var wne=Object.defineProperty;var mO=t=>{throw TypeError(t)};var xne=(t,e,n)=>e in t?wne(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var se=(t,e,n)=>xne(t,typeof e!="symbol"?e+"":e,n),tE=(t,e,n)=>e.has(t)||mO("Cannot "+n);var On=(t,e,n)=>(tE(t,e,"read from private field"),n?n.call(t):e.get(t)),eo=(t,e,n)=>e.has(t)?mO("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ug=(t,e,n,r)=>(tE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Cu=(t,e,n)=>(tE(t,e,"access private method"),n);function pz(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var en=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Cne(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?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 mz={exports:{}},yS={},gz={exports:{}},mn={};/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var $y=Symbol.for("react.element"),_ne=Symbol.for("react.portal"),Sne=Symbol.for("react.fragment"),Ene=Symbol.for("react.strict_mode"),Tne=Symbol.for("react.profiler"),Bne=Symbol.for("react.provider"),Mne=Symbol.for("react.context"),kne=Symbol.for("react.forward_ref"),Rne=Symbol.for("react.suspense"),Pne=Symbol.for("react.memo"),Lne=Symbol.for("react.lazy"),gO=Symbol.iterator;function Ine(t){return t===null||typeof t!="object"?null:(t=gO&&t[gO]||t["@@iterator"],typeof t=="function"?t:null)}var yz={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},vz=Object.assign,bz={};function gg(t,e,n){this.props=t,this.context=e,this.refs=bz,this.updater=n||yz}gg.prototype.isReactComponent={};gg.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};gg.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function wz(){}wz.prototype=gg.prototype;function $R(t,e,n){this.props=t,this.context=e,this.refs=bz,this.updater=n||yz}var qR=$R.prototype=new wz;qR.constructor=$R;vz(qR,gg.prototype);qR.isPureReactComponent=!0;var yO=Array.isArray,xz=Object.prototype.hasOwnProperty,XR={current:null},Cz={key:!0,ref:!0,__self:!0,__source:!0};function _z(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)xz.call(e,r)&&!Cz.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:$y,type:t,key:s,ref:o,props:i,_owner:XR.current}}function One(t,e){return{$$typeof:$y,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function YR(t){return typeof t=="object"&&t!==null&&t.$$typeof===$y}function Fne(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var vO=/\/+/g;function nE(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Fne(""+t.key):e.toString(36)}function Zw(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case $y:case _ne:o=!0}}if(o)return o=t,i=i(o),t=r===""?"."+nE(o,0):r,yO(i)?(n="",t!=null&&(n=t.replace(vO,"$&/")+"/"),Zw(i,e,n,"",function(c){return c})):i!=null&&(YR(i)&&(i=One(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(vO,"$&/")+"/")+t)),e.push(i)),1;if(o=0,r=r===""?".":r+":",yO(t))for(var a=0;a<t.length;a++){s=t[a];var l=r+nE(s,a);o+=Zw(s,e,n,l,i)}else if(l=Ine(t),typeof l=="function")for(t=l.call(t),a=0;!(s=t.next()).done;)s=s.value,l=r+nE(s,a++),o+=Zw(s,e,n,l,i);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Ov(t,e,n){if(t==null)return t;var r=[],i=0;return Zw(t,r,"","",function(s){return e.call(n,s,i++)}),r}function Nne(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var qs={current:null},ex={transition:null},Dne={ReactCurrentDispatcher:qs,ReactCurrentBatchConfig:ex,ReactCurrentOwner:XR};function Sz(){throw Error("act(...) is not supported in production builds of React.")}mn.Children={map:Ov,forEach:function(t,e,n){Ov(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Ov(t,function(){e++}),e},toArray:function(t){return Ov(t,function(e){return e})||[]},only:function(t){if(!YR(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};mn.Component=gg;mn.Fragment=Sne;mn.Profiler=Tne;mn.PureComponent=$R;mn.StrictMode=Ene;mn.Suspense=Rne;mn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Dne;mn.act=Sz;mn.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=vz({},t.props),i=t.key,s=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=XR.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)xz.call(e,l)&&!Cz.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:$y,type:t.type,key:i,ref:s,props:r,_owner:o}};mn.createContext=function(t){return t={$$typeof:Mne,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Bne,_context:t},t.Consumer=t};mn.createElement=_z;mn.createFactory=function(t){var e=_z.bind(null,t);return e.type=t,e};mn.createRef=function(){return{current:null}};mn.forwardRef=function(t){return{$$typeof:kne,render:t}};mn.isValidElement=YR;mn.lazy=function(t){return{$$typeof:Lne,_payload:{_status:-1,_result:t},_init:Nne}};mn.memo=function(t,e){return{$$typeof:Pne,type:t,compare:e===void 0?null:e}};mn.startTransition=function(t){var e=ex.transition;ex.transition={};try{t()}finally{ex.transition=e}};mn.unstable_act=Sz;mn.useCallback=function(t,e){return qs.current.useCallback(t,e)};mn.useContext=function(t){return qs.current.useContext(t)};mn.useDebugValue=function(){};mn.useDeferredValue=function(t){return qs.current.useDeferredValue(t)};mn.useEffect=function(t,e){return qs.current.useEffect(t,e)};mn.useId=function(){return qs.current.useId()};mn.useImperativeHandle=function(t,e,n){return qs.current.useImperativeHandle(t,e,n)};mn.useInsertionEffect=function(t,e){return qs.current.useInsertionEffect(t,e)};mn.useLayoutEffect=function(t,e){return qs.current.useLayoutEffect(t,e)};mn.useMemo=function(t,e){return qs.current.useMemo(t,e)};mn.useReducer=function(t,e,n){return qs.current.useReducer(t,e,n)};mn.useRef=function(t){return qs.current.useRef(t)};mn.useState=function(t){return qs.current.useState(t)};mn.useSyncExternalStore=function(t,e,n){return qs.current.useSyncExternalStore(t,e,n)};mn.useTransition=function(){return qs.current.useTransition()};mn.version="18.3.1";gz.exports=mn;var P=gz.exports;const at=mg(P),hm=pz({__proto__:null,default:at},[P]);/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Une=P,Hne=Symbol.for("react.element"),jne=Symbol.for("react.fragment"),Qne=Object.prototype.hasOwnProperty,zne=Une.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Vne={key:!0,ref:!0,__self:!0,__source:!0};function Ez(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)Qne.call(e,r)&&!Vne.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Hne,type:t,key:s,ref:o,props:i,_owner:zne.current}}yS.Fragment=jne;yS.jsx=Ez;yS.jsxs=Ez;mz.exports=yS;var b=mz.exports,YB={},Tz={exports:{}},Wo={},Bz={exports:{}},Mz={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(t){function e(Y,$){var ee=Y.length;Y.push($);e:for(;0<ee;){var W=ee-1>>>1,ne=Y[W];if(0<i(ne,$))Y[W]=$,Y[ee]=ne,ee=W;else break e}}function n(Y){return Y.length===0?null:Y[0]}function r(Y){if(Y.length===0)return null;var $=Y[0],ee=Y.pop();if(ee!==$){Y[0]=ee;e:for(var W=0,ne=Y.length,Se=ne>>>1;W<Se;){var fe=2*(W+1)-1,ge=Y[fe],Oe=fe+1,Fe=Y[Oe];if(0>i(ge,ee))Oe<ne&&0>i(Fe,ge)?(Y[W]=Fe,Y[Oe]=ee,W=Oe):(Y[W]=ge,Y[fe]=ee,W=fe);else if(Oe<ne&&0>i(Fe,ee))Y[W]=Fe,Y[Oe]=ee,W=Oe;else break e}}return $}function i(Y,$){var ee=Y.sortIndex-$.sortIndex;return ee!==0?ee:Y.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,d=null,f=3,h=!1,A=!1,p=!1,m=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(Y){for(var $=n(c);$!==null;){if($.callback===null)r(c);else if($.startTime<=Y)r(c),$.sortIndex=$.expirationTime,e(l,$);else break;$=n(c)}}function v(Y){if(p=!1,w(Y),!A)if(n(l)!==null)A=!0,I(x);else{var $=n(c);$!==null&&z(v,$.startTime-Y)}}function x(Y,$){A=!1,p&&(p=!1,g(S),S=-1),h=!0;var ee=f;try{for(w($),d=n(l);d!==null&&(!(d.expirationTime>$)||Y&&!R());){var W=d.callback;if(typeof W=="function"){d.callback=null,f=d.priorityLevel;var ne=W(d.expirationTime<=$);$=t.unstable_now(),typeof ne=="function"?d.callback=ne:d===n(l)&&r(l),w($)}else r(l);d=n(l)}if(d!==null)var Se=!0;else{var fe=n(c);fe!==null&&z(v,fe.startTime-$),Se=!1}return Se}finally{d=null,f=ee,h=!1}}var C=!1,_=null,S=-1,E=5,T=-1;function R(){return!(t.unstable_now()-T<E)}function k(){if(_!==null){var Y=t.unstable_now();T=Y;var $=!0;try{$=_(!0,Y)}finally{$?B():(C=!1,_=null)}}else C=!1}var B;if(typeof y=="function")B=function(){y(k)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,F=M.port2;M.port1.onmessage=k,B=function(){F.postMessage(null)}}else B=function(){m(k,0)};function I(Y){_=Y,C||(C=!0,B())}function z(Y,$){S=m(function(){Y(t.unstable_now())},$)}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(Y){Y.callback=null},t.unstable_continueExecution=function(){A||h||(A=!0,I(x))},t.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<Y?Math.floor(1e3/Y):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(Y){switch(f){case 1:case 2:case 3:var $=3;break;default:$=f}var ee=f;f=$;try{return Y()}finally{f=ee}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(Y,$){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var ee=f;f=Y;try{return $()}finally{f=ee}},t.unstable_scheduleCallback=function(Y,$,ee){var W=t.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?W+ee:W):ee=W,Y){case 1:var ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=ee+ne,Y={id:u++,callback:$,priorityLevel:Y,startTime:ee,expirationTime:ne,sortIndex:-1},ee>W?(Y.sortIndex=ee,e(c,Y),n(l)===null&&Y===n(c)&&(p?(g(S),S=-1):p=!0,z(v,ee-W))):(Y.sortIndex=ne,e(l,Y),A||h||(A=!0,I(x))),Y},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(Y){var $=f;return function(){var ee=f;f=$;try{return Y.apply(this,arguments)}finally{f=ee}}}})(Mz);Bz.exports=Mz;var Gne=Bz.exports;/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Wne=P,Vo=Gne;function it(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var kz=new Set,R1={};function tA(t,e){Am(t,e),Am(t+"Capture",e)}function Am(t,e){for(R1[t]=e,t=0;t<e.length;t++)kz.add(e[t])}var Vc=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),JB=Object.prototype.hasOwnProperty,Kne=/^[: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]*$/,bO={},wO={};function $ne(t){return JB.call(wO,t)?!0:JB.call(bO,t)?!1:Kne.test(t)?wO[t]=!0:(bO[t]=!0,!1)}function qne(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Xne(t,e,n,r){if(e===null||typeof e>"u"||qne(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Xs(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var os={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){os[t]=new Xs(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];os[e]=new Xs(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){os[t]=new Xs(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){os[t]=new Xs(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){os[t]=new Xs(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){os[t]=new Xs(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){os[t]=new Xs(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){os[t]=new Xs(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){os[t]=new Xs(t,5,!1,t.toLowerCase(),null,!1,!1)});var JR=/[\-:]([a-z])/g;function ZR(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(JR,ZR);os[e]=new Xs(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(JR,ZR);os[e]=new Xs(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(JR,ZR);os[e]=new Xs(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){os[t]=new Xs(t,1,!1,t.toLowerCase(),null,!1,!1)});os.xlinkHref=new Xs("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){os[t]=new Xs(t,1,!1,t.toLowerCase(),null,!0,!0)});function eP(t,e,n,r){var i=os.hasOwnProperty(e)?os[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Xne(e,n,i,r)&&(n=null),r||i===null?$ne(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var hu=Wne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Fv=Symbol.for("react.element"),dp=Symbol.for("react.portal"),fp=Symbol.for("react.fragment"),tP=Symbol.for("react.strict_mode"),ZB=Symbol.for("react.profiler"),Rz=Symbol.for("react.provider"),Pz=Symbol.for("react.context"),nP=Symbol.for("react.forward_ref"),e3=Symbol.for("react.suspense"),t3=Symbol.for("react.suspense_list"),rP=Symbol.for("react.memo"),Qu=Symbol.for("react.lazy"),Lz=Symbol.for("react.offscreen"),xO=Symbol.iterator;function Hg(t){return t===null||typeof t!="object"?null:(t=xO&&t[xO]||t["@@iterator"],typeof t=="function"?t:null)}var Or=Object.assign,rE;function x0(t){if(rE===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);rE=e&&e[1]||""}return`
`+rE+t}var iE=!1;function sE(t,e){if(!t||iE)return"";iE=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
`),s=r.stack.split(`
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
`+i[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{iE=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?x0(t):""}function Yne(t){switch(t.tag){case 5:return x0(t.type);case 16:return x0("Lazy");case 13:return x0("Suspense");case 19:return x0("SuspenseList");case 0:case 2:case 15:return t=sE(t.type,!1),t;case 11:return t=sE(t.type.render,!1),t;case 1:return t=sE(t.type,!0),t;default:return""}}function n3(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case fp:return"Fragment";case dp:return"Portal";case ZB:return"Profiler";case tP:return"StrictMode";case e3:return"Suspense";case t3:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Pz:return(t.displayName||"Context")+".Consumer";case Rz:return(t._context.displayName||"Context")+".Provider";case nP:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case rP:return e=t.displayName||null,e!==null?e:n3(t.type)||"Memo";case Qu:e=t._payload,t=t._init;try{return n3(t(e))}catch{}}return null}function Jne(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return n3(e);case 8:return e===tP?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Yd(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Iz(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Zne(t){var e=Iz(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Nv(t){t._valueTracker||(t._valueTracker=Zne(t))}function Oz(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Iz(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function nC(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function r3(t,e){var n=e.checked;return Or({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function CO(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Yd(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Fz(t,e){e=e.checked,e!=null&&eP(t,"checked",e,!1)}function i3(t,e){Fz(t,e);var n=Yd(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?s3(t,e.type,n):e.hasOwnProperty("defaultValue")&&s3(t,e.type,Yd(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function _O(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function s3(t,e,n){(e!=="number"||nC(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var C0=Array.isArray;function Up(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Yd(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function o3(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(it(91));return Or({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function SO(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(it(92));if(C0(n)){if(1<n.length)throw Error(it(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Yd(n)}}function Nz(t,e){var n=Yd(e.value),r=Yd(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function EO(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Dz(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function a3(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Dz(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Dv,Uz=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Dv=Dv||document.createElement("div"),Dv.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Dv.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function P1(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var e1={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ere=["Webkit","ms","Moz","O"];Object.keys(e1).forEach(function(t){ere.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),e1[e]=e1[t]})});function Hz(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||e1.hasOwnProperty(t)&&e1[t]?(""+e).trim():e+"px"}function jz(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Hz(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var tre=Or({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function l3(t,e){if(e){if(tre[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(it(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(it(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(it(61))}if(e.style!=null&&typeof e.style!="object")throw Error(it(62))}}function c3(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 u3=null;function iP(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var d3=null,Hp=null,jp=null;function TO(t){if(t=Yy(t)){if(typeof d3!="function")throw Error(it(280));var e=t.stateNode;e&&(e=CS(e),d3(t.stateNode,t.type,e))}}function Qz(t){Hp?jp?jp.push(t):jp=[t]:Hp=t}function zz(){if(Hp){var t=Hp,e=jp;if(jp=Hp=null,TO(t),e)for(t=0;t<e.length;t++)TO(e[t])}}function Vz(t,e){return t(e)}function Gz(){}var oE=!1;function Wz(t,e,n){if(oE)return t(e,n);oE=!0;try{return Vz(t,e,n)}finally{oE=!1,(Hp!==null||jp!==null)&&(Gz(),zz())}}function L1(t,e){var n=t.stateNode;if(n===null)return null;var r=CS(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(it(231,e,typeof n));return n}var f3=!1;if(Vc)try{var jg={};Object.defineProperty(jg,"passive",{get:function(){f3=!0}}),window.addEventListener("test",jg,jg),window.removeEventListener("test",jg,jg)}catch{f3=!1}function nre(t,e,n,r,i,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var t1=!1,rC=null,iC=!1,h3=null,rre={onError:function(t){t1=!0,rC=t}};function ire(t,e,n,r,i,s,o,a,l){t1=!1,rC=null,nre.apply(rre,arguments)}function sre(t,e,n,r,i,s,o,a,l){if(ire.apply(this,arguments),t1){if(t1){var c=rC;t1=!1,rC=null}else throw Error(it(198));iC||(iC=!0,h3=c)}}function nA(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function Kz(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function BO(t){if(nA(t)!==t)throw Error(it(188))}function ore(t){var e=t.alternate;if(!e){if(e=nA(t),e===null)throw Error(it(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return BO(i),t;if(s===r)return BO(i),e;s=s.sibling}throw Error(it(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(it(189))}}if(n.alternate!==r)throw Error(it(190))}if(n.tag!==3)throw Error(it(188));return n.stateNode.current===n?t:e}function $z(t){return t=ore(t),t!==null?qz(t):null}function qz(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=qz(t);if(e!==null)return e;t=t.sibling}return null}var Xz=Vo.unstable_scheduleCallback,MO=Vo.unstable_cancelCallback,are=Vo.unstable_shouldYield,lre=Vo.unstable_requestPaint,Xr=Vo.unstable_now,cre=Vo.unstable_getCurrentPriorityLevel,sP=Vo.unstable_ImmediatePriority,Yz=Vo.unstable_UserBlockingPriority,sC=Vo.unstable_NormalPriority,ure=Vo.unstable_LowPriority,Jz=Vo.unstable_IdlePriority,vS=null,Ul=null;function dre(t){if(Ul&&typeof Ul.onCommitFiberRoot=="function")try{Ul.onCommitFiberRoot(vS,t,void 0,(t.current.flags&128)===128)}catch{}}var qa=Math.clz32?Math.clz32:Are,fre=Math.log,hre=Math.LN2;function Are(t){return t>>>=0,t===0?32:31-(fre(t)/hre|0)|0}var Uv=64,Hv=4194304;function _0(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function oC(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=_0(a):(s&=o,s!==0&&(r=_0(s)))}else o=n&~i,o!==0?r=_0(o):s!==0&&(r=_0(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-qa(e),i=1<<n,r|=t[n],e&=~i;return r}function pre(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function mre(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var o=31-qa(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=pre(a,e)):l<=e&&(t.expiredLanes|=a),s&=~a}}function A3(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Zz(){var t=Uv;return Uv<<=1,!(Uv&4194240)&&(Uv=64),t}function aE(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function qy(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-qa(e),t[e]=n}function gre(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-qa(n),s=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~s}}function oP(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-qa(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var Xn=0;function eV(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var tV,aP,nV,rV,iV,p3=!1,jv=[],Cd=null,_d=null,Sd=null,I1=new Map,O1=new Map,qu=[],yre="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 submit".split(" ");function kO(t,e){switch(t){case"focusin":case"focusout":Cd=null;break;case"dragenter":case"dragleave":_d=null;break;case"mouseover":case"mouseout":Sd=null;break;case"pointerover":case"pointerout":I1.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":O1.delete(e.pointerId)}}function Qg(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=Yy(e),e!==null&&aP(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function vre(t,e,n,r,i){switch(e){case"focusin":return Cd=Qg(Cd,t,e,n,r,i),!0;case"dragenter":return _d=Qg(_d,t,e,n,r,i),!0;case"mouseover":return Sd=Qg(Sd,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return I1.set(s,Qg(I1.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,O1.set(s,Qg(O1.get(s)||null,t,e,n,r,i)),!0}return!1}function sV(t){var e=dh(t.target);if(e!==null){var n=nA(e);if(n!==null){if(e=n.tag,e===13){if(e=Kz(n),e!==null){t.blockedOn=e,iV(t.priority,function(){nV(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function tx(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=m3(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);u3=r,n.target.dispatchEvent(r),u3=null}else return e=Yy(n),e!==null&&aP(e),t.blockedOn=n,!1;e.shift()}return!0}function RO(t,e,n){tx(t)&&n.delete(e)}function bre(){p3=!1,Cd!==null&&tx(Cd)&&(Cd=null),_d!==null&&tx(_d)&&(_d=null),Sd!==null&&tx(Sd)&&(Sd=null),I1.forEach(RO),O1.forEach(RO)}function zg(t,e){t.blockedOn===e&&(t.blockedOn=null,p3||(p3=!0,Vo.unstable_scheduleCallback(Vo.unstable_NormalPriority,bre)))}function F1(t){function e(i){return zg(i,t)}if(0<jv.length){zg(jv[0],t);for(var n=1;n<jv.length;n++){var r=jv[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Cd!==null&&zg(Cd,t),_d!==null&&zg(_d,t),Sd!==null&&zg(Sd,t),I1.forEach(e),O1.forEach(e),n=0;n<qu.length;n++)r=qu[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<qu.length&&(n=qu[0],n.blockedOn===null);)sV(n),n.blockedOn===null&&qu.shift()}var Qp=hu.ReactCurrentBatchConfig,aC=!0;function wre(t,e,n,r){var i=Xn,s=Qp.transition;Qp.transition=null;try{Xn=1,lP(t,e,n,r)}finally{Xn=i,Qp.transition=s}}function xre(t,e,n,r){var i=Xn,s=Qp.transition;Qp.transition=null;try{Xn=4,lP(t,e,n,r)}finally{Xn=i,Qp.transition=s}}function lP(t,e,n,r){if(aC){var i=m3(t,e,n,r);if(i===null)gE(t,e,r,lC,n),kO(t,r);else if(vre(i,t,e,n,r))r.stopPropagation();else if(kO(t,r),e&4&&-1<yre.indexOf(t)){for(;i!==null;){var s=Yy(i);if(s!==null&&tV(s),s=m3(t,e,n,r),s===null&&gE(t,e,r,lC,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else gE(t,e,r,null,n)}}var lC=null;function m3(t,e,n,r){if(lC=null,t=iP(r),t=dh(t),t!==null)if(e=nA(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Kz(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return lC=t,null}function oV(t){switch(t){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(cre()){case sP:return 1;case Yz:return 4;case sC:case ure:return 16;case Jz:return 536870912;default:return 16}default:return 16}}var rd=null,cP=null,nx=null;function aV(){if(nx)return nx;var t,e=cP,n=e.length,r,i="value"in rd?rd.value:rd.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===i[s-r];r++);return nx=i.slice(t,1<r?1-r:void 0)}function rx(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Qv(){return!0}function PO(){return!1}function Ko(t){function e(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Qv:PO,this.isPropagationStopped=PO,this}return Or(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Qv)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Qv)},persist:function(){},isPersistent:Qv}),e}var yg={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},uP=Ko(yg),Xy=Or({},yg,{view:0,detail:0}),Cre=Ko(Xy),lE,cE,Vg,bS=Or({},Xy,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dP,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Vg&&(Vg&&t.type==="mousemove"?(lE=t.screenX-Vg.screenX,cE=t.screenY-Vg.screenY):cE=lE=0,Vg=t),lE)},movementY:function(t){return"movementY"in t?t.movementY:cE}}),LO=Ko(bS),_re=Or({},bS,{dataTransfer:0}),Sre=Ko(_re),Ere=Or({},Xy,{relatedTarget:0}),uE=Ko(Ere),Tre=Or({},yg,{animationName:0,elapsedTime:0,pseudoElement:0}),Bre=Ko(Tre),Mre=Or({},yg,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),kre=Ko(Mre),Rre=Or({},yg,{data:0}),IO=Ko(Rre),Pre={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Lre={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"},Ire={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ore(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=Ire[t])?!!e[t]:!1}function dP(){return Ore}var Fre=Or({},Xy,{key:function(t){if(t.key){var e=Pre[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=rx(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Lre[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dP,charCode:function(t){return t.type==="keypress"?rx(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?rx(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Nre=Ko(Fre),Dre=Or({},bS,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),OO=Ko(Dre),Ure=Or({},Xy,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dP}),Hre=Ko(Ure),jre=Or({},yg,{propertyName:0,elapsedTime:0,pseudoElement:0}),Qre=Ko(jre),zre=Or({},bS,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Vre=Ko(zre),Gre=[9,13,27,32],fP=Vc&&"CompositionEvent"in window,n1=null;Vc&&"documentMode"in document&&(n1=document.documentMode);var Wre=Vc&&"TextEvent"in window&&!n1,lV=Vc&&(!fP||n1&&8<n1&&11>=n1),FO=" ",NO=!1;function cV(t,e){switch(t){case"keyup":return Gre.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uV(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var hp=!1;function Kre(t,e){switch(t){case"compositionend":return uV(e);case"keypress":return e.which!==32?null:(NO=!0,FO);case"textInput":return t=e.data,t===FO&&NO?null:t;default:return null}}function $re(t,e){if(hp)return t==="compositionend"||!fP&&cV(t,e)?(t=aV(),nx=cP=rd=null,hp=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return lV&&e.locale!=="ko"?null:e.data;default:return null}}var qre={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 DO(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!qre[t.type]:e==="textarea"}function dV(t,e,n,r){Qz(r),e=cC(e,"onChange"),0<e.length&&(n=new uP("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var r1=null,N1=null;function Xre(t){xV(t,0)}function wS(t){var e=mp(t);if(Oz(e))return t}function Yre(t,e){if(t==="change")return e}var fV=!1;if(Vc){var dE;if(Vc){var fE="oninput"in document;if(!fE){var UO=document.createElement("div");UO.setAttribute("oninput","return;"),fE=typeof UO.oninput=="function"}dE=fE}else dE=!1;fV=dE&&(!document.documentMode||9<document.documentMode)}function HO(){r1&&(r1.detachEvent("onpropertychange",hV),N1=r1=null)}function hV(t){if(t.propertyName==="value"&&wS(N1)){var e=[];dV(e,N1,t,iP(t)),Wz(Xre,e)}}function Jre(t,e,n){t==="focusin"?(HO(),r1=e,N1=n,r1.attachEvent("onpropertychange",hV)):t==="focusout"&&HO()}function Zre(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return wS(N1)}function eie(t,e){if(t==="click")return wS(e)}function tie(t,e){if(t==="input"||t==="change")return wS(e)}function nie(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Za=typeof Object.is=="function"?Object.is:nie;function D1(t,e){if(Za(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!JB.call(e,i)||!Za(t[i],e[i]))return!1}return!0}function jO(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function QO(t,e){var n=jO(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=jO(n)}}function AV(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?AV(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function pV(){for(var t=window,e=nC();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=nC(t.document)}return e}function hP(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function rie(t){var e=pV(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&AV(n.ownerDocument.documentElement,n)){if(r!==null&&hP(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=QO(n,s);var o=QO(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var iie=Vc&&"documentMode"in document&&11>=document.documentMode,Ap=null,g3=null,i1=null,y3=!1;function zO(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;y3||Ap==null||Ap!==nC(r)||(r=Ap,"selectionStart"in r&&hP(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),i1&&D1(i1,r)||(i1=r,r=cC(g3,"onSelect"),0<r.length&&(e=new uP("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Ap)))}function zv(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var pp={animationend:zv("Animation","AnimationEnd"),animationiteration:zv("Animation","AnimationIteration"),animationstart:zv("Animation","AnimationStart"),transitionend:zv("Transition","TransitionEnd")},hE={},mV={};Vc&&(mV=document.createElement("div").style,"AnimationEvent"in window||(delete pp.animationend.animation,delete pp.animationiteration.animation,delete pp.animationstart.animation),"TransitionEvent"in window||delete pp.transitionend.transition);function xS(t){if(hE[t])return hE[t];if(!pp[t])return t;var e=pp[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in mV)return hE[t]=e[n];return t}var gV=xS("animationend"),yV=xS("animationiteration"),vV=xS("animationstart"),bV=xS("transitionend"),wV=new Map,VO="abort auxClick 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(" ");function bf(t,e){wV.set(t,e),tA(e,[t])}for(var AE=0;AE<VO.length;AE++){var pE=VO[AE],sie=pE.toLowerCase(),oie=pE[0].toUpperCase()+pE.slice(1);bf(sie,"on"+oie)}bf(gV,"onAnimationEnd");bf(yV,"onAnimationIteration");bf(vV,"onAnimationStart");bf("dblclick","onDoubleClick");bf("focusin","onFocus");bf("focusout","onBlur");bf(bV,"onTransitionEnd");Am("onMouseEnter",["mouseout","mouseover"]);Am("onMouseLeave",["mouseout","mouseover"]);Am("onPointerEnter",["pointerout","pointerover"]);Am("onPointerLeave",["pointerout","pointerover"]);tA("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));tA("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));tA("onBeforeInput",["compositionend","keypress","textInput","paste"]);tA("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));tA("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));tA("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var S0="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(" "),aie=new Set("cancel close invalid load scroll toggle".split(" ").concat(S0));function GO(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,sre(r,e,void 0,t),t.currentTarget=null}function xV(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;GO(i,a,c),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;GO(i,a,c),s=l}}}if(iC)throw t=h3,iC=!1,h3=null,t}function dr(t,e){var n=e[C3];n===void 0&&(n=e[C3]=new Set);var r=t+"__bubble";n.has(r)||(CV(e,t,2,!1),n.add(r))}function mE(t,e,n){var r=0;e&&(r|=4),CV(n,t,r,e)}var Vv="_reactListening"+Math.random().toString(36).slice(2);function U1(t){if(!t[Vv]){t[Vv]=!0,kz.forEach(function(n){n!=="selectionchange"&&(aie.has(n)||mE(n,!1,t),mE(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Vv]||(e[Vv]=!0,mE("selectionchange",!1,e))}}function CV(t,e,n,r){switch(oV(e)){case 1:var i=wre;break;case 4:i=xre;break;default:i=lP}n=i.bind(null,e,n,t),i=void 0,!f3||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function gE(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=dh(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}Wz(function(){var c=s,u=iP(n),d=[];e:{var f=wV.get(t);if(f!==void 0){var h=uP,A=t;switch(t){case"keypress":if(rx(n)===0)break e;case"keydown":case"keyup":h=Nre;break;case"focusin":A="focus",h=uE;break;case"focusout":A="blur",h=uE;break;case"beforeblur":case"afterblur":h=uE;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=LO;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=Sre;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=Hre;break;case gV:case yV:case vV:h=Bre;break;case bV:h=Qre;break;case"scroll":h=Cre;break;case"wheel":h=Vre;break;case"copy":case"cut":case"paste":h=kre;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=OO}var p=(e&4)!==0,m=!p&&t==="scroll",g=p?f!==null?f+"Capture":null:f;p=[];for(var y=c,w;y!==null;){w=y;var v=w.stateNode;if(w.tag===5&&v!==null&&(w=v,g!==null&&(v=L1(y,g),v!=null&&p.push(H1(y,v,w)))),m)break;y=y.return}0<p.length&&(f=new h(f,A,null,n,u),d.push({event:f,listeners:p}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",f&&n!==u3&&(A=n.relatedTarget||n.fromElement)&&(dh(A)||A[Gc]))break e;if((h||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,h?(A=n.relatedTarget||n.toElement,h=c,A=A?dh(A):null,A!==null&&(m=nA(A),A!==m||A.tag!==5&&A.tag!==6)&&(A=null)):(h=null,A=c),h!==A)){if(p=LO,v="onMouseLeave",g="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(p=OO,v="onPointerLeave",g="onPointerEnter",y="pointer"),m=h==null?f:mp(h),w=A==null?f:mp(A),f=new p(v,y+"leave",h,n,u),f.target=m,f.relatedTarget=w,v=null,dh(u)===c&&(p=new p(g,y+"enter",A,n,u),p.target=w,p.relatedTarget=m,v=p),m=v,h&&A)t:{for(p=h,g=A,y=0,w=p;w;w=vA(w))y++;for(w=0,v=g;v;v=vA(v))w++;for(;0<y-w;)p=vA(p),y--;for(;0<w-y;)g=vA(g),w--;for(;y--;){if(p===g||g!==null&&p===g.alternate)break t;p=vA(p),g=vA(g)}p=null}else p=null;h!==null&&WO(d,f,h,p,!1),A!==null&&m!==null&&WO(d,m,A,p,!0)}}e:{if(f=c?mp(c):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var x=Yre;else if(DO(f))if(fV)x=tie;else{x=Zre;var C=Jre}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(x=eie);if(x&&(x=x(t,c))){dV(d,x,n,u);break e}C&&C(t,f,c),t==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&s3(f,"number",f.value)}switch(C=c?mp(c):window,t){case"focusin":(DO(C)||C.contentEditable==="true")&&(Ap=C,g3=c,i1=null);break;case"focusout":i1=g3=Ap=null;break;case"mousedown":y3=!0;break;case"contextmenu":case"mouseup":case"dragend":y3=!1,zO(d,n,u);break;case"selectionchange":if(iie)break;case"keydown":case"keyup":zO(d,n,u)}var _;if(fP)e:{switch(t){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else hp?cV(t,n)&&(S="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&(lV&&n.locale!=="ko"&&(hp||S!=="onCompositionStart"?S==="onCompositionEnd"&&hp&&(_=aV()):(rd=u,cP="value"in rd?rd.value:rd.textContent,hp=!0)),C=cC(c,S),0<C.length&&(S=new IO(S,t,null,n,u),d.push({event:S,listeners:C}),_?S.data=_:(_=uV(n),_!==null&&(S.data=_)))),(_=Wre?Kre(t,n):$re(t,n))&&(c=cC(c,"onBeforeInput"),0<c.length&&(u=new IO("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=_))}xV(d,e)})}function H1(t,e,n){return{instance:t,listener:e,currentTarget:n}}function cC(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=L1(t,n),s!=null&&r.unshift(H1(t,s,i)),s=L1(t,e),s!=null&&r.push(H1(t,s,i))),t=t.return}return r}function vA(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function WO(t,e,n,r,i){for(var s=e._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=L1(n,s),l!=null&&o.unshift(H1(n,l,a))):i||(l=L1(n,s),l!=null&&o.push(H1(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var lie=/\r\n?/g,cie=/\u0000|\uFFFD/g;function KO(t){return(typeof t=="string"?t:""+t).replace(lie,`
`).replace(cie,"")}function Gv(t,e,n){if(e=KO(e),KO(t)!==e&&n)throw Error(it(425))}function uC(){}var v3=null,b3=null;function w3(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var x3=typeof setTimeout=="function"?setTimeout:void 0,uie=typeof clearTimeout=="function"?clearTimeout:void 0,$O=typeof Promise=="function"?Promise:void 0,die=typeof queueMicrotask=="function"?queueMicrotask:typeof $O<"u"?function(t){return $O.resolve(null).then(t).catch(fie)}:x3;function fie(t){setTimeout(function(){throw t})}function yE(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),F1(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);F1(e)}function Ed(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function qO(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var vg=Math.random().toString(36).slice(2),Sl="__reactFiber$"+vg,j1="__reactProps$"+vg,Gc="__reactContainer$"+vg,C3="__reactEvents$"+vg,hie="__reactListeners$"+vg,Aie="__reactHandles$"+vg;function dh(t){var e=t[Sl];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Gc]||n[Sl]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=qO(t);t!==null;){if(n=t[Sl])return n;t=qO(t)}return e}t=n,n=t.parentNode}return null}function Yy(t){return t=t[Sl]||t[Gc],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function mp(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(it(33))}function CS(t){return t[j1]||null}var _3=[],gp=-1;function wf(t){return{current:t}}function mr(t){0>gp||(t.current=_3[gp],_3[gp]=null,gp--)}function cr(t,e){gp++,_3[gp]=t.current,t.current=e}var Jd={},Bs=wf(Jd),uo=wf(!1),Ph=Jd;function pm(t,e){var n=t.type.contextTypes;if(!n)return Jd;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function fo(t){return t=t.childContextTypes,t!=null}function dC(){mr(uo),mr(Bs)}function XO(t,e,n){if(Bs.current!==Jd)throw Error(it(168));cr(Bs,e),cr(uo,n)}function _V(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(it(108,Jne(t)||"Unknown",i));return Or({},n,r)}function fC(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Jd,Ph=Bs.current,cr(Bs,t),cr(uo,uo.current),!0}function YO(t,e,n){var r=t.stateNode;if(!r)throw Error(it(169));n?(t=_V(t,e,Ph),r.__reactInternalMemoizedMergedChildContext=t,mr(uo),mr(Bs),cr(Bs,t)):mr(uo),cr(uo,n)}var Mc=null,_S=!1,vE=!1;function SV(t){Mc===null?Mc=[t]:Mc.push(t)}function pie(t){_S=!0,SV(t)}function xf(){if(!vE&&Mc!==null){vE=!0;var t=0,e=Xn;try{var n=Mc;for(Xn=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Mc=null,_S=!1}catch(i){throw Mc!==null&&(Mc=Mc.slice(t+1)),Xz(sP,xf),i}finally{Xn=e,vE=!1}}return null}var yp=[],vp=0,hC=null,AC=0,na=[],ra=0,Lh=null,Lc=1,Ic="";function Vf(t,e){yp[vp++]=AC,yp[vp++]=hC,hC=t,AC=e}function EV(t,e,n){na[ra++]=Lc,na[ra++]=Ic,na[ra++]=Lh,Lh=t;var r=Lc;t=Ic;var i=32-qa(r)-1;r&=~(1<<i),n+=1;var s=32-qa(e)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Lc=1<<32-qa(e)+i|n<<i|r,Ic=s+t}else Lc=1<<s|n<<i|r,Ic=t}function AP(t){t.return!==null&&(Vf(t,1),EV(t,1,0))}function pP(t){for(;t===hC;)hC=yp[--vp],yp[vp]=null,AC=yp[--vp],yp[vp]=null;for(;t===Lh;)Lh=na[--ra],na[ra]=null,Ic=na[--ra],na[ra]=null,Lc=na[--ra],na[ra]=null}var Uo=null,Fo=null,Cr=!1,Ua=null;function TV(t,e){var n=ca(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function JO(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Uo=t,Fo=Ed(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Uo=t,Fo=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Lh!==null?{id:Lc,overflow:Ic}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=ca(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Uo=t,Fo=null,!0):!1;default:return!1}}function S3(t){return(t.mode&1)!==0&&(t.flags&128)===0}function E3(t){if(Cr){var e=Fo;if(e){var n=e;if(!JO(t,e)){if(S3(t))throw Error(it(418));e=Ed(n.nextSibling);var r=Uo;e&&JO(t,e)?TV(r,n):(t.flags=t.flags&-4097|2,Cr=!1,Uo=t)}}else{if(S3(t))throw Error(it(418));t.flags=t.flags&-4097|2,Cr=!1,Uo=t}}}function ZO(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Uo=t}function Wv(t){if(t!==Uo)return!1;if(!Cr)return ZO(t),Cr=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!w3(t.type,t.memoizedProps)),e&&(e=Fo)){if(S3(t))throw BV(),Error(it(418));for(;e;)TV(t,e),e=Ed(e.nextSibling)}if(ZO(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(it(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Fo=Ed(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Fo=null}}else Fo=Uo?Ed(t.stateNode.nextSibling):null;return!0}function BV(){for(var t=Fo;t;)t=Ed(t.nextSibling)}function mm(){Fo=Uo=null,Cr=!1}function mP(t){Ua===null?Ua=[t]:Ua.push(t)}var mie=hu.ReactCurrentBatchConfig;function Gg(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(it(309));var r=n.stateNode}if(!r)throw Error(it(147,t));var i=r,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof t!="string")throw Error(it(284));if(!n._owner)throw Error(it(290,t))}return t}function Kv(t,e){throw t=Object.prototype.toString.call(e),Error(it(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function eF(t){var e=t._init;return e(t._payload)}function MV(t){function e(g,y){if(t){var w=g.deletions;w===null?(g.deletions=[y],g.flags|=16):w.push(y)}}function n(g,y){if(!t)return null;for(;y!==null;)e(g,y),y=y.sibling;return null}function r(g,y){for(g=new Map;y!==null;)y.key!==null?g.set(y.key,y):g.set(y.index,y),y=y.sibling;return g}function i(g,y){return g=kd(g,y),g.index=0,g.sibling=null,g}function s(g,y,w){return g.index=w,t?(w=g.alternate,w!==null?(w=w.index,w<y?(g.flags|=2,y):w):(g.flags|=2,y)):(g.flags|=1048576,y)}function o(g){return t&&g.alternate===null&&(g.flags|=2),g}function a(g,y,w,v){return y===null||y.tag!==6?(y=EE(w,g.mode,v),y.return=g,y):(y=i(y,w),y.return=g,y)}function l(g,y,w,v){var x=w.type;return x===fp?u(g,y,w.props.children,v,w.key):y!==null&&(y.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Qu&&eF(x)===y.type)?(v=i(y,w.props),v.ref=Gg(g,y,w),v.return=g,v):(v=ux(w.type,w.key,w.props,null,g.mode,v),v.ref=Gg(g,y,w),v.return=g,v)}function c(g,y,w,v){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=TE(w,g.mode,v),y.return=g,y):(y=i(y,w.children||[]),y.return=g,y)}function u(g,y,w,v,x){return y===null||y.tag!==7?(y=wh(w,g.mode,v,x),y.return=g,y):(y=i(y,w),y.return=g,y)}function d(g,y,w){if(typeof y=="string"&&y!==""||typeof y=="number")return y=EE(""+y,g.mode,w),y.return=g,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Fv:return w=ux(y.type,y.key,y.props,null,g.mode,w),w.ref=Gg(g,null,y),w.return=g,w;case dp:return y=TE(y,g.mode,w),y.return=g,y;case Qu:var v=y._init;return d(g,v(y._payload),w)}if(C0(y)||Hg(y))return y=wh(y,g.mode,w,null),y.return=g,y;Kv(g,y)}return null}function f(g,y,w,v){var x=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return x!==null?null:a(g,y,""+w,v);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Fv:return w.key===x?l(g,y,w,v):null;case dp:return w.key===x?c(g,y,w,v):null;case Qu:return x=w._init,f(g,y,x(w._payload),v)}if(C0(w)||Hg(w))return x!==null?null:u(g,y,w,v,null);Kv(g,w)}return null}function h(g,y,w,v,x){if(typeof v=="string"&&v!==""||typeof v=="number")return g=g.get(w)||null,a(y,g,""+v,x);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Fv:return g=g.get(v.key===null?w:v.key)||null,l(y,g,v,x);case dp:return g=g.get(v.key===null?w:v.key)||null,c(y,g,v,x);case Qu:var C=v._init;return h(g,y,w,C(v._payload),x)}if(C0(v)||Hg(v))return g=g.get(w)||null,u(y,g,v,x,null);Kv(y,v)}return null}function A(g,y,w,v){for(var x=null,C=null,_=y,S=y=0,E=null;_!==null&&S<w.length;S++){_.index>S?(E=_,_=null):E=_.sibling;var T=f(g,_,w[S],v);if(T===null){_===null&&(_=E);break}t&&_&&T.alternate===null&&e(g,_),y=s(T,y,S),C===null?x=T:C.sibling=T,C=T,_=E}if(S===w.length)return n(g,_),Cr&&Vf(g,S),x;if(_===null){for(;S<w.length;S++)_=d(g,w[S],v),_!==null&&(y=s(_,y,S),C===null?x=_:C.sibling=_,C=_);return Cr&&Vf(g,S),x}for(_=r(g,_);S<w.length;S++)E=h(_,g,S,w[S],v),E!==null&&(t&&E.alternate!==null&&_.delete(E.key===null?S:E.key),y=s(E,y,S),C===null?x=E:C.sibling=E,C=E);return t&&_.forEach(function(R){return e(g,R)}),Cr&&Vf(g,S),x}function p(g,y,w,v){var x=Hg(w);if(typeof x!="function")throw Error(it(150));if(w=x.call(w),w==null)throw Error(it(151));for(var C=x=null,_=y,S=y=0,E=null,T=w.next();_!==null&&!T.done;S++,T=w.next()){_.index>S?(E=_,_=null):E=_.sibling;var R=f(g,_,T.value,v);if(R===null){_===null&&(_=E);break}t&&_&&R.alternate===null&&e(g,_),y=s(R,y,S),C===null?x=R:C.sibling=R,C=R,_=E}if(T.done)return n(g,_),Cr&&Vf(g,S),x;if(_===null){for(;!T.done;S++,T=w.next())T=d(g,T.value,v),T!==null&&(y=s(T,y,S),C===null?x=T:C.sibling=T,C=T);return Cr&&Vf(g,S),x}for(_=r(g,_);!T.done;S++,T=w.next())T=h(_,g,S,T.value,v),T!==null&&(t&&T.alternate!==null&&_.delete(T.key===null?S:T.key),y=s(T,y,S),C===null?x=T:C.sibling=T,C=T);return t&&_.forEach(function(k){return e(g,k)}),Cr&&Vf(g,S),x}function m(g,y,w,v){if(typeof w=="object"&&w!==null&&w.type===fp&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Fv:e:{for(var x=w.key,C=y;C!==null;){if(C.key===x){if(x=w.type,x===fp){if(C.tag===7){n(g,C.sibling),y=i(C,w.props.children),y.return=g,g=y;break e}}else if(C.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Qu&&eF(x)===C.type){n(g,C.sibling),y=i(C,w.props),y.ref=Gg(g,C,w),y.return=g,g=y;break e}n(g,C);break}else e(g,C);C=C.sibling}w.type===fp?(y=wh(w.props.children,g.mode,v,w.key),y.return=g,g=y):(v=ux(w.type,w.key,w.props,null,g.mode,v),v.ref=Gg(g,y,w),v.return=g,g=v)}return o(g);case dp:e:{for(C=w.key;y!==null;){if(y.key===C)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(g,y.sibling),y=i(y,w.children||[]),y.return=g,g=y;break e}else{n(g,y);break}else e(g,y);y=y.sibling}y=TE(w,g.mode,v),y.return=g,g=y}return o(g);case Qu:return C=w._init,m(g,y,C(w._payload),v)}if(C0(w))return A(g,y,w,v);if(Hg(w))return p(g,y,w,v);Kv(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(n(g,y.sibling),y=i(y,w),y.return=g,g=y):(n(g,y),y=EE(w,g.mode,v),y.return=g,g=y),o(g)):n(g,y)}return m}var gm=MV(!0),kV=MV(!1),pC=wf(null),mC=null,bp=null,gP=null;function yP(){gP=bp=mC=null}function vP(t){var e=pC.current;mr(pC),t._currentValue=e}function T3(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function zp(t,e){mC=t,gP=bp=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(oo=!0),t.firstContext=null)}function wa(t){var e=t._currentValue;if(gP!==t)if(t={context:t,memoizedValue:e,next:null},bp===null){if(mC===null)throw Error(it(308));bp=t,mC.dependencies={lanes:0,firstContext:t}}else bp=bp.next=t;return e}var fh=null;function bP(t){fh===null?fh=[t]:fh.push(t)}function RV(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,bP(e)):(n.next=i.next,i.next=n),e.interleaved=n,Wc(t,r)}function Wc(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var zu=!1;function wP(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function PV(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Dc(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Td(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,kn&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Wc(t,n)}return i=r.interleaved,i===null?(e.next=e,bP(r)):(e.next=i.next,i.next=e),r.interleaved=e,Wc(t,n)}function ix(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,oP(t,n)}}function tF(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function gC(t,e,n,r){var i=t.updateQueue;zu=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=t.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;o=0,u=c=l=null,a=s;do{var f=a.lane,h=a.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var A=t,p=a;switch(f=e,h=n,p.tag){case 1:if(A=p.payload,typeof A=="function"){d=A.call(h,d,f);break e}d=A;break e;case 3:A.flags=A.flags&-65537|128;case 0:if(A=p.payload,f=typeof A=="function"?A.call(h,d,f):A,f==null)break e;d=Or({},d,f);break e;case 2:zu=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else h={eventTime:h,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=h,l=d):u=u.next=h,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(u===null&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Oh|=o,t.lanes=o,t.memoizedState=d}}function nF(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(it(191,i));i.call(r)}}}var Jy={},Hl=wf(Jy),Q1=wf(Jy),z1=wf(Jy);function hh(t){if(t===Jy)throw Error(it(174));return t}function xP(t,e){switch(cr(z1,e),cr(Q1,t),cr(Hl,Jy),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:a3(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=a3(e,t)}mr(Hl),cr(Hl,e)}function ym(){mr(Hl),mr(Q1),mr(z1)}function LV(t){hh(z1.current);var e=hh(Hl.current),n=a3(e,t.type);e!==n&&(cr(Q1,t),cr(Hl,n))}function CP(t){Q1.current===t&&(mr(Hl),mr(Q1))}var Pr=wf(0);function yC(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var bE=[];function _P(){for(var t=0;t<bE.length;t++)bE[t]._workInProgressVersionPrimary=null;bE.length=0}var sx=hu.ReactCurrentDispatcher,wE=hu.ReactCurrentBatchConfig,Ih=0,Ir=null,pi=null,Ri=null,vC=!1,s1=!1,V1=0,gie=0;function us(){throw Error(it(321))}function SP(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Za(t[n],e[n]))return!1;return!0}function EP(t,e,n,r,i,s){if(Ih=s,Ir=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,sx.current=t===null||t.memoizedState===null?wie:xie,t=n(r,i),s1){s=0;do{if(s1=!1,V1=0,25<=s)throw Error(it(301));s+=1,Ri=pi=null,e.updateQueue=null,sx.current=Cie,t=n(r,i)}while(s1)}if(sx.current=bC,e=pi!==null&&pi.next!==null,Ih=0,Ri=pi=Ir=null,vC=!1,e)throw Error(it(300));return t}function TP(){var t=V1!==0;return V1=0,t}function pl(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ri===null?Ir.memoizedState=Ri=t:Ri=Ri.next=t,Ri}function xa(){if(pi===null){var t=Ir.alternate;t=t!==null?t.memoizedState:null}else t=pi.next;var e=Ri===null?Ir.memoizedState:Ri.next;if(e!==null)Ri=e,pi=t;else{if(t===null)throw Error(it(310));pi=t,t={memoizedState:pi.memoizedState,baseState:pi.baseState,baseQueue:pi.baseQueue,queue:pi.queue,next:null},Ri===null?Ir.memoizedState=Ri=t:Ri=Ri.next=t}return Ri}function G1(t,e){return typeof e=="function"?e(t):e}function xE(t){var e=xa(),n=e.queue;if(n===null)throw Error(it(311));n.lastRenderedReducer=t;var r=pi,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,c=s;do{var u=c.lane;if((Ih&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=d,o=r):l=l.next=d,Ir.lanes|=u,Oh|=u}c=c.next}while(c!==null&&c!==s);l===null?o=r:l.next=a,Za(r,e.memoizedState)||(oo=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do s=i.lane,Ir.lanes|=s,Oh|=s,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function CE(t){var e=xa(),n=e.queue;if(n===null)throw Error(it(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=t(s,o.action),o=o.next;while(o!==i);Za(s,e.memoizedState)||(oo=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function IV(){}function OV(t,e){var n=Ir,r=xa(),i=e(),s=!Za(r.memoizedState,i);if(s&&(r.memoizedState=i,oo=!0),r=r.queue,BP(DV.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||Ri!==null&&Ri.memoizedState.tag&1){if(n.flags|=2048,W1(9,NV.bind(null,n,r,i,e),void 0,null),Ii===null)throw Error(it(349));Ih&30||FV(n,e,i)}return i}function FV(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Ir.updateQueue,e===null?(e={lastEffect:null,stores:null},Ir.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function NV(t,e,n,r){e.value=n,e.getSnapshot=r,UV(e)&&HV(t)}function DV(t,e,n){return n(function(){UV(e)&&HV(t)})}function UV(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Za(t,n)}catch{return!0}}function HV(t){var e=Wc(t,1);e!==null&&Xa(e,t,1,-1)}function rF(t){var e=pl();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:G1,lastRenderedState:t},e.queue=t,t=t.dispatch=bie.bind(null,Ir,t),[e.memoizedState,t]}function W1(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Ir.updateQueue,e===null?(e={lastEffect:null,stores:null},Ir.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function jV(){return xa().memoizedState}function ox(t,e,n,r){var i=pl();Ir.flags|=t,i.memoizedState=W1(1|e,n,void 0,r===void 0?null:r)}function SS(t,e,n,r){var i=xa();r=r===void 0?null:r;var s=void 0;if(pi!==null){var o=pi.memoizedState;if(s=o.destroy,r!==null&&SP(r,o.deps)){i.memoizedState=W1(e,n,s,r);return}}Ir.flags|=t,i.memoizedState=W1(1|e,n,s,r)}function iF(t,e){return ox(8390656,8,t,e)}function BP(t,e){return SS(2048,8,t,e)}function QV(t,e){return SS(4,2,t,e)}function zV(t,e){return SS(4,4,t,e)}function VV(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function GV(t,e,n){return n=n!=null?n.concat([t]):null,SS(4,4,VV.bind(null,e,t),n)}function MP(){}function WV(t,e){var n=xa();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&SP(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function KV(t,e){var n=xa();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&SP(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function $V(t,e,n){return Ih&21?(Za(n,e)||(n=Zz(),Ir.lanes|=n,Oh|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,oo=!0),t.memoizedState=n)}function yie(t,e){var n=Xn;Xn=n!==0&&4>n?n:4,t(!0);var r=wE.transition;wE.transition={};try{t(!1),e()}finally{Xn=n,wE.transition=r}}function qV(){return xa().memoizedState}function vie(t,e,n){var r=Md(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},XV(t))YV(e,n);else if(n=RV(t,e,n,r),n!==null){var i=Gs();Xa(n,t,r,i),JV(n,e,r)}}function bie(t,e,n){var r=Md(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(XV(t))YV(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,Za(a,o)){var l=e.interleaved;l===null?(i.next=i,bP(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=RV(t,e,i,r),n!==null&&(i=Gs(),Xa(n,t,r,i),JV(n,e,r))}}function XV(t){var e=t.alternate;return t===Ir||e!==null&&e===Ir}function YV(t,e){s1=vC=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function JV(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,oP(t,n)}}var bC={readContext:wa,useCallback:us,useContext:us,useEffect:us,useImperativeHandle:us,useInsertionEffect:us,useLayoutEffect:us,useMemo:us,useReducer:us,useRef:us,useState:us,useDebugValue:us,useDeferredValue:us,useTransition:us,useMutableSource:us,useSyncExternalStore:us,useId:us,unstable_isNewReconciler:!1},wie={readContext:wa,useCallback:function(t,e){return pl().memoizedState=[t,e===void 0?null:e],t},useContext:wa,useEffect:iF,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,ox(4194308,4,VV.bind(null,e,t),n)},useLayoutEffect:function(t,e){return ox(4194308,4,t,e)},useInsertionEffect:function(t,e){return ox(4,2,t,e)},useMemo:function(t,e){var n=pl();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=pl();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=vie.bind(null,Ir,t),[r.memoizedState,t]},useRef:function(t){var e=pl();return t={current:t},e.memoizedState=t},useState:rF,useDebugValue:MP,useDeferredValue:function(t){return pl().memoizedState=t},useTransition:function(){var t=rF(!1),e=t[0];return t=yie.bind(null,t[1]),pl().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Ir,i=pl();if(Cr){if(n===void 0)throw Error(it(407));n=n()}else{if(n=e(),Ii===null)throw Error(it(349));Ih&30||FV(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,iF(DV.bind(null,r,s,t),[t]),r.flags|=2048,W1(9,NV.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=pl(),e=Ii.identifierPrefix;if(Cr){var n=Ic,r=Lc;n=(r&~(1<<32-qa(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=V1++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=gie++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},xie={readContext:wa,useCallback:WV,useContext:wa,useEffect:BP,useImperativeHandle:GV,useInsertionEffect:QV,useLayoutEffect:zV,useMemo:KV,useReducer:xE,useRef:jV,useState:function(){return xE(G1)},useDebugValue:MP,useDeferredValue:function(t){var e=xa();return $V(e,pi.memoizedState,t)},useTransition:function(){var t=xE(G1)[0],e=xa().memoizedState;return[t,e]},useMutableSource:IV,useSyncExternalStore:OV,useId:qV,unstable_isNewReconciler:!1},Cie={readContext:wa,useCallback:WV,useContext:wa,useEffect:BP,useImperativeHandle:GV,useInsertionEffect:QV,useLayoutEffect:zV,useMemo:KV,useReducer:CE,useRef:jV,useState:function(){return CE(G1)},useDebugValue:MP,useDeferredValue:function(t){var e=xa();return pi===null?e.memoizedState=t:$V(e,pi.memoizedState,t)},useTransition:function(){var t=CE(G1)[0],e=xa().memoizedState;return[t,e]},useMutableSource:IV,useSyncExternalStore:OV,useId:qV,unstable_isNewReconciler:!1};function Fa(t,e){if(t&&t.defaultProps){e=Or({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function B3(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Or({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var ES={isMounted:function(t){return(t=t._reactInternals)?nA(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Gs(),i=Md(t),s=Dc(r,i);s.payload=e,n!=null&&(s.callback=n),e=Td(t,s,i),e!==null&&(Xa(e,t,i,r),ix(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Gs(),i=Md(t),s=Dc(r,i);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=Td(t,s,i),e!==null&&(Xa(e,t,i,r),ix(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Gs(),r=Md(t),i=Dc(n,r);i.tag=2,e!=null&&(i.callback=e),e=Td(t,i,r),e!==null&&(Xa(e,t,r,n),ix(e,t,r))}};function sF(t,e,n,r,i,s,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,o):e.prototype&&e.prototype.isPureReactComponent?!D1(n,r)||!D1(i,s):!0}function ZV(t,e,n){var r=!1,i=Jd,s=e.contextType;return typeof s=="object"&&s!==null?s=wa(s):(i=fo(e)?Ph:Bs.current,r=e.contextTypes,s=(r=r!=null)?pm(t,i):Jd),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=ES,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function oF(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&ES.enqueueReplaceState(e,e.state,null)}function M3(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},wP(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=wa(s):(s=fo(e)?Ph:Bs.current,i.context=pm(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(B3(t,e,s,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&ES.enqueueReplaceState(i,i.state,null),gC(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function vm(t,e){try{var n="",r=e;do n+=Yne(r),r=r.return;while(r);var i=n}catch(s){i=`
Error generating stack: `+s.message+`
`+s.stack}return{value:t,source:e,stack:i,digest:null}}function _E(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function k3(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var _ie=typeof WeakMap=="function"?WeakMap:Map;function eG(t,e,n){n=Dc(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){xC||(xC=!0,H3=r),k3(t,e)},n}function tG(t,e,n){n=Dc(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){k3(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){k3(t,e),typeof r!="function"&&(Bd===null?Bd=new Set([this]):Bd.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function aF(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new _ie;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=Die.bind(null,t,e,n),e.then(t,t))}function lF(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function cF(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=Dc(-1,1),e.tag=2,Td(n,e,1))),n.lanes|=1),t)}var Sie=hu.ReactCurrentOwner,oo=!1;function Ds(t,e,n,r){e.child=t===null?kV(e,null,n,r):gm(e,t.child,n,r)}function uF(t,e,n,r,i){n=n.render;var s=e.ref;return zp(e,i),r=EP(t,e,n,r,s,i),n=TP(),t!==null&&!oo?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Kc(t,e,i)):(Cr&&n&&AP(e),e.flags|=1,Ds(t,e,r,i),e.child)}function dF(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!NP(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,nG(t,e,s,r,i)):(t=ux(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:D1,n(o,r)&&t.ref===e.ref)return Kc(t,e,i)}return e.flags|=1,t=kd(s,r),t.ref=e.ref,t.return=e,e.child=t}function nG(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(D1(s,r)&&t.ref===e.ref)if(oo=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(oo=!0);else return e.lanes=t.lanes,Kc(t,e,i)}return R3(t,e,n,r,i)}function rG(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},cr(xp,Bo),Bo|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,cr(xp,Bo),Bo|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,cr(xp,Bo),Bo|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,cr(xp,Bo),Bo|=r;return Ds(t,e,i,n),e.child}function iG(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function R3(t,e,n,r,i){var s=fo(n)?Ph:Bs.current;return s=pm(e,s),zp(e,i),n=EP(t,e,n,r,s,i),r=TP(),t!==null&&!oo?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Kc(t,e,i)):(Cr&&r&&AP(e),e.flags|=1,Ds(t,e,n,i),e.child)}function fF(t,e,n,r,i){if(fo(n)){var s=!0;fC(e)}else s=!1;if(zp(e,i),e.stateNode===null)ax(t,e),ZV(e,n,r),M3(e,n,r,i),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=wa(c):(c=fo(n)?Ph:Bs.current,c=pm(e,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==c)&&oF(e,o,r,c),zu=!1;var f=e.memoizedState;o.state=f,gC(e,r,o,i),l=e.memoizedState,a!==r||f!==l||uo.current||zu?(typeof u=="function"&&(B3(e,n,u,r),l=e.memoizedState),(a=zu||sF(e,n,a,r,f,l,c))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,PV(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Fa(e.type,a),o.props=c,d=e.pendingProps,f=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=wa(l):(l=fo(n)?Ph:Bs.current,l=pm(e,l));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||f!==l)&&oF(e,o,r,l),zu=!1,f=e.memoizedState,o.state=f,gC(e,r,o,i);var A=e.memoizedState;a!==d||f!==A||uo.current||zu?(typeof h=="function"&&(B3(e,n,h,r),A=e.memoizedState),(c=zu||sF(e,n,c,r,f,A,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,A,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,A,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=A),o.props=r,o.state=A,o.context=l,r=c):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return P3(t,e,n,r,s,i)}function P3(t,e,n,r,i,s){iG(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&YO(e,n,!1),Kc(t,e,s);r=e.stateNode,Sie.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=gm(e,t.child,null,s),e.child=gm(e,null,a,s)):Ds(t,e,a,s),e.memoizedState=r.state,i&&YO(e,n,!0),e.child}function sG(t){var e=t.stateNode;e.pendingContext?XO(t,e.pendingContext,e.pendingContext!==e.context):e.context&&XO(t,e.context,!1),xP(t,e.containerInfo)}function hF(t,e,n,r,i){return mm(),mP(i),e.flags|=256,Ds(t,e,n,r),e.child}var L3={dehydrated:null,treeContext:null,retryLane:0};function I3(t){return{baseLanes:t,cachePool:null,transitions:null}}function oG(t,e,n){var r=e.pendingProps,i=Pr.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),cr(Pr,i&1),t===null)return E3(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=MS(o,r,0,null),t=wh(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=I3(n),e.memoizedState=L3,t):kP(e,o));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return Eie(t,e,o,r,a,i,n);if(s){s=r.fallback,o=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=kd(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=kd(a,s):(s=wh(s,o,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=t.child.memoizedState,o=o===null?I3(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~n,e.memoizedState=L3,r}return s=t.child,t=s.sibling,r=kd(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function kP(t,e){return e=MS({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function $v(t,e,n,r){return r!==null&&mP(r),gm(e,t.child,null,n),t=kP(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Eie(t,e,n,r,i,s,o){if(n)return e.flags&256?(e.flags&=-257,r=_E(Error(it(422))),$v(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=MS({mode:"visible",children:r.children},i,0,null),s=wh(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&gm(e,t.child,null,o),e.child.memoizedState=I3(o),e.memoizedState=L3,s);if(!(e.mode&1))return $v(t,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(it(419)),r=_E(s,r,void 0),$v(t,e,o,r)}if(a=(o&t.childLanes)!==0,oo||a){if(r=Ii,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Wc(t,i),Xa(r,t,i,-1))}return FP(),r=_E(Error(it(421))),$v(t,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=Uie.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,Fo=Ed(i.nextSibling),Uo=e,Cr=!0,Ua=null,t!==null&&(na[ra++]=Lc,na[ra++]=Ic,na[ra++]=Lh,Lc=t.id,Ic=t.overflow,Lh=e),e=kP(e,r.children),e.flags|=4096,e)}function AF(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),T3(t.return,e,n)}function SE(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function aG(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(Ds(t,e,r.children,n),r=Pr.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&AF(t,n,e);else if(t.tag===19)AF(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(cr(Pr,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&yC(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),SE(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&yC(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}SE(e,!0,n,null,s);break;case"together":SE(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ax(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Kc(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Oh|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(it(153));if(e.child!==null){for(t=e.child,n=kd(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=kd(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Tie(t,e,n){switch(e.tag){case 3:sG(e),mm();break;case 5:LV(e);break;case 1:fo(e.type)&&fC(e);break;case 4:xP(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;cr(pC,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(cr(Pr,Pr.current&1),e.flags|=128,null):n&e.child.childLanes?oG(t,e,n):(cr(Pr,Pr.current&1),t=Kc(t,e,n),t!==null?t.sibling:null);cr(Pr,Pr.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return aG(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),cr(Pr,Pr.current),r)break;return null;case 22:case 23:return e.lanes=0,rG(t,e,n)}return Kc(t,e,n)}var lG,O3,cG,uG;lG=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};O3=function(){};cG=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,hh(Hl.current);var s=null;switch(n){case"input":i=r3(t,i),r=r3(t,r),s=[];break;case"select":i=Or({},i,{value:void 0}),r=Or({},r,{value:void 0}),s=[];break;case"textarea":i=o3(t,i),r=o3(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=uC)}l3(n,r);var o;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(R1.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(R1.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&dr("scroll",t),s||a===l||(s=[])):(s=s||[]).push(c,l))}n&&(s=s||[]).push("style",n);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};uG=function(t,e,n,r){n!==r&&(e.flags|=4)};function Wg(t,e){if(!Cr)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function ds(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function Bie(t,e,n){var r=e.pendingProps;switch(pP(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ds(e),null;case 1:return fo(e.type)&&dC(),ds(e),null;case 3:return r=e.stateNode,ym(),mr(uo),mr(Bs),_P(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Wv(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Ua!==null&&(z3(Ua),Ua=null))),O3(t,e),ds(e),null;case 5:CP(e);var i=hh(z1.current);if(n=e.type,t!==null&&e.stateNode!=null)cG(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(it(166));return ds(e),null}if(t=hh(Hl.current),Wv(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[Sl]=e,r[j1]=s,t=(e.mode&1)!==0,n){case"dialog":dr("cancel",r),dr("close",r);break;case"iframe":case"object":case"embed":dr("load",r);break;case"video":case"audio":for(i=0;i<S0.length;i++)dr(S0[i],r);break;case"source":dr("error",r);break;case"img":case"image":case"link":dr("error",r),dr("load",r);break;case"details":dr("toggle",r);break;case"input":CO(r,s),dr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},dr("invalid",r);break;case"textarea":SO(r,s),dr("invalid",r)}l3(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Gv(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Gv(r.textContent,a,t),i=["children",""+a]):R1.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&dr("scroll",r)}switch(n){case"input":Nv(r),_O(r,s,!0);break;case"textarea":Nv(r),EO(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=uC)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Dz(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Sl]=e,t[j1]=r,lG(t,e,!1,!1),e.stateNode=t;e:{switch(o=c3(n,r),n){case"dialog":dr("cancel",t),dr("close",t),i=r;break;case"iframe":case"object":case"embed":dr("load",t),i=r;break;case"video":case"audio":for(i=0;i<S0.length;i++)dr(S0[i],t);i=r;break;case"source":dr("error",t),i=r;break;case"img":case"image":case"link":dr("error",t),dr("load",t),i=r;break;case"details":dr("toggle",t),i=r;break;case"input":CO(t,r),i=r3(t,r),dr("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=Or({},r,{value:void 0}),dr("invalid",t);break;case"textarea":SO(t,r),i=o3(t,r),dr("invalid",t);break;default:i=r}l3(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?jz(t,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Uz(t,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&P1(t,l):typeof l=="number"&&P1(t,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(R1.hasOwnProperty(s)?l!=null&&s==="onScroll"&&dr("scroll",t):l!=null&&eP(t,s,l,o))}switch(n){case"input":Nv(t),_O(t,r,!1);break;case"textarea":Nv(t),EO(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Yd(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?Up(t,!!r.multiple,s,!1):r.defaultValue!=null&&Up(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=uC)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return ds(e),null;case 6:if(t&&e.stateNode!=null)uG(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(it(166));if(n=hh(z1.current),hh(Hl.current),Wv(e)){if(r=e.stateNode,n=e.memoizedProps,r[Sl]=e,(s=r.nodeValue!==n)&&(t=Uo,t!==null))switch(t.tag){case 3:Gv(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Gv(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Sl]=e,e.stateNode=r}return ds(e),null;case 13:if(mr(Pr),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Cr&&Fo!==null&&e.mode&1&&!(e.flags&128))BV(),mm(),e.flags|=98560,s=!1;else if(s=Wv(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(it(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(it(317));s[Sl]=e}else mm(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;ds(e),s=!1}else Ua!==null&&(z3(Ua),Ua=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Pr.current&1?wi===0&&(wi=3):FP())),e.updateQueue!==null&&(e.flags|=4),ds(e),null);case 4:return ym(),O3(t,e),t===null&&U1(e.stateNode.containerInfo),ds(e),null;case 10:return vP(e.type._context),ds(e),null;case 17:return fo(e.type)&&dC(),ds(e),null;case 19:if(mr(Pr),s=e.memoizedState,s===null)return ds(e),null;if(r=(e.flags&128)!==0,o=s.rendering,o===null)if(r)Wg(s,!1);else{if(wi!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=yC(t),o!==null){for(e.flags|=128,Wg(s,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)s=n,t=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,t=o.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return cr(Pr,Pr.current&1|2),e.child}t=t.sibling}s.tail!==null&&Xr()>bm&&(e.flags|=128,r=!0,Wg(s,!1),e.lanes=4194304)}else{if(!r)if(t=yC(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Wg(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Cr)return ds(e),null}else 2*Xr()-s.renderingStartTime>bm&&n!==1073741824&&(e.flags|=128,r=!0,Wg(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Xr(),e.sibling=null,n=Pr.current,cr(Pr,r?n&1|2:n&1),e):(ds(e),null);case 22:case 23:return OP(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Bo&1073741824&&(ds(e),e.subtreeFlags&6&&(e.flags|=8192)):ds(e),null;case 24:return null;case 25:return null}throw Error(it(156,e.tag))}function Mie(t,e){switch(pP(e),e.tag){case 1:return fo(e.type)&&dC(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ym(),mr(uo),mr(Bs),_P(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return CP(e),null;case 13:if(mr(Pr),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(it(340));mm()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return mr(Pr),null;case 4:return ym(),null;case 10:return vP(e.type._context),null;case 22:case 23:return OP(),null;case 24:return null;default:return null}}var qv=!1,Cs=!1,kie=typeof WeakSet=="function"?WeakSet:Set,St=null;function wp(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){jr(t,e,r)}else n.current=null}function F3(t,e,n){try{n()}catch(r){jr(t,e,r)}}var pF=!1;function Rie(t,e){if(v3=aC,t=pV(),hP(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=t,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===t)break t;if(f===n&&++c===i&&(a=o),f===s&&++u===r&&(l=o),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(b3={focusedElem:t,selectionRange:n},aC=!1,St=e;St!==null;)if(e=St,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,St=t;else for(;St!==null;){e=St;try{var A=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(A!==null){var p=A.memoizedProps,m=A.memoizedState,g=e.stateNode,y=g.getSnapshotBeforeUpdate(e.elementType===e.type?p:Fa(e.type,p),m);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(it(163))}}catch(v){jr(e,e.return,v)}if(t=e.sibling,t!==null){t.return=e.return,St=t;break}St=e.return}return A=pF,pF=!1,A}function o1(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&F3(e,n,s)}i=i.next}while(i!==r)}}function TS(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function N3(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function dG(t){var e=t.alternate;e!==null&&(t.alternate=null,dG(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Sl],delete e[j1],delete e[C3],delete e[hie],delete e[Aie])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function fG(t){return t.tag===5||t.tag===3||t.tag===4}function mF(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||fG(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function D3(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=uC));else if(r!==4&&(t=t.child,t!==null))for(D3(t,e,n),t=t.sibling;t!==null;)D3(t,e,n),t=t.sibling}function U3(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(U3(t,e,n),t=t.sibling;t!==null;)U3(t,e,n),t=t.sibling}var zi=null,Na=!1;function _u(t,e,n){for(n=n.child;n!==null;)hG(t,e,n),n=n.sibling}function hG(t,e,n){if(Ul&&typeof Ul.onCommitFiberUnmount=="function")try{Ul.onCommitFiberUnmount(vS,n)}catch{}switch(n.tag){case 5:Cs||wp(n,e);case 6:var r=zi,i=Na;zi=null,_u(t,e,n),zi=r,Na=i,zi!==null&&(Na?(t=zi,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):zi.removeChild(n.stateNode));break;case 18:zi!==null&&(Na?(t=zi,n=n.stateNode,t.nodeType===8?yE(t.parentNode,n):t.nodeType===1&&yE(t,n),F1(t)):yE(zi,n.stateNode));break;case 4:r=zi,i=Na,zi=n.stateNode.containerInfo,Na=!0,_u(t,e,n),zi=r,Na=i;break;case 0:case 11:case 14:case 15:if(!Cs&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&F3(n,e,o),i=i.next}while(i!==r)}_u(t,e,n);break;case 1:if(!Cs&&(wp(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){jr(n,e,a)}_u(t,e,n);break;case 21:_u(t,e,n);break;case 22:n.mode&1?(Cs=(r=Cs)||n.memoizedState!==null,_u(t,e,n),Cs=r):_u(t,e,n);break;default:_u(t,e,n)}}function gF(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new kie),e.forEach(function(r){var i=Hie.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function ka(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:zi=a.stateNode,Na=!1;break e;case 3:zi=a.stateNode.containerInfo,Na=!0;break e;case 4:zi=a.stateNode.containerInfo,Na=!0;break e}a=a.return}if(zi===null)throw Error(it(160));hG(s,o,i),zi=null,Na=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){jr(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)AG(e,t),e=e.sibling}function AG(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(ka(e,t),cl(t),r&4){try{o1(3,t,t.return),TS(3,t)}catch(p){jr(t,t.return,p)}try{o1(5,t,t.return)}catch(p){jr(t,t.return,p)}}break;case 1:ka(e,t),cl(t),r&512&&n!==null&&wp(n,n.return);break;case 5:if(ka(e,t),cl(t),r&512&&n!==null&&wp(n,n.return),t.flags&32){var i=t.stateNode;try{P1(i,"")}catch(p){jr(t,t.return,p)}}if(r&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,o=n!==null?n.memoizedProps:s,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&Fz(i,s),c3(a,o);var c=c3(a,s);for(o=0;o<l.length;o+=2){var u=l[o],d=l[o+1];u==="style"?jz(i,d):u==="dangerouslySetInnerHTML"?Uz(i,d):u==="children"?P1(i,d):eP(i,u,d,c)}switch(a){case"input":i3(i,s);break;case"textarea":Nz(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?Up(i,!!s.multiple,h,!1):f!==!!s.multiple&&(s.defaultValue!=null?Up(i,!!s.multiple,s.defaultValue,!0):Up(i,!!s.multiple,s.multiple?[]:"",!1))}i[j1]=s}catch(p){jr(t,t.return,p)}}break;case 6:if(ka(e,t),cl(t),r&4){if(t.stateNode===null)throw Error(it(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(p){jr(t,t.return,p)}}break;case 3:if(ka(e,t),cl(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{F1(e.containerInfo)}catch(p){jr(t,t.return,p)}break;case 4:ka(e,t),cl(t);break;case 13:ka(e,t),cl(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(LP=Xr())),r&4&&gF(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(Cs=(c=Cs)||u,ka(e,t),Cs=c):ka(e,t),cl(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(St=t,u=t.child;u!==null;){for(d=St=u;St!==null;){switch(f=St,h=f.child,f.tag){case 0:case 11:case 14:case 15:o1(4,f,f.return);break;case 1:wp(f,f.return);var A=f.stateNode;if(typeof A.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,A.props=e.memoizedProps,A.state=e.memoizedState,A.componentWillUnmount()}catch(p){jr(r,n,p)}}break;case 5:wp(f,f.return);break;case 22:if(f.memoizedState!==null){vF(d);continue}}h!==null?(h.return=f,St=h):vF(d)}u=u.sibling}e:for(u=null,d=t;;){if(d.tag===5){if(u===null){u=d;try{i=d.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=d.stateNode,l=d.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Hz("display",o))}catch(p){jr(t,t.return,p)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(p){jr(t,t.return,p)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:ka(e,t),cl(t),r&4&&gF(t);break;case 21:break;default:ka(e,t),cl(t)}}function cl(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(fG(n)){var r=n;break e}n=n.return}throw Error(it(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(P1(i,""),r.flags&=-33);var s=mF(t);U3(t,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=mF(t);D3(t,a,o);break;default:throw Error(it(161))}}catch(l){jr(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Pie(t,e,n){St=t,pG(t)}function pG(t,e,n){for(var r=(t.mode&1)!==0;St!==null;){var i=St,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||qv;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||Cs;a=qv;var c=Cs;if(qv=o,(Cs=l)&&!c)for(St=i;St!==null;)o=St,l=o.child,o.tag===22&&o.memoizedState!==null?bF(i):l!==null?(l.return=o,St=l):bF(i);for(;s!==null;)St=s,pG(s),s=s.sibling;St=i,qv=a,Cs=c}yF(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,St=s):yF(t)}}function yF(t){for(;St!==null;){var e=St;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Cs||TS(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Cs)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:Fa(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&nF(e,s,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}nF(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&F1(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(it(163))}Cs||e.flags&512&&N3(e)}catch(f){jr(e,e.return,f)}}if(e===t){St=null;break}if(n=e.sibling,n!==null){n.return=e.return,St=n;break}St=e.return}}function vF(t){for(;St!==null;){var e=St;if(e===t){St=null;break}var n=e.sibling;if(n!==null){n.return=e.return,St=n;break}St=e.return}}function bF(t){for(;St!==null;){var e=St;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{TS(4,e)}catch(l){jr(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){jr(e,i,l)}}var s=e.return;try{N3(e)}catch(l){jr(e,s,l)}break;case 5:var o=e.return;try{N3(e)}catch(l){jr(e,o,l)}}}catch(l){jr(e,e.return,l)}if(e===t){St=null;break}var a=e.sibling;if(a!==null){a.return=e.return,St=a;break}St=e.return}}var Lie=Math.ceil,wC=hu.ReactCurrentDispatcher,RP=hu.ReactCurrentOwner,pa=hu.ReactCurrentBatchConfig,kn=0,Ii=null,di=null,rs=0,Bo=0,xp=wf(0),wi=0,K1=null,Oh=0,BS=0,PP=0,a1=null,ro=null,LP=0,bm=1/0,Tc=null,xC=!1,H3=null,Bd=null,Xv=!1,id=null,CC=0,l1=0,j3=null,lx=-1,cx=0;function Gs(){return kn&6?Xr():lx!==-1?lx:lx=Xr()}function Md(t){return t.mode&1?kn&2&&rs!==0?rs&-rs:mie.transition!==null?(cx===0&&(cx=Zz()),cx):(t=Xn,t!==0||(t=window.event,t=t===void 0?16:oV(t.type)),t):1}function Xa(t,e,n,r){if(50<l1)throw l1=0,j3=null,Error(it(185));qy(t,n,r),(!(kn&2)||t!==Ii)&&(t===Ii&&(!(kn&2)&&(BS|=n),wi===4&&Xu(t,rs)),ho(t,r),n===1&&kn===0&&!(e.mode&1)&&(bm=Xr()+500,_S&&xf()))}function ho(t,e){var n=t.callbackNode;mre(t,e);var r=oC(t,t===Ii?rs:0);if(r===0)n!==null&&MO(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&MO(n),e===1)t.tag===0?pie(wF.bind(null,t)):SV(wF.bind(null,t)),die(function(){!(kn&6)&&xf()}),n=null;else{switch(eV(r)){case 1:n=sP;break;case 4:n=Yz;break;case 16:n=sC;break;case 536870912:n=Jz;break;default:n=sC}n=CG(n,mG.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function mG(t,e){if(lx=-1,cx=0,kn&6)throw Error(it(327));var n=t.callbackNode;if(Vp()&&t.callbackNode!==n)return null;var r=oC(t,t===Ii?rs:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=_C(t,r);else{e=r;var i=kn;kn|=2;var s=yG();(Ii!==t||rs!==e)&&(Tc=null,bm=Xr()+500,bh(t,e));do try{Fie();break}catch(a){gG(t,a)}while(!0);yP(),wC.current=s,kn=i,di!==null?e=0:(Ii=null,rs=0,e=wi)}if(e!==0){if(e===2&&(i=A3(t),i!==0&&(r=i,e=Q3(t,i))),e===1)throw n=K1,bh(t,0),Xu(t,r),ho(t,Xr()),n;if(e===6)Xu(t,r);else{if(i=t.current.alternate,!(r&30)&&!Iie(i)&&(e=_C(t,r),e===2&&(s=A3(t),s!==0&&(r=s,e=Q3(t,s))),e===1))throw n=K1,bh(t,0),Xu(t,r),ho(t,Xr()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(it(345));case 2:Gf(t,ro,Tc);break;case 3:if(Xu(t,r),(r&130023424)===r&&(e=LP+500-Xr(),10<e)){if(oC(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){Gs(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=x3(Gf.bind(null,t,ro,Tc),e);break}Gf(t,ro,Tc);break;case 4:if(Xu(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var o=31-qa(r);s=1<<o,o=e[o],o>i&&(i=o),r&=~s}if(r=i,r=Xr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Lie(r/1960))-r,10<r){t.timeoutHandle=x3(Gf.bind(null,t,ro,Tc),r);break}Gf(t,ro,Tc);break;case 5:Gf(t,ro,Tc);break;default:throw Error(it(329))}}}return ho(t,Xr()),t.callbackNode===n?mG.bind(null,t):null}function Q3(t,e){var n=a1;return t.current.memoizedState.isDehydrated&&(bh(t,e).flags|=256),t=_C(t,e),t!==2&&(e=ro,ro=n,e!==null&&z3(e)),t}function z3(t){ro===null?ro=t:ro.push.apply(ro,t)}function Iie(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!Za(s(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Xu(t,e){for(e&=~PP,e&=~BS,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-qa(e),r=1<<n;t[n]=-1,e&=~r}}function wF(t){if(kn&6)throw Error(it(327));Vp();var e=oC(t,0);if(!(e&1))return ho(t,Xr()),null;var n=_C(t,e);if(t.tag!==0&&n===2){var r=A3(t);r!==0&&(e=r,n=Q3(t,r))}if(n===1)throw n=K1,bh(t,0),Xu(t,e),ho(t,Xr()),n;if(n===6)throw Error(it(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Gf(t,ro,Tc),ho(t,Xr()),null}function IP(t,e){var n=kn;kn|=1;try{return t(e)}finally{kn=n,kn===0&&(bm=Xr()+500,_S&&xf())}}function Fh(t){id!==null&&id.tag===0&&!(kn&6)&&Vp();var e=kn;kn|=1;var n=pa.transition,r=Xn;try{if(pa.transition=null,Xn=1,t)return t()}finally{Xn=r,pa.transition=n,kn=e,!(kn&6)&&xf()}}function OP(){Bo=xp.current,mr(xp)}function bh(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,uie(n)),di!==null)for(n=di.return;n!==null;){var r=n;switch(pP(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&dC();break;case 3:ym(),mr(uo),mr(Bs),_P();break;case 5:CP(r);break;case 4:ym();break;case 13:mr(Pr);break;case 19:mr(Pr);break;case 10:vP(r.type._context);break;case 22:case 23:OP()}n=n.return}if(Ii=t,di=t=kd(t.current,null),rs=Bo=e,wi=0,K1=null,PP=BS=Oh=0,ro=a1=null,fh!==null){for(e=0;e<fh.length;e++)if(n=fh[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}fh=null}return t}function gG(t,e){do{var n=di;try{if(yP(),sx.current=bC,vC){for(var r=Ir.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}vC=!1}if(Ih=0,Ri=pi=Ir=null,s1=!1,V1=0,RP.current=null,n===null||n.return===null){wi=1,K1=e,di=null;break}e:{var s=t,o=n.return,a=n,l=e;if(e=rs,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=lF(o);if(h!==null){h.flags&=-257,cF(h,o,a,s,e),h.mode&1&&aF(s,c,e),e=h,l=c;var A=e.updateQueue;if(A===null){var p=new Set;p.add(l),e.updateQueue=p}else A.add(l);break e}else{if(!(e&1)){aF(s,c,e),FP();break e}l=Error(it(426))}}else if(Cr&&a.mode&1){var m=lF(o);if(m!==null){!(m.flags&65536)&&(m.flags|=256),cF(m,o,a,s,e),mP(vm(l,a));break e}}s=l=vm(l,a),wi!==4&&(wi=2),a1===null?a1=[s]:a1.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var g=eG(s,l,e);tF(s,g);break e;case 1:a=l;var y=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof y.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Bd===null||!Bd.has(w)))){s.flags|=65536,e&=-e,s.lanes|=e;var v=tG(s,a,e);tF(s,v);break e}}s=s.return}while(s!==null)}bG(n)}catch(x){e=x,di===n&&n!==null&&(di=n=n.return);continue}break}while(!0)}function yG(){var t=wC.current;return wC.current=bC,t===null?bC:t}function FP(){(wi===0||wi===3||wi===2)&&(wi=4),Ii===null||!(Oh&268435455)&&!(BS&268435455)||Xu(Ii,rs)}function _C(t,e){var n=kn;kn|=2;var r=yG();(Ii!==t||rs!==e)&&(Tc=null,bh(t,e));do try{Oie();break}catch(i){gG(t,i)}while(!0);if(yP(),kn=n,wC.current=r,di!==null)throw Error(it(261));return Ii=null,rs=0,wi}function Oie(){for(;di!==null;)vG(di)}function Fie(){for(;di!==null&&!are();)vG(di)}function vG(t){var e=xG(t.alternate,t,Bo);t.memoizedProps=t.pendingProps,e===null?bG(t):di=e,RP.current=null}function bG(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=Mie(n,e),n!==null){n.flags&=32767,di=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{wi=6,di=null;return}}else if(n=Bie(n,e,Bo),n!==null){di=n;return}if(e=e.sibling,e!==null){di=e;return}di=e=t}while(e!==null);wi===0&&(wi=5)}function Gf(t,e,n){var r=Xn,i=pa.transition;try{pa.transition=null,Xn=1,Nie(t,e,n,r)}finally{pa.transition=i,Xn=r}return null}function Nie(t,e,n,r){do Vp();while(id!==null);if(kn&6)throw Error(it(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(it(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(gre(t,s),t===Ii&&(di=Ii=null,rs=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xv||(Xv=!0,CG(sC,function(){return Vp(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=pa.transition,pa.transition=null;var o=Xn;Xn=1;var a=kn;kn|=4,RP.current=null,Rie(t,n),AG(n,t),rie(b3),aC=!!v3,b3=v3=null,t.current=n,Pie(n),lre(),kn=a,Xn=o,pa.transition=s}else t.current=n;if(Xv&&(Xv=!1,id=t,CC=i),s=t.pendingLanes,s===0&&(Bd=null),dre(n.stateNode),ho(t,Xr()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(xC)throw xC=!1,t=H3,H3=null,t;return CC&1&&t.tag!==0&&Vp(),s=t.pendingLanes,s&1?t===j3?l1++:(l1=0,j3=t):l1=0,xf(),null}function Vp(){if(id!==null){var t=eV(CC),e=pa.transition,n=Xn;try{if(pa.transition=null,Xn=16>t?16:t,id===null)var r=!1;else{if(t=id,id=null,CC=0,kn&6)throw Error(it(331));var i=kn;for(kn|=4,St=t.current;St!==null;){var s=St,o=s.child;if(St.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(St=c;St!==null;){var u=St;switch(u.tag){case 0:case 11:case 15:o1(8,u,s)}var d=u.child;if(d!==null)d.return=u,St=d;else for(;St!==null;){u=St;var f=u.sibling,h=u.return;if(dG(u),u===c){St=null;break}if(f!==null){f.return=h,St=f;break}St=h}}}var A=s.alternate;if(A!==null){var p=A.child;if(p!==null){A.child=null;do{var m=p.sibling;p.sibling=null,p=m}while(p!==null)}}St=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,St=o;else e:for(;St!==null;){if(s=St,s.flags&2048)switch(s.tag){case 0:case 11:case 15:o1(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,St=g;break e}St=s.return}}var y=t.current;for(St=y;St!==null;){o=St;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,St=w;else e:for(o=y;St!==null;){if(a=St,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:TS(9,a)}}catch(x){jr(a,a.return,x)}if(a===o){St=null;break e}var v=a.sibling;if(v!==null){v.return=a.return,St=v;break e}St=a.return}}if(kn=i,xf(),Ul&&typeof Ul.onPostCommitFiberRoot=="function")try{Ul.onPostCommitFiberRoot(vS,t)}catch{}r=!0}return r}finally{Xn=n,pa.transition=e}}return!1}function xF(t,e,n){e=vm(n,e),e=eG(t,e,1),t=Td(t,e,1),e=Gs(),t!==null&&(qy(t,1,e),ho(t,e))}function jr(t,e,n){if(t.tag===3)xF(t,t,n);else for(;e!==null;){if(e.tag===3){xF(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Bd===null||!Bd.has(r))){t=vm(n,t),t=tG(e,t,1),e=Td(e,t,1),t=Gs(),e!==null&&(qy(e,1,t),ho(e,t));break}}e=e.return}}function Die(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Gs(),t.pingedLanes|=t.suspendedLanes&n,Ii===t&&(rs&n)===n&&(wi===4||wi===3&&(rs&130023424)===rs&&500>Xr()-LP?bh(t,0):PP|=n),ho(t,e)}function wG(t,e){e===0&&(t.mode&1?(e=Hv,Hv<<=1,!(Hv&130023424)&&(Hv=4194304)):e=1);var n=Gs();t=Wc(t,e),t!==null&&(qy(t,e,n),ho(t,n))}function Uie(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),wG(t,n)}function Hie(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(it(314))}r!==null&&r.delete(e),wG(t,n)}var xG;xG=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||uo.current)oo=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return oo=!1,Tie(t,e,n);oo=!!(t.flags&131072)}else oo=!1,Cr&&e.flags&1048576&&EV(e,AC,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;ax(t,e),t=e.pendingProps;var i=pm(e,Bs.current);zp(e,n),i=EP(null,e,r,t,i,n);var s=TP();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,fo(r)?(s=!0,fC(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,wP(e),i.updater=ES,e.stateNode=i,i._reactInternals=e,M3(e,r,t,n),e=P3(null,e,r,!0,s,n)):(e.tag=0,Cr&&s&&AP(e),Ds(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(ax(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=Qie(r),t=Fa(r,t),i){case 0:e=R3(null,e,r,t,n);break e;case 1:e=fF(null,e,r,t,n);break e;case 11:e=uF(null,e,r,t,n);break e;case 14:e=dF(null,e,r,Fa(r.type,t),n);break e}throw Error(it(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fa(r,i),R3(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fa(r,i),fF(t,e,r,i,n);case 3:e:{if(sG(e),t===null)throw Error(it(387));r=e.pendingProps,s=e.memoizedState,i=s.element,PV(t,e),gC(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=vm(Error(it(423)),e),e=hF(t,e,r,n,i);break e}else if(r!==i){i=vm(Error(it(424)),e),e=hF(t,e,r,n,i);break e}else for(Fo=Ed(e.stateNode.containerInfo.firstChild),Uo=e,Cr=!0,Ua=null,n=kV(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(mm(),r===i){e=Kc(t,e,n);break e}Ds(t,e,r,n)}e=e.child}return e;case 5:return LV(e),t===null&&E3(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,w3(r,i)?o=null:s!==null&&w3(r,s)&&(e.flags|=32),iG(t,e),Ds(t,e,o,n),e.child;case 6:return t===null&&E3(e),null;case 13:return oG(t,e,n);case 4:return xP(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=gm(e,null,r,n):Ds(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fa(r,i),uF(t,e,r,i,n);case 7:return Ds(t,e,e.pendingProps,n),e.child;case 8:return Ds(t,e,e.pendingProps.children,n),e.child;case 12:return Ds(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,cr(pC,r._currentValue),r._currentValue=o,s!==null)if(Za(s.value,o)){if(s.children===i.children&&!uo.current){e=Kc(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Dc(-1,n&-n),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),T3(s.return,n,e),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(it(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),T3(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ds(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,zp(e,n),i=wa(i),r=r(i),e.flags|=1,Ds(t,e,r,n),e.child;case 14:return r=e.type,i=Fa(r,e.pendingProps),i=Fa(r.type,i),dF(t,e,r,i,n);case 15:return nG(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fa(r,i),ax(t,e),e.tag=1,fo(r)?(t=!0,fC(e)):t=!1,zp(e,n),ZV(e,r,i),M3(e,r,i,n),P3(null,e,r,!0,t,n);case 19:return aG(t,e,n);case 22:return rG(t,e,n)}throw Error(it(156,e.tag))};function CG(t,e){return Xz(t,e)}function jie(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ca(t,e,n,r){return new jie(t,e,n,r)}function NP(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Qie(t){if(typeof t=="function")return NP(t)?1:0;if(t!=null){if(t=t.$$typeof,t===nP)return 11;if(t===rP)return 14}return 2}function kd(t,e){var n=t.alternate;return n===null?(n=ca(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function ux(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")NP(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case fp:return wh(n.children,i,s,e);case tP:o=8,i|=8;break;case ZB:return t=ca(12,n,e,i|2),t.elementType=ZB,t.lanes=s,t;case e3:return t=ca(13,n,e,i),t.elementType=e3,t.lanes=s,t;case t3:return t=ca(19,n,e,i),t.elementType=t3,t.lanes=s,t;case Lz:return MS(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Rz:o=10;break e;case Pz:o=9;break e;case nP:o=11;break e;case rP:o=14;break e;case Qu:o=16,r=null;break e}throw Error(it(130,t==null?t:typeof t,""))}return e=ca(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function wh(t,e,n,r){return t=ca(7,t,r,e),t.lanes=n,t}function MS(t,e,n,r){return t=ca(22,t,r,e),t.elementType=Lz,t.lanes=n,t.stateNode={isHidden:!1},t}function EE(t,e,n){return t=ca(6,t,null,e),t.lanes=n,t}function TE(t,e,n){return e=ca(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function zie(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=aE(0),this.expirationTimes=aE(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=aE(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function DP(t,e,n,r,i,s,o,a,l){return t=new zie(t,e,n,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=ca(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},wP(s),t}function Vie(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:dp,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function _G(t){if(!t)return Jd;t=t._reactInternals;e:{if(nA(t)!==t||t.tag!==1)throw Error(it(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(fo(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(it(171))}if(t.tag===1){var n=t.type;if(fo(n))return _V(t,n,e)}return e}function SG(t,e,n,r,i,s,o,a,l){return t=DP(n,r,!0,t,i,s,o,a,l),t.context=_G(null),n=t.current,r=Gs(),i=Md(n),s=Dc(r,i),s.callback=e??null,Td(n,s,i),t.current.lanes=i,qy(t,i,r),ho(t,r),t}function kS(t,e,n,r){var i=e.current,s=Gs(),o=Md(i);return n=_G(n),e.context===null?e.context=n:e.pendingContext=n,e=Dc(s,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Td(i,e,o),t!==null&&(Xa(t,i,o,s),ix(t,i,o)),o}function SC(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function CF(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function UP(t,e){CF(t,e),(t=t.alternate)&&CF(t,e)}function Gie(){return null}var EG=typeof reportError=="function"?reportError:function(t){console.error(t)};function HP(t){this._internalRoot=t}RS.prototype.render=HP.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(it(409));kS(t,e,null,null)};RS.prototype.unmount=HP.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Fh(function(){kS(null,t,null,null)}),e[Gc]=null}};function RS(t){this._internalRoot=t}RS.prototype.unstable_scheduleHydration=function(t){if(t){var e=rV();t={blockedOn:null,target:t,priority:e};for(var n=0;n<qu.length&&e!==0&&e<qu[n].priority;n++);qu.splice(n,0,t),n===0&&sV(t)}};function jP(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function PS(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function _F(){}function Wie(t,e,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var c=SC(o);s.call(c)}}var o=SG(e,r,t,0,null,!1,!1,"",_F);return t._reactRootContainer=o,t[Gc]=o.current,U1(t.nodeType===8?t.parentNode:t),Fh(),o}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=SC(l);a.call(c)}}var l=DP(t,0,!1,null,null,!1,!1,"",_F);return t._reactRootContainer=l,t[Gc]=l.current,U1(t.nodeType===8?t.parentNode:t),Fh(function(){kS(e,l,n,r)}),l}function LS(t,e,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=SC(o);a.call(l)}}kS(e,o,t,i)}else o=Wie(n,e,t,i,r);return SC(o)}tV=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=_0(e.pendingLanes);n!==0&&(oP(e,n|1),ho(e,Xr()),!(kn&6)&&(bm=Xr()+500,xf()))}break;case 13:Fh(function(){var r=Wc(t,1);if(r!==null){var i=Gs();Xa(r,t,1,i)}}),UP(t,1)}};aP=function(t){if(t.tag===13){var e=Wc(t,134217728);if(e!==null){var n=Gs();Xa(e,t,134217728,n)}UP(t,134217728)}};nV=function(t){if(t.tag===13){var e=Md(t),n=Wc(t,e);if(n!==null){var r=Gs();Xa(n,t,e,r)}UP(t,e)}};rV=function(){return Xn};iV=function(t,e){var n=Xn;try{return Xn=t,e()}finally{Xn=n}};d3=function(t,e,n){switch(e){case"input":if(i3(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=CS(r);if(!i)throw Error(it(90));Oz(r),i3(r,i)}}}break;case"textarea":Nz(t,n);break;case"select":e=n.value,e!=null&&Up(t,!!n.multiple,e,!1)}};Vz=IP;Gz=Fh;var Kie={usingClientEntryPoint:!1,Events:[Yy,mp,CS,Qz,zz,IP]},Kg={findFiberByHostInstance:dh,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$ie={bundleType:Kg.bundleType,version:Kg.version,rendererPackageName:Kg.rendererPackageName,rendererConfig:Kg.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:hu.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=$z(t),t===null?null:t.stateNode},findFiberByHostInstance:Kg.findFiberByHostInstance||Gie,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yv=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yv.isDisabled&&Yv.supportsFiber)try{vS=Yv.inject($ie),Ul=Yv}catch{}}Wo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Kie;Wo.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!jP(e))throw Error(it(200));return Vie(t,e,null,n)};Wo.createRoot=function(t,e){if(!jP(t))throw Error(it(299));var n=!1,r="",i=EG;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=DP(t,1,!1,null,null,n,!1,r,i),t[Gc]=e.current,U1(t.nodeType===8?t.parentNode:t),new HP(e)};Wo.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(it(188)):(t=Object.keys(t).join(","),Error(it(268,t)));return t=$z(e),t=t===null?null:t.stateNode,t};Wo.flushSync=function(t){return Fh(t)};Wo.hydrate=function(t,e,n){if(!PS(e))throw Error(it(200));return LS(null,t,e,!0,n)};Wo.hydrateRoot=function(t,e,n){if(!jP(t))throw Error(it(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=EG;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=SG(e,null,t,1,n??null,i,!1,s,o),t[Gc]=e.current,U1(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new RS(e)};Wo.render=function(t,e,n){if(!PS(e))throw Error(it(200));return LS(null,t,e,!1,n)};Wo.unmountComponentAtNode=function(t){if(!PS(t))throw Error(it(40));return t._reactRootContainer?(Fh(function(){LS(null,null,t,!1,function(){t._reactRootContainer=null,t[Gc]=null})}),!0):!1};Wo.unstable_batchedUpdates=IP;Wo.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!PS(n))throw Error(it(200));if(t==null||t._reactInternals===void 0)throw Error(it(38));return LS(t,e,n,!1,r)};Wo.version="18.3.1-next-f1338f8080-20240426";function TG(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(TG)}catch(t){console.error(t)}}TG(),Tz.exports=Wo;var bg=Tz.exports;const qie=mg(bg),Xie=pz({__proto__:null,default:qie},[bg]);var SF=bg;YB.createRoot=SF.createRoot,YB.hydrateRoot=SF.hydrateRoot;const Yie="modulepreload",Jie=function(t){return"/"+t},EF={},Zie=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=Jie(l),l in EF)return;EF[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":Yie,c||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),c)return new Promise((f,h)=>{d.addEventListener("load",f),d.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};let ese={data:""},tse=t=>typeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||ese,nse=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,rse=/\/\*[^]*?\*\/|  +/g,TF=/\n+/g,Yu=(t,e)=>{let n="",r="",i="";for(let s in t){let o=t[s];s[0]=="@"?s[1]=="i"?n=s+" "+o+";":r+=s[1]=="f"?Yu(o,s):s+"{"+Yu(o,s[1]=="k"?"":e)+"}":typeof o=="object"?r+=Yu(o,e?e.replace(/([^,])+/g,a=>s.replace(/(^:.*)|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,a):a?a+" "+l:l)):s):o!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=Yu.p?Yu.p(s,o):s+":"+o+";")}return n+(e&&i?e+"{"+i+"}":i)+r},pc={},BG=t=>{if(typeof t=="object"){let e="";for(let n in t)e+=n+BG(t[n]);return e}return t},ise=(t,e,n,r,i)=>{let s=BG(t),o=pc[s]||(pc[s]=(l=>{let c=0,u=11;for(;c<l.length;)u=101*u+l.charCodeAt(c++)>>>0;return"go"+u})(s));if(!pc[o]){let l=s!==t?t:(c=>{let u,d,f=[{}];for(;u=nse.exec(c.replace(rse,""));)u[4]?f.shift():u[3]?(d=u[3].replace(TF," ").trim(),f.unshift(f[0][d]=f[0][d]||{})):f[0][u[1]]=u[2].replace(TF," ").trim();return f[0]})(t);pc[o]=Yu(i?{["@keyframes "+o]:l}:l,n?"":"."+o)}let a=n&&pc.g?pc.g:null;return n&&(pc.g=pc[o]),((l,c,u,d)=>{d?c.data=c.data.replace(d,l):c.data.indexOf(l)===-1&&(c.data=u?l+c.data:c.data+l)})(pc[o],e,r,a),o},sse=(t,e,n)=>t.reduce((r,i,s)=>{let o=e[s];if(o&&o.call){let a=o(n),l=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=l?"."+l:a&&typeof a=="object"?a.props?"":Yu(a,""):a===!1?"":a}return r+i+(o??"")},"");function IS(t){let e=this||{},n=t.call?t(e.p):t;return ise(n.unshift?n.raw?sse(n,[].slice.call(arguments,1),e.p):n.reduce((r,i)=>Object.assign(r,i&&i.call?i(e.p):i),{}):n,tse(e.target),e.g,e.o,e.k)}let MG,V3,G3;IS.bind({g:1});let $c=IS.bind({k:1});function ose(t,e,n,r){Yu.p=e,MG=t,V3=n,G3=r}function Cf(t,e){let n=this||{};return function(){let r=arguments;function i(s,o){let a=Object.assign({},s),l=a.className||i.className;n.p=Object.assign({theme:V3&&V3()},a),n.o=/ *go\d+/.test(l),a.className=IS.apply(n,r)+(l?" "+l:"");let c=t;return t[0]&&(c=a.as||t,delete a.as),G3&&c[0]&&G3(a),MG(c,a)}return i}}var ase=t=>typeof t=="function",EC=(t,e)=>ase(t)?t(e):t,lse=(()=>{let t=0;return()=>(++t).toString()})(),kG=(()=>{let t;return()=>{if(t===void 0&&typeof window<"u"){let e=matchMedia("(prefers-reduced-motion: reduce)");t=!e||e.matches}return t}})(),cse=20,dx=new Map,use=1e3,BF=t=>{if(dx.has(t))return;let e=setTimeout(()=>{dx.delete(t),rA({type:4,toastId:t})},use);dx.set(t,e)},dse=t=>{let e=dx.get(t);e&&clearTimeout(e)},W3=(t,e)=>{switch(e.type){case 0:return{...t,toasts:[e.toast,...t.toasts].slice(0,cse)};case 1:return e.toast.id&&dse(e.toast.id),{...t,toasts:t.toasts.map(s=>s.id===e.toast.id?{...s,...e.toast}:s)};case 2:let{toast:n}=e;return t.toasts.find(s=>s.id===n.id)?W3(t,{type:1,toast:n}):W3(t,{type:0,toast:n});case 3:let{toastId:r}=e;return r?BF(r):t.toasts.forEach(s=>{BF(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===r||r===void 0?{...s,visible:!1}:s)};case 4:return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(s=>s.id!==e.toastId)};case 5:return{...t,pausedAt:e.time};case 6:let i=e.time-(t.pausedAt||0);return{...t,pausedAt:void 0,toasts:t.toasts.map(s=>({...s,pauseDuration:s.pauseDuration+i}))}}},fx=[],hx={toasts:[],pausedAt:void 0},rA=t=>{hx=W3(hx,t),fx.forEach(e=>{e(hx)})},fse={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},hse=(t={})=>{let[e,n]=P.useState(hx);P.useEffect(()=>(fx.push(n),()=>{let i=fx.indexOf(n);i>-1&&fx.splice(i,1)}),[e]);let r=e.toasts.map(i=>{var s,o;return{...t,...t[i.type],...i,duration:i.duration||((s=t[i.type])==null?void 0:s.duration)||(t==null?void 0:t.duration)||fse[i.type],style:{...t.style,...(o=t[i.type])==null?void 0:o.style,...i.style}}});return{...e,toasts:r}},Ase=(t,e="blank",n)=>({createdAt:Date.now(),visible:!0,type:e,ariaProps:{role:"status","aria-live":"polite"},message:t,pauseDuration:0,...n,id:(n==null?void 0:n.id)||lse()}),Zy=t=>(e,n)=>{let r=Ase(e,t,n);return rA({type:2,toast:r}),r.id},Zr=(t,e)=>Zy("blank")(t,e);Zr.error=Zy("error");Zr.success=Zy("success");Zr.loading=Zy("loading");Zr.custom=Zy("custom");Zr.dismiss=t=>{rA({type:3,toastId:t})};Zr.remove=t=>rA({type:4,toastId:t});Zr.promise=(t,e,n)=>{let r=Zr.loading(e.loading,{...n,...n==null?void 0:n.loading});return t.then(i=>(Zr.success(EC(e.success,i),{id:r,...n,...n==null?void 0:n.success}),i)).catch(i=>{Zr.error(EC(e.error,i),{id:r,...n,...n==null?void 0:n.error})}),t};var pse=(t,e)=>{rA({type:1,toast:{id:t,height:e}})},mse=()=>{rA({type:5,time:Date.now()})},gse=t=>{let{toasts:e,pausedAt:n}=hse(t);P.useEffect(()=>{if(n)return;let s=Date.now(),o=e.map(a=>{if(a.duration===1/0)return;let l=(a.duration||0)+a.pauseDuration-(s-a.createdAt);if(l<0){a.visible&&Zr.dismiss(a.id);return}return setTimeout(()=>Zr.dismiss(a.id),l)});return()=>{o.forEach(a=>a&&clearTimeout(a))}},[e,n]);let r=P.useCallback(()=>{n&&rA({type:6,time:Date.now()})},[n]),i=P.useCallback((s,o)=>{let{reverseOrder:a=!1,gutter:l=8,defaultPosition:c}=o||{},u=e.filter(h=>(h.position||c)===(s.position||c)&&h.height),d=u.findIndex(h=>h.id===s.id),f=u.filter((h,A)=>A<d&&h.visible).length;return u.filter(h=>h.visible).slice(...a?[f+1]:[0,f]).reduce((h,A)=>h+(A.height||0)+l,0)},[e]);return{toasts:e,handlers:{updateHeight:pse,startPause:mse,endPause:r,calculateOffset:i}}},yse=$c`
from {
  transform: scale(0) rotate(45deg);
	opacity: 0;
}
to {
 transform: scale(1) rotate(45deg);
  opacity: 1;
}`,vse=$c`
from {
  transform: scale(0);
  opacity: 0;
}
to {
  transform: scale(1);
  opacity: 1;
}`,bse=$c`
from {
  transform: scale(0) rotate(90deg);
	opacity: 0;
}
to {
  transform: scale(1) rotate(90deg);
	opacity: 1;
}`,wse=Cf("div")`
  width: 20px;
  opacity: 0;
  height: 20px;
  border-radius: 10px;
  background: ${t=>t.primary||"#ff4b4b"};
  position: relative;
  transform: rotate(45deg);

  animation: ${yse} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
  animation-delay: 100ms;

  &:after,
  &:before {
    content: '';
    animation: ${vse} 0.15s ease-out forwards;
    animation-delay: 150ms;
    position: absolute;
    border-radius: 3px;
    opacity: 0;
    background: ${t=>t.secondary||"#fff"};
    bottom: 9px;
    left: 4px;
    height: 2px;
    width: 12px;
  }

  &:before {
    animation: ${bse} 0.15s ease-out forwards;
    animation-delay: 180ms;
    transform: rotate(90deg);
  }
`,xse=$c`
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
`,Cse=Cf("div")`
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border: 2px solid;
  border-radius: 100%;
  border-color: ${t=>t.secondary||"#e0e0e0"};
  border-right-color: ${t=>t.primary||"#616161"};
  animation: ${xse} 1s linear infinite;
`,_se=$c`
from {
  transform: scale(0) rotate(45deg);
	opacity: 0;
}
to {
  transform: scale(1) rotate(45deg);
	opacity: 1;
}`,Sse=$c`
0% {
	height: 0;
	width: 0;
	opacity: 0;
}
40% {
  height: 0;
	width: 6px;
	opacity: 1;
}
100% {
  opacity: 1;
  height: 10px;
}`,Ese=Cf("div")`
  width: 20px;
  opacity: 0;
  height: 20px;
  border-radius: 10px;
  background: ${t=>t.primary||"#61d345"};
  position: relative;
  transform: rotate(45deg);

  animation: ${_se} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
  animation-delay: 100ms;
  &:after {
    content: '';
    box-sizing: border-box;
    animation: ${Sse} 0.2s ease-out forwards;
    opacity: 0;
    animation-delay: 200ms;
    position: absolute;
    border-right: 2px solid;
    border-bottom: 2px solid;
    border-color: ${t=>t.secondary||"#fff"};
    bottom: 6px;
    left: 6px;
    height: 10px;
    width: 6px;
  }
`,Tse=Cf("div")`
  position: absolute;
`,Bse=Cf("div")`
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 20px;
  min-height: 20px;
`,Mse=$c`
from {
  transform: scale(0.6);
  opacity: 0.4;
}
to {
  transform: scale(1);
  opacity: 1;
}`,kse=Cf("div")`
  position: relative;
  transform: scale(0.6);
  opacity: 0.4;
  min-width: 20px;
  animation: ${Mse} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
`,Rse=({toast:t})=>{let{icon:e,type:n,iconTheme:r}=t;return e!==void 0?typeof e=="string"?P.createElement(kse,null,e):e:n==="blank"?null:P.createElement(Bse,null,P.createElement(Cse,{...r}),n!=="loading"&&P.createElement(Tse,null,n==="error"?P.createElement(wse,{...r}):P.createElement(Ese,{...r})))},Pse=t=>`
0% {transform: translate3d(0,${t*-200}%,0) scale(.6); opacity:.5;}
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
`,Lse=t=>`
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
100% {transform: translate3d(0,${t*-150}%,-1px) scale(.6); opacity:0;}
`,Ise="0%{opacity:0;} 100%{opacity:1;}",Ose="0%{opacity:1;} 100%{opacity:0;}",Fse=Cf("div")`
  display: flex;
  align-items: center;
  background: #fff;
  color: #363636;
  line-height: 1.3;
  will-change: transform;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
  max-width: 350px;
  pointer-events: auto;
  padding: 8px 10px;
  border-radius: 8px;
`,Nse=Cf("div")`
  display: flex;
  justify-content: center;
  margin: 4px 10px;
  color: inherit;
  flex: 1 1 auto;
  white-space: pre-line;
`,Dse=(t,e)=>{let n=t.includes("top")?1:-1,[r,i]=kG()?[Ise,Ose]:[Pse(n),Lse(n)];return{animation:e?`${$c(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${$c(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Use=P.memo(({toast:t,position:e,style:n,children:r})=>{let i=t.height?Dse(t.position||e||"top-center",t.visible):{opacity:0},s=P.createElement(Rse,{toast:t}),o=P.createElement(Nse,{...t.ariaProps},EC(t.message,t));return P.createElement(Fse,{className:t.className,style:{...i,...n,...t.style}},typeof r=="function"?r({icon:s,message:o}):P.createElement(P.Fragment,null,s,o))});ose(P.createElement);var Hse=({id:t,className:e,style:n,onHeightUpdate:r,children:i})=>{let s=P.useCallback(o=>{if(o){let a=()=>{let l=o.getBoundingClientRect().height;r(t,l)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[t,r]);return P.createElement("div",{ref:s,className:e,style:n},i)},jse=(t,e)=>{let n=t.includes("top"),r=n?{top:0}:{bottom:0},i=t.includes("center")?{justifyContent:"center"}:t.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:kG()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(n?1:-1)}px)`,...r,...i}},Qse=IS`
  z-index: 9999;
  > * {
    pointer-events: auto;
  }
`,Jv=16,zse=({reverseOrder:t,position:e="top-center",toastOptions:n,gutter:r,children:i,containerStyle:s,containerClassName:o})=>{let{toasts:a,handlers:l}=gse(n);return P.createElement("div",{style:{position:"fixed",zIndex:9999,top:Jv,left:Jv,right:Jv,bottom:Jv,pointerEvents:"none",...s},className:o,onMouseEnter:l.startPause,onMouseLeave:l.endPause},a.map(c=>{let u=c.position||e,d=l.calculateOffset(c,{reverseOrder:t,gutter:r,defaultPosition:e}),f=jse(u,d);return P.createElement(Hse,{id:c.id,key:c.id,onHeightUpdate:l.updateHeight,className:c.visible?Qse:"",style:f},c.type==="custom"?EC(c.message,c):i?i(c):P.createElement(Use,{toast:c,position:u}))}))},jt=Zr;function QP(t){return t instanceof Error}function ie(t){return QP(t)?(console.error(t),!0):!1}function RG(t){const e=[],n=[];for(const r of t)QP(r)?n.push(r):e.push(r);return[e.length!==t.length,e,n]}function Vse(t,{showToast:e}={showToast:!1}){console.error(t),e&&jt.error(t,{id:"error"})}function Bt(t){Vse((t??"Unknown promise rejection").toString())}function pt(t,e){return QP(t)?(console.error(t),e!=null&&e.suppress||jt.error(((e==null?void 0:e.altErr)??t??new Error("Unknown")).toString(),{id:"error"}),!0):!1}/**
 * @license
 * Copyright 2010-2024 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const zP="166",bA={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},wA={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Gse=0,MF=1,Wse=2,PG=1,Kse=2,Ec=3,qc=0,Ao=1,ja=2,Rd=0,Gp=1,kF=2,RF=3,PF=4,$se=5,Zf=100,qse=101,Xse=102,Yse=103,Jse=104,Zse=200,eoe=201,toe=202,noe=203,K3=204,$3=205,roe=206,ioe=207,soe=208,ooe=209,aoe=210,loe=211,coe=212,uoe=213,doe=214,foe=0,hoe=1,Aoe=2,TC=3,poe=4,moe=5,goe=6,yoe=7,LG=0,voe=1,boe=2,Pd=0,woe=1,xoe=2,Coe=3,_oe=4,Soe=5,Eoe=6,Toe=7,LF="attached",Boe="detached",IG=300,wm=301,xm=302,q3=303,X3=304,OS=306,Cm=1e3,sd=1001,BC=1002,Qs=1003,OG=1004,E0=1005,Io=1006,Ax=1007,Oc=1008,Xc=1009,FG=1010,NG=1011,$1=1012,VP=1013,Nh=1014,Wa=1015,ev=1016,GP=1017,WP=1018,_m=1020,DG=35902,UG=1021,HG=1022,ua=1023,jG=1024,QG=1025,Wp=1026,Sm=1027,KP=1028,$P=1029,zG=1030,qP=1031,XP=1033,px=33776,mx=33777,gx=33778,yx=33779,Y3=35840,J3=35841,Z3=35842,eM=35843,tM=36196,nM=37492,rM=37496,iM=37808,sM=37809,oM=37810,aM=37811,lM=37812,cM=37813,uM=37814,dM=37815,fM=37816,hM=37817,AM=37818,pM=37819,mM=37820,gM=37821,vx=36492,yM=36494,vM=36495,VG=36283,bM=36284,wM=36285,xM=36286,q1=2300,X1=2301,BE=2302,IF=2400,OF=2401,FF=2402,Moe=2500,koe=0,GG=1,CM=2,Roe=3200,Poe=3201,WG=0,Loe=1,Ju="",Ki="srgb",Ni="srgb-linear",YP="display-p3",FS="display-p3-linear",MC="linear",hr="srgb",kC="rec709",RC="p3",xA=7680,NF=519,Ioe=512,Ooe=513,Foe=514,KG=515,Noe=516,Doe=517,Uoe=518,Hoe=519,_M=35044,DF="300 es",Fc=2e3,PC=2001;class iA{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const fs=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let UF=1234567;const Kp=Math.PI/180,Em=180/Math.PI;function ma(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(fs[t&255]+fs[t>>8&255]+fs[t>>16&255]+fs[t>>24&255]+"-"+fs[e&255]+fs[e>>8&255]+"-"+fs[e>>16&15|64]+fs[e>>24&255]+"-"+fs[n&63|128]+fs[n>>8&255]+"-"+fs[n>>16&255]+fs[n>>24&255]+fs[r&255]+fs[r>>8&255]+fs[r>>16&255]+fs[r>>24&255]).toLowerCase()}function yi(t,e,n){return Math.max(e,Math.min(n,t))}function JP(t,e){return(t%e+e)%e}function joe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function Qoe(t,e,n){return t!==e?(n-t)/(e-t):0}function c1(t,e,n){return(1-n)*t+n*e}function zoe(t,e,n,r){return c1(t,e,1-Math.exp(-n*r))}function Voe(t,e=1){return e-Math.abs(JP(t,e*2)-e)}function Goe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Woe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Koe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function $oe(t,e){return t+Math.random()*(e-t)}function qoe(t){return t*(.5-Math.random())}function Xoe(t){t!==void 0&&(UF=t);let e=UF+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Yoe(t){return t*Kp}function Joe(t){return t*Em}function Zoe(t){return(t&t-1)===0&&t!==0}function eae(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function tae(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function nae(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),u=o((e+r)/2),d=s((e-r)/2),f=o((e-r)/2),h=s((r-e)/2),A=o((r-e)/2);switch(i){case"XYX":t.set(a*u,l*d,l*f,a*c);break;case"YZY":t.set(l*f,a*u,l*d,a*c);break;case"ZXZ":t.set(l*d,l*f,a*u,a*c);break;case"XZX":t.set(a*u,l*A,l*h,a*c);break;case"YXY":t.set(l*h,a*u,l*A,a*c);break;case"ZYZ":t.set(l*A,l*h,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Qa(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Wn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const LC={DEG2RAD:Kp,RAD2DEG:Em,generateUUID:ma,clamp:yi,euclideanModulo:JP,mapLinear:joe,inverseLerp:Qoe,lerp:c1,damp:zoe,pingpong:Voe,smoothstep:Goe,smootherstep:Woe,randInt:Koe,randFloat:$oe,randFloatSpread:qoe,seededRandom:Xoe,degToRad:Yoe,radToDeg:Joe,isPowerOfTwo:Zoe,ceilPowerOfTwo:eae,floorPowerOfTwo:tae,setQuaternionFromProperEuler:nae,normalize:Wn,denormalize:Qa};class Ze{constructor(e=0,n=0){Ze.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(yi(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ln{constructor(e,n,r,i,s,o,a,l,c){ln.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c)}set(e,n,r,i,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=n,u[4]=s,u[5]=l,u[6]=r,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],u=r[4],d=r[7],f=r[2],h=r[5],A=r[8],p=i[0],m=i[3],g=i[6],y=i[1],w=i[4],v=i[7],x=i[2],C=i[5],_=i[8];return s[0]=o*p+a*y+l*x,s[3]=o*m+a*w+l*C,s[6]=o*g+a*v+l*_,s[1]=c*p+u*y+d*x,s[4]=c*m+u*w+d*C,s[7]=c*g+u*v+d*_,s[2]=f*p+h*y+A*x,s[5]=f*m+h*w+A*C,s[8]=f*g+h*v+A*_,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return n*o*u-n*a*c-r*s*u+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=u*o-a*c,f=a*l-u*s,h=c*s-o*l,A=n*d+r*f+i*h;if(A===0)return this.set(0,0,0,0,0,0,0,0,0);const p=1/A;return e[0]=d*p,e[1]=(i*c-u*r)*p,e[2]=(a*r-i*o)*p,e[3]=f*p,e[4]=(u*n-i*l)*p,e[5]=(i*s-a*n)*p,e[6]=h*p,e[7]=(r*l-c*n)*p,e[8]=(o*n-r*s)*p,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(ME.makeScale(e,n)),this}rotate(e){return this.premultiply(ME.makeRotation(-e)),this}translate(e,n){return this.premultiply(ME.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const ME=new ln;function $G(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function Y1(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function rae(){const t=Y1("canvas");return t.style.display="block",t}const HF={};function ZP(t){t in HF||(HF[t]=!0,console.warn(t))}function iae(t,e,n){return new Promise(function(r,i){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}}setTimeout(s,n)})}const jF=new ln().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),QF=new ln().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Zv={[Ni]:{transfer:MC,primaries:kC,toReference:t=>t,fromReference:t=>t},[Ki]:{transfer:hr,primaries:kC,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[FS]:{transfer:MC,primaries:RC,toReference:t=>t.applyMatrix3(QF),fromReference:t=>t.applyMatrix3(jF)},[YP]:{transfer:hr,primaries:RC,toReference:t=>t.convertSRGBToLinear().applyMatrix3(QF),fromReference:t=>t.applyMatrix3(jF).convertLinearToSRGB()}},sae=new Set([Ni,FS]),Nn={enabled:!0,_workingColorSpace:Ni,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!sae.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const r=Zv[e].toReference,i=Zv[n].fromReference;return i(r(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return Zv[t].primaries},getTransfer:function(t){return t===Ju?MC:Zv[t].transfer}};function $p(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function kE(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let CA;class oae{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{CA===void 0&&(CA=Y1("canvas")),CA.width=e.width,CA.height=e.height;const r=CA.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=CA}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Y1("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=$p(s[o]/255)*255;return r.putImageData(i,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor($p(n[r]/255)*255):n[r]=$p(n[r]);return{data:n,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let aae=0;class qG{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:aae++}),this.uuid=ma(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(RE(i[o].image)):s.push(RE(i[o]))}else s=RE(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function RE(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?oae.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let lae=0;class Oi extends iA{constructor(e=Oi.DEFAULT_IMAGE,n=Oi.DEFAULT_MAPPING,r=sd,i=sd,s=Io,o=Oc,a=ua,l=Xc,c=Oi.DEFAULT_ANISOTROPY,u=Ju){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:lae++}),this.uuid=ma(),this.name="",this.source=new qG(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Ze(0,0),this.repeat=new Ze(1,1),this.center=new Ze(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ln,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==IG)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Cm:e.x=e.x-Math.floor(e.x);break;case sd:e.x=e.x<0?0:1;break;case BC:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Cm:e.y=e.y-Math.floor(e.y);break;case sd:e.y=e.y<0?0:1;break;case BC:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Oi.DEFAULT_IMAGE=null;Oi.DEFAULT_MAPPING=IG;Oi.DEFAULT_ANISOTROPY=1;class Jn{constructor(e=0,n=0,r=0,i=1){Jn.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],u=l[4],d=l[8],f=l[1],h=l[5],A=l[9],p=l[2],m=l[6],g=l[10];if(Math.abs(u-f)<.01&&Math.abs(d-p)<.01&&Math.abs(A-m)<.01){if(Math.abs(u+f)<.1&&Math.abs(d+p)<.1&&Math.abs(A+m)<.1&&Math.abs(c+h+g-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const w=(c+1)/2,v=(h+1)/2,x=(g+1)/2,C=(u+f)/4,_=(d+p)/4,S=(A+m)/4;return w>v&&w>x?w<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(w),i=C/r,s=_/r):v>x?v<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(v),r=C/i,s=S/i):x<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(x),r=_/s,i=S/s),this.set(r,i,s,n),this}let y=Math.sqrt((m-A)*(m-A)+(d-p)*(d-p)+(f-u)*(f-u));return Math.abs(y)<.001&&(y=1),this.x=(m-A)/y,this.y=(d-p)/y,this.z=(f-u)/y,this.w=Math.acos((c+h+g-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class cae extends iA{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new Jn(0,0,e,n),this.scissorTest=!1,this.viewport=new Jn(0,0,e,n);const i={width:e,height:n,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Io,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new Oi(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this.depthTexture=r.depthTexture,this.samples=r.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,n,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=n,this.textures[i].image.depth=r;this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let r=0,i=e.textures.length;r<i;r++)this.textures[r]=e.textures[r].clone(),this.textures[r].isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new qG(n),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Dh extends cae{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class XG extends Oi{constructor(e=null,n=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=Qs,this.minFilter=Qs,this.wrapR=sd,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class uae extends Oi{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=Qs,this.minFilter=Qs,this.wrapR=sd,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class $s{constructor(e=0,n=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}static slerpFlat(e,n,r,i,s,o,a){let l=r[i+0],c=r[i+1],u=r[i+2],d=r[i+3];const f=s[o+0],h=s[o+1],A=s[o+2],p=s[o+3];if(a===0){e[n+0]=l,e[n+1]=c,e[n+2]=u,e[n+3]=d;return}if(a===1){e[n+0]=f,e[n+1]=h,e[n+2]=A,e[n+3]=p;return}if(d!==p||l!==f||c!==h||u!==A){let m=1-a;const g=l*f+c*h+u*A+d*p,y=g>=0?1:-1,w=1-g*g;if(w>Number.EPSILON){const x=Math.sqrt(w),C=Math.atan2(x,g*y);m=Math.sin(m*C)/x,a=Math.sin(a*C)/x}const v=a*y;if(l=l*m+f*v,c=c*m+h*v,u=u*m+A*v,d=d*m+p*v,m===1-a){const x=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=x,c*=x,u*=x,d*=x}}e[n]=l,e[n+1]=c,e[n+2]=u,e[n+3]=d}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],u=r[i+3],d=s[o],f=s[o+1],h=s[o+2],A=s[o+3];return e[n]=a*A+u*d+l*h-c*f,e[n+1]=l*A+u*f+c*d-a*h,e[n+2]=c*A+u*h+a*f-l*d,e[n+3]=u*A-a*d-l*f-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),u=a(i/2),d=a(s/2),f=l(r/2),h=l(i/2),A=l(s/2);switch(o){case"XYZ":this._x=f*u*d+c*h*A,this._y=c*h*d-f*u*A,this._z=c*u*A+f*h*d,this._w=c*u*d-f*h*A;break;case"YXZ":this._x=f*u*d+c*h*A,this._y=c*h*d-f*u*A,this._z=c*u*A-f*h*d,this._w=c*u*d+f*h*A;break;case"ZXY":this._x=f*u*d-c*h*A,this._y=c*h*d+f*u*A,this._z=c*u*A+f*h*d,this._w=c*u*d-f*h*A;break;case"ZYX":this._x=f*u*d-c*h*A,this._y=c*h*d+f*u*A,this._z=c*u*A-f*h*d,this._w=c*u*d+f*h*A;break;case"YZX":this._x=f*u*d+c*h*A,this._y=c*h*d+f*u*A,this._z=c*u*A-f*h*d,this._w=c*u*d-f*h*A;break;case"XZY":this._x=f*u*d-c*h*A,this._y=c*h*d-f*u*A,this._z=c*u*A+f*h*d,this._w=c*u*d+f*h*A;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],o=n[1],a=n[5],l=n[9],c=n[2],u=n[6],d=n[10],f=r+a+d;if(f>0){const h=.5/Math.sqrt(f+1);this._w=.25/h,this._x=(u-l)*h,this._y=(s-c)*h,this._z=(o-i)*h}else if(r>a&&r>d){const h=2*Math.sqrt(1+r-a-d);this._w=(u-l)/h,this._x=.25*h,this._y=(i+o)/h,this._z=(s+c)/h}else if(a>d){const h=2*Math.sqrt(1+a-r-d);this._w=(s-c)/h,this._x=(i+o)/h,this._y=.25*h,this._z=(l+u)/h}else{const h=2*Math.sqrt(1+d-r-a);this._w=(o-i)/h,this._x=(s+c)/h,this._y=(l+u)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(yi(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,s=e._z,o=e._w,a=n._x,l=n._y,c=n._z,u=n._w;return this._x=r*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-r*c,this._z=s*u+o*c+r*l-i*a,this._w=o*u-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const h=1-n;return this._w=h*o+n*this._w,this._x=h*r+n*this._x,this._y=h*i+n*this._y,this._z=h*s+n*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),d=Math.sin((1-n)*u)/c,f=Math.sin(n*u)/c;return this._w=o*d+this._w*f,this._x=r*d+this._x*f,this._y=i*d+this._y*f,this._z=s*d+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class de{constructor(e=0,n=0,r=0){de.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(zF.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(zF.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),u=2*(a*n-s*i),d=2*(s*r-o*n);return this.x=n+l*c+o*d-a*u,this.y=r+l*u+a*c-s*d,this.z=i+l*d+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,o=n.x,a=n.y,l=n.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return PE.copy(this).projectOnVector(e),this.sub(PE)}reflect(e){return this.sub(PE.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(yi(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const PE=new de,zF=new $s;class ic{constructor(e=new de(1/0,1/0,1/0),n=new de(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n+=3)this.expandByPoint(Ra.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Ra.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=Ra.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Ra):Ra.fromBufferAttribute(s,o),Ra.applyMatrix4(e.matrixWorld),this.expandByPoint(Ra);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),eb.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),eb.copy(r.boundingBox)),eb.applyMatrix4(e.matrixWorld),this.union(eb)}const i=e.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[s],n);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ra),Ra.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter($g),tb.subVectors(this.max,$g),_A.subVectors(e.a,$g),SA.subVectors(e.b,$g),EA.subVectors(e.c,$g),Su.subVectors(SA,_A),Eu.subVectors(EA,SA),Lf.subVectors(_A,EA);let n=[0,-Su.z,Su.y,0,-Eu.z,Eu.y,0,-Lf.z,Lf.y,Su.z,0,-Su.x,Eu.z,0,-Eu.x,Lf.z,0,-Lf.x,-Su.y,Su.x,0,-Eu.y,Eu.x,0,-Lf.y,Lf.x,0];return!LE(n,_A,SA,EA,tb)||(n=[1,0,0,0,1,0,0,0,1],!LE(n,_A,SA,EA,tb))?!1:(nb.crossVectors(Su,Eu),n=[nb.x,nb.y,nb.z],LE(n,_A,SA,EA,tb))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ra).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ra).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(mc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const mc=[new de,new de,new de,new de,new de,new de,new de,new de],Ra=new de,eb=new ic,_A=new de,SA=new de,EA=new de,Su=new de,Eu=new de,Lf=new de,$g=new de,tb=new de,nb=new de,If=new de;function LE(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){If.fromArray(t,s);const a=i.x*Math.abs(If.x)+i.y*Math.abs(If.y)+i.z*Math.abs(If.z),l=e.dot(If),c=n.dot(If),u=r.dot(If);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const dae=new ic,qg=new de,IE=new de;class sc{constructor(e=new de,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):dae.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const r=this.center.distanceToSquared(e);return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;qg.subVectors(e,this.center);const n=qg.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(qg,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(IE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(qg.copy(e.center).add(IE)),this.expandByPoint(qg.copy(e.center).sub(IE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const gc=new de,OE=new de,rb=new de,Tu=new de,FE=new de,ib=new de,NE=new de;class wg{constructor(e=new de,n=new de(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,gc)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=gc.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(gc.copy(this.origin).addScaledVector(this.direction,n),gc.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){OE.copy(e).add(n).multiplyScalar(.5),rb.copy(n).sub(e).normalize(),Tu.copy(this.origin).sub(OE);const s=e.distanceTo(n)*.5,o=-this.direction.dot(rb),a=Tu.dot(this.direction),l=-Tu.dot(rb),c=Tu.lengthSq(),u=Math.abs(1-o*o);let d,f,h,A;if(u>0)if(d=o*l-a,f=o*a-l,A=s*u,d>=0)if(f>=-A)if(f<=A){const p=1/u;d*=p,f*=p,h=d*(d+o*f+2*a)+f*(o*d+f+2*l)+c}else f=s,d=Math.max(0,-(o*f+a)),h=-d*d+f*(f+2*l)+c;else f=-s,d=Math.max(0,-(o*f+a)),h=-d*d+f*(f+2*l)+c;else f<=-A?(d=Math.max(0,-(-o*s+a)),f=d>0?-s:Math.min(Math.max(-s,-l),s),h=-d*d+f*(f+2*l)+c):f<=A?(d=0,f=Math.min(Math.max(-s,-l),s),h=f*(f+2*l)+c):(d=Math.max(0,-(o*s+a)),f=d>0?s:Math.min(Math.max(-s,-l),s),h=-d*d+f*(f+2*l)+c);else f=o>0?-s:s,d=Math.max(0,-(o*f+a)),h=-d*d+f*(f+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(OE).addScaledVector(rb,f),h}intersectSphere(e,n){gc.subVectors(e.center,this.origin);const r=gc.dot(this.direction),i=gc.dot(gc)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,f=this.origin;return c>=0?(r=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(r=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o<i||isNaN(i))&&(i=o),d>=0?(a=(e.min.z-f.z)*d,l=(e.max.z-f.z)*d):(a=(e.max.z-f.z)*d,l=(e.min.z-f.z)*d),r>l||a>i)||((a>r||r!==r)&&(r=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,gc)!==null}intersectTriangle(e,n,r,i,s){FE.subVectors(n,e),ib.subVectors(r,e),NE.crossVectors(FE,ib);let o=this.direction.dot(NE),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Tu.subVectors(this.origin,e);const l=a*this.direction.dot(ib.crossVectors(Tu,ib));if(l<0)return null;const c=a*this.direction.dot(FE.cross(Tu));if(c<0||l+c>o)return null;const u=-a*Tu.dot(NE);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Zt{constructor(e,n,r,i,s,o,a,l,c,u,d,f,h,A,p,m){Zt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c,u,d,f,h,A,p,m)}set(e,n,r,i,s,o,a,l,c,u,d,f,h,A,p,m){const g=this.elements;return g[0]=e,g[4]=n,g[8]=r,g[12]=i,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=c,g[6]=u,g[10]=d,g[14]=f,g[3]=h,g[7]=A,g[11]=p,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Zt().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,i=1/TA.setFromMatrixColumn(e,0).length(),s=1/TA.setFromMatrixColumn(e,1).length(),o=1/TA.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const f=o*u,h=o*d,A=a*u,p=a*d;n[0]=l*u,n[4]=-l*d,n[8]=c,n[1]=h+A*c,n[5]=f-p*c,n[9]=-a*l,n[2]=p-f*c,n[6]=A+h*c,n[10]=o*l}else if(e.order==="YXZ"){const f=l*u,h=l*d,A=c*u,p=c*d;n[0]=f+p*a,n[4]=A*a-h,n[8]=o*c,n[1]=o*d,n[5]=o*u,n[9]=-a,n[2]=h*a-A,n[6]=p+f*a,n[10]=o*l}else if(e.order==="ZXY"){const f=l*u,h=l*d,A=c*u,p=c*d;n[0]=f-p*a,n[4]=-o*d,n[8]=A+h*a,n[1]=h+A*a,n[5]=o*u,n[9]=p-f*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const f=o*u,h=o*d,A=a*u,p=a*d;n[0]=l*u,n[4]=A*c-h,n[8]=f*c+p,n[1]=l*d,n[5]=p*c+f,n[9]=h*c-A,n[2]=-c,n[6]=a*l,n[10]=o*l}else if(e.order==="YZX"){const f=o*l,h=o*c,A=a*l,p=a*c;n[0]=l*u,n[4]=p-f*d,n[8]=A*d+h,n[1]=d,n[5]=o*u,n[9]=-a*u,n[2]=-c*u,n[6]=h*d+A,n[10]=f-p*d}else if(e.order==="XZY"){const f=o*l,h=o*c,A=a*l,p=a*c;n[0]=l*u,n[4]=-d,n[8]=c*u,n[1]=f*d+p,n[5]=o*u,n[9]=h*d-A,n[2]=A*d-h,n[6]=a*u,n[10]=p*d+f}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(fae,e,hae)}lookAt(e,n,r){const i=this.elements;return xo.subVectors(e,n),xo.lengthSq()===0&&(xo.z=1),xo.normalize(),Bu.crossVectors(r,xo),Bu.lengthSq()===0&&(Math.abs(r.z)===1?xo.x+=1e-4:xo.z+=1e-4,xo.normalize(),Bu.crossVectors(r,xo)),Bu.normalize(),sb.crossVectors(xo,Bu),i[0]=Bu.x,i[4]=sb.x,i[8]=xo.x,i[1]=Bu.y,i[5]=sb.y,i[9]=xo.y,i[2]=Bu.z,i[6]=sb.z,i[10]=xo.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],u=r[1],d=r[5],f=r[9],h=r[13],A=r[2],p=r[6],m=r[10],g=r[14],y=r[3],w=r[7],v=r[11],x=r[15],C=i[0],_=i[4],S=i[8],E=i[12],T=i[1],R=i[5],k=i[9],B=i[13],M=i[2],F=i[6],I=i[10],z=i[14],Y=i[3],$=i[7],ee=i[11],W=i[15];return s[0]=o*C+a*T+l*M+c*Y,s[4]=o*_+a*R+l*F+c*$,s[8]=o*S+a*k+l*I+c*ee,s[12]=o*E+a*B+l*z+c*W,s[1]=u*C+d*T+f*M+h*Y,s[5]=u*_+d*R+f*F+h*$,s[9]=u*S+d*k+f*I+h*ee,s[13]=u*E+d*B+f*z+h*W,s[2]=A*C+p*T+m*M+g*Y,s[6]=A*_+p*R+m*F+g*$,s[10]=A*S+p*k+m*I+g*ee,s[14]=A*E+p*B+m*z+g*W,s[3]=y*C+w*T+v*M+x*Y,s[7]=y*_+w*R+v*F+x*$,s[11]=y*S+w*k+v*I+x*ee,s[15]=y*E+w*B+v*z+x*W,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],d=e[6],f=e[10],h=e[14],A=e[3],p=e[7],m=e[11],g=e[15];return A*(+s*l*d-i*c*d-s*a*f+r*c*f+i*a*h-r*l*h)+p*(+n*l*h-n*c*f+s*o*f-i*o*h+i*c*u-s*l*u)+m*(+n*c*d-n*a*h-s*o*d+r*o*h+s*a*u-r*c*u)+g*(-i*a*u-n*l*d+n*a*f+i*o*d-r*o*f+r*l*u)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=e[9],f=e[10],h=e[11],A=e[12],p=e[13],m=e[14],g=e[15],y=d*m*c-p*f*c+p*l*h-a*m*h-d*l*g+a*f*g,w=A*f*c-u*m*c-A*l*h+o*m*h+u*l*g-o*f*g,v=u*p*c-A*d*c+A*a*h-o*p*h-u*a*g+o*d*g,x=A*d*l-u*p*l-A*a*f+o*p*f+u*a*m-o*d*m,C=n*y+r*w+i*v+s*x;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/C;return e[0]=y*_,e[1]=(p*f*s-d*m*s-p*i*h+r*m*h+d*i*g-r*f*g)*_,e[2]=(a*m*s-p*l*s+p*i*c-r*m*c-a*i*g+r*l*g)*_,e[3]=(d*l*s-a*f*s-d*i*c+r*f*c+a*i*h-r*l*h)*_,e[4]=w*_,e[5]=(u*m*s-A*f*s+A*i*h-n*m*h-u*i*g+n*f*g)*_,e[6]=(A*l*s-o*m*s-A*i*c+n*m*c+o*i*g-n*l*g)*_,e[7]=(o*f*s-u*l*s+u*i*c-n*f*c-o*i*h+n*l*h)*_,e[8]=v*_,e[9]=(A*d*s-u*p*s-A*r*h+n*p*h+u*r*g-n*d*g)*_,e[10]=(o*p*s-A*a*s+A*r*c-n*p*c-o*r*g+n*a*g)*_,e[11]=(u*a*s-o*d*s-u*r*c+n*d*c+o*r*h-n*a*h)*_,e[12]=x*_,e[13]=(u*p*i-A*d*i+A*r*f-n*p*f-u*r*m+n*d*m)*_,e[14]=(A*a*i-o*p*i-A*r*l+n*p*l+o*r*m-n*a*m)*_,e[15]=(o*d*i-u*a*i+u*r*l-n*d*l-o*r*f+n*a*f)*_,this}scale(e){const n=this.elements,r=e.x,i=e.y,s=e.z;return n[0]*=r,n[4]*=i,n[8]*=s,n[1]*=r,n[5]*=i,n[9]*=s,n[2]*=r,n[6]*=i,n[10]*=s,n[3]*=r,n[7]*=i,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+r,u*l-i*o,0,c*l-i*a,u*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,u=o+o,d=a+a,f=s*c,h=s*u,A=s*d,p=o*u,m=o*d,g=a*d,y=l*c,w=l*u,v=l*d,x=r.x,C=r.y,_=r.z;return i[0]=(1-(p+g))*x,i[1]=(h+v)*x,i[2]=(A-w)*x,i[3]=0,i[4]=(h-v)*C,i[5]=(1-(f+g))*C,i[6]=(m+y)*C,i[7]=0,i[8]=(A+w)*_,i[9]=(m-y)*_,i[10]=(1-(f+p))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;let s=TA.set(i[0],i[1],i[2]).length();const o=TA.set(i[4],i[5],i[6]).length(),a=TA.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Pa.copy(this);const c=1/s,u=1/o,d=1/a;return Pa.elements[0]*=c,Pa.elements[1]*=c,Pa.elements[2]*=c,Pa.elements[4]*=u,Pa.elements[5]*=u,Pa.elements[6]*=u,Pa.elements[8]*=d,Pa.elements[9]*=d,Pa.elements[10]*=d,n.setFromRotationMatrix(Pa),r.x=s,r.y=o,r.z=a,this}makePerspective(e,n,r,i,s,o,a=Fc){const l=this.elements,c=2*s/(n-e),u=2*s/(r-i),d=(n+e)/(n-e),f=(r+i)/(r-i);let h,A;if(a===Fc)h=-(o+s)/(o-s),A=-2*o*s/(o-s);else if(a===PC)h=-o/(o-s),A=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=h,l[14]=A,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,s,o,a=Fc){const l=this.elements,c=1/(n-e),u=1/(r-i),d=1/(o-s),f=(n+e)*c,h=(r+i)*u;let A,p;if(a===Fc)A=(o+s)*d,p=-2*d;else if(a===PC)A=s*d,p=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-h,l[2]=0,l[6]=0,l[10]=p,l[14]=-A,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const TA=new de,Pa=new Zt,fae=new de(0,0,0),hae=new de(1,1,1),Bu=new de,sb=new de,xo=new de,VF=new Zt,GF=new $s;class el{constructor(e=0,n=0,r=0,i=el.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],d=i[2],f=i[6],h=i[10];switch(n){case"XYZ":this._y=Math.asin(yi(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,h),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-yi(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(yi(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,h),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-yi(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,h),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(yi(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-yi(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return VF.makeRotationFromQuaternion(e),this.setFromRotationMatrix(VF,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return GF.setFromEuler(this),this.setFromQuaternion(GF,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}el.DEFAULT_ORDER="XYZ";let eL=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},Aae=0;const WF=new de,BA=new $s,yc=new Zt,ob=new de,Xg=new de,pae=new de,mae=new $s,KF=new de(1,0,0),$F=new de(0,1,0),qF=new de(0,0,1),XF={type:"added"},gae={type:"removed"},MA={type:"childadded",child:null},DE={type:"childremoved",child:null};class Sr extends iA{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Aae++}),this.uuid=ma(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Sr.DEFAULT_UP.clone();const e=new de,n=new el,r=new $s,i=new de(1,1,1);function s(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Zt},normalMatrix:{value:new ln}}),this.matrix=new Zt,this.matrixWorld=new Zt,this.matrixAutoUpdate=Sr.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Sr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new eL,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return BA.setFromAxisAngle(e,n),this.quaternion.multiply(BA),this}rotateOnWorldAxis(e,n){return BA.setFromAxisAngle(e,n),this.quaternion.premultiply(BA),this}rotateX(e){return this.rotateOnAxis(KF,e)}rotateY(e){return this.rotateOnAxis($F,e)}rotateZ(e){return this.rotateOnAxis(qF,e)}translateOnAxis(e,n){return WF.copy(e).applyQuaternion(this.quaternion),this.position.add(WF.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(KF,e)}translateY(e){return this.translateOnAxis($F,e)}translateZ(e){return this.translateOnAxis(qF,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(yc.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?ob.copy(e):ob.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),Xg.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?yc.lookAt(Xg,ob,this.up):yc.lookAt(ob,Xg,this.up),this.quaternion.setFromRotationMatrix(yc),i&&(yc.extractRotation(i.matrixWorld),BA.setFromRotationMatrix(yc),this.quaternion.premultiply(BA.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(XF),MA.child=e,this.dispatchEvent(MA),MA.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(gae),DE.child=e,this.dispatchEvent(DE),DE.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),yc.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),yc.multiply(e.parent.matrixWorld)),e.applyMatrix4(yc),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(XF),MA.child=e,this.dispatchEvent(MA),MA.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let r=0,i=this.children.length;r<i;r++){const o=this.children[r].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xg,e,pae),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xg,mae,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].updateMatrixWorld(e)}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(n){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),d=o(e.shapes),f=o(e.skeletons),h=o(e.animations),A=o(e.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),u.length>0&&(r.images=u),d.length>0&&(r.shapes=d),f.length>0&&(r.skeletons=f),h.length>0&&(r.animations=h),A.length>0&&(r.nodes=A)}return r.object=i,r;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}Sr.DEFAULT_UP=new de(0,1,0);Sr.DEFAULT_MATRIX_AUTO_UPDATE=!0;Sr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const La=new de,vc=new de,UE=new de,bc=new de,kA=new de,RA=new de,YF=new de,HE=new de,jE=new de,QE=new de;class za{constructor(e=new de,n=new de,r=new de){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),La.subVectors(e,n),i.cross(La);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){La.subVectors(i,n),vc.subVectors(r,n),UE.subVectors(e,n);const o=La.dot(La),a=La.dot(vc),l=La.dot(UE),c=vc.dot(vc),u=vc.dot(UE),d=o*c-a*a;if(d===0)return s.set(0,0,0),null;const f=1/d,h=(c*l-a*u)*f,A=(o*u-a*l)*f;return s.set(1-h-A,A,h)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,bc)===null?!1:bc.x>=0&&bc.y>=0&&bc.x+bc.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,bc)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,bc.x),l.addScaledVector(o,bc.y),l.addScaledVector(a,bc.z),l)}static isFrontFacing(e,n,r,i){return La.subVectors(r,n),vc.subVectors(e,n),La.cross(vc).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return La.subVectors(this.c,this.b),vc.subVectors(this.a,this.b),La.cross(vc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return za.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return za.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return za.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return za.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return za.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let o,a;kA.subVectors(i,r),RA.subVectors(s,r),HE.subVectors(e,r);const l=kA.dot(HE),c=RA.dot(HE);if(l<=0&&c<=0)return n.copy(r);jE.subVectors(e,i);const u=kA.dot(jE),d=RA.dot(jE);if(u>=0&&d<=u)return n.copy(i);const f=l*d-u*c;if(f<=0&&l>=0&&u<=0)return o=l/(l-u),n.copy(r).addScaledVector(kA,o);QE.subVectors(e,s);const h=kA.dot(QE),A=RA.dot(QE);if(A>=0&&h<=A)return n.copy(s);const p=h*c-l*A;if(p<=0&&c>=0&&A<=0)return a=c/(c-A),n.copy(r).addScaledVector(RA,a);const m=u*A-h*d;if(m<=0&&d-u>=0&&h-A>=0)return YF.subVectors(s,i),a=(d-u)/(d-u+(h-A)),n.copy(i).addScaledVector(YF,a);const g=1/(m+p+f);return o=p*g,a=f*g,n.copy(r).addScaledVector(kA,o).addScaledVector(RA,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const YG={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},Mu={h:0,s:0,l:0},ab={h:0,s:0,l:0};function zE(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}let Nt=class{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Ki){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Nn.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=Nn.workingColorSpace){return this.r=e,this.g=n,this.b=r,Nn.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=Nn.workingColorSpace){if(e=JP(e,1),n=yi(n,0,1),r=yi(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=zE(o,s,e+1/3),this.g=zE(o,s,e),this.b=zE(o,s,e-1/3)}return Nn.toWorkingColorSpace(this,i),this}setStyle(e,n=Ki){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Ki){const r=YG[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=$p(e.r),this.g=$p(e.g),this.b=$p(e.b),this}copyLinearToSRGB(e){return this.r=kE(e.r),this.g=kE(e.g),this.b=kE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ki){return Nn.fromWorkingColorSpace(hs.copy(this),e),Math.round(yi(hs.r*255,0,255))*65536+Math.round(yi(hs.g*255,0,255))*256+Math.round(yi(hs.b*255,0,255))}getHexString(e=Ki){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Nn.workingColorSpace){Nn.fromWorkingColorSpace(hs.copy(this),n);const r=hs.r,i=hs.g,s=hs.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const d=o-a;switch(c=u<=.5?d/(o+a):d/(2-o-a),o){case r:l=(i-s)/d+(i<s?6:0);break;case i:l=(s-r)/d+2;break;case s:l=(r-i)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,n=Nn.workingColorSpace){return Nn.fromWorkingColorSpace(hs.copy(this),n),e.r=hs.r,e.g=hs.g,e.b=hs.b,e}getStyle(e=Ki){Nn.fromWorkingColorSpace(hs.copy(this),e);const n=hs.r,r=hs.g,i=hs.b;return e!==Ki?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(Mu),this.setHSL(Mu.h+e,Mu.s+n,Mu.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(Mu),e.getHSL(ab);const r=c1(Mu.h,ab.h,n),i=c1(Mu.s,ab.s,n),s=c1(Mu.l,ab.l,n);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*n+s[3]*r+s[6]*i,this.g=s[1]*n+s[4]*r+s[7]*i,this.b=s[2]*n+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const hs=new Nt;Nt.NAMES=YG;let yae=0;class jl extends iA{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:yae++}),this.uuid=ma(),this.name="",this.type="Material",this.blending=Gp,this.side=qc,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=K3,this.blendDst=$3,this.blendEquation=Zf,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Nt(0,0,0),this.blendAlpha=0,this.depthFunc=TC,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=NF,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=xA,this.stencilZFail=xA,this.stencilZPass=xA,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Gp&&(r.blending=this.blending),this.side!==qc&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==K3&&(r.blendSrc=this.blendSrc),this.blendDst!==$3&&(r.blendDst=this.blendDst),this.blendEquation!==Zf&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==TC&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==NF&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==xA&&(r.stencilFail=this.stencilFail),this.stencilZFail!==xA&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==xA&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(n){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class ei extends jl{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Nt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new el,this.combine=LG,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ri=new de,lb=new Ze;class Fi{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=_M,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Wa,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return ZP("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=n.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)lb.fromBufferAttribute(this,n),lb.applyMatrix3(e),this.setXY(n,lb.x,lb.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)ri.fromBufferAttribute(this,n),ri.applyMatrix3(e),this.setXYZ(n,ri.x,ri.y,ri.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)ri.fromBufferAttribute(this,n),ri.applyMatrix4(e),this.setXYZ(n,ri.x,ri.y,ri.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)ri.fromBufferAttribute(this,n),ri.applyNormalMatrix(e),this.setXYZ(n,ri.x,ri.y,ri.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)ri.fromBufferAttribute(this,n),ri.transformDirection(e),this.setXYZ(n,ri.x,ri.y,ri.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=Qa(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Wn(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Qa(n,this.array)),n}setX(e,n){return this.normalized&&(n=Wn(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Qa(n,this.array)),n}setY(e,n){return this.normalized&&(n=Wn(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Qa(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Wn(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Qa(n,this.array)),n}setW(e,n){return this.normalized&&(n=Wn(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Wn(n,this.array),r=Wn(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=Wn(n,this.array),r=Wn(r,this.array),i=Wn(i,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=Wn(n,this.array),r=Wn(r,this.array),i=Wn(i,this.array),s=Wn(s,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==_M&&(e.usage=this.usage),e}}class JG extends Fi{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class ZG extends Fi{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class hi extends Fi{constructor(e,n,r){super(new Float32Array(e),n,r)}}let vae=0;const Xo=new Zt,VE=new Sr,PA=new de,Co=new ic,Yg=new ic,Bi=new de;class Ai extends iA{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:vae++}),this.uuid=ma(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new($G(e)?ZG:JG)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,r=0){this.groups.push({start:e,count:n,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const s=new ln().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Xo.makeRotationFromQuaternion(e),this.applyMatrix4(Xo),this}rotateX(e){return Xo.makeRotationX(e),this.applyMatrix4(Xo),this}rotateY(e){return Xo.makeRotationY(e),this.applyMatrix4(Xo),this}rotateZ(e){return Xo.makeRotationZ(e),this.applyMatrix4(Xo),this}translate(e,n,r){return Xo.makeTranslation(e,n,r),this.applyMatrix4(Xo),this}scale(e,n,r){return Xo.makeScale(e,n,r),this.applyMatrix4(Xo),this}lookAt(e){return VE.lookAt(e),VE.updateMatrix(),this.applyMatrix4(VE.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(PA).negate(),this.translate(PA.x,PA.y,PA.z),this}setFromPoints(e){const n=[];for(let r=0,i=e.length;r<i;r++){const s=e[r];n.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new hi(n,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ic);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new de(-1/0,-1/0,-1/0),new de(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,i=n.length;r<i;r++){const s=n[r];Co.setFromBufferAttribute(s),this.morphTargetsRelative?(Bi.addVectors(this.boundingBox.min,Co.min),this.boundingBox.expandByPoint(Bi),Bi.addVectors(this.boundingBox.max,Co.max),this.boundingBox.expandByPoint(Bi)):(this.boundingBox.expandByPoint(Co.min),this.boundingBox.expandByPoint(Co.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new sc);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new de,1/0);return}if(e){const r=this.boundingSphere.center;if(Co.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const a=n[s];Yg.setFromBufferAttribute(a),this.morphTargetsRelative?(Bi.addVectors(Co.min,Yg.min),Co.expandByPoint(Bi),Bi.addVectors(Co.max,Yg.max),Co.expandByPoint(Bi)):(Co.expandByPoint(Yg.min),Co.expandByPoint(Yg.max))}Co.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)Bi.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(Bi));if(n)for(let s=0,o=n.length;s<o;s++){const a=n[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Bi.fromBufferAttribute(a,c),l&&(PA.fromBufferAttribute(e,c),Bi.add(PA)),i=Math.max(i,r.distanceToSquared(Bi))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=n.position,i=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Fi(new Float32Array(4*r.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let S=0;S<r.count;S++)a[S]=new de,l[S]=new de;const c=new de,u=new de,d=new de,f=new Ze,h=new Ze,A=new Ze,p=new de,m=new de;function g(S,E,T){c.fromBufferAttribute(r,S),u.fromBufferAttribute(r,E),d.fromBufferAttribute(r,T),f.fromBufferAttribute(s,S),h.fromBufferAttribute(s,E),A.fromBufferAttribute(s,T),u.sub(c),d.sub(c),h.sub(f),A.sub(f);const R=1/(h.x*A.y-A.x*h.y);isFinite(R)&&(p.copy(u).multiplyScalar(A.y).addScaledVector(d,-h.y).multiplyScalar(R),m.copy(d).multiplyScalar(h.x).addScaledVector(u,-A.x).multiplyScalar(R),a[S].add(p),a[E].add(p),a[T].add(p),l[S].add(m),l[E].add(m),l[T].add(m))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let S=0,E=y.length;S<E;++S){const T=y[S],R=T.start,k=T.count;for(let B=R,M=R+k;B<M;B+=3)g(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const w=new de,v=new de,x=new de,C=new de;function _(S){x.fromBufferAttribute(i,S),C.copy(x);const E=a[S];w.copy(E),w.sub(x.multiplyScalar(x.dot(E))).normalize(),v.crossVectors(C,E);const R=v.dot(l[S])<0?-1:1;o.setXYZW(S,w.x,w.y,w.z,R)}for(let S=0,E=y.length;S<E;++S){const T=y[S],R=T.start,k=T.count;for(let B=R,M=R+k;B<M;B+=3)_(e.getX(B+0)),_(e.getX(B+1)),_(e.getX(B+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Fi(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let f=0,h=r.count;f<h;f++)r.setXYZ(f,0,0,0);const i=new de,s=new de,o=new de,a=new de,l=new de,c=new de,u=new de,d=new de;if(e)for(let f=0,h=e.count;f<h;f+=3){const A=e.getX(f+0),p=e.getX(f+1),m=e.getX(f+2);i.fromBufferAttribute(n,A),s.fromBufferAttribute(n,p),o.fromBufferAttribute(n,m),u.subVectors(o,s),d.subVectors(i,s),u.cross(d),a.fromBufferAttribute(r,A),l.fromBufferAttribute(r,p),c.fromBufferAttribute(r,m),a.add(u),l.add(u),c.add(u),r.setXYZ(A,a.x,a.y,a.z),r.setXYZ(p,l.x,l.y,l.z),r.setXYZ(m,c.x,c.y,c.z)}else for(let f=0,h=n.count;f<h;f+=3)i.fromBufferAttribute(n,f+0),s.fromBufferAttribute(n,f+1),o.fromBufferAttribute(n,f+2),u.subVectors(o,s),d.subVectors(i,s),u.cross(d),r.setXYZ(f+0,u.x,u.y,u.z),r.setXYZ(f+1,u.x,u.y,u.z),r.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)Bi.fromBufferAttribute(e,n),Bi.normalize(),e.setXYZ(n,Bi.x,Bi.y,Bi.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,d=a.normalized,f=new c.constructor(l.length*u);let h=0,A=0;for(let p=0,m=l.length;p<m;p++){a.isInterleavedBufferAttribute?h=l[p]*a.data.stride+a.offset:h=l[p]*u;for(let g=0;g<u;g++)f[A++]=c[h++]}return new Fi(f,u,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Ai,r=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,r);n.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,d=c.length;u<d;u++){const f=c[u],h=e(f,r);l.push(h)}n.morphAttributes[a]=l}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];n.addGroup(c.start,c.count,c.materialIndex)}return n}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,f=c.length;d<f;d++){const h=c[d];u.push(h.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(n))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let f=0,h=d.length;f<h;f++)u.push(d[f].clone(n));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const d=o[c];this.addGroup(d.start,d.count,d.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const JF=new Zt,Of=new wg,cb=new sc,ZF=new de,LA=new de,IA=new de,OA=new de,GE=new de,ub=new de,db=new Ze,fb=new Ze,hb=new Ze,eN=new de,tN=new de,nN=new de,Ab=new de,pb=new de;class xn extends Sr{constructor(e=new Ai,n=new ei){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,o=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){ub.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],d=s[l];u!==0&&(GE.fromBufferAttribute(d,e),o?ub.addScaledVector(GE,u):ub.addScaledVector(GE.sub(n),u))}n.add(ub)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),cb.copy(r.boundingSphere),cb.applyMatrix4(s),Of.copy(e.ray).recast(e.near),!(cb.containsPoint(Of.origin)===!1&&(Of.intersectSphere(cb,ZF)===null||Of.origin.distanceToSquared(ZF)>(e.far-e.near)**2))&&(JF.copy(s).invert(),Of.copy(e.ray).applyMatrix4(JF),!(r.boundingBox!==null&&Of.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Of)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,f=s.groups,h=s.drawRange;if(a!==null)if(Array.isArray(o))for(let A=0,p=f.length;A<p;A++){const m=f[A],g=o[m.materialIndex],y=Math.max(m.start,h.start),w=Math.min(a.count,Math.min(m.start+m.count,h.start+h.count));for(let v=y,x=w;v<x;v+=3){const C=a.getX(v),_=a.getX(v+1),S=a.getX(v+2);i=mb(this,g,e,r,c,u,d,C,_,S),i&&(i.faceIndex=Math.floor(v/3),i.face.materialIndex=m.materialIndex,n.push(i))}}else{const A=Math.max(0,h.start),p=Math.min(a.count,h.start+h.count);for(let m=A,g=p;m<g;m+=3){const y=a.getX(m),w=a.getX(m+1),v=a.getX(m+2);i=mb(this,o,e,r,c,u,d,y,w,v),i&&(i.faceIndex=Math.floor(m/3),n.push(i))}}else if(l!==void 0)if(Array.isArray(o))for(let A=0,p=f.length;A<p;A++){const m=f[A],g=o[m.materialIndex],y=Math.max(m.start,h.start),w=Math.min(l.count,Math.min(m.start+m.count,h.start+h.count));for(let v=y,x=w;v<x;v+=3){const C=v,_=v+1,S=v+2;i=mb(this,g,e,r,c,u,d,C,_,S),i&&(i.faceIndex=Math.floor(v/3),i.face.materialIndex=m.materialIndex,n.push(i))}}else{const A=Math.max(0,h.start),p=Math.min(l.count,h.start+h.count);for(let m=A,g=p;m<g;m+=3){const y=m,w=m+1,v=m+2;i=mb(this,o,e,r,c,u,d,y,w,v),i&&(i.faceIndex=Math.floor(m/3),n.push(i))}}}}function bae(t,e,n,r,i,s,o,a){let l;if(e.side===Ao?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,e.side===qc,a),l===null)return null;pb.copy(a),pb.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(pb);return c<n.near||c>n.far?null:{distance:c,point:pb.clone(),object:t}}function mb(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,LA),t.getVertexPosition(l,IA),t.getVertexPosition(c,OA);const u=bae(t,e,n,r,LA,IA,OA,Ab);if(u){i&&(db.fromBufferAttribute(i,a),fb.fromBufferAttribute(i,l),hb.fromBufferAttribute(i,c),u.uv=za.getInterpolation(Ab,LA,IA,OA,db,fb,hb,new Ze)),s&&(db.fromBufferAttribute(s,a),fb.fromBufferAttribute(s,l),hb.fromBufferAttribute(s,c),u.uv1=za.getInterpolation(Ab,LA,IA,OA,db,fb,hb,new Ze)),o&&(eN.fromBufferAttribute(o,a),tN.fromBufferAttribute(o,l),nN.fromBufferAttribute(o,c),u.normal=za.getInterpolation(Ab,LA,IA,OA,eN,tN,nN,new de),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:l,c,normal:new de,materialIndex:0};za.getNormal(LA,IA,OA,d.normal),u.face=d}return u}class Wl extends Ai{constructor(e=1,n=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],d=[];let f=0,h=0;A("z","y","x",-1,-1,r,n,e,o,s,0),A("z","y","x",1,-1,r,n,-e,o,s,1),A("x","z","y",1,1,e,r,n,i,o,2),A("x","z","y",1,-1,e,r,-n,i,o,3),A("x","y","z",1,-1,e,n,r,i,s,4),A("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new hi(c,3)),this.setAttribute("normal",new hi(u,3)),this.setAttribute("uv",new hi(d,2));function A(p,m,g,y,w,v,x,C,_,S,E){const T=v/_,R=x/S,k=v/2,B=x/2,M=C/2,F=_+1,I=S+1;let z=0,Y=0;const $=new de;for(let ee=0;ee<I;ee++){const W=ee*R-B;for(let ne=0;ne<F;ne++){const Se=ne*T-k;$[p]=Se*y,$[m]=W*w,$[g]=M,c.push($.x,$.y,$.z),$[p]=0,$[m]=0,$[g]=C>0?1:-1,u.push($.x,$.y,$.z),d.push(ne/_),d.push(1-ee/S),z+=1}}for(let ee=0;ee<S;ee++)for(let W=0;W<_;W++){const ne=f+W+F*ee,Se=f+W+F*(ee+1),fe=f+(W+1)+F*(ee+1),ge=f+(W+1)+F*ee;l.push(ne,Se,ge),l.push(Se,fe,ge),Y+=6}a.addGroup(h,Y,E),h+=Y,f+=z}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wl(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Tm(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function Ls(t){const e={};for(let n=0;n<t.length;n++){const r=Tm(t[n]);for(const i in r)e[i]=r[i]}return e}function wae(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function eW(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Nn.workingColorSpace}const xae={clone:Tm,merge:Ls};var Cae=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,_ae=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class Zd extends jl{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Cae,this.fragmentShader=_ae,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Tm(e.uniforms),this.uniformsGroups=wae(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?n.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[i]={type:"m4",value:o.toArray()}:n.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class tW extends Sr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Zt,this.projectionMatrix=new Zt,this.projectionMatrixInverse=new Zt,this.coordinateSystem=Fc}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const ku=new de,rN=new Ze,iN=new Ze;class Fn extends tW{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=Em*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Kp*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Em*2*Math.atan(Math.tan(Kp*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){ku.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ku.x,ku.y).multiplyScalar(-e/ku.z),ku.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(ku.x,ku.y).multiplyScalar(-e/ku.z)}getViewSize(e,n){return this.getViewBounds(e,rN,iN),n.subVectors(iN,rN)}setViewOffset(e,n,r,i,s,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Kp*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,n-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const FA=-90,NA=1;class Sae extends Sr{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Fn(FA,NA,e,n);i.layers=this.layers,this.add(i);const s=new Fn(FA,NA,e,n);s.layers=this.layers,this.add(s);const o=new Fn(FA,NA,e,n);o.layers=this.layers,this.add(o);const a=new Fn(FA,NA,e,n);a.layers=this.layers,this.add(a);const l=new Fn(FA,NA,e,n);l.layers=this.layers,this.add(l);const c=new Fn(FA,NA,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===Fc)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===PC)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,d=e.getRenderTarget(),f=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),A=e.xr.enabled;e.xr.enabled=!1;const p=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(n,s),e.setRenderTarget(r,1,i),e.render(n,o),e.setRenderTarget(r,2,i),e.render(n,a),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,c),r.texture.generateMipmaps=p,e.setRenderTarget(r,5,i),e.render(n,u),e.setRenderTarget(d,f,h),e.xr.enabled=A,r.texture.needsPMREMUpdate=!0}}class nW extends Oi{constructor(e,n,r,i,s,o,a,l,c,u){e=e!==void 0?e:[],n=n!==void 0?n:wm,super(e,n,r,i,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Eae extends Dh{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new nW(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Io}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

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

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

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},i=new Wl(5,5,5),s=new Zd({name:"CubemapFromEquirect",uniforms:Tm(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Ao,blending:Rd});s.uniforms.tEquirect.value=n;const o=new xn(i,s),a=n.minFilter;return n.minFilter===Oc&&(n.minFilter=Io),new Sae(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,r,i);e.setRenderTarget(s)}}const WE=new de,Tae=new de,Bae=new ln;class Vu{constructor(e=new de(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=WE.subVectors(r,n).cross(Tae.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(WE),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const r=n||Bae.getNormalMatrix(e),i=this.coplanarPoint(WE).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ff=new sc,gb=new de;class tL{constructor(e=new Vu,n=new Vu,r=new Vu,i=new Vu,s=new Vu,o=new Vu){this.planes=[e,n,r,i,s,o]}set(e,n,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Fc){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],d=i[6],f=i[7],h=i[8],A=i[9],p=i[10],m=i[11],g=i[12],y=i[13],w=i[14],v=i[15];if(r[0].setComponents(l-s,f-c,m-h,v-g).normalize(),r[1].setComponents(l+s,f+c,m+h,v+g).normalize(),r[2].setComponents(l+o,f+u,m+A,v+y).normalize(),r[3].setComponents(l-o,f-u,m-A,v-y).normalize(),r[4].setComponents(l-a,f-d,m-p,v-w).normalize(),n===Fc)r[5].setComponents(l+a,f+d,m+p,v+w).normalize();else if(n===PC)r[5].setComponents(a,d,p,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ff.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Ff.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ff)}intersectsSprite(e){return Ff.center.set(0,0,0),Ff.radius=.7071067811865476,Ff.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ff)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if(gb.x=i.normal.x>0?e.max.x:e.min.x,gb.y=i.normal.y>0?e.max.y:e.min.y,gb.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(gb)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function rW(){let t=null,e=!1,n=null,r=null;function i(s,o){n(s,o),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function Mae(t){const e=new WeakMap;function n(a,l){const c=a.array,u=a.usage,d=c.byteLength,f=t.createBuffer();t.bindBuffer(l,f),t.bufferData(l,c,u),a.onUploadCallback();let h;if(c instanceof Float32Array)h=t.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?h=t.HALF_FLOAT:h=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)h=t.SHORT;else if(c instanceof Uint32Array)h=t.UNSIGNED_INT;else if(c instanceof Int32Array)h=t.INT;else if(c instanceof Int8Array)h=t.BYTE;else if(c instanceof Uint8Array)h=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)h=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:h,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:d}}function r(a,l,c){const u=l.array,d=l._updateRange,f=l.updateRanges;if(t.bindBuffer(c,a),d.count===-1&&f.length===0&&t.bufferSubData(c,0,u),f.length!==0){for(let h=0,A=f.length;h<A;h++){const p=f[h];t.bufferSubData(c,p.start*u.BYTES_PER_ELEMENT,u,p.start,p.count)}l.clearUpdateRanges()}d.count!==-1&&(t.bufferSubData(c,d.offset*u.BYTES_PER_ELEMENT,u,d.offset,d.count),d.count=-1),l.onUploadCallback()}function i(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(t.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isGLBufferAttribute){const u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}a.isInterleavedBufferAttribute&&(a=a.data);const c=e.get(a);if(c===void 0)e.set(a,n(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(c.buffer,a,l),c.version=a.version}}return{get:i,remove:s,update:o}}class tv extends Ai{constructor(e=1,n=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:i};const s=e/2,o=n/2,a=Math.floor(r),l=Math.floor(i),c=a+1,u=l+1,d=e/a,f=n/l,h=[],A=[],p=[],m=[];for(let g=0;g<u;g++){const y=g*f-o;for(let w=0;w<c;w++){const v=w*d-s;A.push(v,-y,0),p.push(0,0,1),m.push(w/a),m.push(1-g/l)}}for(let g=0;g<l;g++)for(let y=0;y<a;y++){const w=y+c*g,v=y+c*(g+1),x=y+1+c*(g+1),C=y+1+c*g;h.push(w,v,C),h.push(v,x,C)}this.setIndex(h),this.setAttribute("position",new hi(A,3)),this.setAttribute("normal",new hi(p,3)),this.setAttribute("uv",new hi(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tv(e.width,e.height,e.widthSegments,e.heightSegments)}}var kae=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,Rae=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,Pae=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,Lae=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,Iae=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,Oae=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,Fae=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,Nae=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,Dae=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec3 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
	}
#endif`,Uae=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,Hae=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,jae=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,Qae=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,zae=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,Vae=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,Gae=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,Wae=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,Kae=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,$ae=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,qae=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,Xae=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,Yae=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec3 vColor;
#endif`,Jae=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
	vColor.xyz *= batchingColor.xyz;
#endif`,Zae=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
float luminance( const in vec3 rgb ) {
	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
	return dot( weights, rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,ele=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,tle=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,nle=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,rle=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,ile=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,sle=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,ole="gl_FragColor = linearToOutputTexel( gl_FragColor );",ale=`
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
	vec3( 0.8224621, 0.177538, 0.0 ),
	vec3( 0.0331941, 0.9668058, 0.0 ),
	vec3( 0.0170827, 0.0723974, 0.9105199 )
);
const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
	vec3( 1.2249401, - 0.2249404, 0.0 ),
	vec3( - 0.0420569, 1.0420571, 0.0 ),
	vec3( - 0.0196376, - 0.0786361, 1.0982735 )
);
vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
	return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
}
vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
	return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
}
vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}
vec4 LinearToLinear( in vec4 value ) {
	return value;
}
vec4 LinearTosRGB( in vec4 value ) {
	return sRGBTransferOETF( value );
}`,lle=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,cle=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,ule=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,dle=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,fle=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,hle=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,Ale=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,ple=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,mle=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,gle=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,yle=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,vle=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,ble=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,wle=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,xle=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,Cle=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,_le=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,Sle=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,Ele=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,Tle=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,Ble=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return saturate(v);
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColor;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,Mle=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,kle=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometryNormal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,Rle=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,Ple=`#if defined( USE_LOGDEPTHBUF )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,Lle=`#if defined( USE_LOGDEPTHBUF )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,Ile=`#ifdef USE_LOGDEPTHBUF
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,Ole=`#ifdef USE_LOGDEPTHBUF
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,Fle=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
	
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,Nle=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,Dle=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	#if defined( USE_POINTS_UV )
		vec2 uv = vUv;
	#else
		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	#endif
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,Ule=`#if defined( USE_POINTS_UV )
	varying vec2 vUv;
#else
	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		uniform mat3 uvTransform;
	#endif
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,Hle=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,jle=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,Qle=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,zle=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,Vle=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,Gle=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,Wle=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,Kle=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,$le=`#ifdef USE_NORMALMAP_OBJECTSPACE
	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,qle=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,Xle=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,Yle=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,Jle=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,Zle=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,ece=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,tce=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif`,nce=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,rce=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,ice=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
	vec4 r = vec4( fract( v * PackFactors ), v );
	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors );
}
vec2 packDepthToRG( in highp float v ) {
	return packDepthToRGBA( v ).yx;
}
float unpackRGToDepth( const in highp vec2 v ) {
	return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
}
vec4 pack2HalfToRGBA( vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * depth - far );
}`,sce=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,oce=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,ace=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,lce=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,cce=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,uce=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,dce=`#if NUM_SPOT_LIGHT_COORDS > 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		
		float lightToPositionLength = length( lightToPosition );
		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
				shadow = (
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
				) * ( 1.0 / 9.0 );
			#else
				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
			#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
#endif`,fce=`#if NUM_SPOT_LIGHT_COORDS > 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,hce=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
#endif`,Ace=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,pce=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,mce=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,gce=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,yce=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,vce=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,bce=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,wce=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,xce=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,Cce=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,_ce=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
		
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
		
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		
		#else
		
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,Sce=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Ece=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Tce=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,Bce=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const Mce=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,kce=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Rce=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,Pce=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Lce=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,Ice=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Oce=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,Fce=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#endif
}`,Nce=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,Dce=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,Uce=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,Hce=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,jce=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,Qce=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,zce=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,Vce=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Gce=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Wce=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Kce=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,$ce=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,qce=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,Xce=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,Yce=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Jce=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Zce=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,eue=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,tue=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,nue=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,rue=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,iue=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,sue=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,oue=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,aue=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
	vec2 scale;
	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,lue=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,an={alphahash_fragment:kae,alphahash_pars_fragment:Rae,alphamap_fragment:Pae,alphamap_pars_fragment:Lae,alphatest_fragment:Iae,alphatest_pars_fragment:Oae,aomap_fragment:Fae,aomap_pars_fragment:Nae,batching_pars_vertex:Dae,batching_vertex:Uae,begin_vertex:Hae,beginnormal_vertex:jae,bsdfs:Qae,iridescence_fragment:zae,bumpmap_pars_fragment:Vae,clipping_planes_fragment:Gae,clipping_planes_pars_fragment:Wae,clipping_planes_pars_vertex:Kae,clipping_planes_vertex:$ae,color_fragment:qae,color_pars_fragment:Xae,color_pars_vertex:Yae,color_vertex:Jae,common:Zae,cube_uv_reflection_fragment:ele,defaultnormal_vertex:tle,displacementmap_pars_vertex:nle,displacementmap_vertex:rle,emissivemap_fragment:ile,emissivemap_pars_fragment:sle,colorspace_fragment:ole,colorspace_pars_fragment:ale,envmap_fragment:lle,envmap_common_pars_fragment:cle,envmap_pars_fragment:ule,envmap_pars_vertex:dle,envmap_physical_pars_fragment:xle,envmap_vertex:fle,fog_vertex:hle,fog_pars_vertex:Ale,fog_fragment:ple,fog_pars_fragment:mle,gradientmap_pars_fragment:gle,lightmap_pars_fragment:yle,lights_lambert_fragment:vle,lights_lambert_pars_fragment:ble,lights_pars_begin:wle,lights_toon_fragment:Cle,lights_toon_pars_fragment:_le,lights_phong_fragment:Sle,lights_phong_pars_fragment:Ele,lights_physical_fragment:Tle,lights_physical_pars_fragment:Ble,lights_fragment_begin:Mle,lights_fragment_maps:kle,lights_fragment_end:Rle,logdepthbuf_fragment:Ple,logdepthbuf_pars_fragment:Lle,logdepthbuf_pars_vertex:Ile,logdepthbuf_vertex:Ole,map_fragment:Fle,map_pars_fragment:Nle,map_particle_fragment:Dle,map_particle_pars_fragment:Ule,metalnessmap_fragment:Hle,metalnessmap_pars_fragment:jle,morphinstance_vertex:Qle,morphcolor_vertex:zle,morphnormal_vertex:Vle,morphtarget_pars_vertex:Gle,morphtarget_vertex:Wle,normal_fragment_begin:Kle,normal_fragment_maps:$le,normal_pars_fragment:qle,normal_pars_vertex:Xle,normal_vertex:Yle,normalmap_pars_fragment:Jle,clearcoat_normal_fragment_begin:Zle,clearcoat_normal_fragment_maps:ece,clearcoat_pars_fragment:tce,iridescence_pars_fragment:nce,opaque_fragment:rce,packing:ice,premultiplied_alpha_fragment:sce,project_vertex:oce,dithering_fragment:ace,dithering_pars_fragment:lce,roughnessmap_fragment:cce,roughnessmap_pars_fragment:uce,shadowmap_pars_fragment:dce,shadowmap_pars_vertex:fce,shadowmap_vertex:hce,shadowmask_pars_fragment:Ace,skinbase_vertex:pce,skinning_pars_vertex:mce,skinning_vertex:gce,skinnormal_vertex:yce,specularmap_fragment:vce,specularmap_pars_fragment:bce,tonemapping_fragment:wce,tonemapping_pars_fragment:xce,transmission_fragment:Cce,transmission_pars_fragment:_ce,uv_pars_fragment:Sce,uv_pars_vertex:Ece,uv_vertex:Tce,worldpos_vertex:Bce,background_vert:Mce,background_frag:kce,backgroundCube_vert:Rce,backgroundCube_frag:Pce,cube_vert:Lce,cube_frag:Ice,depth_vert:Oce,depth_frag:Fce,distanceRGBA_vert:Nce,distanceRGBA_frag:Dce,equirect_vert:Uce,equirect_frag:Hce,linedashed_vert:jce,linedashed_frag:Qce,meshbasic_vert:zce,meshbasic_frag:Vce,meshlambert_vert:Gce,meshlambert_frag:Wce,meshmatcap_vert:Kce,meshmatcap_frag:$ce,meshnormal_vert:qce,meshnormal_frag:Xce,meshphong_vert:Yce,meshphong_frag:Jce,meshphysical_vert:Zce,meshphysical_frag:eue,meshtoon_vert:tue,meshtoon_frag:nue,points_vert:rue,points_frag:iue,shadow_vert:sue,shadow_frag:oue,sprite_vert:aue,sprite_frag:lue},gt={common:{diffuse:{value:new Nt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ln},alphaMap:{value:null},alphaMapTransform:{value:new ln},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ln}},envmap:{envMap:{value:null},envMapRotation:{value:new ln},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ln}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ln}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ln},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ln},normalScale:{value:new Ze(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ln},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ln}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ln}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ln}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Nt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Nt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ln},alphaTest:{value:0},uvTransform:{value:new ln}},sprite:{diffuse:{value:new Nt(16777215)},opacity:{value:1},center:{value:new Ze(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ln},alphaMap:{value:null},alphaMapTransform:{value:new ln},alphaTest:{value:0}}},wl={basic:{uniforms:Ls([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.fog]),vertexShader:an.meshbasic_vert,fragmentShader:an.meshbasic_frag},lambert:{uniforms:Ls([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,gt.lights,{emissive:{value:new Nt(0)}}]),vertexShader:an.meshlambert_vert,fragmentShader:an.meshlambert_frag},phong:{uniforms:Ls([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,gt.lights,{emissive:{value:new Nt(0)},specular:{value:new Nt(1118481)},shininess:{value:30}}]),vertexShader:an.meshphong_vert,fragmentShader:an.meshphong_frag},standard:{uniforms:Ls([gt.common,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.roughnessmap,gt.metalnessmap,gt.fog,gt.lights,{emissive:{value:new Nt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:an.meshphysical_vert,fragmentShader:an.meshphysical_frag},toon:{uniforms:Ls([gt.common,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.gradientmap,gt.fog,gt.lights,{emissive:{value:new Nt(0)}}]),vertexShader:an.meshtoon_vert,fragmentShader:an.meshtoon_frag},matcap:{uniforms:Ls([gt.common,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,{matcap:{value:null}}]),vertexShader:an.meshmatcap_vert,fragmentShader:an.meshmatcap_frag},points:{uniforms:Ls([gt.points,gt.fog]),vertexShader:an.points_vert,fragmentShader:an.points_frag},dashed:{uniforms:Ls([gt.common,gt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:an.linedashed_vert,fragmentShader:an.linedashed_frag},depth:{uniforms:Ls([gt.common,gt.displacementmap]),vertexShader:an.depth_vert,fragmentShader:an.depth_frag},normal:{uniforms:Ls([gt.common,gt.bumpmap,gt.normalmap,gt.displacementmap,{opacity:{value:1}}]),vertexShader:an.meshnormal_vert,fragmentShader:an.meshnormal_frag},sprite:{uniforms:Ls([gt.sprite,gt.fog]),vertexShader:an.sprite_vert,fragmentShader:an.sprite_frag},background:{uniforms:{uvTransform:{value:new ln},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:an.background_vert,fragmentShader:an.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ln}},vertexShader:an.backgroundCube_vert,fragmentShader:an.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:an.cube_vert,fragmentShader:an.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:an.equirect_vert,fragmentShader:an.equirect_frag},distanceRGBA:{uniforms:Ls([gt.common,gt.displacementmap,{referencePosition:{value:new de},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:an.distanceRGBA_vert,fragmentShader:an.distanceRGBA_frag},shadow:{uniforms:Ls([gt.lights,gt.fog,{color:{value:new Nt(0)},opacity:{value:1}}]),vertexShader:an.shadow_vert,fragmentShader:an.shadow_frag}};wl.physical={uniforms:Ls([wl.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ln},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ln},clearcoatNormalScale:{value:new Ze(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ln},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ln},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ln},sheen:{value:0},sheenColor:{value:new Nt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ln},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ln},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ln},transmissionSamplerSize:{value:new Ze},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ln},attenuationDistance:{value:0},attenuationColor:{value:new Nt(0)},specularColor:{value:new Nt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ln},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ln},anisotropyVector:{value:new Ze},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ln}}]),vertexShader:an.meshphysical_vert,fragmentShader:an.meshphysical_frag};const yb={r:0,b:0,g:0},Nf=new el,cue=new Zt;function uue(t,e,n,r,i,s,o){const a=new Nt(0);let l=s===!0?0:1,c,u,d=null,f=0,h=null;function A(y){let w=y.isScene===!0?y.background:null;return w&&w.isTexture&&(w=(y.backgroundBlurriness>0?n:e).get(w)),w}function p(y){let w=!1;const v=A(y);v===null?g(a,l):v&&v.isColor&&(g(v,1),w=!0);const x=t.xr.getEnvironmentBlendMode();x==="additive"?r.buffers.color.setClear(0,0,0,1,o):x==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(t.autoClear||w)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function m(y,w){const v=A(w);v&&(v.isCubeTexture||v.mapping===OS)?(u===void 0&&(u=new xn(new Wl(1,1,1),new Zd({name:"BackgroundCubeMaterial",uniforms:Tm(wl.backgroundCube.uniforms),vertexShader:wl.backgroundCube.vertexShader,fragmentShader:wl.backgroundCube.fragmentShader,side:Ao,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(x,C,_){this.matrixWorld.copyPosition(_.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),Nf.copy(w.backgroundRotation),Nf.x*=-1,Nf.y*=-1,Nf.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Nf.y*=-1,Nf.z*=-1),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(cue.makeRotationFromEuler(Nf)),u.material.toneMapped=Nn.getTransfer(v.colorSpace)!==hr,(d!==v||f!==v.version||h!==t.toneMapping)&&(u.material.needsUpdate=!0,d=v,f=v.version,h=t.toneMapping),u.layers.enableAll(),y.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(c===void 0&&(c=new xn(new tv(2,2),new Zd({name:"BackgroundMaterial",uniforms:Tm(wl.background.uniforms),vertexShader:wl.background.vertexShader,fragmentShader:wl.background.fragmentShader,side:qc,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=v,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.toneMapped=Nn.getTransfer(v.colorSpace)!==hr,v.matrixAutoUpdate===!0&&v.updateMatrix(),c.material.uniforms.uvTransform.value.copy(v.matrix),(d!==v||f!==v.version||h!==t.toneMapping)&&(c.material.needsUpdate=!0,d=v,f=v.version,h=t.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function g(y,w){y.getRGB(yb,eW(t)),r.buffers.color.setClear(yb.r,yb.g,yb.b,w,o)}return{getClearColor:function(){return a},setClearColor:function(y,w=1){a.set(y),l=w,g(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,g(a,l)},render:p,addToRenderList:m}}function due(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=f(null);let s=i,o=!1;function a(T,R,k,B,M){let F=!1;const I=d(B,k,R);s!==I&&(s=I,c(s.object)),F=h(T,B,k,M),F&&A(T,B,k,M),M!==null&&e.update(M,t.ELEMENT_ARRAY_BUFFER),(F||o)&&(o=!1,v(T,R,k,B),M!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(M).buffer))}function l(){return t.createVertexArray()}function c(T){return t.bindVertexArray(T)}function u(T){return t.deleteVertexArray(T)}function d(T,R,k){const B=k.wireframe===!0;let M=r[T.id];M===void 0&&(M={},r[T.id]=M);let F=M[R.id];F===void 0&&(F={},M[R.id]=F);let I=F[B];return I===void 0&&(I=f(l()),F[B]=I),I}function f(T){const R=[],k=[],B=[];for(let M=0;M<n;M++)R[M]=0,k[M]=0,B[M]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:R,enabledAttributes:k,attributeDivisors:B,object:T,attributes:{},index:null}}function h(T,R,k,B){const M=s.attributes,F=R.attributes;let I=0;const z=k.getAttributes();for(const Y in z)if(z[Y].location>=0){const ee=M[Y];let W=F[Y];if(W===void 0&&(Y==="instanceMatrix"&&T.instanceMatrix&&(W=T.instanceMatrix),Y==="instanceColor"&&T.instanceColor&&(W=T.instanceColor)),ee===void 0||ee.attribute!==W||W&&ee.data!==W.data)return!0;I++}return s.attributesNum!==I||s.index!==B}function A(T,R,k,B){const M={},F=R.attributes;let I=0;const z=k.getAttributes();for(const Y in z)if(z[Y].location>=0){let ee=F[Y];ee===void 0&&(Y==="instanceMatrix"&&T.instanceMatrix&&(ee=T.instanceMatrix),Y==="instanceColor"&&T.instanceColor&&(ee=T.instanceColor));const W={};W.attribute=ee,ee&&ee.data&&(W.data=ee.data),M[Y]=W,I++}s.attributes=M,s.attributesNum=I,s.index=B}function p(){const T=s.newAttributes;for(let R=0,k=T.length;R<k;R++)T[R]=0}function m(T){g(T,0)}function g(T,R){const k=s.newAttributes,B=s.enabledAttributes,M=s.attributeDivisors;k[T]=1,B[T]===0&&(t.enableVertexAttribArray(T),B[T]=1),M[T]!==R&&(t.vertexAttribDivisor(T,R),M[T]=R)}function y(){const T=s.newAttributes,R=s.enabledAttributes;for(let k=0,B=R.length;k<B;k++)R[k]!==T[k]&&(t.disableVertexAttribArray(k),R[k]=0)}function w(T,R,k,B,M,F,I){I===!0?t.vertexAttribIPointer(T,R,k,M,F):t.vertexAttribPointer(T,R,k,B,M,F)}function v(T,R,k,B){p();const M=B.attributes,F=k.getAttributes(),I=R.defaultAttributeValues;for(const z in F){const Y=F[z];if(Y.location>=0){let $=M[z];if($===void 0&&(z==="instanceMatrix"&&T.instanceMatrix&&($=T.instanceMatrix),z==="instanceColor"&&T.instanceColor&&($=T.instanceColor)),$!==void 0){const ee=$.normalized,W=$.itemSize,ne=e.get($);if(ne===void 0)continue;const Se=ne.buffer,fe=ne.type,ge=ne.bytesPerElement,Oe=fe===t.INT||fe===t.UNSIGNED_INT||$.gpuType===VP;if($.isInterleavedBufferAttribute){const Fe=$.data,De=Fe.stride,ke=$.offset;if(Fe.isInstancedInterleavedBuffer){for(let Ge=0;Ge<Y.locationSize;Ge++)g(Y.location+Ge,Fe.meshPerAttribute);T.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=Fe.meshPerAttribute*Fe.count)}else for(let Ge=0;Ge<Y.locationSize;Ge++)m(Y.location+Ge);t.bindBuffer(t.ARRAY_BUFFER,Se);for(let Ge=0;Ge<Y.locationSize;Ge++)w(Y.location+Ge,W/Y.locationSize,fe,ee,De*ge,(ke+W/Y.locationSize*Ge)*ge,Oe)}else{if($.isInstancedBufferAttribute){for(let Fe=0;Fe<Y.locationSize;Fe++)g(Y.location+Fe,$.meshPerAttribute);T.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let Fe=0;Fe<Y.locationSize;Fe++)m(Y.location+Fe);t.bindBuffer(t.ARRAY_BUFFER,Se);for(let Fe=0;Fe<Y.locationSize;Fe++)w(Y.location+Fe,W/Y.locationSize,fe,ee,W*ge,W/Y.locationSize*Fe*ge,Oe)}}else if(I!==void 0){const ee=I[z];if(ee!==void 0)switch(ee.length){case 2:t.vertexAttrib2fv(Y.location,ee);break;case 3:t.vertexAttrib3fv(Y.location,ee);break;case 4:t.vertexAttrib4fv(Y.location,ee);break;default:t.vertexAttrib1fv(Y.location,ee)}}}}y()}function x(){S();for(const T in r){const R=r[T];for(const k in R){const B=R[k];for(const M in B)u(B[M].object),delete B[M];delete R[k]}delete r[T]}}function C(T){if(r[T.id]===void 0)return;const R=r[T.id];for(const k in R){const B=R[k];for(const M in B)u(B[M].object),delete B[M];delete R[k]}delete r[T.id]}function _(T){for(const R in r){const k=r[R];if(k[T.id]===void 0)continue;const B=k[T.id];for(const M in B)u(B[M].object),delete B[M];delete k[T.id]}}function S(){E(),o=!0,s!==i&&(s=i,c(s.object))}function E(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:S,resetDefaultState:E,dispose:x,releaseStatesOfGeometry:C,releaseStatesOfProgram:_,initAttributes:p,enableAttribute:m,disableUnusedAttributes:y}}function fue(t,e,n){let r;function i(c){r=c}function s(c,u){t.drawArrays(r,c,u),n.update(u,r,1)}function o(c,u,d){d!==0&&(t.drawArraysInstanced(r,c,u,d),n.update(u,r,d))}function a(c,u,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,u,0,d);let h=0;for(let A=0;A<d;A++)h+=u[A];n.update(h,r,1)}function l(c,u,d,f){if(d===0)return;const h=e.get("WEBGL_multi_draw");if(h===null)for(let A=0;A<c.length;A++)o(c[A],u[A],f[A]);else{h.multiDrawArraysInstancedWEBGL(r,c,0,u,0,f,0,d);let A=0;for(let p=0;p<d;p++)A+=u[p];for(let p=0;p<f.length;p++)n.update(A,r,f[p])}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function hue(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(C){return!(C!==ua&&r.convert(C)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(C){const _=C===ev&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==Xc&&r.convert(C)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==Wa&&!_)}function l(C){if(C==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const d=n.logarithmicDepthBuffer===!0,f=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),A=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),m=t.getParameter(t.MAX_VERTEX_ATTRIBS),g=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),y=t.getParameter(t.MAX_VARYING_VECTORS),w=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=h>0,x=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:d,maxTextures:f,maxVertexTextures:h,maxTextureSize:A,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:g,maxVaryings:y,maxFragmentUniforms:w,vertexTextures:v,maxSamples:x}}function Aue(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Vu,a=new ln,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const h=d.length!==0||f||r!==0||i;return i=f,r=d.length,h},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,f){n=u(d,f,0)},this.setState=function(d,f,h){const A=d.clippingPlanes,p=d.clipIntersection,m=d.clipShadows,g=t.get(d);if(!i||A===null||A.length===0||s&&!m)s?u(null):c();else{const y=s?0:r,w=y*4;let v=g.clippingState||null;l.value=v,v=u(A,f,w,h);for(let x=0;x!==w;++x)v[x]=n[x];g.clippingState=v,this.numIntersection=p?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(d,f,h,A){const p=d!==null?d.length:0;let m=null;if(p!==0){if(m=l.value,A!==!0||m===null){const g=h+p*4,y=f.matrixWorldInverse;a.getNormalMatrix(y),(m===null||m.length<g)&&(m=new Float32Array(g));for(let w=0,v=h;w!==p;++w,v+=4)o.copy(d[w]).applyMatrix4(y,a),o.normal.toArray(m,v),m[v+3]=o.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=p,e.numIntersection=0,m}}function pue(t){let e=new WeakMap;function n(o,a){return a===q3?o.mapping=wm:a===X3&&(o.mapping=xm),o}function r(o){if(o&&o.isTexture){const a=o.mapping;if(a===q3||a===X3)if(e.has(o)){const l=e.get(o).texture;return n(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new Eae(l.height);return c.fromEquirectangularTexture(t,o),e.set(o,c),o.addEventListener("dispose",i),n(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class $r extends tW{constructor(e=-1,n=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const Cp=4,sN=[.125,.215,.35,.446,.526,.582],eh=20,KE=new $r,oN=new Nt;let $E=null,qE=0,XE=0,YE=!1;const Wf=(1+Math.sqrt(5))/2,DA=1/Wf,aN=[new de(-Wf,DA,0),new de(Wf,DA,0),new de(-DA,0,Wf),new de(DA,0,Wf),new de(0,Wf,-DA),new de(0,Wf,DA),new de(-1,1,-1),new de(1,1,-1),new de(-1,1,1),new de(1,1,1)];class lN{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,r=.1,i=100){$E=this._renderer.getRenderTarget(),qE=this._renderer.getActiveCubeFace(),XE=this._renderer.getActiveMipmapLevel(),YE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dN(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=uN(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget($E,qE,XE),this._renderer.xr.enabled=YE,e.scissorTest=!1,vb(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===wm||e.mapping===xm?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),$E=this._renderer.getRenderTarget(),qE=this._renderer.getActiveCubeFace(),XE=this._renderer.getActiveMipmapLevel(),YE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:Io,minFilter:Io,generateMipmaps:!1,type:ev,format:ua,colorSpace:Ni,depthBuffer:!1},i=cN(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=cN(e,n,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=mue(s)),this._blurMaterial=gue(s,e,n)}return i}_compileMaterial(e){const n=new xn(this._lodPlanes[0],e);this._renderer.compile(n,KE)}_sceneToCubeUV(e,n,r,i){const a=new Fn(90,1,n,r),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,f=u.toneMapping;u.getClearColor(oN),u.toneMapping=Pd,u.autoClear=!1;const h=new ei({name:"PMREM.Background",side:Ao,depthWrite:!1,depthTest:!1}),A=new xn(new Wl,h);let p=!1;const m=e.background;m?m.isColor&&(h.color.copy(m),e.background=null,p=!0):(h.color.copy(oN),p=!0);for(let g=0;g<6;g++){const y=g%3;y===0?(a.up.set(0,l[g],0),a.lookAt(c[g],0,0)):y===1?(a.up.set(0,0,l[g]),a.lookAt(0,c[g],0)):(a.up.set(0,l[g],0),a.lookAt(0,0,c[g]));const w=this._cubeSize;vb(i,y*w,g>2?w:0,w,w),u.setRenderTarget(i),p&&u.render(A,a),u.render(e,a)}A.geometry.dispose(),A.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=m}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===wm||e.mapping===xm;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dN()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=uN());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new xn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;vb(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,KE)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=aN[(i-s-1)%aN.length];this._blur(e,s-1,s,o,a)}n.autoClear=r}_blur(e,n,r,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,n,r,i,"latitudinal",s),this._halfBlur(o,e,r,r,i,"longitudinal",s)}_halfBlur(e,n,r,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,d=new xn(this._lodPlanes[i],c),f=c.uniforms,h=this._sizeLods[r]-1,A=isFinite(s)?Math.PI/(2*h):2*Math.PI/(2*eh-1),p=s/A,m=isFinite(s)?1+Math.floor(u*p):eh;m>eh&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${eh}`);const g=[];let y=0;for(let _=0;_<eh;++_){const S=_/p,E=Math.exp(-S*S/2);g.push(E),_===0?y+=E:_<m&&(y+=2*E)}for(let _=0;_<g.length;_++)g[_]=g[_]/y;f.envMap.value=e.texture,f.samples.value=m,f.weights.value=g,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a);const{_lodMax:w}=this;f.dTheta.value=A,f.mipInt.value=w-r;const v=this._sizeLods[i],x=3*v*(i>w-Cp?i-w+Cp:0),C=4*(this._cubeSize-v);vb(n,x,C,3*v,2*v),l.setRenderTarget(n),l.render(d,KE)}}function mue(t){const e=[],n=[],r=[];let i=t;const s=t-Cp+1+sN.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);n.push(a);let l=1/a;o>t-Cp?l=sN[o-t+Cp-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),u=-c,d=1+c,f=[u,u,d,u,d,d,u,u,d,d,u,d],h=6,A=6,p=3,m=2,g=1,y=new Float32Array(p*A*h),w=new Float32Array(m*A*h),v=new Float32Array(g*A*h);for(let C=0;C<h;C++){const _=C%3*2/3-1,S=C>2?0:-1,E=[_,S,0,_+2/3,S,0,_+2/3,S+1,0,_,S,0,_+2/3,S+1,0,_,S+1,0];y.set(E,p*A*C),w.set(f,m*A*C);const T=[C,C,C,C,C,C];v.set(T,g*A*C)}const x=new Ai;x.setAttribute("position",new Fi(y,p)),x.setAttribute("uv",new Fi(w,m)),x.setAttribute("faceIndex",new Fi(v,g)),e.push(x),i>Cp&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function cN(t,e,n){const r=new Dh(t,e,n);return r.texture.mapping=OS,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function vb(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function gue(t,e,n){const r=new Float32Array(eh),i=new de(0,1,0);return new Zd({name:"SphericalGaussianBlur",defines:{n:eh,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:nL(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

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

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

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

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

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

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

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

				}

				axis = normalize( axis );

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

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

					if ( i >= samples ) {

						break;

					}

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

				}

			}
		`,blending:Rd,depthTest:!1,depthWrite:!1})}function uN(){return new Zd({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:nL(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include <common>

			void main() {

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

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

			}
		`,blending:Rd,depthTest:!1,depthWrite:!1})}function dN(){return new Zd({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:nL(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

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

			}
		`,blending:Rd,depthTest:!1,depthWrite:!1})}function nL(){return`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

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

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

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

			} else if ( face == 1.0 ) {

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

			} else if ( face == 2.0 ) {

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

			} else if ( face == 3.0 ) {

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

			} else if ( face == 4.0 ) {

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

			} else if ( face == 5.0 ) {

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

			}

			return direction;

		}

		void main() {

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

		}
	`}function yue(t){let e=new WeakMap,n=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===q3||l===X3,u=l===wm||l===xm;if(c||u){let d=e.get(a);const f=d!==void 0?d.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==f)return n===null&&(n=new lN(t)),d=c?n.fromEquirectangular(a,d):n.fromCubemap(a,d),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),d.texture;if(d!==void 0)return d.texture;{const h=a.image;return c&&h&&h.height>0||u&&h&&i(h)?(n===null&&(n=new lN(t)),d=c?n.fromEquirectangular(a):n.fromCubemap(a),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),a.addEventListener("dispose",s),d.texture):null}}}return a}function i(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function vue(t){const e={};function n(r){if(e[r]!==void 0)return e[r];let i;switch(r){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(r)}return e[r]=i,i}return{has:function(r){return n(r)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(r){const i=n(r);return i===null&&ZP("THREE.WebGLRenderer: "+r+" extension not supported."),i}}}function bue(t,e,n,r){const i={},s=new WeakMap;function o(d){const f=d.target;f.index!==null&&e.remove(f.index);for(const A in f.attributes)e.remove(f.attributes[A]);for(const A in f.morphAttributes){const p=f.morphAttributes[A];for(let m=0,g=p.length;m<g;m++)e.remove(p[m])}f.removeEventListener("dispose",o),delete i[f.id];const h=s.get(f);h&&(e.remove(h),s.delete(f)),r.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,n.memory.geometries--}function a(d,f){return i[f.id]===!0||(f.addEventListener("dispose",o),i[f.id]=!0,n.memory.geometries++),f}function l(d){const f=d.attributes;for(const A in f)e.update(f[A],t.ARRAY_BUFFER);const h=d.morphAttributes;for(const A in h){const p=h[A];for(let m=0,g=p.length;m<g;m++)e.update(p[m],t.ARRAY_BUFFER)}}function c(d){const f=[],h=d.index,A=d.attributes.position;let p=0;if(h!==null){const y=h.array;p=h.version;for(let w=0,v=y.length;w<v;w+=3){const x=y[w+0],C=y[w+1],_=y[w+2];f.push(x,C,C,_,_,x)}}else if(A!==void 0){const y=A.array;p=A.version;for(let w=0,v=y.length/3-1;w<v;w+=3){const x=w+0,C=w+1,_=w+2;f.push(x,C,C,_,_,x)}}else return;const m=new($G(f)?ZG:JG)(f,1);m.version=p;const g=s.get(d);g&&e.remove(g),s.set(d,m)}function u(d){const f=s.get(d);if(f){const h=d.index;h!==null&&f.version<h.version&&c(d)}else c(d);return s.get(d)}return{get:a,update:l,getWireframeAttribute:u}}function wue(t,e,n){let r;function i(f){r=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function l(f,h){t.drawElements(r,h,s,f*o),n.update(h,r,1)}function c(f,h,A){A!==0&&(t.drawElementsInstanced(r,h,s,f*o,A),n.update(h,r,A))}function u(f,h,A){if(A===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,h,0,s,f,0,A);let m=0;for(let g=0;g<A;g++)m+=h[g];n.update(m,r,1)}function d(f,h,A,p){if(A===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let g=0;g<f.length;g++)c(f[g]/o,h[g],p[g]);else{m.multiDrawElementsInstancedWEBGL(r,h,0,s,f,0,p,0,A);let g=0;for(let y=0;y<A;y++)g+=h[y];for(let y=0;y<p.length;y++)n.update(g,r,p[y])}}this.setMode=i,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=d}function xue(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,o,a){switch(n.calls++,o){case t.TRIANGLES:n.triangles+=a*(s/3);break;case t.LINES:n.lines+=a*(s/2);break;case t.LINE_STRIP:n.lines+=a*(s-1);break;case t.LINE_LOOP:n.lines+=a*s;break;case t.POINTS:n.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:i,update:r}}function Cue(t,e,n){const r=new WeakMap,i=new Jn;function s(o,a,l){const c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,d=u!==void 0?u.length:0;let f=r.get(a);if(f===void 0||f.count!==d){let E=function(){_.dispose(),r.delete(a),a.removeEventListener("dispose",E)};f!==void 0&&f.texture.dispose();const h=a.morphAttributes.position!==void 0,A=a.morphAttributes.normal!==void 0,p=a.morphAttributes.color!==void 0,m=a.morphAttributes.position||[],g=a.morphAttributes.normal||[],y=a.morphAttributes.color||[];let w=0;h===!0&&(w=1),A===!0&&(w=2),p===!0&&(w=3);let v=a.attributes.position.count*w,x=1;v>e.maxTextureSize&&(x=Math.ceil(v/e.maxTextureSize),v=e.maxTextureSize);const C=new Float32Array(v*x*4*d),_=new XG(C,v,x,d);_.type=Wa,_.needsUpdate=!0;const S=w*4;for(let T=0;T<d;T++){const R=m[T],k=g[T],B=y[T],M=v*x*4*T;for(let F=0;F<R.count;F++){const I=F*S;h===!0&&(i.fromBufferAttribute(R,F),C[M+I+0]=i.x,C[M+I+1]=i.y,C[M+I+2]=i.z,C[M+I+3]=0),A===!0&&(i.fromBufferAttribute(k,F),C[M+I+4]=i.x,C[M+I+5]=i.y,C[M+I+6]=i.z,C[M+I+7]=0),p===!0&&(i.fromBufferAttribute(B,F),C[M+I+8]=i.x,C[M+I+9]=i.y,C[M+I+10]=i.z,C[M+I+11]=B.itemSize===4?i.w:1)}}f={count:d,texture:_,size:new Ze(v,x)},r.set(a,f),a.addEventListener("dispose",E)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",o.morphTexture,n);else{let h=0;for(let p=0;p<c.length;p++)h+=c[p];const A=a.morphTargetsRelative?1:1-h;l.getUniforms().setValue(t,"morphTargetBaseInfluence",A),l.getUniforms().setValue(t,"morphTargetInfluences",c)}l.getUniforms().setValue(t,"morphTargetsTexture",f.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",f.size)}return{update:s}}function _ue(t,e,n,r){let i=new WeakMap;function s(l){const c=r.render.frame,u=l.geometry,d=e.get(l,u);if(i.get(d)!==c&&(e.update(d),i.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),i.get(l)!==c&&(n.update(l.instanceMatrix,t.ARRAY_BUFFER),l.instanceColor!==null&&n.update(l.instanceColor,t.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;i.get(f)!==c&&(f.update(),i.set(f,c))}return d}function o(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),n.remove(c.instanceMatrix),c.instanceColor!==null&&n.remove(c.instanceColor)}return{update:s,dispose:o}}class iW extends Oi{constructor(e,n,r,i,s,o,a,l,c,u=Wp){if(u!==Wp&&u!==Sm)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&u===Wp&&(r=Nh),r===void 0&&u===Sm&&(r=_m),super(null,i,s,o,a,l,u,r,c),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=a!==void 0?a:Qs,this.minFilter=l!==void 0?l:Qs,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}const sW=new Oi,fN=new iW(1,1),oW=new XG,aW=new uae,lW=new nW,hN=[],AN=[],pN=new Float32Array(16),mN=new Float32Array(9),gN=new Float32Array(4);function xg(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=hN[i];if(s===void 0&&(s=new Float32Array(i),hN[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function _i(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Si(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function NS(t,e){let n=AN[e];n===void 0&&(n=new Int32Array(e),AN[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function Sue(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Eue(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(_i(n,e))return;t.uniform2fv(this.addr,e),Si(n,e)}}function Tue(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(_i(n,e))return;t.uniform3fv(this.addr,e),Si(n,e)}}function Bue(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(_i(n,e))return;t.uniform4fv(this.addr,e),Si(n,e)}}function Mue(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(_i(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Si(n,e)}else{if(_i(n,r))return;gN.set(r),t.uniformMatrix2fv(this.addr,!1,gN),Si(n,r)}}function kue(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(_i(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Si(n,e)}else{if(_i(n,r))return;mN.set(r),t.uniformMatrix3fv(this.addr,!1,mN),Si(n,r)}}function Rue(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(_i(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Si(n,e)}else{if(_i(n,r))return;pN.set(r),t.uniformMatrix4fv(this.addr,!1,pN),Si(n,r)}}function Pue(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Lue(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(_i(n,e))return;t.uniform2iv(this.addr,e),Si(n,e)}}function Iue(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(_i(n,e))return;t.uniform3iv(this.addr,e),Si(n,e)}}function Oue(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(_i(n,e))return;t.uniform4iv(this.addr,e),Si(n,e)}}function Fue(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Nue(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(_i(n,e))return;t.uniform2uiv(this.addr,e),Si(n,e)}}function Due(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(_i(n,e))return;t.uniform3uiv(this.addr,e),Si(n,e)}}function Uue(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(_i(n,e))return;t.uniform4uiv(this.addr,e),Si(n,e)}}function Hue(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i);let s;this.type===t.SAMPLER_2D_SHADOW?(fN.compareFunction=KG,s=fN):s=sW,n.setTexture2D(e||s,i)}function jue(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||aW,i)}function Que(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||lW,i)}function zue(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||oW,i)}function Vue(t){switch(t){case 5126:return Sue;case 35664:return Eue;case 35665:return Tue;case 35666:return Bue;case 35674:return Mue;case 35675:return kue;case 35676:return Rue;case 5124:case 35670:return Pue;case 35667:case 35671:return Lue;case 35668:case 35672:return Iue;case 35669:case 35673:return Oue;case 5125:return Fue;case 36294:return Nue;case 36295:return Due;case 36296:return Uue;case 35678:case 36198:case 36298:case 36306:case 35682:return Hue;case 35679:case 36299:case 36307:return jue;case 35680:case 36300:case 36308:case 36293:return Que;case 36289:case 36303:case 36311:case 36292:return zue}}function Gue(t,e){t.uniform1fv(this.addr,e)}function Wue(t,e){const n=xg(e,this.size,2);t.uniform2fv(this.addr,n)}function Kue(t,e){const n=xg(e,this.size,3);t.uniform3fv(this.addr,n)}function $ue(t,e){const n=xg(e,this.size,4);t.uniform4fv(this.addr,n)}function que(t,e){const n=xg(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Xue(t,e){const n=xg(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Yue(t,e){const n=xg(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Jue(t,e){t.uniform1iv(this.addr,e)}function Zue(t,e){t.uniform2iv(this.addr,e)}function ede(t,e){t.uniform3iv(this.addr,e)}function tde(t,e){t.uniform4iv(this.addr,e)}function nde(t,e){t.uniform1uiv(this.addr,e)}function rde(t,e){t.uniform2uiv(this.addr,e)}function ide(t,e){t.uniform3uiv(this.addr,e)}function sde(t,e){t.uniform4uiv(this.addr,e)}function ode(t,e,n){const r=this.cache,i=e.length,s=NS(n,i);_i(r,s)||(t.uniform1iv(this.addr,s),Si(r,s));for(let o=0;o!==i;++o)n.setTexture2D(e[o]||sW,s[o])}function ade(t,e,n){const r=this.cache,i=e.length,s=NS(n,i);_i(r,s)||(t.uniform1iv(this.addr,s),Si(r,s));for(let o=0;o!==i;++o)n.setTexture3D(e[o]||aW,s[o])}function lde(t,e,n){const r=this.cache,i=e.length,s=NS(n,i);_i(r,s)||(t.uniform1iv(this.addr,s),Si(r,s));for(let o=0;o!==i;++o)n.setTextureCube(e[o]||lW,s[o])}function cde(t,e,n){const r=this.cache,i=e.length,s=NS(n,i);_i(r,s)||(t.uniform1iv(this.addr,s),Si(r,s));for(let o=0;o!==i;++o)n.setTexture2DArray(e[o]||oW,s[o])}function ude(t){switch(t){case 5126:return Gue;case 35664:return Wue;case 35665:return Kue;case 35666:return $ue;case 35674:return que;case 35675:return Xue;case 35676:return Yue;case 5124:case 35670:return Jue;case 35667:case 35671:return Zue;case 35668:case 35672:return ede;case 35669:case 35673:return tde;case 5125:return nde;case 36294:return rde;case 36295:return ide;case 36296:return sde;case 35678:case 36198:case 36298:case 36306:case 35682:return ode;case 35679:case 36299:case 36307:return ade;case 35680:case 36300:case 36308:case 36293:return lde;case 36289:case 36303:case 36311:case 36292:return cde}}class dde{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=Vue(n.type)}}class fde{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=ude(n.type)}}class hde{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const a=i[s];a.setValue(e,n[a.id],r)}}}const JE=/(\w+)(\])?(\[|\.)?/g;function yN(t,e){t.seq.push(e),t.map[e.id]=e}function Ade(t,e,n){const r=t.name,i=r.length;for(JE.lastIndex=0;;){const s=JE.exec(r),o=JE.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){yN(n,c===void 0?new dde(a,t,e):new fde(a,t,e));break}else{let d=n.map[a];d===void 0&&(d=new hde(a),yN(n,d)),n=d}}}class bx{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let i=0;i<r;++i){const s=e.getActiveUniform(n,i),o=e.getUniformLocation(n,s.name);Ade(s,o,this)}}setValue(e,n,r,i){const s=this.map[n];s!==void 0&&s.setValue(e,r,i)}setOptional(e,n,r){const i=n[r];i!==void 0&&this.setValue(e,r,i)}static upload(e,n,r,i){for(let s=0,o=n.length;s!==o;++s){const a=n[s],l=r[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,i)}}static seqWithValue(e,n){const r=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in n&&r.push(o)}return r}}function vN(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const pde=37297;let mde=0;function gde(t,e){const n=t.split(`
`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let o=i;o<s;o++){const a=o+1;r.push(`${a===e?">":" "} ${a}: ${n[o]}`)}return r.join(`
`)}function yde(t){const e=Nn.getPrimaries(Nn.workingColorSpace),n=Nn.getPrimaries(t);let r;switch(e===n?r="":e===RC&&n===kC?r="LinearDisplayP3ToLinearSRGB":e===kC&&n===RC&&(r="LinearSRGBToLinearDisplayP3"),t){case Ni:case FS:return[r,"LinearTransferOETF"];case Ki:case YP:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function bN(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return n.toUpperCase()+`

`+i+`

`+gde(t.getShaderSource(e),o)}else return i}function vde(t,e){const n=yde(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function bde(t,e){let n;switch(e){case woe:n="Linear";break;case xoe:n="Reinhard";break;case Coe:n="OptimizedCineon";break;case _oe:n="ACESFilmic";break;case Eoe:n="AgX";break;case Toe:n="Neutral";break;case Soe:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function wde(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(T0).join(`
`)}function xde(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
`)}function Cde(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=t.getActiveAttrib(e,i),o=s.name;let a=1;s.type===t.FLOAT_MAT2&&(a=2),s.type===t.FLOAT_MAT3&&(a=3),s.type===t.FLOAT_MAT4&&(a=4),n[o]={type:s.type,location:t.getAttribLocation(e,o),locationSize:a}}return n}function T0(t){return t!==""}function wN(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function xN(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const _de=/^[ \t]*#include +<([\w\d./]+)>/gm;function SM(t){return t.replace(_de,Ede)}const Sde=new Map;function Ede(t,e){let n=an[e];if(n===void 0){const r=Sde.get(e);if(r!==void 0)n=an[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return SM(n)}const Tde=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function CN(t){return t.replace(Tde,Bde)}function Bde(t,e,n,r){let i="";for(let s=parseInt(e);s<parseInt(n);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function _N(t){let e=`precision ${t.precision} float;
	precision ${t.precision} int;
	precision ${t.precision} sampler2D;
	precision ${t.precision} samplerCube;
	precision ${t.precision} sampler3D;
	precision ${t.precision} sampler2DArray;
	precision ${t.precision} sampler2DShadow;
	precision ${t.precision} samplerCubeShadow;
	precision ${t.precision} sampler2DArrayShadow;
	precision ${t.precision} isampler2D;
	precision ${t.precision} isampler3D;
	precision ${t.precision} isamplerCube;
	precision ${t.precision} isampler2DArray;
	precision ${t.precision} usampler2D;
	precision ${t.precision} usampler3D;
	precision ${t.precision} usamplerCube;
	precision ${t.precision} usampler2DArray;
	`;return t.precision==="highp"?e+=`
#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function Mde(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===PG?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Kse?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Ec&&(e="SHADOWMAP_TYPE_VSM"),e}function kde(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case wm:case xm:e="ENVMAP_TYPE_CUBE";break;case OS:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Rde(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case xm:e="ENVMAP_MODE_REFRACTION";break}return e}function Pde(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case LG:e="ENVMAP_BLENDING_MULTIPLY";break;case voe:e="ENVMAP_BLENDING_MIX";break;case boe:e="ENVMAP_BLENDING_ADD";break}return e}function Lde(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),7*16)),texelHeight:r,maxMip:n}}function Ide(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=Mde(n),c=kde(n),u=Rde(n),d=Pde(n),f=Lde(n),h=wde(n),A=xde(s),p=i.createProgram();let m,g,y=n.glslVersion?"#version "+n.glslVersion+`
`:"";n.isRawShaderMaterial?(m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A].filter(T0).join(`
`),m.length>0&&(m+=`
`),g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A].filter(T0).join(`
`),g.length>0&&(g+=`
`)):(m=[_N(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(T0).join(`
`),g=[_N(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.envMap?"#define "+d:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Pd?"#define TONE_MAPPING":"",n.toneMapping!==Pd?an.tonemapping_pars_fragment:"",n.toneMapping!==Pd?bde("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",an.colorspace_pars_fragment,vde("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
`].filter(T0).join(`
`)),o=SM(o),o=wN(o,n),o=xN(o,n),a=SM(a),a=wN(a,n),a=xN(a,n),o=CN(o),a=CN(a),n.isRawShaderMaterial!==!0&&(y=`#version 300 es
`,m=[h,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+m,g=["#define varying in",n.glslVersion===DF?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===DF?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
`+g);const w=y+m+o,v=y+g+a,x=vN(i,i.VERTEX_SHADER,w),C=vN(i,i.FRAGMENT_SHADER,v);i.attachShader(p,x),i.attachShader(p,C),n.index0AttributeName!==void 0?i.bindAttribLocation(p,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(p,0,"position"),i.linkProgram(p);function _(R){if(t.debug.checkShaderErrors){const k=i.getProgramInfoLog(p).trim(),B=i.getShaderInfoLog(x).trim(),M=i.getShaderInfoLog(C).trim();let F=!0,I=!0;if(i.getProgramParameter(p,i.LINK_STATUS)===!1)if(F=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,p,x,C);else{const z=bN(i,x,"vertex"),Y=bN(i,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(p,i.VALIDATE_STATUS)+`

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

Program Info Log: `+k+`
`+z+`
`+Y)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(B===""||M==="")&&(I=!1);I&&(R.diagnostics={runnable:F,programLog:k,vertexShader:{log:B,prefix:m},fragmentShader:{log:M,prefix:g}})}i.deleteShader(x),i.deleteShader(C),S=new bx(i,p),E=Cde(i,p)}let S;this.getUniforms=function(){return S===void 0&&_(this),S};let E;this.getAttributes=function(){return E===void 0&&_(this),E};let T=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return T===!1&&(T=i.getProgramParameter(p,pde)),T},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(p),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=mde++,this.cacheKey=e,this.usedTimes=1,this.program=p,this.vertexShader=x,this.fragmentShader=C,this}let Ode=0;class Fde{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new Nde(e),n.set(e,r)),r}}class Nde{constructor(e){this.id=Ode++,this.code=e,this.usedTimes=0}}function Dde(t,e,n,r,i,s,o){const a=new eL,l=new Fde,c=new Set,u=[],d=i.logarithmicDepthBuffer,f=i.vertexTextures;let h=i.precision;const A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function p(E){return c.add(E),E===0?"uv":`uv${E}`}function m(E,T,R,k,B){const M=k.fog,F=B.geometry,I=E.isMeshStandardMaterial?k.environment:null,z=(E.isMeshStandardMaterial?n:e).get(E.envMap||I),Y=z&&z.mapping===OS?z.image.height:null,$=A[E.type];E.precision!==null&&(h=i.getMaxPrecision(E.precision),h!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",h,"instead."));const ee=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,W=ee!==void 0?ee.length:0;let ne=0;F.morphAttributes.position!==void 0&&(ne=1),F.morphAttributes.normal!==void 0&&(ne=2),F.morphAttributes.color!==void 0&&(ne=3);let Se,fe,ge,Oe;if($){const Ft=wl[$];Se=Ft.vertexShader,fe=Ft.fragmentShader}else Se=E.vertexShader,fe=E.fragmentShader,l.update(E),ge=l.getVertexShaderID(E),Oe=l.getFragmentShaderID(E);const Fe=t.getRenderTarget(),De=B.isInstancedMesh===!0,ke=B.isBatchedMesh===!0,Ge=!!E.map,Ve=!!E.matcap,q=!!z,Ue=!!E.aoMap,O=!!E.lightMap,ve=!!E.bumpMap,Ae=!!E.normalMap,ae=!!E.displacementMap,Z=!!E.emissiveMap,pe=!!E.metalnessMap,J=!!E.roughnessMap,H=E.anisotropy>0,oe=E.clearcoat>0,we=E.dispersion>0,Ee=E.iridescence>0,re=E.sheen>0,ce=E.transmission>0,le=H&&!!E.anisotropyMap,me=oe&&!!E.clearcoatMap,Le=oe&&!!E.clearcoatNormalMap,Te=oe&&!!E.clearcoatRoughnessMap,Pe=Ee&&!!E.iridescenceMap,Qe=Ee&&!!E.iridescenceThicknessMap,$e=re&&!!E.sheenColorMap,et=re&&!!E.sheenRoughnessMap,st=!!E.specularMap,dt=!!E.specularColorMap,Mt=!!E.specularIntensityMap,K=ce&&!!E.transmissionMap,Be=ce&&!!E.thicknessMap,Re=!!E.gradientMap,Me=!!E.alphaMap,We=E.alphaTest>0,Je=!!E.alphaHash,ht=!!E.extensions;let Gt=Pd;E.toneMapped&&(Fe===null||Fe.isXRRenderTarget===!0)&&(Gt=t.toneMapping);const tn={shaderID:$,shaderType:E.type,shaderName:E.name,vertexShader:Se,fragmentShader:fe,defines:E.defines,customVertexShaderID:ge,customFragmentShaderID:Oe,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:h,batching:ke,batchingColor:ke&&B._colorsTexture!==null,instancing:De,instancingColor:De&&B.instanceColor!==null,instancingMorph:De&&B.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:Fe===null?t.outputColorSpace:Fe.isXRRenderTarget===!0?Fe.texture.colorSpace:Ni,alphaToCoverage:!!E.alphaToCoverage,map:Ge,matcap:Ve,envMap:q,envMapMode:q&&z.mapping,envMapCubeUVHeight:Y,aoMap:Ue,lightMap:O,bumpMap:ve,normalMap:Ae,displacementMap:f&&ae,emissiveMap:Z,normalMapObjectSpace:Ae&&E.normalMapType===Loe,normalMapTangentSpace:Ae&&E.normalMapType===WG,metalnessMap:pe,roughnessMap:J,anisotropy:H,anisotropyMap:le,clearcoat:oe,clearcoatMap:me,clearcoatNormalMap:Le,clearcoatRoughnessMap:Te,dispersion:we,iridescence:Ee,iridescenceMap:Pe,iridescenceThicknessMap:Qe,sheen:re,sheenColorMap:$e,sheenRoughnessMap:et,specularMap:st,specularColorMap:dt,specularIntensityMap:Mt,transmission:ce,transmissionMap:K,thicknessMap:Be,gradientMap:Re,opaque:E.transparent===!1&&E.blending===Gp&&E.alphaToCoverage===!1,alphaMap:Me,alphaTest:We,alphaHash:Je,combine:E.combine,mapUv:Ge&&p(E.map.channel),aoMapUv:Ue&&p(E.aoMap.channel),lightMapUv:O&&p(E.lightMap.channel),bumpMapUv:ve&&p(E.bumpMap.channel),normalMapUv:Ae&&p(E.normalMap.channel),displacementMapUv:ae&&p(E.displacementMap.channel),emissiveMapUv:Z&&p(E.emissiveMap.channel),metalnessMapUv:pe&&p(E.metalnessMap.channel),roughnessMapUv:J&&p(E.roughnessMap.channel),anisotropyMapUv:le&&p(E.anisotropyMap.channel),clearcoatMapUv:me&&p(E.clearcoatMap.channel),clearcoatNormalMapUv:Le&&p(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Te&&p(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Pe&&p(E.iridescenceMap.channel),iridescenceThicknessMapUv:Qe&&p(E.iridescenceThicknessMap.channel),sheenColorMapUv:$e&&p(E.sheenColorMap.channel),sheenRoughnessMapUv:et&&p(E.sheenRoughnessMap.channel),specularMapUv:st&&p(E.specularMap.channel),specularColorMapUv:dt&&p(E.specularColorMap.channel),specularIntensityMapUv:Mt&&p(E.specularIntensityMap.channel),transmissionMapUv:K&&p(E.transmissionMap.channel),thicknessMapUv:Be&&p(E.thicknessMap.channel),alphaMapUv:Me&&p(E.alphaMap.channel),vertexTangents:!!F.attributes.tangent&&(Ae||H),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!F.attributes.uv&&(Ge||Me),fog:!!M,useFog:E.fog===!0,fogExp2:!!M&&M.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:B.isSkinnedMesh===!0,morphTargets:F.morphAttributes.position!==void 0,morphNormals:F.morphAttributes.normal!==void 0,morphColors:F.morphAttributes.color!==void 0,morphTargetsCount:W,morphTextureStride:ne,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:E.dithering,shadowMapEnabled:t.shadowMap.enabled&&R.length>0,shadowMapType:t.shadowMap.type,toneMapping:Gt,decodeVideoTexture:Ge&&E.map.isVideoTexture===!0&&Nn.getTransfer(E.map.colorSpace)===hr,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===ja,flipSided:E.side===Ao,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:ht&&E.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ht&&E.extensions.multiDraw===!0||ke)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return tn.vertexUv1s=c.has(1),tn.vertexUv2s=c.has(2),tn.vertexUv3s=c.has(3),c.clear(),tn}function g(E){const T=[];if(E.shaderID?T.push(E.shaderID):(T.push(E.customVertexShaderID),T.push(E.customFragmentShaderID)),E.defines!==void 0)for(const R in E.defines)T.push(R),T.push(E.defines[R]);return E.isRawShaderMaterial===!1&&(y(T,E),w(T,E),T.push(t.outputColorSpace)),T.push(E.customProgramCacheKey),T.join()}function y(E,T){E.push(T.precision),E.push(T.outputColorSpace),E.push(T.envMapMode),E.push(T.envMapCubeUVHeight),E.push(T.mapUv),E.push(T.alphaMapUv),E.push(T.lightMapUv),E.push(T.aoMapUv),E.push(T.bumpMapUv),E.push(T.normalMapUv),E.push(T.displacementMapUv),E.push(T.emissiveMapUv),E.push(T.metalnessMapUv),E.push(T.roughnessMapUv),E.push(T.anisotropyMapUv),E.push(T.clearcoatMapUv),E.push(T.clearcoatNormalMapUv),E.push(T.clearcoatRoughnessMapUv),E.push(T.iridescenceMapUv),E.push(T.iridescenceThicknessMapUv),E.push(T.sheenColorMapUv),E.push(T.sheenRoughnessMapUv),E.push(T.specularMapUv),E.push(T.specularColorMapUv),E.push(T.specularIntensityMapUv),E.push(T.transmissionMapUv),E.push(T.thicknessMapUv),E.push(T.combine),E.push(T.fogExp2),E.push(T.sizeAttenuation),E.push(T.morphTargetsCount),E.push(T.morphAttributeCount),E.push(T.numDirLights),E.push(T.numPointLights),E.push(T.numSpotLights),E.push(T.numSpotLightMaps),E.push(T.numHemiLights),E.push(T.numRectAreaLights),E.push(T.numDirLightShadows),E.push(T.numPointLightShadows),E.push(T.numSpotLightShadows),E.push(T.numSpotLightShadowsWithMaps),E.push(T.numLightProbes),E.push(T.shadowMapType),E.push(T.toneMapping),E.push(T.numClippingPlanes),E.push(T.numClipIntersection),E.push(T.depthPacking)}function w(E,T){a.disableAll(),T.supportsVertexTextures&&a.enable(0),T.instancing&&a.enable(1),T.instancingColor&&a.enable(2),T.instancingMorph&&a.enable(3),T.matcap&&a.enable(4),T.envMap&&a.enable(5),T.normalMapObjectSpace&&a.enable(6),T.normalMapTangentSpace&&a.enable(7),T.clearcoat&&a.enable(8),T.iridescence&&a.enable(9),T.alphaTest&&a.enable(10),T.vertexColors&&a.enable(11),T.vertexAlphas&&a.enable(12),T.vertexUv1s&&a.enable(13),T.vertexUv2s&&a.enable(14),T.vertexUv3s&&a.enable(15),T.vertexTangents&&a.enable(16),T.anisotropy&&a.enable(17),T.alphaHash&&a.enable(18),T.batching&&a.enable(19),T.dispersion&&a.enable(20),T.batchingColor&&a.enable(21),E.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.skinning&&a.enable(4),T.morphTargets&&a.enable(5),T.morphNormals&&a.enable(6),T.morphColors&&a.enable(7),T.premultipliedAlpha&&a.enable(8),T.shadowMapEnabled&&a.enable(9),T.doubleSided&&a.enable(10),T.flipSided&&a.enable(11),T.useDepthPacking&&a.enable(12),T.dithering&&a.enable(13),T.transmission&&a.enable(14),T.sheen&&a.enable(15),T.opaque&&a.enable(16),T.pointsUvs&&a.enable(17),T.decodeVideoTexture&&a.enable(18),T.alphaToCoverage&&a.enable(19),E.push(a.mask)}function v(E){const T=A[E.type];let R;if(T){const k=wl[T];R=xae.clone(k.uniforms)}else R=E.uniforms;return R}function x(E,T){let R;for(let k=0,B=u.length;k<B;k++){const M=u[k];if(M.cacheKey===T){R=M,++R.usedTimes;break}}return R===void 0&&(R=new Ide(t,T,E,s),u.push(R)),R}function C(E){if(--E.usedTimes===0){const T=u.indexOf(E);u[T]=u[u.length-1],u.pop(),E.destroy()}}function _(E){l.remove(E)}function S(){l.dispose()}return{getParameters:m,getProgramCacheKey:g,getUniforms:v,acquireProgram:x,releaseProgram:C,releaseShaderCache:_,programs:u,dispose:S}}function Ude(){let t=new WeakMap;function e(s){let o=t.get(s);return o===void 0&&(o={},t.set(s,o)),o}function n(s){t.delete(s)}function r(s,o,a){t.get(s)[o]=a}function i(){t=new WeakMap}return{get:e,remove:n,update:r,dispose:i}}function Hde(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function SN(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function EN(){const t=[];let e=0;const n=[],r=[],i=[];function s(){e=0,n.length=0,r.length=0,i.length=0}function o(d,f,h,A,p,m){let g=t[e];return g===void 0?(g={id:d.id,object:d,geometry:f,material:h,groupOrder:A,renderOrder:d.renderOrder,z:p,group:m},t[e]=g):(g.id=d.id,g.object=d,g.geometry=f,g.material=h,g.groupOrder=A,g.renderOrder=d.renderOrder,g.z=p,g.group=m),e++,g}function a(d,f,h,A,p,m){const g=o(d,f,h,A,p,m);h.transmission>0?r.push(g):h.transparent===!0?i.push(g):n.push(g)}function l(d,f,h,A,p,m){const g=o(d,f,h,A,p,m);h.transmission>0?r.unshift(g):h.transparent===!0?i.unshift(g):n.unshift(g)}function c(d,f){n.length>1&&n.sort(d||Hde),r.length>1&&r.sort(f||SN),i.length>1&&i.sort(f||SN)}function u(){for(let d=e,f=t.length;d<f;d++){const h=t[d];if(h.id===null)break;h.id=null,h.object=null,h.geometry=null,h.material=null,h.group=null}}return{opaque:n,transmissive:r,transparent:i,init:s,push:a,unshift:l,finish:u,sort:c}}function jde(){let t=new WeakMap;function e(r,i){const s=t.get(r);let o;return s===void 0?(o=new EN,t.set(r,[o])):i>=s.length?(o=new EN,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function Qde(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new de,color:new Nt};break;case"SpotLight":n={position:new de,direction:new de,color:new Nt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new de,color:new Nt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new de,skyColor:new Nt,groundColor:new Nt};break;case"RectAreaLight":n={color:new Nt,position:new de,halfWidth:new de,halfHeight:new de};break}return t[e.id]=n,n}}}function zde(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Vde=0;function Gde(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Wde(t){const e=new Qde,n=zde(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new de);const i=new de,s=new Zt,o=new Zt;function a(c){let u=0,d=0,f=0;for(let E=0;E<9;E++)r.probe[E].set(0,0,0);let h=0,A=0,p=0,m=0,g=0,y=0,w=0,v=0,x=0,C=0,_=0;c.sort(Gde);for(let E=0,T=c.length;E<T;E++){const R=c[E],k=R.color,B=R.intensity,M=R.distance,F=R.shadow&&R.shadow.map?R.shadow.map.texture:null;if(R.isAmbientLight)u+=k.r*B,d+=k.g*B,f+=k.b*B;else if(R.isLightProbe){for(let I=0;I<9;I++)r.probe[I].addScaledVector(R.sh.coefficients[I],B);_++}else if(R.isDirectionalLight){const I=e.get(R);if(I.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){const z=R.shadow,Y=n.get(R);Y.shadowIntensity=z.intensity,Y.shadowBias=z.bias,Y.shadowNormalBias=z.normalBias,Y.shadowRadius=z.radius,Y.shadowMapSize=z.mapSize,r.directionalShadow[h]=Y,r.directionalShadowMap[h]=F,r.directionalShadowMatrix[h]=R.shadow.matrix,y++}r.directional[h]=I,h++}else if(R.isSpotLight){const I=e.get(R);I.position.setFromMatrixPosition(R.matrixWorld),I.color.copy(k).multiplyScalar(B),I.distance=M,I.coneCos=Math.cos(R.angle),I.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),I.decay=R.decay,r.spot[p]=I;const z=R.shadow;if(R.map&&(r.spotLightMap[x]=R.map,x++,z.updateMatrices(R),R.castShadow&&C++),r.spotLightMatrix[p]=z.matrix,R.castShadow){const Y=n.get(R);Y.shadowIntensity=z.intensity,Y.shadowBias=z.bias,Y.shadowNormalBias=z.normalBias,Y.shadowRadius=z.radius,Y.shadowMapSize=z.mapSize,r.spotShadow[p]=Y,r.spotShadowMap[p]=F,v++}p++}else if(R.isRectAreaLight){const I=e.get(R);I.color.copy(k).multiplyScalar(B),I.halfWidth.set(R.width*.5,0,0),I.halfHeight.set(0,R.height*.5,0),r.rectArea[m]=I,m++}else if(R.isPointLight){const I=e.get(R);if(I.color.copy(R.color).multiplyScalar(R.intensity),I.distance=R.distance,I.decay=R.decay,R.castShadow){const z=R.shadow,Y=n.get(R);Y.shadowIntensity=z.intensity,Y.shadowBias=z.bias,Y.shadowNormalBias=z.normalBias,Y.shadowRadius=z.radius,Y.shadowMapSize=z.mapSize,Y.shadowCameraNear=z.camera.near,Y.shadowCameraFar=z.camera.far,r.pointShadow[A]=Y,r.pointShadowMap[A]=F,r.pointShadowMatrix[A]=R.shadow.matrix,w++}r.point[A]=I,A++}else if(R.isHemisphereLight){const I=e.get(R);I.skyColor.copy(R.color).multiplyScalar(B),I.groundColor.copy(R.groundColor).multiplyScalar(B),r.hemi[g]=I,g++}}m>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=gt.LTC_FLOAT_1,r.rectAreaLTC2=gt.LTC_FLOAT_2):(r.rectAreaLTC1=gt.LTC_HALF_1,r.rectAreaLTC2=gt.LTC_HALF_2)),r.ambient[0]=u,r.ambient[1]=d,r.ambient[2]=f;const S=r.hash;(S.directionalLength!==h||S.pointLength!==A||S.spotLength!==p||S.rectAreaLength!==m||S.hemiLength!==g||S.numDirectionalShadows!==y||S.numPointShadows!==w||S.numSpotShadows!==v||S.numSpotMaps!==x||S.numLightProbes!==_)&&(r.directional.length=h,r.spot.length=p,r.rectArea.length=m,r.point.length=A,r.hemi.length=g,r.directionalShadow.length=y,r.directionalShadowMap.length=y,r.pointShadow.length=w,r.pointShadowMap.length=w,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=y,r.pointShadowMatrix.length=w,r.spotLightMatrix.length=v+x-C,r.spotLightMap.length=x,r.numSpotLightShadowsWithMaps=C,r.numLightProbes=_,S.directionalLength=h,S.pointLength=A,S.spotLength=p,S.rectAreaLength=m,S.hemiLength=g,S.numDirectionalShadows=y,S.numPointShadows=w,S.numSpotShadows=v,S.numSpotMaps=x,S.numLightProbes=_,r.version=Vde++)}function l(c,u){let d=0,f=0,h=0,A=0,p=0;const m=u.matrixWorldInverse;for(let g=0,y=c.length;g<y;g++){const w=c[g];if(w.isDirectionalLight){const v=r.directional[d];v.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),v.direction.sub(i),v.direction.transformDirection(m),d++}else if(w.isSpotLight){const v=r.spot[h];v.position.setFromMatrixPosition(w.matrixWorld),v.position.applyMatrix4(m),v.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),v.direction.sub(i),v.direction.transformDirection(m),h++}else if(w.isRectAreaLight){const v=r.rectArea[A];v.position.setFromMatrixPosition(w.matrixWorld),v.position.applyMatrix4(m),o.identity(),s.copy(w.matrixWorld),s.premultiply(m),o.extractRotation(s),v.halfWidth.set(w.width*.5,0,0),v.halfHeight.set(0,w.height*.5,0),v.halfWidth.applyMatrix4(o),v.halfHeight.applyMatrix4(o),A++}else if(w.isPointLight){const v=r.point[f];v.position.setFromMatrixPosition(w.matrixWorld),v.position.applyMatrix4(m),f++}else if(w.isHemisphereLight){const v=r.hemi[p];v.direction.setFromMatrixPosition(w.matrixWorld),v.direction.transformDirection(m),p++}}}return{setup:a,setupView:l,state:r}}function TN(t){const e=new Wde(t),n=[],r=[];function i(u){c.camera=u,n.length=0,r.length=0}function s(u){n.push(u)}function o(u){r.push(u)}function a(){e.setup(n)}function l(u){e.setupView(n,u)}const c={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function Kde(t){let e=new WeakMap;function n(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new TN(t),e.set(i,[a])):s>=o.length?(a=new TN(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}class $de extends jl{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Roe,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class qde extends jl{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Xde=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,Yde=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
	const float samples = float( VSM_SAMPLES );
	float mean = 0.0;
	float squared_mean = 0.0;
	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
	for ( float i = 0.0; i < samples; i ++ ) {
		float uvOffset = uvStart + i * uvStride;
		#ifdef HORIZONTAL_PASS
			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( squared_mean - mean * mean );
	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function Jde(t,e,n){let r=new tL;const i=new Ze,s=new Ze,o=new Jn,a=new $de({depthPacking:Poe}),l=new qde,c={},u=n.maxTextureSize,d={[qc]:Ao,[Ao]:qc,[ja]:ja},f=new Zd({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ze},radius:{value:4}},vertexShader:Xde,fragmentShader:Yde}),h=f.clone();h.defines.HORIZONTAL_PASS=1;const A=new Ai;A.setAttribute("position",new Fi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const p=new xn(A,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=PG;let g=this.type;this.render=function(C,_,S){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||C.length===0)return;const E=t.getRenderTarget(),T=t.getActiveCubeFace(),R=t.getActiveMipmapLevel(),k=t.state;k.setBlending(Rd),k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const B=g!==Ec&&this.type===Ec,M=g===Ec&&this.type!==Ec;for(let F=0,I=C.length;F<I;F++){const z=C[F],Y=z.shadow;if(Y===void 0){console.warn("THREE.WebGLShadowMap:",z,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;i.copy(Y.mapSize);const $=Y.getFrameExtents();if(i.multiply($),s.copy(Y.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/$.x),i.x=s.x*$.x,Y.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/$.y),i.y=s.y*$.y,Y.mapSize.y=s.y)),Y.map===null||B===!0||M===!0){const W=this.type!==Ec?{minFilter:Qs,magFilter:Qs}:{};Y.map!==null&&Y.map.dispose(),Y.map=new Dh(i.x,i.y,W),Y.map.texture.name=z.name+".shadowMap",Y.camera.updateProjectionMatrix()}t.setRenderTarget(Y.map),t.clear();const ee=Y.getViewportCount();for(let W=0;W<ee;W++){const ne=Y.getViewport(W);o.set(s.x*ne.x,s.y*ne.y,s.x*ne.z,s.y*ne.w),k.viewport(o),Y.updateMatrices(z,W),r=Y.getFrustum(),v(_,S,Y.camera,z,this.type)}Y.isPointLightShadow!==!0&&this.type===Ec&&y(Y,S),Y.needsUpdate=!1}g=this.type,m.needsUpdate=!1,t.setRenderTarget(E,T,R)};function y(C,_){const S=e.update(p);f.defines.VSM_SAMPLES!==C.blurSamples&&(f.defines.VSM_SAMPLES=C.blurSamples,h.defines.VSM_SAMPLES=C.blurSamples,f.needsUpdate=!0,h.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new Dh(i.x,i.y)),f.uniforms.shadow_pass.value=C.map.texture,f.uniforms.resolution.value=C.mapSize,f.uniforms.radius.value=C.radius,t.setRenderTarget(C.mapPass),t.clear(),t.renderBufferDirect(_,null,S,f,p,null),h.uniforms.shadow_pass.value=C.mapPass.texture,h.uniforms.resolution.value=C.mapSize,h.uniforms.radius.value=C.radius,t.setRenderTarget(C.map),t.clear(),t.renderBufferDirect(_,null,S,h,p,null)}function w(C,_,S,E){let T=null;const R=S.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(R!==void 0)T=R;else if(T=S.isPointLight===!0?l:a,t.localClippingEnabled&&_.clipShadows===!0&&Array.isArray(_.clippingPlanes)&&_.clippingPlanes.length!==0||_.displacementMap&&_.displacementScale!==0||_.alphaMap&&_.alphaTest>0||_.map&&_.alphaTest>0){const k=T.uuid,B=_.uuid;let M=c[k];M===void 0&&(M={},c[k]=M);let F=M[B];F===void 0&&(F=T.clone(),M[B]=F,_.addEventListener("dispose",x)),T=F}if(T.visible=_.visible,T.wireframe=_.wireframe,E===Ec?T.side=_.shadowSide!==null?_.shadowSide:_.side:T.side=_.shadowSide!==null?_.shadowSide:d[_.side],T.alphaMap=_.alphaMap,T.alphaTest=_.alphaTest,T.map=_.map,T.clipShadows=_.clipShadows,T.clippingPlanes=_.clippingPlanes,T.clipIntersection=_.clipIntersection,T.displacementMap=_.displacementMap,T.displacementScale=_.displacementScale,T.displacementBias=_.displacementBias,T.wireframeLinewidth=_.wireframeLinewidth,T.linewidth=_.linewidth,S.isPointLight===!0&&T.isMeshDistanceMaterial===!0){const k=t.properties.get(T);k.light=S}return T}function v(C,_,S,E,T){if(C.visible===!1)return;if(C.layers.test(_.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&T===Ec)&&(!C.frustumCulled||r.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,C.matrixWorld);const B=e.update(C),M=C.material;if(Array.isArray(M)){const F=B.groups;for(let I=0,z=F.length;I<z;I++){const Y=F[I],$=M[Y.materialIndex];if($&&$.visible){const ee=w(C,$,E,T);C.onBeforeShadow(t,C,_,S,B,ee,Y),t.renderBufferDirect(S,null,B,ee,C,Y),C.onAfterShadow(t,C,_,S,B,ee,Y)}}}else if(M.visible){const F=w(C,M,E,T);C.onBeforeShadow(t,C,_,S,B,F,null),t.renderBufferDirect(S,null,B,F,C,null),C.onAfterShadow(t,C,_,S,B,F,null)}}const k=C.children;for(let B=0,M=k.length;B<M;B++)v(k[B],_,S,E,T)}function x(C){C.target.removeEventListener("dispose",x);for(const S in c){const E=c[S],T=C.target.uuid;T in E&&(E[T].dispose(),delete E[T])}}}function Zde(t){function e(){let K=!1;const Be=new Jn;let Re=null;const Me=new Jn(0,0,0,0);return{setMask:function(We){Re!==We&&!K&&(t.colorMask(We,We,We,We),Re=We)},setLocked:function(We){K=We},setClear:function(We,Je,ht,Gt,tn){tn===!0&&(We*=Gt,Je*=Gt,ht*=Gt),Be.set(We,Je,ht,Gt),Me.equals(Be)===!1&&(t.clearColor(We,Je,ht,Gt),Me.copy(Be))},reset:function(){K=!1,Re=null,Me.set(-1,0,0,0)}}}function n(){let K=!1,Be=null,Re=null,Me=null;return{setTest:function(We){We?Oe(t.DEPTH_TEST):Fe(t.DEPTH_TEST)},setMask:function(We){Be!==We&&!K&&(t.depthMask(We),Be=We)},setFunc:function(We){if(Re!==We){switch(We){case foe:t.depthFunc(t.NEVER);break;case hoe:t.depthFunc(t.ALWAYS);break;case Aoe:t.depthFunc(t.LESS);break;case TC:t.depthFunc(t.LEQUAL);break;case poe:t.depthFunc(t.EQUAL);break;case moe:t.depthFunc(t.GEQUAL);break;case goe:t.depthFunc(t.GREATER);break;case yoe:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Re=We}},setLocked:function(We){K=We},setClear:function(We){Me!==We&&(t.clearDepth(We),Me=We)},reset:function(){K=!1,Be=null,Re=null,Me=null}}}function r(){let K=!1,Be=null,Re=null,Me=null,We=null,Je=null,ht=null,Gt=null,tn=null;return{setTest:function(Ft){K||(Ft?Oe(t.STENCIL_TEST):Fe(t.STENCIL_TEST))},setMask:function(Ft){Be!==Ft&&!K&&(t.stencilMask(Ft),Be=Ft)},setFunc:function(Ft,Dt,zt){(Re!==Ft||Me!==Dt||We!==zt)&&(t.stencilFunc(Ft,Dt,zt),Re=Ft,Me=Dt,We=zt)},setOp:function(Ft,Dt,zt){(Je!==Ft||ht!==Dt||Gt!==zt)&&(t.stencilOp(Ft,Dt,zt),Je=Ft,ht=Dt,Gt=zt)},setLocked:function(Ft){K=Ft},setClear:function(Ft){tn!==Ft&&(t.clearStencil(Ft),tn=Ft)},reset:function(){K=!1,Be=null,Re=null,Me=null,We=null,Je=null,ht=null,Gt=null,tn=null}}}const i=new e,s=new n,o=new r,a=new WeakMap,l=new WeakMap;let c={},u={},d=new WeakMap,f=[],h=null,A=!1,p=null,m=null,g=null,y=null,w=null,v=null,x=null,C=new Nt(0,0,0),_=0,S=!1,E=null,T=null,R=null,k=null,B=null;const M=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let F=!1,I=0;const z=t.getParameter(t.VERSION);z.indexOf("WebGL")!==-1?(I=parseFloat(/^WebGL (\d)/.exec(z)[1]),F=I>=1):z.indexOf("OpenGL ES")!==-1&&(I=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),F=I>=2);let Y=null,$={};const ee=t.getParameter(t.SCISSOR_BOX),W=t.getParameter(t.VIEWPORT),ne=new Jn().fromArray(ee),Se=new Jn().fromArray(W);function fe(K,Be,Re,Me){const We=new Uint8Array(4),Je=t.createTexture();t.bindTexture(K,Je),t.texParameteri(K,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(K,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let ht=0;ht<Re;ht++)K===t.TEXTURE_3D||K===t.TEXTURE_2D_ARRAY?t.texImage3D(Be,0,t.RGBA,1,1,Me,0,t.RGBA,t.UNSIGNED_BYTE,We):t.texImage2D(Be+ht,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,We);return Je}const ge={};ge[t.TEXTURE_2D]=fe(t.TEXTURE_2D,t.TEXTURE_2D,1),ge[t.TEXTURE_CUBE_MAP]=fe(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),ge[t.TEXTURE_2D_ARRAY]=fe(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),ge[t.TEXTURE_3D]=fe(t.TEXTURE_3D,t.TEXTURE_3D,1,1),i.setClear(0,0,0,1),s.setClear(1),o.setClear(0),Oe(t.DEPTH_TEST),s.setFunc(TC),ve(!1),Ae(MF),Oe(t.CULL_FACE),Ue(Rd);function Oe(K){c[K]!==!0&&(t.enable(K),c[K]=!0)}function Fe(K){c[K]!==!1&&(t.disable(K),c[K]=!1)}function De(K,Be){return u[K]!==Be?(t.bindFramebuffer(K,Be),u[K]=Be,K===t.DRAW_FRAMEBUFFER&&(u[t.FRAMEBUFFER]=Be),K===t.FRAMEBUFFER&&(u[t.DRAW_FRAMEBUFFER]=Be),!0):!1}function ke(K,Be){let Re=f,Me=!1;if(K){Re=d.get(Be),Re===void 0&&(Re=[],d.set(Be,Re));const We=K.textures;if(Re.length!==We.length||Re[0]!==t.COLOR_ATTACHMENT0){for(let Je=0,ht=We.length;Je<ht;Je++)Re[Je]=t.COLOR_ATTACHMENT0+Je;Re.length=We.length,Me=!0}}else Re[0]!==t.BACK&&(Re[0]=t.BACK,Me=!0);Me&&t.drawBuffers(Re)}function Ge(K){return h!==K?(t.useProgram(K),h=K,!0):!1}const Ve={[Zf]:t.FUNC_ADD,[qse]:t.FUNC_SUBTRACT,[Xse]:t.FUNC_REVERSE_SUBTRACT};Ve[Yse]=t.MIN,Ve[Jse]=t.MAX;const q={[Zse]:t.ZERO,[eoe]:t.ONE,[toe]:t.SRC_COLOR,[K3]:t.SRC_ALPHA,[aoe]:t.SRC_ALPHA_SATURATE,[soe]:t.DST_COLOR,[roe]:t.DST_ALPHA,[noe]:t.ONE_MINUS_SRC_COLOR,[$3]:t.ONE_MINUS_SRC_ALPHA,[ooe]:t.ONE_MINUS_DST_COLOR,[ioe]:t.ONE_MINUS_DST_ALPHA,[loe]:t.CONSTANT_COLOR,[coe]:t.ONE_MINUS_CONSTANT_COLOR,[uoe]:t.CONSTANT_ALPHA,[doe]:t.ONE_MINUS_CONSTANT_ALPHA};function Ue(K,Be,Re,Me,We,Je,ht,Gt,tn,Ft){if(K===Rd){A===!0&&(Fe(t.BLEND),A=!1);return}if(A===!1&&(Oe(t.BLEND),A=!0),K!==$se){if(K!==p||Ft!==S){if((m!==Zf||w!==Zf)&&(t.blendEquation(t.FUNC_ADD),m=Zf,w=Zf),Ft)switch(K){case Gp:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case kF:t.blendFunc(t.ONE,t.ONE);break;case RF:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case PF:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",K);break}else switch(K){case Gp:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case kF:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case RF:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case PF:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",K);break}g=null,y=null,v=null,x=null,C.set(0,0,0),_=0,p=K,S=Ft}return}We=We||Be,Je=Je||Re,ht=ht||Me,(Be!==m||We!==w)&&(t.blendEquationSeparate(Ve[Be],Ve[We]),m=Be,w=We),(Re!==g||Me!==y||Je!==v||ht!==x)&&(t.blendFuncSeparate(q[Re],q[Me],q[Je],q[ht]),g=Re,y=Me,v=Je,x=ht),(Gt.equals(C)===!1||tn!==_)&&(t.blendColor(Gt.r,Gt.g,Gt.b,tn),C.copy(Gt),_=tn),p=K,S=!1}function O(K,Be){K.side===ja?Fe(t.CULL_FACE):Oe(t.CULL_FACE);let Re=K.side===Ao;Be&&(Re=!Re),ve(Re),K.blending===Gp&&K.transparent===!1?Ue(Rd):Ue(K.blending,K.blendEquation,K.blendSrc,K.blendDst,K.blendEquationAlpha,K.blendSrcAlpha,K.blendDstAlpha,K.blendColor,K.blendAlpha,K.premultipliedAlpha),s.setFunc(K.depthFunc),s.setTest(K.depthTest),s.setMask(K.depthWrite),i.setMask(K.colorWrite);const Me=K.stencilWrite;o.setTest(Me),Me&&(o.setMask(K.stencilWriteMask),o.setFunc(K.stencilFunc,K.stencilRef,K.stencilFuncMask),o.setOp(K.stencilFail,K.stencilZFail,K.stencilZPass)),Z(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),K.alphaToCoverage===!0?Oe(t.SAMPLE_ALPHA_TO_COVERAGE):Fe(t.SAMPLE_ALPHA_TO_COVERAGE)}function ve(K){E!==K&&(K?t.frontFace(t.CW):t.frontFace(t.CCW),E=K)}function Ae(K){K!==Gse?(Oe(t.CULL_FACE),K!==T&&(K===MF?t.cullFace(t.BACK):K===Wse?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Fe(t.CULL_FACE),T=K}function ae(K){K!==R&&(F&&t.lineWidth(K),R=K)}function Z(K,Be,Re){K?(Oe(t.POLYGON_OFFSET_FILL),(k!==Be||B!==Re)&&(t.polygonOffset(Be,Re),k=Be,B=Re)):Fe(t.POLYGON_OFFSET_FILL)}function pe(K){K?Oe(t.SCISSOR_TEST):Fe(t.SCISSOR_TEST)}function J(K){K===void 0&&(K=t.TEXTURE0+M-1),Y!==K&&(t.activeTexture(K),Y=K)}function H(K,Be,Re){Re===void 0&&(Y===null?Re=t.TEXTURE0+M-1:Re=Y);let Me=$[Re];Me===void 0&&(Me={type:void 0,texture:void 0},$[Re]=Me),(Me.type!==K||Me.texture!==Be)&&(Y!==Re&&(t.activeTexture(Re),Y=Re),t.bindTexture(K,Be||ge[K]),Me.type=K,Me.texture=Be)}function oe(){const K=$[Y];K!==void 0&&K.type!==void 0&&(t.bindTexture(K.type,null),K.type=void 0,K.texture=void 0)}function we(){try{t.compressedTexImage2D.apply(t,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Ee(){try{t.compressedTexImage3D.apply(t,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function re(){try{t.texSubImage2D.apply(t,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function ce(){try{t.texSubImage3D.apply(t,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function le(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function me(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Le(){try{t.texStorage2D.apply(t,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Te(){try{t.texStorage3D.apply(t,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Pe(){try{t.texImage2D.apply(t,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Qe(){try{t.texImage3D.apply(t,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function $e(K){ne.equals(K)===!1&&(t.scissor(K.x,K.y,K.z,K.w),ne.copy(K))}function et(K){Se.equals(K)===!1&&(t.viewport(K.x,K.y,K.z,K.w),Se.copy(K))}function st(K,Be){let Re=l.get(Be);Re===void 0&&(Re=new WeakMap,l.set(Be,Re));let Me=Re.get(K);Me===void 0&&(Me=t.getUniformBlockIndex(Be,K.name),Re.set(K,Me))}function dt(K,Be){const Me=l.get(Be).get(K);a.get(Be)!==Me&&(t.uniformBlockBinding(Be,Me,K.__bindingPointIndex),a.set(Be,Me))}function Mt(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),c={},Y=null,$={},u={},d=new WeakMap,f=[],h=null,A=!1,p=null,m=null,g=null,y=null,w=null,v=null,x=null,C=new Nt(0,0,0),_=0,S=!1,E=null,T=null,R=null,k=null,B=null,ne.set(0,0,t.canvas.width,t.canvas.height),Se.set(0,0,t.canvas.width,t.canvas.height),i.reset(),s.reset(),o.reset()}return{buffers:{color:i,depth:s,stencil:o},enable:Oe,disable:Fe,bindFramebuffer:De,drawBuffers:ke,useProgram:Ge,setBlending:Ue,setMaterial:O,setFlipSided:ve,setCullFace:Ae,setLineWidth:ae,setPolygonOffset:Z,setScissorTest:pe,activeTexture:J,bindTexture:H,unbindTexture:oe,compressedTexImage2D:we,compressedTexImage3D:Ee,texImage2D:Pe,texImage3D:Qe,updateUBOMapping:st,uniformBlockBinding:dt,texStorage2D:Le,texStorage3D:Te,texSubImage2D:re,texSubImage3D:ce,compressedTexSubImage2D:le,compressedTexSubImage3D:me,scissor:$e,viewport:et,reset:Mt}}function BN(t,e,n,r){const i=efe(r);switch(n){case UG:return t*e;case jG:return t*e;case QG:return t*e*2;case KP:return t*e/i.components*i.byteLength;case $P:return t*e/i.components*i.byteLength;case zG:return t*e*2/i.components*i.byteLength;case qP:return t*e*2/i.components*i.byteLength;case HG:return t*e*3/i.components*i.byteLength;case ua:return t*e*4/i.components*i.byteLength;case XP:return t*e*4/i.components*i.byteLength;case px:case mx:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case gx:case yx:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case J3:case eM:return Math.max(t,16)*Math.max(e,8)/4;case Y3:case Z3:return Math.max(t,8)*Math.max(e,8)/2;case tM:case nM:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case rM:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case iM:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case sM:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case oM:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case aM:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case lM:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case cM:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case uM:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case dM:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case fM:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case hM:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case AM:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case pM:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case mM:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case gM:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case vx:case yM:case vM:return Math.ceil(t/4)*Math.ceil(e/4)*16;case VG:case bM:return Math.ceil(t/4)*Math.ceil(e/4)*8;case wM:case xM:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function efe(t){switch(t){case Xc:case FG:return{byteLength:1,components:1};case $1:case NG:case ev:return{byteLength:2,components:1};case GP:case WP:return{byteLength:2,components:4};case Nh:case VP:case Wa:return{byteLength:4,components:1};case DG:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}function tfe(t,e,n,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ze,u=new WeakMap;let d;const f=new WeakMap;let h=!1;try{h=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function A(J,H){return h?new OffscreenCanvas(J,H):Y1("canvas")}function p(J,H,oe){let we=1;const Ee=pe(J);if((Ee.width>oe||Ee.height>oe)&&(we=oe/Math.max(Ee.width,Ee.height)),we<1)if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap||typeof VideoFrame<"u"&&J instanceof VideoFrame){const re=Math.floor(we*Ee.width),ce=Math.floor(we*Ee.height);d===void 0&&(d=A(re,ce));const le=H?A(re,ce):d;return le.width=re,le.height=ce,le.getContext("2d").drawImage(J,0,0,re,ce),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ee.width+"x"+Ee.height+") to ("+re+"x"+ce+")."),le}else return"data"in J&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ee.width+"x"+Ee.height+")."),J;return J}function m(J){return J.generateMipmaps&&J.minFilter!==Qs&&J.minFilter!==Io}function g(J){t.generateMipmap(J)}function y(J,H,oe,we,Ee=!1){if(J!==null){if(t[J]!==void 0)return t[J];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+J+"'")}let re=H;if(H===t.RED&&(oe===t.FLOAT&&(re=t.R32F),oe===t.HALF_FLOAT&&(re=t.R16F),oe===t.UNSIGNED_BYTE&&(re=t.R8)),H===t.RED_INTEGER&&(oe===t.UNSIGNED_BYTE&&(re=t.R8UI),oe===t.UNSIGNED_SHORT&&(re=t.R16UI),oe===t.UNSIGNED_INT&&(re=t.R32UI),oe===t.BYTE&&(re=t.R8I),oe===t.SHORT&&(re=t.R16I),oe===t.INT&&(re=t.R32I)),H===t.RG&&(oe===t.FLOAT&&(re=t.RG32F),oe===t.HALF_FLOAT&&(re=t.RG16F),oe===t.UNSIGNED_BYTE&&(re=t.RG8)),H===t.RG_INTEGER&&(oe===t.UNSIGNED_BYTE&&(re=t.RG8UI),oe===t.UNSIGNED_SHORT&&(re=t.RG16UI),oe===t.UNSIGNED_INT&&(re=t.RG32UI),oe===t.BYTE&&(re=t.RG8I),oe===t.SHORT&&(re=t.RG16I),oe===t.INT&&(re=t.RG32I)),H===t.RGB&&oe===t.UNSIGNED_INT_5_9_9_9_REV&&(re=t.RGB9_E5),H===t.RGBA){const ce=Ee?MC:Nn.getTransfer(we);oe===t.FLOAT&&(re=t.RGBA32F),oe===t.HALF_FLOAT&&(re=t.RGBA16F),oe===t.UNSIGNED_BYTE&&(re=ce===hr?t.SRGB8_ALPHA8:t.RGBA8),oe===t.UNSIGNED_SHORT_4_4_4_4&&(re=t.RGBA4),oe===t.UNSIGNED_SHORT_5_5_5_1&&(re=t.RGB5_A1)}return(re===t.R16F||re===t.R32F||re===t.RG16F||re===t.RG32F||re===t.RGBA16F||re===t.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function w(J,H){let oe;return J?H===null||H===Nh||H===_m?oe=t.DEPTH24_STENCIL8:H===Wa?oe=t.DEPTH32F_STENCIL8:H===$1&&(oe=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):H===null||H===Nh||H===_m?oe=t.DEPTH_COMPONENT24:H===Wa?oe=t.DEPTH_COMPONENT32F:H===$1&&(oe=t.DEPTH_COMPONENT16),oe}function v(J,H){return m(J)===!0||J.isFramebufferTexture&&J.minFilter!==Qs&&J.minFilter!==Io?Math.log2(Math.max(H.width,H.height))+1:J.mipmaps!==void 0&&J.mipmaps.length>0?J.mipmaps.length:J.isCompressedTexture&&Array.isArray(J.image)?H.mipmaps.length:1}function x(J){const H=J.target;H.removeEventListener("dispose",x),_(H),H.isVideoTexture&&u.delete(H)}function C(J){const H=J.target;H.removeEventListener("dispose",C),E(H)}function _(J){const H=r.get(J);if(H.__webglInit===void 0)return;const oe=J.source,we=f.get(oe);if(we){const Ee=we[H.__cacheKey];Ee.usedTimes--,Ee.usedTimes===0&&S(J),Object.keys(we).length===0&&f.delete(oe)}r.remove(J)}function S(J){const H=r.get(J);t.deleteTexture(H.__webglTexture);const oe=J.source,we=f.get(oe);delete we[H.__cacheKey],o.memory.textures--}function E(J){const H=r.get(J);if(J.depthTexture&&J.depthTexture.dispose(),J.isWebGLCubeRenderTarget)for(let we=0;we<6;we++){if(Array.isArray(H.__webglFramebuffer[we]))for(let Ee=0;Ee<H.__webglFramebuffer[we].length;Ee++)t.deleteFramebuffer(H.__webglFramebuffer[we][Ee]);else t.deleteFramebuffer(H.__webglFramebuffer[we]);H.__webglDepthbuffer&&t.deleteRenderbuffer(H.__webglDepthbuffer[we])}else{if(Array.isArray(H.__webglFramebuffer))for(let we=0;we<H.__webglFramebuffer.length;we++)t.deleteFramebuffer(H.__webglFramebuffer[we]);else t.deleteFramebuffer(H.__webglFramebuffer);if(H.__webglDepthbuffer&&t.deleteRenderbuffer(H.__webglDepthbuffer),H.__webglMultisampledFramebuffer&&t.deleteFramebuffer(H.__webglMultisampledFramebuffer),H.__webglColorRenderbuffer)for(let we=0;we<H.__webglColorRenderbuffer.length;we++)H.__webglColorRenderbuffer[we]&&t.deleteRenderbuffer(H.__webglColorRenderbuffer[we]);H.__webglDepthRenderbuffer&&t.deleteRenderbuffer(H.__webglDepthRenderbuffer)}const oe=J.textures;for(let we=0,Ee=oe.length;we<Ee;we++){const re=r.get(oe[we]);re.__webglTexture&&(t.deleteTexture(re.__webglTexture),o.memory.textures--),r.remove(oe[we])}r.remove(J)}let T=0;function R(){T=0}function k(){const J=T;return J>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+J+" texture units while this GPU supports only "+i.maxTextures),T+=1,J}function B(J){const H=[];return H.push(J.wrapS),H.push(J.wrapT),H.push(J.wrapR||0),H.push(J.magFilter),H.push(J.minFilter),H.push(J.anisotropy),H.push(J.internalFormat),H.push(J.format),H.push(J.type),H.push(J.generateMipmaps),H.push(J.premultiplyAlpha),H.push(J.flipY),H.push(J.unpackAlignment),H.push(J.colorSpace),H.join()}function M(J,H){const oe=r.get(J);if(J.isVideoTexture&&ae(J),J.isRenderTargetTexture===!1&&J.version>0&&oe.__version!==J.version){const we=J.image;if(we===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(we.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Se(oe,J,H);return}}n.bindTexture(t.TEXTURE_2D,oe.__webglTexture,t.TEXTURE0+H)}function F(J,H){const oe=r.get(J);if(J.version>0&&oe.__version!==J.version){Se(oe,J,H);return}n.bindTexture(t.TEXTURE_2D_ARRAY,oe.__webglTexture,t.TEXTURE0+H)}function I(J,H){const oe=r.get(J);if(J.version>0&&oe.__version!==J.version){Se(oe,J,H);return}n.bindTexture(t.TEXTURE_3D,oe.__webglTexture,t.TEXTURE0+H)}function z(J,H){const oe=r.get(J);if(J.version>0&&oe.__version!==J.version){fe(oe,J,H);return}n.bindTexture(t.TEXTURE_CUBE_MAP,oe.__webglTexture,t.TEXTURE0+H)}const Y={[Cm]:t.REPEAT,[sd]:t.CLAMP_TO_EDGE,[BC]:t.MIRRORED_REPEAT},$={[Qs]:t.NEAREST,[OG]:t.NEAREST_MIPMAP_NEAREST,[E0]:t.NEAREST_MIPMAP_LINEAR,[Io]:t.LINEAR,[Ax]:t.LINEAR_MIPMAP_NEAREST,[Oc]:t.LINEAR_MIPMAP_LINEAR},ee={[Ioe]:t.NEVER,[Hoe]:t.ALWAYS,[Ooe]:t.LESS,[KG]:t.LEQUAL,[Foe]:t.EQUAL,[Uoe]:t.GEQUAL,[Noe]:t.GREATER,[Doe]:t.NOTEQUAL};function W(J,H){if(H.type===Wa&&e.has("OES_texture_float_linear")===!1&&(H.magFilter===Io||H.magFilter===Ax||H.magFilter===E0||H.magFilter===Oc||H.minFilter===Io||H.minFilter===Ax||H.minFilter===E0||H.minFilter===Oc)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(J,t.TEXTURE_WRAP_S,Y[H.wrapS]),t.texParameteri(J,t.TEXTURE_WRAP_T,Y[H.wrapT]),(J===t.TEXTURE_3D||J===t.TEXTURE_2D_ARRAY)&&t.texParameteri(J,t.TEXTURE_WRAP_R,Y[H.wrapR]),t.texParameteri(J,t.TEXTURE_MAG_FILTER,$[H.magFilter]),t.texParameteri(J,t.TEXTURE_MIN_FILTER,$[H.minFilter]),H.compareFunction&&(t.texParameteri(J,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(J,t.TEXTURE_COMPARE_FUNC,ee[H.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(H.magFilter===Qs||H.minFilter!==E0&&H.minFilter!==Oc||H.type===Wa&&e.has("OES_texture_float_linear")===!1)return;if(H.anisotropy>1||r.get(H).__currentAnisotropy){const oe=e.get("EXT_texture_filter_anisotropic");t.texParameterf(J,oe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(H.anisotropy,i.getMaxAnisotropy())),r.get(H).__currentAnisotropy=H.anisotropy}}}function ne(J,H){let oe=!1;J.__webglInit===void 0&&(J.__webglInit=!0,H.addEventListener("dispose",x));const we=H.source;let Ee=f.get(we);Ee===void 0&&(Ee={},f.set(we,Ee));const re=B(H);if(re!==J.__cacheKey){Ee[re]===void 0&&(Ee[re]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,oe=!0),Ee[re].usedTimes++;const ce=Ee[J.__cacheKey];ce!==void 0&&(Ee[J.__cacheKey].usedTimes--,ce.usedTimes===0&&S(H)),J.__cacheKey=re,J.__webglTexture=Ee[re].texture}return oe}function Se(J,H,oe){let we=t.TEXTURE_2D;(H.isDataArrayTexture||H.isCompressedArrayTexture)&&(we=t.TEXTURE_2D_ARRAY),H.isData3DTexture&&(we=t.TEXTURE_3D);const Ee=ne(J,H),re=H.source;n.bindTexture(we,J.__webglTexture,t.TEXTURE0+oe);const ce=r.get(re);if(re.version!==ce.__version||Ee===!0){n.activeTexture(t.TEXTURE0+oe);const le=Nn.getPrimaries(Nn.workingColorSpace),me=H.colorSpace===Ju?null:Nn.getPrimaries(H.colorSpace),Le=H.colorSpace===Ju||le===me?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,H.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,H.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Le);let Te=p(H.image,!1,i.maxTextureSize);Te=Z(H,Te);const Pe=s.convert(H.format,H.colorSpace),Qe=s.convert(H.type);let $e=y(H.internalFormat,Pe,Qe,H.colorSpace,H.isVideoTexture);W(we,H);let et;const st=H.mipmaps,dt=H.isVideoTexture!==!0,Mt=ce.__version===void 0||Ee===!0,K=re.dataReady,Be=v(H,Te);if(H.isDepthTexture)$e=w(H.format===Sm,H.type),Mt&&(dt?n.texStorage2D(t.TEXTURE_2D,1,$e,Te.width,Te.height):n.texImage2D(t.TEXTURE_2D,0,$e,Te.width,Te.height,0,Pe,Qe,null));else if(H.isDataTexture)if(st.length>0){dt&&Mt&&n.texStorage2D(t.TEXTURE_2D,Be,$e,st[0].width,st[0].height);for(let Re=0,Me=st.length;Re<Me;Re++)et=st[Re],dt?K&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,et.width,et.height,Pe,Qe,et.data):n.texImage2D(t.TEXTURE_2D,Re,$e,et.width,et.height,0,Pe,Qe,et.data);H.generateMipmaps=!1}else dt?(Mt&&n.texStorage2D(t.TEXTURE_2D,Be,$e,Te.width,Te.height),K&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Te.width,Te.height,Pe,Qe,Te.data)):n.texImage2D(t.TEXTURE_2D,0,$e,Te.width,Te.height,0,Pe,Qe,Te.data);else if(H.isCompressedTexture)if(H.isCompressedArrayTexture){dt&&Mt&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Be,$e,st[0].width,st[0].height,Te.depth);for(let Re=0,Me=st.length;Re<Me;Re++)if(et=st[Re],H.format!==ua)if(Pe!==null)if(dt){if(K)if(H.layerUpdates.size>0){const We=BN(et.width,et.height,H.format,H.type);for(const Je of H.layerUpdates){const ht=et.data.subarray(Je*We/et.data.BYTES_PER_ELEMENT,(Je+1)*We/et.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,Je,et.width,et.height,1,Pe,ht,0,0)}H.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,et.width,et.height,Te.depth,Pe,et.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Re,$e,et.width,et.height,Te.depth,0,et.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else dt?K&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,et.width,et.height,Te.depth,Pe,Qe,et.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Re,$e,et.width,et.height,Te.depth,0,Pe,Qe,et.data)}else{dt&&Mt&&n.texStorage2D(t.TEXTURE_2D,Be,$e,st[0].width,st[0].height);for(let Re=0,Me=st.length;Re<Me;Re++)et=st[Re],H.format!==ua?Pe!==null?dt?K&&n.compressedTexSubImage2D(t.TEXTURE_2D,Re,0,0,et.width,et.height,Pe,et.data):n.compressedTexImage2D(t.TEXTURE_2D,Re,$e,et.width,et.height,0,et.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):dt?K&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,et.width,et.height,Pe,Qe,et.data):n.texImage2D(t.TEXTURE_2D,Re,$e,et.width,et.height,0,Pe,Qe,et.data)}else if(H.isDataArrayTexture)if(dt){if(Mt&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Be,$e,Te.width,Te.height,Te.depth),K)if(H.layerUpdates.size>0){const Re=BN(Te.width,Te.height,H.format,H.type);for(const Me of H.layerUpdates){const We=Te.data.subarray(Me*Re/Te.data.BYTES_PER_ELEMENT,(Me+1)*Re/Te.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Me,Te.width,Te.height,1,Pe,Qe,We)}H.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Te.width,Te.height,Te.depth,Pe,Qe,Te.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,$e,Te.width,Te.height,Te.depth,0,Pe,Qe,Te.data);else if(H.isData3DTexture)dt?(Mt&&n.texStorage3D(t.TEXTURE_3D,Be,$e,Te.width,Te.height,Te.depth),K&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Te.width,Te.height,Te.depth,Pe,Qe,Te.data)):n.texImage3D(t.TEXTURE_3D,0,$e,Te.width,Te.height,Te.depth,0,Pe,Qe,Te.data);else if(H.isFramebufferTexture){if(Mt)if(dt)n.texStorage2D(t.TEXTURE_2D,Be,$e,Te.width,Te.height);else{let Re=Te.width,Me=Te.height;for(let We=0;We<Be;We++)n.texImage2D(t.TEXTURE_2D,We,$e,Re,Me,0,Pe,Qe,null),Re>>=1,Me>>=1}}else if(st.length>0){if(dt&&Mt){const Re=pe(st[0]);n.texStorage2D(t.TEXTURE_2D,Be,$e,Re.width,Re.height)}for(let Re=0,Me=st.length;Re<Me;Re++)et=st[Re],dt?K&&n.texSubImage2D(t.TEXTURE_2D,Re,0,0,Pe,Qe,et):n.texImage2D(t.TEXTURE_2D,Re,$e,Pe,Qe,et);H.generateMipmaps=!1}else if(dt){if(Mt){const Re=pe(Te);n.texStorage2D(t.TEXTURE_2D,Be,$e,Re.width,Re.height)}K&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Pe,Qe,Te)}else n.texImage2D(t.TEXTURE_2D,0,$e,Pe,Qe,Te);m(H)&&g(we),ce.__version=re.version,H.onUpdate&&H.onUpdate(H)}J.__version=H.version}function fe(J,H,oe){if(H.image.length!==6)return;const we=ne(J,H),Ee=H.source;n.bindTexture(t.TEXTURE_CUBE_MAP,J.__webglTexture,t.TEXTURE0+oe);const re=r.get(Ee);if(Ee.version!==re.__version||we===!0){n.activeTexture(t.TEXTURE0+oe);const ce=Nn.getPrimaries(Nn.workingColorSpace),le=H.colorSpace===Ju?null:Nn.getPrimaries(H.colorSpace),me=H.colorSpace===Ju||ce===le?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,H.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,H.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,me);const Le=H.isCompressedTexture||H.image[0].isCompressedTexture,Te=H.image[0]&&H.image[0].isDataTexture,Pe=[];for(let Me=0;Me<6;Me++)!Le&&!Te?Pe[Me]=p(H.image[Me],!0,i.maxCubemapSize):Pe[Me]=Te?H.image[Me].image:H.image[Me],Pe[Me]=Z(H,Pe[Me]);const Qe=Pe[0],$e=s.convert(H.format,H.colorSpace),et=s.convert(H.type),st=y(H.internalFormat,$e,et,H.colorSpace),dt=H.isVideoTexture!==!0,Mt=re.__version===void 0||we===!0,K=Ee.dataReady;let Be=v(H,Qe);W(t.TEXTURE_CUBE_MAP,H);let Re;if(Le){dt&&Mt&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Be,st,Qe.width,Qe.height);for(let Me=0;Me<6;Me++){Re=Pe[Me].mipmaps;for(let We=0;We<Re.length;We++){const Je=Re[We];H.format!==ua?$e!==null?dt?K&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,We,0,0,Je.width,Je.height,$e,Je.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,We,st,Je.width,Je.height,0,Je.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):dt?K&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,We,0,0,Je.width,Je.height,$e,et,Je.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,We,st,Je.width,Je.height,0,$e,et,Je.data)}}}else{if(Re=H.mipmaps,dt&&Mt){Re.length>0&&Be++;const Me=pe(Pe[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Be,st,Me.width,Me.height)}for(let Me=0;Me<6;Me++)if(Te){dt?K&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,0,0,Pe[Me].width,Pe[Me].height,$e,et,Pe[Me].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,st,Pe[Me].width,Pe[Me].height,0,$e,et,Pe[Me].data);for(let We=0;We<Re.length;We++){const ht=Re[We].image[Me].image;dt?K&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,We+1,0,0,ht.width,ht.height,$e,et,ht.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,We+1,st,ht.width,ht.height,0,$e,et,ht.data)}}else{dt?K&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,0,0,$e,et,Pe[Me]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,st,$e,et,Pe[Me]);for(let We=0;We<Re.length;We++){const Je=Re[We];dt?K&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,We+1,0,0,$e,et,Je.image[Me]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Me,We+1,st,$e,et,Je.image[Me])}}}m(H)&&g(t.TEXTURE_CUBE_MAP),re.__version=Ee.version,H.onUpdate&&H.onUpdate(H)}J.__version=H.version}function ge(J,H,oe,we,Ee,re){const ce=s.convert(oe.format,oe.colorSpace),le=s.convert(oe.type),me=y(oe.internalFormat,ce,le,oe.colorSpace);if(!r.get(H).__hasExternalTextures){const Te=Math.max(1,H.width>>re),Pe=Math.max(1,H.height>>re);Ee===t.TEXTURE_3D||Ee===t.TEXTURE_2D_ARRAY?n.texImage3D(Ee,re,me,Te,Pe,H.depth,0,ce,le,null):n.texImage2D(Ee,re,me,Te,Pe,0,ce,le,null)}n.bindFramebuffer(t.FRAMEBUFFER,J),Ae(H)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,we,Ee,r.get(oe).__webglTexture,0,ve(H)):(Ee===t.TEXTURE_2D||Ee>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Ee<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,we,Ee,r.get(oe).__webglTexture,re),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Oe(J,H,oe){if(t.bindRenderbuffer(t.RENDERBUFFER,J),H.depthBuffer){const we=H.depthTexture,Ee=we&&we.isDepthTexture?we.type:null,re=w(H.stencilBuffer,Ee),ce=H.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,le=ve(H);Ae(H)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,le,re,H.width,H.height):oe?t.renderbufferStorageMultisample(t.RENDERBUFFER,le,re,H.width,H.height):t.renderbufferStorage(t.RENDERBUFFER,re,H.width,H.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,ce,t.RENDERBUFFER,J)}else{const we=H.textures;for(let Ee=0;Ee<we.length;Ee++){const re=we[Ee],ce=s.convert(re.format,re.colorSpace),le=s.convert(re.type),me=y(re.internalFormat,ce,le,re.colorSpace),Le=ve(H);oe&&Ae(H)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Le,me,H.width,H.height):Ae(H)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Le,me,H.width,H.height):t.renderbufferStorage(t.RENDERBUFFER,me,H.width,H.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Fe(J,H){if(H&&H.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,J),!(H.depthTexture&&H.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(H.depthTexture).__webglTexture||H.depthTexture.image.width!==H.width||H.depthTexture.image.height!==H.height)&&(H.depthTexture.image.width=H.width,H.depthTexture.image.height=H.height,H.depthTexture.needsUpdate=!0),M(H.depthTexture,0);const we=r.get(H.depthTexture).__webglTexture,Ee=ve(H);if(H.depthTexture.format===Wp)Ae(H)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,we,0,Ee):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,we,0);else if(H.depthTexture.format===Sm)Ae(H)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,we,0,Ee):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,we,0);else throw new Error("Unknown depthTexture format")}function De(J){const H=r.get(J),oe=J.isWebGLCubeRenderTarget===!0;if(J.depthTexture&&!H.__autoAllocateDepthBuffer){if(oe)throw new Error("target.depthTexture not supported in Cube render targets");Fe(H.__webglFramebuffer,J)}else if(oe){H.__webglDepthbuffer=[];for(let we=0;we<6;we++)n.bindFramebuffer(t.FRAMEBUFFER,H.__webglFramebuffer[we]),H.__webglDepthbuffer[we]=t.createRenderbuffer(),Oe(H.__webglDepthbuffer[we],J,!1)}else n.bindFramebuffer(t.FRAMEBUFFER,H.__webglFramebuffer),H.__webglDepthbuffer=t.createRenderbuffer(),Oe(H.__webglDepthbuffer,J,!1);n.bindFramebuffer(t.FRAMEBUFFER,null)}function ke(J,H,oe){const we=r.get(J);H!==void 0&&ge(we.__webglFramebuffer,J,J.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),oe!==void 0&&De(J)}function Ge(J){const H=J.texture,oe=r.get(J),we=r.get(H);J.addEventListener("dispose",C);const Ee=J.textures,re=J.isWebGLCubeRenderTarget===!0,ce=Ee.length>1;if(ce||(we.__webglTexture===void 0&&(we.__webglTexture=t.createTexture()),we.__version=H.version,o.memory.textures++),re){oe.__webglFramebuffer=[];for(let le=0;le<6;le++)if(H.mipmaps&&H.mipmaps.length>0){oe.__webglFramebuffer[le]=[];for(let me=0;me<H.mipmaps.length;me++)oe.__webglFramebuffer[le][me]=t.createFramebuffer()}else oe.__webglFramebuffer[le]=t.createFramebuffer()}else{if(H.mipmaps&&H.mipmaps.length>0){oe.__webglFramebuffer=[];for(let le=0;le<H.mipmaps.length;le++)oe.__webglFramebuffer[le]=t.createFramebuffer()}else oe.__webglFramebuffer=t.createFramebuffer();if(ce)for(let le=0,me=Ee.length;le<me;le++){const Le=r.get(Ee[le]);Le.__webglTexture===void 0&&(Le.__webglTexture=t.createTexture(),o.memory.textures++)}if(J.samples>0&&Ae(J)===!1){oe.__webglMultisampledFramebuffer=t.createFramebuffer(),oe.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,oe.__webglMultisampledFramebuffer);for(let le=0;le<Ee.length;le++){const me=Ee[le];oe.__webglColorRenderbuffer[le]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,oe.__webglColorRenderbuffer[le]);const Le=s.convert(me.format,me.colorSpace),Te=s.convert(me.type),Pe=y(me.internalFormat,Le,Te,me.colorSpace,J.isXRRenderTarget===!0),Qe=ve(J);t.renderbufferStorageMultisample(t.RENDERBUFFER,Qe,Pe,J.width,J.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+le,t.RENDERBUFFER,oe.__webglColorRenderbuffer[le])}t.bindRenderbuffer(t.RENDERBUFFER,null),J.depthBuffer&&(oe.__webglDepthRenderbuffer=t.createRenderbuffer(),Oe(oe.__webglDepthRenderbuffer,J,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(re){n.bindTexture(t.TEXTURE_CUBE_MAP,we.__webglTexture),W(t.TEXTURE_CUBE_MAP,H);for(let le=0;le<6;le++)if(H.mipmaps&&H.mipmaps.length>0)for(let me=0;me<H.mipmaps.length;me++)ge(oe.__webglFramebuffer[le][me],J,H,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+le,me);else ge(oe.__webglFramebuffer[le],J,H,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+le,0);m(H)&&g(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(ce){for(let le=0,me=Ee.length;le<me;le++){const Le=Ee[le],Te=r.get(Le);n.bindTexture(t.TEXTURE_2D,Te.__webglTexture),W(t.TEXTURE_2D,Le),ge(oe.__webglFramebuffer,J,Le,t.COLOR_ATTACHMENT0+le,t.TEXTURE_2D,0),m(Le)&&g(t.TEXTURE_2D)}n.unbindTexture()}else{let le=t.TEXTURE_2D;if((J.isWebGL3DRenderTarget||J.isWebGLArrayRenderTarget)&&(le=J.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(le,we.__webglTexture),W(le,H),H.mipmaps&&H.mipmaps.length>0)for(let me=0;me<H.mipmaps.length;me++)ge(oe.__webglFramebuffer[me],J,H,t.COLOR_ATTACHMENT0,le,me);else ge(oe.__webglFramebuffer,J,H,t.COLOR_ATTACHMENT0,le,0);m(H)&&g(le),n.unbindTexture()}J.depthBuffer&&De(J)}function Ve(J){const H=J.textures;for(let oe=0,we=H.length;oe<we;oe++){const Ee=H[oe];if(m(Ee)){const re=J.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,ce=r.get(Ee).__webglTexture;n.bindTexture(re,ce),g(re),n.unbindTexture()}}}const q=[],Ue=[];function O(J){if(J.samples>0){if(Ae(J)===!1){const H=J.textures,oe=J.width,we=J.height;let Ee=t.COLOR_BUFFER_BIT;const re=J.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ce=r.get(J),le=H.length>1;if(le)for(let me=0;me<H.length;me++)n.bindFramebuffer(t.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+me,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,ce.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+me,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,ce.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ce.__webglFramebuffer);for(let me=0;me<H.length;me++){if(J.resolveDepthBuffer&&(J.depthBuffer&&(Ee|=t.DEPTH_BUFFER_BIT),J.stencilBuffer&&J.resolveStencilBuffer&&(Ee|=t.STENCIL_BUFFER_BIT)),le){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,ce.__webglColorRenderbuffer[me]);const Le=r.get(H[me]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Le,0)}t.blitFramebuffer(0,0,oe,we,0,0,oe,we,Ee,t.NEAREST),l===!0&&(q.length=0,Ue.length=0,q.push(t.COLOR_ATTACHMENT0+me),J.depthBuffer&&J.resolveDepthBuffer===!1&&(q.push(re),Ue.push(re),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Ue)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,q))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),le)for(let me=0;me<H.length;me++){n.bindFramebuffer(t.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+me,t.RENDERBUFFER,ce.__webglColorRenderbuffer[me]);const Le=r.get(H[me]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,ce.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+me,t.TEXTURE_2D,Le,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ce.__webglMultisampledFramebuffer)}else if(J.depthBuffer&&J.resolveDepthBuffer===!1&&l){const H=J.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[H])}}}function ve(J){return Math.min(i.maxSamples,J.samples)}function Ae(J){const H=r.get(J);return J.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&H.__useRenderToTexture!==!1}function ae(J){const H=o.render.frame;u.get(J)!==H&&(u.set(J,H),J.update())}function Z(J,H){const oe=J.colorSpace,we=J.format,Ee=J.type;return J.isCompressedTexture===!0||J.isVideoTexture===!0||oe!==Ni&&oe!==Ju&&(Nn.getTransfer(oe)===hr?(we!==ua||Ee!==Xc)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",oe)),H}function pe(J){return typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement?(c.width=J.naturalWidth||J.width,c.height=J.naturalHeight||J.height):typeof VideoFrame<"u"&&J instanceof VideoFrame?(c.width=J.displayWidth,c.height=J.displayHeight):(c.width=J.width,c.height=J.height),c}this.allocateTextureUnit=k,this.resetTextureUnits=R,this.setTexture2D=M,this.setTexture2DArray=F,this.setTexture3D=I,this.setTextureCube=z,this.rebindTextures=ke,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=Ve,this.updateMultisampleRenderTarget=O,this.setupDepthRenderbuffer=De,this.setupFrameBufferTexture=ge,this.useMultisampledRTT=Ae}function nfe(t,e){function n(r,i=Ju){let s;const o=Nn.getTransfer(i);if(r===Xc)return t.UNSIGNED_BYTE;if(r===GP)return t.UNSIGNED_SHORT_4_4_4_4;if(r===WP)return t.UNSIGNED_SHORT_5_5_5_1;if(r===DG)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===FG)return t.BYTE;if(r===NG)return t.SHORT;if(r===$1)return t.UNSIGNED_SHORT;if(r===VP)return t.INT;if(r===Nh)return t.UNSIGNED_INT;if(r===Wa)return t.FLOAT;if(r===ev)return t.HALF_FLOAT;if(r===UG)return t.ALPHA;if(r===HG)return t.RGB;if(r===ua)return t.RGBA;if(r===jG)return t.LUMINANCE;if(r===QG)return t.LUMINANCE_ALPHA;if(r===Wp)return t.DEPTH_COMPONENT;if(r===Sm)return t.DEPTH_STENCIL;if(r===KP)return t.RED;if(r===$P)return t.RED_INTEGER;if(r===zG)return t.RG;if(r===qP)return t.RG_INTEGER;if(r===XP)return t.RGBA_INTEGER;if(r===px||r===mx||r===gx||r===yx)if(o===hr)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===px)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===mx)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===gx)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===yx)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===px)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===mx)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===gx)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===yx)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Y3||r===J3||r===Z3||r===eM)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===Y3)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===J3)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Z3)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===eM)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===tM||r===nM||r===rM)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===tM||r===nM)return o===hr?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===rM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===iM||r===sM||r===oM||r===aM||r===lM||r===cM||r===uM||r===dM||r===fM||r===hM||r===AM||r===pM||r===mM||r===gM)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===iM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===sM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===oM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===aM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===lM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===cM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===uM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===dM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===fM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===hM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===AM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===pM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===mM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===gM)return o===hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===vx||r===yM||r===vM)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===vx)return o===hr?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===yM)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===vM)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===VG||r===bM||r===wM||r===xM)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===vx)return s.COMPRESSED_RED_RGTC1_EXT;if(r===bM)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===wM)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===xM)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===_m?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class rfe extends Fn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let es=class extends Sr{constructor(){super(),this.isGroup=!0,this.type="Group"}};const ife={type:"move"};class ZE{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new es,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new es,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new de,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new de),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new es,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new de,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new de),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const p of e.hand.values()){const m=n.getJointPose(p,r),g=this._getHandJoint(c,p);m!==null&&(g.matrix.fromArray(m.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=m.radius),g.visible=m!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=u.position.distanceTo(d.position),h=.02,A=.005;c.inputState.pinching&&f>h+A?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=h-A&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ife)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new es;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const sfe=`
void main() {

	gl_Position = vec4( position, 1.0 );

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

void main() {

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

	if ( coord.x >= 1.0 ) {

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

	} else {

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

	}

}`;class afe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,r){if(this.texture===null){const i=new Oi,s=e.properties.get(i);s.__webglTexture=n.texture,(n.depthNear!=r.depthNear||n.depthFar!=r.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new Zd({vertexShader:sfe,fragmentShader:ofe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new xn(new tv(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class lfe extends iA{constructor(e,n){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,d=null,f=null,h=null,A=null;const p=new afe,m=n.getContextAttributes();let g=null,y=null;const w=[],v=[],x=new Ze;let C=null;const _=new Fn;_.layers.enable(1),_.viewport=new Jn;const S=new Fn;S.layers.enable(2),S.viewport=new Jn;const E=[_,S],T=new rfe;T.layers.enable(1),T.layers.enable(2);let R=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(fe){let ge=w[fe];return ge===void 0&&(ge=new ZE,w[fe]=ge),ge.getTargetRaySpace()},this.getControllerGrip=function(fe){let ge=w[fe];return ge===void 0&&(ge=new ZE,w[fe]=ge),ge.getGripSpace()},this.getHand=function(fe){let ge=w[fe];return ge===void 0&&(ge=new ZE,w[fe]=ge),ge.getHandSpace()};function B(fe){const ge=v.indexOf(fe.inputSource);if(ge===-1)return;const Oe=w[ge];Oe!==void 0&&(Oe.update(fe.inputSource,fe.frame,c||o),Oe.dispatchEvent({type:fe.type,data:fe.inputSource}))}function M(){i.removeEventListener("select",B),i.removeEventListener("selectstart",B),i.removeEventListener("selectend",B),i.removeEventListener("squeeze",B),i.removeEventListener("squeezestart",B),i.removeEventListener("squeezeend",B),i.removeEventListener("end",M),i.removeEventListener("inputsourceschange",F);for(let fe=0;fe<w.length;fe++){const ge=v[fe];ge!==null&&(v[fe]=null,w[fe].disconnect(ge))}R=null,k=null,p.reset(),e.setRenderTarget(g),h=null,f=null,d=null,i=null,y=null,Se.stop(),r.isPresenting=!1,e.setPixelRatio(C),e.setSize(x.width,x.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(fe){s=fe,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(fe){a=fe,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(fe){c=fe},this.getBaseLayer=function(){return f!==null?f:h},this.getBinding=function(){return d},this.getFrame=function(){return A},this.getSession=function(){return i},this.setSession=async function(fe){if(i=fe,i!==null){if(g=e.getRenderTarget(),i.addEventListener("select",B),i.addEventListener("selectstart",B),i.addEventListener("selectend",B),i.addEventListener("squeeze",B),i.addEventListener("squeezestart",B),i.addEventListener("squeezeend",B),i.addEventListener("end",M),i.addEventListener("inputsourceschange",F),m.xrCompatible!==!0&&await n.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(x),i.renderState.layers===void 0){const ge={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};h=new XRWebGLLayer(i,n,ge),i.updateRenderState({baseLayer:h}),e.setPixelRatio(1),e.setSize(h.framebufferWidth,h.framebufferHeight,!1),y=new Dh(h.framebufferWidth,h.framebufferHeight,{format:ua,type:Xc,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let ge=null,Oe=null,Fe=null;m.depth&&(Fe=m.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,ge=m.stencil?Sm:Wp,Oe=m.stencil?_m:Nh);const De={colorFormat:n.RGBA8,depthFormat:Fe,scaleFactor:s};d=new XRWebGLBinding(i,n),f=d.createProjectionLayer(De),i.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),y=new Dh(f.textureWidth,f.textureHeight,{format:ua,type:Xc,depthTexture:new iW(f.textureWidth,f.textureHeight,Oe,void 0,void 0,void 0,void 0,void 0,void 0,ge),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),Se.setContext(i),Se.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return p.getDepthTexture()};function F(fe){for(let ge=0;ge<fe.removed.length;ge++){const Oe=fe.removed[ge],Fe=v.indexOf(Oe);Fe>=0&&(v[Fe]=null,w[Fe].disconnect(Oe))}for(let ge=0;ge<fe.added.length;ge++){const Oe=fe.added[ge];let Fe=v.indexOf(Oe);if(Fe===-1){for(let ke=0;ke<w.length;ke++)if(ke>=v.length){v.push(Oe),Fe=ke;break}else if(v[ke]===null){v[ke]=Oe,Fe=ke;break}if(Fe===-1)break}const De=w[Fe];De&&De.connect(Oe)}}const I=new de,z=new de;function Y(fe,ge,Oe){I.setFromMatrixPosition(ge.matrixWorld),z.setFromMatrixPosition(Oe.matrixWorld);const Fe=I.distanceTo(z),De=ge.projectionMatrix.elements,ke=Oe.projectionMatrix.elements,Ge=De[14]/(De[10]-1),Ve=De[14]/(De[10]+1),q=(De[9]+1)/De[5],Ue=(De[9]-1)/De[5],O=(De[8]-1)/De[0],ve=(ke[8]+1)/ke[0],Ae=Ge*O,ae=Ge*ve,Z=Fe/(-O+ve),pe=Z*-O;ge.matrixWorld.decompose(fe.position,fe.quaternion,fe.scale),fe.translateX(pe),fe.translateZ(Z),fe.matrixWorld.compose(fe.position,fe.quaternion,fe.scale),fe.matrixWorldInverse.copy(fe.matrixWorld).invert();const J=Ge+Z,H=Ve+Z,oe=Ae-pe,we=ae+(Fe-pe),Ee=q*Ve/H*J,re=Ue*Ve/H*J;fe.projectionMatrix.makePerspective(oe,we,Ee,re,J,H),fe.projectionMatrixInverse.copy(fe.projectionMatrix).invert()}function $(fe,ge){ge===null?fe.matrixWorld.copy(fe.matrix):fe.matrixWorld.multiplyMatrices(ge.matrixWorld,fe.matrix),fe.matrixWorldInverse.copy(fe.matrixWorld).invert()}this.updateCamera=function(fe){if(i===null)return;p.texture!==null&&(fe.near=p.depthNear,fe.far=p.depthFar),T.near=S.near=_.near=fe.near,T.far=S.far=_.far=fe.far,(R!==T.near||k!==T.far)&&(i.updateRenderState({depthNear:T.near,depthFar:T.far}),R=T.near,k=T.far,_.near=R,_.far=k,S.near=R,S.far=k,_.updateProjectionMatrix(),S.updateProjectionMatrix(),fe.updateProjectionMatrix());const ge=fe.parent,Oe=T.cameras;$(T,ge);for(let Fe=0;Fe<Oe.length;Fe++)$(Oe[Fe],ge);Oe.length===2?Y(T,_,S):T.projectionMatrix.copy(_.projectionMatrix),ee(fe,T,ge)};function ee(fe,ge,Oe){Oe===null?fe.matrix.copy(ge.matrixWorld):(fe.matrix.copy(Oe.matrixWorld),fe.matrix.invert(),fe.matrix.multiply(ge.matrixWorld)),fe.matrix.decompose(fe.position,fe.quaternion,fe.scale),fe.updateMatrixWorld(!0),fe.projectionMatrix.copy(ge.projectionMatrix),fe.projectionMatrixInverse.copy(ge.projectionMatrixInverse),fe.isPerspectiveCamera&&(fe.fov=Em*2*Math.atan(1/fe.projectionMatrix.elements[5]),fe.zoom=1)}this.getCamera=function(){return T},this.getFoveation=function(){if(!(f===null&&h===null))return l},this.setFoveation=function(fe){l=fe,f!==null&&(f.fixedFoveation=fe),h!==null&&h.fixedFoveation!==void 0&&(h.fixedFoveation=fe)},this.hasDepthSensing=function(){return p.texture!==null},this.getDepthSensingMesh=function(){return p.getMesh(T)};let W=null;function ne(fe,ge){if(u=ge.getViewerPose(c||o),A=ge,u!==null){const Oe=u.views;h!==null&&(e.setRenderTargetFramebuffer(y,h.framebuffer),e.setRenderTarget(y));let Fe=!1;Oe.length!==T.cameras.length&&(T.cameras.length=0,Fe=!0);for(let ke=0;ke<Oe.length;ke++){const Ge=Oe[ke];let Ve=null;if(h!==null)Ve=h.getViewport(Ge);else{const Ue=d.getViewSubImage(f,Ge);Ve=Ue.viewport,ke===0&&(e.setRenderTargetTextures(y,Ue.colorTexture,f.ignoreDepthValues?void 0:Ue.depthStencilTexture),e.setRenderTarget(y))}let q=E[ke];q===void 0&&(q=new Fn,q.layers.enable(ke),q.viewport=new Jn,E[ke]=q),q.matrix.fromArray(Ge.transform.matrix),q.matrix.decompose(q.position,q.quaternion,q.scale),q.projectionMatrix.fromArray(Ge.projectionMatrix),q.projectionMatrixInverse.copy(q.projectionMatrix).invert(),q.viewport.set(Ve.x,Ve.y,Ve.width,Ve.height),ke===0&&(T.matrix.copy(q.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale)),Fe===!0&&T.cameras.push(q)}const De=i.enabledFeatures;if(De&&De.includes("depth-sensing")){const ke=d.getDepthInformation(Oe[0]);ke&&ke.isValid&&ke.texture&&p.init(e,ke,i.renderState)}}for(let Oe=0;Oe<w.length;Oe++){const Fe=v[Oe],De=w[Oe];Fe!==null&&De!==void 0&&De.update(Fe,ge,c||o)}W&&W(fe,ge),ge.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:ge}),A=null}const Se=new rW;Se.setAnimationLoop(ne),this.setAnimationLoop=function(fe){W=fe},this.dispose=function(){}}}const Df=new el,cfe=new Zt;function ufe(t,e){function n(m,g){m.matrixAutoUpdate===!0&&m.updateMatrix(),g.value.copy(m.matrix)}function r(m,g){g.color.getRGB(m.fogColor.value,eW(t)),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function i(m,g,y,w,v){g.isMeshBasicMaterial||g.isMeshLambertMaterial?s(m,g):g.isMeshToonMaterial?(s(m,g),d(m,g)):g.isMeshPhongMaterial?(s(m,g),u(m,g)):g.isMeshStandardMaterial?(s(m,g),f(m,g),g.isMeshPhysicalMaterial&&h(m,g,v)):g.isMeshMatcapMaterial?(s(m,g),A(m,g)):g.isMeshDepthMaterial?s(m,g):g.isMeshDistanceMaterial?(s(m,g),p(m,g)):g.isMeshNormalMaterial?s(m,g):g.isLineBasicMaterial?(o(m,g),g.isLineDashedMaterial&&a(m,g)):g.isPointsMaterial?l(m,g,y,w):g.isSpriteMaterial?c(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map,n(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,n(g.alphaMap,m.alphaMapTransform)),g.bumpMap&&(m.bumpMap.value=g.bumpMap,n(g.bumpMap,m.bumpMapTransform),m.bumpScale.value=g.bumpScale,g.side===Ao&&(m.bumpScale.value*=-1)),g.normalMap&&(m.normalMap.value=g.normalMap,n(g.normalMap,m.normalMapTransform),m.normalScale.value.copy(g.normalScale),g.side===Ao&&m.normalScale.value.negate()),g.displacementMap&&(m.displacementMap.value=g.displacementMap,n(g.displacementMap,m.displacementMapTransform),m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap,n(g.emissiveMap,m.emissiveMapTransform)),g.specularMap&&(m.specularMap.value=g.specularMap,n(g.specularMap,m.specularMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);const y=e.get(g),w=y.envMap,v=y.envMapRotation;w&&(m.envMap.value=w,Df.copy(v),Df.x*=-1,Df.y*=-1,Df.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Df.y*=-1,Df.z*=-1),m.envMapRotation.value.setFromMatrix4(cfe.makeRotationFromEuler(Df)),m.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap&&(m.lightMap.value=g.lightMap,m.lightMapIntensity.value=g.lightMapIntensity,n(g.lightMap,m.lightMapTransform)),g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity,n(g.aoMap,m.aoMapTransform))}function o(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,g.map&&(m.map.value=g.map,n(g.map,m.mapTransform))}function a(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function l(m,g,y,w){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*y,m.scale.value=w*.5,g.map&&(m.map.value=g.map,n(g.map,m.uvTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,n(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function c(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map,n(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,n(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function u(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function d(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function f(m,g){m.metalness.value=g.metalness,g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap,n(g.metalnessMap,m.metalnessMapTransform)),m.roughness.value=g.roughness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap,n(g.roughnessMap,m.roughnessMapTransform)),g.envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function h(m,g,y){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap,n(g.sheenColorMap,m.sheenColorMapTransform)),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap,n(g.sheenRoughnessMap,m.sheenRoughnessMapTransform))),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap,n(g.clearcoatMap,m.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,n(g.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(m.clearcoatNormalMap.value=g.clearcoatNormalMap,n(g.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Ao&&m.clearcoatNormalScale.value.negate())),g.dispersion>0&&(m.dispersion.value=g.dispersion),g.iridescence>0&&(m.iridescence.value=g.iridescence,m.iridescenceIOR.value=g.iridescenceIOR,m.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(m.iridescenceMap.value=g.iridescenceMap,n(g.iridescenceMap,m.iridescenceMapTransform)),g.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=g.iridescenceThicknessMap,n(g.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap,n(g.transmissionMap,m.transmissionMapTransform)),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap,n(g.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(m.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(m.anisotropyMap.value=g.anisotropyMap,n(g.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap,n(g.specularColorMap,m.specularColorMapTransform)),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap,n(g.specularIntensityMap,m.specularIntensityMapTransform))}function A(m,g){g.matcap&&(m.matcap.value=g.matcap)}function p(m,g){const y=e.get(g).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function dfe(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,w){const v=w.program;r.uniformBlockBinding(y,v)}function c(y,w){let v=i[y.id];v===void 0&&(A(y),v=u(y),i[y.id]=v,y.addEventListener("dispose",m));const x=w.program;r.updateUBOMapping(y,x);const C=e.render.frame;s[y.id]!==C&&(f(y),s[y.id]=C)}function u(y){const w=d();y.__bindingPointIndex=w;const v=t.createBuffer(),x=y.__size,C=y.usage;return t.bindBuffer(t.UNIFORM_BUFFER,v),t.bufferData(t.UNIFORM_BUFFER,x,C),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,w,v),v}function d(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(y){const w=i[y.id],v=y.uniforms,x=y.__cache;t.bindBuffer(t.UNIFORM_BUFFER,w);for(let C=0,_=v.length;C<_;C++){const S=Array.isArray(v[C])?v[C]:[v[C]];for(let E=0,T=S.length;E<T;E++){const R=S[E];if(h(R,C,E,x)===!0){const k=R.__offset,B=Array.isArray(R.value)?R.value:[R.value];let M=0;for(let F=0;F<B.length;F++){const I=B[F],z=p(I);typeof I=="number"||typeof I=="boolean"?(R.__data[0]=I,t.bufferSubData(t.UNIFORM_BUFFER,k+M,R.__data)):I.isMatrix3?(R.__data[0]=I.elements[0],R.__data[1]=I.elements[1],R.__data[2]=I.elements[2],R.__data[3]=0,R.__data[4]=I.elements[3],R.__data[5]=I.elements[4],R.__data[6]=I.elements[5],R.__data[7]=0,R.__data[8]=I.elements[6],R.__data[9]=I.elements[7],R.__data[10]=I.elements[8],R.__data[11]=0):(I.toArray(R.__data,M),M+=z.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,k,R.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function h(y,w,v,x){const C=y.value,_=w+"_"+v;if(x[_]===void 0)return typeof C=="number"||typeof C=="boolean"?x[_]=C:x[_]=C.clone(),!0;{const S=x[_];if(typeof C=="number"||typeof C=="boolean"){if(S!==C)return x[_]=C,!0}else if(S.equals(C)===!1)return S.copy(C),!0}return!1}function A(y){const w=y.uniforms;let v=0;const x=16;for(let _=0,S=w.length;_<S;_++){const E=Array.isArray(w[_])?w[_]:[w[_]];for(let T=0,R=E.length;T<R;T++){const k=E[T],B=Array.isArray(k.value)?k.value:[k.value];for(let M=0,F=B.length;M<F;M++){const I=B[M],z=p(I),Y=v%x;Y!==0&&x-Y<z.boundary&&(v+=x-Y),k.__data=new Float32Array(z.storage/Float32Array.BYTES_PER_ELEMENT),k.__offset=v,v+=z.storage}}}const C=v%x;return C>0&&(v+=x-C),y.__size=v,y.__cache={},this}function p(y){const w={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(w.boundary=4,w.storage=4):y.isVector2?(w.boundary=8,w.storage=8):y.isVector3||y.isColor?(w.boundary=16,w.storage=12):y.isVector4?(w.boundary=16,w.storage=16):y.isMatrix3?(w.boundary=48,w.storage=48):y.isMatrix4?(w.boundary=64,w.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),w}function m(y){const w=y.target;w.removeEventListener("dispose",m);const v=o.indexOf(w.__bindingPointIndex);o.splice(v,1),t.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function g(){for(const y in i)t.deleteBuffer(i[y]);o=[],i={},s={}}return{bind:l,update:c,dispose:g}}class rL{constructor(e={}){const{canvas:n=rae(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let f;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=r.getContextAttributes().alpha}else f=o;const h=new Uint32Array(4),A=new Int32Array(4);let p=null,m=null;const g=[],y=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ki,this.toneMapping=Pd,this.toneMappingExposure=1;const w=this;let v=!1,x=0,C=0,_=null,S=-1,E=null;const T=new Jn,R=new Jn;let k=null;const B=new Nt(0);let M=0,F=n.width,I=n.height,z=1,Y=null,$=null;const ee=new Jn(0,0,F,I),W=new Jn(0,0,F,I);let ne=!1;const Se=new tL;let fe=!1,ge=!1;const Oe=new Zt,Fe=new de,De=new Jn,ke={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ge=!1;function Ve(){return _===null?z:1}let q=r;function Ue(L,Q){return n.getContext(L,Q)}try{const L={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${zP}`),n.addEventListener("webglcontextlost",Re,!1),n.addEventListener("webglcontextrestored",Me,!1),n.addEventListener("webglcontextcreationerror",We,!1),q===null){const Q="webgl2";if(q=Ue(Q,L),q===null)throw Ue(Q)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(L){throw console.error("THREE.WebGLRenderer: "+L.message),L}let O,ve,Ae,ae,Z,pe,J,H,oe,we,Ee,re,ce,le,me,Le,Te,Pe,Qe,$e,et,st,dt,Mt;function K(){O=new vue(q),O.init(),st=new nfe(q,O),ve=new hue(q,O,e,st),Ae=new Zde(q),ae=new xue(q),Z=new Ude,pe=new tfe(q,O,Ae,Z,ve,st,ae),J=new pue(w),H=new yue(w),oe=new Mae(q),dt=new due(q,oe),we=new bue(q,oe,ae,dt),Ee=new _ue(q,we,oe,ae),Qe=new Cue(q,ve,pe),Le=new Aue(Z),re=new Dde(w,J,H,O,ve,dt,Le),ce=new ufe(w,Z),le=new jde,me=new Kde(O),Pe=new uue(w,J,H,Ae,Ee,f,l),Te=new Jde(w,Ee,ve),Mt=new dfe(q,ae,ve,Ae),$e=new fue(q,O,ae),et=new wue(q,O,ae),ae.programs=re.programs,w.capabilities=ve,w.extensions=O,w.properties=Z,w.renderLists=le,w.shadowMap=Te,w.state=Ae,w.info=ae}K();const Be=new lfe(w,q);this.xr=Be,this.getContext=function(){return q},this.getContextAttributes=function(){return q.getContextAttributes()},this.forceContextLoss=function(){const L=O.get("WEBGL_lose_context");L&&L.loseContext()},this.forceContextRestore=function(){const L=O.get("WEBGL_lose_context");L&&L.restoreContext()},this.getPixelRatio=function(){return z},this.setPixelRatio=function(L){L!==void 0&&(z=L,this.setSize(F,I,!1))},this.getSize=function(L){return L.set(F,I)},this.setSize=function(L,Q,te=!0){if(Be.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}F=L,I=Q,n.width=Math.floor(L*z),n.height=Math.floor(Q*z),te===!0&&(n.style.width=L+"px",n.style.height=Q+"px"),this.setViewport(0,0,L,Q)},this.getDrawingBufferSize=function(L){return L.set(F*z,I*z).floor()},this.setDrawingBufferSize=function(L,Q,te){F=L,I=Q,z=te,n.width=Math.floor(L*te),n.height=Math.floor(Q*te),this.setViewport(0,0,L,Q)},this.getCurrentViewport=function(L){return L.copy(T)},this.getViewport=function(L){return L.copy(ee)},this.setViewport=function(L,Q,te,X){L.isVector4?ee.set(L.x,L.y,L.z,L.w):ee.set(L,Q,te,X),Ae.viewport(T.copy(ee).multiplyScalar(z).round())},this.getScissor=function(L){return L.copy(W)},this.setScissor=function(L,Q,te,X){L.isVector4?W.set(L.x,L.y,L.z,L.w):W.set(L,Q,te,X),Ae.scissor(R.copy(W).multiplyScalar(z).round())},this.getScissorTest=function(){return ne},this.setScissorTest=function(L){Ae.setScissorTest(ne=L)},this.setOpaqueSort=function(L){Y=L},this.setTransparentSort=function(L){$=L},this.getClearColor=function(L){return L.copy(Pe.getClearColor())},this.setClearColor=function(){Pe.setClearColor.apply(Pe,arguments)},this.getClearAlpha=function(){return Pe.getClearAlpha()},this.setClearAlpha=function(){Pe.setClearAlpha.apply(Pe,arguments)},this.clear=function(L=!0,Q=!0,te=!0){let X=0;if(L){let V=!1;if(_!==null){const he=_.texture.format;V=he===XP||he===qP||he===$P}if(V){const he=_.texture.type,_e=he===Xc||he===Nh||he===$1||he===_m||he===GP||he===WP,He=Pe.getClearColor(),ze=Pe.getClearAlpha(),lt=He.r,rt=He.g,ct=He.b;_e?(h[0]=lt,h[1]=rt,h[2]=ct,h[3]=ze,q.clearBufferuiv(q.COLOR,0,h)):(A[0]=lt,A[1]=rt,A[2]=ct,A[3]=ze,q.clearBufferiv(q.COLOR,0,A))}else X|=q.COLOR_BUFFER_BIT}Q&&(X|=q.DEPTH_BUFFER_BIT),te&&(X|=q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),q.clear(X)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Re,!1),n.removeEventListener("webglcontextrestored",Me,!1),n.removeEventListener("webglcontextcreationerror",We,!1),le.dispose(),me.dispose(),Z.dispose(),J.dispose(),H.dispose(),Ee.dispose(),dt.dispose(),Mt.dispose(),re.dispose(),Be.dispose(),Be.removeEventListener("sessionstart",zt),Be.removeEventListener("sessionend",tr),wn.stop()};function Re(L){L.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function Me(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const L=ae.autoReset,Q=Te.enabled,te=Te.autoUpdate,X=Te.needsUpdate,V=Te.type;K(),ae.autoReset=L,Te.enabled=Q,Te.autoUpdate=te,Te.needsUpdate=X,Te.type=V}function We(L){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",L.statusMessage)}function Je(L){const Q=L.target;Q.removeEventListener("dispose",Je),ht(Q)}function ht(L){Gt(L),Z.remove(L)}function Gt(L){const Q=Z.get(L).programs;Q!==void 0&&(Q.forEach(function(te){re.releaseProgram(te)}),L.isShaderMaterial&&re.releaseShaderCache(L))}this.renderBufferDirect=function(L,Q,te,X,V,he){Q===null&&(Q=ke);const _e=V.isMesh&&V.matrixWorld.determinant()<0,He=j(L,Q,te,X,V);Ae.setMaterial(X,_e);let ze=te.index,lt=1;if(X.wireframe===!0){if(ze=we.getWireframeAttribute(te),ze===void 0)return;lt=2}const rt=te.drawRange,ct=te.attributes.position;let kt=rt.start*lt,yt=(rt.start+rt.count)*lt;he!==null&&(kt=Math.max(kt,he.start*lt),yt=Math.min(yt,(he.start+he.count)*lt)),ze!==null?(kt=Math.max(kt,0),yt=Math.min(yt,ze.count)):ct!=null&&(kt=Math.max(kt,0),yt=Math.min(yt,ct.count));const Ut=yt-kt;if(Ut<0||Ut===1/0)return;dt.setup(V,X,He,te,ze);let Pn,Xt=$e;if(ze!==null&&(Pn=oe.get(ze),Xt=et,Xt.setIndex(Pn)),V.isMesh)X.wireframe===!0?(Ae.setLineWidth(X.wireframeLinewidth*Ve()),Xt.setMode(q.LINES)):Xt.setMode(q.TRIANGLES);else if(V.isLine){let Et=X.linewidth;Et===void 0&&(Et=1),Ae.setLineWidth(Et*Ve()),V.isLineSegments?Xt.setMode(q.LINES):V.isLineLoop?Xt.setMode(q.LINE_LOOP):Xt.setMode(q.LINE_STRIP)}else V.isPoints?Xt.setMode(q.POINTS):V.isSprite&&Xt.setMode(q.TRIANGLES);if(V.isBatchedMesh)if(V._multiDrawInstances!==null)Xt.renderMultiDrawInstances(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount,V._multiDrawInstances);else if(O.get("WEBGL_multi_draw"))Xt.renderMultiDraw(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount);else{const Et=V._multiDrawStarts,xt=V._multiDrawCounts,Rt=V._multiDrawCount,Ln=ze?oe.get(ze).bytesPerElement:1,Wt=Z.get(X).currentProgram.getUniforms();for(let jn=0;jn<Rt;jn++)Wt.setValue(q,"_gl_DrawID",jn),Xt.render(Et[jn]/Ln,xt[jn])}else if(V.isInstancedMesh)Xt.renderInstances(kt,Ut,V.count);else if(te.isInstancedBufferGeometry){const Et=te._maxInstanceCount!==void 0?te._maxInstanceCount:1/0,xt=Math.min(te.instanceCount,Et);Xt.renderInstances(kt,Ut,xt)}else Xt.render(kt,Ut)};function tn(L,Q,te){L.transparent===!0&&L.side===ja&&L.forceSinglePass===!1?(L.side=Ao,L.needsUpdate=!0,Ce(L,Q,te),L.side=qc,L.needsUpdate=!0,Ce(L,Q,te),L.side=ja):Ce(L,Q,te)}this.compile=function(L,Q,te=null){te===null&&(te=L),m=me.get(te),m.init(Q),y.push(m),te.traverseVisible(function(V){V.isLight&&V.layers.test(Q.layers)&&(m.pushLight(V),V.castShadow&&m.pushShadow(V))}),L!==te&&L.traverseVisible(function(V){V.isLight&&V.layers.test(Q.layers)&&(m.pushLight(V),V.castShadow&&m.pushShadow(V))}),m.setupLights();const X=new Set;return L.traverse(function(V){const he=V.material;if(he)if(Array.isArray(he))for(let _e=0;_e<he.length;_e++){const He=he[_e];tn(He,te,V),X.add(He)}else tn(he,te,V),X.add(he)}),y.pop(),m=null,X},this.compileAsync=function(L,Q,te=null){const X=this.compile(L,Q,te);return new Promise(V=>{function he(){if(X.forEach(function(_e){Z.get(_e).currentProgram.isReady()&&X.delete(_e)}),X.size===0){V(L);return}setTimeout(he,10)}O.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let Ft=null;function Dt(L){Ft&&Ft(L)}function zt(){wn.stop()}function tr(){wn.start()}const wn=new rW;wn.setAnimationLoop(Dt),typeof self<"u"&&wn.setContext(self),this.setAnimationLoop=function(L){Ft=L,Be.setAnimationLoop(L),L===null?wn.stop():wn.start()},Be.addEventListener("sessionstart",zt),Be.addEventListener("sessionend",tr),this.render=function(L,Q){if(Q!==void 0&&Q.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;if(L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),Q.parent===null&&Q.matrixWorldAutoUpdate===!0&&Q.updateMatrixWorld(),Be.enabled===!0&&Be.isPresenting===!0&&(Be.cameraAutoUpdate===!0&&Be.updateCamera(Q),Q=Be.getCamera()),L.isScene===!0&&L.onBeforeRender(w,L,Q,_),m=me.get(L,y.length),m.init(Q),y.push(m),Oe.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),Se.setFromProjectionMatrix(Oe),ge=this.localClippingEnabled,fe=Le.init(this.clippingPlanes,ge),p=le.get(L,g.length),p.init(),g.push(p),Be.enabled===!0&&Be.isPresenting===!0){const he=w.xr.getDepthSensingMesh();he!==null&&Vn(he,Q,-1/0,w.sortObjects)}Vn(L,Q,0,w.sortObjects),p.finish(),w.sortObjects===!0&&p.sort(Y,$),Ge=Be.enabled===!1||Be.isPresenting===!1||Be.hasDepthSensing()===!1,Ge&&Pe.addToRenderList(p,L),this.info.render.frame++,fe===!0&&Le.beginShadows();const te=m.state.shadowsArray;Te.render(te,L,Q),fe===!0&&Le.endShadows(),this.info.autoReset===!0&&this.info.reset();const X=p.opaque,V=p.transmissive;if(m.setupLights(),Q.isArrayCamera){const he=Q.cameras;if(V.length>0)for(let _e=0,He=he.length;_e<He;_e++){const ze=he[_e];ue(X,V,L,ze)}Ge&&Pe.render(L);for(let _e=0,He=he.length;_e<He;_e++){const ze=he[_e];kr(p,L,ze,ze.viewport)}}else V.length>0&&ue(X,V,L,Q),Ge&&Pe.render(L),kr(p,L,Q);_!==null&&(pe.updateMultisampleRenderTarget(_),pe.updateRenderTargetMipmap(_)),L.isScene===!0&&L.onAfterRender(w,L,Q),dt.resetDefaultState(),S=-1,E=null,y.pop(),y.length>0?(m=y[y.length-1],fe===!0&&Le.setGlobalState(w.clippingPlanes,m.state.camera)):m=null,g.pop(),g.length>0?p=g[g.length-1]:p=null};function Vn(L,Q,te,X){if(L.visible===!1)return;if(L.layers.test(Q.layers)){if(L.isGroup)te=L.renderOrder;else if(L.isLOD)L.autoUpdate===!0&&L.update(Q);else if(L.isLight)m.pushLight(L),L.castShadow&&m.pushShadow(L);else if(L.isSprite){if(!L.frustumCulled||Se.intersectsSprite(L)){X&&De.setFromMatrixPosition(L.matrixWorld).applyMatrix4(Oe);const _e=Ee.update(L),He=L.material;He.visible&&p.push(L,_e,He,te,De.z,null)}}else if((L.isMesh||L.isLine||L.isPoints)&&(!L.frustumCulled||Se.intersectsObject(L))){const _e=Ee.update(L),He=L.material;if(X&&(L.boundingSphere!==void 0?(L.boundingSphere===null&&L.computeBoundingSphere(),De.copy(L.boundingSphere.center)):(_e.boundingSphere===null&&_e.computeBoundingSphere(),De.copy(_e.boundingSphere.center)),De.applyMatrix4(L.matrixWorld).applyMatrix4(Oe)),Array.isArray(He)){const ze=_e.groups;for(let lt=0,rt=ze.length;lt<rt;lt++){const ct=ze[lt],kt=He[ct.materialIndex];kt&&kt.visible&&p.push(L,_e,kt,te,De.z,ct)}}else He.visible&&p.push(L,_e,He,te,De.z,null)}}const he=L.children;for(let _e=0,He=he.length;_e<He;_e++)Vn(he[_e],Q,te,X)}function kr(L,Q,te,X){const V=L.opaque,he=L.transmissive,_e=L.transparent;m.setupLightsView(te),fe===!0&&Le.setGlobalState(w.clippingPlanes,te),X&&Ae.viewport(T.copy(X)),V.length>0&&ye(V,Q,te),he.length>0&&ye(he,Q,te),_e.length>0&&ye(_e,Q,te),Ae.buffers.depth.setTest(!0),Ae.buffers.depth.setMask(!0),Ae.buffers.color.setMask(!0),Ae.setPolygonOffset(!1)}function ue(L,Q,te,X){if((te.isScene===!0?te.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[X.id]===void 0&&(m.state.transmissionRenderTarget[X.id]=new Dh(1,1,{generateMipmaps:!0,type:O.has("EXT_color_buffer_half_float")||O.has("EXT_color_buffer_float")?ev:Xc,minFilter:Oc,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Nn.workingColorSpace}));const he=m.state.transmissionRenderTarget[X.id],_e=X.viewport||T;he.setSize(_e.z,_e.w);const He=w.getRenderTarget();w.setRenderTarget(he),w.getClearColor(B),M=w.getClearAlpha(),M<1&&w.setClearColor(16777215,.5),Ge?Pe.render(te):w.clear();const ze=w.toneMapping;w.toneMapping=Pd;const lt=X.viewport;if(X.viewport!==void 0&&(X.viewport=void 0),m.setupLightsView(X),fe===!0&&Le.setGlobalState(w.clippingPlanes,X),ye(L,te,X),pe.updateMultisampleRenderTarget(he),pe.updateRenderTargetMipmap(he),O.has("WEBGL_multisampled_render_to_texture")===!1){let rt=!1;for(let ct=0,kt=Q.length;ct<kt;ct++){const yt=Q[ct],Ut=yt.object,Pn=yt.geometry,Xt=yt.material,Et=yt.group;if(Xt.side===ja&&Ut.layers.test(X.layers)){const xt=Xt.side;Xt.side=Ao,Xt.needsUpdate=!0,xe(Ut,te,X,Pn,Xt,Et),Xt.side=xt,Xt.needsUpdate=!0,rt=!0}}rt===!0&&(pe.updateMultisampleRenderTarget(he),pe.updateRenderTargetMipmap(he))}w.setRenderTarget(He),w.setClearColor(B,M),lt!==void 0&&(X.viewport=lt),w.toneMapping=ze}function ye(L,Q,te){const X=Q.isScene===!0?Q.overrideMaterial:null;for(let V=0,he=L.length;V<he;V++){const _e=L[V],He=_e.object,ze=_e.geometry,lt=X===null?_e.material:X,rt=_e.group;He.layers.test(te.layers)&&xe(He,Q,te,ze,lt,rt)}}function xe(L,Q,te,X,V,he){L.onBeforeRender(w,Q,te,X,V,he),L.modelViewMatrix.multiplyMatrices(te.matrixWorldInverse,L.matrixWorld),L.normalMatrix.getNormalMatrix(L.modelViewMatrix),V.transparent===!0&&V.side===ja&&V.forceSinglePass===!1?(V.side=Ao,V.needsUpdate=!0,w.renderBufferDirect(te,Q,X,V,L,he),V.side=qc,V.needsUpdate=!0,w.renderBufferDirect(te,Q,X,V,L,he),V.side=ja):w.renderBufferDirect(te,Q,X,V,L,he),L.onAfterRender(w,Q,te,X,V,he)}function Ce(L,Q,te){Q.isScene!==!0&&(Q=ke);const X=Z.get(L),V=m.state.lights,he=m.state.shadowsArray,_e=V.state.version,He=re.getParameters(L,V.state,he,Q,te),ze=re.getProgramCacheKey(He);let lt=X.programs;X.environment=L.isMeshStandardMaterial?Q.environment:null,X.fog=Q.fog,X.envMap=(L.isMeshStandardMaterial?H:J).get(L.envMap||X.environment),X.envMapRotation=X.environment!==null&&L.envMap===null?Q.environmentRotation:L.envMapRotation,lt===void 0&&(L.addEventListener("dispose",Je),lt=new Map,X.programs=lt);let rt=lt.get(ze);if(rt!==void 0){if(X.currentProgram===rt&&X.lightsStateVersion===_e)return D(L,He),rt}else He.uniforms=re.getUniforms(L),L.onBeforeCompile(He,w),rt=re.acquireProgram(He,ze),lt.set(ze,rt),X.uniforms=He.uniforms;const ct=X.uniforms;return(!L.isShaderMaterial&&!L.isRawShaderMaterial||L.clipping===!0)&&(ct.clippingPlanes=Le.uniform),D(L,He),X.needsLights=G(L),X.lightsStateVersion=_e,X.needsLights&&(ct.ambientLightColor.value=V.state.ambient,ct.lightProbe.value=V.state.probe,ct.directionalLights.value=V.state.directional,ct.directionalLightShadows.value=V.state.directionalShadow,ct.spotLights.value=V.state.spot,ct.spotLightShadows.value=V.state.spotShadow,ct.rectAreaLights.value=V.state.rectArea,ct.ltc_1.value=V.state.rectAreaLTC1,ct.ltc_2.value=V.state.rectAreaLTC2,ct.pointLights.value=V.state.point,ct.pointLightShadows.value=V.state.pointShadow,ct.hemisphereLights.value=V.state.hemi,ct.directionalShadowMap.value=V.state.directionalShadowMap,ct.directionalShadowMatrix.value=V.state.directionalShadowMatrix,ct.spotShadowMap.value=V.state.spotShadowMap,ct.spotLightMatrix.value=V.state.spotLightMatrix,ct.spotLightMap.value=V.state.spotLightMap,ct.pointShadowMap.value=V.state.pointShadowMap,ct.pointShadowMatrix.value=V.state.pointShadowMatrix),X.currentProgram=rt,X.uniformsList=null,rt}function N(L){if(L.uniformsList===null){const Q=L.currentProgram.getUniforms();L.uniformsList=bx.seqWithValue(Q.seq,L.uniforms)}return L.uniformsList}function D(L,Q){const te=Z.get(L);te.outputColorSpace=Q.outputColorSpace,te.batching=Q.batching,te.batchingColor=Q.batchingColor,te.instancing=Q.instancing,te.instancingColor=Q.instancingColor,te.instancingMorph=Q.instancingMorph,te.skinning=Q.skinning,te.morphTargets=Q.morphTargets,te.morphNormals=Q.morphNormals,te.morphColors=Q.morphColors,te.morphTargetsCount=Q.morphTargetsCount,te.numClippingPlanes=Q.numClippingPlanes,te.numIntersection=Q.numClipIntersection,te.vertexAlphas=Q.vertexAlphas,te.vertexTangents=Q.vertexTangents,te.toneMapping=Q.toneMapping}function j(L,Q,te,X,V){Q.isScene!==!0&&(Q=ke),pe.resetTextureUnits();const he=Q.fog,_e=X.isMeshStandardMaterial?Q.environment:null,He=_===null?w.outputColorSpace:_.isXRRenderTarget===!0?_.texture.colorSpace:Ni,ze=(X.isMeshStandardMaterial?H:J).get(X.envMap||_e),lt=X.vertexColors===!0&&!!te.attributes.color&&te.attributes.color.itemSize===4,rt=!!te.attributes.tangent&&(!!X.normalMap||X.anisotropy>0),ct=!!te.morphAttributes.position,kt=!!te.morphAttributes.normal,yt=!!te.morphAttributes.color;let Ut=Pd;X.toneMapped&&(_===null||_.isXRRenderTarget===!0)&&(Ut=w.toneMapping);const Pn=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,Xt=Pn!==void 0?Pn.length:0,Et=Z.get(X),xt=m.state.lights;if(fe===!0&&(ge===!0||L!==E)){const cs=L===E&&X.id===S;Le.setState(X,L,cs)}let Rt=!1;X.version===Et.__version?(Et.needsLights&&Et.lightsStateVersion!==xt.state.version||Et.outputColorSpace!==He||V.isBatchedMesh&&Et.batching===!1||!V.isBatchedMesh&&Et.batching===!0||V.isBatchedMesh&&Et.batchingColor===!0&&V.colorTexture===null||V.isBatchedMesh&&Et.batchingColor===!1&&V.colorTexture!==null||V.isInstancedMesh&&Et.instancing===!1||!V.isInstancedMesh&&Et.instancing===!0||V.isSkinnedMesh&&Et.skinning===!1||!V.isSkinnedMesh&&Et.skinning===!0||V.isInstancedMesh&&Et.instancingColor===!0&&V.instanceColor===null||V.isInstancedMesh&&Et.instancingColor===!1&&V.instanceColor!==null||V.isInstancedMesh&&Et.instancingMorph===!0&&V.morphTexture===null||V.isInstancedMesh&&Et.instancingMorph===!1&&V.morphTexture!==null||Et.envMap!==ze||X.fog===!0&&Et.fog!==he||Et.numClippingPlanes!==void 0&&(Et.numClippingPlanes!==Le.numPlanes||Et.numIntersection!==Le.numIntersection)||Et.vertexAlphas!==lt||Et.vertexTangents!==rt||Et.morphTargets!==ct||Et.morphNormals!==kt||Et.morphColors!==yt||Et.toneMapping!==Ut||Et.morphTargetsCount!==Xt)&&(Rt=!0):(Rt=!0,Et.__version=X.version);let Ln=Et.currentProgram;Rt===!0&&(Ln=Ce(X,Q,V));let Wt=!1,jn=!1,qo=!1;const Gn=Ln.getUniforms(),Ma=Et.uniforms;if(Ae.useProgram(Ln.program)&&(Wt=!0,jn=!0,qo=!0),X.id!==S&&(S=X.id,jn=!0),Wt||E!==L){Gn.setValue(q,"projectionMatrix",L.projectionMatrix),Gn.setValue(q,"viewMatrix",L.matrixWorldInverse);const cs=Gn.map.cameraPosition;cs!==void 0&&cs.setValue(q,Fe.setFromMatrixPosition(L.matrixWorld)),ve.logarithmicDepthBuffer&&Gn.setValue(q,"logDepthBufFC",2/(Math.log(L.far+1)/Math.LN2)),(X.isMeshPhongMaterial||X.isMeshToonMaterial||X.isMeshLambertMaterial||X.isMeshBasicMaterial||X.isMeshStandardMaterial||X.isShaderMaterial)&&Gn.setValue(q,"isOrthographic",L.isOrthographicCamera===!0),E!==L&&(E=L,jn=!0,qo=!0)}if(V.isSkinnedMesh){Gn.setOptional(q,V,"bindMatrix"),Gn.setOptional(q,V,"bindMatrixInverse");const cs=V.skeleton;cs&&(cs.boneTexture===null&&cs.computeBoneTexture(),Gn.setValue(q,"boneTexture",cs.boneTexture,pe))}V.isBatchedMesh&&(Gn.setOptional(q,V,"batchingTexture"),Gn.setValue(q,"batchingTexture",V._matricesTexture,pe),Gn.setOptional(q,V,"batchingIdTexture"),Gn.setValue(q,"batchingIdTexture",V._indirectTexture,pe),Gn.setOptional(q,V,"batchingColorTexture"),V._colorsTexture!==null&&Gn.setValue(q,"batchingColorTexture",V._colorsTexture,pe));const xu=te.morphAttributes;if((xu.position!==void 0||xu.normal!==void 0||xu.color!==void 0)&&Qe.update(V,te,Ln),(jn||Et.receiveShadow!==V.receiveShadow)&&(Et.receiveShadow=V.receiveShadow,Gn.setValue(q,"receiveShadow",V.receiveShadow)),X.isMeshGouraudMaterial&&X.envMap!==null&&(Ma.envMap.value=ze,Ma.flipEnvMap.value=ze.isCubeTexture&&ze.isRenderTargetTexture===!1?-1:1),X.isMeshStandardMaterial&&X.envMap===null&&Q.environment!==null&&(Ma.envMapIntensity.value=Q.environmentIntensity),jn&&(Gn.setValue(q,"toneMappingExposure",w.toneMappingExposure),Et.needsLights&&U(Ma,qo),he&&X.fog===!0&&ce.refreshFogUniforms(Ma,he),ce.refreshMaterialUniforms(Ma,X,z,I,m.state.transmissionRenderTarget[L.id]),bx.upload(q,N(Et),Ma,pe)),X.isShaderMaterial&&X.uniformsNeedUpdate===!0&&(bx.upload(q,N(Et),Ma,pe),X.uniformsNeedUpdate=!1),X.isSpriteMaterial&&Gn.setValue(q,"center",V.center),Gn.setValue(q,"modelViewMatrix",V.modelViewMatrix),Gn.setValue(q,"normalMatrix",V.normalMatrix),Gn.setValue(q,"modelMatrix",V.matrixWorld),X.isShaderMaterial||X.isRawShaderMaterial){const cs=X.uniformsGroups;for(let Pf=0,Dg=cs.length;Pf<Dg;Pf++){const gA=cs[Pf];Mt.update(gA,Ln),Mt.bind(gA,Ln)}}return Ln}function U(L,Q){L.ambientLightColor.needsUpdate=Q,L.lightProbe.needsUpdate=Q,L.directionalLights.needsUpdate=Q,L.directionalLightShadows.needsUpdate=Q,L.pointLights.needsUpdate=Q,L.pointLightShadows.needsUpdate=Q,L.spotLights.needsUpdate=Q,L.spotLightShadows.needsUpdate=Q,L.rectAreaLights.needsUpdate=Q,L.hemisphereLights.needsUpdate=Q}function G(L){return L.isMeshLambertMaterial||L.isMeshToonMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isShadowMaterial||L.isShaderMaterial&&L.lights===!0}this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(L,Q,te){Z.get(L.texture).__webglTexture=Q,Z.get(L.depthTexture).__webglTexture=te;const X=Z.get(L);X.__hasExternalTextures=!0,X.__autoAllocateDepthBuffer=te===void 0,X.__autoAllocateDepthBuffer||O.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),X.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(L,Q){const te=Z.get(L);te.__webglFramebuffer=Q,te.__useDefaultFramebuffer=Q===void 0},this.setRenderTarget=function(L,Q=0,te=0){_=L,x=Q,C=te;let X=!0,V=null,he=!1,_e=!1;if(L){const ze=Z.get(L);ze.__useDefaultFramebuffer!==void 0?(Ae.bindFramebuffer(q.FRAMEBUFFER,null),X=!1):ze.__webglFramebuffer===void 0?pe.setupRenderTarget(L):ze.__hasExternalTextures&&pe.rebindTextures(L,Z.get(L.texture).__webglTexture,Z.get(L.depthTexture).__webglTexture);const lt=L.texture;(lt.isData3DTexture||lt.isDataArrayTexture||lt.isCompressedArrayTexture)&&(_e=!0);const rt=Z.get(L).__webglFramebuffer;L.isWebGLCubeRenderTarget?(Array.isArray(rt[Q])?V=rt[Q][te]:V=rt[Q],he=!0):L.samples>0&&pe.useMultisampledRTT(L)===!1?V=Z.get(L).__webglMultisampledFramebuffer:Array.isArray(rt)?V=rt[te]:V=rt,T.copy(L.viewport),R.copy(L.scissor),k=L.scissorTest}else T.copy(ee).multiplyScalar(z).floor(),R.copy(W).multiplyScalar(z).floor(),k=ne;if(Ae.bindFramebuffer(q.FRAMEBUFFER,V)&&X&&Ae.drawBuffers(L,V),Ae.viewport(T),Ae.scissor(R),Ae.setScissorTest(k),he){const ze=Z.get(L.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+Q,ze.__webglTexture,te)}else if(_e){const ze=Z.get(L.texture),lt=Q||0;q.framebufferTextureLayer(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,ze.__webglTexture,te||0,lt)}S=-1},this.readRenderTargetPixels=function(L,Q,te,X,V,he,_e){if(!(L&&L.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let He=Z.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&_e!==void 0&&(He=He[_e]),He){Ae.bindFramebuffer(q.FRAMEBUFFER,He);try{const ze=L.texture,lt=ze.format,rt=ze.type;if(!ve.textureFormatReadable(lt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ve.textureTypeReadable(rt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Q>=0&&Q<=L.width-X&&te>=0&&te<=L.height-V&&q.readPixels(Q,te,X,V,st.convert(lt),st.convert(rt),he)}finally{const ze=_!==null?Z.get(_).__webglFramebuffer:null;Ae.bindFramebuffer(q.FRAMEBUFFER,ze)}}},this.readRenderTargetPixelsAsync=async function(L,Q,te,X,V,he,_e){if(!(L&&L.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let He=Z.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&_e!==void 0&&(He=He[_e]),He){Ae.bindFramebuffer(q.FRAMEBUFFER,He);try{const ze=L.texture,lt=ze.format,rt=ze.type;if(!ve.textureFormatReadable(lt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ve.textureTypeReadable(rt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(Q>=0&&Q<=L.width-X&&te>=0&&te<=L.height-V){const ct=q.createBuffer();q.bindBuffer(q.PIXEL_PACK_BUFFER,ct),q.bufferData(q.PIXEL_PACK_BUFFER,he.byteLength,q.STREAM_READ),q.readPixels(Q,te,X,V,st.convert(lt),st.convert(rt),0),q.flush();const kt=q.fenceSync(q.SYNC_GPU_COMMANDS_COMPLETE,0);await iae(q,kt,4);try{q.bindBuffer(q.PIXEL_PACK_BUFFER,ct),q.getBufferSubData(q.PIXEL_PACK_BUFFER,0,he)}finally{q.deleteBuffer(ct),q.deleteSync(kt)}return he}}finally{const ze=_!==null?Z.get(_).__webglFramebuffer:null;Ae.bindFramebuffer(q.FRAMEBUFFER,ze)}}},this.copyFramebufferToTexture=function(L,Q=null,te=0){L.isTexture!==!0&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),Q=arguments[0]||null,L=arguments[1]);const X=Math.pow(2,-te),V=Math.floor(L.image.width*X),he=Math.floor(L.image.height*X),_e=Q!==null?Q.x:0,He=Q!==null?Q.y:0;pe.setTexture2D(L,0),q.copyTexSubImage2D(q.TEXTURE_2D,te,0,0,_e,He,V,he),Ae.unbindTexture()},this.copyTextureToTexture=function(L,Q,te=null,X=null,V=0){L.isTexture!==!0&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),X=arguments[0]||null,L=arguments[1],Q=arguments[2],V=arguments[3]||0,te=null);let he,_e,He,ze,lt,rt;te!==null?(he=te.max.x-te.min.x,_e=te.max.y-te.min.y,He=te.min.x,ze=te.min.y):(he=L.image.width,_e=L.image.height,He=0,ze=0),X!==null?(lt=X.x,rt=X.y):(lt=0,rt=0);const ct=st.convert(Q.format),kt=st.convert(Q.type);pe.setTexture2D(Q,0),q.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,Q.flipY),q.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Q.premultiplyAlpha),q.pixelStorei(q.UNPACK_ALIGNMENT,Q.unpackAlignment);const yt=q.getParameter(q.UNPACK_ROW_LENGTH),Ut=q.getParameter(q.UNPACK_IMAGE_HEIGHT),Pn=q.getParameter(q.UNPACK_SKIP_PIXELS),Xt=q.getParameter(q.UNPACK_SKIP_ROWS),Et=q.getParameter(q.UNPACK_SKIP_IMAGES),xt=L.isCompressedTexture?L.mipmaps[V]:L.image;q.pixelStorei(q.UNPACK_ROW_LENGTH,xt.width),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,xt.height),q.pixelStorei(q.UNPACK_SKIP_PIXELS,He),q.pixelStorei(q.UNPACK_SKIP_ROWS,ze),L.isDataTexture?q.texSubImage2D(q.TEXTURE_2D,V,lt,rt,he,_e,ct,kt,xt.data):L.isCompressedTexture?q.compressedTexSubImage2D(q.TEXTURE_2D,V,lt,rt,xt.width,xt.height,ct,xt.data):q.texSubImage2D(q.TEXTURE_2D,V,lt,rt,he,_e,ct,kt,xt),q.pixelStorei(q.UNPACK_ROW_LENGTH,yt),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,Ut),q.pixelStorei(q.UNPACK_SKIP_PIXELS,Pn),q.pixelStorei(q.UNPACK_SKIP_ROWS,Xt),q.pixelStorei(q.UNPACK_SKIP_IMAGES,Et),V===0&&Q.generateMipmaps&&q.generateMipmap(q.TEXTURE_2D),Ae.unbindTexture()},this.copyTextureToTexture3D=function(L,Q,te=null,X=null,V=0){L.isTexture!==!0&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),te=arguments[0]||null,X=arguments[1]||null,L=arguments[2],Q=arguments[3],V=arguments[4]||0);let he,_e,He,ze,lt,rt,ct,kt,yt;const Ut=L.isCompressedTexture?L.mipmaps[V]:L.image;te!==null?(he=te.max.x-te.min.x,_e=te.max.y-te.min.y,He=te.max.z-te.min.z,ze=te.min.x,lt=te.min.y,rt=te.min.z):(he=Ut.width,_e=Ut.height,He=Ut.depth,ze=0,lt=0,rt=0),X!==null?(ct=X.x,kt=X.y,yt=X.z):(ct=0,kt=0,yt=0);const Pn=st.convert(Q.format),Xt=st.convert(Q.type);let Et;if(Q.isData3DTexture)pe.setTexture3D(Q,0),Et=q.TEXTURE_3D;else if(Q.isDataArrayTexture||Q.isCompressedArrayTexture)pe.setTexture2DArray(Q,0),Et=q.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}q.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,Q.flipY),q.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Q.premultiplyAlpha),q.pixelStorei(q.UNPACK_ALIGNMENT,Q.unpackAlignment);const xt=q.getParameter(q.UNPACK_ROW_LENGTH),Rt=q.getParameter(q.UNPACK_IMAGE_HEIGHT),Ln=q.getParameter(q.UNPACK_SKIP_PIXELS),Wt=q.getParameter(q.UNPACK_SKIP_ROWS),jn=q.getParameter(q.UNPACK_SKIP_IMAGES);q.pixelStorei(q.UNPACK_ROW_LENGTH,Ut.width),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,Ut.height),q.pixelStorei(q.UNPACK_SKIP_PIXELS,ze),q.pixelStorei(q.UNPACK_SKIP_ROWS,lt),q.pixelStorei(q.UNPACK_SKIP_IMAGES,rt),L.isDataTexture||L.isData3DTexture?q.texSubImage3D(Et,V,ct,kt,yt,he,_e,He,Pn,Xt,Ut.data):Q.isCompressedArrayTexture?q.compressedTexSubImage3D(Et,V,ct,kt,yt,he,_e,He,Pn,Ut.data):q.texSubImage3D(Et,V,ct,kt,yt,he,_e,He,Pn,Xt,Ut),q.pixelStorei(q.UNPACK_ROW_LENGTH,xt),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,Rt),q.pixelStorei(q.UNPACK_SKIP_PIXELS,Ln),q.pixelStorei(q.UNPACK_SKIP_ROWS,Wt),q.pixelStorei(q.UNPACK_SKIP_IMAGES,jn),V===0&&Q.generateMipmaps&&q.generateMipmap(Et),Ae.unbindTexture()},this.initRenderTarget=function(L){Z.get(L).__webglFramebuffer===void 0&&pe.setupRenderTarget(L)},this.initTexture=function(L){L.isCubeTexture?pe.setTextureCube(L,0):L.isData3DTexture?pe.setTexture3D(L,0):L.isDataArrayTexture||L.isCompressedArrayTexture?pe.setTexture2DArray(L,0):pe.setTexture2D(L,0),Ae.unbindTexture()},this.resetState=function(){x=0,C=0,_=null,Ae.reset(),dt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Fc}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===YP?"display-p3":"srgb",n.unpackColorSpace=Nn.workingColorSpace===FS?"display-p3":"srgb"}}class iL extends Sr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new el,this.environmentIntensity=1,this.environmentRotation=new el,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}class ffe{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=_M,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=ma()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return ZP("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,r){e*=this.stride,r*=n.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=n.array[r+i];return this}set(e,n=0){return this.array.set(e,n),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ma()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const n=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(n,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ma()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Rs=new de;class sL{constructor(e,n,r,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=n,this.offset=r,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let n=0,r=this.data.count;n<r;n++)Rs.fromBufferAttribute(this,n),Rs.applyMatrix4(e),this.setXYZ(n,Rs.x,Rs.y,Rs.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Rs.fromBufferAttribute(this,n),Rs.applyNormalMatrix(e),this.setXYZ(n,Rs.x,Rs.y,Rs.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Rs.fromBufferAttribute(this,n),Rs.transformDirection(e),this.setXYZ(n,Rs.x,Rs.y,Rs.z);return this}getComponent(e,n){let r=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(r=Qa(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Wn(r,this.array)),this.data.array[e*this.data.stride+this.offset+n]=r,this}setX(e,n){return this.normalized&&(n=Wn(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Wn(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Wn(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Wn(n,this.array)),this.data.array[e*this.data.stride+this.offset+3]=n,this}getX(e){let n=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(n=Qa(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Qa(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Qa(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Qa(n,this.array)),n}setXY(e,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=Wn(n,this.array),r=Wn(r,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this}setXYZ(e,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(n=Wn(n,this.array),r=Wn(r,this.array),i=Wn(i,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(n=Wn(n,this.array),r=Wn(r,this.array),i=Wn(i,this.array),s=Wn(s,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let r=0;r<this.count;r++){const i=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[i+s])}return new Fi(new this.array.constructor(n),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new sL(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let r=0;r<this.count;r++){const i=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:n,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const MN=new de,kN=new Jn,RN=new Jn,hfe=new de,PN=new Zt,bb=new de,eT=new sc,LN=new Zt,tT=new wg;class Afe extends xn{constructor(e,n){super(e,n),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=LF,this.bindMatrix=new Zt,this.bindMatrixInverse=new Zt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new ic),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,bb),this.boundingBox.expandByPoint(bb)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new sc),this.boundingSphere.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,bb),this.boundingSphere.expandByPoint(bb)}copy(e,n){return super.copy(e,n),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,n){const r=this.material,i=this.matrixWorld;r!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),eT.copy(this.boundingSphere),eT.applyMatrix4(i),e.ray.intersectsSphere(eT)!==!1&&(LN.copy(i).invert(),tT.copy(e.ray).applyMatrix4(LN),!(this.boundingBox!==null&&tT.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,n,tT)))}getVertexPosition(e,n){return super.getVertexPosition(e,n),this.applyBoneTransform(e,n),n}bind(e,n){this.skeleton=e,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Jn,n=this.geometry.attributes.skinWeight;for(let r=0,i=n.count;r<i;r++){e.fromBufferAttribute(n,r);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),n.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===LF?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Boe?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,n){const r=this.skeleton,i=this.geometry;kN.fromBufferAttribute(i.attributes.skinIndex,e),RN.fromBufferAttribute(i.attributes.skinWeight,e),MN.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let s=0;s<4;s++){const o=RN.getComponent(s);if(o!==0){const a=kN.getComponent(s);PN.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),n.addScaledVector(hfe.copy(MN).applyMatrix4(PN),o)}}return n.applyMatrix4(this.bindMatrixInverse)}}class cW extends Sr{constructor(){super(),this.isBone=!0,this.type="Bone"}}class uW extends Oi{constructor(e=null,n=1,r=1,i,s,o,a,l,c=Qs,u=Qs,d,f){super(null,o,a,l,c,u,i,s,d,f),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const IN=new Zt,pfe=new Zt;class oL{constructor(e=[],n=[]){this.uuid=ma(),this.bones=e.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,n=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),n.length===0)this.calculateInverses();else if(e.length!==n.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let r=0,i=this.bones.length;r<i;r++)this.boneInverses.push(new Zt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,n=this.bones.length;e<n;e++){const r=new Zt;this.bones[e]&&r.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(r)}}pose(){for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];r&&r.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];r&&(r.parent&&r.parent.isBone?(r.matrix.copy(r.parent.matrixWorld).invert(),r.matrix.multiply(r.matrixWorld)):r.matrix.copy(r.matrixWorld),r.matrix.decompose(r.position,r.quaternion,r.scale))}}update(){const e=this.bones,n=this.boneInverses,r=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:pfe;IN.multiplyMatrices(a,n[s]),IN.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new oL(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4);n.set(this.boneMatrices);const r=new uW(n,e,e,ua,Wa);return r.needsUpdate=!0,this.boneMatrices=n,this.boneTexture=r,this}getBoneByName(e){for(let n=0,r=this.bones.length;n<r;n++){const i=this.bones[n];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,n){this.uuid=e.uuid;for(let r=0,i=e.bones.length;r<i;r++){const s=e.bones[r];let o=n[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new cW),this.bones.push(o),this.boneInverses.push(new Zt().fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const n=this.bones,r=this.boneInverses;for(let i=0,s=n.length;i<s;i++){const o=n[i];e.bones.push(o.uuid);const a=r[i];e.boneInverses.push(a.toArray())}return e}}class EM extends Fi{constructor(e,n,r,i=1){super(e,n,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const UA=new Zt,ON=new Zt,wb=[],FN=new ic,mfe=new Zt,Jg=new xn,Zg=new sc;class gfe extends xn{constructor(e,n,r){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new EM(new Float32Array(r*16),16),this.instanceColor=null,this.morphTexture=null,this.count=r,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<r;i++)this.setMatrixAt(i,mfe)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new ic),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,UA),FN.copy(e.boundingBox).applyMatrix4(UA),this.boundingBox.union(FN)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new sc),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,UA),Zg.copy(e.boundingSphere).applyMatrix4(UA),this.boundingSphere.union(Zg)}copy(e,n){return super.copy(e,n),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,n){n.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,n){n.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,n){const r=n.morphTargetInfluences,i=this.morphTexture.source.data.data,s=r.length+1,o=e*s+1;for(let a=0;a<r.length;a++)r[a]=i[o+a]}raycast(e,n){const r=this.matrixWorld,i=this.count;if(Jg.geometry=this.geometry,Jg.material=this.material,Jg.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Zg.copy(this.boundingSphere),Zg.applyMatrix4(r),e.ray.intersectsSphere(Zg)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,UA),ON.multiplyMatrices(r,UA),Jg.matrixWorld=ON,Jg.raycast(e,wb);for(let o=0,a=wb.length;o<a;o++){const l=wb[o];l.instanceId=s,l.object=this,n.push(l)}wb.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new EM(new Float32Array(this.instanceMatrix.count*3),3)),n.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,n){n.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,n){const r=n.morphTargetInfluences,i=r.length+1;this.morphTexture===null&&(this.morphTexture=new uW(new Float32Array(i*this.count),i,this.count,KP,Wa));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<r.length;c++)o+=r[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=i*e;s[l]=a,s.set(r,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class Cg extends jl{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Nt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const IC=new de,OC=new de,NN=new Zt,e0=new wg,xb=new sc,nT=new de,DN=new de;let aL=class extends Sr{constructor(e=new Ai,n=new Cg){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[0];for(let i=1,s=n.count;i<s;i++)IC.fromBufferAttribute(n,i-1),OC.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=IC.distanceTo(OC);e.setAttribute("lineDistance",new hi(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const r=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),xb.copy(r.boundingSphere),xb.applyMatrix4(i),xb.radius+=s,e.ray.intersectsSphere(xb)===!1)return;NN.copy(i).invert(),e0.copy(e.ray).applyMatrix4(NN);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=r.index,f=r.attributes.position;if(u!==null){const h=Math.max(0,o.start),A=Math.min(u.count,o.start+o.count);for(let p=h,m=A-1;p<m;p+=c){const g=u.getX(p),y=u.getX(p+1),w=Cb(this,e,e0,l,g,y);w&&n.push(w)}if(this.isLineLoop){const p=u.getX(A-1),m=u.getX(h),g=Cb(this,e,e0,l,p,m);g&&n.push(g)}}else{const h=Math.max(0,o.start),A=Math.min(f.count,o.start+o.count);for(let p=h,m=A-1;p<m;p+=c){const g=Cb(this,e,e0,l,p,p+1);g&&n.push(g)}if(this.isLineLoop){const p=Cb(this,e,e0,l,A-1,h);p&&n.push(p)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function Cb(t,e,n,r,i,s){const o=t.geometry.attributes.position;if(IC.fromBufferAttribute(o,i),OC.fromBufferAttribute(o,s),n.distanceSqToSegment(IC,OC,nT,DN)>r)return;nT.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(nT);if(!(l<e.near||l>e.far))return{distance:l,point:DN.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,object:t}}const UN=new de,HN=new de;class lL extends aL{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[];for(let i=0,s=n.count;i<s;i+=2)UN.fromBufferAttribute(n,i),HN.fromBufferAttribute(n,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+UN.distanceTo(HN);e.setAttribute("lineDistance",new hi(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class yfe extends aL{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class cL extends jl{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Nt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const jN=new Zt,TM=new wg,_b=new sc,Sb=new de;class FC extends Sr{constructor(e=new Ai,n=new cL){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,n){const r=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),_b.copy(r.boundingSphere),_b.applyMatrix4(i),_b.radius+=s,e.ray.intersectsSphere(_b)===!1)return;jN.copy(i).invert(),TM.copy(e.ray).applyMatrix4(jN);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=r.index,d=r.attributes.position;if(c!==null){const f=Math.max(0,o.start),h=Math.min(c.count,o.start+o.count);for(let A=f,p=h;A<p;A++){const m=c.getX(A);Sb.fromBufferAttribute(d,m),QN(Sb,m,l,i,e,n,this)}}else{const f=Math.max(0,o.start),h=Math.min(d.count,o.start+o.count);for(let A=f,p=h;A<p;A++)Sb.fromBufferAttribute(d,A),QN(Sb,A,l,i,e,n,this)}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function QN(t,e,n,r,i,s,o){const a=TM.distanceSqToPoint(t);if(a<n){const l=new de;TM.closestPointToPoint(t,l),l.applyMatrix4(r);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class oc{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),s=0;n.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const r=this.getLengths();let i=0;const s=r.length;let o;n?o=n:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const u=r[i],f=r[i+1]-u,h=(o-u)/f;return(i+h)/(s-1)}getTangent(e,n){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=n||(o.isVector2?new Ze:new de);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new de,i=[],s=[],o=[],a=new de,l=new Zt;for(let h=0;h<=e;h++){const A=h/e;i[h]=this.getTangentAt(A,new de)}s[0]=new de,o[0]=new de;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),d=Math.abs(i[0].y),f=Math.abs(i[0].z);u<=c&&(c=u,r.set(1,0,0)),d<=c&&(c=d,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let h=1;h<=e;h++){if(s[h]=s[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(i[h-1],i[h]),a.length()>Number.EPSILON){a.normalize();const A=Math.acos(yi(i[h-1].dot(i[h]),-1,1));s[h].applyMatrix4(l.makeRotationAxis(a,A))}o[h].crossVectors(i[h],s[h])}if(n===!0){let h=Math.acos(yi(s[0].dot(s[e]),-1,1));h/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(h=-h);for(let A=1;A<=e;A++)s[A].applyMatrix4(l.makeRotationAxis(i[A],h*A)),o[A].crossVectors(i[A],s[A])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class qp extends oc{constructor(e=0,n=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n=new Ze){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),d=Math.sin(this.aRotation),f=l-this.aX,h=c-this.aY;l=f*u-h*d+this.aX,c=f*d+h*u+this.aY}return r.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class vfe extends qp{constructor(e,n,r,i,s,o){super(e,n,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function uL(){let t=0,e=0,n=0,r=0;function i(s,o,a,l){t=s,e=a,n=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,d){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,h=(a-o)/u-(l-o)/(u+d)+(l-a)/d;f*=u,h*=u,i(o,a,f,h)},calc:function(s){const o=s*s,a=o*s;return t+e*s+n*o+r*a}}}const Eb=new de,rT=new uL,iT=new uL,sT=new uL;class wx extends oc{constructor(e=[],n=!1,r="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=n,this.curveType=r,this.tension=i}getPoint(e,n=new de){const r=n,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=i[(a-1)%s]:(Eb.subVectors(i[0],i[1]).add(i[0]),c=Eb);const d=i[a%s],f=i[(a+1)%s];if(this.closed||a+2<s?u=i[(a+2)%s]:(Eb.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=Eb),this.curveType==="centripetal"||this.curveType==="chordal"){const h=this.curveType==="chordal"?.5:.25;let A=Math.pow(c.distanceToSquared(d),h),p=Math.pow(d.distanceToSquared(f),h),m=Math.pow(f.distanceToSquared(u),h);p<1e-4&&(p=1),A<1e-4&&(A=p),m<1e-4&&(m=p),rT.initNonuniformCatmullRom(c.x,d.x,f.x,u.x,A,p,m),iT.initNonuniformCatmullRom(c.y,d.y,f.y,u.y,A,p,m),sT.initNonuniformCatmullRom(c.z,d.z,f.z,u.z,A,p,m)}else this.curveType==="catmullrom"&&(rT.initCatmullRom(c.x,d.x,f.x,u.x,this.tension),iT.initCatmullRom(c.y,d.y,f.y,u.y,this.tension),sT.initCatmullRom(c.z,d.z,f.z,u.z,this.tension));return r.set(rT.calc(l),iT.calc(l),sT.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,r=this.points.length;n<r;n++){const i=this.points[n];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(new de().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function zN(t,e,n,r,i){const s=(r-e)*.5,o=(i-n)*.5,a=t*t,l=t*a;return(2*n-2*r+s+o)*l+(-3*n+3*r-2*s-o)*a+s*t+n}function bfe(t,e){const n=1-t;return n*n*e}function wfe(t,e){return 2*(1-t)*t*e}function xfe(t,e){return t*t*e}function u1(t,e,n,r){return bfe(t,e)+wfe(t,n)+xfe(t,r)}function Cfe(t,e){const n=1-t;return n*n*n*e}function _fe(t,e){const n=1-t;return 3*n*n*t*e}function Sfe(t,e){return 3*(1-t)*t*t*e}function Efe(t,e){return t*t*t*e}function d1(t,e,n,r,i){return Cfe(t,e)+_fe(t,n)+Sfe(t,r)+Efe(t,i)}class dW extends oc{constructor(e=new Ze,n=new Ze,r=new Ze,i=new Ze){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new Ze){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(d1(e,i.x,s.x,o.x,a.x),d1(e,i.y,s.y,o.y,a.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Tfe extends oc{constructor(e=new de,n=new de,r=new de,i=new de){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new de){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(d1(e,i.x,s.x,o.x,a.x),d1(e,i.y,s.y,o.y,a.y),d1(e,i.z,s.z,o.z,a.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class fW extends oc{constructor(e=new Ze,n=new Ze){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new Ze){const r=n;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new Ze){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class J1 extends oc{constructor(e=new de,n=new de){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new de){const r=n;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new de){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class hW extends oc{constructor(e=new Ze,n=new Ze,r=new Ze){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new Ze){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(u1(e,i.x,s.x,o.x),u1(e,i.y,s.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Bfe extends oc{constructor(e=new de,n=new de,r=new de){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new de){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(u1(e,i.x,s.x,o.x),u1(e,i.y,s.y,o.y),u1(e,i.z,s.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class AW extends oc{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new Ze){const r=n,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],u=i[o>i.length-2?i.length-1:o+1],d=i[o>i.length-3?i.length-1:o+2];return r.set(zN(a,l.x,c.x,u.x,d.x),zN(a,l.y,c.y,u.y,d.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,r=this.points.length;n<r;n++){const i=this.points[n];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(new Ze().fromArray(i))}return this}}var BM=Object.freeze({__proto__:null,ArcCurve:vfe,CatmullRomCurve3:wx,CubicBezierCurve:dW,CubicBezierCurve3:Tfe,EllipseCurve:qp,LineCurve:fW,LineCurve3:J1,QuadraticBezierCurve:hW,QuadraticBezierCurve3:Bfe,SplineCurve:AW});class xx extends oc{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),n=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(n)){const r=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new BM[r](n,e))}return this}getPoint(e,n){const r=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;r<i;r++)n+=this.curves[r].getLength(),e.push(n);return this.cacheLengths=e,e}getSpacedPoints(e=40){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return this.autoClose&&n.push(n[0]),n}getPoints(e=12){const n=[];let r;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];r&&r.equals(u)||(n.push(u),r=u)}}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let n=0,r=this.curves.length;n<r;n++){const i=this.curves[n];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(new BM[i.type]().fromJSON(i))}return this}}class VN extends xx{constructor(e){super(),this.type="Path",this.currentPoint=new Ze,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let n=1,r=e.length;n<r;n++)this.lineTo(e[n].x,e[n].y);return this}moveTo(e,n){return this.currentPoint.set(e,n),this}lineTo(e,n){const r=new fW(this.currentPoint.clone(),new Ze(e,n));return this.curves.push(r),this.currentPoint.set(e,n),this}quadraticCurveTo(e,n,r,i){const s=new hW(this.currentPoint.clone(),new Ze(e,n),new Ze(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,n,r,i,s,o){const a=new dW(this.currentPoint.clone(),new Ze(e,n),new Ze(r,i),new Ze(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new AW(n);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,n,r,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,n+l,r,i,s,o),this}absarc(e,n,r,i,s,o){return this.absellipse(e,n,r,r,i,s,o),this}ellipse(e,n,r,i,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,n+u,r,i,s,o,a,l),this}absellipse(e,n,r,i,s,o,a,l){const c=new qp(e,n,r,i,s,o,a,l);if(this.curves.length>0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class dL extends Ai{constructor(e=1,n=1,r=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],d=[],f=[],h=[];let A=0;const p=[],m=r/2;let g=0;y(),o===!1&&(e>0&&w(!0),n>0&&w(!1)),this.setIndex(u),this.setAttribute("position",new hi(d,3)),this.setAttribute("normal",new hi(f,3)),this.setAttribute("uv",new hi(h,2));function y(){const v=new de,x=new de;let C=0;const _=(n-e)/r;for(let S=0;S<=s;S++){const E=[],T=S/s,R=T*(n-e)+e;for(let k=0;k<=i;k++){const B=k/i,M=B*l+a,F=Math.sin(M),I=Math.cos(M);x.x=R*F,x.y=-T*r+m,x.z=R*I,d.push(x.x,x.y,x.z),v.set(F,_,I).normalize(),f.push(v.x,v.y,v.z),h.push(B,1-T),E.push(A++)}p.push(E)}for(let S=0;S<i;S++)for(let E=0;E<s;E++){const T=p[E][S],R=p[E+1][S],k=p[E+1][S+1],B=p[E][S+1];u.push(T,R,B),u.push(R,k,B),C+=6}c.addGroup(g,C,0),g+=C}function w(v){const x=A,C=new Ze,_=new de;let S=0;const E=v===!0?e:n,T=v===!0?1:-1;for(let k=1;k<=i;k++)d.push(0,m*T,0),f.push(0,T,0),h.push(.5,.5),A++;const R=A;for(let k=0;k<=i;k++){const M=k/i*l+a,F=Math.cos(M),I=Math.sin(M);_.x=E*I,_.y=m*T,_.z=E*F,d.push(_.x,_.y,_.z),f.push(0,T,0),C.x=F*.5+.5,C.y=I*.5*T+.5,h.push(C.x,C.y),A++}for(let k=0;k<i;k++){const B=x+k,M=R+k;v===!0?u.push(M,M+1,B):u.push(M+1,M,B),S+=3}c.addGroup(g,S,v===!0?1:2),g+=S}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dL(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class fL extends dL{constructor(e=1,n=1,r=32,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,n,r,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new fL(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}const Tb=new de,Bb=new de,oT=new de,Mb=new za;class Mfe extends Ai{constructor(e=null,n=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:n},e!==null){const i=Math.pow(10,4),s=Math.cos(Kp*n),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],d=new Array(3),f={},h=[];for(let A=0;A<l;A+=3){o?(c[0]=o.getX(A),c[1]=o.getX(A+1),c[2]=o.getX(A+2)):(c[0]=A,c[1]=A+1,c[2]=A+2);const{a:p,b:m,c:g}=Mb;if(p.fromBufferAttribute(a,c[0]),m.fromBufferAttribute(a,c[1]),g.fromBufferAttribute(a,c[2]),Mb.getNormal(oT),d[0]=`${Math.round(p.x*i)},${Math.round(p.y*i)},${Math.round(p.z*i)}`,d[1]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,d[2]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let y=0;y<3;y++){const w=(y+1)%3,v=d[y],x=d[w],C=Mb[u[y]],_=Mb[u[w]],S=`${v}_${x}`,E=`${x}_${v}`;E in f&&f[E]?(oT.dot(f[E].normal)<=s&&(h.push(C.x,C.y,C.z),h.push(_.x,_.y,_.z)),f[E]=null):S in f||(f[S]={index0:c[y],index1:c[w],normal:oT.clone()})}}for(const A in f)if(f[A]){const{index0:p,index1:m}=f[A];Tb.fromBufferAttribute(a,p),Bb.fromBufferAttribute(a,m),h.push(Tb.x,Tb.y,Tb.z),h.push(Bb.x,Bb.y,Bb.z)}this.setAttribute("position",new hi(h,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class NC extends VN{constructor(e){super(e),this.uuid=ma(),this.type="Shape",this.holes=[]}getPointsHoles(e){const n=[];for(let r=0,i=this.holes.length;r<i;r++)n[r]=this.holes[r].getPoints(e);return n}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let n=0,r=e.holes.length;n<r;n++){const i=e.holes[n];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let n=0,r=this.holes.length;n<r;n++){const i=this.holes[n];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let n=0,r=e.holes.length;n<r;n++){const i=e.holes[n];this.holes.push(new VN().fromJSON(i))}return this}}const kfe={triangulate:function(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=pW(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,d,f,h;if(r&&(s=Ofe(t,e,s,n)),t.length>80*n){a=c=t[0],l=u=t[1];for(let A=n;A<i;A+=n)d=t[A],f=t[A+1],d<a&&(a=d),f<l&&(l=f),d>c&&(c=d),f>u&&(u=f);h=Math.max(c-a,u-l),h=h!==0?32767/h:0}return Z1(s,o,n,a,l,h,0),o}};function pW(t,e,n,r,i){let s,o;if(i===Wfe(t,e,n,r)>0)for(s=e;s<n;s+=r)o=GN(s,t[s],t[s+1],o);else for(s=n-r;s>=e;s-=r)o=GN(s,t[s],t[s+1],o);return o&&DS(o,o.next)&&(ty(o),o=o.next),o}function Uh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(DS(n,n.next)||Lr(n.prev,n,n.next)===0)){if(ty(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Z1(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Hfe(t,r,i,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Pfe(t,r,i,s):Rfe(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),ty(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=Lfe(Uh(t),e,n),Z1(t,e,n,r,i,s,2)):o===2&&Ife(t,e,n,r,i,s):Z1(Uh(t),e,n,r,i,s,1);break}}}function Rfe(t){const e=t.prev,n=t,r=t.next;if(Lr(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,c=r.y,u=i<s?i<o?i:o:s<o?s:o,d=a<l?a<c?a:c:l<c?l:c,f=i>s?i>o?i:o:s>o?s:o,h=a>l?a>c?a:c:l>c?l:c;let A=r.next;for(;A!==e;){if(A.x>=u&&A.x<=f&&A.y>=d&&A.y<=h&&_p(i,a,s,l,o,c,A.x,A.y)&&Lr(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function Pfe(t,e,n,r){const i=t.prev,s=t,o=t.next;if(Lr(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,u=i.y,d=s.y,f=o.y,h=a<l?a<c?a:c:l<c?l:c,A=u<d?u<f?u:f:d<f?d:f,p=a>l?a>c?a:c:l>c?l:c,m=u>d?u>f?u:f:d>f?d:f,g=MM(h,A,e,n,r),y=MM(p,m,e,n,r);let w=t.prevZ,v=t.nextZ;for(;w&&w.z>=g&&v&&v.z<=y;){if(w.x>=h&&w.x<=p&&w.y>=A&&w.y<=m&&w!==i&&w!==o&&_p(a,u,l,d,c,f,w.x,w.y)&&Lr(w.prev,w,w.next)>=0||(w=w.prevZ,v.x>=h&&v.x<=p&&v.y>=A&&v.y<=m&&v!==i&&v!==o&&_p(a,u,l,d,c,f,v.x,v.y)&&Lr(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;w&&w.z>=g;){if(w.x>=h&&w.x<=p&&w.y>=A&&w.y<=m&&w!==i&&w!==o&&_p(a,u,l,d,c,f,w.x,w.y)&&Lr(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;v&&v.z<=y;){if(v.x>=h&&v.x<=p&&v.y>=A&&v.y<=m&&v!==i&&v!==o&&_p(a,u,l,d,c,f,v.x,v.y)&&Lr(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Lfe(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!DS(i,s)&&mW(i,r,r.next,s)&&ey(i,s)&&ey(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),ty(r),ty(r.next),r=t=s),r=r.next}while(r!==t);return Uh(r)}function Ife(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&zfe(o,a)){let l=gW(o,a);o=Uh(o,o.next),l=Uh(l,l.next),Z1(o,e,n,r,i,s,0),Z1(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function Ofe(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*r,l=s<o-1?e[s+1]*r:t.length,c=pW(t,a,l,r,!1),c===c.next&&(c.steiner=!0),i.push(Qfe(c));for(i.sort(Ffe),s=0;s<i.length;s++)n=Nfe(i[s],n);return n}function Ffe(t,e){return t.x-e.x}function Nfe(t,e){const n=Dfe(t,e);if(!n)return e;const r=gW(n,t);return Uh(r,r.next),Uh(n,n.next)}function Dfe(t,e){let n=e,r=-1/0,i;const s=t.x,o=t.y;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){const f=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=s&&f>r&&(r=f,i=n.x<n.next.x?n:n.next,f===s))return i}n=n.next}while(n!==e);if(!i)return null;const a=i,l=i.x,c=i.y;let u=1/0,d;n=i;do s>=n.x&&n.x>=l&&s!==n.x&&_p(o<c?s:r,o,l,c,o<c?r:s,o,n.x,n.y)&&(d=Math.abs(o-n.y)/(s-n.x),ey(n,t)&&(d<u||d===u&&(n.x>i.x||n.x===i.x&&Ufe(i,n)))&&(i=n,u=d)),n=n.next;while(n!==a);return i}function Ufe(t,e){return Lr(t.prev,t,e.prev)<0&&Lr(e.next,t,t.next)<0}function Hfe(t,e,n,r){let i=t;do i.z===0&&(i.z=MM(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,jfe(i)}function jfe(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e<c&&(a++,r=r.nextZ,!!r);e++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function MM(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Qfe(t){let e=t,n=t;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==t);return n}function _p(t,e,n,r,i,s,o,a){return(i-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function zfe(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Vfe(t,e)&&(ey(t,e)&&ey(e,t)&&Gfe(t,e)&&(Lr(t.prev,t,e.prev)||Lr(t,e.prev,e))||DS(t,e)&&Lr(t.prev,t,t.next)>0&&Lr(e.prev,e,e.next)>0)}function Lr(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function DS(t,e){return t.x===e.x&&t.y===e.y}function mW(t,e,n,r){const i=Rb(Lr(t,e,n)),s=Rb(Lr(t,e,r)),o=Rb(Lr(n,r,t)),a=Rb(Lr(n,r,e));return!!(i!==s&&o!==a||i===0&&kb(t,n,e)||s===0&&kb(t,r,e)||o===0&&kb(n,t,r)||a===0&&kb(n,e,r))}function kb(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Rb(t){return t>0?1:t<0?-1:0}function Vfe(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&mW(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function ey(t,e){return Lr(t.prev,t,t.next)<0?Lr(t,e,t.next)>=0&&Lr(t,t.prev,e)>=0:Lr(t,e,t.prev)<0||Lr(t,t.next,e)<0}function Gfe(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function gW(t,e){const n=new kM(t.i,t.x,t.y),r=new kM(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function GN(t,e,n,r){const i=new kM(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ty(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function kM(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Wfe(t,e,n,r){let i=0;for(let s=e,o=n-r;s<n;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}class f1{static area(e){const n=e.length;let r=0;for(let i=n-1,s=0;s<n;i=s++)r+=e[i].x*e[s].y-e[s].x*e[i].y;return r*.5}static isClockWise(e){return f1.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];WN(e),KN(r,e);let o=e.length;n.forEach(WN);for(let l=0;l<n.length;l++)i.push(o),o+=n[l].length,KN(r,n[l]);const a=kfe.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function WN(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function KN(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Ld extends Ai{constructor(e=new NC([new Ze(.5,.5),new Ze(-.5,.5),new Ze(-.5,-.5),new Ze(.5,-.5)]),n={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:n},e=Array.isArray(e)?e:[e];const r=this,i=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new hi(i,3)),this.setAttribute("uv",new hi(s,2)),this.computeVertexNormals();function o(a){const l=[],c=n.curveSegments!==void 0?n.curveSegments:12,u=n.steps!==void 0?n.steps:1,d=n.depth!==void 0?n.depth:1;let f=n.bevelEnabled!==void 0?n.bevelEnabled:!0,h=n.bevelThickness!==void 0?n.bevelThickness:.2,A=n.bevelSize!==void 0?n.bevelSize:h-.1,p=n.bevelOffset!==void 0?n.bevelOffset:0,m=n.bevelSegments!==void 0?n.bevelSegments:3;const g=n.extrudePath,y=n.UVGenerator!==void 0?n.UVGenerator:Kfe;let w,v=!1,x,C,_,S;g&&(w=g.getSpacedPoints(u),v=!0,f=!1,x=g.computeFrenetFrames(u,!1),C=new de,_=new de,S=new de),f||(m=0,h=0,A=0,p=0);const E=a.extractPoints(c);let T=E.shape;const R=E.holes;if(!f1.isClockWise(T)){T=T.reverse();for(let q=0,Ue=R.length;q<Ue;q++){const O=R[q];f1.isClockWise(O)&&(R[q]=O.reverse())}}const B=f1.triangulateShape(T,R),M=T;for(let q=0,Ue=R.length;q<Ue;q++){const O=R[q];T=T.concat(O)}function F(q,Ue,O){return Ue||console.error("THREE.ExtrudeGeometry: vec does not exist"),q.clone().addScaledVector(Ue,O)}const I=T.length,z=B.length;function Y(q,Ue,O){let ve,Ae,ae;const Z=q.x-Ue.x,pe=q.y-Ue.y,J=O.x-q.x,H=O.y-q.y,oe=Z*Z+pe*pe,we=Z*H-pe*J;if(Math.abs(we)>Number.EPSILON){const Ee=Math.sqrt(oe),re=Math.sqrt(J*J+H*H),ce=Ue.x-pe/Ee,le=Ue.y+Z/Ee,me=O.x-H/re,Le=O.y+J/re,Te=((me-ce)*H-(Le-le)*J)/(Z*H-pe*J);ve=ce+Z*Te-q.x,Ae=le+pe*Te-q.y;const Pe=ve*ve+Ae*Ae;if(Pe<=2)return new Ze(ve,Ae);ae=Math.sqrt(Pe/2)}else{let Ee=!1;Z>Number.EPSILON?J>Number.EPSILON&&(Ee=!0):Z<-Number.EPSILON?J<-Number.EPSILON&&(Ee=!0):Math.sign(pe)===Math.sign(H)&&(Ee=!0),Ee?(ve=-pe,Ae=Z,ae=Math.sqrt(oe)):(ve=Z,Ae=pe,ae=Math.sqrt(oe/2))}return new Ze(ve/ae,Ae/ae)}const $=[];for(let q=0,Ue=M.length,O=Ue-1,ve=q+1;q<Ue;q++,O++,ve++)O===Ue&&(O=0),ve===Ue&&(ve=0),$[q]=Y(M[q],M[O],M[ve]);const ee=[];let W,ne=$.concat();for(let q=0,Ue=R.length;q<Ue;q++){const O=R[q];W=[];for(let ve=0,Ae=O.length,ae=Ae-1,Z=ve+1;ve<Ae;ve++,ae++,Z++)ae===Ae&&(ae=0),Z===Ae&&(Z=0),W[ve]=Y(O[ve],O[ae],O[Z]);ee.push(W),ne=ne.concat(W)}for(let q=0;q<m;q++){const Ue=q/m,O=h*Math.cos(Ue*Math.PI/2),ve=A*Math.sin(Ue*Math.PI/2)+p;for(let Ae=0,ae=M.length;Ae<ae;Ae++){const Z=F(M[Ae],$[Ae],ve);Fe(Z.x,Z.y,-O)}for(let Ae=0,ae=R.length;Ae<ae;Ae++){const Z=R[Ae];W=ee[Ae];for(let pe=0,J=Z.length;pe<J;pe++){const H=F(Z[pe],W[pe],ve);Fe(H.x,H.y,-O)}}}const Se=A+p;for(let q=0;q<I;q++){const Ue=f?F(T[q],ne[q],Se):T[q];v?(_.copy(x.normals[0]).multiplyScalar(Ue.x),C.copy(x.binormals[0]).multiplyScalar(Ue.y),S.copy(w[0]).add(_).add(C),Fe(S.x,S.y,S.z)):Fe(Ue.x,Ue.y,0)}for(let q=1;q<=u;q++)for(let Ue=0;Ue<I;Ue++){const O=f?F(T[Ue],ne[Ue],Se):T[Ue];v?(_.copy(x.normals[q]).multiplyScalar(O.x),C.copy(x.binormals[q]).multiplyScalar(O.y),S.copy(w[q]).add(_).add(C),Fe(S.x,S.y,S.z)):Fe(O.x,O.y,d/u*q)}for(let q=m-1;q>=0;q--){const Ue=q/m,O=h*Math.cos(Ue*Math.PI/2),ve=A*Math.sin(Ue*Math.PI/2)+p;for(let Ae=0,ae=M.length;Ae<ae;Ae++){const Z=F(M[Ae],$[Ae],ve);Fe(Z.x,Z.y,d+O)}for(let Ae=0,ae=R.length;Ae<ae;Ae++){const Z=R[Ae];W=ee[Ae];for(let pe=0,J=Z.length;pe<J;pe++){const H=F(Z[pe],W[pe],ve);v?Fe(H.x,H.y+w[u-1].y,w[u-1].x+O):Fe(H.x,H.y,d+O)}}}fe(),ge();function fe(){const q=i.length/3;if(f){let Ue=0,O=I*Ue;for(let ve=0;ve<z;ve++){const Ae=B[ve];De(Ae[2]+O,Ae[1]+O,Ae[0]+O)}Ue=u+m*2,O=I*Ue;for(let ve=0;ve<z;ve++){const Ae=B[ve];De(Ae[0]+O,Ae[1]+O,Ae[2]+O)}}else{for(let Ue=0;Ue<z;Ue++){const O=B[Ue];De(O[2],O[1],O[0])}for(let Ue=0;Ue<z;Ue++){const O=B[Ue];De(O[0]+I*u,O[1]+I*u,O[2]+I*u)}}r.addGroup(q,i.length/3-q,0)}function ge(){const q=i.length/3;let Ue=0;Oe(M,Ue),Ue+=M.length;for(let O=0,ve=R.length;O<ve;O++){const Ae=R[O];Oe(Ae,Ue),Ue+=Ae.length}r.addGroup(q,i.length/3-q,1)}function Oe(q,Ue){let O=q.length;for(;--O>=0;){const ve=O;let Ae=O-1;Ae<0&&(Ae=q.length-1);for(let ae=0,Z=u+m*2;ae<Z;ae++){const pe=I*ae,J=I*(ae+1),H=Ue+ve+pe,oe=Ue+Ae+pe,we=Ue+Ae+J,Ee=Ue+ve+J;ke(H,oe,we,Ee)}}}function Fe(q,Ue,O){l.push(q),l.push(Ue),l.push(O)}function De(q,Ue,O){Ge(q),Ge(Ue),Ge(O);const ve=i.length/3,Ae=y.generateTopUV(r,i,ve-3,ve-2,ve-1);Ve(Ae[0]),Ve(Ae[1]),Ve(Ae[2])}function ke(q,Ue,O,ve){Ge(q),Ge(Ue),Ge(ve),Ge(Ue),Ge(O),Ge(ve);const Ae=i.length/3,ae=y.generateSideWallUV(r,i,Ae-6,Ae-3,Ae-2,Ae-1);Ve(ae[0]),Ve(ae[1]),Ve(ae[3]),Ve(ae[1]),Ve(ae[2]),Ve(ae[3])}function Ge(q){i.push(l[q*3+0]),i.push(l[q*3+1]),i.push(l[q*3+2])}function Ve(q){s.push(q.x),s.push(q.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),n=this.parameters.shapes,r=this.parameters.options;return $fe(n,r,e)}static fromJSON(e,n){const r=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=n[e.shapes[s]];r.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new BM[i.type]().fromJSON(i)),new Ld(r,e.options)}}const Kfe={generateTopUV:function(t,e,n,r,i){const s=e[n*3],o=e[n*3+1],a=e[r*3],l=e[r*3+1],c=e[i*3],u=e[i*3+1];return[new Ze(s,o),new Ze(a,l),new Ze(c,u)]},generateSideWallUV:function(t,e,n,r,i,s){const o=e[n*3],a=e[n*3+1],l=e[n*3+2],c=e[r*3],u=e[r*3+1],d=e[r*3+2],f=e[i*3],h=e[i*3+1],A=e[i*3+2],p=e[s*3],m=e[s*3+1],g=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Ze(o,1-l),new Ze(c,1-d),new Ze(f,1-A),new Ze(p,1-g)]:[new Ze(a,1-l),new Ze(u,1-d),new Ze(h,1-A),new Ze(m,1-g)]}};function $fe(t,e,n){if(n.shapes=[],Array.isArray(t))for(let r=0,i=t.length;r<i;r++){const s=t[r];n.shapes.push(s.uuid)}else n.shapes.push(t.uuid);return n.options=Object.assign({},e),e.extrudePath!==void 0&&(n.options.extrudePath=e.extrudePath.toJSON()),n}class nv extends Ai{constructor(e=1,n=32,r=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));const l=Math.min(o+a,Math.PI);let c=0;const u=[],d=new de,f=new de,h=[],A=[],p=[],m=[];for(let g=0;g<=r;g++){const y=[],w=g/r;let v=0;g===0&&o===0?v=.5/n:g===r&&l===Math.PI&&(v=-.5/n);for(let x=0;x<=n;x++){const C=x/n;d.x=-e*Math.cos(i+C*s)*Math.sin(o+w*a),d.y=e*Math.cos(o+w*a),d.z=e*Math.sin(i+C*s)*Math.sin(o+w*a),A.push(d.x,d.y,d.z),f.copy(d).normalize(),p.push(f.x,f.y,f.z),m.push(C+v,1-w),y.push(c++)}u.push(y)}for(let g=0;g<r;g++)for(let y=0;y<n;y++){const w=u[g][y+1],v=u[g][y],x=u[g+1][y],C=u[g+1][y+1];(g!==0||o>0)&&h.push(w,v,C),(g!==r-1||l<Math.PI)&&h.push(v,x,C)}this.setIndex(h),this.setAttribute("position",new hi(A,3)),this.setAttribute("normal",new hi(p,3)),this.setAttribute("uv",new hi(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nv(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class hL extends jl{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Nt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Nt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=WG,this.normalScale=new Ze(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new el,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ac extends hL{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ze(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return yi(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(n){this.ior=(1+.4*n)/(1-.4*n)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Nt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Nt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Nt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}function Pb(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function qfe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Xfe(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function $N(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const a=n[s]*e;for(let l=0;l!==e;++l)i[o++]=t[a+l]}return i}function yW(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),n.push.apply(n,o)),s=t[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),n.push(o)),s=t[i++];while(s!==void 0)}class rv{constructor(e,n,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const n=this.parameterPositions;let r=this._cachedIndex,i=n[r],s=n[r-1];e:{t:{let o;n:{r:if(!(e<i)){for(let a=r+2;;){if(i===void 0){if(e<s)break r;return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===a)break;if(s=i,i=n[++r],e<i)break t}o=n.length;break n}if(!(e>=s)){const a=n[1];e<a&&(r=2,s=a);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===l)break;if(i=s,s=n[--r-1],e>=s)break t}o=r,r=0;break n}break e}for(;r<o;){const a=r+o>>>1;e<n[a]?o=a:r=a+1}if(i=n[r],s=n[r-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,s,i)}return this.interpolate_(r,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const n=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)n[o]=r[s+o];return n}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Yfe extends rv{constructor(e,n,r,i){super(e,n,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:IF,endingEnd:IF}}intervalChanged_(e,n,r){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case OF:s=e,a=2*n-r;break;case FF:s=i.length-2,a=n+i[s]-i[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case OF:o=e,l=2*r-n;break;case FF:o=1,l=r+i[1]-i[0];break;default:o=e-1,l=n}const c=(r-n)*.5,u=this.valueSize;this._weightPrev=c/(n-a),this._weightNext=c/(l-r),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,d=this._offsetNext,f=this._weightPrev,h=this._weightNext,A=(r-n)/(i-n),p=A*A,m=p*A,g=-f*m+2*f*p-f*A,y=(1+f)*m+(-1.5-2*f)*p+(-.5+f)*A+1,w=(-1-h)*m+(1.5+h)*p+.5*A,v=h*m-h*p;for(let x=0;x!==a;++x)s[x]=g*o[u+x]+y*o[c+x]+w*o[l+x]+v*o[d+x];return s}}class Jfe extends rv{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(r-n)/(i-n),d=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*d+o[l+f]*u;return s}}class Zfe extends rv{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class lc{constructor(e,n,r,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(n===void 0||n.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Pb(n,this.TimeBufferType),this.values=Pb(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const n=e.constructor;let r;if(n.toJSON!==this.toJSON)r=n.toJSON(e);else{r={name:e.name,times:Pb(e.times,Array),values:Pb(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new Zfe(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Jfe(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Yfe(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let n;switch(e){case q1:n=this.InterpolantFactoryMethodDiscrete;break;case X1:n=this.InterpolantFactoryMethodLinear;break;case BE:n=this.InterpolantFactoryMethodSmooth;break}if(n===void 0){const r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=n,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return q1;case this.InterpolantFactoryMethodLinear:return X1;case this.InterpolantFactoryMethodSmooth:return BE}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]+=e}return this}scale(e){if(e!==1){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]*=e}return this}trim(e,n){const r=this.times,i=r.length;let s=0,o=i-1;for(;s!==i&&r[s]<e;)++s;for(;o!==-1&&r[o]>n;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&qfe(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===BE,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(i)l=!0;else{const d=a*r,f=d-r,h=d+r;for(let A=0;A!==r;++A){const p=n[d+A];if(p!==n[f+A]||p!==n[h+A]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const d=a*r,f=o*r;for(let h=0;h!==r;++h)n[f+h]=n[d+h]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}lc.prototype.TimeBufferType=Float32Array;lc.prototype.ValueBufferType=Float32Array;lc.prototype.DefaultInterpolation=X1;class _g extends lc{constructor(e,n,r){super(e,n,r)}}_g.prototype.ValueTypeName="bool";_g.prototype.ValueBufferType=Array;_g.prototype.DefaultInterpolation=q1;_g.prototype.InterpolantFactoryMethodLinear=void 0;_g.prototype.InterpolantFactoryMethodSmooth=void 0;class vW extends lc{}vW.prototype.ValueTypeName="color";class Bm extends lc{}Bm.prototype.ValueTypeName="number";class ehe extends rv{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let c=e*a;for(let u=c+a;c!==u;c+=4)$s.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Mm extends lc{InterpolantFactoryMethodLinear(e){return new ehe(this.times,this.values,this.getValueSize(),e)}}Mm.prototype.ValueTypeName="quaternion";Mm.prototype.InterpolantFactoryMethodSmooth=void 0;class Sg extends lc{constructor(e,n,r){super(e,n,r)}}Sg.prototype.ValueTypeName="string";Sg.prototype.ValueBufferType=Array;Sg.prototype.DefaultInterpolation=q1;Sg.prototype.InterpolantFactoryMethodLinear=void 0;Sg.prototype.InterpolantFactoryMethodSmooth=void 0;class km extends lc{}km.prototype.ValueTypeName="vector";class the{constructor(e="",n=-1,r=[],i=Moe){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=ma(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)n.push(rhe(r[o]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)n.push(lc.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=Xfe(l);l=$N(l,1,u),c=$N(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Bm(".morphTargetInfluences["+n[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}static findByName(e,n){let r=e;if(!Array.isArray(e)){const i=e;r=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<r.length;i++)if(r[i].name===n)return r[i];return null}static CreateClipsFromMorphTargetSequences(e,n,r){const i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const d=u[1];let f=i[d];f||(i[d]=f=[]),f.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return o}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(d,f,h,A,p){if(h.length!==0){const m=[],g=[];yW(h,m,g,A),m.length!==0&&p.push(new d(f,m,g))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d<c.length;d++){const f=c[d].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const h={};let A;for(A=0;A<f.length;A++)if(f[A].morphTargets)for(let p=0;p<f[A].morphTargets.length;p++)h[f[A].morphTargets[p]]=-1;for(const p in h){const m=[],g=[];for(let y=0;y!==f[A].morphTargets.length;++y){const w=f[A];m.push(w.time),g.push(w.morphTarget===p?1:0)}i.push(new Bm(".morphTargetInfluence["+p+"]",m,g))}l=h.length*o}else{const h=".bones["+n[d].name+"]";r(km,h+".position",f,"pos",i),r(Mm,h+".quaternion",f,"rot",i),r(km,h+".scale",f,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}resetDuration(){const e=this.tracks;let n=0;for(let r=0,i=e.length;r!==i;++r){const s=this.tracks[r];n=Math.max(n,s.times[s.times.length-1])}return this.duration=n,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let n=0;n<this.tracks.length;n++)e=e&&this.tracks[n].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function nhe(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Bm;case"vector":case"vector2":case"vector3":case"vector4":return km;case"color":return vW;case"quaternion":return Mm;case"bool":case"boolean":return _g;case"string":return Sg}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function rhe(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=nhe(t.type);if(t.times===void 0){const n=[],r=[];yW(t.keys,n,r,"value"),t.times=n,t.values=r}return e.parse!==void 0?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const od={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class ihe{constructor(e,n,r){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=r,this.itemStart=function(u){a++,s===!1&&i.onStart!==void 0&&i.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,d){return c.push(u,d),this},this.removeHandler=function(u){const d=c.indexOf(u);return d!==-1&&c.splice(d,2),this},this.getHandler=function(u){for(let d=0,f=c.length;d<f;d+=2){const h=c[d],A=c[d+1];if(h.global&&(h.lastIndex=0),h.test(u))return A}return null}}}const she=new ihe;class sA{constructor(e){this.manager=e!==void 0?e:she,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,n){const r=this;return new Promise(function(i,s){r.load(e,i,n,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}sA.DEFAULT_MATERIAL_NAME="__DEFAULT";const wc={};class ohe extends Error{constructor(e,n){super(e),this.response=n}}class DC extends sA{constructor(e){super(e)}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=od.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(wc[e]!==void 0){wc[e].push({onLoad:n,onProgress:r,onError:i});return}wc[e]=[],wc[e].push({onLoad:n,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=wc[e],d=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),h=f?parseInt(f):0,A=h!==0;let p=0;const m=new ReadableStream({start(g){y();function y(){d.read().then(({done:w,value:v})=>{if(w)g.close();else{p+=v.byteLength;const x=new ProgressEvent("progress",{lengthComputable:A,loaded:p,total:h});for(let C=0,_=u.length;C<_;C++){const S=u[C];S.onProgress&&S.onProgress(x)}g.enqueue(v),y()}},w=>{g.error(w)})}}});return new Response(m)}else throw new ohe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),f=d&&d[1]?d[1].toLowerCase():void 0,h=new TextDecoder(f);return c.arrayBuffer().then(A=>h.decode(A))}}}).then(c=>{od.add(e,c);const u=wc[e];delete wc[e];for(let d=0,f=u.length;d<f;d++){const h=u[d];h.onLoad&&h.onLoad(c)}}).catch(c=>{const u=wc[e];if(u===void 0)throw this.manager.itemError(e),c;delete wc[e];for(let d=0,f=u.length;d<f;d++){const h=u[d];h.onError&&h.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class ahe extends sA{constructor(e){super(e)}load(e,n,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=od.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o;const a=Y1("img");function l(){u(),od.add(e,this),n&&n(this),s.manager.itemEnd(e)}function c(d){u(),i&&i(d),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class bW extends sA{constructor(e){super(e)}load(e,n,r,i){const s=new Oi,o=new ahe(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,n!==void 0&&n(s)},r,i),s}}class US extends Sr{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Nt(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}}const aT=new Zt,qN=new de,XN=new de;class AL{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ze(512,512),this.map=null,this.mapPass=null,this.matrix=new Zt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new tL,this._frameExtents=new Ze(1,1),this._viewportCount=1,this._viewports=[new Jn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;qN.setFromMatrixPosition(e.matrixWorld),n.position.copy(qN),XN.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(XN),n.updateMatrixWorld(),aT.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(aT),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(aT)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class lhe extends AL{constructor(){super(new Fn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const n=this.camera,r=Em*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||n.far;(r!==n.fov||i!==n.aspect||s!==n.far)&&(n.fov=r,n.aspect=i,n.far=s,n.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class che extends US{constructor(e,n,r=0,i=Math.PI/3,s=0,o=2){super(e,n),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Sr.DEFAULT_UP),this.updateMatrix(),this.target=new Sr,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new lhe}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const YN=new Zt,t0=new de,lT=new de;class uhe extends AL{constructor(){super(new Fn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ze(4,2),this._viewportCount=6,this._viewports=[new Jn(2,1,1,1),new Jn(0,1,1,1),new Jn(3,1,1,1),new Jn(1,1,1,1),new Jn(3,0,1,1),new Jn(1,0,1,1)],this._cubeDirections=[new de(1,0,0),new de(-1,0,0),new de(0,0,1),new de(0,0,-1),new de(0,1,0),new de(0,-1,0)],this._cubeUps=[new de(0,1,0),new de(0,1,0),new de(0,1,0),new de(0,1,0),new de(0,0,1),new de(0,0,-1)]}updateMatrices(e,n=0){const r=this.camera,i=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),t0.setFromMatrixPosition(e.matrixWorld),r.position.copy(t0),lT.copy(r.position),lT.add(this._cubeDirections[n]),r.up.copy(this._cubeUps[n]),r.lookAt(lT),r.updateMatrixWorld(),i.makeTranslation(-t0.x,-t0.y,-t0.z),YN.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(YN)}}class dhe extends US{constructor(e,n,r=0,i=2){super(e,n),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new uhe}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class fhe extends AL{constructor(){super(new $r(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class B0 extends US{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Sr.DEFAULT_UP),this.updateMatrix(),this.target=new Sr,this.shadow=new fhe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class hhe extends US{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class h1{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let r=0,i=e.length;r<i;r++)n+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(n))}catch{return n}}static extractUrlBase(e){const n=e.lastIndexOf("/");return n===-1?"./":e.slice(0,n+1)}static resolveURL(e,n){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(n)&&/^\//.test(e)&&(n=n.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:n+e)}}class Ahe extends sA{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=od.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return od.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),od.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});od.add(e,l),s.manager.itemStart(e)}}class phe{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=JN(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=JN();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function JN(){return(typeof performance>"u"?Date:performance).now()}const pL="\\[\\]\\.:\\/",mhe=new RegExp("["+pL+"]","g"),mL="[^"+pL+"]",ghe="[^"+pL.replace("\\.","")+"]",yhe=/((?:WC+[\/:])*)/.source.replace("WC",mL),vhe=/(WCOD+)?/.source.replace("WCOD",ghe),bhe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",mL),whe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",mL),xhe=new RegExp("^"+yhe+vhe+bhe+whe+"$"),Che=["material","materials","bones","map"];class _he{constructor(e,n,r){const i=r||Kn.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,i)}getValue(e,n){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,n)}setValue(e,n){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].unbind()}}class Kn{constructor(e,n,r){this.path=n,this.parsedPath=r||Kn.parseTrackName(n),this.node=Kn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,r){return e&&e.isAnimationObjectGroup?new Kn.Composite(e,n,r):new Kn(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(mhe,"")}static parseTrackName(e){const n=xhe.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);Che.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===n||a.uuid===n)return a;const l=r(a.children);if(l)return l}return null},i=r(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,n){e[n]=this.targetObject[this.propertyName]}_getValue_array(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)e[n++]=r[i]}_getValue_arrayElement(e,n){e[n]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,n){this.resolvedProperty.toArray(e,n)}_setValue_direct(e,n){this.targetObject[this.propertyName]=e[n]}_setValue_direct_setNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++]}_setValue_array_setNeedsUpdate(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,n){this.resolvedProperty[this.propertyIndex]=e[n]}_setValue_arrayElement_setNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,n){this.resolvedProperty.fromArray(e,n)}_setValue_fromArray_setNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,n){this.bind(),this.getValue(e,n)}_setValue_unbound(e,n){this.bind(),this.setValue(e,n)}bind(){let e=this.node;const n=this.parsedPath,r=n.objectName,i=n.propertyName;let s=n.propertyIndex;if(e||(e=Kn.findNode(this.rootNode,n.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=n.objectIndex;switch(r){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[i];if(o===void 0){const c=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Kn.Composite=_he;Kn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Kn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Kn.prototype.GetterByBindingType=[Kn.prototype._getValue_direct,Kn.prototype._getValue_array,Kn.prototype._getValue_arrayElement,Kn.prototype._getValue_toArray];Kn.prototype.SetterByBindingTypeAndVersioning=[[Kn.prototype._setValue_direct,Kn.prototype._setValue_direct_setNeedsUpdate,Kn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Kn.prototype._setValue_array,Kn.prototype._setValue_array_setNeedsUpdate,Kn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Kn.prototype._setValue_arrayElement,Kn.prototype._setValue_arrayElement_setNeedsUpdate,Kn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Kn.prototype._setValue_fromArray,Kn.prototype._setValue_fromArray_setNeedsUpdate,Kn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];const ZN=new Zt;class RM{constructor(e,n,r=0,i=1/0){this.ray=new wg(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new eL,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):console.error("THREE.Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return ZN.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ZN),this}intersectObject(e,n=!0,r=[]){return PM(e,this,r,n),r.sort(eD),r}intersectObjects(e,n=!0,r=[]){for(let i=0,s=e.length;i<s;i++)PM(e[i],this,r,n);return r.sort(eD),r}}function eD(t,e){return t.distance-e.distance}function PM(t,e,n,r){let i=!0;if(t.layers.test(e.layers)&&t.raycast(e,n)===!1&&(i=!1),i===!0&&r===!0){const s=t.children;for(let o=0,a=s.length;o<a;o++)PM(s[o],e,n,!0)}}class LM{constructor(e=1,n=0,r=0){return this.radius=e,this.phi=n,this.theta=r,this}set(e,n,r){return this.radius=e,this.phi=n,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+n*n+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(yi(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class wW extends lL{constructor(e=10,n=10,r=4473924,i=8947848){r=new Nt(r),i=new Nt(i);const s=n/2,o=e/n,a=e/2,l=[],c=[];for(let f=0,h=0,A=-a;f<=n;f++,A+=o){l.push(-a,0,A,a,0,A),l.push(A,0,-a,A,0,a);const p=f===s?r:i;p.toArray(c,h),h+=3,p.toArray(c,h),h+=3,p.toArray(c,h),h+=3,p.toArray(c,h),h+=3}const u=new Ai;u.setAttribute("position",new hi(l,3)),u.setAttribute("color",new hi(c,3));const d=new Cg({vertexColors:!0,toneMapped:!1});super(u,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:zP}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=zP);let Ye;const xW=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&xW.decode();let M0=null;function Xp(){return(M0===null||M0.byteLength===0)&&(M0=new Uint8Array(Ye.memory.buffer)),M0}function fr(t,e){return t=t>>>0,xW.decode(Xp().subarray(t,t+e))}let ar=0;const Cx=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},She=typeof Cx.encodeInto=="function"?function(t,e){return Cx.encodeInto(t,e)}:function(t,e){const n=Cx.encode(t);return e.set(n),{read:t.length,written:n.length}};function Ur(t,e,n){if(n===void 0){const a=Cx.encode(t),l=e(a.length,1)>>>0;return Xp().subarray(l,l+a.length).set(a),ar=a.length,l}let r=t.length,i=e(r,1)>>>0;const s=Xp();let o=0;for(;o<r;o++){const a=t.charCodeAt(o);if(a>127)break;s[i+o]=a}if(o!==r){o!==0&&(t=t.slice(o)),i=n(i,r,r=o+t.length*3,1)>>>0;const a=Xp().subarray(i+o,i+r),l=She(t,a);o+=l.written,i=n(i,r,o,1)>>>0}return ar=o,i}function _x(t){return t==null}let Kf=null;function ii(){return(Kf===null||Kf.buffer.detached===!0||Kf.buffer.detached===void 0&&Kf.buffer!==Ye.memory.buffer)&&(Kf=new DataView(Ye.memory.buffer)),Kf}function IM(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const i=t.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){const i=t.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){const i=t.length;let s="[";i>0&&(s+=IM(t[0]));for(let o=1;o<i;o++)s+=", "+IM(t[o]);return s+="]",s}const n=/\[object ([^\]]+)\]/.exec(toString.call(t));let r;if(n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
${t.stack}`:r}const tD=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{Ye.__wbindgen_export_3.get(t.dtor)(t.a,t.b)});function Ehe(t,e,n,r){const i={a:t,b:e,cnt:1,dtor:n},s=(...o)=>{i.cnt++;const a=i.a;i.a=0;try{return r(a,i.b,...o)}finally{--i.cnt===0?(Ye.__wbindgen_export_3.get(i.dtor)(a,i.b),tD.unregister(i)):i.a=a}};return s.original=i,tD.register(s,i,i),s}function The(t,e,n){Ye.closure6380_externref_shim(t,e,n)}function Bhe(t,e,n,r,i,s,o,a){const l=Ur(t,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),c=ar,u=Ur(e,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),d=ar,f=Ur(n,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),h=ar,A=Ur(r,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),p=ar;var m=_x(o)?0:Ur(o,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),g=ar;return Ye.execute_wasm(l,c,u,d,f,h,A,p,i,s,m,g,a)}function Mhe(t){const e=Ur(t,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),n=ar;return Ye.kcl_lint(e,n)}function khe(t){return Ye.make_default_planes(t)}function Rhe(t,e){return Ye.modify_grid(t,e)}function Phe(t,e){const n=e(t.length*1,1)>>>0;return Xp().set(t,n/1),ar=t.length,n}function Di(t){const e=Ye.__wbindgen_export_2.get(t);return Ye.__externref_table_dealloc(t),e}function CW(t){const e=Phe(t,Ye.__wbindgen_malloc),n=ar,r=Ye.deserialize_files(e,n);if(r[2])throw Di(r[1]);return Di(r[0])}function Lhe(t){const e=Ur(t,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),n=ar,r=Ye.parse_wasm(e,n);if(r[2])throw Di(r[1]);return Di(r[0])}function Ihe(t){const e=Ur(t,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),n=ar,r=Ye.recast_wasm(e,n);if(r[2])throw Di(r[1]);return Di(r[0])}function OM(t){const e=Ye.__externref_table_alloc();return Ye.__wbindgen_export_2.set(e,t),e}function Ohe(t,e,n,r,i,s,o){const a=Ye.get_tangential_arc_to_info(t,e,n,r,i,s,o);return gL.__wrap(a)}function Fhe(){const t=Ye.program_memory_init();if(t[2])throw Di(t[1]);return Di(t[0])}function Nhe(t){return Ye.coredump(t)}function Dhe(){const t=Ye.default_app_settings();if(t[2])throw Di(t[1]);return Di(t[0])}function Uhe(t){const e=Ur(t,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),n=ar,r=Ye.parse_app_settings(e,n);if(r[2])throw Di(r[1]);return Di(r[0])}function Hhe(){const t=Ye.default_project_settings();if(t[2])throw Di(t[1]);return Di(t[0])}function jhe(t){const e=Ur(t,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),n=ar,r=Ye.parse_project_settings(e,n);if(r[2])throw Di(r[1]);return Di(r[0])}function Qhe(t,e){return t=t>>>0,Xp().subarray(t/1,t/1+e)}function zhe(t){const e=Ur(t,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),n=ar,r=Ye.base64_decode(e,n);if(r[3])throw Di(r[2]);var i=Qhe(r[0],r[1]).slice();return Ye.__wbindgen_free(r[0],r[1]*1,1),i}function Vhe(t){let e,n;try{const s=Ur(t,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),o=ar,a=Ye.toml_stringify(s,o);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,Di(a[2]);return e=r,n=i,fr(r,i)}finally{Ye.__wbindgen_free(e,n,1)}}function qt(t,e){try{return t.apply(this,e)}catch(n){const r=OM(n);Ye.__wbindgen_exn_store(r)}}function nD(t){return()=>{throw new Error(`${t} is not defined`)}}function Ghe(t,e,n,r){Ye.closure7339_externref_shim(t,e,n,r)}const Whe=["omit","same-origin","include"],Khe=["same-origin","no-cors","cors","navigate"];typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Ye.__wbg_intounderlyingbytesource_free(t>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Ye.__wbg_intounderlyingsink_free(t>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Ye.__wbg_intounderlyingsource_free(t>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Ye.__wbg_serverconfig_free(t>>>0,1));const rD=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ye.__wbg_tangentialarcinfooutputwasm_free(t>>>0,1));class gL{static __wrap(e){e=e>>>0;const n=Object.create(gL.prototype);return n.__wbg_ptr=e,rD.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,rD.unregister(this),e}free(){const e=this.__destroy_into_raw();Ye.__wbg_tangentialarcinfooutputwasm_free(e,0)}get center_x(){return Ye.__wbg_get_tangentialarcinfooutputwasm_center_x(this.__wbg_ptr)}set center_x(e){Ye.__wbg_set_tangentialarcinfooutputwasm_center_x(this.__wbg_ptr,e)}get center_y(){return Ye.__wbg_get_tangentialarcinfooutputwasm_center_y(this.__wbg_ptr)}set center_y(e){Ye.__wbg_set_tangentialarcinfooutputwasm_center_y(this.__wbg_ptr,e)}get arc_mid_point_x(){return Ye.__wbg_get_tangentialarcinfooutputwasm_arc_mid_point_x(this.__wbg_ptr)}set arc_mid_point_x(e){Ye.__wbg_set_tangentialarcinfooutputwasm_arc_mid_point_x(this.__wbg_ptr,e)}get arc_mid_point_y(){return Ye.__wbg_get_tangentialarcinfooutputwasm_arc_mid_point_y(this.__wbg_ptr)}set arc_mid_point_y(e){Ye.__wbg_set_tangentialarcinfooutputwasm_arc_mid_point_y(this.__wbg_ptr,e)}get radius(){return Ye.__wbg_get_tangentialarcinfooutputwasm_radius(this.__wbg_ptr)}set radius(e){Ye.__wbg_set_tangentialarcinfooutputwasm_radius(this.__wbg_ptr,e)}get start_angle(){return Ye.__wbg_get_tangentialarcinfooutputwasm_start_angle(this.__wbg_ptr)}set start_angle(e){Ye.__wbg_set_tangentialarcinfooutputwasm_start_angle(this.__wbg_ptr,e)}get end_angle(){return Ye.__wbg_get_tangentialarcinfooutputwasm_end_angle(this.__wbg_ptr)}set end_angle(e){Ye.__wbg_set_tangentialarcinfooutputwasm_end_angle(this.__wbg_ptr,e)}get ccw(){return Ye.__wbg_get_tangentialarcinfooutputwasm_ccw(this.__wbg_ptr)}set ccw(e){Ye.__wbg_set_tangentialarcinfooutputwasm_ccw(this.__wbg_ptr,e)}get arc_length(){return Ye.__wbg_get_tangentialarcinfooutputwasm_arc_length(this.__wbg_ptr)}set arc_length(e){Ye.__wbg_set_tangentialarcinfooutputwasm_arc_length(this.__wbg_ptr,e)}}async function $he(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function qhe(){const t={};return t.wbg={},t.wbg.__wbindgen_string_new=function(e,n){return fr(e,n)},t.wbg.__wbindgen_cb_drop=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbindgen_string_get=function(e,n){const r=n,i=typeof r=="string"?r:void 0;var s=_x(i)?0:Ur(i,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),o=ar;ii().setInt32(e+4*1,o,!0),ii().setInt32(e+4*0,s,!0)},t.wbg.__wbindgen_error_new=function(e,n){return new Error(fr(e,n))},t.wbg.__wbindgen_is_undefined=function(e){return e===void 0},t.wbg.__wbg_new_abda76e883ba8a5f=function(){return new Error},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=n.stack,i=Ur(r,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),s=ar;ii().setInt32(e+4*1,s,!0),ii().setInt32(e+4*0,i,!0)},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(fr(e,n))}finally{Ye.__wbindgen_free(r,i,1)}},t.wbg.__wbg_authToken_12dd1b02462da0a9=function(){return qt(function(e,n){const r=n.authToken(),i=Ur(r,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),s=ar;ii().setInt32(e+4*1,s,!0),ii().setInt32(e+4*0,i,!0)},arguments)},t.wbg.__wbg_baseApiUrl_6954185f462555e0=function(){return qt(function(e,n){const r=n.baseApiUrl(),i=Ur(r,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),s=ar;ii().setInt32(e+4*1,s,!0),ii().setInt32(e+4*0,i,!0)},arguments)},t.wbg.__wbg_version_a6eaf88f1592176f=function(){return qt(function(e,n){const r=n.version(),i=Ur(r,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),s=ar;ii().setInt32(e+4*1,s,!0),ii().setInt32(e+4*0,i,!0)},arguments)},t.wbg.__wbg_kclCode_29834ec9afd09767=function(){return qt(function(e,n){const r=n.kclCode(),i=Ur(r,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),s=ar;ii().setInt32(e+4*1,s,!0),ii().setInt32(e+4*0,i,!0)},arguments)},t.wbg.__wbg_pool_aedf8def177cc085=function(){return qt(function(e,n){const r=n.pool(),i=Ur(r,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),s=ar;ii().setInt32(e+4*1,s,!0),ii().setInt32(e+4*0,i,!0)},arguments)},t.wbg.__wbg_getOsInfo_7fd0d1abcda2ad77=function(){return qt(function(e,n){const r=n.getOsInfo(),i=Ur(r,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),s=ar;ii().setInt32(e+4*1,s,!0),ii().setInt32(e+4*0,i,!0)},arguments)},t.wbg.__wbg_isDesktop_2045a6e15d9a4697=function(){return qt(function(e){return e.isDesktop()},arguments)},t.wbg.__wbg_getWebrtcStats_246dd7a7c2d18855=function(){return qt(function(e){return e.getWebrtcStats()},arguments)},t.wbg.__wbg_getClientState_9f66967c9be23e9a=function(){return qt(function(e){return e.getClientState()},arguments)},t.wbg.__wbg_screenshot_45bb6ec5c7193dbb=function(){return qt(function(e){return e.screenshot()},arguments)},t.wbg.__wbg_wasmGetDefaultPlanes_a92f7f8422265442=function(){return qt(function(e){return e.wasmGetDefaultPlanes()},arguments)},t.wbg.__wbg_clearDefaultPlanes_636c37fe37726f75=function(){return qt(function(e){e.clearDefaultPlanes()},arguments)},t.wbg.__wbg_startNewSession_cac3dfd9e41b1c40=function(){return qt(function(e){return e.startNewSession()},arguments)},t.wbg.__wbg_sendModelingCommandFromWasm_b6059f729d3ae52d=function(){return qt(function(e,n,r,i,s,o,a,l,c){let u,d,f,h,A,p,m,g;try{return u=n,d=r,f=i,h=s,A=o,p=a,m=l,g=c,e.sendModelingCommandFromWasm(fr(n,r),fr(i,s),fr(o,a),fr(l,c))}finally{Ye.__wbindgen_free(u,d,1),Ye.__wbindgen_free(f,h,1),Ye.__wbindgen_free(A,p,1),Ye.__wbindgen_free(m,g,1)}},arguments)},t.wbg.__wbg_readFile_9c77d4a61f7906a1=function(){return qt(function(e,n,r){let i,s;try{return i=n,s=r,e.readFile(fr(n,r))}finally{Ye.__wbindgen_free(i,s,1)}},arguments)},t.wbg.__wbg_exists_3f47aafed86243bd=function(){return qt(function(e,n,r){let i,s;try{return i=n,s=r,e.exists(fr(n,r))}finally{Ye.__wbindgen_free(i,s,1)}},arguments)},t.wbg.__wbg_getAllFiles_9badfe304b047881=function(){return qt(function(e,n,r){let i,s;try{return i=n,s=r,e.getAllFiles(fr(n,r))}finally{Ye.__wbindgen_free(i,s,1)}},arguments)},t.wbg.__wbindgen_boolean_get=function(e){const n=e;return typeof n=="boolean"?n?1:0:2},t.wbg.__wbg_fetch_f8d735ba6fe1b719=typeof fetch=="function"?fetch:nD("fetch"),t.wbg.__wbg_queueMicrotask_f94325d4468bfb98=typeof queueMicrotask=="function"?queueMicrotask:nD("queueMicrotask"),t.wbg.__wbg_queueMicrotask_e7bd49216a137e8f=function(e){return e.queueMicrotask},t.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},t.wbg.__wbg_crypto_1d1f22824a6a080c=function(e){return e.crypto},t.wbg.__wbindgen_is_object=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbg_process_4a72847cc503995b=function(e){return e.process},t.wbg.__wbg_versions_f686565e586dd935=function(e){return e.versions},t.wbg.__wbg_node_104a2ff8d6ea03a2=function(e){return e.node},t.wbg.__wbindgen_is_string=function(e){return typeof e=="string"},t.wbg.__wbg_require_cca90b1a94a0255b=function(){return qt(function(){return module.require},arguments)},t.wbg.__wbg_msCrypto_eb05e62b530a1508=function(e){return e.msCrypto},t.wbg.__wbg_randomFillSync_5c9c955aa56b6049=function(){return qt(function(e,n){e.randomFillSync(n)},arguments)},t.wbg.__wbg_getRandomValues_3aa56aa6edec874c=function(){return qt(function(e,n){e.getRandomValues(n)},arguments)},t.wbg.__wbg_fetch_1fdc4448ed9eec00=function(e,n){return e.fetch(n)},t.wbg.__wbg_signal_9acfcec9e7dffc22=function(e){return e.signal},t.wbg.__wbg_new_75169ae5a9683c55=function(){return qt(function(){return new AbortController},arguments)},t.wbg.__wbg_abort_c57daab47a6c1215=function(e){e.abort()},t.wbg.__wbg_newwithu8arraysequenceandoptions_d41c0fdf78490206=function(){return qt(function(e,n){return new Blob(e,n)},arguments)},t.wbg.__wbg_ready_b946f0c6dacc9233=function(e){return e.ready},t.wbg.__wbg_close_949410ec7b6cba9f=function(e){return e.close()},t.wbg.__wbg_releaseLock_39977506928e60f7=function(e){e.releaseLock()},t.wbg.__wbg_write_8516d1ea4c89b39d=function(e,n){return e.write(n)},t.wbg.__wbg_instanceof_Response_3c0e210a57ff751d=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_url_58af972663531d16=function(e,n){const r=n.url,i=Ur(r,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),s=ar;ii().setInt32(e+4*1,s,!0),ii().setInt32(e+4*0,i,!0)},t.wbg.__wbg_status_5f4e900d22140a18=function(e){return e.status},t.wbg.__wbg_headers_1b9bf90c73fae600=function(e){return e.headers},t.wbg.__wbg_text_ebeee8b31af4c919=function(){return qt(function(e){return e.text()},arguments)},t.wbg.__wbg_view_de0e81c5c00d2129=function(e){const n=e.view;return _x(n)?0:OM(n)},t.wbg.__wbg_respond_ffb6928cd9b79c32=function(){return qt(function(e,n){e.respond(n>>>0)},arguments)},t.wbg.__wbg_settype_623d2ee701e6310a=function(e,n,r){e.type=fr(n,r)},t.wbg.__wbg_setbody_aa8b691bec428bf4=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_a4e661320cdb9738=function(e,n){e.credentials=Whe[n]},t.wbg.__wbg_setheaders_f5205d36e423a544=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_ce2da76000b02f6a=function(e,n,r){e.method=fr(n,r)},t.wbg.__wbg_setmode_4919fd636102c586=function(e,n){e.mode=Khe[n]},t.wbg.__wbg_setsignal_812ccb8269a7fd90=function(e,n){e.signal=n},t.wbg.__wbg_new_a9ae04a5200606a5=function(){return qt(function(){return new Headers},arguments)},t.wbg.__wbg_append_8b3e7f74a47ea7d5=function(){return qt(function(e,n,r,i,s){e.append(fr(n,r),fr(i,s))},arguments)},t.wbg.__wbg_newwithstrandinit_4b92c89af0a8e383=function(){return qt(function(e,n,r){return new Request(fr(e,n),r)},arguments)},t.wbg.__wbg_new_4e7308fbedde3997=function(){return qt(function(){return new FormData},arguments)},t.wbg.__wbg_append_7ee78799a92a9731=function(){return qt(function(e,n,r,i){e.append(fr(n,r),i)},arguments)},t.wbg.__wbg_append_8135c71037096394=function(){return qt(function(e,n,r,i,s,o){e.append(fr(n,r),i,fr(s,o))},arguments)},t.wbg.__wbg_append_43a4b1c9d5df4168=function(){return qt(function(e,n,r,i,s){e.append(fr(n,r),fr(i,s))},arguments)},t.wbg.__wbg_close_cfd08d9cf9f36856=function(){return qt(function(e){e.close()},arguments)},t.wbg.__wbg_enqueue_e693a6fb4f3261c1=function(){return qt(function(e,n){e.enqueue(n)},arguments)},t.wbg.__wbg_getWriter_2fe953e01e7ca9c5=function(){return qt(function(e){return e.getWriter()},arguments)},t.wbg.__wbg_byobRequest_86ac467c94924d3c=function(e){const n=e.byobRequest;return _x(n)?0:OM(n)},t.wbg.__wbg_close_7cda9dd901230214=function(){return qt(function(e){e.close()},arguments)},t.wbg.__wbg_new_034f913e7636e987=function(){return new Array},t.wbg.__wbg_newnoargs_1ede4bf2ebbaaf43=function(e,n){return new Function(fr(e,n))},t.wbg.__wbg_next_13b477da1eaa3897=function(e){return e.next},t.wbg.__wbg_next_b06e115d1b01e10b=function(){return qt(function(e){return e.next()},arguments)},t.wbg.__wbg_done_983b5ffcaec8c583=function(e){return e.done},t.wbg.__wbg_value_2ab8a198c834c26a=function(e){return e.value},t.wbg.__wbg_iterator_695d699a44d6234c=function(){return Symbol.iterator},t.wbg.__wbg_get_ef828680c64da212=function(){return qt(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_call_a9ef466721e824f2=function(){return qt(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_new_e69b5f66fda8f13c=function(){return new Object},t.wbg.__wbg_self_bf91bf94d9e04084=function(){return qt(function(){return self.self},arguments)},t.wbg.__wbg_window_52dd9f07d03fd5f8=function(){return qt(function(){return window.window},arguments)},t.wbg.__wbg_globalThis_05c129bf37fcf1be=function(){return qt(function(){return globalThis.globalThis},arguments)},t.wbg.__wbg_global_3eca19bb09e9c484=function(){return qt(function(){return global.global},arguments)},t.wbg.__wbg_push_36cf4d81d7da33d1=function(e,n){return e.push(n)},t.wbg.__wbg_new_70a2f23d1565c04c=function(e,n){return new Error(fr(e,n))},t.wbg.__wbg_toString_4b677455b9167e31=function(e){return e.toString()},t.wbg.__wbg_call_3bfa248576352471=function(){return qt(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_next_3903305faa61ec71=function(){return qt(function(e){return e.next()},arguments)},t.wbg.__wbg_getTime_41225036a0393d63=function(e){return e.getTime()},t.wbg.__wbg_new0_218ada33b570be35=function(){return new Date},t.wbg.__wbg_toString_aea130fe68d19e1a=function(e){return e.toString()},t.wbg.__wbg_new_1073970097e5a420=function(e,n){try{var r={a:e,b:n},i=(o,a)=>{const l=r.a;r.a=0;try{return Ghe(l,r.b,o,a)}finally{r.a=l}};return new Promise(i)}finally{r.a=r.b=0}},t.wbg.__wbg_resolve_0aad7c1484731c99=function(e){return Promise.resolve(e)},t.wbg.__wbg_then_748f75edfb032440=function(e,n){return e.then(n)},t.wbg.__wbg_then_4866a7d9f55d8f3e=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_buffer_ccaed51a635d8a2d=function(e){return e.buffer},t.wbg.__wbg_newwithbyteoffsetandlength_7e3eb787208af730=function(e,n,r){return new Uint8Array(e,n>>>0,r>>>0)},t.wbg.__wbg_new_fec2611eb9180f95=function(e){return new Uint8Array(e)},t.wbg.__wbg_set_ec2fcf81bc573fd9=function(e,n,r){e.set(n,r>>>0)},t.wbg.__wbg_length_9254c4bd3b9f23c4=function(e){return e.length},t.wbg.__wbg_instanceof_Uint8Array_df0761410414ef36=function(e){let n;try{n=e instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbg_newwithlength_76462a666eca145f=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_buffer_95102df5554646dc=function(e){return e.buffer},t.wbg.__wbg_subarray_975a06f9dbd16995=function(e,n,r){return e.subarray(n>>>0,r>>>0)},t.wbg.__wbg_byteLength_5d623ba3d92a3a9c=function(e){return e.byteLength},t.wbg.__wbg_byteOffset_ec0928143c619cd7=function(e){return e.byteOffset},t.wbg.__wbg_has_bd717f25f195f23d=function(){return qt(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbg_parse_51ee5409072379d3=function(){return qt(function(e,n){return JSON.parse(fr(e,n))},arguments)},t.wbg.__wbg_stringify_eead5648c09faaf8=function(){return qt(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbindgen_debug_string=function(e,n){const r=IM(n),i=Ur(r,Ye.__wbindgen_malloc,Ye.__wbindgen_realloc),s=ar;ii().setInt32(e+4*1,s,!0),ii().setInt32(e+4*0,i,!0)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(fr(e,n))},t.wbg.__wbindgen_memory=function(){return Ye.memory},t.wbg.__wbindgen_closure_wrapper15872=function(e,n,r){return Ehe(e,n,6381,The)},t.wbg.__wbindgen_init_externref_table=function(){const e=Ye.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t}function Xhe(t,e){return Ye=t.exports,_W.__wbindgen_wasm_module=e,Kf=null,M0=null,Ye.__wbindgen_start(),Ye}async function _W(t){if(Ye!==void 0)return Ye;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("/assets/wasm_lib_bg-DGWGQTDM.wasm",import.meta.url));const e=qhe();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await $he(await t,e);return Xhe(n,r)}const SW=1024;let Yhe=0,cT=class{constructor(e,n){this.from=e,this.to=n}};class fn{constructor(e={}){this.id=Yhe++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=mo.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}fn.closedBy=new fn({deserialize:t=>t.split(" ")});fn.openedBy=new fn({deserialize:t=>t.split(" ")});fn.group=new fn({deserialize:t=>t.split(" ")});fn.isolate=new fn({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});fn.contextHash=new fn({perNode:!0});fn.lookAhead=new fn({perNode:!0});fn.mounted=new fn({perNode:!0});class UC{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[fn.mounted.id]}}const Jhe=Object.create(null);class mo{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):Jhe,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new mo(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(fn.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(fn.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}mo.none=new mo("",Object.create(null),0,8);class yL{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);o&&(i||(i=Object.assign({},r.props)),i[o[0].id]=o[1])}n.push(i?new mo(r.name,i,r.id,r.flags):r)}return new yL(n)}}const Lb=new WeakMap,iD=new WeakMap;var Pi;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(Pi||(Pi={}));class fi{constructor(e,n,r,i,s){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=UC.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new NM(this.topNode,e)}cursorAt(e,n=0,r=0){let i=Lb.get(this)||this.topNode,s=new NM(i);return s.moveTo(e,n),Lb.set(this,s._tree),s}get topNode(){return new ga(this,0,0,null)}resolve(e,n=0){let r=ny(Lb.get(this)||this.topNode,e,n,!1);return Lb.set(this,r),r}resolveInner(e,n=0){let r=ny(iD.get(this)||this.topNode,e,n,!0);return iD.set(this,r),r}resolveStack(e,n=0){return tAe(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&Pi.IncludeAnonymous)>0;for(let l=this.cursor(o|Pi.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:wL(mo.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new fi(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new fi(mo.none,n,r,i)))}static build(e){return nAe(e)}}fi.empty=new fi(mo.none,[],[],0);class vL{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new vL(this.buffer,this.index)}}class ef{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return mo.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,n,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(EW(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new ef(s,o,this.set)}}function EW(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function ny(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof ga&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:Pi.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof ga&&o.index<0&&((i=a.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class TW{cursor(e=0){return new NM(this,e)}getChild(e,n=null,r=null){let i=sD(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return sD(this,e,n,r)}resolve(e,n=0){return ny(this,e,n,!1)}resolveInner(e,n=0){return ny(this,e,n,!0)}matchContext(e){return FM(this,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class ga extends TW{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;e!=c;e+=n){let u=a[e],d=l[e]+o.from;if(EW(i,r,d,d+u.length)){if(u instanceof ef){if(s&Pi.ExcludeBuffers)continue;let f=u.findChild(0,u.buffer.length,n,r-d,i);if(f>-1)return new ad(new Zhe(o,u,e,d),null,f)}else if(s&Pi.IncludeAnonymous||!u.type.isAnonymous||bL(u)){let f;if(!(s&Pi.IgnoreMounts)&&(f=UC.get(u))&&!f.overlay)return new ga(f.tree,d,e,o);let h=new ga(u,d,e,o);return s&Pi.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(n<0?u.children.length-1:0,n,r,i)}}}if(s&Pi.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r&Pi.IgnoreOverlays)&&(i=UC.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((n>0?o<=s:o<s)&&(n<0?a>=s:a>s))return new ga(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function sD(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function FM(t,e,n=e.length-1){for(let r=t.parent;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class Zhe{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class ad extends TW{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new ad(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Pi.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new ad(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ad(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new ad(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new fi(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function BW(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof ga&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new eAe(i,n)}class eAe{constructor(e,n){this.heads=e,this.node=n}get next(){return BW(this.heads)}}function tAe(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof ga?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,n)),s=o}else{let o=UC.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new ga(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(ny(a,e,n,!1))}}return i?BW(i):r}class NM{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof ga)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof ga?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Pi.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Pi.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Pi.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&Pi.IncludeAnonymous||a instanceof ef||!a.type.isAnonymous||bL(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new ad(this.buffer,n,this.stack[i]);return this.bufferNode=new ad(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;i&&n&&n(this),i=this.type.isAnonymous,!this.nextSibling();){if(!r)return;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return FM(this.node,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return FM(this.node,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function bL(t){return t.children.some(e=>e instanceof ef||!e.type.isAnonymous||bL(e))}function nAe(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=SW,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new vL(n,n.length):n,l=r.types,c=0,u=0;function d(x,C,_,S,E,T){let{id:R,start:k,end:B,size:M}=a,F=u;for(;M<0;)if(a.next(),M==-1){let ee=s[R];_.push(ee),S.push(k-x);return}else if(M==-3){c=R;return}else if(M==-4){u=R;return}else throw new RangeError(`Unrecognized record size: ${M}`);let I=l[R],z,Y,$=k-x;if(B-k<=i&&(Y=m(a.pos-C,E))){let ee=new Uint16Array(Y.size-Y.skip),W=a.pos-Y.size,ne=ee.length;for(;a.pos>W;)ne=g(Y.start,ee,ne);z=new ef(ee,B-Y.start,r),$=Y.start-x}else{let ee=a.pos-M;a.next();let W=[],ne=[],Se=R>=o?R:-1,fe=0,ge=B;for(;a.pos>ee;)Se>=0&&a.id==Se&&a.size>=0?(a.end<=ge-i&&(A(W,ne,k,fe,a.end,ge,Se,F),fe=W.length,ge=a.end),a.next()):T>2500?f(k,ee,W,ne):d(k,ee,W,ne,Se,T+1);if(Se>=0&&fe>0&&fe<W.length&&A(W,ne,k,fe,k,ge,Se,F),W.reverse(),ne.reverse(),Se>-1&&fe>0){let Oe=h(I);z=wL(I,W,ne,0,W.length,0,B-k,Oe,Oe)}else z=p(I,W,ne,B-k,F-B)}_.push(z),S.push($)}function f(x,C,_,S){let E=[],T=0,R=-1;for(;a.pos>C;){let{id:k,start:B,end:M,size:F}=a;if(F>4)a.next();else{if(R>-1&&B<R)break;R<0&&(R=M-i),E.push(k,B,M),T++,a.next()}}if(T){let k=new Uint16Array(T*4),B=E[E.length-2];for(let M=E.length-3,F=0;M>=0;M-=3)k[F++]=E[M],k[F++]=E[M+1]-B,k[F++]=E[M+2]-B,k[F++]=F;_.push(new ef(k,E[2]-B,r)),S.push(B-x)}}function h(x){return(C,_,S)=>{let E=0,T=C.length-1,R,k;if(T>=0&&(R=C[T])instanceof fi){if(!T&&R.type==x&&R.length==S)return R;(k=R.prop(fn.lookAhead))&&(E=_[T]+R.length+k)}return p(x,C,_,S,E)}}function A(x,C,_,S,E,T,R,k){let B=[],M=[];for(;x.length>S;)B.push(x.pop()),M.push(C.pop()+_-E);x.push(p(r.types[R],B,M,T-E,k-T)),C.push(E-_)}function p(x,C,_,S,E=0,T){if(c){let R=[fn.contextHash,c];T=T?[R].concat(T):[R]}if(E>25){let R=[fn.lookAhead,E];T=T?[R].concat(T):[R]}return new fi(x,C,_,S,T)}function m(x,C){let _=a.fork(),S=0,E=0,T=0,R=_.end-i,k={size:0,start:0,skip:0};e:for(let B=_.pos-x;_.pos>B;){let M=_.size;if(_.id==C&&M>=0){k.size=S,k.start=E,k.skip=T,T+=4,S+=4,_.next();continue}let F=_.pos-M;if(M<0||F<B||_.start<R)break;let I=_.id>=o?4:0,z=_.start;for(_.next();_.pos>F;){if(_.size<0)if(_.size==-3)I+=4;else break e;else _.id>=o&&(I+=4);_.next()}E=z,S+=M,T+=I}return(C<0||S==x)&&(k.size=S,k.start=E,k.skip=T),k.size>4?k:void 0}function g(x,C,_){let{id:S,start:E,end:T,size:R}=a;if(a.next(),R>=0&&S<o){let k=_;if(R>4){let B=a.pos-(R-4);for(;a.pos>B;)_=g(x,C,_)}C[--_]=k,C[--_]=T-x,C[--_]=E-x,C[--_]=S}else R==-3?c=S:R==-4&&(u=S);return _}let y=[],w=[];for(;a.pos>0;)d(t.start||0,t.bufferStart||0,y,w,-1,0);let v=(e=t.length)!==null&&e!==void 0?e:y.length?w[0]+y[0].length:0;return new fi(l[t.topID],y.reverse(),w.reverse(),v)}const oD=new WeakMap;function Sx(t,e){if(!t.isAnonymous||e instanceof ef||e.type!=t)return 1;let n=oD.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof fi)){n=1;break}n+=Sx(t,r)}oD.set(e,n)}return n}function wL(t,e,n,r,i,s,o,a,l){let c=0;for(let A=r;A<i;A++)c+=Sx(t,e[A]);let u=Math.ceil(c*1.5/8),d=[],f=[];function h(A,p,m,g,y){for(let w=m;w<g;){let v=w,x=p[w],C=Sx(t,A[w]);for(w++;w<g;w++){let _=Sx(t,A[w]);if(C+_>=u)break;C+=_}if(w==v+1){if(C>u){let _=A[v];h(_.children,_.positions,0,_.children.length,p[v]+y);continue}d.push(A[v])}else{let _=p[w-1]+A[w-1].length-x;d.push(wL(t,A,p,v,w,x,_,null,l))}f.push(x+y-s)}}return h(e,n,r,i,0),(a||l)(d,f,o)}class xh{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new xh(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,d=u?u.fromA:1e9;if(d-l>=r)for(;o&&o.from<d;){let f=o;if(l>=f.from||d<=f.to||c){let h=Math.max(f.from,l)-c,A=Math.min(f.to,d)-c;f=h>=A?null:new xh(h,A,f.tree,f.offset+c,a>0,!!u)}if(f&&i.push(f),o.to>d)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}let MW=class{startParse(e,n,r){return typeof e=="string"&&(e=new rAe(e)),r=r?r.length?r.map(i=>new cT(i.from,i.to)):[new cT(0,0)]:[new cT(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}};class rAe{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new fn({perNode:!0});class Mn{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Rm(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),El.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Rm(this,e,n);let r=[];return this.decompose(e,n,r,0),El.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new A1(this),s=new A1(e);for(let o=n,a=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new A1(this,e)}iterRange(e,n=this.length){return new kW(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new RW(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Mn.empty:e.length<=32?new qr(e):El.from(qr.split(e,[]))}}class qr extends Mn{constructor(e,n=iAe(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new sAe(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new qr(aD(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Ex(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new qr(a,o.length+s.length));else{let l=a.length>>1;r.push(new qr(a.slice(0,l)),new qr(a.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof qr))return super.replace(e,n,r);[e,n]=Rm(this,e,n);let i=Ex(this.text,Ex(r.text,aD(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new qr(i,s):El.from(qr.split(i,[]),s)}sliceString(e,n=this.length,r=`
`){[e,n]=Rm(this,e,n);let i="";for(let s=0,o=0;s<=n&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&n>s&&(i+=a.slice(Math.max(0,e-s),n-s)),s=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new qr(r,i)),r=[],i=-1);return i>-1&&n.push(new qr(r,i)),n}}class El extends Mn{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=r+o.lines-1;if((n?l:a)>=e)return o.lineInner(e,n,r,i);i=a+1,r=l+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&n>=o){let c=i&((o<=e?1:0)|(l>=n?2:0));o>=e&&l<=n&&!c?r.push(a):a.decompose(e-o,n-o,r,c)}o=l+1}}replace(e,n,r){if([e,n]=Rm(this,e,n),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&n<=a){let l=o.replace(e-s,n-s,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[i]=l,new El(u,this.length-(n-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
`){[e,n]=Rm(this,e,n);let i="";for(let s=0,o=0;s<this.children.length&&o<=n;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&n>o&&(i+=a.sliceString(e-o,n-o,r)),o=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof El))return 0;let r=0,[i,s,o,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==a)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let h of e)r+=h.lines;if(r<32){let h=[];for(let A of e)A.flatten(h);return new qr(h,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,u=[];function d(h){let A;if(h.lines>s&&h instanceof El)for(let p of h.children)d(p);else h.lines>o&&(l>o||!l)?(f(),a.push(h)):h instanceof qr&&l&&(A=u[u.length-1])instanceof qr&&h.lines+A.lines<=32?(l+=h.lines,c+=h.length+1,u[u.length-1]=new qr(A.text.concat(h.text),A.length+1+h.length)):(l+h.lines>i&&f(),l+=h.lines,c+=h.length+1,u.push(h))}function f(){l!=0&&(a.push(u.length==1?u[0]:El.from(u,c)),c=-1,l=u.length=0)}for(let h of e)d(h);return f(),a.length==1?a[0]:new El(a,n)}}Mn.empty=new qr([""],0);function iAe(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Ex(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s<t.length&&i<=r;s++){let a=t[s],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function aD(t,e,n){return Ex(t,[""],e,n)}class A1{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof qr?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof qr?i.text.length:i.children.length;if(o==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(i instanceof qr){let l=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof qr?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class kW{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new A1(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class RW{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Mn.prototype[Symbol.iterator]=function(){return this.iter()},A1.prototype[Symbol.iterator]=kW.prototype[Symbol.iterator]=RW.prototype[Symbol.iterator]=function(){return this});class sAe{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Rm(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}let Yp="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=1;t<Yp.length;t++)Yp[t]+=Yp[t-1];function oAe(t){for(let e=1;e<Yp.length;e+=2)if(Yp[e]>t)return Yp[e-1]<=t;return!1}function lD(t){return t>=127462&&t<=127487}const cD=8205;function ts(t,e,n=!0,r=!0){return(n?PW:aAe)(t,e,r)}function PW(t,e,n){if(e==t.length)return e;e&&LW(t.charCodeAt(e))&&IW(t.charCodeAt(e-1))&&e--;let r=$i(t,e);for(e+=aa(r);e<t.length;){let i=$i(t,e);if(r==cD||i==cD||n&&oAe(i))e+=aa(i),r=i;else if(lD(i)){let s=0,o=e-2;for(;o>=0&&lD($i(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function aAe(t,e,n){for(;e>0;){let r=PW(t,e-2,n);if(r<e)return r;e--}return 0}function LW(t){return t>=56320&&t<57344}function IW(t){return t>=55296&&t<56320}function $i(t,e){let n=t.charCodeAt(e);if(!IW(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return LW(r)?(n-55296<<10)+(r-56320)+65536:n}function xL(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function aa(t){return t<65536?1:2}const DM=/\r\n?|\n/;var bi=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(bi||(bi={}));class Ql{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let s=this.sections[n++],o=this.sections[n++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,n=!1){UM(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new Ql(e)}composeDesc(e){return this.empty?e:e.empty?this:OW(this,e)}mapDesc(e,n=!1){return e.empty?this:HM(this,e,n)}mapPos(e,n=-1,r=bi.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(r!=bi.Simple&&c>=e&&(r==bi.TrackDel&&i<e&&c>e||r==bi.TrackBefore&&i<e||r==bi.TrackAfter&&c>e))return null;if(c>e||c==e&&n<0&&!a)return e==i||n<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=n&&a>=e)return i<e&&a>n?"cover":!0;i=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ql(e)}static create(e){return new Ql(e)}}class gi extends Ql{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return UM(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return HM(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i<n.length;i+=2){let o=n[i],a=n[i+1];if(a>=0){n[i]=a,n[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(Mn.empty);r.push(o?e.slice(s,s+o):Mn.empty)}s+=o}return new gi(n,r)}compose(e){return this.empty?e:e.empty?this:OW(this,e,!0)}map(e,n=!1){return e.empty?this:HM(this,e,n,!0)}iterChanges(e,n=!1){UM(this,e,n)}get desc(){return Ql.create(this.sections)}filter(e){let n=[],r=[],i=[],s=new ry(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,l-a);bs(i,u,-1);let d=s.ins==-1?-1:s.off==0?s.ins:0;bs(n,u,d),d>0&&ld(r,n,s.text),s.forward(u),a+=u}let c=e[o++];for(;a<c;){if(s.done)break e;let u=Math.min(s.len,c-a);bs(n,u,-1),bs(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new gi(n,r),filtered:Ql.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,a=null;function l(u=!1){if(!u&&!i.length)return;o<n&&bs(i,n-o,-1);let d=new gi(i,s);a=a?a.compose(d.map(a)):d,i=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let d of u)c(d);else if(u instanceof gi){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:d,to:f=d,insert:h}=u;if(d>f||d<0||f>n)throw new RangeError(`Invalid change range ${d} to ${f} (in doc of length ${n})`);let A=h?typeof h=="string"?Mn.of(h.split(r||DM)):h:Mn.empty,p=A.length;if(d==f&&p==0)return;d<o&&l(),d>o&&bs(i,d-o,-1),bs(i,f-d,p),ld(s,i,A),o=f}}return c(e),l(!a),a}static empty(e){return new gi(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")n.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length<i;)r.push(Mn.empty);r[i]=Mn.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new gi(n,r)}static createSet(e,n){return new gi(e,n)}}function bs(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function ld(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(Mn.empty);t.push(n)}}function UM(t,e,n){let r=t.inserted;for(let i=0,s=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,u=s,d=Mn.empty;for(;c+=a,u+=l,l&&r&&(d=d.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(i,c,s,u,d),i=c,s=u}}}function HM(t,e,n,r=!1){let i=[],s=r?[]:null,o=new ry(t),a=new ry(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);bs(i,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let c=a.len;for(bs(i,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(bs(i,0,o.ins),s&&ld(s,i,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let d=Math.min(u,a.len);c+=d,u-=d,a.forward(d)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;bs(i,c,l<o.i?o.ins:0),s&&l<o.i&&ld(s,i,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?gi.createSet(i,s):Ql.create(i);throw new Error("Mismatched change set lengths")}}function OW(t,e,n=!1){let r=[],i=n?[]:null,s=new ry(t),o=new ry(e);for(let a=!1;;){if(s.done&&o.done)return i?gi.createSet(r,i):Ql.create(r);if(s.ins==0)bs(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)bs(r,0,o.ins,a),i&&ld(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;bs(r,l,u,a),i&&u&&ld(i,r,o.text)}else o.ins==-1?(bs(r,s.off?0:s.len,l,a),i&&ld(i,r,s.textBit(l))):(bs(r,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&ld(i,r,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),s.forward2(l),o.forward(l)}}}}class ry{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?Mn.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Mn.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}let Ib=class jM{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new jM(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return qe.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return qe.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return qe.range(e.anchor,e.head)}static create(e,n,r){return new jM(e,n,r)}};class qe{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:qe.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new qe([this.main],0)}addRange(e,n=!0){return qe.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,qe.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new qe(e.ranges.map(n=>Ib.fromJSON(n)),e.main)}static single(e,n=e){return new qe([qe.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return qe.normalized(e.slice(),n);r=s.to}return new qe(e,n)}static cursor(e,n=0,r,i){return Ib.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<e?Ib.create(n,e,48|s):Ib.create(e,n,(n>e?8:0)|s)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=n&&n--,e.splice(--i,2,s.anchor>s.head?qe.range(l,a):qe.range(a,l))}}return new qe(e,n)}}function FW(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let CL=0;class bt{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=CL++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new bt(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:_L),!!e.static,e.enables)}of(e){return new Tx([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Tx(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Tx(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function _L(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Tx{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=CL++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?c=!0:((n=e[d.id])!==null&&n!==void 0?n:1)&1||u.push(e[d.id]);return{create(d){return d.values[o]=r(d),1},update(d,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||QM(d,u)){let h=r(d);if(a?!uD(h,d.values[o],i):!i(h,d.values[o]))return d.values[o]=h,1}return 0},reconfigure:(d,f)=>{let h,A=f.config.address[s];if(A!=null){let p=jC(f,A);if(this.dependencies.every(m=>m instanceof bt?f.facet(m)===d.facet(m):m instanceof Mr?f.field(m,!1)==d.field(m,!1):!0)||(a?uD(h=r(d),p,i):i(h=r(d),p)))return d.values[o]=p,0}else h=r(d);return d.values[o]=h,1}}}}function uD(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function QM(t,e){let n=!1;for(let r of e)p1(t,r)&1&&(n=!0);return n}function lAe(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),s=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let c=[];for(let u=0;u<r.length;u++){let d=jC(l,r[u]);if(i[u]==2)for(let f of d)c.push(f);else c.push(d)}return e.combine(c)}return{create(l){for(let c of r)p1(l,c);return l.values[o]=a(l),1},update(l,c){if(!QM(l,s))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=QM(l,r),d=c.config.facets[e.id],f=c.facet(e);if(d&&!u&&_L(n,d))return l.values[o]=f,0;let h=a(l);return e.compare(h,f)?(l.values[o]=f,0):(l.values[o]=h,1)}}}const dD=bt.define({static:!0});class Mr{constructor(e,n,r,i,s){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let n=new Mr(CL++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(dD).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}init(e){return[this,dD.of({field:this,create:e})]}get extension(){return this}}const th={lowest:4,low:3,default:2,high:1,highest:0};function n0(t){return e=>new NW(e,t)}const Ea={highest:n0(th.highest),high:n0(th.high),default:n0(th.default),low:n0(th.low),lowest:n0(th.lowest)};class NW{constructor(e,n){this.inner=e,this.prec=n}}class HS{of(e){return new zM(this,e)}reconfigure(e){return HS.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class zM{constructor(e,n){this.compartment=e,this.inner=n}}class HC{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let f of cAe(e,n,o))f instanceof Mr?i.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of i)a[f.id]=c.length<<1,c.push(h=>f.slot(h));let u=r==null?void 0:r.config.facets;for(let f in s){let h=s[f],A=h[0].facet,p=u&&u[f]||[];if(h.every(m=>m.type==0))if(a[A.id]=l.length<<1|1,_L(p,h))l.push(r.facet(A));else{let m=A.combine(h.map(g=>g.value));l.push(r&&A.compare(m,r.facet(A))?r.facet(A):m)}else{for(let m of h)m.type==0?(a[m.id]=l.length<<1|1,l.push(m.value)):(a[m.id]=c.length<<1,c.push(g=>m.dynamicSlot(g)));a[A.id]=c.length<<1,c.push(m=>lAe(m,A,h))}}let d=c.map(f=>f(a));return new HC(e,o,d,a,l,s)}}function cAe(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof zM&&n.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof zM){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;n.set(o.compartment,c),s(c,a)}else if(o instanceof NW)s(o.inner,o.prec);else if(o instanceof Mr)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof Tx)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,th.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(t,th.default),r.reduce((o,a)=>o.concat(a))}function p1(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function jC(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const DW=bt.define(),VM=bt.define({combine:t=>t.some(e=>e),static:!0}),UW=bt.define({combine:t=>t.length?t[0]:void 0,static:!0}),HW=bt.define(),jW=bt.define(),QW=bt.define(),zW=bt.define({combine:t=>t.length?t[0]:!1});class ls{constructor(e,n){this.type=e,this.value=n}static define(){return new uAe}}class uAe{of(e){return new ls(this,e)}}class dAe{constructor(e){this.map=e}of(e){return new Qt(this,e)}}class Qt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Qt(this.type,n)}is(e){return this.type==e}static define(e={}){return new dAe(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}Qt.reconfigure=Qt.define();Qt.appendConfig=Qt.define();class Bn{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&FW(r,n.newLength),s.some(a=>a.type==Bn.time)||(this.annotations=s.concat(Bn.time.of(Date.now())))}static create(e,n,r,i,s,o){return new Bn(e,n,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Bn.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Bn.time=ls.define();Bn.userEvent=ls.define();Bn.addToHistory=ls.define();Bn.remote=ls.define();function fAe(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r<t.length&&(i==e.length||e[i]>=t[r]))s=t[r++],o=t[r++];else if(i<e.length)s=e[i++],o=e[i++];else return n;!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function VW(t,e,n){var r;let i,s,o;return n?(i=e.changes,s=gi.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:Qt.mapEffects(t.effects,i).concat(Qt.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function GM(t,e,n){let r=e.selection,i=Jp(e.annotations);return e.userEvent&&(i=i.concat(Bn.userEvent.of(e.userEvent))),{changes:e.changes instanceof gi?e.changes:gi.of(e.changes||[],n,t.facet(UW)),selection:r&&(r instanceof qe?r:qe.single(r.anchor,r.head)),effects:Jp(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function GW(t,e,n){let r=GM(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(n=!1);let o=!!e[s].sequential;r=VW(r,GM(t,e[s],o?r.changes.newLength:t.doc.length),o)}let i=Bn.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return AAe(n?hAe(i):i)}function hAe(t){let e=t.startState,n=!0;for(let i of e.facet(HW)){let s=i(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:fAe(n,s))}if(n!==!0){let i,s;if(n===!1)s=t.changes.invertedDesc,i=gi.empty(e.doc.length);else{let o=t.changes.filter(n);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=Bn.create(e,i,t.selection&&t.selection.map(s),Qt.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let r=e.facet(jW);for(let i=r.length-1;i>=0;i--){let s=r[i](t);s instanceof Bn?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Bn?t=s[0]:t=GW(e,Jp(s),!1)}return t}function AAe(t){let e=t.startState,n=e.facet(QW),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=VW(r,GM(e,s,t.changes.newLength),!0))}return r==t?t:Bn.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const pAe=[];function Jp(t){return t==null?pAe:Array.isArray(t)?t:[t]}var _r=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(_r||(_r={}));const mAe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let WM;try{WM=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function gAe(t){if(WM)return WM.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||mAe.test(n)))return!0}return!1}function yAe(t){return e=>{if(!/\S/.test(e))return _r.Space;if(gAe(e))return _r.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return _r.Word;return _r.Other}}class Tn{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)p1(this,a<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return p1(this,r),jC(this,r)}update(...e){return GW(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let a of e.effects)a.is(HS.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,c)=>i.set(c,l)),n=null),i.set(a.value.compartment,a.value.extension)):a.is(Qt.reconfigure)?(n=null,r=a.value):a.is(Qt.appendConfig)&&(n=null,r=Jp(r).concat(a.value));let s;n?s=e.startState.values.slice():(n=HC.resolve(r,i,this),s=new Tn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(VM)?e.newSelection:e.newSelection.asSingle();new Tn(n,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:qe.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Jp(r.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.ranges[a]),c=this.changes(l.changes),u=c.map(i);for(let f=0;f<a;f++)s[f]=s[f].map(u);let d=i.mapDesc(c,!0);s.push(l.range.map(d)),i=i.compose(u),o=Qt.mapEffects(o,u).concat(Qt.mapEffects(Jp(l.effects),d))}return{changes:i,selection:qe.create(s,n.mainIndex),effects:o}}changes(e=[]){return e instanceof gi?e:gi.of(e,this.doc.length,this.facet(Tn.lineSeparator))}toText(e){return Mn.of(e.split(this.facet(Tn.lineSeparator)||DM))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(p1(this,n),jC(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Mr&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return Tn.create({doc:e.doc,selection:qe.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=HC.resolve(e.extensions||[],new Map),r=e.doc instanceof Mn?e.doc:Mn.of((e.doc||"").split(n.staticFacet(Tn.lineSeparator)||DM)),i=e.selection?e.selection instanceof qe?e.selection:qe.single(e.selection.anchor,e.selection.head):qe.single(0);return FW(i,r.length),n.staticFacet(VM)||(i=i.asSingle()),new Tn(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Tn.tabSize)}get lineBreak(){return this.facet(Tn.lineSeparator)||`
`}get readOnly(){return this.facet(zW)}phrase(e,...n){for(let r of this.facet(Tn.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(DW))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return yAe(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=ts(n,o,!1);if(s(n.slice(l,o))!=_r.Word)break;o=l}for(;a<i;){let l=ts(n,a);if(s(n.slice(a,l))!=_r.Word)break;a=l}return o==a?null:qe.range(o+r,a+r)}}Tn.allowMultipleSelections=VM;Tn.tabSize=bt.define({combine:t=>t.length?t[0]:4});Tn.lineSeparator=UW;Tn.readOnly=zW;Tn.phrases=bt.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});Tn.languageData=DW;Tn.changeFilter=HW;Tn.transactionFilter=jW;Tn.transactionExtender=QW;HS.reconfigure=Qt.define();function il(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Hh{eq(e){return this==e}range(e,n=e){return KM.create(e,n,this)}}Hh.prototype.startSide=Hh.prototype.endSide=0;Hh.prototype.point=!1;Hh.prototype.mapMode=bi.TrackDel;let KM=class WW{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new WW(e,n,r)}};function $M(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class SL{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,n){let r=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+e,d=this.to[l]+e,f,h;if(u==d){let A=n.mapPos(u,c.startSide,c.mapMode);if(A==null||(f=h=A,c.startSide!=c.endSide&&(h=n.mapPos(u,c.endSide),h<f)))continue}else if(f=n.mapPos(u,c.startSide),h=n.mapPos(d,c.endSide),f>h||f==h&&c.startSide>0&&c.endSide<=0)continue;(h-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,h-f)),r.push(c),i.push(f-o),s.push(h-o))}return{mapped:r.length?new SL(i,s,r,a):null,pos:o}}}class yn{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new yn(e,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort($M)),this.isEmpty)return n.length?yn.of(n):this;let a=new KW(this,null,-1).goto(0),l=0,c=[],u=new tf;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let d=n[l++];u.addInner(d.from,d.to,d.value)||c.push(d)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(KM.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?yn.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),n.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:u,pos:d}=l.map(a,e);u&&(i=Math.max(i,u.maxPoint),n.push(u),r.push(d))}}let s=this.nextLayer.map(e);return n.length==0?s:new yn(r,n,s||yn.empty,i)}between(e,n,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(n>=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return iy.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return iy.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=s),a=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=s),l=fD(o,a,r),c=new r0(o,l,s),u=new r0(a,l,s);r.iterGaps((d,f,h)=>hD(c,d,u,f,h,i)),r.empty&&r.length==0&&hD(c,0,u,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(u=>!u.isEmpty&&n.indexOf(u)<0),o=n.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=fD(s,o),l=new r0(s,a,0).goto(r),c=new r0(o,a,0).goto(r);for(;;){if(l.to!=c.to||!qM(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,n,r,i,s=-1){let o=new r0(e,null,s).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let u=o.activeForPoint(o.to),d=o.pointFrom<n?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);i.point(a,c,o.point,u,d,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,n=!1){let r=new tf;for(let i of e instanceof KM?[e]:n?vAe(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return yn.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=yn.empty;i=i.nextLayer)n=new yn(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}yn.empty=new yn([],[],null,-1);function vAe(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if($M(e,r)>0)return t.slice().sort($M);e=r}return t}yn.empty.nextLayer=yn.empty;class tf{finishChunk(e){this.chunks.push(new SL(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new tf)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(yn.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=yn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function fD(t,e,n){let r=new Map;for(let s of t)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(n?n.mapPos(a):a)==s.chunkPos[o]&&!(n!=null&&n.touchesRange(a,a+s.chunk[o].length))&&i.add(s.chunk[o])}return i}class KW{constructor(e,n,r,i=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class iy{constructor(e){this.heap=e}static from(e,n=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&i.push(new KW(o,n,r,s));return i.length==1?i[0]:new iy(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)uT(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)uT(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),uT(this.heap,0)}}}function uT(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1<t.length&&i.compare(t[r+1])>=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class r0{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=iy.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Ob(this.active,e),Ob(this.activeTo,e),Ob(this.activeRank,e),this.minActive=AD(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n<this.activeRank.length&&(s-this.activeRank[n]||i-this.activeTo[n])>0;)n++;Fb(this.active,n,r),Fb(this.activeTo,n,i),Fb(this.activeRank,n,s),e&&Fb(e,n,this.cursor.from),this.minActive=AD(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&Ob(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function hD(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,a=r,l=r-e;for(;;){let c=t.to+l-n.to||t.endSide-n.endSide,u=c<0?t.to+l:n.to,d=Math.min(u,o);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&qM(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(a,d,t.point,n.point):d>a&&!qM(t.active,n.active)&&s.compareRange(a,d,t.active,n.active),u>o)break;a=u,c<=0&&t.next(),c>=0&&n.next()}}function qM(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function Ob(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function Fb(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function AD(t,e){let n=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||t[i].endSide-t[n].endSide)<0&&(n=i,r=e[i]);return n}function Eg(t,e,n=t.length){let r=0;for(let i=0;i<n;)t.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=ts(t,i));return r}function XM(t,e,n,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=ts(t,i)}return r===!0?-1:t.length}const YM="ͼ",pD=typeof Symbol>"u"?"__"+YM:Symbol.for(YM),JM=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),mD=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class nf{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let u=[],d=/^@(\w+)\b/.exec(o[0]),f=d&&d[1]=="keyframes";if(d&&a==null)return l.push(o[0]+";");for(let h in a){let A=a[h];if(/&/.test(h))s(h.split(/,\s*/).map(p=>o.map(m=>p.replace(/&/,m))).reduce((p,m)=>p.concat(m)),A,l);else if(A&&typeof A=="object"){if(!d)throw new RangeError("The value of a property ("+h+") should be a primitive value.");s(i(h),A,u,f)}else A!=null&&u.push(h.replace(/_.*/,"").replace(/[A-Z]/g,p=>"-"+p.toLowerCase())+": "+A+";")}(u.length||f)&&l.push((r&&!d&&!c?o.map(r):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let e=mD[pD]||1;return mD[pD]=e+1,YM+e.toString(36)}static mount(e,n,r){let i=e[JM],s=r&&r.nonce;i?s&&i.setNonce(s):i=new bAe(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let gD=new Map;class bAe{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=gD.get(r);if(s)return e[JM]=s;this.sheet=new i.CSSStyleSheet,gD.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[JM]=this}mount(e,n){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
`;this.styleTag.textContent=o;let a=n.head||n;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var rf={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},sy={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wAe=typeof navigator<"u"&&/Mac/.test(navigator.platform),xAe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var qi=0;qi<10;qi++)rf[48+qi]=rf[96+qi]=String(qi);for(var qi=1;qi<=24;qi++)rf[qi+111]="F"+qi;for(var qi=65;qi<=90;qi++)rf[qi]=String.fromCharCode(qi+32),sy[qi]=String.fromCharCode(qi);for(var dT in rf)sy.hasOwnProperty(dT)||(sy[dT]=rf[dT]);function CAe(t){var e=wAe&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||xAe&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?sy:rf)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function oy(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function ZM(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function _Ae(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Bx(t,e){if(!e.anchorNode)return!1;try{return ZM(t,e.anchorNode)}catch{return!1}}function ay(t){return t.nodeType==3?Qh(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function m1(t,e,n,r){return n?yD(t,e,n,r,-1)||yD(t,e,n,r,1):!1}function jh(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function QC(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function yD(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Yc(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=jh(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?Yc(t):0}else return!1}}function Yc(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function EL(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function SAe(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function $W(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function EAe(t,e,n,r,i,s,o,a){let l=t.ownerDocument,c=l.defaultView||window;for(let u=t,d=!1;u&&!d;)if(u.nodeType==1){let f,h=u==l.body,A=1,p=1;if(h)f=SAe(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(d=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let y=u.getBoundingClientRect();({scaleX:A,scaleY:p}=$W(u,y)),f={left:y.left,right:y.left+u.clientWidth*A,top:y.top,bottom:y.top+u.clientHeight*p}}let m=0,g=0;if(i=="nearest")e.top<f.top?(g=-(f.top-e.top+o),n>0&&e.bottom>f.bottom+g&&(g=e.bottom-f.bottom+g+o)):e.bottom>f.bottom&&(g=e.bottom-f.bottom+o,n<0&&e.top-g<f.top&&(g=-(f.top+g-e.top+o)));else{let y=e.bottom-e.top,w=f.bottom-f.top;g=(i=="center"&&y<=w?e.top+y/2-w/2:i=="start"||i=="center"&&n<0?e.top-o:e.bottom-w+o)-f.top}if(r=="nearest"?e.left<f.left?(m=-(f.left-e.left+s),n>0&&e.right>f.right+m&&(m=e.right-f.right+m+s)):e.right>f.right&&(m=e.right-f.right+s,n<0&&e.left<f.left+m&&(m=-(f.left+m-e.left+s))):m=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==a?e.left-s:e.right-(f.right-f.left)+s)-f.left,m||g)if(h)c.scrollBy(m,g);else{let y=0,w=0;if(g){let v=u.scrollTop;u.scrollTop+=g/p,w=(u.scrollTop-v)*p}if(m){let v=u.scrollLeft;u.scrollLeft+=m/A,y=(u.scrollLeft-v)*A}e={left:e.left-y,top:e.top-w,right:e.right-y,bottom:e.bottom-w},y&&Math.abs(y-m)<1&&(r="nearest"),w&&Math.abs(w-g)<1&&(i="nearest")}if(h)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function TAe(t){let e=t.ownerDocument,n,r;for(let i=t.parentNode;i&&!(i==e.body||n&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!n&&i.scrollWidth>i.clientWidth&&(n=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:n,y:r}}class BAe{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?Yc(n):0),r,Math.min(e.focusOffset,r?Yc(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let HA=null;function qW(t){if(t.setActive)return t.setActive();if(HA)return t.focus(HA);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(HA==null?{get preventScroll(){return HA={preventScroll:!0},!0}}:void 0),!HA){HA=!1;for(let n=0;n<e.length;){let r=e[n++],i=e[n++],s=e[n++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let vD;function Qh(t,e,n=e){let r=vD||(vD=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function Zp(t,e,n,r){let i={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function MAe(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function XW(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function kAe(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,Yc(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=Yc(n))}else{if(n==t)return!0;r=jh(n),n=n.parentNode}}function YW(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function JW(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=Yc(n)}else if(n.parentNode&&!QC(n))r=jh(n),n=n.parentNode;else return null}}function ZW(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!QC(n))r=jh(n)+1,n=n.parentNode;else return null}}class _s{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new _s(e.parentNode,jh(e),n)}static after(e,n){return new _s(e.parentNode,jh(e)+1,n)}}const TL=[];class rr{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let n=this.posAtStart;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,n){if(this.flags&2){let r=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:r.firstChild)){let a=rr.get(s);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,n),o.flags&=-8}if(s=i?i.nextSibling:r.firstChild,n&&!n.written&&n.node==r&&s!=o.dom&&(n.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=bD(s);else r.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:r.firstChild,s&&n&&n.node==r&&(n.written=!0);s;)s=bD(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,n),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,n){let r;if(e==this.dom)r=this.dom.childNodes[n];else{let i=Yc(e)==0?0:n==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;i==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?i=-1:i=1),e=s}i<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!rr.get(r);)r=r.nextSibling;if(!r)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,n,r=0){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,u=r;l<this.children.length;l++){let d=this.children[l],f=c+d.length;if(c<e&&f>n)return d.domBoundsAround(e,n,c);if(f>=e&&i==-1&&(i=l,s=c),c>n&&d.dom.parentNode==this.dom){o=l,a=u;break}u=f,c=f+d.breakAfter}return{from:s,to:a<0?r+this.length:a,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=TL){this.markDirty();for(let i=e;i<n;i++){let s=this.children[i];s.parent==this&&r.indexOf(s)<0&&s.destroy()}this.children.splice(e,n-e,...r);for(let i=0;i<r.length;i++)r[i].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new eK(this.children,e,this.children.length)}childPos(e,n=1){return this.childCursor().findPos(e,n)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,n,r,i,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}rr.prototype.breakAfter=0;function bD(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class eK{constructor(e,n,r){this.children=e,this.pos=n,this.i=r,this.off=0}findPos(e,n=1){for(;;){if(e>this.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function tK(t,e,n,r,i,s,o,a,l){let{children:c}=t,u=c.length?c[e]:null,d=s.length?s[s.length-1]:null,f=d?d.breakAfter:o;if(!(e==r&&u&&!o&&!f&&s.length<2&&u.merge(n,i,s.length?d:null,n==0,a,l))){if(r<c.length){let h=c[r];h&&(i<h.length||h.breakAfter&&(d!=null&&d.breakAfter))?(e==r&&(h=h.split(i),i=0),!f&&d&&h.merge(0,i,d,!0,0,l)?s[s.length-1]=h:((i||h.children.length&&!h.children[0].length)&&h.merge(0,i,null,!1,0,l),s.push(h))):h!=null&&h.breakAfter&&(d?d.breakAfter=1:o=1),r++}for(u&&(u.breakAfter=o,n>0&&(!o&&s.length&&u.merge(n,u.length,s[0],!1,a,0)?u.breakAfter=s.shift().breakAfter:(n<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(n,u.length,null,!1,a,0),e++));e<r&&s.length;)if(c[r-1].become(s[s.length-1]))r--,s.pop(),l=s.length?0:a;else if(c[e].become(s[0]))e++,s.shift(),a=s.length?0:l;else break;!s.length&&e&&r<c.length&&!c[e-1].breakAfter&&c[r].merge(0,0,c[e-1],!1,a,l)&&e--,(e<r||s.length)&&t.replaceChildren(e,r,s)}}function nK(t,e,n,r,i,s){let o=t.childCursor(),{i:a,off:l}=o.findPos(n,1),{i:c,off:u}=o.findPos(e,-1),d=e-n;for(let f of r)d+=f.length;t.length+=d,tK(t,c,u,a,l,r,0,i,s)}let io=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},ek=typeof document<"u"?document:{documentElement:{style:{}}};const tk=/Edge\/(\d+)/.exec(io.userAgent),rK=/MSIE \d/.test(io.userAgent),nk=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(io.userAgent),jS=!!(rK||nk||tk),wD=!jS&&/gecko\/(\d+)/i.test(io.userAgent),fT=!jS&&/Chrome\/(\d+)/.exec(io.userAgent),xD="webkitFontSmoothing"in ek.documentElement.style,iK=!jS&&/Apple Computer/.test(io.vendor),CD=iK&&(/Mobile\/\w+/.test(io.userAgent)||io.maxTouchPoints>2);var _t={mac:CD||/Mac/.test(io.platform),windows:/Win/.test(io.platform),linux:/Linux|X11/.test(io.platform),ie:jS,ie_version:rK?ek.documentMode||6:nk?+nk[1]:tk?+tk[1]:0,gecko:wD,gecko_version:wD?+(/Firefox\/(\d+)/.exec(io.userAgent)||[0,0])[1]:0,chrome:!!fT,chrome_version:fT?+fT[1]:0,ios:CD,android:/Android\b/.test(io.userAgent),webkit:xD,safari:iK,webkit_version:xD?+(/\bAppleWebKit\/(\d+)/.exec(io.userAgent)||[0,0])[1]:0,tabSize:ek.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const RAe=256;class tl extends rr{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,r){return this.flags&8||r&&(!(r instanceof tl)||this.length-(n-e)+r.length>RAe||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new tl(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new _s(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return PAe(this.dom,e,n)}}class Jc extends rr{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let i of n)i.setParent(this)}setAttrs(e){if(XW(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,i,s,o){return r&&(!(r instanceof Jc&&r.mark.eq(this.mark))||e&&s<=0||n<this.length&&o<=0)?!1:(nK(this,e,n,r?r.children.slice():[],s-1,o-1),this.markDirty(),!0)}split(e){let n=[],r=0,i=-1,s=0;for(let a of this.children){let l=r+a.length;l>e&&n.push(r<e?a.split(e-r):a),i<0&&r>=e&&(i=s),r=l,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new Jc(this.mark,n,o)}domAtPos(e){return sK(this,e)}coordsAt(e,n){return aK(this,e,n)}}function PAe(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&n<0||e==r&&n>=0?_t.chrome||_t.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):n<0?i--:s<r&&s++;let a=Qh(t,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return _t.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?EL(l,o<0):l||null}class cd extends rr{static create(e,n,r){return new cd(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=cd.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,i,s,o){return r&&(!(r instanceof cd)||!this.widget.compare(r.widget)||e>0&&s<=0||n<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-n),!0)}become(e){return e instanceof cd&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return Mn.empty;let e=this;for(;e.parent;)e=e.parent;let{view:n}=e,r=n&&n.state.doc,i=this.posAtStart;return r?r.slice(i,i+this.length):Mn.empty}domAtPos(e){return(this.length?e==0:this.side>0)?_s.before(this.dom):_s.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?i.length-1:0;s=i[a],!(e>0?a==0:a==i.length-1||s.top<s.bottom);a+=o?-1:1);return EL(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Pm extends rr{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Pm&&e.side==this.side}split(){return new Pm(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?_s.before(this.dom):_s.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Mn.empty}get isHidden(){return!0}}tl.prototype.children=cd.prototype.children=Pm.prototype.children=TL;function sK(t,e){let n=t.dom,{children:r}=t,i=0;for(let s=0;i<r.length;i++){let o=r[i],a=s+o.length;if(!(a==s&&o.getSide()<=0)){if(e>s&&e<a&&o.dom.parentNode==n)return o.domAtPos(e-s);if(e<=s)break;s=a}}for(let s=i;s>0;s--){let o=r[s-1];if(o.dom.parentNode==n)return o.domAtPos(o.length)}for(let s=i;s<r.length;s++){let o=r[s];if(o.dom.parentNode==n)return o.domAtPos(0)}return new _s(n,0)}function oK(t,e,n){let r,{children:i}=t;n>0&&e instanceof Jc&&i.length&&(r=i[i.length-1])instanceof Jc&&r.mark.eq(e.mark)?oK(r,e.children[0],n-1):(i.push(e),e.setParent(t)),t.length+=e.length}function aK(t,e,n){let r=null,i=-1,s=null,o=-1;function a(c,u){for(let d=0,f=0;d<c.children.length&&f<=u;d++){let h=c.children[d],A=f+h.length;A>=u&&(h.children.length?a(h,u-f):(!s||s.isHidden&&n>0)&&(A>u||f==A&&h.getSide()>0)?(s=h,o=u-f):(f<u||f==A&&h.getSide()<0&&!h.isHidden)&&(r=h,i=u-f)),f=A}}a(t,e);let l=(n<0?r:s)||r||s;return l?l.coordsAt(Math.max(0,l==r?i:o),n):LAe(t)}function LAe(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=ay(e);return n[n.length-1]||null}function rk(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const _D=Object.create(null);function zC(t,e,n){if(t==e)return!0;t||(t=_D),e||(e=_D);let r=Object.keys(t),i=Object.keys(e);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function ik(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function IAe(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class ai extends rr{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,i,s,o){if(r){if(!(r instanceof ai))return!1;this.dom||r.transferDOM(this)}return i&&this.setDeco(r?r.attrs:null),nK(this,e,n,r?r.children.slice():[],s,o),!0}split(e){let n=new ai;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:i}=this.childPos(e);i&&(n.append(this.children[r].split(i),0),this.children[r].merge(i,this.children[r].length,null,!1,0,0),r++);for(let s=r;s<this.children.length;s++)n.append(this.children[s],0);for(;r>0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){zC(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){oK(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=rk(n,this.attrs||{})),r&&(this.attrs=rk({class:r},this.attrs||{}))}domAtPos(e){return sK(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(XW(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(ik(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let i=this.dom.lastChild;for(;i&&rr.get(i)instanceof Jc;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((r=rr.get(i))===null||r===void 0?void 0:r.isEditable)==!1&&(!_t.ios||!this.children.some(s=>s instanceof tl))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof tl)||/[^ -~]/.test(r.text))return null;let i=ay(r.dom);if(i.length!=1)return null;e+=i[0].width,n=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=aK(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight<s){let o=(s-i.textHeight)/2;return{top:r.top+o,bottom:r.bottom-o,left:r.left,right:r.left}}}return r}become(e){return e instanceof ai&&this.children.length==0&&e.children.length==0&&zC(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,n){for(let r=0,i=0;r<e.children.length;r++){let s=e.children[r],o=i+s.length;if(o>=n){if(s instanceof ai)return s;if(o>n)break}i=o+s.breakAfter}return null}}class Uc extends rr{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,i,s,o){return r&&(!(r instanceof Uc)||!this.widget.compare(r.widget)||e>0&&s<=0||n<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-n),!0)}domAtPos(e){return e==0?_s.before(this.dom):_s.after(this.dom,e==this.length)}split(e){let n=this.length-e;this.length=e;let r=new Uc(this.widget,n,this.deco);return r.breakAfter=this.breakAfter,r}get children(){return TL}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Mn.empty}domBoundsAround(){return null}become(e){return e instanceof Uc&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,n){return this.widget.coordsAt(this.dom,e,n)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:n,endSide:r}=this.deco;return n==r?!1:e<0?n<0:r>0}}class Au{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Ws=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Ws||(Ws={}));class Ct extends Hh{constructor(e,n,r,i){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new iv(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new sf(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=lK(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new sf(e,r,i,n,e.widget||null,!0)}static line(e){return new sv(e)}static set(e,n=!1){return yn.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ct.none=yn.empty;class iv extends Ct{constructor(e){let{start:n,end:r}=lK(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof iv&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&zC(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}iv.prototype.point=!1;class sv extends Ct{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof sv&&this.spec.class==e.spec.class&&zC(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}sv.prototype.mapMode=bi.TrackBefore;sv.prototype.point=!0;class sf extends Ct{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?bi.TrackBefore:bi.TrackAfter:bi.TrackDel}get type(){return this.startSide!=this.endSide?Ws.WidgetRange:this.startSide<=0?Ws.WidgetBefore:Ws.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof sf&&OAe(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}sf.prototype.point=!0;function lK(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function OAe(t,e){return t==e||!!(t&&e&&t.compare(e))}function sk(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class g1{constructor(e,n,r,i){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Uc&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ai),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Nb(new Pm(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Uc)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(Nb(new tl(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=0}}span(e,n,r,i){this.buildText(n-e,r,i),this.pos=n,this.openStart<0&&(this.openStart=i)}point(e,n,r,i,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof sf){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=n-e;if(r instanceof sf)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Uc(r.widget||Lm.block,a,r));else{let l=cd.create(r.widget||Lm.inline,a,a?0:r.startSide),c=this.atCursorPos&&!l.isEditable&&s<=i.length&&(e<n||r.startSide>0),u=!l.isEditable&&(e<n||s>i.length||r.startSide<=0),d=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),c&&(d.append(Nb(new Pm(1),i),s),s=i.length+Math.max(0,s-i.length)),d.append(Nb(l,i),s),this.atCursorPos=u,this.pendingBuffer=u?e<n||s>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=s)}static build(e,n,r,i,s){let o=new g1(e,n,r,s);return o.openEnd=yn.spans(i,n,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Nb(t,e){for(let n of e)t=new Jc(n,[t],t.length);return t}class Lm extends Au{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Lm.inline=new Lm("span");Lm.block=new Lm("div");var gr=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(gr||(gr={}));const zh=gr.LTR,BL=gr.RTL;function cK(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const FAe=cK("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),NAe=cK("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ok=Object.create(null),ul=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);ok[e]=n,ok[n]=-e}function uK(t){return t<=247?FAe[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?NAe[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const DAe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ud{get dir(){return this.level%2?BL:zh}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=n&&a.to>=n){if(a.level==r)return o;(s<0||(i!=0?i<0?a.from<n:a.to>n:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function dK(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],i=e[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!dK(r.inner,i.inner))return!1}return!0}const nr=[];function UAe(t,e,n,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:n,l=s?256:i;for(let c=o,u=l,d=l;c<a;c++){let f=uK(t.charCodeAt(c));f==512?f=u:f==8&&d==4&&(f=16),nr[c]=f==4?2:f,f&7&&(d=f),u=f}for(let c=o,u=l,d=l;c<a;c++){let f=nr[c];if(f==128)c<a-1&&u==nr[c+1]&&u&24?f=nr[c]=u:nr[c]=256;else if(f==64){let h=c+1;for(;h<a&&nr[h]==64;)h++;let A=c&&u==8||h<n&&nr[h]==8?d==1?1:8:256;for(let p=c;p<h;p++)nr[p]=A;c=h-1}else f==8&&d==1&&(nr[c]=1);u=f,f&7&&(d=f)}}}function HAe(t,e,n,r,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:e,u=o<r.length?r[o].from:n;for(let d=c,f,h,A;d<u;d++)if(h=ok[f=t.charCodeAt(d)])if(h<0){for(let p=a-3;p>=0;p-=3)if(ul[p+1]==-h){let m=ul[p+2],g=m&2?i:m&4?m&1?s:i:0;g&&(nr[d]=nr[ul[p]]=g),a=p;break}}else{if(ul.length==189)break;ul[a++]=d,ul[a++]=f,ul[a++]=l}else if((A=nr[d])==2||A==1){let p=A==i;l=p?0:1;for(let m=a-3;m>=0;m-=3){let g=ul[m+2];if(g&2)break;if(p)ul[m+2]|=2;else{if(g&4)break;ul[m+2]|=4}}}}}function jAe(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,a=i<n.length?n[i].from:e;for(let l=o;l<a;){let c=nr[l];if(c==256){let u=l+1;for(;;)if(u==a){if(i==n.length)break;u=n[i++].to,a=i<n.length?n[i].from:e}else if(nr[u]==256)u++;else break;let d=s==1,f=(u<e?nr[u]:r)==1,h=d==f?d?1:2:r;for(let A=u,p=i,m=p?n[p-1].to:t;A>l;)A==m&&(A=n[--p].from,m=p?n[p-1].to:t),nr[--A]=h;l=u}else s=c,l++}}}function ak(t,e,n,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let l=e,c=0;l<n;){let u=!0,d=!1;if(c==s.length||l<s[c].from){let p=nr[l];p!=a&&(u=!1,d=p==16)}let f=!u&&a==1?[]:null,h=u?r:r+1,A=l;e:for(;;)if(c<s.length&&A==s[c].from){if(d)break e;let p=s[c];if(!u)for(let m=p.to,g=c+1;;){if(m==n)break e;if(g<s.length&&s[g].from==m)m=s[g++].to;else{if(nr[m]==a)break e;break}}if(c++,f)f.push(p);else{p.from>l&&o.push(new ud(l,p.from,h));let m=p.direction==zh!=!(h%2);lk(t,m?r+1:r,i,p.inner,p.from,p.to,o),l=p.to}A=p.to}else{if(A==n||(u?nr[A]!=a:nr[A]==a))break;A++}f?ak(t,l,A,r+1,i,f,o):l<A&&o.push(new ud(l,A,h)),l=A}else for(let l=n,c=s.length;l>e;){let u=!0,d=!1;if(!c||l>s[c-1].to){let p=nr[l-1];p!=a&&(u=!1,d=p==16)}let f=!u&&a==1?[]:null,h=u?r:r+1,A=l;e:for(;;)if(c&&A==s[c-1].to){if(d)break e;let p=s[--c];if(!u)for(let m=p.from,g=c;;){if(m==e)break e;if(g&&s[g-1].to==m)m=s[--g].from;else{if(nr[m-1]==a)break e;break}}if(f)f.push(p);else{p.to<l&&o.push(new ud(p.to,l,h));let m=p.direction==zh!=!(h%2);lk(t,m?r+1:r,i,p.inner,p.from,p.to,o),l=p.from}A=p.from}else{if(A==e||(u?nr[A-1]!=a:nr[A-1]==a))break;A--}f?ak(t,A,l,r+1,i,f,o):A<l&&o.push(new ud(A,l,h)),l=A}}function lk(t,e,n,r,i,s,o){let a=e%2?2:1;UAe(t,i,s,r,a),HAe(t,i,s,r,a),jAe(i,s,r,a),ak(t,i,s,e,n,r,o)}function QAe(t,e,n){if(!t)return[new ud(0,0,e==BL?1:0)];if(e==zh&&!n.length&&!DAe.test(t))return fK(t.length);if(n.length)for(;t.length>nr.length;)nr[nr.length]=256;let r=[],i=e==zh?0:1;return lk(t,i,i,n,0,t.length,r),r}function fK(t){return[new ud(0,t,0)]}let hK="";function zAe(t,e,n,r,i){var s;let o=r.head-t.from,a=ud.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],c=l.side(i,n);if(o==c){let f=a+=i?1:-1;if(f<0||f>=e.length)return null;l=e[a=f],o=l.side(!i,n),c=l.side(i,n)}let u=ts(t.text,o,l.forward(i,n));(u<l.from||u>l.to)&&(u=c),hK=t.text.slice(Math.min(o,u),Math.max(o,u));let d=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return d&&u==c&&d.level+(i?0:1)<l.level?qe.cursor(d.side(!i,n)+t.from,d.forward(i,n)?1:-1,d.level):qe.cursor(u+t.from,l.forward(i,n)?-1:1,l.level)}function VAe(t,e,n){for(let r=e;r<n;r++){let i=uK(t.charCodeAt(r));if(i==1)return zh;if(i==2||i==4)return BL}return zh}const AK=bt.define(),pK=bt.define(),mK=bt.define(),gK=bt.define(),ck=bt.define(),yK=bt.define(),vK=bt.define(),bK=bt.define({combine:t=>t.some(e=>e)}),wK=bt.define({combine:t=>t.some(e=>e)}),xK=bt.define();class em{constructor(e,n="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new em(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new em(qe.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Db=Qt.define({map:(t,e)=>t.map(e)}),CK=Qt.define();function zs(t,e,n){let r=t.facet(gK);r.length?r[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}const Zu=bt.define({combine:t=>t.length?t[0]:!0});let GAe=0;const k0=bt.define();class Br{constructor(e,n,r,i,s){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=i,this.extension=s(this)}static define(e,n){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=n||{};return new Br(GAe++,e,r,i,a=>{let l=[k0.of(a)];return o&&l.push(ly.of(c=>{let u=c.plugin(a);return u?o(u):Ct.none})),s&&l.push(s(a)),l})}static fromClass(e,n){return Br.define(r=>new e(r),n)}}class hT{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(zs(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(n){zs(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){zs(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const _K=bt.define(),ML=bt.define(),ly=bt.define(),SK=bt.define(),kL=bt.define(),EK=bt.define();function SD(t,e){let n=t.state.facet(EK);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return yn.spans(r,e.from,e.to,{point(){},span(s,o,a,l){let c=s-e.from,u=o-e.from,d=i;for(let f=a.length-1;f>=0;f--,l--){let h=a[f].spec.bidiIsolate,A;if(h==null&&(h=VAe(e.text,c,u)),l>0&&d.length&&(A=d[d.length-1]).to==c&&A.direction==h)A.to=u,d=A.inner;else{let p={from:c,to:u,direction:h,inner:[]};d.push(p),d=p.inner}}}}),i}const TK=bt.define();function BK(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(TK)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const R0=bt.define();class ya{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new ya(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let i=0,s=0,o=0,a=0;;i++){let l=i==e.length?null:e[i],c=o-a,u=l?l.fromB:1e9;for(;s<n.length&&n[s]<u;){let d=n[s],f=n[s+1],h=Math.max(a,d),A=Math.min(u,f);if(h<=A&&new ya(h+c,A+c,h,A).addToSet(r),f>u)break;s+=2}if(!l)return r;new ya(l.fromA,l.toA,l.fromB,l.toB).addToSet(r),o=l.toA,a=l.toB}}}class VC{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=gi.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new ya(s,o,a,l))),this.changedRanges=i}static create(e,n,r){return new VC(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class ED extends rr{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Ct.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ai],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ya(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:u})=>u<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!JAe(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?KAe(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;r=new ya(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(_t.ie||_t.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=XAe(o,a,e.changes);return r=ya.extendWithRanges(r,l),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=_t.chrome||_t.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||i.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof Uc&&o.widget instanceof TD&&s.push(o.dom);i.updateGaps(s)}updateChildren(e,n,r){let i=r?r.range.addToSet(e.slice()):e,s=this.childCursor(n);for(let o=i.length-1;;o--){let a=o>=0?i[o]:null;if(!a)break;let{fromA:l,toA:c,fromB:u,toB:d}=a,f,h,A,p;if(r&&r.range.fromB<d&&r.range.toB>u){let v=g1.build(this.view.state.doc,u,r.range.fromB,this.decorations,this.dynamicDecorationMap),x=g1.build(this.view.state.doc,r.range.toB,d,this.decorations,this.dynamicDecorationMap);h=v.breakAtStart,A=v.openStart,p=x.openEnd;let C=this.compositionView(r);x.breakAtStart?C.breakAfter=1:x.content.length&&C.merge(C.length,C.length,x.content[0],!1,x.openStart,0)&&(C.breakAfter=x.content[0].breakAfter,x.content.shift()),v.content.length&&C.merge(0,0,v.content[v.content.length-1],!0,0,v.openEnd)&&v.content.pop(),f=v.content.concat(C).concat(x.content)}else({content:f,breakAtStart:h,openStart:A,openEnd:p}=g1.build(this.view.state.doc,u,d,this.decorations,this.dynamicDecorationMap));let{i:m,off:g}=s.findPos(c,1),{i:y,off:w}=s.findPos(l,-1);tK(this,y,w,m,g,f,h,A,p)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(CK)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new tl(e.text.nodeValue);n.flags|=8;for(let{deco:i}of e.marks)n=new Jc(i,[n],n.length);let r=new ai;return r.append(n,0),r}fixCompositionDOM(e){let n=(s,o)=>{o.flags|=8|(o.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(o);let a=rr.get(s);a&&a!=o&&(a.dom=null),o.setDOM(s)},r=this.childPos(e.range.fromB,1),i=this.children[r.i];n(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)r=i.childPos(r.off,1),i=i.children[r.i],n(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,i=r==this.dom,s=!i&&Bx(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(i||n||s))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),c=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(_t.gecko&&a.empty&&!this.hasComposition&&WAe(l)){let d=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(d,l.node.childNodes[l.offset]||null)),l=c=new _s(d,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!m1(l.node,l.offset,u.anchorNode,u.anchorOffset)||!m1(c.node,c.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,a))&&(this.view.observer.ignore(()=>{_t.android&&_t.chrome&&this.dom.contains(u.focusNode)&&YAe(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let d=oy(this.view.root);if(d)if(a.empty){if(_t.gecko){let f=$Ae(l.node,l.offset);if(f&&f!=3){let h=(f==1?JW:ZW)(l.node,l.offset);h&&(l=new _s(h.node,h.offset))}}d.collapse(l.node,l.offset),a.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=a.bidiLevel)}else if(d.extend){d.collapse(l.node,l.offset);try{d.extend(c.node,c.offset)}catch{}}else{let f=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),f.setEnd(c.node,c.offset),f.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(f)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new _s(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new _s(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&m1(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=oy(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=ai.find(this,n.head);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),c=this.coordsAt(n.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(n.head+n.assoc);r.collapse(u.node,u.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let d=e.observer.selectionRange;e.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=n.from&&r.collapse(i,s)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let i=e.offset;!r&&i<n.childNodes.length;i++){let s=rr.get(n.childNodes[i]);s instanceof ai&&(r=s.domAtPos(0))}for(let i=e.offset-1;!r&&i>=0;i--){let s=rr.get(n.childNodes[i]);s instanceof ai&&(r=s.domAtPos(s.length))}return r?new _s(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=rr.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n<this.children.length-1;){let i=this.children[n];if(r<i.length||i instanceof ai)break;n++,r=0}return this.children[n].domAtPos(r)}coordsAt(e,n){let r=null,i=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let a=this.children[o],l=s-a.breakAfter,c=l-a.length;if(l<e)break;if(c<=e&&(c<e||a.covers(-1))&&(l>e||a.covers(1))&&(!r||a instanceof ai&&!(r instanceof ai&&n>=0)))r=a,i=c;else if(r&&c==e&&l==e&&a instanceof Uc&&Math.abs(n)<2){if(a.deco.startSide<0)break;o&&(r=null)}s=c}return r?r.coordsAt(e-i,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),i=this.children[n];if(!(i instanceof ai))return null;for(;i.children.length;){let{i:a,off:l}=i.childPos(r,1);for(;;a++){if(a==i.children.length)return null;if((i=i.children[a]).length)break}r=l}if(!(i instanceof tl))return null;let s=ts(i.text,r);if(s==r)return null;let o=Qh(i.dom,r,s).getClientRects();for(let a=0;a<o.length;a++){let l=o[a];if(a==o.length-1||l.top<l.bottom&&l.left<l.right)return l}return null}measureVisibleLineHeights(e){let n=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==gr.LTR;for(let c=0,u=0;u<this.children.length;u++){let d=this.children[u],f=c+d.length;if(f>i)break;if(c>=r){let h=d.dom.getBoundingClientRect();if(n.push(h.height),o){let A=d.dom.lastChild,p=A?ay(A):[];if(p.length){let m=p[p.length-1],g=l?m.right-h.left:h.right-m.left;g>a&&(a=g,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=f)}}}c=f+d.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?gr.RTL:gr.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ai){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),n,r,i;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=ay(e.firstChild)[0];n=e.getBoundingClientRect().height,r=s?s.width/27:7,i=s?s.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new eK(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Ct.replace({widget:new TD(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return Ct.set(e)}updateDeco(){let e=1,n=this.view.state.facet(ly).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(SK).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(yn.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(xK))try{if(c(this.view,e.range,e))return!0}catch(u){zs(this.view.state,u,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=BK(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;EAe(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==gr.LTR)}}function WAe(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}class TD extends Au{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function MK(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=JW(n.focusNode,n.focusOffset),i=ZW(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let a=rr.get(i.node);if(!a||a instanceof tl&&a.text!=i.node.nodeValue)s=i;else if(t.docView.lastCompositionAfterCursor){let l=rr.get(r.node);!l||l instanceof tl&&l.text!=r.node.nodeValue||(s=i)}}if(t.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function KAe(t,e,n){let r=MK(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||t.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc,c=new ya(l.mapPos(s),l.mapPos(o),s,o),u=[];for(let d=i.parentNode;;d=d.parentNode){let f=rr.get(d);if(f instanceof Jc)u.push({node:d,deco:f.mark});else{if(f instanceof ai||d.nodeName=="DIV"&&d.parentNode==t.contentDOM)return{range:c,text:i,marks:u,line:d};if(d!=t.contentDOM)u.push({node:d,deco:new iv({inclusive:!0,attributes:IAe(d),tagName:d.tagName.toLowerCase()})});else return null}}}function $Ae(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let qAe=class{constructor(){this.changes=[]}compareRange(e,n){sk(e,n,this.changes)}comparePoint(e,n){sk(e,n,this.changes)}};function XAe(t,e,n){let r=new qAe;return yn.compare(t,e,n,r),r.changes}function YAe(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function JAe(t,e){let n=!1;return e&&t.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(n=!0)}),n}function ZAe(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return qe.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,a=s;n<0?o=ts(i.text,s,!1):a=ts(i.text,s);let l=r(i.text.slice(o,a));for(;o>0;){let c=ts(i.text,o,!1);if(r(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=ts(i.text,a);if(r(i.text.slice(a,c))!=l)break;a=c}return qe.range(o+i.from,a+i.from)}function epe(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function tpe(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function AT(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function BD(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function MD(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function uk(t,e,n){let r,i,s,o,a=!1,l,c,u,d;for(let A=t.firstChild;A;A=A.nextSibling){let p=ay(A);for(let m=0;m<p.length;m++){let g=p[m];i&&AT(i,g)&&(g=BD(MD(g,i.bottom),i.top));let y=epe(e,g),w=tpe(n,g);if(y==0&&w==0)return A.nodeType==3?kD(A,e,n):uk(A,e,n);if(!r||o>w||o==w&&s>y){r=A,i=g,s=y,o=w;let v=w?n<g.top?-1:1:y?e<g.left?-1:1:0;a=!v||(v>0?m<p.length-1:m>0)}y==0?n>g.bottom&&(!u||u.bottom<g.bottom)?(l=A,u=g):n<g.top&&(!d||d.top>g.top)&&(c=A,d=g):u&&AT(u,g)?u=MD(u,g.bottom):d&&AT(d,g)&&(d=BD(d,g.top))}}if(u&&u.bottom>=n?(r=l,i=u):d&&d.top<=n&&(r=c,i=d),!r)return{node:t,offset:0};let f=Math.max(i.left,Math.min(i.right,e));if(r.nodeType==3)return kD(r,f,n);if(a&&r.contentEditable!="false")return uk(r,f,n);let h=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(i.left+i.right)/2?1:0);return{node:t,offset:h}}function kD(t,e,n){let r=t.nodeValue.length,i=-1,s=1e9,o=0;for(let a=0;a<r;a++){let l=Qh(t,a,a+1).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(u.top==u.bottom)continue;o||(o=e-u.left);let d=(u.top>n?u.top-n:n-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&d<s){let f=e>=(u.left+u.right)/2,h=f;if((_t.chrome||_t.gecko)&&Qh(t,a).getBoundingClientRect().left==u.right&&(h=!f),d<=0)return{node:t,offset:a+(h?1:0)};i=a+(h?1:0),s=d}}}return{node:t,offset:i>-1?i:o>0?t.nodeValue.length:0}}function kK(t,e,n,r=-1){var i,s;let o=t.contentDOM.getBoundingClientRect(),a=o.top+t.viewState.paddingTop,l,{docHeight:c}=t.viewState,{x:u,y:d}=e,f=d-a;if(f<0)return 0;if(f>c)return t.state.doc.length;for(let v=t.viewState.heightOracle.textHeight/2,x=!1;l=t.elementAtHeight(f),l.type!=Ws.Text;)for(;f=r>0?l.bottom+v:l.top-v,!(f>=0&&f<=c);){if(x)return n?null:0;x=!0,r=-r}d=a+f;let h=l.from;if(h<t.viewport.from)return t.viewport.from==0?0:n?null:RD(t,o,l,u,d);if(h>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:RD(t,o,l,u,d);let A=t.dom.ownerDocument,p=t.root.elementFromPoint?t.root:A,m=p.elementFromPoint(u,d);m&&!t.contentDOM.contains(m)&&(m=null),m||(u=Math.max(o.left+1,Math.min(o.right-1,u)),m=p.elementFromPoint(u,d),m&&!t.contentDOM.contains(m)&&(m=null));let g,y=-1;if(m&&((i=t.docView.nearest(m))===null||i===void 0?void 0:i.isEditable)!=!1){if(A.caretPositionFromPoint){let v=A.caretPositionFromPoint(u,d);v&&({offsetNode:g,offset:y}=v)}else if(A.caretRangeFromPoint){let v=A.caretRangeFromPoint(u,d);v&&({startContainer:g,startOffset:y}=v,(!t.contentDOM.contains(g)||_t.safari&&npe(g,y,u)||_t.chrome&&rpe(g,y,u))&&(g=void 0))}}if(!g||!t.docView.dom.contains(g)){let v=ai.find(t.docView,h);if(!v)return f>l.top+l.height/2?l.to:l.from;({node:g,offset:y}=uk(v.dom,u,d))}let w=t.docView.nearest(g);if(!w)return null;if(w.isWidget&&((s=w.dom)===null||s===void 0?void 0:s.nodeType)==1){let v=w.dom.getBoundingClientRect();return e.y<v.top||e.y<=v.bottom&&e.x<=(v.left+v.right)/2?w.posAtStart:w.posAtEnd}else return w.localPosFromDOM(g,y)+w.posAtStart}function RD(t,e,n,r,i){let s=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((i-n.top-(t.defaultLineHeight-a)*.5)/a);s+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+XM(o,s,t.state.tabSize)}function npe(t,e,n){let r;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(let i=t.nextSibling;i;i=i.nextSibling)if(i.nodeType!=1||i.nodeName!="BR")return!1;return Qh(t,r-1,r).getBoundingClientRect().left>n}function rpe(t,e,n){if(e!=0)return!1;for(let i=t;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let r=t.nodeType==1?t.getBoundingClientRect():Qh(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function dk(t,e){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){for(let r of n.type)if(r.to>e||r.to==e&&(r.to==n.to||r.type==Ws.Text))return r}return n}function ipe(t,e,n,r){let i=dk(t,e.head),s=!r||i.type!=Ws.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(i.from),l=t.posAtCoords({x:n==(a==gr.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return qe.cursor(l,n?-1:1)}return qe.cursor(n?i.to:i.from,n?-1:1)}function PD(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let a=e,l=null;;){let c=zAe(i,s,o,a,n),u=hK;if(!c){if(i.number==(n?t.state.doc.lines:1))return a;u=`
`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),c=t.visualLineSide(i,!n)}if(l){if(!l(u))return a}else{if(!r)return c;l=r(u)}a=c}}function spe(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==_r.Space&&(i=o),i==o}}function ope(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return qe.cursor(i,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i,e.assoc||-1),u=t.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let h=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-h.from))),a=(s<0?h.top:h.bottom)+u}let d=l.left+o,f=r??t.viewState.heightOracle.textHeight>>1;for(let h=0;;h+=10){let A=a+(f+h)*s,p=kK(t,{x:d,y:A},!1,s);if(A<l.top||A>l.bottom||(s<0?p<i:p>i)){let m=t.docView.coordsForChar(p),g=!m||A<m.top?-1:1;return qe.cursor(p,g,void 0,o)}}}function Mx(t,e,n){for(;;){let r=0;for(let i of t)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||n||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function pT(t,e,n){let r=Mx(t.state.facet(kL).map(i=>i(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:qe.cursor(r,r<n.from?1:-1)}class ape{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,_t.safari&&e.contentDOM.addEventListener("input",()=>null),_t.gecko&&Cpe(e.contentDOM.ownerDocument)}handleEvent(e){!ppe(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=lpe(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&PK.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),_t.android&&_t.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return _t.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=RK.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||cpe.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Zp(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:_t.safari&&!_t.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function LD(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){zs(n.state,i)}}}function lpe(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec;if(i&&i.domEventHandlers)for(let s in i.domEventHandlers){let o=i.domEventHandlers[s];o&&n(s).handlers.push(LD(r.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&n(s).observers.push(LD(r.value,o))}}for(let r in nl)n(r).handlers.push(nl[r]);for(let r in Ca)n(r).observers.push(Ca[r]);return e}const RK=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],cpe="dthko",PK=[16,17,18,20,91,92,224,225],Ub=6;function Hb(t){return Math.max(0,t)*.7+8}function upe(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class dpe{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=TAe(e.contentDOM),this.atoms=e.state.facet(kL).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Tn.allowMultipleSelections)&&fpe(e,n),this.dragging=Ape(e,n)&&OK(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&upe(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=BK(this.view);e.clientX-l.left<=i+Ub?n=-Hb(i-e.clientX):e.clientX+l.right>=o-Ub&&(n=Hb(e.clientX-o)),e.clientY-l.top<=s+Ub?r=-Hb(s-e.clientY):e.clientY+l.bottom>=a-Ub&&(r=Hb(e.clientY-a)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let n=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=Mx(this.atoms,i.from,0);o!=i.from&&(s=qe.cursor(o,-1))}else{let o=Mx(this.atoms,i.from,-1),a=Mx(this.atoms,i.to,1);(o!=i.from||a!=i.to)&&(s=qe.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(n||(n=e.ranges.slice()),n[r]=s)}return n?qe.create(n,e.mainIndex):e}select(e){let{view:n}=this,r=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function fpe(t,e){let n=t.state.facet(AK);return n.length?n[0](e):_t.mac?e.metaKey:e.ctrlKey}function hpe(t,e){let n=t.state.facet(pK);return n.length?n[0](e):_t.mac?!e.altKey:!e.ctrlKey}function Ape(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=oy(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function ppe(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=rr.get(n))&&r.ignoreEvent(e))return!1;return!0}const nl=Object.create(null),Ca=Object.create(null),LK=_t.ie&&_t.ie_version<15||_t.ios&&_t.webkit_version<604;function mpe(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),IK(t,n.value)},50)}function IK(t,e){let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(fk!=null&&n.selection.ranges.every(l=>l.empty)&&fk==s.toString()){let l=-1;r=n.changeByRange(c=>{let u=n.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let d=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:u.from,insert:d},range:qe.cursor(c.from+d.length)}})}else o?r=n.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:qe.cursor(l.from+c.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Ca.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};nl.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ca.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ca.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};nl.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(mK))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=vpe(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new dpe(t,e,n,r)),r&&t.observer.ignore(()=>{qW(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function ID(t,e,n,r){if(r==1)return qe.cursor(e,n);if(r==2)return ZAe(t.state,e,n);{let i=ai.find(t.docView,e),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<t.state.doc.length&&a==s.to&&a++,qe.range(o,a)}}let OD=(t,e,n)=>e>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function gpe(t,e,n,r){let i=ai.find(t.docView,e);if(!i)return 1;let s=e-i.posAtStart;if(s==0)return 1;if(s==i.length)return-1;let o=i.coordsAt(s,-1);if(o&&OD(n,r,o))return-1;let a=i.coordsAt(s,1);return a&&OD(n,r,a)?1:o&&o.bottom>=r?-1:1}function FD(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:gpe(t,n,e.clientX,e.clientY)}}const ype=_t.ie&&_t.ie_version<=11;let ND=null,DD=0,UD=0;function OK(t){if(!ype)return t.detail;let e=ND,n=UD;return ND=t,UD=Date.now(),DD=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(DD+1)%3:1}function vpe(t,e){let n=FD(t,e),r=OK(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,a){let l=FD(t,s),c,u=ID(t,l.pos,l.bias,r);if(n.pos!=l.pos&&!o){let d=ID(t,n.pos,n.bias,r),f=Math.min(d.from,u.from),h=Math.max(d.to,u.to);u=f<u.from?qe.range(f,h):qe.range(h,f)}return o?i.replaceRange(i.main.extend(u.from,u.to)):a&&r==1&&i.ranges.length>1&&(c=bpe(i,l.pos))?c:a?i.addRange(u):qe.create([u])}}}function bpe(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:i}=t.ranges[n];if(r<=e&&i>=e)return qe.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}nl.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.nearest(e.target);if(i&&i.isWidget){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=qe.range(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(n.from,n.to)),e.dataTransfer.effectAllowed="copyMove"),!1};nl.dragend=t=>(t.inputState.draggedContent=null,!1);function HD(t,e,n,r){if(!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&hpe(t,e)?{from:s.from,to:s.to}:null,a={from:i,insert:n},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}nl.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&HD(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return HD(t,e,r,!0),!0}return!1};nl.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=LK?null:e.clipboardData;return n?(IK(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(mpe(t),!1)};function wpe(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function xpe(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:e.join(t.lineBreak),ranges:n,linewise:r}}let fk=null;nl.copy=nl.cut=(t,e)=>{let{text:n,ranges:r,linewise:i}=xpe(t.state);if(!n&&!i)return!1;fk=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=LK?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(wpe(t,n),!1)};const FK=ls.define();function NK(t,e){let n=[];for(let r of t.facet(vK)){let i=r(t,e);i&&n.push(i)}return n?t.update({effects:n,annotations:FK.of(!0)}):null}function DK(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=NK(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ca.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),DK(t)};Ca.blur=t=>{t.observer.clearSelectionRange(),DK(t)};Ca.compositionstart=Ca.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ca.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,_t.chrome&&_t.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ca.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};nl.beforeinput=(t,e)=>{var n;let r;if(_t.chrome&&_t.android&&(r=RK.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let i=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return _t.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),_t.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ca.compositionend(t,e),20),!1};const jD=new Set;function Cpe(t){jD.has(t)||(jD.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const QD=["pre-wrap","normal","pre-line","break-spaces"];let Im=!1;function zD(){Im=!1}class _pe{constructor(e){this.lineWrapping=e,this.doc=Mn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return QD.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(n=!0,this.heightSamples[Math.floor(i*10)]=!0)}return n}refresh(e,n,r,i,s,o){let a=QD.indexOf(e)>-1,l=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class Spe{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Tl{constructor(e,n,r,i,s){this.from=e,this.length=n,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?Ws.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof sf?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Tl(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Ar=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Ar||(Ar={}));const kx=.001;class Ks{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>kx&&(Im=!0),this.height=e)}replace(e,n,r){return Ks.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:d}=i[a],f=s.lineAt(l,Ar.ByPosNoHeight,r.setDoc(n),0,0),h=f.to>=c?f:s.lineAt(c,Ar.ByPosNoHeight,r,0,0);for(d+=h.to-c,c=h.to;a>0&&f.from<=i[a-1].toA;)l=i[a-1].fromA,u=i[a-1].fromB,a--,l<f.from&&(f=s.lineAt(l,Ar.ByPosNoHeight,r,0,0));u+=f.from-l,l=f.from;let A=RL.build(r.setDoc(o),e,u,d);s=GC(s,s.replace(l,c,A))}return s.updateHeight(r,0)}static empty(){return new Mo(0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,i=0,s=0;for(;;)if(n==r)if(i>s*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(s>i*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[n++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,r++),new Epe(Ks.of(e.slice(0,n)),o,Ks.of(e.slice(r)))}}function GC(t,e){return t==e?t:(t.constructor!=e.constructor&&(Im=!0),e)}Ks.prototype.size=1;class UK extends Ks{constructor(e,n,r){super(e,n),this.deco=r}blockAt(e,n,r,i){return new Tl(i,this.length,r,this.height,this.deco||0)}lineAt(e,n,r,i,s){return this.blockAt(0,r,i,s)}forEachLine(e,n,r,i,s,o){e<=s+this.length&&n>=s&&o(this.blockAt(0,r,i,s))}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Mo extends UK{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,i){return new Tl(i,this.length,r,this.height,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof Mo||i instanceof Vi&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Vi?i=new Mo(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Ks.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setHeight(i.heights[i.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Vi extends Ks{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:a}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,i);if(n.lineWrapping){let c=i+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),u=n.doc.lineAt(c),d=a+u.length*l,f=Math.max(r,e-d/2);return new Tl(u.from,u.length,f,d,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:u,length:d}=n.doc.line(s+c);return new Tl(u,d,r+a*c,a,0)}}lineAt(e,n,r,i,s){if(n==Ar.ByHeight)return this.blockAt(e,r,i,s);if(n==Ar.ByPosNoHeight){let{from:h,to:A}=r.doc.lineAt(e);return new Tl(h,A-h,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,s),c=r.doc.lineAt(e),u=a+c.length*l,d=c.number-o,f=i+a*d+l*(c.from-s-d);return new Tl(c.from,c.length,Math.max(i,Math.min(f,i+this.height-u)),u,0)}forEachLine(e,n,r,i,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let u=e,d=i;u<=n;){let f=r.doc.lineAt(u);if(u==e){let A=f.number-a;d+=l*A+c*(e-s-A)}let h=l+c*f.length;o(new Tl(f.from,f.length,d,h,0)),d+=h,u=f.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let s=r[r.length-1];s instanceof Vi?r[r.length-1]=new Vi(s.length+i):r.push(null,new Vi(i-1))}if(e>0){let s=r[0];s instanceof Vi?r[0]=new Vi(e+s.length):r.unshift(new Vi(e-1),null)}return Ks.of(r)}decomposeLeft(e,n){n.push(new Vi(e-1),null)}decomposeRight(e,n){n.push(null,new Vi(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],a=Math.max(n,i.from),l=-1;for(i.from>n&&o.push(new Vi(i.from-n-1).updateHeight(e,n));a<=s&&i.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let d=i.heights[i.index++];l==-1?l=d:Math.abs(d-l)>=kx&&(l=-2);let f=new Mo(u,d);f.outdated=!1,o.push(f),a+=u+1}a<=s&&o.push(null,new Vi(s-a).updateHeight(e,a));let c=Ks.of(o);return(l<0||Math.abs(c.height-this.height)>=kx||Math.abs(l-this.heightMetrics(e,n).perLine)>=kx)&&(Im=!0),GC(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Epe extends Ks{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,n,r,i):this.right.blockAt(e,n,s,i+this.left.length+this.break)}lineAt(e,n,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=n==Ar.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,n,r,i,s):this.right.lineAt(e,n,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=n==Ar.ByPosNoHeight?Ar.ByPosNoHeight:Ar.ByPos;return l?c.join(this.right.lineAt(a,u,r,o,a)):this.left.lineAt(a,u,r,i,s).join(c)}forEachLine(e,n,r,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,r,i,s,o),n>=l&&this.right.forEachLine(e,n,r,a,l,o);else{let c=this.lineAt(l,Ar.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,o),c.to>=e&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,a,l,o)}}replace(e,n,r){let i=this.left.length+this.break;if(n<i)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&VD(s,o-1),n<this.length){let a=s.length;this.decomposeRight(n,s),VD(s,a)}return Ks.of(s)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<i&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?Ks.of(this.break?[e,null,n]:[e,n]):(this.left=GC(this.left,e),this.right=GC(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,a=n+s.length+this.break,l=null;return i&&i.from<=n+s.length&&i.more?l=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,r,i):o.updateHeight(e,a,r),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function VD(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof Vi&&(r=t[e+1])instanceof Vi&&t.splice(e-1,3,new Vi(n.length+1+r.length))}const Tpe=5;class RL{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Mo?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Mo(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=n-e;r.block?this.addBlock(new UK(o,i,r)):(o||s||i>=Tpe)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Mo(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new Vi(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Mo)return e;let n=new Mo(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Mo)&&!this.isCovered?this.nodes.push(new Mo(0,-1)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof Mo&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,n,r,i){let s=new RL(r,e);return yn.spans(n,r,i,s,0),s.finish(r)}}function Bpe(t,e,n){let r=new Mpe;return yn.compare(t,e,n,r,0),r.changes}class Mpe{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&sk(e,n,this.changes,5)}}function kpe(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,i=r.defaultView||window,s=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let c=t.parentNode;c&&c!=r.body;)if(c.nodeType==1){let u=c,d=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&d.overflow!="visible"){let f=u.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=c==t.parentNode?f.bottom:Math.min(l,f.bottom)}c=d.position=="absolute"||d.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function Rpe(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class mT{constructor(e,n,r){this.from=e,this.to=n,this.size=r}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=n[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,n){return Ct.replace({widget:new Ppe(this.size*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class Ppe extends Au{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class GD{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=WD,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=gr.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(ML).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new _pe(n),this.stateDeco=e.facet(ly).filter(r=>typeof r!="function"),this.heightMap=Ks.empty().applyChanges(this.stateDeco,Mn.empty,this.heightOracle.setDoc(e.doc),[new ya(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ct.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new jb(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?WD:new PL(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(P0(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(ly).filter(u=>typeof u!="function");let i=e.changedRanges,s=ya.extendWithRanges(i,Bpe(r,this.stateDeco,e?e.changes:gi.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);zD(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Im)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(wK)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?gr.RTL:gr.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,u=0;if(a.width&&a.height){let{scaleX:v,scaleY:x}=$W(n,a);(v>.005&&Math.abs(this.scaleX-v)>.005||x>.005&&Math.abs(this.scaleY-x)>.005)&&(this.scaleX=v,this.scaleY=x,c|=8,o=l=!0)}let d=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=f)&&(this.paddingTop=d,this.paddingBottom=f,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let h=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=h&&(this.scrollAnchorHeight=-1,this.scrollTop=h),this.scrolledToBottom=YW(e.scrollDOM);let A=(this.printing?Rpe:kpe)(n,this.paddingTop),p=A.top-this.pixelViewport.top,m=A.bottom-this.pixelViewport.bottom;this.pixelViewport=A;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let y=a.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let v=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(v)&&(o=!0),o||i.lineWrapping&&Math.abs(y-this.contentDOMWidth)>i.charWidth){let{lineHeight:x,charWidth:C,textHeight:_}=e.docView.measureTextSize();o=x>0&&i.refresh(s,x,C,_,y/C,v),o&&(e.docView.minWidth=0,c|=8)}p>0&&m>0?u=Math.max(p,m):p<0&&m<0&&(u=Math.min(p,m)),zD();for(let x of this.viewports){let C=x.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(x);this.heightMap=(o?Ks.empty().applyChanges(this.stateDeco,Mn.empty,this.heightOracle,[new ya(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new Spe(x.from,C))}Im&&(c|=2)}let w=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return w&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new jb(i.lineAt(o-r*1e3,Ar.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,Ar.ByHeight,s,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=i.lineAt(c,Ar.ByPos,s,0,0),f;n.y=="center"?f=(d.top+d.bottom)/2-u/2:n.y=="start"||n.y=="nearest"&&c<l.from?f=d.top:f=d.bottom-u,l=new jb(i.lineAt(f-1e3/2,Ar.ByHeight,s,0,0).from,i.lineAt(f+u+1e3/2,Ar.ByHeight,s,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new jb(this.heightMap.lineAt(r,Ar.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Ar.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Ar.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(n,Ar.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let i of e)n.touchesRange(i.from,i.to)||r.push(new mT(n.mapPos(i.from),n.mapPos(i.to),i.size));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=gr.LTR&&!r)return[];let a=[],l=(u,d,f,h)=>{if(d-u<s)return;let A=this.state.selection.main,p=[A.from];A.empty||p.push(A.to);for(let g of p)if(g>u&&g<d){l(u,g-10,f,h),l(g+10,d,f,h);return}let m=Ipe(e,g=>g.from>=f.from&&g.to<=f.to&&Math.abs(g.from-u)<s&&Math.abs(g.to-d)<s&&!p.some(y=>g.from<y&&g.to>y));if(!m){if(d<f.to&&n&&r&&n.visibleRanges.some(g=>g.from<=d&&g.to>=d)){let g=n.moveToLineBoundary(qe.cursor(d),!1,!0).head;g>u&&(d=g)}m=new mT(u,d,this.gapSize(f,u,d,h))}a.push(m)},c=u=>{if(u.length<o||u.type!=Ws.Text)return;let d=Lpe(u.from,u.to,this.stateDeco);if(d.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,h,A;if(r){let p=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,m,g;if(f!=null){let y=zb(d,f),w=((this.visibleBottom-this.visibleTop)/2+p)/u.height;m=y-w,g=y+w}else m=(this.visibleTop-u.top-p)/u.height,g=(this.visibleBottom-u.top+p)/u.height;h=Qb(d,m),A=Qb(d,g)}else{let p=d.total*this.heightOracle.charWidth,m=i*this.heightOracle.charWidth,g,y;if(f!=null){let w=zb(d,f),v=((this.pixelViewport.right-this.pixelViewport.left)/2+m)/p;g=w-v,y=w+v}else g=(this.pixelViewport.left-m)/p,y=(this.pixelViewport.right+m)/p;h=Qb(d,g),A=Qb(d,y)}h>u.from&&l(u.from,h,u,d),A<u.to&&l(A,u.to,u,d)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return a}gapSize(e,n,r,i){let s=zb(i,r)-zb(i,n);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){mT.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ct.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];yn.spans(e,this.viewport.from,this.viewport.to,{span(i,s){n.push({from:i,to:s})},point(){}},20);let r=n.length!=this.visibleRanges.length||this.visibleRanges.some((i,s)=>i.from!=n[s].from||i.to!=n[s].to);return this.visibleRanges=n,r?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||P0(this.heightMap.lineAt(e,Ar.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||P0(this.heightMap.lineAt(this.scaler.fromDOM(e),Ar.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return P0(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class jb{constructor(e,n){this.from=e,this.to=n}}function Lpe(t,e,n){let r=[],i=t,s=0;return yn.spans(n,t,e,{span(){},point(o,a){o>i&&(r.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function Qb({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function zb(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function Ipe(t,e){for(let n of t)if(e(n))return n}const WD={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class PL{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,Ar.ByPos,e,0,0).top,u=n.lineAt(l,Ar.ByPos,e,0,0).bottom;return i+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof PL?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function P0(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Tl(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>P0(i,e)):t._content)}const Vb=bt.define({combine:t=>t.join(" ")}),hk=bt.define({combine:t=>t.indexOf(!0)>-1}),Ak=nf.newName(),HK=nf.newName(),jK=nf.newName(),QK={"&light":"."+HK,"&dark":"."+jK};function pk(t,e,n){return new nf(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const Ope=pk("."+Ak,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},QK),L0="￿";class Fpe{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(Tn.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=L0}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==n)break;let a=rr.get(i),l=rr.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:QC(i))||QC(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(n))&&(s=a.index,o=a[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=s+o}}readNode(e){if(e.cmIgnore)return;let n=rr.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(Npe(e,r.node,r.offset)?n:0))}}function Npe(t,e,n){for(;;){if(!e||n<Yc(e))return!1;if(e==t)return!0;n=jh(e)+1,e=e.parentNode}}class KD{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class Dpe{constructor(e,n,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let a=s||o?[]:jpe(e),l=new Fpe(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=Qpe(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!ZM(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!ZM(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),u=e.viewport;if((_t.ios||_t.chrome)&&e.state.selection.main.empty&&l!=c&&(u.from>0||u.to<e.state.doc.length)){let d=Math.min(l,c),f=Math.max(l,c),h=u.from-d,A=u.to-f;(h==0||h==1||d==0)&&(A==0||A==-1||f==e.state.doc.length)&&(l=0,c=e.state.doc.length)}this.newSel=qe.single(c,l)}}}function zK(t,e){let n,{newSel:r}=e,i=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||_t.android&&e.text.length<a-o)&&(l=i.to,c="end");let u=Hpe(t.state.doc.sliceString(o,a,L0),e.text,l-o,c);u&&(_t.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==L0+L0&&u.toB--,n={from:o+u.from,to:o+u.toA,insert:Mn.of(e.text.slice(u.from,u.toB).split(L0))})}else r&&(!t.hasFocus&&t.state.facet(Zu)||r.main.eq(i))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!i.empty&&r&&r.main.empty?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,i.to)}:n&&n.from>=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,i.to))}:(_t.mac||_t.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=qe.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Mn.of([" "])}):_t.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&t.lineWrapping&&(r&&(r=qe.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Mn.of([" "])}),n)return VK(t,n,r,s);if(r&&!r.main.eq(i)){let o=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),a=t.inputState.lastSelectionOrigin),t.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function VK(t,e,n,r=-1){if(_t.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(_t.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Zp(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Zp(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Zp(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=Upe(t,e,n));return t.state.facet(yK).some(l=>l(t,e.from,e.to,s,a))||t.dispatch(a()),!0}function Upe(t,e,n){let r,i=t.state,s=i.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.from<e.from?i.sliceDoc(s.from,e.from):"",l=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+l))}else{let a=i.changes(e),l=n&&n.main.to<=a.newLength?n.main:void 0;if(i.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),u,d=n&&MK(t,n.main.head);if(d){let A=e.insert.length-(e.to-e.from);u={from:d.from,to:d.to-A}}else u=t.state.doc.lineAt(s.head);let f=s.to-e.to,h=s.to-s.from;r=i.changeByRange(A=>{if(A.from==s.from&&A.to==s.to)return{changes:a,range:l||A.map(a)};let p=A.to-f,m=p-c.length;if(A.to-A.from!=h||t.state.sliceDoc(m,p)!=c||A.to>=u.from&&A.from<=u.to)return{range:A};let g=i.changes({from:m,to:p,insert:e.insert}),y=A.to-s.to;return{changes:g,range:l?qe.range(Math.max(0,l.anchor+y),Math.max(0,l.head+y)):A.map(g)}})}else r={changes:a,selection:l&&i.selection.replaceRange(l)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:o,scrollIntoView:!0})}function Hpe(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&t.length<e.length){let l=n<=s&&n>=o?s-n:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function jpe(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new KD(n,r)),(i!=n||s!=r)&&e.push(new KD(i,s))),e}function Qpe(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?qe.single(n+e,r+e):null}const zpe={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},gT=_t.ie&&_t.ie_version<=11;class Vpe{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new BAe,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(_t.ie&&_t.ie_version<=11||_t.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(_t.chrome&&_t.chrome_version<126)&&(this.editContext=new Wpe(e),e.state.facet(Zu)&&(e.contentDOM.editContext=this.editContext.editContext)),gT&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(Zu)?r.root.activeElement!=this.dom:!Bx(r.dom,i))return;let s=i.anchorNode&&r.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(_t.ie&&_t.ie_version<=11||_t.android&&_t.chrome)&&!r.state.selection.main.empty&&i.focusNode&&m1(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=oy(e.root);if(!n)return!1;let r=_t.safari&&e.root.nodeType==11&&_Ae(this.dom.ownerDocument)==this.dom&&Gpe(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=Bx(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&kAe(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,zpe),gT&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),gT&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Zp(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Bx(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Dpe(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=zK(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=$D(n,e.previousSibling||e.target.previousSibling,-1),i=$D(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Zu)!=e.state.facet(Zu)&&(e.view.contentDOM.editContext=e.state.facet(Zu)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function $D(t,e,n){for(;e;){let r=rr.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function qD(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor);return m1(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Gpe(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return qD(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?qD(t,n):null}class Wpe{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let{anchor:i}=e.state.selection.main,s={from:this.toEditorPos(r.updateRangeStart),to:this.toEditorPos(r.updateRangeEnd),insert:Mn.of(r.text.split(`
`))};s.from==this.from&&i<this.from?s.from=i:s.to==this.to&&i>this.to&&(s.to=i),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||VK(e,s,qe.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}n.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(o!="None"&&a!="None"){let l=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${a=="Thin"?1:2}px`;i.push(Ct.mark({attributes:{style:l}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:CK.of(Ct.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=oy(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(r)return;let u=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,n+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=u}n+=u}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class At{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(r=>r.forEach(i=>n(i,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||MAe(e.parent)||document,this.viewState=new GD(e.state||Tn.create(e)),e.scrollTo&&e.scrollTo.is(Db)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(k0).map(r=>new hT(r));for(let r of this.plugins)r.update(this);this.observer=new Vpe(this),this.inputState=new ape(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ED(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let n=e.length==1&&e[0]instanceof Bn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(FK))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=NK(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(Tn.phrases)!=this.state.facet(Tn.phrases))return this.setState(s);i=VC.create(this,s,e),i.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(d&&(d=d.map(f.changes)),f.scrollIntoView){let{main:h}=f.state.selection;d=new em(h.empty?h:qe.cursor(h.head,h.head>h.anchor?-1:1))}for(let h of f.effects)h.is(Db)&&(d=h.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=WC.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(R0)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Vb)!=i.state.facet(Vb)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let f of this.state.facet(ck))try{f(i)}catch(h){zs(this.state,h,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!zK(this,u)&&c.force&&Zp(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new GD(e),this.plugins=e.facet(k0).map(r=>new hT(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new ED(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(k0),r=e.state.facet(k0);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new hT(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){zs(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(YW(r))s=-1,o=this.viewState.heightMap.height;else{let h=this.viewState.scrollAnchorAt(i);s=h.from,o=h.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(h=>{try{return h.read(this)}catch(A){return zs(this.state,A),XD}}),d=VC.create(this,this.state,[]),f=!1;d.flags|=l,n?n.flags|=l:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),f=this.docView.update(d),f&&this.docViewUpdate());for(let h=0;h<c.length;h++)if(u[h]!=XD)try{let A=c[h];A.write&&A.write(u[h],this)}catch(A){zs(this.state,A)}if(f&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let A=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(A>1||A<-1){i=i+A,r.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(ck))a(n)}get themeClasses(){return Ak+" "+(this.state.facet(hk)?jK:HK)+" "+this.state.facet(Vb)}updateAttrs(){let e=YD(this,_K,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Zu)?"true":"false",class:"cm-content",style:`${_t.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),YD(this,ML,n);let r=this.observer.ignore(()=>{let i=ik(this.contentDOM,this.contentAttrs,n),s=ik(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(At.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(R0);let e=this.state.facet(At.cspNonce);nf.mount(this.root,this.styleModules.concat(Ope).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.spec!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.spec==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return pT(this,e,PD(this,e,n,r))}moveByGroup(e,n){return pT(this,e,PD(this,e,n,r=>spe(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return qe.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return ipe(this,e,n,r)}moveVertically(e,n,r){return pT(this,e,ope(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),kK(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[ud.find(s,e-i.from,-1,n)];return EL(r,o.dir==gr.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(bK)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Kpe)return fK(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||dK(s.isolates,r=SD(this,e))))return s.order;r||(r=SD(this,e));let i=QAe(e.text,n,r);return this.bidiCache.push(new WC(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||_t.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qW(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return Db.of(new em(typeof e=="number"?qe.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Db.of(new em(qe.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Br.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Br.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=nf.newName(),i=[Vb.of(r),R0.of(pk(`.${r}`,e))];return n&&n.dark&&i.push(hk.of(!0)),i}static baseTheme(e){return Ea.lowest(R0.of(pk("."+Ak,e,QK)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&rr.get(r)||rr.get(e);return((n=i==null?void 0:i.rootView)===null||n===void 0?void 0:n.view)||null}}At.styleModule=R0;At.inputHandler=yK;At.scrollHandler=xK;At.focusChangeEffect=vK;At.perLineTextDirection=bK;At.exceptionSink=gK;At.updateListener=ck;At.editable=Zu;At.mouseSelectionStyle=mK;At.dragMovesSelection=pK;At.clickAddsSelectionRange=AK;At.decorations=ly;At.outerDecorations=SK;At.atomicRanges=kL;At.bidiIsolatedRanges=EK;At.scrollMargins=TK;At.darkTheme=hk;At.cspNonce=bt.define({combine:t=>t.length?t[0]:""});At.contentAttributes=ML;At.editorAttributes=_K;At.lineWrapping=At.contentAttributes.of({class:"cm-lineWrapping"});At.announce=Qt.define();const Kpe=4096,XD={};class WC{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:gr.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new WC(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function YD(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&rk(o,n)}return n}const $pe=_t.mac?"mac":_t.windows?"win":_t.linux?"linux":"key";function qpe(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Gb(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const Xpe=Ea.default(At.domEventHandlers({keydown(t,e){return WK(GK(e.state),t,e,"editor")}})),oA=bt.define({enables:Xpe}),JD=new WeakMap;function GK(t){let e=t.facet(oA),n=JD.get(e);return n||JD.set(e,n=Zpe(e.reduce((r,i)=>r.concat(i),[]))),n}function Ype(t,e,n){return WK(GK(t.state),e,t,n)}let ed=null;const Jpe=4e3;function Zpe(t,e=$pe){let n=Object.create(null),r=Object.create(null),i=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,c,u)=>{var d,f;let h=n[o]||(n[o]=Object.create(null)),A=a.split(/ (?!$)/).map(g=>qpe(g,e));for(let g=1;g<A.length;g++){let y=A.slice(0,g).join(" ");i(y,!0),h[y]||(h[y]={preventDefault:!0,stopPropagation:!1,run:[w=>{let v=ed={view:w,prefix:y,scope:o};return setTimeout(()=>{ed==v&&(ed=null)},Jpe),!0}]})}let p=A.join(" ");i(p,!1);let m=h[p]||(h[p]={preventDefault:!1,stopPropagation:!1,run:((f=(d=h._any)===null||d===void 0?void 0:d.run)===null||f===void 0?void 0:f.slice())||[]});l&&m.run.push(l),c&&(m.preventDefault=!0),u&&(m.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=o;for(let f in u)u[f].run.push(h=>d(h,mk))}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let mk=null;function WK(t,e,n,r){mk=e;let i=CAe(e),s=$i(i,0),o=aa(s)==i.length&&i!=" ",a="",l=!1,c=!1,u=!1;ed&&ed.view==n&&ed.scope==r&&(a=ed.prefix+" ",PK.indexOf(e.keyCode)<0&&(c=!0,ed=null));let d=new Set,f=m=>{if(m){for(let g of m.run)if(!d.has(g)&&(d.add(g),g(n)))return m.stopPropagation&&(u=!0),!0;m.preventDefault&&(m.stopPropagation&&(u=!0),c=!0)}return!1},h=t[r],A,p;return h&&(f(h[a+Gb(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(_t.windows&&e.ctrlKey&&e.altKey)&&(A=rf[e.keyCode])&&A!=i?(f(h[a+Gb(A,e,!0)])||e.shiftKey&&(p=sy[e.keyCode])!=i&&p!=A&&f(h[a+Gb(p,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(h[a+Gb(i,e,!0)])&&(l=!0),!l&&f(h._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),mk=null,l}class ov{constructor(e,n,r,i,s){this.className=e,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=KK(e);return[new ov(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return eme(e,n,r)}}function KK(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==gr.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function ZD(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let s=t.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=t.posAtCoords({x:s.left+1,y:o}),l=t.posAtCoords({x:s.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function eme(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),s=t.textDirection==gr.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=KK(t),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),d=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=a.right-(u?parseInt(u.paddingRight):0),h=dk(t,r),A=dk(t,i),p=h.type==Ws.Text?h:null,m=A.type==Ws.Text?A:null;if(p&&(t.lineWrapping||h.widgetLineBreaks)&&(p=ZD(t,r,1,p)),m&&(t.lineWrapping||A.widgetLineBreaks)&&(m=ZD(t,i,-1,m)),p&&m&&p.from==m.from&&p.to==m.to)return y(w(n.from,n.to,p));{let x=p?w(n.from,null,p):v(h,!1),C=m?w(null,n.to,m):v(A,!0),_=[];return(p||h).to<(m||A).from-(p&&m?1:0)||h.widgetLineBreaks>1&&x.bottom+t.defaultLineHeight/2<C.top?_.push(g(d,x.bottom,f,C.top)):x.bottom<C.top&&t.elementAtHeight((x.bottom+C.top)/2).type==Ws.Text&&(x.bottom=C.top=(x.bottom+C.top)/2),y(x).concat(_).concat(y(C))}function g(x,C,_,S){return new ov(e,x-l.left,C-l.top-.01,_-x,S-C+.01)}function y({top:x,bottom:C,horizontal:_}){let S=[];for(let E=0;E<_.length;E+=2)S.push(g(_[E],x,_[E+1],C));return S}function w(x,C,_){let S=1e9,E=-1e9,T=[];function R(M,F,I,z,Y){let $=t.coordsAtPos(M,M==_.to?-2:2),ee=t.coordsAtPos(I,I==_.from?2:-2);!$||!ee||(S=Math.min($.top,ee.top,S),E=Math.max($.bottom,ee.bottom,E),Y==gr.LTR?T.push(s&&F?d:$.left,s&&z?f:ee.right):T.push(!s&&z?d:ee.left,!s&&F?f:$.right))}let k=x??_.from,B=C??_.to;for(let M of t.visibleRanges)if(M.to>k&&M.from<B)for(let F=Math.max(M.from,k),I=Math.min(M.to,B);;){let z=t.state.doc.lineAt(F);for(let Y of t.bidiSpans(z)){let $=Y.from+z.from,ee=Y.to+z.from;if($>=I)break;ee>F&&R(Math.max($,F),x==null&&$<=k,Math.min(ee,I),C==null&&ee>=B,Y.dir)}if(F=z.to+1,F>=I)break}return T.length==0&&R(k,x==null,B,C==null,t.textDirection),{top:S,bottom:E,horizontal:T}}function v(x,C){let _=a.top+(C?x.top:x.bottom);return{top:_,bottom:_,horizontal:[]}}}function tme(t,e){return t.constructor==e.constructor&&t.eq(e)}class nme{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Rx)!=e.state.facet(Rx)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Rx);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!tme(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Rx=bt.define();function $K(t){return[Br.define(e=>new nme(e,t)),Rx.of(t)]}const qK=!_t.ios,cy=bt.define({combine(t){return il(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function rme(t={}){return[cy.of(t),ime,sme,ome,wK.of(!0)]}function XK(t){return t.startState.facet(cy)!=t.state.facet(cy)}const ime=$K({above:!0,markers(t){let{state:e}=t,n=e.facet(cy),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty?!s||qK:n.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:qe.cursor(i.head,i.head>i.anchor?-1:1);for(let l of ov.forRange(t,o,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=XK(t);return n&&e8(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){e8(e.state,t)},class:"cm-cursorLayer"});function e8(t,e){e.style.animationDuration=t.facet(cy).cursorBlinkRate+"ms"}const sme=$K({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:ov.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||XK(t)},class:"cm-selectionLayer"}),gk={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};qK&&(gk[".cm-line"].caretColor=gk[".cm-content"].caretColor="transparent !important");const ome=Ea.highest(At.theme(gk)),YK=Qt.define({map(t,e){return t==null?null:e.mapPos(t)}}),I0=Mr.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(YK)?r.value:n,t)}}),ame=Br.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(I0);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(I0)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(I0),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(I0)!=t&&this.view.dispatch({effects:YK.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function lme(){return[I0,ame]}function t8(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function cme(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class ume{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(a,l,c,u)=>i(u,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,u)=>{let d=r(a,l,c);d&&u(c,c+a[0].length,d)};else if(r)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let n=new tf,r=n.add.bind(n);for(let{from:i,to:s}of cme(e,this.maxLength))t8(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>e.view.viewport.from&&a<e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(l,i))}),e.viewportChanged||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,i);if(a>o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(s.from,l.from),d=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){d=a;break}}let f=[],h,A=(p,m,g)=>f.push(g.range(p,m));if(l==c)for(this.regexp.lastIndex=u-l.from;(h=this.regexp.exec(l.text))&&h.index<d-l.from;)this.addMatch(h,e,h.index+l.from,A);else t8(e.state.doc,this.regexp,u,d,(p,m)=>this.addMatch(m,e,p,A));n=n.update({filterFrom:u,filterTo:d,filter:(p,m)=>p<u||m>d,add:f})}}return n}}const yk=/x/.unicode!=null?"gu":"g",dme=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,yk),fme={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let yT=null;function hme(){var t;if(yT==null&&typeof document<"u"&&document.body){let e=document.body.style;yT=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return yT||!1}const Px=bt.define({combine(t){let e=il(t,{render:null,specialChars:dme,addSpecialChars:null});return(e.replaceTabs=!hme())&&(e.specialChars=new RegExp("	|"+e.specialChars.source,yk)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,yk)),e}});function Ame(t={}){return[Px.of(t),pme()]}let n8=null;function pme(){return n8||(n8=Br.fromClass(class{constructor(t){this.view=t,this.decorations=Ct.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Px)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new ume({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=$i(e[0],0);if(s==9){let o=i.lineAt(r),a=n.state.tabSize,l=Eg(o.text,a,r-o.from);return Ct.replace({widget:new vme((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Ct.replace({widget:new yme(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Px);t.startState.facet(Px)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const mme="•";function gme(t){return t>=32?mme:t==10?"␤":String.fromCharCode(9216+t)}class yme extends Au{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=gme(this.code),r=e.state.phrase("Control character")+" "+(fme[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class vme extends Au{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="	",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function bme(){return xme}const wme=Ct.line({class:"cm-activeLine"}),xme=Br.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(wme.range(i.from)),e=i.from)}return Ct.set(n)}},{decorations:t=>t.decorations}),vk=2e3;function Cme(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>vk||n.off>vk||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=i;l++){let c=t.doc.line(l);c.length<=a&&s.push(qe.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=i;l++){let c=t.doc.line(l),u=XM(c.text,o,t.tabSize,!0);if(u<0)s.push(qe.cursor(c.to));else{let d=XM(c.text,a,t.tabSize);s.push(qe.range(c.from+u,c.from+d))}}}return s}function _me(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function r8(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>vk?-1:i==r.length?_me(t,e.clientX):Eg(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function Sme(t,e){let n=r8(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=r8(t,i);if(!a)return r;let l=Cme(t.state,n,a);return l.length?o?qe.create(l.concat(r.ranges)):qe.create(l):r}}:null}function Eme(t){let e=n=>n.altKey&&n.button==0;return At.mouseSelectionStyle.of((n,r)=>e(r)?Sme(n,r):null)}const i0="-10000px";class JK{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=n?[]:null;for(let l=0;l<s.length;l++){let c=s[l],u=-1;if(c){for(let d=0;d<this.tooltips.length;d++){let f=this.tooltips[d];f&&f.create==c.create&&(u=d)}if(u<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let d=o[l]=this.tooltipViews[u];a&&(a[l]=n[u]),d.update&&d.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function Tme(t={}){return Lx.of(t)}function Bme(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Lx=bt.define({combine:t=>{var e,n,r;return{position:_t.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||Bme}}}),i8=new WeakMap,LL=Br.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Lx);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new JK(t,QS,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Lx);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=i0,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,n=1,r=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(_t.gecko)r=i.offsetParent!=this.container.ownerDocument.body;else if(i.style.top==i0&&i.style.left=="0px"){let s=i.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,n=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:n}=this.view.viewState);return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map((i,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Lx).tooltipSpace(this.view),scaleX:e,scaleY:n,makeAbsolute:r}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,d=t.pos[a],f=t.size[a];if(!d||d.bottom<=Math.max(n.top,r.top)||d.top>=Math.min(n.bottom,r.bottom)||d.right<Math.max(n.left,r.left)-.1||d.left>Math.min(n.right,r.right)+.1){u.style.top=i0;continue}let h=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,A=h?7:0,p=f.right-f.left,m=(e=i8.get(c))!==null&&e!==void 0?e:f.bottom-f.top,g=c.offset||kme,y=this.view.textDirection==gr.LTR,w=f.width>r.right-r.left?y?r.left:r.right-f.width:y?Math.max(r.left,Math.min(d.left-(h?14:0)+g.x,r.right-p)):Math.min(Math.max(r.left,d.left-p+(h?14:0)-g.x),r.right-p),v=this.above[a];!l.strictSide&&(v?d.top-(f.bottom-f.top)-g.y<r.top:d.bottom+(f.bottom-f.top)+g.y>r.bottom)&&v==r.bottom-d.bottom>d.top-r.top&&(v=this.above[a]=!v);let x=(v?d.top-r.top:r.bottom-d.bottom)-A;if(x<m&&c.resize!==!1){if(x<this.view.defaultLineHeight){u.style.top=i0;continue}i8.set(c,m),u.style.height=(m=x)/s+"px"}else u.style.height&&(u.style.height="");let C=v?d.top-m-A-g.y:d.bottom+A+g.y,_=w+p;if(c.overlap!==!0)for(let S of o)S.left<_&&S.right>w&&S.top<C+m&&S.bottom>C&&(C=v?S.top-m-2-A:S.bottom+A+2);if(this.position=="absolute"?(u.style.top=(C-t.parent.top)/s+"px",u.style.left=(w-t.parent.left)/i+"px"):(u.style.top=C/s+"px",u.style.left=w/i+"px"),h){let S=d.left+(y?g.x:-g.x)-(w+14-7);h.style.left=S/i+"px"}c.overlap!==!0&&o.push({left:w,top:C,right:_,bottom:C+m}),u.classList.toggle("cm-tooltip-above",v),u.classList.toggle("cm-tooltip-below",!v),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=i0}},{eventObservers:{scroll(){this.maybeMeasure()}}}),Mme=At.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),kme={x:0,y:0},QS=bt.define({enables:[LL,Mme]}),KC=bt.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class zS{static create(e){return new zS(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new JK(e,KC,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Rme=QS.compute([KC],t=>{let e=t.facet(KC);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:zS.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class Pme{constructor(e,n,r,i,s){this.view=e,this.source=n,this.field=r,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.nearest(n.target);if(!r)return;let i,s=1;if(r instanceof cd)i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let a=e.coordsAtPos(i);if(!a||n.y<a.top||n.y>a.bottom||n.x<a.left-e.defaultCharacterWidth||n.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),c=l&&l.dir==gr.RTL?-1:1;s=n.x<a.left?-c:c}let o=this.source(e,i,s);if(o!=null&&o.then){let a=this.pending={pos:i};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>zs(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(LL),n=e?e.manager.tooltips.findIndex(r=>r.create==zS.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!Lme(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!Ime(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Wb=4;function Lme(t,e){let n=t.getBoundingClientRect();return e.clientX>=n.left-Wb&&e.clientX<=n.right+Wb&&e.clientY>=n.top-Wb&&e.clientY<=n.bottom+Wb}function Ime(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=t.posAtCoords({x:r,y:i},!1);return l>=e&&l<=n}function ZK(t,e={}){let n=Qt.define(),r=Mr.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let a of i){let l=s.changes.mapPos(a.pos,-1,bi.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=s.changes.mapPos(c.end)),o.push(c)}}i=o}for(let o of s.effects)o.is(n)&&(i=o.value),o.is(Ome)&&(i=[]);return i},provide:i=>KC.from(i)});return[r,Br.define(i=>new Pme(i,t,r,n,e.hoverTime||300)),Rme]}function e$(t,e){let n=t.plugin(LL);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const Ome=Qt.define(),s8=bt.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function uy(t,e){let n=t.plugin(t$),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const t$=Br.fromClass(class{constructor(t){this.input=t.state.facet(dy),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(s8);this.top=new Kb(t,!0,e.topContainer),this.bottom=new Kb(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(s8);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Kb(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Kb(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(dy);if(n!=this.input){let r=n.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),a.push(u)):(u=this.panels[c],u.update&&u.update(t)),i.push(u),(u.top?s:o).push(u)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>At.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Kb{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=o8(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=o8(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function o8(t){let e=t.nextSibling;return t.remove(),e}const dy=bt.define({enables:t$});class Kl extends Hh{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Kl.prototype.elementClass="";Kl.prototype.toDOM=void 0;Kl.prototype.mapMode=bi.TrackBefore;Kl.prototype.startSide=Kl.prototype.endSide=-1;Kl.prototype.point=!0;const Ix=bt.define(),Fme={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>yn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},y1=bt.define();function n$(t){return[r$(),y1.of(Object.assign(Object.assign({},Fme),t))]}const a8=bt.define({combine:t=>t.some(e=>e)});function r$(t){return[Nme]}const Nme=Br.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(y1).map(e=>new c8(t,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(a8),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(a8)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let n=yn.iter(this.view.state.facet(Ix),this.view.viewport.from),r=[],i=this.gutters.map(s=>new Dme(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Ws.Text&&o){bk(n,r,a.from);for(let l of i)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==Ws.Text){bk(n,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(y1),n=t.state.facet(y1),r=t.docChanged||t.heightChanged||t.viewportChanged||!yn.eq(t.startState.facet(Ix),t.state.facet(Ix),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let s of n){let o=e.indexOf(s);o<0?i.push(new c8(this.view,s)):(this.gutters[o].update(t),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>At.scrollMargins.of(e=>{let n=e.plugin(t);return!n||n.gutters.length==0||!n.fixed?null:e.textDirection==gr.LTR?{left:n.dom.offsetWidth*e.scaleX}:{right:n.dom.offsetWidth*e.scaleX}})});function l8(t){return Array.isArray(t)?t:[t]}function bk(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class Dme{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=yn.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let a=new i$(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];bk(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n);r&&this.addElement(e,n,[r])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class c8{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=l8(n.markers(e)),n.initialSpacer&&(this.spacer=new i$(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=l8(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!yn.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class i${constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),Ume(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<n.length?n[s++]:null,c=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let d=o;d<this.markers.length;d++)if(this.markers[d].compare(l)){a=d,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let d=i.nextSibling;i.remove(),i=d}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function Ume(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const Hme=bt.define(),Sp=bt.define({combine(t){return il(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let s=r[i],o=n[i];r[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}});class vT extends Kl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function bT(t,e){return t.state.facet(Sp).formatNumber(e,t.state)}const jme=y1.compute([Sp],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Hme)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new vT(bT(e,e.state.doc.lineAt(n.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(Sp)!=e.state.facet(Sp),initialSpacer(e){return new vT(bT(e,u8(e.state.doc.lines)))},updateSpacer(e,n){let r=bT(n.view,u8(n.view.state.doc.lines));return r==e.number?e:new vT(r)},domEventHandlers:t.facet(Sp).domEventHandlers}));function Qme(t={}){return[Sp.of(t),r$(),jme]}function u8(t){let e=9;for(;e<t;)e=e*10+9;return e}const zme=new class extends Kl{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Vme=Ix.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(zme.range(i)))}return yn.of(e)});function Gme(){return Vme}let Wme=0;class ia{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=Wme++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof ia&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new ia(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new $C(e);return r=>r.modified.indexOf(n)>-1?r:$C.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let Kme=0;class $C{constructor(e){this.name=e,this.instances=[],this.id=Kme++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&$me(n,a.modified));if(r)return r;let i=[],s=new ia(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=qme(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push($C.get(a,l));return s}}function $me(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function qme(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function s$(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,a=i;for(let d=0;;){if(a=="..."&&d>0&&d+3==i.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+i);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),d+=f[0].length,d==i.length)break;let h=i[d++];if(d==i.length&&h=="!"){o=0;break}if(h!="/")throw new RangeError("Invalid path: "+i);a=i.slice(d)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new qC(r,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return o$.add(e)}const o$=new fn;class qC{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}qC.empty=new qC([],2,null);function a$(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function Xme(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function Yme(t,e,n,r=0,i=t.length){let s=new Jme(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class Jme{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(h=>!h.scope||h.scope(o)));let c=i,u=Zme(e)||qC.empty,d=Xme(s,u.tags);if(d&&(c&&(c+=" "),c+=d,u.mode==1&&(i+=(i?" ":"")+d)),this.startSpan(Math.max(n,a),c),u.opaque)return;let f=e.tree&&e.tree.prop(fn.mounted);if(f&&f.overlay){let h=e.node.enter(f.overlay[0].from+a,1),A=this.highlighters.filter(m=>!m.scope||m.scope(f.tree.type)),p=e.firstChild();for(let m=0,g=a;;m++){let y=m<f.overlay.length?f.overlay[m]:null,w=y?y.from+a:l,v=Math.max(n,g),x=Math.min(r,w);if(v<x&&p)for(;e.from<x&&(this.highlightRange(e,v,x,i,s),this.startSpan(Math.min(x,e.to),c),!(e.to>=w||!e.nextSibling())););if(!y||w>r)break;g=y.to+a,g>n&&(this.highlightRange(h.cursor(),Math.max(n,y.from+a),Math.min(r,g),"",A),this.startSpan(Math.min(r,g),c))}p&&e.parent()}else if(e.firstChild()){f&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function Zme(t){let e=t.type.prop(o$);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const mt=ia.define,$b=mt(),Gu=mt(),d8=mt(Gu),f8=mt(Gu),Wu=mt(),qb=mt(Wu),wT=mt(Wu),Al=mt(),Uf=mt(Al),dl=mt(),fl=mt(),wk=mt(),s0=mt(wk),Xb=mt(),Ie={comment:$b,lineComment:mt($b),blockComment:mt($b),docComment:mt($b),name:Gu,variableName:mt(Gu),typeName:d8,tagName:mt(d8),propertyName:f8,attributeName:mt(f8),className:mt(Gu),labelName:mt(Gu),namespace:mt(Gu),macroName:mt(Gu),literal:Wu,string:qb,docString:mt(qb),character:mt(qb),attributeValue:mt(qb),number:wT,integer:mt(wT),float:mt(wT),bool:mt(Wu),regexp:mt(Wu),escape:mt(Wu),color:mt(Wu),url:mt(Wu),keyword:dl,self:mt(dl),null:mt(dl),atom:mt(dl),unit:mt(dl),modifier:mt(dl),operatorKeyword:mt(dl),controlKeyword:mt(dl),definitionKeyword:mt(dl),moduleKeyword:mt(dl),operator:fl,derefOperator:mt(fl),arithmeticOperator:mt(fl),logicOperator:mt(fl),bitwiseOperator:mt(fl),compareOperator:mt(fl),updateOperator:mt(fl),definitionOperator:mt(fl),typeOperator:mt(fl),controlOperator:mt(fl),punctuation:wk,separator:mt(wk),bracket:s0,angleBracket:mt(s0),squareBracket:mt(s0),paren:mt(s0),brace:mt(s0),content:Al,heading:Uf,heading1:mt(Uf),heading2:mt(Uf),heading3:mt(Uf),heading4:mt(Uf),heading5:mt(Uf),heading6:mt(Uf),contentSeparator:mt(Al),list:mt(Al),quote:mt(Al),emphasis:mt(Al),strong:mt(Al),link:mt(Al),monospace:mt(Al),strikethrough:mt(Al),inserted:mt(),deleted:mt(),changed:mt(),invalid:mt(),meta:Xb,documentMeta:mt(Xb),annotation:mt(Xb),processingInstruction:mt(Xb),definition:ia.defineModifier("definition"),constant:ia.defineModifier("constant"),function:ia.defineModifier("function"),standard:ia.defineModifier("standard"),local:ia.defineModifier("local"),special:ia.defineModifier("special")};for(let t in Ie){let e=Ie[t];e instanceof ia&&(e.name=t)}a$([{tag:Ie.link,class:"tok-link"},{tag:Ie.heading,class:"tok-heading"},{tag:Ie.emphasis,class:"tok-emphasis"},{tag:Ie.strong,class:"tok-strong"},{tag:Ie.keyword,class:"tok-keyword"},{tag:Ie.atom,class:"tok-atom"},{tag:Ie.bool,class:"tok-bool"},{tag:Ie.url,class:"tok-url"},{tag:Ie.labelName,class:"tok-labelName"},{tag:Ie.inserted,class:"tok-inserted"},{tag:Ie.deleted,class:"tok-deleted"},{tag:Ie.literal,class:"tok-literal"},{tag:Ie.string,class:"tok-string"},{tag:Ie.number,class:"tok-number"},{tag:[Ie.regexp,Ie.escape,Ie.special(Ie.string)],class:"tok-string2"},{tag:Ie.variableName,class:"tok-variableName"},{tag:Ie.local(Ie.variableName),class:"tok-variableName tok-local"},{tag:Ie.definition(Ie.variableName),class:"tok-variableName tok-definition"},{tag:Ie.special(Ie.variableName),class:"tok-variableName2"},{tag:Ie.definition(Ie.propertyName),class:"tok-propertyName tok-definition"},{tag:Ie.typeName,class:"tok-typeName"},{tag:Ie.namespace,class:"tok-namespace"},{tag:Ie.className,class:"tok-className"},{tag:Ie.macroName,class:"tok-macroName"},{tag:Ie.propertyName,class:"tok-propertyName"},{tag:Ie.operator,class:"tok-operator"},{tag:Ie.comment,class:"tok-comment"},{tag:Ie.meta,class:"tok-meta"},{tag:Ie.invalid,class:"tok-invalid"},{tag:Ie.punctuation,class:"tok-punctuation"}]);var xT;const Ep=new fn;function ege(t){return bt.define({combine:t?e=>e.concat(t):void 0})}const tge=new fn;class Ka{constructor(e,n,r=[],i=""){this.data=e,this.name=i,Tn.prototype.hasOwnProperty("tree")||Object.defineProperty(Tn.prototype,"tree",{get(){return as(this)}}),this.parser=n,this.extension=[of.of(this),Tn.languageData.of((s,o,a)=>{let l=h8(s,o,a),c=l.type.prop(Ep);if(!c)return[];let u=s.facet(c),d=l.type.prop(tge);if(d){let f=l.resolve(o-l.from,a);for(let h of d)if(h.test(f,s)){let A=s.facet(h.facet);return h.type=="replace"?A:A.concat(u)}}return u})].concat(r)}isActiveAt(e,n,r=-1){return h8(e,n,r).type.prop(Ep)==this.data}findRegions(e){let n=e.facet(of);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Ep)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(fn.mounted);if(a){if(a.tree.prop(Ep)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof fi&&i(c,s.positions[l]+o)}};return i(as(e),0),r}get allowsNesting(){return!0}}Ka.setState=Qt.define();function h8(t,e,n){let r=t.facet(of),i=as(t).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,n,Pi.ExcludeBuffers))s.type.isTop&&(i=s);return i}class XC extends Ka{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=ege(e.languageData);return new XC(n,e.parser.configure({props:[Ep.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new XC(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function as(t){let e=t.field(Ka.state,!1);return e?e.tree:fi.empty}class nge{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let o0=null;class YC{constructor(e,n,r=[],i,s,o,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new YC(e,n,[],fi.empty,0,r,[],null)}startParse(){return this.parser.startParse(new nge(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=fi.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(xh.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(xh.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=o0;o0=this;try{return e()}finally{o0=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=A8(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,d,f)=>l.push({fromA:c,toA:u,fromB:d,toB:f})),r=xh.applyChanges(r,l),i=fi.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),d=e.mapPos(c.to,-1);u<d&&a.push({from:u,to:d})}}}return new YC(this.parser,n,r,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=A8(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends MW{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=o0;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new fi(mo.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return o0}}function A8(t,e,n){return xh.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Om{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new Om(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=YC.create(e.facet(of).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Om(r)}}Ka.state=Mr.define({create:Om.init,update(t,e){for(let n of e.effects)if(n.is(Ka.setState))return n.value;return e.startState.facet(of)!=e.state.facet(of)?Om.init(e.state):t.apply(e)}});let l$=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(l$=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const CT=typeof navigator<"u"&&(!((xT=navigator.scheduling)===null||xT===void 0)&&xT.isInputPending)?()=>navigator.scheduling.isInputPending():null,rge=Br.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Ka.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Ka.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=l$(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(Ka.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!CT?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>CT&&CT()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Ka.setState.of(new Om(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>zs(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),of=bt.define({combine(t){return t.length?t[0]:null},enables:t=>[Ka.state,rge,At.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class ige{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const c$=bt.define(),av=bt.define({combine:t=>{if(!t.length)return"  ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function JC(t){let e=t.facet(av);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function fy(t,e){let n="",r=t.tabSize,i=t.facet(av)[0];if(i=="	"){for(;e>=r;)n+="	",e-=r;i=" "}for(let s=0;s<e;s++)n+=i;return n}function IL(t,e){t instanceof Tn&&(t=new VS(t));for(let r of t.state.facet(c$)){let i=r(t,e);if(i!==void 0)return i}let n=as(t.state);return n.length>=e?sge(t,n,e):null}class VS{constructor(e,n={}){this.state=e,this.options=n,this.unit=JC(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,n);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return Eg(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const u$=new fn;function sge(t,e,n){let r=e.resolveStack(n),i=r.node.enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o!=r.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return d$(r,t,n)}function d$(t,e,n){for(let r=t;r;r=r.next){let i=age(r.node);if(i)return i(OL.create(e,n,r))}return 0}function oge(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function age(t){let e=t.type.prop(u$);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(fn.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>f$(o,!0,1,void 0,s&&!oge(o)?i.from:void 0)}return t.parent==null?lge:null}function lge(){return 0}class OL extends VS{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new OL(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(cge(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return d$(this.context.next,this.base,this.pos)}}function cge(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function uge(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped)return l.from<o?n:null;a=l.to}}function dge({closing:t,align:e=!0,units:n=1}){return r=>f$(r,e,n,t)}function f$(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==t.pos+o,l=e?uge(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}function fge({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const hge=200;function Age(){return Tn.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+hge)return t;let s=n.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return t;let{state:o}=t,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let d=IL(o,u.from);if(d==null)continue;let f=/^\s*/.exec(u.text)[0],h=fy(o,d);f!=h&&l.push({from:u.from,to:u.from+f.length,insert:h})}return l.length?[t,{changes:l,sequential:!0}]:t})}const h$=bt.define(),A$=new fn;function pge(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function mge(t,e,n){let r=as(t);if(r.length<n)return null;let i=r.resolveStack(n,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(s&&a.from<e)break;let l=a.type.prop(A$);if(l&&(a.to<r.length-50||r.length==t.doc.length||!gge(a))){let c=l(a,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(s=c)}}return s}function gge(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function ZC(t,e,n){for(let r of t.facet(h$)){let i=r(t,e,n);if(i)return i}return mge(t,e,n)}function p$(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const GS=Qt.define({map:p$}),lv=Qt.define({map:p$});function m$(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Vh=Mr.define({create(){return Ct.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)if(n.is(GS)&&!yge(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(v$),i=r?Ct.replace({widget:new Sge(r(e.state,n.value))}):p8;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(lv)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));if(e.selection){let n=!1,{head:r}=e.selection.main;t.between(r,r,(i,s)=>{i<r&&s>r&&(n=!0)}),n&&(t=t.update({filterFrom:r,filterTo:r,filter:(i,s)=>s<=r||i>=r}))}return t},provide:t=>At.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],i=t[n++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(p8.range(r,i))}return Ct.set(e,!0)}});function e_(t,e,n){var r;let i=null;return(r=t.field(Vh,!1))===null||r===void 0||r.between(e,n,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function yge(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function g$(t,e){return t.field(Vh,!1)?e:e.concat(Qt.appendConfig.of(FL()))}const vge=t=>{for(let e of m$(t)){let n=ZC(t.state,e.from,e.to);if(n)return t.dispatch({effects:g$(t.state,[GS.of(n),y$(t,n)])}),!0}return!1},bge=t=>{if(!t.state.field(Vh,!1))return!1;let e=[];for(let n of m$(t)){let r=e_(t.state,n.from,n.to);r&&e.push(lv.of(r),y$(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function y$(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return At.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const wge=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),s=ZC(e,i.from,i.to);s&&n.push(GS.of(s)),r=(s?t.lineBlockAt(s.to):i).to+1}return n.length&&t.dispatch({effects:g$(t.state,n)}),!!n.length},xge=t=>{let e=t.state.field(Vh,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(lv.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},Cge=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:vge},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bge},{key:"Ctrl-Alt-[",run:wge},{key:"Ctrl-Alt-]",run:xge}],_ge={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},v$=bt.define({combine(t){return il(t,_ge)}});function FL(t){return[Vh,Bge]}function b$(t,e){let{state:n}=t,r=n.facet(v$),i=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=e_(t.state,a.from,a.to);l&&t.dispatch({effects:lv.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const p8=Ct.replace({widget:new class extends Au{toDOM(t){return b$(t,null)}}});class Sge extends Au{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return b$(e,this.value)}}const Ege={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class _T extends Kl{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function Tge(t={}){let e=Object.assign(Object.assign({},Ege),t),n=new _T(e,!0),r=new _T(e,!1),i=Br.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(of)!=o.state.facet(of)||o.startState.field(Vh,!1)!=o.state.field(Vh,!1)||as(o.startState)!=as(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new tf;for(let l of o.viewportLineBlocks){let c=e_(o.state,l.from,l.to)?r:ZC(o.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,n$({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||yn.empty},initialSpacer(){return new _T(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=e_(o.state,a.from,a.to);if(c)return o.dispatch({effects:lv.of(c)}),!0;let u=ZC(o.state,a.from,a.to);return u?(o.dispatch({effects:GS.of(u)}),!0):!1}})}),FL()]}const Bge=At.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class cv{constructor(e,n){this.specs=e;let r;function i(a){let l=nf.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof Ka?a=>a.prop(Ep)==o.data:o?a=>a==o:void 0,this.style=a$(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new nf(r):null,this.themeType=n.themeType}static define(e,n){return new cv(e,n||{})}}const xk=bt.define(),w$=bt.define({combine(t){return t.length?[t[0]]:null}});function Ox(t){let e=t.facet(xk);return e.length?e:t.facet(w$)}function x$(t,e){let n=[Rge],r;return t instanceof cv&&(t.module&&n.push(At.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(w$.of(t)):r?n.push(xk.computeN([At.darkTheme],i=>i.facet(At.darkTheme)==(r=="dark")?[t]:[])):n.push(xk.of(t)),n}function Mge(t,e,n){let r=Ox(t),i=null;if(r){for(let s of r)if(!s.scope||n){let o=s.style(e);o&&(i=i?i+" "+o:o)}}return i}class kge{constructor(e){this.markCache=Object.create(null),this.tree=as(e.state),this.decorations=this.buildDeco(e,Ox(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=as(e.state),r=Ox(e.state),i=r!=Ox(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!i&&n.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return Ct.none;let r=new tf;for(let{from:i,to:s}of e.visibleRanges)Yme(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=Ct.mark({class:l})))},i,s);return r.finish()}}const Rge=Ea.high(Br.fromClass(kge,{decorations:t=>t.decorations})),Pge=cv.define([{tag:Ie.meta,color:"#404740"},{tag:Ie.link,textDecoration:"underline"},{tag:Ie.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Ie.emphasis,fontStyle:"italic"},{tag:Ie.strong,fontWeight:"bold"},{tag:Ie.strikethrough,textDecoration:"line-through"},{tag:Ie.keyword,color:"#708"},{tag:[Ie.atom,Ie.bool,Ie.url,Ie.contentSeparator,Ie.labelName],color:"#219"},{tag:[Ie.literal,Ie.inserted],color:"#164"},{tag:[Ie.string,Ie.deleted],color:"#a11"},{tag:[Ie.regexp,Ie.escape,Ie.special(Ie.string)],color:"#e40"},{tag:Ie.definition(Ie.variableName),color:"#00f"},{tag:Ie.local(Ie.variableName),color:"#30a"},{tag:[Ie.typeName,Ie.namespace],color:"#085"},{tag:Ie.className,color:"#167"},{tag:[Ie.special(Ie.variableName),Ie.macroName],color:"#256"},{tag:Ie.definition(Ie.propertyName),color:"#00c"},{tag:Ie.comment,color:"#940"},{tag:Ie.invalid,color:"#f00"}]),Lge=At.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),C$=1e4,_$="()[]{}",S$=bt.define({combine(t){return il(t,{afterCursor:!0,brackets:_$,maxScanDistance:C$,renderMatch:Fge})}}),Ige=Ct.mark({class:"cm-matchingBracket"}),Oge=Ct.mark({class:"cm-nonmatchingBracket"});function Fge(t){let e=[],n=t.matched?Ige:Oge;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const Nge=Mr.define({create(){return Ct.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(S$);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=Pl(e.state,i.head,-1,r)||i.head>0&&Pl(e.state,i.head-1,1,r)||r.afterCursor&&(Pl(e.state,i.head,1,r)||i.head<e.state.doc.length&&Pl(e.state,i.head+1,-1,r));s&&(n=n.concat(r.renderMatch(s,e.state)))}return Ct.set(n,!0)},provide:t=>At.decorations.from(t)}),Dge=[Nge,Lge];function Uge(t={}){return[S$.of(t),Dge]}const Hge=new fn;function Ck(t,e,n){let r=t.prop(e<0?fn.openedBy:fn.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function _k(t){let e=t.type.prop(Hge);return e?e(t.node):t}function Pl(t,e,n,r={}){let i=r.maxScanDistance||C$,s=r.brackets||_$,o=as(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=Ck(l.type,n,s);if(c&&l.from<l.to){let u=_k(l);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return jge(t,e,n,l,u,c,s)}}return Qge(t,e,n,o,a.type,i,s)}function jge(t,e,n,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},c=0,u=a==null?void 0:a.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let d=_k(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(Ck(u.type,n,o))c++;else if(Ck(u.type,-n,o)){if(c==0){let d=_k(u);return{start:l,end:d&&d.from<d.to?{from:d.from,to:d.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function Qge(t,e,n,r,i,s,o){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},u=t.doc.iterRange(e,n>0?t.doc.length:0),d=0;for(let f=0;!u.next().done&&f<=s;){let h=u.value;n<0&&(f+=h.length);let A=e+f*n;for(let p=n>0?0:h.length-1,m=n>0?h.length:-1;p!=m;p+=n){let g=o.indexOf(h[p]);if(!(g<0||r.resolveInner(A+p,1).type!=i))if(g%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:A+p,to:A+p+1},matched:g>>1==l>>1};d--}}n>0&&(f+=h.length)}return u.done?{start:c,matched:!1}:null}const zge=Object.create(null),m8=[mo.none],g8=[],y8=Object.create(null),Vge=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Vge[t]=Gge(zge,e);function ST(t,e){g8.indexOf(t)>-1||(g8.push(t),console.warn(e))}function Gge(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=t[c]||Ie[c];u?typeof u=="function"?l.length?l=l.map(u):ST(c,`Modifier ${c} used at start of tag`):l.length?ST(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:ST(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(a=>a.id),s=y8[i];if(s)return s.id;let o=y8[i]=mo.define({id:m8.length,name:r,props:[s$({[r]:n})]});return m8.push(o),o.id}gr.RTL,gr.LTR;class E${constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[]}tokenBefore(e){let n=as(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(B$(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n){e=="abort"&&this.abortListeners&&this.abortListeners.push(n)}}function v8(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Wge(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;s<i.length;s++)n[i[s]]=!0}let r=v8(e)+v8(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function T$(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Wge(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}class b8{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function Id(t){return t.selection.main.from}function B$(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const NL=ls.define();function Kge(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return Object.assign(Object.assign({},t.changeByRange(a=>a!=i&&n!=r&&t.sliceDoc(a.from+s,a.from+o)!=t.sliceDoc(n,r)?{range:a}:{changes:{from:a.from+s,to:r==i.from?a.to:a.from+o,insert:e},range:qe.cursor(a.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const w8=new WeakMap;function $ge(t){if(!Array.isArray(t))return t;let e=w8.get(t);return e||w8.set(t,e=T$(t)),e}const t_=Qt.define(),hy=Qt.define();class qge{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=$i(e,n),i=aa(r);this.chars.push(r);let s=e.slice(n,n+i),o=s.toUpperCase();this.folded.push($i(o==s?s.toLowerCase():o,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:s,byWord:o}=this;if(n.length==1){let y=$i(e,0),w=aa(y),v=w==e.length?0:-100;if(y!=n[0])if(y==r[0])v+=-200;else return null;return this.ret(v,[0,w])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let y=0,w=Math.min(e.length,200);y<w&&c<l;){let v=$i(e,y);(v==n[c]||v==r[c])&&(i[c++]=y),y+=aa(v)}if(c<l)return null}let u=0,d=0,f=!1,h=0,A=-1,p=-1,m=/[a-z]/.test(e),g=!0;for(let y=0,w=Math.min(e.length,200),v=0;y<w&&d<l;){let x=$i(e,y);a<0&&(u<l&&x==n[u]&&(s[u++]=y),h<l&&(x==n[h]||x==r[h]?(h==0&&(A=y),p=y+1,h++):h=0));let C,_=x<255?x>=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(C=xL(x))!=C.toLowerCase()?1:C!=C.toUpperCase()?2:0;(!y||_==1&&m||v==0&&_!=0)&&(n[d]==x||r[d]==x&&(f=!0)?o[d++]=y:o.length&&(g=!1)),v=_,y+=aa(x)}return d==l&&o[0]==0&&g?this.result(-100+(f?-200:0),o,e):h==l&&A==0?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):h==l?this.ret(-900-e.length,[A,p]):d==l?this.result(-100+(f?-200:0)+-700+(g?0:-1100),o,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let o of n){let a=o+(this.astral?aa($i(r,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-r.length,i)}}class Xge{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const Zi=bt.define({combine(t){return il(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Yge,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>x8(e(r),n(r)),optionClass:(e,n)=>r=>x8(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function x8(t,e){return t?e?t+" "+e:t:e}function Yge(t,e,n,r,i,s){let o=t.textDirection==gr.RTL,a=o,l=!1,c="top",u,d,f=e.left-i.left,h=i.right-e.right,A=r.right-r.left,p=r.bottom-r.top;if(a&&f<Math.min(A,h)?a=!1:!a&&h<Math.min(A,f)&&(a=!0),A<=(a?f:h))u=Math.max(i.top,Math.min(n.top,i.bottom-p))-e.top,d=Math.min(400,a?f:h);else{l=!0,d=Math.min(400,(o?e.right:i.right-e.left)-30);let y=i.bottom-e.bottom;y>=p||y>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let m=(e.bottom-e.top)/s.offsetHeight,g=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/m}px; max-width: ${d/g}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function Jge(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<s.length;){let u=s[c++],d=s[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(u,d))),f.className="cm-completionMatchedText",l=d}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function ET(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class Zge{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:s,selected:o}=i.open,a=e.state.facet(Zi);this.optionContent=Jge(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=ET(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let u=l.target,d;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(d=/-(\d+)$/.exec(u.id))&&+d[1]<c.length){this.applyCompletion(e,c[+d[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Zi).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:hy.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:a}=r.open;(!i.open||i.open.options!=s)&&(this.range=ET(s.length,o,e.state.facet(Zi).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;if((n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=ET(n.options.length,n.selected,this.view.state.facet(Zi).maxRenderedOptions),this.showOptions(n.options,e.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(r);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,r)}).catch(o=>zs(this.view.state,o,"completion info")):this.addInfoPane(s,r)}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return n&&t0e(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(Zi).positionInfo(this.view,n,i,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));let s=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>r.from||r.from==0))if(s=f,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let h=i.appendChild(document.createElement("completion-section"));h.textContent=f}}const u=i.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let d=this.optionClass(a);d&&(u.className=d);for(let f of this.optionContent){let h=f(a,this.view.state,this.view,l);h&&u.appendChild(h)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function e0e(t,e){return n=>new Zge(n,t,e)}function t0e(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function C8(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function n0e(t,e){let n=[],r=null,i=c=>{n.push(c);let{section:u}=c.completion;if(u){r||(r=[]);let d=typeof u=="string"?u:u.name;r.some(f=>f.name==d)||r.push(typeof u=="string"?{name:d}:u)}},s=e.facet(Zi);for(let c of t)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let d of c.result.options)i(new b8(d,c.source,u?u(d):[],1e9-n.length));else{let d=e.sliceDoc(c.from,c.to),f,h=s.filterStrict?new Xge(d):new qge(d);for(let A of c.result.options)if(f=h.match(A.label)){let p=A.displayLabel?u?u(A,f.matched):[]:f.matched;i(new b8(A,c.source,p,f.score+(A.boost||0)))}}}if(r){let c=Object.create(null),u=0,d=(f,h)=>{var A,p;return((A=f.rank)!==null&&A!==void 0?A:1e9)-((p=h.rank)!==null&&p!==void 0?p:1e9)||(f.name<h.name?-1:1)};for(let f of r.sort(d))u-=1e5,c[f.name]=u;for(let f of n){let{section:h}=f.completion;h&&(f.score+=c[typeof h=="string"?h:h.name])}}let o=[],a=null,l=s.compareCompletions;for(let c of n.sort((u,d)=>d.score-u.score||l(u.completion,d.completion))){let u=c.completion;!a||a.label!=u.label||a.detail!=u.detail||a.type!=null&&u.type!=null&&a.type!=u.type||a.apply!=u.apply||a.boost!=u.boost?o.push(c):C8(c.completion)>C8(a)&&(o[o.length-1]=c),a=c.completion}return o}class Tp{constructor(e,n,r,i,s,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Tp(this.options,_8(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s){let o=n0e(e,n);if(!o.length)return i&&e.some(l=>l.state==1)?new Tp(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let a=n.facet(Zi).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let l=i.options[i.selected].completion;for(let c=0;c<o.length;c++)if(o[c].completion==l){a=c;break}}return new Tp(o,_8(r,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:l0e,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new Tp(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class n_{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new n_(o0e,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Zi),s=(r.override||n.languageDataAt("autocomplete",Id(n)).map($ge)).map(a=>(this.active.find(c=>c.source==a)||new Oo(a,this.active.some(c=>c.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((a,l)=>a==this.active[l])&&(s=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!r0e(s,this.active)?o=Tp.build(s,n,this.id,o,r):o&&o.disabled&&!s.some(a=>a.state==1)&&(o=null),!o&&s.every(a=>a.state!=1)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new Oo(a.source,0):a));for(let a of e.effects)a.is(R$)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new n_(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?i0e:s0e}}function r0e(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult;)n++;for(;r<e.length&&!e[r].hasResult;)r++;let i=n==t.length,s=r==e.length;if(i||s)return i==s;if(t[n++].result!=e[r++].result)return!1}}const i0e={"aria-autocomplete":"list"},s0e={};function _8(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const o0e=[];function M$(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(NL);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Oo{constructor(e,n,r=-1){this.source=e,this.state=n,this.explicitPos=r}hasResult(){return!1}update(e,n){let r=M$(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new Oo(i.source,0)),r&4&&i.state==0&&(i=new Oo(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(t_))i=new Oo(i.source,1,s.value?Id(e.state):-1);else if(s.is(hy))i=new Oo(i.source,0);else if(s.is(k$))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,n){return this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new Oo(this.source,this.state,e.mapPos(this.explicitPos))}touches(e){return e.changes.touchesRange(Id(e.state))}}class tm extends Oo{constructor(e,n,r,i,s){super(e,2,n),this.result=r,this.from=i,this.to=s}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=Id(e.state);if((this.explicitPos<0?a<=s:a<this.from)||a>o||!i||n&2&&Id(e.startState)==this.from)return new Oo(this.source,n&4?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return a0e(i.validFor,e.state,s,o)?new tm(this.source,l,i,s,o):i.update&&(i=i.update(i,s,o,new E$(e.state,a,l>=0)))?new tm(this.source,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:Id(e.state)):new Oo(this.source,1,l)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new tm(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Oo(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function a0e(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):B$(t,!0).test(i)}const k$=Qt.define({map(t,e){return t.map(n=>n.map(e))}}),R$=Qt.define(),Us=Mr.define({create(){return n_.start()},update(t,e){return t.update(e)},provide:t=>[QS.from(t,e=>e.tooltip),At.contentAttributes.from(t,e=>e.attrs)]});function DL(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Us).active.find(i=>i.source==e.source);return r instanceof tm?(typeof n=="string"?t.dispatch(Object.assign(Object.assign({},Kge(t.state,n,r.from,r.to)),{annotations:NL.of(e.completion)})):n(t,e.completion,r.from,r.to),!0):!1}const l0e=e0e(Us,DL);function dd(t,e="option"){return n=>{let r=n.state.field(Us,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Zi).interactionDelay)return!1;let i=1,s;e=="page"&&(s=e$(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+i*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:R$.of(a)}),!0}}const Sk=t=>{let e=t.state.field(Us,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Zi).interactionDelay?!1:DL(t,e.open.options[e.open.selected])},P$=t=>t.state.field(Us,!1)?(t.dispatch({effects:t_.of(!0)}),!0):!1,L$=t=>{let e=t.state.field(Us,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:hy.of(null)}),!0)};class c0e{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const u0e=50,d0e=1e3,f0e=Br.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Us).active)e.state==1&&this.startQuery(e)}update(t){let e=t.state.field(Us),n=t.state.facet(Zi);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Us)==e)return;let r=t.transactions.some(s=>{let o=M$(s,n);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.updates.length+t.transactions.length>u0e&&Date.now()-o.time>d0e){for(let a of o.context.abortListeners)try{a()}catch(l){zs(this.view.state,l)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(o=>o.is(t_)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.state==1&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Us);for(let n of e.active)n.state==1&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n)}startQuery(t){let{state:e}=this.view,n=Id(e),r=new E$(e,n,t.explicitPos==n,this.view),i=new c0e(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:hy.of(null)}),zs(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Zi).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Zi);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let o=new tm(i.active.source,i.active.explicitPos,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:Id(i.updates.length?i.updates[0].startState:this.view.state));for(let a of i.updates)o=o.update(a,n);if(o.hasResult()){e.push(o);continue}}let s=this.view.state.field(Us).active.find(o=>o.source==i.active.source);if(s&&s.state==1)if(i.done==null){let o=new Oo(i.active.source,0);for(let a of i.updates)o=o.update(a,n);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:k$.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Us,!1);if(e&&e.tooltip&&this.view.state.facet(Zi).closeOnBlur){let n=e.open&&e$(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:hy.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:t_.of(!1)}),20),this.composing=0}}}),h0e=typeof navigator=="object"&&/Win/.test(navigator.platform),A0e=Ea.highest(At.domEventHandlers({keydown(t,e){let n=e.state.field(Us,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(h0e&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&DL(e,r),!1}})),I$=At.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class p0e{constructor(e,n,r,i){this.field=e,this.line=n,this.from=r,this.to=i}}class UL{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,bi.TrackDel),r=e.mapPos(this.to,1,bi.TrackDel);return n==null||r==null?null:new UL(this.field,n,r)}}class HL{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],i=[n],s=e.doc.lineAt(n),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(r.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let d=0;d<u;d++)c+=e.facet(av);i.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let a=this.fieldPositions.map(l=>new UL(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(o);){let a=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1,u=l.replace(/\\[{}]/g,d=>d[1]);for(let d=0;d<n.length;d++)(a!=null?n[d].seq==a:u&&n[d].name==u)&&(c=d);if(c<0){let d=0;for(;d<n.length&&(a==null||n[d].seq!=null&&n[d].seq<a);)d++;n.splice(d,0,{seq:a,name:u}),c=d;for(let f of i)f.field>=c&&f.field++}i.push(new p0e(c,r.length,s.index,s.index+u.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let u of i)u.line==r.length&&u.from>c&&(u.from--,u.to--);return l}),r.push(o)}return new HL(r,i)}}let m0e=Ct.widget({widget:new class extends Au{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),g0e=Ct.mark({class:"cm-snippetField"});class Tg{constructor(e,n){this.ranges=e,this.active=n,this.deco=Ct.set(e.map(r=>(r.from==r.to?m0e:g0e).range(r.from,r.to)))}map(e){let n=[];for(let r of this.ranges){let i=r.map(e);if(!i)return null;n.push(i)}return new Tg(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const uv=Qt.define({map(t,e){return t&&t.map(e)}}),y0e=Qt.define(),Fm=Mr.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(uv))return n.value;if(n.is(y0e)&&t)return new Tg(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>At.decorations.from(t,e=>e?e.deco:Ct.none)});function jL(t,e){return qe.create(t.filter(n=>n.field==e).map(n=>qe.range(n.from,n.to)))}function v0e(t){let e=HL.parse(t);return(n,r,i,s)=>{let{text:o,ranges:a}=e.instantiate(n.state,i),l={changes:{from:i,to:s,insert:Mn.of(o)},scrollIntoView:!0,annotations:r?[NL.of(r),Bn.userEvent.of("input.complete")]:void 0};if(a.length&&(l.selection=jL(a,0)),a.some(c=>c.field>0)){let c=new Tg(a,0),u=l.effects=[uv.of(c)];n.state.field(Fm,!1)===void 0&&u.push(Qt.appendConfig.of([Fm,x0e,_0e,I$]))}n.dispatch(n.state.update(l))}}function O$(t){return({state:e,dispatch:n})=>{let r=e.field(Fm,!1);if(!r||t<0&&r.active==0)return!1;let i=r.active+t,s=t>0&&!r.ranges.some(o=>o.field==i+t);return n(e.update({selection:jL(r.ranges,i),effects:uv.of(s?null:new Tg(r.ranges,i)),scrollIntoView:!0})),!0}}const F$=({state:t,dispatch:e})=>t.field(Fm,!1)?(e(t.update({effects:uv.of(null)})),!0):!1,N$=O$(1),D$=O$(-1);function b0e(t){let e=t.field(Fm,!1);return!!(e&&e.ranges.some(n=>n.field==e.active+1))}const w0e=[{key:"Tab",run:N$,shift:D$},{key:"Escape",run:F$}],S8=bt.define({combine(t){return t.length?t[0]:w0e}}),x0e=Ea.highest(oA.compute([S8],t=>t.facet(S8)));function C0e(t,e){return Object.assign(Object.assign({},e),{apply:v0e(t)})}const _0e=At.domEventHandlers({mousedown(t,e){let n=e.state.field(Fm,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=n.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==n.active?!1:(e.dispatch({selection:jL(n.ranges,i.field),effects:uv.of(n.ranges.some(s=>s.field>i.field)?new Tg(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),Ay={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ah=Qt.define({map(t,e){let n=e.mapPos(t,-1,bi.TrackAfter);return n??void 0}}),QL=new class extends Hh{};QL.startSide=1;QL.endSide=-1;const U$=Mr.define({create(){return yn.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Ah)&&(t=t.update({add:[QL.range(n.value,n.value+1)]}));return t}});function E8(){return[E0e,U$]}const TT="()[]{}<>";function H$(t){for(let e=0;e<TT.length;e+=2)if(TT.charCodeAt(e)==t)return TT.charAt(e+1);return xL(t<128?t:t+1)}function j$(t,e){return t.languageDataAt("closeBrackets",e)[0]||Ay}const S0e=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),E0e=At.inputHandler.of((t,e,n,r)=>{if((S0e?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&aa($i(r,0))==1||e!=i.from||n!=i.to)return!1;let s=M0e(t.state,r);return s?(t.dispatch(s),!0):!1}),T0e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=j$(t,t.selection.main.head).brackets||Ay.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let a=k0e(t.doc,o.head);for(let l of r)if(l==a&&WS(t.doc,o.head)==H$($i(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:qe.cursor(o.head-l.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},B0e=[{key:"Backspace",run:T0e}];function M0e(t,e){let n=j$(t,t.selection.main.head),r=n.brackets||Ay.brackets;for(let i of r){let s=H$($i(i,0));if(e==i)return s==i?L0e(t,i,r.indexOf(i+i+i)>-1,n):R0e(t,i,s,n.before||Ay.before);if(e==s&&Q$(t,t.selection.main.from))return P0e(t,i,s)}return null}function Q$(t,e){let n=!1;return t.field(U$).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function WS(t,e){let n=t.sliceString(e,e+2);return n.slice(0,aa($i(n,0)))}function k0e(t,e){let n=t.sliceString(e-2,e);return aa($i(n,0))==n.length?n:n.slice(1)}function R0e(t,e,n,r){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Ah.of(o.to+e.length),range:qe.range(o.anchor+e.length,o.head+e.length)};let a=WS(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:Ah.of(o.head+e.length),range:qe.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function P0e(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&WS(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:qe.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function L0e(t,e,n,r){let i=r.stringPrefixes||Ay.stringPrefixes,s=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ah.of(a.to+e.length),range:qe.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=WS(t.doc,l),u;if(c==e){if(T8(t,l))return{changes:{insert:e+e,from:l},effects:Ah.of(l+e.length),range:qe.cursor(l+e.length)};if(Q$(t,l)){let f=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:qe.cursor(l+f.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=B8(t,l-2*e.length,i))>-1&&T8(t,u))return{changes:{insert:e+e+e+e,from:l},effects:Ah.of(l+e.length),range:qe.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=_r.Word&&B8(t,l,i)>-1&&!I0e(t,l,e,i))return{changes:{insert:e+e,from:l},effects:Ah.of(l+e.length),range:qe.cursor(l+e.length)}}return{range:s=a}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function T8(t,e){let n=as(t).resolveInner(e+1);return n.parent&&n.from==e}function I0e(t,e,n,r){let i=as(t).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>n.length+l;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function B8(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=_r.Word)return e;for(let i of n){let s=e-i.length;if(t.sliceDoc(s,e)==i&&r(t.sliceDoc(s-1,s))!=_r.Word)return s}return-1}function z$(t={}){return[A0e,Us,Zi.of(t),f0e,O0e,I$]}const V$=[{key:"Ctrl-Space",run:P$},{key:"Escape",run:L$},{key:"ArrowDown",run:dd(!0)},{key:"ArrowUp",run:dd(!1)},{key:"PageDown",run:dd(!0,"page")},{key:"PageUp",run:dd(!1,"page")},{key:"Enter",run:Sk}],O0e=Ea.highest(oA.computeN([Zi],t=>t.facet(Zi).defaultKeymap?[V$]:[]));function F0e(t){let e=t.field(Us,!1);return e&&e.active.some(n=>n.state==1)?"pending":e&&e.active.some(n=>n.state!=0)?"active":null}function or(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e<arguments.length;e++)G$(t,arguments[e]);return t}function G$(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)G$(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}class N0e{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class nh{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=e,s=r.facet(Ll).markerFilter;s&&(i=s(i,r));let o=Ct.set(i.map(a=>a.from==a.to||a.from==a.to-1&&r.doc.lineAt(a.from).to==a.from?Ct.widget({widget:new K0e(a),diagnostic:a}).range(a.from):Ct.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new nh(o,n,Nm(o))}}function Nm(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return r=new N0e(i,s,o.diagnostic),!1}),r}function W$(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(Ll).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(dv))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function K$(t,e){return t.field(Vs,!1)?e:e.concat(Qt.appendConfig.of(eq))}function D0e(t,e){return{effects:K$(t,[dv.of(e)])}}const dv=Qt.define(),zL=Qt.define(),$$=Qt.define(),Vs=Mr.define({create(){return new nh(Ct.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);r=Nm(n,t.selected.diagnostic,s)||Nm(n,null,s)}!n.size&&i&&e.state.facet(Ll).autoPanel&&(i=null),t=new nh(n,i,r)}for(let n of e.effects)if(n.is(dv)){let r=e.state.facet(Ll).autoPanel?n.value.length?py.open:null:t.panel;t=nh.init(n.value,r,e.state)}else n.is(zL)?t=new nh(t.diagnostics,n.value?py.open:null,t.selected):n.is($$)&&(t=new nh(t.diagnostics,t.panel,n.value));return t},provide:t=>[dy.from(t,e=>e.panel),At.decorations.from(t,e=>e.diagnostics)]});function U0e(t){let e=t.field(Vs,!1);return e?e.diagnostics.size:0}const H0e=Ct.mark({class:"cm-lintRange cm-lintRange-active"});function j0e(t,e,n){let{diagnostics:r}=t.state.field(Vs),i=[],s=2e8,o=0;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:u})=>{e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0))&&(i.push(u.diagnostic),s=Math.min(l,s),o=Math.max(c,o))});let a=t.state.facet(Ll).tooltipFilter;return a&&(i=a(i,t.state)),i.length?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create(){return{dom:q$(t,i)}}}:null}function q$(t,e){return or("ul",{class:"cm-tooltip-lint"},e.map(n=>Y$(t,n,!1)))}const Q0e=t=>{let e=t.state.field(Vs,!1);(!e||!e.panel)&&t.dispatch({effects:K$(t.state,[zL.of(!0)])});let n=uy(t,py.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},M8=t=>{let e=t.state.field(Vs,!1);return!e||!e.panel?!1:(t.dispatch({effects:zL.of(!1)}),!0)},z0e=t=>{let e=t.state.field(Vs,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},V0e=[{key:"Mod-Shift-m",run:Q0e,preventDefault:!0},{key:"F8",run:z0e}],G0e=Br.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(Ll);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let t=Date.now();if(t<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:e}=this.view,{sources:n}=e.facet(Ll);n.length&&Promise.all(n.map(r=>Promise.resolve(r(this.view)))).then(r=>{let i=r.reduce((s,o)=>s.concat(o));this.view.state.doc==e.doc&&this.view.dispatch(D0e(this.view.state,i))},r=>{zs(this.view.state,r)})}}update(t){let e=t.state.facet(Ll);(t.docChanged||e!=t.startState.facet(Ll)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),Ll=bt.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},il(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n}))}});function W0e(t,e={}){return[Ll.of({source:t,config:e}),G0e,eq]}function X$(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Y$(t,e,n){var r;let i=n?X$(e.actions):[];return or("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},or("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let h=Nm(t.state.field(Vs).diagnostics,e);h&&s.apply(t,h.from,h.to)},{name:c}=s,u=i[o]?c.indexOf(i[o]):-1,d=u<0?c:[c.slice(0,u),or("u",c.slice(u,u+1)),c.slice(u+1)];return or("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[o]})"`}.`},d)}),e.source&&or("div",{class:"cm-diagnosticSource"},e.source))}class K0e extends Au{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return or("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class k8{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Y$(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class py{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)M8(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=X$(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=Nm(this.view.state.field(Vs).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=or("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=or("div",{class:"cm-panel-lint"},this.list,or("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>M8(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Vs).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(Vs),r=0,i=!1,s=null;for(e.between(0,this.view.state.doc.length,(o,a,{spec:l})=>{let c=-1,u;for(let d=r;d<this.items.length;d++)if(this.items[d].diagnostic==l.diagnostic){c=d;break}c<0?(u=new k8(this.view,l.diagnostic),this.items.splice(r,0,u),i=!0):(u=this.items[c],c>r&&(this.items.splice(r,c-r),i=!0)),n&&u.diagnostic==n.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),s=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),r++});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new k8(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{let l=a.height/this.list.offsetHeight;o.top<a.top?this.list.scrollTop-=(a.top-o.top)/l:o.bottom>a.bottom&&(this.list.scrollTop+=(o.bottom-a.bottom)/l)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Vs),r=Nm(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:$$.of(r)})}static open(e){return new py(e)}}function Fx(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Yb(t){return Fx(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const $0e=At.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Yb("#d11")},".cm-lintRange-warning":{backgroundImage:Yb("orange")},".cm-lintRange-info":{backgroundImage:Yb("#999")},".cm-lintRange-hint":{backgroundImage:Yb("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function R8(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}class q0e extends Kl{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce((n,r)=>R8(n)<R8(r.severity)?r.severity:n,"hint")}toDOM(e){let n=document.createElement("div");n.className="cm-lint-marker cm-lint-marker-"+this.severity;let r=this.diagnostics,i=e.state.facet(KS).tooltipFilter;return i&&(r=i(r,e.state)),r.length&&(n.onmouseover=()=>Y0e(e,n,r)),n}}function X0e(t,e){let n=r=>{let i=e.getBoundingClientRect();if(!(r.clientX>i.left-10&&r.clientX<i.right+10&&r.clientY>i.top-10&&r.clientY<i.bottom+10)){for(let s=r.target;s;s=s.parentNode)if(s.nodeType==1&&s.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",n),t.state.field(Z$)&&t.dispatch({effects:VL.of(null)})}};window.addEventListener("mousemove",n)}function Y0e(t,e,n){function r(){let o=t.elementAtHeight(e.getBoundingClientRect().top+5-t.documentTop);t.coordsAtPos(o.from)&&t.dispatch({effects:VL.of({pos:o.from,above:!1,create(){return{dom:q$(t,n),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,X0e(t,e)}let{hoverTime:i}=t.state.facet(KS),s=setTimeout(r,i);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(r,i)}}function J0e(t,e){let n=Object.create(null);for(let i of e){let s=t.lineAt(i.from);(n[s.from]||(n[s.from]=[])).push(i)}let r=[];for(let i in n)r.push(new q0e(n[i]).range(+i));return yn.of(r,!0)}const Z0e=n$({class:"cm-gutter-lint",markers:t=>t.state.field(J$)}),J$=Mr.define({create(){return yn.empty},update(t,e){t=t.map(e.changes);let n=e.state.facet(KS).markerFilter;for(let r of e.effects)if(r.is(dv)){let i=r.value;n&&(i=n(i||[],e.state)),t=J0e(e.state.doc,i.slice(0))}return t}}),VL=Qt.define(),Z$=Mr.define({create(){return null},update(t,e){return t&&e.docChanged&&(t=W$(e,t)?null:Object.assign(Object.assign({},t),{pos:e.changes.mapPos(t.pos)})),e.effects.reduce((n,r)=>r.is(VL)?r.value:n,t)},provide:t=>QS.from(t)}),e1e=At.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Fx('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Fx('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Fx('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),eq=[Vs,At.decorations.compute([Vs],t=>{let{selected:e,panel:n}=t.field(Vs);return!e||!n||e.from==e.to?Ct.none:Ct.set([H0e.range(e.from,e.to)])}),ZK(j0e,{hideOn:W$}),$0e],KS=bt.define({combine(t){return il(t,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function t1e(t={}){return[KS.of(t),J$,Z0e,e1e,Z$]}function n1e(t,e){let n=t.field(Vs,!1);if(n&&n.diagnostics.size)for(let r=yn.iter([n.diagnostics]);r.value;r.next())e(r.value.spec.diagnostic,r.from,r.to)}var ki={},aA={},GL={},r_={},Lt={},li={};Object.defineProperty(li,"__esModule",{value:!0});li.stringArray=li.array=li.func=li.error=li.number=li.string=li.boolean=void 0;function r1e(t){return t===!0||t===!1}li.boolean=r1e;function tq(t){return typeof t=="string"||t instanceof String}li.string=tq;function i1e(t){return typeof t=="number"||t instanceof Number}li.number=i1e;function s1e(t){return t instanceof Error}li.error=s1e;function o1e(t){return typeof t=="function"}li.func=o1e;function nq(t){return Array.isArray(t)}li.array=nq;function a1e(t){return nq(t)&&t.every(e=>tq(e))}li.stringArray=a1e;Object.defineProperty(Lt,"__esModule",{value:!0});Lt.Message=Lt.NotificationType9=Lt.NotificationType8=Lt.NotificationType7=Lt.NotificationType6=Lt.NotificationType5=Lt.NotificationType4=Lt.NotificationType3=Lt.NotificationType2=Lt.NotificationType1=Lt.NotificationType0=Lt.NotificationType=Lt.RequestType9=Lt.RequestType8=Lt.RequestType7=Lt.RequestType6=Lt.RequestType5=Lt.RequestType4=Lt.RequestType3=Lt.RequestType2=Lt.RequestType1=Lt.RequestType=Lt.RequestType0=Lt.AbstractMessageSignature=Lt.ParameterStructures=Lt.ResponseError=Lt.ErrorCodes=void 0;const $f=li;var Ek;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(Ek||(Lt.ErrorCodes=Ek={}));let l1e=class rq extends Error{constructor(e,n,r){super(n),this.code=$f.number(e)?e:Ek.UnknownErrorCode,this.data=r,Object.setPrototypeOf(this,rq.prototype)}toJson(){const e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};Lt.ResponseError=l1e;let _a=class Nx{constructor(e){this.kind=e}static is(e){return e===Nx.auto||e===Nx.byName||e===Nx.byPosition}toString(){return this.kind}};Lt.ParameterStructures=_a;_a.auto=new _a("auto");_a.byPosition=new _a("byPosition");_a.byName=new _a("byName");let Nr=class{constructor(e,n){this.method=e,this.numberOfParams=n}get parameterStructures(){return _a.auto}};Lt.AbstractMessageSignature=Nr;let c1e=class extends Nr{constructor(e){super(e,0)}};Lt.RequestType0=c1e;let u1e=class extends Nr{constructor(e,n=_a.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Lt.RequestType=u1e;let d1e=class extends Nr{constructor(e,n=_a.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Lt.RequestType1=d1e;let f1e=class extends Nr{constructor(e){super(e,2)}};Lt.RequestType2=f1e;let h1e=class extends Nr{constructor(e){super(e,3)}};Lt.RequestType3=h1e;let A1e=class extends Nr{constructor(e){super(e,4)}};Lt.RequestType4=A1e;let p1e=class extends Nr{constructor(e){super(e,5)}};Lt.RequestType5=p1e;let m1e=class extends Nr{constructor(e){super(e,6)}};Lt.RequestType6=m1e;let g1e=class extends Nr{constructor(e){super(e,7)}};Lt.RequestType7=g1e;let y1e=class extends Nr{constructor(e){super(e,8)}};Lt.RequestType8=y1e;let v1e=class extends Nr{constructor(e){super(e,9)}};Lt.RequestType9=v1e;let b1e=class extends Nr{constructor(e,n=_a.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Lt.NotificationType=b1e;let w1e=class extends Nr{constructor(e){super(e,0)}};Lt.NotificationType0=w1e;let x1e=class extends Nr{constructor(e,n=_a.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Lt.NotificationType1=x1e;let C1e=class extends Nr{constructor(e){super(e,2)}};Lt.NotificationType2=C1e;let _1e=class extends Nr{constructor(e){super(e,3)}};Lt.NotificationType3=_1e;let S1e=class extends Nr{constructor(e){super(e,4)}};Lt.NotificationType4=S1e;let E1e=class extends Nr{constructor(e){super(e,5)}};Lt.NotificationType5=E1e;let T1e=class extends Nr{constructor(e){super(e,6)}};Lt.NotificationType6=T1e;let B1e=class extends Nr{constructor(e){super(e,7)}};Lt.NotificationType7=B1e;let M1e=class extends Nr{constructor(e){super(e,8)}};Lt.NotificationType8=M1e;let k1e=class extends Nr{constructor(e){super(e,9)}};Lt.NotificationType9=k1e;var P8;(function(t){function e(i){const s=i;return s&&$f.string(s.method)&&($f.string(s.id)||$f.number(s.id))}t.isRequest=e;function n(i){const s=i;return s&&$f.string(s.method)&&i.id===void 0}t.isNotification=n;function r(i){const s=i;return s&&(s.result!==void 0||!!s.error)&&($f.string(s.id)||$f.number(s.id)||s.id===null)}t.isResponse=r})(P8||(Lt.Message=P8={}));var Hc={},L8;Object.defineProperty(Hc,"__esModule",{value:!0});Hc.LRUCache=Hc.LinkedMap=Hc.Touch=void 0;var ms;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(ms||(Hc.Touch=ms={}));let iq=class{constructor(){this[L8]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var e;return(e=this._head)==null?void 0:e.value}get last(){var e;return(e=this._tail)==null?void 0:e.value}has(e){return this._map.has(e)}get(e,n=ms.None){const r=this._map.get(e);if(r)return n!==ms.None&&this.touch(r,n),r.value}set(e,n,r=ms.None){let i=this._map.get(e);if(i)i.value=n,r!==ms.None&&this.touch(i,r);else{switch(i={key:e,value:n,next:void 0,previous:void 0},r){case ms.None:this.addItemLast(i);break;case ms.First:this.addItemFirst(i);break;case ms.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const n=this._map.get(e);if(n)return this._map.delete(e),this.removeItem(n),this._size--,n.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,n){const r=this._state;let i=this._head;for(;i;){if(n?e.bind(n)(i.value,i.key,this):e(i.value,i.key,this),this._state!==r)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){const e=this._state;let n=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){const i={value:n.key,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}values(){const e=this._state;let n=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){const i={value:n.value,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}entries(){const e=this._state;let n=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){const i={value:[n.key,n.value],done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}[(L8=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let n=this._head,r=this.size;for(;n&&r>e;)this._map.delete(n.key),n=n.next,r--;this._head=n,this._size=r,n&&(n.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const n=e.next,r=e.previous;if(!n||!r)throw new Error("Invalid list");n.previous=r,r.next=n}e.next=void 0,e.previous=void 0,this._state++}touch(e,n){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(n!==ms.First&&n!==ms.Last)){if(n===ms.First){if(e===this._head)return;const r=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(r.previous=i,i.next=r),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(n===ms.Last){if(e===this._tail)return;const r=e.next,i=e.previous;e===this._head?(r.previous=void 0,this._head=r):(r.previous=i,i.next=r),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){const e=[];return this.forEach((n,r)=>{e.push([r,n])}),e}fromJSON(e){this.clear();for(const[n,r]of e)this.set(n,r)}};Hc.LinkedMap=iq;let R1e=class extends iq{constructor(e,n=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,n),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,n=ms.AsNew){return super.get(e,n)}peek(e){return super.get(e,ms.None)}set(e,n){return super.set(e,n,ms.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Hc.LRUCache=R1e;var $S={};Object.defineProperty($S,"__esModule",{value:!0});$S.Disposable=void 0;var I8;(function(t){function e(n){return{dispose:n}}t.create=e})(I8||($S.Disposable=I8={}));var $l={},pu={};Object.defineProperty(pu,"__esModule",{value:!0});let Tk;function Bk(){if(Tk===void 0)throw new Error("No runtime abstraction layer installed");return Tk}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");Tk=n}t.install=e})(Bk||(Bk={}));pu.default=Bk;Object.defineProperty($l,"__esModule",{value:!0});$l.Emitter=$l.Event=void 0;const P1e=pu;var O8;(function(t){const e={dispose(){}};t.None=function(){return e}})(O8||($l.Event=O8={}));let L1e=class{add(e,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,n)})}remove(e,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i<s;i++)if(this._callbacks[i]===e)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];const n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,o=r.length;s<o;s++)try{n.push(r[s].apply(i[s],e))}catch(a){(0,P1e.default)().console.error(a)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},sq=class oq{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,n,r)=>{this._callbacks||(this._callbacks=new L1e),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,n);const i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,n),i.dispose=oq._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};$l.Emitter=sq;sq._noop=function(){};var af={};Object.defineProperty(af,"__esModule",{value:!0});af.CancellationTokenSource=af.CancellationToken=void 0;const I1e=pu,O1e=li,Mk=$l;var i_;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Mk.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Mk.Event.None});function e(n){const r=n;return r&&(r===t.None||r===t.Cancelled||O1e.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}t.is=e})(i_||(af.CancellationToken=i_={}));const F1e=Object.freeze(function(t,e){const n=(0,I1e.default)().timer.setTimeout(t.bind(e),0);return{dispose(){n.dispose()}}});let F8=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?F1e:(this._emitter||(this._emitter=new Mk.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},N1e=class{get token(){return this._token||(this._token=new F8),this._token}cancel(){this._token?this._token.cancel():this._token=i_.Cancelled}dispose(){this._token?this._token instanceof F8&&this._token.dispose():this._token=i_.None}};af.CancellationTokenSource=N1e;var Dm={};Object.defineProperty(Dm,"__esModule",{value:!0});Dm.SharedArrayReceiverStrategy=Dm.SharedArraySenderStrategy=void 0;const D1e=af;var my;(function(t){t.Continue=0,t.Cancelled=1})(my||(my={}));let U1e=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;const n=new SharedArrayBuffer(4),r=new Int32Array(n,0,1);r[0]=my.Continue,this.buffers.set(e.id,n),e.$cancellationData=n}async sendCancellation(e,n){const r=this.buffers.get(n);if(r===void 0)return;const i=new Int32Array(r,0,1);Atomics.store(i,0,my.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};Dm.SharedArraySenderStrategy=U1e;let H1e=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===my.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},j1e=class{constructor(e){this.token=new H1e(e)}cancel(){}dispose(){}},Q1e=class{constructor(){this.kind="request"}createCancellationTokenSource(e){const n=e.$cancellationData;return n===void 0?new D1e.CancellationTokenSource:new j1e(n)}};Dm.SharedArrayReceiverStrategy=Q1e;var Od={},fv={};Object.defineProperty(fv,"__esModule",{value:!0});fv.Semaphore=void 0;const z1e=pu;let V1e=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((n,r)=>{this._waiting.push({thunk:e,resolve:n,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,z1e.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;const e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const n=e.thunk();n instanceof Promise?n.then(r=>{this._active--,e.resolve(r),this.runNext()},r=>{this._active--,e.reject(r),this.runNext()}):(this._active--,e.resolve(n),this.runNext())}catch(n){this._active--,e.reject(n),this.runNext()}}};fv.Semaphore=V1e;Object.defineProperty(Od,"__esModule",{value:!0});Od.ReadableStreamMessageReader=Od.AbstractMessageReader=Od.MessageReader=void 0;const kk=pu,rp=li,BT=$l,G1e=fv;var N8;(function(t){function e(n){let r=n;return r&&rp.func(r.listen)&&rp.func(r.dispose)&&rp.func(r.onError)&&rp.func(r.onClose)&&rp.func(r.onPartialMessage)}t.is=e})(N8||(Od.MessageReader=N8={}));let aq=class{constructor(){this.errorEmitter=new BT.Emitter,this.closeEmitter=new BT.Emitter,this.partialMessageEmitter=new BT.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${rp.string(e.message)?e.message:"unknown"}`)}};Od.AbstractMessageReader=aq;var Rk;(function(t){function e(n){let r,i;const s=new Map;let o;const a=new Map;if(n===void 0||typeof n=="string")r=n??"utf-8";else{if(r=n.charset??"utf-8",n.contentDecoder!==void 0&&(i=n.contentDecoder,s.set(i.name,i)),n.contentDecoders!==void 0)for(const l of n.contentDecoders)s.set(l.name,l);if(n.contentTypeDecoder!==void 0&&(o=n.contentTypeDecoder,a.set(o.name,o)),n.contentTypeDecoders!==void 0)for(const l of n.contentTypeDecoders)a.set(l.name,l)}return o===void 0&&(o=(0,kk.default)().applicationJson.decoder,a.set(o.name,o)),{charset:r,contentDecoder:i,contentDecoders:s,contentTypeDecoder:o,contentTypeDecoders:a}}t.fromOptions=e})(Rk||(Rk={}));let W1e=class extends aq{constructor(e,n){super(),this.readable=e,this.options=Rk.fromOptions(n),this.buffer=(0,kk.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new G1e.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;const n=this.readable.onData(r=>{this.onData(r)});return this.readable.onError(r=>this.fireError(r)),this.readable.onClose(()=>this.fireClose()),n}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){const r=this.buffer.tryReadHeaders(!0);if(!r)return;const i=r.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property.
${JSON.stringify(Object.fromEntries(r))}`));return}const s=parseInt(i);if(isNaN(s)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=s}const n=this.buffer.tryReadBody(this.nextMessageLength);if(n===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const r=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(n):n,i=await this.options.contentTypeDecoder.decode(r,this.options);this.callback(i)}).catch(r=>{this.fireError(r)})}}catch(n){this.fireError(n)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,kk.default)().timer.setTimeout((e,n)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:n}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};Od.ReadableStreamMessageReader=W1e;var Fd={};Object.defineProperty(Fd,"__esModule",{value:!0});Fd.WriteableStreamMessageWriter=Fd.AbstractMessageWriter=Fd.MessageWriter=void 0;const D8=pu,O0=li,K1e=fv,U8=$l,$1e="Content-Length: ",H8=`\r
`;var j8;(function(t){function e(n){let r=n;return r&&O0.func(r.dispose)&&O0.func(r.onClose)&&O0.func(r.onError)&&O0.func(r.write)}t.is=e})(j8||(Fd.MessageWriter=j8={}));let lq=class{constructor(){this.errorEmitter=new U8.Emitter,this.closeEmitter=new U8.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,n,r){this.errorEmitter.fire([this.asError(e),n,r])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${O0.string(e.message)?e.message:"unknown"}`)}};Fd.AbstractMessageWriter=lq;var Pk;(function(t){function e(n){return n===void 0||typeof n=="string"?{charset:n??"utf-8",contentTypeEncoder:(0,D8.default)().applicationJson.encoder}:{charset:n.charset??"utf-8",contentEncoder:n.contentEncoder,contentTypeEncoder:n.contentTypeEncoder??(0,D8.default)().applicationJson.encoder}}t.fromOptions=e})(Pk||(Pk={}));let q1e=class extends lq{constructor(e,n){super(),this.writable=e,this.options=Pk.fromOptions(n),this.errorCount=0,this.writeSemaphore=new K1e.Semaphore(1),this.writable.onError(r=>this.fireError(r)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(r=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(r):r).then(r=>{const i=[];return i.push($1e,r.byteLength.toString(),H8),i.push(H8),this.doWrite(e,i,r)},r=>{throw this.fireError(r),r}))}async doWrite(e,n,r){try{return await this.writable.write(n.join(""),"ascii"),this.writable.write(r)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,n){this.errorCount++,this.fireError(e,n,this.errorCount)}end(){this.writable.end()}};Fd.WriteableStreamMessageWriter=q1e;var qS={};Object.defineProperty(qS,"__esModule",{value:!0});qS.AbstractMessageBuffer=void 0;const X1e=13,Y1e=10,J1e=`\r
`;let Z1e=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){const n=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(n),this._totalLength+=n.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let n=0,r=0,i=0,s=0;e:for(;r<this._chunks.length;){const c=this._chunks[r];for(i=0;i<c.length;){switch(c[i]){case X1e:switch(n){case 0:n=1;break;case 2:n=3;break;default:n=0}break;case Y1e:switch(n){case 1:n=2;break;case 3:n=4,i++;break e;default:n=0}break;default:n=0}i++}s+=c.byteLength,r++}if(n!==4)return;const o=this._read(s+i),a=new Map,l=this.toString(o,"ascii").split(J1e);if(l.length<2)return a;for(let c=0;c<l.length-2;c++){const u=l[c],d=u.indexOf(":");if(d===-1)throw new Error(`Message header must separate key and value using ':'
${u}`);const f=u.substr(0,d),h=u.substr(d+1).trim();a.set(e?f.toLowerCase():f,h)}return a}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const s=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(s)}if(this._chunks[0].byteLength>e){const s=this._chunks[0],o=this.asNative(s,e);return this._chunks[0]=s.slice(e),this._totalLength-=e,o}const n=this.allocNative(e);let r=0,i=0;for(;e>0;){const s=this._chunks[i];if(s.byteLength>e){const o=s.slice(0,e);n.set(o,r),r+=e,this._chunks[i]=s.slice(e),this._totalLength-=e,e-=e}else n.set(s,r),r+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,e-=s.byteLength}return n}};qS.AbstractMessageBuffer=Z1e;var cq={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.ConnectionOptions=t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.RequestCancellationReceiverStrategy=t.IdCancellationReceiverStrategy=t.ConnectionStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=t.NullLogger=t.ProgressType=t.ProgressToken=void 0;const e=pu,n=li,r=Lt,i=Hc,s=$l,o=af;var a;(function(B){B.type=new r.NotificationType("$/cancelRequest")})(a||(a={}));var l;(function(B){function M(F){return typeof F=="string"||typeof F=="number"}B.is=M})(l||(t.ProgressToken=l={}));var c;(function(B){B.type=new r.NotificationType("$/progress")})(c||(c={}));class u{constructor(){}}t.ProgressType=u;var d;(function(B){function M(F){return n.func(F)}B.is=M})(d||(d={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var f;(function(B){B[B.Off=0]="Off",B[B.Messages=1]="Messages",B[B.Compact=2]="Compact",B[B.Verbose=3]="Verbose"})(f||(t.Trace=f={}));var h;(function(B){B.Off="off",B.Messages="messages",B.Compact="compact",B.Verbose="verbose"})(h||(t.TraceValues=h={})),function(B){function M(I){if(!n.string(I))return B.Off;switch(I=I.toLowerCase(),I){case"off":return B.Off;case"messages":return B.Messages;case"compact":return B.Compact;case"verbose":return B.Verbose;default:return B.Off}}B.fromString=M;function F(I){switch(I){case B.Off:return"off";case B.Messages:return"messages";case B.Compact:return"compact";case B.Verbose:return"verbose";default:return"off"}}B.toString=F}(f||(t.Trace=f={}));var A;(function(B){B.Text="text",B.JSON="json"})(A||(t.TraceFormat=A={})),function(B){function M(F){return n.string(F)?(F=F.toLowerCase(),F==="json"?B.JSON:B.Text):B.Text}B.fromString=M}(A||(t.TraceFormat=A={}));var p;(function(B){B.type=new r.NotificationType("$/setTrace")})(p||(t.SetTraceNotification=p={}));var m;(function(B){B.type=new r.NotificationType("$/logTrace")})(m||(t.LogTraceNotification=m={}));var g;(function(B){B[B.Closed=1]="Closed",B[B.Disposed=2]="Disposed",B[B.AlreadyListening=3]="AlreadyListening"})(g||(t.ConnectionErrors=g={}));class y extends Error{constructor(M,F){super(F),this.code=M,Object.setPrototypeOf(this,y.prototype)}}t.ConnectionError=y;var w;(function(B){function M(F){const I=F;return I&&n.func(I.cancelUndispatched)}B.is=M})(w||(t.ConnectionStrategy=w={}));var v;(function(B){function M(F){const I=F;return I&&(I.kind===void 0||I.kind==="id")&&n.func(I.createCancellationTokenSource)&&(I.dispose===void 0||n.func(I.dispose))}B.is=M})(v||(t.IdCancellationReceiverStrategy=v={}));var x;(function(B){function M(F){const I=F;return I&&I.kind==="request"&&n.func(I.createCancellationTokenSource)&&(I.dispose===void 0||n.func(I.dispose))}B.is=M})(x||(t.RequestCancellationReceiverStrategy=x={}));var C;(function(B){B.Message=Object.freeze({createCancellationTokenSource(F){return new o.CancellationTokenSource}});function M(F){return v.is(F)||x.is(F)}B.is=M})(C||(t.CancellationReceiverStrategy=C={}));var _;(function(B){B.Message=Object.freeze({sendCancellation(F,I){return F.sendNotification(a.type,{id:I})},cleanup(F){}});function M(F){const I=F;return I&&n.func(I.sendCancellation)&&n.func(I.cleanup)}B.is=M})(_||(t.CancellationSenderStrategy=_={}));var S;(function(B){B.Message=Object.freeze({receiver:C.Message,sender:_.Message});function M(F){const I=F;return I&&C.is(I.receiver)&&_.is(I.sender)}B.is=M})(S||(t.CancellationStrategy=S={}));var E;(function(B){function M(F){const I=F;return I&&n.func(I.handleMessage)}B.is=M})(E||(t.MessageStrategy=E={}));var T;(function(B){function M(F){const I=F;return I&&(S.is(I.cancellationStrategy)||w.is(I.connectionStrategy)||E.is(I.messageStrategy))}B.is=M})(T||(t.ConnectionOptions=T={}));var R;(function(B){B[B.New=1]="New",B[B.Listening=2]="Listening",B[B.Closed=3]="Closed",B[B.Disposed=4]="Disposed"})(R||(R={}));function k(B,M,F,I){const z=F!==void 0?F:t.NullLogger;let Y=0,$=0,ee=0;const W="2.0";let ne;const Se=new Map;let fe;const ge=new Map,Oe=new Map;let Fe,De=new i.LinkedMap,ke=new Map,Ge=new Set,Ve=new Map,q=f.Off,Ue=A.Text,O,ve=R.New;const Ae=new s.Emitter,ae=new s.Emitter,Z=new s.Emitter,pe=new s.Emitter,J=new s.Emitter,H=I&&I.cancellationStrategy?I.cancellationStrategy:S.Message;function oe(N){if(N===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+N.toString()}function we(N){return N===null?"res-unknown-"+(++ee).toString():"res-"+N.toString()}function Ee(){return"not-"+(++$).toString()}function re(N,D){r.Message.isRequest(D)?N.set(oe(D.id),D):r.Message.isResponse(D)?N.set(we(D.id),D):N.set(Ee(),D)}function ce(N){}function le(){return ve===R.Listening}function me(){return ve===R.Closed}function Le(){return ve===R.Disposed}function Te(){(ve===R.New||ve===R.Listening)&&(ve=R.Closed,ae.fire(void 0))}function Pe(N){Ae.fire([N,void 0,void 0])}function Qe(N){Ae.fire(N)}B.onClose(Te),B.onError(Pe),M.onClose(Te),M.onError(Qe);function $e(){Fe||De.size===0||(Fe=(0,e.default)().timer.setImmediate(()=>{Fe=void 0,st()}))}function et(N){r.Message.isRequest(N)?Mt(N):r.Message.isNotification(N)?Be(N):r.Message.isResponse(N)?K(N):Re(N)}function st(){if(De.size===0)return;const N=De.shift();try{const D=I==null?void 0:I.messageStrategy;E.is(D)?D.handleMessage(N,et):et(N)}finally{$e()}}const dt=N=>{try{if(r.Message.isNotification(N)&&N.method===a.type.method){const D=N.params.id,j=oe(D),U=De.get(j);if(r.Message.isRequest(U)){const L=I==null?void 0:I.connectionStrategy,Q=L&&L.cancelUndispatched?L.cancelUndispatched(U,ce):void 0;if(Q&&(Q.error!==void 0||Q.result!==void 0)){De.delete(j),Ve.delete(D),Q.id=U.id,ht(Q,N.method,Date.now()),M.write(Q).catch(()=>z.error("Sending response for canceled message failed."));return}}const G=Ve.get(D);if(G!==void 0){G.cancel(),tn(N);return}else Ge.add(D)}re(De,N)}finally{$e()}};function Mt(N){if(Le())return;function D(X,V,he){const _e={jsonrpc:W,id:N.id};X instanceof r.ResponseError?_e.error=X.toJson():_e.result=X===void 0?null:X,ht(_e,V,he),M.write(_e).catch(()=>z.error("Sending response failed."))}function j(X,V,he){const _e={jsonrpc:W,id:N.id,error:X.toJson()};ht(_e,V,he),M.write(_e).catch(()=>z.error("Sending response failed."))}function U(X,V,he){X===void 0&&(X=null);const _e={jsonrpc:W,id:N.id,result:X};ht(_e,V,he),M.write(_e).catch(()=>z.error("Sending response failed."))}Gt(N);const G=Se.get(N.method);let L,Q;G&&(L=G.type,Q=G.handler);const te=Date.now();if(Q||ne){const X=N.id??String(Date.now()),V=v.is(H.receiver)?H.receiver.createCancellationTokenSource(X):H.receiver.createCancellationTokenSource(N);N.id!==null&&Ge.has(N.id)&&V.cancel(),N.id!==null&&Ve.set(X,V);try{let he;if(Q)if(N.params===void 0){if(L!==void 0&&L.numberOfParams!==0){j(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${N.method} defines ${L.numberOfParams} params but received none.`),N.method,te);return}he=Q(V.token)}else if(Array.isArray(N.params)){if(L!==void 0&&L.parameterStructures===r.ParameterStructures.byName){j(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${N.method} defines parameters by name but received parameters by position`),N.method,te);return}he=Q(...N.params,V.token)}else{if(L!==void 0&&L.parameterStructures===r.ParameterStructures.byPosition){j(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${N.method} defines parameters by position but received parameters by name`),N.method,te);return}he=Q(N.params,V.token)}else ne&&(he=ne(N.method,N.params,V.token));const _e=he;he?_e.then?_e.then(He=>{Ve.delete(X),D(He,N.method,te)},He=>{Ve.delete(X),He instanceof r.ResponseError?j(He,N.method,te):He&&n.string(He.message)?j(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${N.method} failed with message: ${He.message}`),N.method,te):j(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${N.method} failed unexpectedly without providing any details.`),N.method,te)}):(Ve.delete(X),D(he,N.method,te)):(Ve.delete(X),U(he,N.method,te))}catch(he){Ve.delete(X),he instanceof r.ResponseError?D(he,N.method,te):he&&n.string(he.message)?j(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${N.method} failed with message: ${he.message}`),N.method,te):j(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${N.method} failed unexpectedly without providing any details.`),N.method,te)}}else j(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${N.method}`),N.method,te)}function K(N){if(!Le())if(N.id===null)N.error?z.error(`Received response message without id: Error is: 
${JSON.stringify(N.error,void 0,4)}`):z.error("Received response message without id. No further error information provided.");else{const D=N.id,j=ke.get(D);if(Ft(N,j),j!==void 0){ke.delete(D);try{if(N.error){const U=N.error;j.reject(new r.ResponseError(U.code,U.message,U.data))}else if(N.result!==void 0)j.resolve(N.result);else throw new Error("Should never happen.")}catch(U){U.message?z.error(`Response handler '${j.method}' failed with message: ${U.message}`):z.error(`Response handler '${j.method}' failed unexpectedly.`)}}}}function Be(N){if(Le())return;let D,j;if(N.method===a.type.method){const U=N.params.id;Ge.delete(U),tn(N);return}else{const U=ge.get(N.method);U&&(j=U.handler,D=U.type)}if(j||fe)try{if(tn(N),j)if(N.params===void 0)D!==void 0&&D.numberOfParams!==0&&D.parameterStructures!==r.ParameterStructures.byName&&z.error(`Notification ${N.method} defines ${D.numberOfParams} params but received none.`),j();else if(Array.isArray(N.params)){const U=N.params;N.method===c.type.method&&U.length===2&&l.is(U[0])?j({token:U[0],value:U[1]}):(D!==void 0&&(D.parameterStructures===r.ParameterStructures.byName&&z.error(`Notification ${N.method} defines parameters by name but received parameters by position`),D.numberOfParams!==N.params.length&&z.error(`Notification ${N.method} defines ${D.numberOfParams} params but received ${U.length} arguments`)),j(...U))}else D!==void 0&&D.parameterStructures===r.ParameterStructures.byPosition&&z.error(`Notification ${N.method} defines parameters by position but received parameters by name`),j(N.params);else fe&&fe(N.method,N.params)}catch(U){U.message?z.error(`Notification handler '${N.method}' failed with message: ${U.message}`):z.error(`Notification handler '${N.method}' failed unexpectedly.`)}else Z.fire(N)}function Re(N){if(!N){z.error("Received empty message.");return}z.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(N,null,4)}`);const D=N;if(n.string(D.id)||n.number(D.id)){const j=D.id,U=ke.get(j);U&&U.reject(new Error("The received response has neither a result nor an error property."))}}function Me(N){if(N!=null)switch(q){case f.Verbose:return JSON.stringify(N,null,4);case f.Compact:return JSON.stringify(N);default:return}}function We(N){if(!(q===f.Off||!O))if(Ue===A.Text){let D;(q===f.Verbose||q===f.Compact)&&N.params&&(D=`Params: ${Me(N.params)}

`),O.log(`Sending request '${N.method} - (${N.id})'.`,D)}else Dt("send-request",N)}function Je(N){if(!(q===f.Off||!O))if(Ue===A.Text){let D;(q===f.Verbose||q===f.Compact)&&(N.params?D=`Params: ${Me(N.params)}

`:D=`No parameters provided.

`),O.log(`Sending notification '${N.method}'.`,D)}else Dt("send-notification",N)}function ht(N,D,j){if(!(q===f.Off||!O))if(Ue===A.Text){let U;(q===f.Verbose||q===f.Compact)&&(N.error&&N.error.data?U=`Error data: ${Me(N.error.data)}

`:N.result?U=`Result: ${Me(N.result)}

`:N.error===void 0&&(U=`No result returned.

`)),O.log(`Sending response '${D} - (${N.id})'. Processing request took ${Date.now()-j}ms`,U)}else Dt("send-response",N)}function Gt(N){if(!(q===f.Off||!O))if(Ue===A.Text){let D;(q===f.Verbose||q===f.Compact)&&N.params&&(D=`Params: ${Me(N.params)}

`),O.log(`Received request '${N.method} - (${N.id})'.`,D)}else Dt("receive-request",N)}function tn(N){if(!(q===f.Off||!O||N.method===m.type.method))if(Ue===A.Text){let D;(q===f.Verbose||q===f.Compact)&&(N.params?D=`Params: ${Me(N.params)}

`:D=`No parameters provided.

`),O.log(`Received notification '${N.method}'.`,D)}else Dt("receive-notification",N)}function Ft(N,D){if(!(q===f.Off||!O))if(Ue===A.Text){let j;if((q===f.Verbose||q===f.Compact)&&(N.error&&N.error.data?j=`Error data: ${Me(N.error.data)}

`:N.result?j=`Result: ${Me(N.result)}

`:N.error===void 0&&(j=`No result returned.

`)),D){const U=N.error?` Request failed: ${N.error.message} (${N.error.code}).`:"";O.log(`Received response '${D.method} - (${N.id})' in ${Date.now()-D.timerStart}ms.${U}`,j)}else O.log(`Received response ${N.id} without active response promise.`,j)}else Dt("receive-response",N)}function Dt(N,D){if(!O||q===f.Off)return;const j={isLSPMessage:!0,type:N,message:D,timestamp:Date.now()};O.log(j)}function zt(){if(me())throw new y(g.Closed,"Connection is closed.");if(Le())throw new y(g.Disposed,"Connection is disposed.")}function tr(){if(le())throw new y(g.AlreadyListening,"Connection is already listening")}function wn(){if(!le())throw new Error("Call listen() first.")}function Vn(N){return N===void 0?null:N}function kr(N){if(N!==null)return N}function ue(N){return N!=null&&!Array.isArray(N)&&typeof N=="object"}function ye(N,D){switch(N){case r.ParameterStructures.auto:return ue(D)?kr(D):[Vn(D)];case r.ParameterStructures.byName:if(!ue(D))throw new Error("Received parameters by name but param is not an object literal.");return kr(D);case r.ParameterStructures.byPosition:return[Vn(D)];default:throw new Error(`Unknown parameter structure ${N.toString()}`)}}function xe(N,D){let j;const U=N.numberOfParams;switch(U){case 0:j=void 0;break;case 1:j=ye(N.parameterStructures,D[0]);break;default:j=[];for(let G=0;G<D.length&&G<U;G++)j.push(Vn(D[G]));if(D.length<U)for(let G=D.length;G<U;G++)j.push(null);break}return j}const Ce={sendNotification:(N,...D)=>{zt();let j,U;if(n.string(N)){j=N;const L=D[0];let Q=0,te=r.ParameterStructures.auto;r.ParameterStructures.is(L)&&(Q=1,te=L);let X=D.length;const V=X-Q;switch(V){case 0:U=void 0;break;case 1:U=ye(te,D[Q]);break;default:if(te===r.ParameterStructures.byName)throw new Error(`Received ${V} parameters for 'by Name' notification parameter structure.`);U=D.slice(Q,X).map(he=>Vn(he));break}}else{const L=D;j=N.method,U=xe(N,L)}const G={jsonrpc:W,method:j,params:U};return Je(G),M.write(G).catch(L=>{throw z.error("Sending notification failed."),L})},onNotification:(N,D)=>{zt();let j;return n.func(N)?fe=N:D&&(n.string(N)?(j=N,ge.set(N,{type:void 0,handler:D})):(j=N.method,ge.set(N.method,{type:N,handler:D}))),{dispose:()=>{j!==void 0?ge.delete(j):fe=void 0}}},onProgress:(N,D,j)=>{if(Oe.has(D))throw new Error(`Progress handler for token ${D} already registered`);return Oe.set(D,j),{dispose:()=>{Oe.delete(D)}}},sendProgress:(N,D,j)=>Ce.sendNotification(c.type,{token:D,value:j}),onUnhandledProgress:pe.event,sendRequest:(N,...D)=>{zt(),wn();let j,U,G;if(n.string(N)){j=N;const X=D[0],V=D[D.length-1];let he=0,_e=r.ParameterStructures.auto;r.ParameterStructures.is(X)&&(he=1,_e=X);let He=D.length;o.CancellationToken.is(V)&&(He=He-1,G=V);const ze=He-he;switch(ze){case 0:U=void 0;break;case 1:U=ye(_e,D[he]);break;default:if(_e===r.ParameterStructures.byName)throw new Error(`Received ${ze} parameters for 'by Name' request parameter structure.`);U=D.slice(he,He).map(lt=>Vn(lt));break}}else{const X=D;j=N.method,U=xe(N,X);const V=N.numberOfParams;G=o.CancellationToken.is(X[V])?X[V]:void 0}const L=Y++;let Q;G&&(Q=G.onCancellationRequested(()=>{const X=H.sender.sendCancellation(Ce,L);return X===void 0?(z.log(`Received no promise from cancellation strategy when cancelling id ${L}`),Promise.resolve()):X.catch(()=>{z.log(`Sending cancellation messages for id ${L} failed`)})}));const te={jsonrpc:W,id:L,method:j,params:U};return We(te),typeof H.sender.enableCancellation=="function"&&H.sender.enableCancellation(te),new Promise(async(X,V)=>{const he=ze=>{X(ze),H.sender.cleanup(L),Q==null||Q.dispose()},_e=ze=>{V(ze),H.sender.cleanup(L),Q==null||Q.dispose()},He={method:j,timerStart:Date.now(),resolve:he,reject:_e};try{await M.write(te),ke.set(L,He)}catch(ze){throw z.error("Sending request failed."),He.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,ze.message?ze.message:"Unknown reason")),ze}})},onRequest:(N,D)=>{zt();let j=null;return d.is(N)?(j=void 0,ne=N):n.string(N)?(j=null,D!==void 0&&(j=N,Se.set(N,{handler:D,type:void 0}))):D!==void 0&&(j=N.method,Se.set(N.method,{type:N,handler:D})),{dispose:()=>{j!==null&&(j!==void 0?Se.delete(j):ne=void 0)}}},hasPendingResponse:()=>ke.size>0,trace:async(N,D,j)=>{let U=!1,G=A.Text;j!==void 0&&(n.boolean(j)?U=j:(U=j.sendNotification||!1,G=j.traceFormat||A.Text)),q=N,Ue=G,q===f.Off?O=void 0:O=D,U&&!me()&&!Le()&&await Ce.sendNotification(p.type,{value:f.toString(N)})},onError:Ae.event,onClose:ae.event,onUnhandledNotification:Z.event,onDispose:J.event,end:()=>{M.end()},dispose:()=>{if(Le())return;ve=R.Disposed,J.fire(void 0);const N=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const D of ke.values())D.reject(N);ke=new Map,Ve=new Map,Ge=new Set,De=new i.LinkedMap,n.func(M.dispose)&&M.dispose(),n.func(B.dispose)&&B.dispose()},listen:()=>{zt(),tr(),ve=R.Listening,B.listen(dt)},inspect:()=>{(0,e.default)().console.log("inspect")}};return Ce.onNotification(m.type,N=>{if(q===f.Off||!O)return;const D=q===f.Verbose||q===f.Compact;O.log(N.message,D?N.verbose:void 0)}),Ce.onNotification(c.type,N=>{const D=Oe.get(N.token);D?D(N.value):pe.fire(N)}),Ce}t.createMessageConnection=k})(cq);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressType=t.ProgressToken=t.createMessageConnection=t.NullLogger=t.ConnectionOptions=t.ConnectionStrategy=t.AbstractMessageBuffer=t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=t.SharedArrayReceiverStrategy=t.SharedArraySenderStrategy=t.CancellationToken=t.CancellationTokenSource=t.Emitter=t.Event=t.Disposable=t.LRUCache=t.Touch=t.LinkedMap=t.ParameterStructures=t.NotificationType9=t.NotificationType8=t.NotificationType7=t.NotificationType6=t.NotificationType5=t.NotificationType4=t.NotificationType3=t.NotificationType2=t.NotificationType1=t.NotificationType0=t.NotificationType=t.ErrorCodes=t.ResponseError=t.RequestType9=t.RequestType8=t.RequestType7=t.RequestType6=t.RequestType5=t.RequestType4=t.RequestType3=t.RequestType2=t.RequestType1=t.RequestType0=t.RequestType=t.Message=t.RAL=void 0,t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=void 0;const e=Lt;Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return e.Message}}),Object.defineProperty(t,"RequestType",{enumerable:!0,get:function(){return e.RequestType}}),Object.defineProperty(t,"RequestType0",{enumerable:!0,get:function(){return e.RequestType0}}),Object.defineProperty(t,"RequestType1",{enumerable:!0,get:function(){return e.RequestType1}}),Object.defineProperty(t,"RequestType2",{enumerable:!0,get:function(){return e.RequestType2}}),Object.defineProperty(t,"RequestType3",{enumerable:!0,get:function(){return e.RequestType3}}),Object.defineProperty(t,"RequestType4",{enumerable:!0,get:function(){return e.RequestType4}}),Object.defineProperty(t,"RequestType5",{enumerable:!0,get:function(){return e.RequestType5}}),Object.defineProperty(t,"RequestType6",{enumerable:!0,get:function(){return e.RequestType6}}),Object.defineProperty(t,"RequestType7",{enumerable:!0,get:function(){return e.RequestType7}}),Object.defineProperty(t,"RequestType8",{enumerable:!0,get:function(){return e.RequestType8}}),Object.defineProperty(t,"RequestType9",{enumerable:!0,get:function(){return e.RequestType9}}),Object.defineProperty(t,"ResponseError",{enumerable:!0,get:function(){return e.ResponseError}}),Object.defineProperty(t,"ErrorCodes",{enumerable:!0,get:function(){return e.ErrorCodes}}),Object.defineProperty(t,"NotificationType",{enumerable:!0,get:function(){return e.NotificationType}}),Object.defineProperty(t,"NotificationType0",{enumerable:!0,get:function(){return e.NotificationType0}}),Object.defineProperty(t,"NotificationType1",{enumerable:!0,get:function(){return e.NotificationType1}}),Object.defineProperty(t,"NotificationType2",{enumerable:!0,get:function(){return e.NotificationType2}}),Object.defineProperty(t,"NotificationType3",{enumerable:!0,get:function(){return e.NotificationType3}}),Object.defineProperty(t,"NotificationType4",{enumerable:!0,get:function(){return e.NotificationType4}}),Object.defineProperty(t,"NotificationType5",{enumerable:!0,get:function(){return e.NotificationType5}}),Object.defineProperty(t,"NotificationType6",{enumerable:!0,get:function(){return e.NotificationType6}}),Object.defineProperty(t,"NotificationType7",{enumerable:!0,get:function(){return e.NotificationType7}}),Object.defineProperty(t,"NotificationType8",{enumerable:!0,get:function(){return e.NotificationType8}}),Object.defineProperty(t,"NotificationType9",{enumerable:!0,get:function(){return e.NotificationType9}}),Object.defineProperty(t,"ParameterStructures",{enumerable:!0,get:function(){return e.ParameterStructures}});const n=Hc;Object.defineProperty(t,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(t,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(t,"Touch",{enumerable:!0,get:function(){return n.Touch}});const r=$S;Object.defineProperty(t,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const i=$l;Object.defineProperty(t,"Event",{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(t,"Emitter",{enumerable:!0,get:function(){return i.Emitter}});const s=af;Object.defineProperty(t,"CancellationTokenSource",{enumerable:!0,get:function(){return s.CancellationTokenSource}}),Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return s.CancellationToken}});const o=Dm;Object.defineProperty(t,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(t,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});const a=Od;Object.defineProperty(t,"MessageReader",{enumerable:!0,get:function(){return a.MessageReader}}),Object.defineProperty(t,"AbstractMessageReader",{enumerable:!0,get:function(){return a.AbstractMessageReader}}),Object.defineProperty(t,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return a.ReadableStreamMessageReader}});const l=Fd;Object.defineProperty(t,"MessageWriter",{enumerable:!0,get:function(){return l.MessageWriter}}),Object.defineProperty(t,"AbstractMessageWriter",{enumerable:!0,get:function(){return l.AbstractMessageWriter}}),Object.defineProperty(t,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return l.WriteableStreamMessageWriter}});const c=qS;Object.defineProperty(t,"AbstractMessageBuffer",{enumerable:!0,get:function(){return c.AbstractMessageBuffer}});const u=cq;Object.defineProperty(t,"ConnectionStrategy",{enumerable:!0,get:function(){return u.ConnectionStrategy}}),Object.defineProperty(t,"ConnectionOptions",{enumerable:!0,get:function(){return u.ConnectionOptions}}),Object.defineProperty(t,"NullLogger",{enumerable:!0,get:function(){return u.NullLogger}}),Object.defineProperty(t,"createMessageConnection",{enumerable:!0,get:function(){return u.createMessageConnection}}),Object.defineProperty(t,"ProgressToken",{enumerable:!0,get:function(){return u.ProgressToken}}),Object.defineProperty(t,"ProgressType",{enumerable:!0,get:function(){return u.ProgressType}}),Object.defineProperty(t,"Trace",{enumerable:!0,get:function(){return u.Trace}}),Object.defineProperty(t,"TraceValues",{enumerable:!0,get:function(){return u.TraceValues}}),Object.defineProperty(t,"TraceFormat",{enumerable:!0,get:function(){return u.TraceFormat}}),Object.defineProperty(t,"SetTraceNotification",{enumerable:!0,get:function(){return u.SetTraceNotification}}),Object.defineProperty(t,"LogTraceNotification",{enumerable:!0,get:function(){return u.LogTraceNotification}}),Object.defineProperty(t,"ConnectionErrors",{enumerable:!0,get:function(){return u.ConnectionErrors}}),Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return u.ConnectionError}}),Object.defineProperty(t,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return u.CancellationReceiverStrategy}}),Object.defineProperty(t,"CancellationSenderStrategy",{enumerable:!0,get:function(){return u.CancellationSenderStrategy}}),Object.defineProperty(t,"CancellationStrategy",{enumerable:!0,get:function(){return u.CancellationStrategy}}),Object.defineProperty(t,"MessageStrategy",{enumerable:!0,get:function(){return u.MessageStrategy}});const d=pu;t.RAL=d.default})(r_);Object.defineProperty(GL,"__esModule",{value:!0});const Bl=r_;let uq=class dq extends Bl.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return dq.emptyBuffer}fromString(e,n){return new TextEncoder().encode(e)}toString(e,n){return n==="ascii"?this.asciiDecoder.decode(e):new TextDecoder(n).decode(e)}asNative(e,n){return n===void 0?e:e.slice(0,n)}allocNative(e){return new Uint8Array(e)}};uq.emptyBuffer=new Uint8Array(0);let eye=class{constructor(e){this.socket=e,this._onData=new Bl.Emitter,this._messageListener=n=>{n.data.arrayBuffer().then(i=>{this._onData.fire(new Uint8Array(i))},()=>{(0,Bl.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),Bl.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),Bl.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),Bl.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}},tye=class{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),Bl.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),Bl.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),Bl.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,n){if(typeof e=="string"){if(n!==void 0&&n!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${n}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}};const nye=new TextEncoder,fq=Object.freeze({messageBuffer:Object.freeze({create:t=>new uq(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{if(e.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${e.charset}`);return Promise.resolve(nye.encode(JSON.stringify(t,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{if(!(t instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(e.charset).decode(t)))}})}),stream:Object.freeze({asReadableStream:t=>new eye(t),asWritableStream:t=>new tye(t)}),console,timer:Object.freeze({setTimeout(t,e,...n){const r=setTimeout(t,e,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(t,...e){const n=setTimeout(t,0,...e);return{dispose:()=>clearTimeout(n)}},setInterval(t,e,...n){const r=setInterval(t,e,...n);return{dispose:()=>clearInterval(r)}}})});function Lk(){return fq}(function(t){function e(){Bl.RAL.install(fq)}t.install=e})(Lk||(Lk={}));GL.default=Lk;(function(t){var e=en&&en.__createBinding||(Object.create?function(l,c,u,d){d===void 0&&(d=u);var f=Object.getOwnPropertyDescriptor(c,u);(!f||("get"in f?!c.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return c[u]}}),Object.defineProperty(l,d,f)}:function(l,c,u,d){d===void 0&&(d=u),l[d]=c[u]}),n=en&&en.__exportStar||function(l,c){for(var u in l)u!=="default"&&!Object.prototype.hasOwnProperty.call(c,u)&&e(c,l,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.BrowserMessageWriter=t.BrowserMessageReader=void 0,GL.default.install();const i=r_;n(r_,t);class s extends i.AbstractMessageReader{constructor(c){super(),this._onData=new i.Emitter,this._messageListener=u=>{this._onData.fire(u.data)},c.addEventListener("error",u=>this.fireError(u)),c.onmessage=this._messageListener}listen(c){return this._onData.event(c)}}t.BrowserMessageReader=s;class o extends i.AbstractMessageWriter{constructor(c){super(),this.port=c,this.errorCount=0,c.addEventListener("error",u=>this.fireError(u))}write(c){try{return this.port.postMessage(c),Promise.resolve()}catch(u){return this.handleError(u,c),Promise.reject(u)}}handleError(c,u){this.errorCount++,this.fireError(c,u,this.errorCount)}end(){}}t.BrowserMessageWriter=o;function a(l,c,u,d){return u===void 0&&(u=i.NullLogger),i.ConnectionStrategy.is(d)&&(d={connectionStrategy:d}),(0,i.createMessageConnection)(l,c,u,d)}t.createMessageConnection=a})(aA);var Q8=aA,hq={},Ik;(function(t){function e(n){return typeof n=="string"}t.is=e})(Ik||(Ik={}));var s_;(function(t){function e(n){return typeof n=="string"}t.is=e})(s_||(s_={}));var Ok;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Ok||(Ok={}));var gy;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(gy||(gy={}));var sa;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=gy.MAX_VALUE),i===Number.MAX_VALUE&&(i=gy.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return Ne.objectLiteral(i)&&Ne.uinteger(i.line)&&Ne.uinteger(i.character)}t.is=n})(sa||(sa={}));var Vr;(function(t){function e(r,i,s,o){if(Ne.uinteger(r)&&Ne.uinteger(i)&&Ne.uinteger(s)&&Ne.uinteger(o))return{start:sa.create(r,i),end:sa.create(s,o)};if(sa.is(r)&&sa.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${o}]`)}t.create=e;function n(r){let i=r;return Ne.objectLiteral(i)&&sa.is(i.start)&&sa.is(i.end)}t.is=n})(Vr||(Vr={}));var yy;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return Ne.objectLiteral(i)&&Vr.is(i.range)&&(Ne.string(i.uri)||Ne.undefined(i.uri))}t.is=n})(yy||(yy={}));var Fk;(function(t){function e(r,i,s,o){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}t.create=e;function n(r){let i=r;return Ne.objectLiteral(i)&&Vr.is(i.targetRange)&&Ne.string(i.targetUri)&&Vr.is(i.targetSelectionRange)&&(Vr.is(i.originSelectionRange)||Ne.undefined(i.originSelectionRange))}t.is=n})(Fk||(Fk={}));var o_;(function(t){function e(r,i,s,o){return{red:r,green:i,blue:s,alpha:o}}t.create=e;function n(r){const i=r;return Ne.objectLiteral(i)&&Ne.numberRange(i.red,0,1)&&Ne.numberRange(i.green,0,1)&&Ne.numberRange(i.blue,0,1)&&Ne.numberRange(i.alpha,0,1)}t.is=n})(o_||(o_={}));var Nk;(function(t){function e(r,i){return{range:r,color:i}}t.create=e;function n(r){const i=r;return Ne.objectLiteral(i)&&Vr.is(i.range)&&o_.is(i.color)}t.is=n})(Nk||(Nk={}));var Dk;(function(t){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}t.create=e;function n(r){const i=r;return Ne.objectLiteral(i)&&Ne.string(i.label)&&(Ne.undefined(i.textEdit)||zl.is(i))&&(Ne.undefined(i.additionalTextEdits)||Ne.typedArray(i.additionalTextEdits,zl.is))}t.is=n})(Dk||(Dk={}));var Uk;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(Uk||(Uk={}));var Hk;(function(t){function e(r,i,s,o,a,l){const c={startLine:r,endLine:i};return Ne.defined(s)&&(c.startCharacter=s),Ne.defined(o)&&(c.endCharacter=o),Ne.defined(a)&&(c.kind=a),Ne.defined(l)&&(c.collapsedText=l),c}t.create=e;function n(r){const i=r;return Ne.objectLiteral(i)&&Ne.uinteger(i.startLine)&&Ne.uinteger(i.startLine)&&(Ne.undefined(i.startCharacter)||Ne.uinteger(i.startCharacter))&&(Ne.undefined(i.endCharacter)||Ne.uinteger(i.endCharacter))&&(Ne.undefined(i.kind)||Ne.string(i.kind))}t.is=n})(Hk||(Hk={}));var a_;(function(t){function e(r,i){return{location:r,message:i}}t.create=e;function n(r){let i=r;return Ne.defined(i)&&yy.is(i.location)&&Ne.string(i.message)}t.is=n})(a_||(a_={}));var jk;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(jk||(jk={}));var Qk;(function(t){t.Unnecessary=1,t.Deprecated=2})(Qk||(Qk={}));var zk;(function(t){function e(n){const r=n;return Ne.objectLiteral(r)&&Ne.string(r.href)}t.is=e})(zk||(zk={}));var vy;(function(t){function e(r,i,s,o,a,l){let c={range:r,message:i};return Ne.defined(s)&&(c.severity=s),Ne.defined(o)&&(c.code=o),Ne.defined(a)&&(c.source=a),Ne.defined(l)&&(c.relatedInformation=l),c}t.create=e;function n(r){var i;let s=r;return Ne.defined(s)&&Vr.is(s.range)&&Ne.string(s.message)&&(Ne.number(s.severity)||Ne.undefined(s.severity))&&(Ne.integer(s.code)||Ne.string(s.code)||Ne.undefined(s.code))&&(Ne.undefined(s.codeDescription)||Ne.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(Ne.string(s.source)||Ne.undefined(s.source))&&(Ne.undefined(s.relatedInformation)||Ne.typedArray(s.relatedInformation,a_.is))}t.is=n})(vy||(vy={}));var Gh;(function(t){function e(r,i,...s){let o={title:r,command:i};return Ne.defined(s)&&s.length>0&&(o.arguments=s),o}t.create=e;function n(r){let i=r;return Ne.defined(i)&&Ne.string(i.title)&&Ne.string(i.command)}t.is=n})(Gh||(Gh={}));var zl;(function(t){function e(s,o){return{range:s,newText:o}}t.replace=e;function n(s,o){return{range:{start:s,end:s},newText:o}}t.insert=n;function r(s){return{range:s,newText:""}}t.del=r;function i(s){const o=s;return Ne.objectLiteral(o)&&Ne.string(o.newText)&&Vr.is(o.range)}t.is=i})(zl||(zl={}));var Ch;(function(t){function e(r,i,s){const o={label:r};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}t.create=e;function n(r){const i=r;return Ne.objectLiteral(i)&&Ne.string(i.label)&&(Ne.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(Ne.string(i.description)||i.description===void 0)}t.is=n})(Ch||(Ch={}));var Xi;(function(t){function e(n){const r=n;return Ne.string(r)}t.is=e})(Xi||(Xi={}));var kc;(function(t){function e(s,o,a){return{range:s,newText:o,annotationId:a}}t.replace=e;function n(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}t.insert=n;function r(s,o){return{range:s,newText:"",annotationId:o}}t.del=r;function i(s){const o=s;return zl.is(o)&&(Ch.is(o.annotationId)||Xi.is(o.annotationId))}t.is=i})(kc||(kc={}));var by;(function(t){function e(r,i){return{textDocument:r,edits:i}}t.create=e;function n(r){let i=r;return Ne.defined(i)&&wy.is(i.textDocument)&&Array.isArray(i.edits)}t.is=n})(by||(by={}));var Um;(function(t){function e(r,i,s){let o={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function n(r){let i=r;return i&&i.kind==="create"&&Ne.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||Ne.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||Ne.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Xi.is(i.annotationId))}t.is=n})(Um||(Um={}));var Hm;(function(t){function e(r,i,s,o){let a={kind:"rename",oldUri:r,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}t.create=e;function n(r){let i=r;return i&&i.kind==="rename"&&Ne.string(i.oldUri)&&Ne.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||Ne.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||Ne.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Xi.is(i.annotationId))}t.is=n})(Hm||(Hm={}));var jm;(function(t){function e(r,i,s){let o={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function n(r){let i=r;return i&&i.kind==="delete"&&Ne.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||Ne.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||Ne.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Xi.is(i.annotationId))}t.is=n})(jm||(jm={}));var l_;(function(t){function e(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>Ne.string(i.kind)?Um.is(i)||Hm.is(i)||jm.is(i):by.is(i)))}t.is=e})(l_||(l_={}));class Jb{constructor(e,n){this.edits=e,this.changeAnnotations=n}insert(e,n,r){let i,s;if(r===void 0?i=zl.insert(e,n):Xi.is(r)?(s=r,i=kc.insert(e,n,r)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(r),i=kc.insert(e,n,s)),this.edits.push(i),s!==void 0)return s}replace(e,n,r){let i,s;if(r===void 0?i=zl.replace(e,n):Xi.is(r)?(s=r,i=kc.replace(e,n,r)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(r),i=kc.replace(e,n,s)),this.edits.push(i),s!==void 0)return s}delete(e,n){let r,i;if(n===void 0?r=zl.del(e):Xi.is(n)?(i=n,r=kc.del(e,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=kc.del(e,i)),this.edits.push(r),i!==void 0)return i}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}}class z8{constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,n){let r;if(Xi.is(e)?r=e:(r=this.nextId(),n=e),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(n===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=n,this._size++,r}nextId(){return this._counter++,this._counter.toString()}}class rye{constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new z8(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(n=>{if(by.is(n)){const r=new Jb(n.edits,this._changeAnnotations);this._textEditChanges[n.textDocument.uri]=r}})):e.changes&&Object.keys(e.changes).forEach(n=>{const r=new Jb(e.changes[n]);this._textEditChanges[n]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(wy.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const n={uri:e.uri,version:e.version};let r=this._textEditChanges[n.uri];if(!r){const i=[],s={textDocument:n,edits:i};this._workspaceEdit.documentChanges.push(s),r=new Jb(i,this._changeAnnotations),this._textEditChanges[n.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let n=this._textEditChanges[e];if(!n){let r=[];this._workspaceEdit.changes[e]=r,n=new Jb(r),this._textEditChanges[e]=n}return n}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new z8,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Ch.is(n)||Xi.is(n)?i=n:r=n;let s,o;if(i===void 0?s=Um.create(e,r):(o=Xi.is(i)?i:this._changeAnnotations.manage(i),s=Um.create(e,r,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o}renameFile(e,n,r,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let s;Ch.is(r)||Xi.is(r)?s=r:i=r;let o,a;if(s===void 0?o=Hm.create(e,n,i):(a=Xi.is(s)?s:this._changeAnnotations.manage(s),o=Hm.create(e,n,i,a)),this._workspaceEdit.documentChanges.push(o),a!==void 0)return a}deleteFile(e,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Ch.is(n)||Xi.is(n)?i=n:r=n;let s,o;if(i===void 0?s=jm.create(e,r):(o=Xi.is(i)?i:this._changeAnnotations.manage(i),s=jm.create(e,r,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o}}var Vk;(function(t){function e(r){return{uri:r}}t.create=e;function n(r){let i=r;return Ne.defined(i)&&Ne.string(i.uri)}t.is=n})(Vk||(Vk={}));var Gk;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return Ne.defined(i)&&Ne.string(i.uri)&&Ne.integer(i.version)}t.is=n})(Gk||(Gk={}));var wy;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return Ne.defined(i)&&Ne.string(i.uri)&&(i.version===null||Ne.integer(i.version))}t.is=n})(wy||(wy={}));var Wk;(function(t){function e(r,i,s,o){return{uri:r,languageId:i,version:s,text:o}}t.create=e;function n(r){let i=r;return Ne.defined(i)&&Ne.string(i.uri)&&Ne.string(i.languageId)&&Ne.integer(i.version)&&Ne.string(i.text)}t.is=n})(Wk||(Wk={}));var c_;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(n){const r=n;return r===t.PlainText||r===t.Markdown}t.is=e})(c_||(c_={}));var Qm;(function(t){function e(n){const r=n;return Ne.objectLiteral(n)&&c_.is(r.kind)&&Ne.string(r.value)}t.is=e})(Qm||(Qm={}));var Kk;(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(Kk||(Kk={}));var $k;(function(t){t.PlainText=1,t.Snippet=2})($k||($k={}));var qk;(function(t){t.Deprecated=1})(qk||(qk={}));var Xk;(function(t){function e(r,i,s){return{newText:r,insert:i,replace:s}}t.create=e;function n(r){const i=r;return i&&Ne.string(i.newText)&&Vr.is(i.insert)&&Vr.is(i.replace)}t.is=n})(Xk||(Xk={}));var Yk;(function(t){t.asIs=1,t.adjustIndentation=2})(Yk||(Yk={}));var Jk;(function(t){function e(n){const r=n;return r&&(Ne.string(r.detail)||r.detail===void 0)&&(Ne.string(r.description)||r.description===void 0)}t.is=e})(Jk||(Jk={}));var Zk;(function(t){function e(n){return{label:n}}t.create=e})(Zk||(Zk={}));var e4;(function(t){function e(n,r){return{items:n||[],isIncomplete:!!r}}t.create=e})(e4||(e4={}));var xy;(function(t){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function n(r){const i=r;return Ne.string(i)||Ne.objectLiteral(i)&&Ne.string(i.language)&&Ne.string(i.value)}t.is=n})(xy||(xy={}));var t4;(function(t){function e(n){let r=n;return!!r&&Ne.objectLiteral(r)&&(Qm.is(r.contents)||xy.is(r.contents)||Ne.typedArray(r.contents,xy.is))&&(n.range===void 0||Vr.is(n.range))}t.is=e})(t4||(t4={}));var n4;(function(t){function e(n,r){return r?{label:n,documentation:r}:{label:n}}t.create=e})(n4||(n4={}));var r4;(function(t){function e(n,r,...i){let s={label:n};return Ne.defined(r)&&(s.documentation=r),Ne.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(r4||(r4={}));var i4;(function(t){t.Text=1,t.Read=2,t.Write=3})(i4||(i4={}));var s4;(function(t){function e(n,r){let i={range:n};return Ne.number(r)&&(i.kind=r),i}t.create=e})(s4||(s4={}));var o4;(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(o4||(o4={}));var a4;(function(t){t.Deprecated=1})(a4||(a4={}));var l4;(function(t){function e(n,r,i,s,o){let a={name:n,kind:r,location:{uri:s,range:i}};return o&&(a.containerName=o),a}t.create=e})(l4||(l4={}));var c4;(function(t){function e(n,r,i,s){return s!==void 0?{name:n,kind:r,location:{uri:i,range:s}}:{name:n,kind:r,location:{uri:i}}}t.create=e})(c4||(c4={}));var u4;(function(t){function e(r,i,s,o,a,l){let c={name:r,detail:i,kind:s,range:o,selectionRange:a};return l!==void 0&&(c.children=l),c}t.create=e;function n(r){let i=r;return i&&Ne.string(i.name)&&Ne.number(i.kind)&&Vr.is(i.range)&&Vr.is(i.selectionRange)&&(i.detail===void 0||Ne.string(i.detail))&&(i.deprecated===void 0||Ne.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=n})(u4||(u4={}));var d4;(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(d4||(d4={}));var Cy;(function(t){t.Invoked=1,t.Automatic=2})(Cy||(Cy={}));var f4;(function(t){function e(r,i,s){let o={diagnostics:r};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}t.create=e;function n(r){let i=r;return Ne.defined(i)&&Ne.typedArray(i.diagnostics,vy.is)&&(i.only===void 0||Ne.typedArray(i.only,Ne.string))&&(i.triggerKind===void 0||i.triggerKind===Cy.Invoked||i.triggerKind===Cy.Automatic)}t.is=n})(f4||(f4={}));var h4;(function(t){function e(r,i,s){let o={title:r},a=!0;return typeof i=="string"?(a=!1,o.kind=i):Gh.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}t.create=e;function n(r){let i=r;return i&&Ne.string(i.title)&&(i.diagnostics===void 0||Ne.typedArray(i.diagnostics,vy.is))&&(i.kind===void 0||Ne.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Gh.is(i.command))&&(i.isPreferred===void 0||Ne.boolean(i.isPreferred))&&(i.edit===void 0||l_.is(i.edit))}t.is=n})(h4||(h4={}));var A4;(function(t){function e(r,i){let s={range:r};return Ne.defined(i)&&(s.data=i),s}t.create=e;function n(r){let i=r;return Ne.defined(i)&&Vr.is(i.range)&&(Ne.undefined(i.command)||Gh.is(i.command))}t.is=n})(A4||(A4={}));var p4;(function(t){function e(r,i){return{tabSize:r,insertSpaces:i}}t.create=e;function n(r){let i=r;return Ne.defined(i)&&Ne.uinteger(i.tabSize)&&Ne.boolean(i.insertSpaces)}t.is=n})(p4||(p4={}));var m4;(function(t){function e(r,i,s){return{range:r,target:i,data:s}}t.create=e;function n(r){let i=r;return Ne.defined(i)&&Vr.is(i.range)&&(Ne.undefined(i.target)||Ne.string(i.target))}t.is=n})(m4||(m4={}));var g4;(function(t){function e(r,i){return{range:r,parent:i}}t.create=e;function n(r){let i=r;return Ne.objectLiteral(i)&&Vr.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=n})(g4||(g4={}));var y4;(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(y4||(y4={}));var v4;(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(v4||(v4={}));var b4;(function(t){function e(n){const r=n;return Ne.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}t.is=e})(b4||(b4={}));var w4;(function(t){function e(r,i){return{range:r,text:i}}t.create=e;function n(r){const i=r;return i!=null&&Vr.is(i.range)&&Ne.string(i.text)}t.is=n})(w4||(w4={}));var x4;(function(t){function e(r,i,s){return{range:r,variableName:i,caseSensitiveLookup:s}}t.create=e;function n(r){const i=r;return i!=null&&Vr.is(i.range)&&Ne.boolean(i.caseSensitiveLookup)&&(Ne.string(i.variableName)||i.variableName===void 0)}t.is=n})(x4||(x4={}));var C4;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&Vr.is(i.range)&&(Ne.string(i.expression)||i.expression===void 0)}t.is=n})(C4||(C4={}));var _4;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return Ne.defined(i)&&Vr.is(r.stoppedLocation)}t.is=n})(_4||(_4={}));var u_;(function(t){t.Type=1,t.Parameter=2;function e(n){return n===1||n===2}t.is=e})(u_||(u_={}));var d_;(function(t){function e(r){return{value:r}}t.create=e;function n(r){const i=r;return Ne.objectLiteral(i)&&(i.tooltip===void 0||Ne.string(i.tooltip)||Qm.is(i.tooltip))&&(i.location===void 0||yy.is(i.location))&&(i.command===void 0||Gh.is(i.command))}t.is=n})(d_||(d_={}));var S4;(function(t){function e(r,i,s){const o={position:r,label:i};return s!==void 0&&(o.kind=s),o}t.create=e;function n(r){const i=r;return Ne.objectLiteral(i)&&sa.is(i.position)&&(Ne.string(i.label)||Ne.typedArray(i.label,d_.is))&&(i.kind===void 0||u_.is(i.kind))&&i.textEdits===void 0||Ne.typedArray(i.textEdits,zl.is)&&(i.tooltip===void 0||Ne.string(i.tooltip)||Qm.is(i.tooltip))&&(i.paddingLeft===void 0||Ne.boolean(i.paddingLeft))&&(i.paddingRight===void 0||Ne.boolean(i.paddingRight))}t.is=n})(S4||(S4={}));var E4;(function(t){function e(n){return{kind:"snippet",value:n}}t.createSnippet=e})(E4||(E4={}));var T4;(function(t){function e(n,r,i,s){return{insertText:n,filterText:r,range:i,command:s}}t.create=e})(T4||(T4={}));var B4;(function(t){function e(n){return{items:n}}t.create=e})(B4||(B4={}));var M4;(function(t){t.Invoked=0,t.Automatic=1})(M4||(M4={}));var k4;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(k4||(k4={}));var R4;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(R4||(R4={}));var P4;(function(t){function e(n){const r=n;return Ne.objectLiteral(r)&&s_.is(r.uri)&&Ne.string(r.name)}t.is=e})(P4||(P4={}));const iye=[`
`,`\r
`,"\r"];var L4;(function(t){function e(s,o,a,l){return new sye(s,o,a,l)}t.create=e;function n(s){let o=s;return!!(Ne.defined(o)&&Ne.string(o.uri)&&(Ne.undefined(o.languageId)||Ne.string(o.languageId))&&Ne.uinteger(o.lineCount)&&Ne.func(o.getText)&&Ne.func(o.positionAt)&&Ne.func(o.offsetAt))}t.is=n;function r(s,o){let a=s.getText(),l=i(o,(u,d)=>{let f=u.range.start.line-d.range.start.line;return f===0?u.range.start.character-d.range.start.character:f}),c=a.length;for(let u=l.length-1;u>=0;u--){let d=l[u],f=s.offsetAt(d.range.start),h=s.offsetAt(d.range.end);if(h<=c)a=a.substring(0,f)+d.newText+a.substring(h,a.length);else throw new Error("Overlapping edit");c=f}return a}t.applyEdits=r;function i(s,o){if(s.length<=1)return s;const a=s.length/2|0,l=s.slice(0,a),c=s.slice(a);i(l,o),i(c,o);let u=0,d=0,f=0;for(;u<l.length&&d<c.length;)o(l[u],c[d])<=0?s[f++]=l[u++]:s[f++]=c[d++];for(;u<l.length;)s[f++]=l[u++];for(;d<c.length;)s[f++]=c[d++];return s}})(L4||(L4={}));class sye{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){this._content=e.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],n=this._content,r=!0;for(let i=0;i<n.length;i++){r&&(e.push(i),r=!1);let s=n.charAt(i);r=s==="\r"||s===`
`,s==="\r"&&i+1<n.length&&n.charAt(i+1)===`
`&&i++}r&&n.length>0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return sa.create(0,e);for(;r<i;){let o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}let s=r-1;return sa.create(s,e-n[s])}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}}var Ne;(function(t){const e=Object.prototype.toString;function n(h){return typeof h<"u"}t.defined=n;function r(h){return typeof h>"u"}t.undefined=r;function i(h){return h===!0||h===!1}t.boolean=i;function s(h){return e.call(h)==="[object String]"}t.string=s;function o(h){return e.call(h)==="[object Number]"}t.number=o;function a(h,A,p){return e.call(h)==="[object Number]"&&A<=h&&h<=p}t.numberRange=a;function l(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}t.integer=l;function c(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}t.uinteger=c;function u(h){return e.call(h)==="[object Function]"}t.func=u;function d(h){return h!==null&&typeof h=="object"}t.objectLiteral=d;function f(h,A){return Array.isArray(h)&&h.every(A)}t.typedArray=f})(Ne||(Ne={}));const oye=Object.freeze(Object.defineProperty({__proto__:null,get AnnotatedTextEdit(){return kc},get ChangeAnnotation(){return Ch},get ChangeAnnotationIdentifier(){return Xi},get CodeAction(){return h4},get CodeActionContext(){return f4},get CodeActionKind(){return d4},get CodeActionTriggerKind(){return Cy},get CodeDescription(){return zk},get CodeLens(){return A4},get Color(){return o_},get ColorInformation(){return Nk},get ColorPresentation(){return Dk},get Command(){return Gh},get CompletionItem(){return Zk},get CompletionItemKind(){return Kk},get CompletionItemLabelDetails(){return Jk},get CompletionItemTag(){return qk},get CompletionList(){return e4},get CreateFile(){return Um},get DeleteFile(){return jm},get Diagnostic(){return vy},get DiagnosticRelatedInformation(){return a_},get DiagnosticSeverity(){return jk},get DiagnosticTag(){return Qk},get DocumentHighlight(){return s4},get DocumentHighlightKind(){return i4},get DocumentLink(){return m4},get DocumentSymbol(){return u4},get DocumentUri(){return Ik},EOL:iye,get FoldingRange(){return Hk},get FoldingRangeKind(){return Uk},get FormattingOptions(){return p4},get Hover(){return t4},get InlayHint(){return S4},get InlayHintKind(){return u_},get InlayHintLabelPart(){return d_},get InlineCompletionContext(){return R4},get InlineCompletionItem(){return T4},get InlineCompletionList(){return B4},get InlineCompletionTriggerKind(){return M4},get InlineValueContext(){return _4},get InlineValueEvaluatableExpression(){return C4},get InlineValueText(){return w4},get InlineValueVariableLookup(){return x4},get InsertReplaceEdit(){return Xk},get InsertTextFormat(){return $k},get InsertTextMode(){return Yk},get Location(){return yy},get LocationLink(){return Fk},get MarkedString(){return xy},get MarkupContent(){return Qm},get MarkupKind(){return c_},get OptionalVersionedTextDocumentIdentifier(){return wy},get ParameterInformation(){return n4},get Position(){return sa},get Range(){return Vr},get RenameFile(){return Hm},get SelectedCompletionInfo(){return k4},get SelectionRange(){return g4},get SemanticTokenModifiers(){return v4},get SemanticTokenTypes(){return y4},get SemanticTokens(){return b4},get SignatureInformation(){return r4},get StringValue(){return E4},get SymbolInformation(){return l4},get SymbolKind(){return o4},get SymbolTag(){return a4},get TextDocument(){return L4},get TextDocumentEdit(){return by},get TextDocumentIdentifier(){return Vk},get TextDocumentItem(){return Wk},get TextEdit(){return zl},get URI(){return s_},get VersionedTextDocumentIdentifier(){return Gk},WorkspaceChange:rye,get WorkspaceEdit(){return l_},get WorkspaceFolder(){return P4},get WorkspaceSymbol(){return c4},get integer(){return Ok},get uinteger(){return gy}},Symbol.toStringTag,{value:"Module"})),WL=Cne(oye);var vn={};Object.defineProperty(vn,"__esModule",{value:!0});vn.ProtocolNotificationType=vn.ProtocolNotificationType0=vn.ProtocolRequestType=vn.ProtocolRequestType0=vn.RegistrationType=vn.MessageDirection=void 0;const zm=aA;var V8;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(V8||(vn.MessageDirection=V8={}));class aye{constructor(e){this.method=e}}vn.RegistrationType=aye;class lye extends zm.RequestType0{constructor(e){super(e)}}vn.ProtocolRequestType0=lye;class cye extends zm.RequestType{constructor(e){super(e,zm.ParameterStructures.byName)}}vn.ProtocolRequestType=cye;class uye extends zm.NotificationType0{constructor(e){super(e)}}vn.ProtocolNotificationType0=uye;class dye extends zm.NotificationType{constructor(e){super(e,zm.ParameterStructures.byName)}}vn.ProtocolNotificationType=dye;var Aq={},Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.objectLiteral=Qr.typedArray=Qr.stringArray=Qr.array=Qr.func=Qr.error=Qr.number=Qr.string=Qr.boolean=void 0;function fye(t){return t===!0||t===!1}Qr.boolean=fye;function pq(t){return typeof t=="string"||t instanceof String}Qr.string=pq;function hye(t){return typeof t=="number"||t instanceof Number}Qr.number=hye;function Aye(t){return t instanceof Error}Qr.error=Aye;function pye(t){return typeof t=="function"}Qr.func=pye;function mq(t){return Array.isArray(t)}Qr.array=mq;function mye(t){return mq(t)&&t.every(e=>pq(e))}Qr.stringArray=mye;function gye(t,e){return Array.isArray(t)&&t.every(e)}Qr.typedArray=gye;function yye(t){return t!==null&&typeof t=="object"}Qr.objectLiteral=yye;var XS={};Object.defineProperty(XS,"__esModule",{value:!0});XS.ImplementationRequest=void 0;const G8=vn;var W8;(function(t){t.method="textDocument/implementation",t.messageDirection=G8.MessageDirection.clientToServer,t.type=new G8.ProtocolRequestType(t.method)})(W8||(XS.ImplementationRequest=W8={}));var YS={};Object.defineProperty(YS,"__esModule",{value:!0});YS.TypeDefinitionRequest=void 0;const K8=vn;var $8;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=K8.MessageDirection.clientToServer,t.type=new K8.ProtocolRequestType(t.method)})($8||(YS.TypeDefinitionRequest=$8={}));var Vm={};Object.defineProperty(Vm,"__esModule",{value:!0});Vm.DidChangeWorkspaceFoldersNotification=Vm.WorkspaceFoldersRequest=void 0;const f_=vn;var q8;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=f_.MessageDirection.serverToClient,t.type=new f_.ProtocolRequestType0(t.method)})(q8||(Vm.WorkspaceFoldersRequest=q8={}));var X8;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=f_.MessageDirection.clientToServer,t.type=new f_.ProtocolNotificationType(t.method)})(X8||(Vm.DidChangeWorkspaceFoldersNotification=X8={}));var JS={};Object.defineProperty(JS,"__esModule",{value:!0});JS.ConfigurationRequest=void 0;const Y8=vn;var J8;(function(t){t.method="workspace/configuration",t.messageDirection=Y8.MessageDirection.serverToClient,t.type=new Y8.ProtocolRequestType(t.method)})(J8||(JS.ConfigurationRequest=J8={}));var Gm={};Object.defineProperty(Gm,"__esModule",{value:!0});Gm.ColorPresentationRequest=Gm.DocumentColorRequest=void 0;const h_=vn;var Z8;(function(t){t.method="textDocument/documentColor",t.messageDirection=h_.MessageDirection.clientToServer,t.type=new h_.ProtocolRequestType(t.method)})(Z8||(Gm.DocumentColorRequest=Z8={}));var eU;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=h_.MessageDirection.clientToServer,t.type=new h_.ProtocolRequestType(t.method)})(eU||(Gm.ColorPresentationRequest=eU={}));var Wm={};Object.defineProperty(Wm,"__esModule",{value:!0});Wm.FoldingRangeRefreshRequest=Wm.FoldingRangeRequest=void 0;const A_=vn;var tU;(function(t){t.method="textDocument/foldingRange",t.messageDirection=A_.MessageDirection.clientToServer,t.type=new A_.ProtocolRequestType(t.method)})(tU||(Wm.FoldingRangeRequest=tU={}));var nU;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=A_.MessageDirection.serverToClient,t.type=new A_.ProtocolRequestType0(t.method)})(nU||(Wm.FoldingRangeRefreshRequest=nU={}));var ZS={};Object.defineProperty(ZS,"__esModule",{value:!0});ZS.DeclarationRequest=void 0;const rU=vn;var iU;(function(t){t.method="textDocument/declaration",t.messageDirection=rU.MessageDirection.clientToServer,t.type=new rU.ProtocolRequestType(t.method)})(iU||(ZS.DeclarationRequest=iU={}));var e2={};Object.defineProperty(e2,"__esModule",{value:!0});e2.SelectionRangeRequest=void 0;const sU=vn;var oU;(function(t){t.method="textDocument/selectionRange",t.messageDirection=sU.MessageDirection.clientToServer,t.type=new sU.ProtocolRequestType(t.method)})(oU||(e2.SelectionRangeRequest=oU={}));var Nd={};Object.defineProperty(Nd,"__esModule",{value:!0});Nd.WorkDoneProgressCancelNotification=Nd.WorkDoneProgressCreateRequest=Nd.WorkDoneProgress=void 0;const vye=aA,p_=vn;var aU;(function(t){t.type=new vye.ProgressType;function e(n){return n===t.type}t.is=e})(aU||(Nd.WorkDoneProgress=aU={}));var lU;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=p_.MessageDirection.serverToClient,t.type=new p_.ProtocolRequestType(t.method)})(lU||(Nd.WorkDoneProgressCreateRequest=lU={}));var cU;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=p_.MessageDirection.clientToServer,t.type=new p_.ProtocolNotificationType(t.method)})(cU||(Nd.WorkDoneProgressCancelNotification=cU={}));var Dd={};Object.defineProperty(Dd,"__esModule",{value:!0});Dd.CallHierarchyOutgoingCallsRequest=Dd.CallHierarchyIncomingCallsRequest=Dd.CallHierarchyPrepareRequest=void 0;const Km=vn;var uU;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=Km.MessageDirection.clientToServer,t.type=new Km.ProtocolRequestType(t.method)})(uU||(Dd.CallHierarchyPrepareRequest=uU={}));var dU;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=Km.MessageDirection.clientToServer,t.type=new Km.ProtocolRequestType(t.method)})(dU||(Dd.CallHierarchyIncomingCallsRequest=dU={}));var fU;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=Km.MessageDirection.clientToServer,t.type=new Km.ProtocolRequestType(t.method)})(fU||(Dd.CallHierarchyOutgoingCallsRequest=fU={}));var so={};Object.defineProperty(so,"__esModule",{value:!0});so.SemanticTokensRefreshRequest=so.SemanticTokensRangeRequest=so.SemanticTokensDeltaRequest=so.SemanticTokensRequest=so.SemanticTokensRegistrationType=so.TokenFormat=void 0;const Zc=vn;var hU;(function(t){t.Relative="relative"})(hU||(so.TokenFormat=hU={}));var _y;(function(t){t.method="textDocument/semanticTokens",t.type=new Zc.RegistrationType(t.method)})(_y||(so.SemanticTokensRegistrationType=_y={}));var AU;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=Zc.MessageDirection.clientToServer,t.type=new Zc.ProtocolRequestType(t.method),t.registrationMethod=_y.method})(AU||(so.SemanticTokensRequest=AU={}));var pU;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=Zc.MessageDirection.clientToServer,t.type=new Zc.ProtocolRequestType(t.method),t.registrationMethod=_y.method})(pU||(so.SemanticTokensDeltaRequest=pU={}));var mU;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=Zc.MessageDirection.clientToServer,t.type=new Zc.ProtocolRequestType(t.method),t.registrationMethod=_y.method})(mU||(so.SemanticTokensRangeRequest=mU={}));var gU;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=Zc.MessageDirection.serverToClient,t.type=new Zc.ProtocolRequestType0(t.method)})(gU||(so.SemanticTokensRefreshRequest=gU={}));var t2={};Object.defineProperty(t2,"__esModule",{value:!0});t2.ShowDocumentRequest=void 0;const yU=vn;var vU;(function(t){t.method="window/showDocument",t.messageDirection=yU.MessageDirection.serverToClient,t.type=new yU.ProtocolRequestType(t.method)})(vU||(t2.ShowDocumentRequest=vU={}));var n2={};Object.defineProperty(n2,"__esModule",{value:!0});n2.LinkedEditingRangeRequest=void 0;const bU=vn;var wU;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=bU.MessageDirection.clientToServer,t.type=new bU.ProtocolRequestType(t.method)})(wU||(n2.LinkedEditingRangeRequest=wU={}));var ws={};Object.defineProperty(ws,"__esModule",{value:!0});ws.WillDeleteFilesRequest=ws.DidDeleteFilesNotification=ws.DidRenameFilesNotification=ws.WillRenameFilesRequest=ws.DidCreateFilesNotification=ws.WillCreateFilesRequest=ws.FileOperationPatternKind=void 0;const Sa=vn;var xU;(function(t){t.file="file",t.folder="folder"})(xU||(ws.FileOperationPatternKind=xU={}));var CU;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Sa.MessageDirection.clientToServer,t.type=new Sa.ProtocolRequestType(t.method)})(CU||(ws.WillCreateFilesRequest=CU={}));var _U;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Sa.MessageDirection.clientToServer,t.type=new Sa.ProtocolNotificationType(t.method)})(_U||(ws.DidCreateFilesNotification=_U={}));var SU;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Sa.MessageDirection.clientToServer,t.type=new Sa.ProtocolRequestType(t.method)})(SU||(ws.WillRenameFilesRequest=SU={}));var EU;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Sa.MessageDirection.clientToServer,t.type=new Sa.ProtocolNotificationType(t.method)})(EU||(ws.DidRenameFilesNotification=EU={}));var TU;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Sa.MessageDirection.clientToServer,t.type=new Sa.ProtocolNotificationType(t.method)})(TU||(ws.DidDeleteFilesNotification=TU={}));var BU;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Sa.MessageDirection.clientToServer,t.type=new Sa.ProtocolRequestType(t.method)})(BU||(ws.WillDeleteFilesRequest=BU={}));var Ud={};Object.defineProperty(Ud,"__esModule",{value:!0});Ud.MonikerRequest=Ud.MonikerKind=Ud.UniquenessLevel=void 0;const MU=vn;var kU;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(kU||(Ud.UniquenessLevel=kU={}));var RU;(function(t){t.$import="import",t.$export="export",t.local="local"})(RU||(Ud.MonikerKind=RU={}));var PU;(function(t){t.method="textDocument/moniker",t.messageDirection=MU.MessageDirection.clientToServer,t.type=new MU.ProtocolRequestType(t.method)})(PU||(Ud.MonikerRequest=PU={}));var Hd={};Object.defineProperty(Hd,"__esModule",{value:!0});Hd.TypeHierarchySubtypesRequest=Hd.TypeHierarchySupertypesRequest=Hd.TypeHierarchyPrepareRequest=void 0;const $m=vn;var LU;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=$m.MessageDirection.clientToServer,t.type=new $m.ProtocolRequestType(t.method)})(LU||(Hd.TypeHierarchyPrepareRequest=LU={}));var IU;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=$m.MessageDirection.clientToServer,t.type=new $m.ProtocolRequestType(t.method)})(IU||(Hd.TypeHierarchySupertypesRequest=IU={}));var OU;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=$m.MessageDirection.clientToServer,t.type=new $m.ProtocolRequestType(t.method)})(OU||(Hd.TypeHierarchySubtypesRequest=OU={}));var qm={};Object.defineProperty(qm,"__esModule",{value:!0});qm.InlineValueRefreshRequest=qm.InlineValueRequest=void 0;const m_=vn;var FU;(function(t){t.method="textDocument/inlineValue",t.messageDirection=m_.MessageDirection.clientToServer,t.type=new m_.ProtocolRequestType(t.method)})(FU||(qm.InlineValueRequest=FU={}));var NU;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=m_.MessageDirection.serverToClient,t.type=new m_.ProtocolRequestType0(t.method)})(NU||(qm.InlineValueRefreshRequest=NU={}));var jd={};Object.defineProperty(jd,"__esModule",{value:!0});jd.InlayHintRefreshRequest=jd.InlayHintResolveRequest=jd.InlayHintRequest=void 0;const Xm=vn;var DU;(function(t){t.method="textDocument/inlayHint",t.messageDirection=Xm.MessageDirection.clientToServer,t.type=new Xm.ProtocolRequestType(t.method)})(DU||(jd.InlayHintRequest=DU={}));var UU;(function(t){t.method="inlayHint/resolve",t.messageDirection=Xm.MessageDirection.clientToServer,t.type=new Xm.ProtocolRequestType(t.method)})(UU||(jd.InlayHintResolveRequest=UU={}));var HU;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=Xm.MessageDirection.serverToClient,t.type=new Xm.ProtocolRequestType0(t.method)})(HU||(jd.InlayHintRefreshRequest=HU={}));var la={};Object.defineProperty(la,"__esModule",{value:!0});la.DiagnosticRefreshRequest=la.WorkspaceDiagnosticRequest=la.DocumentDiagnosticRequest=la.DocumentDiagnosticReportKind=la.DiagnosticServerCancellationData=void 0;const gq=aA,bye=Qr,Ym=vn;var jU;(function(t){function e(n){const r=n;return r&&bye.boolean(r.retriggerRequest)}t.is=e})(jU||(la.DiagnosticServerCancellationData=jU={}));var QU;(function(t){t.Full="full",t.Unchanged="unchanged"})(QU||(la.DocumentDiagnosticReportKind=QU={}));var zU;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Ym.MessageDirection.clientToServer,t.type=new Ym.ProtocolRequestType(t.method),t.partialResult=new gq.ProgressType})(zU||(la.DocumentDiagnosticRequest=zU={}));var VU;(function(t){t.method="workspace/diagnostic",t.messageDirection=Ym.MessageDirection.clientToServer,t.type=new Ym.ProtocolRequestType(t.method),t.partialResult=new gq.ProgressType})(VU||(la.WorkspaceDiagnosticRequest=VU={}));var GU;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Ym.MessageDirection.serverToClient,t.type=new Ym.ProtocolRequestType0(t.method)})(GU||(la.DiagnosticRefreshRequest=GU={}));var Hr={};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.DidCloseNotebookDocumentNotification=Hr.DidSaveNotebookDocumentNotification=Hr.DidChangeNotebookDocumentNotification=Hr.NotebookCellArrayChange=Hr.DidOpenNotebookDocumentNotification=Hr.NotebookDocumentSyncRegistrationType=Hr.NotebookDocument=Hr.NotebookCell=Hr.ExecutionSummary=Hr.NotebookCellKind=void 0;const Sy=WL,$a=Qr,ql=vn;var I4;(function(t){t.Markup=1,t.Code=2;function e(n){return n===1||n===2}t.is=e})(I4||(Hr.NotebookCellKind=I4={}));var O4;(function(t){function e(i,s){const o={executionOrder:i};return(s===!0||s===!1)&&(o.success=s),o}t.create=e;function n(i){const s=i;return $a.objectLiteral(s)&&Sy.uinteger.is(s.executionOrder)&&(s.success===void 0||$a.boolean(s.success))}t.is=n;function r(i,s){return i===s?!0:i==null||s===null||s===void 0?!1:i.executionOrder===s.executionOrder&&i.success===s.success}t.equals=r})(O4||(Hr.ExecutionSummary=O4={}));var g_;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function n(s){const o=s;return $a.objectLiteral(o)&&I4.is(o.kind)&&Sy.DocumentUri.is(o.document)&&(o.metadata===void 0||$a.objectLiteral(o.metadata))}t.is=n;function r(s,o){const a=new Set;return s.document!==o.document&&a.add("document"),s.kind!==o.kind&&a.add("kind"),s.executionSummary!==o.executionSummary&&a.add("executionSummary"),(s.metadata!==void 0||o.metadata!==void 0)&&!i(s.metadata,o.metadata)&&a.add("metadata"),(s.executionSummary!==void 0||o.executionSummary!==void 0)&&!O4.equals(s.executionSummary,o.executionSummary)&&a.add("executionSummary"),a}t.diff=r;function i(s,o){if(s===o)return!0;if(s==null||o===null||o===void 0||typeof s!=typeof o||typeof s!="object")return!1;const a=Array.isArray(s),l=Array.isArray(o);if(a!==l)return!1;if(a&&l){if(s.length!==o.length)return!1;for(let c=0;c<s.length;c++)if(!i(s[c],o[c]))return!1}if($a.objectLiteral(s)&&$a.objectLiteral(o)){const c=Object.keys(s),u=Object.keys(o);if(c.length!==u.length||(c.sort(),u.sort(),!i(c,u)))return!1;for(let d=0;d<c.length;d++){const f=c[d];if(!i(s[f],o[f]))return!1}}return!0}})(g_||(Hr.NotebookCell=g_={}));var WU;(function(t){function e(r,i,s,o){return{uri:r,notebookType:i,version:s,cells:o}}t.create=e;function n(r){const i=r;return $a.objectLiteral(i)&&$a.string(i.uri)&&Sy.integer.is(i.version)&&$a.typedArray(i.cells,g_.is)}t.is=n})(WU||(Hr.NotebookDocument=WU={}));var Jm;(function(t){t.method="notebookDocument/sync",t.messageDirection=ql.MessageDirection.clientToServer,t.type=new ql.RegistrationType(t.method)})(Jm||(Hr.NotebookDocumentSyncRegistrationType=Jm={}));var KU;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=ql.MessageDirection.clientToServer,t.type=new ql.ProtocolNotificationType(t.method),t.registrationMethod=Jm.method})(KU||(Hr.DidOpenNotebookDocumentNotification=KU={}));var $U;(function(t){function e(r){const i=r;return $a.objectLiteral(i)&&Sy.uinteger.is(i.start)&&Sy.uinteger.is(i.deleteCount)&&(i.cells===void 0||$a.typedArray(i.cells,g_.is))}t.is=e;function n(r,i,s){const o={start:r,deleteCount:i};return s!==void 0&&(o.cells=s),o}t.create=n})($U||(Hr.NotebookCellArrayChange=$U={}));var qU;(function(t){t.method="notebookDocument/didChange",t.messageDirection=ql.MessageDirection.clientToServer,t.type=new ql.ProtocolNotificationType(t.method),t.registrationMethod=Jm.method})(qU||(Hr.DidChangeNotebookDocumentNotification=qU={}));var XU;(function(t){t.method="notebookDocument/didSave",t.messageDirection=ql.MessageDirection.clientToServer,t.type=new ql.ProtocolNotificationType(t.method),t.registrationMethod=Jm.method})(XU||(Hr.DidSaveNotebookDocumentNotification=XU={}));var YU;(function(t){t.method="notebookDocument/didClose",t.messageDirection=ql.MessageDirection.clientToServer,t.type=new ql.ProtocolNotificationType(t.method),t.registrationMethod=Jm.method})(YU||(Hr.DidCloseNotebookDocumentNotification=YU={}));var r2={};Object.defineProperty(r2,"__esModule",{value:!0});r2.InlineCompletionRequest=void 0;const JU=vn;var ZU;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=JU.MessageDirection.clientToServer,t.type=new JU.ProtocolRequestType(t.method)})(ZU||(r2.InlineCompletionRequest=ZU={}));(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceSymbolRequest=t.CodeActionResolveRequest=t.CodeActionRequest=t.DocumentSymbolRequest=t.DocumentHighlightRequest=t.ReferencesRequest=t.DefinitionRequest=t.SignatureHelpRequest=t.SignatureHelpTriggerKind=t.HoverRequest=t.CompletionResolveRequest=t.CompletionRequest=t.CompletionTriggerKind=t.PublishDiagnosticsNotification=t.WatchKind=t.RelativePattern=t.FileChangeType=t.DidChangeWatchedFilesNotification=t.WillSaveTextDocumentWaitUntilRequest=t.WillSaveTextDocumentNotification=t.TextDocumentSaveReason=t.DidSaveTextDocumentNotification=t.DidCloseTextDocumentNotification=t.DidChangeTextDocumentNotification=t.TextDocumentContentChangeEvent=t.DidOpenTextDocumentNotification=t.TextDocumentSyncKind=t.TelemetryEventNotification=t.LogMessageNotification=t.ShowMessageRequest=t.ShowMessageNotification=t.MessageType=t.DidChangeConfigurationNotification=t.ExitNotification=t.ShutdownRequest=t.InitializedNotification=t.InitializeErrorCodes=t.InitializeRequest=t.WorkDoneProgressOptions=t.TextDocumentRegistrationOptions=t.StaticRegistrationOptions=t.PositionEncodingKind=t.FailureHandlingKind=t.ResourceOperationKind=t.UnregistrationRequest=t.RegistrationRequest=t.DocumentSelector=t.NotebookCellTextDocumentFilter=t.NotebookDocumentFilter=t.TextDocumentFilter=void 0,t.MonikerRequest=t.MonikerKind=t.UniquenessLevel=t.WillDeleteFilesRequest=t.DidDeleteFilesNotification=t.WillRenameFilesRequest=t.DidRenameFilesNotification=t.WillCreateFilesRequest=t.DidCreateFilesNotification=t.FileOperationPatternKind=t.LinkedEditingRangeRequest=t.ShowDocumentRequest=t.SemanticTokensRegistrationType=t.SemanticTokensRefreshRequest=t.SemanticTokensRangeRequest=t.SemanticTokensDeltaRequest=t.SemanticTokensRequest=t.TokenFormat=t.CallHierarchyPrepareRequest=t.CallHierarchyOutgoingCallsRequest=t.CallHierarchyIncomingCallsRequest=t.WorkDoneProgressCancelNotification=t.WorkDoneProgressCreateRequest=t.WorkDoneProgress=t.SelectionRangeRequest=t.DeclarationRequest=t.FoldingRangeRefreshRequest=t.FoldingRangeRequest=t.ColorPresentationRequest=t.DocumentColorRequest=t.ConfigurationRequest=t.DidChangeWorkspaceFoldersNotification=t.WorkspaceFoldersRequest=t.TypeDefinitionRequest=t.ImplementationRequest=t.ApplyWorkspaceEditRequest=t.ExecuteCommandRequest=t.PrepareRenameRequest=t.RenameRequest=t.PrepareSupportDefaultBehavior=t.DocumentOnTypeFormattingRequest=t.DocumentRangesFormattingRequest=t.DocumentRangeFormattingRequest=t.DocumentFormattingRequest=t.DocumentLinkResolveRequest=t.DocumentLinkRequest=t.CodeLensRefreshRequest=t.CodeLensResolveRequest=t.CodeLensRequest=t.WorkspaceSymbolResolveRequest=void 0,t.InlineCompletionRequest=t.DidCloseNotebookDocumentNotification=t.DidSaveNotebookDocumentNotification=t.DidChangeNotebookDocumentNotification=t.NotebookCellArrayChange=t.DidOpenNotebookDocumentNotification=t.NotebookDocumentSyncRegistrationType=t.NotebookDocument=t.NotebookCell=t.ExecutionSummary=t.NotebookCellKind=t.DiagnosticRefreshRequest=t.WorkspaceDiagnosticRequest=t.DocumentDiagnosticRequest=t.DocumentDiagnosticReportKind=t.DiagnosticServerCancellationData=t.InlayHintRefreshRequest=t.InlayHintResolveRequest=t.InlayHintRequest=t.InlineValueRefreshRequest=t.InlineValueRequest=t.TypeHierarchySupertypesRequest=t.TypeHierarchySubtypesRequest=t.TypeHierarchyPrepareRequest=void 0;const e=vn,n=WL,r=Qr,i=XS;Object.defineProperty(t,"ImplementationRequest",{enumerable:!0,get:function(){return i.ImplementationRequest}});const s=YS;Object.defineProperty(t,"TypeDefinitionRequest",{enumerable:!0,get:function(){return s.TypeDefinitionRequest}});const o=Vm;Object.defineProperty(t,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return o.WorkspaceFoldersRequest}}),Object.defineProperty(t,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return o.DidChangeWorkspaceFoldersNotification}});const a=JS;Object.defineProperty(t,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const l=Gm;Object.defineProperty(t,"DocumentColorRequest",{enumerable:!0,get:function(){return l.DocumentColorRequest}}),Object.defineProperty(t,"ColorPresentationRequest",{enumerable:!0,get:function(){return l.ColorPresentationRequest}});const c=Wm;Object.defineProperty(t,"FoldingRangeRequest",{enumerable:!0,get:function(){return c.FoldingRangeRequest}}),Object.defineProperty(t,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return c.FoldingRangeRefreshRequest}});const u=ZS;Object.defineProperty(t,"DeclarationRequest",{enumerable:!0,get:function(){return u.DeclarationRequest}});const d=e2;Object.defineProperty(t,"SelectionRangeRequest",{enumerable:!0,get:function(){return d.SelectionRangeRequest}});const f=Nd;Object.defineProperty(t,"WorkDoneProgress",{enumerable:!0,get:function(){return f.WorkDoneProgress}}),Object.defineProperty(t,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return f.WorkDoneProgressCreateRequest}}),Object.defineProperty(t,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return f.WorkDoneProgressCancelNotification}});const h=Dd;Object.defineProperty(t,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(t,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(t,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return h.CallHierarchyPrepareRequest}});const A=so;Object.defineProperty(t,"TokenFormat",{enumerable:!0,get:function(){return A.TokenFormat}}),Object.defineProperty(t,"SemanticTokensRequest",{enumerable:!0,get:function(){return A.SemanticTokensRequest}}),Object.defineProperty(t,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return A.SemanticTokensDeltaRequest}}),Object.defineProperty(t,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return A.SemanticTokensRangeRequest}}),Object.defineProperty(t,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return A.SemanticTokensRefreshRequest}}),Object.defineProperty(t,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return A.SemanticTokensRegistrationType}});const p=t2;Object.defineProperty(t,"ShowDocumentRequest",{enumerable:!0,get:function(){return p.ShowDocumentRequest}});const m=n2;Object.defineProperty(t,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return m.LinkedEditingRangeRequest}});const g=ws;Object.defineProperty(t,"FileOperationPatternKind",{enumerable:!0,get:function(){return g.FileOperationPatternKind}}),Object.defineProperty(t,"DidCreateFilesNotification",{enumerable:!0,get:function(){return g.DidCreateFilesNotification}}),Object.defineProperty(t,"WillCreateFilesRequest",{enumerable:!0,get:function(){return g.WillCreateFilesRequest}}),Object.defineProperty(t,"DidRenameFilesNotification",{enumerable:!0,get:function(){return g.DidRenameFilesNotification}}),Object.defineProperty(t,"WillRenameFilesRequest",{enumerable:!0,get:function(){return g.WillRenameFilesRequest}}),Object.defineProperty(t,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return g.DidDeleteFilesNotification}}),Object.defineProperty(t,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return g.WillDeleteFilesRequest}});const y=Ud;Object.defineProperty(t,"UniquenessLevel",{enumerable:!0,get:function(){return y.UniquenessLevel}}),Object.defineProperty(t,"MonikerKind",{enumerable:!0,get:function(){return y.MonikerKind}}),Object.defineProperty(t,"MonikerRequest",{enumerable:!0,get:function(){return y.MonikerRequest}});const w=Hd;Object.defineProperty(t,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return w.TypeHierarchyPrepareRequest}}),Object.defineProperty(t,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return w.TypeHierarchySubtypesRequest}}),Object.defineProperty(t,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return w.TypeHierarchySupertypesRequest}});const v=qm;Object.defineProperty(t,"InlineValueRequest",{enumerable:!0,get:function(){return v.InlineValueRequest}}),Object.defineProperty(t,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return v.InlineValueRefreshRequest}});const x=jd;Object.defineProperty(t,"InlayHintRequest",{enumerable:!0,get:function(){return x.InlayHintRequest}}),Object.defineProperty(t,"InlayHintResolveRequest",{enumerable:!0,get:function(){return x.InlayHintResolveRequest}}),Object.defineProperty(t,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return x.InlayHintRefreshRequest}});const C=la;Object.defineProperty(t,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return C.DiagnosticServerCancellationData}}),Object.defineProperty(t,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return C.DocumentDiagnosticReportKind}}),Object.defineProperty(t,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return C.DocumentDiagnosticRequest}}),Object.defineProperty(t,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return C.WorkspaceDiagnosticRequest}}),Object.defineProperty(t,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return C.DiagnosticRefreshRequest}});const _=Hr;Object.defineProperty(t,"NotebookCellKind",{enumerable:!0,get:function(){return _.NotebookCellKind}}),Object.defineProperty(t,"ExecutionSummary",{enumerable:!0,get:function(){return _.ExecutionSummary}}),Object.defineProperty(t,"NotebookCell",{enumerable:!0,get:function(){return _.NotebookCell}}),Object.defineProperty(t,"NotebookDocument",{enumerable:!0,get:function(){return _.NotebookDocument}}),Object.defineProperty(t,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return _.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(t,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return _.DidOpenNotebookDocumentNotification}}),Object.defineProperty(t,"NotebookCellArrayChange",{enumerable:!0,get:function(){return _.NotebookCellArrayChange}}),Object.defineProperty(t,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return _.DidChangeNotebookDocumentNotification}}),Object.defineProperty(t,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return _.DidSaveNotebookDocumentNotification}}),Object.defineProperty(t,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return _.DidCloseNotebookDocumentNotification}});const S=r2;Object.defineProperty(t,"InlineCompletionRequest",{enumerable:!0,get:function(){return S.InlineCompletionRequest}});var E;(function(ue){function ye(xe){const Ce=xe;return r.string(Ce)||r.string(Ce.language)||r.string(Ce.scheme)||r.string(Ce.pattern)}ue.is=ye})(E||(t.TextDocumentFilter=E={}));var T;(function(ue){function ye(xe){const Ce=xe;return r.objectLiteral(Ce)&&(r.string(Ce.notebookType)||r.string(Ce.scheme)||r.string(Ce.pattern))}ue.is=ye})(T||(t.NotebookDocumentFilter=T={}));var R;(function(ue){function ye(xe){const Ce=xe;return r.objectLiteral(Ce)&&(r.string(Ce.notebook)||T.is(Ce.notebook))&&(Ce.language===void 0||r.string(Ce.language))}ue.is=ye})(R||(t.NotebookCellTextDocumentFilter=R={}));var k;(function(ue){function ye(xe){if(!Array.isArray(xe))return!1;for(let Ce of xe)if(!r.string(Ce)&&!E.is(Ce)&&!R.is(Ce))return!1;return!0}ue.is=ye})(k||(t.DocumentSelector=k={}));var B;(function(ue){ue.method="client/registerCapability",ue.messageDirection=e.MessageDirection.serverToClient,ue.type=new e.ProtocolRequestType(ue.method)})(B||(t.RegistrationRequest=B={}));var M;(function(ue){ue.method="client/unregisterCapability",ue.messageDirection=e.MessageDirection.serverToClient,ue.type=new e.ProtocolRequestType(ue.method)})(M||(t.UnregistrationRequest=M={}));var F;(function(ue){ue.Create="create",ue.Rename="rename",ue.Delete="delete"})(F||(t.ResourceOperationKind=F={}));var I;(function(ue){ue.Abort="abort",ue.Transactional="transactional",ue.TextOnlyTransactional="textOnlyTransactional",ue.Undo="undo"})(I||(t.FailureHandlingKind=I={}));var z;(function(ue){ue.UTF8="utf-8",ue.UTF16="utf-16",ue.UTF32="utf-32"})(z||(t.PositionEncodingKind=z={}));var Y;(function(ue){function ye(xe){const Ce=xe;return Ce&&r.string(Ce.id)&&Ce.id.length>0}ue.hasId=ye})(Y||(t.StaticRegistrationOptions=Y={}));var $;(function(ue){function ye(xe){const Ce=xe;return Ce&&(Ce.documentSelector===null||k.is(Ce.documentSelector))}ue.is=ye})($||(t.TextDocumentRegistrationOptions=$={}));var ee;(function(ue){function ye(Ce){const N=Ce;return r.objectLiteral(N)&&(N.workDoneProgress===void 0||r.boolean(N.workDoneProgress))}ue.is=ye;function xe(Ce){const N=Ce;return N&&r.boolean(N.workDoneProgress)}ue.hasWorkDoneProgress=xe})(ee||(t.WorkDoneProgressOptions=ee={}));var W;(function(ue){ue.method="initialize",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(W||(t.InitializeRequest=W={}));var ne;(function(ue){ue.unknownProtocolVersion=1})(ne||(t.InitializeErrorCodes=ne={}));var Se;(function(ue){ue.method="initialized",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolNotificationType(ue.method)})(Se||(t.InitializedNotification=Se={}));var fe;(function(ue){ue.method="shutdown",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType0(ue.method)})(fe||(t.ShutdownRequest=fe={}));var ge;(function(ue){ue.method="exit",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolNotificationType0(ue.method)})(ge||(t.ExitNotification=ge={}));var Oe;(function(ue){ue.method="workspace/didChangeConfiguration",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolNotificationType(ue.method)})(Oe||(t.DidChangeConfigurationNotification=Oe={}));var Fe;(function(ue){ue.Error=1,ue.Warning=2,ue.Info=3,ue.Log=4,ue.Debug=5})(Fe||(t.MessageType=Fe={}));var De;(function(ue){ue.method="window/showMessage",ue.messageDirection=e.MessageDirection.serverToClient,ue.type=new e.ProtocolNotificationType(ue.method)})(De||(t.ShowMessageNotification=De={}));var ke;(function(ue){ue.method="window/showMessageRequest",ue.messageDirection=e.MessageDirection.serverToClient,ue.type=new e.ProtocolRequestType(ue.method)})(ke||(t.ShowMessageRequest=ke={}));var Ge;(function(ue){ue.method="window/logMessage",ue.messageDirection=e.MessageDirection.serverToClient,ue.type=new e.ProtocolNotificationType(ue.method)})(Ge||(t.LogMessageNotification=Ge={}));var Ve;(function(ue){ue.method="telemetry/event",ue.messageDirection=e.MessageDirection.serverToClient,ue.type=new e.ProtocolNotificationType(ue.method)})(Ve||(t.TelemetryEventNotification=Ve={}));var q;(function(ue){ue.None=0,ue.Full=1,ue.Incremental=2})(q||(t.TextDocumentSyncKind=q={}));var Ue;(function(ue){ue.method="textDocument/didOpen",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolNotificationType(ue.method)})(Ue||(t.DidOpenTextDocumentNotification=Ue={}));var O;(function(ue){function ye(Ce){let N=Ce;return N!=null&&typeof N.text=="string"&&N.range!==void 0&&(N.rangeLength===void 0||typeof N.rangeLength=="number")}ue.isIncremental=ye;function xe(Ce){let N=Ce;return N!=null&&typeof N.text=="string"&&N.range===void 0&&N.rangeLength===void 0}ue.isFull=xe})(O||(t.TextDocumentContentChangeEvent=O={}));var ve;(function(ue){ue.method="textDocument/didChange",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolNotificationType(ue.method)})(ve||(t.DidChangeTextDocumentNotification=ve={}));var Ae;(function(ue){ue.method="textDocument/didClose",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolNotificationType(ue.method)})(Ae||(t.DidCloseTextDocumentNotification=Ae={}));var ae;(function(ue){ue.method="textDocument/didSave",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolNotificationType(ue.method)})(ae||(t.DidSaveTextDocumentNotification=ae={}));var Z;(function(ue){ue.Manual=1,ue.AfterDelay=2,ue.FocusOut=3})(Z||(t.TextDocumentSaveReason=Z={}));var pe;(function(ue){ue.method="textDocument/willSave",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolNotificationType(ue.method)})(pe||(t.WillSaveTextDocumentNotification=pe={}));var J;(function(ue){ue.method="textDocument/willSaveWaitUntil",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(J||(t.WillSaveTextDocumentWaitUntilRequest=J={}));var H;(function(ue){ue.method="workspace/didChangeWatchedFiles",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolNotificationType(ue.method)})(H||(t.DidChangeWatchedFilesNotification=H={}));var oe;(function(ue){ue.Created=1,ue.Changed=2,ue.Deleted=3})(oe||(t.FileChangeType=oe={}));var we;(function(ue){function ye(xe){const Ce=xe;return r.objectLiteral(Ce)&&(n.URI.is(Ce.baseUri)||n.WorkspaceFolder.is(Ce.baseUri))&&r.string(Ce.pattern)}ue.is=ye})(we||(t.RelativePattern=we={}));var Ee;(function(ue){ue.Create=1,ue.Change=2,ue.Delete=4})(Ee||(t.WatchKind=Ee={}));var re;(function(ue){ue.method="textDocument/publishDiagnostics",ue.messageDirection=e.MessageDirection.serverToClient,ue.type=new e.ProtocolNotificationType(ue.method)})(re||(t.PublishDiagnosticsNotification=re={}));var ce;(function(ue){ue.Invoked=1,ue.TriggerCharacter=2,ue.TriggerForIncompleteCompletions=3})(ce||(t.CompletionTriggerKind=ce={}));var le;(function(ue){ue.method="textDocument/completion",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(le||(t.CompletionRequest=le={}));var me;(function(ue){ue.method="completionItem/resolve",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(me||(t.CompletionResolveRequest=me={}));var Le;(function(ue){ue.method="textDocument/hover",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Le||(t.HoverRequest=Le={}));var Te;(function(ue){ue.Invoked=1,ue.TriggerCharacter=2,ue.ContentChange=3})(Te||(t.SignatureHelpTriggerKind=Te={}));var Pe;(function(ue){ue.method="textDocument/signatureHelp",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Pe||(t.SignatureHelpRequest=Pe={}));var Qe;(function(ue){ue.method="textDocument/definition",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Qe||(t.DefinitionRequest=Qe={}));var $e;(function(ue){ue.method="textDocument/references",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})($e||(t.ReferencesRequest=$e={}));var et;(function(ue){ue.method="textDocument/documentHighlight",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(et||(t.DocumentHighlightRequest=et={}));var st;(function(ue){ue.method="textDocument/documentSymbol",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(st||(t.DocumentSymbolRequest=st={}));var dt;(function(ue){ue.method="textDocument/codeAction",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(dt||(t.CodeActionRequest=dt={}));var Mt;(function(ue){ue.method="codeAction/resolve",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Mt||(t.CodeActionResolveRequest=Mt={}));var K;(function(ue){ue.method="workspace/symbol",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(K||(t.WorkspaceSymbolRequest=K={}));var Be;(function(ue){ue.method="workspaceSymbol/resolve",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Be||(t.WorkspaceSymbolResolveRequest=Be={}));var Re;(function(ue){ue.method="textDocument/codeLens",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Re||(t.CodeLensRequest=Re={}));var Me;(function(ue){ue.method="codeLens/resolve",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Me||(t.CodeLensResolveRequest=Me={}));var We;(function(ue){ue.method="workspace/codeLens/refresh",ue.messageDirection=e.MessageDirection.serverToClient,ue.type=new e.ProtocolRequestType0(ue.method)})(We||(t.CodeLensRefreshRequest=We={}));var Je;(function(ue){ue.method="textDocument/documentLink",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Je||(t.DocumentLinkRequest=Je={}));var ht;(function(ue){ue.method="documentLink/resolve",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(ht||(t.DocumentLinkResolveRequest=ht={}));var Gt;(function(ue){ue.method="textDocument/formatting",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Gt||(t.DocumentFormattingRequest=Gt={}));var tn;(function(ue){ue.method="textDocument/rangeFormatting",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(tn||(t.DocumentRangeFormattingRequest=tn={}));var Ft;(function(ue){ue.method="textDocument/rangesFormatting",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Ft||(t.DocumentRangesFormattingRequest=Ft={}));var Dt;(function(ue){ue.method="textDocument/onTypeFormatting",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Dt||(t.DocumentOnTypeFormattingRequest=Dt={}));var zt;(function(ue){ue.Identifier=1})(zt||(t.PrepareSupportDefaultBehavior=zt={}));var tr;(function(ue){ue.method="textDocument/rename",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(tr||(t.RenameRequest=tr={}));var wn;(function(ue){ue.method="textDocument/prepareRename",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(wn||(t.PrepareRenameRequest=wn={}));var Vn;(function(ue){ue.method="workspace/executeCommand",ue.messageDirection=e.MessageDirection.clientToServer,ue.type=new e.ProtocolRequestType(ue.method)})(Vn||(t.ExecuteCommandRequest=Vn={}));var kr;(function(ue){ue.method="workspace/applyEdit",ue.messageDirection=e.MessageDirection.serverToClient,ue.type=new e.ProtocolRequestType("workspace/applyEdit")})(kr||(t.ApplyWorkspaceEditRequest=kr={}))})(Aq);var i2={};Object.defineProperty(i2,"__esModule",{value:!0});i2.createProtocolConnection=void 0;const e7=aA;function wye(t,e,n,r){return e7.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,e7.createMessageConnection)(t,e,n,r)}i2.createProtocolConnection=wye;(function(t){var e=en&&en.__createBinding||(Object.create?function(s,o,a,l){l===void 0&&(l=a);var c=Object.getOwnPropertyDescriptor(o,a);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,l,c)}:function(s,o,a,l){l===void 0&&(l=a),s[l]=o[a]}),n=en&&en.__exportStar||function(s,o){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,s,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.LSPErrorCodes=t.createProtocolConnection=void 0,n(aA,t),n(WL,t),n(vn,t),n(Aq,t);var r=i2;Object.defineProperty(t,"createProtocolConnection",{enumerable:!0,get:function(){return r.createProtocolConnection}});var i;(function(s){s.lspReservedErrorRangeStart=-32899,s.RequestFailed=-32803,s.ServerCancelled=-32802,s.ContentModified=-32801,s.RequestCancelled=-32800,s.lspReservedErrorRangeEnd=-32800})(i||(t.LSPErrorCodes=i={}))})(hq);(function(t){var e=en&&en.__createBinding||(Object.create?function(s,o,a,l){l===void 0&&(l=a);var c=Object.getOwnPropertyDescriptor(o,a);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,l,c)}:function(s,o,a,l){l===void 0&&(l=a),s[l]=o[a]}),n=en&&en.__exportStar||function(s,o){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,s,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.createProtocolConnection=void 0;const r=Q8;n(Q8,t),n(hq,t);function i(s,o,a,l){return(0,r.createMessageConnection)(s,o,a,l)}t.createProtocolConnection=i})(ki);var yq;(()=>{var t={470:i=>{function s(l){if(typeof l!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(l))}function o(l,c){for(var u,d="",f=0,h=-1,A=0,p=0;p<=l.length;++p){if(p<l.length)u=l.charCodeAt(p);else{if(u===47)break;u=47}if(u===47){if(!(h===p-1||A===1))if(h!==p-1&&A===2){if(d.length<2||f!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var m=d.lastIndexOf("/");if(m!==d.length-1){m===-1?(d="",f=0):f=(d=d.slice(0,m)).length-1-d.lastIndexOf("/"),h=p,A=0;continue}}else if(d.length===2||d.length===1){d="",f=0,h=p,A=0;continue}}c&&(d.length>0?d+="/..":d="..",f=2)}else d.length>0?d+="/"+l.slice(h+1,p):d=l.slice(h+1,p),f=p-h-1;h=p,A=0}else u===46&&A!==-1?++A:A=-1}return d}var a={resolve:function(){for(var l,c="",u=!1,d=arguments.length-1;d>=-1&&!u;d--){var f;d>=0?f=arguments[d]:(l===void 0&&(l=process.cwd()),f=l),s(f),f.length!==0&&(c=f+"/"+c,u=f.charCodeAt(0)===47)}return c=o(c,!u),u?c.length>0?"/"+c:"/":c.length>0?c:"."},normalize:function(l){if(s(l),l.length===0)return".";var c=l.charCodeAt(0)===47,u=l.charCodeAt(l.length-1)===47;return(l=o(l,!c)).length!==0||c||(l="."),l.length>0&&u&&(l+="/"),c?"/"+l:l},isAbsolute:function(l){return s(l),l.length>0&&l.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var l,c=0;c<arguments.length;++c){var u=arguments[c];s(u),u.length>0&&(l===void 0?l=u:l+="/"+u)}return l===void 0?".":a.normalize(l)},relative:function(l,c){if(s(l),s(c),l===c||(l=a.resolve(l))===(c=a.resolve(c)))return"";for(var u=1;u<l.length&&l.charCodeAt(u)===47;++u);for(var d=l.length,f=d-u,h=1;h<c.length&&c.charCodeAt(h)===47;++h);for(var A=c.length-h,p=f<A?f:A,m=-1,g=0;g<=p;++g){if(g===p){if(A>p){if(c.charCodeAt(h+g)===47)return c.slice(h+g+1);if(g===0)return c.slice(h+g)}else f>p&&(l.charCodeAt(u+g)===47?m=g:g===0&&(m=0));break}var y=l.charCodeAt(u+g);if(y!==c.charCodeAt(h+g))break;y===47&&(m=g)}var w="";for(g=u+m+1;g<=d;++g)g!==d&&l.charCodeAt(g)!==47||(w.length===0?w+="..":w+="/..");return w.length>0?w+c.slice(h+m):(h+=m,c.charCodeAt(h)===47&&++h,c.slice(h))},_makeLong:function(l){return l},dirname:function(l){if(s(l),l.length===0)return".";for(var c=l.charCodeAt(0),u=c===47,d=-1,f=!0,h=l.length-1;h>=1;--h)if((c=l.charCodeAt(h))===47){if(!f){d=h;break}}else f=!1;return d===-1?u?"/":".":u&&d===1?"//":l.slice(0,d)},basename:function(l,c){if(c!==void 0&&typeof c!="string")throw new TypeError('"ext" argument must be a string');s(l);var u,d=0,f=-1,h=!0;if(c!==void 0&&c.length>0&&c.length<=l.length){if(c.length===l.length&&c===l)return"";var A=c.length-1,p=-1;for(u=l.length-1;u>=0;--u){var m=l.charCodeAt(u);if(m===47){if(!h){d=u+1;break}}else p===-1&&(h=!1,p=u+1),A>=0&&(m===c.charCodeAt(A)?--A==-1&&(f=u):(A=-1,f=p))}return d===f?f=p:f===-1&&(f=l.length),l.slice(d,f)}for(u=l.length-1;u>=0;--u)if(l.charCodeAt(u)===47){if(!h){d=u+1;break}}else f===-1&&(h=!1,f=u+1);return f===-1?"":l.slice(d,f)},extname:function(l){s(l);for(var c=-1,u=0,d=-1,f=!0,h=0,A=l.length-1;A>=0;--A){var p=l.charCodeAt(A);if(p!==47)d===-1&&(f=!1,d=A+1),p===46?c===-1?c=A:h!==1&&(h=1):c!==-1&&(h=-1);else if(!f){u=A+1;break}}return c===-1||d===-1||h===0||h===1&&c===d-1&&c===u+1?"":l.slice(c,d)},format:function(l){if(l===null||typeof l!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof l);return function(c,u){var d=u.dir||u.root,f=u.base||(u.name||"")+(u.ext||"");return d?d===u.root?d+f:d+"/"+f:f}(0,l)},parse:function(l){s(l);var c={root:"",dir:"",base:"",ext:"",name:""};if(l.length===0)return c;var u,d=l.charCodeAt(0),f=d===47;f?(c.root="/",u=1):u=0;for(var h=-1,A=0,p=-1,m=!0,g=l.length-1,y=0;g>=u;--g)if((d=l.charCodeAt(g))!==47)p===-1&&(m=!1,p=g+1),d===46?h===-1?h=g:y!==1&&(y=1):h!==-1&&(y=-1);else if(!m){A=g+1;break}return h===-1||p===-1||y===0||y===1&&h===p-1&&h===A+1?p!==-1&&(c.base=c.name=A===0&&f?l.slice(1,p):l.slice(A,p)):(A===0&&f?(c.name=l.slice(1,h),c.base=l.slice(1,p)):(c.name=l.slice(A,h),c.base=l.slice(A,p)),c.ext=l.slice(h,p)),A>0?c.dir=l.slice(0,A-1):f&&(c.dir="/"),c},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,i.exports=a}},e={};function n(i){var s=e[i];if(s!==void 0)return s.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,n),o.exports}n.d=(i,s)=>{for(var o in s)n.o(s,o)&&!n.o(i,o)&&Object.defineProperty(i,o,{enumerable:!0,get:s[o]})},n.o=(i,s)=>Object.prototype.hasOwnProperty.call(i,s),n.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var r={};(()=>{let i;n.r(r),n.d(r,{URI:()=>f,Utils:()=>T}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,o=/^\//,a=/^\/\//;function l(R,k){if(!R.scheme&&k)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${R.authority}", path: "${R.path}", query: "${R.query}", fragment: "${R.fragment}"}`);if(R.scheme&&!s.test(R.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(R.path){if(R.authority){if(!o.test(R.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(a.test(R.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}const c="",u="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class f{constructor(k,B,M,F,I,z=!1){se(this,"scheme");se(this,"authority");se(this,"path");se(this,"query");se(this,"fragment");typeof k=="object"?(this.scheme=k.scheme||c,this.authority=k.authority||c,this.path=k.path||c,this.query=k.query||c,this.fragment=k.fragment||c):(this.scheme=function(Y,$){return Y||$?Y:"file"}(k,z),this.authority=B||c,this.path=function(Y,$){switch(Y){case"https":case"http":case"file":$?$[0]!==u&&($=u+$):$=u}return $}(this.scheme,M||c),this.query=F||c,this.fragment=I||c,l(this,z))}static isUri(k){return k instanceof f||!!k&&typeof k.authority=="string"&&typeof k.fragment=="string"&&typeof k.path=="string"&&typeof k.query=="string"&&typeof k.scheme=="string"&&typeof k.fsPath=="string"&&typeof k.with=="function"&&typeof k.toString=="function"}get fsPath(){return y(this)}with(k){if(!k)return this;let{scheme:B,authority:M,path:F,query:I,fragment:z}=k;return B===void 0?B=this.scheme:B===null&&(B=c),M===void 0?M=this.authority:M===null&&(M=c),F===void 0?F=this.path:F===null&&(F=c),I===void 0?I=this.query:I===null&&(I=c),z===void 0?z=this.fragment:z===null&&(z=c),B===this.scheme&&M===this.authority&&F===this.path&&I===this.query&&z===this.fragment?this:new A(B,M,F,I,z)}static parse(k,B=!1){const M=d.exec(k);return M?new A(M[2]||c,C(M[4]||c),C(M[5]||c),C(M[7]||c),C(M[9]||c),B):new A(c,c,c,c,c)}static file(k){let B=c;if(i&&(k=k.replace(/\\/g,u)),k[0]===u&&k[1]===u){const M=k.indexOf(u,2);M===-1?(B=k.substring(2),k=u):(B=k.substring(2,M),k=k.substring(M)||u)}return new A("file",B,k,c,c)}static from(k){const B=new A(k.scheme,k.authority,k.path,k.query,k.fragment);return l(B,!0),B}toString(k=!1){return w(this,k)}toJSON(){return this}static revive(k){if(k){if(k instanceof f)return k;{const B=new A(k);return B._formatted=k.external,B._fsPath=k._sep===h?k.fsPath:null,B}}return k}}const h=i?1:void 0;class A extends f{constructor(){super(...arguments);se(this,"_formatted",null);se(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=y(this)),this._fsPath}toString(B=!1){return B?w(this,!0):(this._formatted||(this._formatted=w(this,!1)),this._formatted)}toJSON(){const B={$mid:1};return this._fsPath&&(B.fsPath=this._fsPath,B._sep=h),this._formatted&&(B.external=this._formatted),this.path&&(B.path=this.path),this.scheme&&(B.scheme=this.scheme),this.authority&&(B.authority=this.authority),this.query&&(B.query=this.query),this.fragment&&(B.fragment=this.fragment),B}}const p={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function m(R,k,B){let M,F=-1;for(let I=0;I<R.length;I++){const z=R.charCodeAt(I);if(z>=97&&z<=122||z>=65&&z<=90||z>=48&&z<=57||z===45||z===46||z===95||z===126||k&&z===47||B&&z===91||B&&z===93||B&&z===58)F!==-1&&(M+=encodeURIComponent(R.substring(F,I)),F=-1),M!==void 0&&(M+=R.charAt(I));else{M===void 0&&(M=R.substr(0,I));const Y=p[z];Y!==void 0?(F!==-1&&(M+=encodeURIComponent(R.substring(F,I)),F=-1),M+=Y):F===-1&&(F=I)}}return F!==-1&&(M+=encodeURIComponent(R.substring(F))),M!==void 0?M:R}function g(R){let k;for(let B=0;B<R.length;B++){const M=R.charCodeAt(B);M===35||M===63?(k===void 0&&(k=R.substr(0,B)),k+=p[M]):k!==void 0&&(k+=R[B])}return k!==void 0?k:R}function y(R,k){let B;return B=R.authority&&R.path.length>1&&R.scheme==="file"?`//${R.authority}${R.path}`:R.path.charCodeAt(0)===47&&(R.path.charCodeAt(1)>=65&&R.path.charCodeAt(1)<=90||R.path.charCodeAt(1)>=97&&R.path.charCodeAt(1)<=122)&&R.path.charCodeAt(2)===58?R.path[1].toLowerCase()+R.path.substr(2):R.path,i&&(B=B.replace(/\//g,"\\")),B}function w(R,k){const B=k?g:m;let M="",{scheme:F,authority:I,path:z,query:Y,fragment:$}=R;if(F&&(M+=F,M+=":"),(I||F==="file")&&(M+=u,M+=u),I){let ee=I.indexOf("@");if(ee!==-1){const W=I.substr(0,ee);I=I.substr(ee+1),ee=W.lastIndexOf(":"),ee===-1?M+=B(W,!1,!1):(M+=B(W.substr(0,ee),!1,!1),M+=":",M+=B(W.substr(ee+1),!1,!0)),M+="@"}I=I.toLowerCase(),ee=I.lastIndexOf(":"),ee===-1?M+=B(I,!1,!0):(M+=B(I.substr(0,ee),!1,!0),M+=I.substr(ee))}if(z){if(z.length>=3&&z.charCodeAt(0)===47&&z.charCodeAt(2)===58){const ee=z.charCodeAt(1);ee>=65&&ee<=90&&(z=`/${String.fromCharCode(ee+32)}:${z.substr(3)}`)}else if(z.length>=2&&z.charCodeAt(1)===58){const ee=z.charCodeAt(0);ee>=65&&ee<=90&&(z=`${String.fromCharCode(ee+32)}:${z.substr(2)}`)}M+=B(z,!0,!1)}return Y&&(M+="?",M+=B(Y,!1,!1)),$&&(M+="#",M+=k?$:m($,!1,!1)),M}function v(R){try{return decodeURIComponent(R)}catch{return R.length>3?R.substr(0,3)+v(R.substr(3)):R}}const x=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function C(R){return R.match(x)?R.replace(x,k=>v(k)):R}var _=n(470);const S=_.posix||_,E="/";var T;(function(R){R.joinPath=function(k,...B){return k.with({path:S.join(k.path,...B)})},R.resolvePath=function(k,...B){let M=k.path,F=!1;M[0]!==E&&(M=E+M,F=!0);let I=S.resolve(M,...B);return F&&I[0]===E&&!k.authority&&(I=I.substring(1)),k.with({path:I})},R.dirname=function(k){if(k.path.length===0||k.path===E)return k;let B=S.dirname(k.path);return B.length===1&&B.charCodeAt(0)===46&&(B=""),k.with({path:B})},R.basename=function(k){return S.basename(k.path)},R.extname=function(k){return S.extname(k.path)}})(T||(T={}))})(),yq=r})();const{URI:xye,Utils:RHe}=yq;/*
 * @license
 *
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 *
 * Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
 * https://github.com/ts-stack/markdown
 */class Ha{constructor(e,n=""){se(this,"source");se(this,"flags");this.source=e.source,this.flags=n}setGroup(e,n){let r=typeof n=="string"?n:n.source;return r=r.replace(/(^|[^\[])\^/g,"$1"),this.source=this.source.replace(e,r),this}getRegexp(){return new RegExp(this.source,this.flags)}}/**
 * @license
 *
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 *
 * Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
 * https://github.com/ts-stack/markdown
 */const Cye=/[&<>"']/,_ye=/[&<>"']/g,t7={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Sye=/[<>"']|&(?!#?\w+;)/,Eye=/[<>"']|&(?!#?\w+;)/g;function Tye(t,e){if(e){if(Cye.test(t))return t.replace(_ye,n=>t7[n])}else if(Sye.test(t))return t.replace(Eye,n=>t7[n]);return t}function Bye(t){return t.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,n){return n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""})}/**
 * @license
 *
 * Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
 * https://github.com/ts-stack/markdown
 */var rn;(function(t){t[t.space=1]="space",t[t.text=2]="text",t[t.paragraph=3]="paragraph",t[t.heading=4]="heading",t[t.listStart=5]="listStart",t[t.listEnd=6]="listEnd",t[t.looseItemStart=7]="looseItemStart",t[t.looseItemEnd=8]="looseItemEnd",t[t.listItemStart=9]="listItemStart",t[t.listItemEnd=10]="listItemEnd",t[t.blockquoteStart=11]="blockquoteStart",t[t.blockquoteEnd=12]="blockquoteEnd",t[t.code=13]="code",t[t.table=14]="table",t[t.html=15]="html",t[t.hr=16]="hr"})(rn||(rn={}));class Mye{constructor(){se(this,"gfm",!0);se(this,"tables",!0);se(this,"breaks",!1);se(this,"pedantic",!1);se(this,"sanitize",!1);se(this,"sanitizer");se(this,"mangle",!0);se(this,"smartLists",!1);se(this,"silent",!1);se(this,"highlight");se(this,"langPrefix","lang-");se(this,"smartypants",!1);se(this,"headerPrefix","");se(this,"renderer");se(this,"xhtml",!1);se(this,"escape",Tye);se(this,"unescape",Bye);se(this,"isNoP")}}/**
 * @license
 *
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 *
 * Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
 * https://github.com/ts-stack/markdown
 */let vq=class{constructor(e){se(this,"options");this.options=e||eu.options}code(e,n,r,i){if(this.options.highlight){const a=this.options.highlight(e,n);a!=null&&a!==e&&(r=!0,e=a)}const s=r?e:this.options.escape(e,!0);return n?`
<pre><code class="${this.options.langPrefix+this.options.escape(n,!0)}">${s}
</code></pre>
`:`
<pre><code>${s}
</code></pre>
`}blockquote(e){return`<blockquote>
${e}</blockquote>
`}html(e){return e}heading(e,n,r){const i=this.options.headerPrefix+r.toLowerCase().replace(/[^\w]+/g,"-");return`<h${n} id="${i}">${e}</h${n}>
`}hr(){return this.options.xhtml?`<hr/>
`:`<hr>
`}list(e,n){const r=n?"ol":"ul";return`
<${r}>
${e}</${r}>
`}listitem(e){return"<li>"+e+`</li>
`}paragraph(e){return"<p>"+e+`</p>
`}table(e,n){return`
<table>
<thead>
${e}</thead>
<tbody>
${n}</tbody>
</table>
`}tablerow(e){return`<tr>
`+e+`</tr>
`}tablecell(e,n){const r=n.header?"th":"td";return(n.align?"<"+r+' style="text-align:'+n.align+'">':"<"+r+">")+e+"</"+r+`>
`}strong(e){return"<strong>"+e+"</strong>"}em(e){return"<em>"+e+"</em>"}codespan(e){return"<code>"+e+"</code>"}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return"<del>"+e+"</del>"}link(e,n,r){if(this.options.sanitize){let s;try{s=decodeURIComponent(this.options.unescape(e)).replace(/[^\w:]/g,"").toLowerCase()}catch{return r}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return r}let i='<a href="'+e+'"';return n&&(i+=' title="'+n+'"'),i+=">"+r+"</a>",i}image(e,n,r){let i='<img src="'+e+'" alt="'+r+'"';return n&&(i+=' title="'+n+'"'),i+=this.options.xhtml?"/>":">",i}text(e){return e}};/**
 * @license
 *
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 *
 * Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
 * https://github.com/ts-stack/markdown
 */class fd{constructor(e,n,r=eu.options,i){se(this,"staticThis");se(this,"links");se(this,"options");se(this,"rules");se(this,"renderer");se(this,"inLink");se(this,"hasRulesGfm");se(this,"ruleCallbacks");if(this.staticThis=e,this.links=n,this.options=r,this.renderer=i||this.options.renderer||new vq(this.options),!this.links)throw new Error("InlineLexer requires 'links' parameter.");this.setRules()}static output(e,n,r){return new this(this,n,r).output(e)}static getRulesBase(){if(this.rulesBase)return this.rulesBase;const e={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ <>]+(@|:\/)[^ <>]+)>/,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^<'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)([\s\S]*?[^`])\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,_inside:/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,_href:/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/};return e.link=new Ha(e.link).setGroup("inside",e._inside).setGroup("href",e._href).getRegexp(),e.reflink=new Ha(e.reflink).setGroup("inside",e._inside).getRegexp(),this.rulesBase=e}static getRulesPedantic(){return this.rulesPedantic?this.rulesPedantic:this.rulesPedantic={...this.getRulesBase(),strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}}static getRulesGfm(){if(this.rulesGfm)return this.rulesGfm;const e=this.getRulesBase(),n=new Ha(e.escape).setGroup("])","~|])").getRegexp(),r=new Ha(e.text).setGroup("]|","~]|").setGroup("|","|https?://|").getRegexp();return this.rulesGfm={...e,escape:n,url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:r}}static getRulesBreaks(){if(this.rulesBreaks)return this.rulesBreaks;const e=this.getRulesGfm(),n=this.getRulesGfm();return this.rulesBreaks={...n,br:new Ha(e.br).setGroup("{2,}","*").getRegexp(),text:new Ha(n.text).setGroup("{2,}","*").getRegexp()}}setRules(){this.options.gfm?this.options.breaks?this.rules=this.staticThis.getRulesBreaks():this.rules=this.staticThis.getRulesGfm():this.options.pedantic?this.rules=this.staticThis.getRulesPedantic():this.rules=this.staticThis.getRulesBase(),this.hasRulesGfm=this.rules.url!==void 0}output(e){let n,r="";for(;e;){if(n=this.rules.escape.exec(e)){e=e.substring(n[0].length),r+=n[1];continue}if(n=this.rules.autolink.exec(e)){let i,s;e=e.substring(n[0].length),n[2]==="@"?(i=this.options.escape(n[1].charAt(6)===":"?this.mangle(n[1].substring(7)):this.mangle(n[1])),s=this.mangle("mailto:")+i):(i=this.options.escape(n[1]),s=i),r+=this.renderer.link(s,null,i);continue}if(!this.inLink&&this.hasRulesGfm&&(n=this.rules.url.exec(e))){e=e.substring(n[0].length);const i=this.options.escape(n[1]),s=i;r+=this.renderer.link(s,null,i);continue}if(n=this.rules.tag.exec(e)){!this.inLink&&/^<a /i.test(n[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(n[0])&&(this.inLink=!1),e=e.substring(n[0].length),r+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):this.options.escape(n[0]):n[0];continue}if(n=this.rules.link.exec(e)){e=e.substring(n[0].length),this.inLink=!0,r+=this.outputLink(n,{href:n[2],title:n[3]}),this.inLink=!1;continue}if((n=this.rules.reflink.exec(e))||(n=this.rules.nolink.exec(e))){e=e.substring(n[0].length);const i=(n[2]||n[1]).replace(/\s+/g," "),s=this.links[i.toLowerCase()];if(!s||!s.href){r+=n[0].charAt(0),e=n[0].substring(1)+e;continue}this.inLink=!0,r+=this.outputLink(n,s),this.inLink=!1;continue}if(n=this.rules.strong.exec(e)){e=e.substring(n[0].length),r+=this.renderer.strong(this.output(n[2]||n[1]));continue}if(n=this.rules.em.exec(e)){e=e.substring(n[0].length),r+=this.renderer.em(this.output(n[2]||n[1]));continue}if(n=this.rules.code.exec(e)){e=e.substring(n[0].length),r+=this.renderer.codespan(this.options.escape(n[2].trim(),!0));continue}if(n=this.rules.br.exec(e)){e=e.substring(n[0].length),r+=this.renderer.br();continue}if(this.hasRulesGfm&&(n=this.rules.del.exec(e))){e=e.substring(n[0].length),r+=this.renderer.del(this.output(n[1]));continue}if(n=this.rules.text.exec(e)){e=e.substring(n[0].length),r+=this.renderer.text(this.options.escape(this.smartypants(n[0])));continue}if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}return r}outputLink(e,n){const r=this.options.escape(n.href),i=n.title?this.options.escape(n.title):null;return e[0].charAt(0)!=="!"?this.renderer.link(r,i,this.output(e[1])):this.renderer.image(r,i,this.options.escape(e[1]))}smartypants(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/([{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/([{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e}mangle(e){if(!this.options.mangle)return e;let n="";const r=e.length;for(let i=0;i<r;i++){let s;Math.random()>.5&&(s="x"+e.charCodeAt(i).toString(16)),n+="&#"+s+";"}return n}}se(fd,"rulesBase",null),se(fd,"rulesPedantic",null),se(fd,"rulesGfm",null),se(fd,"rulesBreaks",null);/**
 * @license
 *
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 *
 * Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
 * https://github.com/ts-stack/markdown
 */let MT=class{constructor(e){se(this,"simpleRenderers",[]);se(this,"tokens");se(this,"token");se(this,"inlineLexer");se(this,"options");se(this,"renderer");se(this,"line",0);this.tokens=[],this.token=null,this.options=e||eu.options,this.renderer=this.options.renderer||new vq(this.options)}static parse(e,n,r){return new this(r).parse(n,e)}parse(e,n){this.inlineLexer=new fd(fd,e,this.options,this.renderer),this.tokens=n.reverse();let r="";for(;this.next();)r+=this.tok();return r}debug(e,n){this.inlineLexer=new fd(fd,e,this.options,this.renderer),this.tokens=n.reverse();let r="";for(;this.next();){const i=this.tok();this.token.line=this.line+=i.split(`
`).length-1,r+=i}return r}next(){return this.token=this.tokens.pop()}getNextElement(){return this.tokens[this.tokens.length-1]}parseText(){let e=this.token.text,n;for(;(n=this.getNextElement())&&n.type==rn.text;)e+=`
`+this.next().text;return this.inlineLexer.output(e)}tok(){switch(this.token.type){case rn.space:return"";case rn.paragraph:return this.renderer.paragraph(this.inlineLexer.output(this.token.text));case rn.text:return this.options.isNoP?this.parseText():this.renderer.paragraph(this.parseText());case rn.heading:return this.renderer.heading(this.inlineLexer.output(this.token.text),this.token.depth,this.token.text);case rn.listStart:{let e="";const n=this.token.ordered;for(;this.next().type!=rn.listEnd;)e+=this.tok();return this.renderer.list(e,n)}case rn.listItemStart:{let e="";for(;this.next().type!=rn.listItemEnd;)e+=this.token.type==rn.text?this.parseText():this.tok();return this.renderer.listitem(e)}case rn.looseItemStart:{let e="";for(;this.next().type!=rn.listItemEnd;)e+=this.tok();return this.renderer.listitem(e)}case rn.code:return this.renderer.code(this.token.text,this.token.lang,this.token.escaped,this.token.meta);case rn.table:{let e="",n="",r;r="";for(let i=0;i<this.token.header.length;i++){const s={header:!0,align:this.token.align[i]},o=this.inlineLexer.output(this.token.header[i]);r+=this.renderer.tablecell(o,s)}e+=this.renderer.tablerow(r);for(const i of this.token.cells){r="";for(let s=0;s<i.length;s++)r+=this.renderer.tablecell(this.inlineLexer.output(i[s]),{header:!1,align:this.token.align[s]});n+=this.renderer.tablerow(r)}return this.renderer.table(e,n)}case rn.blockquoteStart:{let e="";for(;this.next().type!=rn.blockquoteEnd;)e+=this.tok();return this.renderer.blockquote(e)}case rn.hr:return this.renderer.hr();case rn.html:{const e=!this.token.pre&&!this.options.pedantic?this.inlineLexer.output(this.token.text):this.token.text;return this.renderer.html(e)}default:{if(this.simpleRenderers.length){for(let n=0;n<this.simpleRenderers.length;n++)if(this.token.type=="simpleRule"+(n+1))return this.simpleRenderers[n].call(this.renderer,this.token.execArr)}const e=`Token with "${this.token.type}" type was not found.`;if(this.options.silent)console.log(e);else throw new Error(e)}}}};/**
 * @license
 *
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 *
 * Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
 * https://github.com/ts-stack/markdown
 */class eu{static setOptions(e){return Object.assign(this.options,e),this}static setBlockRule(e,n=()=>""){return Bp.simpleRules.push(e),this.simpleRenderers.push(n),this}static parse(e,n){try{n={...this.options,...n};const{tokens:r,links:i}=this.callBlockLexer(e,n);return this.callParser(r,i,n)}catch(r){return this.callMe(r)}}static debug(e,n=this.options){const{tokens:r,links:i}=this.callBlockLexer(e,n);let s=r.slice();const o=new MT(n);o.simpleRenderers=this.simpleRenderers;const a=o.debug(i,r);return s=s.map(l=>{l.type=rn[l.type]||l.type;const c=l.line;return delete l.line,c?{line:c,...l}:l}),{tokens:s,links:i,result:a}}static callBlockLexer(e="",n){if(typeof e!="string")throw new Error(`Expected that the 'src' parameter would have a 'string' type, got '${typeof e}'`);return e=e.replace(/\r\n|\r/g,`
`).replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,`
`).replace(/^ +$/gm,""),Bp.lex(e,n,!0)}static callParser(e,n,r){if(this.simpleRenderers.length){const i=new MT(r);return i.simpleRenderers=this.simpleRenderers,i.parse(n,e)}else return MT.parse(e,n,r)}static callMe(e){if(e.message+=`
Please report this to https://github.com/ts-stack/markdown`,this.options.silent)return"<p>An error occured:</p><pre>"+this.options.escape(e.message+"",!0)+"</pre>";throw e}}se(eu,"options",new Mye),se(eu,"simpleRenderers",[]);/**
 * @license
 *
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 *
 * Copyright (c) 2018-2021, Костя Третяк. (MIT Licensed)
 * https://github.com/ts-stack/markdown
 */class Bp{constructor(e,n){se(this,"staticThis");se(this,"rules");se(this,"options");se(this,"links",{});se(this,"tokens",[]);se(this,"hasRulesGfm");se(this,"hasRulesTables");this.staticThis=e,this.options=n||eu.options,this.setRules()}static lex(e,n,r,i){return new this(this,n).getTokens(e,r,i)}static getRulesBase(){if(this.rulesBase)return this.rulesBase;const e={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/,bullet:/(?:[*+-]|\d+\.)/,item:/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/};e.item=new Ha(e.item,"gm").setGroup(/bull/g,e.bullet).getRegexp(),e.list=new Ha(e.list).setGroup(/bull/g,e.bullet).setGroup("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))").setGroup("def","\\n+(?="+e.def.source+")").getRegexp();const n="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";return e.html=new Ha(e.html).setGroup("comment",/<!--[\s\S]*?-->/).setGroup("closed",/<(tag)[\s\S]+?<\/\1>/).setGroup("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/).setGroup(/tag/g,n).getRegexp(),e.paragraph=new Ha(e.paragraph).setGroup("hr",e.hr).setGroup("heading",e.heading).setGroup("lheading",e.lheading).setGroup("blockquote",e.blockquote).setGroup("tag","<"+n).setGroup("def",e.def).getRegexp(),this.rulesBase=e}static getRulesGfm(){if(this.rulesGfm)return this.rulesGfm;const e=this.getRulesBase(),n={...e,fences:/^ *(`{3,}|~{3,})[ \.]*((\S+)? *[^\n]*)\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/},r=n.fences.source.replace("\\1","\\2"),i=e.list.source.replace("\\1","\\3");return n.paragraph=new Ha(e.paragraph).setGroup("(?!",`(?!${r}|${i}|`).getRegexp(),this.rulesGfm=n}static getRulesTable(){return this.rulesTables?this.rulesTables:this.rulesTables={...this.getRulesGfm(),nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}}setRules(){this.options.gfm?this.options.tables?this.rules=this.staticThis.getRulesTable():this.rules=this.staticThis.getRulesGfm():this.rules=this.staticThis.getRulesBase(),this.hasRulesGfm=this.rules.fences!==void 0,this.hasRulesTables=this.rules.table!==void 0}getTokens(e,n,r){let i=e,s;e:for(;i;){if((s=this.rules.newline.exec(i))&&(i=i.substring(s[0].length),s[0].length>1&&this.tokens.push({type:rn.space})),s=this.rules.code.exec(i)){i=i.substring(s[0].length);const o=s[0].replace(/^ {4}/gm,"");this.tokens.push({type:rn.code,text:this.options.pedantic?o:o.replace(/\n+$/,"")});continue}if(this.hasRulesGfm&&(s=this.rules.fences.exec(i))){i=i.substring(s[0].length),this.tokens.push({type:rn.code,meta:s[2],lang:s[3],text:s[4]||""});continue}if(s=this.rules.heading.exec(i)){i=i.substring(s[0].length),this.tokens.push({type:rn.heading,depth:s[1].length,text:s[2]});continue}if(n&&this.hasRulesTables&&(s=this.rules.nptable.exec(i))){i=i.substring(s[0].length);const o={type:rn.table,header:s[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]};for(let l=0;l<o.align.length;l++)/^ *-+: *$/.test(o.align[l])?o.align[l]="right":/^ *:-+: *$/.test(o.align[l])?o.align[l]="center":/^ *:-+ *$/.test(o.align[l])?o.align[l]="left":o.align[l]=null;const a=s[3].replace(/\n$/,"").split(`
`);for(let l=0;l<a.length;l++)o.cells[l]=a[l].split(/ *\| */);this.tokens.push(o);continue}if(s=this.rules.lheading.exec(i)){i=i.substring(s[0].length),this.tokens.push({type:rn.heading,depth:s[2]==="="?1:2,text:s[1]});continue}if(s=this.rules.hr.exec(i)){i=i.substring(s[0].length),this.tokens.push({type:rn.hr});continue}if(s=this.rules.blockquote.exec(i)){i=i.substring(s[0].length),this.tokens.push({type:rn.blockquoteStart});const o=s[0].replace(/^ *> ?/gm,"");this.getTokens(o),this.tokens.push({type:rn.blockquoteEnd});continue}if(s=this.rules.list.exec(i)){i=i.substring(s[0].length);const o=s[2];this.tokens.push({type:rn.listStart,ordered:o.length>1});const a=s[0].match(this.rules.item),l=a.length;let c=!1,u,d,f;for(let h=0;h<l;h++){let A=a[h];u=A.length,A=A.replace(/^ *([*+-]|\d+\.) +/,""),A.indexOf(`
 `)!==-1&&(u-=A.length,A=this.options.pedantic?A.replace(/^ {1,4}/gm,""):A.replace(new RegExp("^ {1,"+u+"}","gm"),"")),this.options.smartLists&&h!==l-1&&(d=this.staticThis.getRulesBase().bullet.exec(a[h+1])[0],o!==d&&!(o.length>1&&d.length>1)&&(i=a.slice(h+1).join(`
`)+i,h=l-1)),f=c||/\n\n(?!\s*$)/.test(A),h!==l-1&&(c=A.charAt(A.length-1)===`
`,f||(f=c)),this.tokens.push({type:f?rn.looseItemStart:rn.listItemStart}),this.getTokens(A,!1,r),this.tokens.push({type:rn.listItemEnd})}this.tokens.push({type:rn.listEnd});continue}if(s=this.rules.html.exec(i)){i=i.substring(s[0].length);const o=s[1],a=o==="pre"||o==="script"||o==="style";this.tokens.push({type:this.options.sanitize?rn.paragraph:rn.html,pre:!this.options.sanitizer&&a,text:s[0]});continue}if(n&&(s=this.rules.def.exec(i))){i=i.substring(s[0].length),this.links[s[1].toLowerCase()]={href:s[2],title:s[3]};continue}if(n&&this.hasRulesTables&&(s=this.rules.table.exec(i))){i=i.substring(s[0].length);const o={type:rn.table,header:s[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]};for(let l=0;l<o.align.length;l++)/^ *-+: *$/.test(o.align[l])?o.align[l]="right":/^ *:-+: *$/.test(o.align[l])?o.align[l]="center":/^ *:-+ *$/.test(o.align[l])?o.align[l]="left":o.align[l]=null;const a=s[3].replace(/(?: *\| *)?\n$/,"").split(`
`);for(let l=0;l<a.length;l++)o.cells[l]=a[l].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(o);continue}if(this.staticThis.simpleRules.length){const o=this.staticThis.simpleRules;for(let a=0;a<o.length;a++)if(s=o[a].exec(i)){i=i.substring(s[0].length);const l="simpleRule"+(a+1);this.tokens.push({type:l,execArr:s});continue e}}if(n&&(s=this.rules.paragraph.exec(i))){i=i.substring(s[0].length),s[1].slice(-1)===`
`?this.tokens.push({type:rn.paragraph,text:s[1].slice(0,-1)}):this.tokens.push({type:this.tokens.length>0?rn.paragraph:rn.text,text:s[1]});continue}if(s=this.rules.text.exec(i)){i=i.substring(s[0].length),this.tokens.push({type:rn.text,text:s[0]});continue}if(i)throw new Error("Infinite loop on byte: "+i.charCodeAt(0)+`, near text '${i.slice(0,30)}...'`)}return{tokens:this.tokens,links:this.links}}}se(Bp,"simpleRules",[]),se(Bp,"rulesBase",null),se(Bp,"rulesGfm",null),se(Bp,"rulesTables",null);function Oa(t,e){if(e.line>=t.lines)return;const n=t.line(e.line+1).from+e.character;if(!(n>t.length))return n}function KL(t,e){const n=t.lineAt(e);return{line:n.number-1,character:e-n.from}}function Dx(t){return Array.isArray(t)?t.map(e=>Dx(e)+`

`).join(""):typeof t=="string"?eu.parse(t):eu.parse(t.value)}const kye=Object.fromEntries(Object.entries(ki.CompletionItemKind).map(([t,e])=>[e,t])),Rye=[{key:"Ctrl-Space",run:P$},{key:"Escape",run:t=>F$(t)?!0:L$(t)},{key:"ArrowDown",run:dd(!0)},{key:"ArrowUp",run:dd(!1)},{key:"PageDown",run:dd(!0,"page")},{key:"PageUp",run:dd(!1,"page")},{key:"Enter",run:Sk},{key:"Tab",run:t=>b0e(t.state)?N$(t):Sk(t),shift:D$}],Pye=Ea.highest(oA.of(Rye));function Lye(t){return[Pye,z$({defaultKeymap:!1,override:[async e=>{var d,f;const{state:n,pos:r,explicit:i,view:s}=e;let o=s==null?void 0:s.plugin(t);if(!o)return null;let a=as(n).resolveInner(r,-1);if(a.name==="BlockComment"||a.name==="LineComment")return null;const l=n.doc.lineAt(r);let c=ki.CompletionTriggerKind.Invoked,u;return!i&&((f=(d=o.client.getServerCapabilities().completionProvider)==null?void 0:d.triggerCharacters)!=null&&f.includes(l.text[r-l.from-1]))&&(c=ki.CompletionTriggerKind.TriggerCharacter,u=l.text[r-l.from-1]),c===ki.CompletionTriggerKind.Invoked&&!e.matchBefore(/\w+$/)?null:await o.requestCompletion(e,KL(n.doc,r),{triggerKind:c,triggerCharacter:u})}]})]}const F4=Qt.define({map:(t,e)=>({...t,from:e.mapPos(t.from),to:e.mapPos(t.to)})});function Iye(){return Mr.define({create(){return Ct.none},update(t,e){if(t=t.map(e.changes),!e.annotation(wq.type))return t;e.effects.some(i=>i.is(F4))&&(t=t.update({filter:(i,s)=>!1}));for(const i of e.effects)if(i.is(F4)){const s=Oye(i.value),o=s?Mge(e.startState,[s]):void 0;i.value.from<i.value.to&&s&&o&&(t=t.update({add:[Ct.mark({class:o}).range(i.value.from,i.value.to)]}))}return t},provide:t=>At.decorations.from(t)})}function Oye(t){let e=bq(t.type);if(t.modifiers===void 0||t.modifiers===null||t.modifiers.length===0)return e;for(let n of t.modifiers)e=Fye("",n,e||void 0);return e}function bq(t){switch(t){case"keyword":return Ie.keyword;case"variable":return Ie.variableName;case"string":return Ie.string;case"number":return Ie.number;case"comment":return Ie.comment;case"operator":return Ie.operator;case"function":return Ie.function(Ie.name);case"type":return Ie.typeName;case"property":return Ie.propertyName;case"parameter":return Ie.local(Ie.name);default:return console.error("Unknown token type:",t),null}}function Fye(t,e,n){let r=n||bq(t);if(!r)return null;if(e)switch(e){case"definition":return Ie.definition(r);case"declaration":return Ie.definition(r);case"readonly":return Ie.constant(r);case"static":return Ie.constant(r);case"defaultLibrary":return Ie.standard(r);default:return console.error("Unknown token modifier:",e),r}return r}function Nye(t){return[ZK((e,n)=>{const r=e.plugin(t);return(r==null?void 0:r.requestHoverTooltip(e,KL(e.state.doc,n)))??null}),Tme({position:"absolute",parent:document.body}),At.baseTheme({".cm-tooltip":{fontSize:"12px",maxWidth:"400px"}})]}function Dye(t){const e=[{key:"Alt-Shift-f",run:r=>{let i=r.plugin(t);return i?(i.requestFormatting(),!0):!1}}];return Ea.highest(oA.computeN([],()=>[e]))}function Uye(){return c$.of((t,e)=>{try{const i=t.lineAt(e,-1).text.replaceAll("	"," ".repeat(t.state.tabSize)).match(/^(\s)*/);return i===null||i.length<=0?null:i[0].length}catch(n){console.error("Error in codemirror indentService",n)}return null})}const $L=t=>t.reduce((e,n)=>n,""),qL=bt.define({combine:$L}),XL=bt.define({combine:$L}),Hye=bt.define({combine:$L}),YL=ls.define(),wq=YL.of("semantic-tokens"),xq=YL.of("format-code");YL.of("diagnostics");class jye{constructor(e,n){se(this,"client");se(this,"documentVersion");se(this,"foldingRanges",null);se(this,"previousSemanticTokens",[]);se(this,"allowHTMLContent",!0);se(this,"changesDelay",600);se(this,"processLspNotification");se(this,"doSemanticTokens",!1);se(this,"doFoldingRanges",!1);se(this,"sendScheduled",null);this.view=n,this.client=e.client,this.documentVersion=0,this.doSemanticTokens=e.doSemanticTokens??!1,this.doFoldingRanges=e.doFoldingRanges??!1,e.changesDelay&&(this.changesDelay=e.changesDelay),e.allowHTMLContent!==void 0&&(this.allowHTMLContent=e.allowHTMLContent),this.client.attachPlugin(this),this.processLspNotification=e.processLspNotification,this.initialize({documentText:this.getDocText()})}getDocPath(e=this.view){return e.state.facet(qL)}getDocText(e=this.view){return e.state.doc.toString()}getDocUri(e=this.view){return xye.file(this.getDocPath(e)).toString()}getLanguageId(e=this.view){return e.state.facet(XL)}update(e){e.docChanged&&this.scheduleSendDoc()}destroy(){this.client.detachPlugin(this)}async initialize({documentText:e}){this.client.initializePromise&&await this.client.initializePromise,this.client.textDocumentDidOpen({textDocument:{uri:this.getDocUri(),languageId:this.getLanguageId(),text:e,version:this.documentVersion}}),this.requestSemanticTokens(),this.updateFoldingRanges()}async requestHoverTooltip(e,{line:n,character:r}){if(!this.client.ready||!this.client.getServerCapabilities().hoverProvider)return null;this.ensureDocSent();const i=await this.client.textDocumentHover({textDocument:{uri:this.getDocUri()},position:{line:n,character:r}});if(!i)return null;const{contents:s,range:o}=i;let a=Oa(e.state.doc,{line:n,character:r}),l;if(o&&(a=Oa(e.state.doc,o.start),l=Oa(e.state.doc,o.end)),a===null)return null;const c=document.createElement("div");return c.classList.add("documentation"),c.classList.add("hover-tooltip"),c.style.zIndex="99999999",this.allowHTMLContent?c.innerHTML=Dx(s):c.textContent=Dx(s),{pos:a,end:l,create:u=>({dom:c}),above:!0}}scheduleSendDoc(){this.sendScheduled!=null&&window.clearTimeout(this.sendScheduled),this.sendScheduled=window.setTimeout(()=>this.sendDoc(),this.changesDelay)}sendDoc(){if(this.sendScheduled!=null&&(window.clearTimeout(this.sendScheduled),this.sendScheduled=null),!!this.client.ready)try{this.client.textDocumentDidChange({textDocument:{uri:this.getDocUri(),version:this.documentVersion++},contentChanges:[{text:this.view.state.doc.toString()}]}),this.requestSemanticTokens(),this.updateFoldingRanges()}catch(e){console.error(e)}}ensureDocSent(){this.sendScheduled!=null&&this.sendDoc()}async getFoldingRanges(){return!this.doFoldingRanges||!this.client.ready||!this.client.getServerCapabilities().foldingRangeProvider?null:await this.client.textDocumentFoldingRange({textDocument:{uri:this.getDocUri()}})||null}async updateFoldingRanges(){const e=await this.getFoldingRanges();e!==null&&(this.foldingRanges=e)}foldingRange(e,n){if(this.foldingRanges===null)return null;for(let r=0;r<this.foldingRanges.length;r++){const{startLine:i,endLine:s}=this.foldingRanges[r];if(i===n)return{from:i,to:s}}return null}async requestFormatting(){if(!this.client.ready||!this.client.getServerCapabilities().documentFormattingProvider)return null;this.ensureDocSent();const e=await this.client.textDocumentFormatting({textDocument:{uri:this.getDocUri()},options:{tabSize:2,insertSpaces:!0,insertFinalNewline:!0}});if(!e||!e.length)return null;this.view.dispatch({changes:e.map(({range:n,newText:r})=>({from:Oa(this.view.state.doc,n.start),to:Oa(this.view.state.doc,n.end),insert:r})),annotations:xq})}async requestCompletion(e,{line:n,character:r},{triggerKind:i,triggerCharacter:s}){if(!this.client.ready||!this.client.getServerCapabilities().completionProvider)return null;this.ensureDocSent();const o=await this.client.textDocumentCompletion({textDocument:{uri:this.getDocUri()},position:{line:n,character:r},context:{triggerKind:i,triggerCharacter:s}});if(!o)return null;let l=("items"in o?o.items:o).map(({detail:c,label:u,labelDetails:d,kind:f,textEdit:h,documentation:A,deprecated:p,insertText:m,insertTextFormat:g,sortText:y,filterText:w})=>{const v={label:u,detail:d?d.detail:c,apply:u,type:f&&kye[f].toLowerCase(),sortText:y??u,filterText:w??u};return A&&(v.info=()=>{const x=Dx(A),C=document.createElement("div");return C.style.display="contents",C.innerHTML=x,{dom:C}}),m&&g===2?C0e(m,v):v});return T$(l)(e)}parseSemanticTokens(e,n){const r=[];for(let c=0;c<n.length;c+=5)r.push({deltaLine:n[c],startChar:n[c+1],length:n[c+2],tokenType:n[c+3],modifiers:n[c+4]});const i=this.client.getServerCapabilities().semanticTokensProvider.legend.tokenTypes,s=this.client.getServerCapabilities().semanticTokensProvider.legend.tokenModifiers,o=[];let a=0,l=0;for(let c=0;c<r.length;c++){const u=r[c],d=i[u.tokenType],f=[];for(let A=0;A<s.length;A++)u.modifiers&1<<A&&f.push(s[A]);u.deltaLine!==0&&(l=0);const h={from:Oa(e.state.doc,{line:a+u.deltaLine,character:l+u.startChar}),to:Oa(e.state.doc,{line:a+u.deltaLine,character:l+u.startChar+u.length}),type:d,modifiers:f};o.push(h),a+=u.deltaLine,l+=u.startChar}return o.sort((c,u)=>c.from-u.from),o}async requestSemanticTokens(){if(!this.doSemanticTokens||!this.client.ready||!this.client.getServerCapabilities().semanticTokensProvider)return null;const e=await this.client.textDocumentSemanticTokensFull({textDocument:{uri:this.getDocUri()}});if(!e)return null;const{data:n}=e;this.previousSemanticTokens=this.parseSemanticTokens(this.view,n);const r=this.previousSemanticTokens.map(i=>F4.of(i));this.view.dispatch({effects:r,annotations:[wq,Bn.addToHistory.of(!1)]})}async processNotification(e){var n;try{switch(e.method){case"textDocument/publishDiagnostics":if(e===void 0||e.params===void 0||!e.params)break;const r=e.params;if(!r)break;console.log("[lsp] [window/publishDiagnostics]",this.client.getName(),r),this.processDiagnostics(r);break;case"window/logMessage":console.log("[lsp] [window/logMessage]",this.client.getName(),e.params);break;case"window/showMessage":console.log("[lsp] [window/showMessage]",this.client.getName(),e.params);break}}catch(r){console.error(r)}(n=this.processLspNotification)==null||n.call(this,this,e)}processDiagnostics(e){e.uri===this.getDocUri()&&e.diagnostics.map(({range:n,message:r,severity:i})=>({from:Oa(this.view.state.doc,n.start),to:Oa(this.view.state.doc,n.end),severity:{[ki.DiagnosticSeverity.Error]:"error",[ki.DiagnosticSeverity.Warning]:"warning",[ki.DiagnosticSeverity.Information]:"info",[ki.DiagnosticSeverity.Hint]:"info"}[i],message:r})).filter(({from:n,to:r})=>n!==null&&r!==null&&n!==void 0&&r!==void 0).sort((n,r)=>{switch(!0){case n.from<r.from:return-1;case n.from>r.from:return 1}return 0})}}class Qye{provide(e){return[Lye(e),Dye(e),Nye(e),Uye(),Iye(),W0e(null)]}}var Ux={},s2={},hv={};(function(t){var e=en&&en.__extends||function(){var h=function(A,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,g){m.__proto__=g}||function(m,g){for(var y in g)Object.prototype.hasOwnProperty.call(g,y)&&(m[y]=g[y])},h(A,p)};return function(A,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");h(A,p);function m(){this.constructor=A}A.prototype=p===null?Object.create(p):(m.prototype=p.prototype,new m)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.createJSONRPCNotification=t.createJSONRPCRequest=t.createJSONRPCSuccessResponse=t.createJSONRPCErrorResponse=t.JSONRPCErrorCode=t.JSONRPCErrorException=t.isJSONRPCResponses=t.isJSONRPCResponse=t.isJSONRPCRequests=t.isJSONRPCRequest=t.isJSONRPCID=t.JSONRPC=void 0,t.JSONRPC="2.0";var n=function(h){return typeof h=="string"||typeof h=="number"||h===null};t.isJSONRPCID=n;var r=function(h){return h.jsonrpc===t.JSONRPC&&h.method!==void 0&&h.result===void 0&&h.error===void 0};t.isJSONRPCRequest=r;var i=function(h){return Array.isArray(h)&&h.every(t.isJSONRPCRequest)};t.isJSONRPCRequests=i;var s=function(h){return h.jsonrpc===t.JSONRPC&&h.id!==void 0&&(h.result!==void 0||h.error!==void 0)};t.isJSONRPCResponse=s;var o=function(h){return Array.isArray(h)&&h.every(t.isJSONRPCResponse)};t.isJSONRPCResponses=o;var a=function(h,A,p){var m={code:h,message:A};return p!=null&&(m.data=p),m},l=function(h){e(A,h);function A(p,m,g){var y=h.call(this,p)||this;return Object.setPrototypeOf(y,A.prototype),y.code=m,y.data=g,y}return A.prototype.toObject=function(){return a(this.code,this.message,this.data)},A}(Error);t.JSONRPCErrorException=l,function(h){h[h.ParseError=-32700]="ParseError",h[h.InvalidRequest=-32600]="InvalidRequest",h[h.MethodNotFound=-32601]="MethodNotFound",h[h.InvalidParams=-32602]="InvalidParams",h[h.InternalError=-32603]="InternalError"}(t.JSONRPCErrorCode||(t.JSONRPCErrorCode={}));var c=function(h,A,p,m){return{jsonrpc:t.JSONRPC,id:h,error:a(A,p,m)}};t.createJSONRPCErrorResponse=c;var u=function(h,A){return{jsonrpc:t.JSONRPC,id:h,result:A??null}};t.createJSONRPCSuccessResponse=u;var d=function(h,A,p){return{jsonrpc:t.JSONRPC,id:h,method:A,params:p}};t.createJSONRPCRequest=d;var f=function(h,A){return{jsonrpc:t.JSONRPC,method:h,params:A}};t.createJSONRPCNotification=f})(hv);var Av={};Object.defineProperty(Av,"__esModule",{value:!0});Av.DefaultErrorCode=void 0;Av.DefaultErrorCode=0;var n7=en&&en.__awaiter||function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})},r7=en&&en.__generator||function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){n.label=c[1];break}if(c[0]===6&&n.label<s[1]){n.label=s[1],s=c;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(c);break}s[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(u){c=[6,u],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(s2,"__esModule",{value:!0});s2.JSONRPCClient=void 0;var jA=hv,kT=Av,zye=function(){function t(e,n){this._send=e,this.createID=n,this.idToResolveMap=new Map,this.id=0}return t.prototype._createID=function(){return this.createID?this.createID():++this.id},t.prototype.timeout=function(e,n){var r=this;n===void 0&&(n=function(o){return(0,jA.createJSONRPCErrorResponse)(o,kT.DefaultErrorCode,"Request timeout")});var i=function(o,a){var l=setTimeout(function(){o.forEach(function(c){var u=r.idToResolveMap.get(c);u&&(r.idToResolveMap.delete(c),u(n(c)))})},e);return a().then(function(c){return clearTimeout(l),c},function(c){return clearTimeout(l),Promise.reject(c)})},s=function(o,a){var l=(Array.isArray(o)?o:[o]).map(function(c){return c.id}).filter(i7);return i(l,function(){return r.requestAdvanced(o,a)})};return{request:function(o,a,l){var c=r._createID();return i([c],function(){return r.requestWithID(o,a,l,c)})},requestAdvanced:function(o,a){return s(o,a)}}},t.prototype.request=function(e,n,r){return this.requestWithID(e,n,r,this._createID())},t.prototype.requestWithID=function(e,n,r,i){return n7(this,void 0,void 0,function(){var s,o;return r7(this,function(a){switch(a.label){case 0:return s=(0,jA.createJSONRPCRequest)(i,e,n),[4,this.requestAdvanced(s,r)];case 1:return o=a.sent(),o.result!==void 0&&!o.error?[2,o.result]:o.result===void 0&&o.error?[2,Promise.reject(new jA.JSONRPCErrorException(o.error.message,o.error.code,o.error.data))]:[2,Promise.reject(new Error("An unexpected error occurred"))]}})})},t.prototype.requestAdvanced=function(e,n){var r=this,i=Array.isArray(e);Array.isArray(e)||(e=[e]);var s=e.filter(function(l){return i7(l.id)}),o=s.map(function(l){return new Promise(function(c){return r.idToResolveMap.set(l.id,c)})}),a=Promise.all(o).then(function(l){return i||!l.length?l:l[0]});return this.send(i?e:e[0],n).then(function(){return a},function(l){return s.forEach(function(c){r.receive((0,jA.createJSONRPCErrorResponse)(c.id,kT.DefaultErrorCode,l&&l.message||"Failed to send a request"))}),a})},t.prototype.notify=function(e,n,r){var i=(0,jA.createJSONRPCNotification)(e,n);this.send(i,r).then(void 0,function(){})},t.prototype.send=function(e,n){return n7(this,void 0,void 0,function(){return r7(this,function(r){return[2,this._send(e,n)]})})},t.prototype.rejectAllPendingRequests=function(e){this.idToResolveMap.forEach(function(n,r){return n((0,jA.createJSONRPCErrorResponse)(r,kT.DefaultErrorCode,e))}),this.idToResolveMap.clear()},t.prototype.receive=function(e){var n=this;Array.isArray(e)||(e=[e]),e.forEach(function(r){var i=n.idToResolveMap.get(r.id);i&&(n.idToResolveMap.delete(r.id),i(r))})},t}();s2.JSONRPCClient=zye;var i7=function(t){return t!=null},Cq={};Object.defineProperty(Cq,"__esModule",{value:!0});var o2={},y_=en&&en.__assign||function(){return y_=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},y_.apply(this,arguments)},s7=en&&en.__awaiter||function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})},o7=en&&en.__generator||function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){n.label=c[1];break}if(c[0]===6&&n.label<s[1]){n.label=s[1],s=c;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(c);break}s[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(u){c=[6,u],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Vye=en&&en.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))};Object.defineProperty(o2,"__esModule",{value:!0});o2.JSONRPCServer=void 0;var Ho=hv,Gye=Av,Wye=function(){return(0,Ho.createJSONRPCErrorResponse)(null,Ho.JSONRPCErrorCode.ParseError,"Parse error")},Kye=function(t){return(0,Ho.createJSONRPCErrorResponse)((0,Ho.isJSONRPCID)(t.id)?t.id:null,Ho.JSONRPCErrorCode.InvalidRequest,"Invalid Request")},$ye=function(t){return(0,Ho.createJSONRPCErrorResponse)(t,Ho.JSONRPCErrorCode.MethodNotFound,"Method not found")},qye=function(){function t(e){e===void 0&&(e={});var n;this.mapErrorToJSONRPCErrorResponse=Zye,this.nameToMethodDictionary={},this.middleware=null,this.errorListener=(n=e.errorListener)!==null&&n!==void 0?n:console.warn}return t.prototype.hasMethod=function(e){return!!this.nameToMethodDictionary[e]},t.prototype.addMethod=function(e,n){this.addMethodAdvanced(e,this.toJSONRPCMethod(n))},t.prototype.removeMethod=function(e){delete this.nameToMethodDictionary[e]},t.prototype.toJSONRPCMethod=function(e){return function(n,r){var i=e(n.params,r);return Promise.resolve(i).then(function(s){return Jye(n.id,s)})}},t.prototype.addMethodAdvanced=function(e,n){var r;this.nameToMethodDictionary=y_(y_({},this.nameToMethodDictionary),(r={},r[e]=n,r))},t.prototype.receiveJSON=function(e,n){var r=this.tryParseRequestJSON(e);return r?this.receive(r,n):Promise.resolve(Wye())},t.prototype.tryParseRequestJSON=function(e){try{return JSON.parse(e)}catch{return null}},t.prototype.receive=function(e,n){return Array.isArray(e)?this.receiveMultiple(e,n):this.receiveSingle(e,n)},t.prototype.receiveMultiple=function(e,n){return s7(this,void 0,void 0,function(){var r,i=this;return o7(this,function(s){switch(s.label){case 0:return[4,Promise.all(e.map(function(o){return i.receiveSingle(o,n)}))];case 1:return r=s.sent().filter(Xye),r.length===1?[2,r[0]]:r.length?[2,r]:[2,null]}})})},t.prototype.receiveSingle=function(e,n){return s7(this,void 0,void 0,function(){var r,i;return o7(this,function(s){switch(s.label){case 0:return r=this.nameToMethodDictionary[e.method],(0,Ho.isJSONRPCRequest)(e)?[3,1]:[2,Kye(e)];case 1:return[4,this.callMethod(r,e,n)];case 2:return i=s.sent(),[2,eve(e,i)]}})})},t.prototype.applyMiddleware=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.middleware?this.middleware=this.combineMiddlewares(Vye([this.middleware],e,!0)):this.middleware=this.combineMiddlewares(e)},t.prototype.combineMiddlewares=function(e){return e.length?e.reduce(this.middlewareReducer):null},t.prototype.middlewareReducer=function(e,n){return function(r,i,s){return e(function(o,a){return n(r,o,a)},i,s)}},t.prototype.callMethod=function(e,n,r){var i=this,s=function(a,l){return e?e(a,l):a.id!==void 0?Promise.resolve($ye(a.id)):Promise.resolve(null)},o=function(a){return i.errorListener('An unexpected error occurred while executing "'.concat(n.method,'" JSON-RPC method:'),a),Promise.resolve(i.mapErrorToJSONRPCErrorResponseIfNecessary(n.id,a))};try{return(this.middleware||Yye)(s,n,r).then(void 0,o)}catch(a){return o(a)}},t.prototype.mapErrorToJSONRPCErrorResponseIfNecessary=function(e,n){return e!==void 0?this.mapErrorToJSONRPCErrorResponse(e,n):null},t}();o2.JSONRPCServer=qye;var Xye=function(t){return t!==null},Yye=function(t,e,n){return t(e,n)},Jye=function(t,e){return t!==void 0?(0,Ho.createJSONRPCSuccessResponse)(t,e):null},Zye=function(t,e){var n,r=(n=e==null?void 0:e.message)!==null&&n!==void 0?n:"An unexpected error occurred",i=Gye.DefaultErrorCode,s;return e instanceof Ho.JSONRPCErrorException&&(i=e.code,s=e.data),(0,Ho.createJSONRPCErrorResponse)(t,i,r,s)},eve=function(t,e){return e||(t.id!==void 0?(0,Ho.createJSONRPCErrorResponse)(t.id,Ho.JSONRPCErrorCode.InternalError,"Internal error"):null)},a2={},tve=en&&en.__awaiter||function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})},nve=en&&en.__generator||function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){n.label=c[1];break}if(c[0]===6&&n.label<s[1]){n.label=s[1],s=c;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(c);break}s[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(u){c=[6,u],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(a2,"__esModule",{value:!0});a2.JSONRPCServerAndClient=void 0;var Zb=hv,rve=function(){function t(e,n,r){r===void 0&&(r={});var i;this.server=e,this.client=n,this.errorListener=(i=r.errorListener)!==null&&i!==void 0?i:console.warn}return t.prototype.applyServerMiddleware=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];(e=this.server).applyMiddleware.apply(e,n)},t.prototype.hasMethod=function(e){return this.server.hasMethod(e)},t.prototype.addMethod=function(e,n){this.server.addMethod(e,n)},t.prototype.addMethodAdvanced=function(e,n){this.server.addMethodAdvanced(e,n)},t.prototype.removeMethod=function(e){this.server.removeMethod(e)},t.prototype.timeout=function(e){return this.client.timeout(e)},t.prototype.request=function(e,n,r){return this.client.request(e,n,r)},t.prototype.requestAdvanced=function(e,n){return this.client.requestAdvanced(e,n)},t.prototype.notify=function(e,n,r){this.client.notify(e,n,r)},t.prototype.rejectAllPendingRequests=function(e){this.client.rejectAllPendingRequests(e)},t.prototype.receiveAndSend=function(e,n,r){return tve(this,void 0,void 0,function(){var i,s;return nve(this,function(o){switch(o.label){case 0:return(0,Zb.isJSONRPCResponse)(e)||(0,Zb.isJSONRPCResponses)(e)?(this.client.receive(e),[3,4]):[3,1];case 1:return(0,Zb.isJSONRPCRequest)(e)||(0,Zb.isJSONRPCRequests)(e)?[4,this.server.receive(e,n)]:[3,3];case 2:return i=o.sent(),i?[2,this.client.send(i,r)]:[3,4];case 3:return s="Received an invalid JSON-RPC message",this.errorListener(s,e),[2,Promise.reject(new Error(s))];case 4:return[2]}})})},t}();a2.JSONRPCServerAndClient=rve;(function(t){var e=en&&en.__createBinding||(Object.create?function(r,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(r,o,a)}:function(r,i,s,o){o===void 0&&(o=s),r[o]=i[s]}),n=en&&en.__exportStar||function(r,i){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,r,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(s2,t),n(Cq,t),n(hv,t),n(o2,t),n(a2,t)})(Ux);const _q={"textDocument/hover":"hoverProvider","textDocument/completion":"completionProvider","textDocument/signatureHelp":"signatureHelpProvider","textDocument/definition":"definitionProvider","textDocument/typeDefinition":"typeDefinitionProvider","textDocument/implementation":"implementationProvider","textDocument/references":"referencesProvider","textDocument/documentHighlight":"documentHighlightProvider","textDocument/documentSymbol":"documentSymbolProvider","textDocument/workspaceSymbol":"workspaceSymbolProvider","textDocument/codeAction":"codeActionProvider","textDocument/codeLens":"codeLensProvider","textDocument/documentFormatting":"documentFormattingProvider","textDocument/documentRangeFormatting":"documentRangeFormattingProvider","textDocument/documentOnTypeFormatting":"documentOnTypeFormattingProvider","textDocument/rename":"renameProvider","textDocument/documentLink":"documentLinkProvider","textDocument/color":"colorProvider","textDocument/foldingRange":"foldingRangeProvider","textDocument/declaration":"declarationProvider","textDocument/executeCommand":"executeCommandProvider","textDocument/semanticTokens/full":"semanticTokensProvider","textDocument/publishDiagnostics":"diagnosticsProvider"};function ive(t,e){const n=structuredClone(t),{method:r,registerOptions:i}=e,s=_q[r];if(s)i?n[s]=Object.assign({},structuredClone(i)):n[s]=!0;else return new Error("Could not register server capability.");return n}function sve(t,e){const n=structuredClone(t),{method:r}=e,i=_q[r];return delete n[i],n}class v1{static encode(e){return abe.encode(e)}static decode(e){return Lq.decode(e)}static append(e,...n){let r=0;for(const o of n)r+=o.length;const i=new e(r);let s=0;for(const o of n)i.set(o,s),s+=o.length;return i}}var qf={},JL={},v_={},It={},ci={};Object.defineProperty(ci,"__esModule",{value:!0});ci.stringArray=ci.array=ci.func=ci.error=ci.number=ci.string=ci.boolean=void 0;function ove(t){return t===!0||t===!1}ci.boolean=ove;function Sq(t){return typeof t=="string"||t instanceof String}ci.string=Sq;function ave(t){return typeof t=="number"||t instanceof Number}ci.number=ave;function lve(t){return t instanceof Error}ci.error=lve;function cve(t){return typeof t=="function"}ci.func=cve;function Eq(t){return Array.isArray(t)}ci.array=Eq;function uve(t){return Eq(t)&&t.every(e=>Sq(e))}ci.stringArray=uve;Object.defineProperty(It,"__esModule",{value:!0});It.Message=It.NotificationType9=It.NotificationType8=It.NotificationType7=It.NotificationType6=It.NotificationType5=It.NotificationType4=It.NotificationType3=It.NotificationType2=It.NotificationType1=It.NotificationType0=It.NotificationType=It.RequestType9=It.RequestType8=It.RequestType7=It.RequestType6=It.RequestType5=It.RequestType4=It.RequestType3=It.RequestType2=It.RequestType1=It.RequestType=It.RequestType0=It.AbstractMessageSignature=It.ParameterStructures=It.ResponseError=It.ErrorCodes=void 0;const Xf=ci;var N4;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(N4||(It.ErrorCodes=N4={}));class ZL extends Error{constructor(e,n,r){super(n),this.code=Xf.number(e)?e:N4.UnknownErrorCode,this.data=r,Object.setPrototypeOf(this,ZL.prototype)}toJson(){const e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}}It.ResponseError=ZL;class Es{constructor(e){this.kind=e}static is(e){return e===Es.auto||e===Es.byName||e===Es.byPosition}toString(){return this.kind}}It.ParameterStructures=Es;Es.auto=new Es("auto");Es.byPosition=new Es("byPosition");Es.byName=new Es("byName");class Dr{constructor(e,n){this.method=e,this.numberOfParams=n}get parameterStructures(){return Es.auto}}It.AbstractMessageSignature=Dr;class dve extends Dr{constructor(e){super(e,0)}}It.RequestType0=dve;class fve extends Dr{constructor(e,n=Es.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}}It.RequestType=fve;class hve extends Dr{constructor(e,n=Es.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}}It.RequestType1=hve;class Ave extends Dr{constructor(e){super(e,2)}}It.RequestType2=Ave;class pve extends Dr{constructor(e){super(e,3)}}It.RequestType3=pve;class mve extends Dr{constructor(e){super(e,4)}}It.RequestType4=mve;class gve extends Dr{constructor(e){super(e,5)}}It.RequestType5=gve;class yve extends Dr{constructor(e){super(e,6)}}It.RequestType6=yve;class vve extends Dr{constructor(e){super(e,7)}}It.RequestType7=vve;class bve extends Dr{constructor(e){super(e,8)}}It.RequestType8=bve;class wve extends Dr{constructor(e){super(e,9)}}It.RequestType9=wve;class xve extends Dr{constructor(e,n=Es.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}}It.NotificationType=xve;class Cve extends Dr{constructor(e){super(e,0)}}It.NotificationType0=Cve;class _ve extends Dr{constructor(e,n=Es.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}}It.NotificationType1=_ve;class Sve extends Dr{constructor(e){super(e,2)}}It.NotificationType2=Sve;class Eve extends Dr{constructor(e){super(e,3)}}It.NotificationType3=Eve;class Tve extends Dr{constructor(e){super(e,4)}}It.NotificationType4=Tve;class Bve extends Dr{constructor(e){super(e,5)}}It.NotificationType5=Bve;class Mve extends Dr{constructor(e){super(e,6)}}It.NotificationType6=Mve;class kve extends Dr{constructor(e){super(e,7)}}It.NotificationType7=kve;class Rve extends Dr{constructor(e){super(e,8)}}It.NotificationType8=Rve;class Pve extends Dr{constructor(e){super(e,9)}}It.NotificationType9=Pve;var a7;(function(t){function e(i){const s=i;return s&&Xf.string(s.method)&&(Xf.string(s.id)||Xf.number(s.id))}t.isRequest=e;function n(i){const s=i;return s&&Xf.string(s.method)&&i.id===void 0}t.isNotification=n;function r(i){const s=i;return s&&(s.result!==void 0||!!s.error)&&(Xf.string(s.id)||Xf.number(s.id)||s.id===null)}t.isResponse=r})(a7||(It.Message=a7={}));var jc={},l7;Object.defineProperty(jc,"__esModule",{value:!0});jc.LRUCache=jc.LinkedMap=jc.Touch=void 0;var gs;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(gs||(jc.Touch=gs={}));class Tq{constructor(){this[l7]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var e;return(e=this._head)==null?void 0:e.value}get last(){var e;return(e=this._tail)==null?void 0:e.value}has(e){return this._map.has(e)}get(e,n=gs.None){const r=this._map.get(e);if(r)return n!==gs.None&&this.touch(r,n),r.value}set(e,n,r=gs.None){let i=this._map.get(e);if(i)i.value=n,r!==gs.None&&this.touch(i,r);else{switch(i={key:e,value:n,next:void 0,previous:void 0},r){case gs.None:this.addItemLast(i);break;case gs.First:this.addItemFirst(i);break;case gs.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const n=this._map.get(e);if(n)return this._map.delete(e),this.removeItem(n),this._size--,n.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,n){const r=this._state;let i=this._head;for(;i;){if(n?e.bind(n)(i.value,i.key,this):e(i.value,i.key,this),this._state!==r)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){const e=this._state;let n=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){const i={value:n.key,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}values(){const e=this._state;let n=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){const i={value:n.value,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}entries(){const e=this._state;let n=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){const i={value:[n.key,n.value],done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}[(l7=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let n=this._head,r=this.size;for(;n&&r>e;)this._map.delete(n.key),n=n.next,r--;this._head=n,this._size=r,n&&(n.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const n=e.next,r=e.previous;if(!n||!r)throw new Error("Invalid list");n.previous=r,r.next=n}e.next=void 0,e.previous=void 0,this._state++}touch(e,n){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(n!==gs.First&&n!==gs.Last)){if(n===gs.First){if(e===this._head)return;const r=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(r.previous=i,i.next=r),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(n===gs.Last){if(e===this._tail)return;const r=e.next,i=e.previous;e===this._head?(r.previous=void 0,this._head=r):(r.previous=i,i.next=r),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){const e=[];return this.forEach((n,r)=>{e.push([r,n])}),e}fromJSON(e){this.clear();for(const[n,r]of e)this.set(n,r)}}jc.LinkedMap=Tq;class Lve extends Tq{constructor(e,n=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,n),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,n=gs.AsNew){return super.get(e,n)}peek(e){return super.get(e,gs.None)}set(e,n){return super.set(e,n,gs.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}jc.LRUCache=Lve;var l2={};Object.defineProperty(l2,"__esModule",{value:!0});l2.Disposable=void 0;var c7;(function(t){function e(n){return{dispose:n}}t.create=e})(c7||(l2.Disposable=c7={}));var Xl={},mu={};Object.defineProperty(mu,"__esModule",{value:!0});let D4;function U4(){if(D4===void 0)throw new Error("No runtime abstraction layer installed");return D4}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");D4=n}t.install=e})(U4||(U4={}));mu.default=U4;Object.defineProperty(Xl,"__esModule",{value:!0});Xl.Emitter=Xl.Event=void 0;const Ive=mu;var u7;(function(t){const e={dispose(){}};t.None=function(){return e}})(u7||(Xl.Event=u7={}));class Ove{add(e,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,n)})}remove(e,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i<s;i++)if(this._callbacks[i]===e)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];const n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,o=r.length;s<o;s++)try{n.push(r[s].apply(i[s],e))}catch(a){(0,Ive.default)().console.error(a)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class c2{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,n,r)=>{this._callbacks||(this._callbacks=new Ove),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,n);const i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,n),i.dispose=c2._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}Xl.Emitter=c2;c2._noop=function(){};var lf={};Object.defineProperty(lf,"__esModule",{value:!0});lf.CancellationTokenSource=lf.CancellationToken=void 0;const Fve=mu,Nve=ci,H4=Xl;var b_;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:H4.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:H4.Event.None});function e(n){const r=n;return r&&(r===t.None||r===t.Cancelled||Nve.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}t.is=e})(b_||(lf.CancellationToken=b_={}));const Dve=Object.freeze(function(t,e){const n=(0,Fve.default)().timer.setTimeout(t.bind(e),0);return{dispose(){n.dispose()}}});class d7{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Dve:(this._emitter||(this._emitter=new H4.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class Uve{get token(){return this._token||(this._token=new d7),this._token}cancel(){this._token?this._token.cancel():this._token=b_.Cancelled}dispose(){this._token?this._token instanceof d7&&this._token.dispose():this._token=b_.None}}lf.CancellationTokenSource=Uve;var Zm={};Object.defineProperty(Zm,"__esModule",{value:!0});Zm.SharedArrayReceiverStrategy=Zm.SharedArraySenderStrategy=void 0;const Hve=lf;var Ey;(function(t){t.Continue=0,t.Cancelled=1})(Ey||(Ey={}));class jve{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;const n=new SharedArrayBuffer(4),r=new Int32Array(n,0,1);r[0]=Ey.Continue,this.buffers.set(e.id,n),e.$cancellationData=n}async sendCancellation(e,n){const r=this.buffers.get(n);if(r===void 0)return;const i=new Int32Array(r,0,1);Atomics.store(i,0,Ey.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}}Zm.SharedArraySenderStrategy=jve;class Qve{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Ey.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class zve{constructor(e){this.token=new Qve(e)}cancel(){}dispose(){}}class Vve{constructor(){this.kind="request"}createCancellationTokenSource(e){const n=e.$cancellationData;return n===void 0?new Hve.CancellationTokenSource:new zve(n)}}Zm.SharedArrayReceiverStrategy=Vve;var Qd={},pv={};Object.defineProperty(pv,"__esModule",{value:!0});pv.Semaphore=void 0;const Gve=mu;class Wve{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((n,r)=>{this._waiting.push({thunk:e,resolve:n,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,Gve.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;const e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const n=e.thunk();n instanceof Promise?n.then(r=>{this._active--,e.resolve(r),this.runNext()},r=>{this._active--,e.reject(r),this.runNext()}):(this._active--,e.resolve(n),this.runNext())}catch(n){this._active--,e.reject(n),this.runNext()}}}pv.Semaphore=Wve;Object.defineProperty(Qd,"__esModule",{value:!0});Qd.ReadableStreamMessageReader=Qd.AbstractMessageReader=Qd.MessageReader=void 0;const j4=mu,ip=ci,RT=Xl,Kve=pv;var f7;(function(t){function e(n){let r=n;return r&&ip.func(r.listen)&&ip.func(r.dispose)&&ip.func(r.onError)&&ip.func(r.onClose)&&ip.func(r.onPartialMessage)}t.is=e})(f7||(Qd.MessageReader=f7={}));class Bq{constructor(){this.errorEmitter=new RT.Emitter,this.closeEmitter=new RT.Emitter,this.partialMessageEmitter=new RT.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${ip.string(e.message)?e.message:"unknown"}`)}}Qd.AbstractMessageReader=Bq;var Q4;(function(t){function e(n){let r,i;const s=new Map;let o;const a=new Map;if(n===void 0||typeof n=="string")r=n??"utf-8";else{if(r=n.charset??"utf-8",n.contentDecoder!==void 0&&(i=n.contentDecoder,s.set(i.name,i)),n.contentDecoders!==void 0)for(const l of n.contentDecoders)s.set(l.name,l);if(n.contentTypeDecoder!==void 0&&(o=n.contentTypeDecoder,a.set(o.name,o)),n.contentTypeDecoders!==void 0)for(const l of n.contentTypeDecoders)a.set(l.name,l)}return o===void 0&&(o=(0,j4.default)().applicationJson.decoder,a.set(o.name,o)),{charset:r,contentDecoder:i,contentDecoders:s,contentTypeDecoder:o,contentTypeDecoders:a}}t.fromOptions=e})(Q4||(Q4={}));class $ve extends Bq{constructor(e,n){super(),this.readable=e,this.options=Q4.fromOptions(n),this.buffer=(0,j4.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new Kve.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;const n=this.readable.onData(r=>{this.onData(r)});return this.readable.onError(r=>this.fireError(r)),this.readable.onClose(()=>this.fireClose()),n}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){const r=this.buffer.tryReadHeaders(!0);if(!r)return;const i=r.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property.
${JSON.stringify(Object.fromEntries(r))}`));return}const s=parseInt(i);if(isNaN(s)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=s}const n=this.buffer.tryReadBody(this.nextMessageLength);if(n===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const r=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(n):n,i=await this.options.contentTypeDecoder.decode(r,this.options);this.callback(i)}).catch(r=>{this.fireError(r)})}}catch(n){this.fireError(n)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,j4.default)().timer.setTimeout((e,n)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:n}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}Qd.ReadableStreamMessageReader=$ve;var zd={};Object.defineProperty(zd,"__esModule",{value:!0});zd.WriteableStreamMessageWriter=zd.AbstractMessageWriter=zd.MessageWriter=void 0;const h7=mu,F0=ci,qve=pv,A7=Xl,Xve="Content-Length: ",p7=`\r
`;var m7;(function(t){function e(n){let r=n;return r&&F0.func(r.dispose)&&F0.func(r.onClose)&&F0.func(r.onError)&&F0.func(r.write)}t.is=e})(m7||(zd.MessageWriter=m7={}));class Mq{constructor(){this.errorEmitter=new A7.Emitter,this.closeEmitter=new A7.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,n,r){this.errorEmitter.fire([this.asError(e),n,r])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${F0.string(e.message)?e.message:"unknown"}`)}}zd.AbstractMessageWriter=Mq;var z4;(function(t){function e(n){return n===void 0||typeof n=="string"?{charset:n??"utf-8",contentTypeEncoder:(0,h7.default)().applicationJson.encoder}:{charset:n.charset??"utf-8",contentEncoder:n.contentEncoder,contentTypeEncoder:n.contentTypeEncoder??(0,h7.default)().applicationJson.encoder}}t.fromOptions=e})(z4||(z4={}));class Yve extends Mq{constructor(e,n){super(),this.writable=e,this.options=z4.fromOptions(n),this.errorCount=0,this.writeSemaphore=new qve.Semaphore(1),this.writable.onError(r=>this.fireError(r)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(r=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(r):r).then(r=>{const i=[];return i.push(Xve,r.byteLength.toString(),p7),i.push(p7),this.doWrite(e,i,r)},r=>{throw this.fireError(r),r}))}async doWrite(e,n,r){try{return await this.writable.write(n.join(""),"ascii"),this.writable.write(r)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,n){this.errorCount++,this.fireError(e,n,this.errorCount)}end(){this.writable.end()}}zd.WriteableStreamMessageWriter=Yve;var u2={};Object.defineProperty(u2,"__esModule",{value:!0});u2.AbstractMessageBuffer=void 0;const Jve=13,Zve=10,ebe=`\r
`;class tbe{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){const n=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(n),this._totalLength+=n.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let n=0,r=0,i=0,s=0;e:for(;r<this._chunks.length;){const c=this._chunks[r];for(i=0;i<c.length;){switch(c[i]){case Jve:switch(n){case 0:n=1;break;case 2:n=3;break;default:n=0}break;case Zve:switch(n){case 1:n=2;break;case 3:n=4,i++;break e;default:n=0}break;default:n=0}i++}s+=c.byteLength,r++}if(n!==4)return;const o=this._read(s+i),a=new Map,l=this.toString(o,"ascii").split(ebe);if(l.length<2)return a;for(let c=0;c<l.length-2;c++){const u=l[c],d=u.indexOf(":");if(d===-1)throw new Error(`Message header must separate key and value using ':'
${u}`);const f=u.substr(0,d),h=u.substr(d+1).trim();a.set(e?f.toLowerCase():f,h)}return a}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const s=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(s)}if(this._chunks[0].byteLength>e){const s=this._chunks[0],o=this.asNative(s,e);return this._chunks[0]=s.slice(e),this._totalLength-=e,o}const n=this.allocNative(e);let r=0,i=0;for(;e>0;){const s=this._chunks[i];if(s.byteLength>e){const o=s.slice(0,e);n.set(o,r),r+=e,this._chunks[i]=s.slice(e),this._totalLength-=e,e-=e}else n.set(s,r),r+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,e-=s.byteLength}return n}}u2.AbstractMessageBuffer=tbe;var kq={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.ConnectionOptions=t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.RequestCancellationReceiverStrategy=t.IdCancellationReceiverStrategy=t.ConnectionStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=t.NullLogger=t.ProgressType=t.ProgressToken=void 0;const e=mu,n=ci,r=It,i=jc,s=Xl,o=lf;var a;(function(B){B.type=new r.NotificationType("$/cancelRequest")})(a||(a={}));var l;(function(B){function M(F){return typeof F=="string"||typeof F=="number"}B.is=M})(l||(t.ProgressToken=l={}));var c;(function(B){B.type=new r.NotificationType("$/progress")})(c||(c={}));class u{constructor(){}}t.ProgressType=u;var d;(function(B){function M(F){return n.func(F)}B.is=M})(d||(d={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var f;(function(B){B[B.Off=0]="Off",B[B.Messages=1]="Messages",B[B.Compact=2]="Compact",B[B.Verbose=3]="Verbose"})(f||(t.Trace=f={}));var h;(function(B){B.Off="off",B.Messages="messages",B.Compact="compact",B.Verbose="verbose"})(h||(t.TraceValues=h={})),function(B){function M(I){if(!n.string(I))return B.Off;switch(I=I.toLowerCase(),I){case"off":return B.Off;case"messages":return B.Messages;case"compact":return B.Compact;case"verbose":return B.Verbose;default:return B.Off}}B.fromString=M;function F(I){switch(I){case B.Off:return"off";case B.Messages:return"messages";case B.Compact:return"compact";case B.Verbose:return"verbose";default:return"off"}}B.toString=F}(f||(t.Trace=f={}));var A;(function(B){B.Text="text",B.JSON="json"})(A||(t.TraceFormat=A={})),function(B){function M(F){return n.string(F)?(F=F.toLowerCase(),F==="json"?B.JSON:B.Text):B.Text}B.fromString=M}(A||(t.TraceFormat=A={}));var p;(function(B){B.type=new r.NotificationType("$/setTrace")})(p||(t.SetTraceNotification=p={}));var m;(function(B){B.type=new r.NotificationType("$/logTrace")})(m||(t.LogTraceNotification=m={}));var g;(function(B){B[B.Closed=1]="Closed",B[B.Disposed=2]="Disposed",B[B.AlreadyListening=3]="AlreadyListening"})(g||(t.ConnectionErrors=g={}));class y extends Error{constructor(M,F){super(F),this.code=M,Object.setPrototypeOf(this,y.prototype)}}t.ConnectionError=y;var w;(function(B){function M(F){const I=F;return I&&n.func(I.cancelUndispatched)}B.is=M})(w||(t.ConnectionStrategy=w={}));var v;(function(B){function M(F){const I=F;return I&&(I.kind===void 0||I.kind==="id")&&n.func(I.createCancellationTokenSource)&&(I.dispose===void 0||n.func(I.dispose))}B.is=M})(v||(t.IdCancellationReceiverStrategy=v={}));var x;(function(B){function M(F){const I=F;return I&&I.kind==="request"&&n.func(I.createCancellationTokenSource)&&(I.dispose===void 0||n.func(I.dispose))}B.is=M})(x||(t.RequestCancellationReceiverStrategy=x={}));var C;(function(B){B.Message=Object.freeze({createCancellationTokenSource(F){return new o.CancellationTokenSource}});function M(F){return v.is(F)||x.is(F)}B.is=M})(C||(t.CancellationReceiverStrategy=C={}));var _;(function(B){B.Message=Object.freeze({sendCancellation(F,I){return F.sendNotification(a.type,{id:I})},cleanup(F){}});function M(F){const I=F;return I&&n.func(I.sendCancellation)&&n.func(I.cleanup)}B.is=M})(_||(t.CancellationSenderStrategy=_={}));var S;(function(B){B.Message=Object.freeze({receiver:C.Message,sender:_.Message});function M(F){const I=F;return I&&C.is(I.receiver)&&_.is(I.sender)}B.is=M})(S||(t.CancellationStrategy=S={}));var E;(function(B){function M(F){const I=F;return I&&n.func(I.handleMessage)}B.is=M})(E||(t.MessageStrategy=E={}));var T;(function(B){function M(F){const I=F;return I&&(S.is(I.cancellationStrategy)||w.is(I.connectionStrategy)||E.is(I.messageStrategy))}B.is=M})(T||(t.ConnectionOptions=T={}));var R;(function(B){B[B.New=1]="New",B[B.Listening=2]="Listening",B[B.Closed=3]="Closed",B[B.Disposed=4]="Disposed"})(R||(R={}));function k(B,M,F,I){const z=F!==void 0?F:t.NullLogger;let Y=0,$=0,ee=0;const W="2.0";let ne;const Se=new Map;let fe;const ge=new Map,Oe=new Map;let Fe,De=new i.LinkedMap,ke=new Map,Ge=new Set,Ve=new Map,q=f.Off,Ue=A.Text,O,ve=R.New;const Ae=new s.Emitter,ae=new s.Emitter,Z=new s.Emitter,pe=new s.Emitter,J=new s.Emitter,H=I&&I.cancellationStrategy?I.cancellationStrategy:S.Message;function oe(N){if(N===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+N.toString()}function we(N){return N===null?"res-unknown-"+(++ee).toString():"res-"+N.toString()}function Ee(){return"not-"+(++$).toString()}function re(N,D){r.Message.isRequest(D)?N.set(oe(D.id),D):r.Message.isResponse(D)?N.set(we(D.id),D):N.set(Ee(),D)}function ce(N){}function le(){return ve===R.Listening}function me(){return ve===R.Closed}function Le(){return ve===R.Disposed}function Te(){(ve===R.New||ve===R.Listening)&&(ve=R.Closed,ae.fire(void 0))}function Pe(N){Ae.fire([N,void 0,void 0])}function Qe(N){Ae.fire(N)}B.onClose(Te),B.onError(Pe),M.onClose(Te),M.onError(Qe);function $e(){Fe||De.size===0||(Fe=(0,e.default)().timer.setImmediate(()=>{Fe=void 0,st()}))}function et(N){r.Message.isRequest(N)?Mt(N):r.Message.isNotification(N)?Be(N):r.Message.isResponse(N)?K(N):Re(N)}function st(){if(De.size===0)return;const N=De.shift();try{const D=I==null?void 0:I.messageStrategy;E.is(D)?D.handleMessage(N,et):et(N)}finally{$e()}}const dt=N=>{try{if(r.Message.isNotification(N)&&N.method===a.type.method){const D=N.params.id,j=oe(D),U=De.get(j);if(r.Message.isRequest(U)){const L=I==null?void 0:I.connectionStrategy,Q=L&&L.cancelUndispatched?L.cancelUndispatched(U,ce):void 0;if(Q&&(Q.error!==void 0||Q.result!==void 0)){De.delete(j),Ve.delete(D),Q.id=U.id,ht(Q,N.method,Date.now()),M.write(Q).catch(()=>z.error("Sending response for canceled message failed."));return}}const G=Ve.get(D);if(G!==void 0){G.cancel(),tn(N);return}else Ge.add(D)}re(De,N)}finally{$e()}};function Mt(N){if(Le())return;function D(X,V,he){const _e={jsonrpc:W,id:N.id};X instanceof r.ResponseError?_e.error=X.toJson():_e.result=X===void 0?null:X,ht(_e,V,he),M.write(_e).catch(()=>z.error("Sending response failed."))}function j(X,V,he){const _e={jsonrpc:W,id:N.id,error:X.toJson()};ht(_e,V,he),M.write(_e).catch(()=>z.error("Sending response failed."))}function U(X,V,he){X===void 0&&(X=null);const _e={jsonrpc:W,id:N.id,result:X};ht(_e,V,he),M.write(_e).catch(()=>z.error("Sending response failed."))}Gt(N);const G=Se.get(N.method);let L,Q;G&&(L=G.type,Q=G.handler);const te=Date.now();if(Q||ne){const X=N.id??String(Date.now()),V=v.is(H.receiver)?H.receiver.createCancellationTokenSource(X):H.receiver.createCancellationTokenSource(N);N.id!==null&&Ge.has(N.id)&&V.cancel(),N.id!==null&&Ve.set(X,V);try{let he;if(Q)if(N.params===void 0){if(L!==void 0&&L.numberOfParams!==0){j(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${N.method} defines ${L.numberOfParams} params but received none.`),N.method,te);return}he=Q(V.token)}else if(Array.isArray(N.params)){if(L!==void 0&&L.parameterStructures===r.ParameterStructures.byName){j(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${N.method} defines parameters by name but received parameters by position`),N.method,te);return}he=Q(...N.params,V.token)}else{if(L!==void 0&&L.parameterStructures===r.ParameterStructures.byPosition){j(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${N.method} defines parameters by position but received parameters by name`),N.method,te);return}he=Q(N.params,V.token)}else ne&&(he=ne(N.method,N.params,V.token));const _e=he;he?_e.then?_e.then(He=>{Ve.delete(X),D(He,N.method,te)},He=>{Ve.delete(X),He instanceof r.ResponseError?j(He,N.method,te):He&&n.string(He.message)?j(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${N.method} failed with message: ${He.message}`),N.method,te):j(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${N.method} failed unexpectedly without providing any details.`),N.method,te)}):(Ve.delete(X),D(he,N.method,te)):(Ve.delete(X),U(he,N.method,te))}catch(he){Ve.delete(X),he instanceof r.ResponseError?D(he,N.method,te):he&&n.string(he.message)?j(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${N.method} failed with message: ${he.message}`),N.method,te):j(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${N.method} failed unexpectedly without providing any details.`),N.method,te)}}else j(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${N.method}`),N.method,te)}function K(N){if(!Le())if(N.id===null)N.error?z.error(`Received response message without id: Error is: 
${JSON.stringify(N.error,void 0,4)}`):z.error("Received response message without id. No further error information provided.");else{const D=N.id,j=ke.get(D);if(Ft(N,j),j!==void 0){ke.delete(D);try{if(N.error){const U=N.error;j.reject(new r.ResponseError(U.code,U.message,U.data))}else if(N.result!==void 0)j.resolve(N.result);else throw new Error("Should never happen.")}catch(U){U.message?z.error(`Response handler '${j.method}' failed with message: ${U.message}`):z.error(`Response handler '${j.method}' failed unexpectedly.`)}}}}function Be(N){if(Le())return;let D,j;if(N.method===a.type.method){const U=N.params.id;Ge.delete(U),tn(N);return}else{const U=ge.get(N.method);U&&(j=U.handler,D=U.type)}if(j||fe)try{if(tn(N),j)if(N.params===void 0)D!==void 0&&D.numberOfParams!==0&&D.parameterStructures!==r.ParameterStructures.byName&&z.error(`Notification ${N.method} defines ${D.numberOfParams} params but received none.`),j();else if(Array.isArray(N.params)){const U=N.params;N.method===c.type.method&&U.length===2&&l.is(U[0])?j({token:U[0],value:U[1]}):(D!==void 0&&(D.parameterStructures===r.ParameterStructures.byName&&z.error(`Notification ${N.method} defines parameters by name but received parameters by position`),D.numberOfParams!==N.params.length&&z.error(`Notification ${N.method} defines ${D.numberOfParams} params but received ${U.length} arguments`)),j(...U))}else D!==void 0&&D.parameterStructures===r.ParameterStructures.byPosition&&z.error(`Notification ${N.method} defines parameters by position but received parameters by name`),j(N.params);else fe&&fe(N.method,N.params)}catch(U){U.message?z.error(`Notification handler '${N.method}' failed with message: ${U.message}`):z.error(`Notification handler '${N.method}' failed unexpectedly.`)}else Z.fire(N)}function Re(N){if(!N){z.error("Received empty message.");return}z.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(N,null,4)}`);const D=N;if(n.string(D.id)||n.number(D.id)){const j=D.id,U=ke.get(j);U&&U.reject(new Error("The received response has neither a result nor an error property."))}}function Me(N){if(N!=null)switch(q){case f.Verbose:return JSON.stringify(N,null,4);case f.Compact:return JSON.stringify(N);default:return}}function We(N){if(!(q===f.Off||!O))if(Ue===A.Text){let D;(q===f.Verbose||q===f.Compact)&&N.params&&(D=`Params: ${Me(N.params)}

`),O.log(`Sending request '${N.method} - (${N.id})'.`,D)}else Dt("send-request",N)}function Je(N){if(!(q===f.Off||!O))if(Ue===A.Text){let D;(q===f.Verbose||q===f.Compact)&&(N.params?D=`Params: ${Me(N.params)}

`:D=`No parameters provided.

`),O.log(`Sending notification '${N.method}'.`,D)}else Dt("send-notification",N)}function ht(N,D,j){if(!(q===f.Off||!O))if(Ue===A.Text){let U;(q===f.Verbose||q===f.Compact)&&(N.error&&N.error.data?U=`Error data: ${Me(N.error.data)}

`:N.result?U=`Result: ${Me(N.result)}

`:N.error===void 0&&(U=`No result returned.

`)),O.log(`Sending response '${D} - (${N.id})'. Processing request took ${Date.now()-j}ms`,U)}else Dt("send-response",N)}function Gt(N){if(!(q===f.Off||!O))if(Ue===A.Text){let D;(q===f.Verbose||q===f.Compact)&&N.params&&(D=`Params: ${Me(N.params)}

`),O.log(`Received request '${N.method} - (${N.id})'.`,D)}else Dt("receive-request",N)}function tn(N){if(!(q===f.Off||!O||N.method===m.type.method))if(Ue===A.Text){let D;(q===f.Verbose||q===f.Compact)&&(N.params?D=`Params: ${Me(N.params)}

`:D=`No parameters provided.

`),O.log(`Received notification '${N.method}'.`,D)}else Dt("receive-notification",N)}function Ft(N,D){if(!(q===f.Off||!O))if(Ue===A.Text){let j;if((q===f.Verbose||q===f.Compact)&&(N.error&&N.error.data?j=`Error data: ${Me(N.error.data)}

`:N.result?j=`Result: ${Me(N.result)}

`:N.error===void 0&&(j=`No result returned.

`)),D){const U=N.error?` Request failed: ${N.error.message} (${N.error.code}).`:"";O.log(`Received response '${D.method} - (${N.id})' in ${Date.now()-D.timerStart}ms.${U}`,j)}else O.log(`Received response ${N.id} without active response promise.`,j)}else Dt("receive-response",N)}function Dt(N,D){if(!O||q===f.Off)return;const j={isLSPMessage:!0,type:N,message:D,timestamp:Date.now()};O.log(j)}function zt(){if(me())throw new y(g.Closed,"Connection is closed.");if(Le())throw new y(g.Disposed,"Connection is disposed.")}function tr(){if(le())throw new y(g.AlreadyListening,"Connection is already listening")}function wn(){if(!le())throw new Error("Call listen() first.")}function Vn(N){return N===void 0?null:N}function kr(N){if(N!==null)return N}function ue(N){return N!=null&&!Array.isArray(N)&&typeof N=="object"}function ye(N,D){switch(N){case r.ParameterStructures.auto:return ue(D)?kr(D):[Vn(D)];case r.ParameterStructures.byName:if(!ue(D))throw new Error("Received parameters by name but param is not an object literal.");return kr(D);case r.ParameterStructures.byPosition:return[Vn(D)];default:throw new Error(`Unknown parameter structure ${N.toString()}`)}}function xe(N,D){let j;const U=N.numberOfParams;switch(U){case 0:j=void 0;break;case 1:j=ye(N.parameterStructures,D[0]);break;default:j=[];for(let G=0;G<D.length&&G<U;G++)j.push(Vn(D[G]));if(D.length<U)for(let G=D.length;G<U;G++)j.push(null);break}return j}const Ce={sendNotification:(N,...D)=>{zt();let j,U;if(n.string(N)){j=N;const L=D[0];let Q=0,te=r.ParameterStructures.auto;r.ParameterStructures.is(L)&&(Q=1,te=L);let X=D.length;const V=X-Q;switch(V){case 0:U=void 0;break;case 1:U=ye(te,D[Q]);break;default:if(te===r.ParameterStructures.byName)throw new Error(`Received ${V} parameters for 'by Name' notification parameter structure.`);U=D.slice(Q,X).map(he=>Vn(he));break}}else{const L=D;j=N.method,U=xe(N,L)}const G={jsonrpc:W,method:j,params:U};return Je(G),M.write(G).catch(L=>{throw z.error("Sending notification failed."),L})},onNotification:(N,D)=>{zt();let j;return n.func(N)?fe=N:D&&(n.string(N)?(j=N,ge.set(N,{type:void 0,handler:D})):(j=N.method,ge.set(N.method,{type:N,handler:D}))),{dispose:()=>{j!==void 0?ge.delete(j):fe=void 0}}},onProgress:(N,D,j)=>{if(Oe.has(D))throw new Error(`Progress handler for token ${D} already registered`);return Oe.set(D,j),{dispose:()=>{Oe.delete(D)}}},sendProgress:(N,D,j)=>Ce.sendNotification(c.type,{token:D,value:j}),onUnhandledProgress:pe.event,sendRequest:(N,...D)=>{zt(),wn();let j,U,G;if(n.string(N)){j=N;const X=D[0],V=D[D.length-1];let he=0,_e=r.ParameterStructures.auto;r.ParameterStructures.is(X)&&(he=1,_e=X);let He=D.length;o.CancellationToken.is(V)&&(He=He-1,G=V);const ze=He-he;switch(ze){case 0:U=void 0;break;case 1:U=ye(_e,D[he]);break;default:if(_e===r.ParameterStructures.byName)throw new Error(`Received ${ze} parameters for 'by Name' request parameter structure.`);U=D.slice(he,He).map(lt=>Vn(lt));break}}else{const X=D;j=N.method,U=xe(N,X);const V=N.numberOfParams;G=o.CancellationToken.is(X[V])?X[V]:void 0}const L=Y++;let Q;G&&(Q=G.onCancellationRequested(()=>{const X=H.sender.sendCancellation(Ce,L);return X===void 0?(z.log(`Received no promise from cancellation strategy when cancelling id ${L}`),Promise.resolve()):X.catch(()=>{z.log(`Sending cancellation messages for id ${L} failed`)})}));const te={jsonrpc:W,id:L,method:j,params:U};return We(te),typeof H.sender.enableCancellation=="function"&&H.sender.enableCancellation(te),new Promise(async(X,V)=>{const he=ze=>{X(ze),H.sender.cleanup(L),Q==null||Q.dispose()},_e=ze=>{V(ze),H.sender.cleanup(L),Q==null||Q.dispose()},He={method:j,timerStart:Date.now(),resolve:he,reject:_e};try{ke.set(L,He),await M.write(te)}catch(ze){throw ke.delete(L),He.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,ze.message?ze.message:"Unknown reason")),z.error("Sending request failed."),ze}})},onRequest:(N,D)=>{zt();let j=null;return d.is(N)?(j=void 0,ne=N):n.string(N)?(j=null,D!==void 0&&(j=N,Se.set(N,{handler:D,type:void 0}))):D!==void 0&&(j=N.method,Se.set(N.method,{type:N,handler:D})),{dispose:()=>{j!==null&&(j!==void 0?Se.delete(j):ne=void 0)}}},hasPendingResponse:()=>ke.size>0,trace:async(N,D,j)=>{let U=!1,G=A.Text;j!==void 0&&(n.boolean(j)?U=j:(U=j.sendNotification||!1,G=j.traceFormat||A.Text)),q=N,Ue=G,q===f.Off?O=void 0:O=D,U&&!me()&&!Le()&&await Ce.sendNotification(p.type,{value:f.toString(N)})},onError:Ae.event,onClose:ae.event,onUnhandledNotification:Z.event,onDispose:J.event,end:()=>{M.end()},dispose:()=>{if(Le())return;ve=R.Disposed,J.fire(void 0);const N=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const D of ke.values())D.reject(N);ke=new Map,Ve=new Map,Ge=new Set,De=new i.LinkedMap,n.func(M.dispose)&&M.dispose(),n.func(B.dispose)&&B.dispose()},listen:()=>{zt(),tr(),ve=R.Listening,B.listen(dt)},inspect:()=>{(0,e.default)().console.log("inspect")}};return Ce.onNotification(m.type,N=>{if(q===f.Off||!O)return;const D=q===f.Verbose||q===f.Compact;O.log(N.message,D?N.verbose:void 0)}),Ce.onNotification(c.type,N=>{const D=Oe.get(N.token);D?D(N.value):pe.fire(N)}),Ce}t.createMessageConnection=k})(kq);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressType=t.ProgressToken=t.createMessageConnection=t.NullLogger=t.ConnectionOptions=t.ConnectionStrategy=t.AbstractMessageBuffer=t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=t.SharedArrayReceiverStrategy=t.SharedArraySenderStrategy=t.CancellationToken=t.CancellationTokenSource=t.Emitter=t.Event=t.Disposable=t.LRUCache=t.Touch=t.LinkedMap=t.ParameterStructures=t.NotificationType9=t.NotificationType8=t.NotificationType7=t.NotificationType6=t.NotificationType5=t.NotificationType4=t.NotificationType3=t.NotificationType2=t.NotificationType1=t.NotificationType0=t.NotificationType=t.ErrorCodes=t.ResponseError=t.RequestType9=t.RequestType8=t.RequestType7=t.RequestType6=t.RequestType5=t.RequestType4=t.RequestType3=t.RequestType2=t.RequestType1=t.RequestType0=t.RequestType=t.Message=t.RAL=void 0,t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=void 0;const e=It;Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return e.Message}}),Object.defineProperty(t,"RequestType",{enumerable:!0,get:function(){return e.RequestType}}),Object.defineProperty(t,"RequestType0",{enumerable:!0,get:function(){return e.RequestType0}}),Object.defineProperty(t,"RequestType1",{enumerable:!0,get:function(){return e.RequestType1}}),Object.defineProperty(t,"RequestType2",{enumerable:!0,get:function(){return e.RequestType2}}),Object.defineProperty(t,"RequestType3",{enumerable:!0,get:function(){return e.RequestType3}}),Object.defineProperty(t,"RequestType4",{enumerable:!0,get:function(){return e.RequestType4}}),Object.defineProperty(t,"RequestType5",{enumerable:!0,get:function(){return e.RequestType5}}),Object.defineProperty(t,"RequestType6",{enumerable:!0,get:function(){return e.RequestType6}}),Object.defineProperty(t,"RequestType7",{enumerable:!0,get:function(){return e.RequestType7}}),Object.defineProperty(t,"RequestType8",{enumerable:!0,get:function(){return e.RequestType8}}),Object.defineProperty(t,"RequestType9",{enumerable:!0,get:function(){return e.RequestType9}}),Object.defineProperty(t,"ResponseError",{enumerable:!0,get:function(){return e.ResponseError}}),Object.defineProperty(t,"ErrorCodes",{enumerable:!0,get:function(){return e.ErrorCodes}}),Object.defineProperty(t,"NotificationType",{enumerable:!0,get:function(){return e.NotificationType}}),Object.defineProperty(t,"NotificationType0",{enumerable:!0,get:function(){return e.NotificationType0}}),Object.defineProperty(t,"NotificationType1",{enumerable:!0,get:function(){return e.NotificationType1}}),Object.defineProperty(t,"NotificationType2",{enumerable:!0,get:function(){return e.NotificationType2}}),Object.defineProperty(t,"NotificationType3",{enumerable:!0,get:function(){return e.NotificationType3}}),Object.defineProperty(t,"NotificationType4",{enumerable:!0,get:function(){return e.NotificationType4}}),Object.defineProperty(t,"NotificationType5",{enumerable:!0,get:function(){return e.NotificationType5}}),Object.defineProperty(t,"NotificationType6",{enumerable:!0,get:function(){return e.NotificationType6}}),Object.defineProperty(t,"NotificationType7",{enumerable:!0,get:function(){return e.NotificationType7}}),Object.defineProperty(t,"NotificationType8",{enumerable:!0,get:function(){return e.NotificationType8}}),Object.defineProperty(t,"NotificationType9",{enumerable:!0,get:function(){return e.NotificationType9}}),Object.defineProperty(t,"ParameterStructures",{enumerable:!0,get:function(){return e.ParameterStructures}});const n=jc;Object.defineProperty(t,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(t,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(t,"Touch",{enumerable:!0,get:function(){return n.Touch}});const r=l2;Object.defineProperty(t,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const i=Xl;Object.defineProperty(t,"Event",{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(t,"Emitter",{enumerable:!0,get:function(){return i.Emitter}});const s=lf;Object.defineProperty(t,"CancellationTokenSource",{enumerable:!0,get:function(){return s.CancellationTokenSource}}),Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return s.CancellationToken}});const o=Zm;Object.defineProperty(t,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(t,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});const a=Qd;Object.defineProperty(t,"MessageReader",{enumerable:!0,get:function(){return a.MessageReader}}),Object.defineProperty(t,"AbstractMessageReader",{enumerable:!0,get:function(){return a.AbstractMessageReader}}),Object.defineProperty(t,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return a.ReadableStreamMessageReader}});const l=zd;Object.defineProperty(t,"MessageWriter",{enumerable:!0,get:function(){return l.MessageWriter}}),Object.defineProperty(t,"AbstractMessageWriter",{enumerable:!0,get:function(){return l.AbstractMessageWriter}}),Object.defineProperty(t,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return l.WriteableStreamMessageWriter}});const c=u2;Object.defineProperty(t,"AbstractMessageBuffer",{enumerable:!0,get:function(){return c.AbstractMessageBuffer}});const u=kq;Object.defineProperty(t,"ConnectionStrategy",{enumerable:!0,get:function(){return u.ConnectionStrategy}}),Object.defineProperty(t,"ConnectionOptions",{enumerable:!0,get:function(){return u.ConnectionOptions}}),Object.defineProperty(t,"NullLogger",{enumerable:!0,get:function(){return u.NullLogger}}),Object.defineProperty(t,"createMessageConnection",{enumerable:!0,get:function(){return u.createMessageConnection}}),Object.defineProperty(t,"ProgressToken",{enumerable:!0,get:function(){return u.ProgressToken}}),Object.defineProperty(t,"ProgressType",{enumerable:!0,get:function(){return u.ProgressType}}),Object.defineProperty(t,"Trace",{enumerable:!0,get:function(){return u.Trace}}),Object.defineProperty(t,"TraceValues",{enumerable:!0,get:function(){return u.TraceValues}}),Object.defineProperty(t,"TraceFormat",{enumerable:!0,get:function(){return u.TraceFormat}}),Object.defineProperty(t,"SetTraceNotification",{enumerable:!0,get:function(){return u.SetTraceNotification}}),Object.defineProperty(t,"LogTraceNotification",{enumerable:!0,get:function(){return u.LogTraceNotification}}),Object.defineProperty(t,"ConnectionErrors",{enumerable:!0,get:function(){return u.ConnectionErrors}}),Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return u.ConnectionError}}),Object.defineProperty(t,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return u.CancellationReceiverStrategy}}),Object.defineProperty(t,"CancellationSenderStrategy",{enumerable:!0,get:function(){return u.CancellationSenderStrategy}}),Object.defineProperty(t,"CancellationStrategy",{enumerable:!0,get:function(){return u.CancellationStrategy}}),Object.defineProperty(t,"MessageStrategy",{enumerable:!0,get:function(){return u.MessageStrategy}});const d=mu;t.RAL=d.default})(v_);Object.defineProperty(JL,"__esModule",{value:!0});const Ml=v_;class d2 extends Ml.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return d2.emptyBuffer}fromString(e,n){return new TextEncoder().encode(e)}toString(e,n){return n==="ascii"?this.asciiDecoder.decode(e):new TextDecoder(n).decode(e)}asNative(e,n){return n===void 0?e:e.slice(0,n)}allocNative(e){return new Uint8Array(e)}}d2.emptyBuffer=new Uint8Array(0);class nbe{constructor(e){this.socket=e,this._onData=new Ml.Emitter,this._messageListener=n=>{n.data.arrayBuffer().then(i=>{this._onData.fire(new Uint8Array(i))},()=>{(0,Ml.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),Ml.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),Ml.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),Ml.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}}class rbe{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),Ml.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),Ml.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),Ml.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,n){if(typeof e=="string"){if(n!==void 0&&n!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${n}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}}const ibe=new TextEncoder,Rq=Object.freeze({messageBuffer:Object.freeze({create:t=>new d2(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{if(e.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${e.charset}`);return Promise.resolve(ibe.encode(JSON.stringify(t,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{if(!(t instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(e.charset).decode(t)))}})}),stream:Object.freeze({asReadableStream:t=>new nbe(t),asWritableStream:t=>new rbe(t)}),console,timer:Object.freeze({setTimeout(t,e,...n){const r=setTimeout(t,e,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(t,...e){const n=setTimeout(t,0,...e);return{dispose:()=>clearTimeout(n)}},setInterval(t,e,...n){const r=setInterval(t,e,...n);return{dispose:()=>clearInterval(r)}}})});function V4(){return Rq}(function(t){function e(){Ml.RAL.install(Rq)}t.install=e})(V4||(V4={}));JL.default=V4;(function(t){var e=en&&en.__createBinding||(Object.create?function(l,c,u,d){d===void 0&&(d=u);var f=Object.getOwnPropertyDescriptor(c,u);(!f||("get"in f?!c.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return c[u]}}),Object.defineProperty(l,d,f)}:function(l,c,u,d){d===void 0&&(d=u),l[d]=c[u]}),n=en&&en.__exportStar||function(l,c){for(var u in l)u!=="default"&&!Object.prototype.hasOwnProperty.call(c,u)&&e(c,l,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.BrowserMessageWriter=t.BrowserMessageReader=void 0,JL.default.install();const i=v_;n(v_,t);class s extends i.AbstractMessageReader{constructor(c){super(),this._onData=new i.Emitter,this._messageListener=u=>{this._onData.fire(u.data)},c.addEventListener("error",u=>this.fireError(u)),c.onmessage=this._messageListener}listen(c){return this._onData.event(c)}}t.BrowserMessageReader=s;class o extends i.AbstractMessageWriter{constructor(c){super(),this.port=c,this.errorCount=0,c.addEventListener("error",u=>this.fireError(u))}write(c){try{return this.port.postMessage(c),Promise.resolve()}catch(u){return this.handleError(u,c),Promise.reject(u)}}handleError(c,u){this.errorCount++,this.fireError(c,u,this.errorCount)}end(){}}t.BrowserMessageWriter=o;function a(l,c,u,d){return u===void 0&&(u=i.NullLogger),i.ConnectionStrategy.is(d)&&(d={connectionStrategy:d}),(0,i.createMessageConnection)(l,c,u,d)}t.createMessageConnection=a})(qf);var vl,td,AS,Wy,KR,nd,vf,G4,W4,pS,Pq;const uh=class uh{constructor(){eo(this,pS);eo(this,vl,[]);eo(this,td,[]);eo(this,AS,[]);eo(this,Wy,!1);eo(this,KR,!1);eo(this,nd);const e=On(this,Wy),n=On(this,vl),r=On(this,td);Ug(this,nd,new WritableStream({write(i){var s;Cu(s=uh,vf,W4).call(s,e,n,r,i)}}))}enqueue(e){var n;return Cu(n=uh,vf,W4).call(n,On(this,Wy),On(this,vl),On(this,td),e)}dequeue(){return On(this,vl).length||Cu(this,pS,Pq).call(this),On(this,vl).shift()}isEmpty(){return!On(this,vl).length}isBlocked(){return!!On(this,td).length}get length(){return On(this,vl).length-On(this,td).length}async next(){const n=await this.dequeue();for(const r of On(this,AS))r(n);return{done:!1,value:n}}return(){return new Promise(()=>{})}throw(e){return new Promise((n,r)=>{r(e)})}[Symbol.asyncIterator](){return this}get locked(){return On(this,nd).locked}abort(e){return On(this,nd).abort(e)}close(){return On(this,nd).close()}getWriter(){return On(this,nd).getWriter()}};vl=new WeakMap,td=new WeakMap,AS=new WeakMap,Wy=new WeakMap,KR=new WeakMap,nd=new WeakMap,vf=new WeakSet,G4=function(e,n){e.push(new Promise(r=>{n.push(r)}))},W4=function(e,n,r,i){var s;e||(r.length||Cu(s=uh,vf,G4).call(s,n,r),r.shift()(i))},pS=new WeakSet,Pq=function(){var e;return Cu(e=uh,vf,G4).call(e,On(this,vl),On(this,td))},eo(uh,vf);let nm=uh;class K4{static client(e){console.log("lsp client message",e)}static server(e){const n=typeof e=="string"?e:JSON.stringify(e);console.log("lsp server message",n)}}var bl,Ky,$4;class sbe{constructor(){eo(this,Ky);eo(this,bl,new Map)}get(e){let n;return On(this,bl).has(e)?n=On(this,bl).get(e):n=Cu(this,Ky,$4).call(this,e),n.status==="pending"?n.promise:null}set(e,n){const r=Cu(this,Ky,$4).call(this,e,n);return r.status==="pending"&&(On(this,bl).set(e,{status:"resolved"}),r.resolve(n)),this}get size(){return On(this,bl).size}}bl=new WeakMap,Ky=new WeakSet,$4=function(e,n){if(On(this,bl).has(e))return On(this,bl).get(e);let r=o=>{};const i=new Promise(o=>{r=o}),s={status:"pending",resolve:r,promise:i};return n!=null&&s.resolve(n),On(this,bl).set(e,s),s};var mS;class obe extends nm{constructor(n){super();se(this,"responses",new sbe);se(this,"notifications",new nm);se(this,"requests",new nm);eo(this,mS);se(this,"trace",!1);this.trace=n||!1,Ug(this,mS,this.start())}async start(){let n=null,r=new Uint8Array;for await(const i of this)for(r=v1.append(Uint8Array,r,i);r.length>0;){if(n==null){const l=v1.decode(r).match(/^Content-Length:\s*(\d+)\s*/);if(l==null)continue;const c=parseInt(l[1]);if(isNaN(c))return Promise.reject(new Error("invalid content length"));r=r.slice(l[0].length),n=c}if(r.length<n)continue;const s=r.slice(0,n),o=v1.decode(s);r=r.slice(n),n=null;const a=JSON.parse(o);if(this.trace&&K4.server(a),qf.Message.isResponse(a)&&a.id!=null){this.responses.set(a.id,a);continue}if(qf.Message.isNotification(a)){this.notifications.enqueue(a);continue}if(qf.Message.isRequest(a)){this.requests.enqueue(a);continue}}}add(n){const r=Iq.decode(n);this.trace&&K4.server(r),qf.Message.isResponse(r)&&r.id!=null&&this.responses.set(r.id,r),qf.Message.isNotification(r)&&this.notifications.enqueue(r),qf.Message.isRequest(r)&&this.requests.enqueue(r)}}mS=new WeakMap;let q4=class{static add(e){return`Content-Length: ${e.length}\r
\r
${e}`}static remove(e){return e.replace(/^Content-Length:\s*\d+\s*/,"")}};var X4=(t=>(t.Init="init",t.Call="call",t))(X4||{});const abe=new TextEncoder,Lq=new TextDecoder;class Iq{static encode(e){const n=JSON.stringify(e),r=q4.add(n);return v1.encode(r)}static decode(e){const n=v1.decode(e),r=q4.remove(n);return JSON.parse(r)}}class g7 extends nm{constructor(n,r,i){super();se(this,"worker",null);se(this,"type_",null);se(this,"trace",!1);r&&n&&(this.worker=r,this.type_=n),this.trace=i||!1}enqueue(n){this.trace&&K4.client(q4.remove(Lq.decode(n))),this.worker?this.worker.postMessage({worker:this.type_,eventType:"call",eventData:n}):super.enqueue(n)}}var w_;(t=>{function e(){try{return new obe(!1)}catch(n){return n}}t.create=e})(w_||(w_={}));const lbe={textDocument:{hover:{dynamicRegistration:!0,contentFormat:["plaintext","markdown"]},moniker:{},synchronization:{dynamicRegistration:!0,willSave:!1,didSave:!1,willSaveWaitUntil:!1},completion:{dynamicRegistration:!0,completionItem:{snippetSupport:!1,commitCharactersSupport:!0,documentationFormat:["plaintext","markdown"],deprecatedSupport:!1,preselectSupport:!1},contextSupport:!1},signatureHelp:{dynamicRegistration:!0,signatureInformation:{documentationFormat:["plaintext","markdown"]}},declaration:{dynamicRegistration:!0,linkSupport:!0},definition:{dynamicRegistration:!0,linkSupport:!0},typeDefinition:{dynamicRegistration:!0,linkSupport:!0},implementation:{dynamicRegistration:!0,linkSupport:!0}},workspace:{didChangeConfiguration:{dynamicRegistration:!0}}};var dm;class cbe extends Ux.JSONRPCServerAndClient{constructor(n,r,i){super(new Ux.JSONRPCServer,new Ux.JSONRPCClient(async s=>{const o=Iq.encode(s);if(r.enqueue(o),s.id!=null){const a=await n.responses.get(s.id);this.client.receive(a)}}));se(this,"afterInitializedHooks",[]);eo(this,dm);se(this,"serverCapabilities",{});se(this,"notifyFn",null);se(this,"initializedCallback");Ug(this,dm,n),this.initializedCallback=i}async start(){this.addMethod(ki.LogMessageNotification.type.method,r=>{const{type:i,message:s}=r;switch(i){case ki.MessageType.Error:break;case ki.MessageType.Warning:break;case ki.MessageType.Info:break;case ki.MessageType.Log:break}}),this.addMethod(ki.RegistrationRequest.type.method,r=>{r.registrations.forEach(i=>{const s=ive(this.serverCapabilities,i);if(s instanceof Error)return this.serverCapabilities={};this.serverCapabilities=s})}),this.addMethod(ki.UnregistrationRequest.type.method,r=>{r.unregisterations.forEach(i=>{const s=sve(this.serverCapabilities,i);if(s instanceof Error)return this.serverCapabilities={};this.serverCapabilities=s})});const{capabilities:n}=await this.request(ki.InitializeRequest.type.method,{processId:null,clientInfo:{name:"codemirror-lsp-client"},capabilities:lbe,rootUri:null});this.serverCapabilities=n,this.notify(ki.InitializedNotification.type.method,{}),this.initializedCallback(),await Promise.all(this.afterInitializedHooks.map(r=>r())),await Promise.all([this.processNotifications(),this.processRequests()])}getServerCapabilities(){return this.serverCapabilities}setNotifyFn(n){this.notifyFn=n}async processNotifications(){for await(const n of On(this,dm).notifications)this.notifyFn&&this.notifyFn(n)}async processRequests(){for await(const n of On(this,dm).requests)await this.receiveAndSend(n)}pushAfterInitializeHook(...n){this.afterInitializedHooks.push(...n)}}dm=new WeakMap;class y7{constructor(e){se(this,"client");se(this,"name");se(this,"ready");se(this,"plugins");se(this,"initializePromise");this.name=e.name,this.plugins=[],this.client=new cbe(e.fromServer,e.intoServer,e.initializedCallback),this.ready=!1,this.initializePromise=this.initialize()}async initialize(){this.client.setNotifyFn(this.processNotifications.bind(this)),this.client.start(),this.ready=!0}getName(){return this.name}getServerCapabilities(){return this.client.getServerCapabilities()}close(){}textDocumentDidOpen(e){this.notify("textDocument/didOpen",e)}textDocumentDidChange(e){this.notify("textDocument/didChange",e)}textDocumentDidClose(e){this.notify("textDocument/didClose",e)}workspaceDidChangeWorkspaceFolders(e,n){this.notify("workspace/didChangeWorkspaceFolders",{event:{added:e,removed:n}})}workspaceDidCreateFiles(e){this.notify("workspace/didCreateFiles",e)}workspaceDidRenameFiles(e){this.notify("workspace/didRenameFiles",e)}workspaceDidDeleteFiles(e){this.notify("workspace/didDeleteFiles",e)}async textDocumentSemanticTokensFull(e){if(this.getServerCapabilities().semanticTokensProvider)return this.request("textDocument/semanticTokens/full",e)}async textDocumentHover(e){if(this.getServerCapabilities().hoverProvider)return await this.request("textDocument/hover",e)}async textDocumentFormatting(e){if(this.getServerCapabilities().documentFormattingProvider)return await this.request("textDocument/formatting",e)}async textDocumentFoldingRange(e){if(this.getServerCapabilities().foldingRangeProvider)return await this.request("textDocument/foldingRange",e)}async textDocumentCompletion(e){return this.getServerCapabilities().completionProvider?await this.request("textDocument/completion",e):void 0}attachPlugin(e){this.plugins.push(e)}detachPlugin(e){const n=this.plugins.indexOf(e);n!==-1&&this.plugins.splice(n,1)}request(e,n){return this.client.request(e,n)}requestCustom(e,n){return this.client.request(e,n)}notify(e,n){return this.client.notify(e,n)}notifyCustom(e,n){return this.client.notify(e,n)}processNotifications(e){for(const n of this.plugins)n.processNotification(e)}}function ube(t){let e=null;const n=Br.define(i=>e=new jye(t,i),new Qye);return[qL.of(t.documentUri),XL.of("kcl"),Hye.of(t.workspaceFolders),n,h$.of((i,s,o)=>e==null?null:e==null?void 0:e.foldingRange(s,o))]}class Bg extends Error{constructor(n,r,i){super();se(this,"kind");se(this,"sourceRanges");se(this,"msg");this.kind=n,this.msg=r,this.sourceRanges=i,Object.setPrototypeOf(this,Bg.prototype)}}function dbe(t){return t==null?void 0:t.flatMap(e=>e.sourceRanges.map(([n,r])=>({from:n,to:r,message:e.msg,severity:"error"})))}function ft(){return navigator.userAgent.toLowerCase().indexOf("electron")>-1}class fbe{constructor(){se(this,"_dir",null)}get dir(){return this._dir??""}set dir(e){this._dir=e}async join(e,n){return Promise.resolve(window.electron.path.join(e,n))}async readFile(e){return ft()?this.join(this.dir,e).then(n=>window.electron.readFile(n)):Promise.reject(new Error("This function can only be called from the desktop application"))}async exists(e){return ft()?this.join(this.dir,e).then(async n=>{try{await window.electron.stat(n)}catch(r){if(r==="ENOENT")return!1}return!0}):Promise.reject(new Error("This function can only be called from the desktop application"))}async getAllFiles(e){return ft()?this.join(this.dir,e).then(n=>window.electron.readdir(n).catch(r=>Promise.reject(new Error(`Error reading dir: ${r}`))).then(r=>r.map(i=>i))):Promise.reject(new Error("This function can only be called from the desktop application"))}}const Oq=new fbe,tu=t=>function(e){var n;if(ft())return window.electron.openExternal(t||((n=e.currentTarget)==null?void 0:n.href)).catch(Bt),e.preventDefault(),e.stopPropagation(),!1};async function Y4(t){ft()?await window.electron.openExternal(t):window.open(t,"_blank")}const hbe={BASE_URL:"/",DEV:!1,MODE:"production",PACKAGE_VERSION:"0.26.0",PROD:!0,SSR:!1,VITE_KC_API_BASE_URL:"https://api.dev.zoo.dev",VITE_KC_API_WS_MODELING_URL:"wss://api.dev.zoo.dev/ws/modeling/commands",VITE_KC_CONNECTION_TIMEOUT_MS:"15000",VITE_KC_SITE_BASE_URL:"https://dev.zoo.dev",VITE_KC_SKIP_AUTH:"false"};var Az;const sl=((Az=window.electron)==null?void 0:Az.process.env)??hbe,Abe=sl.NODE_ENV,Fq=sl.VITE_KC_API_WS_MODELING_URL,cf=sl.VITE_KC_API_BASE_URL,v7=sl.VITE_KC_SITE_BASE_URL,pbe=sl.VITE_KC_SKIP_AUTH;sl.VITE_KC_CONNECTION_TIMEOUT_MS;const x_=sl.VITE_KC_DEV_TOKEN;sl.PROD;const Mp=sl.TEST,C_=sl.DEV;sl.CI;const J4=()=>document.location.protocol.includes("http")?document.location.origin+"/wasm_lib_bg.wasm":document.location.protocol+document.location.pathname.split("/").slice(0,-1).join("/")+"/wasm_lib_bg.wasm",mbe=async()=>{try{const t=J4(),n=await(await fetch(t)).arrayBuffer();return await _W(n)}catch(t){return console.log("Error initialising WASM",t),Promise.reject(t)}},eI=mbe(),tI=t=>t.map(([e,n])=>[e,n]),Rr=t=>{if(ie(t))return t;try{return Lhe(t)}catch(e){const n=JSON.parse(e.toString());return new Bg(n.kind,n.msg,tI(n.sourceRanges))}};function Z4(){return{memory:ao.empty(),idGenerator:nI()}}function gbe(t){return{memory:ao.fromRaw(t.memory),idGenerator:t.idGenerator}}function nI(){return{nextId:0,ids:[]}}const b7=0;function w7(){return{bindings:{},parent:null}}class ao{constructor(e=[w7()],n=b7,r=null){se(this,"environments");se(this,"currentEnv");se(this,"return");this.environments=e,this.currentEnv=n,this.return=r}static empty(){return new ao}static fromRaw(e){return new ao(e.environments,e.currentEnv,e.return)}clone(){return ao.fromRaw(structuredClone(this.toRaw()))}has(e){let n=this.currentEnv;for(;;){const r=this.environments[n];if(r.bindings.hasOwnProperty(e))return!0;if(!r.parent)break;n=r.parent}return!1}get(e){let n=this.currentEnv;for(;;){const r=this.environments[n];if(r.bindings.hasOwnProperty(e))return r.bindings[e]??null;if(!r.parent)break;n=r.parent}return null}set(e,n){if(this.environments.length===0)return new Error("No environment to set memory in");const r=this.environments[this.currentEnv];return r.bindings[e]=n,null}filterVariables(e,n){const r=[];for(const[i,s]of this.environments.entries()){let o;if(i===b7&&e){const a=e5();if(ie(a))return a;o=a.environments[0].bindings}else o=w7().bindings;for(const[a,l]of Object.entries(s.bindings))l!==void 0&&n(l)&&(o[a]=structuredClone(l));r.push({bindings:o,parent:s.parent})}return new ao(r,this.currentEnv,null)}numEnvironments(){return this.environments.length}numVariables(e){return Object.keys(this.environments[e]).length}visibleEntries(){const e=new Map;let n=this.currentEnv;for(;;){const r=this.environments[n];for(const[i,s]of Object.entries(r.bindings))s!==void 0&&(e.has(i)||e.set(i,s));if(!r.parent)break;n=r.parent}return e}hasSketchOrSolid(){var e;for(const n of this.visibleEntries().values())if(n.type==="Solid"||((e=n.value)==null?void 0:e.type)==="Sketch")return!0;return!1}toRaw(){return{environments:this.environments,currentEnv:this.currentEnv,return:this.return}}}function js(t,e){var r,i,s;if(((r=t==null?void 0:t.value)==null?void 0:r.type)==="Sketch")return t.value;if(((i=t==null?void 0:t.value)==null?void 0:i.type)==="Solid")return t.value.sketch;if((t==null?void 0:t.type)==="Solid")return t.sketch;e||(e="a KCL value");const n=((s=t==null?void 0:t.value)==null?void 0:s.type)??(t==null?void 0:t.type);return n?(console.log(t),new Error(`Expected ${e} to be a sketch or solid, but it was ${n} instead.`)):new Error(`Expected ${e} to be a sketch, but it wasn't.`)}const Nq=async(t,e=ao.empty(),n=nI(),r,i)=>{var s;if(ie(e))return Promise.reject(e);try{let o="mm";Mp||(o=((s=(await Zie(()=>Promise.resolve().then(()=>aTe),void 0).then(c=>c.getSettingsState))())==null?void 0:s.modeling.defaultUnit.current)||"mm");const a=await Bhe(JSON.stringify(t),JSON.stringify(e.toRaw()),JSON.stringify(n),o,r,Oq,void 0,i);return gbe(a)}catch(o){console.log(o);const a=JSON.parse(o.toString()),l=new Bg(a.kind,a.msg,tI(a.sourceRanges));return Promise.reject(l)}},ybe=async t=>{try{return await Mhe(JSON.stringify(t))}catch(e){return Promise.reject(e)}},wr=t=>Ihe(JSON.stringify(t)),vbe=async t=>{try{return await khe(t)}catch(e){return console.log("make default planes error",e),Promise.reject(e)}},bbe=async(t,e)=>{try{await Rhe(t,e);return}catch(n){return console.log("modify grid error",n),Promise.reject(n)}};function wbe({arcStartPoint:t,arcEndPoint:e,tanPreviousPoint:n,obtuse:r=!0}){const i=Ohe(t[0],t[1],e[0],e[1],n[0],n[1],r);return{center:[i.center_x,i.center_y],arcMidPoint:[i.arc_mid_point_x,i.arc_mid_point_y],radius:i.radius,startAngle:i.start_angle,endAngle:i.end_angle,ccw:i.ccw>0,arcLength:i.arc_length}}function e5(){try{const t=Fhe();return new ao(t.environments,t.currentEnv,t.return)}catch(t){console.log(t);const e=JSON.parse(t.toString());return new Bg(e.kind,e.msg,tI(e.sourceRanges))}}async function rI(t,e=!1){try{console.warn("CoreDump: Initializing core dump");const n=await Nhe(t);return e&&n.github_issue_url?Y4(n.github_issue_url):console.error("github_issue_url undefined. Unable to create GitHub issue for coredump."),console.log("CoreDump: final coredump",n),console.log("CoreDump: final coredump JSON",JSON.stringify(n)),n}catch(n){return console.error("CoreDump: error",n),Promise.reject(new Error(`Error getting core dump: ${n}`))}}function __(t){return Vhe(JSON.stringify(t))}function t5(){return Dhe()}function Dq(t){return Uhe(t)}function x7(){return Hhe()}function iI(t){return jhe(t)}function xbe(t){try{const e=zhe(t);return new Uint8Array(e).buffer}catch(e){return console.error("Caught error decoding base64 string: "+e),new Error("Caught error decoding base64 string: "+e)}}const nu="Modeling App",Uq="$n",Cbe=7,_be="project-$nnn",Sbe="main.kcl",eg="browser",Hq="main",Ebe="zoo-modeling-app-projects",Ss=".kcl",ea=`main${Ss}`,PT="Untitled",C7="Tutorial Project $nn",f2={SKETCH:"sketch",EXTRUDE:"extrude",SEGMENT:"seg",REVOLVE:"revolve"},_7="5",Tbe="360",Bbe="settings.toml",Mbe="token.txt",jq="project.toml",Qq="__Secure-next-auth.session-token",zq="Force interrupt, executionIsStale, new AST requested",_h={START:"Exporting...",SUCCESS:"Exported successfully",FAILED:"Export failed"},Ps={START:"Starting print...",NO_MACHINES:"No machines available",NO_MACHINE_API_IP:"No machine api ip available",NO_CURRENT_MACHINE:"No current machine available",NO_MACHINE_ID:"No machine id available",NO_NAME:"No name provided",ERROR_STARTING_PRINT:"Error while starting print",SUCCESS:"Started print successfully"},S7={remote:"https://raw.githubusercontent.com/KittyCAD/kcl-samples/main/manifest.json",localFallback:"/kcl-samples-manifest-fallback.json"},LT="auto-updater-toast",kbe=async(t,e,n)=>{if("showSaveFilePicker"in window&&(()=>{try{return window.self===window.top}catch{return!1}})()&&window.showSaveFilePicker&&!window.playwrightSkipFilePicker)try{const a=await(await window.showSaveFilePicker({suggestedName:e})).createWritable();await a.write(t),await a.close(),jt.success(_h.SUCCESS,{id:n});return}catch(o){o.name==="AbortError"?jt.dismiss(n):(console.error(o.name,o.message),jt.error(_h.FAILED,{id:n}));return}const i=URL.createObjectURL(t),s=document.createElement("a");s.href=i,s.download=e,s.style.display="none",document.body.append(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(i),s.remove()},1e3),jt.success(_h.SUCCESS,{id:n})};function ew(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vq={exports:{}};/*!

JSZip v3.10.1 - A JavaScript class for generating and reading zip files
<http://stuartk.com/jszip>

(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.

JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/main/LICENSE
*/(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,s){function o(c,u){if(!i[c]){if(!r[c]){var d=typeof ew=="function"&&ew;if(!u&&d)return d(c,!0);if(a)return a(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var h=i[c]={exports:{}};r[c][0].call(h.exports,function(A){var p=r[c][1][A];return o(p||A)},h,h.exports,n,r,i,s)}return i[c].exports}for(var a=typeof ew=="function"&&ew,l=0;l<s.length;l++)o(s[l]);return o}({1:[function(n,r,i){var s=n("./utils"),o=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(l){for(var c,u,d,f,h,A,p,m=[],g=0,y=l.length,w=y,v=s.getTypeOf(l)!=="string";g<l.length;)w=y-g,d=v?(c=l[g++],u=g<y?l[g++]:0,g<y?l[g++]:0):(c=l.charCodeAt(g++),u=g<y?l.charCodeAt(g++):0,g<y?l.charCodeAt(g++):0),f=c>>2,h=(3&c)<<4|u>>4,A=1<w?(15&u)<<2|d>>6:64,p=2<w?63&d:64,m.push(a.charAt(f)+a.charAt(h)+a.charAt(A)+a.charAt(p));return m.join("")},i.decode=function(l){var c,u,d,f,h,A,p=0,m=0,g="data:";if(l.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var y,w=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&w--,l.charAt(l.length-2)===a.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=o.uint8array?new Uint8Array(0|w):new Array(0|w);p<l.length;)c=a.indexOf(l.charAt(p++))<<2|(f=a.indexOf(l.charAt(p++)))>>4,u=(15&f)<<4|(h=a.indexOf(l.charAt(p++)))>>2,d=(3&h)<<6|(A=a.indexOf(l.charAt(p++))),y[m++]=c,h!==64&&(y[m++]=u),A!==64&&(y[m++]=d);return y}},{"./support":30,"./utils":32}],2:[function(n,r,i){var s=n("./external"),o=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function c(u,d,f,h,A){this.compressedSize=u,this.uncompressedSize=d,this.crc32=f,this.compression=h,this.compressedContent=A}c.prototype={getContentWorker:function(){var u=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return u.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(u,d,f){return u.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var s=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var s=n("./utils"),o=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(c,u,d,f){var h=o,A=f+d;c^=-1;for(var p=f;p<A;p++)c=c>>>8^h[255&(c^u[p])];return-1^c}(0|l,a,a.length,0):function(c,u,d,f){var h=o,A=f+d;c^=-1;for(var p=f;p<A;p++)c=c>>>8^h[255&(c^u.charCodeAt(p))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),c=s?"uint8array":"array";function u(d,f){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(u,l),u.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,d.data),!1)},u.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(f){d.push({data:f,meta:d.meta})}},i.compressWorker=function(d){return new u("Deflate",d)},i.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function s(h,A){var p,m="";for(p=0;p<A;p++)m+=String.fromCharCode(255&h),h>>>=8;return m}function o(h,A,p,m,g,y){var w,v,x=h.file,C=h.compression,_=y!==c.utf8encode,S=a.transformTo("string",y(x.name)),E=a.transformTo("string",c.utf8encode(x.name)),T=x.comment,R=a.transformTo("string",y(T)),k=a.transformTo("string",c.utf8encode(T)),B=E.length!==x.name.length,M=k.length!==T.length,F="",I="",z="",Y=x.dir,$=x.date,ee={crc32:0,compressedSize:0,uncompressedSize:0};A&&!p||(ee.crc32=h.crc32,ee.compressedSize=h.compressedSize,ee.uncompressedSize=h.uncompressedSize);var W=0;A&&(W|=8),_||!B&&!M||(W|=2048);var ne=0,Se=0;Y&&(ne|=16),g==="UNIX"?(Se=798,ne|=function(ge,Oe){var Fe=ge;return ge||(Fe=Oe?16893:33204),(65535&Fe)<<16}(x.unixPermissions,Y)):(Se=20,ne|=function(ge){return 63&(ge||0)}(x.dosPermissions)),w=$.getUTCHours(),w<<=6,w|=$.getUTCMinutes(),w<<=5,w|=$.getUTCSeconds()/2,v=$.getUTCFullYear()-1980,v<<=4,v|=$.getUTCMonth()+1,v<<=5,v|=$.getUTCDate(),B&&(I=s(1,1)+s(u(S),4)+E,F+="up"+s(I.length,2)+I),M&&(z=s(1,1)+s(u(R),4)+k,F+="uc"+s(z.length,2)+z);var fe="";return fe+=`
\0`,fe+=s(W,2),fe+=C.magic,fe+=s(w,2),fe+=s(v,2),fe+=s(ee.crc32,4),fe+=s(ee.compressedSize,4),fe+=s(ee.uncompressedSize,4),fe+=s(S.length,2),fe+=s(F.length,2),{fileRecord:d.LOCAL_FILE_HEADER+fe+S+F,dirRecord:d.CENTRAL_FILE_HEADER+s(Se,2)+fe+s(R.length,2)+"\0\0\0\0"+s(ne,4)+s(m,4)+S+F+R}}var a=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),u=n("../crc32"),d=n("../signature");function f(h,A,p,m){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=A,this.zipPlatform=p,this.encodeFileName=m,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(h){var A=h.meta.percent||0,p=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:p?(A+100*(p-m-1))/p:100}}))},f.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var A=this.streamFiles&&!h.file.dir;if(A){var p=o(h,A,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(h){this.accumulate=!1;var A=this.streamFiles&&!h.file.dir,p=o(h,A,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),A)this.push({data:function(m){return d.DATA_DESCRIPTOR+s(m.crc32,4)+s(m.compressedSize,4)+s(m.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var h=this.bytesWritten,A=0;A<this.dirRecords.length;A++)this.push({data:this.dirRecords[A],meta:{percent:100}});var p=this.bytesWritten-h,m=function(g,y,w,v,x){var C=a.transformTo("string",x(v));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(g,2)+s(g,2)+s(y,4)+s(w,4)+s(C.length,2)+C}(this.dirRecords.length,p,h,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(h){this._sources.push(h);var A=this;return h.on("data",function(p){A.processChunk(p)}),h.on("end",function(){A.closedSource(A.previous.streamInfo),A._sources.length?A.prepareNextSource():A.end()}),h.on("error",function(p){A.error(p)}),this},f.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(h){var A=this._sources;if(!l.prototype.error.call(this,h))return!1;for(var p=0;p<A.length;p++)try{A[p].error(h)}catch{}return!0},f.prototype.lock=function(){l.prototype.lock.call(this);for(var h=this._sources,A=0;A<h.length;A++)h[A].lock()},r.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,i){var s=n("../compressions"),o=n("./ZipFileWorker");i.generateWorker=function(a,l,c){var u=new o(l.streamFiles,c,l.platform,l.encodeFileName),d=0;try{a.forEach(function(f,h){d++;var A=function(y,w){var v=y||w,x=s[v];if(!x)throw new Error(v+" is not a valid compression method !");return x}(h.options.compression,l.compression),p=h.options.compressionOptions||l.compressionOptions||{},m=h.dir,g=h.date;h._compressWorker(A,p).withStreamInfo("file",{name:f,dir:m,date:g,comment:h.comment||"",unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions}).pipe(u)}),u.entriesCount=d}catch(f){u.error(f)}return u}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,i){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new s;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(o,a){return new s().loadAsync(o,a)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,i){var s=n("./utils"),o=n("./external"),a=n("./utf8"),l=n("./zipEntries"),c=n("./stream/Crc32Probe"),u=n("./nodejsUtils");function d(f){return new o.Promise(function(h,A){var p=f.decompressed.getContentWorker().pipe(new c);p.on("error",function(m){A(m)}).on("end",function(){p.streamInfo.crc32!==f.decompressed.crc32?A(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}r.exports=function(f,h){var A=this;return h=s.extend(h||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),u.isNode&&u.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",f,!0,h.optimizedBinaryString,h.base64).then(function(p){var m=new l(h);return m.load(p),m}).then(function(p){var m=[o.Promise.resolve(p)],g=p.files;if(h.checkCRC32)for(var y=0;y<g.length;y++)m.push(d(g[y]));return o.Promise.all(m)}).then(function(p){for(var m=p.shift(),g=m.files,y=0;y<g.length;y++){var w=g[y],v=w.fileNameStr,x=s.resolve(w.fileNameStr);A.file(x,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:h.createFolders}),w.dir||(A.file(x).unsafeOriginalName=v)}return m.zipComment.length&&(A.comment=m.zipComment),A})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,i){var s=n("../utils"),o=n("../stream/GenericWorker");function a(l,c){o.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}s.inherits(a,o),a.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(u){c.push({data:u,meta:{percent:0}})}).on("error",function(u){c.isPaused?this.generatedError=u:c.error(u)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},a.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,i){var s=n("readable-stream").Readable;function o(a,l,c){s.call(this,l),this._helper=a;var u=this;a.on("data",function(d,f){u.push(d)||u._helper.pause(),c&&c(f)}).on("error",function(d){u.emit("error",d)}).on("end",function(){u.push(null)})}n("../utils").inherits(o,s),o.prototype._read=function(){this._helper.resume()},r.exports=o},{"../utils":32,"readable-stream":16}],14:[function(n,r,i){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,o);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,o)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var o=new Buffer(s);return o.fill(0),o},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,i){function s(x,C,_){var S,E=a.getTypeOf(C),T=a.extend(_||{},u);T.date=T.date||new Date,T.compression!==null&&(T.compression=T.compression.toUpperCase()),typeof T.unixPermissions=="string"&&(T.unixPermissions=parseInt(T.unixPermissions,8)),T.unixPermissions&&16384&T.unixPermissions&&(T.dir=!0),T.dosPermissions&&16&T.dosPermissions&&(T.dir=!0),T.dir&&(x=g(x)),T.createFolders&&(S=m(x))&&y.call(this,S,!0);var R=E==="string"&&T.binary===!1&&T.base64===!1;_&&_.binary!==void 0||(T.binary=!R),(C instanceof d&&C.uncompressedSize===0||T.dir||!C||C.length===0)&&(T.base64=!1,T.binary=!0,C="",T.compression="STORE",E="string");var k=null;k=C instanceof d||C instanceof l?C:A.isNode&&A.isStream(C)?new p(x,C):a.prepareContent(x,C,T.binary,T.optimizedBinaryString,T.base64);var B=new f(x,k,T);this.files[x]=B}var o=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),c=n("./stream/StreamHelper"),u=n("./defaults"),d=n("./compressedObject"),f=n("./zipObject"),h=n("./generate"),A=n("./nodejsUtils"),p=n("./nodejs/NodejsStreamInputAdapter"),m=function(x){x.slice(-1)==="/"&&(x=x.substring(0,x.length-1));var C=x.lastIndexOf("/");return 0<C?x.substring(0,C):""},g=function(x){return x.slice(-1)!=="/"&&(x+="/"),x},y=function(x,C){return C=C!==void 0?C:u.createFolders,x=g(x),this.files[x]||s.call(this,x,null,{dir:!0,createFolders:C}),this.files[x]};function w(x){return Object.prototype.toString.call(x)==="[object RegExp]"}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(x){var C,_,S;for(C in this.files)S=this.files[C],(_=C.slice(this.root.length,C.length))&&C.slice(0,this.root.length)===this.root&&x(_,S)},filter:function(x){var C=[];return this.forEach(function(_,S){x(_,S)&&C.push(S)}),C},file:function(x,C,_){if(arguments.length!==1)return x=this.root+x,s.call(this,x,C,_),this;if(w(x)){var S=x;return this.filter(function(T,R){return!R.dir&&S.test(T)})}var E=this.files[this.root+x];return E&&!E.dir?E:null},folder:function(x){if(!x)return this;if(w(x))return this.filter(function(E,T){return T.dir&&x.test(E)});var C=this.root+x,_=y.call(this,C),S=this.clone();return S.root=_.name,S},remove:function(x){x=this.root+x;var C=this.files[x];if(C||(x.slice(-1)!=="/"&&(x+="/"),C=this.files[x]),C&&!C.dir)delete this.files[x];else for(var _=this.filter(function(E,T){return T.name.slice(0,x.length)===x}),S=0;S<_.length;S++)delete this.files[_[S].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(x){var C,_={};try{if((_=a.extend(x||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=_.type.toLowerCase(),_.compression=_.compression.toUpperCase(),_.type==="binarystring"&&(_.type="string"),!_.type)throw new Error("No output type specified.");a.checkSupport(_.type),_.platform!=="darwin"&&_.platform!=="freebsd"&&_.platform!=="linux"&&_.platform!=="sunos"||(_.platform="UNIX"),_.platform==="win32"&&(_.platform="DOS");var S=_.comment||this.comment||"";C=h.generateWorker(this,_,S)}catch(E){(C=new l("error")).error(E)}return new c(C,_.type||"string",_.mimeType)},generateAsync:function(x,C){return this.generateInternalStream(x).accumulate(C)},generateNodeStream:function(x,C){return(x=x||{}).type||(x.type="nodebuffer"),this.generateInternalStream(x).toNodejsStream(C)}};r.exports=v},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,i){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,i){var s=n("./DataReader");function o(a){s.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data[this.zero+a]},o.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),c=a.charCodeAt(1),u=a.charCodeAt(2),d=a.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===l&&this.data[f+1]===c&&this.data[f+2]===u&&this.data[f+3]===d)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),u=a.charCodeAt(2),d=a.charCodeAt(3),f=this.readData(4);return l===f[0]&&c===f[1]&&u===f[2]&&d===f[3]},o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./DataReader":18}],18:[function(n,r,i){var s=n("../utils");function o(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,c=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=o},{"../utils":32}],19:[function(n,r,i){var s=n("./Uint8ArrayReader");function o(a){s.call(this,a)}n("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var s=n("./DataReader");function o(a){s.call(this,a)}n("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var s=n("./ArrayReader");function o(a){s.call(this,a)}n("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var s=n("../utils"),o=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),c=n("./NodeBufferReader"),u=n("./Uint8ArrayReader");r.exports=function(d){var f=s.getTypeOf(d);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new c(d):o.uint8array?new u(s.transformTo("uint8array",d)):new a(s.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var s=n("./GenericWorker"),o=n("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var s=n("./GenericWorker"),o=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var s=n("../utils"),o=n("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}o.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var s=n("../utils"),o=n("./GenericWorker");function a(l){o.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(u){c.dataIsReady=!0,c.data=u,c.max=u&&u.length||0,c.type=s.getTypeOf(u),c.isPaused||c._tickAndRepeat()},function(u){c.error(u)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l<this._listeners[o].length;l++)this._listeners[o][l].call(this,a)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var a=this;return o.on("data",function(l){a.processChunk(l)}),o.on("end",function(){a.end()}),o.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,a){return this.extraStreamInfo[o]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},r.exports=s},{}],29:[function(n,r,i){var s=n("../utils"),o=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),c=n("../support"),u=n("../external"),d=null;if(c.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(A,p){return new u.Promise(function(m,g){var y=[],w=A._internalType,v=A._outputType,x=A._mimeType;A.on("data",function(C,_){y.push(C),p&&p(_)}).on("error",function(C){y=[],g(C)}).on("end",function(){try{var C=function(_,S,E){switch(_){case"blob":return s.newBlob(s.transformTo("arraybuffer",S),E);case"base64":return l.encode(S);default:return s.transformTo(_,S)}}(v,function(_,S){var E,T=0,R=null,k=0;for(E=0;E<S.length;E++)k+=S[E].length;switch(_){case"string":return S.join("");case"array":return Array.prototype.concat.apply([],S);case"uint8array":for(R=new Uint8Array(k),E=0;E<S.length;E++)R.set(S[E],T),T+=S[E].length;return R;case"nodebuffer":return Buffer.concat(S);default:throw new Error("concat : unsupported type '"+_+"'")}}(w,y),x);m(C)}catch(_){g(_)}y=[]}).resume()})}function h(A,p,m){var g=p;switch(p){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=p,this._mimeType=m,s.checkSupport(g),this._worker=A.pipe(new o(g)),A.lock()}catch(y){this._worker=new a("error"),this._worker.error(y)}}h.prototype={accumulate:function(A){return f(this,A)},on:function(A,p){var m=this;return A==="data"?this._worker.on(A,function(g){p.call(m,g.data,g.meta)}):this._worker.on(A,function(){s.delay(p,arguments,m)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(A){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},A)}},r.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var s=n("./utils"),o=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),c=new Array(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;c[254]=c[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}i.utf8encode=function(h){return o.nodebuffer?a.newBufferFrom(h,"utf-8"):function(A){var p,m,g,y,w,v=A.length,x=0;for(y=0;y<v;y++)(64512&(m=A.charCodeAt(y)))==55296&&y+1<v&&(64512&(g=A.charCodeAt(y+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),y++),x+=m<128?1:m<2048?2:m<65536?3:4;for(p=o.uint8array?new Uint8Array(x):new Array(x),y=w=0;w<x;y++)(64512&(m=A.charCodeAt(y)))==55296&&y+1<v&&(64512&(g=A.charCodeAt(y+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),y++),m<128?p[w++]=m:(m<2048?p[w++]=192|m>>>6:(m<65536?p[w++]=224|m>>>12:(p[w++]=240|m>>>18,p[w++]=128|m>>>12&63),p[w++]=128|m>>>6&63),p[w++]=128|63&m);return p}(h)},i.utf8decode=function(h){return o.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(A){var p,m,g,y,w=A.length,v=new Array(2*w);for(p=m=0;p<w;)if((g=A[p++])<128)v[m++]=g;else if(4<(y=c[g]))v[m++]=65533,p+=y-1;else{for(g&=y===2?31:y===3?15:7;1<y&&p<w;)g=g<<6|63&A[p++],y--;1<y?v[m++]=65533:g<65536?v[m++]=g:(g-=65536,v[m++]=55296|g>>10&1023,v[m++]=56320|1023&g)}return v.length!==m&&(v.subarray?v=v.subarray(0,m):v.length=m),s.applyFromCharCode(v)}(h=s.transformTo(o.uint8array?"uint8array":"array",h))},s.inherits(d,l),d.prototype.processChunk=function(h){var A=s.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var p=A;(A=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),A.set(p,this.leftOver.length)}else A=this.leftOver.concat(A);this.leftOver=null}var m=function(y,w){var v;for((w=w||y.length)>y.length&&(w=y.length),v=w-1;0<=v&&(192&y[v])==128;)v--;return v<0||v===0?w:v+c[y[v]]>w?v:w}(A),g=A;m!==A.length&&(o.uint8array?(g=A.subarray(0,m),this.leftOver=A.subarray(m,A.length)):(g=A.slice(0,m),this.leftOver=A.slice(m,A.length))),this.push({data:i.utf8decode(g),meta:h.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=d,s.inherits(f,l),f.prototype.processChunk=function(h){this.push({data:i.utf8encode(h.data),meta:h.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var s=n("./support"),o=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function c(p){return p}function u(p,m){for(var g=0;g<p.length;++g)m[g]=255&p.charCodeAt(g);return m}n("setimmediate"),i.newBlob=function(p,m){i.checkSupport("blob");try{return new Blob([p],{type:m})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(p),g.getBlob(m)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(p,m,g){var y=[],w=0,v=p.length;if(v<=g)return String.fromCharCode.apply(null,p);for(;w<v;)m==="array"||m==="nodebuffer"?y.push(String.fromCharCode.apply(null,p.slice(w,Math.min(w+g,v)))):y.push(String.fromCharCode.apply(null,p.subarray(w,Math.min(w+g,v)))),w+=g;return y.join("")},stringifyByChar:function(p){for(var m="",g=0;g<p.length;g++)m+=String.fromCharCode(p[g]);return m},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function f(p){var m=65536,g=i.getTypeOf(p),y=!0;if(g==="uint8array"?y=d.applyCanBeUsed.uint8array:g==="nodebuffer"&&(y=d.applyCanBeUsed.nodebuffer),y)for(;1<m;)try{return d.stringifyByChunk(p,g,m)}catch{m=Math.floor(m/2)}return d.stringifyByChar(p)}function h(p,m){for(var g=0;g<p.length;g++)m[g]=p[g];return m}i.applyFromCharCode=f;var A={};A.string={string:c,array:function(p){return u(p,new Array(p.length))},arraybuffer:function(p){return A.string.uint8array(p).buffer},uint8array:function(p){return u(p,new Uint8Array(p.length))},nodebuffer:function(p){return u(p,a.allocBuffer(p.length))}},A.array={string:f,array:c,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return a.newBufferFrom(p)}},A.arraybuffer={string:function(p){return f(new Uint8Array(p))},array:function(p){return h(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:c,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return a.newBufferFrom(new Uint8Array(p))}},A.uint8array={string:f,array:function(p){return h(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:c,nodebuffer:function(p){return a.newBufferFrom(p)}},A.nodebuffer={string:f,array:function(p){return h(p,new Array(p.length))},arraybuffer:function(p){return A.nodebuffer.uint8array(p).buffer},uint8array:function(p){return h(p,new Uint8Array(p.length))},nodebuffer:c},i.transformTo=function(p,m){if(m=m||"",!p)return m;i.checkSupport(p);var g=i.getTypeOf(m);return A[g][p](m)},i.resolve=function(p){for(var m=p.split("/"),g=[],y=0;y<m.length;y++){var w=m[y];w==="."||w===""&&y!==0&&y!==m.length-1||(w===".."?g.pop():g.push(w))}return g.join("/")},i.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":s.nodebuffer&&a.isBuffer(p)?"nodebuffer":s.uint8array&&p instanceof Uint8Array?"uint8array":s.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(p){if(!s[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(p){var m,g,y="";for(g=0;g<(p||"").length;g++)y+="\\x"+((m=p.charCodeAt(g))<16?"0":"")+m.toString(16).toUpperCase();return y},i.delay=function(p,m,g){setImmediate(function(){p.apply(g||null,m||[])})},i.inherits=function(p,m){function g(){}g.prototype=m.prototype,p.prototype=new g},i.extend=function(){var p,m,g={};for(p=0;p<arguments.length;p++)for(m in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],m)&&g[m]===void 0&&(g[m]=arguments[p][m]);return g},i.prepareContent=function(p,m,g,y,w){return l.Promise.resolve(m).then(function(v){return s.blob&&(v instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(v))!==-1)&&typeof FileReader<"u"?new l.Promise(function(x,C){var _=new FileReader;_.onload=function(S){x(S.target.result)},_.onerror=function(S){C(S.target.error)},_.readAsArrayBuffer(v)}):v}).then(function(v){var x=i.getTypeOf(v);return x?(x==="arraybuffer"?v=i.transformTo("uint8array",v):x==="string"&&(w?v=o.decode(v):g&&y!==!0&&(v=function(C){return u(C,s.uint8array?new Uint8Array(C.length):new Array(C.length))}(v))),v):l.Promise.reject(new Error("Can't read the data of '"+p+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,i){var s=n("./reader/readerFor"),o=n("./utils"),a=n("./signature"),l=n("./zipEntry"),c=n("./support");function u(d){this.files=[],this.loadOptions=d}u.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(d)+")")}},isSignature:function(d,f){var h=this.reader.index;this.reader.setIndex(d);var A=this.reader.readString(4)===f;return this.reader.setIndex(h),A},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),f=c.uint8array?"uint8array":"array",h=o.transformTo(f,d);this.zipComment=this.loadOptions.decodeFileName(h)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,f,h,A=this.zip64EndOfCentralSize-44;0<A;)d=this.reader.readInt(2),f=this.reader.readInt(4),h=this.reader.readData(f),this.zip64ExtensibleData[d]={id:d,length:f,value:h}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,f;for(d=0;d<this.files.length;d++)f=this.files[d],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var f=d;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var h=this.centralDirOffset+this.centralDirSize;this.zip64&&(h+=20,h+=12+this.zip64EndOfCentralSize);var A=f-h;if(0<A)this.isSignature(f,a.CENTRAL_FILE_HEADER)||(this.reader.zero=A);else if(A<0)throw new Error("Corrupted zip: missing "+Math.abs(A)+" bytes.")},prepareReader:function(d){this.reader=s(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,i){var s=n("./reader/readerFor"),o=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),c=n("./utf8"),u=n("./compressions"),d=n("./support");function f(h,A){this.options=h,this.loadOptions=A}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(h){var A,p;if(h.skip(22),this.fileNameLength=h.readInt(2),p=h.readInt(2),this.fileName=h.readData(this.fileNameLength),h.skip(p),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((A=function(m){for(var g in u)if(Object.prototype.hasOwnProperty.call(u,g)&&u[g].magic===m)return u[g];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,A,h.readData(this.compressedSize))},readCentralPart:function(h){this.versionMadeBy=h.readInt(2),h.skip(2),this.bitFlag=h.readInt(2),this.compressionMethod=h.readString(2),this.date=h.readDate(),this.crc32=h.readInt(4),this.compressedSize=h.readInt(4),this.uncompressedSize=h.readInt(4);var A=h.readInt(2);if(this.extraFieldsLength=h.readInt(2),this.fileCommentLength=h.readInt(2),this.diskNumberStart=h.readInt(2),this.internalFileAttributes=h.readInt(2),this.externalFileAttributes=h.readInt(4),this.localHeaderOffset=h.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");h.skip(A),this.readExtraFields(h),this.parseZIP64ExtraField(h),this.fileComment=h.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var h=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var A,p,m,g=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4<g;)A=h.readInt(2),p=h.readInt(2),m=h.readData(p),this.extraFields[A]={id:A,length:p,value:m};h.setIndex(g)},handleUTF8:function(){var h=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var A=this.findExtraFieldUnicodePath();if(A!==null)this.fileNameStr=A;else{var p=o.transformTo(h,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var g=o.transformTo(h,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var h=this.extraFields[28789];if(h){var A=s(h.value);return A.readInt(1)!==1||l(this.fileName)!==A.readInt(4)?null:c.utf8decode(A.readData(h.length-5))}return null},findExtraFieldUnicodeComment:function(){var h=this.extraFields[25461];if(h){var A=s(h.value);return A.readInt(1)!==1||l(this.fileComment)!==A.readInt(4)?null:c.utf8decode(A.readData(h.length-5))}return null}},r.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,i){function s(A,p,m){this.name=A,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=p,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var o=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),c=n("./compressedObject"),u=n("./stream/GenericWorker");s.prototype={internalStream:function(A){var p=null,m="string";try{if(!A)throw new Error("No output type specified.");var g=(m=A.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),p=this._decompressWorker();var y=!this._dataBinary;y&&!g&&(p=p.pipe(new l.Utf8EncodeWorker)),!y&&g&&(p=p.pipe(new l.Utf8DecodeWorker))}catch(w){(p=new u("error")).error(w)}return new o(p,m,"")},async:function(A,p){return this.internalStream(A).accumulate(p)},nodeStream:function(A,p){return this.internalStream(A||"nodebuffer").toNodejsStream(p)},_compressWorker:function(A,p){if(this._data instanceof c&&this._data.compression.magic===A.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(m,A,p)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof u?this._data:new a(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<d.length;h++)s.prototype[d[h]]=f;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,i){(function(s){var o,a,l=s.MutationObserver||s.WebKitMutationObserver;if(l){var c=0,u=new l(A),d=s.document.createTextNode("");u.observe(d,{characterData:!0}),o=function(){d.data=c=++c%2}}else if(s.setImmediate||s.MessageChannel===void 0)o="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var p=s.document.createElement("script");p.onreadystatechange=function(){A(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},s.document.documentElement.appendChild(p)}:function(){setTimeout(A,0)};else{var f=new s.MessageChannel;f.port1.onmessage=A,o=function(){f.port2.postMessage(0)}}var h=[];function A(){var p,m;a=!0;for(var g=h.length;g;){for(m=h,h=[],p=-1;++p<g;)m[p]();g=h.length}a=!1}r.exports=function(p){h.push(p)!==1||a||o()}}).call(this,typeof en<"u"?en:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,i){var s=n("immediate");function o(){}var a={},l=["REJECTED"],c=["FULFILLED"],u=["PENDING"];function d(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,g!==o&&p(this,g)}function f(g,y,w){this.promise=g,typeof y=="function"&&(this.onFulfilled=y,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function h(g,y,w){s(function(){var v;try{v=y(w)}catch(x){return a.reject(g,x)}v===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,v)})}function A(g){var y=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof y=="function")return function(){y.apply(g,arguments)}}function p(g,y){var w=!1;function v(_){w||(w=!0,a.reject(g,_))}function x(_){w||(w=!0,a.resolve(g,_))}var C=m(function(){y(x,v)});C.status==="error"&&v(C.value)}function m(g,y){var w={};try{w.value=g(y),w.status="success"}catch(v){w.status="error",w.value=v}return w}(r.exports=d).prototype.finally=function(g){if(typeof g!="function")return this;var y=this.constructor;return this.then(function(w){return y.resolve(g()).then(function(){return w})},function(w){return y.resolve(g()).then(function(){throw w})})},d.prototype.catch=function(g){return this.then(null,g)},d.prototype.then=function(g,y){if(typeof g!="function"&&this.state===c||typeof y!="function"&&this.state===l)return this;var w=new this.constructor(o);return this.state!==u?h(w,this.state===c?g:y,this.outcome):this.queue.push(new f(w,g,y)),w},f.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},f.prototype.otherCallFulfilled=function(g){h(this.promise,this.onFulfilled,g)},f.prototype.callRejected=function(g){a.reject(this.promise,g)},f.prototype.otherCallRejected=function(g){h(this.promise,this.onRejected,g)},a.resolve=function(g,y){var w=m(A,y);if(w.status==="error")return a.reject(g,w.value);var v=w.value;if(v)p(g,v);else{g.state=c,g.outcome=y;for(var x=-1,C=g.queue.length;++x<C;)g.queue[x].callFulfilled(y)}return g},a.reject=function(g,y){g.state=l,g.outcome=y;for(var w=-1,v=g.queue.length;++w<v;)g.queue[w].callRejected(y);return g},d.resolve=function(g){return g instanceof this?g:a.resolve(new this(o),g)},d.reject=function(g){var y=new this(o);return a.reject(y,g)},d.all=function(g){var y=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=g.length,v=!1;if(!w)return this.resolve([]);for(var x=new Array(w),C=0,_=-1,S=new this(o);++_<w;)E(g[_],_);return S;function E(T,R){y.resolve(T).then(function(k){x[R]=k,++C!==w||v||(v=!0,a.resolve(S,x))},function(k){v||(v=!0,a.reject(S,k))})}},d.race=function(g){var y=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=g.length,v=!1;if(!w)return this.resolve([]);for(var x=-1,C=new this(o);++x<w;)_=g[x],y.resolve(_).then(function(S){v||(v=!0,a.resolve(C,S))},function(S){v||(v=!0,a.reject(C,S))});var _;return C}},{immediate:36}],38:[function(n,r,i){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,i){var s=n("./zlib/deflate"),o=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),c=n("./zlib/zstream"),u=Object.prototype.toString,d=0,f=-1,h=0,A=8;function p(g){if(!(this instanceof p))return new p(g);this.options=o.assign({level:f,method:A,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},g||{});var y=this.options;y.raw&&0<y.windowBits?y.windowBits=-y.windowBits:y.gzip&&0<y.windowBits&&y.windowBits<16&&(y.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var w=s.deflateInit2(this.strm,y.level,y.method,y.windowBits,y.memLevel,y.strategy);if(w!==d)throw new Error(l[w]);if(y.header&&s.deflateSetHeader(this.strm,y.header),y.dictionary){var v;if(v=typeof y.dictionary=="string"?a.string2buf(y.dictionary):u.call(y.dictionary)==="[object ArrayBuffer]"?new Uint8Array(y.dictionary):y.dictionary,(w=s.deflateSetDictionary(this.strm,v))!==d)throw new Error(l[w]);this._dict_set=!0}}function m(g,y){var w=new p(y);if(w.push(g,!0),w.err)throw w.msg||l[w.err];return w.result}p.prototype.push=function(g,y){var w,v,x=this.strm,C=this.options.chunkSize;if(this.ended)return!1;v=y===~~y?y:y===!0?4:0,typeof g=="string"?x.input=a.string2buf(g):u.call(g)==="[object ArrayBuffer]"?x.input=new Uint8Array(g):x.input=g,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new o.Buf8(C),x.next_out=0,x.avail_out=C),(w=s.deflate(x,v))!==1&&w!==d)return this.onEnd(w),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||v!==4&&v!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(o.shrinkBuf(x.output,x.next_out))):this.onData(o.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&w!==1);return v===4?(w=s.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===d):v!==2||(this.onEnd(d),!(x.avail_out=0))},p.prototype.onData=function(g){this.chunks.push(g)},p.prototype.onEnd=function(g){g===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},i.Deflate=p,i.deflate=m,i.deflateRaw=function(g,y){return(y=y||{}).raw=!0,m(g,y)},i.gzip=function(g,y){return(y=y||{}).gzip=!0,m(g,y)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,i){var s=n("./zlib/inflate"),o=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=n("./zlib/gzheader"),f=Object.prototype.toString;function h(p){if(!(this instanceof h))return new h(p);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},p||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||p&&p.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&!(15&m.windowBits)&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var g=s.inflateInit2(this.strm,m.windowBits);if(g!==l.Z_OK)throw new Error(c[g]);this.header=new d,s.inflateGetHeader(this.strm,this.header)}function A(p,m){var g=new h(m);if(g.push(p,!0),g.err)throw g.msg||c[g.err];return g.result}h.prototype.push=function(p,m){var g,y,w,v,x,C,_=this.strm,S=this.options.chunkSize,E=this.options.dictionary,T=!1;if(this.ended)return!1;y=m===~~m?m:m===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof p=="string"?_.input=a.binstring2buf(p):f.call(p)==="[object ArrayBuffer]"?_.input=new Uint8Array(p):_.input=p,_.next_in=0,_.avail_in=_.input.length;do{if(_.avail_out===0&&(_.output=new o.Buf8(S),_.next_out=0,_.avail_out=S),(g=s.inflate(_,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&E&&(C=typeof E=="string"?a.string2buf(E):f.call(E)==="[object ArrayBuffer]"?new Uint8Array(E):E,g=s.inflateSetDictionary(this.strm,C)),g===l.Z_BUF_ERROR&&T===!0&&(g=l.Z_OK,T=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);_.next_out&&(_.avail_out!==0&&g!==l.Z_STREAM_END&&(_.avail_in!==0||y!==l.Z_FINISH&&y!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=a.utf8border(_.output,_.next_out),v=_.next_out-w,x=a.buf2string(_.output,w),_.next_out=v,_.avail_out=S-v,v&&o.arraySet(_.output,_.output,w,v,0),this.onData(x)):this.onData(o.shrinkBuf(_.output,_.next_out)))),_.avail_in===0&&_.avail_out===0&&(T=!0)}while((0<_.avail_in||_.avail_out===0)&&g!==l.Z_STREAM_END);return g===l.Z_STREAM_END&&(y=l.Z_FINISH),y===l.Z_FINISH?(g=s.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===l.Z_OK):y!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(_.avail_out=0))},h.prototype.onData=function(p){this.chunks.push(p)},h.prototype.onEnd=function(p){p===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},i.Inflate=h,i.inflate=A,i.inflateRaw=function(p,m){return(m=m||{}).raw=!0,A(p,m)},i.ungzip=A},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var u=c.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var d in u)u.hasOwnProperty(d)&&(l[d]=u[d])}}return l},i.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var o={arraySet:function(l,c,u,d,f){if(c.subarray&&l.subarray)l.set(c.subarray(u,u+d),f);else for(var h=0;h<d;h++)l[f+h]=c[u+h]},flattenChunks:function(l){var c,u,d,f,h,A;for(c=d=0,u=l.length;c<u;c++)d+=l[c].length;for(A=new Uint8Array(d),c=f=0,u=l.length;c<u;c++)h=l[c],A.set(h,f),f+=h.length;return A}},a={arraySet:function(l,c,u,d,f){for(var h=0;h<d;h++)l[f+h]=c[u+h]},flattenChunks:function(l){return[].concat.apply([],l)}};i.setTyped=function(l){l?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,o)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(s)},{}],42:[function(n,r,i){var s=n("./common"),o=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new s.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function u(d,f){if(f<65537&&(d.subarray&&a||!d.subarray&&o))return String.fromCharCode.apply(null,s.shrinkBuf(d,f));for(var h="",A=0;A<f;A++)h+=String.fromCharCode(d[A]);return h}l[254]=l[254]=1,i.string2buf=function(d){var f,h,A,p,m,g=d.length,y=0;for(p=0;p<g;p++)(64512&(h=d.charCodeAt(p)))==55296&&p+1<g&&(64512&(A=d.charCodeAt(p+1)))==56320&&(h=65536+(h-55296<<10)+(A-56320),p++),y+=h<128?1:h<2048?2:h<65536?3:4;for(f=new s.Buf8(y),p=m=0;m<y;p++)(64512&(h=d.charCodeAt(p)))==55296&&p+1<g&&(64512&(A=d.charCodeAt(p+1)))==56320&&(h=65536+(h-55296<<10)+(A-56320),p++),h<128?f[m++]=h:(h<2048?f[m++]=192|h>>>6:(h<65536?f[m++]=224|h>>>12:(f[m++]=240|h>>>18,f[m++]=128|h>>>12&63),f[m++]=128|h>>>6&63),f[m++]=128|63&h);return f},i.buf2binstring=function(d){return u(d,d.length)},i.binstring2buf=function(d){for(var f=new s.Buf8(d.length),h=0,A=f.length;h<A;h++)f[h]=d.charCodeAt(h);return f},i.buf2string=function(d,f){var h,A,p,m,g=f||d.length,y=new Array(2*g);for(h=A=0;h<g;)if((p=d[h++])<128)y[A++]=p;else if(4<(m=l[p]))y[A++]=65533,h+=m-1;else{for(p&=m===2?31:m===3?15:7;1<m&&h<g;)p=p<<6|63&d[h++],m--;1<m?y[A++]=65533:p<65536?y[A++]=p:(p-=65536,y[A++]=55296|p>>10&1023,y[A++]=56320|1023&p)}return u(y,A)},i.utf8border=function(d,f){var h;for((f=f||d.length)>d.length&&(f=d.length),h=f-1;0<=h&&(192&d[h])==128;)h--;return h<0||h===0?f:h+l[d[h]]>f?h:f}},{"./common":41}],43:[function(n,r,i){r.exports=function(s,o,a,l){for(var c=65535&s|0,u=s>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;u=u+(c=c+o[l++]|0)|0,--d;);c%=65521,u%=65521}return c|u<<16|0}},{}],44:[function(n,r,i){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,i){var s=function(){for(var o,a=[],l=0;l<256;l++){o=l;for(var c=0;c<8;c++)o=1&o?3988292384^o>>>1:o>>>1;a[l]=o}return a}();r.exports=function(o,a,l,c){var u=s,d=c+l;o^=-1;for(var f=c;f<d;f++)o=o>>>8^u[255&(o^a[f])];return-1^o}},{}],46:[function(n,r,i){var s,o=n("../utils/common"),a=n("./trees"),l=n("./adler32"),c=n("./crc32"),u=n("./messages"),d=0,f=4,h=0,A=-2,p=-1,m=4,g=2,y=8,w=9,v=286,x=30,C=19,_=2*v+1,S=15,E=3,T=258,R=T+E+1,k=42,B=113,M=1,F=2,I=3,z=4;function Y(O,ve){return O.msg=u[ve],ve}function $(O){return(O<<1)-(4<O?9:0)}function ee(O){for(var ve=O.length;0<=--ve;)O[ve]=0}function W(O){var ve=O.state,Ae=ve.pending;Ae>O.avail_out&&(Ae=O.avail_out),Ae!==0&&(o.arraySet(O.output,ve.pending_buf,ve.pending_out,Ae,O.next_out),O.next_out+=Ae,ve.pending_out+=Ae,O.total_out+=Ae,O.avail_out-=Ae,ve.pending-=Ae,ve.pending===0&&(ve.pending_out=0))}function ne(O,ve){a._tr_flush_block(O,0<=O.block_start?O.block_start:-1,O.strstart-O.block_start,ve),O.block_start=O.strstart,W(O.strm)}function Se(O,ve){O.pending_buf[O.pending++]=ve}function fe(O,ve){O.pending_buf[O.pending++]=ve>>>8&255,O.pending_buf[O.pending++]=255&ve}function ge(O,ve){var Ae,ae,Z=O.max_chain_length,pe=O.strstart,J=O.prev_length,H=O.nice_match,oe=O.strstart>O.w_size-R?O.strstart-(O.w_size-R):0,we=O.window,Ee=O.w_mask,re=O.prev,ce=O.strstart+T,le=we[pe+J-1],me=we[pe+J];O.prev_length>=O.good_match&&(Z>>=2),H>O.lookahead&&(H=O.lookahead);do if(we[(Ae=ve)+J]===me&&we[Ae+J-1]===le&&we[Ae]===we[pe]&&we[++Ae]===we[pe+1]){pe+=2,Ae++;do;while(we[++pe]===we[++Ae]&&we[++pe]===we[++Ae]&&we[++pe]===we[++Ae]&&we[++pe]===we[++Ae]&&we[++pe]===we[++Ae]&&we[++pe]===we[++Ae]&&we[++pe]===we[++Ae]&&we[++pe]===we[++Ae]&&pe<ce);if(ae=T-(ce-pe),pe=ce-T,J<ae){if(O.match_start=ve,H<=(J=ae))break;le=we[pe+J-1],me=we[pe+J]}}while((ve=re[ve&Ee])>oe&&--Z!=0);return J<=O.lookahead?J:O.lookahead}function Oe(O){var ve,Ae,ae,Z,pe,J,H,oe,we,Ee,re=O.w_size;do{if(Z=O.window_size-O.lookahead-O.strstart,O.strstart>=re+(re-R)){for(o.arraySet(O.window,O.window,re,re,0),O.match_start-=re,O.strstart-=re,O.block_start-=re,ve=Ae=O.hash_size;ae=O.head[--ve],O.head[ve]=re<=ae?ae-re:0,--Ae;);for(ve=Ae=re;ae=O.prev[--ve],O.prev[ve]=re<=ae?ae-re:0,--Ae;);Z+=re}if(O.strm.avail_in===0)break;if(J=O.strm,H=O.window,oe=O.strstart+O.lookahead,we=Z,Ee=void 0,Ee=J.avail_in,we<Ee&&(Ee=we),Ae=Ee===0?0:(J.avail_in-=Ee,o.arraySet(H,J.input,J.next_in,Ee,oe),J.state.wrap===1?J.adler=l(J.adler,H,Ee,oe):J.state.wrap===2&&(J.adler=c(J.adler,H,Ee,oe)),J.next_in+=Ee,J.total_in+=Ee,Ee),O.lookahead+=Ae,O.lookahead+O.insert>=E)for(pe=O.strstart-O.insert,O.ins_h=O.window[pe],O.ins_h=(O.ins_h<<O.hash_shift^O.window[pe+1])&O.hash_mask;O.insert&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[pe+E-1])&O.hash_mask,O.prev[pe&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=pe,pe++,O.insert--,!(O.lookahead+O.insert<E)););}while(O.lookahead<R&&O.strm.avail_in!==0)}function Fe(O,ve){for(var Ae,ae;;){if(O.lookahead<R){if(Oe(O),O.lookahead<R&&ve===d)return M;if(O.lookahead===0)break}if(Ae=0,O.lookahead>=E&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,Ae=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),Ae!==0&&O.strstart-Ae<=O.w_size-R&&(O.match_length=ge(O,Ae)),O.match_length>=E)if(ae=a._tr_tally(O,O.strstart-O.match_start,O.match_length-E),O.lookahead-=O.match_length,O.match_length<=O.max_lazy_match&&O.lookahead>=E){for(O.match_length--;O.strstart++,O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,Ae=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart,--O.match_length!=0;);O.strstart++}else O.strstart+=O.match_length,O.match_length=0,O.ins_h=O.window[O.strstart],O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+1])&O.hash_mask;else ae=a._tr_tally(O,0,O.window[O.strstart]),O.lookahead--,O.strstart++;if(ae&&(ne(O,!1),O.strm.avail_out===0))return M}return O.insert=O.strstart<E-1?O.strstart:E-1,ve===f?(ne(O,!0),O.strm.avail_out===0?I:z):O.last_lit&&(ne(O,!1),O.strm.avail_out===0)?M:F}function De(O,ve){for(var Ae,ae,Z;;){if(O.lookahead<R){if(Oe(O),O.lookahead<R&&ve===d)return M;if(O.lookahead===0)break}if(Ae=0,O.lookahead>=E&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,Ae=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),O.prev_length=O.match_length,O.prev_match=O.match_start,O.match_length=E-1,Ae!==0&&O.prev_length<O.max_lazy_match&&O.strstart-Ae<=O.w_size-R&&(O.match_length=ge(O,Ae),O.match_length<=5&&(O.strategy===1||O.match_length===E&&4096<O.strstart-O.match_start)&&(O.match_length=E-1)),O.prev_length>=E&&O.match_length<=O.prev_length){for(Z=O.strstart+O.lookahead-E,ae=a._tr_tally(O,O.strstart-1-O.prev_match,O.prev_length-E),O.lookahead-=O.prev_length-1,O.prev_length-=2;++O.strstart<=Z&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+E-1])&O.hash_mask,Ae=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),--O.prev_length!=0;);if(O.match_available=0,O.match_length=E-1,O.strstart++,ae&&(ne(O,!1),O.strm.avail_out===0))return M}else if(O.match_available){if((ae=a._tr_tally(O,0,O.window[O.strstart-1]))&&ne(O,!1),O.strstart++,O.lookahead--,O.strm.avail_out===0)return M}else O.match_available=1,O.strstart++,O.lookahead--}return O.match_available&&(ae=a._tr_tally(O,0,O.window[O.strstart-1]),O.match_available=0),O.insert=O.strstart<E-1?O.strstart:E-1,ve===f?(ne(O,!0),O.strm.avail_out===0?I:z):O.last_lit&&(ne(O,!1),O.strm.avail_out===0)?M:F}function ke(O,ve,Ae,ae,Z){this.good_length=O,this.max_lazy=ve,this.nice_length=Ae,this.max_chain=ae,this.func=Z}function Ge(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*_),this.dyn_dtree=new o.Buf16(2*(2*x+1)),this.bl_tree=new o.Buf16(2*(2*C+1)),ee(this.dyn_ltree),ee(this.dyn_dtree),ee(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(S+1),this.heap=new o.Buf16(2*v+1),ee(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*v+1),ee(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ve(O){var ve;return O&&O.state?(O.total_in=O.total_out=0,O.data_type=g,(ve=O.state).pending=0,ve.pending_out=0,ve.wrap<0&&(ve.wrap=-ve.wrap),ve.status=ve.wrap?k:B,O.adler=ve.wrap===2?0:1,ve.last_flush=d,a._tr_init(ve),h):Y(O,A)}function q(O){var ve=Ve(O);return ve===h&&function(Ae){Ae.window_size=2*Ae.w_size,ee(Ae.head),Ae.max_lazy_match=s[Ae.level].max_lazy,Ae.good_match=s[Ae.level].good_length,Ae.nice_match=s[Ae.level].nice_length,Ae.max_chain_length=s[Ae.level].max_chain,Ae.strstart=0,Ae.block_start=0,Ae.lookahead=0,Ae.insert=0,Ae.match_length=Ae.prev_length=E-1,Ae.match_available=0,Ae.ins_h=0}(O.state),ve}function Ue(O,ve,Ae,ae,Z,pe){if(!O)return A;var J=1;if(ve===p&&(ve=6),ae<0?(J=0,ae=-ae):15<ae&&(J=2,ae-=16),Z<1||w<Z||Ae!==y||ae<8||15<ae||ve<0||9<ve||pe<0||m<pe)return Y(O,A);ae===8&&(ae=9);var H=new Ge;return(O.state=H).strm=O,H.wrap=J,H.gzhead=null,H.w_bits=ae,H.w_size=1<<H.w_bits,H.w_mask=H.w_size-1,H.hash_bits=Z+7,H.hash_size=1<<H.hash_bits,H.hash_mask=H.hash_size-1,H.hash_shift=~~((H.hash_bits+E-1)/E),H.window=new o.Buf8(2*H.w_size),H.head=new o.Buf16(H.hash_size),H.prev=new o.Buf16(H.w_size),H.lit_bufsize=1<<Z+6,H.pending_buf_size=4*H.lit_bufsize,H.pending_buf=new o.Buf8(H.pending_buf_size),H.d_buf=1*H.lit_bufsize,H.l_buf=3*H.lit_bufsize,H.level=ve,H.strategy=pe,H.method=Ae,q(O)}s=[new ke(0,0,0,0,function(O,ve){var Ae=65535;for(Ae>O.pending_buf_size-5&&(Ae=O.pending_buf_size-5);;){if(O.lookahead<=1){if(Oe(O),O.lookahead===0&&ve===d)return M;if(O.lookahead===0)break}O.strstart+=O.lookahead,O.lookahead=0;var ae=O.block_start+Ae;if((O.strstart===0||O.strstart>=ae)&&(O.lookahead=O.strstart-ae,O.strstart=ae,ne(O,!1),O.strm.avail_out===0)||O.strstart-O.block_start>=O.w_size-R&&(ne(O,!1),O.strm.avail_out===0))return M}return O.insert=0,ve===f?(ne(O,!0),O.strm.avail_out===0?I:z):(O.strstart>O.block_start&&(ne(O,!1),O.strm.avail_out),M)}),new ke(4,4,8,4,Fe),new ke(4,5,16,8,Fe),new ke(4,6,32,32,Fe),new ke(4,4,16,16,De),new ke(8,16,32,32,De),new ke(8,16,128,128,De),new ke(8,32,128,256,De),new ke(32,128,258,1024,De),new ke(32,258,258,4096,De)],i.deflateInit=function(O,ve){return Ue(O,ve,y,15,8,0)},i.deflateInit2=Ue,i.deflateReset=q,i.deflateResetKeep=Ve,i.deflateSetHeader=function(O,ve){return O&&O.state?O.state.wrap!==2?A:(O.state.gzhead=ve,h):A},i.deflate=function(O,ve){var Ae,ae,Z,pe;if(!O||!O.state||5<ve||ve<0)return O?Y(O,A):A;if(ae=O.state,!O.output||!O.input&&O.avail_in!==0||ae.status===666&&ve!==f)return Y(O,O.avail_out===0?-5:A);if(ae.strm=O,Ae=ae.last_flush,ae.last_flush=ve,ae.status===k)if(ae.wrap===2)O.adler=0,Se(ae,31),Se(ae,139),Se(ae,8),ae.gzhead?(Se(ae,(ae.gzhead.text?1:0)+(ae.gzhead.hcrc?2:0)+(ae.gzhead.extra?4:0)+(ae.gzhead.name?8:0)+(ae.gzhead.comment?16:0)),Se(ae,255&ae.gzhead.time),Se(ae,ae.gzhead.time>>8&255),Se(ae,ae.gzhead.time>>16&255),Se(ae,ae.gzhead.time>>24&255),Se(ae,ae.level===9?2:2<=ae.strategy||ae.level<2?4:0),Se(ae,255&ae.gzhead.os),ae.gzhead.extra&&ae.gzhead.extra.length&&(Se(ae,255&ae.gzhead.extra.length),Se(ae,ae.gzhead.extra.length>>8&255)),ae.gzhead.hcrc&&(O.adler=c(O.adler,ae.pending_buf,ae.pending,0)),ae.gzindex=0,ae.status=69):(Se(ae,0),Se(ae,0),Se(ae,0),Se(ae,0),Se(ae,0),Se(ae,ae.level===9?2:2<=ae.strategy||ae.level<2?4:0),Se(ae,3),ae.status=B);else{var J=y+(ae.w_bits-8<<4)<<8;J|=(2<=ae.strategy||ae.level<2?0:ae.level<6?1:ae.level===6?2:3)<<6,ae.strstart!==0&&(J|=32),J+=31-J%31,ae.status=B,fe(ae,J),ae.strstart!==0&&(fe(ae,O.adler>>>16),fe(ae,65535&O.adler)),O.adler=1}if(ae.status===69)if(ae.gzhead.extra){for(Z=ae.pending;ae.gzindex<(65535&ae.gzhead.extra.length)&&(ae.pending!==ae.pending_buf_size||(ae.gzhead.hcrc&&ae.pending>Z&&(O.adler=c(O.adler,ae.pending_buf,ae.pending-Z,Z)),W(O),Z=ae.pending,ae.pending!==ae.pending_buf_size));)Se(ae,255&ae.gzhead.extra[ae.gzindex]),ae.gzindex++;ae.gzhead.hcrc&&ae.pending>Z&&(O.adler=c(O.adler,ae.pending_buf,ae.pending-Z,Z)),ae.gzindex===ae.gzhead.extra.length&&(ae.gzindex=0,ae.status=73)}else ae.status=73;if(ae.status===73)if(ae.gzhead.name){Z=ae.pending;do{if(ae.pending===ae.pending_buf_size&&(ae.gzhead.hcrc&&ae.pending>Z&&(O.adler=c(O.adler,ae.pending_buf,ae.pending-Z,Z)),W(O),Z=ae.pending,ae.pending===ae.pending_buf_size)){pe=1;break}pe=ae.gzindex<ae.gzhead.name.length?255&ae.gzhead.name.charCodeAt(ae.gzindex++):0,Se(ae,pe)}while(pe!==0);ae.gzhead.hcrc&&ae.pending>Z&&(O.adler=c(O.adler,ae.pending_buf,ae.pending-Z,Z)),pe===0&&(ae.gzindex=0,ae.status=91)}else ae.status=91;if(ae.status===91)if(ae.gzhead.comment){Z=ae.pending;do{if(ae.pending===ae.pending_buf_size&&(ae.gzhead.hcrc&&ae.pending>Z&&(O.adler=c(O.adler,ae.pending_buf,ae.pending-Z,Z)),W(O),Z=ae.pending,ae.pending===ae.pending_buf_size)){pe=1;break}pe=ae.gzindex<ae.gzhead.comment.length?255&ae.gzhead.comment.charCodeAt(ae.gzindex++):0,Se(ae,pe)}while(pe!==0);ae.gzhead.hcrc&&ae.pending>Z&&(O.adler=c(O.adler,ae.pending_buf,ae.pending-Z,Z)),pe===0&&(ae.status=103)}else ae.status=103;if(ae.status===103&&(ae.gzhead.hcrc?(ae.pending+2>ae.pending_buf_size&&W(O),ae.pending+2<=ae.pending_buf_size&&(Se(ae,255&O.adler),Se(ae,O.adler>>8&255),O.adler=0,ae.status=B)):ae.status=B),ae.pending!==0){if(W(O),O.avail_out===0)return ae.last_flush=-1,h}else if(O.avail_in===0&&$(ve)<=$(Ae)&&ve!==f)return Y(O,-5);if(ae.status===666&&O.avail_in!==0)return Y(O,-5);if(O.avail_in!==0||ae.lookahead!==0||ve!==d&&ae.status!==666){var H=ae.strategy===2?function(oe,we){for(var Ee;;){if(oe.lookahead===0&&(Oe(oe),oe.lookahead===0)){if(we===d)return M;break}if(oe.match_length=0,Ee=a._tr_tally(oe,0,oe.window[oe.strstart]),oe.lookahead--,oe.strstart++,Ee&&(ne(oe,!1),oe.strm.avail_out===0))return M}return oe.insert=0,we===f?(ne(oe,!0),oe.strm.avail_out===0?I:z):oe.last_lit&&(ne(oe,!1),oe.strm.avail_out===0)?M:F}(ae,ve):ae.strategy===3?function(oe,we){for(var Ee,re,ce,le,me=oe.window;;){if(oe.lookahead<=T){if(Oe(oe),oe.lookahead<=T&&we===d)return M;if(oe.lookahead===0)break}if(oe.match_length=0,oe.lookahead>=E&&0<oe.strstart&&(re=me[ce=oe.strstart-1])===me[++ce]&&re===me[++ce]&&re===me[++ce]){le=oe.strstart+T;do;while(re===me[++ce]&&re===me[++ce]&&re===me[++ce]&&re===me[++ce]&&re===me[++ce]&&re===me[++ce]&&re===me[++ce]&&re===me[++ce]&&ce<le);oe.match_length=T-(le-ce),oe.match_length>oe.lookahead&&(oe.match_length=oe.lookahead)}if(oe.match_length>=E?(Ee=a._tr_tally(oe,1,oe.match_length-E),oe.lookahead-=oe.match_length,oe.strstart+=oe.match_length,oe.match_length=0):(Ee=a._tr_tally(oe,0,oe.window[oe.strstart]),oe.lookahead--,oe.strstart++),Ee&&(ne(oe,!1),oe.strm.avail_out===0))return M}return oe.insert=0,we===f?(ne(oe,!0),oe.strm.avail_out===0?I:z):oe.last_lit&&(ne(oe,!1),oe.strm.avail_out===0)?M:F}(ae,ve):s[ae.level].func(ae,ve);if(H!==I&&H!==z||(ae.status=666),H===M||H===I)return O.avail_out===0&&(ae.last_flush=-1),h;if(H===F&&(ve===1?a._tr_align(ae):ve!==5&&(a._tr_stored_block(ae,0,0,!1),ve===3&&(ee(ae.head),ae.lookahead===0&&(ae.strstart=0,ae.block_start=0,ae.insert=0))),W(O),O.avail_out===0))return ae.last_flush=-1,h}return ve!==f?h:ae.wrap<=0?1:(ae.wrap===2?(Se(ae,255&O.adler),Se(ae,O.adler>>8&255),Se(ae,O.adler>>16&255),Se(ae,O.adler>>24&255),Se(ae,255&O.total_in),Se(ae,O.total_in>>8&255),Se(ae,O.total_in>>16&255),Se(ae,O.total_in>>24&255)):(fe(ae,O.adler>>>16),fe(ae,65535&O.adler)),W(O),0<ae.wrap&&(ae.wrap=-ae.wrap),ae.pending!==0?h:1)},i.deflateEnd=function(O){var ve;return O&&O.state?(ve=O.state.status)!==k&&ve!==69&&ve!==73&&ve!==91&&ve!==103&&ve!==B&&ve!==666?Y(O,A):(O.state=null,ve===B?Y(O,-3):h):A},i.deflateSetDictionary=function(O,ve){var Ae,ae,Z,pe,J,H,oe,we,Ee=ve.length;if(!O||!O.state||(pe=(Ae=O.state).wrap)===2||pe===1&&Ae.status!==k||Ae.lookahead)return A;for(pe===1&&(O.adler=l(O.adler,ve,Ee,0)),Ae.wrap=0,Ee>=Ae.w_size&&(pe===0&&(ee(Ae.head),Ae.strstart=0,Ae.block_start=0,Ae.insert=0),we=new o.Buf8(Ae.w_size),o.arraySet(we,ve,Ee-Ae.w_size,Ae.w_size,0),ve=we,Ee=Ae.w_size),J=O.avail_in,H=O.next_in,oe=O.input,O.avail_in=Ee,O.next_in=0,O.input=ve,Oe(Ae);Ae.lookahead>=E;){for(ae=Ae.strstart,Z=Ae.lookahead-(E-1);Ae.ins_h=(Ae.ins_h<<Ae.hash_shift^Ae.window[ae+E-1])&Ae.hash_mask,Ae.prev[ae&Ae.w_mask]=Ae.head[Ae.ins_h],Ae.head[Ae.ins_h]=ae,ae++,--Z;);Ae.strstart=ae,Ae.lookahead=E-1,Oe(Ae)}return Ae.strstart+=Ae.lookahead,Ae.block_start=Ae.strstart,Ae.insert=Ae.lookahead,Ae.lookahead=0,Ae.match_length=Ae.prev_length=E-1,Ae.match_available=0,O.next_in=H,O.input=oe,O.avail_in=J,Ae.wrap=pe,h},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,i){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,i){r.exports=function(s,o){var a,l,c,u,d,f,h,A,p,m,g,y,w,v,x,C,_,S,E,T,R,k,B,M,F;a=s.state,l=s.next_in,M=s.input,c=l+(s.avail_in-5),u=s.next_out,F=s.output,d=u-(o-s.avail_out),f=u+(s.avail_out-257),h=a.dmax,A=a.wsize,p=a.whave,m=a.wnext,g=a.window,y=a.hold,w=a.bits,v=a.lencode,x=a.distcode,C=(1<<a.lenbits)-1,_=(1<<a.distbits)-1;e:do{w<15&&(y+=M[l++]<<w,w+=8,y+=M[l++]<<w,w+=8),S=v[y&C];t:for(;;){if(y>>>=E=S>>>24,w-=E,(E=S>>>16&255)===0)F[u++]=65535&S;else{if(!(16&E)){if(!(64&E)){S=v[(65535&S)+(y&(1<<E)-1)];continue t}if(32&E){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}T=65535&S,(E&=15)&&(w<E&&(y+=M[l++]<<w,w+=8),T+=y&(1<<E)-1,y>>>=E,w-=E),w<15&&(y+=M[l++]<<w,w+=8,y+=M[l++]<<w,w+=8),S=x[y&_];n:for(;;){if(y>>>=E=S>>>24,w-=E,!(16&(E=S>>>16&255))){if(!(64&E)){S=x[(65535&S)+(y&(1<<E)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if(R=65535&S,w<(E&=15)&&(y+=M[l++]<<w,(w+=8)<E&&(y+=M[l++]<<w,w+=8)),h<(R+=y&(1<<E)-1)){s.msg="invalid distance too far back",a.mode=30;break e}if(y>>>=E,w-=E,(E=u-d)<R){if(p<(E=R-E)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(B=g,(k=0)===m){if(k+=A-E,E<T){for(T-=E;F[u++]=g[k++],--E;);k=u-R,B=F}}else if(m<E){if(k+=A+m-E,(E-=m)<T){for(T-=E;F[u++]=g[k++],--E;);if(k=0,m<T){for(T-=E=m;F[u++]=g[k++],--E;);k=u-R,B=F}}}else if(k+=m-E,E<T){for(T-=E;F[u++]=g[k++],--E;);k=u-R,B=F}for(;2<T;)F[u++]=B[k++],F[u++]=B[k++],F[u++]=B[k++],T-=3;T&&(F[u++]=B[k++],1<T&&(F[u++]=B[k++]))}else{for(k=u-R;F[u++]=F[k++],F[u++]=F[k++],F[u++]=F[k++],2<(T-=3););T&&(F[u++]=F[k++],1<T&&(F[u++]=F[k++]))}break}}break}}while(l<c&&u<f);l-=T=w>>3,y&=(1<<(w-=T<<3))-1,s.next_in=l,s.next_out=u,s.avail_in=l<c?c-l+5:5-(l-c),s.avail_out=u<f?f-u+257:257-(u-f),a.hold=y,a.bits=w}},{}],49:[function(n,r,i){var s=n("../utils/common"),o=n("./adler32"),a=n("./crc32"),l=n("./inffast"),c=n("./inftrees"),u=1,d=2,f=0,h=-2,A=1,p=852,m=592;function g(k){return(k>>>24&255)+(k>>>8&65280)+((65280&k)<<8)+((255&k)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(k){var B;return k&&k.state?(B=k.state,k.total_in=k.total_out=B.total=0,k.msg="",B.wrap&&(k.adler=1&B.wrap),B.mode=A,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new s.Buf32(p),B.distcode=B.distdyn=new s.Buf32(m),B.sane=1,B.back=-1,f):h}function v(k){var B;return k&&k.state?((B=k.state).wsize=0,B.whave=0,B.wnext=0,w(k)):h}function x(k,B){var M,F;return k&&k.state?(F=k.state,B<0?(M=0,B=-B):(M=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15<B)?h:(F.window!==null&&F.wbits!==B&&(F.window=null),F.wrap=M,F.wbits=B,v(k))):h}function C(k,B){var M,F;return k?(F=new y,(k.state=F).window=null,(M=x(k,B))!==f&&(k.state=null),M):h}var _,S,E=!0;function T(k){if(E){var B;for(_=new s.Buf32(512),S=new s.Buf32(32),B=0;B<144;)k.lens[B++]=8;for(;B<256;)k.lens[B++]=9;for(;B<280;)k.lens[B++]=7;for(;B<288;)k.lens[B++]=8;for(c(u,k.lens,0,288,_,0,k.work,{bits:9}),B=0;B<32;)k.lens[B++]=5;c(d,k.lens,0,32,S,0,k.work,{bits:5}),E=!1}k.lencode=_,k.lenbits=9,k.distcode=S,k.distbits=5}function R(k,B,M,F){var I,z=k.state;return z.window===null&&(z.wsize=1<<z.wbits,z.wnext=0,z.whave=0,z.window=new s.Buf8(z.wsize)),F>=z.wsize?(s.arraySet(z.window,B,M-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(F<(I=z.wsize-z.wnext)&&(I=F),s.arraySet(z.window,B,M-F,I,z.wnext),(F-=I)?(s.arraySet(z.window,B,M-F,F,0),z.wnext=F,z.whave=z.wsize):(z.wnext+=I,z.wnext===z.wsize&&(z.wnext=0),z.whave<z.wsize&&(z.whave+=I))),0}i.inflateReset=v,i.inflateReset2=x,i.inflateResetKeep=w,i.inflateInit=function(k){return C(k,15)},i.inflateInit2=C,i.inflate=function(k,B){var M,F,I,z,Y,$,ee,W,ne,Se,fe,ge,Oe,Fe,De,ke,Ge,Ve,q,Ue,O,ve,Ae,ae,Z=0,pe=new s.Buf8(4),J=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!k||!k.state||!k.output||!k.input&&k.avail_in!==0)return h;(M=k.state).mode===12&&(M.mode=13),Y=k.next_out,I=k.output,ee=k.avail_out,z=k.next_in,F=k.input,$=k.avail_in,W=M.hold,ne=M.bits,Se=$,fe=ee,ve=f;e:for(;;)switch(M.mode){case A:if(M.wrap===0){M.mode=13;break}for(;ne<16;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}if(2&M.wrap&&W===35615){pe[M.check=0]=255&W,pe[1]=W>>>8&255,M.check=a(M.check,pe,2,0),ne=W=0,M.mode=2;break}if(M.flags=0,M.head&&(M.head.done=!1),!(1&M.wrap)||(((255&W)<<8)+(W>>8))%31){k.msg="incorrect header check",M.mode=30;break}if((15&W)!=8){k.msg="unknown compression method",M.mode=30;break}if(ne-=4,O=8+(15&(W>>>=4)),M.wbits===0)M.wbits=O;else if(O>M.wbits){k.msg="invalid window size",M.mode=30;break}M.dmax=1<<O,k.adler=M.check=1,M.mode=512&W?10:12,ne=W=0;break;case 2:for(;ne<16;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}if(M.flags=W,(255&M.flags)!=8){k.msg="unknown compression method",M.mode=30;break}if(57344&M.flags){k.msg="unknown header flags set",M.mode=30;break}M.head&&(M.head.text=W>>8&1),512&M.flags&&(pe[0]=255&W,pe[1]=W>>>8&255,M.check=a(M.check,pe,2,0)),ne=W=0,M.mode=3;case 3:for(;ne<32;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}M.head&&(M.head.time=W),512&M.flags&&(pe[0]=255&W,pe[1]=W>>>8&255,pe[2]=W>>>16&255,pe[3]=W>>>24&255,M.check=a(M.check,pe,4,0)),ne=W=0,M.mode=4;case 4:for(;ne<16;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}M.head&&(M.head.xflags=255&W,M.head.os=W>>8),512&M.flags&&(pe[0]=255&W,pe[1]=W>>>8&255,M.check=a(M.check,pe,2,0)),ne=W=0,M.mode=5;case 5:if(1024&M.flags){for(;ne<16;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}M.length=W,M.head&&(M.head.extra_len=W),512&M.flags&&(pe[0]=255&W,pe[1]=W>>>8&255,M.check=a(M.check,pe,2,0)),ne=W=0}else M.head&&(M.head.extra=null);M.mode=6;case 6:if(1024&M.flags&&($<(ge=M.length)&&(ge=$),ge&&(M.head&&(O=M.head.extra_len-M.length,M.head.extra||(M.head.extra=new Array(M.head.extra_len)),s.arraySet(M.head.extra,F,z,ge,O)),512&M.flags&&(M.check=a(M.check,F,ge,z)),$-=ge,z+=ge,M.length-=ge),M.length))break e;M.length=0,M.mode=7;case 7:if(2048&M.flags){if($===0)break e;for(ge=0;O=F[z+ge++],M.head&&O&&M.length<65536&&(M.head.name+=String.fromCharCode(O)),O&&ge<$;);if(512&M.flags&&(M.check=a(M.check,F,ge,z)),$-=ge,z+=ge,O)break e}else M.head&&(M.head.name=null);M.length=0,M.mode=8;case 8:if(4096&M.flags){if($===0)break e;for(ge=0;O=F[z+ge++],M.head&&O&&M.length<65536&&(M.head.comment+=String.fromCharCode(O)),O&&ge<$;);if(512&M.flags&&(M.check=a(M.check,F,ge,z)),$-=ge,z+=ge,O)break e}else M.head&&(M.head.comment=null);M.mode=9;case 9:if(512&M.flags){for(;ne<16;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}if(W!==(65535&M.check)){k.msg="header crc mismatch",M.mode=30;break}ne=W=0}M.head&&(M.head.hcrc=M.flags>>9&1,M.head.done=!0),k.adler=M.check=0,M.mode=12;break;case 10:for(;ne<32;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}k.adler=M.check=g(W),ne=W=0,M.mode=11;case 11:if(M.havedict===0)return k.next_out=Y,k.avail_out=ee,k.next_in=z,k.avail_in=$,M.hold=W,M.bits=ne,2;k.adler=M.check=1,M.mode=12;case 12:if(B===5||B===6)break e;case 13:if(M.last){W>>>=7&ne,ne-=7&ne,M.mode=27;break}for(;ne<3;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}switch(M.last=1&W,ne-=1,3&(W>>>=1)){case 0:M.mode=14;break;case 1:if(T(M),M.mode=20,B!==6)break;W>>>=2,ne-=2;break e;case 2:M.mode=17;break;case 3:k.msg="invalid block type",M.mode=30}W>>>=2,ne-=2;break;case 14:for(W>>>=7&ne,ne-=7&ne;ne<32;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}if((65535&W)!=(W>>>16^65535)){k.msg="invalid stored block lengths",M.mode=30;break}if(M.length=65535&W,ne=W=0,M.mode=15,B===6)break e;case 15:M.mode=16;case 16:if(ge=M.length){if($<ge&&(ge=$),ee<ge&&(ge=ee),ge===0)break e;s.arraySet(I,F,z,ge,Y),$-=ge,z+=ge,ee-=ge,Y+=ge,M.length-=ge;break}M.mode=12;break;case 17:for(;ne<14;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}if(M.nlen=257+(31&W),W>>>=5,ne-=5,M.ndist=1+(31&W),W>>>=5,ne-=5,M.ncode=4+(15&W),W>>>=4,ne-=4,286<M.nlen||30<M.ndist){k.msg="too many length or distance symbols",M.mode=30;break}M.have=0,M.mode=18;case 18:for(;M.have<M.ncode;){for(;ne<3;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}M.lens[J[M.have++]]=7&W,W>>>=3,ne-=3}for(;M.have<19;)M.lens[J[M.have++]]=0;if(M.lencode=M.lendyn,M.lenbits=7,Ae={bits:M.lenbits},ve=c(0,M.lens,0,19,M.lencode,0,M.work,Ae),M.lenbits=Ae.bits,ve){k.msg="invalid code lengths set",M.mode=30;break}M.have=0,M.mode=19;case 19:for(;M.have<M.nlen+M.ndist;){for(;ke=(Z=M.lencode[W&(1<<M.lenbits)-1])>>>16&255,Ge=65535&Z,!((De=Z>>>24)<=ne);){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}if(Ge<16)W>>>=De,ne-=De,M.lens[M.have++]=Ge;else{if(Ge===16){for(ae=De+2;ne<ae;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}if(W>>>=De,ne-=De,M.have===0){k.msg="invalid bit length repeat",M.mode=30;break}O=M.lens[M.have-1],ge=3+(3&W),W>>>=2,ne-=2}else if(Ge===17){for(ae=De+3;ne<ae;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}ne-=De,O=0,ge=3+(7&(W>>>=De)),W>>>=3,ne-=3}else{for(ae=De+7;ne<ae;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}ne-=De,O=0,ge=11+(127&(W>>>=De)),W>>>=7,ne-=7}if(M.have+ge>M.nlen+M.ndist){k.msg="invalid bit length repeat",M.mode=30;break}for(;ge--;)M.lens[M.have++]=O}}if(M.mode===30)break;if(M.lens[256]===0){k.msg="invalid code -- missing end-of-block",M.mode=30;break}if(M.lenbits=9,Ae={bits:M.lenbits},ve=c(u,M.lens,0,M.nlen,M.lencode,0,M.work,Ae),M.lenbits=Ae.bits,ve){k.msg="invalid literal/lengths set",M.mode=30;break}if(M.distbits=6,M.distcode=M.distdyn,Ae={bits:M.distbits},ve=c(d,M.lens,M.nlen,M.ndist,M.distcode,0,M.work,Ae),M.distbits=Ae.bits,ve){k.msg="invalid distances set",M.mode=30;break}if(M.mode=20,B===6)break e;case 20:M.mode=21;case 21:if(6<=$&&258<=ee){k.next_out=Y,k.avail_out=ee,k.next_in=z,k.avail_in=$,M.hold=W,M.bits=ne,l(k,fe),Y=k.next_out,I=k.output,ee=k.avail_out,z=k.next_in,F=k.input,$=k.avail_in,W=M.hold,ne=M.bits,M.mode===12&&(M.back=-1);break}for(M.back=0;ke=(Z=M.lencode[W&(1<<M.lenbits)-1])>>>16&255,Ge=65535&Z,!((De=Z>>>24)<=ne);){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}if(ke&&!(240&ke)){for(Ve=De,q=ke,Ue=Ge;ke=(Z=M.lencode[Ue+((W&(1<<Ve+q)-1)>>Ve)])>>>16&255,Ge=65535&Z,!(Ve+(De=Z>>>24)<=ne);){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}W>>>=Ve,ne-=Ve,M.back+=Ve}if(W>>>=De,ne-=De,M.back+=De,M.length=Ge,ke===0){M.mode=26;break}if(32&ke){M.back=-1,M.mode=12;break}if(64&ke){k.msg="invalid literal/length code",M.mode=30;break}M.extra=15&ke,M.mode=22;case 22:if(M.extra){for(ae=M.extra;ne<ae;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}M.length+=W&(1<<M.extra)-1,W>>>=M.extra,ne-=M.extra,M.back+=M.extra}M.was=M.length,M.mode=23;case 23:for(;ke=(Z=M.distcode[W&(1<<M.distbits)-1])>>>16&255,Ge=65535&Z,!((De=Z>>>24)<=ne);){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}if(!(240&ke)){for(Ve=De,q=ke,Ue=Ge;ke=(Z=M.distcode[Ue+((W&(1<<Ve+q)-1)>>Ve)])>>>16&255,Ge=65535&Z,!(Ve+(De=Z>>>24)<=ne);){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}W>>>=Ve,ne-=Ve,M.back+=Ve}if(W>>>=De,ne-=De,M.back+=De,64&ke){k.msg="invalid distance code",M.mode=30;break}M.offset=Ge,M.extra=15&ke,M.mode=24;case 24:if(M.extra){for(ae=M.extra;ne<ae;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}M.offset+=W&(1<<M.extra)-1,W>>>=M.extra,ne-=M.extra,M.back+=M.extra}if(M.offset>M.dmax){k.msg="invalid distance too far back",M.mode=30;break}M.mode=25;case 25:if(ee===0)break e;if(ge=fe-ee,M.offset>ge){if((ge=M.offset-ge)>M.whave&&M.sane){k.msg="invalid distance too far back",M.mode=30;break}Oe=ge>M.wnext?(ge-=M.wnext,M.wsize-ge):M.wnext-ge,ge>M.length&&(ge=M.length),Fe=M.window}else Fe=I,Oe=Y-M.offset,ge=M.length;for(ee<ge&&(ge=ee),ee-=ge,M.length-=ge;I[Y++]=Fe[Oe++],--ge;);M.length===0&&(M.mode=21);break;case 26:if(ee===0)break e;I[Y++]=M.length,ee--,M.mode=21;break;case 27:if(M.wrap){for(;ne<32;){if($===0)break e;$--,W|=F[z++]<<ne,ne+=8}if(fe-=ee,k.total_out+=fe,M.total+=fe,fe&&(k.adler=M.check=M.flags?a(M.check,I,fe,Y-fe):o(M.check,I,fe,Y-fe)),fe=ee,(M.flags?W:g(W))!==M.check){k.msg="incorrect data check",M.mode=30;break}ne=W=0}M.mode=28;case 28:if(M.wrap&&M.flags){for(;ne<32;){if($===0)break e;$--,W+=F[z++]<<ne,ne+=8}if(W!==(4294967295&M.total)){k.msg="incorrect length check",M.mode=30;break}ne=W=0}M.mode=29;case 29:ve=1;break e;case 30:ve=-3;break e;case 31:return-4;case 32:default:return h}return k.next_out=Y,k.avail_out=ee,k.next_in=z,k.avail_in=$,M.hold=W,M.bits=ne,(M.wsize||fe!==k.avail_out&&M.mode<30&&(M.mode<27||B!==4))&&R(k,k.output,k.next_out,fe-k.avail_out)?(M.mode=31,-4):(Se-=k.avail_in,fe-=k.avail_out,k.total_in+=Se,k.total_out+=fe,M.total+=fe,M.wrap&&fe&&(k.adler=M.check=M.flags?a(M.check,I,fe,k.next_out-fe):o(M.check,I,fe,k.next_out-fe)),k.data_type=M.bits+(M.last?64:0)+(M.mode===12?128:0)+(M.mode===20||M.mode===15?256:0),(Se==0&&fe===0||B===4)&&ve===f&&(ve=-5),ve)},i.inflateEnd=function(k){if(!k||!k.state)return h;var B=k.state;return B.window&&(B.window=null),k.state=null,f},i.inflateGetHeader=function(k,B){var M;return k&&k.state&&2&(M=k.state).wrap?((M.head=B).done=!1,f):h},i.inflateSetDictionary=function(k,B){var M,F=B.length;return k&&k.state?(M=k.state).wrap!==0&&M.mode!==11?h:M.mode===11&&o(1,B,F,0)!==M.check?-3:R(k,B,F,F)?(M.mode=31,-4):(M.havedict=1,f):h},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,i){var s=n("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(u,d,f,h,A,p,m,g){var y,w,v,x,C,_,S,E,T,R=g.bits,k=0,B=0,M=0,F=0,I=0,z=0,Y=0,$=0,ee=0,W=0,ne=null,Se=0,fe=new s.Buf16(16),ge=new s.Buf16(16),Oe=null,Fe=0;for(k=0;k<=15;k++)fe[k]=0;for(B=0;B<h;B++)fe[d[f+B]]++;for(I=R,F=15;1<=F&&fe[F]===0;F--);if(F<I&&(I=F),F===0)return A[p++]=20971520,A[p++]=20971520,g.bits=1,0;for(M=1;M<F&&fe[M]===0;M++);for(I<M&&(I=M),k=$=1;k<=15;k++)if($<<=1,($-=fe[k])<0)return-1;if(0<$&&(u===0||F!==1))return-1;for(ge[1]=0,k=1;k<15;k++)ge[k+1]=ge[k]+fe[k];for(B=0;B<h;B++)d[f+B]!==0&&(m[ge[d[f+B]]++]=B);if(_=u===0?(ne=Oe=m,19):u===1?(ne=o,Se-=257,Oe=a,Fe-=257,256):(ne=l,Oe=c,-1),k=M,C=p,Y=B=W=0,v=-1,x=(ee=1<<(z=I))-1,u===1&&852<ee||u===2&&592<ee)return 1;for(;;){for(S=k-Y,T=m[B]<_?(E=0,m[B]):m[B]>_?(E=Oe[Fe+m[B]],ne[Se+m[B]]):(E=96,0),y=1<<k-Y,M=w=1<<z;A[C+(W>>Y)+(w-=y)]=S<<24|E<<16|T|0,w!==0;);for(y=1<<k-1;W&y;)y>>=1;if(y!==0?(W&=y-1,W+=y):W=0,B++,--fe[k]==0){if(k===F)break;k=d[f+m[B]]}if(I<k&&(W&x)!==v){for(Y===0&&(Y=I),C+=M,$=1<<(z=k-Y);z+Y<F&&!(($-=fe[z+Y])<=0);)z++,$<<=1;if(ee+=1<<z,u===1&&852<ee||u===2&&592<ee)return 1;A[v=W&x]=I<<24|z<<16|C-p|0}}return W!==0&&(A[C+W]=k-Y<<24|64<<16|0),g.bits=I,0}},{"../utils/common":41}],51:[function(n,r,i){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,i){var s=n("../utils/common"),o=0,a=1;function l(Z){for(var pe=Z.length;0<=--pe;)Z[pe]=0}var c=0,u=29,d=256,f=d+1+u,h=30,A=19,p=2*f+1,m=15,g=16,y=7,w=256,v=16,x=17,C=18,_=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],S=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],T=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],R=new Array(2*(f+2));l(R);var k=new Array(2*h);l(k);var B=new Array(512);l(B);var M=new Array(256);l(M);var F=new Array(u);l(F);var I,z,Y,$=new Array(h);function ee(Z,pe,J,H,oe){this.static_tree=Z,this.extra_bits=pe,this.extra_base=J,this.elems=H,this.max_length=oe,this.has_stree=Z&&Z.length}function W(Z,pe){this.dyn_tree=Z,this.max_code=0,this.stat_desc=pe}function ne(Z){return Z<256?B[Z]:B[256+(Z>>>7)]}function Se(Z,pe){Z.pending_buf[Z.pending++]=255&pe,Z.pending_buf[Z.pending++]=pe>>>8&255}function fe(Z,pe,J){Z.bi_valid>g-J?(Z.bi_buf|=pe<<Z.bi_valid&65535,Se(Z,Z.bi_buf),Z.bi_buf=pe>>g-Z.bi_valid,Z.bi_valid+=J-g):(Z.bi_buf|=pe<<Z.bi_valid&65535,Z.bi_valid+=J)}function ge(Z,pe,J){fe(Z,J[2*pe],J[2*pe+1])}function Oe(Z,pe){for(var J=0;J|=1&Z,Z>>>=1,J<<=1,0<--pe;);return J>>>1}function Fe(Z,pe,J){var H,oe,we=new Array(m+1),Ee=0;for(H=1;H<=m;H++)we[H]=Ee=Ee+J[H-1]<<1;for(oe=0;oe<=pe;oe++){var re=Z[2*oe+1];re!==0&&(Z[2*oe]=Oe(we[re]++,re))}}function De(Z){var pe;for(pe=0;pe<f;pe++)Z.dyn_ltree[2*pe]=0;for(pe=0;pe<h;pe++)Z.dyn_dtree[2*pe]=0;for(pe=0;pe<A;pe++)Z.bl_tree[2*pe]=0;Z.dyn_ltree[2*w]=1,Z.opt_len=Z.static_len=0,Z.last_lit=Z.matches=0}function ke(Z){8<Z.bi_valid?Se(Z,Z.bi_buf):0<Z.bi_valid&&(Z.pending_buf[Z.pending++]=Z.bi_buf),Z.bi_buf=0,Z.bi_valid=0}function Ge(Z,pe,J,H){var oe=2*pe,we=2*J;return Z[oe]<Z[we]||Z[oe]===Z[we]&&H[pe]<=H[J]}function Ve(Z,pe,J){for(var H=Z.heap[J],oe=J<<1;oe<=Z.heap_len&&(oe<Z.heap_len&&Ge(pe,Z.heap[oe+1],Z.heap[oe],Z.depth)&&oe++,!Ge(pe,H,Z.heap[oe],Z.depth));)Z.heap[J]=Z.heap[oe],J=oe,oe<<=1;Z.heap[J]=H}function q(Z,pe,J){var H,oe,we,Ee,re=0;if(Z.last_lit!==0)for(;H=Z.pending_buf[Z.d_buf+2*re]<<8|Z.pending_buf[Z.d_buf+2*re+1],oe=Z.pending_buf[Z.l_buf+re],re++,H===0?ge(Z,oe,pe):(ge(Z,(we=M[oe])+d+1,pe),(Ee=_[we])!==0&&fe(Z,oe-=F[we],Ee),ge(Z,we=ne(--H),J),(Ee=S[we])!==0&&fe(Z,H-=$[we],Ee)),re<Z.last_lit;);ge(Z,w,pe)}function Ue(Z,pe){var J,H,oe,we=pe.dyn_tree,Ee=pe.stat_desc.static_tree,re=pe.stat_desc.has_stree,ce=pe.stat_desc.elems,le=-1;for(Z.heap_len=0,Z.heap_max=p,J=0;J<ce;J++)we[2*J]!==0?(Z.heap[++Z.heap_len]=le=J,Z.depth[J]=0):we[2*J+1]=0;for(;Z.heap_len<2;)we[2*(oe=Z.heap[++Z.heap_len]=le<2?++le:0)]=1,Z.depth[oe]=0,Z.opt_len--,re&&(Z.static_len-=Ee[2*oe+1]);for(pe.max_code=le,J=Z.heap_len>>1;1<=J;J--)Ve(Z,we,J);for(oe=ce;J=Z.heap[1],Z.heap[1]=Z.heap[Z.heap_len--],Ve(Z,we,1),H=Z.heap[1],Z.heap[--Z.heap_max]=J,Z.heap[--Z.heap_max]=H,we[2*oe]=we[2*J]+we[2*H],Z.depth[oe]=(Z.depth[J]>=Z.depth[H]?Z.depth[J]:Z.depth[H])+1,we[2*J+1]=we[2*H+1]=oe,Z.heap[1]=oe++,Ve(Z,we,1),2<=Z.heap_len;);Z.heap[--Z.heap_max]=Z.heap[1],function(me,Le){var Te,Pe,Qe,$e,et,st,dt=Le.dyn_tree,Mt=Le.max_code,K=Le.stat_desc.static_tree,Be=Le.stat_desc.has_stree,Re=Le.stat_desc.extra_bits,Me=Le.stat_desc.extra_base,We=Le.stat_desc.max_length,Je=0;for($e=0;$e<=m;$e++)me.bl_count[$e]=0;for(dt[2*me.heap[me.heap_max]+1]=0,Te=me.heap_max+1;Te<p;Te++)We<($e=dt[2*dt[2*(Pe=me.heap[Te])+1]+1]+1)&&($e=We,Je++),dt[2*Pe+1]=$e,Mt<Pe||(me.bl_count[$e]++,et=0,Me<=Pe&&(et=Re[Pe-Me]),st=dt[2*Pe],me.opt_len+=st*($e+et),Be&&(me.static_len+=st*(K[2*Pe+1]+et)));if(Je!==0){do{for($e=We-1;me.bl_count[$e]===0;)$e--;me.bl_count[$e]--,me.bl_count[$e+1]+=2,me.bl_count[We]--,Je-=2}while(0<Je);for($e=We;$e!==0;$e--)for(Pe=me.bl_count[$e];Pe!==0;)Mt<(Qe=me.heap[--Te])||(dt[2*Qe+1]!==$e&&(me.opt_len+=($e-dt[2*Qe+1])*dt[2*Qe],dt[2*Qe+1]=$e),Pe--)}}(Z,pe),Fe(we,le,Z.bl_count)}function O(Z,pe,J){var H,oe,we=-1,Ee=pe[1],re=0,ce=7,le=4;for(Ee===0&&(ce=138,le=3),pe[2*(J+1)+1]=65535,H=0;H<=J;H++)oe=Ee,Ee=pe[2*(H+1)+1],++re<ce&&oe===Ee||(re<le?Z.bl_tree[2*oe]+=re:oe!==0?(oe!==we&&Z.bl_tree[2*oe]++,Z.bl_tree[2*v]++):re<=10?Z.bl_tree[2*x]++:Z.bl_tree[2*C]++,we=oe,le=(re=0)===Ee?(ce=138,3):oe===Ee?(ce=6,3):(ce=7,4))}function ve(Z,pe,J){var H,oe,we=-1,Ee=pe[1],re=0,ce=7,le=4;for(Ee===0&&(ce=138,le=3),H=0;H<=J;H++)if(oe=Ee,Ee=pe[2*(H+1)+1],!(++re<ce&&oe===Ee)){if(re<le)for(;ge(Z,oe,Z.bl_tree),--re!=0;);else oe!==0?(oe!==we&&(ge(Z,oe,Z.bl_tree),re--),ge(Z,v,Z.bl_tree),fe(Z,re-3,2)):re<=10?(ge(Z,x,Z.bl_tree),fe(Z,re-3,3)):(ge(Z,C,Z.bl_tree),fe(Z,re-11,7));we=oe,le=(re=0)===Ee?(ce=138,3):oe===Ee?(ce=6,3):(ce=7,4)}}l($);var Ae=!1;function ae(Z,pe,J,H){fe(Z,(c<<1)+(H?1:0),3),function(oe,we,Ee,re){ke(oe),Se(oe,Ee),Se(oe,~Ee),s.arraySet(oe.pending_buf,oe.window,we,Ee,oe.pending),oe.pending+=Ee}(Z,pe,J)}i._tr_init=function(Z){Ae||(function(){var pe,J,H,oe,we,Ee=new Array(m+1);for(oe=H=0;oe<u-1;oe++)for(F[oe]=H,pe=0;pe<1<<_[oe];pe++)M[H++]=oe;for(M[H-1]=oe,oe=we=0;oe<16;oe++)for($[oe]=we,pe=0;pe<1<<S[oe];pe++)B[we++]=oe;for(we>>=7;oe<h;oe++)for($[oe]=we<<7,pe=0;pe<1<<S[oe]-7;pe++)B[256+we++]=oe;for(J=0;J<=m;J++)Ee[J]=0;for(pe=0;pe<=143;)R[2*pe+1]=8,pe++,Ee[8]++;for(;pe<=255;)R[2*pe+1]=9,pe++,Ee[9]++;for(;pe<=279;)R[2*pe+1]=7,pe++,Ee[7]++;for(;pe<=287;)R[2*pe+1]=8,pe++,Ee[8]++;for(Fe(R,f+1,Ee),pe=0;pe<h;pe++)k[2*pe+1]=5,k[2*pe]=Oe(pe,5);I=new ee(R,_,d+1,f,m),z=new ee(k,S,0,h,m),Y=new ee(new Array(0),E,0,A,y)}(),Ae=!0),Z.l_desc=new W(Z.dyn_ltree,I),Z.d_desc=new W(Z.dyn_dtree,z),Z.bl_desc=new W(Z.bl_tree,Y),Z.bi_buf=0,Z.bi_valid=0,De(Z)},i._tr_stored_block=ae,i._tr_flush_block=function(Z,pe,J,H){var oe,we,Ee=0;0<Z.level?(Z.strm.data_type===2&&(Z.strm.data_type=function(re){var ce,le=4093624447;for(ce=0;ce<=31;ce++,le>>>=1)if(1&le&&re.dyn_ltree[2*ce]!==0)return o;if(re.dyn_ltree[18]!==0||re.dyn_ltree[20]!==0||re.dyn_ltree[26]!==0)return a;for(ce=32;ce<d;ce++)if(re.dyn_ltree[2*ce]!==0)return a;return o}(Z)),Ue(Z,Z.l_desc),Ue(Z,Z.d_desc),Ee=function(re){var ce;for(O(re,re.dyn_ltree,re.l_desc.max_code),O(re,re.dyn_dtree,re.d_desc.max_code),Ue(re,re.bl_desc),ce=A-1;3<=ce&&re.bl_tree[2*T[ce]+1]===0;ce--);return re.opt_len+=3*(ce+1)+5+5+4,ce}(Z),oe=Z.opt_len+3+7>>>3,(we=Z.static_len+3+7>>>3)<=oe&&(oe=we)):oe=we=J+5,J+4<=oe&&pe!==-1?ae(Z,pe,J,H):Z.strategy===4||we===oe?(fe(Z,2+(H?1:0),3),q(Z,R,k)):(fe(Z,4+(H?1:0),3),function(re,ce,le,me){var Le;for(fe(re,ce-257,5),fe(re,le-1,5),fe(re,me-4,4),Le=0;Le<me;Le++)fe(re,re.bl_tree[2*T[Le]+1],3);ve(re,re.dyn_ltree,ce-1),ve(re,re.dyn_dtree,le-1)}(Z,Z.l_desc.max_code+1,Z.d_desc.max_code+1,Ee+1),q(Z,Z.dyn_ltree,Z.dyn_dtree)),De(Z),H&&ke(Z)},i._tr_tally=function(Z,pe,J){return Z.pending_buf[Z.d_buf+2*Z.last_lit]=pe>>>8&255,Z.pending_buf[Z.d_buf+2*Z.last_lit+1]=255&pe,Z.pending_buf[Z.l_buf+Z.last_lit]=255&J,Z.last_lit++,pe===0?Z.dyn_ltree[2*J]++:(Z.matches++,pe--,Z.dyn_ltree[2*(M[J]+d+1)]++,Z.dyn_dtree[2*ne(pe)]++),Z.last_lit===Z.lit_bufsize-1},i._tr_align=function(Z){fe(Z,2,3),ge(Z,w,R),function(pe){pe.bi_valid===16?(Se(pe,pe.bi_buf),pe.bi_buf=0,pe.bi_valid=0):8<=pe.bi_valid&&(pe.pending_buf[pe.pending++]=255&pe.bi_buf,pe.bi_buf>>=8,pe.bi_valid-=8)}(Z)}},{"../utils/common":41}],53:[function(n,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,i){(function(s){(function(o,a){if(!o.setImmediate){var l,c,u,d,f=1,h={},A=!1,p=o.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(o);m=m&&m.setTimeout?m:o,l={}.toString.call(o.process)==="[object process]"?function(v){process.nextTick(function(){y(v)})}:function(){if(o.postMessage&&!o.importScripts){var v=!0,x=o.onmessage;return o.onmessage=function(){v=!1},o.postMessage("","*"),o.onmessage=x,v}}()?(d="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(v){o.postMessage(d+v,"*")}):o.MessageChannel?((u=new MessageChannel).port1.onmessage=function(v){y(v.data)},function(v){u.port2.postMessage(v)}):p&&"onreadystatechange"in p.createElement("script")?(c=p.documentElement,function(v){var x=p.createElement("script");x.onreadystatechange=function(){y(v),x.onreadystatechange=null,c.removeChild(x),x=null},c.appendChild(x)}):function(v){setTimeout(y,0,v)},m.setImmediate=function(v){typeof v!="function"&&(v=new Function(""+v));for(var x=new Array(arguments.length-1),C=0;C<x.length;C++)x[C]=arguments[C+1];var _={callback:v,args:x};return h[f]=_,l(f),f++},m.clearImmediate=g}function g(v){delete h[v]}function y(v){if(A)setTimeout(y,0,v);else{var x=h[v];if(x){A=!0;try{(function(C){var _=C.callback,S=C.args;switch(S.length){case 0:_();break;case 1:_(S[0]);break;case 2:_(S[0],S[1]);break;case 3:_(S[0],S[1],S[2]);break;default:_.apply(a,S)}})(x)}finally{g(v),A=!1}}}}function w(v){v.source===o&&typeof v.data=="string"&&v.data.indexOf(d)===0&&y(+v.data.slice(d.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof en<"u"?en:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Vq);var Rbe=Vq.exports;const Pbe=mg(Rbe),E7=async(t,e)=>{try{if(ft()){const n=t.name.split(".").pop()||null;let r=[];if(n!==null&&r.push(n),window.electron.process.env.IS_PLAYWRIGHT){await window.electron.writeFile(t.name,new Uint8Array(t.contents)),jt.success(_h.SUCCESS,{id:e});return}const i=await window.electron.save({defaultPath:t.name,filters:[{name:"model",extensions:r}]});if(i.canceled){jt.dismiss(e);return}await window.electron.writeFile(i.filePath,new Uint8Array(t.contents)),jt.success(_h.SUCCESS,{id:e})}else{const n=new Blob([new Uint8Array(t.contents)]);await kbe(n,t.name,e)}}catch(n){console.error("export error",n),jt.error(_h.FAILED,{id:e})}};async function Lbe(t,e){let n=new Uint8Array(t),r=CW(n);if(r.length>1){let i=new Pbe;for(const s of r)i.file(s.name,new Uint8Array(s.contents),{binary:!0});return i.generateAsync({type:"array"}).then(s=>E7({name:"output.zip",contents:s},e))}else return E7(r[0],e)}let tw;const Ibe=new Uint8Array(16);function Obe(){if(!tw&&(tw=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!tw))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tw(Ibe)}const ji=[];for(let t=0;t<256;++t)ji.push((t+256).toString(16).slice(1));function Fbe(t,e=0){return ji[t[e+0]]+ji[t[e+1]]+ji[t[e+2]]+ji[t[e+3]]+"-"+ji[t[e+4]]+ji[t[e+5]]+"-"+ji[t[e+6]]+ji[t[e+7]]+"-"+ji[t[e+8]]+ji[t[e+9]]+"-"+ji[t[e+10]]+ji[t[e+11]]+ji[t[e+12]]+ji[t[e+13]]+ji[t[e+14]]+ji[t[e+15]]}const Nbe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),T7={randomUUID:Nbe};function Yf(t,e,n){if(T7.randomUUID&&!e&&!t)return T7.randomUUID();t=t||{};const r=t.random||(t.rng||Obe)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let i=0;i<16;++i)e[n+i]=r[i];return e}return Fbe(r)}const Yt=Yf;function sI(t){return Array.isArray(t)}function S_(t){return t!=null}function Vd(t,e){const[n,r]=t[0]<e[0]?[t,e]:[e,t],[i,s]=[n[1],r[0]];return i>=s}function ot(t,e=2){const n=Math.pow(10,e);return Math.round(t*n)/n}function B7(t,e){const n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)}function xi(t,e){const n=e[0]-t[0],r=e[1]-t[1];return tg(Math.atan2(r,n)*180/Math.PI)}function tg(t){const e=(t%360+360)%360;return e>180?e-360:e}function b1(t,e){let n,r,i;function s(){n=null,t(r)}function o(a){const l=Date.now();r=a,!i||l-i>=e?(i=l,t(r)):n||(n=setTimeout(s,e-(l-i)))}return o}function Ty(t,e){let n,r;function i(){n=null,t(r)}function s(o){r=o,n&&clearTimeout(n),n=setTimeout(i,e)}return s}function Li(t,e){return(...n)=>{t(...n).catch(e)}}function Dbe({clientX:t,clientY:e,streamWidth:n,streamHeight:r,el:i}){const{left:s,top:o,width:a,height:l}=i==null?void 0:i.getBoundingClientRect(),c=t-s,u=e-o;return{x:Math.round(c/a*n),y:Math.round(u/l*r)}}function oI(){var e,n,r,i;if(ft()){const s=window.electron.platform??"";switch(s){case"darwin":return"macos";case"win32":return"windows";case"android":case"freebsd":case"linux":case"openbsd":case"sunos":return"linux";default:return console.error("Unknown desktop platform:",s),""}}if(((e=navigator.platform)==null?void 0:e.indexOf("Mac"))===0||((n=navigator.platform)==null?void 0:n.indexOf("iPhone"))===0||((r=navigator.platform)==null?void 0:r.indexOf("iPad"))===0||((i=navigator.platform)==null?void 0:i.indexOf("Darwin"))>=0)return"macos";if(navigator.platform==="Windows"||navigator.platform==="Win32")return"windows";let t;if("userAgentData"in navigator&&navigator.userAgentData&&typeof navigator.userAgentData=="object"&&"platform"in navigator.userAgentData){if(t=navigator.userAgentData.platform,t==="macOS")return"macos";if(t==="Windows")return"windows"}return navigator.userAgent.indexOf("Mac")!==-1?"macos":navigator.userAgent.indexOf("Win")!==-1?"windows":navigator.userAgent.indexOf("Linux")!==-1?"linux":(console.error("Unknown web platform:",navigator.platform,t,navigator.userAgent),"")}function kp(){return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion)").matches}function Ube(t){return[...new Set([...t._nodes.flatMap(e=>e.ownEvents)])]}const Hs=typeof globalThis.window<"u"&&"matchMedia"in globalThis.window&&globalThis.window.matchMedia("(prefers-color-scheme: dark)")||void 0;var Zn=(t=>(t.Light="light",t.Dark="dark",t.System="system",t))(Zn||{});function Hbe(t){switch(t){case"light":return"light";case"dark":return"dark";case"system":return"system";default:return}}function _f(){return typeof globalThis.window<"u"&&"matchMedia"in globalThis.window&&Hs!=null&&Hs.matches?"dark":"light"}function Gq(t){t==="dark"?document.body.classList.add("dark"):document.body.classList.remove("dark")}function aI(t){return t==="system"?_f():t}function Wq(t){return aI(t)==="dark"?"light":"dark"}function M7(t){const e=aI(t),n=28/255,r=249/255;return e==="dark"?{r:n,g:n,b:n,a:1}:{r,g:r,b:r,a:1}}function ru(t){return aI(t)==="dark"?1842204:16382457}function jbe({orderedCommands:t,responseMap:e,ast:n}){const r=new Map;let i="";return t.forEach(s=>{var a;((a=s.command)==null?void 0:a.type)==="modeling_cmd_req"&&(s.command.cmd.type==="enable_sketch_mode"&&(i=s.command.cmd.entity_id),s.command.cmd.type==="sketch_mode_disable"&&(i="")),zbe({orderedCommand:s,responseMap:e,getArtifact:l=>r.get(l),currentPlaneId:i,ast:n}).forEach(({id:l,artifact:c})=>{const u=Qbe(r.get(l),c);r.set(l,u)})}),r}function Qbe(t,e){if(!t||t.type!==e.type)return e;const n=t,r={...t,...e};return Object.entries(e).forEach(([i,s])=>{const o=n[i];Array.isArray(s)&&Array.isArray(o)&&(r[i]=[...new Set([...o,...s])])}),r}function zbe({orderedCommand:{command:t,range:e},getArtifact:n,responseMap:r,currentPlaneId:i,ast:s}){const o=un(s,e);if(t.type!=="modeling_cmd_req")return[];const a=t.cmd_id,l=r[a],c=t.cmd,u=[];if(!l)return u;if(c.type==="enable_sketch_mode"){const d=n(i),f=(d==null?void 0:d.type)==="plane"?d==null?void 0:d.pathIds:[],h=(d==null?void 0:d.type)==="plane"?d==null?void 0:d.codeRef:{range:e,pathToNode:o},A=n(i);return(A==null?void 0:A.type)==="wall"?[{id:i,artifact:{type:"wall",segId:A.segId,edgeCutEdgeIds:A.edgeCutEdgeIds,sweepId:A.sweepId,pathIds:A.pathIds}}]:[{id:i,artifact:{type:"plane",pathIds:f,codeRef:h}}]}else if(c.type==="start_path"){u.push({id:a,artifact:{type:"path",segIds:[],planeId:i,sweepId:"",codeRef:{range:e,pathToNode:o}}});const d=n(i),f=(d==null?void 0:d.type)==="plane"?d==null?void 0:d.codeRef:{range:e,pathToNode:o};return(d==null?void 0:d.type)==="plane"&&u.push({id:i,artifact:{type:"plane",pathIds:[a],codeRef:f}}),(d==null?void 0:d.type)==="wall"&&u.push({id:i,artifact:{type:"wall",segId:d.segId,edgeCutEdgeIds:d.edgeCutEdgeIds,sweepId:d.sweepId,pathIds:[a]}}),u}else if(c.type==="extend_path"||c.type==="close_path"){const d=c.type==="extend_path"?c.path:c.path_id;u.push({id:a,artifact:{type:"segment",pathId:d,surfaceId:"",edgeIds:[],codeRef:{range:e,pathToNode:o}}});const f=n(d);if((f==null?void 0:f.type)==="path"&&u.push({id:d,artifact:{...f,segIds:[a]}}),(l==null?void 0:l.type)==="modeling"&&l.data.modeling_response.type==="close_path"){u.push({id:l.data.modeling_response.data.face_id,artifact:{type:"solid2D",pathId:d}});const h=n(d);(h==null?void 0:h.type)==="path"&&u.push({id:d,artifact:{...h,solid2dId:l.data.modeling_response.data.face_id}})}return u}else if(c.type==="extrude"||c.type==="revolve"){const d=c.type==="extrude"?"extrusion":c.type;u.push({id:a,artifact:{type:"sweep",subType:d,pathId:c.target,surfaceIds:[],edgeIds:[],codeRef:{range:e,pathToNode:o}}});const f=n(c.target);return(f==null?void 0:f.type)==="path"&&u.push({id:c.target,artifact:{...f,sweepId:a}}),u}else if(c.type==="solid3d_get_extrusion_face_info"&&(l==null?void 0:l.type)==="modeling"&&l.data.modeling_response.type==="solid3d_get_extrusion_face_info"){let d;return l.data.modeling_response.data.faces.forEach(({curve_id:f,cap:h,face_id:A})=>{if(h==="none"&&f&&A){const p=n(f);if((p==null?void 0:p.type)!=="segment")return;const m=n(p.pathId);if((m==null?void 0:m.type)==="path"&&(p==null?void 0:p.type)==="segment"){d=m,u.push({id:A,artifact:{type:"wall",segId:f,edgeCutEdgeIds:[],sweepId:m.sweepId,pathIds:[]}}),u.push({id:f,artifact:{...p,surfaceId:A}});const g=n(m.sweepId);(g==null?void 0:g.type)==="sweep"&&u.push({id:m.sweepId,artifact:{...g,surfaceIds:[A]}})}}}),l.data.modeling_response.data.faces.forEach(({cap:f,face_id:h})=>{if((f==="top"||f==="bottom")&&h){const A=d;if((A==null?void 0:A.type)==="path"){u.push({id:h,artifact:{type:"cap",subType:f==="bottom"?"start":"end",edgeCutEdgeIds:[],sweepId:A.sweepId,pathIds:[]}});const p=n(A.sweepId);if((p==null?void 0:p.type)!=="sweep")return;u.push({id:A.sweepId,artifact:{...p,surfaceIds:[h]}})}}}),u}else if(c.type==="solid3d_get_opposite_edge"&&l.type==="modeling"&&l.data.modeling_response.type==="solid3d_get_opposite_edge"&&l.data.modeling_response.data.edge||c.type==="solid3d_get_next_adjacent_edge"&&l.type==="modeling"&&l.data.modeling_response.type==="solid3d_get_next_adjacent_edge"&&l.data.modeling_response.data.edge){const d=n(c.face_id);if((d==null?void 0:d.type)!=="wall")return u;const f=n(d.sweepId);if((f==null?void 0:f.type)!=="sweep")return u;const h=n(f.pathId);if((h==null?void 0:h.type)!=="path")return u;const A=n(c.edge_id);return(A==null?void 0:A.type)!=="segment"?u:[{id:l.data.modeling_response.data.edge,artifact:{type:"sweepEdge",subType:c.type==="solid3d_get_next_adjacent_edge"?"adjacent":"opposite",segId:c.edge_id,sweepId:h.sweepId}},{id:c.edge_id,artifact:{...A,edgeIds:[l.data.modeling_response.data.edge]}},{id:h.sweepId,artifact:{...f,edgeIds:[l.data.modeling_response.data.edge]}}]}else if(c.type==="solid3d_fillet_edge"){u.push({id:a,artifact:{type:"edgeCut",subType:c.cut_type,consumedEdgeId:c.edge_id,edgeIds:[],surfaceId:"",codeRef:{range:e,pathToNode:o}}});const d=n(c.edge_id);return(d==null?void 0:d.type)==="segment"&&u.push({id:c.edge_id,artifact:{...d,edgeCutId:a}}),u}return[]}function Vbe({types:t,predicate:e},n){return new Map(Array.from(n).filter(([r,i])=>t.includes(i.type)&&(!e||e(i))))}function Hx({keys:t,types:e,predicate:n},r){return new Map([...r].filter(([i,s])=>t.includes(i)&&e.includes(s.type)&&(!n||n(s))))}function Yr({key:t,types:e},n){const r=n.get(t);return r?e.includes(r==null?void 0:r.type)?r:new Error(`Expected ${e} but got ${r==null?void 0:r.type}`):new Error(`No artifact found with key ${t}`)}function Gbe(t,e){const n=Hx({keys:t.pathIds,types:["path"]},e);return{type:"plane",paths:Array.from(n.values()),codeRef:t.codeRef}}function n5(t,e){const n=Yr({key:t.sweepId,types:["sweep"]},e);if(ie(n))return n;const r=Yr({key:n.pathId,types:["path"]},e);return ie(r)?r:r.codeRef}function Kq(t,e){const n=Yr({key:t.pathId,types:["path"]},e);return ie(n)?n:n.codeRef}function r5(t,e){const n=Yr({key:t.segId,types:["segment"]},e);return ie(n)?n:n.codeRef}function lI(t,e){const n=Yr({key:t.segId,types:["segment"]},e);return ie(n)?n:n.codeRef}function Wbe(t,e){const n=Yr({key:t.consumedEdgeId,types:["segment","sweepEdge"]},e);return ie(n)?n:n.type==="segment"?n.codeRef:lI(n,e)}function k7(t,e){const n=Yr({key:t,types:["wall","cap","edgeCut"]},e);if(ie(n))return n;if(n.type==="wall"||n.type==="cap")return Yr({key:n.sweepId,types:["sweep"]},e);const r=Yr({key:n.consumedEdgeId,types:["segment","sweepEdge"]},e);if(ie(r))return r;if(r.type==="segment"){const i=Yr({key:r.pathId,types:["path"]},e);return ie(i)?i:Yr({key:i.sweepId,types:["sweep"]},e)}return Yr({key:r.sweepId,types:["sweep"]},e)}function Kbe(t,e){const n=Yr({key:t,types:["path"]},e);return ie(n)?n:Yr({key:n.sweepId,types:["sweep"]},e)}class $be{constructor(){se(this,"_isDesktop",ft());se(this,"_machines",[]);se(this,"_machineApiIp",null);se(this,"_currentMachine",null);this._isDesktop&&this.updateMachines().catch(Bt)}start(){if(!this._isDesktop)return;let e;const n=()=>{clearTimeout(e),e=setTimeout(Li(async()=>{await this.updateMachineApiIp(),await this.updateMachines(),n()},Bt),1e4)};n()}get machines(){return this._machines}machineCount(){return this._machines.length}get machineApiIp(){return this._machineApiIp}noMachinesReason(){if(!(this.machineCount()>0))return this.machineApiIp===null?"Machine API server was not discovered":"Machine API server was discovered, but no machines are available"}get currentMachine(){return this._currentMachine}set currentMachine(e){this._currentMachine=e}async updateMachines(){this._isDesktop&&this._machineApiIp!==null&&(this._machines=await window.electron.listMachines(this._machineApiIp))}async updateMachineApiIp(){this._isDesktop&&(this._machineApiIp=await window.electron.getMachineApiIp())}}const va=new $be;va.start();async function qbe(t,e,n){if(e==="")return console.error(Ps.NO_NAME),jt.error(Ps.NO_NAME,{id:n}),null;if(va.machineCount()===0)return console.error(Ps.NO_MACHINES),jt.error(Ps.NO_MACHINES,{id:n}),null;const r=va.machineApiIp;if(!r)return console.error(Ps.NO_MACHINE_API_IP),jt.error(Ps.NO_MACHINE_API_IP,{id:n}),null;const i=va.currentMachine;if(!i)return console.error(Ps.NO_CURRENT_MACHINE),jt.error(Ps.NO_CURRENT_MACHINE,{id:n}),null;let s=i==null?void 0:i.id;if(!s)return console.error(Ps.NO_MACHINE_ID,i),jt.error(Ps.NO_MACHINE_ID,{id:n}),null;const o={machine_id:s,job_name:e};try{console.log("params",o);const a=new FormData;a.append("params",JSON.stringify(o));let c=CW(new Uint8Array(t))[0];const u=new Blob([new Uint8Array(c.contents)],{type:"text/plain"});a.append("file",u,c.name),console.log("formData",a);const d=await fetch("http://"+r+"/print",{mode:"no-cors",method:"POST",body:a});if(console.log("response",d),!d.ok){console.error(Ps.ERROR_STARTING_PRINT,d);const f=await d.text();return jt.error("Error while starting print: "+d.statusText+" "+f,{id:n}),null}return jt.success(Ps.SUCCESS,{id:n}),d}catch(a){return console.error(Ps.ERROR_STARTING_PRINT,a),jt.error(Ps.ERROR_STARTING_PRINT,{id:n}),null}}const R7=5e3;function Xbe(t){return t.entity_id&&t.sequence}var i5=(t=>(t.Save="save",t.Make="make",t))(i5||{}),No=(t=>(t.Fresh="fresh",t.Connecting="connecting",t.ConnectionEstablished="connection-established",t.Disconnecting="disconnecting",t.Disconnected="disconnected",t))(No||{}),ng=(t=>(t.Error="error",t.Timeout="timeout",t.Quit="quit",t.Pause="pause",t))(ng||{}),N0=(t=>(t[t.Unset=0]="Unset",t[t.LongLoadingTime=1]="LongLoadingTime",t[t.ICENegotiate=2]="ICENegotiate",t[t.DataChannelError=3]="DataChannelError",t[t.WebSocketError=4]="WebSocketError",t[t.LocalDescriptionInvalid=5]="LocalDescriptionInvalid",t[t.MissingAuthToken=6]="MissingAuthToken",t[t.BadAuthToken=7]="BadAuthToken",t[t.TooManyConnections=8]="TooManyConnections",t[t.Unknown=9]="Unknown",t))(N0||{});const Ybe={0:"",1:"Loading is taking longer than expected...",2:"ICE negotiation failed.",3:"The data channel signaled an error.",4:"The websocket signaled an error.",5:"The local description is invalid.",6:"Your authorization token is missing; please login again.",7:"Your authorization token is invalid; please login again.",8:"There are too many connections.",9:"An unexpected error occurred. Please report this to us."};var As=(t=>(t.WebSocket="WebSocket",t.ICE="ICE",t.WebRTC="WebRTC",t))(As||{});const jx={WebSocket:[["websocket-connecting",void 0],["websocket-open",void 0]],ICE:[["peer-connection-created",void 0],["ice-servers-set",void 0],["set-local-description",void 0],["offered-sdp",void 0],["received-sdp",void 0],["set-remote-description",void 0],["webrtc-connecting",void 0],["ice-candidate-received",void 0]],WebRTC:[["track-received",void 0],["data-channel-requested",void 0],["data-channel-connecting",void 0],["data-channel-established",void 0]]};var Nc=(t=>(t.PingPongChanged="ping-pong-changed",t.ConnectionStateChanged="connection-state-changed",t.ConnectionStarted="connection-started",t.Opened="opened",t.Closed="closed",t.NewTrack="new-track",t))(Nc||{});class Jbe extends EventTarget{constructor({engineCommandManager:n,url:r,token:i,callbackOnEngineLiteConnect:s}){super();se(this,"websocket");se(this,"pc");se(this,"unreliableDataChannel");se(this,"mediaStream");se(this,"idleMode",!1);se(this,"promise");se(this,"onIceCandidate",function(n){});se(this,"onIceCandidateError",function(n){});se(this,"onConnectionStateChange",function(n){});se(this,"onDataChannelOpen",function(n){});se(this,"onDataChannelClose",function(n){});se(this,"onDataChannelError",function(n){});se(this,"onDataChannelMessage",function(n){});se(this,"onDataChannel",function(n){});se(this,"onTrack",function(n){});se(this,"onWebSocketOpen",function(n){});se(this,"onWebSocketClose",function(n){});se(this,"onWebSocketError",function(n){});se(this,"onWebSocketMessage",function(n){});se(this,"onNetworkStatusReady",()=>{});se(this,"_state",{type:"fresh"});se(this,"url");se(this,"token");se(this,"webrtcStatsCollector");se(this,"engineCommandManager");se(this,"pingPongSpan");se(this,"pingIntervalId",setInterval(()=>{},6e4));se(this,"isUsingConnectionLite",!1);if(this.engineCommandManager=n,this.url=r,this.token=i,this.pingPongSpan={ping:void 0,pong:void 0},s){this.connectLite(s),this.isUsingConnectionLite=!0;return}this.pingIntervalId=setInterval(()=>{if(!this.idleMode)switch(this.state.type){case"connection-established":this.pingPongSpan.ping&&!this.pingPongSpan.pong?(this.dispatchEvent(new CustomEvent("ping-pong-changed",{detail:"TIMEOUT"})),this.state={type:"disconnecting",value:{type:"timeout"}},this.disconnectAll()):this.pingPongSpan.ping&&this.pingPongSpan.pong&&(Math.abs(this.pingPongSpan.pong.valueOf()-this.pingPongSpan.ping.valueOf())>=R7?this.dispatchEvent(new CustomEvent("ping-pong-changed",{detail:"TIMEOUT"})):this.dispatchEvent(new CustomEvent("ping-pong-changed",{detail:"OK"}))),this.send({type:"ping"}),this.pingPongSpan.ping=new Date,this.pingPongSpan.pong=void 0;break;case"disconnecting":case"disconnected":break;default:if(this.isConnecting())break;this.pingPongSpan.ping||this.connect().catch(Bt);break}},R7),this.connect()}get state(){return this._state}set state(n){if(console.log(`${JSON.stringify(this.state)} → ${JSON.stringify(n)}`),n.type==="disconnecting"){const r=n.value;r.type==="error"&&(this._state.type==="connecting"&&(r.value||(r.value={error:9}),r.value.lastConnectingValue=this._state.value),console.error(r.value))}this._state=n,this.dispatchEvent(new CustomEvent("connection-state-changed",{detail:this._state}))}connectLite(n){var i;const r=`${Fq}?video_res_width=256&video_res_height=256`;this.websocket=new WebSocket(r,[]),this.websocket.binaryType="arraybuffer",this.send=s=>{this.websocket&&this.websocket.send(JSON.stringify(s))},this.onWebSocketOpen=s=>{this.send({type:"headers",headers:{Authorization:`Bearer ${x_}`}})},this.tearDown=()=>{},this.websocket.addEventListener("open",this.onWebSocketOpen),(i=this.websocket)==null||i.addEventListener("message",s=>{const o=JSON.parse(s.data),a=this.engineCommandManager.pendingCommands[o.request_id||""];if(!("resp"in o))return;let l=o.resp;if(!(!l||!l.type)){switch(l.type){case"pong":break;case"ice_server_info":n();return}if(a&&o.success&&(o.resp.type==="modeling"||o.resp.type==="modeling_batch")){if(o.resp.type==="modeling"&&a.command.type==="modeling_cmd_req"&&o.request_id)this.engineCommandManager.responseMap[o.request_id]=o.resp;else if(o.resp.type==="modeling_batch"&&a.command.type==="modeling_cmd_batch_req"){let c={};a.command.requests.forEach(({cmd:u,cmd_id:d})=>{c[d]={type:"modeling_cmd_req",cmd:u,cmd_id:d}}),Object.entries(o.resp.data.responses).forEach(([u,d])=>{if(!("response"in d))return;const f=c[u];f&&f.type==="modeling_cmd_req"&&(this.engineCommandManager.responseMap[u]={type:"modeling",data:{modeling_response:d.response}})})}a.resolve([o]),delete this.engineCommandManager.pendingCommands[o.request_id||""]}}})}isConnecting(){return this.state.type==="connecting"}isReady(){return this.state.type==="connection-established"}tearDown(n){this.idleMode=(n==null?void 0:n.idleMode)??!1,clearInterval(this.pingIntervalId),n!=null&&n.idleMode&&(this.state={type:"disconnecting",value:{type:"pause"}}),this.state.type!=="disconnecting"&&this.state.type!=="disconnected"&&(this.state={type:"disconnecting",value:{type:"quit"}},this.disconnectAll())}connect(n){return new Promise(r=>{if(this.isConnecting()||this.isReady())return;const i=()=>{var a,l,c,u,d,f,h,A,p,m,g,y;this.pc=new RTCPeerConnection({bundlePolicy:"max-bundle"}),this.dispatchEvent(new CustomEvent("connection-started",{detail:this}));const o="unreliable_modeling_cmds";(l=(a=this.pc)==null?void 0:a.createDataChannel)==null||l.call(a,o),this.state={type:"connecting",value:{type:"data-channel-requested",value:o}},this.onIceCandidate=w=>{w.candidate!==null&&(this.state={type:"connecting",value:{type:"ice-candidate-received"}},this.send({type:"trickle_ice",candidate:{candidate:w.candidate.candidate,sdpMid:w.candidate.sdpMid||void 0,sdpMLineIndex:w.candidate.sdpMLineIndex||void 0,usernameFragment:w.candidate.usernameFragment||void 0}}))},(u=(c=this.pc)==null?void 0:c.addEventListener)==null||u.call(c,"icecandidate",this.onIceCandidate),this.onIceCandidateError=w=>{const v=w;console.warn(`ICE candidate returned an error: ${v.errorCode}: ${v.errorText} for ${v.url}`)},(f=(d=this.pc)==null?void 0:d.addEventListener)==null||f.call(d,"icecandidateerror",this.onIceCandidateError),this.onConnectionStateChange=w=>{var v,x,C,_,S,E;switch(console.log("connectionstatechange: "+((v=w.target)==null?void 0:v.connectionState)),(x=w.target)==null?void 0:x.connectionState){case"connected":this.dispatchEvent(new CustomEvent("new-track",{detail:{conn:this,mediaStream:this.mediaStream}}));break;case"disconnected":case"failed":(C=this.pc)==null||C.removeEventListener("icecandidate",this.onIceCandidate),(_=this.pc)==null||_.removeEventListener("icecandidateerror",this.onIceCandidateError),(S=this.pc)==null||S.removeEventListener("connectionstatechange",this.onConnectionStateChange),(E=this.pc)==null||E.removeEventListener("track",this.onTrack),this.state={type:"disconnecting",value:{type:"error",value:{error:2,context:w}}},this.disconnectAll();break}},(A=(h=this.pc)==null?void 0:h.addEventListener)==null||A.call(h,"connectionstatechange",this.onConnectionStateChange),this.onTrack=w=>{const v=w.streams[0];this.state={type:"connecting",value:{type:"track-received"}},this.webrtcStatsCollector=()=>new Promise((x,C)=>{var S;if(v.getVideoTracks().length!==1){C(new Error("too many video tracks to report"));return}let _=v.getVideoTracks()[0];(S=this.pc)==null||S.getStats(_).then(E=>{let T={rtc_frames_decoded:0,rtc_frames_dropped:0,rtc_frames_received:0,rtc_frames_per_second:0,rtc_freeze_count:0,rtc_jitter_sec:0,rtc_keyframes_decoded:0,rtc_total_freezes_duration_sec:0,rtc_frame_height:0,rtc_frame_width:0,rtc_packets_lost:0,rtc_pli_count:0,rtc_pause_count:0,rtc_total_pauses_duration_sec:0};E.forEach(R=>{R.type==="inbound-rtp"?(T.rtc_frames_decoded=R.framesDecoded||0,T.rtc_frames_dropped=R.framesDropped||0,T.rtc_frames_received=R.framesReceived||0,T.rtc_frames_per_second=R.framesPerSecond||0,T.rtc_freeze_count=R.freezeCount||0,T.rtc_jitter_sec=R.jitter||0,T.rtc_keyframes_decoded=R.keyFramesDecoded||0,T.rtc_total_freezes_duration_sec=R.totalFreezesDuration||0,T.rtc_frame_height=R.frameHeight||0,T.rtc_frame_width=R.frameWidth||0,T.rtc_packets_lost=R.packetsLost||0,T.rtc_pli_count=R.pliCount||0):R.type}),x(T)})}),this.mediaStream=v},(m=(p=this.pc)==null?void 0:p.addEventListener)==null||m.call(p,"track",this.onTrack),this.onDataChannel=w=>{var v,x,C;this.unreliableDataChannel=w.channel,this.state={type:"connecting",value:{type:"data-channel-connecting",value:w.channel.label}},this.onDataChannelOpen=_=>{this.state={type:"connecting",value:{type:"data-channel-established"}},this.state={type:"connection-established"},this.engineCommandManager.inSequence=1,this.dispatchEvent(new CustomEvent("opened",{detail:this}))},(v=this.unreliableDataChannel)==null||v.addEventListener("open",this.onDataChannelOpen),this.onDataChannelClose=_=>{var S,E,T,R,k;(S=this.unreliableDataChannel)==null||S.removeEventListener("open",this.onDataChannelOpen),(E=this.unreliableDataChannel)==null||E.removeEventListener("close",this.onDataChannelClose),(T=this.unreliableDataChannel)==null||T.removeEventListener("error",this.onDataChannelError),(R=this.unreliableDataChannel)==null||R.removeEventListener("message",this.onDataChannelMessage),(k=this.pc)==null||k.removeEventListener("datachannel",this.onDataChannel),this.disconnectAll()},(x=this.unreliableDataChannel)==null||x.addEventListener("close",this.onDataChannelClose),this.onDataChannelError=_=>{this.state={type:"disconnecting",value:{type:"error",value:{error:3,context:_}}},this.disconnectAll()},(C=this.unreliableDataChannel)==null||C.addEventListener("error",this.onDataChannelError),this.onDataChannelMessage=_=>{const S=JSON.parse(_.data);Object.values(this.engineCommandManager.unreliableSubscriptions[S.type]||{}).forEach(E=>{var T;S.type==="highlight_set_entity"&&((T=S==null?void 0:S.data)!=null&&T.sequence)&&(S==null?void 0:S.data.sequence)>this.engineCommandManager.inSequence?(this.engineCommandManager.inSequence=S.data.sequence,E(S)):S.type!=="highlight_set_entity"&&E(S)})},this.unreliableDataChannel.addEventListener("message",this.onDataChannelMessage)},(y=(g=this.pc)==null?void 0:g.addEventListener)==null||y.call(g,"datachannel",this.onDataChannel)},s=()=>{this.state={type:"connecting",value:{type:"websocket-connecting"}},this.websocket=new WebSocket(this.url,[]),this.websocket.binaryType="arraybuffer",this.onWebSocketOpen=o=>{this.state={type:"connecting",value:{type:"websocket-open"}},this.token&&this.send({type:"headers",headers:{Authorization:`Bearer ${this.token}`}}),this.send({type:"ping"}),this.pingPongSpan.ping=new Date},this.websocket.addEventListener("open",this.onWebSocketOpen),this.onWebSocketClose=o=>{var a,l,c,u;(a=this.websocket)==null||a.removeEventListener("open",this.onWebSocketOpen),(l=this.websocket)==null||l.removeEventListener("close",this.onWebSocketClose),(c=this.websocket)==null||c.removeEventListener("error",this.onWebSocketError),(u=this.websocket)==null||u.removeEventListener("message",this.onWebSocketMessage),window.removeEventListener("use-network-status-ready",this.onNetworkStatusReady),this.disconnectAll()},this.websocket.addEventListener("close",this.onWebSocketClose),this.onWebSocketError=o=>{this.state={type:"disconnecting",value:{type:"error",value:{error:4,context:o}}},this.disconnectAll()},this.websocket.addEventListener("error",this.onWebSocketError),this.onWebSocketMessage=o=>{var c,u,d,f,h,A,p,m,g,y,w;if(typeof o.data!="string")return;const a=JSON.parse(o.data);if(!a.success){const v=(c=a==null?void 0:a.errors)==null?void 0:c.map(C=>`  - ${C.error_code}: ${C.message}`).join(`
`);if(a.request_id){const C=this.engineCommandManager.artifactGraph.get(a.request_id);console.error(`Error in response to request ${a.request_id}:
${v}
    failed cmd type was ${C==null?void 0:C.type}`),((u=this.engineCommandManager.pendingExport)==null?void 0:u.commandId)===a.request_id&&(this.engineCommandManager.pendingExport.reject(v),jt.error(v,{id:this.engineCommandManager.pendingExport.toastId}),this.engineCommandManager.pendingExport=void 0)}else console.error(`Error from server:
${v}`);const x=a==null?void 0:a.errors[0];x.error_code==="auth_token_invalid"&&(this.state={type:"disconnecting",value:{type:"error",value:{error:7,context:x.message}}},this.disconnectAll());return}let l=a.resp;if(!(!l||!l.type))switch(l.type){case"pong":this.pingPongSpan.pong=new Date;break;case"ice_server_info":let v=(d=l.data)==null?void 0:d.ice_servers;i(),this.state={type:"connecting",value:{type:"peer-connection-created"}},(v==null?void 0:v.length)===0?(console.warn("No ICE servers"),(f=this.pc)==null||f.setConfiguration({bundlePolicy:"max-bundle"})):(h=this.pc)==null||h.setConfiguration({bundlePolicy:"max-bundle",iceServers:v,iceTransportPolicy:"relay"}),this.state={type:"connecting",value:{type:"ice-servers-set"}},(A=this.pc)==null||A.addTransceiver("video",{direction:"recvonly"}),(p=this.pc)==null||p.createOffer().then(_=>{var S;return this.state={type:"connecting",value:{type:"set-local-description"}},(S=this.pc)==null?void 0:S.setLocalDescription(_).then(()=>{this.send({type:"sdp_offer",offer:_}),this.state={type:"connecting",value:{type:"offered-sdp"}}})}).catch(_=>{this.state={type:"disconnecting",value:{type:"error",value:{error:5,context:_}}},this.disconnectAll()});break;case"sdp_answer":let x=(m=l.data)==null?void 0:m.answer;if(!x||x.type==="unspecified")return;this.state={type:"connecting",value:{type:"received-sdp"}},(g=this.pc)==null||g.setRemoteDescription(x),this.state={type:"connecting",value:{type:"set-remote-description"}},this.state={type:"connecting",value:{type:"webrtc-connecting"}};break;case"trickle_ice":let C=(y=l.data)==null?void 0:y.candidate;(w=this.pc)==null||w.addIceCandidate(C);break;case"metrics_request":if(this.webrtcStatsCollector===void 0)return;this.webrtcStatsCollector().then(_=>{this.send({type:"metrics_response",metrics:_})});break}},this.websocket.addEventListener("message",this.onWebSocketMessage)};n?s():(this.onNetworkStatusReady=()=>{s()},window.addEventListener("use-network-status-ready",this.onNetworkStatusReady))})}unreliableSend(n){var r;(r=this.unreliableDataChannel)==null||r.send(typeof n=="string"?n:JSON.stringify(n))}send(n){var r,i;((r=this.websocket)==null?void 0:r.readyState)!==3&&((i=this.websocket)==null||i.send(typeof n=="string"?n:JSON.stringify(n)))}disconnectAll(){var s,o,a,l,c,u,d,f,h;if(((s=this.websocket)==null?void 0:s.readyState)===1&&((o=this.websocket)==null||o.close()),((a=this.unreliableDataChannel)==null?void 0:a.readyState)==="open"&&((l=this.unreliableDataChannel)==null||l.close()),((c=this.pc)==null?void 0:c.connectionState)==="connected"&&((u=this.pc)==null||u.close()),this.webrtcStatsCollector=void 0,this.state.type==="disconnected")return;const n=!this.pc||((d=this.pc)==null?void 0:d.connectionState)==="closed",r=!this.unreliableDataChannel||((f=this.unreliableDataChannel)==null?void 0:f.readyState)==="closed",i=this.state.type==="disconnecting"&&this.state.value.type==="timeout"||!this.websocket||((h=this.websocket)==null?void 0:h.readyState)===3;n&&r&&i&&(this.state={type:"disconnected"})}}var Wh=(t=>(t.EngineAvailable="engine-available",t.SceneReady="scene-ready",t))(Wh||{});class Zbe extends EventTarget{constructor(n){super();se(this,"artifactGraph",new Map);se(this,"pendingCommands",{});se(this,"orderedCommands",[]);se(this,"responseMap",{});se(this,"outSequence",1);se(this,"inSequence",1);se(this,"engineConnection");se(this,"defaultPlanes",null);se(this,"commandLogs",[]);se(this,"pendingExport");se(this,"settings");se(this,"_exportInfo",null);se(this,"_commandLogCallBack",()=>{});se(this,"subscriptions",{});se(this,"unreliableSubscriptions",{});se(this,"_camControlsCameraChange",()=>{});se(this,"getAst",()=>({start:0,end:0,body:[],nonCodeMeta:{}}));se(this,"makeDefaultPlanes",()=>null);se(this,"modifyGrid",()=>null);se(this,"onEngineConnectionOpened",()=>{});se(this,"onEngineConnectionClosed",()=>{});se(this,"onDarkThemeMediaQueryChange",n=>{this.setTheme(n.matches?Zn.Dark:Zn.Light).catch(Bt)});se(this,"onEngineConnectionStarted",({detail:n})=>{});se(this,"onEngineConnectionNewTrack",({detail:n})=>{});se(this,"modelingSend",()=>{});se(this,"kclManager",null);se(this,"deferredArtifactPopulated",Ty(n=>{this.modelingSend({type:"Artifact graph populated"})},200));se(this,"deferredArtifactEmptied",Ty(n=>{this.modelingSend({type:"Artifact graph emptied"})},200));this.engineConnection=void 0,this.settings=n||{pool:null,theme:Zn.Dark,highlightEdges:!0,enableSSAO:!0,showScaleGrid:!1,cameraProjection:"perspective"}}set camControlsCameraChange(n){this._camControlsCameraChange=n}set getAstCb(n){this.getAst=n}set exportInfo(n){this._exportInfo=n}get exportInfo(){return this._exportInfo}start({setMediaStream:n,setIsStreamReady:r,width:i,height:s,token:o,makeDefaultPlanes:a,modifyGrid:l,settings:c={pool:null,theme:Zn.Dark,highlightEdges:!0,enableSSAO:!0,showScaleGrid:!1,cameraProjection:"orthographic"},callbackOnEngineLiteConnect:u}){if(c&&(this.settings=c),this.makeDefaultPlanes=a,this.modifyGrid=l,i===0||s===0)return;if(this.engineConnection){this.handleResize({streamWidth:i,streamHeight:s});return}const d=this.settings.enableSSAO?"&post_effect=ssao":"",f=this.settings.pool?`&pool=${this.settings.pool}`:"",h=`${Fq}?video_res_width=${i}&video_res_height=${s}${d}${f}`;this.engineConnection=new Jbe({engineCommandManager:this,url:h,token:o,callbackOnEngineLiteConnect:u}),!u&&(this.dispatchEvent(new CustomEvent("engine-available",{detail:this.engineConnection})),this.onEngineConnectionOpened=async()=>{var A;c.cameraProjection==="orthographic"&&this.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_set_orthographic"}}).catch(Bt),this.setTheme(this.settings.theme).catch(Bt),Hs==null||Hs.addEventListener("change",this.onDarkThemeMediaQueryChange),this.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"edge_lines_visible",hidden:!this.settings.highlightEdges}}),this._camControlsCameraChange(),this.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_get_settings"}}),(A=this.modifyGrid(!this.settings.showScaleGrid))==null||A.then(async()=>{await this.initPlanes(),r(!0),this.dispatchEvent(new CustomEvent("scene-ready",{detail:this.engineConnection}))})},this.engineConnection.addEventListener("opened",this.onEngineConnectionOpened),this.onEngineConnectionClosed=()=>{r(!1)},this.engineConnection.addEventListener("closed",this.onEngineConnectionClosed),this.onEngineConnectionStarted=({detail:A})=>{var p,m,g,y;(p=A==null?void 0:A.pc)==null||p.addEventListener("datachannel",w=>{w.channel.addEventListener("message",x=>{const C=JSON.parse(x.data);Object.values(this.unreliableSubscriptions[C.type]||{}).forEach(_=>{let S=C==null?void 0:C.data;Xbe(S)&&S.sequence!==void 0&&S.sequence>this.inSequence&&(this.inSequence=S.sequence,_(C))})})}),(m=A.websocket)==null||m.addEventListener("message",w=>{var C,_,S,E;if(w.data instanceof ArrayBuffer){if(this.exportInfo===null||this.pendingExport===void 0){jt.error("Export intent was not set, but export data was received"),console.error("Export intent was not set, but export data was received");return}switch(this.exportInfo.intent){case"save":{Lbe(w.data,this.pendingExport.toastId).then(()=>{var T;(T=this.pendingExport)==null||T.resolve(null)},(C=this.pendingExport)==null?void 0:C.reject);break}case"make":{qbe(w.data,this.exportInfo.name,this.pendingExport.toastId).then(T=>{var R,k;T?(R=this.pendingExport)==null||R.resolve(null):(k=this.pendingExport)==null||k.reject("Failed to make export")},(_=this.pendingExport)==null?void 0:_.reject);break}}this.exportInfo=null;return}const v=JSON.parse(w.data),x=this.pendingCommands[v.request_id||""];if(x&&!v.success&&(x.reject(`engine error: ${JSON.stringify(v.errors)}`),delete this.pendingCommands[v.request_id||""]),!!(x&&v.success&&(v.resp.type==="modeling"||v.resp.type==="modeling_batch"))){if(v.resp.type==="modeling"&&x.command.type==="modeling_cmd_req"&&v.request_id){this.addCommandLog({type:"receive-reliable",data:v.resp,id:(v==null?void 0:v.request_id)||"",cmd_type:(E=(S=x==null?void 0:x.command)==null?void 0:S.cmd)==null?void 0:E.type});const T=v.resp.data.modeling_response;Object.values(this.subscriptions[T.type]||{}).forEach(R=>R(T)),this.responseMap[v.request_id]=v.resp}else if(v.resp.type==="modeling_batch"&&x.command.type==="modeling_cmd_batch_req"){let T={};x.command.requests.forEach(({cmd:R,cmd_id:k})=>{T[k]={type:"modeling_cmd_req",cmd:R,cmd_id:k}}),Object.entries(v.resp.data.responses).forEach(([R,k])=>{var M;if(!("response"in k))return;const B=T[R];B&&(B.type==="modeling_cmd_req"&&this.addCommandLog({type:"receive-reliable",data:{type:"modeling",data:{modeling_response:k.response}},id:R,cmd_type:(M=B==null?void 0:B.cmd)==null?void 0:M.type}),this.responseMap[R]={type:"modeling",data:{modeling_response:k.response}})})}x.resolve([v]),delete this.pendingCommands[v.request_id||""]}}),this.onEngineConnectionNewTrack=({detail:{mediaStream:w}})=>{w.getVideoTracks()[0].addEventListener("mute",()=>{console.error("video track mute: check webrtc internals -> inbound rtp")}),n(w)},(g=this.engineConnection)==null||g.addEventListener("new-track",this.onEngineConnectionNewTrack),(y=this.engineConnection)==null||y.connect()},this.engineConnection.addEventListener("connection-started",this.onEngineConnectionStarted))}handleResize({streamWidth:n,streamHeight:r}){var s,o;if(!((s=this.engineConnection)!=null&&s.isReady()))return;const i={type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"reconfigure_stream",width:n,height:r,fps:60}};(o=this.engineConnection)==null||o.send(i)}tearDown(n){var r,i,s,o,a,l,c,u,d,f,h,A;if(this.engineConnection){for(const p of Object.values(this.pendingCommands))p.reject("no connection to send on");(i=(r=this.engineConnection)==null?void 0:r.removeEventListener)==null||i.call(r,"opened",this.onEngineConnectionOpened),(o=(s=this.engineConnection).removeEventListener)==null||o.call(s,"closed",this.onEngineConnectionClosed),(l=(a=this.engineConnection).removeEventListener)==null||l.call(a,"connection-started",this.onEngineConnectionStarted),(u=(c=this.engineConnection).removeEventListener)==null||u.call(c,"new-track",this.onEngineConnectionNewTrack),Hs==null||Hs.removeEventListener("change",this.onDarkThemeMediaQueryChange),(d=this.engineConnection)==null||d.tearDown(n)}else(f=this.engineCommandManager)!=null&&f.engineConnection&&((A=(h=this.engineCommandManager)==null?void 0:h.engineConnection)==null||A.tearDown(n))}async startNewSession(){this.orderedCommands=[],this.responseMap={},await this.initPlanes()}subscribeTo({event:n,callback:r}){const i=Yt();return this.subscriptions[n]||(this.subscriptions[n]={}),this.subscriptions[n][i]=r,()=>this.unSubscribeTo(n,i)}unSubscribeTo(n,r){delete this.subscriptions[n][r]}subscribeToUnreliable({event:n,callback:r}){const i=Yt();return this.unreliableSubscriptions[n]||(this.unreliableSubscriptions[n]={}),this.unreliableSubscriptions[n][i]=r,()=>this.unSubscribeToUnreliable(n,i)}unSubscribeToUnreliable(n,r){delete this.unreliableSubscriptions[n][r]}clearDefaultPlanes(){this.defaultPlanes=null}async wasmGetDefaultPlanes(){return this.defaultPlanes===null&&await this.initPlanes(),JSON.stringify(this.defaultPlanes)}endSession(){var r;const n={type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"scene_clear_all"}};this.clearDefaultPlanes(),(r=this.engineConnection)==null||r.send(n)}addCommandLog(n){this.commandLogs.length>500&&this.commandLogs.shift(),this.commandLogs.push(n),this._commandLogCallBack([...this.commandLogs])}clearCommandLogs(){this.commandLogs=[],this._commandLogCallBack(this.commandLogs)}registerCommandLogCallback(n){this._commandLogCallBack=n}sendSceneCommand(n,r=!1){var s,o,a,l,c,u,d,f;if(this.engineConnection===void 0||!((s=this.engineConnection)!=null&&s.isReady()))return Promise.resolve(null);if(n.type==="modeling_cmd_req"&&(n.cmd.type==="highlight_set_entity"||n.cmd.type==="mouse_move"||n.cmd.type==="camera_drag_move"||n.cmd.type==="default_camera_perspective_settings")||this.addCommandLog({type:"send-scene",data:n}),n.type==="modeling_cmd_batch_req")return(o=this.engineConnection)==null||o.send(n),Promise.resolve(null);if(n.type!=="modeling_cmd_req")return Promise.resolve(null);const i=n.cmd;if((i.type==="camera_drag_move"||i.type==="handle_mouse_drag_move"||i.type==="default_camera_zoom"||i.type==="default_camera_perspective_settings")&&((a=this.engineConnection)!=null&&a.unreliableDataChannel)&&!r)return i.sequence=this.outSequence,this.outSequence++,(l=this.engineConnection)==null||l.unreliableSend(n),Promise.resolve(null);if(i.type==="highlight_set_entity"&&((c=this.engineConnection)!=null&&c.unreliableDataChannel))return i.sequence=this.outSequence,this.outSequence++,(u=this.engineConnection)==null||u.unreliableSend(n),Promise.resolve(null);if(i.type==="mouse_move"&&this.engineConnection.unreliableDataChannel)return i.sequence=this.outSequence,this.outSequence++,(d=this.engineConnection)==null||d.unreliableSend(n),Promise.resolve(null);if(i.type==="export"){const h=new Promise((A,p)=>{if(this.exportInfo===null&&this.exportInfo===null){jt.error("Export intent was not set, but export is being sent"),console.error("Export intent was not set, but export is being sent");return}const m=jt.loading(this.exportInfo.intent==="save"?_h.START:Ps.START);this.pendingExport={toastId:m,resolve:g=>{this.addCommandLog({type:"export-done",data:null}),A(g)},reject:g=>{this.exportInfo=null,p(g)},commandId:n.cmd_id}});return(f=this.engineConnection)==null||f.send(n),h}return(n.cmd.type==="default_camera_look_at"||n.cmd.type==="default_camera_perspective_settings")&&(i.sequence=this.outSequence++),this.sendCommand(n.cmd_id,{command:n,idToRangeMap:{},range:[0,0]},!0).then(([h])=>h).catch(h=>null)}async sendModelingCommandFromWasm(n,r,i,s){var u,d;if(this.engineConnection===void 0||!((u=this.engineConnection)!=null&&u.isReady())&&!this.engineConnection.isUsingConnectionLite)return Promise.resolve();if(n===void 0)return Promise.reject(new Error("id is undefined"));if(r===void 0)return Promise.reject(new Error("rangeStr is undefined"));if(i===void 0)return Promise.reject(new Error("commandStr is undefined"));const o=JSON.parse(r),a=JSON.parse(i),l=JSON.parse(s);if((d=this==null?void 0:this.kclManager)!=null&&d.executeIsStale)return Promise.reject(zq);const c=await this.sendCommand(n,{command:a,range:o,idToRangeMap:l});return JSON.stringify(c[0])}async sendCommand(n,r,i=!1){var l;const{promise:s,resolve:o,reject:a}=ewe();return this.pendingCommands[n]={resolve:o,reject:a,promise:s,command:r.command,range:r.range,idToRangeMap:r.idToRangeMap,isSceneCommand:i},r.command.type==="modeling_cmd_req"?this.orderedCommands.push({command:r.command,range:r.range}):r.command.type==="modeling_cmd_batch_req"&&r.command.requests.forEach(c=>{const u={type:"modeling_cmd_req",cmd_id:c.cmd_id,cmd:c.cmd};this.orderedCommands.push({command:u,range:r.idToRangeMap[c.cmd_id||""]})}),(l=this.engineConnection)==null||l.send(r.command),s}async waitForAllCommands(){await Promise.all(Object.values(this.pendingCommands).map(n=>n.promise)),this.artifactGraph=jbe({orderedCommands:this.orderedCommands,responseMap:this.responseMap,ast:this.getAst()}),this.artifactGraph.size?this.deferredArtifactEmptied(null):this.deferredArtifactPopulated(null)}rejectAllModelingCommands(n){Object.values(this.pendingCommands).forEach(({reject:r,isSceneCommand:i})=>!i&&r(n))}async initPlanes(){if(this.planesInitialized())return;const n=await this.makeDefaultPlanes();this.defaultPlanes=n}planesInitialized(){return!!this.defaultPlanes&&this.defaultPlanes.xy!==""&&this.defaultPlanes.yz!==""&&this.defaultPlanes.xz!==""}async setPlaneHidden(n,r){if(this.engineConnection!==void 0&&!(this.engineConnection.state.type==="disconnecting"||this.engineConnection.state.type==="disconnected"))return await this.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"object_visible",object_id:n,hidden:r}})}async setTheme(n){this.sendSceneCommand({cmd_id:Yt(),type:"modeling_cmd_req",cmd:{type:"set_background_color",color:M7(n)}}).catch(Bt);const r=Wq(n);this.sendSceneCommand({cmd_id:Yt(),type:"modeling_cmd_req",cmd:{type:"set_default_system_properties",color:M7(r)}}).catch(Bt)}setScaleGridVisibility(n){this.modifyGrid(!n)}mapRangeToObjectId(n,r){for(const[i,s]of this.artifactGraph)if("codeRef"in s&&Vd(n,s.codeRef.range)&&r===s.type)return i}}function ewe(){let t=()=>{},e=()=>{};return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}}const twe={xy:Yf(),xz:Yf(),yz:Yf(),negXy:Yf(),negXz:Yf(),negYz:Yf()};class nwe{constructor(e){se(this,"waitForReady",new Promise(e=>e()))}startNewSession(){}waitForAllCommands(){}sendModelingCommand({id:e,range:n,command:r}){const i={success:!0,resp:{type:"modeling",data:{modeling_response:{type:"empty"}}}};return Promise.resolve(JSON.stringify(i))}async wasmGetDefaultPlanes(){return JSON.stringify(twe)}sendModelingCommandFromWasm(e,n,r){if(e===void 0)return Promise.reject(new Error("id is undefined"));if(n===void 0)return Promise.reject(new Error("rangeStr is undefined"));if(r===void 0)return Promise.reject(new Error("commandStr is undefined"));const i=JSON.parse(r),s=JSON.parse(n);return this.sendModelingCommand({id:e,range:s,command:i})}sendSceneCommand(){}}async function rwe(t,e=ao.empty(),n=nI()){if(ie(t))return Promise.reject(t);if(ie(e))return Promise.reject(e);const r=new nwe({setIsStreamReady:()=>{},setMediaStream:()=>{}});r.startNewSession();const i=await Nq(t,e,n,r,!0);return await r.waitForAllCommands(),i}const vo=["line","lineTo","angledLine","angledLineOfXLength","angledLineOfYLength","angledLineToX","angledLineToY","xLine","yLine","xLineTo","yLineTo","angledLineThatIntersects","tangentialArcTo"];async function kl({ast:t,engineCommandManager:e,useFakeExecutor:n=!1,programMemoryOverride:r,idGenerator:i}){try{n||(e.endSession(),e.startNewSession());const s=await(n?rwe(t,r||e5()):Nq(t,e5(),i,e,!1));return await e.waitForAllCommands(),{logs:[],errors:[],execState:s,isInterrupted:!1}}catch(s){let o=!1;return s instanceof Bg?(s.msg==='Failed to wait for promise from engine: JsValue("Force interrupt, executionIsStale, new AST requested")'&&(o=!0),{errors:[s],logs:[],execState:Z4(),isInterrupted:o}):(console.log(s),{logs:[s],errors:[],execState:Z4(),isInterrupted:o})}}async function iwe({ast:t}){try{return(await ybe(t)).map(n=>({message:n.finding.title,severity:"info",from:n.pos[0],to:n.pos[1]}))}catch(e){return console.log(e),[]}}function swe(t,e,n){const r=Xe(e,n);if(ie(r))return r;const i=r.node;if(!i||typeof i.start!="number"||!i.end)return new Error("no node found");const s=[i.start,i.end];return E_(t,s)}function E_(t,[e,n]){var o;const r=t.value.findIndex(({__geoMeta:{sourceRange:a}})=>a[0]<=e&&a[1]>=n),i=t.value[r];if(i)return{segment:i,index:r};const s=(o=t.start)==null?void 0:o.__geoMeta.sourceRange;return s&&s[0]<=e&&s[1]>=n&&t.start?{segment:{...t.start,type:"Base"},index:-1}:new Error("could not find matching segment")}function Mg(t,e,n){var l,c,u,d;const r=(l=t==null?void 0:t.id)==null?void 0:l.name;if(!r)return!1;if(r===((c=e==null?void 0:e.id)==null?void 0:c.name))return!0;const{init:i}=t;if(!i||!(i.type==="CallExpression"||i.type==="PipeExpression"))return!1;const s=(i==null?void 0:i.type)==="CallExpression"?i:i==null?void 0:i.body[0];if(!s||!vo.includes((u=s==null?void 0:s.callee)==null?void 0:u.name))return!1;const o=s==null?void 0:s.arguments[1];if(!o||(o==null?void 0:o.type)!=="Identifier")return!1;if(o.name===((d=e==null?void 0:e.id)==null?void 0:d.name))return!0;let a;for(const f of n.body){if(f.type!=="VariableDeclaration")continue;const h=f.declarations.find(({id:A})=>(A==null?void 0:A.name)===o.name);if(h){a=h;break}}return a?Mg(a,e,n):!1}const Yi=new Error("Referenced segment does not have a to value");function cI(t){return typeof t>"u"}function Ro(t){return typeof t=="number"}function Pt(t,e,n,r){const i=t==="circle"?[]:[Pwe(t,e),cn()];n&&i.push(n);const[s,o]=RG(i);return s?(console.error(i),{callExp:Un("",[]),valueUsedInTransform:0}):{callExp:Un(t,o),valueUsedInTransform:r}}function P7(t,e,n,r){const i=[e,cn()];return n&&i.push(n),{callExp:Un(t,i),valueUsedInTransform:r}}function $q({fnName:t,angleVal:e,offsetVal:n,intersectTag:r,tag:i,valueUsedInTransform:s}){const a=[Po({angle:e,offset:n,intersectTag:r}),cn()];return i&&a.push(i),{callExp:Un(t,a),valueUsedInTransform:s}}const nw=(t,e=!1)=>({referenceSegName:n,tag:r,forceValueUsedInTransform:i,rawArgs:s})=>{const o=Va(n),a=i||(e?o:s[0].expr),l=Ya(s[0].expr);return ie(l)?l:Pt(t,a,r,l)},to=(t="none",e="none",n="none")=>({referenceSegName:r,tag:i,forceValueUsedInTransform:s,inputs:o,rawArgs:a,referencedSegment:l})=>{const c=l?xi(l==null?void 0:l.from,l==null?void 0:l.to):0;if(!Ro(a[0].expr.value))return Yi;const u=n==="ang"?o[0].expr:t==="ang"?owe(a[0].expr.value,c,qq(r)):a[0].expr,d=n==="len"?o[1].expr:t==="len"?Va(r):a[1].expr,f=e==="ang"&&s,h=e==="len"&&s,A=Ya(e==="ang"?a[0].expr:a[1].expr);return ie(A)?A:Pt("angledLine",[f?s:u,h?s:d],i,A)},rw=({referenceSegName:t,inputs:e,tag:n})=>Pt("angledLine",[e[0].expr,Va(t)],n),L7=(t,e)=>{const n=Va(t);return[Un("min",[n,e]),Un("legLen",[n,e])]},I7=(t,e,n="legAngX")=>{const r=Un("min",[Va(t),e]),i=Un(n,[Va(t),e]);return[r,i]},O7=(t,e)=>Number(t.value)<0?xl(e):e,F7=(t,e)=>{const n=(t%360+360)%360,r=Math.floor(n/90)*90,i=ou([tt(r),e]);return r===0?e:i},iw=(t,e)=>(t%180+180)%180>90?xl(e):e;function owe(t,e,n){return(Math.abs(t-e)%360+360)%360>90?ou([n,tt(180)]):n}const N7=(t,e=t==="x"?0:1)=>({referenceSegName:n,tag:r,forceValueUsedInTransform:i,rawArgs:s,referencedSegment:o})=>{var d;const a=(d=o==null?void 0:o.to)==null?void 0:d[e],l=Ya(s==null?void 0:s[e].expr);if(ie(l))return l;if(cI(a)||ie(l))return Yi;const c=ot(l-a,2);let u=ou([By(n,!e),i||tt(c)]);return Mwe(i)&&(u=By(n,!e)),Pt("lineTo",e?[s[0].expr,u]:[u,s[1].expr],r,c)},D7=(t,e=t==="x"?0:1)=>({referenceSegName:n,tag:r,forceValueUsedInTransform:i,inputs:s,rawArgs:o,referencedSegment:a})=>{var f;const l=(f=a==null?void 0:a.to)==null?void 0:f[e],c=Ya(o==null?void 0:o[1].expr);if(cI(l)||ie(c))return Yi;const u=ot(c-l,2),d=ou([By(n,!e),i||tt(u)]);return Pt(t==="x"?"angledLineToX":"angledLineToY",[s[0].expr,d],r,u)},sw=(t,e=!1,n=t==="x"?0:1)=>({tag:r,forceValueUsedInTransform:i,rawArgs:s})=>{const o=Ya(s==null?void 0:s[n].expr);if(ie(o))return Yi;const a=ot(o,2),l=i||tt(a);return e?Pt(t==="x"?"xLineTo":"yLineTo",l,r,a):Pt("lineTo",n?[s[0].expr,l]:[l,s[1].expr],r,a)},U7=t=>({tag:e,forceValueUsedInTransform:n,inputs:r,rawArgs:i})=>{const s=Ya(i==null?void 0:i[1].expr);if(ie(s))return Yi;const o=ot(s,2),a=n||tt(o);return Pt(t==="x"?"angledLineToX":"angledLineToY",[r[0].expr,a],e,o)},H7=t=>({referenceSegName:e,tag:n,forceValueUsedInTransform:r,rawArgs:i,referencedSegment:s})=>{var d;const o=t==="x"?0:1,a=(d=s==null?void 0:s.to)==null?void 0:d[o],l=Ya(i==null?void 0:i[o].expr);if(cI(a)||ie(l))return Yi;const c=ot(l-a,2),u=ou([By(e,t==="x"),r||tt(c)]);return Pt(t==="x"?"xLineTo":"yLineTo",u,n,c)},j7=t=>({referenceSegName:e,tag:n,inputs:r,rawArgs:i,referencedSegment:s})=>{let o=t?r[1].expr:r[0].expr;o=Ga(o)?o:tt(0);const a=ou([Awe(!t),o]),l=u=>{var h;const d=Ya(i==null?void 0:i[u].expr),f=(h=s==null?void 0:s.to)==null?void 0:h[u];return ie(d)||!Ro(f)?Yi:ou([By(e,t),tt(ot(d-f,2))])},c=l(t?0:1);return ie(c)?new Error("Invalid value for distance"):Pt("lineTo",t?[c,a]:[a,c],n)},IT=({referenceSegName:t,tag:e,forceValueUsedInTransform:n,rawArgs:r})=>{const i=r[1].expr.value,s=r[0].expr.value;if(!Ro(i)||!Ro(s))return Yi;const o=ot(i,2),a={0:"ZERO",90:"QUARTER_TURN",180:"HALF_TURN",270:"THREE_QUARTER_TURN"},l=[0,90,180,270].includes(s)?zn(a[s]):tt(s);return $q({fnName:"angledLineThatIntersects",angleVal:l,offsetVal:n||tt(o),intersectTag:zn(t),tag:e,valueUsedInTransform:o})},awe=({referenceSegName:t,tag:e,forceValueUsedInTransform:n,inputs:r,rawArgs:i})=>{const s=i[1].expr.value;if(!Ro(s))return Yi;const o=ot(s,2);return $q({fnName:"angledLineThatIntersects",angleVal:r[0].expr,offsetVal:n||tt(o),intersectTag:zn(t),tag:e,valueUsedInTransform:o})},OT=t=>({referenceSegName:e,tag:n,forceValueUsedInTransform:r,inputs:i,rawArgs:s,referencedSegment:o})=>{const a=o?xi(o==null?void 0:o.from,o==null?void 0:o.to):0,l=s[0].expr.value;if(!Ro(l))return Yi;let c=ot(tg(l-a)),u=qq(e);Math.abs(c)>90&&(u=My([u,"+",zn("HALF_TURN")]),c=tg(c-180));const d=ou([u,r||tt(c)]);return Pt(t==="none"?"angledLine":t==="xAbs"?"angledLineToX":"angledLineToY",t==="none"?[d,s[1].expr]:t==="xAbs"?[d,i[0].expr]:[d,i[1].expr],n,c)},Rc={line:{xRelative:{equalLength:{tooltip:"line",createNode:({referenceSegName:t,inputs:e,tag:n,rawArgs:r})=>{const[i,s]=L7(t,e[0].expr);return Pt("line",[i,O7(r[1].expr,s)],n)}},horizontal:{tooltip:"xLine",createNode:({inputs:t,tag:e})=>Pt("xLine",t[0].expr,e)},setVertDistance:{tooltip:"lineTo",createNode:j7(!1)}},yRelative:{equalLength:{tooltip:"line",createNode:({referenceSegName:t,inputs:e,tag:n,rawArgs:r})=>{const[i,s]=L7(t,e[1].expr);return Pt("line",[O7(r[0].expr,s),i],n)}},vertical:{tooltip:"yLine",createNode:({inputs:t,tag:e})=>Pt("yLine",t[1].expr,e)},setHorzDistance:{tooltip:"lineTo",createNode:j7(!0)}},free:{equalLength:{tooltip:"angledLine",createNode:to("len")},horizontal:{tooltip:"xLine",createNode:({tag:t,rawArgs:e})=>Pt("xLine",e[0].expr,t)},vertical:{tooltip:"yLine",createNode:({tag:t,rawArgs:e})=>Pt("yLine",QA(e,"yRelative").expr,t)},setHorzDistance:{tooltip:"lineTo",createNode:N7("x")},xAbs:{tooltip:"lineTo",createNode:sw("x")},setVertDistance:{tooltip:"lineTo",createNode:N7("y")},yAbs:{tooltip:"lineTo",createNode:sw("y")},setAngle:{tooltip:"angledLine",createNode:to("none","ang")},setLength:{tooltip:"angledLine",createNode:to("none","len")},equalAngle:{tooltip:"angledLine",createNode:to("ang")},intersect:{tooltip:"angledLineThatIntersects",createNode:IT},setAngleBetween:{tooltip:"angledLine",createNode:OT("none")}}},lineTo:{free:{equalLength:{tooltip:"angledLine",createNode:to("len")},horizontal:{tooltip:"xLineTo",createNode:({tag:t,rawArgs:e})=>Pt("xLineTo",e[0].expr,t)},vertical:{tooltip:"yLineTo",createNode:({tag:t,rawArgs:e})=>Pt("yLineTo",QA(e,"yAbsolute").expr,t)}},xAbsolute:{equalLength:{tooltip:"angledLineToX",createNode:({referenceSegName:t,inputs:e,tag:n,rawArgs:r})=>{const i=Un("angleToMatchLengthX",[zn(t),e[0].expr,cn()]);return Ro(r[0].expr.value)?Pt("angledLineToX",[iw(r[0].expr.value,i),e[0].expr],n):Yi}},horizontal:{tooltip:"xLineTo",createNode:({inputs:t,tag:e})=>Pt("xLineTo",t[0].expr,e)},setAngleBetween:{tooltip:"angledLineToX",createNode:OT("xAbs")}},yAbsolute:{equalLength:{tooltip:"angledLineToY",createNode:({referenceSegName:t,inputs:e,tag:n,rawArgs:r})=>{const i=Un("angleToMatchLengthY",[zn(t),e[1].expr,cn()]);return Ro(r[0].expr.value)?Pt("angledLineToY",[iw(r[0].expr.value,i),e[1].expr],n):Yi}},vertical:{tooltip:"yLineTo",createNode:({inputs:t,tag:e})=>Pt("yLineTo",t[1].expr,e)},setAngle:{tooltip:"angledLineToY",createNode:({inputs:t,tag:e,forceValueUsedInTransform:n,rawArgs:r})=>{const i=Ya(r[0].expr);return ie(i)?i:Pt("angledLineToY",[n||r[0].expr,t[1].expr],e,i)}},setAngleBetween:{tooltip:"angledLineToY",createNode:OT("yAbs")}}},angledLine:{angle:{equalLength:{tooltip:"angledLine",createNode:({referenceSegName:t,inputs:e,tag:n})=>Pt("angledLine",[e[0].expr,Va(t)],n)},setLength:{tooltip:"angledLine",createNode:to("none","len","ang")},setVertDistance:{tooltip:"angledLineToY",createNode:D7("y")},yAbs:{tooltip:"angledLineToY",createNode:U7("y")},setHorzDistance:{tooltip:"angledLineToX",createNode:D7("x")},xAbs:{tooltip:"angledLineToX",createNode:U7("x")},intersect:{tooltip:"angledLineThatIntersects",createNode:awe}},free:{equalLength:{tooltip:"angledLine",createNode:to("len")},setLength:{tooltip:"angledLine",createNode:to("none","len")},vertical:{tooltip:"yLine",createNode:({tag:t,rawArgs:e})=>Pt("yLine",QA(e,"yRelative").expr,t)},horizontal:{tooltip:"xLine",createNode:({tag:t,rawArgs:e})=>Pt("xLine",e[0].expr,t)}},length:{vertical:{tooltip:"yLine",createNode:({inputs:t,tag:e,rawArgs:n})=>{const r=t[1].expr;return Number(n[0].expr.value)>=0?Pt("yLine",r,e):Ga(r)?Pt("yLine",xl(r),e):Pt("yLine",r,e)}},horizontal:{tooltip:"xLine",createNode:({inputs:t,tag:e,rawArgs:n})=>{const r=t[1].expr;return Number(n[0].expr.value)>=0?Pt("xLine",r,e):Ga(r)?Pt("xLine",xl(r),e):Pt("xLine",r,e)}},setAngle:{tooltip:"angledLine",createNode:to("len","ang","len")},equalAngle:{tooltip:"angledLine",createNode:to("ang","len","len")}}},angledLineOfXLength:{free:{equalLength:{tooltip:"angledLine",createNode:to("len")},horizontal:{tooltip:"xLine",createNode:({tag:t,rawArgs:e})=>Pt("xLine",e[0].expr,t)}},angle:{equalLength:{tooltip:"angledLine",createNode:rw}},xRelative:{equalLength:{tooltip:"angledLineOfXLength",createNode:({referenceSegName:t,inputs:e,tag:n,rawArgs:r})=>{const[i,s]=I7(t,QA(e,"xRelative").expr);return Ro(r[0].expr.value)?Pt("angledLineOfXLength",[F7(r[0].expr.value,s),i],n):Yi}},horizontal:{tooltip:"xLine",createNode:({inputs:t,tag:e,rawArgs:n})=>{const r=t[1].expr;return Number(n[0].expr.value)>=0?Pt("xLine",r,e):Ga(r)?Pt("xLine",xl(r),e):Pt("xLine",r,e)}}}},angledLineOfYLength:{free:{equalLength:{tooltip:"angledLine",createNode:to("len")},vertical:{tooltip:"yLine",createNode:({tag:t,rawArgs:e})=>Pt("yLine",QA(e,"yRelative").expr,t)}},angle:{equalLength:{tooltip:"angledLine",createNode:rw}},yRelative:{equalLength:{tooltip:"angledLineOfYLength",createNode:({referenceSegName:t,inputs:e,tag:n,rawArgs:r})=>{const[i,s]=I7(t,e[1].expr,"legAngY");return Ro(r[0].expr.value)?Pt("angledLineOfXLength",[F7(r[0].expr.value,s),i],n):Yi}},vertical:{tooltip:"yLine",createNode:({inputs:t,tag:e,rawArgs:n})=>{const r=t[1].expr;return Number(n[0].expr.value)>=0?Pt("yLine",r,e):Ga(r)?Pt("yLine",xl(r),e):Pt("yLine",r,e)}}}},angledLineToX:{free:{equalLength:{tooltip:"angledLine",createNode:to("len")},horizontal:{tooltip:"xLineTo",createNode:({tag:t,rawArgs:e})=>Pt("xLineTo",e[0].expr,t)}},angle:{equalLength:{tooltip:"angledLine",createNode:rw}},xAbsolute:{equalLength:{tooltip:"angledLineToX",createNode:({referenceSegName:t,inputs:e,tag:n,rawArgs:r})=>{const i=Un("angleToMatchLengthX",[zn(t),e[1].expr,cn()]);return Ro(r[0].expr.value)?Pt("angledLineToX",[iw(r[0].expr.value,i),e[1].expr],n):Yi}},horizontal:{tooltip:"xLineTo",createNode:({inputs:t,tag:e})=>Pt("xLineTo",t[1].expr,e)}}},angledLineToY:{free:{equalLength:{tooltip:"angledLine",createNode:to("len")},vertical:{tooltip:"yLineTo",createNode:({tag:t,rawArgs:e})=>Pt("yLineTo",QA(e,"yAbsolute").expr,t)}},angle:{equalLength:{tooltip:"angledLine",createNode:rw}},yAbsolute:{equalLength:{tooltip:"angledLineToY",createNode:({referenceSegName:t,inputs:e,tag:n,rawArgs:r})=>{const i=Un("angleToMatchLengthY",[zn(t),e[1].expr,cn()]);return Ro(r[0].expr.value)?Pt("angledLineToY",[iw(r[0].expr.value,i),e[1].expr],n):Yi}},vertical:{tooltip:"yLineTo",createNode:({inputs:t,tag:e})=>Pt("yLineTo",t[1].expr,e)}}},xLine:{free:{equalLength:{tooltip:"xLine",createNode:({referenceSegName:t,tag:e,rawArgs:n})=>{const r=Ya(n[0].expr);if(ie(r))return r;const i=Va(t);return r>0?Pt("xLine",i,e,r):Ga(i)?Pt("xLine",xl(i),e,r):Pt("xLine",i,e,r)}},setHorzDistance:{tooltip:"xLineTo",createNode:H7("x")},setLength:{tooltip:"xLine",createNode:nw("xLine")},intersect:{tooltip:"angledLineThatIntersects",createNode:IT},xAbs:{tooltip:"xLineTo",createNode:sw("x",!0)}}},yLine:{free:{equalLength:{tooltip:"yLine",createNode:({referenceSegName:t,tag:e,rawArgs:n})=>{const r=Ya(n[0].expr);if(ie(r))return r;let i=Va(t);return r<0&&(i=xl(i)),Pt("yLine",i,e,r)}},setLength:{tooltip:"yLine",createNode:nw("yLine")},setVertDistance:{tooltip:"yLineTo",createNode:H7("y")},intersect:{tooltip:"angledLineThatIntersects",createNode:IT},yAbs:{tooltip:"yLineTo",createNode:sw("y",!0)}}},xLineTo:{free:{equalLength:{tooltip:"xLine",createNode:({referenceSegName:t,tag:e})=>Pt("xLine",Va(t),e)},setLength:{tooltip:"xLine",createNode:nw("xLine")}}},yLineTo:{free:{equalLength:{tooltip:"yLine",createNode:({referenceSegName:t,tag:e})=>Pt("yLine",Va(t),e)},setLength:{tooltip:"yLine",createNode:nw("yLine")}}}};function lwe(t,e){let n=t.callee.name;if(!vo.includes(n))return!1;const i={xLine:"line",yLine:"line",xLineTo:"lineTo",yLineTo:"lineTo"}[n];i&&(n=i);const s={tooltip:"line",createNode:({tag:u,referenceSegName:d,rawArgs:f})=>Pt("line",[f[0].expr,f[1].expr],u)},o=A2(t);return ie(o)?(console.error(o),!1):Ts(o.val)?s:Array.isArray(o.val)&&is(o.val)?!1:!Array.isArray(o.val)&&is(o.val)||uI(o.val,n)?s:!1}function cwe({pathToCallExp:t,inputDetails:e,ast:n}){const r=Xe(n,t,"CallExpression");return ie(r)?(console.error(r),!1):r.node.type!=="CallExpression"?(console.error(new Error("Invalid node type")),!1):{tooltip:r.node.callee.name,createNode:({tag:s,inputs:o,rawArgs:a})=>{if(e.type==="arrayItem"){const l=o.map(c=>{var d;if(!((c.type==="arrayItem"||c.type==="arrayOrObjItem")&&c.index===e.index))return c.expr;const u=(d=a.find(f=>(f.type==="arrayItem"||f.type==="arrayOrObjItem")&&f.index===e.index))==null?void 0:d.expr;return c.index===e.index&&u||c.expr});return P7(r.node.callee.name,bn(l),s)}if(e.type==="arrayInObject"||e.type==="objectProperty"){const l={},c={};o.forEach(f=>{if(f.type!=="objectProperty"&&f.type!=="arrayOrObjItem"&&f.type!=="arrayInObject")return;const h=a.find(p=>p.type==="arrayInObject"&&p.key===e.key&&p.index===(f.type==="arrayInObject"?f.index:-1)),A=a.find(p=>(p.type==="objectProperty"||p.type==="arrayOrObjItem"||p.type==="arrayInObject")&&p.key===e.key);e.type==="arrayInObject"&&(h==null?void 0:h.type)==="arrayInObject"&&(h==null?void 0:h.index)===e.index&&(h==null?void 0:h.key)===e.key?(l[f.key]||(l[f.key]=[]),l[e.key][e.index]=h.expr):e.type==="objectProperty"&&((A==null?void 0:A.type)==="objectProperty"||(A==null?void 0:A.type)==="arrayOrObjItem")&&(A==null?void 0:A.key)===e.key&&f.key===e.key?c[e.key]=A.expr:f.type==="arrayInObject"?(l[f.key]||(l[f.key]=[]),l[f.key][f.index]=f.expr):f.type==="objectProperty"&&(c[f.key]=f.expr)});const u={};Object.entries(l).forEach(([f,h])=>{u[f]=bn(h)});const d=Po({...u,...c});return P7(r.node.callee.name,d,s)}return Pt(r.node.callee.name,a[0].expr,s)}}}function uwe(t,e){var s,o,a,l;const n=t.callee.name;if(!vo.includes(n))return!1;const r=A2(t);if(ie(r))return console.error(r),!1;if(Ts(r.val))return!1;if(is(r.val)&&((o=(s=Rc==null?void 0:Rc[n])==null?void 0:s.free)==null?void 0:o[e]))return{toolTip:n,lineInputType:"free",constraintType:e};const i=uI(r.val,n);return i&&((l=(a=Rc==null?void 0:Rc[n])==null?void 0:a[i])==null?void 0:l[e])?{toolTip:n,lineInputType:i,constraintType:e}:!1}function dwe(t,e){var a,l;const n=uwe(t,e);if(!n)return!1;const{toolTip:r,lineInputType:i,constraintType:s}=n,o=(l=(a=Rc==null?void 0:Rc[r])==null?void 0:a[i])==null?void 0:l[s];return o||!1}function uI(t,e){if(Array.isArray(t)){const r=Ts(t[0]);if(e==="line")return r?"xRelative":"yRelative";if(e==="lineTo")return r?"xAbsolute":"yAbsolute";if(e==="angledLine")return r?"angle":"length";if(e==="angledLineOfXLength")return r?"angle":"xRelative";if(e==="angledLineToX")return r?"angle":"xAbsolute";if(e==="angledLineOfYLength")return r?"angle":"yRelative";if(e==="angledLineToY")return r?"angle":"yAbsolute"}else{if(e==="xLine")return"yRelative";if(e==="yLine")return"xRelative";if(e==="xLineTo")return"yAbsolute";if(e==="yLineTo")return"xAbsolute"}return null}function Sf(t,e,n){const i=t.codeBasedSelections.map(({range:s})=>un(e,s)).map(s=>Xe(e,s,"CallExpression"));try{return i.map(o=>{if(ie(o))return console.error(o),!1;const a=o.node;return(a==null?void 0:a.type)==="CallExpression"?dwe(a,n):!1})}catch(s){return console.log("error",s),[]}}function fwe(t,e,n){return t.codeBasedSelections.map(o=>un(e,o.range)).map(o=>Xe(e,o)).map(o=>{if(ie(o))return console.error(o),!1;const a=o.node;return(a==null?void 0:a.type)==="CallExpression"?lwe(a):!1})}function iu({ast:t,selectionRanges:e,transformInfos:n,programMemory:r,forceSegName:i,forceValueUsedInTransform:s}){const o=e.codeBasedSelections.toSorted((m,g)=>m.range[0]-g.range[0]),a=o[0].range,l=o.slice(1),c=wwe(t,a,i);if(ie(c))return c;const{modifiedAst:u,tag:d,isTagExisting:f,pathToNode:h}=c,A=su({ast:u,selectionRanges:{...e,codeBasedSelections:l},referencedSegmentRange:a,transformInfos:n,programMemory:r,referenceSegName:d,forceValueUsedInTransform:s});if(ie(A))return A;const p=hwe(A.pathToNodeMap);return p[0]=h,{...A,pathToNodeMap:p,tagInfo:{tag:d,isTagExisting:f}}}function hwe(t,e=1){const n={};return Object.entries(t).forEach(([r,i])=>{n[Number(r)+e]=i}),n}function su({ast:t,selectionRanges:e,transformInfos:n,programMemory:r,referenceSegName:i,forceValueUsedInTransform:s,referencedSegmentRange:o}){let a=structuredClone(t),l;const c={},u=(d,f)=>{var Y,$,ee;const h=n==null?void 0:n[f].createNode,A=n==null?void 0:n[f].tooltip;if(!h||!A)return new Error("no callback helper");const p=lA(a,d),m=p("CallExpression");if(ie(m))return m;const g=p("VariableDeclarator");if(ie(g))return g;const y=m.node.arguments[2],w=((Y=m.node.arguments[0])==null?void 0:Y.type)==="ObjectExpression"&&((ee=($=m.node.arguments[0].properties)==null?void 0:$.find(W=>W.key.name==="intersectTag"))==null?void 0:ee.value),v=i||w&&w.type==="Identifier"&&String(w.name)||"",x=[];AI(m.node,"",d).forEach(W=>{var Se,fe,ge,Oe;if(W.type==="tangentialWithPrevious"||W.type==="horizontal"||W.type==="vertical")return;const ne=Xe(t,W.pathToNode);ie(ne)||(((Se=W==null?void 0:W.argPosition)==null?void 0:Se.type)==="arrayItem"?x.push({type:"arrayItem",index:W.argPosition.index,expr:ne.node,argType:W.type}):((fe=W==null?void 0:W.argPosition)==null?void 0:fe.type)==="objectProperty"?x.push({type:"objectProperty",key:W.argPosition.key,expr:ne.node,argType:W.type}):((ge=W==null?void 0:W.argPosition)==null?void 0:ge.type)==="singleValue"?x.push({type:"singleValue",argType:W.type,expr:ne.node}):((Oe=W==null?void 0:W.argPosition)==null?void 0:Oe.type)==="arrayInObject"&&x.push({type:"arrayInObject",key:W.argPosition.key,index:W.argPosition.index,expr:ne.node,argType:W.type}))});const C=g.node.id.name;let _=r.get(C),S;if((_==null?void 0:_.type)==="Solid")S=_.sketch;else if(S=js(_,C),ie(S))return;const E=swe(S,t,d);if(ie(E))return E;const T=E.segment;let R;if(o){const W=E_(S,o);if(ie(W))return W;R=W.segment}else R=S.value.find(W=>{var ne;return((ne=W.tag)==null?void 0:ne.value)===v});const{to:k,from:B}=T,M=Xwe({node:a,programMemory:r,pathToNode:d,referencedSegment:R,fnName:A||m.node.callee.name,segmentInput:T.type==="Circle"?{type:"arc-segment",center:T.center,radius:T.radius,from:B}:{type:"straight-segment",to:k,from:B},replaceExistingCallback:W=>h({referenceSegName:v,inputs:x,tag:y,rawArgs:W,forceValueUsedInTransform:s,referencedSegment:R})});if(ie(M))return M;const{modifiedAst:F,valueUsedInTransform:I,pathToNode:z}=M;a=F,c[f]=z,typeof I=="number"&&(l=I)};if("codeBasedSelections"in e){const d=e.codeBasedSelections.map(({range:f},h)=>u(un(a,f),h)).filter(ie);if(d.length)return d[0]}else{const d=e.map(u).filter(ie);if(d.length)return d[0]}return{modifiedAst:a,valueUsedInTransform:l,pathToNodeMap:c}}function Va(t){return Un("segLen",[zn(t)])}function qq(t){return Un("segAng",[zn(t)])}function By(t,e){return Un(e?"segEndX":"segEndY",[zn(t)])}function Awe(t){return Un(t?"lastSegX":"lastSegY",[cn()])}function Ya(t){return Ro(t.value)?t.value:Yi}function pwe(t,e){var c;if(ie(e))return e;const n=Xe(e,un(e,t),"CallExpression");if(ie(n))return n;const{node:r}=n,i=(c=r==null?void 0:r.callee)==null?void 0:c.name,s=[r.start,r.end];if(!vo.includes(i))return{level:"free",range:s};const o=A2(r);if(ie(o))return o;if(Ts(o.val))return{level:"full",range:s};const a=Array.isArray(o.val)&&is(o.val),l=!Array.isArray(o.val)&&is(o.val);return a?{level:"free",range:s}:l?{level:"partial",range:s}:{level:"partial",range:s}}function is(t){if(!t)return!1;if(Array.isArray(t)){const e=t[0],n=t[1];return is(e)&&is(n)}return t.type==="Literal"||t.type==="UnaryExpression"&&t.argument.type==="Literal"}function Ts(t){if(Array.isArray(t)){const e=t[0],n=t[1];return Ts(e)&&Ts(n)}return t.type!=="Literal"&&t.type!=="UnaryExpression"||t.type==="UnaryExpression"&&t.argument.type!=="Literal"}function Ga(t){return t.type==="Literal"||t.type==="Identifier"||t.type==="BinaryExpression"||t.type==="CallExpression"||t.type==="UnaryExpression"||t.type==="MemberExpression"}function QA(t,e){return t.find(({argType:n})=>n===e)||t[0]}function mwe(t,e,n=""){const r={...t},i=n||jo(t,f2.SKETCH),s=lr("startSketchOn",[tt(e)]),o=Ta(i,s);r.body=[...t.body,o];const a=r.body.length-1;return{modifiedAst:r,id:i,pathToNode:[["body",""],[a,"index"],["declarations","VariableDeclaration"],["0","index"],["init","VariableDeclarator"]]}}function gwe(t,e,n){const r=Xe(t,e,"VariableDeclaration");if(ie(r))return r;const i=r.node;if(i.type!=="VariableDeclaration")return new Error("variableDeclaration.init.type !== PipeExpression");const s={...t},o=i.declarations[0].init,a=lr("startProfileAt",[bn([tt(ot(n[0])),tt(ot(n[1]))]),cn()]);return o.type==="PipeExpression"?o.body.splice(1,0,a):i.declarations[0].init=Yl([o,a]),{modifiedAst:s,pathToNode:e}}function jo(t,e,n=3,r=1){let i=typeof t=="string"?t:JSON.stringify(t);const s=String(r).padStart(n,"0"),o=/\d+$/,a=e.match(o);let l=i.includes(`:"${e}"`);if(a!==null){if(!l)return e;const u=a[1].length,d=parseInt(a[1])+1,f=e.replace(o,"");return jo(i,f,u,d)}const c=`${e}${s}`;return l=i.includes(`:"${c}"`),l?jo(i,e,n,r+1):c}function gu(t,e){return t.type==="ArrayExpression"?(t.elements.forEach((n,r)=>{is(n)&&(t.elements[r]=e.elements[r])}),!0):!1}function Gr(t,e,n){if(t.type==="ObjectExpression"){const r=t.properties.findIndex(i=>i.key.name===n);if(r!==-1){if(is(e)&&is(t.properties[r].value))return t.properties[r].value=e,!0;if(t.properties[r].value.type==="ArrayExpression"&&e.type==="ArrayExpression"){const i=t.properties[r].value;i.elements.forEach((s,o)=>{is(s)&&(i.elements[o]=e.elements[o])})}return!0}else t.properties.push({type:"ObjectProperty",key:zn(n),value:e,start:0,end:0})}return!1}function ywe(t,e,n=!1,r=tt(4)){const i=structuredClone(t),s=Xe(i,e);if(ie(s))return s;const{node:o}=s,a=Xe(i,e,"PipeExpression");if(ie(a))return a;const{node:l}=a,c=l.type==="PipeExpression",u=Xe(i,e,"VariableDeclarator");if(ie(u))return u;const{node:d,shallowPath:f}=u,h=lr("extrude",[r,n?cn():zn(d.id.name)]);if(n){const w=Yl(c?[...l.body,h]:[o,h]);d.init=w;const v=[...f,["init","VariableDeclarator"],["body",""],[w.body.length-1,"index"],["arguments","CallExpression"],[0,"index"]];return{modifiedAst:i,pathToNode:e,pathToExtrudeArg:v}}const A=jo(t,f2.EXTRUDE),p=Ta(A,h),m=f.findIndex(w=>w[0]==="body")+1,g=f[m][0];i.body.splice(g+1,0,p);const y=[["body",""],[g+1,"index"],["declarations","VariableDeclaration"],[0,"index"],["init","VariableDeclarator"],["arguments","CallExpression"],[0,"index"]];return{modifiedAst:i,pathToNode:[...e.slice(0,-1),[-1,"index"]],pathToExtrudeArg:y}}function vwe(t,e,n=!1,r=tt(4)){const i=structuredClone(t),s=Xe(i,e);if(ie(s))return s;const{node:o}=s,a=Xe(i,e,"PipeExpression");if(ie(a))return a;const{node:l}=a,c=l.type==="PipeExpression",u=Xe(i,e,"VariableDeclarator");if(ie(u))return u;const{node:d,shallowPath:f}=u,h=lr("revolve",[Po({angle:r,axis:tt("X")}),zn(d.id.name)]);if(n){const w=Yl(c?[...l.body,h]:[o,h]);d.init=w;const v=[...f,["init","VariableDeclarator"],["body",""],[w.body.length-1,"index"],["arguments","CallExpression"],[0,"index"]];return{modifiedAst:i,pathToNode:e,pathToRevolveArg:v}}const A=jo(t,f2.REVOLVE),p=Ta(A,h),m=f.findIndex(w=>w[0]==="body")+1,g=f[m][0];if(typeof g!="number")return new Error("expected sketchIndexInBody to be a number");i.body.splice(g+1,0,p);const y=[["body",""],[g+1,"index"],["declarations","VariableDeclaration"],[0,"index"],["init","VariableDeclarator"],["arguments","CallExpression"],[0,"index"]];return{modifiedAst:i,pathToNode:[...e.slice(0,-1),[-1,"index"]],pathToRevolveArg:y}}function bwe(t,e,n,r={type:"wall"}){var y;let i={...t};const s=jo(t,f2.SKETCH),o=Xe(i,e,"VariableDeclarator",!0);if(ie(o))return o;const{node:a}=o,l=a.id.name,c=Xe(i,e,"CallExpression");if(ie(c))return c;const{node:u}=c,d=Xe(i,n,"VariableDeclarator");if(ie(d))return d;const{node:f}=d,h=(y=f.id)==null?void 0:y.name;let A;if(r.type!=="cap"){const w=iX({pathToNode:e,node:i},u.callee.name,r.type==="edgeCut"?r:null);if(ie(w))return w;const{modifiedAst:v,tag:x}=w;A=zn(x),i=v}else A=tt(r.subType.toUpperCase());const p=Ta(s,lr("startSketchOn",[zn(h||l),A]),void 0,"const"),m=Math.max(e[1][0],n[1][0]);i.body.splice(m+1,0,p);const g=[["body",""],[m+1,"index"],["declarations","VariableDeclaration"],[0,"index"],["init","VariableDeclarator"]];return{modifiedAst:i,pathToNode:g}}function Xq(t){const e=t[t.length-1];return e&&typeof e[0]=="number"?{path:t.slice(0,-1),index:e[0]}:t.length===0?{path:[],index:-1}:Xq(t.slice(0,-1))}function Ys(t){var n;const e=t[t.length-1];return e&&e[1]==="index"&&((n=t==null?void 0:t[t.length-2])==null?void 0:n[1])==="PipeExpression"&&typeof e[0]=="number"?{path:t.slice(0,-1),index:e[0]}:t.length===0?{path:[],index:-1}:Ys(t.slice(0,-1))}function tt(t){return{type:"Literal",start:0,end:0,value:t,raw:`${t}`}}function rm(t){return{type:"TagDeclarator",start:0,end:0,value:t}}function zn(t){return{type:"Identifier",start:0,end:0,name:t}}function cn(){return{type:"PipeSubstitution",start:0,end:0}}function lr(t,e){return{type:"CallExpression",start:0,end:0,callee:{type:"Identifier",start:0,end:0,name:t},optional:!1,arguments:e}}function Un(t,e){return{type:"CallExpression",start:0,end:0,callee:{type:"Identifier",start:0,end:0,name:t},optional:!1,arguments:e}}function bn(t){return{type:"ArrayExpression",start:0,end:0,nonCodeMeta:dI(),elements:t}}function Yl(t){return{type:"PipeExpression",start:0,end:0,body:t,nonCodeMeta:dI()}}function Ta(t,e,n="default",r="const"){return{type:"VariableDeclaration",start:0,end:0,declarations:[{type:"VariableDeclarator",start:0,end:0,id:zn(t),init:e}],visibility:n,kind:r}}function Po(t){return{type:"ObjectExpression",start:0,end:0,nonCodeMeta:dI(),properties:Object.entries(t).map(([e,n])=>({type:"ObjectProperty",start:0,end:0,key:zn(e),value:n}))}}function xl(t,e="-"){return{type:"UnaryExpression",start:0,end:0,operator:e,argument:t}}function My([t,e,n]){return{type:"BinaryExpression",start:0,end:0,operator:e,left:t,right:n}}function ou([t,e]){return e.type==="UnaryExpression"&&e.operator==="-"?My([t,"-",e.argument]):My([t,"+",e])}function wwe(t,e,n){var c;const r=un(t,e),i=Xe(t,r,"CallExpression");if(ie(i))return i;const{node:s}=i,o=(c=s.arguments)==null?void 0:c[2],a=o||rm(n||jo(t,"seg",2)),l=!!o;return l||(s.arguments[2]=a),"value"in a?{modifiedAst:t,tag:String(a.value),isTagExisting:l,pathToNode:r}:new Error("Unable to assign tag without value")}function xwe(t,e,n,r){const i=fI(t,n);if(pt(i))return{modifiedAst:t};const{isSafe:s,value:o,replacer:a}=i;if(!s||o.type==="Identifier")return{modifiedAst:t};const{insertIndex:l}=Jq(t,e,n);let c=structuredClone(t);const u=a(c,r);return pt(u)?{modifiedAst:t}:(c=u.modifiedAst,c.body.splice(l,0,Ta(r,o)),{modifiedAst:c,pathToReplacedNode:u.pathToReplaced})}function Cwe(t,e,n,r){const i=eX(t,n);if(pt(i))return{modifiedAst:t};const{isSafe:s,value:o,replacer:a}=i;if(!s||o.type==="Identifier")return{modifiedAst:t};const{insertIndex:l}=Zq(t,e,n);let c=structuredClone(t);const u=a(c,r);if(pt(u))return{modifiedAst:t};const{modifiedAst:d,pathToReplaced:f}=u;return c=d,c.body.splice(l,0,Ta(r,o)),{modifiedAst:c,pathToReplacedNode:f}}function _we(t,e,n,r,i){let s=structuredClone(e);t.forEach(c=>{const u=un(s,c),d=Xe(s,u,"CallExpression",!0);if(ie(d))return d;const f=AI(d.node,r,u).find(({sourceRange:A})=>Vd(A,c));if(!f||!f.argPosition)return;const h=Yq(d.shallowPath,f.argPosition,s,n);h&&(s=h.modifiedAst)});const o=Xe(s,i,"PipeExpression");if(ie(o))return o;const a=i.findIndex(([c,u])=>u==="PipeExpression"),l=i[a+1];return o.node.body.splice(l[0],1),l[0]=Math.max(l[0]-1,0),s}function Yq(t,e,n,r){const i=cwe({pathToCallExp:t,inputDetails:e,ast:n});if(!i)return!1;const s=su({ast:n,selectionRanges:[t],transformInfos:[i],programMemory:r,referenceSegName:""});return ie(s)?!1:s}async function Swe(t,e,n,r=()=>({})){const i=structuredClone(t),s=e.range,o=un(t,s),a=Xe(t,o,"VariableDeclarator");if(ie(a))return a;if((e.type==="extrude-wall"||e.type==="end-cap"||e.type==="start-cap")&&a.node.init.type==="PipeExpression"){const l=a.node.id.name;let c=null,u="";if(Vl(i,{enter:(f,h)=>{var A,p;if(f.type==="VariableDeclaration"){const m=f.declarations[0];m.init.type==="CallExpression"&&(m.init.callee.name==="extrude"||m.init.callee.name==="revolve")&&((A=m.init.arguments)==null?void 0:A[1].type)==="Identifier"&&((p=m.init.arguments)==null?void 0:p[1].name)===l&&(c=h,u=m.id.name)}}}),!c)return new Error("Could not find extrude variable");const d=c[1][0];return i.body.splice(d,1),u&&await new Promise(f=>{(async()=>{let h="";const A=[];Vl(i,{leave:g=>{g.type==="VariableDeclaration"&&(h="")},enter:(g,y)=>{(async()=>{g.type==="VariableDeclaration"&&(h=g.declarations[0].id.name),g.type==="CallExpression"&&g.callee.name==="startSketchOn"&&g.arguments[0].type==="Identifier"&&g.arguments[0].name===u&&A.push({path:y,sketchName:h})})().catch(Bt)}});const p=g=>tt(ot(g)),m=[];for(const{path:g,sketchName:y}of A){const w=Xe(i,g.slice(0,-1));if(ie(w))return;const v=js(n.get(y),y);if(ie(v))return v;console.log("sketchName",y);const x=await r(v.on.id);if(!(x.origin&&x.x_axis&&x.y_axis&&x.z_axis))return;const C=Number(g.slice(-1)[0][0]);m.push({parent:w.node,faceDetails:x,lastKey:C})}for(const{parent:g,faceDetails:y,lastKey:w}of m)y.origin&&y.x_axis&&y.y_axis&&y.z_axis&&(g[w]=lr("startSketchOn",[Po({plane:Po({origin:Po({x:p(y.origin.x),y:p(y.origin.y),z:p(y.origin.z)}),x_axis:Po({x:p(y.x_axis.x),y:p(y.x_axis.y),z:p(y.x_axis.z)}),y_axis:Po({x:p(y.y_axis.x),y:p(y.y_axis.y),z:p(y.y_axis.z)}),z_axis:Po({x:p(y.z_axis.x),y:p(y.z_axis.y),z:p(y.z_axis.z)})})})]));f(!0)})().catch(Bt)}),i}else if(a.node.init.type==="PipeExpression"){const l=a.node.init.body;if(l[0].type==="CallExpression"&&l[0].callee.name==="startSketchOn"){const c=a.shallowPath[1][0];return i.body.splice(c,1),i}}return new Error("Selection not recognised, could not delete")}const dI=()=>({nonCodeNodes:{},start:[]});function Xe(t,e,n,r=!1){let i=t,s=null,o=[],a=[];for(const l of e){if(typeof i[l[0]]!="object")return s?{node:s,shallowPath:a,deepPath:o}:new Error("not an object");if(i=i==null?void 0:i[l[0]],o.push(l),s||a.push(l),typeof n<"u"&&(Array.isArray(n)?n.includes(i.type):i.type===n)&&(s=i,r))return{node:s,shallowPath:a,deepPath:o}}return{node:s||i,shallowPath:a,deepPath:o}}function lA(t,e){return(n,r=!1)=>{const i=Xe(t,e,n,r);if(ie(i))return i;const{node:s,shallowPath:o}=i;return{node:s,path:o}}}function Qi(t,e,n=[["body",""]]){const[r,i]=e;let s=[...n];const o={...t};if(r<o.start||i>o.end)return s;const a=o.start<=r&&o.end>=i;if((o.type==="Identifier"||o.type==="Literal"||o.type==="TagDeclarator")&&a)return s;if(o.type==="CallExpression"&&a){const{callee:l,arguments:c}=o;if(l.type==="Identifier"&&l.start<=r&&l.end>=i)return s.push(["callee","CallExpression"]),s;if(c.length>0)for(let u=0;u<c.length;u++){const d=c[u];if(d.start<=r&&d.end>=i)return s.push(["arguments","CallExpression"]),s.push([u,"index"]),Qi(d,e,s)}return s}if(o.type==="BinaryExpression"&&a){const{left:l,right:c}=o;return l.start<=r&&l.end>=i?(s.push(["left","BinaryExpression"]),Qi(l,e,s)):c.start<=r&&c.end>=i?(s.push(["right","BinaryExpression"]),Qi(c,e,s)):s}if(o.type==="PipeExpression"&&a){const{body:l}=o;for(let c=0;c<l.length;c++){const u=l[c];if(u.start<=r&&u.end>=i)return s.push(["body","PipeExpression"]),s.push([c,"index"]),Qi(u,e,s)}return s}if(o.type==="ArrayExpression"&&a){const{elements:l}=o;for(let c=0;c<l.length;c++){const u=l[c];if(u.start<=r&&u.end>=i)return s.push(["elements","ArrayExpression"]),s.push([c,"index"]),Qi(u,e,s)}return s}if(o.type==="ObjectExpression"&&a){const{properties:l}=o;for(let c=0;c<l.length;c++){const u=l[c];if(u.start<=r&&u.end>=i){if(s.push(["properties","ObjectExpression"]),s.push([c,"index"]),u.key.start<=r&&u.key.end>=i)return s.push(["key","Property"]),Qi(u.key,e,s);if(u.value.start<=r&&u.value.end>=i)return s.push(["value","Property"]),Qi(u.value,e,s)}}return s}if(o.type==="ExpressionStatement"&&a){const{expression:l}=o;return s.push(["expression","ExpressionStatement"]),Qi(l,e,s)}if(o.type==="VariableDeclaration"&&a){const l=o.declarations;for(let c=0;c<l.length;c++){const u=l[c];if(u.start<=r&&u.end>=i){s.push(["declarations","VariableDeclaration"]),s.push([c,"index"]);const d=u.init;if(d.start<=r&&d.end>=i)return s.push(["init",""]),Qi(d,e,s)}}}if(o.type==="VariableDeclaration"&&a){const l=o.declarations;for(let c=0;c<l.length;c++){const u=l[c];if(u.start<=r&&u.end>=i){const d=u.init;if(d.start<=r&&d.end>=i)return s.push(["declarations","VariableDeclaration"]),s.push([c,"index"]),s.push(["init",""]),Qi(d,e,s)}}return s}if(o.type==="UnaryExpression"&&a){const{argument:l}=o;return l.start<=r&&l.end>=i?(s.push(["argument","UnaryExpression"]),Qi(l,e,s)):s}if(o.type==="FunctionExpression"&&a){for(let l=0;l<o.params.length;l++){const c=o.params[l];if(c.identifier.start<=r&&c.identifier.end>=i)return s.push(["params","FunctionExpression"]),s.push([l,"index"]),Qi(c.identifier,e,s)}if(o.body.start<=r&&o.body.end>=i){s.push(["body","FunctionExpression"]);const l=o.body.body;for(let c=0;c<l.length;c++){const u=l[c];if(u.start<=r&&u.end>=i)return s.push(["body","FunctionExpression"]),s.push([c,"index"]),Qi(u,e,s)}}return s}if(o.type==="ReturnStatement"&&a){const{argument:l}=o;return l.start<=r&&l.end>=i?(s.push(["argument","ReturnStatement"]),Qi(l,e,s)):s}if(o.type==="MemberExpression"&&a){const{object:l,property:c}=o;return l.start<=r&&l.end>=i?(s.push(["object","MemberExpression"]),Qi(l,e,s)):c.start<=r&&c.end>=i?(s.push(["property","MemberExpression"]),Qi(c,e,s)):s}return o.type==="PipeSubstitution"&&a||console.error("not implemented: "+t.type),s}function un(t,e,n=[["body",""]]){const[r,i]=e||[];let s=[...n];const o={...t};for(let a=0;a<o.body.length;a++){const l=o.body[a];if(l.start<=r&&l.end>=i)return s.push([a,"index"]),Qi(l,e,s)}return s}function Vl(t,e,n=[]){var s,o;const r=t;(s=e==null?void 0:e.enter)==null||s.call(e,r,n);const i=(a,l)=>Vl(a,e,l);r.type==="VariableDeclaration"?r.declarations.forEach((a,l)=>i(a,[...n,["declarations","VariableDeclaration"],[l,"index"]])):r.type==="VariableDeclarator"?i(r.init,[...n,["init",""]]):r.type==="PipeExpression"?r.body.forEach((a,l)=>i(a,[...n,["body","PipeExpression"],[l,"index"]])):r.type==="CallExpression"?(i(r.callee,[...n,["callee","CallExpression"]]),r.arguments.forEach((a,l)=>i(a,[...n,["arguments","CallExpression"],[l,"index"]]))):r.type==="BinaryExpression"?(i(r.left,[...n,["left","BinaryExpression"]]),i(r.right,[...n,["right","BinaryExpression"]])):r.type==="Identifier"||r.type==="Literal"||r.type==="TagDeclarator"||(r.type==="ArrayExpression"?r.elements.forEach((a,l)=>i(a,[...n,["elements","ArrayExpression"],[l,"index"]])):r.type==="ObjectExpression"?r.properties.forEach(({key:a,value:l},c)=>{i(a,[...n,["properties","ObjectExpression"],[c,"index"],["key","Property"]]),i(l,[...n,["properties","ObjectExpression"],[c,"index"],["value","Property"]])}):r.type==="UnaryExpression"?i(r.argument,[...n,["argument","UnaryExpression"]]):r.type==="MemberExpression"?(i(r.object,[...n,["object","MemberExpression"]]),i(r.property,[...n,["property","MemberExpression"]])):"body"in r&&Array.isArray(r.body)&&r.body.forEach((a,l)=>i(a,[...n,["body",""],[l,"index"]]))),(o=e==null?void 0:e.leave)==null||o.call(e,r)}function Jq(t,e,n,r="number"){var h;const i=Xe(t,n,"VariableDeclaration");if(ie(i))return console.error(i),{variables:[],bodyPath:[],insertIndex:0};const{shallowPath:s,node:o}=i,a=o.start,{index:l,path:c}=Xq(s),u=Xe(t,c);if(ie(u))return console.error(u),{variables:[],bodyPath:[],insertIndex:0};const{node:d}=u,f=[];return(h=d==null?void 0:d.forEach)==null||h.call(d,A=>{if(A.type!=="VariableDeclaration"||A.end>a)return;const p=A.declarations[0].id.name,m=e==null?void 0:e.get(p);!m||typeof(m==null?void 0:m.value)!==r||f.push({key:p,value:m.value})}),{insertIndex:l,bodyPath:c,variables:f}}function Zq(t,e,n,r="number"){const i=un(t,n);return Jq(t,e,i,r)}function fI(t,e){e[e.length-1][0]==="callee"&&(e=e.slice(0,-1));const n=["BinaryExpression","Identifier","CallExpression","Literal","UnaryExpression"],r=Xe(t,e,n);if(ie(r))return r;const{node:i,deepPath:s}=r,o=Xe(t,e,"BinaryExpression");if(ie(o))return o;const{node:a,shallowPath:l}=o,[c,u]=(a==null?void 0:a.type)==="BinaryExpression"?[a,l]:[i,s],d=(A,p)=>{const m=zn(p),g=u[u.length-1],y=structuredClone(u),w=y[1][0];if(typeof w!="number")return new Error(`Expected number index, but found: ${typeof w} ${w}`);y[1][0]=w+1;const v=u.slice(0,-1),x=Xe(A,v);if(ie(x))return x;const C=x.node;return C[g[0]]=m,{modifiedAst:A,pathToReplaced:y}},f=ky(c,"PipeSubstitution"),h=e[e.length-1][0]!=="callee";return{isSafe:!f&&h&&n.includes(c==null?void 0:c.type)&&u.map(([A,p])=>p).includes("VariableDeclaration"),value:c,replacer:d}}function eX(t,e){let n=un(t,e);return fI(t,n)}function ky(t,e){return t.type===e?!0:t.type==="BinaryExpression"?Ewe(t,e):t.type==="CallExpression"?Twe(t,e):t.type==="ArrayExpression"?Bwe(t,e):!1}function Ewe(t,e){return t.type===e||t.left.type===e||t.right.type===e?!0:ky(t.left,e)||ky(t.right,e)}function Twe(t,e){return t.callee.type===e?!0:t.arguments.some(n=>ky(n,e))}function Bwe(t,e){return t.elements.some(n=>ky(n,e))}function Mwe(t){return(t==null?void 0:t.type)==="Literal"&&Number(t.value)===0||(t==null?void 0:t.type)==="UnaryExpression"&&t.operator==="-"&&t.argument.type==="Literal"&&Number(t.argument.value)===0}function kwe(t,e,n,r){var i,s;try{const a=un(t,n.range),l=un(t,r.range),c=Xe(t,l,"CallExpression");if(ie(c))return c;const u=c.node,d=Xe(t,a,"VariableDeclaration");if(ie(d))return d;const f=d.node,h=(s=(i=f==null?void 0:f.declarations[0])==null?void 0:i.id)==null?void 0:s.name,A=js(e==null?void 0:e.get(h),h);if(ie(A))return A;const p=E_(A,n.range);if(ie(p))return p;const m=p.segment,g=E_(A,r.range);if(ie(g))return g;const{segment:y,index:w}=g,v=xi(m.from,m.to),x=xi(y.from,y.to),C=xi(y.to,y.from),_=Math.abs(v-x)<.005||Math.abs(v-C)<.005,S=A2(u);if(ie(S))return S;const E=uI(S.val,u.callee.name),T=pwe(r.range,t);if(ie(T))return console.error(T),{isParallelAndConstrained:!1,sourceRange:[0,0]};const R=T.level,k=E==="angle"||R==="full",M=A.value[w-1].__geoMeta.sourceRange;return{isParallelAndConstrained:_&&k&&!!M,sourceRange:M}}catch{return{isParallelAndConstrained:!1,sourceRange:[0,0]}}}function T_({ast:t,selection:e,calleeName:n}){const r=un(t,e.range),i=Xe(t,r,"PipeExpression");if(ie(i))return console.error(i),!1;const s=i.node;return s.type!=="PipeExpression"?!1:s.body.some(o=>o.type==="CallExpression"&&o.callee.name===n)}function hI(t,e){if(t.codeBasedSelections.length!==1)return!1;const n=t.codeBasedSelections[0],i=un(e,n.range).map(([,s])=>s);return i.includes("FunctionExpression")||!i.includes("VariableDeclaration")?!1:!!i.includes("PipeExpression")}function tX(t,e){const n=["segAng","segEndX","segEndY","segLen"],r=Xe(t,e,"CallExpression");if(ie(r))return console.error(r),[];const i=r.node;if(i.type!=="CallExpression")return[];const s=i.callee.name==="close"?1:2,o=i.arguments[s];if(!((o==null?void 0:o.type)==="TagDeclarator"||(o==null?void 0:o.type)==="Identifier"))return[];const a=(o==null?void 0:o.type)==="TagDeclarator"?String(o.value):o.name,l=Xe(t,e,"VariableDeclaration");if(ie(l))return console.error(l),[];const c=[];return Vl(l.node,{enter:u=>{if(u.type!=="CallExpression"||!n.includes(u.callee.name))return;const d=u.arguments[0];if(!(d.type==="TagDeclarator"||d.type==="Identifier"))return;(d.type==="TagDeclarator"?String(d.value):d.name)===a&&c.push([u.start,u.end])}}),c}function nX(t,e){const n=un(e,t.range),r=Xe(e,n,"PipeExpression");if(ie(r))return!1;const{node:i}=r;if(i.type!=="PipeExpression")return!1;const s=Xe(e,n,"VariableDeclarator");if(ie(s))return!1;const o=s.node;if(o.type!=="VariableDeclarator")return!1;let a=!1;return Vl(e,{enter(l){var c,u;l.type==="CallExpression"&&l.callee.type==="Identifier"&&(l.callee.name==="extrude"||l.callee.name==="revolve")&&((u=(c=l.arguments)==null?void 0:c[1])==null?void 0:u.type)==="Identifier"&&l.arguments[1].name===o.id.name&&(a=!0)}}),a}function Rwe(t){const e={};return Vl(t,{enter(n){var r,i,s,o;if(n.type==="VariableDeclarator"&&((r=n.init)==null?void 0:r.type)==="PipeExpression"){let a=!1,l=!1,c=!1,u=!1;for(const d of n.init.body)d.type==="CallExpression"&&d.callee.name==="startProfileAt"&&(a=!0),d.type==="CallExpression"&&d.callee.name==="startSketchOn"&&(l=!0),d.type==="CallExpression"&&d.callee.name==="close"&&(c=!0),d.type==="CallExpression"&&d.callee.name==="circle"&&(u=!0);(a||u)&&l&&(c||u)&&(e[n.id.name]=!0)}else n.type==="CallExpression"&&(n.callee.name==="extrude"||n.callee.name==="revolve")&&((i=n.arguments[1])==null?void 0:i.type)==="Identifier"&&(e!=null&&e[(o=(s=n==null?void 0:n.arguments)==null?void 0:s[1])==null?void 0:o.name])&&delete e[n.arguments[1].name]}}),Object.keys(e).length>0}function rg(t,e){const n=t.properties.findIndex(({key:r})=>r.name===e);return n===-1?null:{expr:t.properties[n].value,index:n}}function FT(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var s,o,a,l,c=[],u=!0,d=!1;try{if(a=(i=i.call(n)).next,r!==0)for(;!(u=(s=a.call(i)).done)&&(c.push(s.value),c.length!==r);u=!0);}catch(f){d=!0,o=f}finally{try{if(!u&&i.return!=null&&(l=i.return(),Object(l)!==l))return}finally{if(d)throw o}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return Q7(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Q7(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Q7(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function z7(t,e,n){var r=FT(t,2),i=r[0],s=r[1],o=FT(e,2),a=o[0],l=o[1],c=FT(n,2),u=c[0],d=c[1];return Math.abs((l-s)*u-(a-i)*d+a*s-l*i)/Math.sqrt(Math.pow(l-s,2)+Math.pow(a-i,2))*Math.sign((a-i)*(d-s)-(l-s)*(u-i))}const sr=new Error('Invalid input, expected "straight-segment"'),V7=new Error('Invalid input, expected "arc-segment"');function Pwe(t,e){if(Array.isArray(e)){if(["angledLine","angledLineOfXLength","angledLineOfYLength","angledLineToX","angledLineToY","line","lineTo"].includes(t))return bn(e);if(["angledLineThatIntersects"].includes(t)&&e[2])return Po({angle:e[0],offset:e[1],intersectTag:e[2]})}else if(["startSketchAt","xLine","xLineTo","yLine","yLineTo"].includes(t))return e;return new Error("Missing sketch line type")}const Ja=(t,e,n,r,i,s,o)=>({type:t,isConstrained:e,value:n,sourceRange:s,argPosition:i==="singleValue"?{type:"singleValue"}:typeof i=="number"?{type:"arrayItem",index:i}:typeof i=="string"?{type:"objectProperty",key:i}:void 0,pathToNode:o,stdLibFnName:r}),cA=(t,e,n,r,i,s)=>{var m,g,y;if(t.type!=="CallExpression")return[];const o=(m=t.arguments)==null?void 0:m[0],a=o.type==="ArrayExpression";if(!a&&o.type!=="ObjectExpression")return[];const l=s.findIndex(([w,v])=>v==="PipeExpression"),u=[...s.slice(0,l+2),["arguments","CallExpression"],[0,"index"],a?["elements","ArrayExpression"]:["properties","ObjectExpression"]],d=a?[...u,[0,"index"]]:[...u,[o.properties.findIndex(w=>w.key.name===r[0].objInput),"index"],["value","Property"]],f=a?[...u,[1,"index"]]:[...u,[o.properties.findIndex(w=>w.key.name===r[1].objInput),"index"],["value","Property"]],h=a?o.elements[0]:(g=o.properties.find(w=>w.key.name===r[0].objInput))==null?void 0:g.value,A=a?o.elements[1]:(y=o.properties.find(w=>w.key.name===r[1].objInput))==null?void 0:y.value,p=[];return h&&p.push(Ja(e[0],Ts(h),i.slice(h.start,h.end),n,a?r[0].arrayInput:r[0].objInput,[h.start,h.end],d)),A&&p.push(Ja(e[1],Ts(A),i.slice(A.start,A.end),n,a?r[1].arrayInput:r[1].objInput,[A.start,A.end],f)),p},h2=(t,e,n,r,i,s)=>{var u,d;if(t.type!=="CallExpression")return[];const o=(u=t.arguments)==null?void 0:u[0],a=t.callee,l=[...s,["arguments","CallExpression"],[0,"index"]],c=[...s,["callee","CallExpression"]];return[Ja(e[0],!0,a.name,n,void 0,[a.start,a.end],c),Ja(e[1],Ts((d=t.arguments)==null?void 0:d[0]),i.slice(o.start,o.end),n,r,[o.start,o.end],l)]};function bo(t=2){return e=>{var r;if(e.type!=="CallExpression")return new Error("Not a CallExpression");const n=(r=e.arguments)==null?void 0:r[t];return n?n.type!=="TagDeclarator"?new Error("Tag not a TagDeclarator"):n.value:new Error("No argument")}}const Lwe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r})=>{if(n.type!=="straight-segment")return sr;const i=n.to,s={...t},o=Xe(s,e,"PipeExpression");if(ie(o))return o;const{node:a}=o,l=[tt(ot(i[0],2)),tt(ot(i[1],2))],c=Un("lineTo",[bn(l),cn()]),{index:u}=Ys(e);if(r){const d=r([{type:"arrayItem",index:0,argType:"xAbsolute",expr:tt(ot(i[0],2))},{type:"arrayItem",index:1,argType:"yAbsolute",expr:tt(ot(i[1],2))}]);if(ie(d))return d;const{callExp:f,valueUsedInTransform:h}=d;return a.body[u]=f,{modifiedAst:s,pathToNode:e,valueUsedInTransform:h}}else a.body=[...a.body,c];return{modifiedAst:s,pathToNode:e}},updateArgs:({node:t,pathToNode:e,input:n})=>{var l,c;if(n.type!=="straight-segment")return sr;const{to:r}=n,i={...t},s=Xe(i,e);if(ie(s))return s;const{node:o}=s,a=bn([tt(r[0]),tt(r[1])]);return gu((l=o.arguments)==null?void 0:l[0],a)||Gr((c=o.arguments)==null?void 0:c[0],a,"to"),{modifiedAst:i,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>cA(t,["xAbsolute","yAbsolute"],"lineTo",[{arrayInput:0},{arrayInput:1}],...e)},Iwe={add:({node:t,previousProgramMemory:e,pathToNode:n,segmentInput:r,replaceExistingCallback:i,spliceBetween:s})=>{if(r.type!=="straight-segment")return sr;const{from:o,to:a}=r,l={...t},c=Xe(l,n,"PipeExpression");if(ie(c))return c;const{node:u}=c,d=Xe(l,n,"VariableDeclarator");if(ie(d))return d;const{node:f}=d,h=tt(ot(a[0]-o[0],2)),A=tt(ot(a[1]-o[1],2));if(s&&!i&&u.type==="PipeExpression"){const m=Un("line",[bn([h,A]),cn()]),g=n.findIndex(w=>w[1]==="PipeExpression"),y=n[g+1][0];return typeof y>"u"||typeof y=="string"?new Error("pipeIndex is undefined"):(u.body=[...u.body.slice(0,y),m,...u.body.slice(y)],{modifiedAst:l,pathToNode:n})}if(i&&u.type!=="CallExpression"){const{index:m}=Ys(n),g=i([{type:"arrayItem",index:0,argType:"xRelative",expr:tt(ot(a[0]-o[0],2))},{type:"arrayItem",index:1,argType:"yRelative",expr:tt(ot(a[1]-o[1],2))}]);if(ie(g))return g;const{callExp:y,valueUsedInTransform:w}=g;return u.body[m]=y,{modifiedAst:l,pathToNode:[...n],valueUsedInTransform:w}}const p=Un("line",[bn([h,A]),cn()]);return u.type==="PipeExpression"?(u.body=[...u.body,p],{modifiedAst:l,pathToNode:[...n,["body","PipeExpression"],[u.body.length-1,"CallExpression"]]}):(f.init=Yl([f.init,p]),{modifiedAst:l,pathToNode:n})},updateArgs:({node:t,pathToNode:e,input:n})=>{var c,u,d;if(n.type!=="straight-segment")return sr;const{to:r,from:i}=n,s={...t},o=Xe(s,e);if(ie(o))return o;const{node:a}=o,l=bn([tt(ot(r[0]-i[0],2)),tt(ot(r[1]-i[1],2))]);return((c=a.arguments)==null?void 0:c[0].type)==="ObjectExpression"?Gr((u=a.arguments)==null?void 0:u[0],l,"to"):gu((d=a.arguments)==null?void 0:d[0],l),{modifiedAst:s,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>cA(t,["xRelative","yRelative"],"line",[{arrayInput:0},{arrayInput:1}],...e)},Owe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r})=>{if(n.type!=="straight-segment")return sr;const{to:i}=n,s={...t},a=lA(s,e)("PipeExpression");if(ie(a))return a;const{node:l}=a,c=tt(ot(i[0],2));if(r){const{index:d}=Ys(e),f=r([{type:"singleValue",argType:"xAbsolute",expr:tt(ot(i[0],2))}]);if(ie(f))return f;const{callExp:h,valueUsedInTransform:A}=f;return l.body[d]=h,{modifiedAst:s,pathToNode:e,valueUsedInTransform:A}}const u=Un("xLineTo",[c,cn()]);return l.body=[...l.body,u],{modifiedAst:s,pathToNode:e}},updateArgs:({node:t,pathToNode:e,input:n})=>{var l,c;if(n.type!=="straight-segment")return sr;const{to:r}=n,i={...t},s=Xe(i,e);if(ie(s))return s;const{node:o}=s,a=tt(ot(r[0],2));return is((l=o.arguments)==null?void 0:l[0])?o.arguments[0]=a:Gr((c=o.arguments)==null?void 0:c[0],a,"to"),{modifiedAst:i,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>h2(t,["horizontal","xAbsolute"],"xLineTo","singleValue",...e)},Fwe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r})=>{if(n.type!=="straight-segment")return sr;const{to:i}=n,s={...t},a=lA(s,e)("PipeExpression");if(ie(a))return a;const{node:l}=a,c=tt(ot(i[1],2));if(r){const{index:d}=Ys(e),f=r([{type:"singleValue",argType:"yAbsolute",expr:c}]);if(ie(f))return f;const{callExp:h,valueUsedInTransform:A}=f;return l.body[d]=h,{modifiedAst:s,pathToNode:e,valueUsedInTransform:A}}const u=Un("yLineTo",[c,cn()]);return l.body=[...l.body,u],{modifiedAst:s,pathToNode:e}},updateArgs:({node:t,pathToNode:e,input:n})=>{var l,c;if(n.type!=="straight-segment")return sr;const{to:r}=n,i={...t},s=Xe(i,e);if(ie(s))return s;const{node:o}=s,a=tt(ot(r[1],2));return is((l=o.arguments)==null?void 0:l[0])?o.arguments[0]=a:Gr((c=o.arguments)==null?void 0:c[0],a,"to"),{modifiedAst:i,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>h2(t,["vertical","yAbsolute"],"yLineTo","singleValue",...e)},Nwe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r})=>{if(n.type!=="straight-segment")return sr;const{from:i,to:s}=n,o={...t},l=lA(o,e)("PipeExpression");if(ie(l))return l;const{node:c}=l,u=tt(ot(s[0]-i[0],2));if(r){const{index:f}=Ys(e),h=r([{type:"singleValue",argType:"xRelative",expr:u}]);if(ie(h))return h;const{callExp:A,valueUsedInTransform:p}=h;return c.body[f]=A,{modifiedAst:o,pathToNode:e,valueUsedInTransform:p}}const d=Un("xLine",[u,cn()]);return c.body=[...c.body,d],{modifiedAst:o,pathToNode:e}},updateArgs:({node:t,pathToNode:e,input:n})=>{var c,u;if(n.type!=="straight-segment")return sr;const{to:r,from:i}=n,s={...t},o=Xe(s,e);if(ie(o))return o;const{node:a}=o,l=tt(ot(r[0]-i[0],2));return is((c=a.arguments)==null?void 0:c[0])?a.arguments[0]=l:Gr((u=a.arguments)==null?void 0:u[0],l,"length"),{modifiedAst:s,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>h2(t,["horizontal","xRelative"],"xLine","singleValue",...e)},Dwe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r})=>{if(n.type!=="straight-segment")return sr;const{from:i,to:s}=n,o={...t},l=lA(o,e)("PipeExpression");if(ie(l))return l;const{node:c}=l,u=tt(ot(s[1]-i[1],2));if(r){const{index:f}=Ys(e),h=r([{type:"singleValue",argType:"yRelative",expr:u}]);if(ie(h))return h;const{callExp:A,valueUsedInTransform:p}=h;return c.body[f]=A,{modifiedAst:o,pathToNode:e,valueUsedInTransform:p}}const d=Un("yLine",[u,cn()]);return c.body=[...c.body,d],{modifiedAst:o,pathToNode:e}},updateArgs:({node:t,pathToNode:e,input:n})=>{var c,u;if(n.type!=="straight-segment")return sr;const{to:r,from:i}=n,s={...t},o=Xe(s,e);if(ie(o))return o;const{node:a}=o,l=tt(ot(r[1]-i[1],2));return is((c=a.arguments)==null?void 0:c[0])?a.arguments[0]=l:Gr((u=a.arguments)==null?void 0:u[0],l,"length"),{modifiedAst:s,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>h2(t,["vertical","yRelative"],"yLine","singleValue",...e)},Uwe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r})=>{if(n.type!=="straight-segment")return sr;const{to:i}=n,s={...t},a=lA(s,e)("PipeExpression");if(ie(a))return a;const{node:l}=a,c=Xe(s,e,"VariableDeclarator");if(ie(c))return c;const{node:u}=c,d=tt(ot(i[0],2)),f=tt(ot(i[1],2));if(r&&l.type!=="CallExpression"){const{index:A}=Ys(e),p=r([{type:"arrayItem",index:0,argType:"xRelative",expr:d},{type:"arrayItem",index:1,argType:"yAbsolute",expr:f}]);if(ie(p))return p;const{callExp:m,valueUsedInTransform:g}=p;return l.body[A]=m,{modifiedAst:s,pathToNode:e,valueUsedInTransform:g}}const h=Un("tangentialArcTo",[bn([d,f]),cn()]);return l.type==="PipeExpression"?(l.body=[...l.body,h],{modifiedAst:s,pathToNode:[...e,["body","PipeExpression"],[l.body.length-1,"CallExpression"]]}):(u.init=Yl([u.init,h]),{modifiedAst:s,pathToNode:e})},updateArgs:({node:t,pathToNode:e,input:n})=>{var u;if(n.type!=="straight-segment")return sr;const{to:r}=n,i={...t},s=Xe(i,e);if(ie(s))return s;const{node:o}=s,a=tt(ot(r[0],2)),l=tt(ot(r[1],2)),c=(u=o.arguments)==null?void 0:u[0];return gu(c,bn([a,l]))||Gr(c,bn([a,l]),"to"),{modifiedAst:i,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,e,n)=>{var c;if(t.type!=="CallExpression")return[];const r=(c=t.arguments)==null?void 0:c[0];if(r.type!=="ArrayExpression")return[];const i=t.callee,s=[...n,["callee","CallExpression"]],o=[...n,["arguments","CallExpression"],[0,"index"],["elements","ArrayExpression"]],a=[...o,[0,"index"]],l=[...o,[1,"index"]];return[Ja("tangentialWithPrevious",!0,i.name,"tangentialArcTo",void 0,[i.start,i.end],s),Ja("xAbsolute",Ts(r.elements[0]),e.slice(r.elements[0].start,r.elements[0].end),"tangentialArcTo",0,[r.elements[0].start,r.elements[0].end],a),Ja("yAbsolute",Ts(r.elements[1]),e.slice(r.elements[1].start,r.elements[1].end),"tangentialArcTo",1,[r.elements[1].start,r.elements[1].end],l)]}},Hwe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r})=>{if(n.type!=="arc-segment")return V7;const{center:i,radius:s}=n,o={...t},a=Xe(o,e,"PipeExpression");if(ie(a))return a;const{node:l}=a,c=tt(ot(i[0],2)),u=tt(ot(i[1],2)),d=tt(ot(s,2));if(r){const f=r([{type:"arrayInObject",index:0,key:"center",argType:"xAbsolute",expr:c},{type:"arrayInObject",index:1,key:"center",argType:"yAbsolute",expr:u},{type:"objectProperty",key:"radius",argType:"radius",expr:d}]);if(ie(f))return f;const{callExp:h,valueUsedInTransform:A}=f,{index:p}=Ys(e);return l.body[p]=h,{modifiedAst:o,pathToNode:e,valueUsedInTransform:A}}return new Error("not implemented")},updateArgs:({node:t,pathToNode:e,input:n})=>{var f;if(n.type!=="arc-segment")return V7;const{center:r,radius:i}=n,s={...t},o=Xe(s,e);if(ie(o))return o;const{node:a,shallowPath:l}=o,c=(f=a.arguments)==null?void 0:f[0],u=bn([tt(ot(r[0])),tt(ot(r[1]))]);Gr(c,u,"center");const d=tt(ot(i));return Gr(c,d,"radius"),{modifiedAst:s,pathToNode:l}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,e,n)=>{var u;if(t.type!=="CallExpression")return[];const r=(u=t.arguments)==null?void 0:u[0];if(r.type!=="ObjectExpression")return[];const i=rg(r,"center"),s=rg(r,"radius");if(!i||!s)return[];if(i.expr.type!=="ArrayExpression")return[];const o=[...n,["arguments","CallExpression"],[0,"index"],["properties","ObjectExpression"],[i.index,"index"],["value","Property"],["elements","ArrayExpression"]],a=[...n,["arguments","CallExpression"],[0,"index"],["properties","ObjectExpression"],[s.index,"index"],["value","Property"]],l=[...o,[0,"index"]],c=[...o,[1,"index"]];return[Ja("radius",Ts(s.expr),e.slice(s.expr.start,s.expr.end),"circle","radius",[s.expr.start,s.expr.end],a),{stdLibFnName:"circle",type:"xAbsolute",isConstrained:Ts(i.expr.elements[0]),sourceRange:[i.expr.elements[0].start,i.expr.elements[0].end],pathToNode:l,value:e.slice(i.expr.elements[0].start,i.expr.elements[0].end),argPosition:{type:"arrayInObject",index:0,key:"center"}},{stdLibFnName:"circle",type:"yAbsolute",isConstrained:Ts(i.expr.elements[1]),sourceRange:[i.expr.elements[1].start,i.expr.elements[1].end],pathToNode:c,value:e.slice(i.expr.elements[1].start,i.expr.elements[1].end),argPosition:{type:"arrayInObject",index:1,key:"center"}}]}},jwe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r})=>{if(n.type!=="straight-segment")return sr;const{from:i,to:s}=n,o={...t},l=lA(o,e)("PipeExpression");if(ie(l))return l;const{node:c}=l,u=tt(ot(xi(i,s),0)),d=tt(ot(B7(i,s),2)),f=Un("angledLine",[bn([u,d]),cn()]);if(r){const{index:h}=Ys(e),A=r([{type:"arrayOrObjItem",index:0,key:"angle",argType:"angle",expr:u},{type:"arrayOrObjItem",index:1,key:"length",argType:"length",expr:d}]);if(ie(A))return A;const{callExp:p,valueUsedInTransform:m}=A;return c.body[h]=p,{modifiedAst:o,pathToNode:e,valueUsedInTransform:m}}else c.body=[...c.body,f];return{modifiedAst:o,pathToNode:e}},updateArgs:({node:t,pathToNode:e,input:n})=>{var h;if(n.type!=="straight-segment")return sr;const{to:r,from:i}=n,s={...t},o=Xe(s,e);if(ie(o))return o;const{node:a}=o,l=ot(xi(i,r),0),c=ot(B7(i,r),2),u=tt(l),d=tt(c),f=(h=a.arguments)==null?void 0:h[0];return gu(f,bn([u,d]))||(Gr(f,u,"angle"),Gr(f,d,"length")),{modifiedAst:s,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>cA(t,["angle","length"],"angledLine",[{arrayInput:0,objInput:"angle"},{arrayInput:1,objInput:"length"}],...e)},Qwe={add:({node:t,previousProgramMemory:e,pathToNode:n,segmentInput:r,replaceExistingCallback:i})=>{if(r.type!=="straight-segment")return sr;const{from:s,to:o}=r,a={...t},l=Xe(a,n,"PipeExpression");if(ie(l))return l;const{node:c}=l,u=Xe(a,n,"VariableDeclarator");if(ie(u))return u;const{node:d}=u,f=d.id.name,h=js(e==null?void 0:e.get(f),f);if(ie(h))return h;const A=tt(ot(xi(s,o),0)),p=tt(ot(Math.abs(s[0]-o[0]),2)||.1);let m;if(i){const y=i([{type:"arrayOrObjItem",index:0,key:"angle",argType:"angle",expr:A},{type:"arrayOrObjItem",index:1,key:"length",argType:"xRelative",expr:p}]);if(ie(y))return y;m=y.callExp}else m=Un("angledLineOfXLength",[bn([A,p]),cn()]);const{index:g}=Ys(n);return i?c.body[g]=m:c.body=[...c.body,m],{modifiedAst:a,pathToNode:n}},updateArgs:({node:t,pathToNode:e,input:n})=>{var A;if(n.type!=="straight-segment")return sr;const{to:r,from:i}=n,s={...t},o=Xe(s,e);if(ie(o))return o;const{node:a}=o,l=ot(xi(i,r),0),c=ot(Math.abs(r[0]-i[0]),2),u=(A=a.arguments)==null?void 0:A[0],d=sX(u)?Math.abs(c):c,f=tt(l),h=tt(d);return gu(u,bn([f,h]))||(Gr(u,f,"angle"),Gr(u,h,"length")),{modifiedAst:s,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>cA(t,["angle","xRelative"],"angledLineOfXLength",[{arrayInput:0,objInput:"angle"},{arrayInput:1,objInput:"length"}],...e)},zwe={add:({node:t,previousProgramMemory:e,pathToNode:n,segmentInput:r,replaceExistingCallback:i})=>{if(r.type!=="straight-segment")return sr;const{from:s,to:o}=r,a={...t},l=Xe(a,n,"PipeExpression");if(ie(l))return l;const{node:c}=l,u=Xe(a,n,"VariableDeclarator");if(ie(u))return u;const{node:d}=u,f=d.id.name,h=js(e==null?void 0:e.get(f),f);if(ie(h))return h;const A=tt(ot(xi(s,o),0)),p=tt(ot(Math.abs(s[1]-o[1]),2)||.1);let m;if(i){const y=i([{type:"arrayOrObjItem",index:0,key:"angle",argType:"angle",expr:A},{type:"arrayOrObjItem",index:1,key:"length",argType:"yRelative",expr:p}]);if(ie(y))return y;m=y.callExp}else m=Un("angledLineOfYLength",[bn([A,p]),cn()]);const{index:g}=Ys(n);return i?c.body[g]=m:c.body=[...c.body,m],{modifiedAst:a,pathToNode:n}},updateArgs:({node:t,pathToNode:e,input:n})=>{var A;if(n.type!=="straight-segment")return sr;const{to:r,from:i}=n,s={...t},o=Xe(s,e);if(ie(o))return o;const{node:a}=o,l=ot(xi(i,r),0),c=ot(r[1]-i[1],2),u=(A=a.arguments)==null?void 0:A[0],d=sX(u)?Math.abs(c):c,f=tt(l),h=tt(d);return gu(u,bn([f,h]))||(Gr(u,f,"angle"),Gr(u,h,"length")),{modifiedAst:s,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>cA(t,["angle","yRelative"],"angledLineOfYLength",[{arrayInput:0,objInput:"angle"},{arrayInput:1,objInput:"length"}],...e)},Vwe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r})=>{if(n.type!=="straight-segment")return sr;const{from:i,to:s}=n,o={...t},a=Xe(o,e,"PipeExpression");if(ie(a))return a;const{node:l}=a,c=tt(ot(xi(i,s),0)),u=tt(ot(s[0],2));if(r){const f=r([{type:"arrayOrObjItem",index:0,key:"angle",argType:"angle",expr:c},{type:"arrayOrObjItem",index:1,key:"to",argType:"xAbsolute",expr:u}]);if(ie(f))return f;const{callExp:h,valueUsedInTransform:A}=f,{index:p}=Ys(e);return l.body[p]=h,{modifiedAst:o,pathToNode:e,valueUsedInTransform:A}}const d=Un("angledLineToX",[bn([c,u]),cn()]);return l.body=[...l.body,d],{modifiedAst:o,pathToNode:e}},updateArgs:({node:t,pathToNode:e,input:n})=>{var A;if(n.type!=="straight-segment")return sr;const{to:r,from:i}=n,s={...t},o=Xe(s,e);if(ie(o))return o;const{node:a}=o,l=ot(xi(i,r),0),c=ot(r[0],2),u=(A=a.arguments)==null?void 0:A[0],d=c,f=tt(l),h=tt(d);return gu(u,bn([f,h]))||(Gr(u,f,"angle"),Gr(u,h,"to")),{modifiedAst:s,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>cA(t,["angle","xAbsolute"],"angledLineToX",[{arrayInput:0,objInput:"angle"},{arrayInput:1,objInput:"to"}],...e)},Gwe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r})=>{if(n.type!=="straight-segment")return sr;const{from:i,to:s}=n,o={...t},a=Xe(o,e,"PipeExpression");if(ie(a))return a;const{node:l}=a,c=tt(ot(xi(i,s),0)),u=tt(ot(s[1],2));if(r){const f=r([{type:"arrayOrObjItem",index:0,key:"angle",argType:"angle",expr:c},{type:"arrayOrObjItem",index:1,key:"to",argType:"yAbsolute",expr:u}]);if(ie(f))return f;const{callExp:h,valueUsedInTransform:A}=f,{index:p}=Ys(e);return l.body[p]=h,{modifiedAst:o,pathToNode:e,valueUsedInTransform:A}}const d=Un("angledLineToY",[bn([c,u]),cn()]);return l.body=[...l.body,d],{modifiedAst:o,pathToNode:e}},updateArgs:({node:t,pathToNode:e,input:n})=>{var A;if(n.type!=="straight-segment")return sr;const{to:r,from:i}=n,s={...t},o=Xe(s,e);if(ie(o))return o;const{node:a}=o,l=ot(xi(i,r),0),c=ot(r[1],2),u=(A=a.arguments)==null?void 0:A[0],d=c,f=tt(l),h=tt(d);return gu(u,bn([f,h]))||(Gr(u,f,"angle"),Gr(u,h,"to")),{modifiedAst:s,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,...e)=>cA(t,["angle","yAbsolute"],"angledLineToY",[{arrayInput:0,objInput:"angle"},{arrayInput:1,objInput:"to"}],...e)},Wwe={add:({node:t,pathToNode:e,segmentInput:n,replaceExistingCallback:r,referencedSegment:i})=>{if(n.type!=="straight-segment")return sr;const{from:s,to:o}=n,a={...t},l=Xe(a,e,"PipeExpression");if(ie(l))return l;const{node:c}=l,u=tt(ot(xi(s,o),0));if(!i)return new Error("referencedSegment must be provided");const d=tt(ot(z7(i==null?void 0:i.from,i==null?void 0:i.to,o),2));if(r){const f=r([{type:"objectProperty",key:"angle",argType:"angle",expr:u},{type:"objectProperty",key:"offset",argType:"intersectionOffset",expr:d}]);if(ie(f))return f;const{callExp:h,valueUsedInTransform:A}=f,{index:p}=Ys(e);return c.body[p]=h,{modifiedAst:a,pathToNode:e,valueUsedInTransform:A}}return new Error("not implemented")},updateArgs:({node:t,pathToNode:e,input:n,previousProgramMemory:r})=>{var v,x;if(n.type!=="straight-segment")return sr;const{to:i,from:s}=n,o={...t},a=Xe(o,e);if(ie(a))return a;const{node:l}=a,c=ot(xi(s,i),0),u=(v=l.arguments)==null?void 0:v[0],d=u.type==="ObjectExpression"&&((x=u.properties.find(C=>C.key.name==="intersectTag"))==null?void 0:x.value)||tt(""),f=d.type==="Identifier"?d.name:"",h=Xe(o,e,"VariableDeclaration");if(ie(h))return h;const{node:A}=h,p=A.declarations[0].id.name,m=js(r.get(p),p);if(ie(m))return m;const g=m.value.find(({tag:C})=>C&&C.value===f);let y=0;g&&(y=ot(z7(g==null?void 0:g.from,g==null?void 0:g.to,i),2));const w=tt(c);return Gr(u,w,"angle"),Gr(u,tt(y),"offset"),{modifiedAst:o,pathToNode:e}},getTag:bo(),addTag:Ms(),getConstraintInfo:(t,e,n)=>{var c,u,d,f;if(t.type!=="CallExpression")return[];const r=(c=t.arguments)==null?void 0:c[0];if(r.type!=="ObjectExpression")return[];const i=r.properties.findIndex(h=>h.key.name==="angle"),s=r.properties.findIndex(h=>h.key.name==="offset"),o=r.properties.findIndex(h=>h.key.name==="intersectTag"),a=[],l=[...n,["arguments","CallExpression"],[0,"index"],["properties","ObjectExpression"]];if(i!==-1){const h=(u=r.properties[i])==null?void 0:u.value,A=[...l,[i,"index"],["value","Property"]];a.push(Ja("angle",Ts(h),e.slice(h.start,h.end),"angledLineThatIntersects","angle",[h.start,h.end],A))}if(s!==-1){const h=(d=r.properties[s])==null?void 0:d.value,A=[...l,[s,"index"],["value","Property"]];a.push(Ja("intersectionOffset",Ts(h),e.slice(h.start,h.end),"angledLineThatIntersects","offset",[h.start,h.end],A))}if(o!==-1){const h=(f=r.properties[o])==null?void 0:f.value,A=[...l,[o,"index"],["value","Property"]],p=Ja("intersectionTag",!1,e.slice(h.start,h.end),"angledLineThatIntersects","intersectTag",[h.start,h.end],A);a.push(p)}return a}},Kwe=({node:t,pathToNode:e,input:n})=>{var l,c;if(n.type!=="straight-segment")return sr;const{to:r}=n,i={...t},s=Xe(i,e);if(ie(s))return console.error(s),{modifiedAst:{start:0,end:0,body:[],nonCodeMeta:{start:[],nonCodeNodes:[]}},pathToNode:e};const{node:o}=s,a=bn([tt(ot(r[0])),tt(ot(r[1]))]);return gu((l=o.arguments)==null?void 0:l[0],a)||Gr((c=o.arguments)==null?void 0:c[0],a,"to"),{modifiedAst:i,pathToNode:e}},ba={line:Iwe,lineTo:Lwe,xLine:Nwe,yLine:Dwe,xLineTo:Owe,yLineTo:Fwe,angledLine:jwe,angledLineOfXLength:Qwe,angledLineOfYLength:zwe,angledLineToX:Vwe,angledLineToY:Gwe,angledLineThatIntersects:Wwe,tangentialArcTo:Uwe,circle:Hwe};function NT(t,e,n,r){var c,u;const i={...t},s=n.type==="sourceRange"?un(i,n.sourceRange):n.pathToNode,o=Xe(i,s);if(ie(o))return o;const{node:a,shallowPath:l}=o;if(((c=a==null?void 0:a.callee)==null?void 0:c.name)in ba){const{updateArgs:d}=ba[a.callee.name];return d?d({node:i,previousProgramMemory:e,pathToNode:l,input:r}):new Error("not a sketch line helper")}return new Error(`not a sketch line helper: ${(u=a==null?void 0:a.callee)==null?void 0:u.name}`)}function AI(t,e,n){var i;const r=((i=t==null?void 0:t.callee)==null?void 0:i.name)||"";return r in ba?ba[r].getConstraintInfo(t,e,n):[]}function rX(t,e,n=.015625){const r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]);return Math.sqrt(r*r+i*i)<n}function DT({node:t,programMemory:e,fnName:n,pathToNode:r,input:i,spliceBetween:s=!1}){const o=structuredClone(t),{add:a,updateArgs:l}=(ba==null?void 0:ba[n])||{};return!a||!l?new Error("not a sketch line helper"):(Xe(o,r,"VariableDeclarator"),Xe(o,r,"PipeExpression"),a({node:o,previousProgramMemory:e,pathToNode:r,segmentInput:i,spliceBetween:s}))}function $we({node:t,pathToNode:e,expressions:n}){const r={...t},i=Xe(r,e,"PipeExpression");return ie(i)?i:i.node.type!=="PipeExpression"?new Error("not a pipe expression"):(i.node.body=[...i.node.body,...n],r)}function qwe({node:t,pathToNode:e}){const n={...t},r=Un("close",[cn()]),i=Xe(n,e,"PipeExpression");return ie(i)?i:i.node.type!=="PipeExpression"?new Error("not a pipe expression"):(i.node.body=[...i.node.body,r],n)}function Xwe({node:t,programMemory:e,pathToNode:n,fnName:r,segmentInput:i,replaceExistingCallback:s,referencedSegment:o}){if(![...vo,"intersect","circle"].includes(r))return new Error(`The following function name  is not tooltip: ${r}`);const a={...t},{add:l}=ba[r],c=l({node:a,previousProgramMemory:e,pathToNode:n,referencedSegment:o,segmentInput:i,replaceExistingCallback:s});if(ie(c))return c;const{modifiedAst:u,valueUsedInTransform:d,pathToNode:f}=c;return{modifiedAst:u,valueUsedInTransform:d,pathToNode:f}}function Ywe(t,e){const n=structuredClone(t.node);let r=0;for(let g=0;g<t.pathToNode.length;g++)if(t.pathToNode[g][1]==="PipeExpression"){r=Number(t.pathToNode[g+1][0]);break}const i=Xe(n,t.pathToNode,"PipeExpression"),s=Xe(n,t.pathToNode,"VariableDeclarator");if(ie(i))return i;if(ie(s))return s;const o=i.node.type==="PipeExpression";console.log("pipeExpr",i,s);const a=o?i.node.body[r]:s.node.init;if(a.type!=="CallExpression")return new Error("no chamfer call Expr");const l=a.arguments[0];if(l.type!=="ObjectExpression")return new Error("first argument should be an object expression");const c=rg(l,"tags");if(!c)return new Error("no tags property");if(c.expr.type!=="ArrayExpression")return new Error("tags should be an array expression");if(!(c.expr.elements.length>1))return Ms(2)(t);const d=c.expr.elements.findIndex(g=>(e==null?void 0:e.subType)==="base"&&g.type==="Identifier"&&g.name===e.tagName||(e==null?void 0:e.subType)==="opposite"&&g.type==="CallExpression"&&g.callee.name==="getOppositeEdge"&&g.arguments[0].type==="Identifier"&&g.arguments[0].name===e.tagName||(e==null?void 0:e.subType)==="adjacent"&&g.type==="CallExpression"&&(g.callee.name==="getNextAdjacentEdge"||g.callee.name==="getPrevAdjacentEdge")&&g.arguments[0].type==="Identifier"&&g.arguments[0].name===e.tagName);if(d===-1)return new Error("tag not found");const f=c.expr.elements[d];c.expr.elements.splice(d,1);const h=rg(l,"length");if(!h)return new Error("no chamfer length");const A=rm(jo(n,"seg",2)),p=a.arguments[1],m=Un("chamfer",[Po({length:h.expr,tags:bn([f])}),o?cn():p,A]);return o?i.node.body.splice(r,0,m):(console.log("yo",Yl([m,a])),a.arguments[1]=cn(),s.node.init=Yl([m,a])),{modifiedAst:n,tag:A.value}}function iX(t,e,n){if(e==="close")return Ms(1)(t);if(e==="chamfer")return Ywe(t,n);if(e in ba){const{addTag:r}=ba[e];return r(t)}return new Error(`"${e}" is not a sketch line helper`)}function sX(t){var e;return(t==null?void 0:t.type)==="ArrayExpression"?is(t.elements[0]):(t==null?void 0:t.type)==="ObjectExpression"?is((e=t.properties.find(({key:n})=>n.name==="angle"))==null?void 0:e.value):!1}function Ms(t=2){return({node:e,pathToNode:n})=>{var c;const r={...e},i=Xe(r,n,"CallExpression");if(ie(i))return i;const{node:s}=i,o=(c=s.arguments)==null?void 0:c[t],a=o||rm(jo(r,"seg",2));return!!o||(s.arguments[t]=a),"value"in a?{modifiedAst:r,tag:String(a.value)}:new Error("Unable to assign tag without value")}}function G7(t){var n,r;const e=t.arguments[0];if(e.type==="ArrayExpression")return{val:[e.elements[0],e.elements[1]]};if(e.type==="ObjectExpression"){const i=(n=e.properties.find(o=>o.key.name==="to"))==null?void 0:n.value,s=(r=e.properties.find(o=>o.key.name==="tag"))==null?void 0:r.value;if((i==null?void 0:i.type)==="ArrayExpression"){const[o,a]=i.elements;return{val:[o,a],tag:s}}}return new Error("expected ArrayExpression or ObjectExpression")}function Jwe(t){var n,r,i,s;const e=t.arguments[0];if(e.type==="ArrayExpression")return{val:[e.elements[0],e.elements[1]]};if(e.type==="ObjectExpression"){const o=(n=e.properties.find(u=>u.key.name==="tag"))==null?void 0:n.value,a=(r=e.properties.find(u=>u.key.name==="angle"))==null?void 0:r.value,l=["angledLineToX","angledLineToY"].includes((i=t==null?void 0:t.callee)==null?void 0:i.name)?"to":"length",c=(s=e.properties.find(u=>u.key.name===l))==null?void 0:s.value;if(a&&c)return{val:[a,c],tag:o}}return new Error("expected ArrayExpression or ObjectExpression")}function W7(t){var s,o,a;const e=t.arguments[0];if(e.type!=="ObjectExpression")return{val:e};const n=(s=e.properties.find(l=>l.key.name==="tag"))==null?void 0:s.value,r=["xLineTo","yLineTo","startSketchAt"].includes((o=t==null?void 0:t.callee)==null?void 0:o.name)?"to":"length",i=(a=e.properties.find(l=>l.key.name===r))==null?void 0:a.value;return i?{val:i,tag:n}:(console.warn("expected ArrayExpression or ObjectExpression"),{val:tt(1)})}const Zwe=t=>{var n;const e=t.arguments[0];if(e.type==="ObjectExpression"){const r=rg(e,"center"),i=rg(e,"radius"),s=t.arguments[2];if(((n=r==null?void 0:r.expr)==null?void 0:n.type)==="ArrayExpression"&&i)return{val:[r==null?void 0:r.expr.elements[0],r==null?void 0:r.expr.elements[1],i.expr],tag:s}}return new Error("expected ArrayExpression or ObjectExpression")},exe=t=>{var n,r,i,s;const e=t.arguments[0];if(e.type==="ObjectExpression"){const o=(n=e.properties.find(u=>u.key.name==="tag"))==null?void 0:n.value,a=(r=e.properties.find(u=>u.key.name==="angle"))==null?void 0:r.value,l=(i=e.properties.find(u=>u.key.name==="offset"))==null?void 0:i.value,c=(s=e.properties.find(u=>u.key.name==="intersectTag"))==null?void 0:s.value;if(a&&l&&c)return{val:[a,l,c],tag:o}}return new Error("expected ArrayExpression or ObjectExpression")};function A2(t){var n;const e=(n=t==null?void 0:t.callee)==null?void 0:n.name;return["lineTo","line"].includes(e)?G7(t):["angledLine","angledLineOfXLength","angledLineToX","angledLineOfYLength","angledLineToY"].includes(e)?Jwe(t):["xLine","yLine","xLineTo","yLineTo"].includes(e)||["startSketchAt"].includes(e)?W7(t):["angledLineThatIntersects"].includes(e)?exe(t):["tangentialArcTo"].includes(e)?G7(t):e==="circle"?Zwe(t):new Error("unexpected call expression: "+e)}var Sh=Object.freeze({Linear:Object.freeze({None:function(t){return t},In:function(t){return t},Out:function(t){return t},InOut:function(t){return t}}),Quadratic:Object.freeze({In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}}),Cubic:Object.freeze({In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}}),Quartic:Object.freeze({In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}}),Quintic:Object.freeze({In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}}),Sinusoidal:Object.freeze({In:function(t){return 1-Math.sin((1-t)*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return .5*(1-Math.sin(Math.PI*(.5-t)))}}),Exponential:Object.freeze({In:function(t){return t===0?0:Math.pow(1024,t-1)},Out:function(t){return t===1?1:1-Math.pow(2,-10*t)},InOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)}}),Circular:Object.freeze({In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}}),Elastic:Object.freeze({In:function(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},Out:function(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},InOut:function(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(t){var e=1.70158;return t===1?1:t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return t===0?0:--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}}),Bounce:Object.freeze({In:function(t){return 1-Sh.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?Sh.Bounce.In(t*2)*.5:Sh.Bounce.Out(t*2-1)*.5+.5}}),generatePow:function(t){return t===void 0&&(t=4),t=t<Number.EPSILON?Number.EPSILON:t,t=t>1e4?1e4:t,{In:function(e){return Math.pow(e,t)},Out:function(e){return 1-Math.pow(1-e,t)},InOut:function(e){return e<.5?Math.pow(e*2,t)/2:(1-Math.pow(2-e*2,t))/2+.5}}}}),D0=function(){return performance.now()},txe=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(n){return e._tweens[n]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},t.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},t.prototype.update=function(e,n){e===void 0&&(e=D0()),n===void 0&&(n=!1);var r=Object.keys(this._tweens);if(r.length===0)return!1;for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<r.length;i++){var s=this._tweens[r[i]],o=!n;s&&s.update(e,o)===!1&&!n&&delete this._tweens[r[i]]}r=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}(),Rp={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),s=Rp.Utils.Linear;return e<0?s(t[0],t[1],r):e>1?s(t[n],t[n-1],n-r):s(t[i],t[i+1>n?n:i+1],r-i)},Bezier:function(t,e){for(var n=0,r=t.length-1,i=Math.pow,s=Rp.Utils.Bernstein,o=0;o<=r;o++)n+=i(1-e,r-o)*i(e,o)*t[o]*s(r,o);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),s=Rp.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(r=n*(1+e))),s(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],r-i)):e<0?t[0]-(s(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(s(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):s(t[i?i-1:0],t[i],t[n<i+1?n:i+1],t[n<i+2?n:i+2],r-i)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=Rp.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:function(){var t=[1];return function(e){var n=1;if(t[e])return t[e];for(var r=e;r>1;r--)n*=r;return t[e]=n,n}}(),CatmullRom:function(t,e,n,r,i){var s=(n-t)*.5,o=(r-e)*.5,a=i*i,l=i*a;return(2*e-2*n+s+o)*l+(-3*e+3*n-2*s-o)*a+s*i+e}}},nxe=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),s5=new txe,UT=function(){function t(e,n){n===void 0&&(n=s5),this._object=e,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Sh.Linear.None,this._interpolationFunction=Rp.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=nxe.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(e,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},t.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},t.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},t.prototype.start=function(e,n){if(e===void 0&&(e=D0()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var s in this._valuesEnd)i[s]=this._valuesEnd[s];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},t.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},t.prototype._setupProperties=function(e,n,r,i,s){for(var o in r){var a=e[o],l=Array.isArray(a),c=l?"array":typeof a,u=!l&&Array.isArray(r[o]);if(!(c==="undefined"||c==="function")){if(u){var d=r[o];if(d.length===0)continue;for(var f=[a],h=0,A=d.length;h<A;h+=1){var p=this._handleRelativeValue(a,d[h]);if(isNaN(p)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(p)}u&&(r[o]=f)}if((c==="object"||l)&&a&&!u){n[o]=l?[]:{};var m=a;for(var g in m)n[o][g]=m[g];i[o]=l?[]:{};var d=r[o];if(!this._isDynamic){var y={};for(var g in d)y[g]=d[g];r[o]=d=y}this._setupProperties(m,n[o],d,i[o],s)}else(typeof n[o]>"u"||s)&&(n[o]=a),l||(n[o]*=1),u?i[o]=r[o].slice().reverse():i[o]=n[o]||0}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(e){return e===void 0&&(e=D0()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},t.prototype.resume=function(e){return e===void 0&&(e=D0()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},t.prototype.stopChainedTweens=function(){for(var e=0,n=this._chainedTweens.length;e<n;e++)this._chainedTweens[e].stop();return this},t.prototype.group=function(e){return e===void 0&&(e=s5),this._group=e,this},t.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},t.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},t.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},t.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},t.prototype.easing=function(e){return e===void 0&&(e=Sh.Linear.None),this._easingFunction=e,this},t.prototype.interpolation=function(e){return e===void 0&&(e=Rp.Linear),this._interpolationFunction=e,this},t.prototype.chain=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return this._chainedTweens=e,this},t.prototype.onStart=function(e){return this._onStartCallback=e,this},t.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},t.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},t.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},t.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},t.prototype.onStop=function(e){return this._onStopCallback=e,this},t.prototype.update=function(e,n){var r=this,i;if(e===void 0&&(e=D0()),n===void 0&&(n=!0),this._isPaused)return!0;var s,o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>o)return!1;n&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=e-this._startTime,l=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),c=this._duration+this._repeat*l,u=function(){if(r._duration===0||a>c)return 1;var m=Math.trunc(a/l),g=a-m*l,y=Math.min(g/r._duration,1);return y===0&&a===r._duration?1:y},d=u(),f=this._easingFunction(d);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,d),this._duration===0||a>=this._duration)if(this._repeat>0){var h=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=h);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*h,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var A=0,p=this._chainedTweens.length;A<p;A++)this._chainedTweens[A].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(e,n,r,i){for(var s in r)if(n[s]!==void 0){var o=n[s]||0,a=r[s],l=Array.isArray(e[s]),c=Array.isArray(a),u=!l&&c;u?e[s]=this._interpolationFunction(a,i):typeof a=="object"&&a?this._updateProperties(e[s],o,a,i):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[s]=o+(a-o)*i))}},t.prototype._handleRelativeValue=function(e,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?e+parseFloat(n):parseFloat(n)},t.prototype._swapEndStartRepeatValues=function(e){var n=this._valuesStartRepeat[e],r=this._valuesEnd[e];typeof r=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(r):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=n},t}(),Jl=s5;Jl.getAll.bind(Jl);Jl.removeAll.bind(Jl);Jl.add.bind(Jl);Jl.remove.bind(Jl);var rxe=Jl.update.bind(Jl);const o5=oI(),ixe=o5==="macos"?"Cmd":o5==="windows"?"Win":"Super",HT=o5==="macos"?"Option":"Alt",Ru=t=>!t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey,Qx=["KittyCAD","OnShape","Trackpad Friendly","Solidworks","NX","Creo","AutoCAD"];function oX(t){switch(t){case"kitty_cad":return"KittyCAD";case"on_shape":return"OnShape";case"trackpad_friendly":return"Trackpad Friendly";case"solidworks":return"Solidworks";case"nx":return"NX";case"creo":return"Creo";case"auto_cad":return"AutoCAD";default:return}}const br=t=>({middle:!!(t.buttons&4)||t.button===1,right:!!(t.buttons&2)||t.button===2,left:!!(t.buttons&1)||t.button===0}),Gd={KittyCAD:{pan:{description:"Shift + Right click drag or middle click drag",callback:t=>br(t).middle&&Ru(t)||br(t).right&&t.shiftKey},zoom:{description:"Scroll or Ctrl + Right click drag",dragCallback:t=>!!(t.buttons&2)&&t.ctrlKey,scrollCallback:t=>t.buttons===0},rotate:{description:"Right click drag",callback:t=>br(t).right&&Ru(t)}},OnShape:{pan:{description:"Ctrl + Right click drag or middle click drag",callback:t=>br(t).right&&t.ctrlKey||br(t).middle&&Ru(t)},zoom:{description:"Scroll",dragCallback:()=>!1,scrollCallback:t=>t.buttons===0},rotate:{description:"Right click drag",callback:t=>br(t).right&&Ru(t)}},"Trackpad Friendly":{pan:{description:`${HT} + Shift + Left click drag or middle click drag`,callback:t=>br(t).left&&t.altKey&&t.shiftKey&&!t.metaKey||br(t).middle&&Ru(t)},zoom:{description:`Scroll or ${HT} + ${ixe} + Left click drag`,dragCallback:t=>br(t).left&&t.altKey&&t.metaKey,scrollCallback:t=>t.buttons===0},rotate:{description:`${HT} + Left click drag`,callback:t=>br(t).left&&t.altKey&&!t.shiftKey&&!t.metaKey,lenientDragStartButton:0}},Solidworks:{pan:{description:"Ctrl + Right click drag",callback:t=>br(t).right&&t.ctrlKey,lenientDragStartButton:2},zoom:{description:"Scroll or Shift + Middle click drag",dragCallback:t=>br(t).middle&&t.shiftKey,scrollCallback:t=>t.buttons===0},rotate:{description:"Middle click drag",callback:t=>br(t).middle&&Ru(t)}},NX:{pan:{description:"Shift + Middle click drag",callback:t=>br(t).middle&&t.shiftKey},zoom:{description:"Scroll or Ctrl + Middle click drag",dragCallback:t=>br(t).middle&&t.ctrlKey,scrollCallback:t=>t.buttons===0},rotate:{description:"Middle click drag",callback:t=>br(t).middle&&Ru(t)}},Creo:{pan:{description:"Ctrl + Left click drag",callback:t=>br(t).left&&!br(t).right&&t.ctrlKey},zoom:{description:"Scroll or Ctrl + Right click drag",dragCallback:t=>br(t).right&&!br(t).left&&t.ctrlKey,scrollCallback:t=>t.buttons===0},rotate:{description:"Ctrl + Middle (or Left + Right) click drag",callback:t=>{const e=br(t);return(e.middle||e.left&&e.right)&&t.ctrlKey}}},AutoCAD:{pan:{description:"Middle click drag",callback:t=>br(t).middle&&Ru(t)},zoom:{description:"Scroll",dragCallback:()=>!1,scrollCallback:t=>t.buttons===0},rotate:{description:"Shift + Middle click drag",callback:t=>br(t).middle&&t.shiftKey}}};function a5(t){return t*Math.PI/180}function sxe(t,e,n){const i=xi(t,n)+(e?-90:90);return[Math.cos(a5(i))*10+n[0],Math.sin(a5(i))*10+n[1]]}function oxe({size:t,divisions:e}){const n=new Cg({color:11184810,transparent:!0,opacity:.5,depthTest:!1}),r=new wW(t,e,255,16777215);return r.material=n,r.rotation.x=Math.PI/2,r}const aX=72.66985970437086,xc=t=>.55*aX/t.zoom/window.innerHeight,Hf=(t,e)=>e.position.distanceTo(t.position)*t.fov*aX/4e3/window.innerHeight;function l5(t){const e=new de(0,0,1).applyQuaternion(t);return rX([e.x,e.y],[0,0])}function w1(t,e){const n=new Fn;return n.up.copy(t),n.position.copy(e),n.lookAt(0,0,0),n.updateMatrix(),n.quaternion.clone()}const Pu=20,K7=30,ow=4,axe=new $s,lxe=50;class $7{constructor(){se(this,"lastSend");se(this,"rateLimitMs",16);se(this,"send",e=>{let n=new Date;(this.lastSend===void 0||n.getTime()-this.lastSend.getTime()>this.rateLimitMs)&&(e(),this.lastSend=n)});se(this,"reset",()=>{this.lastSend=void 0})}}class cxe{constructor(e=!1,n,r){se(this,"engineCommandManager");se(this,"syncDirection","engineToClient");se(this,"camera");se(this,"target");se(this,"domElement");se(this,"isDragging");se(this,"mouseDownPosition");se(this,"mouseNewPosition");se(this,"rotationSpeed",.3);se(this,"enableRotate",!0);se(this,"enablePan",!0);se(this,"enableZoom",!0);se(this,"moveSender",new $7);se(this,"zoomSender",new $7);se(this,"lastPerspectiveFov",45);se(this,"pendingZoom",null);se(this,"pendingRotation",null);se(this,"pendingPan",null);se(this,"interactionGuards",Gd.KittyCAD);se(this,"isFovAnimationInProgress",!1);se(this,"perspectiveFovBeforeOrtho",45);se(this,"handleStart",()=>{this._isCamMovingCallback(!0,!1)});se(this,"handleEnd",()=>{this._isCamMovingCallback(!1,!1)});se(this,"setCam",e=>{e.type==="perspective"&&this.camera instanceof $r?this.usePerspectiveCamera():e.type==="orthographic"&&this.camera instanceof Fn&&this.useOrthographicCamera(),this.camera.position.set(...e.position),this.camera.quaternion.set(...e.quaternion),e.type==="perspective"&&this.camera instanceof Fn||e.type==="orthographic"&&this.camera instanceof $r&&(this.camera.zoom=e.zoom||1),this.camera.updateProjectionMatrix(),console.log("doing this thing",e),this.update(!0)});se(this,"throttledEngCmd",b1(e=>{this.engineCommandManager.sendSceneCommand(e)},1e3/30));se(this,"throttledUpdateEngineCamera",b1(e=>{const n={type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_look_at",...jT(e)}};this.engineCommandManager.sendSceneCommand(n)},1e3/15));se(this,"lastPerspectiveCmd",null);se(this,"lastPerspectiveCmdTime",Date.now());se(this,"lastPerspectiveCmdTimeoutId",null);se(this,"sendLastPerspectiveReliableChannel",()=>{this.lastPerspectiveCmd&&Date.now()-this.lastPerspectiveCmdTime>=lxe&&(this.engineCommandManager.sendSceneCommand(this.lastPerspectiveCmd,!0),this.lastPerspectiveCmdTime=Date.now())});se(this,"doMove",(e,n)=>{this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd:{type:"camera_drag_move",interaction:e,window:{x:n[0],y:n[1]}},cmd_id:Yt()})});se(this,"doZoom",e=>{this.handleStart(),this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd:{type:"default_camera_zoom",magnitude:-1*e/window.devicePixelRatio},cmd_id:Yt()}),this.handleEnd()});se(this,"_isCamMovingCallback",()=>{});se(this,"_camChangeCallbacks",{});se(this,"onWindowResize",()=>{if(this.camera instanceof Fn)this.camera.aspect=window.innerWidth/window.innerHeight;else if(this.camera instanceof $r){const e=window.innerWidth/window.innerHeight;this.camera.left=-Pu*e,this.camera.right=Pu*e,this.camera.top=Pu,this.camera.bottom=-Pu}this.camera.updateProjectionMatrix()});se(this,"onMouseDown",e=>{this.domElement.setPointerCapture(e.pointerId),this.isDragging=!0,this.mouseDownPosition.set(e.clientX,e.clientY);let n=this.getInteractionType(e);n!=="none"&&(this.handleStart(),this.syncDirection==="engineToClient"&&this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd:{type:"camera_drag_start",interaction:n,window:{x:e.clientX,y:e.clientY}},cmd_id:Yt()}))});se(this,"onMouseMove",e=>{if(this.isDragging){this.mouseNewPosition.set(e.clientX,e.clientY);const n=this.mouseNewPosition.clone().sub(this.mouseDownPosition);this.mouseDownPosition.copy(this.mouseNewPosition);const r=this.getInteractionType(e);if(r==="none")return;if(this.syncDirection==="engineToClient"){this.moveSender.send(()=>{this.doMove(r,[e.clientX,e.clientY])});return}if(r==="rotate")this.pendingRotation=this.pendingRotation?this.pendingRotation:new Ze,this.pendingRotation.x+=n.x,this.pendingRotation.y+=n.y;else if(r==="zoom")this.pendingZoom=this.pendingZoom?this.pendingZoom:1,this.pendingZoom*=1+n.y*.01;else if(r==="pan"){this.pendingPan=this.pendingPan?this.pendingPan:new Ze;let i=this.camera.position.distanceTo(this.target);this.camera instanceof $r&&(i=2280/(this.camera.zoom*45));const s=i/1e3/45*this.perspectiveFovBeforeOrtho;this.pendingPan.x+=-n.x*s,this.pendingPan.y+=n.y*s}}else if(this.syncDirection==="engineToClient"){const n=Yt();this.throttledEngCmd({type:"modeling_cmd_req",cmd:{type:"highlight_set_entity",selected_at_window:{x:e.clientX,y:e.clientY}},cmd_id:n})}});se(this,"onMouseUp",e=>{if(this.domElement.releasePointerCapture(e.pointerId),this.isDragging=!1,this.handleEnd(),this.syncDirection==="engineToClient"){const n=this.getInteractionType(e);if(n==="none")return;this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd:{type:"camera_drag_end",interaction:n,window:{x:e.clientX,y:e.clientY}},cmd_id:Yt()})}});se(this,"onMouseWheel",e=>{const n=this.getInteractionType(e);if(n!=="none"){if(e.preventDefault(),this.syncDirection==="engineToClient"){n==="zoom"?this.zoomSender.send(()=>{this.doZoom(e.deltaY)}):console.error(`Unexpected interaction type for engineToClient wheel event: ${n}`);return}this.handleStart(),n==="zoom"?this.pendingZoom=1+e.deltaY/window.devicePixelRatio*.001:console.error(`Unexpected interaction type for wheel event: ${n}`),this.handleEnd()}});se(this,"useOrthographicCamera",()=>{if(this.camera instanceof $r)return;const{x:e,y:n,z:r}=this.camera.position,{x:i,y:s,z:o,w:a}=this.camera.quaternion,l=this.camera.up.clone(),c=window.innerWidth/window.innerHeight;this.lastPerspectiveFov=this.camera.fov;const{z_near:u,z_far:d}=q7(this.lastPerspectiveFov);this.camera=new $r(-Pu*c,Pu*c,Pu,-Pu,u,d),this.camera.up.copy(l),this.camera.layers.enable(Cl),this.camera.position.set(e,n,r);const f=this.camera.position.distanceTo(this.target.clone()),h=45/this.lastPerspectiveFov;this.camera.zoom=hxe*h*.8/f,this.camera.quaternion.set(i,s,o,a),this.camera.updateProjectionMatrix(),this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_set_orthographic"}}),this.onCameraChange()});se(this,"createPerspectiveCamera",()=>{const{z_near:e,z_far:n}=q7(this.lastPerspectiveFov),r=this.camera.up.clone();return this.camera=new Fn(this.lastPerspectiveFov,window.innerWidth/window.innerHeight,e,n),this.camera.up.copy(r),this.camera.layers.enable(Cl),this.camera});se(this,"_usePerspectiveCamera",()=>{const{x:e,y:n,z:r}=this.camera.position,{x:i,y:s,z:o,w:a}=this.camera.quaternion;this.camera=this.createPerspectiveCamera(),this.camera.position.set(e,n,r),this.camera.quaternion.set(i,s,o,a),new de().subVectors(this.camera.position,this.target).normalize()});se(this,"usePerspectiveCamera",async(e=!1)=>(this._usePerspectiveCamera(),(e||this.syncDirection==="clientToEngine")&&await this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_set_perspective",parameters:{fov_y:this.camera instanceof Fn?this.camera.fov:45}}}),this.onCameraChange(),this.update(),this.camera));se(this,"dollyZoom",async(e,n=!1)=>{if(!(this.camera instanceof Fn)){console.warn("Dolly zoom is only applicable to perspective cameras.");return}this.lastPerspectiveFov=e;const r=new de().subVectors(this.target,this.camera.position).normalize(),i=this.camera.position.distanceTo(this.target),s=this.camera.fov,o=u=>Math.tan(a5(u/2)),a=o(s)/o(e);this.camera.fov=e,this.camera.updateProjectionMatrix();const l=i*a,c=this.target.clone().add(r.multiplyScalar(-l));this.camera.position.copy(c),n?(await this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_look_at",...jT({isPerspective:!0,position:c,quaternion:this.camera.quaternion,zoom:this.camera.zoom,target:this.target})}}),await this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_set_perspective",parameters:{fov_y:e}}})):await this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_perspective_settings",...jT({isPerspective:!0,position:c,quaternion:this.camera.quaternion,zoom:this.camera.zoom,target:this.target}),fov_y:e}})});se(this,"update",(e=!1)=>{let n=!1;if(this.pendingRotation&&(this.rotateCamera(this.pendingRotation.x,this.pendingRotation.y),this.pendingRotation=null,n=!0),this.pendingZoom){if(this.camera instanceof Fn){const i=this.camera.position.distanceTo(this.target)*this.pendingZoom,s=this.camera.position.clone().sub(this.target).normalize(),o=this.target.clone().add(s.multiplyScalar(i));this.camera.position.copy(o),this.camera.updateProjectionMatrix(),this.pendingZoom=null}else this.camera.zoom=this.camera.zoom/this.pendingZoom,this.pendingZoom=null;n=!0}if(this.pendingPan){const i=this.camera.position.clone().sub(this.target).clone().normalize(),s=this.camera.quaternion,o=new de(0,1,0).applyQuaternion(s),a=new de().crossVectors(o,i);a.multiplyScalar(this.pendingPan.x),o.multiplyScalar(this.pendingPan.y);const l=this.camera.position.clone().add(a).add(o);this.target.add(a),this.target.add(o),this.camera.position.copy(l),this.pendingPan=null,n=!0}this.safeLookAtTarget(this.camera.up),this.camera.updateMatrixWorld(),(n||e)&&this.onCameraChange(e)});se(this,"rotateCamera",(e,n)=>{const r=new $s().setFromUnitVectors(new de(0,0,1),new de(0,1,0)),i=r.clone().invert(),s=e*this.rotationSpeed,o=n*this.rotationSpeed,a=LC.degToRad(s),l=LC.degToRad(o),c=new de().subVectors(this.camera.position,this.target);c.applyQuaternion(r);const u=new LM().setFromVector3(c);u.theta-=a,u.phi-=l,u.phi=Math.max(.1,Math.min(Math.PI-.1,u.phi)),c.setFromSpherical(u),c.applyQuaternion(i),this.camera.position.copy(this.target).add(c),this.camera.updateMatrixWorld()});se(this,"animateToOrthographic",()=>new Promise(e=>{this.syncDirection==="engineToClient"&&console.warn("animate To Orthographic not design to work with engineToClient syncDirection."),this.isFovAnimationInProgress=!0;let n=this.lastPerspectiveFov;this.perspectiveFovBeforeOrtho=n;const r=ow,i=(n-r)/K7;let s=10;const o=()=>{this.camera instanceof Fn&&(this.camera.fov>r?(n=Math.max(n-i,r),this.camera.updateProjectionMatrix(),this.dollyZoom(n),requestAnimationFrame(o)):s>0?(s--,requestAnimationFrame(o)):(this.useOrthographicCamera(),this.isFovAnimationInProgress=!1,e(!0)))};o()}));se(this,"animateToPerspective",(e=new de(0,0,1))=>new Promise(n=>{this.syncDirection==="engineToClient"&&console.warn("animate To Perspective not design to work with engineToClient syncDirection."),this.isFovAnimationInProgress=!0;const r=this.perspectiveFovBeforeOrtho;this.lastPerspectiveFov=ow;let i=ow;const s=this.camera.up.clone();this.usePerspectiveCamera();const o=new de,a=c=>{i=this.lastPerspectiveFov+(r-this.lastPerspectiveFov)*c;const u=o.lerpVectors(s,e,c);this.camera.up.copy(u),this.dollyZoom(i)},l=()=>{this.isFovAnimationInProgress=!1,n(!0)};new UT({t:0}).to({t:1},kp()?50:K7*16).easing(Sh.Quadratic.InOut).onUpdate(({t:c})=>a(c)).onComplete(l).start()}));se(this,"snapToPerspectiveBeforeHandingBackControlToEngine",async(e=new de(0,0,1))=>{this.syncDirection==="engineToClient"&&console.warn("animate To Perspective not design to work with engineToClient syncDirection."),this.isFovAnimationInProgress=!0;const n=this.perspectiveFovBeforeOrtho;let r=ow;const i=this.camera.up.clone();this.usePerspectiveCamera();const s=new de;r=this.lastPerspectiveFov+(n-this.lastPerspectiveFov);const o=s.lerpVectors(i,e,1);this.camera.up.copy(o),await this.dollyZoom(r,!0),this.isFovAnimationInProgress=!1});se(this,"reactCameraPropertiesCallback",()=>{});se(this,"setReactCameraPropertiesCallback",e=>{this.reactCameraPropertiesCallback=e});se(this,"deferReactUpdate",b1(e=>{this.reactCameraPropertiesCallback(e)},200));se(this,"onCameraChange",(e=!1)=>{const n=this.target.distanceTo(this.camera.position);(this.camera.far/2.1<n||this.camera.far/1.9>n)&&(this.camera.far=n*2,this.camera.near=n/10,this.camera.updateProjectionMatrix()),(this.syncDirection==="clientToEngine"||e)&&this.throttledUpdateEngineCamera({quaternion:this.camera.quaternion,position:this.camera.position,zoom:this.camera.zoom,isPerspective:this.isPerspective,target:this.target}),this.deferReactUpdate(this.reactCameraProperties),Object.values(this._camChangeCallbacks).forEach(r=>r())});se(this,"getInteractionType",e=>dxe(this.interactionGuards,e,this.enablePan,this.enableRotate,this.enableZoom));this.engineCommandManager=r,this.camera=e?new $r:new Fn,this.camera.up.set(0,0,1),this.camera.far=2e4,this.target=new de,this.domElement=n,this.isDragging=!1,this.mouseDownPosition=new Ze,this.mouseNewPosition=new Ze,this.domElement.addEventListener("pointerdown",this.onMouseDown),this.domElement.addEventListener("pointermove",this.onMouseMove),this.domElement.addEventListener("pointerup",this.onMouseUp),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("resize",this.onWindowResize),this.onWindowResize(),this.update(),this._usePerspectiveCamera();const i=({data:s,type:o})=>{const a=s.settings;this.camera.position.set(a.pos.x,a.pos.y,a.pos.z),this.target.set(a.center.x,a.center.y,a.center.z);const l=new $s(a.orientation.x,a.orientation.y,a.orientation.z,a.orientation.w).invert();if(this.camera.up.copy(new de(0,1,0).applyQuaternion(l)),this.camera instanceof Fn&&a.ortho&&this.useOrthographicCamera(),this.camera instanceof $r&&!a.ortho&&this.usePerspectiveCamera(),this.camera instanceof Fn&&a.fov_y)this.camera.fov=a.fov_y;else if(this.camera instanceof $r&&a.ortho_scale){const c=new de(a.pos.x,a.pos.y,a.pos.z).distanceTo(new de(a.center.x,a.center.y,a.center.z));this.camera.zoom=a.ortho_scale*40/c}this.onCameraChange()};setTimeout(()=>{this.engineCommandManager.subscribeTo({event:"camera_drag_end",callback:i}),this.engineCommandManager.subscribeTo({event:"default_camera_zoom",callback:i}),this.engineCommandManager.subscribeTo({event:"default_camera_get_settings",callback:i}),this.engineCommandManager.subscribeTo({event:"zoom_to_fit",callback:i}),this.engineCommandManager.subscribeToUnreliable({event:"camera_drag_move",callback:i})})}get isPerspective(){return this.camera instanceof Fn}setEngineCameraProjection(e){e==="orthographic"?this.useOrthographicCamera():this.usePerspectiveCamera(!0).catch(Bt)}setIsCamMovingCallback(e){this._isCamMovingCallback=e}subscribeToCamChange(e){const n=Yt();return this._camChangeCallbacks[n]=e,()=>{delete this._camChangeCallbacks[n]}}safeLookAtTarget(e=new de(0,0,1)){const n=uxe(this.camera.position,this.target,e);this.camera.quaternion.copy(n),this.camera.updateMatrixWorld()}tweenCamToNegYAxis(e=-Math.PI/2,n=500){return new Promise(r=>{const i=Math.sqrt((this.target.x-this.camera.position.x)**2+(this.target.y-this.camera.position.y)**2),s=Math.atan2(this.camera.position.y-this.target.y,this.camera.position.x-this.target.x),o=l=>{const c=i*Math.cos(l.angle),u=i*Math.sin(l.angle);this.camera.position.set(this.target.x+c,this.target.y+u,this.camera.position.z),this.update(),this.onCameraChange()},a=l=>{o(l),this._isCamMovingCallback(!1,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>r())})};if(this._isCamMovingCallback(!0,!0),kp()){a({angle:e});return}new UT({angle:s}).to({angle:e},n).onUpdate(o).onComplete(a).start()})}async updateCameraToAxis(e){const n=this.camera.position.distanceTo(this.target),r=this.target.clone();let i={x:0,y:0,z:1};e==="x"?r.x+=n:e==="y"?r.y+=n:e==="z"?(r.z+=n,i={x:-1,y:0,z:0}):e==="-x"?r.x-=n:e==="-y"?r.y-=n:e==="-z"&&(r.z-=n,i={x:-1,y:0,z:0}),await this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_look_at",center:this.target,vantage:r,up:i}}),await this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_get_settings"}})}async resetCameraPosition(){await this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_look_at",center:this.target,vantage:{x:this.target.x,y:this.target.y-128,z:this.target.z+64},up:{x:0,y:0,z:1}}}),await this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"zoom_to_fit",object_ids:[],padding:.2,animated:!1}})}async tweenCameraToQuaternion(e,n=new de,r=500,i=!0){this.syncDirection==="engineToClient"&&console.warn("tweenCameraToQuaternion not design to work with engineToClient syncDirection.");const s=l5(e);let o=r;if(s){o=r*.5;const a=r*.65;let l=-Math.PI/2;new de(0,0,1).applyQuaternion(e).z<0&&(l=Math.PI/2),await this.tweenCamToNegYAxis(l,a)}await this._tweenCameraToQuaternion(e,n,o,i)}_tweenCameraToQuaternion(e,n,r=500,i=!1){return new Promise(s=>{const o=this.camera;this._isCamMovingCallback(!0,!0);const a=o.quaternion.clone(),l=this.target.clone();let u=l5(e)?.99:1;const d=new de,f=l.distanceTo(o.position.clone()),h=p=>{const m=axe.slerpQuaternions(a,e,p),g=new de(0,0,1).applyQuaternion(m);this.camera.up.copy(g);const y=d.lerpVectors(l,n,p);this.camera instanceof Fn&&this.camera.position.set(0,0,1).applyQuaternion(m).multiplyScalar(f).add(y),this.camera.up.set(0,1,0).applyQuaternion(m).normalize(),this.camera.quaternion.copy(m),this.target.copy(y),this.camera.updateProjectionMatrix(),this.update(),this.onCameraChange()},A=async()=>{kp()&&i?(h(.9999),this.useOrthographicCamera()):i&&await this.animateToOrthographic(),this.enableRotate=!1,this._isCamMovingCallback(!1,!0),s()};if(kp()){A();return}new UT({t:0}).to({t:u},r).easing(Sh.Quadratic.InOut).onUpdate(({t:p})=>h(p)).onComplete(Li(A,Bt)).start()})}get reactCameraProperties(){return{type:this.isPerspective?"perspective":"orthographic",[this.isPerspective?"fov":"zoom"]:this.camera instanceof Fn?this.camera.fov:this.camera.zoom,position:[ot(this.camera.position.x,2),ot(this.camera.position.y,2),ot(this.camera.position.z,2)],target:[ot(this.target.x,2),ot(this.target.y,2),ot(this.target.z,2)],quaternion:[ot(this.camera.quaternion.x,2),ot(this.camera.quaternion.y,2),ot(this.camera.quaternion.z,2),ot(this.camera.quaternion.w,2)]}}}function q7(t){return{z_near:.01,z_far:1e3}}function jT({target:t,position:e,quaternion:n,zoom:r,isPerspective:i}){const s=new el().setFromQuaternion(n,"XYZ"),o=new de(0,1,0).applyEuler(s).normalize();if(i)return{center:t,up:o,vantage:e};function a(p,m,g){const y=h(u(g,m));return{center:m,eye:c(m,l(y,p))}}function l(p,m){return{x:p.x*m,y:p.y*m,z:p.z*m}}function c(p,m){return{x:p.x+m.x,y:p.y+m.y,z:p.z+m.z}}function u(p,m){return{x:p.x-m.x,y:p.y-m.y,z:p.z-m.z}}function d(p,m){return p.x*m.x+p.y*m.y+p.z*m.z}function f(p){return Math.sqrt(d(p,p))}function h(p){return l(p,1/f(p))}const A=a(64/r,t,e);return{center:new de(A.center.x,A.center.y,A.center.z),up:new de(o.x,o.y,o.z),vantage:new de(A.eye.x,A.eye.y,A.eye.z)}}function uxe(t,e,n){let r=new de().subVectors(e,t).normalize(),i=new de().crossVectors(r,n).normalize(),s=new de().crossVectors(i,r).normalize(),o=new Zt;return o.lookAt(t,e,s),new $s().setFromRotationMatrix(o)}function dxe(t,e,n,r,i){if(e instanceof WheelEvent){if(i&&t.zoom.scrollCallback(e))return"zoom"}else{if(n&&t.pan.callback(e))return"pan";if(r&&t.rotate.callback(e))return"rotate";if(i&&t.zoom.dragCallback(e))return"zoom"}return"none"}async function QT(t,e){await t.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"enable_sketch_mode",adjust_camera:!0,animated:!kp(),ortho:!0,entity_id:e}}),await new Promise(n=>setTimeout(n,kp()?100:600)),await t.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_get_settings"}})}class lX extends Sr{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Ze(.5,.5),this.addEventListener("removed",function(){this.traverse(function(n){n.element instanceof Element&&n.element.parentNode!==null&&n.element.parentNode.removeChild(n.element)})})}copy(e,n){return super.copy(e,n),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const zA=new de,X7=new Zt,Y7=new Zt,J7=new de,Z7=new de;class fxe{constructor(e={}){const n=this;let r,i,s,o;const a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.getSize=function(){return{width:r,height:i}},this.render=function(A,p){A.matrixWorldAutoUpdate===!0&&A.updateMatrixWorld(),p.parent===null&&p.matrixWorldAutoUpdate===!0&&p.updateMatrixWorld(),X7.copy(p.matrixWorldInverse),Y7.multiplyMatrices(p.projectionMatrix,X7),u(A,A,p),h(A)},this.setSize=function(A,p){r=A,i=p,s=r/2,o=i/2,l.style.width=A+"px",l.style.height=p+"px"};function c(A){A.isCSS2DObject&&(A.element.style.display="none");for(let p=0,m=A.children.length;p<m;p++)c(A.children[p])}function u(A,p,m){if(A.visible===!1){c(A);return}if(A.isCSS2DObject){zA.setFromMatrixPosition(A.matrixWorld),zA.applyMatrix4(Y7);const g=zA.z>=-1&&zA.z<=1&&A.layers.test(m.layers)===!0,y=A.element;y.style.display=g===!0?"":"none",g===!0&&(A.onBeforeRender(n,p,m),y.style.transform="translate("+-100*A.center.x+"%,"+-100*A.center.y+"%)translate("+(zA.x*s+s)+"px,"+(-zA.y*o+o)+"px)",y.parentNode!==l&&l.appendChild(y),A.onAfterRender(n,p,m));const w={distanceToCameraSquared:d(m,A)};a.objects.set(A,w)}for(let g=0,y=A.children.length;g<y;g++)u(A.children[g],p,m)}function d(A,p){return J7.setFromMatrixPosition(A.matrixWorld),Z7.setFromMatrixPosition(p.matrixWorld),J7.distanceToSquared(Z7)}function f(A){const p=[];return A.traverseVisible(function(m){m.isCSS2DObject&&p.push(m)}),p}function h(A){const p=f(A).sort(function(g,y){if(g.renderOrder!==y.renderOrder)return y.renderOrder-g.renderOrder;const w=a.objects.get(g).distanceToCameraSquared,v=a.objects.get(y).distanceToCameraSquared;return w-v}),m=p.length;for(let g=0,y=p.length;g<y;g++)p[g].element.style.zIndex=m-g}}}const hxe=63.5,cX=1,Cl=2,U0="raycastable-plane",rh="xAxis",sp="yAxis",ig="axisGroup",e9="sketch-group-segments",au="arrowhead",uX="segment-length-label",B_="segment-length-label-text",Axe=30,gS=class gS{constructor(e){se(this,"scene");se(this,"renderer");se(this,"labelRenderer");se(this,"camControls");se(this,"isPerspective",!0);se(this,"fov",45);se(this,"fovBeforeAnimate",45);se(this,"isFovAnimationInProgress",!1);se(this,"_baseUnit","mm");se(this,"_baseUnitMultiplier",1);se(this,"_theme",Zn.System);se(this,"extraSegmentTexture");se(this,"lastMouseState",{type:"idle"});se(this,"onDragStartCallback",()=>{});se(this,"onDragEndCallback",()=>{});se(this,"onDragCallback",()=>{});se(this,"onMoveCallback",()=>{});se(this,"onClickCallback",()=>{});se(this,"onMouseEnter",()=>{});se(this,"onMouseLeave",()=>{});se(this,"setCallbacks",e=>{this.onDragStartCallback=e.onDragStart||this.onDragStartCallback,this.onDragEndCallback=e.onDragEnd||this.onDragEndCallback,this.onDragCallback=e.onDrag||this.onDragCallback,this.onMoveCallback=e.onMove||this.onMoveCallback,this.onClickCallback=e.onClick||this.onClickCallback,this.onMouseEnter=e.onMouseEnter||this.onMouseEnter,this.onMouseLeave=e.onMouseLeave||this.onMouseLeave,this.selected=null});se(this,"resetMouseListeners",()=>{this.setCallbacks({onDragStart:()=>{},onDragEnd:()=>{},onDrag:()=>{},onMove:()=>{},onClick:()=>{},onMouseEnter:()=>{},onMouseLeave:()=>{}})});se(this,"modelingSend",()=>{});se(this,"throttledModelingSend",()=>{});se(this,"overlayTimeout",0);se(this,"callbacks",[]);se(this,"overlayThrottleMap",{});se(this,"hoveredObject",null);se(this,"raycaster",new RM);se(this,"planeRaycaster",new RM);se(this,"currentMouseVector",new Ze);se(this,"selected",null);se(this,"mouseDownVector",null);se(this,"onCameraChange",()=>{var r;const e=dX(this.camControls.camera,this.camControls.target),n=(r=this.scene.getObjectByName(ig))==null?void 0:r.getObjectByName("gridHelper");(n==null?void 0:n.name)==="gridHelper"&&n.scale.set(e,e,e)});se(this,"onWindowResize",()=>{this.renderer.setSize(window.innerWidth,window.innerHeight),this.labelRenderer.setSize(window.innerWidth,window.innerHeight)});se(this,"animate",()=>{requestAnimationFrame(this.animate),rxe(),this.isFovAnimationInProgress||(this.camControls.update(),this.renderer.render(this.scene,this.camControls.camera),this.labelRenderer.render(this.scene,this.camControls.camera))});se(this,"dispose",()=>{this.renderer.dispose(),window.removeEventListener("resize",this.onWindowResize)});se(this,"getPlaneIntersectPoint",()=>{this.planeRaycaster.setFromCamera(this.currentMouseVector,this.camControls.camera);const e=this.planeRaycaster.intersectObjects(this.scene.children,!0),n=e.find(c=>c.object.name===U0);if(!e.length)return null;if(!n)return{intersection:e[0]};const r=e[0].object.position,i=e[0].object.quaternion.clone().invert(),s=e[0].point;let o=s.clone();o&&o.applyQuaternion(i);const a=new Ze(o.x/this._baseUnitMultiplier,o.y/this._baseUnitMultiplier),l=new de(...r).applyQuaternion(i);return a.sub(new Ze(...l)),{twoD:a,threeD:s.divideScalar(this._baseUnitMultiplier),intersection:e[0]}});se(this,"onMouseMove",async e=>{var i,s;this.currentMouseVector.x=e.clientX/window.innerWidth*2-1,this.currentMouseVector.y=-(e.clientY/window.innerHeight)*2+1;const n=this.getPlaneIntersectPoint(),r=this.raycastRing();if(this.selected){const o=!rX([this.currentMouseVector.x,this.currentMouseVector.y],[this.selected.mouseDownVector.x,this.selected.mouseDownVector.y],.02);!this.selected.hasBeenDragged&&o&&(this.selected.hasBeenDragged=!0),o&&n&&n.twoD&&n.threeD&&(await this.onDragCallback({mouseEvent:e,intersectionPoint:{twoD:n.twoD,threeD:n.threeD},intersects:r,selected:this.selected.object}),this.updateMouseState({type:"isDragging",on:this.selected.object}))}else n&&n.twoD&&n.threeD&&await this.onMoveCallback({mouseEvent:e,intersectionPoint:{twoD:n.twoD,threeD:n.threeD},intersects:r});if(r[0]){const o=r[0].object;if(this.hoveredObject!==o){const a=this.hoveredObject;this.hoveredObject=null,await this.onMouseLeave({selected:a,mouseEvent:e}),this.hoveredObject=o,await this.onMouseEnter({selected:this.hoveredObject,dragSelected:(i=this.selected)==null?void 0:i.object,mouseEvent:e}),this.selected||this.updateMouseState({type:"isHovering",on:this.hoveredObject})}}else if(this.hoveredObject){const o=this.hoveredObject;this.hoveredObject=null,await this.onMouseLeave({selected:o,dragSelected:(s=this.selected)==null?void 0:s.object,mouseEvent:e}),this.selected||this.updateMouseState({type:"idle"})}});se(this,"raycastRing",(e=8,n=32)=>{const r=this.currentMouseVector.clone(),i=new Map,s=o=>{o.forEach(a=>{if(a.object.type!=="GridHelper"){const l=i.get(a.object);(!l||l.distance>a.distance)&&i.set(a.object,a)}})};this.raycaster.setFromCamera(r,this.camControls.camera),s(this.raycaster.intersectObjects(this.scene.children,!0));for(let o=0;o<n;o++){const a=o/n*Math.PI*2,l=e*Math.cos(a)/window.innerWidth*2,c=e*Math.sin(a)/window.innerHeight*2,u=new Ze(r.x+l,r.y-c);this.raycaster.setFromCamera(u,this.camControls.camera),s(this.raycaster.intersectObjects(this.scene.children,!0))}return Array.from(i.values()).sort((o,a)=>o.distance-a.distance)});se(this,"onMouseDown",e=>{var i;this.currentMouseVector.x=e.clientX/window.innerWidth*2-1,this.currentMouseVector.y=-(e.clientY/window.innerHeight)*2+1;const n=this.currentMouseVector.clone(),r=this.raycastRing()[0];if(r){const s=(i=r==null?void 0:r.object)==null?void 0:i.parent;this.selected=s.isGroup?{mouseDownVector:n,object:r.object,hasBeenDragged:!1}:null}});se(this,"onMouseUp",async e=>{this.currentMouseVector.x=e.clientX/window.innerWidth*2-1,this.currentMouseVector.y=-(e.clientY/window.innerHeight)*2+1;const n=this.getPlaneIntersectPoint(),r=this.raycastRing();this.selected?(this.selected.hasBeenDragged?(await this.onDragEndCallback({intersectionPoint:{twoD:n==null?void 0:n.twoD,threeD:n==null?void 0:n.threeD},intersects:r,mouseEvent:e,selected:this.selected}),r.length?this.updateMouseState({type:"isHovering",on:r[0].object}):this.updateMouseState({type:"idle"})):n!=null&&n.twoD&&(n!=null&&n.threeD)?await this.onClickCallback({mouseEvent:e,intersectionPoint:{twoD:n.twoD,threeD:n.threeD},intersects:r,selected:this.selected.object}):n?await this.onClickCallback({mouseEvent:e,intersects:r}):await this.onClickCallback({mouseEvent:e,intersects:r}),this.selected=null):n!=null&&n.twoD&&(n!=null&&n.threeD)?await this.onClickCallback({mouseEvent:e,intersectionPoint:{twoD:n.twoD,threeD:n.threeD},intersects:r}):await this.onClickCallback({mouseEvent:e,intersects:r})});se(this,"updateOtherSelectionColors",e=>{const n=this.scene.children.find(({userData:i})=>(i==null?void 0:i.type)===ig),r={[rh]:"x-axis",[sp]:"y-axis"};n==null||n.children.forEach(i=>{var a,l,c;const s=i,o=s.material;e.includes(r[(a=s.userData)==null?void 0:a.type])?(o.color.set((l=s==null?void 0:s.userData)==null?void 0:l.baseColor),o.color.offsetHSL(0,0,.2),s.userData.isSelected=!0):(o.color.set((c=s==null?void 0:s.userData)==null?void 0:c.baseColor),s.userData.isSelected=!1)})});var l,c,u;this.scene=new iL,this.scene.background=new Nt(0),this.scene.background=null,this.renderer=new rL({antialias:!0,alpha:!0}),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.setClearColor(0,0),this.labelRenderer=new fxe,this.labelRenderer.setSize(window.innerWidth,window.innerHeight),this.labelRenderer.domElement.style.position="absolute",this.labelRenderer.domElement.style.top="0px",this.labelRenderer.domElement.style.pointerEvents="none",window.addEventListener("resize",this.onWindowResize),this.camControls=new cxe(!1,this.renderer.domElement,e),this.camControls.subscribeToCamChange(()=>this.onCameraChange()),this.camControls.camera.layers.enable(Cl),this.raycaster.layers.enable(Cl),this.raycaster.layers.disable(0),this.planeRaycaster.layers.enable(cX);const n=100,r=10,i=new Cg({color:255,transparent:!0,opacity:.5}),s=new wW(n,r,255,16777215);s.material=i,s.rotation.x=Math.PI/2;const o=new hhe(5263440);this.scene.add(o);const a=new bW;this.extraSegmentTexture=a.load("./clientSideSceneAssets/extra-segment-texture.png"),this.extraSegmentTexture.anisotropy=(u=(c=(l=this.renderer)==null?void 0:l.capabilities)==null?void 0:c.getMaxAnisotropy)==null?void 0:u.call(c),gS.instance=this}set baseUnit(e){this._baseUnit=e,this._baseUnitMultiplier=pxe(e),this.scene.scale.set(this._baseUnitMultiplier,this._baseUnitMultiplier,this._baseUnitMultiplier)}set theme(e){this._theme=e}setSend(e){this.modelingSend=e,this.throttledModelingSend=b1(e,100)}_overlayCallbacks(e){const n={type:"set-many",overlays:{}};e.forEach(r=>{const i=r();(i==null?void 0:i.type)==="set-one"&&(n.overlays[i.pathToNodeString]=i.seg)}),this.modelingSend({type:"Set Segment Overlays",data:n})}overlayCallbacks(e,n=!1){if(n){this._overlayCallbacks(e);return}this.callbacks=e,this.overlayTimeout&&clearTimeout(this.overlayTimeout),this.overlayTimeout=setTimeout(()=>{this._overlayCallbacks(this.callbacks)},100)}updateOverlayDetails({arrowGroup:e,group:n,isHandlesVisible:r,from:i,to:s,angle:o}){if(n.userData.pathToNode&&e){const a=new de(0,0,0);e.getWorldPosition(a),a.project(this.camControls.camera);const l=typeof o=="number"?o:xi(i,s),c=(a.x*.5+.5)*window.innerWidth,u=(-a.y*.5+.5)*window.innerHeight;return{type:"set-one",pathToNodeString:JSON.stringify(n.userData.pathToNode),seg:{windowCoords:[c,u],angle:l,group:n,pathToNode:n.userData.pathToNode,visible:r}}}return null}updateMouseState(e){this.lastMouseState.type!==e.type&&(this.lastMouseState=e,this.modelingSend({type:"Set mouse state",data:e}))}};se(gS,"instance");let c5=gS;function dX(t,e){const n=t instanceof Fn?t.position.distanceTo(e):63.7942123/t.zoom;return n<=20?.1:n>20&&n<=200?1:n>200&&n<=2e3?10:n>2e3&&n<=2e4?100:n>2e4?1e3:1}function pxe(t){switch(t){case"mm":return 1;case"cm":return 10;case"m":return 1e3;case"in":return 25.4;case"ft":return 304.8;case"yd":return 914.4}}function fX(t,e=!1){const n=t[0].index!==null,r=new Set(Object.keys(t[0].attributes)),i=new Set(Object.keys(t[0].morphAttributes)),s={},o={},a=t[0].morphTargetsRelative,l=new Ai;let c=0;for(let u=0;u<t.length;++u){const d=t[u];let f=0;if(n!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const h in d.attributes){if(!r.has(h))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+h+'" attribute exists among all geometries, or in none of them.'),null;s[h]===void 0&&(s[h]=[]),s[h].push(d.attributes[h]),f++}if(f!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const h in d.morphAttributes){if(!i.has(h))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+".  .morphAttributes must be consistent throughout all geometries."),null;o[h]===void 0&&(o[h]=[]),o[h].push(d.morphAttributes[h])}if(e){let h;if(n)h=d.index.count;else if(d.attributes.position!==void 0)h=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,h,u),c+=h}}if(n){let u=0;const d=[];for(let f=0;f<t.length;++f){const h=t[f].index;for(let A=0;A<h.count;++A)d.push(h.getX(A)+u);u+=t[f].attributes.position.count}l.setIndex(d)}for(const u in s){const d=t9(s[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(const u in o){const d=o[u][0].length;if(d===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<d;++f){const h=[];for(let p=0;p<o[u].length;++p)h.push(o[u][p][f]);const A=t9(h);if(!A)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(A)}}return l}function t9(t){let e,n,r,i=-1,s=0;for(let c=0;c<t.length;++c){const u=t[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(n===void 0&&(n=u.itemSize),n!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(r===void 0&&(r=u.normalized),r!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=u.gpuType),i!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*n}const o=new e(s),a=new Fi(o,n,r);let l=0;for(let c=0;c<t.length;++c){const u=t[c];if(u.isInterleavedBufferAttribute){const d=l/n;for(let f=0,h=u.count;f<h;f++)for(let A=0;A<n;A++){const p=u.getComponent(f,A);a.setComponent(f+d,A,p)}}else o.set(u.array,l);l+=u.count*n}return i!==void 0&&(a.gpuType=i),a}function n9(t,e){if(e===koe)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===CM||e===GG){let n=t.getIndex();if(n===null){const o=[],a=t.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);t.setIndex(o),n=t.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t}const r=n.count-2,i=[];if(e===CM)for(let o=1;o<=r;o++)i.push(n.getX(0)),i.push(n.getX(o)),i.push(n.getX(o+1));else for(let o=0;o<r;o++)o%2===0?(i.push(n.getX(o)),i.push(n.getX(o+1)),i.push(n.getX(o+2))):(i.push(n.getX(o+2)),i.push(n.getX(o+1)),i.push(n.getX(o)));i.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}class mxe{constructor(){se(this,"init",({input:e,id:n,pathToNode:r,isDraftSegment:i,scale:s=1,callExpName:o,texture:a,theme:l,isSelected:c=!1,sceneInfra:u,prevSegment:d})=>{if(e.type!=="straight-segment")return new Error("Invalid segment type");const{from:f,to:h}=e,A=o==="close"?4473924:ru(l),p=c?255:A,m=i?a9:o9,g=new es,y=new NC,w=new J1(new de(f[0],f[1],0),new de(h[0],h[1],0)),v=new Ld(y,{steps:2,bevelEnabled:!1,extrudePath:w}),x=new ei({color:p}),C=new xn(v,x);C.userData.type=m,C.name=m,g.name=hd,g.userData={type:hd,id:n,from:f,to:h,pathToNode:r,isSelected:c,callExpName:o,baseColor:A};const _=hX(s,a,l);if(o!=="close"){const E=pI(s,l,p),T=wxe({from:f,to:h,scale:s});g.add(E),g.add(T)}g.add(C,_);let S=this.update({prevSegment:d,input:e,group:g,scale:s,sceneInfra:u});return ie(S)?S:{group:g,updateOverlaysCallback:S}});se(this,"update",({input:e,group:n,scale:r=1,sceneInfra:i})=>{if(e.type!=="straight-segment")return new Error("Invalid segment type");const{from:s,to:o}=e;n.userData.from=s,n.userData.to=o;const a=new NC;a.moveTo(0,-M_/2*r),a.lineTo(0,M_/2*r);const l=n.getObjectByName(au),c=n.getObjectByName(uX),u=Math.sqrt(Math.pow(o[0]-s[0],2)+Math.pow(o[1]-s[1],2)),d=u/r,f=d<yI,h=d<vI,A=i.hoveredObject&&mi(i.hoveredObject,[hd]);let p=!f;if(A&&(A==null?void 0:A.uuid)===(n==null?void 0:n.uuid)&&(p=!h),l){l.position.set(o[0],o[1],0);const w=new de().subVectors(new de(o[0],o[1],0),new de(s[0],s[1],0)).normalize();l.quaternion.setFromUnitVectors(new de(0,1,0),w),l.scale.set(r,r,r),l.visible=p}const m=n.getObjectByName(Il);if(m){const w=new Ze(o[0]-s[0],o[1]-s[1]).normalize().multiplyScalar(xX*r);m.position.set(s[0]+w.x,s[1]+w.y,0),m.scale.set(r,r,r),m.visible=p}if(c){const w=c.getObjectByName(B_),x=w.element.children[0];x.innerText=`${ot(u)}`,x.classList.add(B_);const C=(o[1]-s[1])/(o[0]-s[0]);let _=Math.atan(C)*180/Math.PI*-1;x.style.setProperty("--degree",`${_}deg`),x.style.setProperty("--x","0px"),x.style.setProperty("--y","0px"),w.position.set((s[0]+o[0])/2,(s[1]+o[1])/2,0),c.visible=p}const g=n.children.find(w=>w.userData.type===o9);if(g){const w=new J1(new de(s[0],s[1],0),new de(o[0],o[1],0));g.geometry=new Ld(a,{steps:2,bevelEnabled:!1,extrudePath:w})}const y=n.children.find(w=>w.userData.type===a9);return y&&(y.geometry=xxe(s,o,a,r)),()=>i.updateOverlayDetails({arrowGroup:l,group:n,isHandlesVisible:p,from:s,to:o})})}}class gxe{constructor(){se(this,"init",({prevSegment:e,input:n,id:r,pathToNode:i,isDraftSegment:s,scale:o=1,texture:a,theme:l,isSelected:c,sceneInfra:u})=>{if(n.type!=="straight-segment")return new Error("Invalid segment type");const{from:d,to:f}=n,h=s?l9:c9,A=new es,p=im({center:[0,0],radius:1,startAngle:0,endAngle:1,ccw:!0,isDashed:s,scale:o}),m=ru(l),g=c?255:m,y=new ei({color:g}),w=new xn(p,y),v=pI(o,l,g),x=hX(o,a,l);A.name=Ad,w.userData.type=h,w.name=h,A.userData={type:Ad,id:r,from:d,to:f,prevSegment:e,pathToNode:i,isSelected:c,baseColor:m},A.add(w,v,x);const C=this.update({prevSegment:e,input:n,group:A,scale:o,sceneInfra:u});return ie(C)?C:{group:A,updateOverlaysCallback:C}});se(this,"update",({prevSegment:e,input:n,group:r,scale:i=1,sceneInfra:s})=>{if(n.type!=="straight-segment")return new Error("Invalid segment type");const{from:o,to:a}=n;r.userData.from=o,r.userData.to=a,r.userData.prevSegment=e;const l=r.getObjectByName(au),c=r.getObjectByName(Il),u=(e==null?void 0:e.type)==="TangentialArcTo"?sxe(e.center,e.ccw,e.to):e.from,d=wbe({arcStartPoint:o,arcEndPoint:a,tanPreviousPoint:u,obtuse:!0}),f=d.arcLength/i,h=f<yI,A=f<vI,p=(s==null?void 0:s.hoveredObject)&&mi(s.hoveredObject,[Ad]);let m=!h;if(p&&(p==null?void 0:p.uuid)===(r==null?void 0:r.uuid)&&(m=!A),l){l.position.set(a[0],a[1],0);const v=d.endAngle+Math.PI/2*(d.ccw?1:-1);l.quaternion.setFromUnitVectors(new de(0,1,0),new de(Math.cos(v),Math.sin(v),0)),l.scale.set(i,i,i),l.visible=m}if(c){const v=2*Math.PI*d.radius/i,x=xX/v*Math.PI*2,C=d.startAngle+(d.ccw?1:-1)*x,_=new Ze(Math.cos(C)*d.radius,Math.sin(C)*d.radius);c.position.set(d.center[0]+_.x,d.center[1]+_.y,0),c.scale.set(i,i,i),c.visible=m}const g=r.children.find(v=>v.userData.type===c9);if(g){const v=im({...d,scale:i});g.geometry=v}const y=r.getObjectByName(l9);y instanceof xn&&(y.geometry=im({...d,isDashed:!0,scale:i}));const w=tg(d.endAngle*180/Math.PI+(d.ccw?90:-90));return()=>s.updateOverlayDetails({arrowGroup:l,group:r,isHandlesVisible:m,from:o,to:a,angle:w})})}}class yxe{constructor(){se(this,"init",({prevSegment:e,input:n,id:r,pathToNode:i,isDraftSegment:s,scale:o=1,theme:a,isSelected:l,sceneInfra:c})=>{if(n.type!=="arc-segment")return new Error("Invalid segment type");const{from:u,center:d,radius:f}=n,h=ru(a),A=l?255:h,p=new es,m=im({center:d,radius:f,startAngle:0,endAngle:Math.PI*2,ccw:!0,isDashed:s,scale:o}),g=new ei({color:A}),y=new xn(m,g),w=s?d9:u9,v=pI(o,a,A),x=bxe(o,a,A);y.userData.type=w,y.name=w,p.userData={type:pd,id:r,from:u,radius:f,center:d,ccw:!0,prevSegment:e,pathToNode:i,isSelected:l,baseColor:h},p.name=pd,p.add(y,v,x);const C=this.update({prevSegment:e,input:n,group:p,scale:o,sceneInfra:c});return ie(C)?C:{group:p,updateOverlaysCallback:C}});se(this,"update",({prevSegment:e,input:n,group:r,scale:i=1,sceneInfra:s})=>{if(n.type!=="arc-segment")return new Error("Invalid segment type");const{from:o,center:a,radius:l}=n;r.userData.from=o,r.userData.center=a,r.userData.radius=l,r.userData.prevSegment=e;const c=r.getObjectByName(au),u=r.getObjectByName(Ry),d=2*l*Math.PI/i,f=d<yI,h=d<vI,A=s.hoveredObject&&mi(s.hoveredObject,[pd]);let p=!f;if(A&&(A==null?void 0:A.uuid)===(r==null?void 0:r.uuid)&&(p=!h),c){c.position.set(a[0]+Math.cos(Math.PI/4)*l,a[1]+Math.sin(Math.PI/4)*l,0);const y=Math.PI/4;c.quaternion.setFromUnitVectors(new de(0,1,0),new de(Math.cos(y),Math.sin(y),0)),c.scale.set(i,i,i),c.visible=p}u&&(u.position.set(a[0],a[1],0),u.scale.set(i,i,i),u.visible=p);const m=r.children.find(y=>y.userData.type===u9);if(m){const y=im({radius:l,center:a,startAngle:0,endAngle:Math.PI*2,ccw:!0,scale:i});m.geometry=y}const g=r.getObjectByName(d9);return g instanceof xn&&(g.geometry=im({center:a,radius:l,ccw:!0,startAngle:Math.PI*.25,endAngle:Math.PI*2.25,isDashed:!0,scale:i})),()=>s.updateOverlayDetails({arrowGroup:c,group:r,isHandlesVisible:p,from:o,to:[a[0],a[1]],angle:Math.PI/4})})}}function vxe({from:t,id:e,pathToNode:n,scale:r=1,theme:i,isSelected:s}){const o=new es,a=new Wl(12,12,12),l=ru(i),c=s?255:l,u=new ei({color:c}),d=new xn(a,u);return o.add(d),o.userData={type:ta,id:e,from:t,pathToNode:n,isSelected:s,baseColor:l},o.name=ta,o.position.set(t[0],t[1],0),o.scale.set(r,r,r),o}function pI(t=1,e,n){const r=ru(e),i=new ei({color:n||r}),s=new xn(new fL(4.5,20,12),i);s.position.set(0,-9,0);const o=new xn(new nv(4,12,12),i),a=new es;return a.userData.type=au,a.name=au,a.add(s,o),a.lookAt(new de(0,1,0)),a.scale.set(t,t,t),a}function bxe(t=1,e,n){const r=new es,i=new Wl(12,12,12),s=ru(e),o=new ei({color:n}),a=new xn(i,o);return r.add(a),r.userData={type:Ry,baseColor:s},r.name=Ry,r.scale.set(t,t,t),r}function hX(t,e,n){const r=new cL({size:12,map:e,transparent:!0,opacity:0,depthTest:!1}),i=new ei({transparent:!0,color:ru(n),opacity:0}),s=new Ai().setFromPoints([new de(0,0,0)]),o=new xn(new nv(6,12,12),i),a=new FC(s,r);a.userData.ignoreColorChange=!0,a.userData.type=Il;const l=new es;return l.userData.type=Il,l.name=Il,l.add(o),l.add(a),l.scale.set(t,t,t),l}function wxe({from:t,to:e,scale:n,length:r=.1}){const i=new es;i.name=uX;const s=document.createElement("p");s.classList.add(B_),s.innerText=ot(r).toString();const o=document.createElement("div");o.style.position="absolute",o.appendChild(s);const a=new lX(o);a.name=B_;const l=new Ze(e[0]-t[0],e[1]-t[1]).normalize().rotateAround(new Ze(0,0),-Math.PI/2).multiplyScalar(Axe*n);return s.style.setProperty("--x",`${l.x}px`),s.style.setProperty("--y",`${l.y}px`),i.add(a),i}function im({center:t,radius:e,startAngle:n,endAngle:r,ccw:i,isDashed:s=!1,scale:o=1}){const a=18*o,l=18*o,c=new qp(t[0],t[1],e,e,n,r,!i,0),u=new qp(t[0],t[1],e,e,r,n,i,0),d=new NC;if(d.moveTo(0,-M_/2*o),d.lineTo(0,M_/2*o),!s){const w=c.getPoints(50),v=new xx;return v.add(new wx(w.map(x=>new de(x.x,x.y,0)))),new Ld(d,{steps:100,bevelEnabled:!1,extrudePath:v})}const f=c.getLength(),h=f/(a+l),A=Math.min(100,h/2),p=[],m=(w,v)=>{const x=v.getPoint(w),C=v.getPoint(Math.min(.5,w+a/f)),_=v.getPoint(Math.min(.5,w+a/f/2)),S=new xx;return S.add(new wx([new de(x.x,x.y,0),new de(_.x,_.y,0),new de(C.x,C.y,0)])),new Ld(d,{steps:3,bevelEnabled:!1,extrudePath:S})};for(let w=0;w<A;w++){const v=w/h;p.push(m(v,c)),p.push(m(v,u))}if(f-A*2*(a+l)>0){const w=A/h,v=1-w,x=new Ze(t[0],t[1]),C=c.getPoint(w),_=c.getPoint(v),E=new qp(c.aX,c.aY,c.xRadius,c.yRadius,new Ze().subVectors(x,C).angle()+Math.PI,new Ze().subVectors(x,_).angle()+Math.PI,!i).getPoints(50),T=new xx;T.add(new wx(E.map(k=>new de(k.x,k.y,0))));const R=new Ld(d,{steps:50,bevelEnabled:!1,extrudePath:T});p.push(R)}const y=p.length?fX(p):new Ai;return y.userData.type="dashed",y}function xxe(t,e,n,r=1){const i=18*r,s=18*r,l=new J1(new de(t[0],t[1],0),new de(e[0],e[1],0)).getLength()/(i+s)*2,c=new de(t[0],t[1],0),u=new de(e[0],e[1],0),d=[],f=(A,p)=>(e[A]-t[A])/l*p+t[A];for(let A=0;A<l;A+=2){const p=new de(f(0,A),f(1,A),0);let m=new de(f(0,A+1),f(1,A+1),0);if(c.distanceTo(m)>c.distanceTo(u)&&(m=u),m){const g=new J1(p,m),y=new Ld(n,{steps:1,bevelEnabled:!1,extrudePath:g});d.push(y)}}const h=d.length?fX(d):new Ai;return h.userData.type="dashed",h}const _o={straight:new mxe,tangentialArcTo:new gxe,circle:new yxe};function jf(t,e){const n=structuredClone(t);let r=0;return Object.values(e).forEach(i=>{const s=Number(i[1][0]);s>r&&(r=s)}),n[1][0]=r,n}function mI(t,e){var s;const n=Vbe({types:["segment","path"],predicate:o=>e.codeBasedSelections.some(a=>{var l;return Array.isArray(a==null?void 0:a.range)&&Array.isArray((l=o==null?void 0:o.codeRef)==null?void 0:l.range)&&Vd(a.range,o.codeRef.range)})},t),r=[...n.values()][0],i=(r==null?void 0:r.type)==="segment"?r.pathId:!1;return i||((s=[...n].find(([,o])=>o.type==="path"))==null?void 0:s[0])||!1}const r9="ad792545-7fd3-482a-a602-a93924e3055b",Cxe="680fd157-266f-4b8a-984f-cdf46b8bdf01";async function _xe({data:t}){if(!(t!=null&&t.entity_id))return{type:"Set selection",data:{selectionType:"singleCodeCursor"}};if([r9,Cxe].includes(t.entity_id))return{type:"Set selection",data:{selectionType:"otherSelection",selection:r9===t.entity_id?"x-axis":"y-axis"}};let e=je.artifactGraph.get(t.entity_id);if(!e)return{type:"Set selection",data:{selectionType:"singleCodeCursor"}};if(e.type==="solid2D"){const n=Kq(e,je.artifactGraph);return ie(n)?null:{type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{range:n.range,type:"solid2D"}}}}if(e.type==="cap"){const n=n5(e,je.artifactGraph);return ie(n)?null:{type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{range:n.range,type:(e==null?void 0:e.subType)==="end"?"end-cap":"start-cap"}}}}if(e.type==="wall"){const n=r5(e,je.artifactGraph);return ie(n)?null:{type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{range:n.range,type:"extrude-wall"}}}}if(e.type==="segment"||e.type==="path")return{type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{range:e.codeRef.range,type:"default"}}};if(e.type==="sweepEdge"){const n=lI(e,je.artifactGraph);return ie(n)?null:(e==null?void 0:e.subType)==="adjacent"?{type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{range:n.range,type:"adjacent-edge"}}}:{type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{range:n.range,type:"edge"}}}}if(e.type==="edgeCut"){const n=Yr({key:e.consumedEdgeId,types:["segment","sweepEdge"]},je.artifactGraph);if(ie(n))return{type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{range:e.codeRef.range,type:"default"}}};if(n.type==="segment")return{type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{range:e.codeRef.range,type:"base-edgeCut",secondaryRange:n.codeRef.range}}};const r=Yr({key:n.segId,types:["segment"]},je.artifactGraph);return ie(r)?null:{type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{range:e.codeRef.range,type:n.subType==="adjacent"?"adjacent-edgeCut":"opposite-edgeCut",secondaryRange:r.codeRef.range}}}}return null}function Sxe(t){var l,c;const e=mi(t,x1),n=mi(t,[ig]);if(!e&&!n)return null;if((n==null?void 0:n.userData.type)===ig)return{type:"Set selection",data:{selectionType:"otherSelection",selection:((l=t==null?void 0:t.userData)==null?void 0:l.type)===rh?"x-axis":"y-axis"}};const r=(c=e==null?void 0:e.userData)==null?void 0:c.pathToNode;if(!r)return null;const i=Rr(Kt.code);if(ie(i))return null;const s=Xe(i,r,"CallExpression");if(ie(s))return null;const o=s.node;return{type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{range:[o.start,o.end],type:"default"}}}}function i9({selections:t}){const e=[],n=AX(wX(t.codeBasedSelections));return t.codeBasedSelections.forEach(({range:r,type:i})=>{r!=null&&r[1]&&e.push(qe.cursor(r[1]))}),e.length?{engineEvents:n,codeMirrorSelection:qe.create(e,t.codeBasedSelections.length-1),otherSelections:t.otherSelections,updateSceneObjectColors:()=>u5(t.codeBasedSelections)}:{codeMirrorSelection:qe.create([qe.cursor(Kt.code.length)],0),engineEvents:n,otherSelections:t.otherSelections,updateSceneObjectColors:()=>u5(t.codeBasedSelections)}}function Exe({codeMirrorRanges:t,selectionRanges:e,isShiftDown:n}){if(!(t.length!==e.codeBasedSelections.length||t.some(({from:o,to:a},l)=>o!==e.codeBasedSelections[l].range[0]||a!==e.codeBasedSelections[l].range[1])))return null;const i=t.map(({from:o,to:a})=>({type:"default",range:[o,a]})),s=wX(i);return e?(u5(i),{modelingEvent:{type:"Set selection",data:{selectionType:"mirrorCodeMirrorSelections",selection:{otherSelections:n?e.otherSelections:[],codeBasedSelections:i}}},engineEvents:AX(s)}):null}function u5(t){const e=be.ast;Object.values(sn.activeSegments).forEach(n=>{var a;if(!x1.includes(n==null?void 0:n.name))return;const r=Xe(e,n.userData.pathToNode,"CallExpression");if(ie(r))return;const i=r.node,s=t.some(l=>Vd(l.range,[i.start,i.end])),o=s?255:((a=n==null?void 0:n.userData)==null?void 0:a.baseColor)||16777215;n.traverse(l=>l instanceof xn&&l.material.color.set(o)),n.userData.isSelected=s})}function AX(t){var e;return(e=je.engineConnection)!=null&&e.isReady()?[{type:"modeling_cmd_req",cmd:{type:"select_clear"},cmd_id:Yt()},{type:"modeling_cmd_req",cmd:{type:"select_add",entities:t.map(({id:n})=>n)},cmd_id:Yt()}]:[]}function gI(t){return hI(t,be.ast)?mI(je.artifactGraph,t):!1}function Txe(t,e,n=0){return t.codeBasedSelections[n].range[1]===e.length}function Bxe(t){return t.codeBasedSelections.length===1&&t.codeBasedSelections[0].range[0]===0&&t.codeBasedSelections[0].range[1]===0}function pX(t,e){return{selection:t.codeBasedSelections[e],ast:be.ast}}function mX(t){return T_({calleeName:"extrude",...t})||T_({calleeName:"revolve",...t})}function gX(t){return T_({calleeName:"close",...t})}function yX(t){return T_({calleeName:"circle",...t})}function Mxe(t){const e=t.codeBasedSelections.map((n,r)=>pX(t,r));return!!gI(t)&&e.every(n=>!nX(n.selection,n.ast))&&(e.every(n=>gX(n))||e.every(n=>yX(n)))&&e.every(n=>!mX(n))}function kxe(t,e){const n={...t,codeBasedSelections:[t.codeBasedSelections[e]]},r=pX(t,e);return!!gI(n)&&(gX(r)||yX(r))&&!mX(r)}function vX(t){if(!t)return[];const e=t.codeBasedSelections.filter((n,r)=>{const i={...t,codeBasedSelections:[t.codeBasedSelections[r]]};return kxe(i,0)}).length;return e===t.codeBasedSelections.length?[["extrude-wall",e]]:[["other",t.codeBasedSelections.length]]}function bX(t){return vX(t).map(([n,r])=>`${r} ${n.replace("extrude-wall","face")}${r>1?"s":""}`).join(", ")}function Rxe(t,e){return t!=="none"&&t.every(([n,r])=>e.selectionTypes.findIndex(s=>s===n)!==-1&&(e.multiple||r<2)&&r>0)}function wX(t){return t.flatMap(e=>{const{type:n}=e,r=Array.from(je.artifactGraph).map(([s,o])=>"codeRef"in o&&Vd(o.codeRef.range,e.range)?{artifact:o,selection:e,id:s}:null).filter(S_);let i;return r.forEach(s=>{if(n==="default"&&s.artifact.type==="segment"){i=s;return}if(n==="solid2D"&&s.artifact.type==="path"){const o=je.artifactGraph.get(s.artifact.solid2dId||"");if((o==null?void 0:o.type)!=="solid2D")return;if(!s.artifact.solid2dId){console.error("Expected PathArtifact to have solid2dId, but none found");return}i={artifact:o,selection:e,id:s.artifact.solid2dId}}if(n==="extrude-wall"&&s.artifact.type==="segment"){const o=je.artifactGraph.get(s.artifact.surfaceId);if((o==null?void 0:o.type)!=="wall")return;i={artifact:o,selection:e,id:s.artifact.surfaceId};return}if(n==="edge"&&s.artifact.type==="segment"){const a=[...Hx({keys:s.artifact.edgeIds,types:["sweepEdge"]},je.artifactGraph)].find(([l,c])=>c.type==="sweepEdge");if(!a)return;i={artifact:a[1],selection:e,id:a[0]}}if(n==="adjacent-edge"&&s.artifact.type==="segment"){const a=[...Hx({keys:s.artifact.edgeIds,types:["sweepEdge"]},je.artifactGraph)].find(([l,c])=>c.type==="sweepEdge"&&c.subType==="adjacent");if(!a)return;i={artifact:a[1],selection:e,id:a[0]}}if((n==="end-cap"||n==="start-cap")&&s.artifact.type==="path"){const o=Yr({key:s.artifact.sweepId,types:["sweep"]},je.artifactGraph);if(ie(o))return;const l=[...Hx({keys:o.surfaceIds,types:["cap"]},je.artifactGraph)].find(([c,u])=>u.subType===(n==="end-cap"?"end":"start"));if(!l)return;i={artifact:s.artifact,selection:e,id:l[0]};return}if(s.artifact.type==="edgeCut"){const o=Yr({key:s.artifact.consumedEdgeId,types:["segment","sweepEdge"]},je.artifactGraph);if(ie(o))return;if(o.type==="segment"&&n==="base-edgeCut"&&Vd(o.codeRef.range,e.secondaryRange||[0,0]))i={artifact:s.artifact,selection:e,id:s.id};else if(o.type==="sweepEdge"&&(n==="adjacent-edgeCut"&&o.subType==="adjacent"||n==="opposite-edgeCut"&&o.subType==="opposite")){const a=Yr({key:o.segId,types:["segment"]},je.artifactGraph);if(ie(a))return;Vd(a.codeRef.range,e.secondaryRange||[0,0])&&(i={artifact:s.artifact,selection:e,id:s.id})}}}),i?[{type:n,id:i.id}]:null}).filter(S_)}async function Pxe(t,e){var s,o,a,l,c,u;const{x:n,y:r}=Dbe({clientX:t.clientX,clientY:t.clientY,el:e,streamWidth:e.clientWidth,streamHeight:e.clientHeight}),i=await je.sendSceneCommand({type:"modeling_cmd_req",cmd:{type:"select_with_point",selected_at_window:{x:n,y:r},selection_type:"add"},cmd_id:Yt()});return i!=null&&i.success&&((s=i==null?void 0:i.resp)==null?void 0:s.type)==="modeling"&&((a=(o=i==null?void 0:i.resp)==null?void 0:o.data)==null?void 0:a.modeling_response.type)==="select_with_point"?(u=(c=(l=i==null?void 0:i.resp)==null?void 0:l.data)==null?void 0:c.modeling_response)==null?void 0:u.data:{entity_id:""}}function Gi(t,e,n){if(ie(n))return n;const r=Object.entries(t).map(([i,s])=>{const o=Xe(n,s);if(ie(o))return;const a=o.node,l=e.codeBasedSelections[Number(i)];return(l==null?void 0:l.type)==="base-edgeCut"||(l==null?void 0:l.type)==="adjacent-edgeCut"||(l==null?void 0:l.type)==="opposite-edgeCut"?{range:[a.start,a.end],type:l==null?void 0:l.type,secondaryRange:l==null?void 0:l.secondaryRange}:{range:[a.start,a.end],type:l==null?void 0:l.type}}).filter(i=>i!==void 0);return{codeBasedSelections:r.length>0?r:e.codeBasedSelections,otherSelections:e.otherSelections}}const Lxe=(t,e)=>[lr("angledLine",[bn([tt(0),tt(0)]),cn(),rm(e[0])]),lr("angledLine",[bn([My([lr("segAng",[zn(e[0])]),"+",tt(90)]),tt(0)]),cn(),rm(e[1])]),lr("angledLine",[bn([lr("segAng",[zn(e[0])]),xl(lr("segLen",[zn(e[0])]),"-")]),cn(),rm(e[2])]),lr("lineTo",[bn([lr("profileStartX",[cn()]),lr("profileStartY",[cn()])]),cn()]),lr("close",[cn()])];function s9(t,e,n,r){t.body[2].arguments[0]=bn([tt(e>=0?0:180),tt(Math.abs(e))]),t.body[3].arguments[0]=bn([My([lr("segAng",[zn(r)]),Math.sign(n)===Math.sign(e)?"+":"-",tt(90)]),tt(Math.abs(n))])}const Il="extraSegmentHandle",xX=8,ta="profile-start",hd="straight-segment",o9="straight-segment-body",a9="straight-segment-body-dashed",l9="tangential-arc-to-segment-body-dashed",Ad="tangential-arc-to-segment",c9="tangential-arc-to-segment-body",pd="circle-segment",u9="circle-segment-body",d9="circle-segment-body-dashed",Ry="circle-center-handle",M_=1.6,yI=75,vI=60,Py=[hd,Ad,pd],x1=[...Py,ta];class Ixe{constructor(e){se(this,"engineCommandManager");se(this,"scene");se(this,"sceneProgramMemory",ao.empty());se(this,"activeSegments",{});se(this,"intersectionPlane",null);se(this,"axisGroup",null);se(this,"currentSketchQuaternion",null);se(this,"onWindowResize",()=>{this.onCamChange()});se(this,"onCamChange",()=>{const e=xc(Ke.camControls.camera),n=[];if(Object.values(this.activeSegments).forEach((r,i)=>{const s=(Ke.camControls.camera instanceof $r?e:Hf(Ke.camControls.camera,r))/Ke._baseUnitMultiplier;let o={type:"straight-segment",from:r.userData.from,to:r.userData.to},a=null;r.userData.from&&r.userData.to&&r.userData.type===hd&&(a=_o.straight.update),r.userData.from&&r.userData.to&&r.userData.prevSegment&&r.userData.type===Ad&&(a=_o.tangentialArcTo.update),r.userData.from&&r.userData.center&&r.userData.radius&&r.userData.type===pd&&(a=_o.circle.update,o={type:"arc-segment",from:r.userData.from,center:r.userData.center,radius:r.userData.radius});const l=a==null?void 0:a({prevSegment:r.userData.prevSegment,input:o,group:r,scale:s,sceneInfra:Ke});l&&!ie(l)&&n.push(l),r.name===ta&&r.scale.set(s,s,s)}),this.axisGroup){const r=Ke.camControls.camera instanceof $r?e:Hf(Ke.camControls.camera,this.axisGroup),i=this.axisGroup.getObjectByName(rh);i==null||i.scale.set(1,r/Ke._baseUnitMultiplier,1);const s=this.axisGroup.getObjectByName(sp);s==null||s.scale.set(r/Ke._baseUnitMultiplier,1,1)}Ke.overlayCallbacks(n)});se(this,"updateAstAndRejigSketch",async(e,n,r,i,s)=>{if(ie(n))return n;const o=await be.updateAst(n,!1);return await this.tearDownSketch({removeAxis:!1}),Ke.resetMouseListeners(),await this.setupSketch({sketchPathToNode:e,forward:r,up:i,position:s,maybeModdedAst:o.newAst}),this.setupSketchIdleCallbacks({forward:r,up:i,position:s,pathToNode:e}),o});se(this,"setUpDraftSegment",async(e,n,r,i,s="line",o=!0)=>{var w,v,x,C,_;const a=structuredClone(be.ast),l=Xe(a,e||[],"VariableDeclaration");if(pt(l))return Promise.reject(l);const c=((C=(x=(v=(w=l.node)==null?void 0:w.declarations)==null?void 0:v[0])==null?void 0:x.id)==null?void 0:C.name)||"",u=js(be.programMemory.get(c),c);if(ie(u))return Promise.reject(u);const d=((_=u==null?void 0:u.value)==null?void 0:_.slice(-1)[0])||u.start,f=u.value.length,h=DT({node:a,programMemory:be.programMemory,input:{type:"straight-segment",to:d.to,from:d.to},fnName:s,pathToNode:e});if(pt(h))return Promise.reject(h);const A=Rr(wr(h.modifiedAst));if(pt(A))return Promise.reject(A);const p={start:f,end:f};o&&await this.tearDownSketch({removeAxis:!1}),Ke.resetMouseListeners();const{truncatedAst:m,programMemoryOverride:g,sketch:y}=await this.setupSketch({sketchPathToNode:e,forward:n,up:r,position:i,maybeModdedAst:A,draftExpressionsIndices:p});Ke.setCallbacks({onClick:async S=>{if(!S||S.mouseEvent.which!==1)return;const{intersectionPoint:E}=S;let T=E==null?void 0:E.twoD;const R=S.intersects.map(({object:B})=>mi(B,[ta])).find(B=>(B==null?void 0:B.name)===ta);let k;if(R){const B=y.value.slice(-1)[0];if(k=$we({node:be.ast,programMemory:be.programMemory,pathToNode:e,expressions:[lr(B.type==="TangentialArcTo"?"tangentialArcTo":"lineTo",[bn([lr("profileStartX",[cn()]),lr("profileStartY",[cn()])]),cn()])]}),pt(k)||(k=qwe({node:k,programMemory:be.programMemory,pathToNode:e}),pt(k)))return Promise.reject(k)}else if(T){const B=y.value.slice(-1)[0],M=DT({node:be.ast,programMemory:be.programMemory,input:{type:"straight-segment",from:[B.to[0],B.to[1]],to:[T.x,T.y]},fnName:B.type==="TangentialArcTo"?"tangentialArcTo":"line",pathToNode:e});if(pt(M))return Promise.reject(M);if(k=M.modifiedAst,pt(k))return Promise.reject(k)}else return;await be.executeAstMock(k),R?Ke.modelingSend({type:"CancelSketch"}):await this.setUpDraftSegment(e,n,r,i,s)},onMove:S=>{this.onDragSegment({intersection2d:S.intersectionPoint.twoD,object:Object.values(this.activeSegments).slice(-1)[0],intersects:S.intersects,sketchPathToNode:e,draftInfo:{truncatedAst:m,programMemoryOverride:g,variableDeclarationName:c}})},...this.mouseEnterLeaveCallbacks()})});se(this,"setupDraftRectangle",async(e,n,r,i,s)=>{var p,m,g,y,w,v;let o=structuredClone(be.ast);const a=Xe(o,e||[],"VariableDeclaration");if(pt(a))return Promise.reject(a);const l=((y=(g=(m=(p=a.node)==null?void 0:p.declarations)==null?void 0:m[0])==null?void 0:g.id)==null?void 0:y.name)||"",c=(w=a.node)==null?void 0:w.declarations,u=(v=c==null?void 0:c[0])==null?void 0:v.init,d=[jo(o,"rectangleSegmentA"),jo(o,"rectangleSegmentB"),jo(o,"rectangleSegmentC")];c[0].init=Yl([u,...Lxe(s,d)]);let f=Rr(wr(o));if(pt(f))return Promise.reject(f);o=f;const{programMemoryOverride:h,truncatedAst:A}=await this.setupSketch({sketchPathToNode:e,forward:n,up:r,position:i,maybeModdedAst:o,draftExpressionsIndices:{start:0,end:3}});Ke.setCallbacks({onMove:async x=>{var I,z,Y;const C=structuredClone(e);C[1][0]=0;const _=Xe(A,C||[],"VariableDeclaration");if(pt(_))return Promise.reject(_);const S=(Y=(z=(I=_.node)==null?void 0:I.declarations)==null?void 0:z[0])==null?void 0:Y.init,E=(x.intersectionPoint.twoD.x||0)-s[0],T=(x.intersectionPoint.twoD.y||0)-s[1];S.type==="PipeExpression"&&s9(S,E,T,d[0]);const{execState:R}=await kl({ast:A,useFakeExecutor:!0,engineCommandManager:this.engineCommandManager,programMemoryOverride:h,idGenerator:be.execState.idGenerator}),k=R.memory;this.sceneProgramMemory=k;const B=js(k.get(l),l);if(ie(B))return Promise.reject(B);const M=B.value,F=xc(Ke.camControls.camera);this.updateSegment(B.start,0,0,o,F,B),M.forEach(($,ee)=>this.updateSegment($,ee,0,o,F,B))},onClick:async x=>{var R,k,B,M;const C=(R=x.intersectionPoint)==null?void 0:R.twoD;if(!C||x.mouseEvent.button!==0)return;const _=ot((C.x||0)-s[0]),S=ot((C.y||0)-s[1]),E=Xe(o,e||[],"VariableDeclaration");if(pt(E))return;const T=(M=(B=(k=E.node)==null?void 0:k.declarations)==null?void 0:B[0])==null?void 0:M.init;if(T.type==="PipeExpression"){s9(T,_,S,d[0]);let F=Rr(wr(o));if(pt(F))return;o=F,await be.executeAstMock(o),Ke.modelingSend({type:"Finish rectangle"});const{execState:I}=await kl({ast:o,useFakeExecutor:!0,engineCommandManager:this.engineCommandManager,programMemoryOverride:h,idGenerator:be.execState.idGenerator}),z=I.memory;this.sceneProgramMemory=z;const Y=js(z.get(l),l);if(ie(Y))return;const $=Y.value,ee=xc(Ke.camControls.camera);this.updateSegment(Y.start,0,0,o,ee,Y),$.forEach((W,ne)=>this.updateSegment(W,ne,0,o,ee,Y))}}})});se(this,"setupDraftCircle",async(e,n,r,i,s)=>{var A,p,m,g,y,w;let o=structuredClone(be.ast);const a=Xe(o,e||[],"VariableDeclaration");if(pt(a))return Promise.reject(a);const l=((g=(m=(p=(A=a.node)==null?void 0:A.declarations)==null?void 0:p[0])==null?void 0:m.id)==null?void 0:g.name)||"",c=(y=a.node)==null?void 0:y.declarations,u=(w=c==null?void 0:c[0])==null?void 0:w.init;c[0].init=Yl([u,lr("circle",[Po({center:bn([tt(ot(s[0])),tt(ot(s[1]))]),radius:tt(1)}),cn()])]);let d=Rr(wr(o));if(pt(d))return Promise.reject(d);o=d,await be.executeAstMock(o);const{programMemoryOverride:f,truncatedAst:h}=await this.setupSketch({sketchPathToNode:e,forward:n,up:r,position:i,maybeModdedAst:o,draftExpressionsIndices:{start:0,end:0}});Ke.setCallbacks({onMove:async v=>{var I,z,Y;const x=structuredClone(e);x[1][0]=0;const C=Xe(h,x||[],"VariableDeclaration");let _=structuredClone(h);if(pt(C))return;const S=(Y=(z=(I=C.node)==null?void 0:I.declarations)==null?void 0:z[0])==null?void 0:Y.init,E=(v.intersectionPoint.twoD.x||0)-s[0],T=(v.intersectionPoint.twoD.y||0)-s[1];if(S.type==="PipeExpression"){const $=NT(_,be.programMemory,{type:"path",pathToNode:[...C.deepPath,["body","PipeExpression"],[1,"index"]]},{type:"arc-segment",center:s,radius:Math.sqrt(E**2+T**2),from:s});if(ie($))return;_=$.modifiedAst}const{execState:R}=await kl({ast:_,useFakeExecutor:!0,engineCommandManager:this.engineCommandManager,programMemoryOverride:f,idGenerator:be.execState.idGenerator}),k=R.memory;this.sceneProgramMemory=k;const B=js(k.get(l),l);if(ie(B))return;const M=B.value,F=xc(Ke.camControls.camera);this.updateSegment(B.start,0,0,o,F,B),M.forEach(($,ee)=>this.updateSegment($,ee,0,o,F,B))},onClick:async v=>{var R,k,B,M;const x=(R=v.intersectionPoint)==null?void 0:R.twoD;if(!x||v.mouseEvent.button!==0)return;const C=ot((x.x||0)-s[0]),_=ot((x.y||0)-s[1]),S=Xe(o,e||[],"VariableDeclaration");if(pt(S))return;const E=(M=(B=(k=S.node)==null?void 0:k.declarations)==null?void 0:B[0])==null?void 0:M.init;let T=structuredClone(o);if(E.type==="PipeExpression"){const F=NT(T,be.programMemory,{type:"path",pathToNode:[...S.deepPath,["body","PipeExpression"],[1,"index"]]},{type:"arc-segment",center:s,radius:Math.sqrt(C**2+_**2),from:s});if(ie(F))return;T=F.modifiedAst;let I=Rr(wr(T));if(pt(I))return Promise.reject(I);o=I,await be.executeAstMock(o),Ke.modelingSend({type:"Finish circle"})}}})});se(this,"setupSketchIdleCallbacks",({pathToNode:e,up:n,forward:r,position:i})=>{let s="nothing";Ke.setCallbacks({onDragEnd:async()=>{s!=="nothing"&&(await this.tearDownSketch({removeAxis:!1}),this.setupSketch({sketchPathToNode:e,maybeModdedAst:be.ast,up:n,forward:r,position:i}),this.setupSketchIdleCallbacks({pathToNode:e,up:n,forward:r,position:i}))},onDrag:async({selected:o,intersectionPoint:a,mouseEvent:l,intersects:c})=>{var d;if(l.which!==1)return;const u=mi(o,[Il]);if((u==null?void 0:u.name)===Il){const f=mi(o),h=(d=f==null?void 0:f.userData)==null?void 0:d.pathToNode,A=h.findIndex(g=>g[1]==="PipeExpression"),p=d5({pathToNode:h,ast:be.ast,programMemory:be.programMemory});if(pt(p))return;if(!p){pt(new Error("sketch not found"));return}const m=h[A+1][0];if(s==="nothing"){const g=p.value[m-2],y=DT({node:be.ast,programMemory:be.programMemory,input:{type:"straight-segment",to:[a.twoD.x,a.twoD.y],from:g.from},fnName:"line",pathToNode:h,spliceBetween:!0});if(s="pending",pt(y))return;await be.executeAstMock(y.modifiedAst),await this.tearDownSketch({removeAxis:!1}),this.setupSketch({sketchPathToNode:h,maybeModdedAst:be.ast,up:n,forward:r,position:i}),s="added"}else if(s==="added"){const g=h.slice(0,A);g.push([m-2,"index"]),this.onDragSegment({sketchPathToNode:g,object:o,intersection2d:a.twoD,intersects:c})}return}this.onDragSegment({object:o,intersection2d:a.twoD,intersects:c,sketchPathToNode:e})},onMove:()=>{},onClick:o=>{if((o==null?void 0:o.mouseEvent.which)!==1)return;if(!o||!o.selected){Ke.modelingSend({type:"Set selection",data:{selectionType:"singleCodeCursor"}});return}const{selected:a}=o,l=Sxe(a);l&&Ke.modelingSend(l)},...this.mouseEnterLeaveCallbacks()})});se(this,"prepareTruncatedMemoryAndAst",(e,n,r)=>Oxe(e,n||be.ast,be.lastSuccessfulProgramMemory,r));se(this,"updateSegment",(e,n,r,i,s,o)=>{var g;const a=un(i,e.__geoMeta.sourceRange),l=o.value,c=JSON.stringify(a);a[1][0]=r;const u=JSON.stringify(a),d=this.activeSegments[u]||this.activeSegments[c],f=(g=d==null?void 0:d.userData)==null?void 0:g.type,h=(Ke.camControls.camera instanceof $r?s:Hf(Ke.camControls.camera,d))/Ke._baseUnitMultiplier;let A={type:"straight-segment",from:e.from,to:e.to},p=null;f===Ad?p=_o.tangentialArcTo.update:f===hd?p=_o.straight.update:f===pd&&"type"in e&&e.type==="Circle"&&(p=_o.circle.update,A={type:"arc-segment",from:e.from,center:e.center,radius:e.radius});const m=p&&!ie(p)&&p({input:A,group:d,scale:h,prevSegment:l[n-1],sceneInfra:Ke});return m&&!ie(m)?m:(f===ta&&(d.position.set(e.from[0],e.from[1],0),d.scale.set(h,h,h)),()=>null)});this.engineCommandManager=e,this.scene=Ke==null?void 0:Ke.scene,Ke==null||Ke.camControls.subscribeToCamChange(this.onCamChange),window.addEventListener("resize",this.onWindowResize)}createIntersectionPlane(){if(Ke.scene.getObjectByName(U0)){console.warn("createIntersectionPlane called when it already exists");return}const e=1e6,n=new tv(e,e),r=new ei({color:16711680,side:ja,transparent:!0,opacity:.5});this.intersectionPlane=new xn(n,r),this.intersectionPlane.userData={type:U0},this.intersectionPlane.name=U0,this.intersectionPlane.layers.set(cX),this.scene.add(this.intersectionPlane)}createSketchAxis(e,n,r,i){const s=xc(Ke.camControls.camera),o=85,a=5570560,l=1.6,c=new Wl(1e5,l,.01),u=new Wl(l,1e5,.01),d=new ei({color:o,depthTest:!1}),f=new ei({color:a,depthTest:!1}),h=new xn(c,d),A=new xn(u,f);h.renderOrder=-2,A.renderOrder=-1,h.userData={type:rh,baseColor:o,isSelected:!1},A.userData={type:sp,baseColor:a,isSelected:!1},h.name=rh,A.name=sp,this.axisGroup=new es;const p=oxe({size:100,divisions:10});p.position.z=-.01,p.renderOrder=-3,p.name="gridHelper";const m=dX(Ke.camControls.camera,Ke.camControls.target);p.scale.set(m,m,m);const g=Ke.camControls.camera instanceof $r?s:Hf(Ke.camControls.camera,this.axisGroup);h==null||h.scale.set(1,g/Ke._baseUnitMultiplier,1),A==null||A.scale.set(g/Ke._baseUnitMultiplier,1,1),this.axisGroup.add(h,A,p),this.currentSketchQuaternion&&this.axisGroup.setRotationFromQuaternion(this.currentSketchQuaternion),this.axisGroup.userData={type:ig},this.axisGroup.name=ig,this.axisGroup.layers.set(Cl),this.axisGroup.traverse(w=>{w.layers.set(Cl)});const y=w1(new de(...r),new de(...n));this.axisGroup.setRotationFromQuaternion(y),i&&this.axisGroup.position.set(...i),this.scene.add(this.axisGroup)}removeIntersectionPlane(){const e=this.scene.getObjectByName(U0);e&&this.scene.remove(e)}setupNoPointsListener({sketchDetails:e,afterClick:n}){this.createIntersectionPlane();const r=w1(new de(...e.yAxis),new de(...e.zAxis));this.intersectionPlane&&(this.intersectionPlane.setRotationFromQuaternion(r),this.intersectionPlane.position.copy(new de(...(e==null?void 0:e.origin)||[0,0,0]))),Ke.setCallbacks({onClick:async i=>{if(!i||i.mouseEvent.which!==1)return;const{intersectionPoint:s}=i;if(!(s!=null&&s.twoD)||!(e!=null&&e.sketchPathToNode))return;const o=gwe(be.ast,e.sketchPathToNode,[s.twoD.x,s.twoD.y]);if(pt(o))return;const{modifiedAst:a}=o;await be.updateAst(a,!1),this.removeIntersectionPlane(),n(i)}})}async setupSketch({sketchPathToNode:e,forward:n,up:r,position:i,maybeModdedAst:s,draftExpressionsIndices:o,selectionRanges:a}){var x,C;this.createIntersectionPlane();const l=this.prepareTruncatedMemoryAndAst(e||[],s);if(ie(l))return Promise.reject(l);const{truncatedAst:c,programMemoryOverride:u,variableDeclarationName:d}=l,{execState:f}=await kl({ast:c,useFakeExecutor:!0,engineCommandManager:this.engineCommandManager,programMemoryOverride:u,idGenerator:be.execState.idGenerator}),h=f.memory,A=d5({pathToNode:e,ast:s,programMemory:h});if(ie(A))return Promise.reject(A);if(!A)return Promise.reject("sketch not found");if(!sI(A==null?void 0:A.value))return{truncatedAst:c,programMemoryOverride:u,sketch:A,variableDeclarationName:d};this.sceneProgramMemory=h;const p=new es;i&&p.position.set(...i),p.userData={type:e9,pathToNode:e};const m=new xn;m.position.set(0,0,0);const g=xc(Ke.camControls.camera),y=(Ke.camControls.camera instanceof $r?g:Hf(Ke.camControls.camera,m))/Ke._baseUnitMultiplier,w=un(s,A.start.__geoMeta.sourceRange);if(((C=(x=A==null?void 0:A.value)==null?void 0:x[0])==null?void 0:C.type)!=="Circle"){const _=vxe({from:A.start.from,id:A.start.__geoMeta.id,pathToNode:w,scale:y,theme:Ke._theme});_.layers.set(Cl),_.traverse(S=>{S.layers.set(Cl)}),p.add(_),this.activeSegments[JSON.stringify(w)]=_}const v=[];return A.value.forEach((_,S)=>{var ee,W;let E=un(s,_.__geoMeta.sourceRange);if(o&&(A.value[S-1]||A.start)){const ne=A.value[S-1]||A.start,fe=un(s,ne.__geoMeta.sourceRange)[1][0];E=un(c,_.__geoMeta.sourceRange),E[1][0]=fe}const T=o&&S<=o.end&&S>=o.start,R=a==null?void 0:a.codeBasedSelections.some(ne=>Vd(ne.range,_.__geoMeta.sourceRange));let k;const B=Xe(s,E,"CallExpression");if(ie(B))return;const M=(W=(ee=B.node)==null?void 0:ee.callee)==null?void 0:W.name,F=_.type==="TangentialArcTo"?_o.tangentialArcTo.init:_.type==="Circle"?_o.circle.init:_o.straight.init,I=_.type==="Circle"?{type:"arc-segment",from:_.from,center:_.center,radius:_.radius}:{type:"straight-segment",from:_.from,to:_.to},z=F({prevSegment:A.value[S-1],callExpName:M,input:I,id:_.__geoMeta.id,pathToNode:E,isDraftSegment:T,scale:y,texture:Ke.extraSegmentTexture,theme:Ke._theme,isSelected:R,sceneInfra:Ke});if(ie(z))return;const{group:Y,updateOverlaysCallback:$}=z;k=Y,v.push($),k.layers.set(Cl),k.traverse(ne=>{ne.layers.set(Cl)}),p.add(k),this.activeSegments[JSON.stringify(E)]=k}),this.currentSketchQuaternion=w1(new de(...r),new de(...n)),p.setRotationFromQuaternion(this.currentSketchQuaternion),this.intersectionPlane&&this.intersectionPlane.setRotationFromQuaternion(this.currentSketchQuaternion),this.intersectionPlane&&i&&this.intersectionPlane.position.set(...i),this.scene.add(p),Ke.camControls.enableRotate=!1,Ke.overlayCallbacks(v),{truncatedAst:c,programMemoryOverride:u,sketch:A,variableDeclarationName:d}}onDragSegment({object:e,intersection2d:n,sketchPathToNode:r,draftInfo:i,intersects:s}){const o=i&&s.map(({object:_})=>mi(_,[ta])).find(_=>(_==null?void 0:_.name)===ta),a=o?new Ze(o.position.x,o.position.y):n,l=mi(e,x1),c=mi(e,[au,Ry]);if(!l)return;const u=structuredClone(l.userData.pathToNode),d=u[1][0];if(typeof d!="number"){console.error(`Expected varDecIndex to be a number, but found: ${typeof d} ${d}`);return}i&&(u[1][0]=0);const f=[l.userData.from[0],l.userData.from[1]],h=[a.x,a.y];let A=i?i.truncatedAst:{...be.ast};const p=Xe(A,u,"CallExpression");if(pt(p))return;const m=p.node;if(m.type!=="CallExpression")return;let g;const y=()=>l.name===pd&&(!c||(c==null?void 0:c.name)===au)?{type:"arc-segment",from:f,center:l.userData.center,radius:Math.sqrt((l.userData.center[0]-h[0])**2+(l.userData.center[1]-h[1])**2)}:l.name===pd&&(c==null?void 0:c.name)===Ry?{type:"arc-segment",from:f,center:h,radius:l.userData.radius}:{type:"straight-segment",from:f,to:h};if(l.name===ta?g=Kwe({node:A,pathToNode:u,input:{type:"straight-segment",to:h,from:f},previousProgramMemory:be.programMemory}):g=NT(A,be.programMemory,{type:"sourceRange",sourceRange:[m.start,m.end]},y()),pt(g))return;A=g.modifiedAst;const w=i||this.prepareTruncatedMemoryAndAst(u||[]);if(pt(w,{suppress:!0}))return;const{truncatedAst:v,programMemoryOverride:x,variableDeclarationName:C}=w;(async()=>{const _=wr(A);if(pt(_))return;i||Kt.updateCodeEditor(_);const{execState:S}=await kl({ast:v,useFakeExecutor:!0,engineCommandManager:this.engineCommandManager,programMemoryOverride:x,idGenerator:be.execState.idGenerator}),E=S.memory;this.sceneProgramMemory=E;const T=E.get(C);let R;const k=js(T,C);if(ie(k)?T.sketch&&(R=T.sketch):R=k,!R)return;const B=R.value,M=xc(Ke.camControls.camera);this.updateSegment(R.start,0,d,A,M,R);const F=B.map((I,z)=>this.updateSegment(I,z,d,A,M,R));Ke.overlayCallbacks(F)})().catch(Bt)}updateSegmentBaseColor(e){const n=ru(e);Object.values(this.activeSegments).forEach(r=>{r.userData.baseColor=n,r.traverse(i=>{i instanceof xn&&i.material instanceof ei&&i.material.color.set(n)})})}removeSketchGrid(){this.axisGroup&&this.scene.remove(this.axisGroup)}_tearDownSketch(e=0,n,r,{removeAxis:i=!0}){this.intersectionPlane&&this.scene.remove(this.intersectionPlane),this.axisGroup&&i&&this.scene.remove(this.axisGroup);const s=this.scene.children.find(({userData:a})=>(a==null?void 0:a.type)===e9);let o=!1;s?(s.traverse(a=>{a instanceof lX&&(a.element.remove(),a.remove())}),this.scene.remove(s),o=!0):e<30?setTimeout(()=>{this._tearDownSketch(e+1,n,r,{removeAxis:i})},100):n(!0),Ke.camControls.enableRotate=!0,this.activeSegments={},o&&n(!0)}async tearDownSketch({removeAxis:e=!0}={}){return new Promise((n,r)=>{this._tearDownSketch(0,n,r,{removeAxis:e})})}mouseEnterLeaveCallbacks(){return{onMouseEnter:({selected:e,dragSelected:n})=>{var i,s;if([rh,sp].includes((i=e==null?void 0:e.userData)==null?void 0:i.type)){const o=e,a=o.material;a.color.set(o.userData.baseColor),a.color.offsetHSL(0,0,.5)}const r=mi(e,x1);if((s=r==null?void 0:r.userData)!=null&&s.pathToNode){const o=Rr(wr(be.ast));if(pt(o))return;const a=Xe(o,r.userData.pathToNode,"CallExpression");if(pt(a,{suppress:!0}))return;const l=a.node;Ot.setHighlightRange([[l.start,l.end]]),f9(e,16776960);const u=r.getObjectByName(Il);u&&u.traverse(p=>{(p instanceof FC||p instanceof xn)&&(p.material.opacity=n?0:1)});const d=xc(Ke.camControls.camera);let f={type:"straight-segment",from:r.userData.from,to:r.userData.to};const h=(Ke.camControls.camera instanceof $r?d:Hf(Ke.camControls.camera,r))/Ke._baseUnitMultiplier;let A=null;r.name===hd?A=_o.straight.update:r.name===Ad&&(A=_o.tangentialArcTo.update,f={type:"arc-segment",from:r.userData.from,radius:r.userData.radius,center:r.userData.center}),A&&A({prevSegment:r.userData.prevSegment,input:f,group:r,scale:h,sceneInfra:Ke});return}Ot.setHighlightRange([[0,0]])},onMouseLeave:({selected:e,...n})=>{var o,a,l;Ot.setHighlightRange([[0,0]]);const r=mi(e,x1);if(r){const c=xc(Ke.camControls.camera);let u={type:"straight-segment",from:r.userData.from,to:r.userData.to};const d=(Ke.camControls.camera instanceof $r?c:Hf(Ke.camControls.camera,r))/Ke._baseUnitMultiplier;let f=null;r.name===hd?f=_o.straight.update:r.name===Ad&&(f=_o.tangentialArcTo.update,u={type:"arc-segment",from:r.userData.from,radius:r.userData.radius,center:r.userData.center}),f&&f({prevSegment:r.userData.prevSegment,input:u,group:r,scale:d,sceneInfra:Ke})}const i=(o=r==null?void 0:r.userData)==null?void 0:o.isSelected;f9(e,i?255:((a=r==null?void 0:r.userData)==null?void 0:a.baseColor)||ru(Ke._theme));const s=r==null?void 0:r.getObjectByName(Il);if(s&&s.traverse(c=>{(c instanceof FC||c instanceof xn)&&(c.material.opacity=0)}),[rh,sp].includes((l=e==null?void 0:e.userData)==null?void 0:l.type)){const c=e,u=c.material;u.color.set(c.userData.baseColor),c.userData.isSelected&&u.color.offsetHSL(0,0,.2)}}}}resetOverlays(){Ke.modelingSend({type:"Set Segment Overlays",data:{type:"clear"}})}}function Oxe(t,e,n,r){var h,A,p,m,g;const i=Number((h=t==null?void 0:t[1])==null?void 0:h[0])||0,s=structuredClone(e),o=Xe(s,t||[],"VariableDeclaration");if(ie(o))return o;const a=((g=(m=(p=(A=o.node)==null?void 0:A.declarations)==null?void 0:p[0])==null?void 0:m.id)==null?void 0:g.name)||"",l=js(n.get(a),a);if(ie(l))return l;const c=l==null?void 0:l.value.slice(-1)[0];if(r){let y;r==="line"?y=lr("line",[bn([tt(0),tt(0)]),cn()]):y=lr("tangentialArcTo",[bn([tt(c.to[0]),tt(c.to[1])]),cn()]),s.body[i].declarations[0].init.body.push(y);const w=Rr(wr(s));if(ie(w))return w;const v=w.body[i].declarations[0].init.body.slice(-1)[0];s.body[i].declarations[0].init.body.slice(-1)[0].start=v.start,s.end=v.end;const x=s.body[i];x.end=v.end;const C=x.declarations[0];C.end=v.end;const _=C.init;_.end=v.end,_.body.slice(-1)[0].end=v.end}const u={...s,body:[structuredClone(s.body[i])]};let d=o.node.start;const f=n.filterVariables(!0,y=>!("__meta"in y)||y.__meta===void 0||y.__meta.length===0||y.__meta[0].sourceRange===void 0||y.__meta[0].sourceRange[0]>=d?!1:y.type==="TagIdentifier");if(ie(f))return f;for(let y=0;y<i;y++){const w=s.body[y];if(w.type!=="VariableDeclaration")continue;const v=w.declarations[0].id.name,x=n.get(v);if(!x)continue;const C=f.set(v,structuredClone(x));if(ie(C))return C}return{truncatedAst:u,programMemoryOverride:f,variableDeclarationName:a}}function mi(t,e=Py){var n;return e.includes((n=t==null?void 0:t.userData)==null?void 0:n.type)?t:t!=null&&t.parent?mi(t.parent,e):null}function d5({pathToNode:t,ast:e,programMemory:n}){var a,l;const r=Xe(be.ast,t,"VariableDeclarator");if(ie(r))return r;const i=r.node,s=n.get(((a=i==null?void 0:i.id)==null?void 0:a.name)||"");if((s==null?void 0:s.type)==="Solid")return s.sketch;const o=js(s,(l=i==null?void 0:i.id)==null?void 0:l.name);return ie(o)?null:o}function f9(t,e){const n=mi(t,[au,ta]);if(n){n.traverse(i=>{i instanceof xn&&i.material.color.set(e)});return}const r=mi(t,Py);if(r){r.traverse(i=>{i instanceof xn&&!i.userData.ignoreColorChange&&i.material.color.set(e)});return}}async function Fxe(t){const e=d5({pathToNode:t,ast:be.ast,programMemory:be.programMemory});if(ie(e))return Promise.reject(e);if(!e)return Promise.reject("sketch not found");if(e.on.type==="plane"){const n=e==null?void 0:e.on.zAxis;return{quat:Nxe(Dxe(n)),sketchDetails:{sketchPathToNode:t,zAxis:[n.x,n.y,n.z],yAxis:[e.on.yAxis.x,e.on.yAxis.y,e.on.yAxis.z],origin:[0,0,0],faceId:e.on.id}}}if(e.on.type==="face"){const n=await bI(e.on.id);if(!(n!=null&&n.origin)||!(n!=null&&n.z_axis)||!(n!=null&&n.y_axis))return Promise.reject("face info");const{z_axis:r,y_axis:i,origin:s}=n;return{quat:w1(new de(i.x,i.y,i.z),new de(r.x,r.y,r.z)),sketchDetails:{sketchPathToNode:t,zAxis:[r.x,r.y,r.z],yAxis:[i.x,i.y,i.z],origin:[s.x,s.y,s.z],faceId:e.on.id}}}return Promise.reject("sketch.on.type not recognized, has a new type been added?")}async function bI(t){var r,i,s,o,a;await je.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"enable_sketch_mode",adjust_camera:!1,animated:!1,ortho:!1,entity_id:t}});const e=await je.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"get_sketch_mode_plane"}}),n=e!=null&&e.success&&(e==null?void 0:e.resp.type)==="modeling"&&((s=(i=(r=e==null?void 0:e.resp)==null?void 0:r.data)==null?void 0:i.modeling_response)==null?void 0:s.type)==="get_sketch_mode_plane"?(a=(o=e==null?void 0:e.resp)==null?void 0:o.data)==null?void 0:a.modeling_response.data:{};return await je.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"sketch_mode_disable"}}),n}function Nxe(t){const e=new Fn;e.up.set(0,0,1),e.position.copy(t),e.lookAt(0,0,0),e.updateMatrix();const n=e.quaternion.clone(),r=l5(n);return r&&t.z<0?n.set(0,1,0,0):r&&n.set(0,0,0,1),n}function Dxe(t){return sI(t)?new de(t[0],t[1],t[2]):new de(t.x,t.y,t.z)}const Uxe=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=xI(t.state,n.from);return r.line?Hxe(t):r.block?Qxe(t):!1};function wI(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const Hxe=wI(Gxe,0),jxe=wI(CX,0),Qxe=wI((t,e)=>CX(t,e,Vxe(e)),0);function xI(t,e){let n=t.languageDataAt("commentTokens",e);return n.length?n[0]:{}}const a0=50;function zxe(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-a0,r),o=t.sliceDoc(i,i+a0),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let u,d;i-r<=2*a0?u=d=t.sliceDoc(r,i):(u=t.sliceDoc(r,r+a0),d=t.sliceDoc(i-a0,i));let f=/^\s*/.exec(u)[0].length,h=/\s*$/.exec(d)[0].length,A=d.length-h-n.length;return u.slice(f,f+e.length)==e&&d.slice(A,A+n.length)==n?{open:{pos:r+f+e.length,margin:/\s/.test(u.charAt(f+e.length))?1:0},close:{pos:i-h-n.length,margin:/\s/.test(d.charAt(A-1))?1:0}}:null}function Vxe(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to),s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function CX(t,e,n=e.selection.ranges){let r=n.map(s=>xI(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>zxe(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=r[o],{open:c,close:u}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:s}}return null}function Gxe(t,e,n=e.selection.ranges){let r=[],i=-1;for(let{from:s,to:o}of n){let a=r.length,l=1e9,c=xI(e,s).line;if(c){for(let u=s;u<=o;){let d=e.doc.lineAt(u);if(d.from>i&&(s==o||o>d.from)){i=d.from;let f=/^\s*/.exec(d.text)[0].length,h=f==d.length,A=d.text.slice(f,f+c.length)==c?f:-1;f<d.text.length&&f<l&&(l=f),r.push({line:d,comment:A,token:c,indent:f,empty:h,single:!1})}u=d.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}}if(t!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:u,single:d}of r)(d||!u)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const f5=ls.define(),Wxe=ls.define(),Kxe=bt.define(),_X=bt.define({combine(t){return il(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),SX=Mr.define({create(){return Ol.empty},update(t,e){let n=e.state.facet(_X),r=e.annotation(f5);if(r){let l=lo.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=R_(u,u.length,n.minDepth,l):u=TX(u,e.startState.selection),new Ol(c==0?r.rest:u,c==0?u:r.rest)}let i=e.annotation(Wxe);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Bn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=lo.fromTransaction(e),o=e.annotation(Bn.time),a=e.annotation(Bn.userEvent);return s?t=t.addChanges(s,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Ol(t.done.map(lo.fromJSON),t.undone.map(lo.fromJSON))}});function h9(t={}){return[SX,_X.of(t),At.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?CI:e.inputType=="historyRedo"?k_:null;return r?(e.preventDefault(),r(n)):!1}})]}function p2(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(SX,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const CI=p2(0,!1),k_=p2(1,!1),$xe=p2(0,!0),qxe=p2(1,!0);class lo{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new lo(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new lo(e.changes&&gi.fromJSON(e.changes),[],e.mapped&&Ql.fromJSON(e.mapped),e.startSelection&&qe.fromJSON(e.startSelection),e.selectionsAfter.map(qe.fromJSON))}static fromTransaction(e,n){let r=da;for(let i of e.startState.facet(Kxe)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new lo(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,da)}static selection(e){return new lo(void 0,da,void 0,void 0,e)}}function R_(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function Xxe(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function Yxe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function EX(t,e){return t.length?e.length?t.concat(e):t:e}const da=[],Jxe=200;function TX(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Jxe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),R_(t,t.length-1,1e9,n.setSelAfter(r)))}else return[lo.selection([e])]}function Zxe(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function zT(t,e){if(!t.length)return t;let n=t.length,r=da;for(;n;){let i=eCe(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[lo.selection(r)]:da}function eCe(t,e,n){let r=EX(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):da,n);if(!t.changes)return lo.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new lo(i,Qt.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const tCe=/^(input\.type|delete)($|\.)/;class Ol{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new Ol(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||tCe.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,Xxe(a.changes,e.changes))||r=="input.type.compose")?o=R_(o,o.length-1,i.minDepth,new lo(e.changes.compose(a.changes),EX(e.effects,a.effects),a.mapped,a.startSelection,da)):o=R_(o,o.length,i.minDepth,e),new Ol(o,da,n,r)}addSelection(e,n,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:da;return s.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Yxe(s[s.length-1],e)?this:new Ol(TX(this.done,e),this.undone,n,r)}addMapping(e){return new Ol(zT(this.done,e),zT(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],o=s.selectionsAfter[0]||n.selection;if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:f5.of({side:e,rest:Zxe(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?da:i.slice(0,i.length-1);return s.mapped&&(a=zT(a,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:f5.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Ol.empty=new Ol(da,da);const nCe=[{key:"Mod-z",run:CI,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:k_,preventDefault:!0},{linux:"Ctrl-Shift-z",run:k_,preventDefault:!0},{key:"Mod-u",run:$xe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:qxe,preventDefault:!0}];function kg(t,e){return qe.create(t.ranges.map(e),t.mainIndex)}function cc(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ol({state:t,dispatch:e},n){let r=kg(t.selection,n);return r.eq(t.selection,!0)?!1:(e(cc(t,r)),!0)}function m2(t,e){return qe.cursor(e?t.to:t.from)}function BX(t,e){return ol(t,n=>n.empty?t.moveByChar(n,e):m2(n,e))}function ks(t){return t.textDirectionAt(t.state.selection.main.head)==gr.LTR}const MX=t=>BX(t,!ks(t)),kX=t=>BX(t,ks(t));function RX(t,e){return ol(t,n=>n.empty?t.moveByGroup(n,e):m2(n,e))}const rCe=t=>RX(t,!ks(t)),iCe=t=>RX(t,ks(t));function sCe(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function g2(t,e,n){let r=as(t).resolveInner(e.head),i=n?fn.closedBy:fn.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;sCe(t,c,i)?r=c:l=n?c.to:c.from}let s=r.type.prop(i),o,a;return s&&(o=n?Pl(t,r.from,1):Pl(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,qe.cursor(a,n?-1:1)}const oCe=t=>ol(t,e=>g2(t.state,e,!ks(t))),aCe=t=>ol(t,e=>g2(t.state,e,ks(t)));function PX(t,e){return ol(t,n=>{if(!n.empty)return m2(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const LX=t=>PX(t,!1),IX=t=>PX(t,!0);function OX(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let s of t.state.facet(At.scrollMargins)){let o=s(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}i=t.scrollDOM.clientHeight-n-r}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function FX(t,e){let n=OX(t),{state:r}=t,i=kg(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):m2(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(s=At.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(cc(r,i),{effects:s}),!0}const A9=t=>FX(t,!1),h5=t=>FX(t,!0);function Ef(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=qe.cursor(r.from+s))}return i}const lCe=t=>ol(t,e=>Ef(t,e,!0)),cCe=t=>ol(t,e=>Ef(t,e,!1)),uCe=t=>ol(t,e=>Ef(t,e,!ks(t))),dCe=t=>ol(t,e=>Ef(t,e,ks(t))),fCe=t=>ol(t,e=>qe.cursor(t.lineBlockAt(e.head).from,1)),hCe=t=>ol(t,e=>qe.cursor(t.lineBlockAt(e.head).to,-1));function ACe(t,e,n){let r=!1,i=kg(t.selection,s=>{let o=Pl(t,s.head,-1)||Pl(t,s.head,1)||s.head>0&&Pl(t,s.head-1,1)||s.head<t.doc.length&&Pl(t,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return qe.cursor(a)});return r?(e(cc(t,i)),!0):!1}const pCe=({state:t,dispatch:e})=>ACe(t,e);function Ba(t,e){let n=kg(t.state.selection,r=>{let i=e(r);return qe.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(cc(t.state,n)),!0)}function NX(t,e){return Ba(t,n=>t.moveByChar(n,e))}const DX=t=>NX(t,!ks(t)),UX=t=>NX(t,ks(t));function HX(t,e){return Ba(t,n=>t.moveByGroup(n,e))}const mCe=t=>HX(t,!ks(t)),gCe=t=>HX(t,ks(t)),yCe=t=>Ba(t,e=>g2(t.state,e,!ks(t))),vCe=t=>Ba(t,e=>g2(t.state,e,ks(t)));function jX(t,e){return Ba(t,n=>t.moveVertically(n,e))}const QX=t=>jX(t,!1),zX=t=>jX(t,!0);function VX(t,e){return Ba(t,n=>t.moveVertically(n,e,OX(t).height))}const p9=t=>VX(t,!1),m9=t=>VX(t,!0),bCe=t=>Ba(t,e=>Ef(t,e,!0)),wCe=t=>Ba(t,e=>Ef(t,e,!1)),xCe=t=>Ba(t,e=>Ef(t,e,!ks(t))),CCe=t=>Ba(t,e=>Ef(t,e,ks(t))),_Ce=t=>Ba(t,e=>qe.cursor(t.lineBlockAt(e.head).from)),SCe=t=>Ba(t,e=>qe.cursor(t.lineBlockAt(e.head).to)),g9=({state:t,dispatch:e})=>(e(cc(t,{anchor:0})),!0),y9=({state:t,dispatch:e})=>(e(cc(t,{anchor:t.doc.length})),!0),v9=({state:t,dispatch:e})=>(e(cc(t,{anchor:t.selection.main.anchor,head:0})),!0),b9=({state:t,dispatch:e})=>(e(cc(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),ECe=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),TCe=({state:t,dispatch:e})=>{let n=y2(t).map(({from:r,to:i})=>qe.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:qe.create(n),userEvent:"select"})),!0},BCe=({state:t,dispatch:e})=>{let n=kg(t.selection,r=>{var i;let s=as(t).resolveStack(r.from,1);for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&(!((i=a.parent)===null||i===void 0)&&i.parent))return qe.range(a.to,a.from)}return r});return e(cc(t,n)),!0},MCe=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=qe.create([n.main]):n.main.empty||(r=qe.create([qe.cursor(n.main.head)])),r?(e(cc(t,r)),!0):!1};function mv(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(n="delete.backward",l=aw(t,l,!1)):l>o&&(n="delete.forward",l=aw(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=aw(t,o,!1),a=aw(t,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:qe.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?At.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function aw(t,e,n){if(t instanceof At)for(let r of t.state.facet(At.atomicRanges).map(i=>i(t)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=n?s:i)});return e}const GX=(t,e,n)=>mv(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),a,l;if(n&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if(a[a.length-1]=="	")return i-1;let c=Eg(a,s.tabSize),u=c%JC(s)||JC(s);for(let d=0;d<u&&a[a.length-1-d]==" ";d++)i--;l=i}else l=ts(o.text,i-o.from,e,e)+o.from,l==i&&o.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,i-o.from))&&(l=ts(o.text,l-o.from,!1,!1)+o.from);return l}),A5=t=>GX(t,!1,!0),WX=t=>GX(t,!0,!1),KX=(t,e)=>mv(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=ts(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),$X=t=>KX(t,!1),kCe=t=>KX(t,!0),RCe=t=>mv(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),PCe=t=>mv(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),LCe=t=>mv(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),ICe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Mn.of(["",""])},range:qe.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},OCe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:ts(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:ts(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:t.doc.slice(i,a).append(t.doc.slice(o,i))},range:qe.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function y2(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function qX(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of y2(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),a=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let l of s.ranges)i.push(qe.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let l of s.ranges)i.push(qe.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:qe.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const FCe=({state:t,dispatch:e})=>qX(t,e,!1),NCe=({state:t,dispatch:e})=>qX(t,e,!0);function XX(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of y2(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const DCe=({state:t,dispatch:e})=>XX(t,e,!1),UCe=({state:t,dispatch:e})=>XX(t,e,!0),HCe=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(y2(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=kg(e.selection,i=>{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),a=t.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function jCe(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=as(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(fn.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const QCe=YX(!1),zCe=YX(!0);function YX(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!t&&s==o&&jCe(e,s);t&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new VS(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=IL(c,s);for(u==null&&(u=Eg(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let d=["",fy(e,u)];return l&&d.push(fy(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Mn.of(d)},range:qe.cursor(s+1+d[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function _I(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,i,r),n=a.number),o=a.to+1}let s=t.changes(i);return{changes:i,range:qe.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const VCe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new VS(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=_I(t,(s,o,a)=>{let l=IL(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=fy(t,l);(c!=u||a.from<s.from+c.length)&&(n[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},JX=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(_I(t,(n,r)=>{r.push({from:n.from,insert:t.facet(av)})}),{userEvent:"input.indent"})),!0),ZX=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(_I(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=Eg(i,t.tabSize),o=0,a=fy(t,Math.max(0,s-JC(t)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),GCe=t=>(t.setTabFocusMode(),!0),WCe=[{key:"Ctrl-b",run:MX,shift:DX,preventDefault:!0},{key:"Ctrl-f",run:kX,shift:UX},{key:"Ctrl-p",run:LX,shift:QX},{key:"Ctrl-n",run:IX,shift:zX},{key:"Ctrl-a",run:fCe,shift:_Ce},{key:"Ctrl-e",run:hCe,shift:SCe},{key:"Ctrl-d",run:WX},{key:"Ctrl-h",run:A5},{key:"Ctrl-k",run:RCe},{key:"Ctrl-Alt-h",run:$X},{key:"Ctrl-o",run:ICe},{key:"Ctrl-t",run:OCe},{key:"Ctrl-v",run:h5}],KCe=[{key:"ArrowLeft",run:MX,shift:DX,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:rCe,shift:mCe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:uCe,shift:xCe,preventDefault:!0},{key:"ArrowRight",run:kX,shift:UX,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:iCe,shift:gCe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:dCe,shift:CCe,preventDefault:!0},{key:"ArrowUp",run:LX,shift:QX,preventDefault:!0},{mac:"Cmd-ArrowUp",run:g9,shift:v9},{mac:"Ctrl-ArrowUp",run:A9,shift:p9},{key:"ArrowDown",run:IX,shift:zX,preventDefault:!0},{mac:"Cmd-ArrowDown",run:y9,shift:b9},{mac:"Ctrl-ArrowDown",run:h5,shift:m9},{key:"PageUp",run:A9,shift:p9},{key:"PageDown",run:h5,shift:m9},{key:"Home",run:cCe,shift:wCe,preventDefault:!0},{key:"Mod-Home",run:g9,shift:v9},{key:"End",run:lCe,shift:bCe,preventDefault:!0},{key:"Mod-End",run:y9,shift:b9},{key:"Enter",run:QCe},{key:"Mod-a",run:ECe},{key:"Backspace",run:A5,shift:A5},{key:"Delete",run:WX},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$X},{key:"Mod-Delete",mac:"Alt-Delete",run:kCe},{mac:"Mod-Backspace",run:PCe},{mac:"Mod-Delete",run:LCe}].concat(WCe.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),$Ce=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:oCe,shift:yCe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:aCe,shift:vCe},{key:"Alt-ArrowUp",run:FCe},{key:"Shift-Alt-ArrowUp",run:DCe},{key:"Alt-ArrowDown",run:NCe},{key:"Shift-Alt-ArrowDown",run:UCe},{key:"Escape",run:MCe},{key:"Mod-Enter",run:zCe},{key:"Alt-l",mac:"Ctrl-l",run:TCe},{key:"Mod-i",run:BCe,preventDefault:!0},{key:"Mod-[",run:ZX},{key:"Mod-]",run:JX},{key:"Mod-Alt-\\",run:VCe},{key:"Shift-Mod-k",run:HCe},{key:"Shift-Mod-\\",run:pCe},{key:"Mod-/",run:Uxe},{key:"Alt-A",run:jxe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:GCe}].concat(KCe),qCe={key:"Tab",run:JX,shift:ZX},eY=Qt.define(),XCe=ls.define(),tY=XCe.of(null),YCe=Mr.define({create(){return Ct.none},update(t,e){if(t=t.map(e.changes),e.annotation(tY.type)===void 0)return t;const r=[];for(let i of e.effects)if(i.is(eY)){t=Ct.none;for(let s=0;s<i.value.length;s++){const o=i.value[s],[a,l]=o||[0,0];a&&l&&!(a===l&&a===0)&&(s===0?(t=t.update({add:[w9.range(a,l)]}),r.push(w9.range(a,l))):(t=t.update({add:[x9.range(a,l)]}),r.push(x9.range(a,l))))}}return t},provide:t=>At.decorations.from(t)}),w9=Ct.mark({class:"bg-yellow-300/70",attributes:{"data-testid":"hover-highlight"}}),x9=Ct.mark({class:"bg-yellow-200/40",attributes:{"data-testid":"hover-highlight"}}),JCe=ls.define(),H0=JCe.of(!0),ZCe=ls.define(),e_e=ZCe.of(!0),t_e=ls.define(),n_e=t_e.of(!0);function C9(t,e){return t.from===e.from&&t.to===e.to&&t.message===e.message}class r_e{constructor(){se(this,"_editorView",null);se(this,"_copilotEnabled",!0);se(this,"_isShiftDown",!1);se(this,"_selectionRanges",{otherSelections:[],codeBasedSelections:[]});se(this,"_lastEvent",null);se(this,"_modelingSend",()=>{});se(this,"_modelingState",null);se(this,"_commandBarSend",()=>{});se(this,"_convertToVariableEnabled",!1);se(this,"_convertToVariableCallback",()=>{});se(this,"_highlightRange",[[0,0]])}setCopilotEnabled(e){this._copilotEnabled=e}get copilotEnabled(){return this._copilotEnabled}setEditorView(e){this._editorView=e}get editorView(){return this._editorView}get isShiftDown(){return this._isShiftDown}setIsShiftDown(e){this._isShiftDown=e}set selectionRanges(e){this._selectionRanges=e}set modelingSend(e){this._modelingSend=e}set modelingState(e){this._modelingState=e}setCommandBarSend(e){this._commandBarSend=e}commandBarSend(e){return this._commandBarSend(e)}get highlightRange(){return this._highlightRange}setHighlightRange(e){this._highlightRange=e;const n=e.map(r=>{var s;const i=Math.min(r[1],((s=this._editorView)==null?void 0:s.state.doc.length)||r[1]);return[r[0],i]});this._editorView&&this._editorView.dispatch({effects:eY.of(n),annotations:[H0,tY,Bn.addToHistory.of(!1)]})}setDiagnostics(e){if(this._editorView){for(const n of e)for(const r of e)if(C9(n,r)){e=e.filter(i=>!C9(i,n)),e.push(n);break}this._editorView.dispatch({effects:[dv.of(e)],annotations:[n_e,H0,Bn.addToHistory.of(!1)]})}}scrollToFirstErrorDiagnosticIfExists(){if(!this._editorView)return;let e=null;n1e(this._editorView.state,(n,r,i)=>{!e&&n.severity==="error"&&(e=[r,i])}),e&&(this._editorView.focus(),this._editorView.dispatch({selection:qe.create([qe.cursor(e[0])]),effects:[At.scrollIntoView(qe.range(e[0],e[1]))],annotations:[H0,Bn.addToHistory.of(!1)]}))}undo(){this._editorView&&CI(this._editorView)}redo(){this._editorView&&k_(this._editorView)}set convertToVariableEnabled(e){this._convertToVariableEnabled=e}set convertToVariableCallback(e){this._convertToVariableCallback=e}convertToVariable(){return this._convertToVariableEnabled?(this._convertToVariableCallback(),!0):!1}selectRange(e){if(e.codeBasedSelections.length===0)return;let n=[];for(const r of e.codeBasedSelections)n.push(qe.range(r.range[0],r.range[1]));n.push(qe.cursor(e.codeBasedSelections[e.codeBasedSelections.length-1].range[1])),this._editorView&&this._editorView.dispatch({selection:qe.create(n,1),annotations:[H0,Bn.addToHistory.of(!1)]})}handleOnViewUpdate(e){var o,a;if(this._editorView||this.setEditorView(e.view),(((a=(o=e==null?void 0:e.state)==null?void 0:o.selection)==null?void 0:a.ranges)||[]).length===0||!this._modelingState||this._modelingState.matches({Sketch:"Change Tool"}))return;const r=Exe({codeMirrorRanges:e.state.selection.ranges,selectionRanges:this._selectionRanges,isShiftDown:this._isShiftDown});if(!r)return;const i={...r,engineEvents:r.engineEvents.map(l=>({...l,cmd_id:"static"}))},s=JSON.stringify(i);this._lastEvent&&s===this._lastEvent.event&&Date.now()-this._lastEvent.time<500||(this._lastEvent={event:s,time:Date.now()},this._modelingSend(r.modelingEvent),r.engineEvents.forEach(l=>{je.sendSceneCommand(l)}))}}class i_e{constructor(e){se(this,"_ast",{body:[],start:0,end:0,nonCodeMeta:{nonCodeNodes:{},start:[]}});se(this,"_execState",Z4());se(this,"_programMemory",ao.empty());se(this,"lastSuccessfulProgramMemory",ao.empty());se(this,"_logs",[]);se(this,"_lints",[]);se(this,"_kclErrors",[]);se(this,"_isExecuting",!1);se(this,"_executeIsStale",null);se(this,"_wasmInitFailed",!0);se(this,"engineCommandManager");se(this,"_isExecutingCallback",()=>{});se(this,"_astCallBack",()=>{});se(this,"_programMemoryCallBack",()=>{});se(this,"_logsCallBack",()=>{});se(this,"_kclErrorsCallBack",()=>{});se(this,"_wasmInitFailedCallback",()=>{});se(this,"_executeCallback",()=>{});se(this,"_cancelTokens",new Map);this.engineCommandManager=e,this.ensureWasmInit().then(()=>{this.ast=this.safeParse(Kt.code)||this.ast})}get ast(){return this._ast}set ast(e){this._ast=e,this._astCallBack(e)}get programMemory(){return this._programMemory}set programMemory(e){this._programMemory=e,this._programMemoryCallBack(e)}set execState(e){this._execState=e,this.programMemory=e.memory}get execState(){return this._execState}get logs(){return this._logs}set logs(e){this._logs=e,this._logsCallBack(e)}get lints(){return this._lints}set lints(e){e!==this._lints&&(this._lints=e,this.kclErrors=this._kclErrors)}get kclErrors(){return this._kclErrors}set kclErrors(e){e===this._kclErrors&&this.lints.length===0||(this._kclErrors=e,this.setDiagnosticsForCurrentErrors(),this._kclErrorsCallBack(e))}setDiagnosticsForCurrentErrors(){let e=dbe(this.kclErrors);this.lints.length>0&&(e=e.concat(this.lints)),Ot.setDiagnostics(e)}addKclErrors(e){e.length!==0&&(this.kclErrors=this.kclErrors.concat(e))}get isExecuting(){return this._isExecuting}set isExecuting(e){if(this._isExecuting=e,!e&&this.executeIsStale){const n=this.executeIsStale;this.executeIsStale=null,this.executeAst(n)}this._isExecutingCallback(e)}get executeIsStale(){return this._executeIsStale}set executeIsStale(e){this._executeIsStale=e}get wasmInitFailed(){return this._wasmInitFailed}set wasmInitFailed(e){this._wasmInitFailed=e,this._wasmInitFailedCallback(e)}registerCallBacks({setProgramMemory:e,setAst:n,setLogs:r,setKclErrors:i,setIsExecuting:s,setWasmInitFailed:o}){this._programMemoryCallBack=e,this._astCallBack=n,this._logsCallBack=r,this._kclErrorsCallBack=i,this._isExecutingCallback=s,this._wasmInitFailedCallback=o}registerExecuteCallback(e){this._executeCallback=e}clearAst(){this._ast={body:[],start:0,end:0,nonCodeMeta:{nonCodeNodes:{},start:[]}}}safeParse(e){var i;const n=Rr(e);if(this.lints=[],this.kclErrors=[],!ie(n))return n;const r=n;return this.addKclErrors([r]),r.msg==="file is empty"&&((i=this.engineCommandManager)==null||i.endSession()),null}async ensureWasmInit(){try{await eI,this.wasmInitFailed&&(this.wasmInitFailed=!1)}catch{this.wasmInitFailed=!0}}async executeAst(e={}){var l,c;if(this.isExecuting){this.executeIsStale=e,this.engineCommandManager.rejectAllModelingCommands(zq);return}const n=e.ast||this.ast,r=e.executionId||Date.now();this._cancelTokens.set(r,!1),this.isExecuting=!0,(l=this.engineCommandManager)==null||l.endSession(),await this.ensureWasmInit();const{logs:i,errors:s,execState:o,isInterrupted:a}=await kl({ast:n,idGenerator:this.execState.idGenerator,engineCommandManager:this.engineCommandManager});if(!a&&(this.lints=await iwe({ast:n}),Ke.modelingSend({type:"code edit during sketch"}),_9(o.memory,this.engineCommandManager),e.zoomToFit)){let u="";e.zoomOnRangeAndType&&(u=(c=this.engineCommandManager)==null?void 0:c.mapRangeToObjectId(e.zoomOnRangeAndType.range,e.zoomOnRangeAndType.type)),await this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"zoom_to_fit",object_ids:u?[u]:[],padding:.1,animated:!1}})}if(this.isExecuting=!1,this._cancelTokens.get(r)){this._cancelTokens.delete(r);return}this._isAstEmpty(n)&&await this.disableSketchMode(),this.logs=i,this.addKclErrors(a?[]:s),o.idGenerator.nextId=0,this.execState=o,s.length||(this.lastSuccessfulProgramMemory=o.memory),this.ast={...n},this._executeCallback(),this.engineCommandManager.addCommandLog({type:"execution-done",data:null}),this._cancelTokens.delete(r)}async executeAstMock(e=this._ast,{updates:n}={updates:"none"}){await this.ensureWasmInit();const r=wr(e);if(ie(r)){console.error(r);return}const i=this.safeParse(r);if(!i){this.clearAst();return}Kt.updateCodeEditor(r),await Kt.writeToFile(),this._ast={...i};const{logs:s,errors:o,execState:a}=await kl({ast:i,idGenerator:this.execState.idGenerator,engineCommandManager:this.engineCommandManager,useFakeExecutor:!0});this._logs=s,this._kclErrors=o,this._execState=a,this._programMemory=a.memory,o.length||(this.lastSuccessfulProgramMemory=a.memory),n==="artifactRanges"&&Array.from(this.engineCommandManager.artifactGraph).forEach(([l,c])=>{if(!("codeRef"in c))return;const u=Xe(this.ast,c.codeRef.pathToNode,"CallExpression");if(ie(u))return;const{node:d}=u;if(d.type!=="CallExpression")return;const[f,h]=c.codeRef.range;f===0&&h===0||f===d.start&&h===d.end||this.engineCommandManager.artifactGraph.set(l,{...c,codeRef:{...c.codeRef,range:[d.start,d.end]}})})}cancelAllExecutions(){this._cancelTokens.forEach((e,n)=>{this._cancelTokens.set(n,!0)})}async executeCode(e){const n=this.safeParse(Kt.code);if(!n){this.clearAst();return}return this.ast={...n},this.executeAst({zoomToFit:e})}format(){const e=Kt.code,n=this.safeParse(e);if(!n){this.clearAst();return}const r=wr(n);if(ie(r)){console.error(r);return}e!==r&&(Kt.updateCodeStateEditor(r),Kt.writeToFile(),this.executeCode())}async updateAst(e,n,r){const i=wr(e);if(ie(i))return Promise.reject(i);const s=this.safeParse(i);if(!s)return Promise.reject(new Error("bad ast"));let o;if(r!=null&&r.focusPath){o={codeBasedSelections:[],otherSelections:[]};for(const a of r.focusPath){const l=Xe(s,a);if(ie(l))return Promise.reject(l);const{node:c}=l,{start:u,end:d}=c;if(!u||!d)return{selections:void 0,newAst:s};u&&d&&o.codeBasedSelections.push({type:"default",range:[u,d]})}}return n?(Kt.updateCodeEditor(i),await Kt.writeToFile(),await this.executeAst({ast:s,zoomToFit:r==null?void 0:r.zoomToFit,zoomOnRangeAndType:r==null?void 0:r.zoomOnRangeAndType})):await this.executeAstMock(s),{selections:o,newAst:s}}get defaultPlanes(){var e;return(e=this==null?void 0:this.engineCommandManager)==null?void 0:e.defaultPlanes}showPlanes(e=!1){if(!this.defaultPlanes)return Promise.all([]);const n=[this.engineCommandManager.setPlaneHidden(this.defaultPlanes.xy,!1),this.engineCommandManager.setPlaneHidden(this.defaultPlanes.yz,!1),this.engineCommandManager.setPlaneHidden(this.defaultPlanes.xz,!1)];return e&&(n.push(this.engineCommandManager.setPlaneHidden(this.defaultPlanes.negXy,!1)),n.push(this.engineCommandManager.setPlaneHidden(this.defaultPlanes.negYz,!1)),n.push(this.engineCommandManager.setPlaneHidden(this.defaultPlanes.negXz,!1))),Promise.all(n)}hidePlanes(e=!1){if(!this.defaultPlanes)return Promise.all([]);const n=[this.engineCommandManager.setPlaneHidden(this.defaultPlanes.xy,!0),this.engineCommandManager.setPlaneHidden(this.defaultPlanes.yz,!0),this.engineCommandManager.setPlaneHidden(this.defaultPlanes.xz,!0)];return e&&(n.push(this.engineCommandManager.setPlaneHidden(this.defaultPlanes.negXy,!0)),n.push(this.engineCommandManager.setPlaneHidden(this.defaultPlanes.negYz,!0)),n.push(this.engineCommandManager.setPlaneHidden(this.defaultPlanes.negXz,!0))),Promise.all(n)}defaultSelectionFilter(){_9(this.programMemory,this.engineCommandManager)}async disableSketchMode(){await this.engineCommandManager.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"sketch_mode_disable"}})}_isAstEmpty(e){return e.start===0&&e.end===0&&e.body.length===0}}function _9(t,e){t.hasSketchOrSolid()&&e.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"set_selection_filter",filter:["face","edge","solid2d","curve"]}})}const uf=`// Shelf Bracket
// This is a bracket that holds a shelf. It is made of aluminum and is designed to hold a force of 300 lbs. The bracket is 6 inches wide and the force is applied at the end of the shelf, 12 inches from the wall. The bracket has a factor of safety of 1.2. The legs of the bracket are 5 inches and 2 inches long. The thickness of the bracket is calculated from the constraints provided.


// Define constants
const sigmaAllow = 35000 // psi (6061-T6 aluminum)
const width = 6 // inch
const p = 300 // Force on shelf - lbs
const factorOfSafety = 1.2 // FOS of 1.2
const shelfMountL = 5 // inches
const wallMountL = 2 // inches
const shelfDepth = 12 // Shelf is 12 inches in depth from the wall
const moment = shelfDepth * p // assume the force is applied at the end of the shelf to be conservative (lb-in)


const filletRadius = .375 // inches
const extFilletRadius = .25 // inches
const mountingHoleDiameter = 0.5 // inches


// Calculate required thickness of bracket
const thickness = sqrt(moment * factorOfSafety * 6 / (sigmaAllow * width)) // this is the calculation of two brackets holding up the shelf (inches)


// Sketch the bracket body and fillet the inner and outer edges of the bend
const bracketLeg1Sketch = startSketchOn('XY')
  |> startProfileAt([0, 0], %)
  |> line([shelfMountL - filletRadius, 0], %, $fillet1)
  |> line([0, width], %, $fillet2)
  |> line([-shelfMountL + filletRadius, 0], %)
  |> close(%)
  |> hole(circle({
       center: [1, 1],
       radius: mountingHoleDiameter / 2
     }, %), %)
  |> hole(circle({
       center: [shelfMountL - 1.5, width - 1],
       radius: mountingHoleDiameter / 2
     }, %), %)
  |> hole(circle({
       center: [1, width - 1],
       radius: mountingHoleDiameter / 2
     }, %), %)
  |> hole(circle({
       center: [shelfMountL - 1.5, 1],
       radius: mountingHoleDiameter / 2
     }, %), %)

// Extrude the leg 2 bracket sketch
const bracketLeg1Extrude = extrude(thickness, bracketLeg1Sketch)
  |> fillet({
       radius: extFilletRadius,
       tags: [
         getNextAdjacentEdge(fillet1),
         getNextAdjacentEdge(fillet2)
       ]
     }, %)

// Sketch the fillet arc
const filletSketch = startSketchOn('XZ')
  |> startProfileAt([0, 0], %)
  |> line([0, thickness], %)
  |> arc({
       angleEnd: 180,
       angleStart: 90,
       radius: filletRadius + thickness
     }, %)
  |> line([thickness, 0], %)
  |> arc({
       angleEnd: 90,
       angleStart: 180,
       radius: filletRadius
     }, %)

// Sketch the bend
const filletExtrude = extrude(-width, filletSketch)

// Create a custom plane for the leg that sits on the wall
const customPlane = {
  plane: {
    origin: { x: -filletRadius, y: 0, z: 0 },
    xAxis: { x: 0, y: 1, z: 0 },
    yAxis: { x: 0, y: 0, z: 1 },
    zAxis: { x: 1, y: 0, z: 0 }
  }
}

// Create a sketch for the second leg
const bracketLeg2Sketch = startSketchOn(customPlane)
  |> startProfileAt([0, -filletRadius], %)
  |> line([width, 0], %)
  |> line([0, -wallMountL], %, $fillet3)
  |> line([-width, 0], %, $fillet4)
  |> close(%)
  |> hole(circle({
       center: [1, -1.5],
       radius: mountingHoleDiameter / 2
     }, %), %)
  |> hole(circle({
       center: [5, -1.5],
       radius: mountingHoleDiameter / 2
     }, %), %)

// Extrude the second leg
const bracketLeg2Extrude = extrude(-thickness, bracketLeg2Sketch)
  |> fillet({
       radius: extFilletRadius,
       tags: [
         getNextAdjacentEdge(fillet3),
         getNextAdjacentEdge(fillet4)
       ]
     }, %)
`;function nY({searchText:t,example:e=uf}){const r=e.split(`
`).findIndex(i=>i.includes(t))+1;if(r===0)throw new Error(`Could not find the line with search text "${t}" in the example code. Was it removed?`);return r}const s_e=nY({searchText:"const width"}),o_e=nY({searchText:"const thickness"}),S9="persistCode",a_e=ls.define(),rY=a_e.of(!0);var fm;class l_e{constructor(){se(this,"_code",uf);eo(this,fm,()=>{});se(this,"_currentFilePath",null);se(this,"_hotkeys",{});se(this,"timeoutWriter");var r;if(ft()){this.code="";return}const e=E9(S9),n=JSON.parse(E9("store")||"{}");e===null&&((r=n==null?void 0:n.state)!=null&&r.code)?(this.code=n.state.code,n.state.code="",T9("store",JSON.stringify(n))):e===null?this.code=uf:this.code=e}set code(e){this._code=e}get code(){return this._code}registerCallBacks({setCode:e}){Ug(this,fm,e)}registerHotkey(e,n){this._hotkeys[e]=n}getCodemirrorHotkeys(){return Object.keys(this._hotkeys).map(e=>({key:e,run:()=>(this._hotkeys[e](),!1),preventDefault:!0}))}updateCurrentFilePath(e){this._currentFilePath=e}updateCodeState(e){this._code!==e&&(this.code=e,On(this,fm).call(this,e))}updateCodeEditor(e){this.code=e,Ot.editorView&&Ot.editorView.dispatch({changes:{from:0,to:Ot.editorView.state.doc.length,insert:e},annotations:[rY,Bn.addToHistory.of(!0)]})}updateCodeStateEditor(e){this._code!==e&&(this.code=e,On(this,fm).call(this,e),this.updateCodeEditor(e))}async writeToFile(){ft()?(clearTimeout(this.timeoutWriter),this.timeoutWriter=setTimeout(()=>{this._currentFilePath&&window.electron.writeFile(this._currentFilePath,this.code??"").catch(e=>{console.error("error saving file",e),jt.error("Error saving file, please check file permissions")})},1e3)):T9(S9,this.code)}}fm=new WeakMap;function E9(t){return typeof window>"u"?null:localStorage==null?void 0:localStorage.getItem(t)}function T9(t,e){typeof window>"u"||localStorage==null||localStorage.setItem(t,e)}const Kt=new l_e,je=new Zbe;window.tearDown=je.tearDown;const be=new i_e(je);je.kclManager=be;je.getAstCb=()=>be.ast;const Ke=new c5(je);je.camControlsCameraChange=Ke.onCameraChange;const sn=new Ixe(je),Ot=new r_e;typeof window<"u"&&(window.engineCommandManager=je,window.kclManager=be,window.sceneInfra=Ke,window.sceneEntitiesManager=sn,window.editorManager=Ot,window.enableMousePositionLogs=()=>document.addEventListener("mousemove",t=>console.log(`await page.mouse.click(${t.clientX}, ${t.clientY})`)),window.enableFillet=()=>{window._enableFillet=!0},window.zoomToFit=()=>je.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"zoom_to_fit",object_ids:[],padding:.2,animated:!1}}));function c_e(){const t="Shift";P.useEffect(()=>{const e=r=>r.key===t&&Ot.setIsShiftDown(!0),n=r=>r.key===t&&Ot.setIsShiftDown(!1);return window.addEventListener("keydown",e),window.addEventListener("keyup",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",n)}})}const iY=t=>b.jsx("svg",{viewBox:"0 0 10 10",className:"w-8 h-8",...t,children:b.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"var(--primary)",fill:"none",strokeDasharray:"4, 4",className:"animate-spin origin-center"})}),SI=({children:t})=>{const[e,n]=P.useState(N0.Unset);return P.useEffect(()=>{const r=({detail:s})=>{var o;(s.type!==No.Disconnected||s.type!==No.Disconnecting)&&((o=s.value)==null?void 0:o.type)!==ng.Error||n(s.value.value.error)},i=({detail:s})=>{s.addEventListener(Nc.ConnectionStateChanged,r)};return je.addEventListener(Wh.EngineAvailable,i),()=>{var s;je.removeEventListener(Wh.EngineAvailable,i),(s=je.engineConnection)==null||s.removeEventListener(Nc.ConnectionStateChanged,r)}},[je,je.engineConnection]),P.useEffect(()=>{if(e>N0.LongLoadingTime)return;const r=setTimeout(()=>{n(N0.LongLoadingTime)},4e3);return()=>clearTimeout(r)},[e,n]),b.jsxs("div",{className:"body-bg flex flex-col items-center justify-center h-screen","data-testid":"loading",children:[b.jsx(iY,{}),b.jsx("p",{className:"text-base mt-4 text-primary",children:t||"Loading"}),b.jsx("p",{className:"text-sm mt-4 text-primary/60 transition-opacity duration-500"+(e!==N0.Unset?" opacity-100":" opacity-0"),children:Ybe[e]})]})};var sY={exports:{}},oY={};/**
 * @license React
 * use-sync-external-store-shim.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var sg=P;function u_e(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var d_e=typeof Object.is=="function"?Object.is:u_e,f_e=sg.useState,h_e=sg.useEffect,A_e=sg.useLayoutEffect,p_e=sg.useDebugValue;function m_e(t,e){var n=e(),r=f_e({inst:{value:n,getSnapshot:e}}),i=r[0].inst,s=r[1];return A_e(function(){i.value=n,i.getSnapshot=e,VT(i)&&s({inst:i})},[t,n,e]),h_e(function(){return VT(i)&&s({inst:i}),t(function(){VT(i)&&s({inst:i})})},[t]),p_e(n),n}function VT(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!d_e(t,n)}catch{return!0}}function g_e(t,e){return e()}var y_e=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g_e:m_e;oY.useSyncExternalStore=sg.useSyncExternalStore!==void 0?sg.useSyncExternalStore:y_e;sY.exports=oY;var aY=sY.exports,v_e=P.useLayoutEffect;function b_e(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function w_e(){const t=b_e();if(t.__xstate__)return t.__xstate__}const x_e=t=>{if(typeof window>"u")return;const e=w_e();e&&e.register(t)};class B9{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(e){const n={value:e,next:null};if(this._current){this._last.next=n,this._last=n;return}this._current=n,this._last=n,this._active&&this.flush()}flush(){for(;this._current;){const e=this._current;this._process(e.value),this._current=e.next}this._last=null}}const lY=".",C_e="",cY="",S_e="#",E_e="*",uY="xstate.init",P_="xstate.stop";function T_e(t,e){return{type:`xstate.after.${t}.${e}`}}function p5(t,e){return{type:`xstate.done.state.${t}`,output:e}}function B_e(t,e){return{type:`xstate.done.actor.${t}`,output:e,actorId:t}}function M_e(t,e){return{type:`xstate.error.actor.${t}`,error:e,actorId:t}}function dY(t){return{type:uY,input:t}}function Cc(t){setTimeout(()=>{throw t})}const k_e=typeof Symbol=="function"&&Symbol.observable||"@@observable";function fY(t,e){const n=M9(t),r=M9(e);return typeof r=="string"?typeof n=="string"?r===n:!1:typeof n=="string"?n in r:Object.keys(n).every(i=>i in r?fY(n[i],r[i]):!1)}function EI(t){if(AY(t))return t;let e=[],n="";for(let r=0;r<t.length;r++){switch(t.charCodeAt(r)){case 92:n+=t[r+1],r++;continue;case 46:e.push(n),n="";continue}n+=t[r]}return e.push(n),e}function M9(t){if(fSe(t))return t.value;if(typeof t!="string")return t;const e=EI(t);return R_e(e)}function R_e(t){if(t.length===1)return t[0];const e={};let n=e;for(let r=0;r<t.length-1;r++)if(r===t.length-2)n[t[r]]=t[r+1];else{const i=n;n={},i[t[r]]=n}return e}function k9(t,e){const n={},r=Object.keys(t);for(let i=0;i<r.length;i++){const s=r[i];n[s]=e(t[s],s,t,i)}return n}function hY(t){return AY(t)?t:[t]}function md(t){return t===void 0?[]:hY(t)}function m5(t,e,n,r){return typeof t=="function"?t({context:e,event:n,self:r}):t}function AY(t){return Array.isArray(t)}function P_e(t){return t.type.startsWith("xstate.error.actor")}function op(t){return hY(t).map(e=>typeof e>"u"||typeof e=="string"?{target:e}:e)}function pY(t){if(!(t===void 0||t===C_e))return md(t)}function g5(t,e,n){var s,o,a;const r=typeof t=="object",i=r?t:void 0;return{next:(s=r?t.next:t)==null?void 0:s.bind(i),error:(o=r?t.error:e)==null?void 0:o.bind(i),complete:(a=r?t.complete:n)==null?void 0:a.bind(i)}}function R9(t,e){return`${e}.${t}`}function TI(t,e){const n=e.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return t.implementations.actors[e];const[,r,i]=n,o=t.getStateNodeById(i).config.invoke;return(Array.isArray(o)?o[r]:o).src}function P9(t,e){return`${t.sessionId}.${e}`}let L_e=0;function I_e(t,e){const n=new Map,r=new Map,i=new WeakMap,s=new Set,o={},{clock:a,logger:l}=e,c={schedule:(f,h,A,p,m=Math.random().toString(36).slice(2))=>{const g={source:f,target:h,event:A,delay:p,id:m,startedAt:Date.now()},y=P9(f,m);d._snapshot._scheduledEvents[y]=g;const w=a.setTimeout(()=>{delete o[y],delete d._snapshot._scheduledEvents[y],d._relay(f,h,A)},p);o[y]=w},cancel:(f,h)=>{const A=P9(f,h),p=o[A];delete o[A],delete d._snapshot._scheduledEvents[A],p!==void 0&&a.clearTimeout(p)},cancelAll:f=>{for(const h in d._snapshot._scheduledEvents){const A=d._snapshot._scheduledEvents[h];A.source===f&&c.cancel(f,A.id)}}},u=f=>{if(!s.size)return;const h={...f,rootId:t.sessionId};s.forEach(A=>{var p;return(p=A.next)==null?void 0:p.call(A,h)})},d={_snapshot:{_scheduledEvents:((e==null?void 0:e.snapshot)&&e.snapshot.scheduler)??{}},_bookId:()=>`x:${L_e++}`,_register:(f,h)=>(n.set(f,h),f),_unregister:f=>{n.delete(f.sessionId);const h=i.get(f);h!==void 0&&(r.delete(h),i.delete(f))},get:f=>r.get(f),_set:(f,h)=>{const A=r.get(f);if(A&&A!==h)throw new Error(`Actor with system ID '${f}' already exists.`);r.set(f,h),i.set(h,f)},inspect:f=>{const h=g5(f);return s.add(h),{unsubscribe(){s.delete(h)}}},_sendInspectionEvent:u,_relay:(f,h,A)=>{d._sendInspectionEvent({type:"@xstate.event",sourceRef:f,actorRef:h,event:A}),h._send(A)},scheduler:c,getSnapshot:()=>({_scheduledEvents:{...d._snapshot._scheduledEvents}}),start:()=>{const f=d._snapshot._scheduledEvents;d._snapshot._scheduledEvents={};for(const h in f){const{source:A,target:p,event:m,delay:g,id:y}=f[h];c.schedule(A,p,m,g,y)}},_clock:a,_logger:l};return d}const BI=1;let Fs=function(t){return t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped",t}({});const O_e={clock:{setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},logger:console.log.bind(console),devTools:!1};class F_e{constructor(e,n){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new B9(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=Fs.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this._systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];const r={...O_e,...n},{clock:i,logger:s,parent:o,syncSnapshot:a,id:l,systemId:c,inspect:u}=r;this.system=o?o.system:I_e(this,{clock:i,logger:s}),u&&!o&&this.system.inspect(g5(u)),this.sessionId=this.system._bookId(),this.id=l??this.sessionId,this.logger=(n==null?void 0:n.logger)??this.system._logger,this.clock=(n==null?void 0:n.clock)??this.system._clock,this._parent=o,this._syncSnapshot=a,this.options=r,this.src=r.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:d=>{this._deferred.push(d)},system:this.system,stopChild:d=>{if(d._parent!==this)throw new Error(`Cannot stop child actor ${d.id} of ${this.id} because it is not a child`);d._stop()},emit:d=>{const f=this.eventListeners.get(d.type),h=this.eventListeners.get("*");if(!f&&!h)return;const A=new Set([...f?f.values():[],...h?h.values():[]]);for(const p of Array.from(A))p(d)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),c&&(this._systemId=c,this.system._set(c,this)),this._initState((n==null?void 0:n.snapshot)??(n==null?void 0:n.state)),c&&this._snapshot.status!=="active"&&this.system._unregister(this)}_initState(e){var n;try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,(n=this.options)==null?void 0:n.input)}catch(r){this._snapshot={status:"error",output:void 0,error:r}}}update(e,n){var i,s;this._snapshot=e;let r;for(;r=this._deferred.shift();)try{r()}catch(o){this._deferred.length=0,this._snapshot={...e,status:"error",error:o}}switch(this._snapshot.status){case"active":for(const o of this.observers)try{(i=o.next)==null||i.call(o,e)}catch(a){Cc(a)}break;case"done":for(const o of this.observers)try{(s=o.next)==null||s.call(o,e)}catch(a){Cc(a)}this._stopProcedure(),this._complete(),this._doneEvent=B_e(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:n,snapshot:e})}subscribe(e,n,r){var s;const i=g5(e,n,r);if(this._processingStatus!==Fs.Stopped)this.observers.add(i);else switch(this._snapshot.status){case"done":try{(s=i.complete)==null||s.call(i)}catch(o){Cc(o)}break;case"error":{const o=this._snapshot.error;if(!i.error)Cc(o);else try{i.error(o)}catch(a){Cc(a)}break}}return{unsubscribe:()=>{this.observers.delete(i)}}}on(e,n){let r=this.eventListeners.get(e);r||(r=new Set,this.eventListeners.set(e,r));const i=n.bind(void 0);return r.add(i),{unsubscribe:()=>{r.delete(i)}}}start(){if(this._processingStatus===Fs.Running)return this;this._syncSnapshot&&this.subscribe({next:r=>{r.status==="active"&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:r})},error:()=>{}}),this.system._register(this.sessionId,this),this._systemId&&this.system._set(this._systemId,this),this._processingStatus=Fs.Running;const e=dY(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case"done":return this.update(this._snapshot,e),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(r){return this._snapshot={...this._snapshot,status:"error",error:r},this._error(r),this}return this.update(this._snapshot,e),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(e){let n,r;try{n=this.logic.transition(this._snapshot,e,this._actorScope)}catch(i){r={err:i}}if(r){const{err:i}=r;this._snapshot={...this._snapshot,status:"error",error:i},this._error(i);return}this.update(n,e),e.type===P_&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===Fs.Stopped?this:(this.mailbox.clear(),this._processingStatus===Fs.NotStarted?(this._processingStatus=Fs.Stopped,this):(this.mailbox.enqueue({type:P_}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){var e;for(const n of this.observers)try{(e=n.complete)==null||e.call(n)}catch(r){Cc(r)}this.observers.clear()}_reportError(e){if(!this.observers.size){this._parent||Cc(e);return}let n=!1;for(const r of this.observers){const i=r.error;n||(n=!i);try{i==null||i(e)}catch(s){Cc(s)}}this.observers.clear(),n&&Cc(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,M_e(this.id,e))}_stopProcedure(){return this._processingStatus!==Fs.Running?this:(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new B9(this._process.bind(this)),this._processingStatus=Fs.Stopped,this.system._unregister(this),this)}_send(e){this._processingStatus!==Fs.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){const{devTools:e}=this.options;e&&(typeof e=="function"?e:x_e)(this)}toJSON(){return{xstate$$type:BI,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[k_e](){return this}getSnapshot(){return this._snapshot}}function og(t,...[e]){return new F_e(t,e)}function N_e(t,e,n,r,{sendId:i}){const s=typeof i=="function"?i(n,r):i;return[e,s]}function D_e(t,e){t.defer(()=>{t.system.scheduler.cancel(t.self,e)})}function U_e(t){function e(n,r){}return e.type="xstate.cancel",e.sendId=t,e.resolve=N_e,e.execute=D_e,e}function MI(t,e,n,r){const{machine:i}=r,s=typeof t=="function",o=s?t:i.implementations.guards[typeof t=="string"?t:t.type];if(!s&&!o)throw new Error(`Guard '${typeof t=="string"?t:t.type}' is not implemented.'.`);if(typeof o!="function")return MI(o,e,n,r);const a={context:e,event:n},l=s||typeof t=="string"?void 0:"params"in t?typeof t.params=="function"?t.params({context:e,event:n}):t.params:void 0;return"check"in o?o.check(r,a,o):o(a,l)}function H_e(t,e,n,r,{event:i,id:s,delay:o},{internalQueue:a}){const l=e.machine.implementations.delays;if(typeof i=="string")throw new Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);const c=typeof i=="function"?i(n,r):i;let u;if(typeof o=="string"){const d=l&&l[o];u=typeof d=="function"?d(n,r):d}else u=typeof o=="function"?o(n,r):o;return typeof u!="number"&&a.push(c),[e,{event:c,id:s,delay:u}]}function j_e(t,e){const{event:n,delay:r,id:i}=e;if(typeof r=="number"){t.defer(()=>{const s=t.self;t.system.scheduler.schedule(s,s,n,r,i)});return}}function Q_e(t,e){function n(r,i){}return n.type="xstate.raise",n.event=t,n.id=e==null?void 0:e.id,n.delay=e==null?void 0:e.delay,n.resolve=H_e,n.execute=j_e,n}function z_e(t,e,n,r,{id:i,systemId:s,src:o,input:a,syncSnapshot:l}){const c=typeof o=="string"?TI(e.machine,o):o,u=typeof i=="function"?i(n):i;let d;return c&&(d=og(c,{id:u,src:o,parent:t.self,syncSnapshot:l,systemId:s,input:typeof a=="function"?a({context:e.context,event:n.event,self:t.self}):a})),[Kh(e,{children:{...e.children,[u]:d}}),{id:i,actorRef:d}]}function V_e(t,{id:e,actorRef:n}){n&&t.defer(()=>{n._processingStatus!==Fs.Stopped&&n.start()})}function G_e(...[t,{id:e,systemId:n,input:r,syncSnapshot:i=!1}={}]){function s(o,a){}return s.type="snapshot.spawnChild",s.id=e,s.systemId=n,s.src=t,s.input=r,s.syncSnapshot=i,s.resolve=z_e,s.execute=V_e,s}function W_e(t,e,n,r,{actorRef:i}){const s=typeof i=="function"?i(n,r):i,o=typeof s=="string"?e.children[s]:s;let a=e.children;return o&&(a={...a},delete a[o.id]),[Kh(e,{children:a}),o]}function K_e(t,e){if(e){if(t.system._unregister(e),e._processingStatus!==Fs.Running){t.stopChild(e);return}t.defer(()=>{t.stopChild(e)})}}function mY(t){function e(n,r){}return e.type="xstate.stopChild",e.actorRef=t,e.resolve=W_e,e.execute=K_e,e}const kI=t=>t.type==="atomic"||t.type==="final";function ag(t){return Object.values(t.states).filter(e=>e.type!=="history")}function gv(t,e){const n=[];if(e===t)return n;let r=t.parent;for(;r&&r!==e;)n.push(r),r=r.parent;return n}function L_(t){const e=new Set(t),n=yY(e);for(const r of e)if(r.type==="compound"&&(!n.get(r)||!n.get(r).length))L9(r).forEach(i=>e.add(i));else if(r.type==="parallel"){for(const i of ag(r))if(i.type!=="history"&&!e.has(i)){const s=L9(i);for(const o of s)e.add(o)}}for(const r of e){let i=r.parent;for(;i;)e.add(i),i=i.parent}return e}function gY(t,e){const n=e.get(t);if(!n)return{};if(t.type==="compound"){const i=n[0];if(i){if(kI(i))return i.key}else return{}}const r={};for(const i of n)r[i.key]=gY(i,e);return r}function yY(t){const e=new Map;for(const n of t)e.has(n)||e.set(n,[]),n.parent&&(e.has(n.parent)||e.set(n.parent,[]),e.get(n.parent).push(n));return e}function vY(t,e){const n=L_(e);return gY(t,yY(n))}function RI(t,e){return e.type==="compound"?ag(e).some(n=>n.type==="final"&&t.has(n)):e.type==="parallel"?ag(e).every(n=>RI(t,n)):e.type==="final"}const v2=t=>t[0]===S_e;function $_e(t,e){return t.transitions.get(e)||[...t.transitions.keys()].filter(r=>{if(r===E_e)return!0;if(!r.endsWith(".*"))return!1;const i=r.split("."),s=e.split(".");for(let o=0;o<i.length;o++){const a=i[o],l=s[o];if(a==="*")return o===i.length-1;if(a!==l)return!1}return!0}).sort((r,i)=>i.length-r.length).flatMap(r=>t.transitions.get(r))}function q_e(t){const e=t.config.after;if(!e)return[];const n=(i,s)=>{const o=T_e(i,t.id),a=o.type;return t.entry.push(Q_e(o,{id:a,delay:i})),t.exit.push(U_e(a)),a};return Object.keys(e).flatMap((i,s)=>{const o=e[i],a=typeof o=="string"?{target:o}:o,l=Number.isNaN(+i)?i:+i,c=n(l);return md(a).map(u=>({...u,event:c,delay:l}))}).map(i=>{const{delay:s}=i;return{...ih(t,i.event,i),delay:s}})}function ih(t,e,n){const r=pY(n.target),i=n.reenter??!1,s=J_e(t,r),o={...n,actions:md(n.actions),guard:n.guard,target:s,source:t,reenter:i,eventType:e,toJSON:()=>({...o,source:`#${t.id}`,target:s?s.map(a=>`#${a.id}`):void 0})};return o}function X_e(t){const e=new Map;if(t.config.on)for(const n of Object.keys(t.config.on)){if(n===cY)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');const r=t.config.on[n];e.set(n,op(r).map(i=>ih(t,n,i)))}if(t.config.onDone){const n=`xstate.done.state.${t.id}`;e.set(n,op(t.config.onDone).map(r=>ih(t,n,r)))}for(const n of t.invoke){if(n.onDone){const r=`xstate.done.actor.${n.id}`;e.set(r,op(n.onDone).map(i=>ih(t,r,i)))}if(n.onError){const r=`xstate.error.actor.${n.id}`;e.set(r,op(n.onError).map(i=>ih(t,r,i)))}if(n.onSnapshot){const r=`xstate.snapshot.${n.id}`;e.set(r,op(n.onSnapshot).map(i=>ih(t,r,i)))}}for(const n of t.after){let r=e.get(n.eventType);r||(r=[],e.set(n.eventType,r)),r.push(n)}return e}function Y_e(t,e){const n=typeof e=="string"?t.states[e]:e?t.states[e.target]:void 0;if(!n&&e)throw new Error(`Initial state node "${e}" not found on parent state node #${t.id}`);const r={source:t,actions:!e||typeof e=="string"?[]:md(e.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${t.id}`,target:n?[`#${n.id}`]:[]})};return r}function J_e(t,e){if(e!==void 0)return e.map(n=>{if(typeof n!="string")return n;if(v2(n))return t.machine.getStateNodeById(n);const r=n[0]===lY;if(r&&!t.parent)return I_(t,n.slice(1));const i=r?t.key+n:n;if(t.parent)try{return I_(t.parent,i)}catch(s){throw new Error(`Invalid transition definition for state node '${t.id}':
${s.message}`)}else throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`)})}function bY(t){const e=pY(t.config.target);return e?{target:e.map(n=>typeof n=="string"?I_(t.parent,n):n)}:t.parent.initial}function ph(t){return t.type==="history"}function L9(t){const e=wY(t);for(const n of e)for(const r of gv(n,t))e.add(r);return e}function wY(t){const e=new Set;function n(r){if(!e.has(r)){if(e.add(r),r.type==="compound")n(r.initial.target[0]);else if(r.type==="parallel")for(const i of ag(r))n(i)}}return n(t),e}function lg(t,e){if(v2(e))return t.machine.getStateNodeById(e);if(!t.states)throw new Error(`Unable to retrieve child state '${e}' from '${t.id}'; no child states exist.`);const n=t.states[e];if(!n)throw new Error(`Child state '${e}' does not exist on '${t.id}'`);return n}function I_(t,e){if(typeof e=="string"&&v2(e))try{return t.machine.getStateNodeById(e)}catch{}const n=EI(e).slice();let r=t;for(;n.length;){const i=n.shift();if(!i.length)break;r=lg(r,i)}return r}function O_(t,e){if(typeof e=="string"){const i=t.states[e];if(!i)throw new Error(`State '${e}' does not exist on '${t.id}'`);return[t,i]}const n=Object.keys(e),r=n.map(i=>lg(t,i)).filter(Boolean);return[t.machine.root,t].concat(r,n.reduce((i,s)=>{const o=lg(t,s);if(!o)return i;const a=O_(o,e[s]);return i.concat(a)},[]))}function Z_e(t,e,n,r){const s=lg(t,e).next(n,r);return!s||!s.length?t.next(n,r):s}function eSe(t,e,n,r){const i=Object.keys(e),s=lg(t,i[0]),o=PI(s,e[i[0]],n,r);return!o||!o.length?t.next(n,r):o}function tSe(t,e,n,r){const i=[];for(const s of Object.keys(e)){const o=e[s];if(!o)continue;const a=lg(t,s),l=PI(a,o,n,r);l&&i.push(...l)}return i.length?i:t.next(n,r)}function PI(t,e,n,r){return typeof e=="string"?Z_e(t,e,n,r):Object.keys(e).length===1?eSe(t,e,n,r):tSe(t,e,n,r)}function nSe(t){return Object.keys(t.states).map(e=>t.states[e]).filter(e=>e.type==="history")}function df(t,e){let n=t;for(;n.parent&&n.parent!==e;)n=n.parent;return n.parent===e}function rSe(t,e){const n=new Set(t),r=new Set(e);for(const i of n)if(r.has(i))return!0;for(const i of r)if(n.has(i))return!0;return!1}function xY(t,e,n){const r=new Set;for(const i of t){let s=!1;const o=new Set;for(const a of r)if(rSe(y5([i],e,n),y5([a],e,n)))if(df(i.source,a.source))o.add(a);else{s=!0;break}if(!s){for(const a of o)r.delete(a);r.add(i)}}return Array.from(r)}function iSe(t){const[e,...n]=t;for(const r of gv(e,void 0))if(n.every(i=>df(i,r)))return r}function LI(t,e){if(!t.target)return[];const n=new Set;for(const r of t.target)if(ph(r))if(e[r.id])for(const i of e[r.id])n.add(i);else for(const i of LI(bY(r),e))n.add(i);else n.add(r);return[...n]}function CY(t,e){const n=LI(t,e);if(!n)return;if(!t.reenter&&n.every(i=>i===t.source||df(i,t.source)))return t.source;const r=iSe(n.concat(t.source));if(r)return r;if(!t.reenter)return t.source.machine.root}function y5(t,e,n){var i;const r=new Set;for(const s of t)if((i=s.target)!=null&&i.length){const o=CY(s,n);s.reenter&&s.source===o&&r.add(o);for(const a of e)df(a,o)&&r.add(a)}return[...r]}function sSe(t,e){if(t.length!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function v5(t,e,n,r,i,s){if(!t.length)return e;const o=new Set(e._nodes);let a=e.historyValue;const l=xY(t,o,a);let c=e;i||([c,a]=cSe(c,r,n,l,o,a,s)),c=cg(c,r,n,l.flatMap(d=>d.actions),s),c=aSe(c,r,n,l,o,s,a,i);const u=[...o];c.status==="done"&&(c=cg(c,r,n,u.sort((d,f)=>f.order-d.order).flatMap(d=>d.exit),s));try{return a===e.historyValue&&sSe(e._nodes,o)?c:Kh(c,{_nodes:u,historyValue:a})}catch(d){throw d}}function oSe(t,e,n,r,i){if(r.output===void 0)return;const s=p5(i.id,i.output!==void 0&&i.parent?m5(i.output,t.context,e,n.self):void 0);return m5(r.output,t.context,s,n.self)}function aSe(t,e,n,r,i,s,o,a){let l=t;const c=new Set,u=new Set;lSe(r,o,u,c),a&&u.add(t.machine.root);const d=new Set;for(const f of[...c].sort((h,A)=>h.order-A.order)){i.add(f);const h=[];h.push(...f.entry);for(const A of f.invoke)h.push(G_e(A.src,{...A,syncSnapshot:!!A.onSnapshot}));if(u.has(f)){const A=f.initial.actions;h.push(...A)}if(l=cg(l,e,n,h,s,f.invoke.map(A=>A.id)),f.type==="final"){const A=f.parent;let p=(A==null?void 0:A.type)==="parallel"?A:A==null?void 0:A.parent,m=p||f;for((A==null?void 0:A.type)==="compound"&&s.push(p5(A.id,f.output!==void 0?m5(f.output,l.context,e,n.self):void 0));(p==null?void 0:p.type)==="parallel"&&!d.has(p)&&RI(i,p);)d.add(p),s.push(p5(p.id)),m=p,p=p.parent;if(p)continue;l=Kh(l,{status:"done",output:oSe(l,e,n,l.machine.root,m)})}}return l}function lSe(t,e,n,r){for(const i of t){const s=CY(i,e);for(const a of i.target||[])!ph(a)&&(i.source!==a||i.source!==s||i.reenter)&&(r.add(a),n.add(a)),Pp(a,e,n,r);const o=LI(i,e);for(const a of o){const l=gv(a,s);(s==null?void 0:s.type)==="parallel"&&l.push(s),_Y(r,e,n,l,!i.source.parent&&i.reenter?void 0:s)}}}function Pp(t,e,n,r){var i;if(ph(t))if(e[t.id]){const s=e[t.id];for(const o of s)r.add(o),Pp(o,e,n,r);for(const o of s)GT(o,t.parent,r,e,n)}else{const s=bY(t);for(const o of s.target)r.add(o),s===((i=t.parent)==null?void 0:i.initial)&&n.add(t.parent),Pp(o,e,n,r);for(const o of s.target)GT(o,t.parent,r,e,n)}else if(t.type==="compound"){const[s]=t.initial.target;ph(s)||(r.add(s),n.add(s)),Pp(s,e,n,r),GT(s,t,r,e,n)}else if(t.type==="parallel")for(const s of ag(t).filter(o=>!ph(o)))[...r].some(o=>df(o,s))||(ph(s)||(r.add(s),n.add(s)),Pp(s,e,n,r))}function _Y(t,e,n,r,i){for(const s of r)if((!i||df(s,i))&&t.add(s),s.type==="parallel")for(const o of ag(s).filter(a=>!ph(a)))[...t].some(a=>df(a,o))||(t.add(o),Pp(o,e,n,t))}function GT(t,e,n,r,i){_Y(n,r,i,gv(t,e))}function cSe(t,e,n,r,i,s,o){let a=t;const l=y5(r,i,s);l.sort((u,d)=>d.order-u.order);let c;for(const u of l)for(const d of nSe(u)){let f;d.history==="deep"?f=h=>kI(h)&&df(h,u):f=h=>h.parent===u,c??(c={...s}),c[d.id]=Array.from(i).filter(f)}for(const u of l)a=cg(a,e,n,[...u.exit,...u.invoke.map(d=>mY(d.id))],o),i.delete(u);return[a,c||s]}let I9=!1;function SY(t,e,n,r,i,s){const{machine:o}=t;let a=t;for(const l of r){let h=function(){n.system._sendInspectionEvent({type:"@xstate.action",actorRef:n.self,action:{type:typeof l=="string"?l:typeof l=="object"?l.type:l.name||"(anonymous)",params:f}});try{I9=u,u(d,f)}finally{I9=!1}};const c=typeof l=="function",u=c?l:o.implementations.actions[typeof l=="string"?l:l.type];if(!u)continue;const d={context:a.context,event:e,self:n.self,system:n.system},f=c||typeof l=="string"?void 0:"params"in l?typeof l.params=="function"?l.params({context:a.context,event:e}):l.params:void 0;if(!("resolve"in u)){n.self._processingStatus===Fs.Running?h():n.defer(()=>{h()});continue}const A=u,[p,m,g]=A.resolve(n,a,d,f,u,i);a=p,"retryResolve"in A&&(s==null||s.push([A,m])),"execute"in A&&(n.self._processingStatus===Fs.Running?A.execute(n,m):n.defer(A.execute.bind(null,n,m))),g&&(a=SY(a,e,n,g,i,s))}return a}function cg(t,e,n,r,i,s){const o=s?[]:void 0,a=SY(t,e,n,r,{internalQueue:i,deferredActorIds:s},o);return o==null||o.forEach(([l,c])=>{l.retryResolve(n,a,c)}),a}function WT(t,e,n,r=[]){let i=t;const s=[];function o(c,u,d){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:u,snapshot:c,_transitions:d}),s.push(c)}if(e.type===P_)return i=Kh(O9(i,e,n),{status:"stopped"}),o(i,e,[]),{snapshot:i,microstates:s};let a=e;if(a.type!==uY){const c=a,u=P_e(c),d=F9(c,i);if(u&&!d.length)return i=Kh(t,{status:"error",error:c.error}),o(i,c,[]),{snapshot:i,microstates:s};i=v5(d,t,n,a,!1,r),o(i,c,d)}let l=!0;for(;i.status==="active";){let c=l?uSe(i,a):[];const u=c.length?i:void 0;if(!c.length){if(!r.length)break;a=r.shift(),c=F9(a,i)}i=v5(c,i,n,a,!1,r),l=i!==u,o(i,a,c)}return i.status!=="active"&&O9(i,a,n),{snapshot:i,microstates:s}}function O9(t,e,n){return cg(t,e,n,Object.values(t.children).map(r=>mY(r)),[])}function F9(t,e){return e.machine.getTransitionData(e,t)}function uSe(t,e){const n=new Set,r=t._nodes.filter(kI);for(const i of r)e:for(const s of[i].concat(gv(i,void 0)))if(s.always){for(const o of s.always)if(o.guard===void 0||MI(o.guard,t.context,e,t)){n.add(o);break e}}return xY(Array.from(n),new Set(t._nodes),t.historyValue)}function dSe(t,e){const n=L_(O_(t,e));return vY(t,[...n])}function fSe(t){return!!t&&typeof t=="object"&&"machine"in t&&"value"in t}const hSe=function(e){return fY(e,this.value)},ASe=function(e){return this.tags.has(e)},pSe=function(e){const n=this.machine.getTransitionData(this,e);return!!(n!=null&&n.length)&&n.some(r=>r.target!==void 0||r.actions.length)},mSe=function(){const{_nodes:e,tags:n,machine:r,getMeta:i,toJSON:s,can:o,hasTag:a,matches:l,...c}=this;return{...c,tags:Array.from(n)}},gSe=function(){return this._nodes.reduce((e,n)=>(n.meta!==void 0&&(e[n.id]=n.meta),e),{})};function zx(t,e){return{status:t.status,output:t.output,error:t.error,machine:e,context:t.context,_nodes:t._nodes,value:vY(e.root,t._nodes),tags:new Set(t._nodes.flatMap(n=>n.tags)),children:t.children,historyValue:t.historyValue||{},matches:hSe,hasTag:ASe,can:pSe,getMeta:gSe,toJSON:mSe}}function Kh(t,e={}){return zx({...t,...e},t.machine)}function ySe(t,e){const{_nodes:n,tags:r,machine:i,children:s,context:o,can:a,hasTag:l,matches:c,getMeta:u,toJSON:d,...f}=t,h={};for(const p in s){const m=s[p];h[p]={snapshot:m.getPersistedSnapshot(e),src:m.src,systemId:m._systemId,syncSnapshot:m._syncSnapshot}}return{...f,context:EY(o),children:h}}function EY(t){let e;for(const n in t){const r=t[n];if(r&&typeof r=="object")if("sessionId"in r&&"send"in r&&"ref"in r)e??(e=Array.isArray(t)?t.slice():{...t}),e[n]={xstate$$type:BI,id:r.id};else{const i=EY(r);i!==r&&(e??(e=Array.isArray(t)?t.slice():{...t}),e[n]=i)}}return e??t}function vSe(t,{machine:e,context:n},r,i){const s=(o,a={})=>{const{systemId:l,input:c}=a;if(typeof o=="string"){const u=TI(e,o);if(!u)throw new Error(`Actor logic '${o}' not implemented in machine '${e.id}'`);const d=og(u,{id:a.id,parent:t.self,syncSnapshot:a.syncSnapshot,input:typeof c=="function"?c({context:n,event:r,self:t.self}):c,src:o,systemId:l});return i[d.id]=d,d}else return og(o,{id:a.id,parent:t.self,syncSnapshot:a.syncSnapshot,input:a.input,src:o,systemId:l})};return(o,a)=>{const l=s(o,a);return i[l.id]=l,t.defer(()=>{l._processingStatus!==Fs.Stopped&&l.start()}),l}}function bSe(t,e,n,r,{assignment:i}){if(!e.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");const s={},o={context:e.context,event:n.event,spawn:vSe(t,e,n.event,s),self:t.self,system:t.system};let a={};if(typeof i=="function")a=i(o,r);else for(const c of Object.keys(i)){const u=i[c];a[c]=typeof u=="function"?u(o,r):u}const l=Object.assign({},e.context,a);return[Kh(e,{context:l,children:Object.keys(s).length?{...e.children,...s}:e.children})]}function An(t){function e(n,r){}return e.type="xstate.assign",e.assignment=t,e.resolve=bSe,e}const N9="xstate.promise.resolve",D9="xstate.promise.reject",lw=new WeakMap;function Ht(t){return{config:t,transition:(n,r,i)=>{var s;if(n.status!=="active")return n;switch(r.type){case N9:{const o=r.data;return{...n,status:"done",output:o,input:void 0}}case D9:return{...n,status:"error",error:r.data,input:void 0};case P_:return(s=lw.get(i.self))==null||s.abort(),{...n,status:"stopped",input:void 0};default:return n}},start:(n,{self:r,system:i,emit:s})=>{if(n.status!=="active")return;const o=new AbortController;lw.set(r,o),Promise.resolve(t({input:n.input,system:i,self:r,signal:o.signal,emit:s})).then(l=>{r.getSnapshot().status==="active"&&(lw.delete(r),i._relay(r,r,{type:N9,data:l}))},l=>{r.getSnapshot().status==="active"&&(lw.delete(r),i._relay(r,r,{type:D9,data:l}))})},getInitialSnapshot:(n,r)=>({status:"active",output:void 0,error:void 0,input:r}),getPersistedSnapshot:n=>n,restoreSnapshot:n=>n}}const U9=new WeakMap;function VA(t,e,n){let r=U9.get(t);return r?e in r||(r[e]=n()):(r={[e]:n()},U9.set(t,r)),r[e]}const wSe={},l0=t=>typeof t=="string"?{type:t}:typeof t=="function"?"resolve"in t?{type:t.type}:{type:t.name}:t;class II{constructor(e,n){if(this.config=e,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=n._parent,this.key=n._key,this.machine=n._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(lY),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?k9(this.config.states,(r,i)=>new II(r,{_parent:this,_key:i,_machine:this.machine})):wSe,this.type==="compound"&&!this.config.initial)throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===!0?"shallow":this.config.history||!1,this.entry=md(this.config.entry).slice(),this.exit=md(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type==="final"||!this.parent?this.config.output:void 0,this.tags=md(e.tags).slice()}_initialize(){this.transitions=X_e(this),this.config.always&&(this.always=op(this.config.always).map(e=>ih(this,cY,e))),Object.keys(this.states).forEach(e=>{this.states[e]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(l0),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(l0),eventType:null})}:void 0,history:this.history,states:k9(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(l0)})),entry:this.entry.map(l0),exit:this.exit.map(l0),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return VA(this,"invoke",()=>md(this.config.invoke).map((e,n)=>{const{src:r,systemId:i}=e,s=e.id??R9(this.id,n),o=typeof r=="string"?r:`xstate.invoke.${R9(this.id,n)}`;return{...e,src:o,id:s,systemId:i,toJSON(){const{onDone:a,onError:l,...c}=e;return{...c,type:"xstate.invoke",src:o,id:s}}}}))}get on(){return VA(this,"on",()=>[...this.transitions].flatMap(([n,r])=>r.map(i=>[n,i])).reduce((n,[r,i])=>(n[r]=n[r]||[],n[r].push(i),n),{}))}get after(){return VA(this,"delayedTransitions",()=>q_e(this))}get initial(){return VA(this,"initial",()=>Y_e(this,this.config.initial))}next(e,n){const r=n.type,i=[];let s;const o=VA(this,`candidates-${r}`,()=>$_e(this,r));for(const a of o){const{guard:l}=a,c=e.context;let u=!1;try{u=!l||MI(l,c,n,e)}catch(d){const f=typeof l=="string"?l:typeof l=="object"?l.type:void 0;throw new Error(`Unable to evaluate guard ${f?`'${f}' `:""}in transition for event '${r}' in state node '${this.id}':
${d.message}`)}if(u){i.push(...a.actions),s=a;break}}return s?[s]:void 0}get events(){return VA(this,"events",()=>{const{states:e}=this,n=new Set(this.ownEvents);if(e)for(const r of Object.keys(e)){const i=e[r];if(i.states)for(const s of i.events)n.add(`${s}`)}return Array.from(n)})}get ownEvents(){const e=new Set([...this.transitions.keys()].filter(n=>this.transitions.get(n).some(r=>!(!r.target&&!r.actions.length&&!r.reenter))));return Array.from(e)}}const xSe="#";class OI{constructor(e,n){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||"(machine)",this.implementations={actors:(n==null?void 0:n.actors)??{},actions:(n==null?void 0:n.actions)??{},delays:(n==null?void 0:n.delays)??{},guards:(n==null?void 0:n.guards)??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new II(e,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(e){const{actions:n,guards:r,actors:i,delays:s}=this.implementations;return new OI(this.config,{actions:{...n,...e.actions},guards:{...r,...e.guards},actors:{...i,...e.actors},delays:{...s,...e.delays}})}resolveState(e){const n=dSe(this.root,e.value),r=L_(O_(this.root,n));return zx({_nodes:[...r],context:e.context||{},children:{},status:RI(r,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,n,r){return WT(e,n,r).snapshot}microstep(e,n,r){return WT(e,n,r).microstates}getTransitionData(e,n){return PI(this.root,e.value,e,n)||[]}getPreInitialState(e,n,r){const{context:i}=this.config,s=zx({context:typeof i!="function"&&i?i:{},_nodes:[this.root],children:{},status:"active"},this);return typeof i=="function"?cg(s,n,e,[An(({spawn:a,event:l,self:c})=>i({spawn:a,input:l.input,self:c}))],r):s}getInitialSnapshot(e,n){const r=dY(n),i=[],s=this.getPreInitialState(e,r,i),o=v5([{target:[...wY(this.root)],source:this.root,reenter:!0,actions:[],eventType:null,toJSON:null}],s,e,r,!0,i),{snapshot:a}=WT(o,r,e,i);return a}start(e){Object.values(e.children).forEach(n=>{n.getSnapshot().status==="active"&&n.start()})}getStateNodeById(e){const n=EI(e),r=n.slice(1),i=v2(n[0])?n[0].slice(xSe.length):n[0],s=this.idMap.get(i);if(!s)throw new Error(`Child state node '#${i}' does not exist on machine '${this.id}'`);return I_(s,r)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,n){return ySe(e,n)}restoreSnapshot(e,n){const r={},i=e.children;Object.keys(i).forEach(l=>{const c=i[l],u=c.snapshot,d=c.src,f=typeof d=="string"?TI(this,d):d;if(!f)return;const h=og(f,{id:l,parent:n.self,syncSnapshot:c.syncSnapshot,snapshot:u,src:d,systemId:c.systemId});r[l]=h});const s=zx({...e,children:r,_nodes:Array.from(L_(O_(this.root,e.value)))},this);let o=new Set;function a(l,c){if(!o.has(l)){o.add(l);for(let u in l){const d=l[u];if(d&&typeof d=="object"){if("xstate$$type"in d&&d.xstate$$type===BI){l[u]=c[d.id];continue}a(d,c)}}}}return a(s.context,r),s}}function CSe(t,e){return new OI(t,e)}function Rg({schemas:t,actors:e,actions:n,guards:r,delays:i}){return{createMachine:s=>CSe({...s,schemas:t},{actors:e,actions:n,guards:r,delays:i})}}var TY={exports:{}},BY={};/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var b2=P,_Se=aY;function SSe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ESe=typeof Object.is=="function"?Object.is:SSe,TSe=_Se.useSyncExternalStore,BSe=b2.useRef,MSe=b2.useEffect,kSe=b2.useMemo,RSe=b2.useDebugValue;BY.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var s=BSe(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=kSe(function(){function l(h){if(!c){if(c=!0,u=h,h=r(h),i!==void 0&&o.hasValue){var A=o.value;if(i(A,h))return d=A}return d=h}if(A=d,ESe(u,h))return A;var p=r(h);return i!==void 0&&i(A,p)?A:(u=h,d=p)}var c=!1,u,d,f=n===void 0?null:n;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,n,r,i]);var a=TSe(t,s[0],s[1]);return MSe(function(){o.hasValue=!0,o.value=a},[a]),RSe(a),a};TY.exports=BY;var PSe=TY.exports;const MY=(t,e)=>{e(t);const n=t.getSnapshot().children;n&&Object.values(n).forEach(r=>{MY(r,e)})};function kY(t){var r,i;const e=[];MY(t,s=>{e.push([s,s.getSnapshot()]),s.observers=new Set});const n=(i=(r=t.system).getSnapshot)==null?void 0:i.call(r);t.stop(),t.system._snapshot=n,e.forEach(([s,o])=>{s._processingStatus=0,s._snapshot=o})}function RY(t,e){let[[n,r],i]=P.useState(()=>{const s=og(t,e);return[t.config,s]});if(t.config!==n){const s=og(t,{...e,snapshot:r.getPersistedSnapshot({__unsafeAllowInlineActors:!0})});i([t.config,s]),r=s}return v_e(()=>{r.logic.implementations=t.implementations}),r}function LSe(t,e={},n){const r=RY(t,e);return P.useEffect(()=>{},[n]),P.useEffect(()=>(r.start(),()=>{kY(r)}),[r]),r}function ISe(t,e={}){const n=RY(t,e),r=P.useCallback(()=>n.getSnapshot(),[n]),i=P.useCallback(o=>{const{unsubscribe:a}=n.subscribe(o);return a},[n]),s=aY.useSyncExternalStore(i,r,r);return P.useEffect(()=>(n.start(),()=>{kY(n)}),[n]),[s,n.send,n]}function OSe(t,e){return t===e}function FI(t,e,n=OSe){const r=P.useCallback(o=>{if(!t)return()=>{};const{unsubscribe:a}=t.subscribe(o);return a},[t]),i=P.useCallback(()=>t==null?void 0:t.getSnapshot(),[t]);return PSe.useSyncExternalStoreWithSelector(r,i,i,e,n)}function FSe(t,e){const n=P.createContext(null),r=n.Provider;function i({children:a,logic:l=t,machine:c,options:u}){if(c)throw new Error('The "machine" prop has been deprecated. Please use "logic" instead.');const d=LSe(l,{...e,...u});return P.createElement(r,{value:d,children:a})}i.displayName="ActorProvider";function s(){const a=P.useContext(n);if(!a)throw new Error(`You used a hook from "${i.displayName}" but it's not inside a <${i.displayName}> component.`);return a}function o(a,l){const c=s();return FI(c,a,l)}return{Provider:i,useActorRef:s,useSelector:o}}function Ly(t,e={}){return ISe(t,e)}/**
 * @remix-run/router v1.19.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
 */function xr(){return xr=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},xr.apply(this,arguments)}var oi;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(oi||(oi={}));const H9="popstate";function NSe(t){t===void 0&&(t={});function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return ug("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:ff(i)}return PY(e,n,null,t)}function DSe(t){t===void 0&&(t={});function e(i,s){let{pathname:o="/",search:a="",hash:l=""}=yu(i.location.hash.substr(1));return!o.startsWith("/")&&!o.startsWith(".")&&(o="/"+o),ug("",{pathname:o,search:a,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(i,s){let o=i.document.querySelector("base"),a="";if(o&&o.getAttribute("href")){let l=i.location.href,c=l.indexOf("#");a=c===-1?l:l.slice(0,c)}return a+"#"+(typeof s=="string"?s:ff(s))}function r(i,s){$h(i.pathname.charAt(0)==="/","relative pathnames are not supported in hash history.push("+JSON.stringify(s)+")")}return PY(e,n,r,t)}function dn(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function $h(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function USe(){return Math.random().toString(36).substr(2,8)}function j9(t,e){return{usr:t.state,key:t.key,idx:e}}function ug(t,e,n,r){return n===void 0&&(n=null),xr({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?yu(e):e,{state:n,key:e&&e.key||r||USe()})}function ff(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function yu(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function PY(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a=oi.Pop,l=null,c=u();c==null&&(c=0,o.replaceState(xr({},o.state,{idx:c}),""));function u(){return(o.state||{idx:null}).idx}function d(){a=oi.Pop;let m=u(),g=m==null?null:m-c;c=m,l&&l({action:a,location:p.location,delta:g})}function f(m,g){a=oi.Push;let y=ug(p.location,m,g);n&&n(y,m),c=u()+1;let w=j9(y,c),v=p.createHref(y);try{o.pushState(w,"",v)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;i.location.assign(v)}s&&l&&l({action:a,location:p.location,delta:1})}function h(m,g){a=oi.Replace;let y=ug(p.location,m,g);n&&n(y,m),c=u();let w=j9(y,c),v=p.createHref(y);o.replaceState(w,"",v),s&&l&&l({action:a,location:p.location,delta:0})}function A(m){let g=i.location.origin!=="null"?i.location.origin:i.location.href,y=typeof m=="string"?m:ff(m);return y=y.replace(/ $/,"%20"),dn(g,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,g)}let p={get action(){return a},get location(){return t(i,o)},listen(m){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(H9,d),l=m,()=>{i.removeEventListener(H9,d),l=null}},createHref(m){return e(i,m)},createURL:A,encodeLocation(m){let g=A(m);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:h,go(m){return o.go(m)}};return p}var Yn;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Yn||(Yn={}));const HSe=new Set(["lazy","caseSensitive","path","id","index","children"]);function jSe(t){return t.index===!0}function Iy(t,e,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),t.map((i,s)=>{let o=[...n,String(s)],a=typeof i.id=="string"?i.id:o.join("-");if(dn(i.index!==!0||!i.children,"Cannot specify children on an index route"),dn(!r[a],'Found a route id collision on id "'+a+`".  Route id's must be globally unique within Data Router usages`),jSe(i)){let l=xr({},i,e(i),{id:a});return r[a]=l,l}else{let l=xr({},i,e(i),{id:a,children:void 0});return r[a]=l,i.children&&(l.children=Iy(i.children,e,o,r)),l}})}function sh(t,e,n){return n===void 0&&(n="/"),Vx(t,e,n,!1)}function Vx(t,e,n,r){let i=typeof e=="string"?yu(e):e,s=Pg(i.pathname||"/",n);if(s==null)return null;let o=LY(t);zSe(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=e2e(s);a=JSe(o[l],c,r)}return a}function QSe(t,e){let{route:n,pathname:r,params:i}=t;return{id:n.id,pathname:r,params:i,data:e[n.id],handle:n.handle}}function LY(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(s,o,a)=>{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(dn(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let c=Qc([r,l.relativePath]),u=n.concat(l);s.children&&s.children.length>0&&(dn(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),LY(s.children,e,u,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:XSe(c,s.index),routesMeta:u})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of IY(s.path))i(s,o,l)}),e}function IY(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=IY(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function zSe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:YSe(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const VSe=/^:[\w-]+$/,GSe=3,WSe=2,KSe=1,$Se=10,qSe=-2,Q9=t=>t==="*";function XSe(t,e){let n=t.split("/"),r=n.length;return n.some(Q9)&&(r+=qSe),e&&(r+=WSe),n.filter(i=>!Q9(i)).reduce((i,s)=>i+(VSe.test(s)?GSe:s===""?KSe:$Se),r)}function YSe(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 JSe(t,e,n){n===void 0&&(n=!1);let{routesMeta:r}=t,i={},s="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],c=a===r.length-1,u=s==="/"?e:e.slice(s.length)||"/",d=z9({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),f=l.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=z9({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:Qc([s,d.pathname]),pathnameBase:r2e(Qc([s,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(s=Qc([s,d.pathnameBase]))}return o}function z9(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=ZSe(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((c,u,d)=>{let{paramName:f,isOptional:h}=u;if(f==="*"){let p=a[d]||"";o=s.slice(0,s.length-p.length).replace(/(.)\/+$/,"$1")}const A=a[d];return h&&!A?c[f]=void 0:c[f]=(A||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:t}}function ZSe(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),$h(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function e2e(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return $h(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Pg(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 t2e(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?yu(t):t;return{pathname:n?n.startsWith("/")?n:n2e(n,e):e,search:i2e(r),hash:s2e(i)}}function n2e(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 KT(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 OY(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function NI(t,e){let n=OY(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function DI(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=yu(t):(i=xr({},t),dn(!i.pathname||!i.pathname.includes("?"),KT("?","pathname","search",i)),dn(!i.pathname||!i.pathname.includes("#"),KT("#","pathname","hash",i)),dn(!i.search||!i.search.includes("#"),KT("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let d=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}a=d>=0?e[d]:"/"}let l=t2e(i,a),c=o&&o!=="/"&&o.endsWith("/"),u=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const Qc=t=>t.join("/").replace(/\/\/+/g,"/"),r2e=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),i2e=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,s2e=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Oy=function(e,n){n===void 0&&(n=302);let r=n;typeof r=="number"?r={status:r}:typeof r.status>"u"&&(r.status=302);let i=new Headers(r.headers);return i.set("Location",e),new Response(null,xr({},r,{headers:i}))};class F_{constructor(e,n,r,i){i===void 0&&(i=!1),this.status=e,this.statusText=n||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function yv(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const FY=["post","put","patch","delete"],o2e=new Set(FY),a2e=["get",...FY],l2e=new Set(a2e),c2e=new Set([301,302,303,307,308]),u2e=new Set([307,308]),$T={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},d2e={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},c0={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},UI=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,f2e=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),NY="remix-router-transitions";function DY(t){const e=t.window?t.window:typeof window<"u"?window:void 0,n=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",r=!n;dn(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(t.mapRouteProperties)i=t.mapRouteProperties;else if(t.detectErrorBoundary){let ye=t.detectErrorBoundary;i=xe=>({hasErrorBoundary:ye(xe)})}else i=f2e;let s={},o=Iy(t.routes,i,void 0,s),a,l=t.basename||"/",c=t.unstable_dataStrategy||g2e,u=t.unstable_patchRoutesOnNavigation,d=xr({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),f=null,h=new Set,A=1e3,p=new Set,m=null,g=null,y=null,w=t.hydrationData!=null,v=sh(o,t.history.location,l),x=null;if(v==null&&!u){let ye=Is(404,{pathname:t.history.location.pathname}),{matches:xe,route:Ce}=Z9(o);v=xe,x={[Ce.id]:ye}}v&&!t.hydrationData&&tr(v,o,t.history.location.pathname).active&&(v=null);let C;if(v)if(v.some(ye=>ye.route.lazy))C=!1;else if(!v.some(ye=>ye.route.loader))C=!0;else if(d.v7_partialHydration){let ye=t.hydrationData?t.hydrationData.loaderData:null,xe=t.hydrationData?t.hydrationData.errors:null,Ce=N=>N.route.loader?typeof N.route.loader=="function"&&N.route.loader.hydrate===!0?!1:ye&&ye[N.route.id]!==void 0||xe&&xe[N.route.id]!==void 0:!0;if(xe){let N=v.findIndex(D=>xe[D.route.id]!==void 0);C=v.slice(0,N+1).every(Ce)}else C=v.every(Ce)}else C=t.hydrationData!=null;else if(C=!1,v=[],d.v7_partialHydration){let ye=tr(null,o,t.history.location.pathname);ye.active&&ye.matches&&(v=ye.matches)}let _,S={historyAction:t.history.action,location:t.history.location,matches:v,initialized:C,navigation:$T,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||x,fetchers:new Map,blockers:new Map},E=oi.Pop,T=!1,R,k=!1,B=new Map,M=null,F=!1,I=!1,z=[],Y=new Set,$=new Map,ee=0,W=-1,ne=new Map,Se=new Set,fe=new Map,ge=new Map,Oe=new Set,Fe=new Map,De=new Map,ke=new Map,Ge=!1;function Ve(){if(f=t.history.listen(ye=>{let{action:xe,location:Ce,delta:N}=ye;if(Ge){Ge=!1;return}$h(De.size===0||N!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs.  This can also happen if you are using createHashRouter and the user manually changes the URL.");let D=We({currentLocation:S.location,nextLocation:Ce,historyAction:xe});if(D&&N!=null){Ge=!0,t.history.go(N*-1),Me(D,{state:"blocked",location:Ce,proceed(){Me(D,{state:"proceeding",proceed:void 0,reset:void 0,location:Ce}),t.history.go(N)},reset(){let j=new Map(S.blockers);j.set(D,c0),O({blockers:j})}});return}return Z(xe,Ce)}),n){k2e(e,B);let ye=()=>R2e(e,B);e.addEventListener("pagehide",ye),M=()=>e.removeEventListener("pagehide",ye)}return S.initialized||Z(oi.Pop,S.location,{initialHydration:!0}),_}function q(){f&&f(),M&&M(),h.clear(),R&&R.abort(),S.fetchers.forEach((ye,xe)=>$e(xe)),S.blockers.forEach((ye,xe)=>Re(xe))}function Ue(ye){return h.add(ye),()=>h.delete(ye)}function O(ye,xe){xe===void 0&&(xe={}),S=xr({},S,ye);let Ce=[],N=[];d.v7_fetcherPersist&&S.fetchers.forEach((D,j)=>{D.state==="idle"&&(Oe.has(j)?N.push(j):Ce.push(j))}),[...h].forEach(D=>D(S,{deletedFetchers:N,unstable_viewTransitionOpts:xe.viewTransitionOpts,unstable_flushSync:xe.flushSync===!0})),d.v7_fetcherPersist&&(Ce.forEach(D=>S.fetchers.delete(D)),N.forEach(D=>$e(D)))}function ve(ye,xe,Ce){var N,D;let{flushSync:j}=Ce===void 0?{}:Ce,U=S.actionData!=null&&S.navigation.formMethod!=null&&Da(S.navigation.formMethod)&&S.navigation.state==="loading"&&((N=ye.state)==null?void 0:N._isRedirect)!==!0,G;xe.actionData?Object.keys(xe.actionData).length>0?G=xe.actionData:G=null:U?G=S.actionData:G=null;let L=xe.loaderData?Y9(S.loaderData,xe.loaderData,xe.matches||[],xe.errors):S.loaderData,Q=S.blockers;Q.size>0&&(Q=new Map(Q),Q.forEach((V,he)=>Q.set(he,c0)));let te=T===!0||S.navigation.formMethod!=null&&Da(S.navigation.formMethod)&&((D=ye.state)==null?void 0:D._isRedirect)!==!0;a&&(o=a,a=void 0),F||E===oi.Pop||(E===oi.Push?t.history.push(ye,ye.state):E===oi.Replace&&t.history.replace(ye,ye.state));let X;if(E===oi.Pop){let V=B.get(S.location.pathname);V&&V.has(ye.pathname)?X={currentLocation:S.location,nextLocation:ye}:B.has(ye.pathname)&&(X={currentLocation:ye,nextLocation:S.location})}else if(k){let V=B.get(S.location.pathname);V?V.add(ye.pathname):(V=new Set([ye.pathname]),B.set(S.location.pathname,V)),X={currentLocation:S.location,nextLocation:ye}}O(xr({},xe,{actionData:G,loaderData:L,historyAction:E,location:ye,initialized:!0,navigation:$T,revalidation:"idle",restoreScrollPosition:zt(ye,xe.matches||S.matches),preventScrollReset:te,blockers:Q}),{viewTransitionOpts:X,flushSync:j===!0}),E=oi.Pop,T=!1,k=!1,F=!1,I=!1,z=[]}async function Ae(ye,xe){if(typeof ye=="number"){t.history.go(ye);return}let Ce=b5(S.location,S.matches,l,d.v7_prependBasename,ye,d.v7_relativeSplatPath,xe==null?void 0:xe.fromRouteId,xe==null?void 0:xe.relative),{path:N,submission:D,error:j}=V9(d.v7_normalizeFormMethod,!1,Ce,xe),U=S.location,G=ug(S.location,N,xe&&xe.state);G=xr({},G,t.history.encodeLocation(G));let L=xe&&xe.replace!=null?xe.replace:void 0,Q=oi.Push;L===!0?Q=oi.Replace:L===!1||D!=null&&Da(D.formMethod)&&D.formAction===S.location.pathname+S.location.search&&(Q=oi.Replace);let te=xe&&"preventScrollReset"in xe?xe.preventScrollReset===!0:void 0,X=(xe&&xe.unstable_flushSync)===!0,V=We({currentLocation:U,nextLocation:G,historyAction:Q});if(V){Me(V,{state:"blocked",location:G,proceed(){Me(V,{state:"proceeding",proceed:void 0,reset:void 0,location:G}),Ae(ye,xe)},reset(){let he=new Map(S.blockers);he.set(V,c0),O({blockers:he})}});return}return await Z(Q,G,{submission:D,pendingError:j,preventScrollReset:te,replace:xe&&xe.replace,enableViewTransition:xe&&xe.unstable_viewTransition,flushSync:X})}function ae(){if(Le(),O({revalidation:"loading"}),S.navigation.state!=="submitting"){if(S.navigation.state==="idle"){Z(S.historyAction,S.location,{startUninterruptedRevalidation:!0});return}Z(E||S.historyAction,S.navigation.location,{overrideNavigation:S.navigation})}}async function Z(ye,xe,Ce){R&&R.abort(),R=null,E=ye,F=(Ce&&Ce.startUninterruptedRevalidation)===!0,Dt(S.location,S.matches),T=(Ce&&Ce.preventScrollReset)===!0,k=(Ce&&Ce.enableViewTransition)===!0;let N=a||o,D=Ce&&Ce.overrideNavigation,j=sh(N,xe,l),U=(Ce&&Ce.flushSync)===!0,G=tr(j,N,xe.pathname);if(G.active&&G.matches&&(j=G.matches),!j){let{error:_e,notFoundMatches:He,route:ze}=Je(xe.pathname);ve(xe,{matches:He,loaderData:{},errors:{[ze.id]:_e}},{flushSync:U});return}if(S.initialized&&!I&&C2e(S.location,xe)&&!(Ce&&Ce.submission&&Da(Ce.submission.formMethod))){ve(xe,{matches:j},{flushSync:U});return}R=new AbortController;let L=GA(t.history,xe,R.signal,Ce&&Ce.submission),Q;if(Ce&&Ce.pendingError)Q=[Lp(j).route.id,{type:Yn.error,error:Ce.pendingError}];else if(Ce&&Ce.submission&&Da(Ce.submission.formMethod)){let _e=await pe(L,xe,Ce.submission,j,G.active,{replace:Ce.replace,flushSync:U});if(_e.shortCircuited)return;if(_e.pendingActionResult){let[He,ze]=_e.pendingActionResult;if(ko(ze)&&yv(ze.error)&&ze.error.status===404){R=null,ve(xe,{matches:_e.matches,loaderData:{},errors:{[He]:ze.error}});return}}j=_e.matches||j,Q=_e.pendingActionResult,D=qT(xe,Ce.submission),U=!1,G.active=!1,L=GA(t.history,L.url,L.signal)}let{shortCircuited:te,matches:X,loaderData:V,errors:he}=await J(L,xe,j,G.active,D,Ce&&Ce.submission,Ce&&Ce.fetcherSubmission,Ce&&Ce.replace,Ce&&Ce.initialHydration===!0,U,Q);te||(R=null,ve(xe,xr({matches:X||j},J9(Q),{loaderData:V,errors:he})))}async function pe(ye,xe,Ce,N,D,j){j===void 0&&(j={}),Le();let U=B2e(xe,Ce);if(O({navigation:U},{flushSync:j.flushSync===!0}),D){let Q=await wn(N,xe.pathname,ye.signal);if(Q.type==="aborted")return{shortCircuited:!0};if(Q.type==="error"){let{boundaryId:te,error:X}=ht(xe.pathname,Q);return{matches:Q.partialMatches,pendingActionResult:[te,{type:Yn.error,error:X}]}}else if(Q.matches)N=Q.matches;else{let{notFoundMatches:te,error:X,route:V}=Je(xe.pathname);return{matches:te,pendingActionResult:[V.id,{type:Yn.error,error:X}]}}}let G,L=j0(N,xe);if(!L.route.action&&!L.route.lazy)G={type:Yn.error,error:Is(405,{method:ye.method,pathname:xe.pathname,routeId:L.route.id})};else if(G=(await le("action",ye,[L],N))[0],ye.signal.aborted)return{shortCircuited:!0};if(gh(G)){let Q;return j&&j.replace!=null?Q=j.replace:Q=$9(G.response.headers.get("Location"),new URL(ye.url),l)===S.location.pathname+S.location.search,await ce(ye,G,{submission:Ce,replace:Q}),{shortCircuited:!0}}if(mh(G))throw Is(400,{type:"defer-action"});if(ko(G)){let Q=Lp(N,L.route.id);return(j&&j.replace)!==!0&&(E=oi.Push),{matches:N,pendingActionResult:[Q.route.id,G]}}return{matches:N,pendingActionResult:[L.route.id,G]}}async function J(ye,xe,Ce,N,D,j,U,G,L,Q,te){let X=D||qT(xe,j),V=j||U||rH(X),he=!F&&(!d.v7_partialHydration||!L);if(N){if(he){let Rt=H(te);O(xr({navigation:X},Rt!==void 0?{actionData:Rt}:{}),{flushSync:Q})}let xt=await wn(Ce,xe.pathname,ye.signal);if(xt.type==="aborted")return{shortCircuited:!0};if(xt.type==="error"){let{boundaryId:Rt,error:Ln}=ht(xe.pathname,xt);return{matches:xt.partialMatches,loaderData:{},errors:{[Rt]:Ln}}}else if(xt.matches)Ce=xt.matches;else{let{error:Rt,notFoundMatches:Ln,route:Wt}=Je(xe.pathname);return{matches:Ln,loaderData:{},errors:{[Wt.id]:Rt}}}}let _e=a||o,[He,ze]=G9(t.history,S,Ce,V,xe,d.v7_partialHydration&&L===!0,d.v7_skipActionErrorRevalidation,I,z,Y,Oe,fe,Se,_e,l,te);if(Gt(xt=>!(Ce&&Ce.some(Rt=>Rt.route.id===xt))||He&&He.some(Rt=>Rt.route.id===xt)),W=++ee,He.length===0&&ze.length===0){let xt=Mt();return ve(xe,xr({matches:Ce,loaderData:{},errors:te&&ko(te[1])?{[te[0]]:te[1].error}:null},J9(te),xt?{fetchers:new Map(S.fetchers)}:{}),{flushSync:Q}),{shortCircuited:!0}}if(he){let xt={};if(!N){xt.navigation=X;let Rt=H(te);Rt!==void 0&&(xt.actionData=Rt)}ze.length>0&&(xt.fetchers=oe(ze)),O(xt,{flushSync:Q})}ze.forEach(xt=>{$.has(xt.key)&&st(xt.key),xt.controller&&$.set(xt.key,xt.controller)});let lt=()=>ze.forEach(xt=>st(xt.key));R&&R.signal.addEventListener("abort",lt);let{loaderResults:rt,fetcherResults:ct}=await me(S.matches,Ce,He,ze,ye);if(ye.signal.aborted)return{shortCircuited:!0};R&&R.signal.removeEventListener("abort",lt),ze.forEach(xt=>$.delete(xt.key));let kt=eH([...rt,...ct]);if(kt){if(kt.idx>=He.length){let xt=ze[kt.idx-He.length].key;Se.add(xt)}return await ce(ye,kt.result,{replace:G}),{shortCircuited:!0}}let{loaderData:yt,errors:Ut}=X9(S,Ce,He,rt,te,ze,ct,Fe);Fe.forEach((xt,Rt)=>{xt.subscribe(Ln=>{(Ln||xt.done)&&Fe.delete(Rt)})}),d.v7_partialHydration&&L&&S.errors&&Object.entries(S.errors).filter(xt=>{let[Rt]=xt;return!He.some(Ln=>Ln.route.id===Rt)}).forEach(xt=>{let[Rt,Ln]=xt;Ut=Object.assign(Ut||{},{[Rt]:Ln})});let Pn=Mt(),Xt=K(W),Et=Pn||Xt||ze.length>0;return xr({matches:Ce,loaderData:yt,errors:Ut},Et?{fetchers:new Map(S.fetchers)}:{})}function H(ye){if(ye&&!ko(ye[1]))return{[ye[0]]:ye[1].data};if(S.actionData)return Object.keys(S.actionData).length===0?null:S.actionData}function oe(ye){return ye.forEach(xe=>{let Ce=S.fetchers.get(xe.key),N=u0(void 0,Ce?Ce.data:void 0);S.fetchers.set(xe.key,N)}),new Map(S.fetchers)}function we(ye,xe,Ce,N){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");$.has(ye)&&st(ye);let D=(N&&N.unstable_flushSync)===!0,j=a||o,U=b5(S.location,S.matches,l,d.v7_prependBasename,Ce,d.v7_relativeSplatPath,xe,N==null?void 0:N.relative),G=sh(j,U,l),L=tr(G,j,U);if(L.active&&L.matches&&(G=L.matches),!G){Pe(ye,xe,Is(404,{pathname:U}),{flushSync:D});return}let{path:Q,submission:te,error:X}=V9(d.v7_normalizeFormMethod,!0,U,N);if(X){Pe(ye,xe,X,{flushSync:D});return}let V=j0(G,Q);if(T=(N&&N.preventScrollReset)===!0,te&&Da(te.formMethod)){Ee(ye,xe,Q,V,G,L.active,D,te);return}fe.set(ye,{routeId:xe,path:Q}),re(ye,xe,Q,V,G,L.active,D,te)}async function Ee(ye,xe,Ce,N,D,j,U,G){Le(),fe.delete(ye);function L(Wt){if(!Wt.route.action&&!Wt.route.lazy){let jn=Is(405,{method:G.formMethod,pathname:Ce,routeId:xe});return Pe(ye,xe,jn,{flushSync:U}),!0}return!1}if(!j&&L(N))return;let Q=S.fetchers.get(ye);Te(ye,M2e(G,Q),{flushSync:U});let te=new AbortController,X=GA(t.history,Ce,te.signal,G);if(j){let Wt=await wn(D,Ce,X.signal);if(Wt.type==="aborted")return;if(Wt.type==="error"){let{error:jn}=ht(Ce,Wt);Pe(ye,xe,jn,{flushSync:U});return}else if(Wt.matches){if(D=Wt.matches,N=j0(D,Ce),L(N))return}else{Pe(ye,xe,Is(404,{pathname:Ce}),{flushSync:U});return}}$.set(ye,te);let V=ee,_e=(await le("action",X,[N],D))[0];if(X.signal.aborted){$.get(ye)===te&&$.delete(ye);return}if(d.v7_fetcherPersist&&Oe.has(ye)){if(gh(_e)||ko(_e)){Te(ye,Uu(void 0));return}}else{if(gh(_e))if($.delete(ye),W>V){Te(ye,Uu(void 0));return}else return Se.add(ye),Te(ye,u0(G)),ce(X,_e,{fetcherSubmission:G});if(ko(_e)){Pe(ye,xe,_e.error);return}}if(mh(_e))throw Is(400,{type:"defer-action"});let He=S.navigation.location||S.location,ze=GA(t.history,He,te.signal),lt=a||o,rt=S.navigation.state!=="idle"?sh(lt,S.navigation.location,l):S.matches;dn(rt,"Didn't find any matches after fetcher action");let ct=++ee;ne.set(ye,ct);let kt=u0(G,_e.data);S.fetchers.set(ye,kt);let[yt,Ut]=G9(t.history,S,rt,G,He,!1,d.v7_skipActionErrorRevalidation,I,z,Y,Oe,fe,Se,lt,l,[N.route.id,_e]);Ut.filter(Wt=>Wt.key!==ye).forEach(Wt=>{let jn=Wt.key,qo=S.fetchers.get(jn),Gn=u0(void 0,qo?qo.data:void 0);S.fetchers.set(jn,Gn),$.has(jn)&&st(jn),Wt.controller&&$.set(jn,Wt.controller)}),O({fetchers:new Map(S.fetchers)});let Pn=()=>Ut.forEach(Wt=>st(Wt.key));te.signal.addEventListener("abort",Pn);let{loaderResults:Xt,fetcherResults:Et}=await me(S.matches,rt,yt,Ut,ze);if(te.signal.aborted)return;te.signal.removeEventListener("abort",Pn),ne.delete(ye),$.delete(ye),Ut.forEach(Wt=>$.delete(Wt.key));let xt=eH([...Xt,...Et]);if(xt){if(xt.idx>=yt.length){let Wt=Ut[xt.idx-yt.length].key;Se.add(Wt)}return ce(ze,xt.result)}let{loaderData:Rt,errors:Ln}=X9(S,S.matches,yt,Xt,void 0,Ut,Et,Fe);if(S.fetchers.has(ye)){let Wt=Uu(_e.data);S.fetchers.set(ye,Wt)}K(ct),S.navigation.state==="loading"&&ct>W?(dn(E,"Expected pending action"),R&&R.abort(),ve(S.navigation.location,{matches:rt,loaderData:Rt,errors:Ln,fetchers:new Map(S.fetchers)})):(O({errors:Ln,loaderData:Y9(S.loaderData,Rt,rt,Ln),fetchers:new Map(S.fetchers)}),I=!1)}async function re(ye,xe,Ce,N,D,j,U,G){let L=S.fetchers.get(ye);Te(ye,u0(G,L?L.data:void 0),{flushSync:U});let Q=new AbortController,te=GA(t.history,Ce,Q.signal);if(j){let _e=await wn(D,Ce,te.signal);if(_e.type==="aborted")return;if(_e.type==="error"){let{error:He}=ht(Ce,_e);Pe(ye,xe,He,{flushSync:U});return}else if(_e.matches)D=_e.matches,N=j0(D,Ce);else{Pe(ye,xe,Is(404,{pathname:Ce}),{flushSync:U});return}}$.set(ye,Q);let X=ee,he=(await le("loader",te,[N],D))[0];if(mh(he)&&(he=await zY(he,te.signal,!0)||he),$.get(ye)===Q&&$.delete(ye),!te.signal.aborted){if(Oe.has(ye)){Te(ye,Uu(void 0));return}if(gh(he))if(W>X){Te(ye,Uu(void 0));return}else{Se.add(ye),await ce(te,he);return}if(ko(he)){Pe(ye,xe,he.error);return}dn(!mh(he),"Unhandled fetcher deferred data"),Te(ye,Uu(he.data))}}async function ce(ye,xe,Ce){let{submission:N,fetcherSubmission:D,replace:j}=Ce===void 0?{}:Ce;xe.response.headers.has("X-Remix-Revalidate")&&(I=!0);let U=xe.response.headers.get("Location");dn(U,"Expected a Location header on the redirect Response"),U=$9(U,new URL(ye.url),l);let G=ug(S.location,U,{_isRedirect:!0});if(n){let he=!1;if(xe.response.headers.has("X-Remix-Reload-Document"))he=!0;else if(UI.test(U)){const _e=t.history.createURL(U);he=_e.origin!==e.location.origin||Pg(_e.pathname,l)==null}if(he){j?e.location.replace(U):e.location.assign(U);return}}R=null;let L=j===!0||xe.response.headers.has("X-Remix-Replace")?oi.Replace:oi.Push,{formMethod:Q,formAction:te,formEncType:X}=S.navigation;!N&&!D&&Q&&te&&X&&(N=rH(S.navigation));let V=N||D;if(u2e.has(xe.response.status)&&V&&Da(V.formMethod))await Z(L,G,{submission:xr({},V,{formAction:U}),preventScrollReset:T});else{let he=qT(G,N);await Z(L,G,{overrideNavigation:he,fetcherSubmission:D,preventScrollReset:T})}}async function le(ye,xe,Ce,N){try{let D=await y2e(c,ye,xe,Ce,N,s,i);return await Promise.all(D.map((j,U)=>{if(S2e(j)){let G=j.result;return{type:Yn.redirect,response:w2e(G,xe,Ce[U].route.id,N,l,d.v7_relativeSplatPath)}}return b2e(j)}))}catch(D){return Ce.map(()=>({type:Yn.error,error:D}))}}async function me(ye,xe,Ce,N,D){let[j,...U]=await Promise.all([Ce.length?le("loader",D,Ce,xe):[],...N.map(G=>{if(G.matches&&G.match&&G.controller){let L=GA(t.history,G.path,G.controller.signal);return le("loader",L,[G.match],G.matches).then(Q=>Q[0])}else return Promise.resolve({type:Yn.error,error:Is(404,{pathname:G.path})})})]);return await Promise.all([nH(ye,Ce,j,j.map(()=>D.signal),!1,S.loaderData),nH(ye,N.map(G=>G.match),U,N.map(G=>G.controller?G.controller.signal:null),!0)]),{loaderResults:j,fetcherResults:U}}function Le(){I=!0,z.push(...Gt()),fe.forEach((ye,xe)=>{$.has(xe)&&(Y.add(xe),st(xe))})}function Te(ye,xe,Ce){Ce===void 0&&(Ce={}),S.fetchers.set(ye,xe),O({fetchers:new Map(S.fetchers)},{flushSync:(Ce&&Ce.flushSync)===!0})}function Pe(ye,xe,Ce,N){N===void 0&&(N={});let D=Lp(S.matches,xe);$e(ye),O({errors:{[D.route.id]:Ce},fetchers:new Map(S.fetchers)},{flushSync:(N&&N.flushSync)===!0})}function Qe(ye){return d.v7_fetcherPersist&&(ge.set(ye,(ge.get(ye)||0)+1),Oe.has(ye)&&Oe.delete(ye)),S.fetchers.get(ye)||d2e}function $e(ye){let xe=S.fetchers.get(ye);$.has(ye)&&!(xe&&xe.state==="loading"&&ne.has(ye))&&st(ye),fe.delete(ye),ne.delete(ye),Se.delete(ye),Oe.delete(ye),Y.delete(ye),S.fetchers.delete(ye)}function et(ye){if(d.v7_fetcherPersist){let xe=(ge.get(ye)||0)-1;xe<=0?(ge.delete(ye),Oe.add(ye)):ge.set(ye,xe)}else $e(ye);O({fetchers:new Map(S.fetchers)})}function st(ye){let xe=$.get(ye);dn(xe,"Expected fetch controller: "+ye),xe.abort(),$.delete(ye)}function dt(ye){for(let xe of ye){let Ce=Qe(xe),N=Uu(Ce.data);S.fetchers.set(xe,N)}}function Mt(){let ye=[],xe=!1;for(let Ce of Se){let N=S.fetchers.get(Ce);dn(N,"Expected fetcher: "+Ce),N.state==="loading"&&(Se.delete(Ce),ye.push(Ce),xe=!0)}return dt(ye),xe}function K(ye){let xe=[];for(let[Ce,N]of ne)if(N<ye){let D=S.fetchers.get(Ce);dn(D,"Expected fetcher: "+Ce),D.state==="loading"&&(st(Ce),ne.delete(Ce),xe.push(Ce))}return dt(xe),xe.length>0}function Be(ye,xe){let Ce=S.blockers.get(ye)||c0;return De.get(ye)!==xe&&De.set(ye,xe),Ce}function Re(ye){S.blockers.delete(ye),De.delete(ye)}function Me(ye,xe){let Ce=S.blockers.get(ye)||c0;dn(Ce.state==="unblocked"&&xe.state==="blocked"||Ce.state==="blocked"&&xe.state==="blocked"||Ce.state==="blocked"&&xe.state==="proceeding"||Ce.state==="blocked"&&xe.state==="unblocked"||Ce.state==="proceeding"&&xe.state==="unblocked","Invalid blocker state transition: "+Ce.state+" -> "+xe.state);let N=new Map(S.blockers);N.set(ye,xe),O({blockers:N})}function We(ye){let{currentLocation:xe,nextLocation:Ce,historyAction:N}=ye;if(De.size===0)return;De.size>1&&$h(!1,"A router only supports one blocker at a time");let D=Array.from(De.entries()),[j,U]=D[D.length-1],G=S.blockers.get(j);if(!(G&&G.state==="proceeding")&&U({currentLocation:xe,nextLocation:Ce,historyAction:N}))return j}function Je(ye){let xe=Is(404,{pathname:ye}),Ce=a||o,{matches:N,route:D}=Z9(Ce);return Gt(),{notFoundMatches:N,route:D,error:xe}}function ht(ye,xe){return{boundaryId:Lp(xe.partialMatches).route.id,error:Is(400,{type:"route-discovery",pathname:ye,message:xe.error!=null&&"message"in xe.error?xe.error:String(xe.error)})}}function Gt(ye){let xe=[];return Fe.forEach((Ce,N)=>{(!ye||ye(N))&&(Ce.cancel(),xe.push(N),Fe.delete(N))}),xe}function tn(ye,xe,Ce){if(m=ye,y=xe,g=Ce||null,!w&&S.navigation===$T){w=!0;let N=zt(S.location,S.matches);N!=null&&O({restoreScrollPosition:N})}return()=>{m=null,y=null,g=null}}function Ft(ye,xe){return g&&g(ye,xe.map(N=>QSe(N,S.loaderData)))||ye.key}function Dt(ye,xe){if(m&&y){let Ce=Ft(ye,xe);m[Ce]=y()}}function zt(ye,xe){if(m){let Ce=Ft(ye,xe),N=m[Ce];if(typeof N=="number")return N}return null}function tr(ye,xe,Ce){if(u){if(p.has(Ce))return{active:!1,matches:ye};if(ye){if(Object.keys(ye[0].params).length>0)return{active:!0,matches:Vx(xe,Ce,l,!0)}}else return{active:!0,matches:Vx(xe,Ce,l,!0)||[]}}return{active:!1,matches:null}}async function wn(ye,xe,Ce){let N=ye;for(;;){let D=a==null,j=a||o;try{await m2e(u,xe,N,j,s,i,ke,Ce)}catch(L){return{type:"error",error:L,partialMatches:N}}finally{D&&(o=[...o])}if(Ce.aborted)return{type:"aborted"};let U=sh(j,xe,l);if(U)return Vn(xe,p),{type:"success",matches:U};let G=Vx(j,xe,l,!0);if(!G||N.length===G.length&&N.every((L,Q)=>L.route.id===G[Q].route.id))return Vn(xe,p),{type:"success",matches:null};N=G}}function Vn(ye,xe){if(xe.size>=A){let Ce=xe.values().next().value;xe.delete(Ce)}xe.add(ye)}function kr(ye){s={},a=Iy(ye,i,void 0,s)}function ue(ye,xe){let Ce=a==null;HY(ye,xe,a||o,s,i),Ce&&(o=[...o],O({}))}return _={get basename(){return l},get future(){return d},get state(){return S},get routes(){return o},get window(){return e},initialize:Ve,subscribe:Ue,enableScrollRestoration:tn,navigate:Ae,fetch:we,revalidate:ae,createHref:ye=>t.history.createHref(ye),encodeLocation:ye=>t.history.encodeLocation(ye),getFetcher:Qe,deleteFetcher:et,dispose:q,getBlocker:Be,deleteBlocker:Re,patchRoutes:ue,_internalFetchControllers:$,_internalActiveDeferreds:Fe,_internalSetRoutes:kr},_}function h2e(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function b5(t,e,n,r,i,s,o,a){let l,c;if(o){l=[];for(let d of e)if(l.push(d),d.route.id===o){c=d;break}}else l=e,c=e[e.length-1];let u=DI(i||".",NI(l,s),Pg(t.pathname,n)||t.pathname,a==="path");return i==null&&(u.search=t.search,u.hash=t.hash),(i==null||i===""||i===".")&&c&&c.route.index&&!HI(u.search)&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r&&n!=="/"&&(u.pathname=u.pathname==="/"?n:Qc([n,u.pathname])),ff(u)}function V9(t,e,n,r){if(!r||!h2e(r))return{path:n};if(r.formMethod&&!T2e(r.formMethod))return{path:n,error:Is(405,{method:r.formMethod})};let i=()=>({path:n,error:Is(400,{type:"invalid-body"})}),s=r.formMethod||"get",o=t?s.toUpperCase():s.toLowerCase(),a=jY(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!Da(o))return i();let f=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((h,A)=>{let[p,m]=A;return""+h+p+"="+m+`
`},""):String(r.body);return{path:n,submission:{formMethod:o,formAction:a,formEncType:r.formEncType,formData:void 0,json:void 0,text:f}}}else if(r.formEncType==="application/json"){if(!Da(o))return i();try{let f=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:o,formAction:a,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch{return i()}}}dn(typeof FormData=="function","FormData is not available in this environment");let l,c;if(r.formData)l=w5(r.formData),c=r.formData;else if(r.body instanceof FormData)l=w5(r.body),c=r.body;else if(r.body instanceof URLSearchParams)l=r.body,c=q9(l);else if(r.body==null)l=new URLSearchParams,c=new FormData;else try{l=new URLSearchParams(r.body),c=q9(l)}catch{return i()}let u={formMethod:o,formAction:a,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(Da(u.formMethod))return{path:n,submission:u};let d=yu(n);return e&&d.search&&HI(d.search)&&l.append("index",""),d.search="?"+l,{path:ff(d),submission:u}}function A2e(t,e){let n=t;if(e){let r=t.findIndex(i=>i.route.id===e);r>=0&&(n=t.slice(0,r))}return n}function G9(t,e,n,r,i,s,o,a,l,c,u,d,f,h,A,p){let m=p?ko(p[1])?p[1].error:p[1].data:void 0,g=t.createURL(e.location),y=t.createURL(i),w=p&&ko(p[1])?p[0]:void 0,v=w?A2e(n,w):n,x=p?p[1].statusCode:void 0,C=o&&x&&x>=400,_=v.filter((E,T)=>{let{route:R}=E;if(R.lazy)return!0;if(R.loader==null)return!1;if(s)return typeof R.loader!="function"||R.loader.hydrate?!0:e.loaderData[R.id]===void 0&&(!e.errors||e.errors[R.id]===void 0);if(p2e(e.loaderData,e.matches[T],E)||l.some(M=>M===E.route.id))return!0;let k=e.matches[T],B=E;return W9(E,xr({currentUrl:g,currentParams:k.params,nextUrl:y,nextParams:B.params},r,{actionResult:m,actionStatus:x,defaultShouldRevalidate:C?!1:a||g.pathname+g.search===y.pathname+y.search||g.search!==y.search||UY(k,B)}))}),S=[];return d.forEach((E,T)=>{if(s||!n.some(F=>F.route.id===E.routeId)||u.has(T))return;let R=sh(h,E.path,A);if(!R){S.push({key:T,routeId:E.routeId,path:E.path,matches:null,match:null,controller:null});return}let k=e.fetchers.get(T),B=j0(R,E.path),M=!1;f.has(T)?M=!1:c.has(T)?(c.delete(T),M=!0):k&&k.state!=="idle"&&k.data===void 0?M=a:M=W9(B,xr({currentUrl:g,currentParams:e.matches[e.matches.length-1].params,nextUrl:y,nextParams:n[n.length-1].params},r,{actionResult:m,actionStatus:x,defaultShouldRevalidate:C?!1:a})),M&&S.push({key:T,routeId:E.routeId,path:E.path,matches:R,match:B,controller:new AbortController})}),[_,S]}function p2e(t,e,n){let r=!e||n.route.id!==e.route.id,i=t[n.route.id]===void 0;return r||i}function UY(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function W9(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}async function m2e(t,e,n,r,i,s,o,a){let l=[e,...n.map(c=>c.route.id)].join("-");try{let c=o.get(l);c||(c=t({path:e,matches:n,patch:(u,d)=>{a.aborted||HY(u,d,r,i,s)}}),o.set(l,c)),c&&_2e(c)&&await c}finally{o.delete(l)}}function HY(t,e,n,r,i){if(t){var s;let o=r[t];dn(o,"No route found to patch children into: routeId = "+t);let a=Iy(e,i,[t,"patch",String(((s=o.children)==null?void 0:s.length)||"0")],r);o.children?o.children.push(...a):o.children=a}else{let o=Iy(e,i,["patch",String(n.length||"0")],r);n.push(...o)}}async function K9(t,e,n){if(!t.lazy)return;let r=await t.lazy();if(!t.lazy)return;let i=n[t.id];dn(i,"No route found in manifest");let s={};for(let o in r){let l=i[o]!==void 0&&o!=="hasErrorBoundary";$h(!l,'Route "'+i.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!l&&!HSe.has(o)&&(s[o]=r[o])}Object.assign(i,s),Object.assign(i,xr({},e(i),{lazy:void 0}))}function g2e(t){return Promise.all(t.matches.map(e=>e.resolve()))}async function y2e(t,e,n,r,i,s,o,a){let l=r.reduce((d,f)=>d.add(f.route.id),new Set),c=new Set,u=await t({matches:i.map(d=>{let f=l.has(d.route.id);return xr({},d,{shouldLoad:f,resolve:A=>(c.add(d.route.id),f?v2e(e,n,d,s,o,A,a):Promise.resolve({type:Yn.data,result:void 0}))})}),request:n,params:i[0].params,context:a});return i.forEach(d=>dn(c.has(d.route.id),'`match.resolve()` was not called for route id "'+d.route.id+'". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.')),u.filter((d,f)=>l.has(i[f].route.id))}async function v2e(t,e,n,r,i,s,o){let a,l,c=u=>{let d,f=new Promise((p,m)=>d=m);l=()=>d(),e.signal.addEventListener("abort",l);let h=p=>typeof u!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+t+'" [routeId: '+n.route.id+"]"))):u({request:e,params:n.params,context:o},...p!==void 0?[p]:[]),A;return s?A=s(p=>h(p)):A=(async()=>{try{return{type:"data",result:await h()}}catch(p){return{type:"error",result:p}}})(),Promise.race([A,f])};try{let u=n.route[t];if(n.route.lazy)if(u){let d,[f]=await Promise.all([c(u).catch(h=>{d=h}),K9(n.route,i,r)]);if(d!==void 0)throw d;a=f}else if(await K9(n.route,i,r),u=n.route[t],u)a=await c(u);else if(t==="action"){let d=new URL(e.url),f=d.pathname+d.search;throw Is(405,{method:e.method,pathname:f,routeId:n.route.id})}else return{type:Yn.data,result:void 0};else if(u)a=await c(u);else{let d=new URL(e.url),f=d.pathname+d.search;throw Is(404,{pathname:f})}dn(a.result!==void 0,"You defined "+(t==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+t+"` ")+"function. Please return a value or `null`.")}catch(u){return{type:Yn.error,result:u}}finally{l&&e.signal.removeEventListener("abort",l)}return a}async function b2e(t){let{result:e,type:n}=t;if(QY(e)){let c;try{let u=e.headers.get("Content-Type");u&&/\bapplication\/json\b/.test(u)?e.body==null?c=null:c=await e.json():c=await e.text()}catch(u){return{type:Yn.error,error:u}}return n===Yn.error?{type:Yn.error,error:new F_(e.status,e.statusText,c),statusCode:e.status,headers:e.headers}:{type:Yn.data,data:c,statusCode:e.status,headers:e.headers}}if(n===Yn.error){if(tH(e)){var r;if(e.data instanceof Error){var i;return{type:Yn.error,error:e.data,statusCode:(i=e.init)==null?void 0:i.status}}e=new F_(((r=e.init)==null?void 0:r.status)||500,void 0,e.data)}return{type:Yn.error,error:e,statusCode:yv(e)?e.status:void 0}}if(E2e(e)){var s,o;return{type:Yn.deferred,deferredData:e,statusCode:(s=e.init)==null?void 0:s.status,headers:((o=e.init)==null?void 0:o.headers)&&new Headers(e.init.headers)}}if(tH(e)){var a,l;return{type:Yn.data,data:e.data,statusCode:(a=e.init)==null?void 0:a.status,headers:(l=e.init)!=null&&l.headers?new Headers(e.init.headers):void 0}}return{type:Yn.data,data:e}}function w2e(t,e,n,r,i,s){let o=t.headers.get("Location");if(dn(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!UI.test(o)){let a=r.slice(0,r.findIndex(l=>l.route.id===n)+1);o=b5(new URL(e.url),a,i,!0,o,s),t.headers.set("Location",o)}return t}function $9(t,e,n){if(UI.test(t)){let r=t,i=r.startsWith("//")?new URL(e.protocol+r):new URL(r),s=Pg(i.pathname,n)!=null;if(i.origin===e.origin&&s)return i.pathname+i.search+i.hash}return t}function GA(t,e,n,r){let i=t.createURL(jY(e)).toString(),s={signal:n};if(r&&Da(r.formMethod)){let{formMethod:o,formEncType:a}=r;s.method=o.toUpperCase(),a==="application/json"?(s.headers=new Headers({"Content-Type":a}),s.body=JSON.stringify(r.json)):a==="text/plain"?s.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?s.body=w5(r.formData):s.body=r.formData}return new Request(i,s)}function w5(t){let e=new URLSearchParams;for(let[n,r]of t.entries())e.append(n,typeof r=="string"?r:r.name);return e}function q9(t){let e=new FormData;for(let[n,r]of t.entries())e.append(n,r);return e}function x2e(t,e,n,r,i,s){let o={},a=null,l,c=!1,u={},d=r&&ko(r[1])?r[1].error:void 0;return n.forEach((f,h)=>{let A=e[h].route.id;if(dn(!gh(f),"Cannot handle redirect results in processLoaderData"),ko(f)){let p=f.error;d!==void 0&&(p=d,d=void 0),a=a||{};{let m=Lp(t,A);a[m.route.id]==null&&(a[m.route.id]=p)}o[A]=void 0,c||(c=!0,l=yv(f.error)?f.error.status:500),f.headers&&(u[A]=f.headers)}else mh(f)?(i.set(A,f.deferredData),o[A]=f.deferredData.data,f.statusCode!=null&&f.statusCode!==200&&!c&&(l=f.statusCode),f.headers&&(u[A]=f.headers)):(o[A]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(l=f.statusCode),f.headers&&(u[A]=f.headers))}),d!==void 0&&r&&(a={[r[0]]:d},o[r[0]]=void 0),{loaderData:o,errors:a,statusCode:l||200,loaderHeaders:u}}function X9(t,e,n,r,i,s,o,a){let{loaderData:l,errors:c}=x2e(e,n,r,i,a);for(let u=0;u<s.length;u++){let{key:d,match:f,controller:h}=s[u];dn(o!==void 0&&o[u]!==void 0,"Did not find corresponding fetcher result");let A=o[u];if(!(h&&h.signal.aborted))if(ko(A)){let p=Lp(t.matches,f==null?void 0:f.route.id);c&&c[p.route.id]||(c=xr({},c,{[p.route.id]:A.error})),t.fetchers.delete(d)}else if(gh(A))dn(!1,"Unhandled fetcher revalidation redirect");else if(mh(A))dn(!1,"Unhandled fetcher deferred data");else{let p=Uu(A.data);t.fetchers.set(d,p)}}return{loaderData:l,errors:c}}function Y9(t,e,n,r){let i=xr({},e);for(let s of n){let o=s.route.id;if(e.hasOwnProperty(o)?e[o]!==void 0&&(i[o]=e[o]):t[o]!==void 0&&s.route.loader&&(i[o]=t[o]),r&&r.hasOwnProperty(o))break}return i}function J9(t){return t?ko(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function Lp(t,e){return(e?t.slice(0,t.findIndex(r=>r.route.id===e)+1):[...t]).reverse().find(r=>r.route.hasErrorBoundary===!0)||t[0]}function Z9(t){let e=t.length===1?t[0]:t.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Is(t,e){let{pathname:n,routeId:r,method:i,type:s,message:o}=e===void 0?{}:e,a="Unknown Server Error",l="Unknown @remix-run/router error";return t===400?(a="Bad Request",s==="route-discovery"?l='Unable to match URL "'+n+'" - the `unstable_patchRoutesOnNavigation()` '+(`function threw the following error:
`+o):i&&n&&r?l="You made a "+i+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":s==="defer-action"?l="defer() is not supported in actions":s==="invalid-body"&&(l="Unable to encode submission body")):t===403?(a="Forbidden",l='Route "'+r+'" does not match URL "'+n+'"'):t===404?(a="Not Found",l='No route matches URL "'+n+'"'):t===405&&(a="Method Not Allowed",i&&n&&r?l="You made a "+i.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":i&&(l='Invalid request method "'+i.toUpperCase()+'"')),new F_(t||500,a,new Error(l),!0)}function eH(t){for(let e=t.length-1;e>=0;e--){let n=t[e];if(gh(n))return{result:n,idx:e}}}function jY(t){let e=typeof t=="string"?yu(t):t;return ff(xr({},e,{hash:""}))}function C2e(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function _2e(t){return typeof t=="object"&&t!=null&&"then"in t}function S2e(t){return QY(t.result)&&c2e.has(t.result.status)}function mh(t){return t.type===Yn.deferred}function ko(t){return t.type===Yn.error}function gh(t){return(t&&t.type)===Yn.redirect}function tH(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function E2e(t){let e=t;return e&&typeof e=="object"&&typeof e.data=="object"&&typeof e.subscribe=="function"&&typeof e.cancel=="function"&&typeof e.resolveData=="function"}function QY(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function T2e(t){return l2e.has(t.toLowerCase())}function Da(t){return o2e.has(t.toLowerCase())}async function nH(t,e,n,r,i,s){for(let o=0;o<n.length;o++){let a=n[o],l=e[o];if(!l)continue;let c=t.find(d=>d.route.id===l.route.id),u=c!=null&&!UY(c,l)&&(s&&s[l.route.id])!==void 0;if(mh(a)&&(i||u)){let d=r[o];dn(d,"Expected an AbortSignal for revalidating fetcher deferred result"),await zY(a,d,i).then(f=>{f&&(n[o]=f||n[o])})}}}async function zY(t,e,n){if(n===void 0&&(n=!1),!await t.deferredData.resolveData(e)){if(n)try{return{type:Yn.data,data:t.deferredData.unwrappedData}}catch(i){return{type:Yn.error,error:i}}return{type:Yn.data,data:t.deferredData.data}}}function HI(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function j0(t,e){let n=typeof e=="string"?yu(e).search:e.search;if(t[t.length-1].route.index&&HI(n||""))return t[t.length-1];let r=OY(t);return r[r.length-1]}function rH(t){let{formMethod:e,formAction:n,formEncType:r,text:i,formData:s,json:o}=t;if(!(!e||!n||!r)){if(i!=null)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(s!=null)return{formMethod:e,formAction:n,formEncType:r,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function qT(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function B2e(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function u0(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function M2e(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function Uu(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function k2e(t,e){try{let n=t.sessionStorage.getItem(NY);if(n){let r=JSON.parse(n);for(let[i,s]of Object.entries(r||{}))s&&Array.isArray(s)&&e.set(i,new Set(s||[]))}}catch{}}function R2e(t,e){if(e.size>0){let n={};for(let[r,i]of e)n[r]=[...i];try{t.sessionStorage.setItem(NY,JSON.stringify(n))}catch(r){$h(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
 * React Router v6.26.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
 */function N_(){return N_=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},N_.apply(this,arguments)}const w2=P.createContext(null),VY=P.createContext(null),uA=P.createContext(null),jI=P.createContext(null),Tf=P.createContext({outlet:null,matches:[],isDataRoute:!1}),GY=P.createContext(null);function P2e(t,e){let{relative:n}=e===void 0?{}:e;vv()||dn(!1);let{basename:r,navigator:i}=P.useContext(uA),{hash:s,pathname:o,search:a}=KY(t,{relative:n}),l=o;return r!=="/"&&(l=o==="/"?r:Qc([r,o])),i.createHref({pathname:l,search:a,hash:s})}function vv(){return P.useContext(jI)!=null}function Js(){return vv()||dn(!1),P.useContext(jI).location}function WY(t){P.useContext(uA).static||P.useLayoutEffect(t)}function Ui(){let{isDataRoute:t}=P.useContext(Tf);return t?V2e():L2e()}function L2e(){vv()||dn(!1);let t=P.useContext(w2),{basename:e,future:n,navigator:r}=P.useContext(uA),{matches:i}=P.useContext(Tf),{pathname:s}=Js(),o=JSON.stringify(NI(i,n.v7_relativeSplatPath)),a=P.useRef(!1);return WY(()=>{a.current=!0}),P.useCallback(function(c,u){if(u===void 0&&(u={}),!a.current)return;if(typeof c=="number"){r.go(c);return}let d=DI(c,JSON.parse(o),s,u.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Qc([e,d.pathname])),(u.replace?r.replace:r.push)(d,u.state,u)},[e,r,o,s,t])}const I2e=P.createContext(null);function O2e(t){let e=P.useContext(Tf).outlet;return e&&P.createElement(I2e.Provider,{value:t},e)}function KY(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=P.useContext(uA),{matches:i}=P.useContext(Tf),{pathname:s}=Js(),o=JSON.stringify(NI(i,r.v7_relativeSplatPath));return P.useMemo(()=>DI(t,JSON.parse(o),s,n==="path"),[t,o,s,n])}function F2e(t,e,n,r){vv()||dn(!1);let{navigator:i}=P.useContext(uA),{matches:s}=P.useContext(Tf),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=Js(),u;u=c;let d=u.pathname||"/",f=d;if(l!=="/"){let p=l.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(p.length).join("/")}let h=sh(t,{pathname:f});return j2e(h&&h.map(p=>Object.assign({},p,{params:Object.assign({},a,p.params),pathname:Qc([l,i.encodeLocation?i.encodeLocation(p.pathname).pathname:p.pathname]),pathnameBase:p.pathnameBase==="/"?l:Qc([l,i.encodeLocation?i.encodeLocation(p.pathnameBase).pathname:p.pathnameBase])})),s,n,r)}function N2e(){let t=qY(),e=yv(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return P.createElement(P.Fragment,null,P.createElement("h2",null,"Unexpected Application Error!"),P.createElement("h3",{style:{fontStyle:"italic"}},e),n?P.createElement("pre",{style:i},n):null,null)}const D2e=P.createElement(N2e,null);class U2e extends P.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?P.createElement(Tf.Provider,{value:this.props.routeContext},P.createElement(GY.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function H2e(t){let{routeContext:e,match:n,children:r}=t,i=P.useContext(w2);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),P.createElement(Tf.Provider,{value:e},r)}function j2e(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if(!n)return null;if(n.errors)t=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=(i=n)==null?void 0:i.errors;if(a!=null){let u=o.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);u>=0||dn(!1),o=o.slice(0,Math.min(o.length,u+1))}let l=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<o.length;u++){let d=o[u];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=u),d.route.id){let{loaderData:f,errors:h}=n,A=d.route.loader&&f[d.route.id]===void 0&&(!h||h[d.route.id]===void 0);if(d.route.lazy||A){l=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((u,d,f)=>{let h,A=!1,p=null,m=null;n&&(h=a&&d.route.id?a[d.route.id]:void 0,p=d.route.errorElement||D2e,l&&(c<0&&f===0?(A=!0,m=null):c===f&&(A=!0,m=d.route.hydrateFallbackElement||null)));let g=e.concat(o.slice(0,f+1)),y=()=>{let w;return h?w=p:A?w=m:d.route.Component?w=P.createElement(d.route.Component,null):d.route.element?w=d.route.element:w=u,P.createElement(H2e,{match:d,routeContext:{outlet:u,matches:g,isDataRoute:n!=null},children:w})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?P.createElement(U2e,{location:n.location,revalidation:n.revalidation,component:p,error:h,children:y(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):y()},null)}var $Y=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}($Y||{}),qh=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(qh||{});function Q2e(t){let e=P.useContext(w2);return e||dn(!1),e}function QI(t){let e=P.useContext(VY);return e||dn(!1),e}function z2e(t){let e=P.useContext(Tf);return e||dn(!1),e}function zI(t){let e=z2e(),n=e.matches[e.matches.length-1];return n.route.id||dn(!1),n.route.id}function VI(){let t=QI(qh.UseLoaderData),e=zI(qh.UseLoaderData);if(t.errors&&t.errors[e]!=null){console.error("You cannot `useLoaderData` in an errorElement (routeId: "+e+")");return}return t.loaderData[e]}function hf(t){return QI(qh.UseRouteLoaderData).loaderData[t]}function qY(){var t;let e=P.useContext(GY),n=QI(qh.UseRouteError),r=zI(qh.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function V2e(){let{router:t}=Q2e($Y.UseNavigateStable),e=zI(qh.UseNavigateStable),n=P.useRef(!1);return WY(()=>{n.current=!0}),P.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,N_({fromRouteId:e},s)))},[t,e])}function Gx(t){return O2e(t.context)}function G2e(t){let{basename:e="/",children:n=null,location:r,navigationType:i=oi.Pop,navigator:s,static:o=!1,future:a}=t;vv()&&dn(!1);let l=e.replace(/^\/*/,"/"),c=P.useMemo(()=>({basename:l,navigator:s,static:o,future:N_({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof r=="string"&&(r=yu(r));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:A="default"}=r,p=P.useMemo(()=>{let m=Pg(u,l);return m==null?null:{location:{pathname:m,search:d,hash:f,state:h,key:A},navigationType:i}},[l,u,d,f,h,A,i]);return p==null?null:P.createElement(uA.Provider,{value:c},P.createElement(jI.Provider,{children:n,value:p}))}new Promise(()=>{});function XY(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:P.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:P.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:P.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}/**
 * React Router DOM v6.26.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
 */function dg(){return dg=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},dg.apply(this,arguments)}function W2e(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function K2e(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function $2e(t,e){return t.button===0&&(!e||e==="_self")&&!K2e(t)}function x5(t){return t===void 0&&(t=""),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 q2e(t,e){let n=x5(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}const X2e=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],Y2e="6";try{window.__reactRouterVersion=Y2e}catch{}function J2e(t,e){return DY({basename:e==null?void 0:e.basename,future:dg({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:NSe({window:e==null?void 0:e.window}),hydrationData:(e==null?void 0:e.hydrationData)||YY(),routes:t,mapRouteProperties:XY,unstable_dataStrategy:e==null?void 0:e.unstable_dataStrategy,unstable_patchRoutesOnNavigation:e==null?void 0:e.unstable_patchRoutesOnNavigation,window:e==null?void 0:e.window}).initialize()}function Z2e(t,e){return DY({basename:e==null?void 0:e.basename,future:dg({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:DSe({window:e==null?void 0:e.window}),hydrationData:(e==null?void 0:e.hydrationData)||YY(),routes:t,mapRouteProperties:XY,unstable_dataStrategy:e==null?void 0:e.unstable_dataStrategy,unstable_patchRoutesOnNavigation:e==null?void 0:e.unstable_patchRoutesOnNavigation,window:e==null?void 0:e.window}).initialize()}function YY(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=dg({},e,{errors:eEe(e.errors)})),e}function eEe(t){if(!t)return null;let e=Object.entries(t),n={};for(let[r,i]of e)if(i&&i.__type==="RouteErrorResponse")n[r]=new F_(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let s=window[i.__subType];if(typeof s=="function")try{let o=new s(i.message);o.stack="",n[r]=o}catch{}}if(n[r]==null){let s=new Error(i.message);s.stack="",n[r]=s}}else n[r]=i;return n}const tEe=P.createContext({isTransitioning:!1}),nEe=P.createContext(new Map),rEe="startTransition",iH=hm[rEe],iEe="flushSync",sH=Xie[iEe];function sEe(t){iH?iH(t):t()}function d0(t){sH?sH(t):t()}class oEe{constructor(){this.status="pending",this.promise=new Promise((e,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function aEe(t){let{fallbackElement:e,router:n,future:r}=t,[i,s]=P.useState(n.state),[o,a]=P.useState(),[l,c]=P.useState({isTransitioning:!1}),[u,d]=P.useState(),[f,h]=P.useState(),[A,p]=P.useState(),m=P.useRef(new Map),{v7_startTransition:g}=r||{},y=P.useCallback(S=>{g?sEe(S):S()},[g]),w=P.useCallback((S,E)=>{let{deletedFetchers:T,unstable_flushSync:R,unstable_viewTransitionOpts:k}=E;T.forEach(M=>m.current.delete(M)),S.fetchers.forEach((M,F)=>{M.data!==void 0&&m.current.set(F,M.data)});let B=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!k||B){R?d0(()=>s(S)):y(()=>s(S));return}if(R){d0(()=>{f&&(u&&u.resolve(),f.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:k.currentLocation,nextLocation:k.nextLocation})});let M=n.window.document.startViewTransition(()=>{d0(()=>s(S))});M.finished.finally(()=>{d0(()=>{d(void 0),h(void 0),a(void 0),c({isTransitioning:!1})})}),d0(()=>h(M));return}f?(u&&u.resolve(),f.skipTransition(),p({state:S,currentLocation:k.currentLocation,nextLocation:k.nextLocation})):(a(S),c({isTransitioning:!0,flushSync:!1,currentLocation:k.currentLocation,nextLocation:k.nextLocation}))},[n.window,f,u,m,y]);P.useLayoutEffect(()=>n.subscribe(w),[n,w]),P.useEffect(()=>{l.isTransitioning&&!l.flushSync&&d(new oEe)},[l]),P.useEffect(()=>{if(u&&o&&n.window){let S=o,E=u.promise,T=n.window.document.startViewTransition(async()=>{y(()=>s(S)),await E});T.finished.finally(()=>{d(void 0),h(void 0),a(void 0),c({isTransitioning:!1})}),h(T)}},[y,o,u,n.window]),P.useEffect(()=>{u&&o&&i.location.key===o.location.key&&u.resolve()},[u,f,i.location,o]),P.useEffect(()=>{!l.isTransitioning&&A&&(a(A.state),c({isTransitioning:!0,flushSync:!1,currentLocation:A.currentLocation,nextLocation:A.nextLocation}),p(void 0))},[l.isTransitioning,A]),P.useEffect(()=>{},[]);let v=P.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:S=>n.navigate(S),push:(S,E,T)=>n.navigate(S,{state:E,preventScrollReset:T==null?void 0:T.preventScrollReset}),replace:(S,E,T)=>n.navigate(S,{replace:!0,state:E,preventScrollReset:T==null?void 0:T.preventScrollReset})}),[n]),x=n.basename||"/",C=P.useMemo(()=>({router:n,navigator:v,static:!1,basename:x}),[n,v,x]),_=P.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return P.createElement(P.Fragment,null,P.createElement(w2.Provider,{value:C},P.createElement(VY.Provider,{value:i},P.createElement(nEe.Provider,{value:m.current},P.createElement(tEe.Provider,{value:l},P.createElement(G2e,{basename:x,location:i.location,navigationType:i.historyAction,navigator:v,future:_},i.initialized||n.future.v7_partialHydration?P.createElement(lEe,{routes:n.routes,future:n.future,state:i}):e))))),null)}const lEe=P.memo(cEe);function cEe(t){let{routes:e,future:n,state:r}=t;return F2e(e,void 0,r,n)}const uEe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",dEe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Af=P.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:a,target:l,to:c,preventScrollReset:u,unstable_viewTransition:d}=e,f=W2e(e,X2e),{basename:h}=P.useContext(uA),A,p=!1;if(typeof c=="string"&&dEe.test(c)&&(A=c,uEe))try{let w=new URL(window.location.href),v=c.startsWith("//")?new URL(w.protocol+c):new URL(c),x=Pg(v.pathname,h);v.origin===w.origin&&x!=null?c=x+v.search+v.hash:p=!0}catch{}let m=P2e(c,{relative:i}),g=fEe(c,{replace:o,state:a,target:l,preventScrollReset:u,relative:i,unstable_viewTransition:d});function y(w){r&&r(w),w.defaultPrevented||g(w)}return P.createElement("a",dg({},f,{href:A||m,onClick:p||s?r:y,ref:n,target:l}))});var oH;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(oH||(oH={}));var aH;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(aH||(aH={}));function fEe(t,e){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a}=e===void 0?{}:e,l=Ui(),c=Js(),u=KY(t,{relative:o});return P.useCallback(d=>{if($2e(d,n)){d.preventDefault();let f=r!==void 0?r:ff(c)===ff(u);l(t,{replace:f,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a})}},[c,l,u,r,i,n,t,s,o,a])}function GI(t){let e=P.useRef(x5(t)),n=P.useRef(!1),r=Js(),i=P.useMemo(()=>q2e(r.search,n.current?null:e.current),[r.search]),s=Ui(),o=P.useCallback((a,l)=>{const c=x5(typeof a=="function"?a(i):a);n.current=!0,s("?"+c,l)},[s,i]);return[i,o]}const on={INDEX:"/",CAMERA:"/camera",STREAMING:"/streaming",EDITOR:"/editor",PARAMETRIC_MODELING:"/parametric-modeling",INTERACTIVE_NUMBERS:"/interactive-numbers",COMMAND_K:"/command-k",USER_MENU:"/user-menu",PROJECT_MENU:"/project-menu",EXPORT:"/export",MOVE:"/move",SKETCHING:"/sketching",FUTURE_WORK:"/future-work"};async function hEe(t,e){if(!e)return Promise.reject(new Error("New name for project cannot be empty"));try{await window.electron.stat(t)}catch(r){if(r==="ENOENT")return Promise.reject(new Error(`Path ${t} is not a directory`))}const n=window.electron.path.join(window.electron.path.dirname(t),e);try{return await window.electron.stat(n),Promise.reject(new Error(`Path ${n} already exists, cannot rename to an existing path`))}catch(r){if(r==="ENOENT")return await window.electron.rename(t,n),n}return Promise.reject(new Error("Unreachable"))}async function WI(t){var n,r,i,s;const e=((r=(n=t.settings)==null?void 0:n.app)==null?void 0:r.project_directory)||((s=(i=t.settings)==null?void 0:i.project)==null?void 0:s.directory);if(!e)return console.error("projectDir is falsey",t),Promise.reject(new Error("projectDir is falsey"));try{await window.electron.stat(e)}catch(o){o==="ENOENT"&&await window.electron.mkdir(e,{recursive:!0})}return e}async function JY(t,e,n){if(n||(n=await bv()),ie(n))return Promise.reject(n);const r=await WI(n);if(!t)return Promise.reject("Project name cannot be empty.");if(!r)return Promise.reject(new Error("mainDir is falsey"));const i=window.electron.path.join(r,t);try{await window.electron.stat(i)}catch(a){a==="ENOENT"&&await window.electron.mkdir(i,{recursive:!0})}const s=window.electron.path.join(i,ea);await window.electron.writeFile(s,e??"");const o=await window.electron.stat(s);return{path:i,name:t,children:null,default_file:s,metadata:o,kcl_file_count:1,directory_count:0}}async function KI(t){if(t===void 0&&(t=await bv()),ie(t))return Promise.reject(t);const e=await WI(t),n=[];if(!e)return Promise.reject(new Error("projectDir was falsey"));const r=await window.electron.readdir(e);for(let i of r){const s=window.electron.path.join(e,i);if(!await window.electron.statIsDirectory(s))continue;const a=await D_(s);a.kcl_file_count!==0&&n.push(a)}return n}const AEe=["stp","glb","fbxb","kcl"],pEe=t=>AEe.some(e=>t.endsWith("."+e)),ZY=async t=>{try{await window.electron.stat(t)}catch(o){if(o==="ENOENT")return Promise.reject(new Error(`Directory ${t} does not exist`))}if(!await window.electron.statIsDirectory(t))return Promise.reject(new Error(`Path ${t} is not a directory`));let r={name:window.electron.path.basename(t),path:t,children:[]};const i=[],s=await window.electron.readdir(t);s.sort((o,a)=>o.endsWith(".kcl")&&!a.endsWith(".kcl")?-1:!o.endsWith(".kcl")&&a.endsWith(".kcl")?1:0);for(let o of s){if(o.indexOf(".")===0)continue;const a=window.electron.path.join(t,o);if(await window.electron.statIsDirectory(a)){const c=await ZY(a);i.push(c)}else{if(!pEe(a))continue;i.push({name:o,path:a,children:null})}}return r.children=i,r};async function eJ(t,e){var i;if(!await window.electron.statIsDirectory(t))return Promise.reject(new Error(`Path ${t} is not a directory`));let r=window.electron.path.join(t,ea);try{await window.electron.stat(r)}catch(s){if(s==="ENOENT"&&e.children){for(let o of e.children){if(o.name.endsWith(".kcl"))return window.electron.path.join(t,o.name);if((((i=o.children)==null?void 0:i.length)??0)>0)return eJ(o.path,o)}return await window.electron.writeFile(r,""),r}}return e.children?r:e.name}const tJ=t=>{let e=0;if(t.children)for(let n of t.children)n.name.endsWith(".kcl")?e+=1:e+=tJ(n);return e},nJ=t=>{let e=0;if(t.children)for(let n of t.children)e+=1,nJ(n);return e};async function D_(t){try{await window.electron.stat(t)}catch(o){if(o==="ENOENT")return Promise.reject(new Error(`Project directory does not exist: ${t}`))}if(!await window.electron.statIsDirectory(t))return Promise.reject(new Error(`Project path is not a directory: ${t}`));let n=await ZY(t),r=await eJ(t,n);const i=await window.electron.stat(t);let s={...n,metadata:{modified:i.mtimeMs,accessed:i.atimeMs,created:i.ctimeMs,type:null,size:i.size,permission:i.mode},kcl_file_count:0,directory_count:0,default_file:r};return s.kcl_file_count=tJ(s),s.directory_count=nJ(s),s}async function mEe(t,e){const n=await sJ(t);return ie(e)?Promise.reject(e):window.electron.writeFile(n,e)}const gEe="dev.zoo.modeling-app",rJ=()=>window.electron.os.isMac||window.electron.os.isWindows?gEe:window.electron.packageJson.name,$I=async()=>{const t=window.electron.process.env.IS_PLAYWRIGHT==="true",e=window.electron.process.env.TEST_SETTINGS_FILE_KEY,n=await window.electron.getPath("appData"),r=t?e:window.electron.path.join(n,rJ());try{await window.electron.stat(r)}catch(i){i==="ENOENT"&&await window.electron.mkdir(r,{recursive:!0})}return window.electron.path.join(r,Bbe)},iJ=async()=>{const t=window.electron.process.env.IS_PLAYWRIGHT==="true",e=window.electron.process.env.TEST_SETTINGS_FILE_KEY,n=await window.electron.getPath("appData"),r=t?e:window.electron.path.join(n,rJ());try{await window.electron.stat(r)}catch(i){i==="ENOENT"&&await window.electron.mkdir(r,{recursive:!0})}return window.electron.path.join(r,Mbe)},sJ=async t=>{try{await window.electron.stat(t)}catch(e){e==="ENOENT"&&await window.electron.mkdir(t,{recursive:!0})}return window.electron.path.join(t,jq)},oJ=async()=>{if(!window.electron)return"";const t=await window.electron.getPath("documents");return window.electron.path.join(t,Ebe)},yEe=async t=>{let e=await sJ(t);try{await window.electron.stat(e)}catch(i){if(i==="ENOENT")return{}}const n=await window.electron.readFile(e,{encoding:"utf-8"}),r=iI(n);return ie(r)?Promise.reject(r):r},bv=async()=>{var i,s,o,a,l,c;let t=await $I();const e={directory:await oJ()};if(window.electron.exists(t)){const u=await window.electron.readFile(t,{encoding:"utf-8"}),d=Dq(u);return ie(d)?Promise.reject(d):((s=(i=d.settings)==null?void 0:i.project)==null?void 0:s.directory)||((a=(o=d.settings)==null?void 0:o.app)==null?void 0:a.project_directory)?d:{...d,settings:{...d.settings,project:Object.assign({},(l=d.settings)==null?void 0:l.project,e)}}}const n=t5();return ie(n)?Promise.reject(n):{...n,settings:{...n.settings,project:Object.assign({},(c=n.settings)==null?void 0:c.project,e)}}},vEe=async t=>{const e=await $I();return ie(t)?Promise.reject(t):window.electron.writeFile(e,t)},bEe=async()=>{let t=await iJ();if(window.electron.exists(t)){const e=await window.electron.readFile(t,{encoding:"utf-8"});return e||""}return""},aJ=async t=>{const e=await iJ();return ie(t)?Promise.reject(t):window.electron.writeFile(e,t)},wEe=async(t,e)=>{try{return await window.electron.kittycad("users.get_user_self",{client:{token:t}})}catch(n){console.error(n)}return Promise.reject(new Error("unreachable"))},xEe={imperial:["in","ft","yd"],metric:["mm","cm","m"]},C5=Object.values(xEe).flatMap(t=>t),CEe={in:"Inches",ft:"Feet",yd:"Yards",mm:"Millimeters",cm:"Centimeters",m:"Meters"};function _Ee(t,e){return Object.values(e).includes(t)}const SEe={arc:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"arc",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.5 5C11.3284 5 12 4.32843 12 3.5C12 2.67157 11.3284 2 10.5 2C9.82349 2 9.25159 2.44785 9.06458 3.06324C8.24048 3.17471 7.44026 3.43234 6.7024 3.82649C5.68662 4.36911 4.82039 5.15374 4.18045 6.11089C3.54051 7.06805 3.14664 8.16818 3.03373 9.31385C2.92082 10.4595 3.09238 11.6153 3.53318 12.6789C3.97399 13.7424 4.67043 14.6809 5.56079 15.4112C6.45115 16.1414 7.50795 16.6409 8.63758 16.8655C9.7672 17.0901 10.9348 17.0327 12.037 16.6986C12.6805 16.5035 13.2901 16.2176 13.8482 15.8513C14.0453 15.9466 14.2664 16 14.5 16C15.3284 16 16 15.3284 16 14.5C16 13.6716 15.3284 13 14.5 13C13.6716 13 13 13.6716 13 14.5C13 14.7212 13.0479 14.9312 13.1338 15.1202C12.7013 15.3842 12.2355 15.5935 11.7468 15.7416C10.802 16.0281 9.80098 16.0772 8.83255 15.8847C7.86413 15.6922 6.95818 15.264 6.19496 14.638C5.43174 14.012 4.83479 13.2076 4.45698 12.296C4.07917 11.3844 3.93214 10.3938 4.02891 9.41193C4.12568 8.43002 4.46326 7.4871 5.01177 6.66669C5.56028 5.84628 6.3028 5.17369 7.17358 4.70853C7.77986 4.38466 8.43528 4.16831 9.11077 4.06676C9.33434 4.61422 9.87212 5 10.5 5ZM12.571 4.57608C12.8364 4.70157 13.0934 4.84685 13.3396 5.01126C13.5858 5.17563 13.8184 5.35726 14.0359 5.55431L14.7073 4.81315C14.4534 4.58326 14.1821 4.37137 13.895 4.17964C13.6078 3.98786 13.308 3.81837 12.9983 3.67198L12.571 4.57608ZM15.1537 6.9154C15.3046 7.16714 15.4375 7.43061 15.5508 7.704C15.6641 7.97734 15.7566 8.25751 15.8279 8.54215L16.7979 8.29903C16.7147 7.96691 16.6068 7.64002 16.4746 7.32112C16.3425 7.00216 16.1874 6.69476 16.0112 6.40105L15.1537 6.9154ZM16.0006 10.2944C15.9862 10.5875 15.9502 10.8803 15.8925 11.1705C15.8347 11.4607 15.7558 11.745 15.6569 12.0213L16.5983 12.3584C16.7138 12.036 16.8058 11.7043 16.8732 11.3657C16.9406 11.0271 16.9826 10.6855 16.9994 10.3435L16.0006 10.2944Z",fill:"currentColor"})}),angle:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"angle",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 14L10 14H5.00001H4.0495L4.58799 13.2168L7.33799 9.21675L10.088 5.21674L10.912 5.78326L8.45436 9.35807C9.07972 9.78751 9.54479 10.2461 9.87084 10.8329C10.2065 11.437 10.3723 12.1375 10.4598 13H15V14ZM9.45406 13C9.37153 12.2592 9.23025 11.739 8.99671 11.3186C8.7674 10.9059 8.42873 10.5535 7.88782 10.1821L5.95053 13L9.45406 13Z",fill:"currentColor"})}),arrowDown:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"arrow down",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 17.7071L9.64648 17.3535L6.14648 13.8535L6.85359 13.1464L9.50004 15.7929V2.99997H10.5V15.7929L13.1465 13.1464L13.8536 13.8535L10.3536 17.3535L10 17.7071Z",fill:"currentColor"})}),arrowLeft:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"arrow left",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.29291 10L2.64646 9.64645L6.14646 6.14645L6.85357 6.85356L4.20712 9.50001L17 9.50001V10.5L4.20712 10.5L6.85357 13.1465L6.14646 13.8536L2.64646 10.3536L2.29291 10Z",fill:"currentColor"})}),arrowRight:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"arrow right",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.7071 10L17.3536 10.3536L13.8536 13.8536L13.1464 13.1465L15.7929 10.5H3V9.50001H15.7929L13.1464 6.85356L13.8536 6.14645L17.3536 9.64645L17.7071 10Z",fill:"currentColor"})}),arrowRotateRight:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"arrow rotate right",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.5 7.59684L15.5 8.09684L15 8.09684L10.7931 8.09684L10.7931 7.09684L13.769 7.09684C13.3052 6.54751 12.7147 6.11526 12.0452 5.83941C11.2133 5.49662 10.2977 5.41109 9.41668 5.59387C8.53566 5.77666 7.72967 6.21935 7.10277 6.8648C6.47588 7.51025 6.05687 8.32881 5.89986 9.21478C5.74284 10.1008 5.85503 11.0134 6.22194 11.835C6.58884 12.6566 7.19361 13.3493 7.95816 13.8237C8.7227 14.2981 9.61192 14.5325 10.511 14.4964C11.41 14.4604 12.2776 14.1557 13.0018 13.6216L13.5953 14.4264C12.7103 15.0792 11.6499 15.4516 10.551 15.4956C9.45216 15.5397 8.36535 15.2533 7.4309 14.6734C6.49646 14.0936 5.75729 13.2469 5.30885 12.2428C4.86041 11.2386 4.7233 10.1231 4.9152 9.04027C5.10711 7.95742 5.61923 6.95696 6.38543 6.16808C7.15164 5.3792 8.13674 4.83812 9.21354 4.61472C10.2903 4.39132 11.4094 4.49586 12.4262 4.91483C13.2286 5.24545 13.9382 5.7599 14.5 6.41286L14.5 3.38998L15.5 3.38998L15.5 7.59684Z",fill:"currentColor"})}),arrowUp:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"arrow up",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 2.29288L10.3536 2.64643L13.8536 6.14643L13.1465 6.85354L10.5 4.20709V17H9.50004V4.20709L6.85359 6.85354L6.14648 6.14643L9.64648 2.64643L10 2.29288Z",fill:"currentColor"})}),booleanExclude:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"boolean exclude",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5H5V12H8.33325V15.3333H15.3333V8.33333H12V5ZM12 8.33333H8.33325V12H12V8.33333Z",fill:"currentColor"})}),booleanIntersect:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"boolean intersect",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 6H11V8H9H8V9V11H6V6ZM8 12H6H5V11V6V5H6H11H12V6V8H14H15V9V14V15H14H9H8V14V12ZM9 12V14H14V9H12V11V12H12H11H9Z",fill:"currentColor"})}),booleanSubtract:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"boolean subtract",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 6H11V11H6V6ZM5 5H6H11H12V6V8H15V15H7.99998V12H6H5V11V6V5Z",fill:"currentColor"})}),booleanUnion:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"boolean union",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5H5V12H8V15H15V8H12V5Z",fill:"currentColor"})}),bug:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"bug",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.8209 5.99884C10.6403 5.73962 10.3399 5.57001 10 5.57001C9.65984 5.57001 9.35936 5.73984 9.17871 5.99935C9.43724 5.95129 9.71142 5.92578 10.0012 5.92578C10.29 5.92578 10.5633 5.95111 10.8209 5.99884ZM10 4.57001C8.9459 4.57001 8.08227 5.38548 8.00554 6.41997C7.58916 6.65398 7.23724 6.95989 6.95014 7.31304L5.85355 6.21645L5.14645 6.92356L6.40931 8.18642C6.20774 8.62503 6.08043 9.09624 6.0278 9.57001H5V10.57H6.01946C6.06396 11.1581 6.1867 11.8173 6.4071 12.4558L5.14645 13.7165L5.85355 14.4236L6.8408 13.4363C7.46354 14.555 8.47307 15.4258 10.0012 15.4258C11.529 15.4258 12.5378 14.5554 13.16 13.4371L14.1464 14.4236L14.8536 13.7165L13.5934 12.4563C13.8136 11.8177 13.9362 11.1583 13.9806 10.57H15V9.57001H13.9722C13.9197 9.0961 13.7925 8.62474 13.5911 8.18602L14.8536 6.92356L14.1464 6.21645L13.0505 7.31239C12.7633 6.95894 12.4112 6.65285 11.9944 6.41883C11.9171 5.38488 11.0537 4.57001 10 4.57001ZM10.5 14.3801V8.57001H9.5V14.3796C8.72105 14.2298 8.15885 13.7245 7.7428 12.9999C7.22316 12.095 7 10.937 7 10.07C7 8.46381 8.04281 6.92578 10.0012 6.92578C11.9589 6.92578 13 8.4629 13 10.07C13 10.9373 12.7773 12.0954 12.2582 13.0003C11.8422 13.7254 11.2799 14.2309 10.5 14.3801Z",fill:"currentColor"})}),chat:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 14.5L15.2929 15.2071L14.0858 14H5C3.89543 14 3 13.1046 3 12V6C3 4.89543 3.89543 4 5 4H14C15.6569 4 17 5.34315 17 7V11.5V13V14.5ZM5 13H14.5L15 13.5L16 14.5V13.0858V13V11.5V7C16 5.89543 15.1046 5 14 5H5C4.44771 5 4 5.44772 4 6V12C4 12.5523 4.44772 13 5 13ZM7 10C7.55228 10 8 9.55228 8 9C8 8.44772 7.55228 8 7 8C6.44772 8 6 8.44772 6 9C6 9.55228 6.44772 10 7 10ZM11 9C11 9.55228 10.5523 10 10 10C9.44772 10 9 9.55228 9 9C9 8.44772 9.44772 8 10 8C10.5523 8 11 8.44772 11 9ZM13 10C13.5523 10 14 9.55228 14 9C14 8.44772 13.5523 8 13 8C12.4477 8 12 8.44772 12 9C12 9.55228 12.4477 10 13 10Z",fill:"currentColor"})}),checkmark:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"checkmark",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.29956 13.5388L13.9537 6L14.7537 6.6L8.75367 14.6L8.00012 14.6536L5 11.6536L5.70709 10.9465L8.29956 13.5388Z",fill:"currentColor"})}),caretDown:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"caret down",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 11.2929L6.35346 7.64642L5.64636 8.35354L9.64648 12.3536L10.3536 12.3536L14.3535 8.35353L13.6464 7.64643L10 11.2929Z",fill:"currentColor"})}),chamfer3d:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"chamfer 3d",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 6V5H7H9L15 11V13V14H14V15H13H6H5V14V7V6H6ZM13 14H6V7H8.58579L13 11.4142V14Z",fill:"currentColor"})}),circle:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"circle",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 4C9.21207 4 8.43186 4.15519 7.7039 4.45672C6.97595 4.75825 6.31451 5.20021 5.75736 5.75736C5.20021 6.31451 4.75825 6.97594 4.45672 7.7039C4.1552 8.43185 4 9.21207 4 10C4 10.7879 4.15519 11.5681 4.45672 12.2961C4.75825 13.0241 5.20021 13.6855 5.75736 14.2426C6.31451 14.7998 6.97594 15.2417 7.7039 15.5433C8.43185 15.8448 9.21207 16 10 16C10.7879 16 11.5681 15.8448 12.2961 15.5433C13.0241 15.2417 13.6855 14.7998 14.2426 14.2426C14.7998 13.6855 15.2417 13.0241 15.5433 12.2961C15.8448 11.5681 16 10.7879 16 10C16 9.21207 15.8448 8.43185 15.5433 7.7039C15.2417 6.97595 14.7998 6.31451 14.2426 5.75736C13.6855 5.20021 13.0241 4.75825 12.2961 4.45672C11.5681 4.15519 10.7879 4 10 4ZM7.32122 3.53284C8.1705 3.18106 9.08075 3 10 3C10.9193 3 11.8295 3.18106 12.6788 3.53284C13.5281 3.88463 14.2997 4.40024 14.9497 5.05025C15.5998 5.70026 16.1154 6.47194 16.4672 7.32122C16.8189 8.1705 17 9.08075 17 10C17 10.9193 16.8189 11.8295 16.4672 12.6788C16.1154 13.5281 15.5998 14.2997 14.9497 14.9497C14.2997 15.5998 13.5281 16.1154 12.6788 16.4672C11.8295 16.8189 10.9193 17 10 17C9.08074 17 8.17049 16.8189 7.32121 16.4672C6.47193 16.1154 5.70026 15.5998 5.05025 14.9497C4.40024 14.2997 3.88462 13.5281 3.53284 12.6788C3.18106 11.8295 3 10.9192 3 10C3 9.08074 3.18106 8.17049 3.53284 7.32121C3.88463 6.47193 4.40024 5.70026 5.05026 5.05025C5.70027 4.40024 6.47194 3.88462 7.32122 3.53284Z",fill:"currentColor"})}),clipboardCheckmark:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"clipboard checkmark",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.5 3H7L13 3L13.5 3V3.5V4.00001L15.5 4.00002L16 4.00002V4.50002V10.0351C15.6905 9.85609 15.3548 9.71733 15 9.62602V5.00002L13.5 5.00001V6.50001V7.00001L13 7.00001L7 7.00001L6.5 7.00001V6.50001V5.00001L5 5.00001V16H10.8773C11.2024 16.4055 11.6047 16.7463 12.062 17H4.5H4V16.5V4.50001V4.00001L4.5 4.00001L6.5 4.00001V3.5V3ZM15.938 17C15.9588 16.9885 15.9794 16.9768 16 16.9649V17H15.938ZM7.5 4V4.50001V6.00001L12.5 6.00001V4.50001V4L7.5 4ZM13 9H7V8H13V9ZM15.6855 11.5L13.2101 14.8005L12.2071 13.7975L11.5 14.5046L12.9107 15.9153L13.6642 15.8617L16.4855 12.1L15.6855 11.5Z",fill:"currentColor"})}),clipboardPlus:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"clipboard plus",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.5 3H7L13 3L13.5 3V3.5V4.00001L15.5 4.00002L16 4.00002V4.50002V10.0351C15.6905 9.85609 15.3548 9.71733 15 9.62602V5.00002L13.5 5.00001V6.50001V7.00001L13 7.00001L7 7.00001L6.5 7.00001V6.50001V5.00001L5 5.00001V16H10.8773C11.2024 16.4055 11.6047 16.7463 12.062 17H4.5H4V16.5V4.50001V4.00001L4.5 4.00001L6.5 4.00001V3.5V3ZM15.938 17C15.9588 16.9885 15.9794 16.9768 16 16.9649V17H15.938ZM7.5 4V4.50001V6.00001L12.5 6.00001V4.50001V4L7.5 4ZM13 9H7V8H13V9ZM13.5 11V13H11.5V14H13.5V16H14.5V14H16.5V13H14.5V11H13.5Z",fill:"currentColor"})}),close:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"close",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.2929 10L6.46448 7.17158L7.17158 6.46448L10 9.2929L12.8284 6.46448L13.5355 7.17158L10.7071 10L13.5355 12.8284L12.8284 13.5355L10 10.7071L7.17158 13.5355L6.46448 12.8284L9.2929 10Z",fill:"currentColor"})}),code:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"code",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.7071 5L7.77734 14.7794L8.73527 15.0663L11.665 5.28698L10.7071 5ZM2.35356 9.64644L5.85362 6.14644L6.56072 6.85355L3.41423 10L6.56072 13.1464L5.85362 13.8536L2.35356 10.3536L2 10L2.35356 9.64644ZM17.0607 9.64644L13.5607 6.14644L12.8536 6.85355L16 10L12.8536 13.1464L13.5607 13.8535L17.0607 10.3536L17.4142 10L17.0607 9.64644Z",fill:"currentColor"})}),dimension:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"dimension",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6455 3.6455L14 2V5.291L5.291 14H2L6 18V14.7052L14.7052 6H18L16.3526 4.35261L16.3546 4.35065L15.6475 3.64354L15.6455 3.6455Z",fill:"currentColor"})}),elephant:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 4C4.11929 4 3 5.11929 3 6.5V7C3 10.0376 5.46243 12.5 8.5 12.5H8.96482C9.46635 12.5 9.93469 12.2493 10.2129 11.8321L10.5173 11.3755C11.1396 12.0849 12.0423 12.5 13 12.5H13.75H15V14C15 14.2626 14.9483 14.5227 14.8478 14.7654C14.7472 15.008 14.5999 15.2285 14.4142 15.4142C14.2285 15.5999 14.008 15.7472 13.7654 15.8478C13.5227 15.9483 13.2626 16 13 16C12.7374 16 12.4773 15.9483 12.2346 15.8478C11.992 15.7472 11.7715 15.5999 11.5858 15.4142C11.4001 15.2285 11.2528 15.008 11.1522 14.7654C11.1164 14.6789 11.0868 14.5902 11.0635 14.5H11.8544C11.9168 14.6431 12.0056 14.7734 12.1161 14.8839C12.2322 15 12.37 15.092 12.5216 15.1548C12.6733 15.2177 12.8358 15.25 13 15.25C13.1642 15.25 13.3267 15.2177 13.4784 15.1548C13.63 15.092 13.7678 15 13.8839 14.8839C14 14.7678 14.092 14.63 14.1548 14.4784C14.2177 14.3267 14.25 14.1642 14.25 14V13H13.25V14C13.25 14.0328 13.2435 14.0653 13.231 14.0957C13.2184 14.126 13.2 14.1536 13.1768 14.1768C13.1536 14.2 13.126 14.2184 13.0957 14.231C13.0653 14.2435 13.0328 14.25 13 14.25C12.9672 14.25 12.9347 14.2435 12.9043 14.231C12.874 14.2184 12.8464 14.2 12.8232 14.1768C12.8 14.1536 12.7816 14.126 12.769 14.0957C12.7565 14.0653 12.75 14.0328 12.75 14V13.5H12.25H10.5H10V14C10 14.394 10.0776 14.7841 10.2284 15.1481C10.3791 15.512 10.6001 15.8427 10.8787 16.1213C11.1573 16.3999 11.488 16.6209 11.8519 16.7716C12.2159 16.9224 12.606 17 13 17C13.394 17 13.7841 16.9224 14.1481 16.7716C14.512 16.6209 14.8427 16.3999 15.1213 16.1213C15.3999 15.8427 15.6209 15.512 15.7716 15.1481C15.9224 14.7841 16 14.394 16 14V12.5H17V11.5H16V8.5C16 6.01472 13.9853 4 11.5 4H5.5ZM11.084 10.4746L10.9226 10.2326L9.42875 7.74275L8.57125 8.25725L9.90846 10.4859L9.38084 11.2773C9.28811 11.4164 9.13199 11.5 8.96482 11.5H8.5C6.01472 11.5 4 9.48528 4 7V6.5C4 5.67157 4.67157 5 5.5 5H11.5C13.433 5 15 6.567 15 8.5V11.5H13.75H13C12.2301 11.5 11.5111 11.1152 11.084 10.4746ZM13.5 8.5C13.5 9.05228 13.0523 9.5 12.5 9.5C11.9477 9.5 11.5 9.05228 11.5 8.5C11.5 7.94772 11.9477 7.5 12.5 7.5C13.0523 7.5 13.5 7.94772 13.5 8.5Z",fill:"currentColor"})}),equal:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"equal",children:b.jsx("path",{d:"M5 8.78V7H14.52V8.78H5ZM5 13.02V11.24H14.52V13.02H5Z",fill:"currentColor"})}),exclamationMark:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"exclamation mark",children:b.jsx("path",{d:"M9.76391 11.6597L9.3633 7.91112V5.00671H10.6224V7.91112L10.2217 11.6597H9.76391ZM9.99283 15.1221C9.60176 15.1221 9.32515 15.041 9.163 14.8788C9.01039 14.7167 8.93408 14.5116 8.93408 14.2636V14.0061C8.93408 13.7581 9.01039 13.553 9.163 13.3909C9.32515 13.2287 9.60176 13.1476 9.99283 13.1476C10.3839 13.1476 10.6557 13.2287 10.8084 13.3909C10.9705 13.553 11.0516 13.7581 11.0516 14.0061V14.2636C11.0516 14.5116 10.9705 14.7167 10.8084 14.8788C10.6557 15.041 10.3839 15.1221 9.99283 15.1221Z",fill:"currentColor"})}),exportFile:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"export file",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3H4.5H11H11.2071L11.3536 3.14645L15.8536 7.64646L16 7.7929V8.00001V11.3773C15.6992 11.1362 15.3628 10.9376 15 10.7908V8.50001H11H10.5V8.00001V4H5V16H9.79076C9.93763 16.3628 10.1362 16.6992 10.3773 17H4.5H4V16.5V3.5V3ZM11.5 4.70711L14.2929 7.50001H11.5V4.70711ZM16.3904 14.1877L14.3904 11.6877L13.6096 12.3124L14.9597 14H11V15H14.9597L13.6096 16.6877L14.3904 17.3124L16.3904 14.8124L16.6403 14.5L16.3904 14.1877Z",fill:"currentColor"})}),extrude:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"extrude",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 2.51583L10.3536 2.86938L12.3536 4.86938L11.6465 5.57649L10.5 4.43004V10.1012C11.0826 10.3071 11.5 10.8627 11.5 11.5158C11.5 12.3443 10.8284 13.0158 10 13.0158C9.17157 13.0158 8.5 12.3443 8.5 11.5158C8.5 10.8627 8.9174 10.3071 9.5 10.1012V4.43004L8.35356 5.57649L7.64645 4.86938L9.64645 2.86938L10 2.51583ZM3.95886 10.8441L8.5 8.06893V9.24088L4.91773 11.43L10 14.5359L15.0823 11.43L11.5 9.24087V8.06893L16.0411 10.8441L17 11.43L17 13.4842H16V12.0412L10.5 15.4023V17.4842H9.5V15.4023L4 12.0412V13.4842H3V11.43L3.95886 10.8441Z",fill:"currentColor"})}),fillet:b.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"fillet",children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 5H5V15H15V12C15 8.13401 11.866 5 8 5ZM5 4H4V5V15V16H5H15H16V15V12C16 7.58172 12.4183 4 8 4H5Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.5 3.5H5.5H8.5C12.9183 3.5 16.5 7.08172 16.5 11.5V14.5V15.5H16V12C16 7.58172 12.4182 4 7.99996 4H4.5V3.5Z",fill:"currentColor"})]}),fillet3d:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"fillet 3d",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 6V5H7H10C12.7614 5 15 7.23858 15 10V13V14H14V15H13H6H5V14V7V6H6ZM6 7H10C11.6569 7 13 8.34315 13 10V14H6V7Z",fill:"currentColor"})}),file:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"file",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3H4.5H11H11.2071L11.3536 3.14645L15.8536 7.64646L16 7.7929V8.00001V16.5V17H15.5H4.5H4V16.5V3.5V3ZM5 4V16H15V8.50001H11H10.5V8.00001V4H5ZM11.5 4.70711L14.2929 7.50001H11.5V4.70711Z",fill:"currentColor"})}),filePlus:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"file plus",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3H4.5H11H11.2071L11.3536 3.14645L15.8536 7.64646L16 7.7929V8.00001V11.3773C15.6992 11.1362 15.3628 10.9376 15 10.7908V8.50001H11H10.5V8.00001V4H5V16H9.79076C9.93763 16.3628 10.1362 16.6992 10.3773 17H4.5H4V16.5V3.5V3ZM11.5 4.70711L14.2929 7.50001H11.5V4.70711ZM13 12V14H11V15H13V17H14V15H16V14H14V12H13Z",fill:"currentColor"})}),floppyDiskArrow:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"floppy disk arrow",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 4H4.5L7 4L13 4L13.2071 4L13.3536 4.14645L15.8536 6.64645L16 6.79289V7V11.3773C15.6992 11.1362 15.3628 10.9376 15 10.7908V7.20711L13.5 5.70711V7V7.5L13 7.5L7 7.5L6.5 7.5V7V5L5 5V15H6.5V10V9.5H7H13H13.5V10V10.5C13.1547 10.5 12.8196 10.5438 12.5 10.626V10.5H7.5V15H9.53095C9.57451 15.3493 9.66311 15.6847 9.79076 16H7H4.5H4V15.5V4.5V4ZM7.5 5V6.5L12.5 6.5V5L7.5 5ZM16.3904 14.1877L14.3904 11.6877L13.6096 12.3123L14.9597 14H11V15H14.9597L13.6096 16.6877L14.3904 17.3123L16.3904 14.8123L16.6403 14.5L16.3904 14.1877Z",fill:"currentColor"})}),folder:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"folder",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.5 3.5H4H7H7.16667L7.3 3.6L9.16667 5H16H16.5V5.5V7.5V16V16.5H16H4H3.5V16V7.5V4V3.5ZM4.5 4.5V7H15.5V6H9H8.83333L8.7 5.9L6.83333 4.5H4.5ZM15.5 8H4.5V15.5H15.5V8Z",fill:"currentColor"})}),folderPlus:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"folder plus",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.5 3.5H4H7H7.16667L7.3 3.6L9.16667 5H16H16.5V5.5V7.5V10.3773C16.1992 10.1362 15.8628 9.93763 15.5 9.79076V8H4.5V15.5H10.5351C10.7529 15.8764 11.0302 16.2141 11.3542 16.5H4H3.5V16V7.5V4V3.5ZM4.5 4.5V7H15.5V6H9H8.83333L8.7 5.9L6.83333 4.5H4.5ZM13.5 11V13H11.5V14H13.5V16H14.5V14H16.5V13H14.5V11H13.5Z",fill:"currentColor"})}),gear:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"gear",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.61477 3.0884L5.87402 4.67077L6.50004 5.75505L5.25004 7.92011H4.0047V11.07H5.25004L6.50004 13.2351L5.86973 14.3268L8.62776 15.9191L9.24503 14.85H11.745L12.3647 15.9234L15.1416 14.3202L14.5151 13.2351L15.7651 11.07H16.9951V7.92011H15.7651L14.5151 5.75505L15.1373 4.67741L12.3778 3.08423L11.7451 4.18012H9.24508L8.61477 3.0884ZM10.4999 13C12.4329 13 13.9999 11.433 13.9999 9.50003C13.9999 7.56703 12.4329 6.00003 10.4999 6.00003C8.56687 6.00003 6.99986 7.56703 6.99986 9.50003C6.99986 11.433 8.56687 13 10.4999 13Z",fill:"currentColor"})}),hole:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"hole",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.44141 3.77773L5.86999 5.29277L12.7003 6.74461L13.0466 6.81819L15.0555 4.88135L15.7415 5.59773L13.6999 7.56607L13.6785 7.54375V7.95252V15.3589L15.0555 14.0313L15.7415 14.7477L13.6999 16.7161L13.6785 16.6938V16.7185L12.7003 16.5105L5.685 15.0194L4.70685 14.8115V13.8115V6.04554V5.04554L4.73466 5.05145L4.71383 5.02969L6.75542 3.06135L7.44141 3.77773ZM5.685 6.25345L12.7003 7.74461V15.5105L5.685 14.0194V6.25345ZM8.63431 8.91669C8.82484 10.2312 9.80376 11.448 11.0461 11.9188C10.8003 12.6735 10.064 13.1027 9.19383 12.9178C8.12261 12.6901 7.25421 11.6177 7.25421 10.5225C7.25421 9.62626 7.83586 8.9925 8.63431 8.91669ZM8.65548 7.88811C7.30121 7.8585 6.27606 8.85522 6.27606 10.3146C6.27606 11.9621 7.58239 13.5753 9.19383 13.9178C10.6117 14.2191 11.7933 13.4364 12.0568 12.1219C12.06 12.1058 12.0631 12.0896 12.066 12.0734C12.096 11.9083 12.1116 11.7352 12.1116 11.555C12.1116 9.90758 10.8053 8.29439 9.19383 7.95187C9.00991 7.91278 8.82997 7.89193 8.65548 7.88811Z",fill:"currentColor"})}),horizontal:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"horizontal",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 9.5H16V11.5H4V9.5Z",fill:"currentColor"})}),horizontalDash:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"horizontal Dash",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14 10.5H6V9.5H14V10.5Z",fill:"currentColor"})}),"intersection-offset":b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"intersection offset",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.8189 4.34932L4.21895 13.9493L3.51184 13.2422L13.1118 3.64221L13.8189 4.34932ZM7.17419 15.6636L6.48848 16.3493L5.78137 15.6422L6.46709 14.9564L7.17419 15.6636ZM9.57419 13.2636L8.20276 14.635L7.49566 13.9279L8.86709 12.5564L9.57419 13.2636ZM12.0932 13.0433C12.3807 12.8662 12.6223 12.6217 12.796 12.3319L15.8739 15.4098L15.1668 16.1169L12.0932 13.0433ZM14.3742 8.46355L13.0028 9.83498L12.2957 9.12787L13.6671 7.75644L14.3742 8.46355ZM16.0885 6.74927L15.4028 7.43498L14.6957 6.72787L15.3814 6.04216L16.0885 6.74927ZM10.9933 12.754C11.8217 12.754 12.4933 12.0825 12.4933 11.254C12.4933 10.4256 11.8217 9.75404 10.9933 9.75404C10.1649 9.75404 9.49329 10.4256 9.49329 11.254C9.49329 12.0825 10.1649 12.754 10.9933 12.754Z",fill:"currentColor"})}),kcl:b.jsx("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"kcl",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M40 0H0V40H40V0ZM7.34715 27.2143V15.6577L2.976 15.987V36.7949H7.34715V32.0645L8.00582 31.5256C8.24533 31.326 8.47487 31.1264 8.69442 30.9268L12.1075 36.7949H17.0475C16.1893 35.3978 15.311 33.9906 14.4128 32.5735C13.5346 31.1563 12.6664 29.7392 11.8081 28.3221L15.8499 24.9389C15.4308 24.4399 15.0017 23.931 14.5625 23.412L13.3051 21.8552L7.34715 27.2143ZM22.2581 26.6754C22.8769 25.9169 23.6753 25.5377 24.6533 25.5377C25.272 25.5377 25.8309 25.6175 26.3299 25.7772C26.8289 25.9169 27.4177 26.1465 28.0963 26.4658L29.3238 23.3521C28.5853 22.7933 27.7371 22.4041 26.779 22.1845C25.8409 21.9649 25.0625 21.8552 24.4437 21.8552C22.0885 21.8552 20.2223 22.5537 18.845 23.9509C17.4878 25.3281 16.8092 27.1944 16.8092 29.5496C16.8092 31.9048 17.4878 33.7611 18.845 35.1183C20.2223 36.4756 22.0885 37.1542 24.4437 37.1542C25.0625 37.1542 25.8509 37.0444 26.8089 36.8249C27.767 36.6053 28.6053 36.2161 29.3238 35.6572L28.0963 32.5435C27.4177 32.8629 26.8289 33.0924 26.3299 33.2321C25.8309 33.3718 25.272 33.4417 24.6533 33.4417C23.6753 33.4417 22.8769 33.0924 22.2581 32.3938C21.6594 31.6753 21.36 30.7272 21.36 29.5496C21.36 28.372 21.6594 27.4139 22.2581 26.6754ZM36.2796 36.7949V15.6577L31.9085 15.987V36.7949H36.2796Z",fill:"currentColor"})}),keyboard:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"keyboard",children:b.jsx("path",{d:"M16 12V15H13.5M16 12V9M16 12H13.5M4 12V15H6.5M4 12V9M4 12H6.5M4 9V6H6.5M4 9H6.5M16 9V6H13.5M16 9H13.5M6.5 12V15M6.5 12H7.5M6.5 15H13.5M13.5 15V12M13.5 12H12.5M7.5 12V9M7.5 12H10M7.5 9H8.75M7.5 9H6.5M10 12V9M10 12H12.5M10 9H11.25M10 9H8.75M12.5 12V9M12.5 9H13.5M12.5 9H11.25M13.5 9V6M13.5 6H11.25M11.25 9V6M11.25 6H8.75M8.75 9V6M8.75 6H6.5M6.5 9V6",stroke:"currentColor"})}),line:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"line",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.75 6.375C15.5784 6.375 16.25 5.70343 16.25 4.875C16.25 4.04657 15.5784 3.375 14.75 3.375C13.9216 3.375 13.25 4.04657 13.25 4.875C13.25 5.16584 13.3328 5.43736 13.4761 5.66726L5.88512 13.7657C5.69226 13.6754 5.47702 13.625 5.25 13.625C4.42157 13.625 3.75 14.2966 3.75 15.125C3.75 15.9534 4.42157 16.625 5.25 16.625C6.07843 16.625 6.75 15.9534 6.75 15.125C6.75 14.889 6.69549 14.6657 6.59837 14.467L14.26 6.29315C14.4136 6.34619 14.5784 6.375 14.75 6.375Z",fill:"currentColor"})}),link:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"link",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.5864 4.46513C11.9532 3.09829 14.1693 3.09829 15.5361 4.46513C16.903 5.83196 16.903 8.04804 15.5361 9.41488L13.5364 11.4147C13.5839 10.9639 13.5635 10.5074 13.4752 10.0616L14.829 8.70777C15.8053 7.73146 15.8053 6.14855 14.829 5.17224C13.8527 4.19592 12.2698 4.19592 11.2935 5.17224L9.17217 7.29356C8.19586 8.26987 8.19586 9.85278 9.17217 10.8291C9.53458 11.1915 9.98056 11.4194 10.4481 11.5127C10.3749 11.6902 10.2662 11.8565 10.122 12.0007L9.76392 12.3587C9.28973 12.1899 8.84465 11.9158 8.46507 11.5362C7.09823 10.1694 7.09823 7.95328 8.46507 6.58645L10.5864 4.46513ZM4.46507 10.5864L6.46488 8.58663C6.41734 9.03738 6.43772 9.49394 6.52601 9.93972L5.17217 11.2935C4.19586 12.2699 4.19586 13.8528 5.17217 14.8291C6.14849 15.8054 7.7314 15.8054 8.70771 14.8291L10.829 12.7078C11.8053 11.7315 11.8053 10.1485 10.829 9.17223C10.4666 8.80983 10.0207 8.58195 9.55314 8.48859C9.62635 8.31113 9.73506 8.14487 9.87926 8.00066L10.2373 7.64262C10.7115 7.81138 11.1566 8.08555 11.5361 8.46512C12.903 9.83196 12.903 12.048 11.5361 13.4149L9.41481 15.5362C8.04798 16.903 5.8319 16.903 4.46507 15.5362C3.09823 14.1694 3.09823 11.9533 4.46507 10.5864Z",fill:"currentColor"})}),lockClosed:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"lock closed",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 5.5C8.61929 5.5 7.5 6.61929 7.5 8V9H12.5V8C12.5 6.61929 11.3807 5.5 10 5.5ZM6.5 8V9H6H5V10V15V16H6H14H15V15V10V9H14H13.5V8C13.5 6.067 11.933 4.5 10 4.5C8.067 4.5 6.5 6.067 6.5 8ZM6 10V15H14V10H6ZM10.5 11V12.1338C10.7989 12.3067 11 12.6299 11 13C11 13.5523 10.5523 14 10 14C9.44772 14 9 13.5523 9 13C9 12.6299 9.2011 12.3067 9.5 12.1338V11H10.5Z",fill:"currentColor"})}),lockOpen:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"lock open",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 4.5C8.61929 4.5 7.5 5.61929 7.5 7H6.5C6.5 5.067 8.067 3.5 10 3.5C11.933 3.5 13.5 5.067 13.5 7V9H14H15V10V15V16H14H6H5V15V10V9H6H12.5V7C12.5 5.61929 11.3807 4.5 10 4.5ZM6 10V15H14V10H6ZM10.5 11V12.1338C10.7989 12.3067 11 12.6299 11 13C11 13.5523 10.5523 14 10 14C9.44772 14 9 13.5523 9 13C9 12.6299 9.2011 12.3067 9.5 12.1338V11H10.5Z",fill:"currentColor"})}),loft:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"loft",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.7954 6.22689C14.7749 5.73715 15 5.2456 15 5C15 4.7544 14.7749 4.26285 13.7954 3.77311C12.8758 3.31327 11.5353 3 10 3C8.46473 3 7.12424 3.31327 6.20457 3.77311C5.22509 4.26285 5 4.7544 5 5C5 5.2456 5.22509 5.73715 6.20457 6.22689C6.29872 6.27397 6.39728 6.3195 6.5 6.36333L6.5 7.43698C4.98593 6.89239 4 6.00376 4 5C4 3.34315 6.68629 2 10 2C13.3137 2 16 3.34315 16 5C16 6.00376 15.0141 6.89239 13.5 7.43698V6.36333C13.6027 6.3195 13.7013 6.27397 13.7954 6.22689ZM11.5 8.5531V9.72505L15.0823 11.9142L10 15.0201L4.91773 11.9142L8.5 9.72505V8.5531L3.95886 11.3282L3 11.9142V13.9683H4V12.5253L9.5 15.8864V17.9683H10.5V15.8864L16 12.5253V13.9683H17L17 11.9142L16.0411 11.3282L11.5 8.5531ZM10 4.29289L10.3536 4.64645L12.3536 6.64644L11.6465 7.35355L10.5 6.20711V10.5854C11.0826 10.7913 11.5 11.3469 11.5 12C11.5 12.8284 10.8284 13.5 10 13.5C9.17157 13.5 8.5 12.8284 8.5 12C8.5 11.3469 8.91741 10.7913 9.5 10.5854V6.20711L8.35356 7.35355L7.64645 6.64644L9.64645 4.64645L10 4.29289Z",fill:"currentColor"})}),logs:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"logs",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.5 15C6.5 14.1716 5.82843 13.5 5 13.5C4.17157 13.5 3.5 14.1716 3.5 15C3.5 15.8284 4.17157 16.5 5 16.5C5.82843 16.5 6.5 15.8284 6.5 15ZM6.5 10C6.5 9.17157 5.82843 8.5 5 8.5C4.17157 8.5 3.5 9.17157 3.5 10C3.5 10.8284 4.17157 11.5 5 11.5C5.82843 11.5 6.5 10.8284 6.5 10ZM5 3.5C5.82843 3.5 6.5 4.17157 6.5 5C6.5 5.82843 5.82843 6.5 5 6.5C4.17157 6.5 3.5 5.82843 3.5 5C3.5 4.17157 4.17157 3.5 5 3.5ZM8.5 5.5H16.5V4.5H8.5V5.5ZM8.5 10.5H16.5V9.5H8.5V10.5ZM16.5 15.5H8.5V14.5H16.5V15.5Z",fill:"currentColor"})}),"make-variable":b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"make variable",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.07178 6.57735L9.99998 3.1547L15.9282 6.57735V13.4227L9.99998 16.8453L4.07178 13.4227V6.57735ZM9.99998 2L16.9282 6V14L9.99998 18L3.07178 14V6L9.99998 2ZM9.45068 6.854C9.20802 6.798 8.97468 6.78867 8.75068 6.826C8.39602 6.90067 8.06468 7.04533 7.75668 7.26C7.73802 7.26933 7.72402 7.27867 7.71468 7.288C7.45335 7.484 7.24802 7.694 7.09868 7.918C6.96802 8.09533 6.86068 8.282 6.77668 8.478C6.69268 8.65533 6.63668 8.814 6.60868 8.954C6.60868 9.00067 6.62268 9.038 6.65068 9.066L6.69268 9.108H6.95868C7.13602 9.108 7.23402 9.09867 7.25268 9.08C7.28068 9.052 7.30868 8.982 7.33668 8.87C7.45802 8.52467 7.65402 8.212 7.92468 7.932C8.13002 7.72667 8.36802 7.58667 8.63868 7.512C8.83468 7.456 9.02602 7.456 9.21268 7.512C9.40868 7.57733 9.53002 7.68467 9.57668 7.834C9.62335 7.96467 9.61402 8.198 9.54868 8.534L8.77868 11.614C8.65735 11.9593 8.47535 12.216 8.23268 12.384C8.10202 12.4587 7.97602 12.4913 7.85468 12.482C7.68668 12.482 7.53735 12.4307 7.40668 12.328L7.36468 12.286L7.42068 12.272C7.50468 12.244 7.57002 12.216 7.61668 12.188C7.93402 12.02 8.10668 11.7493 8.13468 11.376C8.15335 11.1053 8.05535 10.9187 7.84068 10.816C7.60735 10.6853 7.34135 10.69 7.04268 10.83C6.73468 10.9793 6.54802 11.2547 6.48268 11.656C6.45468 11.8893 6.47335 12.1087 6.53868 12.314C6.56668 12.4073 6.60868 12.4913 6.66468 12.566C6.92602 12.986 7.32268 13.182 7.85468 13.154C8.31202 13.126 8.72268 12.8787 9.08668 12.412L9.12868 12.37L9.21268 12.496C9.44602 12.8133 9.80068 13.0233 10.2767 13.126C10.5474 13.1633 10.79 13.1633 11.0047 13.126C11.6954 12.9767 12.2507 12.58 12.6707 11.936C12.6894 11.9173 12.7034 11.894 12.7127 11.866C12.9553 11.474 13.0767 11.18 13.0767 10.984C13.0767 10.9373 13.0674 10.9047 13.0487 10.886C13.0207 10.8673 12.918 10.858 12.7407 10.858C12.61 10.858 12.526 10.8627 12.4887 10.872C12.442 10.8813 12.4047 10.9327 12.3767 11.026C12.2834 11.3807 12.092 11.7073 11.8027 12.006C11.56 12.23 11.3174 12.3793 11.0747 12.454C11.0094 12.4727 10.9067 12.482 10.7667 12.482C10.6174 12.482 10.5194 12.4727 10.4727 12.454C10.314 12.398 10.1974 12.3 10.1227 12.16C10.0667 12.0573 10.062 11.8613 10.1087 11.572C10.1087 11.5347 10.132 11.4367 10.1787 11.278C10.58 9.542 10.8274 8.55733 10.9207 8.324C11.0887 7.88533 11.3127 7.61467 11.5927 7.512C11.6114 7.50267 11.63 7.498 11.6487 7.498C11.8914 7.43267 12.0967 7.47467 12.2647 7.624L12.3207 7.68L12.2087 7.722C11.8354 7.85267 11.6207 8.128 11.5647 8.548C11.5367 8.76267 11.5927 8.94 11.7327 9.08C11.77 9.11733 11.8167 9.15 11.8727 9.178C12.1714 9.32733 12.4887 9.28067 12.8247 9.038C12.9367 8.954 13.03 8.83267 13.1047 8.674C13.282 8.26333 13.2774 7.87133 13.0907 7.498C12.9787 7.26467 12.7874 7.078 12.5167 6.938C12.162 6.77933 11.8074 6.76533 11.4527 6.896C11.1447 7.01733 10.8787 7.20867 10.6547 7.47L10.5707 7.582C10.552 7.582 10.524 7.554 10.4867 7.498C10.2627 7.17133 9.91735 6.95667 9.45068 6.854Z",fill:"currentColor"})}),menu:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"menu",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 6H5V5H15V6ZM15 10.5H5V9.5H15V10.5ZM5 15H15V14H5V15Z",fill:"currentColor"})}),mirror:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"mirror",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.41667 13.8333V17H10.4167V13.7738L12.5 14.5179L12.6682 14.047L12.8363 13.5761L10.4167 12.7119V7.28805L12.8363 6.42388L12.6682 5.95301L12.5 5.48214L10.4167 6.22619V3H9.41667V6.16667L4 4.23214L3 3.875V4.93686V15.0631V16.125L4 15.7679L9.41667 13.8333ZM9.41667 12.7715V7.22853L4 5.294V14.706L9.41667 12.7715ZM16.5 6.0625H17V4.93686V4.40593V3.875L16.5 4.05357L16 4.23214L14.5 4.76786L14.6682 5.23873L14.8363 5.7096L16 5.294V6.0625H16.5ZM16.5 7.8125H17V12.1875H16.5H16V7.8125H16.5ZM16.5 13.9375H17V15.0631V15.5941V16.125L16.5 15.9464L16 15.7679L14.5 15.2321L14.6682 14.7613L14.8363 14.2904L16 14.706V13.9375H16.5Z",fill:"currentColor"})}),move:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"move",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 2.29289L10.3536 2.64645L12.3536 4.64645L11.6465 5.35355L10.5 4.20711V8V9.50001H12L15.7929 9.50001L14.6465 8.35356L15.3536 7.64645L17.3536 9.64645L17.7071 10L17.3536 10.3536L15.3536 12.3536L14.6465 11.6465L15.7929 10.5H12H10.5V12V15.7929L11.6465 14.6464L12.3536 15.3536L10.3536 17.3536L10 17.7071L9.64645 17.3536L7.64645 15.3536L8.35356 14.6464L9.50001 15.7929V12V10.5H8.00001H4.20712L5.35357 11.6465L4.64646 12.3536L2.64646 10.3536L2.29291 10L2.64646 9.64645L4.64646 7.64645L5.35357 8.35356L4.20712 9.50001H8.00001H9.50001V8V4.20711L8.35356 5.35355L7.64645 4.64645L9.64645 2.64645L10 2.29289Z",fill:"currentColor"})}),network:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"network",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 9.64741C17.1925 8.24871 16.0344 7.08457 14.6399 6.26971C13.2455 5.45486 11.6628 5.01742 10.0478 5.00051C8.4328 4.9836 6.84127 5.38779 5.43006 6.17326C4.01884 6.95873 2.83666 8.09837 2 9.47985L2.76881 9.94546C3.52456 8.69756 4.59243 7.66813 5.86718 6.95862C7.14193 6.2491 8.57955 5.88399 10.0384 5.89927C11.4972 5.91455 12.9269 6.30968 14.1865 7.04574C15.4461 7.7818 16.4922 8.83337 17.2216 10.0968L18 9.64741ZM15.2155 11.0953C14.6772 10.1628 13.9051 9.3867 12.9755 8.84347C12.0459 8.30023 10.9907 8.00861 9.91406 7.99733C8.8374 7.98606 7.77638 8.25552 6.83557 8.77917C5.89476 9.30281 5.10664 10.0626 4.54887 10.9836L5.34391 11.4651C5.81802 10.6822 6.48792 10.0364 7.28761 9.59132C8.0873 9.14622 8.98916 8.91718 9.90432 8.92676C10.8195 8.93635 11.7164 9.18423 12.5065 9.64598C13.2967 10.1077 13.953 10.7674 14.4106 11.56L15.2155 11.0953ZM10 14C10.8284 14 11.5 13.3284 11.5 12.5C11.5 11.6716 10.8284 11 10 11C9.17157 11 8.5 11.6716 8.5 12.5C8.5 13.3284 9.17157 14 10 14Z",fill:"currentColor"})}),networkCrossedOut:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"network crossed out",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.35352 5.39647L14.253 15.296L14.9601 14.5889L5.06062 4.68936L4.35352 5.39647ZM12.5065 9.64599C11.9609 9.32713 11.3643 9.11025 10.746 9.00341L9.74058 7.99796C9.79835 7.99694 9.85618 7.99674 9.91406 7.99735C10.9907 8.00862 12.0459 8.30025 12.9755 8.84348C13.9051 9.38672 14.6772 10.1628 15.2155 11.0953L14.4106 11.56C13.953 10.7674 13.2967 10.1077 12.5065 9.64599ZM6.48788 8.98789L7.16295 9.66297C6.41824 10.1045 5.79317 10.7233 5.34391 11.4651L4.54887 10.9836C5.03646 10.1785 5.70009 9.49656 6.48788 8.98789ZM10.0384 5.89928C9.3134 5.89169 8.59366 5.97804 7.89655 6.15392L7.16867 5.42605C8.09637 5.13507 9.06776 4.99026 10.0478 5.00052C11.6628 5.01744 13.2455 5.45488 14.6399 6.26973C16.0344 7.08458 17.1925 8.24872 18 9.64742L17.2216 10.0968C16.4922 8.83338 15.4461 7.78181 14.1865 7.04575C12.9269 6.3097 11.4972 5.91456 10.0384 5.89928ZM5.00782 7.50783L4.36522 6.86524C3.42033 7.57557 2.61639 8.46208 2 9.47986L2.76881 9.94547C3.34775 8.98952 4.10986 8.16177 5.00782 7.50783ZM10 14C10.4142 14 10.7892 13.8321 11.0607 13.5607L8.93934 11.4394C8.66789 11.7108 8.5 12.0858 8.5 12.5C8.5 13.3284 9.17157 14 10 14Z",fill:"currentColor"})}),parallel:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"parallel",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 16V4H6V16H8ZM14 16V4H12V16H14Z",fill:"currentColor"})}),person:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"person",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 7.10457 11.1046 8 10 8C8.89543 8 8 7.10457 8 6C8 4.89543 8.89543 4 10 4C11.1046 4 12 4.89543 12 6ZM13 6C13 7.65685 11.6569 9 10 9C8.34315 9 7 7.65685 7 6C7 4.34315 8.34315 3 10 3C11.6569 3 13 4.34315 13 6ZM5 12V11L9 10H11L15 11V12C15 14.7614 12.7614 17 10 17C7.23858 17 5 14.7614 5 12ZM6 11.7808L9.12311 11H10.8769L14 11.7808V12C14 14.2091 12.2091 16 10 16C7.79086 16 6 14.2091 6 12V11.7808Z",fill:"currentColor"})}),plane:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"plane",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.92871 5.11391L4.43964 5.00995V4.10898V3.60898V3.10898L4.92871 3.21293L5.41778 3.31689L6.29907 3.50421V4.00421V4.50421L5.41778 4.31689V5.21786L4.92871 5.11391ZM11.8774 4.68991L8.1585 3.89945V4.39945V4.89945L11.8774 5.68991V5.18991V4.68991ZM13.7368 5.08515V5.58515V6.08515L14.6181 6.27247V7.17344L15.1071 7.2774L15.5962 7.38135V6.48038V5.98038V5.48038L15.1071 5.37643L14.6181 5.27247L13.7368 5.08515ZM15.5962 9.28233L15.1071 9.17837L14.6181 9.07441V12.8764L15.1071 12.9803L15.5962 13.0843V9.28233ZM15.5962 14.9852L15.1071 14.8813L14.6181 14.7773V15.6783L13.7368 15.491V15.991V16.491L14.6181 16.6783L15.1071 16.7823L15.5962 16.8862V16.3862V15.8862V14.9852ZM11.8774 16.0957V15.5957V15.0957L8.1585 14.3053V14.8053V15.3053L11.8774 16.0957ZM6.29907 14.91V14.41V13.91L5.41778 13.7227V12.8217L4.92871 12.7178L4.43964 12.6138V13.5148V14.0148V14.5148L4.92871 14.6188L5.41778 14.7227L6.29907 14.91ZM4.43964 10.7129L4.92871 10.8168L5.41778 10.9208V7.11883L4.92871 7.01488L4.43964 6.91092V10.7129Z",fill:"currentColor"})}),plus:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"plus",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.5 9.5V5.5H10.5V9.5H14.5V10.5H10.5V14.5H9.5V10.5H5.5V9.5H9.5Z",fill:"currentColor"})}),printer3d:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"3D printer",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16 5H4V7.5H7V7V6H8H9H10V7V7.5H16V5ZM17 7.5V8.5V15V16V17H16V16H15H14H6H5H4V17H3V16V15V8.5V7.5V5V4H4H16H17V5V7.5ZM4 8.5V15H5V13.5V13H5.5H14.5H15V13.5V15H16V8.5H10V9H9V10L8.5 10.5L8 10V9H7V8.5H4ZM14 14V15H6V14H14ZM8 7H9V8H8V7Z",fill:"currentColor"})}),polygon:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"polygon",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.99291 4.23607L4.03556 8.56434L6.31106 15.5676H13.6748L15.9503 8.56434L9.99291 4.23607ZM17.1258 8.18237L9.99291 3L2.85999 8.18237L5.58452 16.5676H14.4013L17.1258 8.18237Z",fill:"currentColor"})}),questionMark:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"question mark",children:b.jsx("path",{d:"M9.12005 11.9172V9.67093C9.94034 9.63278 10.5842 9.45632 11.0515 9.14156C11.5189 8.81725 11.7526 8.3308 11.7526 7.6822V7.48189C11.7526 6.94775 11.5905 6.54714 11.2662 6.28007C10.9514 6.013 10.5174 5.87946 9.96419 5.87946C9.39189 5.87946 8.93405 6.03685 8.59067 6.35161C8.2473 6.66637 8.00884 7.06698 7.8753 7.55343L6.80225 7.15282C6.89763 6.83806 7.03116 6.54237 7.20285 6.26576C7.37454 5.97962 7.58915 5.73162 7.84669 5.52178C8.11376 5.31194 8.42375 5.14502 8.77667 5.02102C9.13912 4.89702 9.54927 4.83502 10.0071 4.83502C10.4649 4.83502 10.8751 4.90179 11.2375 5.03533C11.6095 5.15932 11.9243 5.34055 12.1818 5.57901C12.4394 5.80793 12.6397 6.08931 12.7827 6.42315C12.9258 6.75699 12.9974 7.12898 12.9974 7.53912C12.9974 7.98742 12.9163 8.38326 12.7541 8.72664C12.592 9.06048 12.3821 9.34663 12.1246 9.58508C11.8671 9.82354 11.5714 10.0191 11.2375 10.1717C10.9132 10.3148 10.5842 10.4149 10.2503 10.4721V11.9172H9.12005ZM9.73527 15.1221C9.3442 15.1221 9.06759 15.041 8.90544 14.8788C8.75282 14.7167 8.67652 14.5116 8.67652 14.2636V14.0061C8.67652 13.7581 8.75282 13.553 8.90544 13.3909C9.06759 13.2287 9.3442 13.1476 9.73527 13.1476C10.1263 13.1476 10.3982 13.2287 10.5508 13.3909C10.7129 13.553 10.794 13.7581 10.794 14.0061V14.2636C10.794 14.5116 10.7129 14.7167 10.5508 14.8788C10.3982 15.041 10.1263 15.1221 9.73527 15.1221Z",fill:"currentColor"})}),rectangle:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"rectangle",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16 5H4V15H16V5ZM4 4H3V5V15V16H4H16H17V15V5V4H16H4Z",fill:"currentColor"})}),refresh:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"refresh",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.93434 4.43959L9.4014 4.26111L14.0251 2.49432L14.382 3.42845L11.5647 4.50499L10.5648 4.51221C10.8323 4.53935 11.0173 4.58539 11.2161 4.63484C11.2179 4.63528 11.2197 4.63572 11.2214 4.63616L11.2195 4.6369C11.8713 4.78513 12.4941 5.05172 13.0556 5.42692C13.9601 6.03127 14.6651 6.89025 15.0813 7.89524C15.4976 8.90024 15.6065 10.0061 15.3943 11.073C15.1821 12.1399 14.6583 13.1199 13.8891 13.8891C13.1199 14.6583 12.1399 15.1821 11.073 15.3943C10.0061 15.6065 8.90023 15.4976 7.89524 15.0813C6.89025 14.6651 6.03126 13.9601 5.42692 13.0556C4.82257 12.1512 4.5 11.0878 4.5 10H5.5C5.5 10.89 5.76392 11.76 6.25839 12.5001C6.75285 13.2401 7.45566 13.8169 8.27792 14.1575C9.10019 14.4981 10.005 14.5872 10.8779 14.4135C11.7508 14.2399 12.5526 13.8113 13.182 13.182C13.8113 12.5526 14.2399 11.7508 14.4135 10.8779C14.5872 10.005 14.4981 9.10019 14.1575 8.27793C13.8169 7.45566 13.2401 6.75286 12.5001 6.25839C11.8763 5.84159 11.1601 5.5886 10.4175 5.51941L11.8137 9.17339L10.8796 9.53033L9.11281 4.90665L8.93434 4.43959Z",fill:"currentColor"})}),revolve:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"revolve",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.89927 4.693C7.36143 4.41381 7.87 4.21672 8.40842 4.10376C7.83595 4.69964 7.47 5.50199 7.47 6.31393C7.47 7.34818 8.06376 8.11443 8.9218 8.3459C8.85859 8.44278 8.80068 8.54347 8.74845 8.64757C8.69108 8.76191 8.6411 8.87927 8.59864 8.99896L9.87934 8.72674C10.0433 8.52252 10.2451 8.35006 10.4752 8.21957L10.4736 8.21676C11.6445 7.74118 12.53 6.5014 12.53 5.2384C12.53 4.20393 11.936 3.43756 11.0776 3.20628L11.0781 3.19471C9.34471 2.75461 7.64421 2.9631 6.28878 3.78191C4.93335 4.60073 4.01395 5.97492 3.69937 7.6522C3.55495 8.4222 3.54245 9.23235 3.65633 10.0495L3.88904 10L4.59283 9.85042C4.53004 9.23247 4.55179 8.62188 4.6613 8.038C4.93318 6.58836 5.7278 5.40068 6.89927 4.693ZM7.47005 15.1799C6.65634 14.4835 5.96657 13.6244 5.46142 12.6658L4.54925 12.8597L4.57626 12.9127C5.40057 14.5194 6.672 15.8914 8.18092 16.8103C8.28057 16.8945 8.38913 16.9684 8.50564 17.0308L9.08339 16.1011C8.87304 15.9884 8.70487 15.8151 8.5944 15.5972C8.48392 15.3793 8.43471 15.1238 8.45129 14.8543C8.46788 14.5848 8.54973 14.31 8.68929 14.0552C8.82885 13.8005 9.02162 13.574 9.24981 13.3967C9.47801 13.2193 9.73427 13.0969 9.99495 13.0406C10.2556 12.9843 10.5123 12.996 10.7413 13.0747C10.9608 13.15 11.1481 13.2845 11.2874 13.4665C11.7756 13.525 12.1412 13.4705 12.4217 13.3627C12.354 13.1483 12.2554 12.9503 12.128 12.7748C11.8981 12.4582 11.5819 12.225 11.2086 12.0968C11.1027 12.0605 10.9931 12.0329 10.8808 12.0141C10.6353 11.9374 10.407 11.816 10.2071 11.6571L9.0562 11.9017C9.09421 11.9513 9.13379 11.9999 9.17491 12.0473C9.2375 12.1194 9.30323 12.1884 9.37183 12.254C9.16516 12.3521 8.9652 12.4755 8.77697 12.6218C8.40494 12.9109 8.09066 13.2801 7.86313 13.6955C7.6356 14.1108 7.50216 14.5588 7.47513 14.9982C7.47137 15.0592 7.46969 15.1198 7.47005 15.1799ZM9.99038 7.3647L10 7.36268C10.8571 7.18051 11.5518 6.32252 11.5518 5.44631C11.5518 4.5701 10.8571 4.00748 10 4.18965C9.14293 4.37183 8.44815 5.22981 8.44815 6.10602C8.44815 6.9614 9.11029 7.51793 9.93915 7.37442C9.95332 7.36608 9.96757 7.35785 9.98189 7.34973L9.99038 7.3647ZM16.6 8.29822L16.1109 8.40218L14.074 8.83515V9.83515L16.1109 9.40218L16.6 9.29822V8.29822ZM7.96305 11.1341L12.037 10.2681V9.26813L7.96305 10.1341V11.1341ZM3.8891 12L5.92607 11.567V10.567L3.8891 11L3.40002 11.104V12.104L3.8891 12ZM15.4172 11.1225L15.9703 10.8085L16.0604 11.4381L16.4532 14.1827L15.5948 14.3056L15.5027 13.662L15.5423 12.9555L15.3598 13.5867C15.1404 13.9788 14.8672 14.3472 14.529 14.662C13.8137 15.3278 12.8466 15.7187 11.5898 15.635C11.3638 16.0194 10.9459 16.2774 10.4678 16.2774C9.74943 16.2774 9.16711 15.6951 9.16711 14.9767C9.16711 14.2584 9.74943 13.6761 10.4678 13.6761C11.1178 13.6761 11.6565 14.153 11.753 14.776C12.7384 14.8173 13.4355 14.4952 13.9382 14.0273C14.4048 13.5929 14.7326 13.0058 14.9513 12.384L13.4607 13.2302L13.0326 12.4761L15.4172 11.1225Z",fill:"currentColor"})}),search:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"search",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.016 9.00482C14.016 10.662 12.6731 12.0048 11.0172 12.0048C9.3613 12.0048 8.01841 10.662 8.01841 9.00482C8.01841 7.34768 9.3613 6.00482 11.0172 6.00482C12.6731 6.00482 14.016 7.34768 14.016 9.00482ZM15.016 9.00482C15.016 11.214 13.2257 13.0048 11.0172 13.0048C10.082 13.0048 9.22178 12.6837 8.54074 12.1456L5.6912 14.9952L4.98409 14.2881L7.83921 11.433C7.32431 10.7597 7.01841 9.91799 7.01841 9.00482C7.01841 6.79568 8.80873 5.00482 11.0172 5.00482C13.2257 5.00482 15.016 6.79568 15.016 9.00482Z",fill:"currentColor"})}),settings:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"settings",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 5.5C8 5.77614 7.77614 6 7.5 6C7.22386 6 7 5.77614 7 5.5C7 5.22386 7.22386 5 7.5 5C7.77614 5 8 5.22386 8 5.5ZM6.08535 6C6.29127 6.5826 6.84689 7 7.5 7C8.32843 7 9 6.32843 9 5.5C9 4.67157 8.32843 4 7.5 4C6.84689 4 6.29127 4.4174 6.08535 5H5V6H6.08535ZM15 6H9.94999C9.98278 5.83844 10 5.67123 10 5.5C10 5.32877 9.98278 5.16155 9.94999 5H15V6ZM11 14.5C11 14.7761 10.7761 15 10.5 15C10.2239 15 10 14.7761 10 14.5C10 14.2239 10.2239 14 10.5 14C10.7761 14 11 14.2239 11 14.5ZM9.08535 15C9.29127 15.5826 9.84689 16 10.5 16C11.3284 16 12 15.3284 12 14.5C12 13.6716 11.3284 13 10.5 13C9.84689 13 9.29127 13.4174 9.08535 14H5V15H9.08535ZM15 15H12.95C12.9828 14.8384 13 14.6712 13 14.5C13 14.3288 12.9828 14.1616 12.95 14H15V15ZM11.5 10.5C11.7761 10.5 12 10.2761 12 10C12 9.72386 11.7761 9.5 11.5 9.5C11.2239 9.5 11 9.72386 11 10C11 10.2761 11.2239 10.5 11.5 10.5ZM11.5 8.5C12.1531 8.5 12.7087 8.9174 12.9146 9.5H15V10.5H12.9146C12.7087 11.0826 12.1531 11.5 11.5 11.5C10.6716 11.5 10 10.8284 10 10C10 9.17157 10.6716 8.5 11.5 8.5ZM9.05001 10.5C9.01722 10.3384 9 10.1712 9 10C9 9.82877 9.01722 9.66155 9.05001 9.5H5V10.5H9.05001Z",fill:"currentColor"})}),shell:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"shell",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.24585 3.87359L5.67443 5.38863L12.5048 6.84046L12.851 6.91405L14.8599 4.97721L15.5459 5.69359L13.5043 7.66193L13.4829 7.63961V8.04838V15.4548L14.8599 14.1272L15.5459 14.8436L13.5043 16.8119L13.4829 16.7896V16.8143L12.5048 16.6064L5.48944 15.1152L4.51129 14.9073V13.9073V6.14139V5.14139L4.5391 5.14731L4.51827 5.12555L6.55986 3.15721L7.24585 3.87359ZM5.48944 6.34931L12.5048 7.84046V15.6064L5.48944 14.1152V6.34931ZM10.5978 13.3098V11.2576L9.62543 11.0509L7.8814 12.7324L10.5978 13.3098ZM7.19195 12.0176V8.74893L9.13482 9.1619V10.1445L7.19195 12.0176ZM11.576 13.5177V11.4655L11.5761 11.4656V8.6808L11.576 8.68078L10.5978 8.47287L9.13482 8.16189L7.19195 7.74893L6.21381 7.54101L6.2138 7.54102V8.54102V12.3779V13.3779L7.19195 13.5859L10.5978 14.3098L11.576 14.5177L11.576 14.5177V13.5177Z",fill:"currentColor"})}),sketch:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"sketch",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.8037 13.4035L15.5509 14.1635L16.3682 16.8386L13.5521 16.1346L12.8186 15.3885L14.8037 13.4035ZM14.1025 12.6903L12.1175 14.6754L3.48609 5.89624C2.94588 5.34678 2.94963 4.46456 3.49448 3.91971C4.04591 3.36828 4.94112 3.37208 5.48786 3.92817L14.1025 12.6903ZM6.20094 3.22709L16.4357 13.6371L17.5003 17.1216L17.8412 18.2376L16.7091 17.9546L13.0364 17.0364L2.77301 6.59732C1.84793 5.6564 1.85434 4.14564 2.78737 3.2126C3.73167 2.2683 5.26468 2.27481 6.20094 3.22709Z",fill:"currentColor"})}),sparkles:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.92704 6.63163L7.67352 4.61429L8.42 6.63163L8.71541 6.92704L10.7327 7.67352L8.71541 8.42L8.42 8.71541L7.67352 10.7327L6.92704 8.71541L6.63163 8.42L4.61429 7.67352L6.63163 6.92704L6.92704 6.63163ZM7.20459 3L6.06897 6.06897L3 7.20459V8.14244L6.06897 9.27807L7.20459 12.347H8.14244L9.27807 9.27807L12.347 8.14244V7.20459L9.27807 6.06897L8.14244 3H7.20459ZM13.4822 13.1868L13.8235 12.2643L14.1649 13.1868L14.4603 13.4822L15.3827 13.8235L14.4603 14.1649L14.1649 14.4603L13.8235 15.3827L13.4822 14.4603L13.1868 14.1649L12.2643 13.8235L13.1868 13.4822L13.4822 13.1868ZM13.3546 10.65L12.6241 12.6241L10.65 13.3546V14.2924L12.6241 15.0229L13.3546 16.997H14.2924L15.0229 15.0229L16.997 14.2924V13.3546L15.0229 12.6241L14.2924 10.65H13.3546Z",fill:"currentColor"})}),spline:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"spline",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.0052 6.91281C15.5851 6.70544 16 6.15118 16 5.5C16 4.67157 15.3284 4 14.5 4C13.6716 4 13 4.67157 13 5.5C13 6.15503 13.4199 6.712 14.0051 6.91646C14.0058 7.31235 13.9653 7.7498 13.8414 8.1571C13.6773 8.69654 13.3777 9.1532 12.854 9.42296C12.3204 9.69782 11.4691 9.82282 10.1135 9.5099C8.62632 9.16662 7.50955 9.26015 6.69015 9.68223C5.86086 10.1094 5.42244 10.8281 5.20399 11.546C5.04308 12.0748 4.99567 12.6189 4.99693 13.0864C4.41594 13.2932 4 13.848 4 14.5C4 15.3284 4.67157 16 5.5 16C6.32843 16 7 15.3284 7 14.5C7 13.8458 6.58114 13.2893 5.99696 13.0843C5.99585 12.6867 6.03606 12.2466 6.16068 11.8371C6.32483 11.2976 6.62436 10.841 7.14807 10.5712C7.68167 10.2964 8.53295 10.1714 9.88859 10.4843C11.3758 10.8276 12.4925 10.734 13.3119 10.312C14.1412 9.88478 14.5796 9.16611 14.7981 8.44821C14.9584 7.92128 15.0061 7.3792 15.0052 6.91281Z",fill:"currentColor"})}),sweep:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"sweep",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.4743 3.19282L15.7063 2.49694L14.9738 2.53539L11.7806 2.703L11.833 3.70162L12.2189 3.68137L13.0309 3.47351L12.4065 3.79549C11.5985 4.23813 10.7423 4.7732 10.0381 5.41523C9.28624 6.1008 8.66584 6.94665 8.50598 7.97341C8.36948 8.8502 8.57961 9.78564 9.20597 10.7756C9.07507 10.9983 9 11.2577 9 11.5347C9 12.3631 9.67157 13.0347 10.5 13.0347C11.3284 13.0347 12 12.3631 12 11.5347C12 10.7063 11.3284 10.0347 10.5 10.0347C10.3174 10.0347 10.1425 10.0673 9.98067 10.127C9.51409 9.34655 9.40701 8.68651 9.49408 8.12725C9.60506 7.41442 10.0472 6.76028 10.7119 6.15418C11.3749 5.54964 12.218 5.03092 13.0491 4.58458C13.4267 4.38176 13.797 4.19644 14.1426 4.02567L13.5257 5.87659L14.4743 6.19282L15.4743 3.19282ZM10.4854 8.10284C10.4627 8.2645 10.4579 8.44276 10.4848 8.63934L15.0823 11.4489L10 14.5548L4.91773 11.4489L7.66526 9.76987C7.56422 9.41819 7.50187 9.06536 7.47765 8.71258L3.95886 10.8629L3 11.4489V13.5031H4V12.06L9.5 15.4211V17.5031H10.5V15.4211L16 12.06V13.5031H17L17 11.4489L16.0411 10.8629L10.6351 7.55929C10.5598 7.74567 10.5101 7.92698 10.4854 8.10284Z",fill:"currentColor"})}),tangent:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"tangent",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.73 2.73L9.23398 6.226C9.72614 6.46571 10.1178 6.87964 10.3288 7.38755C10.6321 7.31396 10.949 7.27497 11.275 7.27497C13.4841 7.27497 15.275 9.06583 15.275 11.275C15.275 13.4841 13.4841 15.275 11.275 15.275C9.06587 15.275 7.27501 13.4841 7.27501 11.275C7.27501 10.949 7.314 10.6321 7.38757 10.3288C6.87965 10.1178 6.46571 9.72614 6.226 9.23398L2.72998 12.73L3.43709 13.4371L6.32769 10.5465C6.29298 10.7843 6.27501 11.0275 6.27501 11.275C6.27501 14.0364 8.51358 16.275 11.275 16.275C14.0364 16.275 16.275 14.0364 16.275 11.275C16.275 8.51355 14.0364 6.27497 11.275 6.27497C11.0276 6.27497 10.7843 6.29294 10.5465 6.32765L13.4371 3.4371L12.73 2.73ZM8.26001 9.75C9.08844 9.75 9.76001 9.07843 9.76001 8.25C9.76001 7.42157 9.08844 6.75 8.26001 6.75C7.43158 6.75 6.76001 7.42157 6.76001 8.25C6.76001 9.07843 7.43158 9.75 8.26001 9.75Z",fill:"currentColor"})}),text:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"text",children:b.jsx("path",{d:"M12.3107 14.9933L11.5524 12.3321H8.37616L7.61786 14.9933H5.98682L8.90553 5.00671H11.0946L14.0133 14.9933H12.3107ZM10.0215 6.62345H9.90705L8.67661 11.0015H11.2519L10.0215 6.62345Z",fill:"currentColor"})}),"three-dots":b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"three-dots",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.5 10C6.5 10.8284 5.82843 11.5 5 11.5C4.17157 11.5 3.5 10.8284 3.5 10C3.5 9.17157 4.17157 8.5 5 8.5C5.82843 8.5 6.5 9.17157 6.5 10ZM11.5 10C11.5 10.8284 10.8284 11.5 10 11.5C9.17157 11.5 8.5 10.8284 8.5 10C8.5 9.17157 9.17157 8.5 10 8.5C10.8284 8.5 11.5 9.17157 11.5 10ZM15 11.5C15.8284 11.5 16.5 10.8284 16.5 10C16.5 9.17157 15.8284 8.5 15 8.5C14.1716 8.5 13.5 9.17157 13.5 10C13.5 10.8284 14.1716 11.5 15 11.5Z",fill:"currentColor"})}),trash:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"trash",children:b.jsx("path",{d:"M8.5 6H5V8H6M8.5 6V4H11.5V6M8.5 6H11.5M11.5 6H15V8H14M6 8V15.5H8M6 8H14M14 8V15.5H12M8 15.5V10M8 15.5H10M12 15.5V10M12 15.5H10M10 15.5V12",stroke:"currentColor"})}),vertical:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"vertical",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 4V16H9V4H11Z",fill:"currentColor"})}),xAbsolute:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"x-absolute",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 16V4H5L5 16H4ZM8.75069 6.82599C8.97469 6.78866 9.20803 6.79799 9.45069 6.85399C9.91736 6.95666 10.2627 7.17132 10.4867 7.49799C10.524 7.55399 10.552 7.58199 10.5707 7.58199L10.6547 7.46999C10.8787 7.20866 11.1447 7.01732 11.4527 6.89599C11.8074 6.76532 12.162 6.77932 12.5167 6.93799C12.7874 7.07799 12.9787 7.26466 13.0907 7.49799C13.2774 7.87132 13.282 8.26332 13.1047 8.67399C13.03 8.83266 12.9367 8.95399 12.8247 9.03799C12.4887 9.28066 12.1714 9.32732 11.8727 9.17799C11.8167 9.14999 11.77 9.11732 11.7327 9.07999C11.5927 8.93999 11.5367 8.76266 11.5647 8.54799C11.6207 8.12799 11.8354 7.85266 12.2087 7.72199L12.3207 7.67999L12.2647 7.62399C12.0967 7.47466 11.8914 7.43266 11.6487 7.49799C11.63 7.49799 11.6114 7.50266 11.5927 7.51199C11.3127 7.61466 11.0887 7.88532 10.9207 8.32399C10.8274 8.55732 10.58 9.54199 10.1787 11.278C10.132 11.4367 10.1087 11.5347 10.1087 11.572C10.062 11.8613 10.0667 12.0573 10.1227 12.16C10.1974 12.3 10.314 12.398 10.4727 12.454C10.5194 12.4727 10.6174 12.482 10.7667 12.482C10.9067 12.482 11.0094 12.4727 11.0747 12.454C11.3174 12.3793 11.56 12.23 11.8027 12.006C12.092 11.7073 12.2834 11.3807 12.3767 11.026C12.4047 10.9327 12.442 10.8813 12.4887 10.872C12.526 10.8627 12.61 10.858 12.7407 10.858C12.918 10.858 13.0207 10.8673 13.0487 10.886C13.0674 10.9047 13.0767 10.9373 13.0767 10.984C13.0767 11.18 12.9554 11.474 12.7127 11.866C12.7034 11.894 12.6894 11.9173 12.6707 11.936C12.2507 12.58 11.6954 12.9767 11.0047 13.126C10.79 13.1633 10.5474 13.1633 10.2767 13.126C9.80069 13.0233 9.44603 12.8133 9.21269 12.496L9.12869 12.37L9.08669 12.412C8.72269 12.8787 8.31203 13.126 7.85469 13.154C7.32269 13.182 6.92603 12.986 6.66469 12.566C6.60869 12.4913 6.56669 12.4073 6.53869 12.314C6.47336 12.1087 6.45469 11.8893 6.48269 11.656C6.54803 11.2547 6.73469 10.9793 7.04269 10.83C7.34136 10.69 7.60736 10.6853 7.84069 10.816C8.05536 10.9187 8.15336 11.1053 8.13469 11.376C8.10669 11.7493 7.93403 12.02 7.61669 12.188C7.57003 12.216 7.50469 12.244 7.42069 12.272L7.36469 12.286L7.40669 12.328C7.53736 12.4307 7.68669 12.482 7.85469 12.482C7.97603 12.4913 8.10203 12.4587 8.23269 12.384C8.47536 12.216 8.65736 11.9593 8.77869 11.614L9.54869 8.53399C9.61403 8.19799 9.62336 7.96466 9.57669 7.83399C9.53003 7.68466 9.40869 7.57732 9.21269 7.51199C9.02603 7.45599 8.83469 7.45599 8.63869 7.51199C8.36803 7.58666 8.13003 7.72666 7.92469 7.93199C7.65403 8.21199 7.45803 8.52466 7.33669 8.86999C7.30869 8.98199 7.28069 9.05199 7.25269 9.07999C7.23403 9.09866 7.13603 9.10799 6.95869 9.10799H6.69269L6.65069 9.06599C6.62269 9.03799 6.60869 9.00066 6.60869 8.95399C6.63669 8.81399 6.69269 8.65532 6.77669 8.47799C6.86069 8.28199 6.96803 8.09532 7.09869 7.91799C7.24803 7.69399 7.45336 7.48399 7.71469 7.28799C7.72403 7.27866 7.73803 7.26932 7.75669 7.25999C8.06469 7.04532 8.39603 6.90066 8.75069 6.82599ZM15 4L15 16H16L16 4H15Z",fill:"currentColor"})}),xRelative:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"x-relative",children:b.jsx("path",{d:"M8.75069 6.82599C8.97469 6.78866 9.20803 6.79799 9.45069 6.85399C9.91736 6.95666 10.2627 7.17132 10.4867 7.49799C10.524 7.55399 10.552 7.58199 10.5707 7.58199L10.6547 7.46999C10.8787 7.20866 11.1447 7.01732 11.4527 6.89599C11.8074 6.76532 12.162 6.77932 12.5167 6.93799C12.7874 7.07799 12.9787 7.26466 13.0907 7.49799C13.2774 7.87132 13.282 8.26332 13.1047 8.67399C13.03 8.83266 12.9367 8.95399 12.8247 9.03799C12.4887 9.28066 12.1714 9.32732 11.8727 9.17799C11.8167 9.14999 11.77 9.11732 11.7327 9.07999C11.5927 8.93999 11.5367 8.76266 11.5647 8.54799C11.6207 8.12799 11.8354 7.85266 12.2087 7.72199L12.3207 7.67999L12.2647 7.62399C12.0967 7.47466 11.8914 7.43266 11.6487 7.49799C11.63 7.49799 11.6114 7.50266 11.5927 7.51199C11.3127 7.61466 11.0887 7.88532 10.9207 8.32399C10.8274 8.55732 10.58 9.54199 10.1787 11.278C10.132 11.4367 10.1087 11.5347 10.1087 11.572C10.062 11.8613 10.0667 12.0573 10.1227 12.16C10.1974 12.3 10.314 12.398 10.4727 12.454C10.5194 12.4727 10.6174 12.482 10.7667 12.482C10.9067 12.482 11.0094 12.4727 11.0747 12.454C11.3174 12.3793 11.56 12.23 11.8027 12.006C12.092 11.7073 12.2834 11.3807 12.3767 11.026C12.4047 10.9327 12.442 10.8813 12.4887 10.872C12.526 10.8627 12.61 10.858 12.7407 10.858C12.918 10.858 13.0207 10.8673 13.0487 10.886C13.0674 10.9047 13.0767 10.9373 13.0767 10.984C13.0767 11.18 12.9554 11.474 12.7127 11.866C12.7034 11.894 12.6894 11.9173 12.6707 11.936C12.2507 12.58 11.6954 12.9767 11.0047 13.126C10.79 13.1633 10.5474 13.1633 10.2767 13.126C9.80069 13.0233 9.44603 12.8133 9.21269 12.496L9.12869 12.37L9.08669 12.412C8.72269 12.8787 8.31203 13.126 7.85469 13.154C7.32269 13.182 6.92603 12.986 6.66469 12.566C6.60869 12.4913 6.56669 12.4073 6.53869 12.314C6.47336 12.1087 6.45469 11.8893 6.48269 11.656C6.54803 11.2547 6.73469 10.9793 7.04269 10.83C7.34136 10.69 7.60736 10.6853 7.84069 10.816C8.05536 10.9187 8.15336 11.1053 8.13469 11.376C8.10669 11.7493 7.93403 12.02 7.61669 12.188C7.57003 12.216 7.50469 12.244 7.42069 12.272L7.36469 12.286L7.40669 12.328C7.53736 12.4307 7.68669 12.482 7.85469 12.482C7.97603 12.4913 8.10203 12.4587 8.23269 12.384C8.47536 12.216 8.65736 11.9593 8.77869 11.614L9.54869 8.53399C9.61403 8.19799 9.62336 7.96466 9.57669 7.83399C9.53003 7.68466 9.40869 7.57732 9.21269 7.51199C9.02603 7.45599 8.83469 7.45599 8.63869 7.51199C8.36803 7.58666 8.13003 7.72666 7.92469 7.93199C7.65403 8.21199 7.45803 8.52466 7.33669 8.86999C7.30869 8.98199 7.28069 9.05199 7.25269 9.07999C7.23403 9.09866 7.13603 9.10799 6.95869 9.10799H6.69269L6.65069 9.06599C6.62269 9.03799 6.60869 9.00066 6.60869 8.95399C6.63669 8.81399 6.69269 8.65532 6.77669 8.47799C6.86069 8.28199 6.96803 8.09532 7.09869 7.91799C7.24803 7.69399 7.45336 7.48399 7.71469 7.28799C7.72403 7.27866 7.73803 7.26932 7.75669 7.25999C8.06469 7.04532 8.39603 6.90066 8.75069 6.82599Z",fill:"currentColor"})}),yAbsolute:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"y-absolute",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 16V4H5L5 16H4ZM7.92469 6.83999C8.11136 6.79332 8.33069 6.79799 8.58269 6.85399C9.05869 6.98466 9.36203 7.26932 9.49269 7.70799C9.53003 7.86666 9.53003 8.06732 9.49269 8.30999C9.47403 8.37532 9.40403 8.56666 9.28269 8.88399C8.94669 9.78932 8.72736 10.4847 8.62469 10.97C8.52203 11.5953 8.57803 12.0293 8.79269 12.272C8.95136 12.4587 9.17536 12.5287 9.46469 12.482C9.88469 12.426 10.2534 12.174 10.5707 11.726L10.6547 11.6L11.1587 9.54199C11.5134 8.15132 11.7047 7.43266 11.7327 7.38599C11.882 7.11532 12.106 6.97532 12.4047 6.96599C12.554 6.96599 12.68 7.00799 12.7827 7.09199C12.8294 7.11066 12.8714 7.16199 12.9087 7.24599C12.9554 7.33932 12.9647 7.45599 12.9367 7.59599C12.9087 7.73599 12.6847 8.65532 12.2647 10.354C11.742 12.3887 11.49 13.3733 11.5087 13.308C11.4154 13.6067 11.2754 13.882 11.0887 14.134C10.566 14.9273 9.87536 15.4593 9.01669 15.73C8.60603 15.87 8.20469 15.912 7.81269 15.856C7.11269 15.7533 6.67403 15.436 6.49669 14.904C6.45936 14.6987 6.46403 14.5073 6.51069 14.33C6.56669 14.0967 6.68336 13.91 6.86069 13.77C7.19669 13.5273 7.51403 13.4807 7.81269 13.63C7.92469 13.6953 8.00869 13.784 8.06469 13.896C8.16736 14.12 8.14869 14.3627 8.00869 14.624C7.91536 14.8013 7.78936 14.932 7.63069 15.016L7.54669 15.072L7.61669 15.1C7.98069 15.2587 8.36336 15.2587 8.76469 15.1C9.26869 14.8947 9.68869 14.442 10.0247 13.742C10.09 13.5927 10.1507 13.4433 10.2067 13.294C10.3187 12.9673 10.3654 12.7993 10.3467 12.79C10.3374 12.79 10.3047 12.8087 10.2487 12.846C10.1087 12.93 9.95936 13 9.80069 13.056C9.28736 13.2333 8.76003 13.2007 8.21869 12.958C8.08803 12.902 7.97136 12.832 7.86869 12.748C7.44869 12.412 7.26669 11.8987 7.32269 11.208C7.36003 10.7507 7.57936 9.98066 7.98069 8.89799C7.99003 8.86066 7.99936 8.82799 8.00869 8.79999C8.13936 8.47332 8.20936 8.27732 8.21869 8.21199C8.33069 7.89466 8.34469 7.67532 8.26069 7.55399C8.22336 7.49799 8.14869 7.46999 8.03669 7.46999C7.63536 7.50732 7.30403 7.84799 7.04269 8.49199C6.99603 8.60399 6.95403 8.72532 6.91669 8.85599C6.87003 9.00532 6.83269 9.08466 6.80469 9.09399C6.79536 9.10332 6.69736 9.10799 6.51069 9.10799H6.25869L6.21669 9.06599C6.17003 9.02866 6.17469 8.93066 6.23069 8.77199C6.40803 8.17466 6.67869 7.70332 7.04269 7.35799C7.30403 7.08732 7.59803 6.91466 7.92469 6.83999ZM15 4L15 16H16L16 4H15Z",fill:"currentColor"})}),yRelative:b.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"y-relative",children:b.jsx("path",{d:"M7.92463 6.83998C8.1113 6.79332 8.33063 6.79798 8.58263 6.85398C9.05863 6.98465 9.36197 7.26932 9.49263 7.70798C9.52997 7.86665 9.52997 8.06732 9.49263 8.30998C9.47397 8.37532 9.40397 8.56665 9.28263 8.88399C8.94663 9.78932 8.7273 10.4847 8.62463 10.97C8.52197 11.5953 8.57797 12.0293 8.79263 12.272C8.9513 12.4587 9.1753 12.5287 9.46463 12.482C9.88463 12.426 10.2533 12.174 10.5706 11.726L10.6546 11.6L11.1586 9.54198C11.5133 8.15132 11.7046 7.43265 11.7326 7.38598C11.882 7.11532 12.106 6.97532 12.4046 6.96598C12.554 6.96598 12.68 7.00798 12.7826 7.09198C12.8293 7.11065 12.8713 7.16198 12.9086 7.24598C12.9553 7.33932 12.9646 7.45598 12.9366 7.59598C12.9086 7.73598 12.6846 8.65532 12.2646 10.354C11.742 12.3887 11.49 13.3733 11.5086 13.308C11.4153 13.6067 11.2753 13.882 11.0886 14.134C10.566 14.9273 9.8753 15.4593 9.01663 15.73C8.60597 15.87 8.20463 15.912 7.81263 15.856C7.11263 15.7533 6.67397 15.436 6.49663 14.904C6.4593 14.6987 6.46397 14.5073 6.51063 14.33C6.56663 14.0967 6.6833 13.91 6.86063 13.77C7.19663 13.5273 7.51397 13.4807 7.81263 13.63C7.92463 13.6953 8.00863 13.784 8.06463 13.896C8.1673 14.12 8.14863 14.3627 8.00863 14.624C7.9153 14.8013 7.7893 14.932 7.63063 15.016L7.54663 15.072L7.61663 15.1C7.98063 15.2587 8.3633 15.2587 8.76463 15.1C9.26863 14.8947 9.68863 14.442 10.0246 13.742C10.09 13.5927 10.1506 13.4433 10.2066 13.294C10.3186 12.9673 10.3653 12.7993 10.3466 12.79C10.3373 12.79 10.3046 12.8087 10.2486 12.846C10.1086 12.93 9.9593 13 9.80063 13.056C9.2873 13.2333 8.75997 13.2007 8.21863 12.958C8.08797 12.902 7.9713 12.832 7.86863 12.748C7.44863 12.412 7.26663 11.8987 7.32263 11.208C7.35997 10.7507 7.5793 9.98065 7.98063 8.89798C7.98997 8.86065 7.9993 8.82798 8.00863 8.79998C8.1393 8.47332 8.2093 8.27732 8.21863 8.21198C8.33063 7.89465 8.34463 7.67532 8.26063 7.55398C8.2233 7.49798 8.14863 7.46998 8.03663 7.46998C7.6353 7.50732 7.30397 7.84798 7.04263 8.49198C6.99597 8.60398 6.95397 8.72532 6.91663 8.85598C6.86997 9.00532 6.83263 9.08465 6.80463 9.09398C6.7953 9.10332 6.6973 9.10798 6.51063 9.10798H6.25863L6.21663 9.06598C6.16997 9.02865 6.17463 8.93065 6.23063 8.77198C6.40797 8.17465 6.67863 7.70332 7.04263 7.35798C7.30397 7.08732 7.59797 6.91465 7.92463 6.83998Z",fill:"currentColor"})})},nn=({name:t,...e})=>P.cloneElement(SEe[t],e),EEe="_tooltipWrapper_11p0o_3",TEe="_tooltip_11p0o_3",BEe="_withFocus_11p0o_60",MEe="_top_11p0o_98",kEe="_bottom_11p0o_99",REe="_right_11p0o_114",PEe="_left_11p0o_135",cw={tooltipWrapper:EEe,tooltip:TEe,withFocus:BEe,top:MEe,bottom:kEe,"top-right":"_top-right_11p0o_109",right:REe,"bottom-right":"_bottom-right_11p0o_120","bottom-left":"_bottom-left_11p0o_131",left:PEe,"top-left":"_top-left_11p0o_141"};function Fr({children:t,position:e="top",wrapperClassName:n,contentClassName:r,wrapperStyle:i={},delay:s=200,hoverOnly:o=!1,inert:a=!0}){return b.jsx("div",{inert:a?"":void 0,role:"tooltip",className:`p-3 ${e!=="left"&&e!=="right"?"px-0":""} ${cw.tooltipWrapper} ${o?"":cw.withFocus} ${cw[e]} ${n}`,style:Object.assign({"--_delay":s+"ms"},i),children:b.jsx("div",{className:`rounded ${cw.tooltip} ${r||""}`,children:t})})}class Hi{constructor(e){se(this,"current");se(this,"hideOnLevel");se(this,"hideOnPlatform");se(this,"commandConfig");se(this,"Component");se(this,"description");se(this,"validate");se(this,"_default");se(this,"_user");se(this,"_project");this._default=e.defaultValue,this.current=e.defaultValue,this.validate=e.validate,this.description=e.description,this.hideOnLevel=e.hideOnLevel,this.hideOnPlatform=e.hideOnPlatform,this.commandConfig=e.commandConfig,this.Component=e.Component}get default(){return this._default}set default(e){this._default=this.validate(e)?e:this._default,this.current=this.resolve()}get user(){return this._user}set user(e){this._user=e!==void 0?this.validate(e)?e:this._user:e,this.current=this.resolve()}get project(){return this._project}set project(e){this._project=e!==void 0?this.validate(e)?e:this._project:e,this.current=this.resolve()}resolve(){return this._project!==void 0?this._project:this._user!==void 0?this._user:this._default}getFallback(e){return e==="project"?this._user!==void 0?this._user:this._default:this._default}shouldShowCurrentLabel(e,n){return this[`_${e}`]===void 0?this.getFallback(e)===n:this[`_${e}`]===n}getParentLevel(e){return e==="project"?"user":"default"}}function qI(){return{app:{theme:new Hi({hideOnLevel:"project",defaultValue:Zn.System,description:"The overall appearance of the app",validate:t=>_Ee(t,Zn),commandConfig:{inputType:"options",defaultValueFromContext:t=>t.app.theme.current,options:(t,e)=>Object.values(Zn).map(n=>({name:n,value:n,isCurrent:n===e.app.theme[t.argumentsToSubmit.level]}))}}),themeColor:new Hi({defaultValue:"264.5",description:"The hue of the primary theme color for the app",validate:t=>Number(t)>=0&&Number(t)<360,Component:({value:t,updateValue:e})=>b.jsxs("div",{className:"flex item-center gap-4 px-2 m-0 py-0",children:[b.jsx("div",{className:"w-4 h-4 rounded-full bg-primary border border-solid border-chalkboard-100 dark:border-chalkboard-30",style:{backgroundColor:`oklch(var(--primary-lightness) var(--primary-chroma) ${t})`}}),b.jsx("input",{type:"range",onChange:n=>e(n.currentTarget.value),value:t,min:0,max:259,step:1,className:"block flex-1"})]})}),enableSSAO:new Hi({defaultValue:!0,description:"Whether or not Screen Space Ambient Occlusion (SSAO) is enabled",validate:t=>typeof t=="boolean",hideOnPlatform:"both"}),streamIdleMode:new Hi({defaultValue:!1,description:"Toggle stream idling, saving bandwidth and battery",validate:t=>typeof t=="boolean",commandConfig:{inputType:"boolean"}}),onboardingStatus:new Hi({defaultValue:"",validate:t=>typeof t=="string",hideOnPlatform:"both"}),dismissWebBanner:new Hi({defaultValue:!1,description:"Permanently dismiss the banner warning to download the desktop app.",validate:t=>typeof t=="boolean",hideOnPlatform:"desktop"}),projectDirectory:new Hi({defaultValue:"",description:"The directory to save and load projects from",hideOnLevel:"project",hideOnPlatform:"web",validate:t=>typeof t=="string"&&(t.length>0||!ft()),Component:({value:t,updateValue:e})=>{const n=P.useRef(null);return b.jsxs("div",{className:"flex gap-4 p-1 border rounded-sm border-chalkboard-30",children:[b.jsx("input",{className:"flex-grow text-xs px-2 bg-transparent",value:t,disabled:!0,"data-testid":"project-directory-input",ref:n}),b.jsxs("button",{onClick:Li(async()=>{var i;const r=(i=n.current)==null?void 0:i.dataset.testValue;if(n.current&&r&&!Array.isArray(r))e(r);else{const s=await window.electron.open({properties:["openDirectory","createDirectory"],defaultPath:t,title:"Choose a new project directory"});if(s.canceled)return;e(s.filePaths[0])}},Bt),className:"p-0 m-0 border-none hover:bg-primary/10 focus:bg-primary/10 dark:hover:bg-primary/20 dark:focus::bg-primary/20","data-testid":"project-directory-button",children:[b.jsx(nn,{name:"folder",className:"w-5 h-5"}),b.jsx(Fr,{position:"top-right",children:"Choose a folder"})]})]})}})},modeling:{defaultUnit:new Hi({defaultValue:"mm",description:"The default unit to use in modeling dimensions",validate:t=>C5.includes(t),commandConfig:{inputType:"options",defaultValueFromContext:t=>t.modeling.defaultUnit.current,options:(t,e)=>Object.values(C5).map(n=>({name:n,value:n,isCurrent:n===e.modeling.defaultUnit[t.argumentsToSubmit.level]}))}}),mouseControls:new Hi({defaultValue:"KittyCAD",description:"The controls for how to navigate the 3D view",validate:t=>Qx.includes(t),hideOnLevel:"project",commandConfig:{inputType:"options",defaultValueFromContext:t=>t.modeling.mouseControls.current,options:(t,e)=>Object.values(Qx).map(n=>({name:n,value:n,isCurrent:n===e.modeling.mouseControls.shouldShowCurrentLabel(t.argumentsToSubmit.level)}))},Component:({value:t,updateValue:e})=>b.jsxs(b.Fragment,{children:[b.jsx("select",{id:"camera-controls",className:"block w-full px-3 py-1 bg-transparent border border-chalkboard-30",value:t,onChange:n=>e(n.target.value),children:Qx.map(n=>b.jsx("option",{value:n,children:n},n))}),b.jsxs("ul",{className:"mx-0 my-2 flex flex-col gap-2 text-sm",children:[b.jsxs("li",{className:"grid grid-cols-4 gap-1",children:[b.jsx("strong",{children:"Pan"}),b.jsx("p",{className:"col-span-3 leading-tight",children:Gd[t].pan.description})]}),b.jsxs("li",{className:"grid grid-cols-4 gap-1",children:[b.jsx("strong",{children:"Zoom"}),b.jsx("p",{className:"col-span-3 leading-tight",children:Gd[t].zoom.description})]}),b.jsxs("li",{className:"grid grid-cols-4 gap-1",children:[b.jsx("strong",{children:"Rotate"}),b.jsx("p",{className:"col-span-3 leading-tight",children:Gd[t].rotate.description})]})]})]})}),cameraProjection:new Hi({defaultValue:"orthographic",hideOnLevel:"project",description:"Projection method applied to the 3D view, perspective or orthographic",validate:t=>["perspective","orthographic"].includes(t),commandConfig:{inputType:"options",defaultValueFromContext:t=>t.modeling.cameraProjection.current==="perspective"?"orthographic":"perspective",options:(t,e)=>["perspective","orthographic"].map(n=>({name:n.charAt(0).toUpperCase()+n.slice(1),value:n,isCurrent:e.modeling.cameraProjection.shouldShowCurrentLabel(t.argumentsToSubmit.level,n)}))}}),highlightEdges:new Hi({defaultValue:!0,description:"Whether to highlight edges of 3D objects",validate:t=>typeof t=="boolean",commandConfig:{inputType:"boolean"},hideOnLevel:"project"}),showScaleGrid:new Hi({defaultValue:!1,description:"Whether to show a scale grid in the 3D modeling view",validate:t=>typeof t=="boolean",commandConfig:{inputType:"boolean"},hideOnLevel:"project"}),showDebugPanel:new Hi({defaultValue:!1,description:"Whether to show the debug panel, a development tool",validate:t=>typeof t=="boolean",commandConfig:{inputType:"boolean"}})},textEditor:{textWrapping:new Hi({defaultValue:!0,description:"Whether to wrap text in the editor or overflow with scroll",validate:t=>typeof t=="boolean",commandConfig:{inputType:"boolean"}}),blinkingCursor:new Hi({defaultValue:!0,description:"Whether to make the cursor blink in the editor",validate:t=>typeof t=="boolean",commandConfig:{inputType:"boolean"}})},projects:{defaultProjectName:new Hi({defaultValue:_be,description:"The default project name to use when creating a new project",validate:t=>typeof t=="string"&&t.length>0,commandConfig:{inputType:"string",defaultValueFromContext:t=>t.projects.defaultProjectName.current},hideOnLevel:"project",hideOnPlatform:"web"})},commandBar:{includeSettings:new Hi({defaultValue:!0,description:"Whether to include settings in the command bar",validate:t=>typeof t=="boolean",commandConfig:{inputType:"boolean"}})}}}const C1=qI();function lJ(t){var e,n,r,i,s,o,a,l,c,u,d,f,h,A,p,m,g,y,w,v,x,C,_,S,E,T,R,k,B,M,F,I,z,Y,$,ee,W,ne,Se;return{app:{theme:Hbe((r=(n=(e=t==null?void 0:t.settings)==null?void 0:e.app)==null?void 0:n.appearance)==null?void 0:r.theme),themeColor:(o=(s=(i=t==null?void 0:t.settings)==null?void 0:i.app)==null?void 0:s.appearance)!=null&&o.color?(c=(l=(a=t==null?void 0:t.settings)==null?void 0:a.app)==null?void 0:l.appearance)==null?void 0:c.color.toString():void 0,onboardingStatus:(d=(u=t==null?void 0:t.settings)==null?void 0:u.app)==null?void 0:d.onboarding_status,dismissWebBanner:(h=(f=t==null?void 0:t.settings)==null?void 0:f.app)==null?void 0:h.dismiss_web_banner,streamIdleMode:(p=(A=t==null?void 0:t.settings)==null?void 0:A.app)==null?void 0:p.stream_idle_mode,projectDirectory:(g=(m=t==null?void 0:t.settings)==null?void 0:m.project)==null?void 0:g.directory,enableSSAO:(w=(y=t==null?void 0:t.settings)==null?void 0:y.modeling)==null?void 0:w.enable_ssao},modeling:{defaultUnit:(x=(v=t==null?void 0:t.settings)==null?void 0:v.modeling)==null?void 0:x.base_unit,cameraProjection:(_=(C=t==null?void 0:t.settings)==null?void 0:C.modeling)==null?void 0:_.camera_projection,mouseControls:oX((E=(S=t==null?void 0:t.settings)==null?void 0:S.modeling)==null?void 0:E.mouse_controls),highlightEdges:(R=(T=t==null?void 0:t.settings)==null?void 0:T.modeling)==null?void 0:R.highlight_edges,showDebugPanel:(B=(k=t==null?void 0:t.settings)==null?void 0:k.modeling)==null?void 0:B.show_debug_panel,showScaleGrid:(F=(M=t==null?void 0:t.settings)==null?void 0:M.modeling)==null?void 0:F.show_scale_grid},textEditor:{textWrapping:(z=(I=t==null?void 0:t.settings)==null?void 0:I.text_editor)==null?void 0:z.text_wrapping,blinkingCursor:($=(Y=t==null?void 0:t.settings)==null?void 0:Y.text_editor)==null?void 0:$.blinking_cursor},projects:{defaultProjectName:(W=(ee=t==null?void 0:t.settings)==null?void 0:ee.project)==null?void 0:W.default_project_name},commandBar:{includeSettings:(Se=(ne=t==null?void 0:t.settings)==null?void 0:ne.command_bar)==null?void 0:Se.include_settings}}}function XI(t){var e,n,r,i,s,o,a,l,c,u,d,f,h,A,p,m,g,y,w,v,x,C,_,S,E,T,R,k;return{app:{themeColor:(r=(n=(e=t==null?void 0:t.settings)==null?void 0:e.app)==null?void 0:n.appearance)!=null&&r.color?(o=(s=(i=t==null?void 0:t.settings)==null?void 0:i.app)==null?void 0:s.appearance)==null?void 0:o.color.toString():void 0,onboardingStatus:(l=(a=t==null?void 0:t.settings)==null?void 0:a.app)==null?void 0:l.onboarding_status,dismissWebBanner:(u=(c=t==null?void 0:t.settings)==null?void 0:c.app)==null?void 0:u.dismiss_web_banner,streamIdleMode:(f=(d=t==null?void 0:t.settings)==null?void 0:d.app)==null?void 0:f.stream_idle_mode,enableSSAO:(A=(h=t==null?void 0:t.settings)==null?void 0:h.modeling)==null?void 0:A.enable_ssao},modeling:{defaultUnit:(m=(p=t==null?void 0:t.settings)==null?void 0:p.modeling)==null?void 0:m.base_unit,mouseControls:oX((y=(g=t==null?void 0:t.settings)==null?void 0:g.modeling)==null?void 0:y.mouse_controls),highlightEdges:(v=(w=t==null?void 0:t.settings)==null?void 0:w.modeling)==null?void 0:v.highlight_edges,showDebugPanel:(C=(x=t==null?void 0:t.settings)==null?void 0:x.modeling)==null?void 0:C.show_debug_panel},textEditor:{textWrapping:(S=(_=t==null?void 0:t.settings)==null?void 0:_.text_editor)==null?void 0:S.text_wrapping,blinkingCursor:(T=(E=t==null?void 0:t.settings)==null?void 0:E.text_editor)==null?void 0:T.blinking_cursor},commandBar:{includeSettings:(k=(R=t==null?void 0:t.settings)==null?void 0:R.command_bar)==null?void 0:k.include_settings}}}function _5(){return"/settings.toml"}function S5(){return"/"+eg+"/project.toml"}function cJ(){let t=localStorage.getItem(_5())??localStorage.getItem("/user.toml")??"";if(t==="")return t5();try{return Dq(t)}catch{const n=t5();if(ie(n))return n;const r=__(n);return ie(r)?r:(localStorage.setItem(_5(),r),n)}}function LEe(){let t=localStorage.getItem(S5())??"";if(t==="")return x7();const e=iI(t);if(ie(e)){const n=x7(),r=__(n);return ie(r)?r:(localStorage.setItem(S5(),r),n)}else return e}async function fg(t){await eI;const e=ft(),n=e?await bv():cJ();if(ie(n))return Promise.reject(n);let r=qI();if(e&&(C1.app.projectDirectory.default=await oJ()),r=E5(r,"user",lJ(n)),t){const i=e?await yEe(t):LEe();if(ie(i))return Promise.reject(new Error("Invalid project settings"));r=E5(r,"project",XI(i))}return{settings:r,configuration:n}}async function IEe(t,e){await eI;const n=ft(),r=lH(t,"user"),i=__({settings:r});if(ie(i)||(n?await vEe(i):localStorage.setItem(_5(),i),!e))return;const s=lH(t,"project"),o=__({settings:s});ie(o)||(n?await mEe(e,o):localStorage.setItem(S5(),o))}function lH(t,e){const n={};return Object.entries(t).forEach(([r,i])=>{const s=r;Object.entries(i).forEach(([o,a])=>{a[e]!==void 0&&(e==="project"&&(a.user!==void 0?a.project!==a.user:a.project!==a.default)||e==="user"&&a.user!==a.default)&&(n[s]||(n[s]={}),n[s][o]=a[e])})}),n}function E5(t,e,n){return Object.entries(n).forEach(([r,i])=>{const s=r;t[s]&&Object.entries(i).forEach(([o,a])=>{t[s][o]&&(t[s][o][e]=a)})}),t}function YI(t,e){return t.hideOnLevel===e||t.hideOnPlatform==="both"||(t.hideOnPlatform&&ft()?t.hideOnPlatform==="desktop":t.hideOnPlatform==="web")}function OEe(t,e){var n;return!YI(t,e)&&(t.Component||["string","boolean"].some(r=>typeof t.default===r)||((n=t.commandConfig)==null?void 0:n.inputType)&&["string","options","boolean"].some(r=>{var i;return((i=t.commandConfig)==null?void 0:i.inputType)===r}))}function FEe(t){return t.Component?"component":t.commandConfig?t.commandConfig.inputType:typeof t.default}const uJ="playwright",Zl={app:{theme:Zn.Dark,onboardingStatus:"dismissed",projectDirectory:"",enableSSAO:!1},modeling:{defaultUnit:"in",mouseControls:"KittyCAD",cameraProjection:"perspective",showDebugPanel:!0},projects:{defaultProjectName:"project-$nnn"},textEditor:{textWrapping:!0}};({...Zl,app:{...Zl.app,onboardingStatus:on.USER_MENU}});({...Zl,app:{...Zl.app,onboardingStatus:on.EXPORT}});({...Zl,app:{...Zl.app,onboardingStatus:on.PARAMETRIC_MODELING}});({...Zl,app:{...Zl.app}});({...Zl,app:{...Zl.app,theme:Zn.System}});Zn.Dark;const NEe=t=>e=>Object.fromEntries(Object.entries(t).map(([n,r])=>[n,e+r])),uw="/settings",ut={INDEX:"/",HOME:"/home",FILE:"/file",SETTINGS:uw,SETTINGS_USER:`${uw}?tab=user`,SETTINGS_PROJECT:`${uw}?tab=project`,SETTINGS_KEYBINDINGS:`${uw}?tab=keybindings`,SIGN_IN:"/signin",ONBOARDING:NEe(on)("/onboarding")},T5=`%2F${eg}%2F${Hq}${Ss}`;async function dJ(t,e){var s;if(!t)return;const n=ft(),r=localStorage.getItem(uJ)==="true";if((e===void 0||r)&&(e=n?await bv():cJ()),ie(e))return Promise.reject(e);if(e===void 0)return Promise.reject(new Error("No configuration found"));const i=DEe(e,t,(s=window==null?void 0:window.electron)==null?void 0:s.path);return ie(i)?Promise.reject(i):i}async function DEe(t,e,n){var a,l;let r=null,i="",s=null,o=null;return n&&((l=(a=t.settings)==null?void 0:a.project)!=null&&l.directory)&&e.startsWith(t.settings.project.directory)?(r=n.relative(t.settings.project.directory,e).split(n.sep)[0],i=n.join(t.settings.project.directory,r),r=r===""?null:r):(i=e,n?(n.extname(e)===".kcl"&&(i=n.dirname(e)),r=n.basename(i)):e.endsWith(".kcl")&&(i="/browser",r="browser")),n?i!==e&&(s=n.basename(e),o=e):(s="main.kcl",o=e),{projectName:r,projectPath:i,currentFileName:s,currentFilePath:o}}function fJ(t){return cf+t}const UEe=pbe==="true"&&C_,cH={id:"8675309",name:"Test User",email:"kittycad.sidebar.test@example.com",image:"https://placekitten.com/200/200",created_at:"yesteryear",updated_at:"today",company:"Test Company",discord:"Test User#1234",github:"testuser",phone:"555-555-5555",first_name:"Test",last_name:"User",can_train_on_data:!1,is_service_account:!1},_1="TOKEN_PERSIST_KEY",HEe=x_||hJ(Qq)||(localStorage==null?void 0:localStorage.getItem(_1))||"",jEe=Rg({types:{},actions:{goToIndexPage:()=>{},goToSignInPage:()=>{}},actors:{getUser:Ht(({input:t})=>QEe(t))}}).createMachine({id:"Auth",initial:"checkIfLoggedIn",context:{token:HEe},states:{checkIfLoggedIn:{id:"check-if-logged-in",invoke:{src:"getUser",input:({context:t})=>({token:t.token}),id:"check-logged-in",onDone:[{target:"loggedIn",actions:An(({context:t,event:e})=>({user:e.output.user,token:e.output.token||t.token}))}],onError:[{target:"loggedOut",actions:An({user:()=>{}})}]}},loggedIn:{entry:["goToIndexPage"],on:{"Log out":{target:"loggedOut",actions:()=>{ft()&&aJ("")}}}},loggedOut:{entry:["goToSignInPage"],on:{"Log in":{target:"checkIfLoggedIn",actions:An({token:({event:t})=>t.token||""})}}}},schema:{events:{}}});async function QEe(t){const e=await zEe(t),n=fJ("/user"),r={"Content-Type":"application/json"};if(!e&&ft())return Promise.reject(new Error("No token found"));if(e&&(r.Authorization=`Bearer ${e}`),UEe)return localStorage.getItem("FORCE_NO_IMAGE")&&(cH.image=""),{user:cH,token:e};const s=await(ft()?wEe(e):fetch(n,{method:"GET",credentials:"include",headers:r}).then(o=>o.json()).catch(o=>console.error("error from Browser getUser",o)));return localStorage.getItem("FORCE_NO_IMAGE")&&(s.image=""),"error_code"in s?Promise.reject(new Error(s.message)):{user:s,token:e}}function hJ(t){if(ft())return null;let e=t+"=",r=decodeURIComponent(document.cookie).split(";");for(let i=0;i<r.length;i++){let s=r[i];for(;s.charAt(0)===" ";)s=s.substring(1);if(s.indexOf(e)===0)return s.substring(e.length,s.length)}return null}async function zEe(t){if(x_)return x_;const e=t.token&&t.token!==""?t.token:hJ(Qq)||(localStorage==null?void 0:localStorage.getItem(_1))||"";if(e)return localStorage.setItem(_1,e),ft()&&aJ(e),e;if(!ft())return"";const n=ft()?await bEe():"";return n?(localStorage.setItem(_1,n),n):""}function AJ({groupId:t,type:e,state:n,send:r,actor:i,commandBarConfig:s,onCancel:o}){const a=s&&s[e];if(a){if(a instanceof Array)return a.map(u=>{const d={[e]:u};return AJ({groupId:t,type:e,state:n,send:r,actor:i,commandBarConfig:d,onCancel:o})}).filter(u=>u!==null)}else return null;if("hide"in a){const{hide:u}=a;if(u==="both")return null;if(u==="desktop"&&ft())return null;if(u==="web"&&!ft())return null}const l="icon"in a&&a.icon||void 0,c={name:e,groupId:t,icon:l,description:a.description,needsReview:a.needsReview||!1,onSubmit:u=>{u!=null?r({type:e,data:u}):r({type:e})}};if(a.args){const u=VEe(n,a.args,i);c.args=u}return o&&(c.onCancel=o),"displayName"in a&&(c.displayName=a.displayName),c}function VEe(t,e,n){const r={};for(const i in e){const s=e[i],o=pJ(s,t.context,n);r[i]=o}return r}function pJ(t,e,n){const r={description:t.description,required:t.required,skip:t.skip,machineActor:n,valueSummary:t.valueSummary,warningMessage:t.warningMessage??""};return t.inputType==="options"?{inputType:t.inputType,...r,defaultValue:t.defaultValueFromContext?t.defaultValueFromContext(e):t.defaultValue,options:t.optionsFromContext?t.optionsFromContext(e):t.options}:t.inputType==="selection"?{inputType:t.inputType,...r,multiple:t.multiple,selectionTypes:t.selectionTypes}:t.inputType==="kcl"?{inputType:t.inputType,defaultValue:t.defaultValue,...r}:{inputType:t.inputType,defaultValue:t.defaultValueFromContext?t.defaultValueFromContext(e):t.defaultValue,...r}}function GEe(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>n!==null&&typeof n=="object"&&"value"in n?[e,n.value]:[e,n]))}const WEe=Rg({types:{context:{},events:{}},actions:{enqueueValidArgsToSubmit:An({argumentsToSubmit:({context:t,event:e})=>{if(e.type!=="xstate.done.actor.validateSingleArgument")return{};const[n,r]=Object.entries(e.output)[0],{currentArgument:i}=t;return i?{...t.argumentsToSubmit,[n]:r}:{}}}),"Execute command":({context:t,event:e})=>{const{selectedCommand:n}=t;if(n)if(n!=null&&n.args&&e.type==="Submit command"||e.type==="xstate.done.actor.validateArguments"){const r={};for(const[i,s]of Object.entries(GEe(e.output)))r[i]=typeof s=="function"?s(t):s;n==null||n.onSubmit(r)}else n==null||n.onSubmit()},"Set current argument to first non-skippable":An({currentArgument:({context:t,event:e})=>{const{selectedCommand:n}=t;if(!(n&&n.args))return;const r="data"in e&&"arg"in e.data&&e.data.arg;let i=0;for(;i<Object.keys(n.args).length;){const[s,o]=Object.entries(n.args)[i];if(((typeof o.required=="function"?o.required(t):o.required)&&(!t.argumentsToSubmit.hasOwnProperty(s)||t.argumentsToSubmit[s]===void 0||r&&typeof r=="object"&&"name"in r&&r.name===s))===!0||i+1===Object.keys(n.args).length)return{...n.args[s],name:s};i++}}}),"Clear current argument":An({currentArgument:void 0}),"Remove argument":An({argumentsToSubmit:({context:t,event:e})=>{if(e.type!=="Remove argument")return t.argumentsToSubmit;const n=Object.values(e.data)[0],{[n.name]:r,...i}=t.argumentsToSubmit;return i}}),"Set current argument":An({currentArgument:({context:t,event:e})=>{switch(e.type){case"Edit argument":return e.data.arg;case"Change current argument":return Object.values(e.data)[0];default:return t.currentArgument}}}),"Clear argument data":An({selectedCommand:void 0,currentArgument:void 0,argumentsToSubmit:{}}),"Set selected command":An({selectedCommand:({context:t,event:e})=>e.type==="Select command"?e.data.command:t.selectedCommand}),"Find and select command":An({selectedCommand:({context:t,event:e})=>{if(e.type!=="Find and select command")return t.selectedCommand;const n=t.commands.find(r=>r.name===e.data.name&&r.groupId===e.data.groupId);return n||t.selectedCommand}}),"Initialize arguments to submit":An({argumentsToSubmit:({context:t,event:e})=>{if(e.type!=="Select command"&&e.type!=="Find and select command")return{};const n="data"in e&&"command"in e.data?e.data.command:t.selectedCommand;if(!(n!=null&&n.args))return{};const r={};for(const[i,s]of Object.entries(n.args))r[i]=e.data.argDefaultValues&&i in e.data.argDefaultValues?e.data.argDefaultValues[i]:s.skip&&"defaultValue"in s?s.defaultValue:void 0;return r}})},guards:{"Command needs review":({context:t})=>{var e;return((e=t.selectedCommand)==null?void 0:e.needsReview)||!1},"Command has no arguments":()=>!1,"All arguments are skippable":()=>!1},actors:{"Validate argument":Ht(({input:t})=>new Promise((e,n)=>{e(t)})),"Validate all arguments":Ht(({input:t})=>new Promise((e,n)=>{var r;for(const[i,s]of Object.entries(t.selectedCommand.args)){let o=t.argumentsToSubmit[i],a=typeof o=="function"?o(t):o;try{const l=typeof s.required=="function"?s.required(t):s.required,c="defaultValue"in s?typeof s.defaultValue=="function"?s.defaultValue(t):s.defaultValue:void 0,u=l&&c!==void 0&&typeof a!=typeof c&&!(s.inputType==="kcl"||s.skip),d=s.inputType==="kcl"&&!(a!=null&&a.valueAst),f=l&&"options"in s&&!(typeof s.options=="function"?s.options(t,(r=s.machineActor)==null?void 0:r.getSnapshot().context):s.options).some(h=>h.value===a);if(u||d||f)return n({message:"Argument payload is of the wrong type",arg:{...s,name:i}});if((s.inputType!=="boolean"&&s.inputType!=="options"?!a:a===void 0)&&l)return n({message:"Argument payload is falsy but is required",arg:{...s,name:i}})}catch(l){return console.error("Error validating argument",context,l),n(l)}}return e(t.argumentsToSubmit)}))}}).createMachine({context:{commands:[],selectedCommand:void 0,currentArgument:void 0,selectionRanges:{otherSelections:[],codeBasedSelections:[]},argumentsToSubmit:{}},id:"Command Bar",initial:"Closed",states:{Closed:{on:{Open:{target:"Selecting command"},"Find and select command":{target:"Command selected",actions:["Find and select command","Initialize arguments to submit"]},"Add commands":{target:"Closed",actions:[An({commands:({context:t,event:e})=>[...t.commands,...e.data.commands].sort(KEe)})],reenter:!1},"Remove commands":{target:"Closed",actions:[An({commands:({context:t,event:e})=>t.commands.filter(n=>!e.data.commands.some(r=>r.name===n.name&&r.groupId===n.groupId))})],reenter:!1}}},"Selecting command":{on:{"Select command":{target:"Command selected",actions:["Set selected command","Initialize arguments to submit"]}}},"Command selected":{always:[{target:"Closed",guard:"Command has no arguments",actions:["Execute command"]},{target:"Checking Arguments",guard:"All arguments are skippable"},{target:"Gathering arguments",actions:["Set current argument to first non-skippable"]}]},"Gathering arguments":{states:{"Awaiting input":{on:{"Submit argument":{target:"Validating"}}},Validating:{invoke:{src:"Validate argument",id:"validateSingleArgument",input:({event:t})=>t.type!=="Submit argument"?{}:t.data,onDone:{target:"#Command Bar.Checking Arguments",actions:["enqueueValidArgsToSubmit"]},onError:[{target:"Awaiting input"}]}}},initial:"Awaiting input",on:{"Change current argument":{target:"Gathering arguments",internal:!0,actions:["Set current argument"]},"Deselect command":{target:"Selecting command",actions:[An({selectedCommand:(t,e)=>{}})]}}},Review:{entry:["Clear current argument"],on:{"Submit command":{target:"Closed",actions:["Execute command"]},"Add argument":{target:"Gathering arguments",actions:["Set current argument"]},"Remove argument":{target:"Review",actions:["Remove argument"]},"Edit argument":{target:"Gathering arguments",actions:["Set current argument"]}}},"Checking Arguments":{invoke:{src:"Validate all arguments",id:"validateArguments",input:({context:t})=>t,onDone:[{target:"Review",guard:"Command needs review"},{target:"Closed",actions:"Execute command"}],onError:[{target:"Gathering arguments",actions:["Set current argument to first non-skippable"]}]}}},on:{Close:{target:".Closed"},Clear:{target:"#Command Bar",reenter:!1,actions:["Clear argument data"]}}});function KEe(t,e){return e.groupId==="auth"&&t.groupId!=="auth"?-2:t.groupId==="auth"&&e.groupId!=="auth"?2:e.groupId==="settings"&&t.groupId!=="settings"?-1:t.groupId==="settings"&&e.groupId!=="settings"?1:t.name.localeCompare(e.name)}const U_=FSe(WEe.provide({guards:{"Command has no arguments":({context:t})=>{var e,n;return!((e=t.selectedCommand)!=null&&e.args)||Object.keys((n=t.selectedCommand)==null?void 0:n.args).length===0},"All arguments are skippable":({context:t})=>Object.values(t.selectedCommand.args).every(e=>e.skip)}})),$Ee=({children:t})=>b.jsx(U_.Provider,{children:b.jsx(qEe,{children:t})});function qEe({children:t}){const e=U_.useActorRef();return P.useEffect(()=>{Ot.setCommandBarSend(e.send)}),t}const ni=()=>{const t=U_.useActorRef(),e=U_.useSelector(n=>n);return{commandBarSend:t.send,commandBarState:e}},mJ=P.createContext({code:(Kt==null?void 0:Kt.code)||"",programMemory:be==null?void 0:be.programMemory,ast:be==null?void 0:be.ast,isExecuting:be==null?void 0:be.isExecuting,errors:be==null?void 0:be.kclErrors,logs:be==null?void 0:be.logs,wasmInitFailed:be==null?void 0:be.wasmInitFailed});function uc(){return P.useContext(mJ)}function XEe({children:t}){const{code:e}=VI(),[n,r]=P.useState(e||Kt.code),[i,s]=P.useState(be.programMemory),[o,a]=P.useState(be.ast),[l,c]=P.useState(!1),[u,d]=P.useState([]),[f,h]=P.useState([]),[A,p]=P.useState(!1);return P.useEffect(()=>{Kt.registerCallBacks({setCode:r}),be.registerCallBacks({setProgramMemory:s,setAst:a,setLogs:h,setKclErrors:d,setIsExecuting:c,setWasmInitFailed:p})},[]),b.jsx(mJ.Provider,{value:{code:n,programMemory:i,ast:o,isExecuting:l,errors:u,logs:f,wasmInitFailed:A},children:t})}var ti=(t=>(t[t.Ok=0]="Ok",t[t.Weak=1]="Weak",t[t.Issue=2]="Issue",t[t.Disconnected=3]="Disconnected",t))(ti||{});function YEe(){const[t,e]=P.useState({type:No.Disconnected}),[n,r]=P.useState(structuredClone(jx)),[i,s]=P.useState(!0),[o,a]=P.useState(3),[l,c]=P.useState(void 0),[u,d]=P.useState(!1),[f,h]=P.useState(void 0),A=w=>w[1]===void 0?w[1]:!w[1],[p,m]=P.useState({[As.WebSocket]:void 0,[As.ICE]:void 0,[As.WebRTC]:void 0}),[g,y]=P.useState(void 0);return P.useEffect(()=>{a(i?g||g===void 0?2:l==="TIMEOUT"?1:0:3)},[g,i,l]),P.useEffect(()=>{const w=()=>{s(!0)},v=()=>{s(!1),r(structuredClone(jx))};return window.addEventListener("online",w),window.addEventListener("offline",v),()=>{window.removeEventListener("online",w),window.removeEventListener("offline",v)}},[]),P.useEffect(()=>{const w={[As.WebSocket]:n[As.WebSocket].reduce((v,x)=>v===!0||v===void 0?v:A(x),!1),[As.ICE]:n[As.ICE].reduce((v,x)=>v===!0||v===void 0?v:A(x),!1),[As.WebRTC]:n[As.WebRTC].reduce((v,x)=>v===!0||v===void 0?v:A(x),!1)};m(w)},[n]),P.useEffect(()=>{y(p[As.WebSocket]||p[As.ICE]||p[As.WebRTC])},[p]),P.useEffect(()=>{const w=({detail:C})=>{c(C)},v=({detail:C})=>{e(C),r(_=>{var E;let S=structuredClone(_);if(C.type===No.Connecting){const T=Object.values(S);for(let R of T)for(let k of R)k[0]===C.value.type&&(k[1]=!0)}if(C.type===No.Disconnecting){const T=Object.values(S);for(let R of T){for(let k of R)C.value.type===ng.Error&&((E=C.value.value.lastConnectingValue)==null?void 0:E.type)===k[0]&&(k[1]=!1);C.value.type===ng.Error&&h(C.value.value)}}return C.type===No.Disconnected?structuredClone(jx):S})},x=({detail:C})=>{C.addEventListener(Nc.PingPongChanged,w),C.addEventListener(Nc.ConnectionStateChanged,v),window.dispatchEvent(new CustomEvent("use-network-status-ready",{}))};return je.addEventListener(Wh.EngineAvailable,x),()=>{var C,_;je.removeEventListener(Wh.EngineAvailable,x),(C=je.engineConnection)==null||C.addEventListener(Nc.PingPongChanged,w),(_=je.engineConnection)==null||_.addEventListener(Nc.ConnectionStateChanged,v)}},[]),{immediateState:t,hasIssues:g,overallState:o,internetConnected:i,steps:n,issues:p,error:f,setHasCopied:d,hasCopied:u,pingPongHealth:l}}const gJ=P.createContext({immediateState:{type:No.Disconnected},hasIssues:void 0,overallState:ti.Disconnected,internetConnected:!0,steps:structuredClone(jx),issues:{[As.WebSocket]:void 0,[As.ICE]:void 0,[As.WebRTC]:void 0},error:void 0,setHasCopied:t=>{},hasCopied:!1,pingPongHealth:void 0}),Lg=()=>P.useContext(gJ),yJ=P.createContext({isStreamReady:!1,setAppState:()=>{}}),JI=()=>P.useContext(yJ),JEe=({children:t})=>{const[e,n]=P.useState({isStreamReady:!1,setAppState:()=>{}}),r=i=>n({...e,...i});return b.jsx(yJ.Provider,{value:{isStreamReady:e.isStreamReady,setAppState:r},children:t})},vJ=P.createContext({mediaStream:void 0,setMediaStream:()=>{}}),bJ=()=>P.useContext(vJ),ZEe=({children:t})=>{const[e,n]=P.useState(void 0);return b.jsx(vJ.Provider,{value:{mediaStream:e,setMediaStream:n},children:t})};function ZI({machineId:t,state:e,send:n,actor:r,commandBarConfig:i,allCommandsRequireNetwork:s=!1,onCancel:o}){const{commandBarSend:a}=ni(),{overallState:l}=Lg(),{isExecuting:c}=uc(),{isStreamReady:u}=JI();P.useEffect(()=>{const d=l!==ti.Ok&&l!==ti.Weak||c||!u,f=Ube(e).filter(h=>!s||!d).filter(h=>!["done.","error."].some(A=>h.includes(A))).flatMap(h=>AJ({groupId:t,type:h,state:e,send:n,actor:r,commandBarConfig:i,onCancel:o})).filter(h=>h!==null);return a({type:"Add commands",data:{commands:f}}),()=>{a({type:"Remove commands",data:{commands:f}})}},[e,l,c,u])}const eTe=Rg({types:{context:{},input:{},events:{}},actions:{setEngineTheme:()=>{},setClientTheme:()=>{},"Execute AST":()=>{},toastSuccess:()=>{},setEngineEdges:()=>{},setEngineScaleGridVisibility:()=>{},setClientSideSceneUnits:()=>{},persistSettings:()=>{},resetSettings:An(({context:t,event:e})=>{if(!("level"in e))return{};const n=e.level==="user"?lJ({}):XI({});return E5(t,e.level,n)}),setAllSettings:An(({event:t})=>"settings"in t?t.settings:{}),setSettingAtLevel:An(({context:t,event:e})=>{if(!("data"in e))return{};const{level:n,value:r}=e.data,[i,s]=e.type.replace(/^set./,"").split(".");return t[i][s][n]=r,{...t,[i]:{...t[i],[s]:t[i][s]}}}),setThemeClass:({context:t})=>{const e=t.app.theme.current??Zn.System;Gq(e===Zn.System?_f():e)},setEngineCameraProjection:({context:t})=>{const e=t.modeling.cameraProjection.current;Ke.camControls.setEngineCameraProjection(e)}}}).createMachine({id:"Settings",initial:"idle",context:({input:t})=>({...qI(),...t}),states:{idle:{entry:["setThemeClass","setClientSideSceneUnits"],on:{"*":{target:"persisting settings",actions:["setSettingAtLevel","toastSuccess"]},"set.app.onboardingStatus":{target:"persisting settings",actions:["setSettingAtLevel"]},"set.app.themeColor":{target:"persisting settings",actions:["setSettingAtLevel"]},"set.modeling.defaultUnit":{target:"persisting settings",actions:["setSettingAtLevel","toastSuccess","setClientSideSceneUnits","Execute AST"]},"set.app.theme":{target:"persisting settings",actions:["setSettingAtLevel","toastSuccess","setThemeClass","setEngineTheme","setClientTheme"]},"set.app.streamIdleMode":{target:"persisting settings",actions:["setSettingAtLevel","toastSuccess"]},"set.modeling.cameraProjection":{target:"persisting settings",actions:["setSettingAtLevel","toastSuccess","setEngineCameraProjection"]},"set.modeling.highlightEdges":{target:"persisting settings",actions:["setSettingAtLevel","toastSuccess","setEngineEdges"]},"Reset settings":{target:"persisting settings",actions:["resetSettings","setThemeClass","setEngineTheme","setClientSideSceneUnits","Execute AST","setClientTheme"]},"Set all settings":{actions:["setAllSettings","setThemeClass","setEngineTheme","setClientSideSceneUnits","Execute AST","setClientTheme"]},"set.modeling.showScaleGrid":{target:"persisting settings",actions:["setSettingAtLevel","toastSuccess","setEngineScaleGridVisibility"]}}},"persisting settings":{entry:["persistSettings"],always:"idle"}}}),tTe=(t,e)=>(t=t.replace(new RegExp("((?<![\\p{Uppercase_Letter}\\d])[\\p{Uppercase_Letter}\\d](?![\\p{Uppercase_Letter}\\d]))","gu"),n=>n.toLowerCase()),t.replace(new RegExp("(\\p{Uppercase_Letter}+)(\\p{Uppercase_Letter}\\p{Lowercase_Letter}+)","gu"),(n,r,i)=>r+e+i.toLowerCase()));function Wd(t,{separator:e="_",preserveConsecutiveUppercase:n=!1}={}){if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("The `text` and `separator` arguments should be of type `string`");if(t.length<2)return n?t:t.toLowerCase();const r=`$1${e}$2`,i=t.replace(new RegExp("([\\p{Lowercase_Letter}\\d])(\\p{Uppercase_Letter})","gu"),r);return n?tTe(i,e):i.replace(new RegExp("(\\p{Uppercase_Letter})(\\p{Uppercase_Letter}\\p{Lowercase_Letter}+)","gu"),r).toLowerCase()}const nTe={"Log in":{hide:"both"},"Log out":{args:[],icon:"arrowLeft"}};function uH(t,e){if(typeof e=="string")return e.split(".").reduce((n,r)=>{if(n)return n[r]},t)}const dH=t=>Object.entries(t).flatMap(([e,n])=>Object.entries(n).filter(([r,i])=>i.commandConfig!==void 0).map(([r])=>`${e}.${r}`)),rTe=(t,e,n)=>({inputType:"options",required:!0,defaultValue:e&&n!=="project"?"project":"user",skip:!0,options:e&&n!=="project"?[{name:"User",value:"user"},{name:"Project",value:"project",isCurrent:!0}]:[{name:"User",value:"user",isCurrent:!0}],machineActor:t});function iTe({type:t,send:e,context:n,actor:r,isProjectAvailable:i}){const s=uH(n,t),o=s.commandConfig,a=(s==null?void 0:s.hideOnLevel)==="user"&&!i,l=s.hideOnPlatform&&(ft()?s.hideOnPlatform==="desktop":s.hideOnPlatform==="web");if(!o||a||l)return null;let c={...o,required:!0};c.inputType==="boolean"&&(c={...c,inputType:"options",options:(f,h)=>{const A=uH(h,t),p=f.argumentsToSubmit.level,m=A[p]===void 0?A.getFallback(p)===!0:A[p]===!0;return[{name:"On",value:!0,isCurrent:m},{name:"Off",value:!1,isCurrent:!m}]}});const u=pJ(c,n,r);return{name:t,displayName:`Settings · ${Wd(t.replaceAll("."," · "),{separator:" "})}`,description:s.description,groupId:"settings",icon:"settings",needsReview:!1,onSubmit:f=>{f!=null?e({type:`set.${t}`,data:f}):e({type:t})},args:{level:rTe(r,i,s.hideOnLevel),value:u}}}const x2=(t,e)=>{const n=P.useRef(Math.random().toString()),[r,i]=P.useState(void 0),[s,o]=P.useState([]);P.useEffect(()=>{r&&t(r.eventType,r.path).catch(Bt)},[r]),P.useEffect(()=>{if(!ft())return;const c=(u,d)=>{i({eventType:u,path:d})};for(let u of s)window.electron.watchFileOn(u,n.current,c);return()=>{for(let u of s)window.electron.watchFileOff(u,n.current)}},[s]);function a(c,u){return[c.filter(d=>!u.find(f=>f===d)),c.filter(d=>!!u.find(f=>f===d))]}const l=a(e,s)[0].length!==0;P.useEffect(()=>{if(!ft()||!l)return;const[,c]=a(s,e),[u]=a(e,s);o(c.concat(u))},[l])};let wJ;const sTe=()=>wJ,e6=P.createContext({}),B5=({children:t})=>{const e=hf(ut.INDEX),n=hf(ut.FILE);return b.jsx(t6,{loadedSettings:e,loadedProject:n,children:t})},oTe=({children:t})=>{const e=C1;return b.jsx(t6,{loadedSettings:e,children:t})},t6=({children:t,loadedSettings:e,loadedProject:n})=>{var A;const r=Js(),i=Ui(),{commandBarSend:s}=ni(),[o,a]=P.useState(void 0),[l,c,u]=Ly(eTe.provide({actions:{setClientSideSceneUnits:({context:p,event:m})=>{const g=m.type==="set.modeling.defaultUnit"?m.data.value:p.modeling.defaultUnit.current;Ke.baseUnit=g},setEngineTheme:({context:p})=>{je.setTheme(p.app.theme.current).catch(Bt)},setEngineScaleGridVisibility:({context:p})=>{je.setScaleGridVisibility(p.modeling.showScaleGrid.current)},setClientTheme:({context:p})=>{const m=Wq(p.app.theme.current);Ke.theme=m,sn.updateSegmentBaseColor(m)},setEngineEdges:({context:p})=>{je.sendSceneCommand({cmd_id:Yt(),type:"modeling_cmd_req",cmd:{type:"edge_lines_visible",hidden:!p.modeling.highlightEdges.current}})},toastSuccess:({event:p})=>{var w;if(!("data"in p))return;const m=p.type.replace(/^set./,"").split("."),g=(w=p.data.value)==null?void 0:w.toString().slice(0,28),y=`Set ${Wd(m[1],{separator:" "})}`+(g?` to "${g}${g.length===28?"...":""}"${p.data.level==="project"?" for this project":" as a user default"}`:"");Zr.success(y,{duration:y.split(" ").length*100+1500,id:`${p.type}.success`})},"Execute AST":({context:p,event:m})=>{var g,y,w,v,x;try{const C=m.type==="Set all settings"&&((w=(y=(g=m.settings)==null?void 0:g.modeling)==null?void 0:y.defaultUnit)==null?void 0:w.current)!==p.modeling.defaultUnit.current,_=m.type==="Reset settings"&&p.modeling.defaultUnit.current!==((x=(v=C1==null?void 0:C1.modeling)==null?void 0:v.defaultUnit)==null?void 0:x.default);(m.type==="set.modeling.defaultUnit"||C||_)&&be.executeCode(!0)}catch(C){console.error("Error executing AST after settings change",C)}},persistSettings:({context:p,event:m})=>{var g;m.doNotPersist||IEe(p,(g=n==null?void 0:n.project)==null?void 0:g.path)}}}),{input:e});wJ=l.context,P.useEffect(()=>{ft()&&$I().then(a).catch(pt)},[]),x2(async()=>{var m,g,y;if((m=n==null?void 0:n.project)!=null&&m.path&&!window.electron.exists((g=n==null?void 0:n.project)==null?void 0:g.path)){i(ut.HOME);return}const p=await fg((y=n==null?void 0:n.project)==null?void 0:y.path);c({type:"Set all settings",settings:p.settings,doNotPersist:!0})},[o,(A=n==null?void 0:n.project)==null?void 0:A.path].filter(p=>p!==void 0)),P.useEffect(()=>{if(l.context.commandBar.includeSettings.current===!1)return;const p=dH(l.context).map(m=>iTe({type:m,send:c,context:l.context,actor:u,isProjectAvailable:n!==void 0})).filter(m=>m!==null);return s({type:"Add commands",data:{commands:p}}),()=>{s({type:"Remove commands",data:{commands:p}})}},[l,c,u,s,dH]),P.useEffect(()=>{const p=m=>{l.context.app.theme.current==="system"&&Gq(m.matches?Zn.Dark:Zn.Light)};return Hs==null||Hs.addEventListener("change",p),()=>Hs==null?void 0:Hs.removeEventListener("change",p)},[l.context]),P.useEffect(()=>{document.documentElement.style.setProperty("--primary-hue",l.context.app.themeColor.current)},[l.context.app.themeColor.current]),P.useEffect(()=>{document.documentElement.style.setProperty("--cursor-color",l.context.textEditor.blinkingCursor.current?"auto":"transparent")},[l.context.textEditor.blinkingCursor.current]);const[d,f,h]=Ly(jEe.provide({actions:{goToSignInPage:()=>{i(ut.SIGN_IN),xJ()},goToIndexPage:()=>{r.pathname.includes(ut.SIGN_IN)&&i(ut.INDEX)}}}));return ZI({machineId:"auth",state:d,send:f,commandBarConfig:nTe,actor:h}),b.jsx(e6.Provider,{value:{auth:{state:d,context:d.context,send:f},settings:{state:l,context:l.context,send:c}},children:t})};async function xJ(){return localStorage.removeItem(_1),ft()?Promise.resolve(null):fetch(fJ("/logout"),{method:"POST",credentials:"include"})}const aTe=Object.freeze(Object.defineProperty({__proto__:null,SettingsAuthContext:e6,SettingsAuthProvider:B5,SettingsAuthProviderBase:t6,SettingsAuthProviderJest:oTe,default:B5,getSettingsState:sTe,logout:xJ},Symbol.toStringTag,{value:"Module"})),In=()=>P.useContext(e6);function M5(t,e){const r=t.codeBasedSelections.map(({range:c})=>un(be.ast,c)).map(c=>{const u=Xe(be.ast,c);return ie(u)?u:u.node}),i=r.find(ie);if(ie(i))return i;const o=r.every(c=>(c==null?void 0:c.type)==="CallExpression"&&vo.includes(c.callee.name)),a=Sf(t,be.ast,e);return ie(a)?a:{enabled:o&&a.every(Boolean),transforms:a}}function fH(t,e,n,r){const i=M5(t,e);if(ie(i))return i;const s=i.transforms;return su({ast:n,selectionRanges:t,transformInfos:s,programMemory:r,referenceSegName:""})}function f0(t,e,n){let r=n.initialDeps??[],i;return()=>{var s,o,a,l;let c;n.key&&((s=n.debug)!=null&&s.call(n))&&(c=Date.now());const u=t();if(!(u.length!==r.length||u.some((h,A)=>r[A]!==h)))return i;r=u;let f;if(n.key&&((o=n.debug)!=null&&o.call(n))&&(f=Date.now()),i=e(...u),n.key&&((a=n.debug)!=null&&a.call(n))){const h=Math.round((Date.now()-c)*100)/100,A=Math.round((Date.now()-f)*100)/100,p=A/16,m=(g,y)=>{for(g=String(g);g.length<y;)g=" "+g;return g};console.info(`%c⏱ ${m(A,5)} /${m(h,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*p,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(l=n==null?void 0:n.onChange)==null||l.call(n,i),i}}function XT(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const lTe=(t,e)=>Math.abs(t-e)<1,cTe=(t,e,n)=>{let r;return function(...i){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,i),n)}},uTe=t=>t,dTe=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let i=e;i<=n;i++)r.push(i);return r},fTe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const i=o=>{const{width:a,height:l}=o;e({width:Math.round(a),height:Math.round(l)})};if(i(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(o=>{const a=o[0];if(a!=null&&a.borderBoxSize){const l=a.borderBoxSize[0];if(l){i({width:l.inlineSize,height:l.blockSize});return}}i(n.getBoundingClientRect())});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},hH={passive:!0},hTe=typeof window>"u"?!0:"onscrollend"in window,ATe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let i=0;const s=hTe?()=>{}:cTe(r,()=>{e(i,!1)},t.options.isScrollingResetDelay),o=c=>()=>{i=n[t.options.horizontal?"scrollLeft":"scrollTop"],s(),e(i,c)},a=o(!0),l=o(!1);return l(),n.addEventListener("scroll",a,hH),n.addEventListener("scrollend",l,hH),()=>{n.removeEventListener("scroll",a),n.removeEventListener("scrollend",l)}},pTe=(t,e,n)=>{if(e!=null&&e.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(t.getBoundingClientRect()[n.options.horizontal?"width":"height"])},mTe=(t,{adjustments:e=0,behavior:n},r)=>{var i,s;const o=t+e;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:o,behavior:n})};class gTe{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{this._measureElement(s.target,s)})}));return{disconnect:()=>{var i;return(i=r())==null?void 0:i.disconnect()},observe:i=>{var s;return(s=r())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=r())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:uTe,rangeExtractor:dTe,onChange:()=>{},measureElement:pTe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,...n}},this.notify=(n,r)=>{var i,s;const{startIndex:o,endIndex:a}=this.range??{startIndex:void 0,endIndex:void 0},l=this.calculateRange();(n||o!==(l==null?void 0:l.startIndex)||a!==(l==null?void 0:l.endIndex))&&((s=(i=this.options).onChange)==null||s.call(i,this,r))},this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.observer.disconnect(),this.elementsCache.clear()},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.notify(!1,!1);return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.notify(!1,!1)})),this.unsubs.push(this.options.observeElementOffset(this,(i,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i;const o=this.isScrolling;this.isScrolling=s,this.notify(o!==s,s)}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const i=new Map,s=new Map;for(let o=r-1;o>=0;o--){const a=n[o];if(i.has(a.lane))continue;const l=s.get(a.lane);if(l==null||a.end>l.end?s.set(a.lane,a):a.end<l.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=f0(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,i,s,o)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:o}),{key:!1}),this.getMeasurements=f0(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:o},a)=>{var l;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,c);for(let d=c;d<n;d++){let f=(l=this.measurementsCache[d])==null?void 0:l.measureElement;f||(f=v=>{const x=s(d),C=this.elementsCache.get(x);if(!v){C&&(this.observer.unobserve(C),this.elementsCache.delete(x));return}C!==v&&(C&&this.observer.unobserve(C),this.observer.observe(v),this.elementsCache.set(x,v)),v.isConnected&&this.resizeItem(d,this.options.measureElement(v,void 0,this))});const h=s(d),A=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),p=A?A.end+this.options.gap:r+i,m=a.get(h),g=typeof m=="number"?m:this.options.estimateSize(d),y=p+g,w=A?A.lane:d%this.options.lanes;u[d]={index:d,start:p,size:g,end:y,key:h,lane:w,measureElement:f}}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=f0(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,r,i)=>this.range=n.length>0&&r>0?yTe({measurements:n,outerSize:r,scrollOffset:i}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=f0(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,r,i,s)=>r===null?[]:n({startIndex:r.startIndex,endIndex:r.endIndex,overscan:i,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const i=this.indexFromElement(n),s=this.getMeasurements()[i];if(!s||!n.isConnected){this.elementsCache.forEach((a,l)=>{a===n&&(this.observer.unobserve(n),this.elementsCache.delete(l))});return}const o=this.elementsCache.get(s.key);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.elementsCache.set(s.key,n)),this.resizeItem(i,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const i=this.getMeasurements()[n];if(!i)return;const s=this.itemSizeCache.get(i.key)??i.size,o=r-s;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,o,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,r)),this.notify(!0,!1))},this.measureElement=n=>{n&&this._measureElement(n,void 0)},this.getVirtualItems=f0(()=>[this.getIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let s=0,o=n.length;s<o;s++){const a=n[s],l=r[a];i.push(l)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return XT(r[CJ(0,r.length-1,i=>XT(r[i]).start,n)])},this.getOffsetForAlignment=(n,r)=>{const i=this.getSize(),s=this.getScrollOffset();r==="auto"&&(n<=s?r="start":n>=s+i?r="end":r="start"),r==="start"?n=n:r==="end"?n=n-i:r==="center"&&(n=n-i/2);const o=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[o]:this.scrollElement[o]:0)-i;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getMeasurements()[n];if(!i)return;const s=this.getSize(),o=this.getScrollOffset();if(r==="auto")if(i.end>=o+s-this.options.scrollPaddingEnd)r="end";else if(i.start<=o+this.options.scrollPaddingStart)r="start";else return[o,r];const a=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:r="start",behavior:i}={})=>{this.cancelScrollToIndex(),i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:i})},this.scrollToIndex=(n,{align:r="auto",behavior:i}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const s=this.getOffsetForIndex(n,r);if(!s)return;const[o,a]=s;this._scrollToOffset(o,{adjustments:void 0,behavior:i}),i!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[c]=XT(this.getOffsetForIndex(n,a));lTe(c,this.getScrollOffset())||this.scrollToIndex(n,{align:a,behavior:i})}else this.scrollToIndex(n,{align:a,behavior:i})}))},this.scrollBy=(n,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;return r.length===0?i=this.options.paddingStart:i=this.options.lanes===1?((n=r[r.length-1])==null?void 0:n.end)??0:Math.max(...r.slice(-this.options.lanes).map(s=>s.end)),i-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{var n,r;this.itemSizeCache=new Map,(r=(n=this.options).onChange)==null||r.call(n,this,!1)},this.setOptions(e)}}const CJ=(t,e,n,r)=>{for(;t<=e;){const i=(t+e)/2|0,s=n(i);if(s<r)t=i+1;else if(s>r)e=i-1;else return i}return t>0?t-1:0};function yTe({measurements:t,outerSize:e,scrollOffset:n}){const r=t.length-1,s=CJ(0,r,a=>t[a].start,n);let o=s;for(;o<r&&t[o].end<n+e;)o++;return{startIndex:s,endIndex:o}}const vTe=typeof document<"u"?P.useLayoutEffect:P.useEffect;function bTe(t){const e=P.useReducer(()=>({}),{})[1],n={...t,onChange:(i,s)=>{var o;s?bg.flushSync(e):e(),(o=t.onChange)==null||o.call(t,i,s)}},[r]=P.useState(()=>new gTe(n));return r.setOptions(n),P.useEffect(()=>r._didMount(),[]),vTe(()=>r._willUpdate()),r}function wTe(t){return bTe({observeElementRect:fTe,observeElementOffset:ATe,scrollToFn:mTe,...t})}var xTe=Object.defineProperty,CTe=(t,e,n)=>e in t?xTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,YT=(t,e,n)=>(CTe(t,typeof e!="symbol"?e+"":e,n),n);let _Te=class{constructor(){YT(this,"current",this.detect()),YT(this,"handoffState","pending"),YT(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},zc=new _Te,Hn=(t,e)=>{zc.isServer?P.useEffect(t,e):P.useLayoutEffect(t,e)};function po(t){let e=P.useRef(t);return Hn(()=>{e.current=t},[t]),e}function n6(t,e){let[n,r]=P.useState(t),i=po(t);return Hn(()=>r(i.current),[i,r,...e]),n}let nt=function(t){let e=po(t);return at.useCallback((...n)=>e.current(...n),[e])};function r6(t,e,n){let[r,i]=P.useState(n),s=t!==void 0,o=P.useRef(s),a=P.useRef(!1),l=P.useRef(!1);return s&&!o.current&&!a.current?(a.current=!0,o.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&o.current&&!l.current&&(l.current=!0,o.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?t:r,nt(c=>(s||i(c),e==null?void 0:e(c)))]}function C2(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function Go(){let t=[],e={addEventListener(n,r,i,s){return n.addEventListener(r,i,s),e.add(()=>n.removeEventListener(r,i,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return e.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return e.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return C2(()=>{r.current&&n[0]()}),e.add(()=>{r.current=!1})},style(n,r,i){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:i}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Go();return n(r),this.add(()=>r.dispose())},add(n){return t.push(n),()=>{let r=t.indexOf(n);if(r>=0)for(let i of t.splice(r,1))i()}},dispose(){for(let n of t.splice(0))n()}};return e}function dc(){let[t]=P.useState(Go);return P.useEffect(()=>()=>t.dispose(),[t]),t}function STe(){let t=typeof document>"u";return"useSyncExternalStore"in hm?(e=>e.useSyncExternalStore)(hm)(()=>()=>{},()=>!1,()=>!t):!1}function Ig(){let t=STe(),[e,n]=P.useState(zc.isHandoffComplete);return e&&zc.isHandoffComplete===!1&&n(!1),P.useEffect(()=>{e!==!0&&n(!0)},[e]),P.useEffect(()=>zc.handoff(),[]),t?!1:e}var AH;let ur=(AH=at.useId)!=null?AH:function(){let t=Ig(),[e,n]=at.useState(t?()=>zc.nextId():null);return Hn(()=>{e===null&&n(zc.nextId())},[e]),e!=null?""+e:void 0};function _n(t,e,...n){if(t in e){let i=e[t];return typeof i=="function"?i(...n):i}let r=new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(i=>`"${i}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,_n),r}function dA(t){return zc.isServer?null:t instanceof Node?t.ownerDocument:t!=null&&t.hasOwnProperty("current")&&t.current instanceof Node?t.current.ownerDocument:document}let k5=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(t=>`${t}:not([tabindex='-1'])`).join(",");var Jr=(t=>(t[t.First=1]="First",t[t.Previous=2]="Previous",t[t.Next=4]="Next",t[t.Last=8]="Last",t[t.WrapAround=16]="WrapAround",t[t.NoScroll=32]="NoScroll",t))(Jr||{}),Xh=(t=>(t[t.Error=0]="Error",t[t.Overflow=1]="Overflow",t[t.Success=2]="Success",t[t.Underflow=3]="Underflow",t))(Xh||{}),ETe=(t=>(t[t.Previous=-1]="Previous",t[t.Next=1]="Next",t))(ETe||{});function wv(t=document.body){return t==null?[]:Array.from(t.querySelectorAll(k5)).sort((e,n)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var _2=(t=>(t[t.Strict=0]="Strict",t[t.Loose=1]="Loose",t))(_2||{});function S2(t,e=0){var n;return t===((n=dA(t))==null?void 0:n.body)?!1:_n(e,{0(){return t.matches(k5)},1(){let r=t;for(;r!==null;){if(r.matches(k5))return!0;r=r.parentElement}return!1}})}function _J(t){let e=dA(t);Go().nextFrame(()=>{e&&!S2(e.activeElement,0)&&Kd(t)})}var TTe=(t=>(t[t.Keyboard=0]="Keyboard",t[t.Mouse=1]="Mouse",t))(TTe||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",t=>{t.metaKey||t.altKey||t.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",t=>{t.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:t.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Kd(t){t==null||t.focus({preventScroll:!0})}let BTe=["textarea","input"].join(",");function MTe(t){var e,n;return(n=(e=t==null?void 0:t.matches)==null?void 0:e.call(t,BTe))!=null?n:!1}function E2(t,e=n=>n){return t.slice().sort((n,r)=>{let i=e(n),s=e(r);if(i===null||s===null)return 0;let o=i.compareDocumentPosition(s);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function kTe(t,e){return co(wv(),e,{relativeTo:t})}function co(t,e,{sorted:n=!0,relativeTo:r=null,skipElements:i=[]}={}){let s=Array.isArray(t)?t.length>0?t[0].ownerDocument:document:t.ownerDocument,o=Array.isArray(t)?n?E2(t):t:wv(t);i.length>0&&o.length>1&&(o=o.filter(h=>!i.includes(h))),r=r??s.activeElement;let a=(()=>{if(e&5)return 1;if(e&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(e&1)return 0;if(e&2)return Math.max(0,o.indexOf(r))-1;if(e&4)return Math.max(0,o.indexOf(r))+1;if(e&8)return o.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=e&32?{preventScroll:!0}:{},u=0,d=o.length,f;do{if(u>=d||u+d<=0)return 0;let h=l+u;if(e&16)h=(h+d)%d;else{if(h<0)return 3;if(h>=d)return 1}f=o[h],f==null||f.focus(c),u+=a}while(f!==s.activeElement);return e&6&&MTe(f)&&f.select(),2}function SJ(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function RTe(){return/Android/gi.test(window.navigator.userAgent)}function EJ(){return SJ()||RTe()}function dw(t,e,n){let r=po(e);P.useEffect(()=>{function i(s){r.current(s)}return document.addEventListener(t,i,n),()=>document.removeEventListener(t,i,n)},[t,n])}function TJ(t,e,n){let r=po(e);P.useEffect(()=>{function i(s){r.current(s)}return window.addEventListener(t,i,n),()=>window.removeEventListener(t,i,n)},[t,n])}function T2(t,e,n=!0){let r=P.useRef(!1);P.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function i(o,a){if(!r.current||o.defaultPrevented)return;let l=a(o);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let c=function u(d){return typeof d=="function"?u(d()):Array.isArray(d)||d instanceof Set?d:[d]}(t);for(let u of c){if(u===null)continue;let d=u instanceof HTMLElement?u:u.current;if(d!=null&&d.contains(l)||o.composed&&o.composedPath().includes(d))return}return!S2(l,_2.Loose)&&l.tabIndex!==-1&&o.preventDefault(),e(o,l)}let s=P.useRef(null);dw("pointerdown",o=>{var a,l;r.current&&(s.current=((l=(a=o.composedPath)==null?void 0:a.call(o))==null?void 0:l[0])||o.target)},!0),dw("mousedown",o=>{var a,l;r.current&&(s.current=((l=(a=o.composedPath)==null?void 0:a.call(o))==null?void 0:l[0])||o.target)},!0),dw("click",o=>{EJ()||s.current&&(i(o,()=>s.current),s.current=null)},!0),dw("touchend",o=>i(o,()=>o.target instanceof HTMLElement?o.target:null),!0),TJ("blur",o=>i(o,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function fc(...t){return P.useMemo(()=>dA(...t),[...t])}function pH(t){var e;if(t.type)return t.type;let n=(e=t.as)!=null?e:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function xv(t,e){let[n,r]=P.useState(()=>pH(t));return Hn(()=>{r(pH(t))},[t.type,t.as]),Hn(()=>{n||e.current&&e.current instanceof HTMLButtonElement&&!e.current.hasAttribute("type")&&r("button")},[n,e]),n}let BJ=Symbol();function i6(t,e=!0){return Object.assign(t,{[BJ]:e})}function Rn(...t){let e=P.useRef(t);P.useEffect(()=>{e.current=t},[t]);let n=nt(r=>{for(let i of e.current)i!=null&&(typeof i=="function"?i(r):i.current=r)});return t.every(r=>r==null||(r==null?void 0:r[BJ]))?void 0:n}function mH(t){return[t.screenX,t.screenY]}function MJ(){let t=P.useRef([-1,-1]);return{wasMoved(e){let n=mH(e);return t.current[0]===n[0]&&t.current[1]===n[1]?!1:(t.current=n,!0)},update(e){t.current=mH(e)}}}function s6({container:t,accept:e,walk:n,enabled:r=!0}){let i=P.useRef(e),s=P.useRef(n);P.useEffect(()=>{i.current=e,s.current=n},[e,n]),Hn(()=>{if(!t||!r)return;let o=dA(t);if(!o)return;let a=i.current,l=s.current,c=Object.assign(d=>a(d),{acceptNode:a}),u=o.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;u.nextNode();)l(u.currentNode)},[t,r,i,s])}function Fy(t,e){let n=P.useRef([]),r=nt(t);P.useEffect(()=>{let i=[...n.current];for(let[s,o]of e.entries())if(n.current[s]!==o){let a=r(e,i);return n.current=e,a}},[r,...e])}function H_(...t){return Array.from(new Set(t.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}var go=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(go||{}),gd=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(gd||{});function Sn({ourProps:t,theirProps:e,slot:n,defaultTag:r,features:i,visible:s=!0,name:o,mergeRefs:a}){a=a??PTe;let l=kJ(e,t);if(s)return fw(l,n,r,o,a);let c=i??0;if(c&2){let{static:u=!1,...d}=l;if(u)return fw(d,n,r,o,a)}if(c&1){let{unmount:u=!0,...d}=l;return _n(u?0:1,{0(){return null},1(){return fw({...d,hidden:!0,style:{display:"none"}},n,r,o,a)}})}return fw(l,n,r,o,a)}function fw(t,e={},n,r,i){let{as:s=n,children:o,refName:a="ref",...l}=JT(t,["unmount","static"]),c=t.ref!==void 0?{[a]:t.ref}:{},u=typeof o=="function"?o(e):o;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(e));let d={};if(e){let f=!1,h=[];for(let[A,p]of Object.entries(e))typeof p=="boolean"&&(f=!0),p===!0&&h.push(A);f&&(d["data-headlessui-state"]=h.join(" "))}if(s===P.Fragment&&Object.keys(Ny(l)).length>0){if(!P.isValidElement(u)||Array.isArray(u)&&u.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(p=>`  - ${p}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(p=>`  - ${p}`).join(`
`)].join(`
`));let f=u.props,h=typeof(f==null?void 0:f.className)=="function"?(...p)=>H_(f==null?void 0:f.className(...p),l.className):H_(f==null?void 0:f.className,l.className),A=h?{className:h}:{};return P.cloneElement(u,Object.assign({},kJ(u.props,Ny(JT(l,["ref"]))),d,c,{ref:i(u.ref,c.ref)},A))}return P.createElement(s,Object.assign({},JT(l,["ref"]),s!==P.Fragment&&c,s!==P.Fragment&&d),u)}function o6(){let t=P.useRef([]),e=P.useCallback(n=>{for(let r of t.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return t.current=n,e}}function PTe(...t){return t.every(e=>e==null)?void 0:e=>{for(let n of t)n!=null&&(typeof n=="function"?n(e):n.current=e)}}function kJ(...t){if(t.length===0)return{};if(t.length===1)return t[0];let e={},n={};for(let r of t)for(let i in r)i.startsWith("on")&&typeof r[i]=="function"?(n[i]!=null||(n[i]=[]),n[i].push(r[i])):e[i]=r[i];if(e.disabled||e["aria-disabled"])return Object.assign(e,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(e,{[r](i,...s){let o=n[r];for(let a of o){if((i instanceof Event||(i==null?void 0:i.nativeEvent)instanceof Event)&&i.defaultPrevented)return;a(i,...s)}}});return e}function En(t){var e;return Object.assign(P.forwardRef(t),{displayName:(e=t.displayName)!=null?e:t.name})}function Ny(t){let e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function JT(t,e=[]){let n=Object.assign({},t);for(let r of e)r in n&&delete n[r];return n}let LTe="div";var rl=(t=>(t[t.None=1]="None",t[t.Focusable=2]="Focusable",t[t.Hidden=4]="Hidden",t))(rl||{});function ITe(t,e){var n;let{features:r=1,...i}=t,s={ref:e,"aria-hidden":(r&2)===2?!0:(n=i["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Sn({ourProps:s,theirProps:i,slot:{},defaultTag:LTe,name:"Hidden"})}let ec=En(ITe),a6=P.createContext(null);a6.displayName="OpenClosedContext";var Dn=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(Dn||{});function Bf(){return P.useContext(a6)}function Cv({value:t,children:e}){return at.createElement(a6.Provider,{value:t},e)}function OTe(t){function e(){document.readyState!=="loading"&&(t(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let Rl=[];OTe(()=>{function t(e){e.target instanceof HTMLElement&&e.target!==document.body&&Rl[0]!==e.target&&(Rl.unshift(e.target),Rl=Rl.filter(n=>n!=null&&n.isConnected),Rl.splice(10))}window.addEventListener("click",t,{capture:!0}),window.addEventListener("mousedown",t,{capture:!0}),window.addEventListener("focus",t,{capture:!0}),document.body.addEventListener("click",t,{capture:!0}),document.body.addEventListener("mousedown",t,{capture:!0}),document.body.addEventListener("focus",t,{capture:!0})});function lu(t){let e=t.parentElement,n=null;for(;e&&!(e instanceof HTMLFieldSetElement);)e instanceof HTMLLegendElement&&(n=e),e=e.parentElement;let r=(e==null?void 0:e.getAttribute("disabled"))==="";return r&&FTe(n)?!1:r}function FTe(t){if(!t)return!1;let e=t.previousElementSibling;for(;e!==null;){if(e instanceof HTMLLegendElement)return!1;e=e.previousElementSibling}return!0}function NTe(t){throw new Error("Unexpected object: "+t)}var $n=(t=>(t[t.First=0]="First",t[t.Previous=1]="Previous",t[t.Next=2]="Next",t[t.Last=3]="Last",t[t.Specific=4]="Specific",t[t.Nothing=5]="Nothing",t))($n||{});function R5(t,e){let n=e.resolveItems();if(n.length<=0)return null;let r=e.resolveActiveIndex(),i=r??-1;switch(t.focus){case 0:{for(let s=0;s<n.length;++s)if(!e.resolveDisabled(n[s],s,n))return s;return r}case 1:{for(let s=i-1;s>=0;--s)if(!e.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=i+1;s<n.length;++s)if(!e.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!e.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(e.resolveId(n[s],s,n)===t.id)return s;return r}case 5:return null;default:NTe(t)}}function l6(t={},e=null,n=[]){for(let[r,i]of Object.entries(t))PJ(n,RJ(e,r),i);return n}function RJ(t,e){return t?t+"["+e+"]":e}function PJ(t,e,n){if(Array.isArray(n))for(let[r,i]of n.entries())PJ(t,RJ(e,r.toString()),i);else n instanceof Date?t.push([e,n.toISOString()]):typeof n=="boolean"?t.push([e,n?"1":"0"]):typeof n=="string"?t.push([e,n]):typeof n=="number"?t.push([e,`${n}`]):n==null?t.push([e,""]):l6(n,e,t)}function LJ(t){var e,n;let r=(e=t==null?void 0:t.form)!=null?e:t.closest("form");if(r){for(let i of r.elements)if(i!==t&&(i.tagName==="INPUT"&&i.type==="submit"||i.tagName==="BUTTON"&&i.type==="submit"||i.nodeName==="INPUT"&&i.type==="image")){i.click();return}(n=r.requestSubmit)==null||n.call(r)}}var Vt=(t=>(t.Space=" ",t.Enter="Enter",t.Escape="Escape",t.Backspace="Backspace",t.Delete="Delete",t.ArrowLeft="ArrowLeft",t.ArrowUp="ArrowUp",t.ArrowRight="ArrowRight",t.ArrowDown="ArrowDown",t.Home="Home",t.End="End",t.PageUp="PageUp",t.PageDown="PageDown",t.Tab="Tab",t))(Vt||{}),DTe={},UTe=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(UTe||{}),HTe=(t=>(t[t.Single=0]="Single",t[t.Multi=1]="Multi",t))(HTe||{}),jTe=(t=>(t[t.Pointer=0]="Pointer",t[t.Focus=1]="Focus",t[t.Other=2]="Other",t))(jTe||{}),QTe=(t=>(t[t.OpenCombobox=0]="OpenCombobox",t[t.CloseCombobox=1]="CloseCombobox",t[t.GoToOption=2]="GoToOption",t[t.RegisterOption=3]="RegisterOption",t[t.UnregisterOption=4]="UnregisterOption",t[t.RegisterLabel=5]="RegisterLabel",t[t.SetActivationTrigger=6]="SetActivationTrigger",t[t.UpdateVirtualOptions=7]="UpdateVirtualOptions",t))(QTe||{});function ZT(t,e=n=>n){let n=t.activeOptionIndex!==null?t.options[t.activeOptionIndex]:null,r=e(t.options.slice()),i=r.length>0&&r[0].dataRef.current.order!==null?r.sort((o,a)=>o.dataRef.current.order-a.dataRef.current.order):E2(r,o=>o.dataRef.current.domRef.current),s=n?i.indexOf(n):null;return s===-1&&(s=null),{options:i,activeOptionIndex:s}}let zTe={1(t){var e;return(e=t.dataRef.current)!=null&&e.disabled||t.comboboxState===1?t:{...t,activeOptionIndex:null,comboboxState:1}},0(t){var e,n;if((e=t.dataRef.current)!=null&&e.disabled||t.comboboxState===0)return t;if((n=t.dataRef.current)!=null&&n.value){let r=t.dataRef.current.calculateIndex(t.dataRef.current.value);if(r!==-1)return{...t,activeOptionIndex:r,comboboxState:0}}return{...t,comboboxState:0}},2(t,e){var n,r,i,s,o;if((n=t.dataRef.current)!=null&&n.disabled||(r=t.dataRef.current)!=null&&r.optionsRef.current&&!((i=t.dataRef.current)!=null&&i.optionsPropsRef.current.static)&&t.comboboxState===1)return t;if(t.virtual){let u=e.focus===$n.Specific?e.idx:R5(e,{resolveItems:()=>t.virtual.options,resolveActiveIndex:()=>{var f,h;return(h=(f=t.activeOptionIndex)!=null?f:t.virtual.options.findIndex(A=>!t.virtual.disabled(A)))!=null?h:null},resolveDisabled:t.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),d=(s=e.trigger)!=null?s:2;return t.activeOptionIndex===u&&t.activationTrigger===d?t:{...t,activeOptionIndex:u,activationTrigger:d}}let a=ZT(t);if(a.activeOptionIndex===null){let u=a.options.findIndex(d=>!d.dataRef.current.disabled);u!==-1&&(a.activeOptionIndex=u)}let l=e.focus===$n.Specific?e.idx:R5(e,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled}),c=(o=e.trigger)!=null?o:2;return t.activeOptionIndex===l&&t.activationTrigger===c?t:{...t,...a,activeOptionIndex:l,activationTrigger:c}},3:(t,e)=>{var n,r,i;if((n=t.dataRef.current)!=null&&n.virtual)return{...t,options:[...t.options,e.payload]};let s=e.payload,o=ZT(t,l=>(l.push(s),l));t.activeOptionIndex===null&&(r=t.dataRef.current)!=null&&r.isSelected(e.payload.dataRef.current.value)&&(o.activeOptionIndex=o.options.indexOf(s));let a={...t,...o,activationTrigger:2};return(i=t.dataRef.current)!=null&&i.__demoMode&&t.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(t,e)=>{var n;if((n=t.dataRef.current)!=null&&n.virtual)return{...t,options:t.options.filter(i=>i.id!==e.id)};let r=ZT(t,i=>{let s=i.findIndex(o=>o.id===e.id);return s!==-1&&i.splice(s,1),i});return{...t,...r,activationTrigger:2}},5:(t,e)=>t.labelId===e.id?t:{...t,labelId:e.id},6:(t,e)=>t.activationTrigger===e.trigger?t:{...t,activationTrigger:e.trigger},7:(t,e)=>{var n;if(((n=t.virtual)==null?void 0:n.options)===e.options)return t;let r=t.activeOptionIndex;if(t.activeOptionIndex!==null){let i=e.options.indexOf(t.virtual.options[t.activeOptionIndex]);i!==-1?r=i:r=null}return{...t,activeOptionIndex:r,virtual:Object.assign({},t.virtual,{options:e.options})}}},c6=P.createContext(null);c6.displayName="ComboboxActionsContext";function _v(t){let e=P.useContext(c6);if(e===null){let n=new Error(`<${t} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,_v),n}return e}let IJ=P.createContext(null);function VTe(t){var e;let n=fA("VirtualProvider"),[r,i]=P.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let c=window.getComputedStyle(l);return[parseFloat(c.paddingBlockStart||c.paddingTop),parseFloat(c.paddingBlockEnd||c.paddingBottom)]},[n.optionsRef.current]),s=wTe({scrollPaddingStart:r,scrollPaddingEnd:i,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[o,a]=P.useState(0);return Hn(()=>{a(l=>l+1)},[(e=n.virtual)==null?void 0:e.options]),at.createElement(IJ.Provider,{value:s},at.createElement("div",{style:{position:"relative",width:"100%",height:`${s.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&DTe.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&s.scrollToIndex(n.activeOptionIndex)}}},s.getVirtualItems().map(l=>{var c;return at.createElement(P.Fragment,{key:l.key},at.cloneElement((c=t.children)==null?void 0:c.call(t,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${o}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let u6=P.createContext(null);u6.displayName="ComboboxDataContext";function fA(t){let e=P.useContext(u6);if(e===null){let n=new Error(`<${t} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,fA),n}return e}function GTe(t,e){return _n(e.type,zTe,t,e)}let WTe=P.Fragment;function KTe(t,e){let{value:n,defaultValue:r,onChange:i,form:s,name:o,by:a=null,disabled:l=!1,__demoMode:c=!1,nullable:u=!1,multiple:d=!1,immediate:f=!1,virtual:h=null,...A}=t,p=!1,m=null,[g=d?[]:void 0,y]=r6(n,i,r),[w,v]=P.useReducer(GTe,{dataRef:P.createRef(),comboboxState:c?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),x=P.useRef(!1),C=P.useRef({static:!1,hold:!1}),_=P.useRef(null),S=P.useRef(null),E=P.useRef(null),T=P.useRef(null),R=nt(typeof a=="string"?(ke,Ge)=>{let Ve=a;return(ke==null?void 0:ke[Ve])===(Ge==null?void 0:Ge[Ve])}:a??((ke,Ge)=>ke===Ge)),k=nt(ke=>w.options.findIndex(Ge=>R(Ge.dataRef.current.value,ke))),B=P.useCallback(ke=>_n(F.mode,{1:()=>g.some(Ge=>R(Ge,ke)),0:()=>R(g,ke)}),[g]),M=nt(ke=>w.activeOptionIndex===k(ke)),F=P.useMemo(()=>({...w,immediate:p,optionsPropsRef:C,labelRef:_,inputRef:S,buttonRef:E,optionsRef:T,value:g,defaultValue:r,disabled:l,mode:d?1:0,virtual:w.virtual,get activeOptionIndex(){if(x.current&&w.activeOptionIndex===null&&w.options.length>0){let ke=w.options.findIndex(Ge=>!Ge.dataRef.current.disabled);if(ke!==-1)return ke}return w.activeOptionIndex},calculateIndex:k,compare:R,isSelected:B,isActive:M,nullable:u,__demoMode:c}),[g,r,l,d,u,c,w,m]);Hn(()=>{},[m,void 0]),Hn(()=>{w.dataRef.current=F},[F]),T2([F.buttonRef,F.inputRef,F.optionsRef],()=>ge.closeCombobox(),F.comboboxState===0);let I=P.useMemo(()=>{var ke,Ge,Ve;return{open:F.comboboxState===0,disabled:l,activeIndex:F.activeOptionIndex,activeOption:F.activeOptionIndex===null?null:F.virtual?F.virtual.options[(ke=F.activeOptionIndex)!=null?ke:0]:(Ve=(Ge=F.options[F.activeOptionIndex])==null?void 0:Ge.dataRef.current.value)!=null?Ve:null,value:g}},[F,l,g]),z=nt(()=>{if(F.activeOptionIndex!==null){if(F.virtual)Se(F.virtual.options[F.activeOptionIndex]);else{let{dataRef:ke}=F.options[F.activeOptionIndex];Se(ke.current.value)}ge.goToOption($n.Specific,F.activeOptionIndex)}}),Y=nt(()=>{v({type:0}),x.current=!0}),$=nt(()=>{v({type:1}),x.current=!1}),ee=nt((ke,Ge,Ve)=>(x.current=!1,ke===$n.Specific?v({type:2,focus:$n.Specific,idx:Ge,trigger:Ve}):v({type:2,focus:ke,trigger:Ve}))),W=nt((ke,Ge)=>(v({type:3,payload:{id:ke,dataRef:Ge}}),()=>{F.isActive(Ge.current.value)&&(x.current=!0),v({type:4,id:ke})})),ne=nt(ke=>(v({type:5,id:ke}),()=>v({type:5,id:null}))),Se=nt(ke=>_n(F.mode,{0(){return y==null?void 0:y(ke)},1(){let Ge=F.value.slice(),Ve=Ge.findIndex(q=>R(q,ke));return Ve===-1?Ge.push(ke):Ge.splice(Ve,1),y==null?void 0:y(Ge)}})),fe=nt(ke=>{v({type:6,trigger:ke})}),ge=P.useMemo(()=>({onChange:Se,registerOption:W,registerLabel:ne,goToOption:ee,closeCombobox:$,openCombobox:Y,setActivationTrigger:fe,selectActiveOption:z}),[]),Oe=e===null?{}:{ref:e},Fe=P.useRef(null),De=dc();return P.useEffect(()=>{Fe.current&&r!==void 0&&De.addEventListener(Fe.current,"reset",()=>{y==null||y(r)})},[Fe,y]),at.createElement(c6.Provider,{value:ge},at.createElement(u6.Provider,{value:F},at.createElement(Cv,{value:_n(F.comboboxState,{0:Dn.Open,1:Dn.Closed})},o!=null&&g!=null&&l6({[o]:g}).map(([ke,Ge],Ve)=>at.createElement(ec,{features:rl.Hidden,ref:Ve===0?q=>{var Ue;Fe.current=(Ue=q==null?void 0:q.closest("form"))!=null?Ue:null}:void 0,...Ny({key:ke,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:l,name:ke,value:Ge})})),Sn({ourProps:Oe,theirProps:A,slot:I,defaultTag:WTe,name:"Combobox"}))))}let $Te="input";function qTe(t,e){var n,r,i,s,o;let a=ur(),{id:l=`headlessui-combobox-input-${a}`,onChange:c,displayValue:u,type:d="text",...f}=t,h=fA("Combobox.Input"),A=_v("Combobox.Input"),p=Rn(h.inputRef,e),m=fc(h.inputRef),g=P.useRef(!1),y=dc(),w=nt(()=>{A.onChange(null),h.optionsRef.current&&(h.optionsRef.current.scrollTop=0),A.goToOption($n.Nothing)}),v=function(){var F;return typeof u=="function"&&h.value!==void 0?(F=u(h.value))!=null?F:"":typeof h.value=="string"?h.value:""}();Fy(([F,I],[z,Y])=>{if(g.current)return;let $=h.inputRef.current;$&&((Y===0&&I===1||F!==z)&&($.value=F),requestAnimationFrame(()=>{if(g.current||!$||(m==null?void 0:m.activeElement)!==$)return;let{selectionStart:ee,selectionEnd:W}=$;Math.abs((W??0)-(ee??0))===0&&ee===0&&$.setSelectionRange($.value.length,$.value.length)}))},[v,h.comboboxState,m]),Fy(([F],[I])=>{if(F===0&&I===1){if(g.current)return;let z=h.inputRef.current;if(!z)return;let Y=z.value,{selectionStart:$,selectionEnd:ee,selectionDirection:W}=z;z.value="",z.value=Y,W!==null?z.setSelectionRange($,ee,W):z.setSelectionRange($,ee)}},[h.comboboxState]);let x=P.useRef(!1),C=nt(()=>{x.current=!0}),_=nt(()=>{y.nextFrame(()=>{x.current=!1})}),S=nt(F=>{switch(g.current=!0,F.key){case Vt.Enter:if(g.current=!1,h.comboboxState!==0||x.current)return;if(F.preventDefault(),F.stopPropagation(),h.activeOptionIndex===null){A.closeCombobox();return}A.selectActiveOption(),h.mode===0&&A.closeCombobox();break;case Vt.ArrowDown:return g.current=!1,F.preventDefault(),F.stopPropagation(),_n(h.comboboxState,{0:()=>A.goToOption($n.Next),1:()=>A.openCombobox()});case Vt.ArrowUp:return g.current=!1,F.preventDefault(),F.stopPropagation(),_n(h.comboboxState,{0:()=>A.goToOption($n.Previous),1:()=>{A.openCombobox(),y.nextFrame(()=>{h.value||A.goToOption($n.Last)})}});case Vt.Home:if(F.shiftKey)break;return g.current=!1,F.preventDefault(),F.stopPropagation(),A.goToOption($n.First);case Vt.PageUp:return g.current=!1,F.preventDefault(),F.stopPropagation(),A.goToOption($n.First);case Vt.End:if(F.shiftKey)break;return g.current=!1,F.preventDefault(),F.stopPropagation(),A.goToOption($n.Last);case Vt.PageDown:return g.current=!1,F.preventDefault(),F.stopPropagation(),A.goToOption($n.Last);case Vt.Escape:return g.current=!1,h.comboboxState!==0?void 0:(F.preventDefault(),h.optionsRef.current&&!h.optionsPropsRef.current.static&&F.stopPropagation(),h.nullable&&h.mode===0&&h.value===null&&w(),A.closeCombobox());case Vt.Tab:if(g.current=!1,h.comboboxState!==0)return;h.mode===0&&h.activationTrigger!==1&&A.selectActiveOption(),A.closeCombobox();break}}),E=nt(F=>{c==null||c(F),h.nullable&&h.mode===0&&F.target.value===""&&w(),A.openCombobox()}),T=nt(F=>{var I,z,Y;let $=(I=F.relatedTarget)!=null?I:Rl.find(ee=>ee!==F.currentTarget);if(g.current=!1,!((z=h.optionsRef.current)!=null&&z.contains($))&&!((Y=h.buttonRef.current)!=null&&Y.contains($))&&h.comboboxState===0)return F.preventDefault(),h.mode===0&&(h.nullable&&h.value===null?w():h.activationTrigger!==1&&A.selectActiveOption()),A.closeCombobox()}),R=nt(F=>{var I,z,Y;let $=(I=F.relatedTarget)!=null?I:Rl.find(ee=>ee!==F.currentTarget);(z=h.buttonRef.current)!=null&&z.contains($)||(Y=h.optionsRef.current)!=null&&Y.contains($)||h.disabled||h.immediate&&h.comboboxState!==0&&(A.openCombobox(),y.nextFrame(()=>{A.setActivationTrigger(1)}))}),k=n6(()=>{if(h.labelId)return[h.labelId].join(" ")},[h.labelId]),B=P.useMemo(()=>({open:h.comboboxState===0,disabled:h.disabled}),[h]),M={ref:p,id:l,role:"combobox",type:d,"aria-controls":(n=h.optionsRef.current)==null?void 0:n.id,"aria-expanded":h.comboboxState===0,"aria-activedescendant":h.activeOptionIndex===null?void 0:h.virtual?(r=h.options.find(F=>{var I;return!((I=h.virtual)!=null&&I.disabled(F.dataRef.current.value))&&h.compare(F.dataRef.current.value,h.virtual.options[h.activeOptionIndex])}))==null?void 0:r.id:(i=h.options[h.activeOptionIndex])==null?void 0:i.id,"aria-labelledby":k,"aria-autocomplete":"list",defaultValue:(o=(s=t.defaultValue)!=null?s:h.defaultValue!==void 0?u==null?void 0:u(h.defaultValue):null)!=null?o:h.defaultValue,disabled:h.disabled,onCompositionStart:C,onCompositionEnd:_,onKeyDown:S,onChange:E,onFocus:R,onBlur:T};return Sn({ourProps:M,theirProps:f,slot:B,defaultTag:$Te,name:"Combobox.Input"})}let XTe="button";function YTe(t,e){var n;let r=fA("Combobox.Button"),i=_v("Combobox.Button"),s=Rn(r.buttonRef,e),o=ur(),{id:a=`headlessui-combobox-button-${o}`,...l}=t,c=dc(),u=nt(p=>{switch(p.key){case Vt.ArrowDown:return p.preventDefault(),p.stopPropagation(),r.comboboxState===1&&i.openCombobox(),c.nextFrame(()=>{var m;return(m=r.inputRef.current)==null?void 0:m.focus({preventScroll:!0})});case Vt.ArrowUp:return p.preventDefault(),p.stopPropagation(),r.comboboxState===1&&(i.openCombobox(),c.nextFrame(()=>{r.value||i.goToOption($n.Last)})),c.nextFrame(()=>{var m;return(m=r.inputRef.current)==null?void 0:m.focus({preventScroll:!0})});case Vt.Escape:return r.comboboxState!==0?void 0:(p.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&p.stopPropagation(),i.closeCombobox(),c.nextFrame(()=>{var m;return(m=r.inputRef.current)==null?void 0:m.focus({preventScroll:!0})}));default:return}}),d=nt(p=>{if(lu(p.currentTarget))return p.preventDefault();r.comboboxState===0?i.closeCombobox():(p.preventDefault(),i.openCombobox()),c.nextFrame(()=>{var m;return(m=r.inputRef.current)==null?void 0:m.focus({preventScroll:!0})})}),f=n6(()=>{if(r.labelId)return[r.labelId,a].join(" ")},[r.labelId,a]),h=P.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),A={ref:s,id:a,type:xv(t,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":f,disabled:r.disabled,onClick:d,onKeyDown:u};return Sn({ourProps:A,theirProps:l,slot:h,defaultTag:XTe,name:"Combobox.Button"})}let JTe="label";function ZTe(t,e){let n=ur(),{id:r=`headlessui-combobox-label-${n}`,...i}=t,s=fA("Combobox.Label"),o=_v("Combobox.Label"),a=Rn(s.labelRef,e);Hn(()=>o.registerLabel(r),[r]);let l=nt(()=>{var u;return(u=s.inputRef.current)==null?void 0:u.focus({preventScroll:!0})}),c=P.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled}),[s]);return Sn({ourProps:{ref:a,id:r,onClick:l},theirProps:i,slot:c,defaultTag:JTe,name:"Combobox.Label"})}let eBe="ul",tBe=go.RenderStrategy|go.Static;function nBe(t,e){let n=ur(),{id:r=`headlessui-combobox-options-${n}`,hold:i=!1,...s}=t,o=fA("Combobox.Options"),a=Rn(o.optionsRef,e),l=Bf(),c=l!==null?(l&Dn.Open)===Dn.Open:o.comboboxState===0;Hn(()=>{var h;o.optionsPropsRef.current.static=(h=t.static)!=null?h:!1},[o.optionsPropsRef,t.static]),Hn(()=>{o.optionsPropsRef.current.hold=i},[o.optionsPropsRef,i]),s6({container:o.optionsRef.current,enabled:o.comboboxState===0,accept(h){return h.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:h.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(h){h.setAttribute("role","none")}});let u=n6(()=>{var h,A;return(A=o.labelId)!=null?A:(h=o.buttonRef.current)==null?void 0:h.id},[o.labelId,o.buttonRef.current]),d=P.useMemo(()=>({open:o.comboboxState===0,option:void 0}),[o]),f={"aria-labelledby":u,role:"listbox","aria-multiselectable":o.mode===1?!0:void 0,id:r,ref:a};return o.virtual&&o.comboboxState===0&&Object.assign(s,{children:at.createElement(VTe,null,s.children)}),Sn({ourProps:f,theirProps:s,slot:d,defaultTag:eBe,features:tBe,visible:c,name:"Combobox.Options"})}let rBe="li";function iBe(t,e){var n;let r=ur(),{id:i=`headlessui-combobox-option-${r}`,disabled:s=!1,value:o,order:a=null,...l}=t,c=fA("Combobox.Option"),u=_v("Combobox.Option"),d=c.virtual?c.activeOptionIndex===c.calculateIndex(o):c.activeOptionIndex===null?!1:((n=c.options[c.activeOptionIndex])==null?void 0:n.id)===i,f=c.isSelected(o),h=P.useRef(null),A=po({disabled:s,value:o,domRef:h,order:a}),p=P.useContext(IJ),m=Rn(e,h,p?p.measureElement:null),g=nt(()=>u.onChange(o));Hn(()=>u.registerOption(i,A),[A,i]);let y=P.useRef(!(c.virtual||c.__demoMode));Hn(()=>{if(!c.virtual||!c.__demoMode)return;let T=Go();return T.requestAnimationFrame(()=>{y.current=!0}),T.dispose},[c.virtual,c.__demoMode]),Hn(()=>{if(!y.current||c.comboboxState!==0||!d||c.activationTrigger===0)return;let T=Go();return T.requestAnimationFrame(()=>{var R,k;(k=(R=h.current)==null?void 0:R.scrollIntoView)==null||k.call(R,{block:"nearest"})}),T.dispose},[h,d,c.comboboxState,c.activationTrigger,c.activeOptionIndex]);let w=nt(T=>{var R;if(s||(R=c.virtual)!=null&&R.disabled(o))return T.preventDefault();g(),EJ()||requestAnimationFrame(()=>{var k;return(k=c.inputRef.current)==null?void 0:k.focus({preventScroll:!0})}),c.mode===0&&requestAnimationFrame(()=>u.closeCombobox())}),v=nt(()=>{var T;if(s||(T=c.virtual)!=null&&T.disabled(o))return u.goToOption($n.Nothing);let R=c.calculateIndex(o);u.goToOption($n.Specific,R)}),x=MJ(),C=nt(T=>x.update(T)),_=nt(T=>{var R;if(!x.wasMoved(T)||s||(R=c.virtual)!=null&&R.disabled(o)||d)return;let k=c.calculateIndex(o);u.goToOption($n.Specific,k,0)}),S=nt(T=>{var R;x.wasMoved(T)&&(s||(R=c.virtual)!=null&&R.disabled(o)||d&&(c.optionsPropsRef.current.hold||u.goToOption($n.Nothing)))}),E=P.useMemo(()=>({active:d,selected:f,disabled:s}),[d,f,s]);return Sn({ourProps:{id:i,ref:m,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:w,onFocus:v,onPointerEnter:C,onMouseEnter:C,onPointerMove:_,onMouseMove:_,onPointerLeave:S,onMouseLeave:S},theirProps:l,slot:E,defaultTag:rBe,name:"Combobox.Option"})}let sBe=En(KTe),oBe=En(YTe),aBe=En(qTe),lBe=En(ZTe),cBe=En(nBe),uBe=En(iBe),fa=Object.assign(sBe,{Input:aBe,Button:oBe,Label:lBe,Options:cBe,Option:uBe});function d6(t,e,n,r){let i=po(n);P.useEffect(()=>{t=t??window;function s(o){i.current(o)}return t.addEventListener(e,s,r),()=>t.removeEventListener(e,s,r)},[t,e,r])}function Sv(){let t=P.useRef(!1);return Hn(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function OJ(t){let e=nt(t),n=P.useRef(!1);P.useEffect(()=>(n.current=!1,()=>{n.current=!0,C2(()=>{n.current&&e()})}),[e])}var Do=(t=>(t[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t))(Do||{});function f6(){let t=P.useRef(0);return TJ("keydown",e=>{e.key==="Tab"&&(t.current=e.shiftKey?1:0)},!0),t}function FJ(t){if(!t)return new Set;if(typeof t=="function")return new Set(t());let e=new Set;for(let n of t.current)n.current instanceof HTMLElement&&e.add(n.current);return e}let dBe="div";var NJ=(t=>(t[t.None=1]="None",t[t.InitialFocus=2]="InitialFocus",t[t.TabLock=4]="TabLock",t[t.FocusLock=8]="FocusLock",t[t.RestoreFocus=16]="RestoreFocus",t[t.All=30]="All",t))(NJ||{});function fBe(t,e){let n=P.useRef(null),r=Rn(n,e),{initialFocus:i,containers:s,features:o=30,...a}=t;Ig()||(o=1);let l=fc(n);pBe({ownerDocument:l},!!(o&16));let c=mBe({ownerDocument:l,container:n,initialFocus:i},!!(o&2));gBe({ownerDocument:l,container:n,containers:s,previousActiveElement:c},!!(o&8));let u=f6(),d=nt(p=>{let m=n.current;m&&(g=>g())(()=>{_n(u.current,{[Do.Forwards]:()=>{co(m,Jr.First,{skipElements:[p.relatedTarget]})},[Do.Backwards]:()=>{co(m,Jr.Last,{skipElements:[p.relatedTarget]})}})})}),f=dc(),h=P.useRef(!1),A={ref:r,onKeyDown(p){p.key=="Tab"&&(h.current=!0,f.requestAnimationFrame(()=>{h.current=!1}))},onBlur(p){let m=FJ(s);n.current instanceof HTMLElement&&m.add(n.current);let g=p.relatedTarget;g instanceof HTMLElement&&g.dataset.headlessuiFocusGuard!=="true"&&(DJ(m,g)||(h.current?co(n.current,_n(u.current,{[Do.Forwards]:()=>Jr.Next,[Do.Backwards]:()=>Jr.Previous})|Jr.WrapAround,{relativeTo:p.target}):p.target instanceof HTMLElement&&Kd(p.target)))}};return at.createElement(at.Fragment,null,!!(o&4)&&at.createElement(ec,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:d,features:rl.Focusable}),Sn({ourProps:A,theirProps:a,defaultTag:dBe,name:"FocusTrap"}),!!(o&4)&&at.createElement(ec,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:d,features:rl.Focusable}))}let hBe=En(fBe),h0=Object.assign(hBe,{features:NJ});function ABe(t=!0){let e=P.useRef(Rl.slice());return Fy(([n],[r])=>{r===!0&&n===!1&&C2(()=>{e.current.splice(0)}),r===!1&&n===!0&&(e.current=Rl.slice())},[t,Rl,e]),nt(()=>{var n;return(n=e.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function pBe({ownerDocument:t},e){let n=ABe(e);Fy(()=>{e||(t==null?void 0:t.activeElement)===(t==null?void 0:t.body)&&Kd(n())},[e]),OJ(()=>{e&&Kd(n())})}function mBe({ownerDocument:t,container:e,initialFocus:n},r){let i=P.useRef(null),s=Sv();return Fy(()=>{if(!r)return;let o=e.current;o&&C2(()=>{if(!s.current)return;let a=t==null?void 0:t.activeElement;if(n!=null&&n.current){if((n==null?void 0:n.current)===a){i.current=a;return}}else if(o.contains(a)){i.current=a;return}n!=null&&n.current?Kd(n.current):co(o,Jr.First)===Xh.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),i.current=t==null?void 0:t.activeElement})},[r]),i}function gBe({ownerDocument:t,container:e,containers:n,previousActiveElement:r},i){let s=Sv();d6(t==null?void 0:t.defaultView,"focus",o=>{if(!i||!s.current)return;let a=FJ(n);e.current instanceof HTMLElement&&a.add(e.current);let l=r.current;if(!l)return;let c=o.target;c&&c instanceof HTMLElement?DJ(a,c)?(r.current=c,Kd(c)):(o.preventDefault(),o.stopPropagation(),Kd(l)):Kd(r.current)},!0)}function DJ(t,e){for(let n of t)if(n.contains(e))return!0;return!1}let UJ=P.createContext(!1);function yBe(){return P.useContext(UJ)}function P5(t){return at.createElement(UJ.Provider,{value:t.force},t.children)}function vBe(t){let e=yBe(),n=P.useContext(HJ),r=fc(t),[i,s]=P.useState(()=>{if(!e&&n!==null||zc.isServer)return null;let o=r==null?void 0:r.getElementById("headlessui-portal-root");if(o)return o;if(r===null)return null;let a=r.createElement("div");return a.setAttribute("id","headlessui-portal-root"),r.body.appendChild(a)});return P.useEffect(()=>{i!==null&&(r!=null&&r.body.contains(i)||r==null||r.body.appendChild(i))},[i,r]),P.useEffect(()=>{e||n!==null&&s(n.current)},[n,s,e]),i}let bBe=P.Fragment;function wBe(t,e){let n=t,r=P.useRef(null),i=Rn(i6(u=>{r.current=u}),e),s=fc(r),o=vBe(r),[a]=P.useState(()=>{var u;return zc.isServer?null:(u=s==null?void 0:s.createElement("div"))!=null?u:null}),l=P.useContext(L5),c=Ig();return Hn(()=>{!o||!a||o.contains(a)||(a.setAttribute("data-headlessui-portal",""),o.appendChild(a))},[o,a]),Hn(()=>{if(a&&l)return l.register(a)},[l,a]),OJ(()=>{var u;!o||!a||(a instanceof Node&&o.contains(a)&&o.removeChild(a),o.childNodes.length<=0&&((u=o.parentElement)==null||u.removeChild(o)))}),c?!o||!a?null:bg.createPortal(Sn({ourProps:{ref:i},theirProps:n,defaultTag:bBe,name:"Portal"}),a):null}let xBe=P.Fragment,HJ=P.createContext(null);function CBe(t,e){let{target:n,...r}=t,i={ref:Rn(e)};return at.createElement(HJ.Provider,{value:n},Sn({ourProps:i,theirProps:r,defaultTag:xBe,name:"Popover.Group"}))}let L5=P.createContext(null);function jJ(){let t=P.useContext(L5),e=P.useRef([]),n=nt(s=>(e.current.push(s),t&&t.register(s),()=>r(s))),r=nt(s=>{let o=e.current.indexOf(s);o!==-1&&e.current.splice(o,1),t&&t.unregister(s)}),i=P.useMemo(()=>({register:n,unregister:r,portals:e}),[n,r,e]);return[e,P.useMemo(()=>function({children:s}){return at.createElement(L5.Provider,{value:i},s)},[i])]}let _Be=En(wBe),SBe=En(CBe),I5=Object.assign(_Be,{Group:SBe});function EBe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}const TBe=typeof Object.is=="function"?Object.is:EBe,{useState:BBe,useEffect:MBe,useLayoutEffect:kBe,useDebugValue:RBe}=hm;function PBe(t,e,n){const r=e(),[{inst:i},s]=BBe({inst:{value:r,getSnapshot:e}});return kBe(()=>{i.value=r,i.getSnapshot=e,eB(i)&&s({inst:i})},[t,r,e]),MBe(()=>(eB(i)&&s({inst:i}),t(()=>{eB(i)&&s({inst:i})})),[t]),RBe(r),r}function eB(t){const e=t.getSnapshot,n=t.value;try{const r=e();return!TBe(n,r)}catch{return!0}}function LBe(t,e,n){return e()}const IBe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",OBe=!IBe,FBe=OBe?LBe:PBe,NBe="useSyncExternalStore"in hm?(t=>t.useSyncExternalStore)(hm):FBe;function DBe(t){return NBe(t.subscribe,t.getSnapshot,t.getSnapshot)}function UBe(t,e){let n=t(),r=new Set;return{getSnapshot(){return n},subscribe(i){return r.add(i),()=>r.delete(i)},dispatch(i,...s){let o=e[i].call(n,...s);o&&(n=o,r.forEach(a=>a()))}}}function HBe(){let t;return{before({doc:e}){var n;let r=e.documentElement;t=((n=e.defaultView)!=null?n:window).innerWidth-r.clientWidth},after({doc:e,d:n}){let r=e.documentElement,i=r.clientWidth-r.offsetWidth,s=t-i;n.style(r,"paddingRight",`${s}px`)}}}function jBe(){return SJ()?{before({doc:t,d:e,meta:n}){function r(i){return n.containers.flatMap(s=>s()).some(s=>s.contains(i))}e.microTask(()=>{var i;if(window.getComputedStyle(t.documentElement).scrollBehavior!=="auto"){let a=Go();a.style(t.documentElement,"scrollBehavior","auto"),e.add(()=>e.microTask(()=>a.dispose()))}let s=(i=window.scrollY)!=null?i:window.pageYOffset,o=null;e.addEventListener(t,"click",a=>{if(a.target instanceof HTMLElement)try{let l=a.target.closest("a");if(!l)return;let{hash:c}=new URL(l.href),u=t.querySelector(c);u&&!r(u)&&(o=u)}catch{}},!0),e.addEventListener(t,"touchstart",a=>{if(a.target instanceof HTMLElement)if(r(a.target)){let l=a.target;for(;l.parentElement&&r(l.parentElement);)l=l.parentElement;e.style(l,"overscrollBehavior","contain")}else e.style(a.target,"touchAction","none")}),e.addEventListener(t,"touchmove",a=>{if(a.target instanceof HTMLElement)if(r(a.target)){let l=a.target;for(;l.parentElement&&l.dataset.headlessuiPortal!==""&&!(l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth);)l=l.parentElement;l.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()},{passive:!1}),e.add(()=>{var a;let l=(a=window.scrollY)!=null?a:window.pageYOffset;s!==l&&window.scrollTo(0,s),o&&o.isConnected&&(o.scrollIntoView({block:"nearest"}),o=null)})})}}:{}}function QBe(){return{before({doc:t,d:e}){e.style(t.documentElement,"overflow","hidden")}}}function zBe(t){let e={};for(let n of t)Object.assign(e,n(e));return e}let yh=UBe(()=>new Map,{PUSH(t,e){var n;let r=(n=this.get(t))!=null?n:{doc:t,count:0,d:Go(),meta:new Set};return r.count++,r.meta.add(e),this.set(t,r),this},POP(t,e){let n=this.get(t);return n&&(n.count--,n.meta.delete(e)),this},SCROLL_PREVENT({doc:t,d:e,meta:n}){let r={doc:t,d:e,meta:zBe(n)},i=[jBe(),HBe(),QBe()];i.forEach(({before:s})=>s==null?void 0:s(r)),i.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:t}){t.dispose()},TEARDOWN({doc:t}){this.delete(t)}});yh.subscribe(()=>{let t=yh.getSnapshot(),e=new Map;for(let[n]of t)e.set(n,n.documentElement.style.overflow);for(let n of t.values()){let r=e.get(n.doc)==="hidden",i=n.count!==0;(i&&!r||!i&&r)&&yh.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&yh.dispatch("TEARDOWN",n)}});function VBe(t,e,n){let r=DBe(yh),i=t?r.get(t):void 0,s=i?i.count>0:!1;return Hn(()=>{if(!(!t||!e))return yh.dispatch("PUSH",t,n),()=>yh.dispatch("POP",t,n)},[e,t]),s}let tB=new Map,A0=new Map;function gH(t,e=!0){Hn(()=>{var n;if(!e)return;let r=typeof t=="function"?t():t.current;if(!r)return;function i(){var o;if(!r)return;let a=(o=A0.get(r))!=null?o:1;if(a===1?A0.delete(r):A0.set(r,a-1),a!==1)return;let l=tB.get(r);l&&(l["aria-hidden"]===null?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",l["aria-hidden"]),r.inert=l.inert,tB.delete(r))}let s=(n=A0.get(r))!=null?n:0;return A0.set(r,s+1),s!==0||(tB.set(r,{"aria-hidden":r.getAttribute("aria-hidden"),inert:r.inert}),r.setAttribute("aria-hidden","true"),r.inert=!0),i},[t,e])}function QJ({defaultContainers:t=[],portals:e,mainTreeNodeRef:n}={}){var r;let i=P.useRef((r=n==null?void 0:n.current)!=null?r:null),s=fc(i),o=nt(()=>{var a,l,c;let u=[];for(let d of t)d!==null&&(d instanceof HTMLElement?u.push(d):"current"in d&&d.current instanceof HTMLElement&&u.push(d.current));if(e!=null&&e.current)for(let d of e.current)u.push(d);for(let d of(a=s==null?void 0:s.querySelectorAll("html > *, body > *"))!=null?a:[])d!==document.body&&d!==document.head&&d instanceof HTMLElement&&d.id!=="headlessui-portal-root"&&(d.contains(i.current)||d.contains((c=(l=i.current)==null?void 0:l.getRootNode())==null?void 0:c.host)||u.some(f=>d.contains(f))||u.push(d));return u});return{resolveContainers:o,contains:nt(a=>o().some(l=>l.contains(a))),mainTreeNodeRef:i,MainTreeNode:P.useMemo(()=>function(){return n!=null?null:at.createElement(ec,{features:rl.Hidden,ref:i})},[i,n])}}function GBe(){let t=P.useRef(null);return{mainTreeNodeRef:t,MainTreeNode:P.useMemo(()=>function(){return at.createElement(ec,{features:rl.Hidden,ref:t})},[t])}}let h6=P.createContext(()=>{});h6.displayName="StackContext";var O5=(t=>(t[t.Add=0]="Add",t[t.Remove=1]="Remove",t))(O5||{});function WBe(){return P.useContext(h6)}function KBe({children:t,onUpdate:e,type:n,element:r,enabled:i}){let s=WBe(),o=nt((...a)=>{e==null||e(...a),s(...a)});return Hn(()=>{let a=i===void 0||i===!0;return a&&o(0,n,r),()=>{a&&o(1,n,r)}},[o,n,r,i]),at.createElement(h6.Provider,{value:o},t)}let zJ=P.createContext(null);function VJ(){let t=P.useContext(zJ);if(t===null){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,VJ),e}return t}function B2(){let[t,e]=P.useState([]);return[t.length>0?t.join(" "):void 0,P.useMemo(()=>function(n){let r=nt(s=>(e(o=>[...o,s]),()=>e(o=>{let a=o.slice(),l=a.indexOf(s);return l!==-1&&a.splice(l,1),a}))),i=P.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return at.createElement(zJ.Provider,{value:i},n.children)},[e])]}let $Be="p";function qBe(t,e){let n=ur(),{id:r=`headlessui-description-${n}`,...i}=t,s=VJ(),o=Rn(e);Hn(()=>s.register(r),[r,s.register]);let a={ref:o,...s.props,id:r};return Sn({ourProps:a,theirProps:i,slot:s.slot||{},defaultTag:$Be,name:s.name||"Description"})}let XBe=En(qBe),A6=Object.assign(XBe,{});var YBe=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(YBe||{}),JBe=(t=>(t[t.SetTitleId=0]="SetTitleId",t))(JBe||{});let ZBe={0(t,e){return t.titleId===e.id?t:{...t,titleId:e.id}}},j_=P.createContext(null);j_.displayName="DialogContext";function Ev(t){let e=P.useContext(j_);if(e===null){let n=new Error(`<${t} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ev),n}return e}function e3e(t,e,n=()=>[document.body]){VBe(t,e,r=>{var i;return{containers:[...(i=r.containers)!=null?i:[],n]}})}function t3e(t,e){return _n(e.type,ZBe,t,e)}let n3e="div",r3e=go.RenderStrategy|go.Static;function i3e(t,e){let n=ur(),{id:r=`headlessui-dialog-${n}`,open:i,onClose:s,initialFocus:o,role:a="dialog",__demoMode:l=!1,...c}=t,[u,d]=P.useState(0),f=P.useRef(!1);a=function(){return a==="dialog"||a==="alertdialog"?a:(f.current||(f.current=!0,console.warn(`Invalid role [${a}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let h=Bf();i===void 0&&h!==null&&(i=(h&Dn.Open)===Dn.Open);let A=P.useRef(null),p=Rn(A,e),m=fc(A),g=t.hasOwnProperty("open")||h!==null,y=t.hasOwnProperty("onClose");if(!g&&!y)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!g)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!y)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(typeof i!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${i}`);if(typeof s!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${s}`);let w=i?0:1,[v,x]=P.useReducer(t3e,{titleId:null,descriptionId:null,panelRef:P.createRef()}),C=nt(()=>s(!1)),_=nt(Ve=>x({type:0,id:Ve})),S=Ig()?l?!1:w===0:!1,E=u>1,T=P.useContext(j_)!==null,[R,k]=jJ(),B={get current(){var Ve;return(Ve=v.panelRef.current)!=null?Ve:A.current}},{resolveContainers:M,mainTreeNodeRef:F,MainTreeNode:I}=QJ({portals:R,defaultContainers:[B]}),z=E?"parent":"leaf",Y=h!==null?(h&Dn.Closing)===Dn.Closing:!1,$=T||Y?!1:S,ee=P.useCallback(()=>{var Ve,q;return(q=Array.from((Ve=m==null?void 0:m.querySelectorAll("body > *"))!=null?Ve:[]).find(Ue=>Ue.id==="headlessui-portal-root"?!1:Ue.contains(F.current)&&Ue instanceof HTMLElement))!=null?q:null},[F]);gH(ee,$);let W=E?!0:S,ne=P.useCallback(()=>{var Ve,q;return(q=Array.from((Ve=m==null?void 0:m.querySelectorAll("[data-headlessui-portal]"))!=null?Ve:[]).find(Ue=>Ue.contains(F.current)&&Ue instanceof HTMLElement))!=null?q:null},[F]);gH(ne,W),T2(M,Ve=>{Ve.preventDefault(),C()},!(!S||E));let fe=!(E||w!==0);d6(m==null?void 0:m.defaultView,"keydown",Ve=>{fe&&(Ve.defaultPrevented||Ve.key===Vt.Escape&&(Ve.preventDefault(),Ve.stopPropagation(),C()))}),e3e(m,!(Y||w!==0||T),M),P.useEffect(()=>{if(w!==0||!A.current)return;let Ve=new ResizeObserver(q=>{for(let Ue of q){let O=Ue.target.getBoundingClientRect();O.x===0&&O.y===0&&O.width===0&&O.height===0&&C()}});return Ve.observe(A.current),()=>Ve.disconnect()},[w,A,C]);let[Oe,Fe]=B2(),De=P.useMemo(()=>[{dialogState:w,close:C,setTitleId:_},v],[w,v,C,_]),ke=P.useMemo(()=>({open:w===0}),[w]),Ge={ref:p,id:r,role:a,"aria-modal":w===0?!0:void 0,"aria-labelledby":v.titleId,"aria-describedby":Oe};return at.createElement(KBe,{type:"Dialog",enabled:w===0,element:A,onUpdate:nt((Ve,q)=>{q==="Dialog"&&_n(Ve,{[O5.Add]:()=>d(Ue=>Ue+1),[O5.Remove]:()=>d(Ue=>Ue-1)})})},at.createElement(P5,{force:!0},at.createElement(I5,null,at.createElement(j_.Provider,{value:De},at.createElement(I5.Group,{target:A},at.createElement(P5,{force:!1},at.createElement(Fe,{slot:ke,name:"Dialog.Description"},at.createElement(h0,{initialFocus:o,containers:M,features:S?_n(z,{parent:h0.features.RestoreFocus,leaf:h0.features.All&~h0.features.FocusLock}):h0.features.None},at.createElement(k,null,Sn({ourProps:Ge,theirProps:c,slot:ke,defaultTag:n3e,features:r3e,visible:w===0,name:"Dialog"}))))))))),at.createElement(I,null))}let s3e="div";function o3e(t,e){let n=ur(),{id:r=`headlessui-dialog-overlay-${n}`,...i}=t,[{dialogState:s,close:o}]=Ev("Dialog.Overlay"),a=Rn(e),l=nt(u=>{if(u.target===u.currentTarget){if(lu(u.currentTarget))return u.preventDefault();u.preventDefault(),u.stopPropagation(),o()}}),c=P.useMemo(()=>({open:s===0}),[s]);return Sn({ourProps:{ref:a,id:r,"aria-hidden":!0,onClick:l},theirProps:i,slot:c,defaultTag:s3e,name:"Dialog.Overlay"})}let a3e="div";function l3e(t,e){let n=ur(),{id:r=`headlessui-dialog-backdrop-${n}`,...i}=t,[{dialogState:s},o]=Ev("Dialog.Backdrop"),a=Rn(e);P.useEffect(()=>{if(o.panelRef.current===null)throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.")},[o.panelRef]);let l=P.useMemo(()=>({open:s===0}),[s]);return at.createElement(P5,{force:!0},at.createElement(I5,null,Sn({ourProps:{ref:a,id:r,"aria-hidden":!0},theirProps:i,slot:l,defaultTag:a3e,name:"Dialog.Backdrop"})))}let c3e="div";function u3e(t,e){let n=ur(),{id:r=`headlessui-dialog-panel-${n}`,...i}=t,[{dialogState:s},o]=Ev("Dialog.Panel"),a=Rn(e,o.panelRef),l=P.useMemo(()=>({open:s===0}),[s]),c=nt(u=>{u.stopPropagation()});return Sn({ourProps:{ref:a,id:r,onClick:c},theirProps:i,slot:l,defaultTag:c3e,name:"Dialog.Panel"})}let d3e="h2";function f3e(t,e){let n=ur(),{id:r=`headlessui-dialog-title-${n}`,...i}=t,[{dialogState:s,setTitleId:o}]=Ev("Dialog.Title"),a=Rn(e);P.useEffect(()=>(o(r),()=>o(null)),[r,o]);let l=P.useMemo(()=>({open:s===0}),[s]);return Sn({ourProps:{ref:a,id:r},theirProps:i,slot:l,defaultTag:d3e,name:"Dialog.Title"})}let h3e=En(i3e),A3e=En(l3e),p3e=En(u3e),m3e=En(o3e),g3e=En(f3e),ir=Object.assign(h3e,{Backdrop:A3e,Panel:p3e,Overlay:m3e,Title:g3e,Description:A6});var yH;let y3e=(yH=at.startTransition)!=null?yH:function(t){t()};var v3e=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(v3e||{}),b3e=(t=>(t[t.ToggleDisclosure=0]="ToggleDisclosure",t[t.CloseDisclosure=1]="CloseDisclosure",t[t.SetButtonId=2]="SetButtonId",t[t.SetPanelId=3]="SetPanelId",t[t.LinkPanel=4]="LinkPanel",t[t.UnlinkPanel=5]="UnlinkPanel",t))(b3e||{});let w3e={0:t=>({...t,disclosureState:_n(t.disclosureState,{0:1,1:0})}),1:t=>t.disclosureState===1?t:{...t,disclosureState:1},4(t){return t.linkedPanel===!0?t:{...t,linkedPanel:!0}},5(t){return t.linkedPanel===!1?t:{...t,linkedPanel:!1}},2(t,e){return t.buttonId===e.buttonId?t:{...t,buttonId:e.buttonId}},3(t,e){return t.panelId===e.panelId?t:{...t,panelId:e.panelId}}},p6=P.createContext(null);p6.displayName="DisclosureContext";function m6(t){let e=P.useContext(p6);if(e===null){let n=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,m6),n}return e}let g6=P.createContext(null);g6.displayName="DisclosureAPIContext";function GJ(t){let e=P.useContext(g6);if(e===null){let n=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,GJ),n}return e}let y6=P.createContext(null);y6.displayName="DisclosurePanelContext";function x3e(){return P.useContext(y6)}function C3e(t,e){return _n(e.type,w3e,t,e)}let _3e=P.Fragment;function S3e(t,e){let{defaultOpen:n=!1,...r}=t,i=P.useRef(null),s=Rn(e,i6(m=>{i.current=m},t.as===void 0||t.as===P.Fragment)),o=P.useRef(null),a=P.useRef(null),l=P.useReducer(C3e,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:a,panelRef:o,buttonId:null,panelId:null}),[{disclosureState:c,buttonId:u},d]=l,f=nt(m=>{d({type:1});let g=dA(i);if(!g||!u)return;let y=m?m instanceof HTMLElement?m:m.current instanceof HTMLElement?m.current:g.getElementById(u):g.getElementById(u);y==null||y.focus()}),h=P.useMemo(()=>({close:f}),[f]),A=P.useMemo(()=>({open:c===0,close:f}),[c,f]),p={ref:s};return at.createElement(p6.Provider,{value:l},at.createElement(g6.Provider,{value:h},at.createElement(Cv,{value:_n(c,{0:Dn.Open,1:Dn.Closed})},Sn({ourProps:p,theirProps:r,slot:A,defaultTag:_3e,name:"Disclosure"}))))}let E3e="button";function T3e(t,e){let n=ur(),{id:r=`headlessui-disclosure-button-${n}`,...i}=t,[s,o]=m6("Disclosure.Button"),a=x3e(),l=a===null?!1:a===s.panelId,c=P.useRef(null),u=Rn(c,e,l?null:s.buttonRef),d=o6();P.useEffect(()=>{if(!l)return o({type:2,buttonId:r}),()=>{o({type:2,buttonId:null})}},[r,o,l]);let f=nt(y=>{var w;if(l){if(s.disclosureState===1)return;switch(y.key){case Vt.Space:case Vt.Enter:y.preventDefault(),y.stopPropagation(),o({type:0}),(w=s.buttonRef.current)==null||w.focus();break}}else switch(y.key){case Vt.Space:case Vt.Enter:y.preventDefault(),y.stopPropagation(),o({type:0});break}}),h=nt(y=>{switch(y.key){case Vt.Space:y.preventDefault();break}}),A=nt(y=>{var w;lu(y.currentTarget)||t.disabled||(l?(o({type:0}),(w=s.buttonRef.current)==null||w.focus()):o({type:0}))}),p=P.useMemo(()=>({open:s.disclosureState===0}),[s]),m=xv(t,c),g=l?{ref:u,type:m,onKeyDown:f,onClick:A}:{ref:u,id:r,type:m,"aria-expanded":s.disclosureState===0,"aria-controls":s.linkedPanel?s.panelId:void 0,onKeyDown:f,onKeyUp:h,onClick:A};return Sn({mergeRefs:d,ourProps:g,theirProps:i,slot:p,defaultTag:E3e,name:"Disclosure.Button"})}let B3e="div",M3e=go.RenderStrategy|go.Static;function k3e(t,e){let n=ur(),{id:r=`headlessui-disclosure-panel-${n}`,...i}=t,[s,o]=m6("Disclosure.Panel"),{close:a}=GJ("Disclosure.Panel"),l=o6(),c=Rn(e,s.panelRef,A=>{y3e(()=>o({type:A?4:5}))});P.useEffect(()=>(o({type:3,panelId:r}),()=>{o({type:3,panelId:null})}),[r,o]);let u=Bf(),d=u!==null?(u&Dn.Open)===Dn.Open:s.disclosureState===0,f=P.useMemo(()=>({open:s.disclosureState===0,close:a}),[s,a]),h={ref:c,id:r};return at.createElement(y6.Provider,{value:s.panelId},Sn({mergeRefs:l,ourProps:h,theirProps:i,slot:f,defaultTag:B3e,features:M3e,visible:d,name:"Disclosure.Panel"}))}let R3e=En(S3e),P3e=En(T3e),L3e=En(k3e),nB=Object.assign(R3e,{Button:P3e,Panel:L3e}),vH=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function bH(t){var e,n;let r=(e=t.innerText)!=null?e:"",i=t.cloneNode(!0);if(!(i instanceof HTMLElement))return r;let s=!1;for(let a of i.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),s=!0;let o=s?(n=i.innerText)!=null?n:"":r;return vH.test(o)&&(o=o.replace(vH,"")),o}function I3e(t){let e=t.getAttribute("aria-label");if(typeof e=="string")return e.trim();let n=t.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(i=>{let s=document.getElementById(i);if(s){let o=s.getAttribute("aria-label");return typeof o=="string"?o.trim():bH(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return bH(t).trim()}function O3e(t){let e=P.useRef(""),n=P.useRef("");return nt(()=>{let r=t.current;if(!r)return"";let i=r.innerText;if(e.current===i)return n.current;let s=I3e(r).trim().toLowerCase();return e.current=i,n.current=s,s})}var F3e=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(F3e||{}),N3e=(t=>(t[t.Pointer=0]="Pointer",t[t.Other=1]="Other",t))(N3e||{}),D3e=(t=>(t[t.OpenMenu=0]="OpenMenu",t[t.CloseMenu=1]="CloseMenu",t[t.GoToItem=2]="GoToItem",t[t.Search=3]="Search",t[t.ClearSearch=4]="ClearSearch",t[t.RegisterItem=5]="RegisterItem",t[t.UnregisterItem=6]="UnregisterItem",t))(D3e||{});function rB(t,e=n=>n){let n=t.activeItemIndex!==null?t.items[t.activeItemIndex]:null,r=E2(e(t.items.slice()),s=>s.dataRef.current.domRef.current),i=n?r.indexOf(n):null;return i===-1&&(i=null),{items:r,activeItemIndex:i}}let U3e={1(t){return t.menuState===1?t:{...t,activeItemIndex:null,menuState:1}},0(t){return t.menuState===0?t:{...t,__demoMode:!1,menuState:0}},2:(t,e)=>{var n;let r=rB(t),i=R5(e,{resolveItems:()=>r.items,resolveActiveIndex:()=>r.activeItemIndex,resolveId:s=>s.id,resolveDisabled:s=>s.dataRef.current.disabled});return{...t,...r,searchQuery:"",activeItemIndex:i,activationTrigger:(n=e.trigger)!=null?n:1}},3:(t,e)=>{let n=t.searchQuery!==""?0:1,r=t.searchQuery+e.value.toLowerCase(),i=(t.activeItemIndex!==null?t.items.slice(t.activeItemIndex+n).concat(t.items.slice(0,t.activeItemIndex+n)):t.items).find(o=>{var a;return((a=o.dataRef.current.textValue)==null?void 0:a.startsWith(r))&&!o.dataRef.current.disabled}),s=i?t.items.indexOf(i):-1;return s===-1||s===t.activeItemIndex?{...t,searchQuery:r}:{...t,searchQuery:r,activeItemIndex:s,activationTrigger:1}},4(t){return t.searchQuery===""?t:{...t,searchQuery:"",searchActiveItemIndex:null}},5:(t,e)=>{let n=rB(t,r=>[...r,{id:e.id,dataRef:e.dataRef}]);return{...t,...n}},6:(t,e)=>{let n=rB(t,r=>{let i=r.findIndex(s=>s.id===e.id);return i!==-1&&r.splice(i,1),r});return{...t,...n,activationTrigger:1}}},v6=P.createContext(null);v6.displayName="MenuContext";function M2(t){let e=P.useContext(v6);if(e===null){let n=new Error(`<${t} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,M2),n}return e}function H3e(t,e){return _n(e.type,U3e,t,e)}let j3e=P.Fragment;function Q3e(t,e){let{__demoMode:n=!1,...r}=t,i=P.useReducer(H3e,{__demoMode:n,menuState:n?0:1,buttonRef:P.createRef(),itemsRef:P.createRef(),items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1}),[{menuState:s,itemsRef:o,buttonRef:a},l]=i,c=Rn(e);T2([a,o],(h,A)=>{var p;l({type:1}),S2(A,_2.Loose)||(h.preventDefault(),(p=a.current)==null||p.focus())},s===0);let u=nt(()=>{l({type:1})}),d=P.useMemo(()=>({open:s===0,close:u}),[s,u]),f={ref:c};return at.createElement(v6.Provider,{value:i},at.createElement(Cv,{value:_n(s,{0:Dn.Open,1:Dn.Closed})},Sn({ourProps:f,theirProps:r,slot:d,defaultTag:j3e,name:"Menu"})))}let z3e="button";function V3e(t,e){var n;let r=ur(),{id:i=`headlessui-menu-button-${r}`,...s}=t,[o,a]=M2("Menu.Button"),l=Rn(o.buttonRef,e),c=dc(),u=nt(p=>{switch(p.key){case Vt.Space:case Vt.Enter:case Vt.ArrowDown:p.preventDefault(),p.stopPropagation(),a({type:0}),c.nextFrame(()=>a({type:2,focus:$n.First}));break;case Vt.ArrowUp:p.preventDefault(),p.stopPropagation(),a({type:0}),c.nextFrame(()=>a({type:2,focus:$n.Last}));break}}),d=nt(p=>{switch(p.key){case Vt.Space:p.preventDefault();break}}),f=nt(p=>{if(lu(p.currentTarget))return p.preventDefault();t.disabled||(o.menuState===0?(a({type:1}),c.nextFrame(()=>{var m;return(m=o.buttonRef.current)==null?void 0:m.focus({preventScroll:!0})})):(p.preventDefault(),a({type:0})))}),h=P.useMemo(()=>({open:o.menuState===0}),[o]),A={ref:l,id:i,type:xv(t,o.buttonRef),"aria-haspopup":"menu","aria-controls":(n=o.itemsRef.current)==null?void 0:n.id,"aria-expanded":o.menuState===0,onKeyDown:u,onKeyUp:d,onClick:f};return Sn({ourProps:A,theirProps:s,slot:h,defaultTag:z3e,name:"Menu.Button"})}let G3e="div",W3e=go.RenderStrategy|go.Static;function K3e(t,e){var n,r;let i=ur(),{id:s=`headlessui-menu-items-${i}`,...o}=t,[a,l]=M2("Menu.Items"),c=Rn(a.itemsRef,e),u=fc(a.itemsRef),d=dc(),f=Bf(),h=f!==null?(f&Dn.Open)===Dn.Open:a.menuState===0;P.useEffect(()=>{let y=a.itemsRef.current;y&&a.menuState===0&&y!==(u==null?void 0:u.activeElement)&&y.focus({preventScroll:!0})},[a.menuState,a.itemsRef,u]),s6({container:a.itemsRef.current,enabled:a.menuState===0,accept(y){return y.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:y.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(y){y.setAttribute("role","none")}});let A=nt(y=>{var w,v;switch(d.dispose(),y.key){case Vt.Space:if(a.searchQuery!=="")return y.preventDefault(),y.stopPropagation(),l({type:3,value:y.key});case Vt.Enter:if(y.preventDefault(),y.stopPropagation(),l({type:1}),a.activeItemIndex!==null){let{dataRef:x}=a.items[a.activeItemIndex];(v=(w=x.current)==null?void 0:w.domRef.current)==null||v.click()}_J(a.buttonRef.current);break;case Vt.ArrowDown:return y.preventDefault(),y.stopPropagation(),l({type:2,focus:$n.Next});case Vt.ArrowUp:return y.preventDefault(),y.stopPropagation(),l({type:2,focus:$n.Previous});case Vt.Home:case Vt.PageUp:return y.preventDefault(),y.stopPropagation(),l({type:2,focus:$n.First});case Vt.End:case Vt.PageDown:return y.preventDefault(),y.stopPropagation(),l({type:2,focus:$n.Last});case Vt.Escape:y.preventDefault(),y.stopPropagation(),l({type:1}),Go().nextFrame(()=>{var x;return(x=a.buttonRef.current)==null?void 0:x.focus({preventScroll:!0})});break;case Vt.Tab:y.preventDefault(),y.stopPropagation(),l({type:1}),Go().nextFrame(()=>{kTe(a.buttonRef.current,y.shiftKey?Jr.Previous:Jr.Next)});break;default:y.key.length===1&&(l({type:3,value:y.key}),d.setTimeout(()=>l({type:4}),350));break}}),p=nt(y=>{switch(y.key){case Vt.Space:y.preventDefault();break}}),m=P.useMemo(()=>({open:a.menuState===0}),[a]),g={"aria-activedescendant":a.activeItemIndex===null||(n=a.items[a.activeItemIndex])==null?void 0:n.id,"aria-labelledby":(r=a.buttonRef.current)==null?void 0:r.id,id:s,onKeyDown:A,onKeyUp:p,role:"menu",tabIndex:0,ref:c};return Sn({ourProps:g,theirProps:o,slot:m,defaultTag:G3e,features:W3e,visible:h,name:"Menu.Items"})}let $3e=P.Fragment;function q3e(t,e){let n=ur(),{id:r=`headlessui-menu-item-${n}`,disabled:i=!1,...s}=t,[o,a]=M2("Menu.Item"),l=o.activeItemIndex!==null?o.items[o.activeItemIndex].id===r:!1,c=P.useRef(null),u=Rn(e,c);Hn(()=>{if(o.__demoMode||o.menuState!==0||!l||o.activationTrigger===0)return;let x=Go();return x.requestAnimationFrame(()=>{var C,_;(_=(C=c.current)==null?void 0:C.scrollIntoView)==null||_.call(C,{block:"nearest"})}),x.dispose},[o.__demoMode,c,l,o.menuState,o.activationTrigger,o.activeItemIndex]);let d=O3e(c),f=P.useRef({disabled:i,domRef:c,get textValue(){return d()}});Hn(()=>{f.current.disabled=i},[f,i]),Hn(()=>(a({type:5,id:r,dataRef:f}),()=>a({type:6,id:r})),[f,r]);let h=nt(()=>{a({type:1})}),A=nt(x=>{if(i)return x.preventDefault();a({type:1}),_J(o.buttonRef.current)}),p=nt(()=>{if(i)return a({type:2,focus:$n.Nothing});a({type:2,focus:$n.Specific,id:r})}),m=MJ(),g=nt(x=>m.update(x)),y=nt(x=>{m.wasMoved(x)&&(i||l||a({type:2,focus:$n.Specific,id:r,trigger:0}))}),w=nt(x=>{m.wasMoved(x)&&(i||l&&a({type:2,focus:$n.Nothing}))}),v=P.useMemo(()=>({active:l,disabled:i,close:h}),[l,i,h]);return Sn({ourProps:{id:r,ref:u,role:"menuitem",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,disabled:void 0,onClick:A,onFocus:p,onPointerEnter:g,onMouseEnter:g,onPointerMove:y,onMouseMove:y,onPointerLeave:w,onMouseLeave:w},theirProps:s,slot:v,defaultTag:$3e,name:"Menu.Item"})}let X3e=En(Q3e),Y3e=En(V3e),J3e=En(K3e),Z3e=En(q3e),Lu=Object.assign(X3e,{Button:Y3e,Items:J3e,Item:Z3e});var eMe=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(eMe||{}),tMe=(t=>(t[t.TogglePopover=0]="TogglePopover",t[t.ClosePopover=1]="ClosePopover",t[t.SetButton=2]="SetButton",t[t.SetButtonId=3]="SetButtonId",t[t.SetPanel=4]="SetPanel",t[t.SetPanelId=5]="SetPanelId",t))(tMe||{});let nMe={0:t=>{let e={...t,popoverState:_n(t.popoverState,{0:1,1:0})};return e.popoverState===0&&(e.__demoMode=!1),e},1(t){return t.popoverState===1?t:{...t,popoverState:1}},2(t,e){return t.button===e.button?t:{...t,button:e.button}},3(t,e){return t.buttonId===e.buttonId?t:{...t,buttonId:e.buttonId}},4(t,e){return t.panel===e.panel?t:{...t,panel:e.panel}},5(t,e){return t.panelId===e.panelId?t:{...t,panelId:e.panelId}}},b6=P.createContext(null);b6.displayName="PopoverContext";function k2(t){let e=P.useContext(b6);if(e===null){let n=new Error(`<${t} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,k2),n}return e}let w6=P.createContext(null);w6.displayName="PopoverAPIContext";function x6(t){let e=P.useContext(w6);if(e===null){let n=new Error(`<${t} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,x6),n}return e}let C6=P.createContext(null);C6.displayName="PopoverGroupContext";function WJ(){return P.useContext(C6)}let R2=P.createContext(null);R2.displayName="PopoverPanelContext";function rMe(){return P.useContext(R2)}function iMe(t,e){return _n(e.type,nMe,t,e)}let sMe="div";function oMe(t,e){var n;let{__demoMode:r=!1,...i}=t,s=P.useRef(null),o=Rn(e,i6(I=>{s.current=I})),a=P.useRef([]),l=P.useReducer(iMe,{__demoMode:r,popoverState:r?0:1,buttons:a,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:P.createRef(),afterPanelSentinel:P.createRef()}),[{popoverState:c,button:u,buttonId:d,panel:f,panelId:h,beforePanelSentinel:A,afterPanelSentinel:p},m]=l,g=fc((n=s.current)!=null?n:u),y=P.useMemo(()=>{if(!u||!f)return!1;for(let ne of document.querySelectorAll("body > *"))if(Number(ne==null?void 0:ne.contains(u))^Number(ne==null?void 0:ne.contains(f)))return!0;let I=wv(),z=I.indexOf(u),Y=(z+I.length-1)%I.length,$=(z+1)%I.length,ee=I[Y],W=I[$];return!f.contains(ee)&&!f.contains(W)},[u,f]),w=po(d),v=po(h),x=P.useMemo(()=>({buttonId:w,panelId:v,close:()=>m({type:1})}),[w,v,m]),C=WJ(),_=C==null?void 0:C.registerPopover,S=nt(()=>{var I;return(I=C==null?void 0:C.isFocusWithinPopoverGroup())!=null?I:(g==null?void 0:g.activeElement)&&((u==null?void 0:u.contains(g.activeElement))||(f==null?void 0:f.contains(g.activeElement)))});P.useEffect(()=>_==null?void 0:_(x),[_,x]);let[E,T]=jJ(),R=QJ({mainTreeNodeRef:C==null?void 0:C.mainTreeNodeRef,portals:E,defaultContainers:[u,f]});d6(g==null?void 0:g.defaultView,"focus",I=>{var z,Y,$,ee;I.target!==window&&I.target instanceof HTMLElement&&c===0&&(S()||u&&f&&(R.contains(I.target)||(Y=(z=A.current)==null?void 0:z.contains)!=null&&Y.call(z,I.target)||(ee=($=p.current)==null?void 0:$.contains)!=null&&ee.call($,I.target)||m({type:1})))},!0),T2(R.resolveContainers,(I,z)=>{m({type:1}),S2(z,_2.Loose)||(I.preventDefault(),u==null||u.focus())},c===0);let k=nt(I=>{m({type:1});let z=I?I instanceof HTMLElement?I:"current"in I&&I.current instanceof HTMLElement?I.current:u:u;z==null||z.focus()}),B=P.useMemo(()=>({close:k,isPortalled:y}),[k,y]),M=P.useMemo(()=>({open:c===0,close:k}),[c,k]),F={ref:o};return at.createElement(R2.Provider,{value:null},at.createElement(b6.Provider,{value:l},at.createElement(w6.Provider,{value:B},at.createElement(Cv,{value:_n(c,{0:Dn.Open,1:Dn.Closed})},at.createElement(T,null,Sn({ourProps:F,theirProps:i,slot:M,defaultTag:sMe,name:"Popover"}),at.createElement(R.MainTreeNode,null))))))}let aMe="button";function lMe(t,e){let n=ur(),{id:r=`headlessui-popover-button-${n}`,...i}=t,[s,o]=k2("Popover.Button"),{isPortalled:a}=x6("Popover.Button"),l=P.useRef(null),c=`headlessui-focus-sentinel-${ur()}`,u=WJ(),d=u==null?void 0:u.closeOthers,f=rMe()!==null;P.useEffect(()=>{if(!f)return o({type:3,buttonId:r}),()=>{o({type:3,buttonId:null})}},[f,r,o]);let[h]=P.useState(()=>Symbol()),A=Rn(l,e,f?null:R=>{if(R)s.buttons.current.push(h);else{let k=s.buttons.current.indexOf(h);k!==-1&&s.buttons.current.splice(k,1)}s.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),R&&o({type:2,button:R})}),p=Rn(l,e),m=fc(l),g=nt(R=>{var k,B,M;if(f){if(s.popoverState===1)return;switch(R.key){case Vt.Space:case Vt.Enter:R.preventDefault(),(B=(k=R.target).click)==null||B.call(k),o({type:1}),(M=s.button)==null||M.focus();break}}else switch(R.key){case Vt.Space:case Vt.Enter:R.preventDefault(),R.stopPropagation(),s.popoverState===1&&(d==null||d(s.buttonId)),o({type:0});break;case Vt.Escape:if(s.popoverState!==0)return d==null?void 0:d(s.buttonId);if(!l.current||m!=null&&m.activeElement&&!l.current.contains(m.activeElement))return;R.preventDefault(),R.stopPropagation(),o({type:1});break}}),y=nt(R=>{f||R.key===Vt.Space&&R.preventDefault()}),w=nt(R=>{var k,B;lu(R.currentTarget)||t.disabled||(f?(o({type:1}),(k=s.button)==null||k.focus()):(R.preventDefault(),R.stopPropagation(),s.popoverState===1&&(d==null||d(s.buttonId)),o({type:0}),(B=s.button)==null||B.focus()))}),v=nt(R=>{R.preventDefault(),R.stopPropagation()}),x=s.popoverState===0,C=P.useMemo(()=>({open:x}),[x]),_=xv(t,l),S=f?{ref:p,type:_,onKeyDown:g,onClick:w}:{ref:A,id:s.buttonId,type:_,"aria-expanded":s.popoverState===0,"aria-controls":s.panel?s.panelId:void 0,onKeyDown:g,onKeyUp:y,onClick:w,onMouseDown:v},E=f6(),T=nt(()=>{let R=s.panel;if(!R)return;function k(){_n(E.current,{[Do.Forwards]:()=>co(R,Jr.First),[Do.Backwards]:()=>co(R,Jr.Last)})===Xh.Error&&co(wv().filter(B=>B.dataset.headlessuiFocusGuard!=="true"),_n(E.current,{[Do.Forwards]:Jr.Next,[Do.Backwards]:Jr.Previous}),{relativeTo:s.button})}k()});return at.createElement(at.Fragment,null,Sn({ourProps:S,theirProps:i,slot:C,defaultTag:aMe,name:"Popover.Button"}),x&&!f&&a&&at.createElement(ec,{id:c,features:rl.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:T}))}let cMe="div",uMe=go.RenderStrategy|go.Static;function dMe(t,e){let n=ur(),{id:r=`headlessui-popover-overlay-${n}`,...i}=t,[{popoverState:s},o]=k2("Popover.Overlay"),a=Rn(e),l=Bf(),c=l!==null?(l&Dn.Open)===Dn.Open:s===0,u=nt(f=>{if(lu(f.currentTarget))return f.preventDefault();o({type:1})}),d=P.useMemo(()=>({open:s===0}),[s]);return Sn({ourProps:{ref:a,id:r,"aria-hidden":!0,onClick:u},theirProps:i,slot:d,defaultTag:cMe,features:uMe,visible:c,name:"Popover.Overlay"})}let fMe="div",hMe=go.RenderStrategy|go.Static;function AMe(t,e){let n=ur(),{id:r=`headlessui-popover-panel-${n}`,focus:i=!1,...s}=t,[o,a]=k2("Popover.Panel"),{close:l,isPortalled:c}=x6("Popover.Panel"),u=`headlessui-focus-sentinel-before-${ur()}`,d=`headlessui-focus-sentinel-after-${ur()}`,f=P.useRef(null),h=Rn(f,e,S=>{a({type:4,panel:S})}),A=fc(f),p=o6();Hn(()=>(a({type:5,panelId:r}),()=>{a({type:5,panelId:null})}),[r,a]);let m=Bf(),g=m!==null?(m&Dn.Open)===Dn.Open:o.popoverState===0,y=nt(S=>{var E;switch(S.key){case Vt.Escape:if(o.popoverState!==0||!f.current||A!=null&&A.activeElement&&!f.current.contains(A.activeElement))return;S.preventDefault(),S.stopPropagation(),a({type:1}),(E=o.button)==null||E.focus();break}});P.useEffect(()=>{var S;t.static||o.popoverState===1&&((S=t.unmount)==null||S)&&a({type:4,panel:null})},[o.popoverState,t.unmount,t.static,a]),P.useEffect(()=>{if(o.__demoMode||!i||o.popoverState!==0||!f.current)return;let S=A==null?void 0:A.activeElement;f.current.contains(S)||co(f.current,Jr.First)},[o.__demoMode,i,f,o.popoverState]);let w=P.useMemo(()=>({open:o.popoverState===0,close:l}),[o,l]),v={ref:h,id:r,onKeyDown:y,onBlur:i&&o.popoverState===0?S=>{var E,T,R,k,B;let M=S.relatedTarget;M&&f.current&&((E=f.current)!=null&&E.contains(M)||(a({type:1}),((R=(T=o.beforePanelSentinel.current)==null?void 0:T.contains)!=null&&R.call(T,M)||(B=(k=o.afterPanelSentinel.current)==null?void 0:k.contains)!=null&&B.call(k,M))&&M.focus({preventScroll:!0})))}:void 0,tabIndex:-1},x=f6(),C=nt(()=>{let S=f.current;if(!S)return;function E(){_n(x.current,{[Do.Forwards]:()=>{var T;co(S,Jr.First)===Xh.Error&&((T=o.afterPanelSentinel.current)==null||T.focus())},[Do.Backwards]:()=>{var T;(T=o.button)==null||T.focus({preventScroll:!0})}})}E()}),_=nt(()=>{let S=f.current;if(!S)return;function E(){_n(x.current,{[Do.Forwards]:()=>{var T;if(!o.button)return;let R=wv(),k=R.indexOf(o.button),B=R.slice(0,k+1),M=[...R.slice(k+1),...B];for(let F of M.slice())if(F.dataset.headlessuiFocusGuard==="true"||(T=o.panel)!=null&&T.contains(F)){let I=M.indexOf(F);I!==-1&&M.splice(I,1)}co(M,Jr.First,{sorted:!1})},[Do.Backwards]:()=>{var T;co(S,Jr.Previous)===Xh.Error&&((T=o.button)==null||T.focus())}})}E()});return at.createElement(R2.Provider,{value:r},g&&c&&at.createElement(ec,{id:u,ref:o.beforePanelSentinel,features:rl.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:C}),Sn({mergeRefs:p,ourProps:v,theirProps:s,slot:w,defaultTag:fMe,features:hMe,visible:g,name:"Popover.Panel"}),g&&c&&at.createElement(ec,{id:d,ref:o.afterPanelSentinel,features:rl.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:_}))}let pMe="div";function mMe(t,e){let n=P.useRef(null),r=Rn(n,e),[i,s]=P.useState([]),o=GBe(),a=nt(p=>{s(m=>{let g=m.indexOf(p);if(g!==-1){let y=m.slice();return y.splice(g,1),y}return m})}),l=nt(p=>(s(m=>[...m,p]),()=>a(p))),c=nt(()=>{var p;let m=dA(n);if(!m)return!1;let g=m.activeElement;return(p=n.current)!=null&&p.contains(g)?!0:i.some(y=>{var w,v;return((w=m.getElementById(y.buttonId.current))==null?void 0:w.contains(g))||((v=m.getElementById(y.panelId.current))==null?void 0:v.contains(g))})}),u=nt(p=>{for(let m of i)m.buttonId.current!==p&&m.close()}),d=P.useMemo(()=>({registerPopover:l,unregisterPopover:a,isFocusWithinPopoverGroup:c,closeOthers:u,mainTreeNodeRef:o.mainTreeNodeRef}),[l,a,c,u,o.mainTreeNodeRef]),f=P.useMemo(()=>({}),[]),h=t,A={ref:r};return at.createElement(C6.Provider,{value:d},Sn({ourProps:A,theirProps:h,slot:f,defaultTag:pMe,name:"Popover.Group"}),at.createElement(o.MainTreeNode,null))}let gMe=En(oMe),yMe=En(lMe),vMe=En(dMe),bMe=En(AMe),wMe=En(mMe),er=Object.assign(gMe,{Button:yMe,Overlay:vMe,Panel:bMe,Group:wMe}),KJ=P.createContext(null);function $J(){let t=P.useContext(KJ);if(t===null){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,$J),e}return t}function _6(){let[t,e]=P.useState([]);return[t.length>0?t.join(" "):void 0,P.useMemo(()=>function(n){let r=nt(s=>(e(o=>[...o,s]),()=>e(o=>{let a=o.slice(),l=a.indexOf(s);return l!==-1&&a.splice(l,1),a}))),i=P.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return at.createElement(KJ.Provider,{value:i},n.children)},[e])]}let xMe="label";function CMe(t,e){let n=ur(),{id:r=`headlessui-label-${n}`,passive:i=!1,...s}=t,o=$J(),a=Rn(e);Hn(()=>o.register(r),[r,o.register]);let l={ref:a,...o.props,id:r};return i&&("onClick"in l&&(delete l.htmlFor,delete l.onClick),"onClick"in s&&delete s.onClick),Sn({ourProps:l,theirProps:s,slot:o.slot||{},defaultTag:xMe,name:o.name||"Label"})}let _Me=En(CMe),qJ=Object.assign(_Me,{});function XJ(t=0){let[e,n]=P.useState(t),r=Sv(),i=P.useCallback(l=>{r.current&&n(c=>c|l)},[e,r]),s=P.useCallback(l=>!!(e&l),[e]),o=P.useCallback(l=>{r.current&&n(c=>c&~l)},[n,r]),a=P.useCallback(l=>{r.current&&n(c=>c^l)},[n]);return{flags:e,addFlag:i,hasFlag:s,removeFlag:o,toggleFlag:a}}var SMe=(t=>(t[t.RegisterOption=0]="RegisterOption",t[t.UnregisterOption=1]="UnregisterOption",t))(SMe||{});let EMe={0(t,e){let n=[...t.options,{id:e.id,element:e.element,propsRef:e.propsRef}];return{...t,options:E2(n,r=>r.element.current)}},1(t,e){let n=t.options.slice(),r=t.options.findIndex(i=>i.id===e.id);return r===-1?t:(n.splice(r,1),{...t,options:n})}},S6=P.createContext(null);S6.displayName="RadioGroupDataContext";function YJ(t){let e=P.useContext(S6);if(e===null){let n=new Error(`<${t} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,YJ),n}return e}let E6=P.createContext(null);E6.displayName="RadioGroupActionsContext";function JJ(t){let e=P.useContext(E6);if(e===null){let n=new Error(`<${t} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,JJ),n}return e}function TMe(t,e){return _n(e.type,EMe,t,e)}let BMe="div";function MMe(t,e){let n=ur(),{id:r=`headlessui-radiogroup-${n}`,value:i,defaultValue:s,form:o,name:a,onChange:l,by:c=($,ee)=>$===ee,disabled:u=!1,...d}=t,f=nt(typeof c=="string"?($,ee)=>{let W=c;return($==null?void 0:$[W])===(ee==null?void 0:ee[W])}:c),[h,A]=P.useReducer(TMe,{options:[]}),p=h.options,[m,g]=_6(),[y,w]=B2(),v=P.useRef(null),x=Rn(v,e),[C,_]=r6(i,l,s),S=P.useMemo(()=>p.find($=>!$.propsRef.current.disabled),[p]),E=P.useMemo(()=>p.some($=>f($.propsRef.current.value,C)),[p,C]),T=nt($=>{var ee;if(u||f($,C))return!1;let W=(ee=p.find(ne=>f(ne.propsRef.current.value,$)))==null?void 0:ee.propsRef.current;return W!=null&&W.disabled?!1:(_==null||_($),!0)});s6({container:v.current,accept($){return $.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:$.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk($){$.setAttribute("role","none")}});let R=nt($=>{let ee=v.current;if(!ee)return;let W=dA(ee),ne=p.filter(Se=>Se.propsRef.current.disabled===!1).map(Se=>Se.element.current);switch($.key){case Vt.Enter:LJ($.currentTarget);break;case Vt.ArrowLeft:case Vt.ArrowUp:if($.preventDefault(),$.stopPropagation(),co(ne,Jr.Previous|Jr.WrapAround)===Xh.Success){let Se=p.find(fe=>fe.element.current===(W==null?void 0:W.activeElement));Se&&T(Se.propsRef.current.value)}break;case Vt.ArrowRight:case Vt.ArrowDown:if($.preventDefault(),$.stopPropagation(),co(ne,Jr.Next|Jr.WrapAround)===Xh.Success){let Se=p.find(fe=>fe.element.current===(W==null?void 0:W.activeElement));Se&&T(Se.propsRef.current.value)}break;case Vt.Space:{$.preventDefault(),$.stopPropagation();let Se=p.find(fe=>fe.element.current===(W==null?void 0:W.activeElement));Se&&T(Se.propsRef.current.value)}break}}),k=nt($=>(A({type:0,...$}),()=>A({type:1,id:$.id}))),B=P.useMemo(()=>({value:C,firstOption:S,containsCheckedOption:E,disabled:u,compare:f,...h}),[C,S,E,u,f,h]),M=P.useMemo(()=>({registerOption:k,change:T}),[k,T]),F={ref:x,id:r,role:"radiogroup","aria-labelledby":m,"aria-describedby":y,onKeyDown:R},I=P.useMemo(()=>({value:C}),[C]),z=P.useRef(null),Y=dc();return P.useEffect(()=>{z.current&&s!==void 0&&Y.addEventListener(z.current,"reset",()=>{T(s)})},[z,T]),at.createElement(w,{name:"RadioGroup.Description"},at.createElement(g,{name:"RadioGroup.Label"},at.createElement(E6.Provider,{value:M},at.createElement(S6.Provider,{value:B},a!=null&&C!=null&&l6({[a]:C}).map(([$,ee],W)=>at.createElement(ec,{features:rl.Hidden,ref:W===0?ne=>{var Se;z.current=(Se=ne==null?void 0:ne.closest("form"))!=null?Se:null}:void 0,...Ny({key:$,as:"input",type:"radio",checked:ee!=null,hidden:!0,readOnly:!0,form:o,disabled:u,name:$,value:ee})})),Sn({ourProps:F,theirProps:d,slot:I,defaultTag:BMe,name:"RadioGroup"})))))}var kMe=(t=>(t[t.Empty=1]="Empty",t[t.Active=2]="Active",t))(kMe||{});let RMe="div";function PMe(t,e){var n;let r=ur(),{id:i=`headlessui-radiogroup-option-${r}`,value:s,disabled:o=!1,...a}=t,l=P.useRef(null),c=Rn(l,e),[u,d]=_6(),[f,h]=B2(),{addFlag:A,removeFlag:p,hasFlag:m}=XJ(1),g=po({value:s,disabled:o}),y=YJ("RadioGroup.Option"),w=JJ("RadioGroup.Option");Hn(()=>w.registerOption({id:i,element:l,propsRef:g}),[i,w,l,g]);let v=nt(k=>{var B;if(lu(k.currentTarget))return k.preventDefault();w.change(s)&&(A(2),(B=l.current)==null||B.focus())}),x=nt(k=>{if(lu(k.currentTarget))return k.preventDefault();A(2)}),C=nt(()=>p(2)),_=((n=y.firstOption)==null?void 0:n.id)===i,S=y.disabled||o,E=y.compare(y.value,s),T={ref:c,id:i,role:"radio","aria-checked":E?"true":"false","aria-labelledby":u,"aria-describedby":f,"aria-disabled":S?!0:void 0,tabIndex:S?-1:E||!y.containsCheckedOption&&_?0:-1,onClick:S?void 0:v,onFocus:S?void 0:x,onBlur:S?void 0:C},R=P.useMemo(()=>({checked:E,disabled:S,active:m(2)}),[E,S,m]);return at.createElement(h,{name:"RadioGroup.Description"},at.createElement(d,{name:"RadioGroup.Label"},Sn({ourProps:T,theirProps:a,slot:R,defaultTag:RMe,name:"RadioGroup.Option"})))}let LMe=En(MMe),IMe=En(PMe),hw=Object.assign(LMe,{Option:IMe,Label:qJ,Description:A6}),T6=P.createContext(null);T6.displayName="GroupContext";let OMe=P.Fragment;function FMe(t){var e;let[n,r]=P.useState(null),[i,s]=_6(),[o,a]=B2(),l=P.useMemo(()=>({switch:n,setSwitch:r,labelledby:i,describedby:o}),[n,r,i,o]),c={},u=t;return at.createElement(a,{name:"Switch.Description"},at.createElement(s,{name:"Switch.Label",props:{htmlFor:(e=l.switch)==null?void 0:e.id,onClick(d){n&&(d.currentTarget.tagName==="LABEL"&&d.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},at.createElement(T6.Provider,{value:l},Sn({ourProps:c,theirProps:u,defaultTag:OMe,name:"Switch.Group"}))))}let NMe="button";function DMe(t,e){var n;let r=ur(),{id:i=`headlessui-switch-${r}`,checked:s,defaultChecked:o=!1,onChange:a,disabled:l=!1,name:c,value:u,form:d,...f}=t,h=P.useContext(T6),A=P.useRef(null),p=Rn(A,e,h===null?null:h.setSwitch),[m,g]=r6(s,a,o),y=nt(()=>g==null?void 0:g(!m)),w=nt(E=>{if(lu(E.currentTarget))return E.preventDefault();E.preventDefault(),y()}),v=nt(E=>{E.key===Vt.Space?(E.preventDefault(),y()):E.key===Vt.Enter&&LJ(E.currentTarget)}),x=nt(E=>E.preventDefault()),C=P.useMemo(()=>({checked:m}),[m]),_={id:i,ref:p,role:"switch",type:xv(t,A),tabIndex:t.tabIndex===-1?0:(n=t.tabIndex)!=null?n:0,"aria-checked":m,"aria-labelledby":h==null?void 0:h.labelledby,"aria-describedby":h==null?void 0:h.describedby,disabled:l,onClick:w,onKeyUp:v,onKeyPress:x},S=dc();return P.useEffect(()=>{var E;let T=(E=A.current)==null?void 0:E.closest("form");T&&o!==void 0&&S.addEventListener(T,"reset",()=>{g(o)})},[A,g]),at.createElement(at.Fragment,null,c!=null&&m&&at.createElement(ec,{features:rl.Hidden,...Ny({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:d,checked:m,name:c,value:u})}),Sn({ourProps:_,theirProps:f,slot:C,defaultTag:NMe,name:"Switch"}))}let UMe=En(DMe),HMe=FMe,jMe=Object.assign(UMe,{Group:HMe,Label:qJ,Description:A6});function QMe(t){let e={called:!1};return(...n)=>{if(!e.called)return e.called=!0,t(...n)}}function iB(t,...e){t&&e.length>0&&t.classList.add(...e)}function sB(t,...e){t&&e.length>0&&t.classList.remove(...e)}function zMe(t,e){let n=Go();if(!t)return n.dispose;let{transitionDuration:r,transitionDelay:i}=getComputedStyle(t),[s,o]=[r,i].map(l=>{let[c=0]=l.split(",").filter(Boolean).map(u=>u.includes("ms")?parseFloat(u):parseFloat(u)*1e3).sort((u,d)=>d-u);return c}),a=s+o;if(a!==0){n.group(c=>{c.setTimeout(()=>{e(),c.dispose()},a),c.addEventListener(t,"transitionrun",u=>{u.target===u.currentTarget&&c.dispose()})});let l=n.addEventListener(t,"transitionend",c=>{c.target===c.currentTarget&&(e(),l())})}else e();return n.add(()=>e()),n.dispose}function VMe(t,e,n,r){let i=n?"enter":"leave",s=Go(),o=r!==void 0?QMe(r):()=>{};i==="enter"&&(t.removeAttribute("hidden"),t.style.display="");let a=_n(i,{enter:()=>e.enter,leave:()=>e.leave}),l=_n(i,{enter:()=>e.enterTo,leave:()=>e.leaveTo}),c=_n(i,{enter:()=>e.enterFrom,leave:()=>e.leaveFrom});return sB(t,...e.base,...e.enter,...e.enterTo,...e.enterFrom,...e.leave,...e.leaveFrom,...e.leaveTo,...e.entered),iB(t,...e.base,...a,...c),s.nextFrame(()=>{sB(t,...e.base,...a,...c),iB(t,...e.base,...a,...l),zMe(t,()=>(sB(t,...e.base,...a),iB(t,...e.base,...e.entered),o()))}),s.dispose}function GMe({immediate:t,container:e,direction:n,classes:r,onStart:i,onStop:s}){let o=Sv(),a=dc(),l=po(n);Hn(()=>{t&&(l.current="enter")},[t]),Hn(()=>{let c=Go();a.add(c.dispose);let u=e.current;if(u&&l.current!=="idle"&&o.current)return c.dispose(),i.current(l.current),c.add(VMe(u,r.current,l.current==="enter",()=>{c.dispose(),s.current(l.current)})),c.dispose},[n])}function Iu(t=""){return t.split(/\s+/).filter(e=>e.length>1)}let P2=P.createContext(null);P2.displayName="TransitionContext";var WMe=(t=>(t.Visible="visible",t.Hidden="hidden",t))(WMe||{});function KMe(){let t=P.useContext(P2);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function $Me(){let t=P.useContext(L2);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let L2=P.createContext(null);L2.displayName="NestingContext";function I2(t){return"children"in t?I2(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function ZJ(t,e){let n=po(t),r=P.useRef([]),i=Sv(),s=dc(),o=nt((h,A=gd.Hidden)=>{let p=r.current.findIndex(({el:m})=>m===h);p!==-1&&(_n(A,{[gd.Unmount](){r.current.splice(p,1)},[gd.Hidden](){r.current[p].state="hidden"}}),s.microTask(()=>{var m;!I2(r)&&i.current&&((m=n.current)==null||m.call(n))}))}),a=nt(h=>{let A=r.current.find(({el:p})=>p===h);return A?A.state!=="visible"&&(A.state="visible"):r.current.push({el:h,state:"visible"}),()=>o(h,gd.Unmount)}),l=P.useRef([]),c=P.useRef(Promise.resolve()),u=P.useRef({enter:[],leave:[],idle:[]}),d=nt((h,A,p)=>{l.current.splice(0),e&&(e.chains.current[A]=e.chains.current[A].filter(([m])=>m!==h)),e==null||e.chains.current[A].push([h,new Promise(m=>{l.current.push(m)})]),e==null||e.chains.current[A].push([h,new Promise(m=>{Promise.all(u.current[A].map(([g,y])=>y)).then(()=>m())})]),A==="enter"?c.current=c.current.then(()=>e==null?void 0:e.wait.current).then(()=>p(A)):p(A)}),f=nt((h,A,p)=>{Promise.all(u.current[A].splice(0).map(([m,g])=>g)).then(()=>{var m;(m=l.current.shift())==null||m()}).then(()=>p(A))});return P.useMemo(()=>({children:r,register:a,unregister:o,onStart:d,onStop:f,wait:c,chains:u}),[a,o,r,d,f,u,c])}function qMe(){}let XMe=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function wH(t){var e;let n={};for(let r of XMe)n[r]=(e=t[r])!=null?e:qMe;return n}function YMe(t){let e=P.useRef(wH(t));return P.useEffect(()=>{e.current=wH(t)},[t]),e}let JMe="div",eZ=go.RenderStrategy;function ZMe(t,e){var n,r;let{beforeEnter:i,afterEnter:s,beforeLeave:o,afterLeave:a,enter:l,enterFrom:c,enterTo:u,entered:d,leave:f,leaveFrom:h,leaveTo:A,...p}=t,m=P.useRef(null),g=Rn(m,e),y=(n=p.unmount)==null||n?gd.Unmount:gd.Hidden,{show:w,appear:v,initial:x}=KMe(),[C,_]=P.useState(w?"visible":"hidden"),S=$Me(),{register:E,unregister:T}=S;P.useEffect(()=>E(m),[E,m]),P.useEffect(()=>{if(y===gd.Hidden&&m.current){if(w&&C!=="visible"){_("visible");return}return _n(C,{hidden:()=>T(m),visible:()=>E(m)})}},[C,m,E,T,w,y]);let R=po({base:Iu(p.className),enter:Iu(l),enterFrom:Iu(c),enterTo:Iu(u),entered:Iu(d),leave:Iu(f),leaveFrom:Iu(h),leaveTo:Iu(A)}),k=YMe({beforeEnter:i,afterEnter:s,beforeLeave:o,afterLeave:a}),B=Ig();P.useEffect(()=>{if(B&&C==="visible"&&m.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[m,C,B]);let M=x&&!v,F=v&&w&&x,I=!B||M?"idle":w?"enter":"leave",z=XJ(0),Y=nt(fe=>_n(fe,{enter:()=>{z.addFlag(Dn.Opening),k.current.beforeEnter()},leave:()=>{z.addFlag(Dn.Closing),k.current.beforeLeave()},idle:()=>{}})),$=nt(fe=>_n(fe,{enter:()=>{z.removeFlag(Dn.Opening),k.current.afterEnter()},leave:()=>{z.removeFlag(Dn.Closing),k.current.afterLeave()},idle:()=>{}})),ee=ZJ(()=>{_("hidden"),T(m)},S),W=P.useRef(!1);GMe({immediate:F,container:m,classes:R,direction:I,onStart:po(fe=>{W.current=!0,ee.onStart(m,fe,Y)}),onStop:po(fe=>{W.current=!1,ee.onStop(m,fe,$),fe==="leave"&&!I2(ee)&&(_("hidden"),T(m))})});let ne=p,Se={ref:g};return F?ne={...ne,className:H_(p.className,...R.current.enter,...R.current.enterFrom)}:W.current&&(ne.className=H_(p.className,(r=m.current)==null?void 0:r.className),ne.className===""&&delete ne.className),at.createElement(L2.Provider,{value:ee},at.createElement(Cv,{value:_n(C,{visible:Dn.Open,hidden:Dn.Closed})|z.flags},Sn({ourProps:Se,theirProps:ne,defaultTag:JMe,features:eZ,visible:C==="visible",name:"Transition.Child"})))}function eke(t,e){let{show:n,appear:r=!1,unmount:i=!0,...s}=t,o=P.useRef(null),a=Rn(o,e);Ig();let l=Bf();if(n===void 0&&l!==null&&(n=(l&Dn.Open)===Dn.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,u]=P.useState(n?"visible":"hidden"),d=ZJ(()=>{u("hidden")}),[f,h]=P.useState(!0),A=P.useRef([n]);Hn(()=>{f!==!1&&A.current[A.current.length-1]!==n&&(A.current.push(n),h(!1))},[A,n]);let p=P.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);P.useEffect(()=>{if(n)u("visible");else if(!I2(d))u("hidden");else{let w=o.current;if(!w)return;let v=w.getBoundingClientRect();v.x===0&&v.y===0&&v.width===0&&v.height===0&&u("hidden")}},[n,d]);let m={unmount:i},g=nt(()=>{var w;f&&h(!1),(w=t.beforeEnter)==null||w.call(t)}),y=nt(()=>{var w;f&&h(!1),(w=t.beforeLeave)==null||w.call(t)});return at.createElement(L2.Provider,{value:d},at.createElement(P2.Provider,{value:p},Sn({ourProps:{...m,as:P.Fragment,children:at.createElement(tZ,{ref:a,...m,...s,beforeEnter:g,beforeLeave:y})},theirProps:{},defaultTag:P.Fragment,features:eZ,visible:c==="visible",name:"Transition"})))}function tke(t,e){let n=P.useContext(P2)!==null,r=Bf()!==null;return at.createElement(at.Fragment,null,!n&&r?at.createElement(F5,{ref:e,...t}):at.createElement(tZ,{ref:e,...t}))}let F5=En(eke),tZ=En(ZMe),nke=En(tke),Ci=Object.assign(F5,{Child:nke,Root:F5});/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var ml=function(){return ml=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ml.apply(this,arguments)};function rke(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 xH(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t}var nZ=function(t){t===void 0&&(t=12);for(var e=8,n=Math.pow(16,Math.min(t,e)-1),r=Math.pow(16,Math.min(t,e))-1,i=Math.floor(Math.random()*(r-n+1))+n,s=i.toString(16);s.length<t;)s=s+nZ(t-e);return s},rZ="stack",Dy="factoryStack";typeof window<"u"&&(window[Dy]||(window[Dy]={}));var ike=function(t,e){return window[Dy][t]=e,e},ske=function(t){delete window[Dy][t]},oke=function(t){return window[Dy][t||rZ]},ake=function(t,e){var n=(t||{}).scope,r=n===void 0?rZ:n,i=P.useRef(t),s=P.useState({}),o=s[0],a=s[1],l=P.useState([]),c=l[0],u=l[1],d=P.useCallback(function(C,_){var S;return(S=o==null?void 0:o[C])===null||S===void 0?void 0:S.resolve(_)},[o]),f=P.useCallback(function(C){return Object.values(o).forEach(function(_){return _.resolve(C)})},[o]),h=P.useCallback(function(C,_){var S;return(S=o==null?void 0:o[C])===null||S===void 0?void 0:S.reject(_)},[o]),A=P.useCallback(function(C){return Object.values(o).forEach(function(_){return _.reject(C)})},[o]),p=P.useCallback(function(C){return!!c.find(function(_){return _===C})},[c]),m=P.useCallback(function(C){return o==null?void 0:o[C]},[o]),g=function(C,_){var S;u(function(E){return E.filter(function(T){return T!==C})}),setTimeout(function(){a(function(E){var T=E,R=C;T[R];var k=rke(T,[typeof R=="symbol"?R:R+""]);return k})},_==null?void 0:_.exitTimeout),(S=t.onRemove)===null||S===void 0||S.call(t,C)},y=function(C,_,S){return _===void 0&&(_={}),new Promise(function(E,T){var R=(S==null?void 0:S.instanceId)||nZ(),k=i.current,B=k.enterTimeout,M=k.exitTimeout,F=k.isAppendIntances,I=k.onResolve,z=k.onReject,Y=ml({enterTimeout:B,exitTimeout:M,instanceId:R},_),$=ml({Component:C,props:ml(ml({},_),S),resolve:function(ee){w.current(R,Y),E(ee),I==null||I(ee,R)},reject:function(ee){w.current(R,Y),T(ee),z==null||z(ee,R)}},Y);a(function(ee){var W,ne;return F?ml(ml({},ee),(W={},W[R]=$,W)):ml((ne={},ne[R]=$,ne),ee)}),setTimeout(function(){var ee,W;u(function(ne){return xH(xH([],ne),[R])}),(W=(ee=i.current).onOpen)===null||W===void 0||W.call(ee,R,$)},Y.enterTimeout)})},w=P.useRef(g),v=P.useRef(y);P.useEffect(function(){i.current=t,w.current=g,v.current=y}),P.useImperativeHandle(e,function(){return{create:v.current,resolve:d,reject:h,resolveAll:f,rejectAll:A,hasInstance:p,getInstance:m}}),P.useEffect(function(){return ike(r,{create:v.current,resolve:d,reject:h,resolveAll:f,rejectAll:A,hasInstance:p,getInstance:m}),function(){return ske(r)}},[r]);var x=P.useMemo(function(){var C=Object.keys(o);return C.map(function(_){var S=o[_],E=S.Component,T=S.props,R=S.resolve,k=S.reject,B=!!c.find(function(M){return M===_});return at.createElement(E,ml({},T,{key:_,isOpen:B,onReject:k,onResolve:R,close:R,open:B}))})},[o,c]);return at.createElement(at.Fragment,null,x)},B6=P.forwardRef(ake);B6.defaultProps={exitTimeout:500,enterTimeout:50};var O2=function(t,e){return function(n){return oke(e==null?void 0:e.scope).create(t,e,n)}};const iZ=({onVarClick:t,prevVariables:e})=>b.jsx("ul",{className:"flex flex-col",children:e.length&&e.map(({key:n,value:r})=>b.jsx("li",{children:b.jsxs("button",{className:"flex w-full justify-between items-center rounded-md hover:bg-gray-100 max-w-xs",onClick:()=>t(n),children:[b.jsx("span",{className:"font-[monospace] text-gray-800",children:n})," ",b.jsx("span",{className:"font-[monospace] text-gray-600 w-24 text-start font-bold",children:r})]})},n))}),sZ=(t,e)=>n=>{var o,a,l,c,u;const r=(o=t.current)==null?void 0:o.selectionStart;let i=(a=t.current)==null?void 0:a.selectionEnd,s="";typeof r=="number"&&typeof i=="number"?(s=lke(((l=t.current)==null?void 0:l.value)||"",r,i,n),i=r+n.length):s=((c=t.current)==null?void 0:c.value)+n,e(s),(u=t.current)==null||u.focus(),setTimeout(()=>{var f;const d=typeof i=="number"?i:s.length;(f=t.current)==null||f.setSelectionRange(d,d)})};function lke(t,e,n,r){return t.slice(0,e)+(r||"")+t.slice(e+n)}const oZ=({calcResult:t})=>b.jsx("div",{className:"font-[monospace] pl-4 text-gray-600",children:b.jsxs("span",{className:`${t==="NAN"?"bg-pink-200":""} px-2 py-0.5 rounded`,children:["= ",t]})}),M6=({newVariableName:t,isNewVariableNameUnique:e,setNewVariableName:n,shouldCreateVariable:r,setShouldCreateVariable:i=()=>{},showCheckbox:s=!0})=>b.jsxs(b.Fragment,{children:[b.jsx("label",{htmlFor:"create-new-variable",className:"block mt-3 font-mono text-chalkboard-90",children:"Create new variable"}),b.jsxs("div",{className:"mt-1 flex gap-2 items-center",children:[s&&b.jsx("input",{type:"checkbox","data-testid":"create-new-variable-checkbox",checked:r,onChange:o=>{i(o.target.checked)},className:"bg-chalkboard-10 dark:bg-chalkboard-80"}),b.jsx("input",{type:"text",disabled:!r,name:"create-new-variable",id:"create-new-variable",autoFocus:!0,autoCapitalize:"off",autoCorrect:"off",className:`font-mono flex-1 sm:text-sm px-2 py-1 rounded-sm bg-chalkboard-10 dark:bg-chalkboard-90 text-chalkboard-90 dark:text-chalkboard-10 ${r?"":"opacity-50"}`,value:t,onChange:o=>{n(o.target.value)}})]}),!e&&b.jsx("div",{className:"bg-pink-200 dark:bg-chalkboard-80 dark:text-pink-200 rounded px-2 py-0.5 text-xs",children:"Sorry, that's not a unique variable name. Please try something else"})]});function Tv(t,e,n){let r=n?zn(n):t;return e===-1&&(r=xl(r)),r.type==="UnaryExpression"&&r.operator==="-"&&r.argument.type==="UnaryExpression"&&r.argument.operator==="-"&&(r=r.argument.argument),r.type==="UnaryExpression"&&r.operator==="-"&&r.argument.type==="Literal"&&typeof r.argument.value=="number"&&r.argument.value<0&&(r=tt(-r.argument.value)),r}const cke=t=>/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t);function F2({value:t,initialVariableName:e=""}){var g;const{programMemory:n,code:r}=uc(),{context:i}=Ti(),s=(g=i.selectionRanges.codeBasedSelections[0])==null?void 0:g.range,o=P.useRef(null),[a,l]=P.useState({variables:[],insertIndex:0,bodyPath:[]}),[c,u]=P.useState(null),[d,f]=P.useState("NAN"),[h,A]=P.useState(""),[p,m]=P.useState(!0);return P.useEffect(()=>{setTimeout(()=>{o.current&&o.current.focus(),o.current&&o.current.setSelectionRange(0,String(t).length)},100),A(jo(be.ast,e))},[]),P.useEffect(()=>{n.has(h)||h===""||!cke(h)?m(!1):m(!0)},[n,h]),P.useEffect(()=>{if(!n||!s)return;const y=Zq(be.ast,be.programMemory,s);l(y)},[be.ast,be.programMemory,s]),P.useEffect(()=>{(async()=>{var T,R,k,B;const w=`const __result__ = ${t}`,v=Rr(w);if(ie(v)||pt(v,{suppress:!0}))return;const x=ao.empty();for(const{key:M,value:F}of a.variables){const I=x.set(M,{type:"UserVal",value:F,__meta:[]});if(pt(I,{suppress:!0}))return}const{execState:C}=await kl({ast:v,engineCommandManager:je,useFakeExecutor:!0,programMemoryOverride:be.programMemory.clone()}),_=v.body.find(M=>{var F,I,z;return M.type==="VariableDeclaration"&&((z=(I=(F=M.declarations)==null?void 0:F[0])==null?void 0:I.id)==null?void 0:z.name)==="__result__"}),S=(_==null?void 0:_.type)==="VariableDeclaration"&&((R=(T=_==null?void 0:_.declarations)==null?void 0:T[0])==null?void 0:R.init),E=(B=(k=C.memory)==null?void 0:k.get("__result__"))==null?void 0:B.value;f(typeof E=="number"?String(E):"NAN"),S&&u(S)})().catch(()=>{f("NAN"),u(null)})},[t,a,r,be.programMemory]),{valueNode:c,calcResult:d,prevVariables:a.variables,newVariableInsertIndex:a.insertIndex,newVariableName:h,isNewVariableNameUnique:p,setNewVariableName:A,inputRef:o}}const k6=O2,R6=({isOpen:t,onResolve:e,onReject:n,segName:r,isSegNameEditable:i,value:s,initialVariableName:o})=>{const[a,l]=P.useState(Math.sign(Number(s))),[c,u]=P.useState(r),[d,f]=P.useState(s===void 0?"":String(Math.abs(s))),[h,A]=P.useState(!1),{prevVariables:p,inputRef:m,calcResult:g,valueNode:y,setNewVariableName:w,newVariableName:v,isNewVariableNameUnique:x,newVariableInsertIndex:C}=F2({value:d,initialVariableName:o});return b.jsx(Ci,{appear:!0,show:t,as:P.Fragment,children:b.jsxs(ir,{as:"div",className:"relative z-10",onClose:n,children:[b.jsx(Ci.Child,{as:P.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:b.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-25"})}),b.jsx("div",{className:"fixed inset-0 overflow-y-auto",children:b.jsx("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:b.jsx(Ci.Child,{as:P.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:b.jsxs(ir.Panel,{className:"w-full max-w-md transform overflow-hidden rounded-2xl bg-white/90 p-6 text-left align-middle shadow-xl transition-all",children:[b.jsx(ir.Title,{as:"h3",className:"text-lg font-medium leading-6 text-gray-900",children:"Constraint details"}),b.jsx("div",{className:"block text-sm font-medium text-gray-700 mt-3 font-mono capitalize",children:"Available Variables"}),b.jsx(iZ,{prevVariables:p,onVarClick:sZ(m,f)}),b.jsx("label",{htmlFor:"val",className:"block text-sm font-medium text-gray-700 mt-3 font-mono",children:"Distance"}),b.jsxs("div",{className:"mt-1 flex",children:[b.jsx("button",{className:"border border-gray-400 px-2 mr-1 text-gray-900",onClick:()=>l(-a),children:a>0?"+":"-"}),b.jsx("input",{type:"text",name:"val",id:"val",ref:m,className:"shadow-sm focus:ring-blue-500 focus:border-blue-500 block w-full sm:text-sm text-gray-900 border-gray-300 rounded-md font-mono",value:d,onChange:_=>{f(_.target.value)}})]}),b.jsx(oZ,{calcResult:g}),b.jsx("label",{htmlFor:"segName",className:"block text-sm font-medium text-gray-700 mt-3 font-mono",children:"Segment Name"}),b.jsx("div",{className:"mt-1",children:b.jsx("input",{type:"text",name:"segName",id:"segName",disabled:!i,className:"shadow-sm focus:ring-blue-500 focus:border-blue-500 block w-full sm:text-sm text-gray-900 border-gray-300 rounded-md font-mono",value:c,onChange:_=>{u(_.target.value)}})}),b.jsx(M6,{setNewVariableName:w,newVariableName:v,isNewVariableNameUnique:x,shouldCreateVariable:h,setShouldCreateVariable:A}),b.jsx("div",{className:"mt-4",children:b.jsx("button",{type:"button",className:"inline-flex justify-center rounded-md border border-transparent bg-blue-100 px-4 py-2 text-sm font-medium text-blue-900 hover:bg-blue-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",onClick:()=>y&&e({segName:c,value:d,valueNode:y,newVariableInsertIndex:C,sign:a,variableName:h?v:void 0}),children:"Add constraining value"})})]})})})})]})})},uke=k6(R6);function Ip({selectionRanges:t,constraint:e}){const n=t.codeBasedSelections.map(({range:m})=>un(be.ast,m)),r=n.map(m=>{const g=Xe(be.ast,m);return ie(g)?g:g.node}),[i,,s]=RG(r);if(i)return s[0];const o=r,a=n.map(m=>{const g=Xe(be.ast,m,"VariableDeclarator");return ie(g)?g:g.node}),l=a.find(ie);if(ie(l))return l;const c=a,u=c[0],d=c.slice(1),f=d.every(m=>Mg(m,u,be.ast)),h=o.every(m=>(m==null?void 0:m.type)==="CallExpression"&&[...vo,"startSketchAt"].includes(m.callee.name)),A=Sf({...t,codeBasedSelections:t.codeBasedSelections.slice(1)},be.ast,e);return{enabled:d.length===1&&h&&f&&A.every(Boolean),transforms:A}}async function CH({selectionRanges:t,constraint:e,isAlign:n=!1}){const r=Ip({selectionRanges:t,constraint:e});if(ie(r))return Promise.reject(r);const i=r.transforms,s=iu({ast:structuredClone(be.ast),selectionRanges:t,transformInfos:i,programMemory:be.programMemory});if(ie(s))return Promise.reject(s);const{modifiedAst:o,tagInfo:a,valueUsedInTransform:l,pathToNodeMap:c}=s,{segName:u,value:d,valueNode:f,variableName:h,newVariableInsertIndex:A,sign:p}=await uke({segName:a==null?void 0:a.tag,isSegNameEditable:!(a!=null&&a.isTagExisting),value:l,initialVariableName:e==="setHorzDistance"?"xDis":"yDis"});if(!h&&u===(a==null?void 0:a.tag)&&Number(d)===l)return{modifiedAst:o,pathToNodeMap:c};{if(!Ga(f))return Promise.reject("Invalid valueNode, is not a BinaryPart");let m=n?tt(0):Tv(f,p,h);const g=iu({ast:be.ast,selectionRanges:t,transformInfos:i,programMemory:be.programMemory,forceSegName:u,forceValueUsedInTransform:m});if(ie(g))return Promise.reject(g);const{modifiedAst:y,pathToNodeMap:w}=g;if(h){const v=[...y.body];v.splice(A,0,Ta(h,f)),y.body=v,Object.values(w).forEach(x=>{const C=x.findIndex(_=>_[0]==="body")+1;x[C][0]=Number(x[C][0])+1})}return{modifiedAst:y,pathToNodeMap:w}}}function _H({selectionRanges:t,constraint:e}){const n=Ip({selectionRanges:t,constraint:e});if(ie(n))return n;const r=n.transforms;let i=tt(0);const s=iu({ast:be.ast,selectionRanges:t,transformInfos:r,programMemory:be.programMemory,forceValueUsedInTransform:i});if(ie(s))return s;const{modifiedAst:o,pathToNodeMap:a}=s;return{modifiedAst:o,pathToNodeMap:a}}const dke=k6(R6);function P6({selectionRanges:t}){const e=t.codeBasedSelections.map(({range:A})=>un(be.ast,A)),n=e.map(A=>{const p=Xe(be.ast,A);return ie(p)?p:p.node}),r=n.find(ie);if(ie(r))return r;const i=n,s=e.map(A=>{const p=Xe(be.ast,A,"VariableDeclarator");return ie(p)?p:p.node}),o=s.find(ie);if(ie(o))return o;const a=s,l=a[0],c=a.slice(1),u=c.every(A=>Mg(A,l,be.ast)),d=i.every(A=>(A==null?void 0:A.type)==="CallExpression"&&vo.includes(A.callee.name)),f=Sf({...t,codeBasedSelections:t.codeBasedSelections.slice(1)},be.ast,"setAngleBetween");return{enabled:t.otherSelections.length===0&&c.length===1&&d&&u&&f.every(Boolean),transforms:f}}async function fke({selectionRanges:t}){const e=P6({selectionRanges:t});if(ie(e))return Promise.reject(e);const n=e.transforms,r=iu({ast:structuredClone(be.ast),selectionRanges:t,transformInfos:n,programMemory:be.programMemory});if(ie(r))return Promise.reject(r);const{modifiedAst:i,tagInfo:s,valueUsedInTransform:o,pathToNodeMap:a}=r,{segName:l,value:c,valueNode:u,variableName:d,newVariableInsertIndex:f,sign:h}=await dke({segName:s==null?void 0:s.tag,isSegNameEditable:!(s!=null&&s.isTagExisting),value:o,initialVariableName:"angle"});if(l===(s==null?void 0:s.tag)&&Number(c)===o&&!d)return{modifiedAst:i,pathToNodeMap:a};if(!Ga(u))return Promise.reject("Invalid valueNode, is not a BinaryPart");const A=Tv(u,h,d),p=iu({ast:be.ast,selectionRanges:t,transformInfos:n,programMemory:be.programMemory,forceSegName:l,forceValueUsedInTransform:A});if(ie(p))return Promise.reject(p);const{modifiedAst:m,pathToNodeMap:g}=p;if(d){const y=[...m.body];y.splice(f,0,Ta(d,u)),m.body=y,Object.values(g).forEach(w=>{const v=w.findIndex(x=>x[0]==="body")+1;w[v][0]=Number(w[v][0])+1})}return{modifiedAst:m,pathToNodeMap:g}}const aZ=O2,lZ=({isOpen:t,onResolve:e,onReject:n,value:r,valueName:i,shouldCreateVariable:s=!1})=>{const[o,a]=P.useState(Math.sign(Number(r))),[l,c]=P.useState(String(r*o)),[u,d]=P.useState(s),{prevVariables:f,calcResult:h,valueNode:A,isNewVariableNameUnique:p,newVariableName:m,setNewVariableName:g,inputRef:y,newVariableInsertIndex:w}=F2({value:l,initialVariableName:i});return b.jsx(Ci,{appear:!0,show:t,as:P.Fragment,children:b.jsxs(ir,{as:"div",className:"relative z-10",onClose:n,children:[b.jsx(Ci.Child,{as:P.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:b.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-25"})}),b.jsx("div",{className:"fixed inset-0 overflow-y-auto",children:b.jsx("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:b.jsx(Ci.Child,{as:P.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:b.jsxs(ir.Panel,{className:"w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all",children:[b.jsxs(ir.Title,{as:"h3",className:"text-lg font-medium leading-6 text-gray-900 capitalize",children:["Set ",i]}),b.jsx("div",{className:"block text-sm font-medium text-gray-700 mt-3 font-mono capitalize",children:"Available Variables"}),b.jsx(iZ,{prevVariables:f,onVarClick:sZ(y,c)}),b.jsxs("label",{htmlFor:"val",className:"block text-sm font-medium text-gray-700 mt-3 font-mono capitalize",children:[i," Value"]}),b.jsxs("div",{className:"mt-1 flex",children:[b.jsx("button",{className:"border border-gray-300 px-2 text-gray-900",onClick:()=>a(-o),children:o>0?"+":"-"}),b.jsx("input",{ref:y,type:"text",name:"val",id:"val",className:"shadow-sm focus:ring-blue-500 focus:border-blue-500 block w-full sm:text-sm border-gray-300 rounded-md font-mono pl-1 text-gray-900",value:l,onChange:v=>{c(v.target.value)}})]}),b.jsx(oZ,{calcResult:h}),b.jsx(M6,{setNewVariableName:g,newVariableName:m,isNewVariableNameUnique:p,shouldCreateVariable:u,setShouldCreateVariable:d}),b.jsx("div",{className:"mt-4",children:b.jsx("button",{type:"button",disabled:h==="NAN"||!p,className:`inline-flex justify-center rounded-md border border-transparent bg-blue-100 px-4 py-2 text-sm font-medium text-blue-900 hover:bg-blue-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 ${h==="NAN"||!p?"opacity-50 cursor-not-allowed":""}`,onClick:()=>A&&e({value:l,sign:o,valueNode:A,newVariableInsertIndex:w,variableName:u?m:void 0}),children:"Add constraining value"})})]})})})})]})})},hke=aZ(lZ);function N5({selectionRanges:t,angleOrLength:e="setLength"}){const r=t.codeBasedSelections.map(({range:l})=>un(be.ast,l)).map(l=>Xe(be.ast,l,"CallExpression")),i=r.find(ie);if(ie(i))return i;const s=r.every(l=>{var c;return ie(l)?!1:((c=l.node)==null?void 0:c.type)==="CallExpression"&&vo.includes(l.node.callee.name)}),o=Sf(t,be.ast,e);return{enabled:t.codeBasedSelections.length<=1&&s&&o.every(Boolean),transforms:o}}async function SH({selectionRanges:t,angleOrLength:e="setLength"}){const n=N5({selectionRanges:t,angleOrLength:e});if(ie(n))return Promise.reject(n);const{transforms:r}=n,i=su({ast:structuredClone(be.ast),selectionRanges:t,transformInfos:r,programMemory:be.programMemory,referenceSegName:""});if(ie(i))return Promise.reject(i);const{valueUsedInTransform:s}=i,a=t.otherSelections.length===1&&t.otherSelections[0]==="y-axis"&&e==="setAngle",c=t.otherSelections.length===1&&t.otherSelections[0]==="x-axis"&&e==="setAngle";let u=s||0,d=zn("ZERO");a?(d=zn(u<0?"THREE_QUARTER_TURN":"QUARTER_TURN"),u=tg(u+(u<0?90:-90))):c&&(d=zn(Math.abs(u)>90?"HALF_TURN":"ZERO"),u=Math.abs(u)>90?tg(u-180):u);const{valueNode:f,variableName:h,newVariableInsertIndex:A,sign:p}=await hke({value:u,valueName:e==="setAngle"?"angle":"length",shouldCreateVariable:!0});if(!Ga(f))return Promise.reject("Invalid valueNode, is not a BinaryPart");let m=Tv(f,p,h);(a||c&&d.name!=="ZERO")&&(m=ou([d,m]));const g=su({ast:structuredClone(be.ast),selectionRanges:t,transformInfos:r,programMemory:be.programMemory,referenceSegName:"",forceValueUsedInTransform:m});if(ie(g))return Promise.reject(g);const{modifiedAst:y,pathToNodeMap:w}=g;if(h){const v=[...y.body];v.splice(A,0,Ta(h,f)),y.body=v,Object.values(w).forEach(x=>{const C=x.findIndex(_=>_[0]==="body")+1;x[C][0]=Number(x[C][0])+1})}return{modifiedAst:y,pathToNodeMap:w}}function cZ({selectionRanges:t}){const e=t.codeBasedSelections.map(({range:A})=>un(be.ast,A)),n=e.map(A=>{const p=Xe(be.ast,A);return ie(p)?p:p.node}),r=n.find(ie);if(ie(r))return r;const i=n,s=e.map(A=>{const p=Xe(be.ast,A,"VariableDeclarator");return ie(p)?p:p.node}),o=s.find(ie);if(ie(o))return o;const a=s,l=a[0],c=a.slice(1),u=c.every(A=>Mg(A,l,be.ast)),d=i.every(A=>(A==null?void 0:A.type)==="CallExpression"&&vo.includes(A.callee.name)),f=Sf({...t,codeBasedSelections:t.codeBasedSelections.slice(1)},be.ast,"equalLength");return ie(f)?f:{enabled:!!c.length&&d&&u&&f.every(Boolean),transforms:f}}function Ake({selectionRanges:t}){const e=cZ({selectionRanges:t});if(ie(e))return e;const{transforms:n}=e,r=iu({ast:be.ast,selectionRanges:t,transformInfos:n,programMemory:be.programMemory});if(ie(r))return r;const{modifiedAst:i,pathToNodeMap:s}=r;return{modifiedAst:i,pathToNodeMap:s}}function pke(t,e,n){const r=mke(t,e,n);if(ie(r))return r;const{modifiedAst:i,pathToFilletNode:s}=r;vke(i,s)}function mke(t,e,n){var u;let r=structuredClone(t);const i=structuredClone(t),s=gke(r,n);if(ie(s))return s;const o=je.artifactGraph,a=new Map,l=new Map;for(const d of e.codeBasedSelections){const f={codeBasedSelections:[d],otherSelections:[]},h=f.codeBasedSelections[0].type,A=yke(i,f,o);if(ie(A))return A;const{pathToSegmentNode:p,pathToExtrudeNode:m}=A,g=bke(r,p);if(ie(g))return g;const{tag:y}=g,w={tag:y,selectionType:h},v=JSON.stringify(m);if(l.has(v)){const x=l.get(v);if(!x)return new Error("Path to extrude node not found.");(u=a.get(x))==null||u.push(w)}else l.set(v,m),a.set(m,[w])}let c=[];for(const[d,f]of a.entries()){const h="variableName"in n?n.variableIdentifierAst:n.valueAst,A=f.map(({tag:v,selectionType:x})=>uZ(v,x)),p=A[0],m=lr("fillet",[Po({radius:h,tags:bn(A)}),cn()]),g=wke(r,d);if(ie(g))return g;const{extrudeDeclarator:y}=g;let w=[];if(y.init.type==="CallExpression")y.init=Yl([y.init,m]),w=EH(d,y,p),c.push(w);else if(y.init.type==="PipeExpression"){const v=y.init.body.find(x=>x.type==="CallExpression"&&x.callee.name==="fillet");if(!v||v.type!=="CallExpression")return new Error("Fillet CallExpression not found.");y.init.body.push(m),w=EH(d,y,p),c.push(w)}else return new Error("Unsupported extrude type.")}return{modifiedAst:r,pathToFilletNode:c}}function gke(t,e){try{if("variableName"in e&&e.variableName&&e.insertIndex!==void 0){const n=structuredClone(t);return n.body.splice(e.insertIndex,0,e.variableDeclarationAst),{ast:n}}return{ast:t}}catch(n){return new Error(`Failed to handle AST: ${n.message}`)}}function yke(t,e,n){const r=un(t,e.codeBasedSelections[0].range),i=Xe(t,r,"VariableDeclaration");if(ie(i))return i;const s=i.node.declarations[0].id.name,o=js(be.programMemory.get(s),s);if(pt(o))return o;const a=Kbe(o.id,n);if(ie(a))return a;const l=un(t,a.codeRef.range);return ie(l)?l:{pathToSegmentNode:r,pathToExtrudeNode:l}}async function vke(t,e){const n=await be.updateAst(t,!0,{focusPath:e});n!=null&&n.selections&&Ot.selectRange(n==null?void 0:n.selections)}function bke(t,e){const n=Xe(t,e,"CallExpression");if(ie(n))return n;if(!(n.node.callee.name in ba))return new Error("Selection is not a sketch segment");const r=iX({pathToNode:e,node:t},n.node.callee.name,null);if(ie(r))return r;const{tag:i}=r;return{modifiedAst:t,tag:i}}function uZ(t,e){let n=zn(t);return e==="edge"?n=lr("getOppositeEdge",[n]):e==="adjacent-edge"&&(n=lr("getNextAdjacentEdge",[n])),n}function wke(t,e){const n=Xe(t,e,"VariableDeclaration");if(ie(n))return n;const{node:r}=n,i=r.declarations[0];if(!i)return new Error("Extrude Declarator not found.");const s=i==null?void 0:i.init;return s?s.type!=="CallExpression"&&s.type!=="PipeExpression"?new Error("Extrude must be a PipeExpression or CallExpression"):{extrudeDeclarator:i}:new Error("Extrude Init not found.")}function EH(t,e,n){let r=[],i=!1;Vl(e.init,{enter(o,a){if(o.type==="CallExpression"&&o.callee.name==="fillet"&&(i=!0),i&&o.type==="ObjectExpression"){if(!dZ(o,n))return!1;r=xke(o,a)}},leave(o){o.type==="CallExpression"&&o.callee.name==="fillet"&&(i=!1)}});let s=t.findIndex(o=>o[1]==="PipeExpression");return s=s===-1?t.length:s,[...t.slice(0,s),...r]}function dZ(t,e){return t.properties.some(n=>{if(n.key.name==="tags"&&n.value.type==="ArrayExpression"){if(e.type==="Identifier")return n.value.elements.some(r=>r.type==="Identifier"&&r.name===e.name);if(e.type==="CallExpression")return n.value.elements.some(r=>r.type==="CallExpression"&&r.callee.name===e.callee.name&&r.arguments[0].type==="Identifier"&&e.arguments[0].type==="Identifier"&&r.arguments[0].name===e.arguments[0].name)}return!1})}function xke(t,e){let n=e;return t.properties.forEach((r,i)=>{r.key.name==="radius"&&n.push(["properties","ObjectExpression"],[i,"index"],["value","Property"])}),n}const Cke=({selectionRanges:t,ast:e,code:n})=>{let r=!1;if(Vl(e,{enter(i){i.type==="CallExpression"&&i.callee.name==="extrude"&&(r=!0)}}),!r)return!1;if(t.codeBasedSelections.length===0||t.codeBasedSelections[0].range[0]===n.length)return!0;for(const i of t.codeBasedSelections){const s=un(e,i.range),o=Xe(e,s,"CallExpression");if(ie(o)||o.node.type!=="CallExpression"||!(o.node.callee.name in ba))return!1;const a=nX(i,e);if(ie(a)||!a)return!1;let l=!1,c="";if(Vl(o.node,{enter(u){u.type==="TagDeclarator"&&(l=!0,c=u.value)}}),l){let u=uZ(c,i.type),d=!1,f=!1;if(Vl(e,{enter(h){h.type==="CallExpression"&&h.callee.name==="fillet"&&(d=!0),d&&h.type==="ObjectExpression"&&dZ(h,u)&&(f=!0)},leave(h){h.type==="CallExpression"&&h.callee.name==="fillet"&&(d=!1)}}),f)return!1}}return!0};function fZ({selectionRanges:t}){const e=t.codeBasedSelections.map(({range:A})=>un(be.ast,A)),n=e.map(A=>{const p=Xe(be.ast,A);return ie(p)?p:p.node}),r=n.find(ie);if(ie(r))return r;const i=n,s=e.map(A=>{const p=Xe(be.ast,A,"VariableDeclarator");return ie(p)?p:p.node}),o=s.find(ie);if(ie(o))return o;const a=s,l=a[0],c=a.slice(1),u=c.every(A=>Mg(A,l,be.ast)),d=i.every(A=>(A==null?void 0:A.type)==="CallExpression"&&vo.includes(A.callee.name)),f=Sf({...t,codeBasedSelections:t.codeBasedSelections.slice(1)},be.ast,"equalAngle");return ie(f)?f:{enabled:!!c.length&&d&&u&&f.every(Boolean),transforms:f}}function _ke({selectionRanges:t}){const e=fZ({selectionRanges:t});if(ie(e))return e;const{transforms:n}=e,r=iu({ast:be.ast,selectionRanges:t,transformInfos:n,programMemory:be.programMemory});if(ie(r))return r;const{modifiedAst:i,pathToNodeMap:s}=r;return{modifiedAst:i,pathToNodeMap:s}}function hZ({selectionRanges:t,pathToNodes:e}){const r=(e||t.codeBasedSelections.map(({range:u})=>un(be.ast,u))).map(u=>{const d=Xe(be.ast,u);return ie(d)?d:d.node}),i=r.find(ie);if(ie(i))return i;const s=r,o=e?{otherSelections:[],codeBasedSelections:s.map(u=>({range:[u.start,u.end],type:"default"}))}:t,a=s.every(u=>(u==null?void 0:u.type)==="CallExpression"&&vo.includes(u.callee.name)),l=fwe(o,be.ast);return ie(l)?l:{enabled:a&&l.every(Boolean),transforms:l,updatedSelectionRanges:o}}function Ske({selectionRanges:t,pathToNodes:e}){const n=hZ({selectionRanges:t,pathToNodes:e});if(ie(n))return n;const{transforms:r,updatedSelectionRanges:i}=n;return su({ast:be.ast,selectionRanges:i,transformInfos:r,programMemory:be.programMemory,referenceSegName:""})}const Eke=k6(R6);function AZ({selectionRanges:t}){var g,y,w,v,x,C;if(t.codeBasedSelections.length<2)return{enabled:!1,transforms:[],forcedSelectionRanges:{...t}};const e=t.codeBasedSelections.length>1&&kwe(be.ast,be.programMemory,t.codeBasedSelections[0],t.codeBasedSelections[1]);if(ie(e))return e;const n=((y=(g=t.codeBasedSelections)==null?void 0:g[1])==null?void 0:y.type)!=="line-end"&&e&&e.isParallelAndConstrained,r={...t,codeBasedSelections:[(w=t.codeBasedSelections)==null?void 0:w[0],n?{range:e.sourceRange,type:"line-end"}:(v=t.codeBasedSelections)==null?void 0:v[1]]},i=r.codeBasedSelections.map(({range:_})=>un(be.ast,_)),s=i.map(_=>{const S=Xe(be.ast,_);return ie(S)?S:S.node}),o=s.find(ie);if(ie(o))return o;const a=s,l=i.map(_=>{const S=Xe(be.ast,_,"VariableDeclarator");return ie(S)?S:S.node}),c=l.find(ie);if(ie(c))return c;const u=l,d=u[0],f=u.slice(1),h=f.every(_=>Mg(_,d,be.ast)),A=a.every(_=>(_==null?void 0:_.type)==="CallExpression"&&[...vo,"startSketchAt"].includes(_.callee.name)),p=Sf({...t,codeBasedSelections:r.codeBasedSelections.slice(1)},be.ast,"intersect");return{enabled:f.length===1&&A&&h&&p.every(Boolean)&&((C=(x=r==null?void 0:r.codeBasedSelections)==null?void 0:x[1])==null?void 0:C.type)==="line-end",transforms:p,forcedSelectionRanges:r}}async function Tke({selectionRanges:t}){const e=AZ({selectionRanges:t});if(ie(e))return Promise.reject(e);const{transforms:n,forcedSelectionRanges:r}=e,i=iu({ast:structuredClone(be.ast),selectionRanges:r,transformInfos:n,programMemory:be.programMemory});if(ie(i))return Promise.reject(i);const{modifiedAst:s,tagInfo:o,valueUsedInTransform:a,pathToNodeMap:l}=i,{segName:c,value:u,valueNode:d,variableName:f,newVariableInsertIndex:h,sign:A}=await Eke({segName:o==null?void 0:o.tag,isSegNameEditable:!(o!=null&&o.isTagExisting),value:a,initialVariableName:"offset"});if(!f&&c===(o==null?void 0:o.tag)&&Number(u)===a)return{modifiedAst:s,pathToNodeMap:l};if(!Ga(d))return Promise.reject("Invalid valueNode, is not a BinaryPart");const p=Tv(d,A,f),m=iu({ast:be.ast,selectionRanges:r,transformInfos:n,programMemory:be.programMemory,forceSegName:c,forceValueUsedInTransform:p});if(ie(m))return Promise.reject(m);const{modifiedAst:g,pathToNodeMap:y}=m;if(f){const w=[...g.body];w.splice(h,0,Ta(f,d)),g.body=w,Object.values(y).forEach(v=>{const x=v.findIndex(C=>C[0]==="body")+1;v[x][0]=Number(v[x][0])+1})}return{modifiedAst:g,pathToNodeMap:y}}const Bke=aZ(lZ);function Op({selectionRanges:t,constraint:e}){const n=e==="xAbs"||e==="yAbs"?e:e==="snapToYAxis"?"xAbs":"yAbs",i=t.codeBasedSelections.map(({range:f})=>un(be.ast,f)).map(f=>{const h=Xe(be.ast,f,"CallExpression");return ie(h)?h:h.node}),s=i.find(ie);if(ie(s))return s;const a=i.every(f=>(f==null?void 0:f.type)==="CallExpression"&&vo.includes(f.callee.name)),l=Sf(t,be.ast,n);if(ie(l))return l;const c=n==="yAbs"&&t.otherSelections.length===1&&t.otherSelections[0]==="x-axis",u=n==="xAbs"&&t.otherSelections.length===1&&t.otherSelections[0]==="y-axis";return{enabled:a&&l.every(Boolean)&&t.codeBasedSelections.length===1&&(u||c),transforms:l}}async function TH({selectionRanges:t,constraint:e}){const n=Op({selectionRanges:t,constraint:e});if(ie(n))return Promise.reject(n);const r=n.transforms,i=su({ast:structuredClone(be.ast),selectionRanges:t,transformInfos:r,programMemory:be.programMemory,referenceSegName:""});if(ie(i))return Promise.reject(i);const{valueUsedInTransform:s}=i;let o=s||0;const{valueNode:a,variableName:l,newVariableInsertIndex:c,sign:u}=await Bke({value:o,valueName:e==="yAbs"?"yDis":"xDis"});if(!Ga(a))return Promise.reject("Invalid valueNode, is not a BinaryPart");let d=Tv(a,u,l);const f=su({ast:structuredClone(be.ast),selectionRanges:t,transformInfos:r,programMemory:be.programMemory,referenceSegName:"",forceValueUsedInTransform:d});if(ie(f))return Promise.reject(f);const{modifiedAst:h,pathToNodeMap:A}=f;if(l){const p=[...h.body];p.splice(c,0,Ta(l,a)),h.body=p,Object.values(A).forEach(m=>{const g=m.findIndex(y=>y[0]==="body")+1;m[g][0]=Number(m[g][0])+1})}return{modifiedAst:h,pathToNodeMap:A}}function BH({selectionRanges:t,constraint:e}){const n=Op({selectionRanges:t,constraint:e});if(ie(n))return n;const r=n.transforms;let i=zn("ZERO");return su({ast:structuredClone(be.ast),selectionRanges:t,transformInfos:r,programMemory:be.programMemory,referenceSegName:"",forceValueUsedInTransform:i})}const Mke={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]},kke={prefix:"fas",iconName:"arrows-rotate",icon:[512,512,[128472,"refresh","sync"],"f021","M105.1 202.6c7.7-21.8 20.2-42.3 37.8-59.8c62.5-62.5 163.8-62.5 226.3 0L386.3 160 352 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l111.5 0c0 0 0 0 0 0l.4 0c17.7 0 32-14.3 32-32l0-112c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 35.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0C73.2 122 55.6 150.7 44.8 181.4c-5.9 16.7 2.9 34.9 19.5 40.8s34.9-2.9 40.8-19.5zM39 289.3c-5 1.5-9.8 4.2-13.7 8.2c-4 4-6.7 8.8-8.1 14c-.3 1.2-.6 2.5-.8 3.8c-.3 1.7-.4 3.4-.4 5.1L16 432c0 17.7 14.3 32 32 32s32-14.3 32-32l0-35.1 17.6 17.5c0 0 0 0 0 0c87.5 87.4 229.3 87.4 316.7 0c24.4-24.4 42.1-53.1 52.9-83.8c5.9-16.7-2.9-34.9-19.5-40.8s-34.9 2.9-40.8 19.5c-7.7 21.8-20.2 42.3-37.8 59.8c-62.5 62.5-163.8 62.5-226.3 0l-.1-.1L125.6 352l34.4 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L48.4 288c-1.6 0-3.2 .1-4.8 .3s-3.1 .5-4.6 1z"]},Rke=kke,MH={prefix:"fas",iconName:"arrow-up-right-from-square",icon:[512,512,["external-link"],"f08e","M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l82.7 0L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3l0 82.7c0 17.7 14.3 32 32 32s32-14.3 32-32l0-160c0-17.7-14.3-32-32-32L320 0zM80 32C35.8 32 0 67.8 0 112L0 432c0 44.2 35.8 80 80 80l320 0c44.2 0 80-35.8 80-80l0-112c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 112c0 8.8-7.2 16-16 16L80 448c-8.8 0-16-7.2-16-16l0-320c0-8.8 7.2-16 16-16l112 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 32z"]},Pke={prefix:"fas",iconName:"trash",icon:[448,512,[],"f1f8","M135.2 17.7L128 32 32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0-7.2-14.3C307.4 6.8 296.3 0 284.2 0L163.8 0c-12.1 0-23.2 6.8-28.6 17.7zM416 128L32 128 53.2 467c1.6 25.3 22.6 45 47.9 45l245.8 0c25.3 0 46.3-19.7 47.9-45L416 128z"]},Lke={prefix:"fas",iconName:"house",icon:[576,512,[127968,63498,63500,"home","home-alt","home-lg-alt"],"f015","M575.8 255.5c0 18-15 32.1-32 32.1l-32 0 .7 160.2c0 2.7-.2 5.4-.5 8.1l0 16.2c0 22.1-17.9 40-40 40l-16 0c-1.1 0-2.2 0-3.3-.1c-1.4 .1-2.8 .1-4.2 .1L416 512l-24 0c-22.1 0-40-17.9-40-40l0-24 0-64c0-17.7-14.3-32-32-32l-64 0c-17.7 0-32 14.3-32 32l0 64 0 24c0 22.1-17.9 40-40 40l-24 0-31.9 0c-1.5 0-3-.1-4.5-.2c-1.2 .1-2.4 .2-3.6 .2l-16 0c-22.1 0-40-17.9-40-40l0-112c0-.9 0-1.9 .1-2.8l0-69.7-32 0c-18 0-32-14-32-32.1c0-9 3-17 10-24L266.4 8c7-7 15-8 22-8s15 2 21 7L564.8 231.5c8 7 12 15 11 24z"]},Ike=Lke,Oke={prefix:"fas",iconName:"bug",icon:[512,512,[],"f188","M256 0c53 0 96 43 96 96l0 3.6c0 15.7-12.7 28.4-28.4 28.4l-135.1 0c-15.7 0-28.4-12.7-28.4-28.4l0-3.6c0-53 43-96 96-96zM41.4 105.4c12.5-12.5 32.8-12.5 45.3 0l64 64c.7 .7 1.3 1.4 1.9 2.1c14.2-7.3 30.4-11.4 47.5-11.4l112 0c17.1 0 33.2 4.1 47.5 11.4c.6-.7 1.2-1.4 1.9-2.1l64-64c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3l-64 64c-.7 .7-1.4 1.3-2.1 1.9c6.2 12 10.1 25.3 11.1 39.5l64.3 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-64 0c0 24.6-5.5 47.8-15.4 68.6c2.2 1.3 4.2 2.9 6 4.8l64 64c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0l-63.1-63.1c-24.5 21.8-55.8 36.2-90.3 39.6L272 240c0-8.8-7.2-16-16-16s-16 7.2-16 16l0 239.2c-34.5-3.4-65.8-17.8-90.3-39.6L86.6 502.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l64-64c1.9-1.9 3.9-3.4 6-4.8C101.5 367.8 96 344.6 96 320l-64 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l64.3 0c1.1-14.1 5-27.5 11.1-39.5c-.7-.6-1.4-1.2-2.1-1.9l-64-64c-12.5-12.5-12.5-32.8 0-45.3z"]},kH={prefix:"fas",iconName:"chevron-right",icon:[320,512,[9002],"f054","M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"]},Fke={prefix:"fas",iconName:"bug-slash",icon:[640,512,[],"e490","M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L477.4 348.9c1.7-9.4 2.6-19 2.6-28.9l64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64.3 0c-1.1-14.1-5-27.5-11.1-39.5c.7-.6 1.4-1.2 2.1-1.9l64-64c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-64 64c-.7 .7-1.3 1.4-1.9 2.1C409.2 164.1 393.1 160 376 160l-112 0c-8.3 0-16.3 1-24 2.8L38.8 5.1zM320 0c-53 0-96 43-96 96l0 3.6c0 15.7 12.7 28.4 28.4 28.4l135.1 0c15.7 0 28.4-12.7 28.4-28.4l0-3.6c0-53-43-96-96-96zM160.3 256L96 256c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0c0 24.6 5.5 47.8 15.4 68.6c-2.2 1.3-4.2 2.9-6 4.8l-64 64c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l63.1-63.1c24.5 21.8 55.8 36.2 90.3 39.6l0-143.7L166.7 227.3c-3.4 9-5.6 18.7-6.4 28.7zM336 479.2c36.6-3.6 69.7-19.6 94.8-43.8L336 360.7l0 118.5z"]},RH=()=>{};let L6={},pZ={},mZ=null,gZ={mark:RH,measure:RH};try{typeof window<"u"&&(L6=window),typeof document<"u"&&(pZ=document),typeof MutationObserver<"u"&&(mZ=MutationObserver),typeof performance<"u"&&(gZ=performance)}catch{}const{userAgent:PH=""}=L6.navigator||{},pf=L6,yr=pZ,LH=mZ,Aw=gZ;pf.document;const vu=!!yr.documentElement&&!!yr.head&&typeof yr.addEventListener=="function"&&typeof yr.createElement=="function",yZ=~PH.indexOf("MSIE")||~PH.indexOf("Trident/");var Er="classic",vZ="duotone",Qo="sharp",zo="sharp-duotone",Nke=[Er,vZ,Qo,zo],Dke={classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds"}},IH={kit:{fak:"kit","fa-kit":"kit"},"kit-duotone":{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"}},Uke=["kit"],Hke=/fa(s|r|l|t|d|b|k|kd|ss|sr|sl|st|sds)?[\-\ ]/,jke=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i,Qke={"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}},zke={"Font Awesome 6 Free":{900:"fas",400:"far"},"Font Awesome 6 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 6 Brands":{400:"fab",normal:"fab"},"Font Awesome 6 Duotone":{900:"fad"},"Font Awesome 6 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 6 Sharp Duotone":{900:"fasds"}},Vke={classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds"}},Gke={classic:["fas","far","fal","fat"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds"]},Wke={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid"}},Kke={classic:{solid:"fas",regular:"far",light:"fal",thin:"fat",duotone:"fad",brands:"fab"},sharp:{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"},"sharp-duotone":{solid:"fasds"}},bZ={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fad:"duotone","fa-duotone":"duotone",fab:"brands","fa-brands":"brands"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid"}},$ke=["solid","regular","light","thin","duotone","brands"],wZ=[1,2,3,4,5,6,7,8,9,10],qke=wZ.concat([11,12,13,14,15,16,17,18,19,20]),Q0={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},Xke=[...Object.keys(Gke),...$ke,"2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",Q0.GROUP,Q0.SWAP_OPACITY,Q0.PRIMARY,Q0.SECONDARY].concat(wZ.map(t=>"".concat(t,"x"))).concat(qke.map(t=>"w-".concat(t))),Yke={"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},Jke={kit:{"fa-kit":"fak"},"kit-duotone":{"fa-kit-duotone":"fakd"}},Zke={kit:{fak:"fa-kit"},"kit-duotone":{fakd:"fa-kit-duotone"}},OH={kit:{kit:"fak"},"kit-duotone":{"kit-duotone":"fakd"}};const cu="___FONT_AWESOME___",D5=16,xZ="fa",CZ="svg-inline--fa",Yh="data-fa-i2svg",U5="data-fa-pseudo-element",e4e="data-fa-pseudo-element-pending",I6="data-prefix",O6="data-icon",FH="fontawesome-i2svg",t4e="async",n4e=["HTML","HEAD","STYLE","SCRIPT"],_Z=(()=>{try{return!0}catch{return!1}})(),SZ=[Er,Qo,zo];function Bv(t){return new Proxy(t,{get(e,n){return n in e?e[n]:e[Er]}})}const EZ={...bZ};EZ[Er]={...bZ[Er],...IH.kit,...IH["kit-duotone"]};const Eh=Bv(EZ),H5={...Kke};H5[Er]={...H5[Er],...OH.kit,...OH["kit-duotone"]};const Uy=Bv(H5),j5={...Wke};j5[Er]={...j5[Er],...Zke.kit};const Th=Bv(j5),Q5={...Vke};Q5[Er]={...Q5[Er],...Jke.kit};const r4e=Bv(Q5),i4e=Hke,TZ="fa-layers-text",s4e=jke,o4e={...Dke};Bv(o4e);const a4e=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],oB=Q0,hg=new Set;Object.keys(Uy[Er]).map(hg.add.bind(hg));Object.keys(Uy[Qo]).map(hg.add.bind(hg));Object.keys(Uy[zo]).map(hg.add.bind(hg));const l4e=[...Uke,...Xke],S1=pf.FontAwesomeConfig||{};function c4e(t){var e=yr.querySelector("script["+t+"]");if(e)return e.getAttribute(t)}function u4e(t){return t===""?!0:t==="false"?!1:t==="true"?!0:t}yr&&typeof yr.querySelector=="function"&&[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(e=>{let[n,r]=e;const i=u4e(c4e(n));i!=null&&(S1[r]=i)});const BZ={styleDefault:"solid",familyDefault:"classic",cssPrefix:xZ,replacementClass:CZ,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};S1.familyPrefix&&(S1.cssPrefix=S1.familyPrefix);const Ag={...BZ,...S1};Ag.autoReplaceSvg||(Ag.observeMutations=!1);const Tt={};Object.keys(BZ).forEach(t=>{Object.defineProperty(Tt,t,{enumerable:!0,set:function(e){Ag[t]=e,E1.forEach(n=>n(Tt))},get:function(){return Ag[t]}})});Object.defineProperty(Tt,"familyPrefix",{enumerable:!0,set:function(t){Ag.cssPrefix=t,E1.forEach(e=>e(Tt))},get:function(){return Ag.cssPrefix}});pf.FontAwesomeConfig=Tt;const E1=[];function d4e(t){return E1.push(t),()=>{E1.splice(E1.indexOf(t),1)}}const Ou=D5,Fl={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function f4e(t){if(!t||!vu)return;const e=yr.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=t;const n=yr.head.childNodes;let r=null;for(let i=n.length-1;i>-1;i--){const s=n[i],o=(s.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(o)>-1&&(r=s)}return yr.head.insertBefore(e,r),t}const h4e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function Hy(){let t=12,e="";for(;t-- >0;)e+=h4e[Math.random()*62|0];return e}function Og(t){const e=[];for(let n=(t||[]).length>>>0;n--;)e[n]=t[n];return e}function F6(t){return t.classList?Og(t.classList):(t.getAttribute("class")||"").split(" ").filter(e=>e)}function MZ(t){return"".concat(t).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A4e(t){return Object.keys(t||{}).reduce((e,n)=>e+"".concat(n,'="').concat(MZ(t[n]),'" '),"").trim()}function N2(t){return Object.keys(t||{}).reduce((e,n)=>e+"".concat(n,": ").concat(t[n].trim(),";"),"")}function N6(t){return t.size!==Fl.size||t.x!==Fl.x||t.y!==Fl.y||t.rotate!==Fl.rotate||t.flipX||t.flipY}function p4e(t){let{transform:e,containerWidth:n,iconWidth:r}=t;const i={transform:"translate(".concat(n/2," 256)")},s="translate(".concat(e.x*32,", ").concat(e.y*32,") "),o="scale(".concat(e.size/16*(e.flipX?-1:1),", ").concat(e.size/16*(e.flipY?-1:1),") "),a="rotate(".concat(e.rotate," 0 0)"),l={transform:"".concat(s," ").concat(o," ").concat(a)},c={transform:"translate(".concat(r/2*-1," -256)")};return{outer:i,inner:l,path:c}}function m4e(t){let{transform:e,width:n=D5,height:r=D5,startCentered:i=!1}=t,s="";return i&&yZ?s+="translate(".concat(e.x/Ou-n/2,"em, ").concat(e.y/Ou-r/2,"em) "):i?s+="translate(calc(-50% + ".concat(e.x/Ou,"em), calc(-50% + ").concat(e.y/Ou,"em)) "):s+="translate(".concat(e.x/Ou,"em, ").concat(e.y/Ou,"em) "),s+="scale(".concat(e.size/Ou*(e.flipX?-1:1),", ").concat(e.size/Ou*(e.flipY?-1:1),") "),s+="rotate(".concat(e.rotate,"deg) "),s}var g4e=`:root, :host {
  --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free";
  --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Free";
  --fa-font-light: normal 300 1em/1 "Font Awesome 6 Pro";
  --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Pro";
  --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone";
  --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands";
  --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp";
  --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp";
  --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp";
  --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 6 Sharp";
  --fa-font-sharp-duotone-solid: normal 900 1em/1 "Font Awesome 6 Sharp Duotone";
}

svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {
  overflow: visible;
  box-sizing: content-box;
}

.svg-inline--fa {
  display: var(--fa-display, inline-block);
  height: 1em;
  overflow: visible;
  vertical-align: -0.125em;
}
.svg-inline--fa.fa-2xs {
  vertical-align: 0.1em;
}
.svg-inline--fa.fa-xs {
  vertical-align: 0em;
}
.svg-inline--fa.fa-sm {
  vertical-align: -0.0714285705em;
}
.svg-inline--fa.fa-lg {
  vertical-align: -0.2em;
}
.svg-inline--fa.fa-xl {
  vertical-align: -0.25em;
}
.svg-inline--fa.fa-2xl {
  vertical-align: -0.3125em;
}
.svg-inline--fa.fa-pull-left {
  margin-right: var(--fa-pull-margin, 0.3em);
  width: auto;
}
.svg-inline--fa.fa-pull-right {
  margin-left: var(--fa-pull-margin, 0.3em);
  width: auto;
}
.svg-inline--fa.fa-li {
  width: var(--fa-li-width, 2em);
  top: 0.25em;
}
.svg-inline--fa.fa-fw {
  width: var(--fa-fw-width, 1.25em);
}

.fa-layers svg.svg-inline--fa {
  bottom: 0;
  left: 0;
  margin: auto;
  position: absolute;
  right: 0;
  top: 0;
}

.fa-layers-counter, .fa-layers-text {
  display: inline-block;
  position: absolute;
  text-align: center;
}

.fa-layers {
  display: inline-block;
  height: 1em;
  position: relative;
  text-align: center;
  vertical-align: -0.125em;
  width: 1em;
}
.fa-layers svg.svg-inline--fa {
  transform-origin: center center;
}

.fa-layers-text {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}

.fa-layers-counter {
  background-color: var(--fa-counter-background-color, #ff253a);
  border-radius: var(--fa-counter-border-radius, 1em);
  box-sizing: border-box;
  color: var(--fa-inverse, #fff);
  line-height: var(--fa-counter-line-height, 1);
  max-width: var(--fa-counter-max-width, 5em);
  min-width: var(--fa-counter-min-width, 1.5em);
  overflow: hidden;
  padding: var(--fa-counter-padding, 0.25em 0.5em);
  right: var(--fa-right, 0);
  text-overflow: ellipsis;
  top: var(--fa-top, 0);
  transform: scale(var(--fa-counter-scale, 0.25));
  transform-origin: top right;
}

.fa-layers-bottom-right {
  bottom: var(--fa-bottom, 0);
  right: var(--fa-right, 0);
  top: auto;
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: bottom right;
}

.fa-layers-bottom-left {
  bottom: var(--fa-bottom, 0);
  left: var(--fa-left, 0);
  right: auto;
  top: auto;
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: bottom left;
}

.fa-layers-top-right {
  top: var(--fa-top, 0);
  right: var(--fa-right, 0);
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: top right;
}

.fa-layers-top-left {
  left: var(--fa-left, 0);
  right: auto;
  top: var(--fa-top, 0);
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: top left;
}

.fa-1x {
  font-size: 1em;
}

.fa-2x {
  font-size: 2em;
}

.fa-3x {
  font-size: 3em;
}

.fa-4x {
  font-size: 4em;
}

.fa-5x {
  font-size: 5em;
}

.fa-6x {
  font-size: 6em;
}

.fa-7x {
  font-size: 7em;
}

.fa-8x {
  font-size: 8em;
}

.fa-9x {
  font-size: 9em;
}

.fa-10x {
  font-size: 10em;
}

.fa-2xs {
  font-size: 0.625em;
  line-height: 0.1em;
  vertical-align: 0.225em;
}

.fa-xs {
  font-size: 0.75em;
  line-height: 0.0833333337em;
  vertical-align: 0.125em;
}

.fa-sm {
  font-size: 0.875em;
  line-height: 0.0714285718em;
  vertical-align: 0.0535714295em;
}

.fa-lg {
  font-size: 1.25em;
  line-height: 0.05em;
  vertical-align: -0.075em;
}

.fa-xl {
  font-size: 1.5em;
  line-height: 0.0416666682em;
  vertical-align: -0.125em;
}

.fa-2xl {
  font-size: 2em;
  line-height: 0.03125em;
  vertical-align: -0.1875em;
}

.fa-fw {
  text-align: center;
  width: 1.25em;
}

.fa-ul {
  list-style-type: none;
  margin-left: var(--fa-li-margin, 2.5em);
  padding-left: 0;
}
.fa-ul > li {
  position: relative;
}

.fa-li {
  left: calc(-1 * var(--fa-li-width, 2em));
  position: absolute;
  text-align: center;
  width: var(--fa-li-width, 2em);
  line-height: inherit;
}

.fa-border {
  border-color: var(--fa-border-color, #eee);
  border-radius: var(--fa-border-radius, 0.1em);
  border-style: var(--fa-border-style, solid);
  border-width: var(--fa-border-width, 0.08em);
  padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);
}

.fa-pull-left {
  float: left;
  margin-right: var(--fa-pull-margin, 0.3em);
}

.fa-pull-right {
  float: right;
  margin-left: var(--fa-pull-margin, 0.3em);
}

.fa-beat {
  animation-name: fa-beat;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, ease-in-out);
}

.fa-bounce {
  animation-name: fa-bounce;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));
}

.fa-fade {
  animation-name: fa-fade;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
}

.fa-beat-fade {
  animation-name: fa-beat-fade;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
}

.fa-flip {
  animation-name: fa-flip;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, ease-in-out);
}

.fa-shake {
  animation-name: fa-shake;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, linear);
}

.fa-spin {
  animation-name: fa-spin;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 2s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, linear);
}

.fa-spin-reverse {
  --fa-animation-direction: reverse;
}

.fa-pulse,
.fa-spin-pulse {
  animation-name: fa-spin;
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, steps(8));
}

@media (prefers-reduced-motion: reduce) {
  .fa-beat,
.fa-bounce,
.fa-fade,
.fa-beat-fade,
.fa-flip,
.fa-pulse,
.fa-shake,
.fa-spin,
.fa-spin-pulse {
    animation-delay: -1ms;
    animation-duration: 1ms;
    animation-iteration-count: 1;
    transition-delay: 0s;
    transition-duration: 0s;
  }
}
@keyframes fa-beat {
  0%, 90% {
    transform: scale(1);
  }
  45% {
    transform: scale(var(--fa-beat-scale, 1.25));
  }
}
@keyframes fa-bounce {
  0% {
    transform: scale(1, 1) translateY(0);
  }
  10% {
    transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
  }
  30% {
    transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
  }
  50% {
    transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
  }
  57% {
    transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
  }
  64% {
    transform: scale(1, 1) translateY(0);
  }
  100% {
    transform: scale(1, 1) translateY(0);
  }
}
@keyframes fa-fade {
  50% {
    opacity: var(--fa-fade-opacity, 0.4);
  }
}
@keyframes fa-beat-fade {
  0%, 100% {
    opacity: var(--fa-beat-fade-opacity, 0.4);
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(var(--fa-beat-fade-scale, 1.125));
  }
}
@keyframes fa-flip {
  50% {
    transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
  }
}
@keyframes fa-shake {
  0% {
    transform: rotate(-15deg);
  }
  4% {
    transform: rotate(15deg);
  }
  8%, 24% {
    transform: rotate(-18deg);
  }
  12%, 28% {
    transform: rotate(18deg);
  }
  16% {
    transform: rotate(-22deg);
  }
  20% {
    transform: rotate(22deg);
  }
  32% {
    transform: rotate(-12deg);
  }
  36% {
    transform: rotate(12deg);
  }
  40%, 100% {
    transform: rotate(0deg);
  }
}
@keyframes fa-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.fa-rotate-90 {
  transform: rotate(90deg);
}

.fa-rotate-180 {
  transform: rotate(180deg);
}

.fa-rotate-270 {
  transform: rotate(270deg);
}

.fa-flip-horizontal {
  transform: scale(-1, 1);
}

.fa-flip-vertical {
  transform: scale(1, -1);
}

.fa-flip-both,
.fa-flip-horizontal.fa-flip-vertical {
  transform: scale(-1, -1);
}

.fa-rotate-by {
  transform: rotate(var(--fa-rotate-angle, 0));
}

.fa-stack {
  display: inline-block;
  vertical-align: middle;
  height: 2em;
  position: relative;
  width: 2.5em;
}

.fa-stack-1x,
.fa-stack-2x {
  bottom: 0;
  left: 0;
  margin: auto;
  position: absolute;
  right: 0;
  top: 0;
  z-index: var(--fa-stack-z-index, auto);
}

.svg-inline--fa.fa-stack-1x {
  height: 1em;
  width: 1.25em;
}
.svg-inline--fa.fa-stack-2x {
  height: 2em;
  width: 2.5em;
}

.fa-inverse {
  color: var(--fa-inverse, #fff);
}

.sr-only,
.fa-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only-focusable:not(:focus),
.fa-sr-only-focusable:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.svg-inline--fa .fa-primary {
  fill: var(--fa-primary-color, currentColor);
  opacity: var(--fa-primary-opacity, 1);
}

.svg-inline--fa .fa-secondary {
  fill: var(--fa-secondary-color, currentColor);
  opacity: var(--fa-secondary-opacity, 0.4);
}

.svg-inline--fa.fa-swap-opacity .fa-primary {
  opacity: var(--fa-secondary-opacity, 0.4);
}

.svg-inline--fa.fa-swap-opacity .fa-secondary {
  opacity: var(--fa-primary-opacity, 1);
}

.svg-inline--fa mask .fa-primary,
.svg-inline--fa mask .fa-secondary {
  fill: black;
}

.fad.fa-inverse,
.fa-duotone.fa-inverse {
  color: var(--fa-inverse, #fff);
}`;function kZ(){const t=xZ,e=CZ,n=Tt.cssPrefix,r=Tt.replacementClass;let i=g4e;if(n!==t||r!==e){const s=new RegExp("\\.".concat(t,"\\-"),"g"),o=new RegExp("\\--".concat(t,"\\-"),"g"),a=new RegExp("\\.".concat(e),"g");i=i.replace(s,".".concat(n,"-")).replace(o,"--".concat(n,"-")).replace(a,".".concat(r))}return i}let NH=!1;function aB(){Tt.autoAddCss&&!NH&&(f4e(kZ()),NH=!0)}var y4e={mixout(){return{dom:{css:kZ,insertCss:aB}}},hooks(){return{beforeDOMElementCreation(){aB()},beforeI2svg(){aB()}}}};const uu=pf||{};uu[cu]||(uu[cu]={});uu[cu].styles||(uu[cu].styles={});uu[cu].hooks||(uu[cu].hooks={});uu[cu].shims||(uu[cu].shims=[]);var Nl=uu[cu];const RZ=[],PZ=function(){yr.removeEventListener("DOMContentLoaded",PZ),Q_=1,RZ.map(t=>t())};let Q_=!1;vu&&(Q_=(yr.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(yr.readyState),Q_||yr.addEventListener("DOMContentLoaded",PZ));function v4e(t){vu&&(Q_?setTimeout(t,0):RZ.push(t))}function Mv(t){const{tag:e,attributes:n={},children:r=[]}=t;return typeof t=="string"?MZ(t):"<".concat(e," ").concat(A4e(n),">").concat(r.map(Mv).join(""),"</").concat(e,">")}function DH(t,e,n){if(t&&t[e]&&t[e][n])return{prefix:e,iconName:n,icon:t[e][n]}}var lB=function(e,n,r,i){var s=Object.keys(e),o=s.length,a=n,l,c,u;for(r===void 0?(l=1,u=e[s[0]]):(l=0,u=r);l<o;l++)c=s[l],u=a(u,e[c],c,e);return u};function b4e(t){const e=[];let n=0;const r=t.length;for(;n<r;){const i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){const s=t.charCodeAt(n++);(s&64512)==56320?e.push(((i&1023)<<10)+(s&1023)+65536):(e.push(i),n--)}else e.push(i)}return e}function z5(t){const e=b4e(t);return e.length===1?e[0].toString(16):null}function w4e(t,e){const n=t.length;let r=t.charCodeAt(e),i;return r>=55296&&r<=56319&&n>e+1&&(i=t.charCodeAt(e+1),i>=56320&&i<=57343)?(r-55296)*1024+i-56320+65536:r}function UH(t){return Object.keys(t).reduce((e,n)=>{const r=t[n];return!!r.icon?e[r.iconName]=r.icon:e[n]=r,e},{})}function V5(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{skipHooks:r=!1}=n,i=UH(e);typeof Nl.hooks.addPack=="function"&&!r?Nl.hooks.addPack(t,UH(e)):Nl.styles[t]={...Nl.styles[t]||{},...i},t==="fas"&&V5("fa",e)}const{styles:oh,shims:x4e}=Nl,C4e={[Er]:Object.values(Th[Er]),[Qo]:Object.values(Th[Qo]),[zo]:Object.values(Th[zo])};let D6=null,LZ={},IZ={},OZ={},FZ={},NZ={};const _4e={[Er]:Object.keys(Eh[Er]),[Qo]:Object.keys(Eh[Qo]),[zo]:Object.keys(Eh[zo])};function S4e(t){return~l4e.indexOf(t)}function E4e(t,e){const n=e.split("-"),r=n[0],i=n.slice(1).join("-");return r===t&&i!==""&&!S4e(i)?i:null}const DZ=()=>{const t=r=>lB(oh,(i,s,o)=>(i[o]=lB(s,r,{}),i),{});LZ=t((r,i,s)=>(i[3]&&(r[i[3]]=s),i[2]&&i[2].filter(a=>typeof a=="number").forEach(a=>{r[a.toString(16)]=s}),r)),IZ=t((r,i,s)=>(r[s]=s,i[2]&&i[2].filter(a=>typeof a=="string").forEach(a=>{r[a]=s}),r)),NZ=t((r,i,s)=>{const o=i[2];return r[s]=s,o.forEach(a=>{r[a]=s}),r});const e="far"in oh||Tt.autoFetchSvg,n=lB(x4e,(r,i)=>{const s=i[0];let o=i[1];const a=i[2];return o==="far"&&!e&&(o="fas"),typeof s=="string"&&(r.names[s]={prefix:o,iconName:a}),typeof s=="number"&&(r.unicodes[s.toString(16)]={prefix:o,iconName:a}),r},{names:{},unicodes:{}});OZ=n.names,FZ=n.unicodes,D6=D2(Tt.styleDefault,{family:Tt.familyDefault})};d4e(t=>{D6=D2(t.styleDefault,{family:Tt.familyDefault})});DZ();function U6(t,e){return(LZ[t]||{})[e]}function T4e(t,e){return(IZ[t]||{})[e]}function yd(t,e){return(NZ[t]||{})[e]}function UZ(t){return OZ[t]||{prefix:null,iconName:null}}function B4e(t){const e=FZ[t],n=U6("fas",t);return e||(n?{prefix:"fas",iconName:n}:null)||{prefix:null,iconName:null}}function mf(){return D6}const H6=()=>({prefix:null,iconName:null,rest:[]});function D2(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{family:n=Er}=e,r=Eh[n][t],i=Uy[n][t]||Uy[n][r],s=t in Nl.styles?t:null;return i||s||null}const M4e={[Er]:Object.keys(Th[Er]),[Qo]:Object.keys(Th[Qo]),[zo]:Object.keys(Th[zo])};function U2(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{skipLookups:n=!1}=e,r={[Er]:"".concat(Tt.cssPrefix,"-").concat(Er),[Qo]:"".concat(Tt.cssPrefix,"-").concat(Qo),[zo]:"".concat(Tt.cssPrefix,"-").concat(zo)};let i=null,s=Er;const o=Nke.filter(l=>l!==vZ);o.forEach(l=>{(t.includes(r[l])||t.some(c=>M4e[l].includes(c)))&&(s=l)});const a=t.reduce((l,c)=>{const u=E4e(Tt.cssPrefix,c);if(oh[c]?(c=C4e[s].includes(c)?r4e[s][c]:c,i=c,l.prefix=c):_4e[s].indexOf(c)>-1?(i=c,l.prefix=D2(c,{family:s})):u?l.iconName=u:c!==Tt.replacementClass&&!o.some(d=>c===r[d])&&l.rest.push(c),!n&&l.prefix&&l.iconName){const d=i==="fa"?UZ(l.iconName):{},f=yd(l.prefix,l.iconName);d.prefix&&(i=null),l.iconName=d.iconName||f||l.iconName,l.prefix=d.prefix||l.prefix,l.prefix==="far"&&!oh.far&&oh.fas&&!Tt.autoFetchSvg&&(l.prefix="fas")}return l},H6());return(t.includes("fa-brands")||t.includes("fab"))&&(a.prefix="fab"),(t.includes("fa-duotone")||t.includes("fad"))&&(a.prefix="fad"),!a.prefix&&s===Qo&&(oh.fass||Tt.autoFetchSvg)&&(a.prefix="fass",a.iconName=yd(a.prefix,a.iconName)||a.iconName),!a.prefix&&s===zo&&(oh.fasds||Tt.autoFetchSvg)&&(a.prefix="fasds",a.iconName=yd(a.prefix,a.iconName)||a.iconName),(a.prefix==="fa"||i==="fa")&&(a.prefix=mf()||"fas"),a}class k4e{constructor(){this.definitions={}}add(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const i=n.reduce(this._pullDefinitions,{});Object.keys(i).forEach(s=>{this.definitions[s]={...this.definitions[s]||{},...i[s]},V5(s,i[s]);const o=Th[Er][s];o&&V5(o,i[s]),DZ()})}reset(){this.definitions={}}_pullDefinitions(e,n){const r=n.prefix&&n.iconName&&n.icon?{0:n}:n;return Object.keys(r).map(i=>{const{prefix:s,iconName:o,icon:a}=r[i],l=a[2];e[s]||(e[s]={}),l.length>0&&l.forEach(c=>{typeof c=="string"&&(e[s][c]=a)}),e[s][o]=a}),e}}let HH=[],Fp={};const sm={},R4e=Object.keys(sm);function P4e(t,e){let{mixoutsTo:n}=e;return HH=t,Fp={},Object.keys(sm).forEach(r=>{R4e.indexOf(r)===-1&&delete sm[r]}),HH.forEach(r=>{const i=r.mixout?r.mixout():{};if(Object.keys(i).forEach(s=>{typeof i[s]=="function"&&(n[s]=i[s]),typeof i[s]=="object"&&Object.keys(i[s]).forEach(o=>{n[s]||(n[s]={}),n[s][o]=i[s][o]})}),r.hooks){const s=r.hooks();Object.keys(s).forEach(o=>{Fp[o]||(Fp[o]=[]),Fp[o].push(s[o])})}r.provides&&r.provides(sm)}),n}function G5(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return(Fp[t]||[]).forEach(o=>{e=o.apply(null,[e,...r])}),e}function Jh(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];(Fp[t]||[]).forEach(s=>{s.apply(null,n)})}function gf(){const t=arguments[0],e=Array.prototype.slice.call(arguments,1);return sm[t]?sm[t].apply(null,e):void 0}function W5(t){t.prefix==="fa"&&(t.prefix="fas");let{iconName:e}=t;const n=t.prefix||mf();if(e)return e=yd(n,e)||e,DH(HZ.definitions,n,e)||DH(Nl.styles,n,e)}const HZ=new k4e,L4e=()=>{Tt.autoReplaceSvg=!1,Tt.observeMutations=!1,Jh("noAuto")},I4e={i2svg:function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return vu?(Jh("beforeI2svg",t),gf("pseudoElements2svg",t),gf("i2svg",t)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{autoReplaceSvgRoot:e}=t;Tt.autoReplaceSvg===!1&&(Tt.autoReplaceSvg=!0),Tt.observeMutations=!0,v4e(()=>{F4e({autoReplaceSvgRoot:e}),Jh("watch",t)})}},O4e={icon:t=>{if(t===null)return null;if(typeof t=="object"&&t.prefix&&t.iconName)return{prefix:t.prefix,iconName:yd(t.prefix,t.iconName)||t.iconName};if(Array.isArray(t)&&t.length===2){const e=t[1].indexOf("fa-")===0?t[1].slice(3):t[1],n=D2(t[0]);return{prefix:n,iconName:yd(n,e)||e}}if(typeof t=="string"&&(t.indexOf("".concat(Tt.cssPrefix,"-"))>-1||t.match(i4e))){const e=U2(t.split(" "),{skipLookups:!0});return{prefix:e.prefix||mf(),iconName:yd(e.prefix,e.iconName)||e.iconName}}if(typeof t=="string"){const e=mf();return{prefix:e,iconName:yd(e,t)||t}}}},$o={noAuto:L4e,config:Tt,dom:I4e,parse:O4e,library:HZ,findIconDefinition:W5,toHtml:Mv},F4e=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{autoReplaceSvgRoot:e=yr}=t;(Object.keys(Nl.styles).length>0||Tt.autoFetchSvg)&&vu&&Tt.autoReplaceSvg&&$o.dom.i2svg({node:e})};function H2(t,e){return Object.defineProperty(t,"abstract",{get:e}),Object.defineProperty(t,"html",{get:function(){return t.abstract.map(n=>Mv(n))}}),Object.defineProperty(t,"node",{get:function(){if(!vu)return;const n=yr.createElement("div");return n.innerHTML=t.html,n.children}}),t}function N4e(t){let{children:e,main:n,mask:r,attributes:i,styles:s,transform:o}=t;if(N6(o)&&n.found&&!r.found){const{width:a,height:l}=n,c={x:a/l/2,y:.5};i.style=N2({...s,"transform-origin":"".concat(c.x+o.x/16,"em ").concat(c.y+o.y/16,"em")})}return[{tag:"svg",attributes:i,children:e}]}function D4e(t){let{prefix:e,iconName:n,children:r,attributes:i,symbol:s}=t;const o=s===!0?"".concat(e,"-").concat(Tt.cssPrefix,"-").concat(n):s;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:{...i,id:o},children:r}]}]}function j6(t){const{icons:{main:e,mask:n},prefix:r,iconName:i,transform:s,symbol:o,title:a,maskId:l,titleId:c,extra:u,watchable:d=!1}=t,{width:f,height:h}=n.found?n:e,A=r==="fak",p=[Tt.replacementClass,i?"".concat(Tt.cssPrefix,"-").concat(i):""].filter(x=>u.classes.indexOf(x)===-1).filter(x=>x!==""||!!x).concat(u.classes).join(" ");let m={children:[],attributes:{...u.attributes,"data-prefix":r,"data-icon":i,class:p,role:u.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(f," ").concat(h)}};const g=A&&!~u.classes.indexOf("fa-fw")?{width:"".concat(f/h*16*.0625,"em")}:{};d&&(m.attributes[Yh]=""),a&&(m.children.push({tag:"title",attributes:{id:m.attributes["aria-labelledby"]||"title-".concat(c||Hy())},children:[a]}),delete m.attributes.title);const y={...m,prefix:r,iconName:i,main:e,mask:n,maskId:l,transform:s,symbol:o,styles:{...g,...u.styles}},{children:w,attributes:v}=n.found&&e.found?gf("generateAbstractMask",y)||{children:[],attributes:{}}:gf("generateAbstractIcon",y)||{children:[],attributes:{}};return y.children=w,y.attributes=v,o?D4e(y):N4e(y)}function jH(t){const{content:e,width:n,height:r,transform:i,title:s,extra:o,watchable:a=!1}=t,l={...o.attributes,...s?{title:s}:{},class:o.classes.join(" ")};a&&(l[Yh]="");const c={...o.styles};N6(i)&&(c.transform=m4e({transform:i,startCentered:!0,width:n,height:r}),c["-webkit-transform"]=c.transform);const u=N2(c);u.length>0&&(l.style=u);const d=[];return d.push({tag:"span",attributes:l,children:[e]}),s&&d.push({tag:"span",attributes:{class:"sr-only"},children:[s]}),d}function U4e(t){const{content:e,title:n,extra:r}=t,i={...r.attributes,...n?{title:n}:{},class:r.classes.join(" ")},s=N2(r.styles);s.length>0&&(i.style=s);const o=[];return o.push({tag:"span",attributes:i,children:[e]}),n&&o.push({tag:"span",attributes:{class:"sr-only"},children:[n]}),o}const{styles:cB}=Nl;function K5(t){const e=t[0],n=t[1],[r]=t.slice(4);let i=null;return Array.isArray(r)?i={tag:"g",attributes:{class:"".concat(Tt.cssPrefix,"-").concat(oB.GROUP)},children:[{tag:"path",attributes:{class:"".concat(Tt.cssPrefix,"-").concat(oB.SECONDARY),fill:"currentColor",d:r[0]}},{tag:"path",attributes:{class:"".concat(Tt.cssPrefix,"-").concat(oB.PRIMARY),fill:"currentColor",d:r[1]}}]}:i={tag:"path",attributes:{fill:"currentColor",d:r}},{found:!0,width:e,height:n,icon:i}}const H4e={found:!1,width:512,height:512};function j4e(t,e){!_Z&&!Tt.showMissingIcons&&t&&console.error('Icon with name "'.concat(t,'" and prefix "').concat(e,'" is missing.'))}function $5(t,e){let n=e;return e==="fa"&&Tt.styleDefault!==null&&(e=mf()),new Promise((r,i)=>{if(n==="fa"){const s=UZ(t)||{};t=s.iconName||t,e=s.prefix||e}if(t&&e&&cB[e]&&cB[e][t]){const s=cB[e][t];return r(K5(s))}j4e(t,e),r({...H4e,icon:Tt.showMissingIcons&&t?gf("missingIconAbstract")||{}:{}})})}const QH=()=>{},q5=Tt.measurePerformance&&Aw&&Aw.mark&&Aw.measure?Aw:{mark:QH,measure:QH},z0='FA "6.6.0"',Q4e=t=>(q5.mark("".concat(z0," ").concat(t," begins")),()=>jZ(t)),jZ=t=>{q5.mark("".concat(z0," ").concat(t," ends")),q5.measure("".concat(z0," ").concat(t),"".concat(z0," ").concat(t," begins"),"".concat(z0," ").concat(t," ends"))};var Q6={begin:Q4e,end:jZ};const Wx=()=>{};function zH(t){return typeof(t.getAttribute?t.getAttribute(Yh):null)=="string"}function z4e(t){const e=t.getAttribute?t.getAttribute(I6):null,n=t.getAttribute?t.getAttribute(O6):null;return e&&n}function V4e(t){return t&&t.classList&&t.classList.contains&&t.classList.contains(Tt.replacementClass)}function G4e(){return Tt.autoReplaceSvg===!0?Kx.replace:Kx[Tt.autoReplaceSvg]||Kx.replace}function W4e(t){return yr.createElementNS("http://www.w3.org/2000/svg",t)}function K4e(t){return yr.createElement(t)}function QZ(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{ceFn:n=t.tag==="svg"?W4e:K4e}=e;if(typeof t=="string")return yr.createTextNode(t);const r=n(t.tag);return Object.keys(t.attributes||[]).forEach(function(s){r.setAttribute(s,t.attributes[s])}),(t.children||[]).forEach(function(s){r.appendChild(QZ(s,{ceFn:n}))}),r}function $4e(t){let e=" ".concat(t.outerHTML," ");return e="".concat(e,"Font Awesome fontawesome.com "),e}const Kx={replace:function(t){const e=t[0];if(e.parentNode)if(t[1].forEach(n=>{e.parentNode.insertBefore(QZ(n),e)}),e.getAttribute(Yh)===null&&Tt.keepOriginalSource){let n=yr.createComment($4e(e));e.parentNode.replaceChild(n,e)}else e.remove()},nest:function(t){const e=t[0],n=t[1];if(~F6(e).indexOf(Tt.replacementClass))return Kx.replace(t);const r=new RegExp("".concat(Tt.cssPrefix,"-.*"));if(delete n[0].attributes.id,n[0].attributes.class){const s=n[0].attributes.class.split(" ").reduce((o,a)=>(a===Tt.replacementClass||a.match(r)?o.toSvg.push(a):o.toNode.push(a),o),{toNode:[],toSvg:[]});n[0].attributes.class=s.toSvg.join(" "),s.toNode.length===0?e.removeAttribute("class"):e.setAttribute("class",s.toNode.join(" "))}const i=n.map(s=>Mv(s)).join(`
`);e.setAttribute(Yh,""),e.innerHTML=i}};function VH(t){t()}function zZ(t,e){const n=typeof e=="function"?e:Wx;if(t.length===0)n();else{let r=VH;Tt.mutateApproach===t4e&&(r=pf.requestAnimationFrame||VH),r(()=>{const i=G4e(),s=Q6.begin("mutate");t.map(i),s(),n()})}}let z6=!1;function VZ(){z6=!0}function X5(){z6=!1}let z_=null;function GH(t){if(!LH||!Tt.observeMutations)return;const{treeCallback:e=Wx,nodeCallback:n=Wx,pseudoElementsCallback:r=Wx,observeMutationsRoot:i=yr}=t;z_=new LH(s=>{if(z6)return;const o=mf();Og(s).forEach(a=>{if(a.type==="childList"&&a.addedNodes.length>0&&!zH(a.addedNodes[0])&&(Tt.searchPseudoElements&&r(a.target),e(a.target)),a.type==="attributes"&&a.target.parentNode&&Tt.searchPseudoElements&&r(a.target.parentNode),a.type==="attributes"&&zH(a.target)&&~a4e.indexOf(a.attributeName))if(a.attributeName==="class"&&z4e(a.target)){const{prefix:l,iconName:c}=U2(F6(a.target));a.target.setAttribute(I6,l||o),c&&a.target.setAttribute(O6,c)}else V4e(a.target)&&n(a.target)})}),vu&&z_.observe(i,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}function q4e(){z_&&z_.disconnect()}function X4e(t){const e=t.getAttribute("style");let n=[];return e&&(n=e.split(";").reduce((r,i)=>{const s=i.split(":"),o=s[0],a=s.slice(1);return o&&a.length>0&&(r[o]=a.join(":").trim()),r},{})),n}function Y4e(t){const e=t.getAttribute("data-prefix"),n=t.getAttribute("data-icon"),r=t.innerText!==void 0?t.innerText.trim():"";let i=U2(F6(t));return i.prefix||(i.prefix=mf()),e&&n&&(i.prefix=e,i.iconName=n),i.iconName&&i.prefix||(i.prefix&&r.length>0&&(i.iconName=T4e(i.prefix,t.innerText)||U6(i.prefix,z5(t.innerText))),!i.iconName&&Tt.autoFetchSvg&&t.firstChild&&t.firstChild.nodeType===Node.TEXT_NODE&&(i.iconName=t.firstChild.data)),i}function J4e(t){const e=Og(t.attributes).reduce((i,s)=>(i.name!=="class"&&i.name!=="style"&&(i[s.name]=s.value),i),{}),n=t.getAttribute("title"),r=t.getAttribute("data-fa-title-id");return Tt.autoA11y&&(n?e["aria-labelledby"]="".concat(Tt.replacementClass,"-title-").concat(r||Hy()):(e["aria-hidden"]="true",e.focusable="false")),e}function Z4e(){return{iconName:null,title:null,titleId:null,prefix:null,transform:Fl,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}}function WH(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{styleParser:!0};const{iconName:n,prefix:r,rest:i}=Y4e(t),s=J4e(t),o=G5("parseNodeAttributes",{},t);let a=e.styleParser?X4e(t):[];return{iconName:n,title:t.getAttribute("title"),titleId:t.getAttribute("data-fa-title-id"),prefix:r,transform:Fl,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:i,styles:a,attributes:s},...o}}const{styles:e5e}=Nl;function GZ(t){const e=Tt.autoReplaceSvg==="nest"?WH(t,{styleParser:!1}):WH(t);return~e.extra.classes.indexOf(TZ)?gf("generateLayersText",t,e):gf("generateSvgReplacementMutation",t,e)}let tc=new Set;SZ.map(t=>{tc.add("fa-".concat(t))});Object.keys(Eh[Er]).map(tc.add.bind(tc));Object.keys(Eh[Qo]).map(tc.add.bind(tc));Object.keys(Eh[zo]).map(tc.add.bind(tc));tc=[...tc];function KH(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!vu)return Promise.resolve();const n=yr.documentElement.classList,r=u=>n.add("".concat(FH,"-").concat(u)),i=u=>n.remove("".concat(FH,"-").concat(u)),s=Tt.autoFetchSvg?tc:SZ.map(u=>"fa-".concat(u)).concat(Object.keys(e5e));s.includes("fa")||s.push("fa");const o=[".".concat(TZ,":not([").concat(Yh,"])")].concat(s.map(u=>".".concat(u,":not([").concat(Yh,"])"))).join(", ");if(o.length===0)return Promise.resolve();let a=[];try{a=Og(t.querySelectorAll(o))}catch{}if(a.length>0)r("pending"),i("complete");else return Promise.resolve();const l=Q6.begin("onTree"),c=a.reduce((u,d)=>{try{const f=GZ(d);f&&u.push(f)}catch(f){_Z||f.name==="MissingIcon"&&console.error(f)}return u},[]);return new Promise((u,d)=>{Promise.all(c).then(f=>{zZ(f,()=>{r("active"),r("complete"),i("pending"),typeof e=="function"&&e(),l(),u()})}).catch(f=>{l(),d(f)})})}function t5e(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;GZ(t).then(n=>{n&&zZ([n],e)})}function n5e(t){return function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=(e||{}).icon?e:W5(e||{});let{mask:i}=n;return i&&(i=(i||{}).icon?i:W5(i||{})),t(r,{...n,mask:i})}}const r5e=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{transform:n=Fl,symbol:r=!1,mask:i=null,maskId:s=null,title:o=null,titleId:a=null,classes:l=[],attributes:c={},styles:u={}}=e;if(!t)return;const{prefix:d,iconName:f,icon:h}=t;return H2({type:"icon",...t},()=>(Jh("beforeDOMElementCreation",{iconDefinition:t,params:e}),Tt.autoA11y&&(o?c["aria-labelledby"]="".concat(Tt.replacementClass,"-title-").concat(a||Hy()):(c["aria-hidden"]="true",c.focusable="false")),j6({icons:{main:K5(h),mask:i?K5(i.icon):{found:!1,width:null,height:null,icon:{}}},prefix:d,iconName:f,transform:{...Fl,...n},symbol:r,title:o,maskId:s,titleId:a,extra:{attributes:c,styles:u,classes:l}})))};var i5e={mixout(){return{icon:n5e(r5e)}},hooks(){return{mutationObserverCallbacks(t){return t.treeCallback=KH,t.nodeCallback=t5e,t}}},provides(t){t.i2svg=function(e){const{node:n=yr,callback:r=()=>{}}=e;return KH(n,r)},t.generateSvgReplacementMutation=function(e,n){const{iconName:r,title:i,titleId:s,prefix:o,transform:a,symbol:l,mask:c,maskId:u,extra:d}=n;return new Promise((f,h)=>{Promise.all([$5(r,o),c.iconName?$5(c.iconName,c.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(A=>{let[p,m]=A;f([e,j6({icons:{main:p,mask:m},prefix:o,iconName:r,transform:a,symbol:l,maskId:u,title:i,titleId:s,extra:d,watchable:!0})])}).catch(h)})},t.generateAbstractIcon=function(e){let{children:n,attributes:r,main:i,transform:s,styles:o}=e;const a=N2(o);a.length>0&&(r.style=a);let l;return N6(s)&&(l=gf("generateAbstractTransformGrouping",{main:i,transform:s,containerWidth:i.width,iconWidth:i.width})),n.push(l||i.icon),{children:n,attributes:r}}}},s5e={mixout(){return{layer(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{classes:n=[]}=e;return H2({type:"layer"},()=>{Jh("beforeDOMElementCreation",{assembler:t,params:e});let r=[];return t(i=>{Array.isArray(i)?i.map(s=>{r=r.concat(s.abstract)}):r=r.concat(i.abstract)}),[{tag:"span",attributes:{class:["".concat(Tt.cssPrefix,"-layers"),...n].join(" ")},children:r}]})}}}},o5e={mixout(){return{counter(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{title:n=null,classes:r=[],attributes:i={},styles:s={}}=e;return H2({type:"counter",content:t},()=>(Jh("beforeDOMElementCreation",{content:t,params:e}),U4e({content:t.toString(),title:n,extra:{attributes:i,styles:s,classes:["".concat(Tt.cssPrefix,"-layers-counter"),...r]}})))}}}},a5e={mixout(){return{text(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{transform:n=Fl,title:r=null,classes:i=[],attributes:s={},styles:o={}}=e;return H2({type:"text",content:t},()=>(Jh("beforeDOMElementCreation",{content:t,params:e}),jH({content:t,transform:{...Fl,...n},title:r,extra:{attributes:s,styles:o,classes:["".concat(Tt.cssPrefix,"-layers-text"),...i]}})))}}},provides(t){t.generateLayersText=function(e,n){const{title:r,transform:i,extra:s}=n;let o=null,a=null;if(yZ){const l=parseInt(getComputedStyle(e).fontSize,10),c=e.getBoundingClientRect();o=c.width/l,a=c.height/l}return Tt.autoA11y&&!r&&(s.attributes["aria-hidden"]="true"),Promise.resolve([e,jH({content:e.innerHTML,width:o,height:a,transform:i,title:r,extra:s,watchable:!0})])}}};const l5e=new RegExp('"',"ug"),$H=[1105920,1112319],qH={FontAwesome:{normal:"fas",400:"fas"},...zke,...Qke,...Yke},Y5=Object.keys(qH).reduce((t,e)=>(t[e.toLowerCase()]=qH[e],t),{}),c5e=Object.keys(Y5).reduce((t,e)=>{const n=Y5[e];return t[e]=n[900]||[...Object.entries(n)][0][1],t},{});function u5e(t){const e=t.replace(l5e,""),n=w4e(e,0),r=n>=$H[0]&&n<=$H[1],i=e.length===2?e[0]===e[1]:!1;return{value:z5(i?e[0]:e),isSecondary:r||i}}function d5e(t,e){const n=t.replace(/^['"]|['"]$/g,"").toLowerCase(),r=parseInt(e),i=isNaN(r)?"normal":r;return(Y5[n]||{})[i]||c5e[n]}function XH(t,e){const n="".concat(e4e).concat(e.replace(":","-"));return new Promise((r,i)=>{if(t.getAttribute(n)!==null)return r();const o=Og(t.children).filter(f=>f.getAttribute(U5)===e)[0],a=pf.getComputedStyle(t,e),l=a.getPropertyValue("font-family"),c=l.match(s4e),u=a.getPropertyValue("font-weight"),d=a.getPropertyValue("content");if(o&&!c)return t.removeChild(o),r();if(c&&d!=="none"&&d!==""){const f=a.getPropertyValue("content");let h=d5e(l,u);const{value:A,isSecondary:p}=u5e(f),m=c[0].startsWith("FontAwesome");let g=U6(h,A),y=g;if(m){const w=B4e(A);w.iconName&&w.prefix&&(g=w.iconName,h=w.prefix)}if(g&&!p&&(!o||o.getAttribute(I6)!==h||o.getAttribute(O6)!==y)){t.setAttribute(n,y),o&&t.removeChild(o);const w=Z4e(),{extra:v}=w;v.attributes[U5]=e,$5(g,h).then(x=>{const C=j6({...w,icons:{main:x,mask:H6()},prefix:h,iconName:y,extra:v,watchable:!0}),_=yr.createElementNS("http://www.w3.org/2000/svg","svg");e==="::before"?t.insertBefore(_,t.firstChild):t.appendChild(_),_.outerHTML=C.map(S=>Mv(S)).join(`
`),t.removeAttribute(n),r()}).catch(i)}else r()}else r()})}function f5e(t){return Promise.all([XH(t,"::before"),XH(t,"::after")])}function h5e(t){return t.parentNode!==document.head&&!~n4e.indexOf(t.tagName.toUpperCase())&&!t.getAttribute(U5)&&(!t.parentNode||t.parentNode.tagName!=="svg")}function YH(t){if(vu)return new Promise((e,n)=>{const r=Og(t.querySelectorAll("*")).filter(h5e).map(f5e),i=Q6.begin("searchPseudoElements");VZ(),Promise.all(r).then(()=>{i(),X5(),e()}).catch(()=>{i(),X5(),n()})})}var A5e={hooks(){return{mutationObserverCallbacks(t){return t.pseudoElementsCallback=YH,t}}},provides(t){t.pseudoElements2svg=function(e){const{node:n=yr}=e;Tt.searchPseudoElements&&YH(n)}}};let JH=!1;var p5e={mixout(){return{dom:{unwatch(){VZ(),JH=!0}}}},hooks(){return{bootstrap(){GH(G5("mutationObserverCallbacks",{}))},noAuto(){q4e()},watch(t){const{observeMutationsRoot:e}=t;JH?X5():GH(G5("mutationObserverCallbacks",{observeMutationsRoot:e}))}}}};const ZH=t=>{let e={size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0};return t.toLowerCase().split(" ").reduce((n,r)=>{const i=r.toLowerCase().split("-"),s=i[0];let o=i.slice(1).join("-");if(s&&o==="h")return n.flipX=!0,n;if(s&&o==="v")return n.flipY=!0,n;if(o=parseFloat(o),isNaN(o))return n;switch(s){case"grow":n.size=n.size+o;break;case"shrink":n.size=n.size-o;break;case"left":n.x=n.x-o;break;case"right":n.x=n.x+o;break;case"up":n.y=n.y-o;break;case"down":n.y=n.y+o;break;case"rotate":n.rotate=n.rotate+o;break}return n},e)};var m5e={mixout(){return{parse:{transform:t=>ZH(t)}}},hooks(){return{parseNodeAttributes(t,e){const n=e.getAttribute("data-fa-transform");return n&&(t.transform=ZH(n)),t}}},provides(t){t.generateAbstractTransformGrouping=function(e){let{main:n,transform:r,containerWidth:i,iconWidth:s}=e;const o={transform:"translate(".concat(i/2," 256)")},a="translate(".concat(r.x*32,", ").concat(r.y*32,") "),l="scale(".concat(r.size/16*(r.flipX?-1:1),", ").concat(r.size/16*(r.flipY?-1:1),") "),c="rotate(".concat(r.rotate," 0 0)"),u={transform:"".concat(a," ").concat(l," ").concat(c)},d={transform:"translate(".concat(s/2*-1," -256)")},f={outer:o,inner:u,path:d};return{tag:"g",attributes:{...f.outer},children:[{tag:"g",attributes:{...f.inner},children:[{tag:n.icon.tag,children:n.icon.children,attributes:{...n.icon.attributes,...f.path}}]}]}}}};const uB={x:0,y:0,width:"100%",height:"100%"};function ej(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return t.attributes&&(t.attributes.fill||e)&&(t.attributes.fill="black"),t}function g5e(t){return t.tag==="g"?t.children:[t]}var y5e={hooks(){return{parseNodeAttributes(t,e){const n=e.getAttribute("data-fa-mask"),r=n?U2(n.split(" ").map(i=>i.trim())):H6();return r.prefix||(r.prefix=mf()),t.mask=r,t.maskId=e.getAttribute("data-fa-mask-id"),t}}},provides(t){t.generateAbstractMask=function(e){let{children:n,attributes:r,main:i,mask:s,maskId:o,transform:a}=e;const{width:l,icon:c}=i,{width:u,icon:d}=s,f=p4e({transform:a,containerWidth:u,iconWidth:l}),h={tag:"rect",attributes:{...uB,fill:"white"}},A=c.children?{children:c.children.map(ej)}:{},p={tag:"g",attributes:{...f.inner},children:[ej({tag:c.tag,attributes:{...c.attributes,...f.path},...A})]},m={tag:"g",attributes:{...f.outer},children:[p]},g="mask-".concat(o||Hy()),y="clip-".concat(o||Hy()),w={tag:"mask",attributes:{...uB,id:g,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"},children:[h,m]},v={tag:"defs",children:[{tag:"clipPath",attributes:{id:y},children:g5e(d)},w]};return n.push(v,{tag:"rect",attributes:{fill:"currentColor","clip-path":"url(#".concat(y,")"),mask:"url(#".concat(g,")"),...uB}}),{children:n,attributes:r}}}},v5e={provides(t){let e=!1;pf.matchMedia&&(e=pf.matchMedia("(prefers-reduced-motion: reduce)").matches),t.missingIconAbstract=function(){const n=[],r={fill:"currentColor"},i={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};n.push({tag:"path",attributes:{...r,d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"}});const s={...i,attributeName:"opacity"},o={tag:"circle",attributes:{...r,cx:"256",cy:"364",r:"28"},children:[]};return e||o.children.push({tag:"animate",attributes:{...i,attributeName:"r",values:"28;14;28;28;14;28;"}},{tag:"animate",attributes:{...s,values:"1;0;1;1;0;1;"}}),n.push(o),n.push({tag:"path",attributes:{...r,opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"},children:e?[]:[{tag:"animate",attributes:{...s,values:"1;0;0;0;0;1;"}}]}),e||n.push({tag:"path",attributes:{...r,opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"},children:[{tag:"animate",attributes:{...s,values:"0;0;1;1;0;0;"}}]}),{tag:"g",attributes:{class:"missing"},children:n}}}},b5e={hooks(){return{parseNodeAttributes(t,e){const n=e.getAttribute("data-fa-symbol"),r=n===null?!1:n===""?!0:n;return t.symbol=r,t}}}},w5e=[y4e,i5e,s5e,o5e,a5e,A5e,p5e,m5e,y5e,v5e,b5e];P4e(w5e,{mixoutsTo:$o});$o.noAuto;$o.config;$o.library;$o.dom;const J5=$o.parse;$o.findIconDefinition;$o.toHtml;const x5e=$o.icon;$o.layer;$o.text;$o.counter;var WZ={exports:{}},C5e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",_5e=C5e,S5e=_5e;function KZ(){}function $Z(){}$Z.resetWarningCache=KZ;var E5e=function(){function t(r,i,s,o,a,l){if(l!==S5e){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:$Z,resetWarningCache:KZ};return n.PropTypes=n,n};WZ.exports=E5e();var T5e=WZ.exports;const hn=mg(T5e);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 _l(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){Np(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 V_(t){"@babel/helpers - typeof";return V_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},V_(t)}function Np(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function B5e(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function M5e(t,e){if(t==null)return{};var n=B5e(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Z5(t){return k5e(t)||R5e(t)||P5e(t)||L5e()}function k5e(t){if(Array.isArray(t))return eR(t)}function R5e(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function P5e(t,e){if(t){if(typeof t=="string")return eR(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eR(t,e)}}function eR(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function L5e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function I5e(t){var e,n=t.beat,r=t.fade,i=t.beatFade,s=t.bounce,o=t.shake,a=t.flash,l=t.spin,c=t.spinPulse,u=t.spinReverse,d=t.pulse,f=t.fixedWidth,h=t.inverse,A=t.border,p=t.listItem,m=t.flip,g=t.size,y=t.rotation,w=t.pull,v=(e={"fa-beat":n,"fa-fade":r,"fa-beat-fade":i,"fa-bounce":s,"fa-shake":o,"fa-flash":a,"fa-spin":l,"fa-spin-reverse":u,"fa-spin-pulse":c,"fa-pulse":d,"fa-fw":f,"fa-inverse":h,"fa-border":A,"fa-li":p,"fa-flip":m===!0,"fa-flip-horizontal":m==="horizontal"||m==="both","fa-flip-vertical":m==="vertical"||m==="both"},Np(e,"fa-".concat(g),typeof g<"u"&&g!==null),Np(e,"fa-rotate-".concat(y),typeof y<"u"&&y!==null&&y!==0),Np(e,"fa-pull-".concat(w),typeof w<"u"&&w!==null),Np(e,"fa-swap-opacity",t.swapOpacity),e);return Object.keys(v).map(function(x){return v[x]?x:null}).filter(function(x){return x})}function O5e(t){return t=t-0,t===t}function qZ(t){return O5e(t)?t:(t=t.replace(/[\-_\s]+(.)?/g,function(e,n){return n?n.toUpperCase():""}),t.substr(0,1).toLowerCase()+t.substr(1))}var F5e=["style"];function N5e(t){return t.charAt(0).toUpperCase()+t.slice(1)}function D5e(t){return t.split(";").map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,n){var r=n.indexOf(":"),i=qZ(n.slice(0,r)),s=n.slice(r+1).trim();return i.startsWith("webkit")?e[N5e(i)]=s:e[i]=s,e},{})}function XZ(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof e=="string")return e;var r=(e.children||[]).map(function(l){return XZ(t,l)}),i=Object.keys(e.attributes||{}).reduce(function(l,c){var u=e.attributes[c];switch(c){case"class":l.attrs.className=u,delete e.attributes.class;break;case"style":l.attrs.style=D5e(u);break;default:c.indexOf("aria-")===0||c.indexOf("data-")===0?l.attrs[c.toLowerCase()]=u:l.attrs[qZ(c)]=u}return l},{attrs:{}}),s=n.style,o=s===void 0?{}:s,a=M5e(n,F5e);return i.attrs.style=_l(_l({},i.attrs.style),o),t.apply(void 0,[e.tag,_l(_l({},i.attrs),a)].concat(Z5(r)))}var YZ=!1;try{YZ=!0}catch{}function U5e(){if(!YZ&&console&&typeof console.error=="function"){var t;(t=console).error.apply(t,arguments)}}function nj(t){if(t&&V_(t)==="object"&&t.prefix&&t.iconName&&t.icon)return t;if(J5.icon)return J5.icon(t);if(t===null)return null;if(t&&V_(t)==="object"&&t.prefix&&t.iconName)return t;if(Array.isArray(t)&&t.length===2)return{prefix:t[0],iconName:t[1]};if(typeof t=="string")return{prefix:"fas",iconName:t}}function dB(t,e){return Array.isArray(e)&&e.length>0||!Array.isArray(e)&&e?Np({},t,e):{}}var rj={border:!1,className:"",mask:null,maskId:null,fixedWidth:!1,inverse:!1,flip:!1,icon:null,listItem:!1,pull:null,pulse:!1,rotation:null,size:null,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:"",titleId:null,transform:null,swapOpacity:!1},Zh=at.forwardRef(function(t,e){var n=_l(_l({},rj),t),r=n.icon,i=n.mask,s=n.symbol,o=n.className,a=n.title,l=n.titleId,c=n.maskId,u=nj(r),d=dB("classes",[].concat(Z5(I5e(n)),Z5((o||"").split(" ")))),f=dB("transform",typeof n.transform=="string"?J5.transform(n.transform):n.transform),h=dB("mask",nj(i)),A=x5e(u,_l(_l(_l(_l({},d),f),h),{},{symbol:s,title:a,titleId:l,maskId:c}));if(!A)return U5e("Could not find icon",u),null;var p=A.abstract,m={ref:e};return Object.keys(n).forEach(function(g){rj.hasOwnProperty(g)||(m[g]=n[g])}),H5e(p[0],m)});Zh.displayName="FontAwesomeIcon";Zh.propTypes={beat:hn.bool,border:hn.bool,beatFade:hn.bool,bounce:hn.bool,className:hn.string,fade:hn.bool,flash:hn.bool,mask:hn.oneOfType([hn.object,hn.array,hn.string]),maskId:hn.string,fixedWidth:hn.bool,inverse:hn.bool,flip:hn.oneOf([!0,!1,"horizontal","vertical","both"]),icon:hn.oneOfType([hn.object,hn.array,hn.string]),listItem:hn.bool,pull:hn.oneOf(["right","left"]),pulse:hn.bool,rotation:hn.oneOf([0,90,180,270]),shake:hn.bool,size:hn.oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:hn.bool,spinPulse:hn.bool,spinReverse:hn.bool,symbol:hn.oneOfType([hn.bool,hn.string]),title:hn.string,titleId:hn.string,transform:hn.oneOfType([hn.string,hn.object]),swapOpacity:hn.bool};var H5e=XZ.bind(null,at.createElement);const pw={xs:12,sm:14,md:20,lg:24},vs=({icon:t=Mke,className:e,bgClassName:n,iconClassName:r,size:i="md",children:s})=>{const o=`h-auto text-inherit dark:text-current group-disabled:text-chalkboard-60 group-disabled:text-chalkboard-60 ${r}`,a=`bg-chalkboard-20 dark:bg-chalkboard-80 group-disabled:bg-chalkboard-30 dark:group-disabled:bg-chalkboard-80 ${n}`;return b.jsx("div",{className:`w-fit self-stretch inline-grid place-content-center ${e} `+a,children:s||(typeof t=="string"?b.jsx(nn,{name:t,width:pw[i],height:pw[i],className:o}):b.jsx(Zh,{icon:t,width:pw[i],height:pw[i],className:o}))})},$t=P.forwardRef((t,e)=>{const n=`action-button p-0 m-0 group mono text-xs leading-none flex items-center gap-2 rounded-sm border-solid border border-chalkboard-30 hover:border-chalkboard-40 enabled:dark:border-chalkboard-70 dark:hover:border-chalkboard-60 dark:bg-chalkboard-90/50 text-chalkboard-100 dark:text-chalkboard-10 ${t.iconStart?t.iconEnd?"px-0":"pr-2":t.iconEnd?"pl-2":"px-2"} ${t.className?t.className:""}`;switch(t.Element){case"button":{const{Element:r,iconStart:i,iconEnd:s,children:o,className:a,...l}=t;return b.jsxs("button",{ref:e,className:n,...l,children:[i&&b.jsx(vs,{...i}),o,s&&b.jsx(vs,{...s})]})}case"link":{const{Element:r,to:i,iconStart:s,iconEnd:o,children:a,className:l,...c}=t;return b.jsxs(Af,{ref:e,to:i||ut.INDEX,className:n,...c,children:[s&&b.jsx(vs,{...s}),a,o&&b.jsx(vs,{...o})]})}case"externalLink":{const{Element:r,to:i,iconStart:s,iconEnd:o,children:a,className:l,...c}=t;return b.jsxs(Af,{ref:e,to:i||ut.INDEX,className:n,onClick:tu(i),...c,target:"_blank",children:[s&&b.jsx(vs,{...s}),a,o&&b.jsx(vs,{...o})]})}default:{const{Element:r,iconStart:i,children:s,className:o,...a}=t;return b.jsxs(r,{className:n,...a,children:[t.iconStart&&b.jsx(vs,{...t.iconStart}),s,t.iconEnd&&b.jsx(vs,{...t.iconEnd})]})}}});function j5e(){const[t,e]=P.useState(!1),[n,r]=P.useState(!1),{state:i}=Ti();if(P.useEffect(()=>{Ke.camControls.setIsCamMovingCallback((o,a)=>{e(o),r(a)})},[]),!t)return{hideClient:!1,hideServer:!1};let s=i.matches("Sketch");return n&&(s=!1),{hideClient:!s,hideServer:s}}const Q5e=({cameraControls:t})=>{var l,c;const e=P.useRef(null),{state:n,send:r,context:i}=Ti(),{hideClient:s,hideServer:o}=j5e();P.useEffect(()=>{Ke.camControls.interactionGuards=Gd[t]},[t]),P.useEffect(()=>{var u,d;Ke.updateOtherSelectionColors(((d=(u=n==null?void 0:n.context)==null?void 0:u.selectionRanges)==null?void 0:d.otherSelections)||[])},[(c=(l=n==null?void 0:n.context)==null?void 0:l.selectionRanges)==null?void 0:c.otherSelections]),P.useEffect(()=>{if(!e.current)return;const u=e.current;return u.appendChild(Ke.renderer.domElement),u.appendChild(Ke.labelRenderer.domElement),Ke.animate(),u.addEventListener("mousemove",Li(Ke.onMouseMove,Bt),!1),u.addEventListener("mousedown",Ke.onMouseDown,!1),u.addEventListener("mouseup",Li(Ke.onMouseUp,Bt),!1),Ke.setSend(r),je.modelingSend=r,()=>{u==null||u.removeEventListener("mousemove",Li(Ke.onMouseMove,Bt)),u==null||u.removeEventListener("mousedown",Ke.onMouseDown),u==null||u.removeEventListener("mouseup",Li(Ke.onMouseUp,Bt))}},[]);let a="default";return n.matches("Sketch")&&(i.mouseState.type==="isHovering"&&mi(i.mouseState.on,[au,Il,ta])?a="move":i.mouseState.type==="isDragging"?a="grabbing":n.matches({Sketch:"Line tool"})||n.matches({Sketch:"Tangential arc to"})||n.matches({Sketch:"Rectangle tool"})||n.matches({Sketch:"Circle tool"})?a="crosshair":a="default"),b.jsxs(b.Fragment,{children:[b.jsx("div",{ref:e,style:{cursor:a},"data-testid":"client-side-scene",className:`absolute inset-0 h-full w-full transition-all duration-300 ${s?"opacity-0":"opacity-100"} ${o?"bg-chalkboard-10 dark:bg-chalkboard-100":""} ${!s&&!o&&n.matches("Sketch")?"bg-chalkboard-10/80 dark:bg-chalkboard-100/80":""}`}),b.jsx(z5e,{})]})},z5e=()=>{const{context:t}=Ti();return t.mouseState.type==="isDragging"?null:b.jsx("div",{className:"absolute inset-0 pointer-events-none",children:Object.entries(t.segmentOverlays).filter(e=>e[1].visible).map(([e,n],r)=>b.jsx(V5e,{overlay:n,pathToNodeString:e,overlayIndex:r},e))})},V5e=({overlay:t,overlayIndex:e,pathToNodeString:n})=>{var m,g,y;const{context:r,send:i,state:s}=Ti();let o=t.angle<0?"0%":"-100%",a=t.angle<-90||t.angle>=90?"0%":"-100%";const l=Xe(be.ast,t.pathToNode,"CallExpression");if(ie(l))return;const c=l.node,u=AI(c,Kt.code,t.pathToNode),d=20,f=90,h=Math.cos((t.angle+f)*Math.PI/180)*d,A=Math.sin((t.angle+f)*Math.PI/180)*d,p=t.visible&&typeof((m=r==null?void 0:r.segmentHoverMap)==null?void 0:m[n])=="number"&&!(s.matches({Sketch:"Line tool"})||s.matches({Sketch:"Tangential arc to"})||s.matches({Sketch:"Rectangle tool"}));return b.jsxs("div",{className:"absolute w-0 h-0",children:[b.jsx("div",{"data-testid":"segment-overlay","data-path-to-node":n,"data-overlay-index":e,"data-overlay-visible":p,"data-overlay-angle":t.angle,className:"pointer-events-auto absolute w-0 h-0",style:{transform:`translate3d(${t.windowCoords[0]}px, ${t.windowCoords[1]}px, 0)`}}),p&&b.jsxs("div",{"data-overlay-toolbar-index":e,className:"px-0 pointer-events-auto absolute flex gap-1",style:{transform:`translate3d(calc(${t.windowCoords[0]+h}px + ${o}), calc(${t.windowCoords[1]-A}px + ${a}), 0)`},onMouseEnter:()=>i({type:"Set mouse state",data:{type:"isHovering",on:t.group}}),onMouseLeave:()=>i({type:"Set mouse state",data:{type:"idle"}}),children:[u&&u.map((w,v)=>b.jsx(q5e,{constrainInfo:w,verticalPosition:t.windowCoords[1]>window.innerHeight/2?"top":"bottom"},v)),((g=c==null?void 0:c.callee)==null?void 0:g.name)!=="circle"&&b.jsx($5e,{verticalPosition:t.windowCoords[1]>window.innerHeight/2?"top":"bottom",pathToNode:t.pathToNode,stdLibFnName:(y=u[0])==null?void 0:y.stdLibFnName})]})]})},G5e=({isOpen:t,onResolve:e,onReject:n,text:r})=>b.jsx(Ci,{appear:!0,show:t,as:P.Fragment,children:b.jsxs(ir,{as:"div",className:"relative z-10",onClose:()=>e(!1),children:[b.jsx(Ci.Child,{as:P.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:b.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-25"})}),b.jsx("div",{className:"fixed inset-0 overflow-y-auto",children:b.jsx("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:b.jsx(Ci.Child,{as:P.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:b.jsxs(ir.Panel,{className:"rounded relative mx-auto px-4 py-8 bg-chalkboard-10 dark:bg-chalkboard-100 border dark:border-chalkboard-70 max-w-xl w-full shadow-lg",children:[b.jsx("div",{children:r}),b.jsxs("div",{className:"mt-8 flex justify-between",children:[b.jsx($t,{Element:"button",onClick:()=>e(!0),children:"Continue and unconstrain"}),b.jsx($t,{Element:"button",onClick:()=>n(!1),children:"Cancel"})]})]})})})})]})}),W5e=O2(G5e);async function K5e({pathToNode:t,sketchDetails:e}){let n=be.ast;const r=tX(n,t);if(!(r.length?await W5e({text:`At least ${r.length} segment rely on the segment you're deleting.
Do you want to continue and unconstrain these segments?`,isOpen:!0}):!0))return;if(n=_we(r,n,be.programMemory,Kt.code,t),ie(n))return Promise.reject(n);const s=wr(n);if(n=Rr(s),ie(n))return Promise.reject(n);if((await kl({ast:n,idGenerator:be.execState.idGenerator,useFakeExecutor:!0,engineCommandManager:je})).errors.length){jt.error("Segment tag used outside of current Sketch. Could not delete.");return}e&&await sn.updateAstAndRejigSketch(t,n,e.zAxis,e.yAxis,e.origin)}const $5e=({verticalPosition:t,pathToNode:e,stdLibFnName:n})=>{const{send:r}=Ti(),i=tX(be.ast,e);return b.jsx(er,{className:"relative",children:({open:s})=>b.jsxs(b.Fragment,{children:[b.jsx(er.Button,{"data-testid":"overlay-menu","data-stdlib-fn-name":n,className:"bg-chalkboard-10 dark:bg-chalkboard-100 border !border-transparent hover:!border-chalkboard-40 dark:hover:!border-chalkboard-70 ui-open:!border-chalkboard-40 dark:ui-open:!border-chalkboard-70 h-[26px] w-[26px] rounded-sm p-0 m-0",children:b.jsx(nn,{name:"three-dots"})}),b.jsxs(er.Panel,{as:"menu",className:`absolute ${t==="top"?"bottom-full":"top-full"} z-10 w-36 flex flex-col gap-1 divide-y divide-chalkboard-20 dark:divide-chalkboard-70 align-stretch px-0 py-1 bg-chalkboard-10 dark:bg-chalkboard-100 rounded-sm shadow-lg border border-solid border-chalkboard-20/50 dark:border-chalkboard-80/50`,children:[b.jsx("button",{className:"!border-transparent rounded-sm text-left p-1 text-nowrap",onClick:()=>{r({type:"Constrain remove constraints",data:e})},children:"Remove constraints"}),b.jsx("button",{className:"!border-transparent rounded-sm text-left p-1 text-nowrap",title:i.length>0?`At least ${i.length} segment rely on this segment's tag.`:"",onClick:()=>{r({type:"Delete segment",data:e})},children:"Delete Segment"})]})]})})},q5e=({constrainInfo:{type:t,isConstrained:e,value:n,pathToNode:r,argPosition:i},verticalPosition:s})=>{var m,g,y;const{context:o,send:a}=Ti(),l={xRelative:{varName:"xRel",displayName:"X Relative",iconName:"xRelative"},xAbsolute:{varName:"xAbs",displayName:"X Absolute",iconName:"xAbsolute"},yRelative:{varName:"yRel",displayName:"Y Relative",iconName:"yRelative"},yAbsolute:{varName:"yAbs",displayName:"Y Absolute",iconName:"yAbsolute"},angle:{varName:"angle",displayName:"Angle",iconName:"angle"},length:{varName:"len",displayName:"Length",iconName:"dimension"},intersectionOffset:{varName:"perpDist",displayName:"Intersection Offset",iconName:"intersection-offset"},radius:{varName:"radius",displayName:"Radius",iconName:"dimension"},vertical:{varName:"",displayName:"",iconName:"vertical",implicitConstraintDesc:"vertically"},horizontal:{varName:"",displayName:"",iconName:"horizontal",implicitConstraintDesc:"horizontally"},tangentialWithPrevious:{varName:"",displayName:"",iconName:"tangent",implicitConstraintDesc:"tangential to previous segment"},intersectionTag:{varName:"",displayName:"",iconName:"dimension"}},c=((m=l==null?void 0:l[t])==null?void 0:m.varName)||"var",u=l[t].iconName,d=(g=l[t])==null?void 0:g.displayName,f=(y=l[t])==null?void 0:y.implicitConstraintDesc,h=P.useMemo(()=>Xe(be.ast,r),[be.ast,r]);if(ie(h))return;const A=h.node,p=A?[A.start,A.end]:[0,0];return t==="intersectionTag"?null:b.jsxs("div",{className:"relative group",children:[b.jsx("button",{"data-testid":"constraint-symbol","data-is-implicit-constraint":f?"true":"false","data-constraint-type":t,"data-is-constrained":e?"true":"false",className:`${f?"bg-chalkboard-10 dark:bg-chalkboard-100 border-transparent border-0 rounded":e?"bg-chalkboard-10 dark:bg-chalkboard-90 dark:hover:bg-chalkboard-80 border-chalkboard-40 dark:border-chalkboard-70 rounded-sm":"bg-primary/30 dark:bg-primary text-primary dark:text-chalkboard-10 dark:border-transparent group-hover:bg-primary/40 group-hover:border-primary/50 group-hover:brightness-125"} h-[26px] w-[26px] rounded-sm relative m-0 p-0`,onMouseEnter:()=>{Ot.setHighlightRange([p])},onMouseLeave:()=>{Ot.setHighlightRange([[0,0]])},onClick:Li(async()=>{if(!e)a({type:"Convert to variable",data:{pathToNode:r,variableName:c}});else if(e){try{const w=Rr(wr(be.ast));if(pt(w))return Promise.reject(w);const v=Xe(w,r,"CallExpression",!0);if(pt(v))return Promise.reject(v);const x=v.shallowPath;if(!o.sketchDetails||!i)return;const C=Yq(x,i,be.ast,be.programMemory);if(!C)return;const{modifiedAst:_}=C;be.updateAst(_,!0)}catch(w){console.log("error",w)}jt.success("Constraint removed")}},Bt),children:b.jsx(nn,{name:u})}),b.jsx("div",{className:`absolute ${s==="top"?"top-0 -translate-y-full":"bottom-0 translate-y-full"} group-hover:block hidden w-[2px] h-2 translate-x-[12px] bg-white/40`}),b.jsx("div",{className:`absolute ${s==="top"?"top-0":"bottom-0"} group-hover:block hidden`,style:{transform:`translate3d(calc(-50% + 13px), ${s==="top"?"-100%":"100%"}, 0)`},children:b.jsx("div",{className:"bg-chalkboard-10 dark:bg-chalkboard-90 p-2 px-3 rounded-sm border border-solid border-chalkboard-20 dark:border-chalkboard-80 shadow-sm","data-testid":"constraint-symbol-popover",children:f?b.jsxs("div",{className:"min-w-48",children:[b.jsx("pre",{className:"inline-block",children:b.jsx("code",{className:"text-primary",children:n})})," ",b.jsxs("span",{children:["is implicitly constrained ",f]})]}):b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"flex mb-1",children:b.jsxs("span",{className:"text-nowrap",children:[b.jsx("span",{className:"font-bold",children:e?"Constrained":"Unconstrained"}),b.jsx("span",{className:"text-white/80 text-sm pl-2",children:d})]})}),b.jsxs("div",{className:"flex mb-1",children:[b.jsx("span",{className:"pr-2 whitespace-nowrap",children:"Set to"}),b.jsx("pre",{children:b.jsx("code",{className:"text-primary",children:n})})]}),b.jsx("div",{className:"text-sm text-chalkboard-70 dark:text-chalkboard-40 text-nowrap",children:e?"Click to unconstrain with raw number":"Click to constrain with variable"})]})})})]})},X5e=b1(t=>{t.type==="perspective"&&t.fov&&Ke.camControls.dollyZoom(t.fov).catch(Bt)},1e3/15),Y5e=()=>{const[t,e]=P.useState(Ke.camControls.reactCameraProperties),[n,r]=P.useState(12),{commandBarSend:i}=ni();return P.useEffect(()=>{Ke.camControls.setReactCameraPropertiesCallback(e)},[Ke]),P.useEffect(()=>{t.type==="perspective"&&t.fov&&r(t.fov)},[t==null?void 0:t.fov]),b.jsxs("div",{children:[b.jsx("h3",{children:"cam settings"}),"perspective cam",b.jsx("input",{type:"checkbox",checked:t.type==="perspective",onChange:()=>i({type:"Find and select command",data:{groupId:"settings",name:"modeling.cameraProjection"}})}),b.jsx("div",{children:b.jsx("button",{onClick:()=>{Ke.camControls.resetCameraPosition().catch(Bt)},children:"Reset Camera Position"})}),t.type==="perspective"&&b.jsx("input",{type:"range",min:"4",max:"90",step:.5,value:n,onChange:s=>{r(parseFloat(s.target.value)),X5e({...t,fov:parseFloat(s.target.value)})},className:"w-full cursor-pointer pointer-events-auto"}),t.type==="perspective"&&b.jsxs("div",{children:[b.jsx("span",{children:"fov"}),b.jsx("input",{type:"number",value:t.fov,className:"text-black w-16",onChange:s=>{Ke.camControls.setCam({...t,fov:parseFloat(s.target.value)})}})]}),t.type==="orthographic"&&b.jsx(b.Fragment,{children:b.jsxs("div",{children:[b.jsx("span",{children:"fov"}),b.jsx("input",{type:"number",value:t.zoom,className:"text-black w-16",onChange:s=>{Ke.camControls.setCam({...t,zoom:parseFloat(s.target.value)})}})]})}),b.jsxs("div",{children:["Position",b.jsxs("ul",{className:"flex",children:[b.jsxs("li",{children:[b.jsx("span",{className:"pl-2 pr-1",children:"x:"}),b.jsx("input",{type:"number",step:5,"data-testid":"cam-x-position",value:t.position[0],className:"text-black w-16",onChange:s=>{Ke.camControls.setCam({...t,position:[parseFloat(s.target.value),t.position[1],t.position[2]]})}})]}),b.jsxs("li",{children:[b.jsx("span",{className:"pl-2 pr-1",children:"y:"}),b.jsx("input",{type:"number",step:5,"data-testid":"cam-y-position",value:t.position[1],className:"text-black w-16",onChange:s=>{Ke.camControls.setCam({...t,position:[t.position[0],parseFloat(s.target.value),t.position[2]]})}})]}),b.jsxs("li",{children:[b.jsx("span",{className:"pl-2 pr-1",children:"z:"}),b.jsx("input",{type:"number",step:5,"data-testid":"cam-z-position",value:t.position[2],className:"text-black w-16",onChange:s=>{Ke.camControls.setCam({...t,position:[t.position[0],t.position[1],parseFloat(s.target.value)]})}})]})]})]}),b.jsxs("div",{children:["target",b.jsxs("ul",{className:"flex",children:[b.jsxs("li",{children:[b.jsx("span",{className:"pl-2 pr-1",children:"x:"}),b.jsx("input",{type:"number",step:5,"data-testid":"cam-x-target",value:t.target[0],className:"text-black w-16",onChange:s=>{Ke.camControls.setCam({...t,target:[parseFloat(s.target.value),t.target[1],t.target[2]]})}})]}),b.jsxs("li",{children:[b.jsx("span",{className:"pl-2 pr-1",children:"y:"}),b.jsx("input",{type:"number",step:5,"data-testid":"cam-y-target",value:t.target[1],className:"text-black w-16",onChange:s=>{Ke.camControls.setCam({...t,target:[t.target[0],parseFloat(s.target.value),t.target[2]]})}})]}),b.jsxs("li",{children:[b.jsx("span",{className:"pl-2 pr-1",children:"z:"}),b.jsx("input",{type:"number",step:5,"data-testid":"cam-z-target",value:t.target[2],className:"text-black w-16",onChange:s=>{Ke.camControls.setCam({...t,target:[t.target[0],t.target[1],parseFloat(s.target.value)]})}})]})]})]})]})},JZ="persistModelingContext",J5e=["openPanes"],ZZ=()=>typeof window<"u"&&JSON.parse(localStorage.getItem(JZ)||"{}")||{openPanes:["code"]},tR={currentMode:"modeling",currentTool:"none",selection:[],selectionRanges:{otherSelections:[],codeBasedSelections:[]},sketchDetails:{sketchPathToNode:[],zAxis:[0,0,1],yAxis:[0,1,0],origin:[0,0,0]},sketchPlaneId:"",sketchEnginePathId:"",moveDescs:[],mouseState:{type:"idle"},segmentOverlays:{},segmentHoverMap:{},store:{openPanes:ZZ().openPanes||["code"]}},Z5e=Rg({types:{context:{},events:{},input:{}},guards:{"Selection is on face":()=>!1,"has valid sweep selection":()=>!1,"has valid fillet selection":()=>!1,"Has exportable geometry":()=>!1,"has valid selection for deletion":()=>!1,"has made first point":({context:t})=>{var i;if(!((i=t.sketchDetails)!=null&&i.sketchPathToNode))return!1;const e=Xe(be.ast,t.sketchDetails.sketchPathToNode,"VariableDeclarator");if(ie(e)||e.node.type!=="VariableDeclarator")return!1;const n=e.node.init;return n.type!=="PipeExpression"?!1:n.body.some(s=>s.type==="CallExpression"&&s.callee.name==="startSketchOn")&&n.body.length>1},"is editing existing sketch":({context:{sketchDetails:t}})=>nR({sketchDetails:t}),"Can make selection horizontal":({context:{selectionRanges:t}})=>{const e=M5(t,"horizontal");return pt(e)?!1:e.enabled},"Can make selection vertical":({context:{selectionRanges:t}})=>{const e=M5(t,"vertical");return pt(e)?!1:e.enabled},"Can constrain horizontal distance":({context:{selectionRanges:t}})=>{const e=Ip({selectionRanges:t,constraint:"setHorzDistance"});return pt(e)?!1:e.enabled},"Can constrain vertical distance":({context:{selectionRanges:t}})=>{const e=Ip({selectionRanges:t,constraint:"setVertDistance"});return pt(e)?!1:e.enabled},"Can constrain ABS X":({context:{selectionRanges:t}})=>{const e=Op({selectionRanges:t,constraint:"xAbs"});return pt(e)?!1:e.enabled},"Can constrain ABS Y":({context:{selectionRanges:t}})=>{const e=Op({selectionRanges:t,constraint:"yAbs"});return pt(e)?!1:e.enabled},"Can constrain angle":({context:{selectionRanges:t}})=>{const e=P6({selectionRanges:t});if(pt(e))return!1;const n=N5({selectionRanges:t,angleOrLength:"setAngle"});return pt(n)?!1:e.enabled||n.enabled},"Can constrain length":({context:{selectionRanges:t}})=>{const e=N5({selectionRanges:t});return pt(e)?!1:e.enabled},"Can constrain perpendicular distance":({context:{selectionRanges:t}})=>{const e=AZ({selectionRanges:t});return pt(e)?!1:e.enabled},"Can constrain horizontally align":({context:{selectionRanges:t}})=>{const e=Ip({selectionRanges:t,constraint:"setHorzDistance"});return pt(e)?!1:e.enabled},"Can constrain vertically align":({context:{selectionRanges:t}})=>{const e=Ip({selectionRanges:t,constraint:"setHorzDistance"});return pt(e)?!1:e.enabled},"Can constrain snap to X":({context:{selectionRanges:t}})=>{const e=Op({selectionRanges:t,constraint:"snapToXAxis"});return pt(e)?!1:e.enabled},"Can constrain snap to Y":({context:{selectionRanges:t}})=>{const e=Op({selectionRanges:t,constraint:"snapToYAxis"});return pt(e)?!1:e.enabled},"Can constrain equal length":({context:{selectionRanges:t}})=>{const e=cZ({selectionRanges:t});return pt(e)?!1:e.enabled},"Can canstrain parallel":({context:{selectionRanges:t}})=>{const e=fZ({selectionRanges:t});return ie(e)?!1:e.enabled},"Can constrain remove constraints":({context:{selectionRanges:t},event:e})=>{if(e.type!=="Constrain remove constraints")return!1;const n=hZ({selectionRanges:t,pathToNodes:e.data&&[e.data]});return pt(n)?!1:n.enabled},"Can convert to variable":({event:t})=>{if(t.type!=="Convert to variable"||!t.data)return!1;const e=Rr(wr(be.ast));if(ie(e))return!1;const n=fI(e,t.data.pathToNode);return ie(n)?!1:n.isSafe},"next is tangential arc":({context:{sketchDetails:t,currentTool:e}})=>e==="tangentialArc"&&nR({sketchDetails:t}),"next is rectangle":({context:{sketchDetails:t,currentTool:e}})=>e==="rectangle"&&G_({sketchDetails:t}),"next is circle":({context:{sketchDetails:t,currentTool:e}})=>e==="circle"&&G_({sketchDetails:t}),"next is line":({context:t})=>t.currentTool==="line","next is none":({context:t})=>t.currentTool==="none"},actions:{"assign tool in context":An({currentTool:({event:t})=>"data"in t&&t.data&&"tool"in t.data?t.data.tool:"none"}),"enter sketching mode":An({currentMode:"sketching"}),"enter modeling mode":An({currentMode:"modeling"}),"set sketchMetadata from pathToNode":An(({context:{sketchDetails:t}})=>!(t!=null&&t.sketchPathToNode)||!t?{}:{sketchDetails:{...t,sketchPathToNode:t.sketchPathToNode}}),"hide default planes":()=>be.hidePlanes(),"reset sketch metadata":An({sketchDetails:null,sketchEnginePathId:"",sketchPlaneId:""}),"reset camera position":()=>{je.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_look_at",center:{x:0,y:0,z:0},vantage:{x:0,y:-1250,z:580},up:{x:0,y:0,z:1}}})},"set new sketch metadata":An(({event:t})=>t.type!=="xstate.done.actor.animate-to-sketch"&&t.type!=="xstate.done.actor.animate-to-face"?{}:{sketchDetails:t.output}),"AST extrude":({context:{store:t},event:e})=>{e.type==="Extrude"&&(async()=>{var u,d,f;if(!e.data)return;const{selection:n,distance:r}=e.data;let i=be.ast;if("variableName"in r&&r.variableName&&r.insertIndex!==void 0){const h=[...i.body];h.splice(r.insertIndex,0,r.variableDeclarationAst),i.body=h}const s=un(i,n.codeBasedSelections[0].range),o=ywe(i,s,!1,"variableName"in r?r.variableIdentifierAst:r.valueAst);if(pt(o))return;const{modifiedAst:a,pathToExtrudeArg:l}=o;(u=t.videoElement)==null||u.pause();const c=await be.updateAst(a,!0,{focusPath:[l],zoomToFit:!0,zoomOnRangeAndType:{range:n.codeBasedSelections[0].range,type:"path"}});(d=je.engineConnection)!=null&&d.idleMode||(f=t.videoElement)==null||f.play().catch(h=>{console.warn("Video playing was prevented",h)}),c!=null&&c.selections&&Ot.selectRange(c==null?void 0:c.selections)})().catch(Bt)},"AST revolve":({context:{store:t},event:e})=>{e.type==="Revolve"&&(async()=>{var u,d,f;if(!e.data)return;const{selection:n,angle:r}=e.data;let i=be.ast;if("variableName"in r&&r.variableName&&r.insertIndex!==void 0){const h=[...i.body];h.splice(r.insertIndex,0,r.variableDeclarationAst),i.body=h}const s=un(i,n.codeBasedSelections[0].range),o=vwe(i,s,!1,"variableName"in r?r.variableIdentifierAst:r.valueAst);if(pt(o))return;const{modifiedAst:a,pathToRevolveArg:l}=o;(u=t.videoElement)==null||u.pause();const c=await be.updateAst(a,!0,{focusPath:[l],zoomToFit:!0,zoomOnRangeAndType:{range:n.codeBasedSelections[0].range,type:"path"}});(d=je.engineConnection)!=null&&d.idleMode||(f=t.videoElement)==null||f.play().catch(h=>{console.warn("Video playing was prevented",h)}),c!=null&&c.selections&&Ot.selectRange(c==null?void 0:c.selections)})().catch(Bt)},"AST delete selection":({context:{selectionRanges:t}})=>{(async()=>{let e=be.ast;const n=await Swe(e,t.codeBasedSelections[0],be.programMemory,bI);if(ie(n))return;if((await kl({ast:n,idGenerator:be.execState.idGenerator,useFakeExecutor:!0,engineCommandManager:je})).errors.length){jt.error("Unable to delete part");return}await be.updateAst(n,!0)})().catch(Bt)},"AST fillet":({event:t})=>{if(t.type!=="Fillet"||!t.data)return;const e=be.ast,{selection:n,radius:r}=t.data,i=pke(e,n,r);if(ie(i))return i},"set selection filter to curves only":()=>{(async()=>{await je.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"set_selection_filter",filter:["curve"]}})})().catch(Bt)},"conditionally equip line tool":({event:{type:t}})=>{t==="xstate.done.actor.animate-to-face"&&Ke.modelingSend({type:"change tool",data:{tool:"line"}})},"setup client side sketch segments":({context:{sketchDetails:t,selectionRanges:e}})=>{t&&(async()=>{Object.keys(sn.activeSegments).length>0&&await sn.tearDownSketch({removeAxis:!1}),Ke.resetMouseListeners(),await sn.setupSketch({sketchPathToNode:(t==null?void 0:t.sketchPathToNode)||[],forward:t.zAxis,up:t.yAxis,position:t.origin,maybeModdedAst:be.ast,selectionRanges:e}),Ke.resetMouseListeners(),sn.setupSketchIdleCallbacks({pathToNode:(t==null?void 0:t.sketchPathToNode)||[],forward:t.zAxis,up:t.yAxis,position:t.origin})})().catch(Bt)},"tear down client sketch":()=>{sn.activeSegments&&sn.tearDownSketch({removeAxis:!1})},"remove sketch grid":()=>sn.removeSketchGrid(),"set up draft line":({context:{sketchDetails:t}})=>{t&&sn.setUpDraftSegment(t.sketchPathToNode,t.zAxis,t.yAxis,t.origin,"line")},"set up draft arc":({context:{sketchDetails:t}})=>{t&&sn.setUpDraftSegment(t.sketchPathToNode,t.zAxis,t.yAxis,t.origin,"tangentialArcTo")},"listen for rectangle origin":({context:{sketchDetails:t}})=>{t&&sn.setupNoPointsListener({sketchDetails:t,afterClick:e=>{var r;const n=(r=e.intersectionPoint)==null?void 0:r.twoD;n?Ke.modelingSend({type:"Add rectangle origin",data:[n.x,n.y]}):console.error("No intersection point found")}})},"listen for circle origin":({context:{sketchDetails:t}})=>{if(!t)return;sn.createIntersectionPlane();const e=w1(new de(...t.yAxis),new de(...t.zAxis));sn.intersectionPlane&&(sn.intersectionPlane.setRotationFromQuaternion(e),sn.intersectionPlane.position.copy(new de(...(t==null?void 0:t.origin)||[0,0,0]))),Ke.setCallbacks({onClick:n=>{var s;if(!n||n.mouseEvent.which!==1)return;const{intersectionPoint:r}=n;if(!(r!=null&&r.twoD)||!(t!=null&&t.sketchPathToNode))return;const i=(s=n.intersectionPoint)==null?void 0:s.twoD;i?Ke.modelingSend({type:"Add circle origin",data:[i.x,i.y]}):console.error("No intersection point found")}})},"set up draft rectangle":({context:{sketchDetails:t},event:e})=>{e.type==="Add rectangle origin"&&(!t||!e.data||sn.setupDraftRectangle(t.sketchPathToNode,t.zAxis,t.yAxis,t.origin,e.data))},"set up draft circle":({context:{sketchDetails:t},event:e})=>{e.type==="Add circle origin"&&(!t||!e.data||sn.setupDraftCircle(t.sketchPathToNode,t.zAxis,t.yAxis,t.origin,e.data))},"set up draft line without teardown":({context:{sketchDetails:t}})=>{t&&sn.setUpDraftSegment(t.sketchPathToNode,t.zAxis,t.yAxis,t.origin,"line",!1)},"show default planes":()=>{be.showPlanes()},"setup noPoints onClick listener":({context:{sketchDetails:t}})=>{t&&sn.setupNoPointsListener({sketchDetails:t,afterClick:()=>Ke.modelingSend({type:"Add start point"})})},"add axis n grid":({context:{sketchDetails:t}})=>{t&&(localStorage.getItem("disableAxis")||sn.createSketchAxis(t.sketchPathToNode||[],t.zAxis,t.yAxis,t.origin))},"reset client scene mouse handlers":()=>{Ke.resetMouseListeners()},"clientToEngine cam sync direction":()=>{Ke.camControls.syncDirection="clientToEngine"},"engineToClient cam sync direction":()=>{Ke.camControls.syncDirection="engineToClient"},"set selection filter to faces only":()=>{je.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"set_selection_filter",filter:["face","object"]}})},"set selection filter to defaults":()=>be.defaultSelectionFilter(),"Delete segment":({context:{sketchDetails:t},event:e})=>{e.type==="Delete segment"&&(!t||!e.data||K5e({pathToNode:e.data,sketchDetails:t}))},"Reset Segment Overlays":()=>sn.resetOverlays(),"Set context":An({store:({context:{store:t},event:e})=>{if(e.type!=="Set context"||!e.data)return t;const n={...t,...e.data},r={};for(const i of J5e)r[i]=n[i];return typeof window<"u"&&window.localStorage.setItem(JZ,JSON.stringify(r)),n}}),Make:()=>{},"enable copilot":()=>{},"disable copilot":()=>{},"Set selection":()=>{},"Set mouse state":()=>{},"Set Segment Overlays":()=>{},"Center camera on selection":()=>{},"Engine export":()=>{},"Submit to Text-to-CAD API":()=>{},"Set sketchDetails":()=>{},"sketch exit execute":()=>{}},actors:{"do-constrain-remove-constraint":Ht(async({input:{selectionRanges:t,sketchDetails:e,data:n}})=>{const r=Ske({selectionRanges:t,pathToNodes:n&&[n]});if(pt(r))return;const{pathToNodeMap:i}=r;if(!e)return;let s=await sn.updateAstAndRejigSketch(i[0],r.modifiedAst,e.zAxis,e.yAxis,e.origin);if(!pt(s,{suppress:!0})&&s)return{selectionType:"completeSelection",selection:Gi(i,t,s.newAst)}}),"do-constrain-horizontally":Ht(async({input:{selectionRanges:t,sketchDetails:e}})=>{const n=fH(t,"horizontal",be.ast,be.programMemory);if(pt(n))return!1;const{modifiedAst:r,pathToNodeMap:i}=n;if(!e)return;const s=await sn.updateAstAndRejigSketch(e.sketchPathToNode,r,e.zAxis,e.yAxis,e.origin);if(!pt(s,{suppress:!0})&&s)return{selectionType:"completeSelection",selection:Gi(i,t,s.newAst)}}),"do-constrain-vertically":Ht(async({input:{selectionRanges:t,sketchDetails:e}})=>{const n=fH(t,"vertical",be.ast,be.programMemory);if(pt(n))return!1;const{modifiedAst:r,pathToNodeMap:i}=n;if(!e)return;const s=await sn.updateAstAndRejigSketch(e.sketchPathToNode||[],r,e.zAxis,e.yAxis,e.origin);if(!pt(s,{suppress:!0})&&s)return{selectionType:"completeSelection",selection:Gi(i,t,s.newAst)}}),"do-constrain-horizontally-align":Ht(async({input:{selectionRanges:t,sketchDetails:e}})=>{const n=_H({selectionRanges:t,constraint:"setVertDistance"});if(pt(n))return;const{modifiedAst:r,pathToNodeMap:i}=n;if(!e)return;const s=await sn.updateAstAndRejigSketch((e==null?void 0:e.sketchPathToNode)||[],r,e.zAxis,e.yAxis,e.origin);return pt(s,{suppress:!0})||!s?void 0:{selectionType:"completeSelection",selection:Gi(i,t,s.newAst)}}),"do-constrain-vertically-align":Ht(async({input:{selectionRanges:t,sketchDetails:e}})=>{const n=_H({selectionRanges:t,constraint:"setHorzDistance"});if(pt(n))return;const{modifiedAst:r,pathToNodeMap:i}=n;if(!e)return;const s=await sn.updateAstAndRejigSketch((e==null?void 0:e.sketchPathToNode)||[],r,e.zAxis,e.yAxis,e.origin);return pt(s,{suppress:!0})||!s?void 0:{selectionType:"completeSelection",selection:Gi(i,t,s.newAst)}}),"do-constrain-snap-to-x":Ht(async({input:{selectionRanges:t,sketchDetails:e}})=>{const n=BH({selectionRanges:t,constraint:"snapToXAxis"});if(ie(n))return!1;const{modifiedAst:r,pathToNodeMap:i}=n;if(!e)return;const s=await sn.updateAstAndRejigSketch((e==null?void 0:e.sketchPathToNode)||[],r,e.zAxis,e.yAxis,e.origin);return pt(s,{suppress:!0})||!s?void 0:{selectionType:"completeSelection",selection:Gi(i,t,s.newAst)}}),"do-constrain-snap-to-y":Ht(async({input:{selectionRanges:t,sketchDetails:e}})=>{const n=BH({selectionRanges:t,constraint:"snapToYAxis"});if(pt(n))return!1;const{modifiedAst:r,pathToNodeMap:i}=n;if(!e)return;const s=await sn.updateAstAndRejigSketch((e==null?void 0:e.sketchPathToNode)||[],r,e.zAxis,e.yAxis,e.origin);return pt(s,{suppress:!0})||!s?void 0:{selectionType:"completeSelection",selection:Gi(i,t,s.newAst)}}),"do-constrain-parallel":Ht(async({input:{selectionRanges:t,sketchDetails:e}})=>{const n=_ke({selectionRanges:t});if(pt(n))return!1;const{modifiedAst:r,pathToNodeMap:i}=n;if(!e){pt(new Error("No sketch details"));return}const s=await sn.updateAstAndRejigSketch((e==null?void 0:e.sketchPathToNode)||[],Rr(wr(r)),e.zAxis,e.yAxis,e.origin);return pt(s,{suppress:!0})||!s?void 0:{selectionType:"completeSelection",selection:Gi(i,t,s.newAst)}}),"do-constrain-equal-length":Ht(async({input:{selectionRanges:t,sketchDetails:e}})=>{const n=Ake({selectionRanges:t});if(pt(n))return!1;const{modifiedAst:r,pathToNodeMap:i}=n;if(!e)return;const s=await sn.updateAstAndRejigSketch((e==null?void 0:e.sketchPathToNode)||[],r,e.zAxis,e.yAxis,e.origin);return pt(s,{suppress:!0})||!s?void 0:{selectionType:"completeSelection",selection:Gi(i,t,s.newAst)}}),"Get vertical info":Ht(async t=>({})),"Get ABS X info":Ht(async t=>({})),"Get ABS Y info":Ht(async t=>({})),"Get angle info":Ht(async t=>({})),"Get perpendicular distance info":Ht(async t=>({})),"AST-undo-startSketchOn":Ht(async t=>{}),"animate-to-face":Ht(async t=>({})),"animate-to-sketch":Ht(async t=>({})),"Get horizontal info":Ht(async t=>({})),"Get length info":Ht(async t=>({})),"Get convert to variable info":Ht(async t=>({}))}}).createMachine({id:"Modeling",context:({input:t})=>({...tR,...t}),states:{idle:{on:{"Enter sketch":[{target:"animating to existing sketch",guard:"Selection is on face"},"Sketch no face"],Extrude:{target:"idle",guard:"has valid sweep selection",actions:["AST extrude"],reenter:!1},Revolve:{target:"idle",guard:"has valid sweep selection",actions:["AST revolve"],reenter:!1},Fillet:{target:"idle",guard:"has valid fillet selection",actions:["AST fillet"],reenter:!1},Export:{target:"idle",reenter:!1,guard:"Has exportable geometry",actions:"Engine export"},Make:{target:"idle",reenter:!1,guard:"Has exportable geometry",actions:"Make"},"Delete selection":{target:"idle",guard:"has valid selection for deletion",actions:["AST delete selection"],reenter:!1},"Text-to-CAD":{target:"idle",reenter:!1,actions:["Submit to Text-to-CAD API"]}},entry:"reset client scene mouse handlers",states:{hidePlanes:{on:{"Artifact graph populated":"showPlanes"},entry:"hide default planes"},showPlanes:{on:{"Artifact graph emptied":"hidePlanes"},entry:["show default planes","reset camera position","set selection filter to curves only"],description:"We want to disable selections and hover highlights here, because users can't do anything with that information until they actually add something to the scene. The planes are just for orientation here.",exit:"set selection filter to defaults"}},initial:"hidePlanes"},Sketch:{states:{SketchIdle:{on:{"Make segment vertical":{guard:"Can make selection vertical",target:"Await constrain vertically"},"Make segment horizontal":{guard:"Can make selection horizontal",target:"Await constrain horizontally"},"Constrain horizontal distance":{target:"Await horizontal distance info",guard:"Can constrain horizontal distance"},"Constrain vertical distance":{target:"Await vertical distance info",guard:"Can constrain vertical distance"},"Constrain ABS X":{target:"Await ABS X info",guard:"Can constrain ABS X"},"Constrain ABS Y":{target:"Await ABS Y info",guard:"Can constrain ABS Y"},"Constrain angle":{target:"Await angle info",guard:"Can constrain angle"},"Constrain length":{target:"Await length info",guard:"Can constrain length"},"Constrain perpendicular distance":{target:"Await perpendicular distance info",guard:"Can constrain perpendicular distance"},"Constrain horizontally align":{guard:"Can constrain horizontally align",target:"Await constrain horizontally align"},"Constrain vertically align":{guard:"Can constrain vertically align",target:"Await constrain vertically align"},"Constrain snap to X":{guard:"Can constrain snap to X",target:"Await constrain snap to X"},"Constrain snap to Y":{guard:"Can constrain snap to Y",target:"Await constrain snap to Y"},"Constrain equal length":{guard:"Can constrain equal length",target:"Await constrain equal length"},"Constrain parallel":{target:"Await constrain parallel",guard:"Can canstrain parallel"},"Constrain remove constraints":{guard:"Can constrain remove constraints",target:"Await constrain remove constraints"},"Re-execute":{target:"SketchIdle",reenter:!1,actions:["set sketchMetadata from pathToNode"]},"code edit during sketch":"clean slate","Convert to variable":{target:"Await convert to variable",guard:"Can convert to variable"},"change tool":{target:"Change Tool"}},entry:"setup client side sketch segments"},"Await horizontal distance info":{invoke:{src:"Get horizontal info",id:"get-horizontal-info",input:({context:{selectionRanges:t,sketchDetails:e}})=>({selectionRanges:t,sketchDetails:e}),onDone:{target:"SketchIdle",actions:"Set selection"},onError:"SketchIdle"}},"Await vertical distance info":{invoke:{src:"Get vertical info",id:"get-vertical-info",input:({context:{selectionRanges:t,sketchDetails:e}})=>({selectionRanges:t,sketchDetails:e}),onDone:{target:"SketchIdle",actions:"Set selection"},onError:"SketchIdle"}},"Await ABS X info":{invoke:{src:"Get ABS X info",id:"get-abs-x-info",input:({context:{selectionRanges:t,sketchDetails:e}})=>({selectionRanges:t,sketchDetails:e}),onDone:{target:"SketchIdle",actions:"Set selection"},onError:"SketchIdle"}},"Await ABS Y info":{invoke:{src:"Get ABS Y info",id:"get-abs-y-info",input:({context:{selectionRanges:t,sketchDetails:e}})=>({selectionRanges:t,sketchDetails:e}),onDone:{target:"SketchIdle",actions:"Set selection"},onError:"SketchIdle"}},"Await angle info":{invoke:{src:"Get angle info",id:"get-angle-info",input:({context:{selectionRanges:t,sketchDetails:e}})=>({selectionRanges:t,sketchDetails:e}),onDone:{target:"SketchIdle",actions:"Set selection"},onError:"SketchIdle"}},"Await length info":{invoke:{src:"Get length info",id:"get-length-info",input:({context:{selectionRanges:t,sketchDetails:e}})=>({selectionRanges:t,sketchDetails:e}),onDone:{target:"SketchIdle",actions:"Set selection"},onError:"SketchIdle"}},"Await perpendicular distance info":{invoke:{src:"Get perpendicular distance info",id:"get-perpendicular-distance-info",input:({context:{selectionRanges:t,sketchDetails:e}})=>({selectionRanges:t,sketchDetails:e}),onDone:{target:"SketchIdle",actions:"Set selection"},onError:"SketchIdle"}},"Line tool":{exit:[],states:{Init:{always:[{target:"normal",guard:"has made first point",actions:"set up draft line"},"No Points"]},normal:{},"No Points":{entry:"setup noPoints onClick listener",on:{"Add start point":{target:"normal",actions:"set up draft line without teardown"},Cancel:"#Modeling.Sketch.undo startSketchOn"}}},initial:"Init",on:{"change tool":{target:"Change Tool"}}},Init:{always:[{target:"SketchIdle",guard:"is editing existing sketch"},"Line tool"]},"Tangential arc to":{entry:"set up draft arc",on:{"change tool":{target:"Change Tool"}}},"undo startSketchOn":{invoke:{src:"AST-undo-startSketchOn",id:"AST-undo-startSketchOn",input:({context:{sketchDetails:t}})=>({sketchDetails:t}),onDone:{target:"#Modeling.idle",actions:"enter modeling mode"}}},"Rectangle tool":{entry:["listen for rectangle origin"],states:{"Awaiting second corner":{on:{"Finish rectangle":"Finished Rectangle"}},"Awaiting origin":{on:{"Add rectangle origin":{target:"Awaiting second corner",actions:"set up draft rectangle"}}},"Finished Rectangle":{always:"#Modeling.Sketch.SketchIdle"}},initial:"Awaiting origin",on:{"change tool":{target:"Change Tool"}}},"clean slate":{always:"SketchIdle"},"Await convert to variable":{invoke:{src:"Get convert to variable info",id:"get-convert-to-variable-info",input:({context:{selectionRanges:t,sketchDetails:e},event:n})=>n.type!=="Convert to variable"?{selectionRanges:t,sketchDetails:e,data:void 0}:{selectionRanges:t,sketchDetails:e,data:n.data},onError:"SketchIdle",onDone:{target:"SketchIdle",actions:["Set selection"]}}},"Await constrain remove constraints":{invoke:{src:"do-constrain-remove-constraint",id:"do-constrain-remove-constraint",input:({context:{selectionRanges:t,sketchDetails:e},event:n})=>({selectionRanges:t,sketchDetails:e,data:n.type==="Constrain remove constraints"?n.data:void 0}),onDone:{target:"SketchIdle",actions:"Set selection"}}},"Await constrain horizontally":{invoke:{src:"do-constrain-horizontally",id:"do-constrain-horizontally",input:({context:{selectionRanges:t,sketchDetails:e}})=>({selectionRanges:t,sketchDetails:e}),onDone:{target:"SketchIdle",actions:"Set selection"}}},"Await constrain vertically":{invoke:{src:"do-constrain-vertically",id:"do-constrain-vertically",input:({context:{selectionRanges:t,sketchDetails:e}})=>({selectionRanges:t,sketchDetails:e}),onDone:{target:"SketchIdle",actions:"Set selection"}}},"Await constrain horizontally align":{invoke:{src:"do-constrain-horizontally-align",id:"do-constrain-horizontally-align",input:({context:t})=>({selectionRanges:t.selectionRanges,sketchDetails:t.sketchDetails}),onDone:{target:"SketchIdle",actions:"Set selection"}}},"Await constrain vertically align":{invoke:{src:"do-constrain-vertically-align",id:"do-constrain-vertically-align",input:({context:t})=>({selectionRanges:t.selectionRanges,sketchDetails:t.sketchDetails}),onDone:{target:"SketchIdle",actions:"Set selection"}}},"Await constrain snap to X":{invoke:{src:"do-constrain-snap-to-x",id:"do-constrain-snap-to-x",input:({context:t})=>({selectionRanges:t.selectionRanges,sketchDetails:t.sketchDetails}),onDone:{target:"SketchIdle",actions:"Set selection"}}},"Await constrain snap to Y":{invoke:{src:"do-constrain-snap-to-y",id:"do-constrain-snap-to-y",input:({context:t})=>({selectionRanges:t.selectionRanges,sketchDetails:t.sketchDetails}),onDone:{target:"SketchIdle",actions:"Set selection"}}},"Await constrain equal length":{invoke:{src:"do-constrain-equal-length",id:"do-constrain-equal-length",input:({context:t})=>({selectionRanges:t.selectionRanges,sketchDetails:t.sketchDetails}),onDone:{target:"SketchIdle",actions:"Set selection"}}},"Await constrain parallel":{invoke:{src:"do-constrain-parallel",id:"do-constrain-parallel",input:({context:t})=>({selectionRanges:t.selectionRanges,sketchDetails:t.sketchDetails}),onDone:{target:"SketchIdle",actions:"Set selection"}}},"Change Tool":{always:[{target:"SketchIdle",guard:"next is none"},{target:"Line tool",guard:"next is line"},{target:"Rectangle tool",guard:"next is rectangle"},{target:"Tangential arc to",guard:"next is tangential arc"},{target:"Circle tool",guard:"next is circle"}],entry:"assign tool in context"},"Circle tool":{on:{"change tool":"Change Tool"},states:{"Awaiting origin":{on:{"Add circle origin":{target:"Awaiting Radius",actions:"set up draft circle"}}},"Awaiting Radius":{on:{"Finish circle":"Finished Circle"}},"Finished Circle":{always:"#Modeling.Sketch.SketchIdle"}},initial:"Awaiting origin",entry:"listen for circle origin"}},initial:"Init",on:{CancelSketch:".SketchIdle","Delete segment":{reenter:!1,actions:["Delete segment","Set sketchDetails"]},"code edit during sketch":".clean slate"},exit:["sketch exit execute","tear down client sketch","remove sketch grid","engineToClient cam sync direction","Reset Segment Overlays","enable copilot"],entry:["add axis n grid","conditionally equip line tool","clientToEngine cam sync direction"]},"Sketch no face":{entry:["disable copilot","show default planes","set selection filter to faces only","enter sketching mode"],exit:["hide default planes","set selection filter to defaults"],on:{"Select default plane":{target:"animating to plane",actions:["reset sketch metadata"]}}},"animating to plane":{invoke:{src:"animate-to-face",id:"animate-to-face",input:({event:t})=>{if(t.type==="Select default plane")return t.data},onDone:{target:"Sketch",actions:"set new sketch metadata"},onError:"Sketch no face"}},"animating to existing sketch":{invoke:{src:"animate-to-sketch",id:"animate-to-sketch",input:({context:t})=>({selectionRanges:t.selectionRanges,sketchDetails:t.sketchDetails}),onDone:{target:"Sketch",actions:["disable copilot","set new sketch metadata","enter sketching mode"]}}}},initial:"idle",on:{Cancel:{target:".idle",actions:["reset sketch metadata","enable copilot","enter modeling mode"]},"Set selection":{reenter:!1,actions:"Set selection"},"Set mouse state":{reenter:!1,actions:"Set mouse state"},"Set context":{reenter:!1,actions:"Set context"},"Set Segment Overlays":{reenter:!1,actions:"Set Segment Overlays"},"Center camera on selection":{reenter:!1,actions:"Center camera on selection"}}});function nR({sketchDetails:t}){if(!(t!=null&&t.sketchPathToNode))return!1;const e=Xe(be.ast,t.sketchPathToNode,"VariableDeclarator");if(ie(e)||e.node.type!=="VariableDeclarator")return!1;const n=e.node.init;if(n.type!=="PipeExpression")return!1;const r=n.body.some(s=>s.type==="CallExpression"&&s.callee.name==="startProfileAt"),i=n.body.some(s=>s.type==="CallExpression"&&s.callee.name==="circle");return r&&n.body.length>2||i}function eRe({sketchDetails:t}){if(!(t!=null&&t.sketchPathToNode))return!1;const e=Xe(be.ast,t.sketchPathToNode,"VariableDeclarator");if(ie(e)||e.node.type!=="VariableDeclarator")return!1;const n=e.node.init;return n.type!=="PipeExpression"?!1:n.body.some(i=>i.type==="CallExpression"&&i.callee.name==="circle")}function G_({sketchDetails:t}){var n,r,i;const e=Xe(be.ast,(t==null?void 0:t.sketchPathToNode)||[],"VariableDeclaration");return ie(e)?!1:((i=(r=(n=e.node)==null?void 0:n.declarations)==null?void 0:r[0])==null?void 0:i.init.type)!=="PipeExpression"}function tRe({sketchDetails:t}){var n,r,i;const e=Xe(be.ast,(t==null?void 0:t.sketchPathToNode)||[],"VariableDeclaration");return ie(e)||((i=(r=(n=e.node)==null?void 0:n.declarations)==null?void 0:r[0])==null?void 0:i.init.type)!=="PipeExpression"?!1:e.node.declarations[0].init.body.some(s=>s.type==="CallExpression"&&(s.callee.name==="close"||s.callee.name==="circle"))}function nRe(t,e,n,r={pool:null,theme:Zn.System,highlightEdges:!0,enableSSAO:!0,showScaleGrid:!1,cameraProjection:"perspective"},i){var f,h;const s=Lg(),{pingPongHealth:o,immediateState:a}=s,{setAppState:l}=JI(),{setMediaStream:c}=bJ(),u=P.useRef(!1);r.pool&&(je.settings.pool=r.pool);const d=()=>{var m,g;const{width:A,height:p}=fB(((m=t==null?void 0:t.current)==null?void 0:m.offsetWidth)??0,((g=t==null?void 0:t.current)==null?void 0:g.offsetHeight)??0);je.start({setMediaStream:y=>c(y),setIsStreamReady:y=>l({isStreamReady:y}),width:A,height:p,token:i,settings:r,makeDefaultPlanes:()=>vbe(be.engineCommandManager),modifyGrid:y=>bbe(be.engineCommandManager,y)}),u.current=!0};P.useLayoutEffect(()=>{var m,g;const{width:A,height:p}=fB(((m=t==null?void 0:t.current)==null?void 0:m.offsetWidth)??0,((g=t==null?void 0:t.current)==null?void 0:g.offsetHeight)??0);!u.current&&p&&A&&d()},[(f=t==null?void 0:t.current)==null?void 0:f.offsetWidth,(h=t==null?void 0:t.current)==null?void 0:h.offsetHeight,e]),P.useEffect(()=>{o==="TIMEOUT"&&je.tearDown()},[o]),P.useEffect(()=>{const A=setInterval(()=>{a.type===No.Disconnected&&(je.engineConnection=void 0,d())},3e3);return()=>{clearInterval(A)}},[a]),P.useEffect(()=>{je.settings=r;const A=Ty(()=>{var x,C;const{width:w,height:v}=fB(((x=t==null?void 0:t.current)==null?void 0:x.offsetWidth)??0,((C=t==null?void 0:t.current)==null?void 0:C.offsetHeight)??0);je.handleResize({streamWidth:w,streamHeight:v})},500),p=()=>{d()},m=()=>{var w,v;window.document.visibilityState==="visible"&&!((w=je.engineConnection)!=null&&w.isReady())&&!((v=je.engineConnection)!=null&&v.isConnecting())&&d()};window.document.addEventListener("visibilitychange",m);const g=()=>{var C,_;const w=!((C=je.engineConnection)!=null&&C.isReady())&&!((_=je.engineConnection)!=null&&_.isConnecting()),v=je.engineConnection,x=(v==null?void 0:v.state.type)===No.Disconnecting&&(v==null?void 0:v.state.value.type)===ng.Pause;(w||x)&&(je.engineConnection=void 0,d())};window.document.addEventListener("keydown",g),window.document.addEventListener("mousemove",g),window.document.addEventListener("mousedown",g),window.document.addEventListener("scroll",g),window.document.addEventListener("touchstart",g);const y=()=>{je.tearDown()};return window.addEventListener("online",p),window.addEventListener("offline",y),window.addEventListener("resize",A),()=>{window.document.removeEventListener("visibilitychange",m),window.document.removeEventListener("keydown",g),window.document.removeEventListener("mousemove",g),window.document.removeEventListener("mousedown",g),window.document.removeEventListener("scroll",g),window.document.removeEventListener("touchstart",g),window.removeEventListener("online",p),window.removeEventListener("offline",y),window.removeEventListener("resize",A)}},[...Object.values(r)])}function fB(t,e){const i=t||0,s=e||0,o=Math.min(Math.min(2e3/i,2e3/s),1),a=Math.round(i*o/4)*4,l=Math.round(s*o/4)*4;return{width:a,height:l}}function rR(){return rR=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},rR.apply(null,arguments)}var eee=["shift","alt","meta","mod","ctrl"],rRe={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function vd(t){return(t&&rRe[t]||t||"").trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function iRe(t){return eee.includes(t)}function hB(t,e){return e===void 0&&(e=","),t.split(e)}function AB(t,e,n){e===void 0&&(e="+");var r=t.toLocaleLowerCase().split(e).map(function(o){return vd(o)}),i={alt:r.includes("alt"),ctrl:r.includes("ctrl")||r.includes("control"),shift:r.includes("shift"),meta:r.includes("meta"),mod:r.includes("mod")},s=r.filter(function(o){return!eee.includes(o)});return rR({},i,{keys:s,description:n})}(function(){typeof document<"u"&&(document.addEventListener("keydown",function(t){t.key!==void 0&&tee([vd(t.key),vd(t.code)])}),document.addEventListener("keyup",function(t){t.key!==void 0&&nee([vd(t.key),vd(t.code)])})),typeof window<"u"&&window.addEventListener("blur",function(){bd.clear()})})();var bd=new Set;function V6(t){return Array.isArray(t)}function sRe(t,e){e===void 0&&(e=",");var n=V6(t)?t:t.split(e);return n.every(function(r){return bd.has(r.trim().toLowerCase())})}function tee(t){var e=Array.isArray(t)?t:[t];bd.has("meta")&&bd.forEach(function(n){return!iRe(n)&&bd.delete(n.toLowerCase())}),e.forEach(function(n){return bd.add(n.toLowerCase())})}function nee(t){var e=Array.isArray(t)?t:[t];t==="meta"?bd.clear():e.forEach(function(n){return bd.delete(n.toLowerCase())})}function oRe(t,e,n){(typeof n=="function"&&n(t,e)||n===!0)&&t.preventDefault()}function aRe(t,e,n){return typeof n=="function"?n(t,e):n===!0||n===void 0}function lRe(t){return ree(t,["input","textarea","select"])}function ree(t,e){var n=t.target;e===void 0&&(e=!1);var r=n&&n.tagName;return V6(e)?!!(r&&e&&e.some(function(i){return i.toLowerCase()===r.toLowerCase()})):!!(r&&e&&e===!0)}function cRe(t,e){return t.length===0&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):e?t.some(function(n){return e.includes(n)})||t.includes("*"):!0}var uRe=function(e,n,r){r===void 0&&(r=!1);var i=n.alt,s=n.meta,o=n.mod,a=n.shift,l=n.ctrl,c=n.keys,u=e.key,d=e.code,f=e.ctrlKey,h=e.metaKey,A=e.shiftKey,p=e.altKey,m=vd(d),g=u.toLowerCase();if(!(c!=null&&c.includes(m))&&!(c!=null&&c.includes(g))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(m))return!1;if(!r){if(i===!p&&g!=="alt"||a===!A&&g!=="shift")return!1;if(o){if(!h&&!f)return!1}else if(s===!h&&g!=="meta"&&g!=="os"||l===!f&&g!=="ctrl"&&g!=="control")return!1}return c&&c.length===1&&(c.includes(g)||c.includes(m))?!0:c?sRe(c):!c},iee=P.createContext(void 0),dRe=function(){return P.useContext(iee)};function fRe(t){var e=t.addHotkey,n=t.removeHotkey,r=t.children;return b.jsx(iee.Provider,{value:{addHotkey:e,removeHotkey:n},children:r})}function G6(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce(function(n,r){return n&&G6(t[r],e[r])},!0):t===e}var see=P.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),hRe=function(){return P.useContext(see)},ARe=function(e){var n=e.initiallyActiveScopes,r=n===void 0?["*"]:n,i=e.children,s=P.useState((r==null?void 0:r.length)>0?r:["*"]),o=s[0],a=s[1],l=P.useState([]),c=l[0],u=l[1],d=P.useCallback(function(m){a(function(g){return g.includes("*")?[m]:Array.from(new Set([].concat(g,[m])))})},[]),f=P.useCallback(function(m){a(function(g){return g.filter(function(y){return y!==m}).length===0?["*"]:g.filter(function(y){return y!==m})})},[]),h=P.useCallback(function(m){a(function(g){return g.includes(m)?g.filter(function(y){return y!==m}).length===0?["*"]:g.filter(function(y){return y!==m}):g.includes("*")?[m]:Array.from(new Set([].concat(g,[m])))})},[]),A=P.useCallback(function(m){u(function(g){return[].concat(g,[m])})},[]),p=P.useCallback(function(m){u(function(g){return g.filter(function(y){return!G6(y,m)})})},[]);return b.jsx(see.Provider,{value:{enabledScopes:o,hotkeys:c,enableScope:d,disableScope:f,toggleScope:h},children:b.jsx(fRe,{addHotkey:A,removeHotkey:p,children:i})})};function pRe(t){var e=P.useRef(void 0);return G6(e.current,t)||(e.current=t),e.current}var ij=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},mRe=typeof window<"u"?P.useLayoutEffect:P.useEffect;function Tr(t,e,n,r){var i=P.useState(null),s=i[0],o=i[1],a=P.useRef(!1),l=n instanceof Array?r instanceof Array?void 0:r:n,c=V6(t)?t.join(l==null?void 0:l.splitKey):t,u=n instanceof Array?n:r instanceof Array?r:void 0,d=P.useCallback(e,u??[]),f=P.useRef(d);u?f.current=d:f.current=e;var h=pRe(l),A=hRe(),p=A.enabledScopes,m=dRe();return mRe(function(){if(!((h==null?void 0:h.enabled)===!1||!cRe(p,h==null?void 0:h.scopes))){var g=function(C,_){var S;if(_===void 0&&(_=!1),!(lRe(C)&&!ree(C,h==null?void 0:h.enableOnFormTags))){if(s!==null){var E=s.getRootNode();if((E instanceof Document||E instanceof ShadowRoot)&&E.activeElement!==s&&!s.contains(E.activeElement)){ij(C);return}}(S=C.target)!=null&&S.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||hB(c,h==null?void 0:h.splitKey).forEach(function(T){var R,k=AB(T,h==null?void 0:h.combinationKey);if(uRe(C,k,h==null?void 0:h.ignoreModifiers)||(R=k.keys)!=null&&R.includes("*")){if(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(C)||_&&a.current)return;if(oRe(C,k,h==null?void 0:h.preventDefault),!aRe(C,k,h==null?void 0:h.enabled)){ij(C);return}f.current(C,k),_||(a.current=!0)}})}},y=function(C){C.key!==void 0&&(tee(vd(C.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&g(C))},w=function(C){C.key!==void 0&&(nee(vd(C.code)),a.current=!1,h!=null&&h.keyup&&g(C,!0))},v=s||(l==null?void 0:l.document)||document;return v.addEventListener("keyup",w),v.addEventListener("keydown",y),m&&hB(c,h==null?void 0:h.splitKey).forEach(function(x){return m.addHotkey(AB(x,h==null?void 0:h.combinationKey,h==null?void 0:h.description))}),function(){v.removeEventListener("keyup",w),v.removeEventListener("keydown",y),m&&hB(c,h==null?void 0:h.splitKey).forEach(function(x){return m.removeHotkey(AB(x,h==null?void 0:h.combinationKey,h==null?void 0:h.description))})}}},[s,c,h,p]),o}const gRe={"Enter sketch":{description:"Enter sketch mode.",icon:"sketch"},"change tool":[{description:"Start drawing straight lines.",icon:"line",displayName:"Line",args:{tool:{defaultValue:"line",required:!0,skip:!0,inputType:"string"}}},{description:"Start drawing an arc tangent to the current segment.",icon:"arc",displayName:"Tangential Arc",args:{tool:{defaultValue:"tangentialArc",required:!0,skip:!0,inputType:"string"}}},{description:"Start drawing a rectangle.",icon:"rectangle",displayName:"Rectangle",args:{tool:{defaultValue:"rectangle",required:!0,skip:!0,inputType:"string"}}}],Export:{description:"Export the current model.",icon:"floppyDiskArrow",needsReview:!0,args:{type:{inputType:"options",defaultValue:"gltf",required:!0,options:[{name:"glTF",isCurrent:!0,value:"gltf"},{name:"OBJ",isCurrent:!1,value:"obj"},{name:"STL",isCurrent:!1,value:"stl"},{name:"STEP",isCurrent:!1,value:"step"},{name:"PLY",isCurrent:!1,value:"ply"}]},storage:{inputType:"options",defaultValue:t=>{switch(t.argumentsToSubmit.type){case"gltf":return"embedded";case"stl":return"ascii";case"ply":return"ascii";default:return}},skip:!0,required:t=>["gltf","stl","ply"].includes(t.argumentsToSubmit.type),options:t=>{switch(t.argumentsToSubmit.type){case"gltf":return[{name:"embedded",isCurrent:!0,value:"embedded"},{name:"binary",isCurrent:!1,value:"binary"},{name:"standard",isCurrent:!1,value:"standard"}];case"stl":return[{name:"binary",isCurrent:!1,value:"binary"},{name:"ascii",isCurrent:!0,value:"ascii"}];case"ply":return[{name:"ascii",isCurrent:!0,value:"ascii"},{name:"binary_big_endian",isCurrent:!1,value:"binary_big_endian"},{name:"binary_little_endian",isCurrent:!1,value:"binary_little_endian"}];default:return[]}}}}},Make:{hide:"web",displayName:"Make",description:"Export the current part and send to a 3D printer on the network.",icon:"printer3d",needsReview:!0,args:{machine:{inputType:"options",required:!0,valueSummary:t=>t.make_model.model||t.make_model.manufacturer||"Unknown Machine",options:()=>Object.entries(va.machines).map(([t,e])=>{var n;return{name:`${e.id} (${e.make_model.model||e.make_model.manufacturer}) (${e.state.state})`+(e.hardware_configuration&&e.hardware_configuration.type!=="none"&&e.hardware_configuration.config.nozzle_diameter?` - Nozzle Diameter: ${e.hardware_configuration.config.nozzle_diameter}`:"")+(e.hardware_configuration&&e.hardware_configuration.type!=="none"&&e.hardware_configuration.config.filaments&&e.hardware_configuration.config.filaments[0]?` - ${e.hardware_configuration.config.filaments[0].name} #${e.hardware_configuration.config&&((n=e.hardware_configuration.config.filaments[0].color)==null?void 0:n.slice(0,6))}`:""),isCurrent:!1,disabled:e.state.state!=="idle",value:e}}),defaultValue:()=>Object.values(va.machines)[0]}}},Extrude:{description:"Pull a sketch into 3D along its normal or perpendicular.",icon:"extrude",needsReview:!0,args:{selection:{inputType:"selection",selectionTypes:["extrude-wall","start-cap","end-cap"],multiple:!1,required:!0,skip:!0},distance:{inputType:"kcl",defaultValue:_7,required:!0}}},Revolve:{description:"Create a 3D body by rotating a sketch region about an axis.",icon:"revolve",needsReview:!0,args:{selection:{inputType:"selection",selectionTypes:["extrude-wall","start-cap","end-cap"],multiple:!1,required:!0,skip:!0},angle:{inputType:"kcl",defaultValue:Tbe,required:!0}}},Fillet:{description:"Fillet edge",icon:"fillet",needsReview:!0,args:{selection:{inputType:"selection",selectionTypes:["default","line-end","line-mid","extrude-wall","solid2D","start-cap","end-cap","point","edge","line","arc","all"],multiple:!0,required:!0,skip:!1,warningMessage:"Fillets cannot touch other fillets yet. This is under development."},radius:{inputType:"kcl",defaultValue:_7,required:!0}}},"Text-to-CAD":{description:"Use the Zoo Text-to-CAD API to generate part starters.",icon:"chat",args:{prompt:{inputType:"text",required:!0}}}};async function sj({format:t}){return je.sendSceneCommand({type:"modeling_cmd_req",cmd:{type:"export",entity_ids:[],format:t},cmd_id:Yt()})}const yRe=O2,vRe=({isOpen:t,onResolve:e,onReject:n,valueName:r})=>{const{isNewVariableNameUnique:i,newVariableName:s,setNewVariableName:o}=F2({value:"",initialVariableName:r});return b.jsx(Ci,{appear:!0,show:t,as:P.Fragment,children:b.jsxs(ir,{as:"div",className:"fixed inset-0 z-40 overflow-y-auto p-4 pt-[25vh]",onClose:n,children:[b.jsx(Ci.Child,{as:P.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-75",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:b.jsx(ir.Overlay,{className:"fixed inset-0 bg-chalkboard-10/70 dark:bg-chalkboard-110/50"})}),b.jsx(Ci.Child,{as:P.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:b.jsx(ir.Panel,{className:"rounded relative mx-auto px-4 py-8 bg-chalkboard-10 dark:bg-chalkboard-100 border dark:border-chalkboard-70 max-w-xl w-full shadow-lg",children:b.jsxs("form",{onSubmit:a=>{a.preventDefault(),e({variableName:s}),Zr.success(`Added variable ${s}`)},children:[b.jsx(M6,{setNewVariableName:o,newVariableName:s,isNewVariableNameUnique:i,shouldCreateVariable:!0,showCheckbox:!1}),b.jsxs("div",{className:"mt-8 flex justify-between",children:[b.jsx($t,{Element:"button",onClick:()=>n(!1),children:"Cancel"}),b.jsx($t,{Element:"button",type:"submit",disabled:!i,iconStart:{icon:"plus"},children:"Add variable"})]})]})})})]})})},oee=yRe(vRe);function bRe(t){const{ast:e}=uc(),{context:n}=Ti(),[r,i]=P.useState(!1);P.useEffect(()=>{Ot.convertToVariableEnabled=r},[r]),P.useEffect(()=>{var f,h;const a=eX(e,((h=(f=n.selectionRanges.codeBasedSelections)==null?void 0:f[0])==null?void 0:h.range)||[]);if(pt(a))return;const{isSafe:l,value:c}=a,u=l&&c.type!=="Identifier",d=n.selectionRanges.codeBasedSelections.length===1;i(u&&d)},[n.selectionRanges]);const s=async o=>{try{const{variableName:a}=await oee({valueName:o||"var"}),{modifiedAst:l,pathToReplacedNode:c}=Cwe(e,be.programMemory,t||n.selectionRanges.codeBasedSelections[0].range,a);return await be.updateAst(l,!0),c}catch(a){console.log("error",a)}};return Ot.convertToVariableCallback=Li(s,Bt),{enable:r,handleClick:s}}class wRe extends sA{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(n){return new ERe(n)}),this.register(function(n){return new TRe(n)}),this.register(function(n){return new FRe(n)}),this.register(function(n){return new NRe(n)}),this.register(function(n){return new DRe(n)}),this.register(function(n){return new MRe(n)}),this.register(function(n){return new kRe(n)}),this.register(function(n){return new RRe(n)}),this.register(function(n){return new PRe(n)}),this.register(function(n){return new SRe(n)}),this.register(function(n){return new LRe(n)}),this.register(function(n){return new BRe(n)}),this.register(function(n){return new ORe(n)}),this.register(function(n){return new IRe(n)}),this.register(function(n){return new CRe(n)}),this.register(function(n){return new URe(n)}),this.register(function(n){return new HRe(n)})}load(e,n,r,i){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const c=h1.extractUrlBase(e);o=h1.resolveURL(c,this.path)}else o=h1.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){i?i(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new DC(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,o,function(u){n(u),s.manager.itemEnd(e)},a)}catch(u){a(u)}},r,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,n,r,i){let s;const o={},a={},l=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===aee){try{o[pn.KHR_BINARY_GLTF]=new jRe(e)}catch(d){i&&i(d);return}s=JSON.parse(o[pn.KHR_BINARY_GLTF].content)}else s=JSON.parse(l.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new ePe(s,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const d=this.pluginCallbacks[u](c);d.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[d.name]=d,o[d.name]=!0}if(s.extensionsUsed)for(let u=0;u<s.extensionsUsed.length;++u){const d=s.extensionsUsed[u],f=s.extensionsRequired||[];switch(d){case pn.KHR_MATERIALS_UNLIT:o[d]=new _Re;break;case pn.KHR_DRACO_MESH_COMPRESSION:o[d]=new QRe(s,this.dracoLoader);break;case pn.KHR_TEXTURE_TRANSFORM:o[d]=new zRe;break;case pn.KHR_MESH_QUANTIZATION:o[d]=new VRe;break;default:f.indexOf(d)>=0&&a[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function xRe(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const pn={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class CRe{constructor(e){this.parser=e,this.name=pn.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r<i;r++){const s=n[r];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const n=this.parser,r="light:"+e;let i=n.cache.get(r);if(i)return i;const s=n.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let c;const u=new Nt(16777215);l.color!==void 0&&u.setRGB(l.color[0],l.color[1],l.color[2],Ni);const d=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new B0(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new dhe(u),c.distance=d;break;case"spot":c=new che(u),c.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,Bc(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=n.createUniqueName(l.name||"light_"+e),i=Promise.resolve(c),n.cache.add(r,i),i}getDependency(e,n){if(e==="light")return this._loadLight(n)}createNodeAttachment(e){const n=this,r=this.parser,s=r.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return r._getNodeRef(n.cache,a,l)})}}class _Re{constructor(){this.name=pn.KHR_MATERIALS_UNLIT}getMaterialType(){return ei}extendParams(e,n,r){const i=[];e.color=new Nt(1,1,1),e.opacity=1;const s=n.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],Ni),e.opacity=o[3]}s.baseColorTexture!==void 0&&i.push(r.assignTexture(e,"map",s.baseColorTexture,Ki))}return Promise.all(i)}}class SRe{constructor(e){this.parser=e,this.name=pn.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name].emissiveStrength;return s!==void 0&&(n.emissiveIntensity=s),Promise.resolve()}}class ERe{constructor(e){this.parser=e,this.name=pn.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:ac}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];if(o.clearcoatFactor!==void 0&&(n.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(r.assignTexture(n,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(n.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(r.assignTexture(n,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(r.assignTexture(n,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;n.clearcoatNormalScale=new Ze(a,a)}return Promise.all(s)}}class TRe{constructor(e){this.parser=e,this.name=pn.KHR_MATERIALS_DISPERSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:ac}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return n.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class BRe{constructor(e){this.parser=e,this.name=pn.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:ac}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.iridescenceFactor!==void 0&&(n.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(r.assignTexture(n,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(n.iridescenceIOR=o.iridescenceIor),n.iridescenceThicknessRange===void 0&&(n.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&s.push(r.assignTexture(n,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class MRe{constructor(e){this.parser=e,this.name=pn.KHR_MATERIALS_SHEEN}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:ac}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[];n.sheenColor=new Nt(0,0,0),n.sheenRoughness=0,n.sheen=1;const o=i.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;n.sheenColor.setRGB(a[0],a[1],a[2],Ni)}return o.sheenRoughnessFactor!==void 0&&(n.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(r.assignTexture(n,"sheenColorMap",o.sheenColorTexture,Ki)),o.sheenRoughnessTexture!==void 0&&s.push(r.assignTexture(n,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class kRe{constructor(e){this.parser=e,this.name=pn.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:ac}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.transmissionFactor!==void 0&&(n.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(r.assignTexture(n,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class RRe{constructor(e){this.parser=e,this.name=pn.KHR_MATERIALS_VOLUME}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:ac}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];n.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(r.assignTexture(n,"thicknessMap",o.thicknessTexture)),n.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return n.attenuationColor=new Nt().setRGB(a[0],a[1],a[2],Ni),Promise.all(s)}}class PRe{constructor(e){this.parser=e,this.name=pn.KHR_MATERIALS_IOR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:ac}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return n.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class LRe{constructor(e){this.parser=e,this.name=pn.KHR_MATERIALS_SPECULAR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:ac}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];n.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(r.assignTexture(n,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return n.specularColor=new Nt().setRGB(a[0],a[1],a[2],Ni),o.specularColorTexture!==void 0&&s.push(r.assignTexture(n,"specularColorMap",o.specularColorTexture,Ki)),Promise.all(s)}}class IRe{constructor(e){this.parser=e,this.name=pn.EXT_MATERIALS_BUMP}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:ac}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return n.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(r.assignTexture(n,"bumpMap",o.bumpTexture)),Promise.all(s)}}class ORe{constructor(e){this.parser=e,this.name=pn.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:ac}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.anisotropyStrength!==void 0&&(n.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(n.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&s.push(r.assignTexture(n,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class FRe{constructor(e){this.parser=e,this.name=pn.KHR_TEXTURE_BASISU}loadTexture(e){const n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const s=i.extensions[this.name],o=n.options.ktx2Loader;if(!o){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,s.source,o)}}class NRe{constructor(e){this.parser=e,this.name=pn.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class DRe{constructor(e){this.parser=e,this.name=pn.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class URe{constructor(e){this.name=pn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,u=i.count,d=i.byteStride,f=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,d,f,i.mode,i.filter).then(function(h){return h.buffer}):o.ready.then(function(){const h=new ArrayBuffer(u*d);return o.decodeGltfBuffer(new Uint8Array(h),u,d,f,i.mode,i.filter),h})})}else return null}}class HRe{constructor(e){this.name=pn.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==Jo.TRIANGLES&&c.mode!==Jo.TRIANGLE_STRIP&&c.mode!==Jo.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),d=u.isGroup?u.children:[u],f=c[0].count,h=[];for(const A of d){const p=new Zt,m=new de,g=new $s,y=new de(1,1,1),w=new gfe(A.geometry,A.material,f);for(let v=0;v<f;v++)l.TRANSLATION&&m.fromBufferAttribute(l.TRANSLATION,v),l.ROTATION&&g.fromBufferAttribute(l.ROTATION,v),l.SCALE&&y.fromBufferAttribute(l.SCALE,v),w.setMatrixAt(v,p.compose(m,g,y));for(const v in l)if(v==="_COLOR_0"){const x=l[v];w.instanceColor=new EM(x.array,x.itemSize,x.normalized)}else v!=="TRANSLATION"&&v!=="ROTATION"&&v!=="SCALE"&&A.geometry.setAttribute(v,l[v]);Sr.prototype.copy.call(w,A),this.parser.assignFinalMaterial(w),h.push(w)}return u.isGroup?(u.clear(),u.add(...h),u):h[0]}))}}const aee="glTF",p0=12,oj={JSON:1313821514,BIN:5130562};class jRe{constructor(e){this.name=pn.KHR_BINARY_GLTF,this.content=null,this.body=null;const n=new DataView(e,0,p0),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==aee)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-p0,s=new DataView(e,p0);let o=0;for(;o<i;){const a=s.getUint32(o,!0);o+=4;const l=s.getUint32(o,!0);if(o+=4,l===oj.JSON){const c=new Uint8Array(e,p0+o,a);this.content=r.decode(c)}else if(l===oj.BIN){const c=p0+o;this.body=e.slice(c,c+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class QRe{constructor(e,n){if(!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=pn.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=n,this.dracoLoader.preload()}decodePrimitive(e,n){const r=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},l={},c={};for(const u in o){const d=iR[u]||u.toLowerCase();a[d]=o[u]}for(const u in e.attributes){const d=iR[u]||u.toLowerCase();if(o[u]!==void 0){const f=r.accessors[e.attributes[u]],h=om[f.componentType];c[d]=h.name,l[d]=f.normalized===!0}}return n.getDependency("bufferView",s).then(function(u){return new Promise(function(d,f){i.decodeDracoFile(u,function(h){for(const A in h.attributes){const p=h.attributes[A],m=l[A];m!==void 0&&(p.normalized=m)}d(h)},a,c,Ni,f)})})}}class zRe{constructor(){this.name=pn.KHR_TEXTURE_TRANSFORM}extendTexture(e,n){return(n.texCoord===void 0||n.texCoord===e.channel)&&n.offset===void 0&&n.rotation===void 0&&n.scale===void 0||(e=e.clone(),n.texCoord!==void 0&&(e.channel=n.texCoord),n.offset!==void 0&&e.offset.fromArray(n.offset),n.rotation!==void 0&&(e.rotation=n.rotation),n.scale!==void 0&&e.repeat.fromArray(n.scale),e.needsUpdate=!0),e}}class VRe{constructor(){this.name=pn.KHR_MESH_QUANTIZATION}}class lee extends rv{constructor(e,n,r,i){super(e,n,r,i)}copySampleValue_(e){const n=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let o=0;o!==i;o++)n[o]=r[s+o];return n}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,c=a*3,u=i-n,d=(r-n)/u,f=d*d,h=f*d,A=e*c,p=A-c,m=-2*h+3*f,g=h-f,y=1-m,w=g-f+d;for(let v=0;v!==a;v++){const x=o[p+v+a],C=o[p+v+l]*u,_=o[A+v+a],S=o[A+v]*u;s[v]=y*x+w*C+m*_+g*S}return s}}const GRe=new $s;class WRe extends lee{interpolate_(e,n,r,i){const s=super.interpolate_(e,n,r,i);return GRe.fromArray(s).normalize().toArray(s),s}}const Jo={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},om={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},aj={9728:Qs,9729:Io,9984:OG,9985:Ax,9986:E0,9987:Oc},lj={33071:sd,33648:BC,10497:Cm},pB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},iR={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Fu={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},KRe={CUBICSPLINE:void 0,LINEAR:X1,STEP:q1},mB={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function $Re(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new hL({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:qc})),t.DefaultMaterial}function Qf(t,e,n){for(const r in n.extensions)t[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=n.extensions[r])}function Bc(t,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function qRe(t,e,n){let r=!1,i=!1,s=!1;for(let c=0,u=e.length;c<u;c++){const d=e[c];if(d.POSITION!==void 0&&(r=!0),d.NORMAL!==void 0&&(i=!0),d.COLOR_0!==void 0&&(s=!0),r&&i&&s)break}if(!r&&!i&&!s)return Promise.resolve(t);const o=[],a=[],l=[];for(let c=0,u=e.length;c<u;c++){const d=e[c];if(r){const f=d.POSITION!==void 0?n.getDependency("accessor",d.POSITION):t.attributes.position;o.push(f)}if(i){const f=d.NORMAL!==void 0?n.getDependency("accessor",d.NORMAL):t.attributes.normal;a.push(f)}if(s){const f=d.COLOR_0!==void 0?n.getDependency("accessor",d.COLOR_0):t.attributes.color;l.push(f)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then(function(c){const u=c[0],d=c[1],f=c[2];return r&&(t.morphAttributes.position=u),i&&(t.morphAttributes.normal=d),s&&(t.morphAttributes.color=f),t.morphTargetsRelative=!0,t})}function XRe(t,e){if(t.updateMorphTargets(),e.weights!==void 0)for(let n=0,r=e.weights.length;n<r;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let r=0,i=n.length;r<i;r++)t.morphTargetDictionary[n[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function YRe(t){let e;const n=t.extensions&&t.extensions[pn.KHR_DRACO_MESH_COMPRESSION];if(n?e="draco:"+n.bufferView+":"+n.indices+":"+gB(n.attributes):e=t.indices+":"+gB(t.attributes)+":"+t.mode,t.targets!==void 0)for(let r=0,i=t.targets.length;r<i;r++)e+=":"+gB(t.targets[r]);return e}function gB(t){let e="";const n=Object.keys(t).sort();for(let r=0,i=n.length;r<i;r++)e+=n[r]+":"+t[n[r]]+";";return e}function sR(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function JRe(t){return t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const ZRe=new Zt;class ePe{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new xRe,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new bW(this.options.manager):this.textureLoader=new Ahe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new DC(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return Qf(s,a,i),Bc(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=n.length;i<s;i++){const o=n[i].joints;for(let a=0,l=o.length;a<l;a++)e[o[a]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const o=e[i];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(r[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,n){n!==void 0&&(e.refs[n]===void 0&&(e.refs[n]=e.uses[n]=0),e.refs[n]++)}_getNodeRef(e,n,r){if(e.refs[n]<=1)return r;const i=r.clone(),s=(o,a)=>{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())s(u,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r<n.length;r++){const i=e(n[r]);if(i)return i}return null}_invokeAll(e){const n=Object.values(this.plugins);n.unshift(this);const r=[];for(let i=0;i<n.length;i++){const s=e(n[i]);s&&r.push(s)}return r}getDependency(e,n){const r=e+":"+n;let i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(n);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(n)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(n)});break;case"accessor":i=this.loadAccessor(n);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(n)});break;case"buffer":i=this.loadBuffer(n);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(n)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(n)});break;case"skin":i=this.loadSkin(n);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(n)});break;case"camera":i=this.loadCamera(n);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,n)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(r,i)}return i}getDependencies(e){let n=this.cache.get(e);if(!n){const r=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];n=Promise.all(i.map(function(s,o){return r.getDependency(e,o)})),this.cache.add(e,n)}return n}loadBuffer(e){const n=this.json.buffers[e],r=this.fileLoader;if(n.type&&n.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");if(n.uri===void 0&&e===0)return Promise.resolve(this.extensions[pn.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,o){r.load(h1.resolveURL(n.uri,i.path),s,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))})})}loadBufferView(e){const n=this.json.bufferViews[e];return this.getDependency("buffer",n.buffer).then(function(r){const i=n.byteLength||0,s=n.byteOffset||0;return r.slice(s,s+i)})}loadAccessor(e){const n=this,r=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const o=pB[i.type],a=om[i.componentType],l=i.normalized===!0,c=new a(i.count*o);return Promise.resolve(new Fi(c,o,l))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(o){const a=o[0],l=pB[i.type],c=om[i.componentType],u=c.BYTES_PER_ELEMENT,d=u*l,f=i.byteOffset||0,h=i.bufferView!==void 0?r.bufferViews[i.bufferView].byteStride:void 0,A=i.normalized===!0;let p,m;if(h&&h!==d){const g=Math.floor(f/h),y="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+g+":"+i.count;let w=n.cache.get(y);w||(p=new c(a,g*h,i.count*h/u),w=new ffe(p,h/u),n.cache.add(y,w)),m=new sL(w,l,f%h/u,A)}else a===null?p=new c(i.count*l):p=new c(a,f,i.count*l),m=new Fi(p,l,A);if(i.sparse!==void 0){const g=pB.SCALAR,y=om[i.sparse.indices.componentType],w=i.sparse.indices.byteOffset||0,v=i.sparse.values.byteOffset||0,x=new y(o[1],w,i.sparse.count*g),C=new c(o[2],v,i.sparse.count*l);a!==null&&(m=new Fi(m.array.slice(),m.itemSize,m.normalized));for(let _=0,S=x.length;_<S;_++){const E=x[_];if(m.setX(E,C[_*l]),l>=2&&m.setY(E,C[_*l+1]),l>=3&&m.setZ(E,C[_*l+2]),l>=4&&m.setW(E,C[_*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,o=n.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,n,r){const i=this,s=this.json,o=s.textures[e],a=s.images[n],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const f=(s.samplers||{})[o.sampler]||{};return u.magFilter=aj[f.magFilter]||Io,u.minFilter=aj[f.minFilter]||Oc,u.wrapS=lj[f.wrapS]||Cm,u.wrapT=lj[f.wrapT]||Cm,i.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,n){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(d=>d.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(d){c=!0;const f=new Blob([d],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(d){return new Promise(function(f,h){let A=f;n.isImageBitmapLoader===!0&&(A=function(p){const m=new Oi(p);m.needsUpdate=!0,f(m)}),n.load(h1.resolveURL(d,s.path),A,void 0,h)})}).then(function(d){return c===!0&&a.revokeObjectURL(l),Bc(d,o),d.userData.mimeType=o.mimeType||JRe(o.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),d});return this.sourceCache[e]=u,u}assignTexture(e,n,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[pn.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[pn.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[pn.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[n]=o,o})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,o=n.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new cL,jl.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Cg,jl.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return hL}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[pn.KHR_MATERIALS_UNLIT]){const d=i[pn.KHR_MATERIALS_UNLIT];o=d.getMaterialType(),c.push(d.extendParams(a,s,n))}else{const d=s.pbrMetallicRoughness||{};if(a.color=new Nt(1,1,1),a.opacity=1,Array.isArray(d.baseColorFactor)){const f=d.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Ni),a.opacity=f[3]}d.baseColorTexture!==void 0&&c.push(n.assignTexture(a,"map",d.baseColorTexture,Ki)),a.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,a.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(a,"metalnessMap",d.metallicRoughnessTexture)),c.push(n.assignTexture(a,"roughnessMap",d.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=ja);const u=s.alphaMode||mB.OPAQUE;if(u===mB.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===mB.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==ei&&(c.push(n.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ze(1,1),s.normalTexture.scale!==void 0)){const d=s.normalTexture.scale;a.normalScale.set(d,d)}if(s.occlusionTexture!==void 0&&o!==ei&&(c.push(n.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==ei){const d=s.emissiveFactor;a.emissive=new Nt().setRGB(d[0],d[1],d[2],Ni)}return s.emissiveTexture!==void 0&&o!==ei&&c.push(n.assignTexture(a,"emissiveMap",s.emissiveTexture,Ki)),Promise.all(c).then(function(){const d=new o(a);return s.name&&(d.name=s.name),Bc(d,s),n.associations.set(d,{materials:e}),s.extensions&&Qf(i,d,s),d})}createUniqueName(e){const n=Kn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[pn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,n).then(function(l){return cj(l,a,n)})}const o=[];for(let a=0,l=e.length;a<l;a++){const c=e[a],u=YRe(c),d=i[u];if(d)o.push(d.promise);else{let f;c.extensions&&c.extensions[pn.KHR_DRACO_MESH_COMPRESSION]?f=s(c):f=cj(new Ai,c,n),i[u]={primitive:c,promise:f},o.push(f)}}return Promise.all(o)}loadMesh(e){const n=this,r=this.json,i=this.extensions,s=r.meshes[e],o=s.primitives,a=[];for(let l=0,c=o.length;l<c;l++){const u=o[l].material===void 0?$Re(this.cache):this.getDependency("material",o[l].material);a.push(u)}return a.push(n.loadGeometries(o)),Promise.all(a).then(function(l){const c=l.slice(0,l.length-1),u=l[l.length-1],d=[];for(let h=0,A=u.length;h<A;h++){const p=u[h],m=o[h];let g;const y=c[h];if(m.mode===Jo.TRIANGLES||m.mode===Jo.TRIANGLE_STRIP||m.mode===Jo.TRIANGLE_FAN||m.mode===void 0)g=s.isSkinnedMesh===!0?new Afe(p,y):new xn(p,y),g.isSkinnedMesh===!0&&g.normalizeSkinWeights(),m.mode===Jo.TRIANGLE_STRIP?g.geometry=n9(g.geometry,GG):m.mode===Jo.TRIANGLE_FAN&&(g.geometry=n9(g.geometry,CM));else if(m.mode===Jo.LINES)g=new lL(p,y);else if(m.mode===Jo.LINE_STRIP)g=new aL(p,y);else if(m.mode===Jo.LINE_LOOP)g=new yfe(p,y);else if(m.mode===Jo.POINTS)g=new FC(p,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(g.geometry.morphAttributes).length>0&&XRe(g,s),g.name=n.createUniqueName(s.name||"mesh_"+e),Bc(g,s),m.extensions&&Qf(i,g,m),n.assignFinalMaterial(g),d.push(g)}for(let h=0,A=d.length;h<A;h++)n.associations.set(d[h],{meshes:e,primitives:h});if(d.length===1)return s.extensions&&Qf(i,d[0],s),d[0];const f=new es;s.extensions&&Qf(i,f,s),n.associations.set(f,{meshes:e});for(let h=0,A=d.length;h<A;h++)f.add(d[h]);return f})}loadCamera(e){let n;const r=this.json.cameras[e],i=r[r.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?n=new Fn(LC.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):r.type==="orthographic"&&(n=new $r(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),r.name&&(n.name=this.createUniqueName(r.name)),Bc(n,r),Promise.resolve(n)}loadSkin(e){const n=this.json.skins[e],r=[];for(let i=0,s=n.joints.length;i<s;i++)r.push(this._loadNodeShallow(n.joints[i]));return n.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",n.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(i){const s=i.pop(),o=i,a=[],l=[];for(let c=0,u=o.length;c<u;c++){const d=o[c];if(d){a.push(d);const f=new Zt;s!==null&&f.fromArray(s.array,c*16),l.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',n.joints[c])}return new oL(a,l)})}loadAnimation(e){const n=this.json,r=this,i=n.animations[e],s=i.name?i.name:"animation_"+e,o=[],a=[],l=[],c=[],u=[];for(let d=0,f=i.channels.length;d<f;d++){const h=i.channels[d],A=i.samplers[h.sampler],p=h.target,m=p.node,g=i.parameters!==void 0?i.parameters[A.input]:A.input,y=i.parameters!==void 0?i.parameters[A.output]:A.output;p.node!==void 0&&(o.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",g)),l.push(this.getDependency("accessor",y)),c.push(A),u.push(p))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c),Promise.all(u)]).then(function(d){const f=d[0],h=d[1],A=d[2],p=d[3],m=d[4],g=[];for(let y=0,w=f.length;y<w;y++){const v=f[y],x=h[y],C=A[y],_=p[y],S=m[y];if(v===void 0)continue;v.updateMatrix&&v.updateMatrix();const E=r._createAnimationTracks(v,x,C,_,S);if(E)for(let T=0;T<E.length;T++)g.push(E[T])}return new the(s,void 0,g)})}createNodeMesh(e){const n=this.json,r=this,i=n.nodes[e];return i.mesh===void 0?null:r.getDependency("mesh",i.mesh).then(function(s){const o=r._getNodeRef(r.meshCache,i.mesh,s);return i.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let l=0,c=i.weights.length;l<c;l++)a.morphTargetInfluences[l]=i.weights[l]}),o})}loadNode(e){const n=this.json,r=this,i=n.nodes[e],s=r._loadNodeShallow(e),o=[],a=i.children||[];for(let c=0,u=a.length;c<u;c++)o.push(r.getDependency("node",a[c]));const l=i.skin===void 0?Promise.resolve(null):r.getDependency("skin",i.skin);return Promise.all([s,Promise.all(o),l]).then(function(c){const u=c[0],d=c[1],f=c[2];f!==null&&u.traverse(function(h){h.isSkinnedMesh&&h.bind(f,ZRe)});for(let h=0,A=d.length;h<A;h++)u.add(d[h]);return u})}_loadNodeShallow(e){const n=this.json,r=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=n.nodes[e],o=s.name?i.createUniqueName(s.name):"",a=[],l=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(i.getDependency("camera",s.camera).then(function(c){return i._getNodeRef(i.cameraCache,s.camera,c)})),i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let u;if(s.isBone===!0?u=new cW:c.length>1?u=new es:c.length===1?u=c[0]:u=new Sr,u!==c[0])for(let d=0,f=c.length;d<f;d++)u.add(c[d]);if(s.name&&(u.userData.name=s.name,u.name=o),Bc(u,s),s.extensions&&Qf(r,u,s),s.matrix!==void 0){const d=new Zt;d.fromArray(s.matrix),u.applyMatrix4(d)}else s.translation!==void 0&&u.position.fromArray(s.translation),s.rotation!==void 0&&u.quaternion.fromArray(s.rotation),s.scale!==void 0&&u.scale.fromArray(s.scale);return i.associations.has(u)||i.associations.set(u,{}),i.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){const n=this.extensions,r=this.json.scenes[e],i=this,s=new es;r.name&&(s.name=i.createUniqueName(r.name)),Bc(s,r),r.extensions&&Qf(n,s,r);const o=r.nodes||[],a=[];for(let l=0,c=o.length;l<c;l++)a.push(i.getDependency("node",o[l]));return Promise.all(a).then(function(l){for(let u=0,d=l.length;u<d;u++)s.add(l[u]);const c=u=>{const d=new Map;for(const[f,h]of i.associations)(f instanceof jl||f instanceof Oi)&&d.set(f,h);return u.traverse(f=>{const h=i.associations.get(f);h!=null&&d.set(f,h)}),d};return i.associations=c(s),s})}_createAnimationTracks(e,n,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];Fu[s.path]===Fu.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let c;switch(Fu[s.path]){case Fu.weights:c=Bm;break;case Fu.rotation:c=Mm;break;case Fu.position:case Fu.scale:c=km;break;default:switch(r.itemSize){case 1:c=Bm;break;case 2:case 3:default:c=km;break}break}const u=i.interpolation!==void 0?KRe[i.interpolation]:X1,d=this._getArrayFromAccessor(r);for(let f=0,h=l.length;f<h;f++){const A=new c(l[f]+"."+Fu[s.path],n.array,d,u);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(A),o.push(A)}return o}_getArrayFromAccessor(e){let n=e.array;if(e.normalized){const r=sR(n.constructor),i=new Float32Array(n.length);for(let s=0,o=n.length;s<o;s++)i[s]=n[s]*r;n=i}return n}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(r){const i=this instanceof Mm?WRe:lee;return new i(this.times,this.values,this.getValueSize()/3,r)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function tPe(t,e,n){const r=e.attributes,i=new ic;if(r.POSITION!==void 0){const a=n.json.accessors[r.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(i.set(new de(l[0],l[1],l[2]),new de(c[0],c[1],c[2])),a.normalized){const u=sR(om[a.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new de,l=new de;for(let c=0,u=s.length;c<u;c++){const d=s[c];if(d.POSITION!==void 0){const f=n.json.accessors[d.POSITION],h=f.min,A=f.max;if(h!==void 0&&A!==void 0){if(l.setX(Math.max(Math.abs(h[0]),Math.abs(A[0]))),l.setY(Math.max(Math.abs(h[1]),Math.abs(A[1]))),l.setZ(Math.max(Math.abs(h[2]),Math.abs(A[2]))),f.normalized){const p=sR(om[f.componentType]);l.multiplyScalar(p)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(a)}t.boundingBox=i;const o=new sc;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=o}function cj(t,e,n){const r=e.attributes,i=[];function s(o,a){return n.getDependency("accessor",o).then(function(l){t.setAttribute(a,l)})}for(const o in r){const a=iR[o]||o.toLowerCase();a in t.attributes||i.push(s(r[o],a))}if(e.indices!==void 0&&!t.index){const o=n.getDependency("accessor",e.indices).then(function(a){t.setIndex(a)});i.push(o)}return Nn.workingColorSpace!==Ni&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Nn.workingColorSpace}" not supported.`),Bc(t,e),tPe(t,e,n),Promise.all(i).then(function(){return e.targets!==void 0?qRe(t,e.targets,n):t})}const uj={type:"change"},yB={type:"start"},dj={type:"end"},mw=new wg,fj=new Vu,nPe=Math.cos(70*LC.DEG2RAD);class rPe extends iA{constructor(e,n){super(),this.object=e,this.domElement=n,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new de,this.cursor=new de,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:bA.ROTATE,MIDDLE:bA.DOLLY,RIGHT:bA.PAN},this.touches={ONE:wA.ROTATE,TWO:wA.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(K){K.addEventListener("keydown",me),this._domElementKeyEvents=K},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",me),this._domElementKeyEvents=null},this.saveState=function(){r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=function(){r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(uj),r.update(),s=i.NONE},this.update=function(){const K=new de,Be=new $s().setFromUnitVectors(e.up,new de(0,1,0)),Re=Be.clone().invert(),Me=new de,We=new $s,Je=new de,ht=2*Math.PI;return function(tn=null){const Ft=r.object.position;K.copy(Ft).sub(r.target),K.applyQuaternion(Be),a.setFromVector3(K),r.autoRotate&&s===i.NONE&&k(T(tn)),r.enableDamping?(a.theta+=l.theta*r.dampingFactor,a.phi+=l.phi*r.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let Dt=r.minAzimuthAngle,zt=r.maxAzimuthAngle;isFinite(Dt)&&isFinite(zt)&&(Dt<-Math.PI?Dt+=ht:Dt>Math.PI&&(Dt-=ht),zt<-Math.PI?zt+=ht:zt>Math.PI&&(zt-=ht),Dt<=zt?a.theta=Math.max(Dt,Math.min(zt,a.theta)):a.theta=a.theta>(Dt+zt)/2?Math.max(Dt,a.theta):Math.min(zt,a.theta)),a.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,a.phi)),a.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(u,r.dampingFactor):r.target.add(u),r.target.sub(r.cursor),r.target.clampLength(r.minTargetRadius,r.maxTargetRadius),r.target.add(r.cursor);let tr=!1;if(r.zoomToCursor&&C||r.object.isOrthographicCamera)a.radius=ee(a.radius);else{const wn=a.radius;a.radius=ee(a.radius*c),tr=wn!=a.radius}if(K.setFromSpherical(a),K.applyQuaternion(Re),Ft.copy(r.target).add(K),r.object.lookAt(r.target),r.enableDamping===!0?(l.theta*=1-r.dampingFactor,l.phi*=1-r.dampingFactor,u.multiplyScalar(1-r.dampingFactor)):(l.set(0,0,0),u.set(0,0,0)),r.zoomToCursor&&C){let wn=null;if(r.object.isPerspectiveCamera){const Vn=K.length();wn=ee(Vn*c);const kr=Vn-wn;r.object.position.addScaledVector(v,kr),r.object.updateMatrixWorld(),tr=!!kr}else if(r.object.isOrthographicCamera){const Vn=new de(x.x,x.y,0);Vn.unproject(r.object);const kr=r.object.zoom;r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/c)),r.object.updateProjectionMatrix(),tr=kr!==r.object.zoom;const ue=new de(x.x,x.y,0);ue.unproject(r.object),r.object.position.sub(ue).add(Vn),r.object.updateMatrixWorld(),wn=K.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;wn!==null&&(this.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(wn).add(r.object.position):(mw.origin.copy(r.object.position),mw.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(mw.direction))<nPe?e.lookAt(r.target):(fj.setFromNormalAndCoplanarPoint(r.object.up,r.target),mw.intersectPlane(fj,r.target))))}else if(r.object.isOrthographicCamera){const wn=r.object.zoom;r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/c)),wn!==r.object.zoom&&(r.object.updateProjectionMatrix(),tr=!0)}return c=1,C=!1,tr||Me.distanceToSquared(r.object.position)>o||8*(1-We.dot(r.object.quaternion))>o||Je.distanceToSquared(r.target)>o?(r.dispatchEvent(uj),Me.copy(r.object.position),We.copy(r.object.quaternion),Je.copy(r.target),!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",Pe),r.domElement.removeEventListener("pointerdown",pe),r.domElement.removeEventListener("pointercancel",H),r.domElement.removeEventListener("wheel",Ee),r.domElement.removeEventListener("pointermove",J),r.domElement.removeEventListener("pointerup",H),r.domElement.getRootNode().removeEventListener("keydown",ce,{capture:!0}),r._domElementKeyEvents!==null&&(r._domElementKeyEvents.removeEventListener("keydown",me),r._domElementKeyEvents=null)};const r=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=i.NONE;const o=1e-6,a=new LM,l=new LM;let c=1;const u=new de,d=new Ze,f=new Ze,h=new Ze,A=new Ze,p=new Ze,m=new Ze,g=new Ze,y=new Ze,w=new Ze,v=new de,x=new Ze;let C=!1;const _=[],S={};let E=!1;function T(K){return K!==null?2*Math.PI/60*r.autoRotateSpeed*K:2*Math.PI/60/60*r.autoRotateSpeed}function R(K){const Be=Math.abs(K*.01);return Math.pow(.95,r.zoomSpeed*Be)}function k(K){l.theta-=K}function B(K){l.phi-=K}const M=function(){const K=new de;return function(Re,Me){K.setFromMatrixColumn(Me,0),K.multiplyScalar(-Re),u.add(K)}}(),F=function(){const K=new de;return function(Re,Me){r.screenSpacePanning===!0?K.setFromMatrixColumn(Me,1):(K.setFromMatrixColumn(Me,0),K.crossVectors(r.object.up,K)),K.multiplyScalar(Re),u.add(K)}}(),I=function(){const K=new de;return function(Re,Me){const We=r.domElement;if(r.object.isPerspectiveCamera){const Je=r.object.position;K.copy(Je).sub(r.target);let ht=K.length();ht*=Math.tan(r.object.fov/2*Math.PI/180),M(2*Re*ht/We.clientHeight,r.object.matrix),F(2*Me*ht/We.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(M(Re*(r.object.right-r.object.left)/r.object.zoom/We.clientWidth,r.object.matrix),F(Me*(r.object.top-r.object.bottom)/r.object.zoom/We.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function z(K){r.object.isPerspectiveCamera||r.object.isOrthographicCamera?c/=K:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function Y(K){r.object.isPerspectiveCamera||r.object.isOrthographicCamera?c*=K:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function $(K,Be){if(!r.zoomToCursor)return;C=!0;const Re=r.domElement.getBoundingClientRect(),Me=K-Re.left,We=Be-Re.top,Je=Re.width,ht=Re.height;x.x=Me/Je*2-1,x.y=-(We/ht)*2+1,v.set(x.x,x.y,1).unproject(r.object).sub(r.object.position).normalize()}function ee(K){return Math.max(r.minDistance,Math.min(r.maxDistance,K))}function W(K){d.set(K.clientX,K.clientY)}function ne(K){$(K.clientX,K.clientX),g.set(K.clientX,K.clientY)}function Se(K){A.set(K.clientX,K.clientY)}function fe(K){f.set(K.clientX,K.clientY),h.subVectors(f,d).multiplyScalar(r.rotateSpeed);const Be=r.domElement;k(2*Math.PI*h.x/Be.clientHeight),B(2*Math.PI*h.y/Be.clientHeight),d.copy(f),r.update()}function ge(K){y.set(K.clientX,K.clientY),w.subVectors(y,g),w.y>0?z(R(w.y)):w.y<0&&Y(R(w.y)),g.copy(y),r.update()}function Oe(K){p.set(K.clientX,K.clientY),m.subVectors(p,A).multiplyScalar(r.panSpeed),I(m.x,m.y),A.copy(p),r.update()}function Fe(K){$(K.clientX,K.clientY),K.deltaY<0?Y(R(K.deltaY)):K.deltaY>0&&z(R(K.deltaY)),r.update()}function De(K){let Be=!1;switch(K.code){case r.keys.UP:K.ctrlKey||K.metaKey||K.shiftKey?B(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,r.keyPanSpeed),Be=!0;break;case r.keys.BOTTOM:K.ctrlKey||K.metaKey||K.shiftKey?B(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,-r.keyPanSpeed),Be=!0;break;case r.keys.LEFT:K.ctrlKey||K.metaKey||K.shiftKey?k(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(r.keyPanSpeed,0),Be=!0;break;case r.keys.RIGHT:K.ctrlKey||K.metaKey||K.shiftKey?k(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(-r.keyPanSpeed,0),Be=!0;break}Be&&(K.preventDefault(),r.update())}function ke(K){if(_.length===1)d.set(K.pageX,K.pageY);else{const Be=dt(K),Re=.5*(K.pageX+Be.x),Me=.5*(K.pageY+Be.y);d.set(Re,Me)}}function Ge(K){if(_.length===1)A.set(K.pageX,K.pageY);else{const Be=dt(K),Re=.5*(K.pageX+Be.x),Me=.5*(K.pageY+Be.y);A.set(Re,Me)}}function Ve(K){const Be=dt(K),Re=K.pageX-Be.x,Me=K.pageY-Be.y,We=Math.sqrt(Re*Re+Me*Me);g.set(0,We)}function q(K){r.enableZoom&&Ve(K),r.enablePan&&Ge(K)}function Ue(K){r.enableZoom&&Ve(K),r.enableRotate&&ke(K)}function O(K){if(_.length==1)f.set(K.pageX,K.pageY);else{const Re=dt(K),Me=.5*(K.pageX+Re.x),We=.5*(K.pageY+Re.y);f.set(Me,We)}h.subVectors(f,d).multiplyScalar(r.rotateSpeed);const Be=r.domElement;k(2*Math.PI*h.x/Be.clientHeight),B(2*Math.PI*h.y/Be.clientHeight),d.copy(f)}function ve(K){if(_.length===1)p.set(K.pageX,K.pageY);else{const Be=dt(K),Re=.5*(K.pageX+Be.x),Me=.5*(K.pageY+Be.y);p.set(Re,Me)}m.subVectors(p,A).multiplyScalar(r.panSpeed),I(m.x,m.y),A.copy(p)}function Ae(K){const Be=dt(K),Re=K.pageX-Be.x,Me=K.pageY-Be.y,We=Math.sqrt(Re*Re+Me*Me);y.set(0,We),w.set(0,Math.pow(y.y/g.y,r.zoomSpeed)),z(w.y),g.copy(y);const Je=(K.pageX+Be.x)*.5,ht=(K.pageY+Be.y)*.5;$(Je,ht)}function ae(K){r.enableZoom&&Ae(K),r.enablePan&&ve(K)}function Z(K){r.enableZoom&&Ae(K),r.enableRotate&&O(K)}function pe(K){r.enabled!==!1&&(_.length===0&&(r.domElement.setPointerCapture(K.pointerId),r.domElement.addEventListener("pointermove",J),r.domElement.addEventListener("pointerup",H)),!et(K)&&(Qe(K),K.pointerType==="touch"?Le(K):oe(K)))}function J(K){r.enabled!==!1&&(K.pointerType==="touch"?Te(K):we(K))}function H(K){switch($e(K),_.length){case 0:r.domElement.releasePointerCapture(K.pointerId),r.domElement.removeEventListener("pointermove",J),r.domElement.removeEventListener("pointerup",H),r.dispatchEvent(dj),s=i.NONE;break;case 1:const Be=_[0],Re=S[Be];Le({pointerId:Be,pageX:Re.x,pageY:Re.y});break}}function oe(K){let Be;switch(K.button){case 0:Be=r.mouseButtons.LEFT;break;case 1:Be=r.mouseButtons.MIDDLE;break;case 2:Be=r.mouseButtons.RIGHT;break;default:Be=-1}switch(Be){case bA.DOLLY:if(r.enableZoom===!1)return;ne(K),s=i.DOLLY;break;case bA.ROTATE:if(K.ctrlKey||K.metaKey||K.shiftKey){if(r.enablePan===!1)return;Se(K),s=i.PAN}else{if(r.enableRotate===!1)return;W(K),s=i.ROTATE}break;case bA.PAN:if(K.ctrlKey||K.metaKey||K.shiftKey){if(r.enableRotate===!1)return;W(K),s=i.ROTATE}else{if(r.enablePan===!1)return;Se(K),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(yB)}function we(K){switch(s){case i.ROTATE:if(r.enableRotate===!1)return;fe(K);break;case i.DOLLY:if(r.enableZoom===!1)return;ge(K);break;case i.PAN:if(r.enablePan===!1)return;Oe(K);break}}function Ee(K){r.enabled===!1||r.enableZoom===!1||s!==i.NONE||(K.preventDefault(),r.dispatchEvent(yB),Fe(re(K)),r.dispatchEvent(dj))}function re(K){const Be=K.deltaMode,Re={clientX:K.clientX,clientY:K.clientY,deltaY:K.deltaY};switch(Be){case 1:Re.deltaY*=16;break;case 2:Re.deltaY*=100;break}return K.ctrlKey&&!E&&(Re.deltaY*=10),Re}function ce(K){K.key==="Control"&&(E=!0,r.domElement.getRootNode().addEventListener("keyup",le,{passive:!0,capture:!0}))}function le(K){K.key==="Control"&&(E=!1,r.domElement.getRootNode().removeEventListener("keyup",le,{passive:!0,capture:!0}))}function me(K){r.enabled===!1||r.enablePan===!1||De(K)}function Le(K){switch(st(K),_.length){case 1:switch(r.touches.ONE){case wA.ROTATE:if(r.enableRotate===!1)return;ke(K),s=i.TOUCH_ROTATE;break;case wA.PAN:if(r.enablePan===!1)return;Ge(K),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(r.touches.TWO){case wA.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;q(K),s=i.TOUCH_DOLLY_PAN;break;case wA.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Ue(K),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(yB)}function Te(K){switch(st(K),s){case i.TOUCH_ROTATE:if(r.enableRotate===!1)return;O(K),r.update();break;case i.TOUCH_PAN:if(r.enablePan===!1)return;ve(K),r.update();break;case i.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ae(K),r.update();break;case i.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Z(K),r.update();break;default:s=i.NONE}}function Pe(K){r.enabled!==!1&&K.preventDefault()}function Qe(K){_.push(K.pointerId)}function $e(K){delete S[K.pointerId];for(let Be=0;Be<_.length;Be++)if(_[Be]==K.pointerId){_.splice(Be,1);return}}function et(K){for(let Be=0;Be<_.length;Be++)if(_[Be]==K.pointerId)return!0;return!1}function st(K){let Be=S[K.pointerId];Be===void 0&&(Be=new Ze,S[K.pointerId]=Be),Be.set(K.pageX,K.pageY)}function dt(K){const Be=K.pointerId===_[0]?_[1]:_[0];return S[Be]}r.domElement.addEventListener("contextmenu",Pe),r.domElement.addEventListener("pointerdown",pe),r.domElement.addEventListener("pointercancel",H),r.domElement.addEventListener("wheel",Ee,{passive:!1}),r.domElement.getRootNode().addEventListener("keydown",ce,{passive:!0,capture:!0}),this.update()}}const vB=new WeakMap;class iPe extends sA{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,n,r,i){const s=new DC(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{this.parse(o,n,i)},r,i)}parse(e,n,r=()=>{}){this.decodeDracoFile(e,n,null,null,Ki,r).catch(r)}decodeDracoFile(e,n,r,i,s=Ni,o=()=>{}){const a={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:s};return this.decodeGeometry(e,a).then(n).catch(o)}decodeGeometry(e,n){const r=JSON.stringify(n);if(vB.has(e)){const l=vB.get(e);if(l.key===r)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(i=l,new Promise((c,u)=>{i._callbacks[s]={resolve:c,reject:u},i.postMessage({type:"decode",id:s,taskConfig:n,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),vB.set(e,{key:r,promise:a}),a}_createGeometry(e){const n=new Ai;e.index&&n.setIndex(new Fi(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const i=e.attributes[r],s=i.name,o=i.array,a=i.itemSize,l=new Fi(o,a);s==="color"&&(this._assignVertexColorSpace(l,i.vertexColorSpace),l.normalized=!(o instanceof Float32Array)),n.setAttribute(s,l)}return n}_assignVertexColorSpace(e,n){if(n!==Ki)return;const r=new Nt;for(let i=0,s=e.count;i<s;i++)r.fromBufferAttribute(e,i).convertSRGBToLinear(),e.setXYZ(i,r.r,r.g,r.b)}_loadLibrary(e,n){const r=new DC(this.manager);return r.setPath(this.decoderPath),r.setResponseType(n),r.setWithCredentials(this.withCredentials),new Promise((i,s)=>{r.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",n=[];return e?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then(r=>{const i=r[0];e||(this.decoderConfig.wasmBinary=r[1]);const s=sPe.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,n){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){const o=s.data;switch(o.type){case"decode":i._callbacks[o.id].resolve(o);break;case"error":i._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=n,r._taskLoad+=n,r})}_releaseTask(e,n){e._taskLoad-=e._taskCosts[n],delete e._callbacks[n],delete e._taskCosts[n]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function sPe(){let t,e;onmessage=function(o){const a=o.data;switch(a.type){case"init":t=a.decoderConfig,e=new Promise(function(u){t.onModuleLoaded=function(d){u({draco:d})},DracoDecoderModule(t)});break;case"decode":const l=a.buffer,c=a.taskConfig;e.then(u=>{const d=u.draco,f=new d.Decoder;try{const h=n(d,f,new Int8Array(l),c),A=h.attributes.map(p=>p.array.buffer);h.index&&A.push(h.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:h},A)}catch(h){console.error(h),self.postMessage({type:"error",id:a.id,error:h.message})}finally{d.destroy(f)}});break}};function n(o,a,l,c){const u=c.attributeIDs,d=c.attributeTypes;let f,h;const A=a.GetEncodedGeometryType(l);if(A===o.TRIANGULAR_MESH)f=new o.Mesh,h=a.DecodeArrayToMesh(l,l.byteLength,f);else if(A===o.POINT_CLOUD)f=new o.PointCloud,h=a.DecodeArrayToPointCloud(l,l.byteLength,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!h.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const p={index:null,attributes:[]};for(const m in u){const g=self[d[m]];let y,w;if(c.useUniqueIDs)w=u[m],y=a.GetAttributeByUniqueId(f,w);else{if(w=a.GetAttributeId(f,o[u[m]]),w===-1)continue;y=a.GetAttribute(f,w)}const v=i(o,a,f,m,g,y);m==="color"&&(v.vertexColorSpace=c.vertexColorSpace),p.attributes.push(v)}return A===o.TRIANGULAR_MESH&&(p.index=r(o,a,f)),o.destroy(f),p}function r(o,a,l){const u=l.num_faces()*3,d=u*4,f=o._malloc(d);a.GetTrianglesUInt32Array(l,d,f);const h=new Uint32Array(o.HEAPF32.buffer,f,u).slice();return o._free(f),{array:h,itemSize:1}}function i(o,a,l,c,u,d){const f=d.num_components(),A=l.num_points()*f,p=A*u.BYTES_PER_ELEMENT,m=s(o,u),g=o._malloc(p);a.GetAttributeDataArrayForAllPoints(l,d,m,p,g);const y=new u(o.HEAPF32.buffer,g,A).slice();return o._free(g),{name:c,array:y,itemSize:f}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}const WA=128,hj=128,gw=.5,oPe="source.glb";function aPe({toastId:t,message:e,prompt:n,commandBarSend:r}){return b.jsxs("div",{className:"flex flex-col justify-between gap-6",children:[b.jsxs("section",{children:[b.jsx("h2",{children:"Text-to-CAD failed"}),b.jsx("p",{className:"text-sm text-chalkboard-70 dark:text-chalkboard-30",children:e})]}),b.jsxs("div",{className:"flex justify-between gap-8",children:[b.jsx($t,{Element:"button",iconStart:{icon:"close"},name:"Dismiss",onClick:()=>{jt.dismiss(t)},children:"Dismiss"}),b.jsx($t,{Element:"button",iconStart:{icon:"refresh"},name:"Edit prompt",onClick:()=>{r({type:"Find and select command",data:{groupId:"modeling",name:"Text-to-CAD",argDefaultValues:{prompt:n}}}),jt.dismiss(t)},children:"Edit prompt"})]})]})}function lPe({toastId:t,data:e,navigate:n,context:r,token:i,fileMachineSend:s,settings:o}){const a=P.useRef(null),l=P.useRef(null),c=P.useRef(),[u,d]=P.useState(!1),[f,h]=P.useState(!1),A=e.id,p=P.useCallback(({renderer:m,scene:g,camera:y,controls:w,isFirstRender:v=!1})=>{!a.current||!(v||c.current)||(c.current=requestAnimationFrame(()=>p({renderer:m,scene:g,camera:y,controls:w})),w.update(),m.render(g,y))},[]);return P.useEffect(()=>{if(!l.current)return;const m=l.current,g=new rL({canvas:m,antialias:!0,alpha:!0});g.setSize(WA,WA),g.setPixelRatio(Math.min(window.devicePixelRatio,2));const y=new iL,w=new B0(new Nt("white"),8);y.add(w);const v=cPe(),x=new rPe(v,g.domElement);x.enableDamping=!0;const C=new wRe,_=new iPe;_.setDecoderPath("/examples/jsm/libs/draco/"),C.setDRACOLoader(_),y.add(v);const S=xbe(e.outputs[oPe]);if(S instanceof Error){jt.error("Error loading GLB file: "+S.message),console.error("decoding buffer from base64 failed",S);return}return C.parse(S,"",function(E){y.add(E.scene),uPe({scene:y,...o});const T=new de,R=new ic;R.setFromObject(E.scene),R.getSize(T);const k=Math.max(T.x,T.y,T.z);v.position.set(k*2,k*2,k*2),v.lookAt(0,0,0),v.left=-k,v.right=k,v.top=k,v.bottom=-k,v.near=0,v.far=k*10;const B=new B0(new Nt("white"),1);B.position.set(k*-5,-k,k),v.add(B);const M=new B0(new Nt("white"),1.4);M.position.set(0,0,2*k),v.add(M);const F=new B0(new Nt("white"),1);F.position.set(-2*k,-2*k,2*k),y.add(F),v.updateProjectionMatrix(),x.update(),g.render(y,v)},function(E){jt.error("Error loading GLB file: "+E.message),console.error("Error loading GLB file",E)}),l.current.addEventListener("mouseover",()=>{g.setAnimationLoop(()=>p({renderer:g,scene:y,camera:v,controls:x,isFirstRender:!0}))}),l.current.addEventListener("mouseout",()=>{g.setAnimationLoop(null),c.current&&(cancelAnimationFrame(c.current),c.current=void 0)}),()=>{g.dispose(),c.current&&(cancelAnimationFrame(c.current),c.current=void 0)}},[]),b.jsxs("div",{className:"flex gap-4 min-w-80",ref:a,children:[b.jsx("div",{className:"flex-none overflow-hidden",style:{width:WA+"px",height:WA+"px"},children:b.jsx("canvas",{ref:l,width:WA,height:WA})}),b.jsxs("div",{className:"flex flex-col justify-between gap-6",children:[b.jsxs("section",{children:[b.jsx("h2",{children:"Text-to-CAD successful"}),b.jsxs("p",{className:"text-sm text-chalkboard-70 dark:text-chalkboard-30",children:['Prompt: "',e.prompt.length>hj?e.prompt.slice(0,hj)+"...":e.prompt,'"']})]}),b.jsxs("div",{className:"flex justify-between gap-8",children:[b.jsx($t,{Element:"button",iconStart:{icon:"close"},"data-negative-button":u?"close":"reject",name:u?"Close":"Reject",onClick:()=>{u||wB(A,"rejected",i).catch(Bt),ft()&&s({type:"Delete file",data:{name:e.fileName,path:`${r.project.path}${window.electron.sep}${e.fileName}`,children:null}}),jt.dismiss(t)},children:u?"Close":"Reject"}),ft()?b.jsx($t,{Element:"button",iconStart:{icon:"checkmark"},name:"Accept",onClick:()=>{wB(A,"accepted",i),n(`${ut.FILE}/${encodeURIComponent(`${r.project.path}${window.electron.sep}${e.fileName}`)}`),jt.dismiss(t)},children:"Accept"}):b.jsx($t,{Element:"button",iconStart:{icon:f?"clipboardCheckmark":"clipboardPlus"},name:"Copy to clipboard",onClick:()=>{wB(A,"accepted",i),navigator.clipboard.writeText(e.code||"// no code found"),h(!0),d(!0),setTimeout(()=>{h(!1)},5e3)},children:f?"Copied":"Copy to clipboard"})]})]})]})}const cPe=()=>new $r(-gw,gw,gw,-gw,.5,3);function uPe({scene:t,color:e=2752420,highlightEdges:n=!1}){t.traverse(r=>{if("isMesh"in r&&r.isMesh){if(r.material=new ei({color:e}),!n)return;const i=new Mfe(r.geometry,30),s=new lL(i,new Cg({color:2039840}));t.add(s)}})}var Ji=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global||{},Ns={searchParams:"URLSearchParams"in Ji,iterable:"Symbol"in Ji&&"iterator"in Symbol,blob:"FileReader"in Ji&&"Blob"in Ji&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in Ji,arrayBuffer:"ArrayBuffer"in Ji};function dPe(t){return t&&DataView.prototype.isPrototypeOf(t)}if(Ns.arrayBuffer)var fPe=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],hPe=ArrayBuffer.isView||function(t){return t&&fPe.indexOf(Object.prototype.toString.call(t))>-1};function Fg(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||t==="")throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function W6(t){return typeof t!="string"&&(t=String(t)),t}function K6(t){var e={next:function(){var n=t.shift();return{done:n===void 0,value:n}}};return Ns.iterable&&(e[Symbol.iterator]=function(){return e}),e}function Ei(t){this.map={},t instanceof Ei?t.forEach(function(e,n){this.append(n,e)},this):Array.isArray(t)?t.forEach(function(e){if(e.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}Ei.prototype.append=function(t,e){t=Fg(t),e=W6(e);var n=this.map[t];this.map[t]=n?n+", "+e:e};Ei.prototype.delete=function(t){delete this.map[Fg(t)]};Ei.prototype.get=function(t){return t=Fg(t),this.has(t)?this.map[t]:null};Ei.prototype.has=function(t){return this.map.hasOwnProperty(Fg(t))};Ei.prototype.set=function(t,e){this.map[Fg(t)]=W6(e)};Ei.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)};Ei.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),K6(t)};Ei.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),K6(t)};Ei.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),K6(t)};Ns.iterable&&(Ei.prototype[Symbol.iterator]=Ei.prototype.entries);function bB(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function cee(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function APe(t){var e=new FileReader,n=cee(e);return e.readAsArrayBuffer(t),n}function pPe(t){var e=new FileReader,n=cee(e),r=/charset=([A-Za-z0-9_-]+)/.exec(t.type),i=r?r[1]:"utf-8";return e.readAsText(t,i),n}function mPe(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}function Aj(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function uee(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:Ns.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:Ns.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Ns.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():Ns.arrayBuffer&&Ns.blob&&dPe(t)?(this._bodyArrayBuffer=Aj(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Ns.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||hPe(t))?this._bodyArrayBuffer=Aj(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):Ns.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Ns.blob&&(this.blob=function(){var t=bB(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=bB(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(Ns.blob)return this.blob().then(APe);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=bB(this);if(t)return t;if(this._bodyBlob)return pPe(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(mPe(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Ns.formData&&(this.formData=function(){return this.text().then(vPe)}),this.json=function(){return this.text().then(JSON.parse)},this}var gPe=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function yPe(t){var e=t.toUpperCase();return gPe.indexOf(e)>-1?e:t}function eA(t,e){if(!(this instanceof eA))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var n=e.body;if(t instanceof eA){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new Ei(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!n&&t._bodyInit!=null&&(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new Ei(e.headers)),this.method=yPe(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in Ji){var s=new AbortController;return s.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+new Date().getTime());else{var i=/\?/;this.url+=(i.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}eA.prototype.clone=function(){return new eA(this,{body:this._bodyInit})};function vPe(t){var e=new FormData;return t.trim().split("&").forEach(function(n){if(n){var r=n.split("="),i=r.shift().replace(/\+/g," "),s=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(s))}}),e}function bPe(t){var e=new Ei,n=t.replace(/\r?\n[\t ]+/g," ");return n.split("\r").map(function(r){return r.indexOf(`
`)===0?r.substr(1,r.length):r}).forEach(function(r){var i=r.split(":"),s=i.shift().trim();if(s){var o=i.join(":").trim();try{e.append(s,o)}catch(a){console.warn("Response "+a.message)}}}),e}uee.call(eA.prototype);function nc(t,e){if(!(this instanceof nc))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText===void 0?"":""+e.statusText,this.headers=new Ei(e.headers),this.url=e.url||"",this._initBody(t)}uee.call(nc.prototype);nc.prototype.clone=function(){return new nc(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Ei(this.headers),url:this.url})};nc.error=function(){var t=new nc(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var wPe=[301,302,303,307,308];nc.redirect=function(t,e){if(wPe.indexOf(e)===-1)throw new RangeError("Invalid status code");return new nc(null,{status:e,headers:{location:t}})};var ah=Ji.DOMException;try{new ah}catch{ah=function(e,n){this.message=e,this.name=n;var r=Error(e);this.stack=r.stack},ah.prototype=Object.create(Error.prototype),ah.prototype.constructor=ah}function dee(t,e){return new Promise(function(n,r){var i=new eA(t,e);if(i.signal&&i.signal.aborted)return r(new ah("Aborted","AbortError"));var s=new XMLHttpRequest;function o(){s.abort()}s.onload=function(){var c={statusText:s.statusText,headers:bPe(s.getAllResponseHeaders()||"")};i.url.indexOf("file://")===0&&(s.status<200||s.status>599)?c.status=200:c.status=s.status,c.url="responseURL"in s?s.responseURL:c.headers.get("X-Request-URL");var u="response"in s?s.response:s.responseText;setTimeout(function(){n(new nc(u,c))},0)},s.onerror=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},s.ontimeout=function(){setTimeout(function(){r(new TypeError("Network request timed out"))},0)},s.onabort=function(){setTimeout(function(){r(new ah("Aborted","AbortError"))},0)};function a(c){try{return c===""&&Ji.location.href?Ji.location.href:c}catch{return c}}if(s.open(i.method,a(i.url),!0),i.credentials==="include"?s.withCredentials=!0:i.credentials==="omit"&&(s.withCredentials=!1),"responseType"in s&&(Ns.blob?s.responseType="blob":Ns.arrayBuffer&&(s.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof Ei||Ji.Headers&&e.headers instanceof Ji.Headers)){var l=[];Object.getOwnPropertyNames(e.headers).forEach(function(c){l.push(Fg(c)),s.setRequestHeader(c,W6(e.headers[c]))}),i.headers.forEach(function(c,u){l.indexOf(u)===-1&&s.setRequestHeader(u,c)})}else i.headers.forEach(function(c,u){s.setRequestHeader(u,c)});i.signal&&(i.signal.addEventListener("abort",o),s.onreadystatechange=function(){s.readyState===4&&i.signal.removeEventListener("abort",o)}),s.send(typeof i._bodyInit>"u"?null:i._bodyInit)})}dee.polyfill=!0;Ji.fetch||(Ji.fetch=dee,Ji.Headers=Ei,Ji.Request=eA,Ji.Response=nc);var xPe=self.fetch.bind(self);const CPe=mg(xPe),pj=t=>({"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}});async function $6(t,e,n){let r=null,i=e||{};if(ft()){if(!n)return new Error("No token provided");i.headers=pj(n),r=await CPe(t,i)}else i.headers=pj(C_?n:void 0),i.credentials="include",r=await fetch(t,i);return r?r.ok?await r.json():(console.error("Failed to request endpoint: "+t,JSON.stringify(r)),new Error("Failed to request endpoint: "+t+" with status: "+r.status+" "+r.statusText)):new Error("Failed to request endpoint: "+t)}function fee(t){return t.sort((n,r)=>n.name===ea?-1:r.name===ea?1:n.children===null&&r.children!==null?-1:n.children!==null&&r.children===null?1:n.name&&r.name?n.name.localeCompare(r.name):0).map(n=>"children"in n&&n.children!==null?{...n,children:fee(n.children||[])}:n)}function _Pe(t){return new RegExp(t.replace(hee(),"([0-9]+)"))}function oR(t,e){const n=_Pe(t),i=e.map(o=>{var a;return(a=o.name)==null?void 0:a.match(n)}).filter(Boolean).map(o=>o[1]).map(Number);return Math.max(...i,-1)+1}function aR(t,e){var s;const n=hee(),r=t.match(n),i=Math.min(r!==null&&((s=r[1])==null?void 0:s.length)||0,Cbe);return t.replace(n,e.toString().padStart(i+1,"0"))}function mj(t){return t.includes(Uq)}function SPe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hee(){const t=SPe(Uq);return new RegExp(`${t}(${t.slice(-1)}*)`)}async function EPe(t){return{user:ft()?await window.electron.getPath("appData"):"/",project:t!==void 0?t:void 0}}async function q6({onProjectOpen:t,navigate:e}){je.endSession();const n=await bv(),r=await KI(n),i=oR(C7,r),s=aR(C7,i),o=await JY(s,uf,n);return t({name:o.name,path:o.path},null),e(`${ut.FILE}/${encodeURIComponent(o.default_file)}${ut.ONBOARDING.INDEX}`),o}function lR({entryName:t,baseDir:e}){let n=t.replace(Ss,"")+Ss,r=window.electron.path.join(e,n),i=1;for(;window.electron.exists(r);){const s=new RegExp(`(-\\d+)?(${Ss})?$`);n=t.replace(s,"")+`-${i}`+Ss,r=window.electron.path.join(e,n),i++}return{name:n,path:r}}function gj({entryName:t,baseDir:e}){let n=t,r=window.electron.path.join(e,n),i=1;for(;window.electron.exists(r);)n=t.replace(/-\d+$/,"")+`-${i}`,r=window.electron.path.join(e,n),i++;return{name:n,path:r}}async function TPe(t,e){const n={prompt:t},r=cf+"/ai/text-to-cad/glb?kcl=true",i=await $6(r,{method:"POST",body:JSON.stringify(n)},e);return i instanceof Error||i.id?i:new Error("No id returned from Text-to-CAD API")}async function BPe(t,e){const n=cf+"/user/text-to-cad/"+t;return await $6(n,{method:"GET"},e)}async function MPe({trimmedPrompt:t,fileMachineSend:e,navigate:n,commandBarSend:r,context:i,token:s,settings:o}){const a=jt.loading("Submitting to Text-to-CAD API..."),l=f=>{jt.error(()=>aPe({toastId:a,message:f,commandBarSend:r,prompt:t}),{id:a,duration:1/0})},c=await TPe(t,s).then(f=>f instanceof Error?Promise.reject(f):f).catch(f=>(l("Failed to submit to Text-to-CAD API"),f));if(c instanceof Error){l("Failed to submit to Text-to-CAD API");return}jt.loading("Generating parametric model...",{id:a});const d=await new Promise((f,h)=>{(async()=>{const A=await c;A instanceof Error&&h(A);const p=3*6e4,m=3e3;let g=0;const y=setInterval(Li(async()=>{g+=m,g>=p&&(clearInterval(y),h(new Error("Text-to-CAD API timed out")));const w=await BPe(A.id,s);w instanceof Error&&(clearInterval(y),h(w)),w instanceof Error||w.status==="failed"?(clearInterval(y),h(w)):w.status==="completed"&&(clearInterval(y),f(w))},Bt),m)})().catch(Bt)}).catch(f=>(l("Failed to generate parametric model"),f)).then(async f=>{if(f.code===void 0||!f.code||f.code.length===0)if(f.error&&f.error.length>0){const p=f.error.replace("Text-to-CAD server:","").trim();return l(p),Promise.reject(new Error(p))}else return l("No KCL code returned"),Promise.reject(new Error("No KCL code returned"));let A=`${f.prompt.slice(0,24).replace(/\s/gi,"-").replace(/\W/gi,"-").toLowerCase()}${Ss}`;return ft()&&(A=lR({entryName:A,baseDir:i.selectedDirectory.path}).name,e({type:"Create file",data:{name:A,makeDir:!1,content:f.code,silent:!0}})),{...f,fileName:A}});if(d instanceof Error){l("Failed to generate parametric model");return}return jt.success(()=>lPe({toastId:a,data:d,token:s,navigate:n,context:i,fileMachineSend:e,settings:o}),{id:a,duration:1/0,icon:null}),d}async function wB(t,e,n){const r=cf+"/user/text-to-cad/"+t+"?feedback="+e;await $6(r,{method:"POST"},n)}const kPe=Rg({types:{},actions:{setFiles:An(({event:t})=>t.type!=="xstate.done.actor.read-files"?{}:{project:t.output}),setSelectedDirectory:An(({event:t})=>t.type!=="Set selected directory"?{}:{selectedDirectory:t.directory}),addFileToRenamingQueue:An({itemsBeingRenamed:({context:t,event:e})=>e.type!=="xstate.done.actor.create-and-open-file"?t.itemsBeingRenamed:[...t.itemsBeingRenamed,e.output.path]}),removeFileFromRenamingQueue:An({itemsBeingRenamed:({context:t,event:e})=>e.type!=="xstate.done.actor.rename-file"?t.itemsBeingRenamed:t.itemsBeingRenamed.filter(n=>n!==e.output.oldPath)}),navigateToFile:()=>{},renameToastSuccess:()=>{},createToastSuccess:()=>{},toastSuccess:()=>{},toastError:()=>{}},guards:{"Name has been changed":({event:t})=>t.type!=="xstate.done.actor.rename-file"?!1:t.output.newPath!==t.output.oldPath,"Has at least 1 file":({event:t})=>{var e;return t.type!=="xstate.done.actor.read-files"?!1:!!((e=t==null?void 0:t.output)!=null&&e.children)&&t.output.children.length>0},"Is not silent":({event:t})=>t.type==="Create file"?!t.data.silent:!1,"Should set to rename":({event:t})=>t.type==="xstate.done.actor.create-and-open-file"&&t.output.shouldSetToRename||!1},actors:{readFiles:Ht(({input:t})=>Promise.resolve(t)),createAndOpenFile:Ht(t=>Promise.resolve({message:"",path:""})),renameFile:Ht(t=>Promise.resolve({message:"",newPath:"",oldPath:""})),deleteFile:Ht(t=>Promise.resolve({message:""})),createFile:Ht(t=>Promise.resolve({path:""}))}}).createMachine({id:"File machine",initial:"Reading files",context:({input:t})=>({project:t.project??{},selectedDirectory:t.selectedDirectory??{},itemsBeingRenamed:[]}),on:{assign:{actions:An(({event:t})=>({...t.data})),target:".Reading files"},Refresh:".Reading files"},states:{"Has no files":{on:{"Create file":{target:"Creating and opening file"}}},"Has files":{on:{"Rename file":{target:"Renaming file"},"Create file":[{target:"Creating and opening file",guard:"Is not silent"},"Creating file"],"Delete file":{target:"Deleting file"},"Open file":{target:"Opening file"},"Set selected directory":{target:"Has files",actions:["setSelectedDirectory"]}}},"Creating and opening file":{invoke:{id:"create-and-open-file",src:"createAndOpenFile",input:({event:t,context:e})=>t.type!=="Create file"?{name:"",makeDir:!1,selectedDirectory:e.selectedDirectory,content:"",shouldSetToRename:!1}:{name:t.data.name,makeDir:t.data.makeDir,selectedDirectory:e.selectedDirectory,content:t.data.content??"",shouldSetToRename:t.data.shouldSetToRename??!1},onDone:[{target:"Reading files",actions:[{type:"createToastSuccess",params:({event:t})=>({message:t.output.message})},"addFileToRenamingQueue","navigateToFile"],guard:"Should set to rename"},{target:"Reading files",actions:[{type:"createToastSuccess",params:({event:t})=>({message:t.output.message})},"navigateToFile"]}],onError:[{target:"Reading files",actions:["toastError"]}]}},"Renaming file":{invoke:{id:"rename-file",src:"renameFile",input:({event:t,context:e})=>t.type!=="Rename file"?{oldName:"",newName:"",isDir:!1,selectedDirectory:{}}:{oldName:t.data.oldName,newName:t.data.newName,isDir:t.data.isDir,selectedDirectory:e.selectedDirectory},onDone:[{target:"#File machine.Reading files",actions:["renameToastSuccess"],guard:"Name has been changed"},"Reading files"],onError:[{target:"#File machine.Reading files",actions:["toastError"]}]},exit:"removeFileFromRenamingQueue"},"Deleting file":{invoke:{id:"delete-file",src:"deleteFile",input:({event:t})=>t.type!=="Delete file"?{path:"",children:[],name:""}:{path:t.data.path,children:t.data.children,name:t.data.name},onDone:[{actions:["toastSuccess"],target:"#File machine.Reading files"}],onError:{actions:["toastError"],target:"#File machine.Has files"}}},"Reading files":{invoke:{id:"read-files",src:"readFiles",input:({context:t})=>t.project,onDone:[{guard:"Has at least 1 file",target:"Has files",actions:["setFiles"]},{target:"Has no files",actions:["setFiles"]}],onError:[{target:"Has no files",actions:["toastError"]}]}},"Opening file":{entry:["navigateToFile"]},"Creating file":{invoke:{src:"createFile",id:"create-file",input:({event:t,context:e})=>t.type!=="Create file"?{name:"",makeDir:!1,selectedDirectory:{},content:""}:{name:t.data.name,makeDir:t.data.makeDir,selectedDirectory:e.selectedDirectory,content:t.data.content??""},onDone:"Reading files",onError:"Reading files"}}}});function yj({heading:t="Overwrite current file and units?",message:e="This will permanently replace the current code in the editor, and overwrite your current units."}){return b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"font-bold text-destroy-60",children:t}),b.jsx("p",{children:e})]})}function RPe(t,e){return[{name:"format-code",displayName:"Format Code",description:"Nicely formats the KCL code in the editor.",needsReview:!1,groupId:"code",icon:"code",onSubmit:()=>{be.format()}},{name:"open-kcl-example",displayName:"Open sample",description:"Imports an example KCL program into the editor.",needsReview:!0,icon:"code",reviewMessage:({argumentsToSubmit:n})=>n.method==="newFile"?yj({heading:"Create a new file, overwrite project units?",message:"This will add the sample as a new file to your project, and replace your current project units with the sample's units."}):yj({}),groupId:"code",onSubmit(n){if(!(n!=null&&n.sample))return;const r=`https://raw.githubusercontent.com/KittyCAD/kcl-samples/main/${encodeURIComponent(n.sample.replace(Ss,""))}/${encodeURIComponent(n.sample)}`,i=`https://raw.githubusercontent.com/KittyCAD/kcl-samples/main/${encodeURIComponent(n.sample.replace(Ss,""))}/${jq}`;Promise.all([fetch(r),fetch(i)]).then(async([s,o])=>{var u;if(!(s.ok&&o.ok))return console.error("Failed to fetch sample code:",s.statusText),Promise.reject(new Error("Failed to fetch sample code"));const a=await s.text(),l=iI(await o.text());let c={};return ie(l)||(c=XI(l)),{sampleName:n.sample,code:a,method:n.method,sampleUnits:((u=c.modeling)==null?void 0:u.defaultUnit)||"mm"}}).then(s=>{s!=null&&s.code&&t(s).catch(reportError)}).catch(reportError)},args:{method:{inputType:"options",required:!0,skip:!0,defaultValue:ft()?"newFile":"overwrite",options(){return[{value:"overwrite",name:"Overwrite current code",isCurrent:!ft()},...ft()?[{value:"newFile",name:"Create a new file",isCurrent:!0}]:[]]}},sample:{inputType:"options",required:!0,valueSummary(n){return typeof n=="string"&&n.length>12?n.substring(0,12)+"...":n},options:e}}}]}async function PPe(){let t=await fetch(S7.remote);return!t.ok&&(console.warn("Failed to fetch latest remote KCL samples manifest, falling back to local:",t.statusText),t=await fetch((ft()?".":"")+S7.localFallback),!t.ok)?(console.error("Failed to fetch fallback KCL samples manifest:",t.statusText),[]):t.json().then(e=>e)}const Aee=P.createContext({}),LPe=({children:t})=>{const e=Ui(),{commandBarSend:n}=ni(),{settings:r}=In(),{project:i,file:s}=hf(ut.FILE),[o,a]=at.useState([]);P.useEffect(()=>{async function d(){a(await PPe())}d().catch(reportError)},[]);const[l,c]=Ly(kPe.provide({actions:{renameToastSuccess:({event:d})=>{d.type==="xstate.done.actor.rename-file"&&Zr.success(d.output.message)},createToastSuccess:({event:d})=>{d.type==="xstate.done.actor.create-and-open-file"&&Zr.success(d.output.message)},toastSuccess:({event:d})=>{d.type!=="xstate.done.actor.rename-file"&&d.type!=="xstate.done.actor.delete-file"||Zr.success(d.output.message)},toastError:({event:d})=>{d.type==="xstate.done.actor.rename-file"&&Zr.error(d.output.message)},navigateToFile:({context:d,event:f})=>{f.type==="xstate.done.actor.create-and-open-file"&&(f.output&&"name"in f.output?(n({type:"Close"}),e(`..${ut.FILE}/${encodeURIComponent(d.selectedDirectory+window.electron.path.sep+f.output.name)}`)):f.output&&"path"in f.output&&f.output.path.endsWith(Ss)&&e(`..${ut.FILE}/${encodeURIComponent(f.output.path)}`))}},actors:{readFiles:Ht(async({input:d})=>{const f=(ft()?(await D_(d.path)).children:[])??[];return{...d,children:f}}),createAndOpenFile:Ht(async({input:d})=>{let f=d.name.trim()||PT,h;if(d.makeDir){let{name:A,path:p}=gj({entryName:f,baseDir:d.selectedDirectory.path});f=A,h=p,await window.electron.mkdir(h)}else{const{name:A,path:p}=lR({entryName:f,baseDir:d.selectedDirectory.path});f=A,h=p,await window.electron.writeFile(h,d.content??"")}return{message:`Successfully created "${f}"`,path:h,shouldSetToRename:d.shouldSetToRename}}),createFile:Ht(async({input:d})=>{let f=d.name.trim()||PT,h;if(d.makeDir){let{name:A,path:p}=gj({entryName:f,baseDir:d.selectedDirectory.path});f=A,h=p,await window.electron.mkdir(h)}else{const{name:A,path:p}=lR({entryName:f,baseDir:d.selectedDirectory.path});f=A,h=p,await window.electron.writeFile(h,d.content??"")}return{path:h}}),renameFile:Ht(async({input:d})=>{const{oldName:f,newName:h,isDir:A}=d,p=h?h.endsWith(Ss)||A?h:h+Ss:PT,m=window.electron.path.join(d.selectedDirectory.path,f),g=window.electron.path.join(d.selectedDirectory.path,p);if(m===g)return{message:"Old is the same as new.",newPath:g,oldPath:m};const y=await window.electron.readdir(window.electron.path.dirname(g));for(let w of y)if(w===h)return Promise.reject(new Error("Filename already exists."));return window.electron.rename(m,g),s?(m===s.path&&(i!=null&&i.path)?e(`..${ut.FILE}/${encodeURIComponent(g)}`):s!=null&&s.path.includes(m)&&e(`..${ut.FILE}/${encodeURIComponent(s.path.replace(m,g))}`),{message:`Successfully renamed "${f}" to "${p}"`,newPath:g,oldPath:m}):Promise.reject(new Error("file is not defined"))}),deleteFile:Ht(async({input:d})=>{const f=!!d.children;return f?await window.electron.rm(d.path,{recursive:!0}).catch(p=>console.error("Error deleting directory",p)):await window.electron.rm(d.path).catch(p=>console.error("Error deleting file",p)),i!=null&&i.path?(await window.electron.readdir(i.path)).filter(p=>p.endsWith(".kcl")).length!==0?((d.path===(s==null?void 0:s.path)||s!=null&&s.path.includes(d.path))&&(i!=null&&i.path)&&e(`../${ut.FILE}/${encodeURIComponent(i.path)}`),{message:`Successfully deleted ${f?"folder":"file"} "${d.name}"`}):(await window.electron.writeFile(window.electron.path.join(i.path,Sbe),""),e(0),{message:"No more files in project, created main.kcl"}):Promise.reject(new Error("Project path not set."))})}}),{input:{project:i,selectedDirectory:i}}),u=P.useMemo(()=>RPe(async d=>{d.method==="overwrite"?(Kt.updateCodeStateEditor(d.code),await be.executeCode(!0),await Kt.writeToFile()):d.method==="newFile"&&ft()&&c({type:"Create file",data:{name:d.sampleName,content:d.code,makeDir:!1}}),d.sampleUnits&&r.send({type:"set.modeling.defaultUnit",data:{level:"project",value:d.sampleUnits}})},o.map(d=>({value:d.file,name:d.title}))).filter(d=>o.length||d.name!=="open-kcl-example"),[Kt,be,c,o]);return P.useEffect(()=>(n({type:"Add commands",data:{commands:u}}),()=>{n({type:"Remove commands",data:{commands:u}})}),[n,u]),b.jsx(Aee.Provider,{value:{send:c,state:l,context:l.context},children:t})},hA=()=>P.useContext(Aee),pee=P.createContext({}),IPe=({children:t})=>{var C;const{auth:e,settings:{context:{app:{theme:n,enableSSAO:r},modeling:{defaultUnit:i,cameraProjection:s,highlightEdges:o,showScaleGrid:a}}}}=In(),l=Ui(),{context:c,send:u}=hA(),{file:d}=VI(),f=(C=e==null?void 0:e.context)==null?void 0:C.token,h=P.useRef(null),A=P.useMemo(()=>ZZ(),[]);let[p]=GI();const m=p.get("pool"),{commandBarState:g,commandBarSend:y}=ni(),[w,v,x]=Ly(Z5e.provide({actions:{"disable copilot":()=>{Ot.setCopilotEnabled(!1)},"enable copilot":()=>{Ot.setCopilotEnabled(!0)},"sketch exit execute":({context:{store:_}})=>{(async()=>{var S;await je.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"sketch_mode_disable"}}),Ke.camControls.syncDirection="clientToEngine",s.current==="perspective"&&await Ke.camControls.snapToPerspectiveBeforeHandingBackControlToEngine(),Ke.camControls.syncDirection="engineToClient",(S=_.videoElement)==null||S.pause(),be.executeCode().then(()=>{var E,T;(E=je.engineConnection)!=null&&E.idleMode||(T=_.videoElement)==null||T.play().catch(R=>{console.warn("Video playing was prevented",R)})}).catch(Bt)})().catch(Bt)},"Set mouse state":An(({context:_,event:S})=>{if(S.type!=="Set mouse state")return{};const E=()=>{var T,R,k;if(S.data.type==="isHovering"){const B=mi(S.data.on,Py),M=(T=B==null?void 0:B.userData)==null?void 0:T.pathToNode,F=JSON.stringify(M);return!B||!M?_.segmentHoverMap:(_.segmentHoverMap[F]!==void 0&&clearTimeout(_.segmentHoverMap[JSON.stringify(M)]),{..._.segmentHoverMap,[F]:0})}else if(S.data.type==="idle"&&_.mouseState.type==="isHovering"){const B=mi(_.mouseState.on,Py);if(!B||!((R=B==null?void 0:B.userData)!=null&&R.pathToNode))return _.segmentHoverMap;const M=JSON.stringify((k=B==null?void 0:B.userData)==null?void 0:k.pathToNode),F=setTimeout(()=>{Ke.modelingSend({type:"Set mouse state",data:{type:"timeoutEnd",pathToNodeString:M}})},1e3);return{..._.segmentHoverMap,[M]:F}}else if(S.data.type==="timeoutEnd"){const B={..._.segmentHoverMap};return delete B[S.data.pathToNodeString],B}return{}};return{mouseState:S.data,segmentHoverMap:E()}}),"Set Segment Overlays":An({segmentOverlays:({context:{segmentOverlays:_},event:S})=>{if(S.type!=="Set Segment Overlays")return{};if(S.data.type==="set-many")return S.data.overlays;if(S.data.type==="set-one")return{..._,[S.data.pathToNodeString]:S.data.seg};if(S.data.type==="delete-one"){const E={..._};return delete E[S.data.pathToNodeString],E}return{}}}),"Center camera on selection":()=>{je.sendSceneCommand({type:"modeling_cmd_req",cmd_id:Yt(),cmd:{type:"default_camera_center_to_selection"}}).catch(Bt)},"Set sketchDetails":An(({context:{sketchDetails:_},event:S})=>S.type!=="Delete segment"?{}:_?{sketchDetails:{..._,sketchPathToNode:S.data}}:{}),"Set selection":An(({context:{selectionRanges:_,sketchDetails:S},event:E})=>{const T="data"in E&&E.data&&"selectionType"in E.data&&E.data||"output"in E&&E.output&&"selectionType"in E.output&&E.output||null;if(!T)return{};const R=B=>{B&&Ot.editorView&&setTimeout(()=>{Ot.editorView&&Ot.editorView.dispatch({selection:B,annotations:[e_e,Bn.addToHistory.of(!1)]})})};let k={codeBasedSelections:[],otherSelections:[]};if(T.selectionType==="singleCodeCursor"){!T.selection&&Ot.isShiftDown||(!T.selection&&!Ot.isShiftDown?k={codeBasedSelections:[],otherSelections:[]}:T.selection&&!Ot.isShiftDown?k={codeBasedSelections:[T.selection],otherSelections:[]}:T.selection&&Ot.isShiftDown&&(k={codeBasedSelections:[..._.codeBasedSelections,T.selection],otherSelections:_.otherSelections}));const{engineEvents:B,codeMirrorSelection:M,updateSceneObjectColors:F}=i9({selections:k});return M&&R(M),B&&B.forEach(I=>{je.sendSceneCommand(I)}),F(),{selectionRanges:k}}if(T.selectionType==="mirrorCodeMirrorSelections")return{selectionRanges:T.selection};if(T.selectionType==="otherSelection"){Ot.isShiftDown?k={codeBasedSelections:_.codeBasedSelections,otherSelections:[T.selection]}:k={codeBasedSelections:[],otherSelections:[T.selection]};const{engineEvents:B,updateSceneObjectColors:M}=i9({selections:k});return B&&B.forEach(F=>{je.sendSceneCommand(F)}),M(),{selectionRanges:k}}return T.selectionType==="completeSelection"?(Ot.selectRange(T.selection),S?{selectionRanges:T.selection,sketchDetails:{...S,sketchPathToNode:T.updatedPathToNode||(S==null?void 0:S.sketchPathToNode)||[]}}:{selectionRanges:T.selection}):{}}),Make:({event:_})=>{if(_.type!=="Make")return;if(je.exportInfo){jt.error("Already exporting");return}je.exportInfo={intent:i5.Make,name:(d==null?void 0:d.name)||""},va.currentMachine=_.data.machine,sj({format:{type:"stl",coords:{forward:{axis:"y",direction:"negative"},up:{axis:"z",direction:"positive"}},storage:"ascii",units:"mm",selection:{type:"default_scene"}}}).catch(Bt)},"Engine export":({event:_})=>{if(_.type!=="Export")return;if(je.exportInfo){jt.error("Already exporting");return}je.exportInfo={intent:i5.Save,name:""};const S={..._.data};S.type==="gltf"&&(S.presentation="pretty"),(S.type==="obj"||S.type==="ply"||S.type==="step"||S.type==="stl")&&(S.coords={forward:{axis:"y",direction:"negative"},up:{axis:"z",direction:"positive"}}),(S.type==="obj"||S.type==="stl"||S.type==="ply")&&(S.units=i.current),(S.type==="ply"||S.type==="stl")&&(S.selection={type:"default_scene"}),sj({format:S}).catch(Bt)},"Submit to Text-to-CAD API":({event:_})=>{if(_.type!=="Text-to-CAD")return;const S=_.data.prompt.trim();S&&MPe({trimmedPrompt:S,fileMachineSend:u,navigate:l,commandBarSend:y,context:c,token:f,settings:{theme:n.current,highlightEdges:o.current}}).catch(Bt)}},guards:{"has valid sweep selection":({context:{selectionRanges:_}})=>_.codeBasedSelections.length===0||Bxe(_)||Txe(_,Kt.code)?Rwe(be.ast):gI(_)?Mxe(_):!1,"has valid selection for deletion":({context:{selectionRanges:_}})=>!(!g.matches("Closed")||_.codeBasedSelections.length<=0),"has valid fillet selection":({context:{selectionRanges:_}})=>Cke({selectionRanges:_,ast:be.ast,code:Kt.code}),"Selection is on face":({context:{selectionRanges:_},event:S})=>{var E;return S.type!=="Enter sketch"||(E=S.data)!=null&&E.forceNewSketch||!hI(_,be.ast)?!1:!!mI(je.artifactGraph,_)},"Has exportable geometry":()=>{var _;if(be.kclErrors.length===0&&be.ast.body.length>0)return!0;{let S="Unable to Export ";return be.kclErrors.length>0?S+="due to KCL Errors":be.ast.body.length===0&&(S+="due to Empty Scene"),console.error(S),jt.error(S,{id:(_=be.engineCommandManager.pendingExport)==null?void 0:_.toastId}),!1}}},actors:{"AST-undo-startSketchOn":Ht(async({input:{sketchDetails:_}})=>{if(_){if(be.ast.body.length){const S=structuredClone(be.ast),E=_.sketchPathToNode[1][0];S.body=S.body.filter((T,R)=>R!==E),await be.executeAstMock(S)}Ke.setCallbacks({onClick:()=>{},onDrag:()=>{}})}}),"animate-to-face":Ht(async({input:_})=>{if(!_)return;if(_.type==="extrudeFace"){const T=bwe(be.ast,_.sketchPathToNode,_.extrudePathToNode,_.faceInfo);if(ie(T)){const B=new Error("Incompatible face, please try another");return pt(B),Promise.reject(B)}const{modifiedAst:R,pathToNode:k}=T;return await be.executeAstMock(R),await QT(je,_.faceId),Ke.camControls.syncDirection="clientToEngine",{sketchPathToNode:k,zAxis:_.zAxis,yAxis:_.yAxis,origin:_.position}}const{modifiedAst:S,pathToNode:E}=mwe(be.ast,_.plane);return await be.updateAst(S,!1),Ke.camControls.syncDirection="clientToEngine",await QT(je,_.planeId),{sketchPathToNode:E,zAxis:_.zAxis,yAxis:_.yAxis,origin:[0,0,0]}}),"animate-to-sketch":Ht(async({input:{selectionRanges:_}})=>{var R;const S=_.codeBasedSelections[0].range,E=un(be.ast,S),T=await Fxe(E||[]);return await QT(je,((R=T==null?void 0:T.sketchDetails)==null?void 0:R.faceId)||""),{sketchPathToNode:E||[],zAxis:T.sketchDetails.zAxis||null,yAxis:T.sketchDetails.yAxis||null,origin:T.sketchDetails.origin.map(k=>k/Ke._baseUnitMultiplier)}}),"Get horizontal info":Ht(async({input:{selectionRanges:_,sketchDetails:S}})=>{const{modifiedAst:E,pathToNodeMap:T}=await CH({constraint:"setHorzDistance",selectionRanges:_}),R=Rr(wr(E));if(!S)return Promise.reject(new Error("No sketch details"));const k=jf(S.sketchPathToNode,T),B=await sn.updateAstAndRejigSketch(k,R,S.zAxis,S.yAxis,S.origin);if(ie(B))return Promise.reject(B);const M=Gi(T,_,B.newAst);return ie(M)?Promise.reject(M):{selectionType:"completeSelection",selection:M,updatedPathToNode:k}}),"Get vertical info":Ht(async({input:{selectionRanges:_,sketchDetails:S}})=>{const{modifiedAst:E,pathToNodeMap:T}=await CH({constraint:"setVertDistance",selectionRanges:_}),R=Rr(wr(E));if(!S)return Promise.reject(new Error("No sketch details"));const k=jf(S.sketchPathToNode,T),B=await sn.updateAstAndRejigSketch(k,R,S.zAxis,S.yAxis,S.origin);if(ie(B))return Promise.reject(B);const M=Gi(T,_,B.newAst);return ie(M)?Promise.reject(M):{selectionType:"completeSelection",selection:M,updatedPathToNode:k}}),"Get angle info":Ht(async({input:{selectionRanges:_,sketchDetails:S}})=>{const E=P6({selectionRanges:_});if(ie(E))return Promise.reject(E);const{modifiedAst:T,pathToNodeMap:R}=await(E.enabled?fke({selectionRanges:_}):SH({selectionRanges:_,angleOrLength:"setAngle"})),k=Rr(wr(T));if(ie(k))return Promise.reject(k);if(!S)return Promise.reject(new Error("No sketch details"));const B=jf(S.sketchPathToNode,R),M=await sn.updateAstAndRejigSketch(B,k,S.zAxis,S.yAxis,S.origin);if(ie(M))return Promise.reject(M);const F=Gi(R,_,M.newAst);return ie(F)?Promise.reject(F):{selectionType:"completeSelection",selection:F,updatedPathToNode:B}}),"Get length info":Ht(async({input:{selectionRanges:_,sketchDetails:S}})=>{const{modifiedAst:E,pathToNodeMap:T}=await SH({selectionRanges:_}),R=Rr(wr(E));if(!S)return Promise.reject(new Error("No sketch details"));const k=jf(S.sketchPathToNode,T),B=await sn.updateAstAndRejigSketch(k,R,S.zAxis,S.yAxis,S.origin);if(ie(B))return Promise.reject(B);const M=Gi(T,_,B.newAst);return ie(M)?Promise.reject(M):{selectionType:"completeSelection",selection:M,updatedPathToNode:k}}),"Get perpendicular distance info":Ht(async({input:{selectionRanges:_,sketchDetails:S}})=>{const{modifiedAst:E,pathToNodeMap:T}=await Tke({selectionRanges:_}),R=Rr(wr(E));if(!S)return Promise.reject(new Error("No sketch details"));const k=jf(S.sketchPathToNode,T),B=await sn.updateAstAndRejigSketch(k,R,S.zAxis,S.yAxis,S.origin);if(ie(B))return Promise.reject(B);const M=Gi(T,_,B.newAst);return ie(M)?Promise.reject(M):{selectionType:"completeSelection",selection:M,updatedPathToNode:k}}),"Get ABS X info":Ht(async({input:{selectionRanges:_,sketchDetails:S}})=>{const{modifiedAst:E,pathToNodeMap:T}=await TH({constraint:"xAbs",selectionRanges:_}),R=Rr(wr(E));if(!S)return Promise.reject(new Error("No sketch details"));const k=jf(S.sketchPathToNode,T),B=await sn.updateAstAndRejigSketch(k,R,S.zAxis,S.yAxis,S.origin);if(ie(B))return Promise.reject(B);const M=Gi(T,_,B.newAst);return ie(M)?Promise.reject(M):{selectionType:"completeSelection",selection:M,updatedPathToNode:k}}),"Get ABS Y info":Ht(async({input:{selectionRanges:_,sketchDetails:S}})=>{const{modifiedAst:E,pathToNodeMap:T}=await TH({constraint:"yAbs",selectionRanges:_}),R=Rr(wr(E));if(!S)return Promise.reject(new Error("No sketch details"));const k=jf(S.sketchPathToNode,T),B=await sn.updateAstAndRejigSketch(k,R,S.zAxis,S.yAxis,S.origin);if(ie(B))return Promise.reject(B);const M=Gi(T,_,B.newAst);return ie(M)?Promise.reject(M):{selectionType:"completeSelection",selection:M,updatedPathToNode:k}}),"Get convert to variable info":Ht(async({input:{selectionRanges:_,sketchDetails:S,data:E}})=>{if(!S)return Promise.reject(new Error("No sketch details"));const{variableName:T}=await oee({valueName:(E==null?void 0:E.variableName)||"var"});let R=Rr(wr(be.ast));if(pt(R))return Promise.reject(R);R=R;const{modifiedAst:k,pathToReplacedNode:B}=xwe(R,be.programMemory,(E==null?void 0:E.pathToNode)||[],T);if(R=Rr(wr(k)),pt(R))return Promise.reject(R);if(R=R,!B)return Promise.reject(new Error("No path to replaced node"));const M=await sn.updateAstAndRejigSketch(B||[],R,S.zAxis,S.yAxis,S.origin);if(ie(M))return Promise.reject(M);const F=Gi({0:B},_,M.newAst);return ie(F)?Promise.reject(F):{selectionType:"completeSelection",selection:F,updatedPathToNode:B}})}}),{input:{...tR,store:{...tR.store,...A}}});return nRe(h,v,w.context,{pool:m,theme:n.current,highlightEdges:o.current,enableSSAO:r.current,showScaleGrid:a.current,cameraProjection:s.current},f),P.useEffect(()=>(be.registerExecuteCallback(()=>{v({type:"Re-execute"})}),()=>{v({type:"Cancel"})}),[v]),P.useEffect(()=>{Ot.modelingSend=v},[v]),P.useEffect(()=>{Ot.modelingState=w},[w]),P.useEffect(()=>{Ot.selectionRanges=w.context.selectionRanges},[w.context.selectionRanges]),P.useEffect(()=>{var S;const _=({detail:E})=>{E.type===No.Disconnecting&&v({type:"Cancel"})};return(S=je.engineConnection)==null||S.addEventListener(Nc.ConnectionStateChanged,_),()=>{var E;(E=je.engineConnection)==null||E.removeEventListener(Nc.ConnectionStateChanged,_)}},[je.engineConnection,v]),Tr(["backspace","delete","del"],()=>{v({type:"Delete selection"})}),Tr(["mod + alt + c"],()=>{v({type:"Center camera on selection"})}),ZI({machineId:"modeling",state:w,send:v,actor:x,commandBarConfig:gRe,allCommandsRequireNetwork:!0,onCancel:()=>v({type:"Cancel"})}),b.jsx(pee.Provider,{value:{state:w,context:w.context,send:v},children:b.jsx("div",{className:"h-screen overflow-hidden select-none",ref:h,children:t})})},Ti=()=>P.useContext(pee),OPe=()=>{const[t,e]=P.useState(!0),n=P.useRef(null),{settings:r}=In(),{state:i,send:s}=Ti(),{mediaStream:o}=bJ(),{overallState:a,immediateState:l}=Lg(),[c,u]=P.useState("unset"),{file:d}=hf(ut.FILE),f=r.context.app.streamIdleMode.current,h=a===ti.Ok||a===ti.Weak;function A(){be.executeCode(!0).then(async()=>{var m;await((m=n.current)==null?void 0:m.play().catch(g=>{console.warn("Video playing was prevented",g,n.current)})),u("playing")})}P.useEffect(()=>{var m;(m=je.engineConnection)!=null&&m.isReady()&&(d!=null&&d.path)&&(console.log("execute on file change"),A())},[d==null?void 0:d.path,je.engineConnection]),P.useEffect(()=>{l.type===No.Disconnecting&&l.value.type===ng.Pause&&u("paused")},[l]),P.useEffect(()=>{var _,S,E,T,R,k,B,M,F,I,z,Y,$,ee;const m=W=>{W.target&&W.target instanceof HTMLElement&&!("explicitOriginalTarget"in W)||"explicitOriginalTarget"in W&&(W.explicitOriginalTarget.contentEditable==="true"||["INPUT","TEXTAREA"].some(fe=>fe===W.explicitOriginalTarget.tagName))||(W.preventDefault(),W.stopPropagation(),W.stopImmediatePropagation())};(S=(_=globalThis==null?void 0:globalThis.window)==null?void 0:_.document)==null||S.addEventListener("paste",m,{capture:!0});const g=1e3*60*2;let y;const w=()=>{var W;c!=="paused"&&((W=n.current)==null||W.pause(),u("paused"),Ke.modelingSend({type:"Cancel"}),window.requestAnimationFrame(()=>{je.tearDown({idleMode:!0})}))},v=()=>{var W;globalThis.window.document.visibilityState==="hidden"?(clearTimeout(y),y=setTimeout(w,g)):(W=je.engineConnection)!=null&&W.isReady()||(clearTimeout(y),u("resuming"))};f&&((T=(E=globalThis==null?void 0:globalThis.window)==null?void 0:E.document)==null||T.addEventListener("visibilitychange",v));let x;const C=()=>{c==="playing"&&(clearTimeout(y),clearTimeout(x),x=setTimeout(w,g)),c==="paused"&&u("resuming")};return f&&((k=(R=globalThis==null?void 0:globalThis.window)==null?void 0:R.document)==null||k.addEventListener("keydown",C),(M=(B=globalThis==null?void 0:globalThis.window)==null?void 0:B.document)==null||M.addEventListener("mousemove",C),(I=(F=globalThis==null?void 0:globalThis.window)==null?void 0:F.document)==null||I.addEventListener("mousedown",C),(Y=(z=globalThis==null?void 0:globalThis.window)==null?void 0:z.document)==null||Y.addEventListener("scroll",C),(ee=($=globalThis==null?void 0:globalThis.window)==null?void 0:$.document)==null||ee.addEventListener("touchstart",C)),f&&(x=setTimeout(w,g)),je.addEventListener(Wh.SceneReady,A),()=>{var W,ne,Se,fe,ge,Oe,Fe,De,ke,Ge,Ve,q,Ue,O;je.removeEventListener(Wh.SceneReady,A),(ne=(W=globalThis==null?void 0:globalThis.window)==null?void 0:W.document)==null||ne.removeEventListener("paste",m,{capture:!0}),f&&(clearTimeout(y),clearTimeout(x),(fe=(Se=globalThis==null?void 0:globalThis.window)==null?void 0:Se.document)==null||fe.removeEventListener("visibilitychange",v),(Oe=(ge=globalThis==null?void 0:globalThis.window)==null?void 0:ge.document)==null||Oe.removeEventListener("keydown",C),(De=(Fe=globalThis==null?void 0:globalThis.window)==null?void 0:Fe.document)==null||De.removeEventListener("mousemove",C),(Ge=(ke=globalThis==null?void 0:globalThis.window)==null?void 0:ke.document)==null||Ge.removeEventListener("mousedown",C),(q=(Ve=globalThis==null?void 0:globalThis.window)==null?void 0:Ve.document)==null||q.removeEventListener("scroll",C),(O=(Ue=globalThis==null?void 0:globalThis.window)==null?void 0:Ue.document)==null||O.removeEventListener("touchstart",C))}},[f,c]),P.useEffect(()=>{be.isExecuting||setTimeout(()=>{var m;(m=n.current)==null||m.play().catch(g=>{console.warn("Video playing was prevented",g,n.current)})})},[be.isExecuting]),P.useEffect(()=>{if(!(typeof window>"u"||typeof RTCPeerConnection>"u")&&n.current&&o){try{n.current.srcObject=o,n.current.pause()}catch(m){console.warn("Attempted to pause stream while play was still loading",m)}s({type:"Set context",data:{videoElement:n.current}}),e(!1)}},[o]);const p=m=>{h&&n.current&&(i.matches("Sketch")||i.matches({idle:"showPlanes"})||br(m.nativeEvent).left&&Pxe(m,n.current))};return b.jsxs("div",{className:"absolute inset-0 z-0",id:"stream","data-testid":"stream",onClick:p,onContextMenu:m=>m.preventDefault(),onContextMenuCapture:m=>m.preventDefault(),children:[b.jsx("video",{ref:n,muted:!0,autoPlay:!0,controls:!1,onPlay:()=>e(!1),className:"w-full cursor-pointer h-full",disablePictureInPicture:!0,id:"video-stream"}),b.jsx(Q5e,{cameraControls:r.context.modeling.mouseControls.current}),(c==="paused"||c==="resuming")&&b.jsx("div",{className:"text-center absolute inset-0",children:b.jsxs("div",{className:"flex flex-col items-center justify-center h-screen","data-testid":"paused",children:[b.jsx("div",{className:"border-primary border p-2 rounded-sm",children:b.jsx("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12V0H0V12H2ZM8 12V0H6V12H8Z",fill:"var(--primary)"})})}),b.jsxs("p",{className:"text-base mt-2 text-primary bold",children:[c==="paused"&&"Paused",c==="resuming"&&"Resuming"]})]})}),(!h||t)&&b.jsx("div",{className:"text-center absolute inset-0",children:b.jsx(SI,{children:!h&&!t?b.jsx("span",{"data-testid":"loading-stream",children:"Stream disconnected..."}):!t&&b.jsx("span",{"data-testid":"loading-stream",children:"Loading stream..."})})})]})};function FPe({splitMenuItems:t,className:e,children:n,...r}){return b.jsx(er,{className:`action-button p-0 m-0 group mono text-xs leading-none flex items-center gap-2 rounded-sm border-solid border border-chalkboard-30 hover:border-chalkboard-40 enabled:dark:border-chalkboard-70 dark:hover:border-chalkboard-60 dark:bg-chalkboard-90/50 text-chalkboard-100 dark:text-chalkboard-10 ${e}`,children:({close:s})=>b.jsxs(b.Fragment,{children:[n,b.jsxs(er.Button,{className:"border-transparent dark:border-transparent p-0 m-0 rounded-none !outline-none ui-open:border-primary ui-open:bg-primary",children:[b.jsx(nn,{name:"caretDown",className:"w-3.5 h-5 text-chalkboard-70 dark:text-chalkboard-40 rounded-none ui-open:rotate-180 ui-open:!text-chalkboard-10"}),b.jsxs("span",{className:"sr-only",children:[r.name?r.name+": ":"","open menu"]})]}),b.jsx(er.Panel,{as:"ul",className:"!pointer-events-auto absolute z-20 left-1/2 -translate-x-1/2 top-full mt-4 w-fit max-w-[280px] max-h-[80vh] overflow-y-auto py-2 flex flex-col align-stretch text-inherit dark:text-chalkboard-10 bg-chalkboard-10 dark:bg-chalkboard-100 rounded shadow-lg border border-solid border-chalkboard-30 dark:border-chalkboard-80 text-sm m-0 p-0",children:t.map(o=>b.jsx("li",{className:"contents",children:b.jsxs("button",{onClick:()=>{o.onClick(),s()},className:"group/button flex items-center gap-6 px-3 py-1 font-sans text-xs hover:bg-primary/10 dark:hover:bg-chalkboard-80 border-0 m-0 w-full rounded-none text-left disabled:!bg-transparent dark:disabled:text-chalkboard-60",disabled:o.disabled,"data-testid":"dropdown-"+o.id,children:[b.jsx("span",{className:"capitalize flex-grow text-left",children:o.label}),o.status==="unavailable"?b.jsxs("div",{className:"flex flex-none items-center gap-1",children:[b.jsx("span",{className:"text-chalkboard-70 dark:text-chalkboard-40",children:"In development"}),b.jsx(nn,{name:"lockClosed",className:"w-4 h-4 text-chalkboard-70 dark:text-chalkboard-40"})]}):o.status==="kcl-only"?b.jsxs("div",{className:"flex flex-none items-center gap-1",children:[b.jsx("span",{className:"text-chalkboard-70 dark:text-chalkboard-40",children:"KCL code only"}),b.jsx(nn,{name:"code",className:"w-4 h-4 text-chalkboard-70 dark:text-chalkboard-40"})]}):o.shortcut?b.jsx("kbd",{className:"hotkey flex-none group-disabled/button:text-chalkboard-50 dark:group-disabled/button:text-chalkboard-70 group-disabled/button:border-chalkboard-20 dark:group-disabled/button:border-chalkboard-80",children:o.shortcut}):null]})},o.label))})]})})}const vj={modeling:{check:t=>!(t.matches("Sketch")||t.matches("Sketch no face")),items:[{id:"sketch",onClick:({modelingSend:t,sketchPathId:e})=>t(e?{type:"Enter sketch"}:{type:"Enter sketch",data:{forceNewSketch:!0}}),icon:"sketch",status:"available",disabled:t=>!t.matches("idle"),title:({sketchPathId:t})=>`${t?"Edit":"Start"} Sketch`,showTitle:!0,hotkey:"S",description:"Start drawing a 2D sketch",links:[{label:"KCL docs",url:"https://zoo.dev/docs/kcl/startSketchOn"}]},"break",{id:"extrude",onClick:({commandBarSend:t})=>t({type:"Find and select command",data:{name:"Extrude",groupId:"modeling"}}),disabled:t=>!t.can({type:"Extrude"}),icon:"extrude",status:"available",title:"Extrude",hotkey:"E",description:"Pull a sketch into 3D along its normal or perpendicular.",links:[{label:"KCL docs",url:"https://zoo.dev/docs/kcl/extrude"}]},{id:"revolve",onClick:({commandBarSend:t})=>t({type:"Find and select command",data:{name:"Revolve",groupId:"modeling"}}),disabled:t=>!t.can({type:"Revolve"}),icon:"revolve",status:C_?"available":"kcl-only",title:"Revolve",hotkey:"R",description:"Create a 3D body by rotating a sketch region about an axis.",links:[{label:"KCL docs",url:"https://zoo.dev/docs/kcl/revolve"},{label:"KCL example",url:"https://zoo.dev/docs/kcl-samples/ball-bearing"}]},{id:"sweep",onClick:()=>console.error("Sweep not yet implemented"),icon:"sweep",status:"unavailable",title:"Sweep",hotkey:"W",description:"Create a 3D body by moving a sketch region along an arbitrary path.",links:[{label:"GitHub discussion",url:"https://github.com/KittyCAD/modeling-app/discussions/498"}]},{id:"loft",onClick:()=>console.error("Loft not yet implemented"),icon:"loft",status:"kcl-only",title:"Loft",hotkey:"L",description:"Create a 3D body by blending between two or more sketches.",links:[{label:"KCL docs",url:"https://zoo.dev/docs/kcl/loft"},{label:"GitHub discussion",url:"https://github.com/KittyCAD/modeling-app/discussions/613"}]},"break",{id:"fillet3d",onClick:({commandBarSend:t})=>t({type:"Find and select command",data:{name:"Fillet",groupId:"modeling"}}),icon:"fillet3d",status:C_?"available":"kcl-only",disabled:t=>!t.can({type:"Fillet"}),title:"Fillet",hotkey:"F",description:"Round the edges of a 3D solid.",links:[{label:"KCL docs",url:"https://zoo.dev/docs/kcl/fillet"}]},{id:"chamfer",onClick:()=>console.error("Chamfer not yet implemented"),icon:"chamfer3d",status:"kcl-only",title:"Chamfer",hotkey:"C",description:"Bevel the edges of a 3D solid.",links:[{label:"KCL docs",url:"https://zoo.dev/docs/kcl/chamfer"}]},{id:"shell",onClick:()=>console.error("Shell not yet implemented"),icon:"shell",status:"kcl-only",title:"Shell",description:"Hollow out a 3D solid.",links:[{label:"KCL docs",url:"https://zoo.dev/docs/kcl/shell"}]},{id:"hole",onClick:()=>console.error("Hole not yet implemented"),icon:"hole",status:"unavailable",title:"Hole",description:"Create a hole in a 3D solid.",links:[]},"break",[{id:"boolean-union",onClick:()=>console.error("Boolean union not yet implemented"),icon:"booleanUnion",status:"unavailable",title:"Union",hotkey:"Shift + B U",description:"Combine two or more solids into a single solid.",links:[{label:"GitHub discussion",url:"https://github.com/KittyCAD/modeling-app/discussions/509"}]},{id:"boolean-subtract",onClick:()=>console.error("Boolean subtract not yet implemented"),icon:"booleanSubtract",status:"unavailable",title:"Subtract",hotkey:"Shift + B S",description:"Subtract one solid from another.",links:[{label:"GitHub discussion",url:"https://github.com/KittyCAD/modeling-app/discussions/510"}]},{id:"boolean-intersect",onClick:()=>console.error("Boolean intersect not yet implemented"),icon:"booleanIntersect",status:"unavailable",title:"Intersect",hotkey:"Shift + B I",description:"Create a solid from the intersection of two solids.",links:[{label:"GitHub discussion",url:"https://github.com/KittyCAD/modeling-app/discussions/511"}]}],[{id:"plane-offset",onClick:()=>console.error("Plane through normal not yet implemented"),icon:"plane",status:"unavailable",title:"Offset plane",description:"Create a plane parallel to an existing plane.",links:[]},{id:"plane-points",onClick:()=>console.error("Plane through points not yet implemented"),status:"unavailable",title:"3-point plane",description:"Create a plane from three points.",links:[]}]]},sketching:{check:t=>t.matches("Sketch")||t.matches("Sketch no face"),items:[{id:"sketch-exit",onClick:({modelingSend:t})=>t({type:"Cancel"}),disableHotkey:t=>!(t.matches({Sketch:"SketchIdle"})||t.matches("Sketch no face")),icon:"arrowLeft",status:"available",title:"Exit sketch",showTitle:!0,hotkey:"Esc",description:"Exit the current sketch",links:[]},"break",{id:"line",onClick:({modelingState:t,modelingSend:e})=>{t.matches({Sketch:{"Line tool":"No Points"}})?e({type:"Cancel"}):e({type:"change tool",data:{tool:t.matches({Sketch:"Line tool"})?"none":"line"}})},icon:"line",status:"available",disabled:t=>t.matches("Sketch no face")||t.matches({Sketch:{"Rectangle tool":"Awaiting second corner"}})||t.matches({Sketch:{"Circle tool":"Awaiting Radius"}})||tRe(t.context),title:"Line",hotkey:t=>t.matches({Sketch:"Line tool"})?["Esc","L"]:"L",description:"Start drawing straight lines",links:[],isActive:t=>t.matches({Sketch:"Line tool"})},[{id:"tangential-arc",onClick:({modelingState:t,modelingSend:e})=>e({type:"change tool",data:{tool:t.matches({Sketch:"Tangential arc to"})?"none":"tangentialArc"}}),icon:"arc",status:"available",disabled:t=>!nR(t.context)&&!t.matches({Sketch:"Tangential arc to"})||eRe(t.context),title:"Tangential Arc",hotkey:t=>t.matches({Sketch:"Tangential arc to"})?["Esc","A"]:"A",description:"Start drawing an arc tangent to the current segment",links:[],isActive:t=>t.matches({Sketch:"Tangential arc to"})},{id:"three-point-arc",onClick:()=>console.error("Three-point arc not yet implemented"),icon:"arc",status:"unavailable",title:"Three-point Arc",showTitle:!1,description:"Draw a circular arc defined by three points",links:[{label:"GitHub issue",url:"https://github.com/KittyCAD/modeling-app/issues/1659"}]}],{id:"spline",onClick:()=>console.error("Spline not yet implemented"),icon:"spline",status:"unavailable",title:"Spline",showTitle:!1,description:"Draw a spline curve through a series of points",links:[]},"break",[{id:"circle-center",onClick:({modelingState:t,modelingSend:e})=>e({type:"change tool",data:{tool:t.matches({Sketch:"Circle tool"})?"none":"circle"}}),icon:"circle",status:"available",title:"Center circle",disabled:t=>!G_(t.context)&&!t.matches({Sketch:"Circle tool"}),isActive:t=>t.matches({Sketch:"Circle tool"}),hotkey:t=>t.matches({Sketch:"Circle tool"})?["Esc","C"]:"C",showTitle:!1,description:"Start drawing a circle from its center",links:[{label:"GitHub issue",url:"https://github.com/KittyCAD/modeling-app/issues/1501"}]},{id:"circle-three-points",onClick:()=>console.error("Three-point circle not yet implemented"),icon:"circle",status:"unavailable",title:"Three-point circle",showTitle:!1,description:"Draw a circle defined by three points",links:[]}],[{id:"corner-rectangle",onClick:({modelingState:t,modelingSend:e})=>e({type:"change tool",data:{tool:t.matches({Sketch:"Rectangle tool"})?"none":"rectangle"}}),icon:"rectangle",status:"available",disabled:t=>!G_(t.context)&&!t.matches({Sketch:"Rectangle tool"}),title:"Corner rectangle",hotkey:t=>t.matches({Sketch:"Rectangle tool"})?["Esc","R"]:"R",description:"Start drawing a rectangle",links:[],isActive:t=>t.matches({Sketch:"Rectangle tool"})},{id:"center-rectangle",onClick:()=>console.error("Center rectangle not yet implemented"),icon:"rectangle",status:"unavailable",title:"Center rectangle",showTitle:!1,description:"Start drawing a rectangle from its center",links:[]}],{id:"polygon",onClick:()=>console.error("Polygon not yet implemented"),icon:"polygon",status:"unavailable",title:"Polygon",showTitle:!1,description:"Draw a polygon with a specified number of sides",links:[]},{id:"text",onClick:()=>console.error("Text not yet implemented"),icon:"text",status:"unavailable",title:"Text",showTitle:!1,description:"Add text to your sketch as geometry.",links:[]},"break",{id:"mirror",onClick:()=>console.error("Mirror not yet implemented"),icon:"mirror",status:"unavailable",title:"Mirror",showTitle:!1,description:"Mirror sketch entities about a line or axis",links:[]},[{id:"constraint-length",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain length"})),onClick:({modelingSend:t})=>t({type:"Constrain length"}),icon:"dimension",status:"available",title:"Length",showTitle:!1,description:"Constrain the length of a straight segment",links:[]},{id:"constraint-angle",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain angle"})),onClick:({modelingSend:t})=>t({type:"Constrain angle"}),status:"available",title:"Angle",showTitle:!1,description:"Constrain the angle between two segments",links:[]},{id:"constraint-vertical",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Make segment vertical"})),onClick:({modelingSend:t})=>t({type:"Make segment vertical"}),status:"available",title:"Vertical",showTitle:!1,description:"Constrain a straight segment to be vertical relative to the sketch",links:[]},{id:"constraint-horizontal",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Make segment horizontal"})),onClick:({modelingSend:t})=>t({type:"Make segment horizontal"}),status:"available",title:"Horizontal",showTitle:!1,description:"Constrain a straight segment to be horizontal relative to the sketch",links:[]},{id:"constraint-parallel",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain parallel"})),onClick:({modelingSend:t})=>t({type:"Constrain parallel"}),status:"available",title:"Parallel",showTitle:!1,description:"Constrain two segments to be parallel",links:[]},{id:"constraint-equal-length",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain equal length"})),onClick:({modelingSend:t})=>t({type:"Constrain equal length"}),status:"available",title:"Equal length",showTitle:!1,description:"Constrain two segments to be equal length",links:[]},{id:"constraint-horizontal-distance",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain horizontal distance"})),onClick:({modelingSend:t})=>t({type:"Constrain horizontal distance"}),status:"available",title:"Horizontal distance",showTitle:!1,description:"Constrain the horizontal distance between two points",links:[]},{id:"constraint-vertical-distance",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain vertical distance"})),onClick:({modelingSend:t})=>t({type:"Constrain vertical distance"}),status:"available",title:"Vertical distance",showTitle:!1,description:"Constrain the vertical distance between two points",links:[]},{id:"constraint-absolute-x",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain ABS X"})),onClick:({modelingSend:t})=>t({type:"Constrain ABS X"}),status:"available",title:"Absolute X",showTitle:!1,description:"Constrain the x-coordinate of a point",links:[]},{id:"constraint-absolute-y",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain ABS Y"})),onClick:({modelingSend:t})=>t({type:"Constrain ABS Y"}),status:"available",title:"Absolute Y",showTitle:!1,description:"Constrain the y-coordinate of a point",links:[]},{id:"constraint-perpendicular-distance",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain perpendicular distance"})),onClick:({modelingSend:t})=>t({type:"Constrain perpendicular distance"}),status:"available",title:"Perpendicular distance",showTitle:!1,description:"Constrain the perpendicular distance between two segments",links:[]},{id:"constraint-align-horizontal",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain horizontally align"})),onClick:({modelingSend:t})=>t({type:"Constrain horizontally align"}),status:"available",title:"Horizontally align",showTitle:!1,description:"Align the ends of two or more segments horizontally",links:[]},{id:"constraint-align-vertical",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain vertically align"})),onClick:({modelingSend:t})=>t({type:"Constrain vertically align"}),status:"available",title:"Vertically align",showTitle:!1,description:"Align the ends of two or more segments vertically",links:[]},{id:"snap-to-x",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain snap to X"})),onClick:({modelingSend:t})=>t({type:"Constrain snap to X"}),status:"available",title:"Snap to X",showTitle:!1,description:"Snap a point to an x-coordinate",links:[]},{id:"snap-to-y",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain snap to Y"})),onClick:({modelingSend:t})=>t({type:"Constrain snap to Y"}),status:"available",title:"Snap to Y",showTitle:!1,description:"Snap a point to a y-coordinate",links:[]},{id:"constraint-remove",disabled:t=>!(t.matches({Sketch:"SketchIdle"})&&t.can({type:"Constrain remove constraints"})),onClick:({modelingSend:t})=>t({type:"Constrain remove constraints"}),status:"available",title:"Remove constraints",showTitle:!1,description:"Remove all constraints from the segment",links:[]}]]}};function NPe({className:t="",...e}){var w;const{state:n,send:r,context:i}=Ti(),{commandBarSend:s}=ni(),o="group-disabled:text-chalkboard-50 !text-inherit dark:group-enabled:group-hover:!text-inherit",a="!bg-transparent",l="bg-chalkboard-transparent dark:bg-transparent disabled:bg-transparent dark:disabled:bg-transparent enabled:hover:bg-chalkboard-10 dark:enabled:hover:bg-chalkboard-100 pressed:!bg-primary pressed:enabled:hover:!text-chalkboard-10",c="!border-transparent hover:!border-chalkboard-20 dark:enabled:hover:!border-primary pressed:!border-primary ui-open:!border-primary",u=P.useMemo(()=>hI(i.selectionRanges,be.ast)?mI(je.artifactGraph,i.selectionRanges):!1,[je.artifactGraph,i.selectionRanges]),d=P.useRef(null),{overallState:f}=Lg(),{isExecuting:h}=uc(),{isStreamReady:A}=JI(),p=f!==ti.Ok&&f!==ti.Weak||h||!A,m=((w=Object.entries(vj).find(([v,x])=>x.check(n)))==null?void 0:w[0])||"modeling",g=P.useMemo(()=>({modelingState:n,modelingSend:r,commandBarSend:s,sketchPathId:u}),[n,r,s,u]),y=P.useMemo(()=>{return vj[m].items.map(x=>x==="break"?"break":Array.isArray(x)?x.map(v):v(x));function v(x){var C,_,S,E;return{...x,title:typeof x.title=="string"?x.title:x.title(g),description:x.description,links:x.links||[],isActive:(C=x.isActive)==null?void 0:C.call(x,n),hotkey:typeof x.hotkey=="string"?x.hotkey:(_=x.hotkey)==null?void 0:_.call(x,n),disabled:p||x.status!=="available"||((S=x.disabled)==null?void 0:S.call(x,n))===!0,disableHotkey:(E=x.disableHotkey)==null?void 0:E.call(x,n),status:x.status}}},[m,p,g]);return b.jsxs("menu",{className:"max-w-full whitespace-nowrap rounded-b px-2 py-1 bg-chalkboard-10 dark:bg-chalkboard-90 relative border border-chalkboard-30 dark:border-chalkboard-80 border-t-0 shadow-sm",children:[b.jsx("ul",{...e,ref:d,className:"has-[[aria-expanded=true]]:!pointer-events-none m-0 py-1 rounded-l-sm flex gap-1.5 items-center "+t,children:y.map((v,x)=>{if(v==="break")return b.jsx("div",{className:"h-5 w-[1px] block bg-chalkboard-30 dark:bg-chalkboard-80"},"break-"+x);if(Array.isArray(v))return b.jsxs(FPe,{Element:"button","data-testid":v[0].id+"-dropdown",id:v[0].id+"-dropdown",name:v[0].title,className:"group/wrapper "+c+" !bg-transparent relative group !gap-0",splitMenuItems:v.map(_=>({id:_.id,label:_.title,hotkey:_.hotkey,onClick:()=>_.onClick(g),disabled:p||_.status!=="available"||_.disabled===!0,status:_.status})),children:[b.jsx($t,{Element:"button",id:v[0].id,"data-testid":v[0].id,iconStart:{icon:v[0].icon,className:o,bgClassName:a},className:"!border-transparent !px-0 pressed:!text-chalkboard-10 pressed:enabled:hovered:!text-chalkboard-10 "+l,"aria-pressed":v[0].isActive,disabled:p||v[0].status!=="available"||v[0].disabled,name:v[0].title,"aria-description":v[0].description,onClick:()=>v[0].onClick(g),children:b.jsx("span",{className:v[0].showTitle?"":"sr-only",children:v[0].title})}),b.jsx(bj,{itemConfig:v[0],configCallbackProps:g})]},v[0].id);const C=v;return b.jsxs("div",{className:"relative",children:[b.jsx($t,{Element:"button",id:C.id,"data-testid":C.id,iconStart:{icon:C.icon,className:o,bgClassName:a},className:"pressed:!text-chalkboard-10 pressed:enabled:hovered:!text-chalkboard-10 "+c+" "+l+(C.showTitle?"":" !px-0"),name:C.title,"aria-description":C.description,"aria-pressed":C.isActive,disabled:p||C.status!=="available"||C.disabled,onClick:()=>C.onClick(g),children:b.jsx("span",{className:C.showTitle?"":"sr-only",children:C.title})},C.id),b.jsx(bj,{itemConfig:C,configCallbackProps:g})]},C.id)})}),n.matches("Sketch no face")&&b.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 mt-2 py-1 px-2 bg-chalkboard-10 dark:bg-chalkboard-90 border border-chalkboard-20 dark:border-chalkboard-80 rounded shadow-lg",children:b.jsx("p",{className:"text-xs",children:"Select a plane or face to start sketching"})})]})}const bj=P.memo(function({itemConfig:e,configCallbackProps:n}){return Tr(e.hotkey||"",()=>{e.onClick(n)},{enabled:e.status==="available"&&!!e.hotkey&&!e.disabled&&!e.disableHotkey}),b.jsxs(Fr,{inert:!1,wrapperStyle:ft()?{"-webkit-app-region":"no-drag"}:{},position:"bottom",wrapperClassName:"!p-4 !pointer-events-auto",contentClassName:"!text-left text-wrap !text-xs !p-0 !pb-2 flex gap-2 !max-w-none !w-72 flex-col items-stretch",children:[b.jsxs("div",{className:"rounded-top flex items-center gap-2 pt-3 pb-2 px-2 bg-chalkboard-20/50 dark:bg-chalkboard-80/50",children:[b.jsx("span",{className:`text-sm flex-1 ${e.status!=="available"?"text-chalkboard-70 dark:text-chalkboard-40":""}`,children:e.title}),e.status==="available"&&e.hotkey?b.jsx("kbd",{className:"flex-none hotkey",children:e.hotkey}):e.status==="kcl-only"?b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-wrap font-sans flex-0 text-chalkboard-70 dark:text-chalkboard-40",children:"KCL code only"}),b.jsx(nn,{name:"code",className:"w-5 h-5 text-chalkboard-70 dark:text-chalkboard-40"})]}):e.status==="unavailable"&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-wrap font-sans flex-0 text-chalkboard-70 dark:text-chalkboard-40",children:"In development"}),b.jsx(nn,{name:"lockClosed",className:"w-5 h-5 text-chalkboard-70 dark:text-chalkboard-40"})]})]}),b.jsx("p",{className:"px-2 text-ch font-sans",children:e.description}),e.links.length>0&&b.jsxs(b.Fragment,{children:[b.jsx("hr",{className:"border-chalkboard-20 dark:border-chalkboard-80"}),b.jsx("ul",{className:"p-0 px-1 m-0 flex flex-col",children:e.links.map(r=>b.jsx("li",{className:"contents",children:b.jsxs("a",{href:r.url,onClick:tu(r.url),target:"_blank",rel:"noreferrer",className:"flex items-center rounded-sm p-1 no-underline text-inherit hover:bg-primary/10 hover:text-primary dark:hover:bg-chalkboard-70 dark:hover:text-inherit",children:[b.jsxs("span",{className:"flex-1",children:["Open ",r.label]}),b.jsx(nn,{name:"link",className:"w-4 h-4"})]})},r.label))})]})]})});function AA(){var e;const t=hf(ut.FILE);return ut.FILE+"/"+encodeURIComponent(((e=t==null?void 0:t.file)==null?void 0:e.path)||T5)}function kv(){const[t,e]=P.useState("");return P.useEffect(()=>{e(oI())},[e]),t}const DPe=({user:t})=>{var d,f;const e=kv(),n=Js(),r=AA(),i=u(t),[s,o]=P.useState(!1),a=Ui(),l=(f=(d=In())==null?void 0:d.auth)==null?void 0:f.send,c=P.useMemo(()=>[{id:"settings",Element:"button",children:b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"flex-1",children:"User settings"}),b.jsx("kbd",{className:"hotkey",children:`${e==="macos"?"⌘":"Ctrl"}${ft()?"":"⬆"},`})]}),"data-testid":"user-settings",onClick:()=>{const h=n.pathname.includes(ut.FILE)?r+ut.SETTINGS_USER:ut.HOME+ut.SETTINGS_USER;a(h)}},{id:"keybindings",Element:"button",children:"Keyboard shortcuts",onClick:()=>{const h=n.pathname.includes(ut.FILE)?r+ut.SETTINGS_KEYBINDINGS:ut.HOME+ut.SETTINGS_KEYBINDINGS;a(h)}},{id:"account",Element:"externalLink",to:"https://zoo.dev/account",children:b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"flex-1",children:"Manage account"}),b.jsx(nn,{name:"link",className:"w-3 h-3 text-chalkboard-70 dark:text-chalkboard-40"})]})},"break",{id:"request-feature",Element:"externalLink",to:"https://github.com/KittyCAD/modeling-app/discussions",children:b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"flex-1",children:"Request a feature"}),b.jsx(nn,{name:"link",className:"w-3 h-3 text-chalkboard-70 dark:text-chalkboard-40"})]})},{id:"report-bug",Element:"externalLink",to:"https://github.com/KittyCAD/modeling-app/issues/new/choose",children:b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"flex-1",children:"Report a bug"}),b.jsx(nn,{name:"link",className:"w-3 h-3 text-chalkboard-70 dark:text-chalkboard-40"})]})},{id:"community",Element:"externalLink",to:"https://discord.gg/JQEpHR7Nt2",children:b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"flex-1",children:"Ask the community"}),b.jsx(nn,{name:"link",className:"w-3 h-3 text-chalkboard-70 dark:text-chalkboard-40"})]})},{id:"release-notes",Element:"externalLink",to:"https://github.com/KittyCAD/modeling-app/releases",children:b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"flex-1",children:"Release notes"}),b.jsx(nn,{name:"link",className:"w-3 h-3 text-chalkboard-70 dark:text-chalkboard-40"})]})},"break",{id:"sign-out",Element:"button","data-testid":"user-sidebar-sign-out",children:"Sign out",onClick:()=>l({type:"Log out"}),className:""}].filter(h=>{var A;return h==="break"||typeof h!="string"&&!((A=h.className)!=null&&A.includes("hidden"))}),[e,n,r,a,l]);(t==null?void 0:t.image)==="https://placekitten.com/200/200"&&(t.image="/cat.jpg");function u(h){return h?h.name?h.name:h.first_name?h.last_name?h.first_name+" "+h.last_name:h.first_name:h.email:null}return b.jsxs(er,{className:"relative",children:[b.jsxs(er.Button,{className:"relative group border-0 w-fit min-w-max p-0 rounded-l-full focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary","data-testid":"user-sidebar-toggle",children:[b.jsxs("div",{className:"flex items-center",children:[b.jsx("div",{className:"rounded-full border overflow-hidden",children:t!=null&&t.image&&!s?b.jsx("img",{src:(t==null?void 0:t.image)||"",alt:(t==null?void 0:t.name)||"",className:"h-7 w-7 rounded-full",referrerPolicy:"no-referrer",onError:()=>o(!0)}):b.jsx(nn,{name:"person",className:"w-5 h-5 text-chalkboard-70 dark:text-chalkboard-40 bg-chalkboard-20 dark:bg-chalkboard-80"})}),b.jsx(nn,{name:"caretDown",className:"w-4 h-4 text-chalkboard-70 dark:text-chalkboard-40 ui-open:rotate-180"})]}),b.jsx(Fr,{position:"bottom-right",delay:1e3,hoverOnly:!0,children:"User menu"})]}),b.jsx(Ci,{enter:"duration-100 ease-out",enterFrom:"opacity-0 -translate-y-2",enterTo:"opacity-100 translate-y-0",as:P.Fragment,children:b.jsx(er.Panel,{className:`z-10 absolute top-full right-0 mt-1 pb-1 w-48 bg-chalkboard-10 dark:bg-chalkboard-90
          border border-solid border-chalkboard-20 dark:border-chalkboard-90 rounded
          shadow-lg`,children:({close:h})=>b.jsxs(b.Fragment,{children:[t&&b.jsxs("div",{className:"flex flex-col gap-1 px-2.5 py-3 bg-chalkboard-20 dark:bg-chalkboard-80/50",children:[b.jsx("p",{className:"m-0 text-mono text-xs","data-testid":"username",children:i||""}),i!==t.email&&b.jsx("p",{className:"m-0 overflow-ellipsis overflow-hidden text-chalkboard-70 dark:text-chalkboard-40 text-xs","data-testid":"email",children:t.email})]}),b.jsx("ul",{className:"relative flex flex-col items-stretch content-stretch p-0.5",children:c.map((A,p)=>{if(A==="break")return p!==c.length-1?b.jsx("li",{className:"contents",children:b.jsx("hr",{className:"border-chalkboard-20 dark:border-chalkboard-80"})},`break-${p}`):null;const{id:m,children:g,...y}=A;return b.jsx("li",{className:"contents",children:b.jsx($t,{...y,className:"!font-sans flex items-center gap-2 rounded-sm py-1.5 px-2 cursor-pointer hover:bg-chalkboard-20 dark:hover:bg-chalkboard-80 border-none text-left",onMouseUp:()=>{h()},children:g})},m)})})]})})})]})},cR=({className:t="w-auto h-5 text-chalkboard-120 dark:text-chalkboard-10",...e})=>b.jsxs("svg",{...e,className:t,viewBox:"0 0 438 145",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M88.2136 25.3021V3.12744H0.595269V34.3994H79.827L0.609484 120.312H0.595269V120.326L0.581055 120.34L0.595269 120.355V141.364H20.8936L41.3341 119.189V141.364H128.952V110.092H49.7349L128.952 24.1649V3.12744L108.64 3.15587L88.2136 25.3021Z",fill:"currentColor"}),b.jsx("path",{d:"M167.36 72.4372C167.36 49.7366 185.824 31.2719 208.525 31.2719C216.514 31.2719 223.976 33.5605 230.288 37.5121L251.78 14.3709C239.698 5.34466 224.73 0 208.525 0C168.582 0 136.088 32.4944 136.088 72.4372C136.088 90.5465 142.769 107.135 153.828 119.857L175.32 96.7156C170.316 89.9069 167.36 81.5061 167.36 72.4372Z",fill:"currentColor"}),b.jsx("path",{d:"M241.745 48.1442C246.734 54.9671 249.691 63.3679 249.691 72.4368C249.691 95.1232 231.226 113.588 208.525 113.588C200.537 113.588 193.088 111.299 186.777 107.348L165.271 130.503C177.353 139.515 192.321 144.86 208.525 144.86C248.468 144.86 280.963 112.365 280.963 72.4368C280.963 54.3133 274.282 37.7249 263.223 25.0029L241.745 48.1442Z",fill:"currentColor"}),b.jsx("path",{d:"M419.312 25.0029L397.834 48.1442C402.823 54.9671 405.779 63.3679 405.779 72.4368C405.779 95.1232 387.315 113.588 364.614 113.588C356.626 113.588 349.177 111.299 342.866 107.348L321.359 130.503C333.442 139.515 348.41 144.86 364.614 144.86C404.557 144.86 437.051 112.365 437.051 72.4368C437.051 54.3133 430.371 37.7249 419.312 25.0029Z",fill:"currentColor"}),b.jsx("path",{d:"M323.449 72.4372C323.449 49.7366 341.913 31.2719 364.614 31.2719C372.603 31.2719 380.065 33.5605 386.376 37.5121L407.869 14.3709C395.786 5.34466 380.819 0 364.614 0C324.671 0 292.177 32.4944 292.177 72.4372C292.177 90.5465 298.858 107.135 309.916 119.857L331.409 96.7156C326.405 89.9069 323.449 81.5061 323.449 72.4372Z",fill:"currentColor"})]}),UPe=ls.define(),gl=UPe.of(!0),HPe=ls.define(),mee=HPe.of(!0),gee=Qt.define(),yee=Qt.define(),vee=Qt.define(),$x=Qt.define(),wj=Ct.mark({class:"cm-ghostText"}),xj=600,bee=Mr.define({create(t){return{ghostText:null}},update(t,e){if(e.annotation(gl.type)===void 0&&e.annotation(mee.type)===void 0)return t;for(const n of e.effects)if(n.is(gee)){const{text:r,displayText:i,endReplacement:s,cursorPos:o,startPos:a,endPos:l,uuid:c}=n.value,u=o+i.length,d=Ct.set([wj.range(o,u)]);return{ghostText:{text:r,displayText:i,startPos:a,endPos:l,decorations:d,displayPos:o,endReplacement:s,endGhostText:u,weirdInsert:!1,uuid:c}}}else if(n.is(yee)){if(t.ghostText)return{ghostText:null}}else if(n.is($x)){const r=n.value;if(t.ghostText&&!t.ghostText.weirdInsert){let{text:i,displayText:s,displayPos:o,startPos:a,endPos:l,endGhostText:c,decorations:u,endReplacement:d,uuid:f}=t.ghostText;return o+=r,s=s.slice(r),a===c?{ghostText:null}:(u=Ct.set([wj.range(o,c)]),{ghostText:{text:i,displayText:s,startPos:a,endPos:l,decorations:u,endGhostText:c,endReplacement:d,uuid:f,displayPos:o,weirdInsert:!1}})}}else if(n.is(vee))return{ghostText:null};return t},provide:t=>At.decorations.from(t,e=>e.ghostText?e.ghostText.decorations:Ct.none)});class jPe{constructor(e,n){se(this,"client");se(this,"lastPos",0);se(this,"queuedUids",[]);se(this,"_deffererUserSelect",Ty(()=>{this.rejectSuggestionCommand()},xj));se(this,"sendScheduledInput",null);this.view=e,this.client=n}update(e){if(!Ot.copilotEnabled)return;let n=!1,r=!1;for(const i of e.transactions)if(i.isUserEvent("select")){n=!0;break}else(i.isUserEvent("input")||i.isUserEvent("delete")||i.isUserEvent("undo")||i.isUserEvent("redo")||i.isUserEvent("move")||i.annotation(gl.type))&&(r=!0);if(n){this._deffererUserSelect(!0);return}r&&(this.lastPos=this.view.state.selection.main.head,e.docChanged&&this.scheduleUpdateDoc())}scheduleUpdateDoc(){this.sendScheduledInput!=null&&window.clearTimeout(this.sendScheduledInput),this.sendScheduledInput=window.setTimeout(()=>this.updateDoc(),xj)}updateDoc(){if(this.sendScheduledInput!=null&&(window.clearTimeout(this.sendScheduledInput),this.sendScheduledInput=null),!!this.client.ready)try{this.requestCompletions().catch(Bt)}catch(e){console.error(e)}}ensureDocUpdated(){this.sendScheduledInput!=null&&this.updateDoc()}ghostText(){var e;return((e=this.view.state.field(bee))==null?void 0:e.ghostText)||null}containsGhostText(){return this.ghostText()!==null}autocompleting(){return F0e(this.view.state)==="active"}notFocused(){return!this.view.hasFocus}async requestCompletions(){if(this.containsGhostText()||this.autocompleting()||this.notFocused())return;const e=this.view.state.selection.main.head;if(e!==this.lastPos)return;const n=this.view.state,r=n.facet(qL),i=await this.getCompletion({doc:{source:n.doc.toString(),tabSize:n.facet(Tn.tabSize),indentSize:1,insertSpaces:!0,path:r.split("/").pop(),uri:r,relativePath:r.replace("file://",""),languageId:n.facet(XL),position:KL(n.doc,e)}});if(i.completions.length===0)return;let{text:s,displayText:o,range:{start:a},position:l,uuid:c}=i.completions[0];if(s.length===0||o.length===0)return;const u=Oa(n.doc,{line:a.line,character:a.character});if(u===void 0)return;const d=Oa(n.doc,{line:l.line,character:l.character});if(d===void 0)return;const f=d+o.length,h=u+s.length;if(e!==this.lastPos||this.autocompleting()||this.notFocused())return;const A=this.view.state.doc.lineAt(e);if(A.to!==e){const p=this.view.state.doc.sliceString(e,A.to);o.endsWith(p)?o=o.slice(0,o.length-p.length):o.includes(p)&&this.view.dispatch({changes:{from:e,to:A.to,insert:""},selection:{anchor:e},effects:$x.of(p.length),annotations:[gl,Bn.addToHistory.of(!1)]})}this.view.dispatch({changes:{from:e,to:e,insert:o},effects:[gee.of({displayText:o,endReplacement:f,text:s,cursorPos:e,startPos:u,endPos:h,uuid:c})],annotations:[gl,Bn.addToHistory.of(!1)]}),this.lastPos=e}acceptSuggestionCommand(){const e=this.ghostText();if(!e)return!1;const n=e.displayPos,r=e.endGhostText,i=e.startPos,s=e.endPos,o=e.endReplacement,a=e.text;this.view.dispatch({changes:{from:n,to:r,insert:""},effects:yee.of(null),annotations:[gl,Bn.addToHistory.of(!1)]});const l=o-(r-n);return this.view.dispatch({changes:{from:i,to:l,insert:a},selection:{anchor:s},annotations:[gl,Bn.addToHistory.of(!0)]}),this.accept(e.uuid).catch(Bt),!0}rejectSuggestionCommand(){const e=this.ghostText();if(!e)return!1;const n=e.displayPos,r=e.endGhostText;return this.view.dispatch({changes:{from:n,to:r,insert:""},effects:vee.of(null),annotations:[mee,gl,Bn.addToHistory.of(!1)]}),this.reject().catch(Bt),!1}sameKeyCommand(e){const n=this.ghostText();if(!n)return!1;const r="Tab",i=n.displayPos,s=this.view.state.facet(av);return e===r&&n.displayText.startsWith(s)?(this.view.dispatch({selection:{anchor:i+s.length},effects:$x.of(s.length),annotations:[gl,Bn.addToHistory.of(!1)]}),!0):e===r?this.acceptSuggestionCommand():n.weirdInsert||e!==n.displayText[0]?this.rejectSuggestionCommand():n.displayText.length===1?this.acceptSuggestionCommand():(this.view.dispatch({selection:{anchor:i+1},effects:$x.of(1),annotations:[gl,Bn.addToHistory.of(!1)]}),!0)}async getCompletion(e){const n=await this.client.requestCustom("copilot/getCompletions",e);return this.queuedUids=[...n.completions.map(r=>r.uuid)],n}async accept(e){const n=this.queuedUids.filter(r=>r!==e);this.queuedUids=[],this.acceptCompletion({uuid:e}),this.rejectCompletions({uuids:n})}async reject(){const e=this.queuedUids;this.queuedUids=[],this.rejectCompletions({uuids:e})}acceptCompletion(e){this.client.notifyCustom("copilot/notifyAccepted",e)}rejectCompletions(e){this.client.notifyCustom("copilot/notifyRejected",e)}}const QPe=t=>{let e=null;const n=Br.define(a=>e=new jPe(a,t.client)),r=At.domEventHandlers({keydown(a,l){if(a.key!=="Shift"&&a.key!=="Control"&&a.key!=="Alt"&&a.key!=="Backspace"&&a.key!=="Delete"&&a.key!=="Meta"){if(l.plugin===null)return!1;const c=l.plugin(n);return c===null?!1:c.sameKeyCommand(a.key)}else return!1}}),i=a=>{const l=a.plugin(n);return l===null?!1:l.rejectSuggestionCommand()},s=[{key:"Tab",run:a=>{if(a.plugin===null)return!1;const l=a.plugin(n);return l===null?!1:l.sameKeyCommand("Tab")}},{key:"Backspace",run:i},{key:"Delete",run:i},{key:"Mod-z",run:i,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:i,preventDefault:!0},{linux:"Ctrl-Shift-z",run:i,preventDefault:!0},{key:"Mod-u",run:i,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:i,preventDefault:!0}],o=Ea.highest(oA.computeN([],()=>[s]));return[n,o,r,bee,At.focusChangeEffect.of((a,l)=>(e===null||e.rejectSuggestionCommand(),null))]},zPe=600;class VPe{constructor(e){se(this,"viewUpdate",null);se(this,"client");se(this,"sendScheduledInput",null);se(this,"_deffererUserSelect",Ty(()=>{this.viewUpdate!==null&&Ot.handleOnViewUpdate(this.viewUpdate)},50));this.client=e}update(e){this.viewUpdate=e,Ot.setEditorView(e.view);let n=!1,r=e.docChanged;for(const s of e.transactions)if(s.isUserEvent("select")?n=!0:(s.isUserEvent("input")||s.isUserEvent("delete")||s.isUserEvent("undo")||s.isUserEvent("redo")||s.isUserEvent("move")||s.annotation(xq.type))&&(r=!0),s.annotation(rY.type)){r=!1;break}else if(s.annotation(gl.type)){r=!1;break}else if(s.annotation(H0.type)){r=!1;break}if(n){this._deffererUserSelect(!0);return}if(!r||!e.docChanged)return;const i=e.state.doc.toString();Kt.code=i,Kt.writeToFile(),this.scheduleUpdateDoc()}scheduleUpdateDoc(){this.sendScheduledInput!=null&&window.clearTimeout(this.sendScheduledInput),this.sendScheduledInput=window.setTimeout(()=>this.updateDoc(),zPe)}updateDoc(){this.sendScheduledInput!=null&&(window.clearTimeout(this.sendScheduledInput),this.sendScheduledInput=null),this.client.ready&&be.executeCode()}ensureDocUpdated(){this.sendScheduledInput!=null&&this.updateDoc()}async updateUnits(e){return this.client.requestCustom("kcl/updateUnits",e)}async updateCanExecute(e){return this.client.requestCustom("kcl/updateCanExecute",e)}}function GPe(t){return[ube(t),Br.define(()=>new VPe(t.client))]}var Cj={};class W_{constructor(e,n,r,i,s,o,a,l,c,u=0,d){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=d}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new W_(e,[],n,r,r,0,[],0,i?new _j(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25;o&&this.setLookAhead(this.pos);let a=s.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let d=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-d;if(i<s.minRepeatTerm||e&131072){let h=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,h,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let h=this.stack[l-3];this.state=s.getGoto(h,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(n==r)return;if(o.buffer[a-2]>=n){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new W_(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new WPe(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<n.length;s+=2)(o=n[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(n[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<n.length;s+=2){let o=n[s+1];i.some((a,l)=>l&1&&a==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let s=n[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new _j(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class _j{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class WPe{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class K_{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new K_(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new K_(this.stack,this.pos,this.index)}}function yw(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let s=0;for(;;){let o=t.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class qx{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Sj=new qx;class KPe{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Sj,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!i)return null;let o=this.ranges[--i];s-=r.from-o.to,r=o}for(;n<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=Sj,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class am{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;$Pe(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}am.prototype.contextual=am.prototype.fallback=am.prototype.extend=!1;am.prototype.fallback=am.prototype.extend=!1;function $Pe(t,e,n,r,i,s){let o=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;a&t[o];){let c=t[o+1];for(let h=o+3;h<c;h+=2)if((t[h+1]&a)>0){let A=t[h];if(l.allows(A)&&(e.token.value==-1||e.token.value==A||qPe(A,e.token.value,i,s))){e.acceptToken(A);break}}let u=e.next,d=0,f=t[o+2];if(e.next<0&&f>d&&t[c+f*3-3]==65535){o=t[c+f*3-1];continue e}for(;d<f;){let h=d+f>>1,A=c+h+(h<<1),p=t[A],m=t[A+1]||65536;if(u<p)f=h;else if(u>=m)d=h+1;else{o=t[A+2],e.advance();continue e}}break}}function Ej(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function qPe(t,e,n,r){let i=Ej(n,r,e);return i<0||Ej(n,r,t)<i}const So=typeof process<"u"&&Cj&&/\bparse\b/.test(Cj.LOG);let xB=null;function Tj(t,e,n){let r=t.cursor(Pi.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class XPe{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Tj(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Tj(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[n]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof fi){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(fn.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[n]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class YPe{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new qx)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if(!(1<<c&o))continue;let u=s[c],d=this.tokens[c];if(!(r&&!u.fallback)&&((u.contextual||d.start!=e.pos||d.mask!=o||d.context!=a)&&(this.updateCachedToken(d,u,e),d.mask=o,d.context=a),d.lookAhead>d.end+25&&(l=Math.max(d.lookAhead,l)),d.value!=0)){let f=n;if(d.extended>-1&&(n=this.addActions(e,d.extended,d.end,n)),n=this.addActions(e,d.value,d.end,n),!u.extend&&(r=d,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new qx,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new qx,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Pc(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Pc(a,c+2),n,r,i));break}a[c]==n&&(i=this.putAction(Pc(a,c+1),n,r,i))}return i}}class JPe{constructor(e,n,r,i){this.parser=e,this.input=n,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new KPe(n,i),this.tokens=new YPe(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[W_.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new XPe(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=i&&eLe(i);if(o)return So&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw So&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return So&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let i=e.pos,{parser:s}=this,o=So?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let d=this.fragments.nodeAt(i);d;){let f=this.parser.nodeSet.types[d.type.id]==d.type?s.getGoto(e.state,d.type.id):-1;if(f>-1&&d.length&&(!c||(d.prop(fn.contextHash)||0)==u))return e.useNode(d,f),So&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(d.type.id)})`),!0;if(!(d instanceof fi)||d.children.length==0||d.positions[0]>0)break;let h=d.children[0];if(h instanceof fi&&d.positions[0]==0)d=h;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),So&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],d=l[c++],f=l[c++],h=c==l.length||!r,A=h?e:e.split(),p=this.tokens.mainToken;if(A.apply(u,d,p?p.start:A.pos,f),So&&console.log(o+this.stackID(A)+` (via ${u&65536?`reduce of ${s.getName(u&65535)}`:"shift"} for ${s.getName(d)} @ ${i}${A==e?"":", split"})`),h)return!0;A.pos>i?n.push(A):r.push(A)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return Bj(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=n[o<<1],c=n[(o<<1)+1],u=So?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),So&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let d=a.split(),f=u;for(let h=0;d.forceReduce()&&h<10&&(So&&console.log(f+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,r));h++)So&&(f=this.stackID(d)+" -> ");for(let h of a.recoverByInsert(l))So&&console.log(u+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),So&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Bj(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),fi.build({buffer:K_.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(xB||(xB=new WeakMap)).get(e);return n||xB.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function Bj(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class ZPe{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class $_ extends MW{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<n.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=fn[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)s(u,l,a[c++]);else{let d=a[c+-u];for(let f=-u;f>0;f--)s(a[c++],l,d);c++}}}this.nodeSet=new yL(n.map((a,l)=>mo.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=SW;let o=yw(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(Mj),this.states=yw(e.states,Uint32Array),this.data=yw(e.stateData),this.goto=yw(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new am(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new JPe(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&r)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=Pc(r,s+2)];else{if(r[s+1]==2)return Pc(r,s+2);break}if(o==n||o==0)return Pc(r,s+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Pc(this.data,s+2);else break;i=n(Pc(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Pc(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create($_.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=Mj(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<n.length;s++)if(!r[s])for(let o=this.dialects[n[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new ZPe(e,r,i)}static deserialize(e){return new $_(e)}}function Pc(t,e){return t[e]|t[e+1]<<16}function eLe(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function Mj(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const tLe=s$({"import export":Ie.moduleKeyword,ImportItemAs:Ie.definitionKeyword,ImportFrom:Ie.moduleKeyword,"fn var let const":Ie.definitionKeyword,"if else":Ie.controlKeyword,return:Ie.controlKeyword,"true false":Ie.bool,nil:Ie.null,"AddOp MultOp ExpOp":Ie.arithmeticOperator,BangOp:Ie.logicOperator,CompOp:Ie.compareOperator,"Equals Arrow":Ie.definitionOperator,PipeOperator:Ie.controlOperator,String:Ie.string,Number:Ie.number,LineComment:Ie.lineComment,BlockComment:Ie.blockComment,Shebang:Ie.meta,PipeSubstitution:Ie.atom,VariableDefinition:Ie.definition(Ie.variableName),VariableName:Ie.variableName,PropertyName:Ie.propertyName,TagDeclarator:Ie.tagName,"( )":Ie.paren,"{ }":Ie.brace,"[ ]":Ie.bracket,", . : ? ..":Ie.punctuation}),nLe={__proto__:null,import:12,export:28,fn:30,string:48,number:48,bool:48,sketch:48,sketch_surface:48,solid:48,var:76,let:78,const:80,true:88,false:90,nil:92,if:116,else:118,return:148},rLe=$_.deserialize({version:14,states:"6zQ!pQPOOO!wQPO'#ClO%`QPO'#DyOOQO'#Dd'#DdO&rQPO'#DcO&rQPO'#DfO'pQPO'#DlO'zQQO'#DpOOQO'#E]'#E]O(VQPO'#DROOQO'#EV'#EVOOQO'#Dz'#DzQ]QPOOQ]QPOOO([QPO'#CaO(aQPO'#CiO(fQPO'#DRO&rQPO'#DgO(aQPO'#DRO&rQPO'#DwO&rQPO,59xO&rQPO,59xO&rQPO,59xO&rQPO,59xO(wQPO'#DkOOQO,5:U,5:UO)RQQO,5:^O&rQPO,5:`O&rQPO'#ERO)WQPO,5:aOOQO'#DW'#DWO+^QPO,59}O,|QPO,5:QO-TQPO'#E_OOQO'#E_'#E_O-bQPO'#E_O-jQPO,5:WO-oQPO'#DqOOQO'#E`'#E`O-tQPO'#E`O-|QPO,5:[O&rQPO,59mOOQO-E7x-E7xO.RQSO'#CdO.^QSO'#EXOOQO'#Cc'#CcO.fQSO,58{OOQO'#Cl'#ClO.kQPO,59TO(aQPO,59TO.pQPO,59mO(aQPO,59mO.uQPO,5:RO.|QPO,5:cO2cQPO1G/dO2jQPO1G/dO4nQPO1G/dO4{QPO1G/dO5YQPO'#E^OOQO'#E^'#E^O5dQPO,5:VOOQO1G/x1G/xO5iQPO1G/zO6XQPO,5:mOOQO-E8P-E8POOQO1G/l1G/lO&rQPO,5:XO7zQPO,5:yO8RQPO,5:yOOQO1G/r1G/rO&rQPO,5:]O8ZQQO,5:zO8cQPO,5:zOOQO1G/v1G/vO8kQPO1G/XO9}QPO,59OO([QPO'#D{O:SQSO,5:sO:[QPO1G.gO:aQPO1G.oO:fQPO1G.oO&rQPO1G/XO:kQPO1G/XO:pQPO'#DQO:wQPO1G/mO:|QPO,5:xO;TQPO,5:xOOQO1G/q1G/qOOQO7+%f7+%fO;]QPO1G/sO;gQPO,5:kOOQO,5:k,5:kO;tQPO1G0eOOQO-E7}-E7}O;{QPO1G/wOOQO,5:l,5:lO<VQQO1G0fOOQO-E8O-E8OOOQO1G.j1G.jOOQO,5:g,5:gOOQO-E7y-E7yOOQO7+$R7+$RO<_QPO'#CpO<jQQO7+$ZO:aQPO7+$ZO<oQPO7+$sO&rQPO7+$sOOQO,59l,59lO>RQPO,59lO>YQPO7+%XO>_QPO,5:jO>iQPO1G0dOOQO-E7|-E7|O&rQPO,5:ZP&rQPO'#EPP>pQQO'#EQO>uQPO'#CqOOQO'#EY'#EYO?TQPO'#EYO?]QPO,59[O>YQPO<<GuO?bQQO<<GuO?gQPO<<H_OOQO1G/W1G/WOOQO<<Hs<<HsP&rQPO'#EOO@yQPO1G/uOATQPO,59]OA]QPO,59]OAhQPO,5:tOApQPO,5:tOOQO1G.v1G.vOOQOAN=aAN=aO>YQPOAN=aOAxQPO1G.wOBTQQO'#CzOOQO'#EZ'#EZOATQPO1G.wOB`QPO'#DOOOQO,5:i,5:iOBnQPO1G0`OOQO-E7{-E7{OOQOG22{G22{OBvQPO,59bOB{QPO'#C{OOQO'#E['#E[OCQQPO'#E[OCYQPO,59fOC_QPO7+$cOATQPO,59jOCjQPO,59jP(aQPO'#D}OOQO1G.|1G.|OATQPO,59gOCuQQO,5:vOC}QPO,5:vOOQO1G/Q1G/QODVQPO1G/UOATQPO1G/UODbQPO1G/RODmQPO'#C}OOQO,5:h,5:hODrQQO1G0bOOQO-E7z-E7zODzQPO7+$pOATQPO,59iPEVQQO'#D|OE[QPO1G/T",stateData:"En~O!xOSPOSQOS~OU^O[WO^`O__OcTOkUOmVOvbOwbOxbOyWO{WO|WO}WO!OWO!PWO!RRO!XRO![aO!lcO!zPO~OS]O~P]OUzX[zX^zX_zXa`XczXkzXmzXvzXwzXxzXyzX{zX|zX}zX!OzX!PzX!RzX!SzX!TzX!UzX!XzX![zX!gzX!jzX!lzX!vzX!zzXlzX~OchOkkO!RdO!SeO!TfO!UgO!gjO!jlO~OU!mX[!mX^!mX_!mXm!mXv!mXw!mXx!mXy!mX{!mX|!mX}!mX!O!mX!P!mX!X!mX![!mX!l!mX!v!mX!z!mXl!mX~P$tO[WOcTOkUOmVOyWO{WO|WO}WO!OWO!PWO!RRO!XRO![aO!znO~OYrOi#RP~P&rOYvOpuOl#SP~OayO~O!z{O~O!z!PO~O_!ROv!TOw!TOx!TO!z!PO~OY!]Ob#QP~P&rOp!_O~O!jlOU!ia[!ia^!ia_!iac!iak!iam!iav!iaw!iax!iay!ia{!ia|!ia}!ia!O!ia!P!ia!R!ia!S!ia!T!ia!U!ia!X!ia![!ia!g!ia!l!ia!v!ia!z!iab!iaY!iai!ia!b!ial!ia~OU!Va[!Va^!Va_!Vam!Vav!Vaw!Vax!Vay!Va{!Va|!Va}!Va!O!Va!P!Va!X!Va![!Va!l!Va!v!Va!z!Vab!VaY!Vai!Va!b!Val!Va~P$tOb!cO~P$tOY!eO!b!dOi#RX~P$tOY!eOi#RX~Oi!gO~Og!hO~OY!iOl#SX~Ol!kO~OX!mOYWXZWX~OY!nOZ!{X~OZ!pO~Oa!qO~Oa!sO~Om!uO~P$tOU!ka[!ka^!ka_!kam!kav!kaw!kax!kay!ka{!ka|!ka}!ka!O!ka!P!ka!X!ka![!ka!l!ka!v!ka!z!kal!ka~P$tOchOkkO!TfO!gjOU!Qi[!Qi^!Qi_!Qim!Qiv!Qiw!Qix!Qiy!Qi{!Qi|!Qi}!Qi!O!Qi!P!Qi!R!Qi!U!Qi!X!Qi![!Qi!j!Qi!l!Qi!v!Qi!z!Qib!QiY!Qii!Qi!b!Qil!Qi~O!SeO~P0`O!S!Qi~P0`OchOkkO!gjOU!Qi[!Qi^!Qi_!Qim!Qiv!Qiw!Qix!Qiy!Qi{!Qi|!Qi}!Qi!O!Qi!P!Qi!U!Qi!X!Qi![!Qi!j!Qi!l!Qi!v!Qi!z!Qib!QiY!Qii!Qi!b!Qil!Qi~O!R!Qi!S!Qi!T!Qi~P2qO!RdO!SeO!TfO~P2qOY!wOb#QX~P$tOb!yO~Oi!zO~P$tOchOkkO!RdO!SeO!TfO!UgO!gjO~OU!ua[!ua^!ua_!uam!uav!uaw!uax!uay!ua{!ua|!ua}!ua!O!ua!P!ua!X!ua![!ua!j!ua!l!ua!v!ua!z!uab!uaY!uai!ua!b!ual!ua~P5pOi#Ra~P&rOY#OOi#Ra~OpuOl#Sa~OY#SOl#Sa~OUui[ui^ui_uimuivuiwuixuiyui{ui|ui}ui!Oui!Pui!Xui![ui!lui!vui!zuilui~P$tO!z#UO~OY!nOZ!{a~O[#XO~Oc#YO~Oa#[O~Oa#^O~Ol#_O~P]O!]#aO~Ob#Qa~P&rOY#cOb#Qa~OY!aii!ai~P$tO!b#eOY!sai!sa~P$tOi#Ri~P&rOY!eil!ei~P$tOpuOl#Si~OY#iO!z!POb!|P~Os#lO~OUuq[uq^uq_uqmuqvuqwuqxuqyuq{uq|uq}uq!Ouq!Puq!Xuq![uq!luq!vuq!zuqluq~P$tOl#oO~P]Om!uO~OY!rab!ra~P$tOb#Qi~P&rOpuO~Of#tOg#sOYeXbeX~OY#uOb!|X~Ob#wO~Os#yO~OUuy[uy^uy_uymuyvuywuyxuyyuy{uy|uy}uy!Ouy!Puy!Xuy![uy!luy!vuy!zuyluy~P$tOY!cii!ci~P$tOh#|Om#{O~Og#}OYeabea~O!z!POb!|a~OY$QOb!|a~Ok$TOYeibei~OY$VOp$UOl#OP~Of$[Og$ZOYrXbrX~O!z!POb!|i~Oi$^O~Og$_O~OY$`Ol#OX~Ol$bO~Ok$TOYeqbeq~Og$dOYrabra~Op$fOl#Oa~OY$hOl#Oa~Ok$TOYribri~Ok$TOYoiloi~Og$kO~Op$fOl#Oi~Ok$TOYrqbrq~Op$fO~Ok$TOYqilqi~Oy!gPQ!SP~",goto:"+W#TPPPPP#UP#]#`PPPP#UPP#fPPP$S$YPPPP$]PPP$]$eP$h$mP$r#UPPPP%OPPPPP%OPPPP%O%oP%O%OPP%O&`%O&wP&z%O'P%OP%O%OP#UP#U'X'd'j'p'v'|(T(ZPPP(pP(w(z(})a)d*}+Q+TZYO[]!u#`R!O^Q|^R#V!nYXO[]!u#`Q!Q_S!S`bQ!r!RQ!t!TQ#h#YV$O#u$Q$]Q#Z!qR#m#[R#j#Y]#|#s#}$Z$_$d$kR$W#{V$g$`$h$lV$P#u$Q$]Q!v!UQ#p#aQ#x#lR$S#y!]WOSTU[]acdefghkly!d!e!h!s!u!w#O#^#`#c#e#f#q!]SOSTU[]acdefghkly!d!e!h!s!u!w#O#^#`#c#e#f#q{iQopq!U!V!W!X!Y!Z![!`!a!l!{!|#Q#]#b#n#rRsUV!}!e#O#fQwVV#R!i#S#gS[O]Sz[#`R#`!uQ!o|R#W!oQ$a$WR$i$aQ#v#jR$R#vQ!x![R#d!xS!fqsR#P!fQ!jwR#T!jpmQopq!U!V![!`!l!{!|#Q#]#b#n#rR!bmZZO[]!u#`R}^R#k#YQ#z#sQ$Y#}Q$c$ZQ$e$_Q$j$dR$m$kR$X#{YQO[]!u#`QoSQpTQqUQ!UaQ!VcQ!WdQ!XeQ!YfQ!ZgQ![hQ!`kQ!alQ!lyQ!{!dU!|!e#O#fQ#Q!hQ#]!sU#b!w#c#qQ#n#^R#r#eR!^hRtURxV",nodeNames:"⚠ LineComment BlockComment Program Shebang ImportStatement import ImportItems ImportItem ImportItemAs , ImportFrom String FunctionDeclaration export fn VariableDefinition Equals ) ( ParamList Parameter ? : PrimitiveType ] ArrayType [ } { ObjectType ObjectProperty PropertyName ObjectProperty Parameter Arrow Body VariableDeclaration var let const Number VariableName TagDeclarator true false nil PipeSubstitution BinaryExpression AddOp MultOp ExpOp CompOp UnaryExpression UnaryOp BangOp ParenthesizedExpression IfExpression if else CallExpression ArgumentList ArrayExpression IntegerRange .. IntegerRange ObjectExpression ObjectProperty MemberExpression . SubscriptExpression PipeExpression PipeOperator ReturnStatement return ExpressionStatement",maxTerm:96,nodeProps:[["isolate",-3,1,2,12,""],["group",-5,5,13,37,73,75,"Statement",-18,12,41,42,43,44,45,46,47,48,53,56,57,60,62,66,68,70,71,"Expression",-3,24,26,30,"Type"],["openedBy",18,"(",25,"[",28,"{"],["closedBy",19,")",27,"]",29,"}"]],propSources:[tLe],skippedNodes:[0,1,2],repeatNodeCount:8,tokenData:"3S~R{X^#xpq#xqr$mrs$zst&htu'Vuv'twx'yxy)byz)gz{)l{|)q|})v}!O)q!O!P){!P!Q*e!Q![-v![!].R!^!_.W!_!`.`!`!a.W!a!b.p!c!}.u!}#O/Y#O#P)l#P#Q/_#Q#R/d#R#S.u#T#U/i#U#Y.u#Y#Z0i#Z#o.u#o#p2m#p#q2r#q#r2}#y#z#x$f$g#x#BY#BZ#x$IS$I_#x$I|$JO#x$JT$JU#x$KV$KW#x&FU&FV#x~#}Y!x~X^#xpq#x#y#z#x$f$g#x#BY#BZ#x$IS$I_#x$I|$JO#x$JT$JU#x$KV$KW#x&FU&FV#x~$rP!X~!_!`$u~$zO!U~~$}VOr$zrs%ds#O$z#O#P%i#P;'S$z;'S;=`&b<%lO$z~%iO[~~%lRO;'S$z;'S;=`%u;=`O$z~%xWOr$zrs%ds#O$z#O#P%i#P;'S$z;'S;=`&b;=`<%l$z<%lO$z~&eP;=`<%l$z~&kPqr&n~&sSS~OY&nZ;'S&n;'S;=`'P<%lO&n~'SP;=`<%l&n~'YR!c!}'c#R#S'c#T#o'c~'hS{~!Q!['c!c!}'c#R#S'c#T#o'c~'yO!P~~'|VOw'ywx%dx#O'y#O#P(c#P;'S'y;'S;=`)[<%lO'y~(fRO;'S'y;'S;=`(o;=`O'y~(rWOw'ywx%dx#O'y#O#P(c#P;'S'y;'S;=`)[;=`<%l'y<%lO'y~)_P;=`<%l'y~)gOc~~)lOb~~)qO!S~~)vO!R~~){OY~~*QQ!g~!O!P*W!Q![*]~*]O!b~~*bPy~!Q![*]~*jQ!S~z{*p!P!Q-_~*sVOz*pz{+Y{;'S*p;'S;=`-S<%l~*p~O*p~~-Y~+]XOz*pz{+x{!P*p!P!Q-Y!Q;'S*p;'S;=`-S<%l~*p~O*p~~-Y~+{XOz*pz{+x{!P*p!P!Q,h!Q;'S*p;'S;=`-S<%l~*p~O*p~~-Y~,mVQ~Oz*pz{+Y{;'S*p;'S;=`-S<%l~*p~O*p~~-Y~-VP;=`<%l*p~-_OQ~~-dSP~OY-_Z;'S-_;'S;=`-p<%lO-_~-sP;=`<%l-_~-{Qy~!O!P*]!Q![-v~.WOg~~.]P!U~!_!`$u~.eQaP!_!`$u!`!a.kQ.pOsQ~.uOf~R.|SpQ!zP!Q![.u!c!}.u#R#S.u#T#o.u~/_Ok~~/dOi~~/iO!T~V/pUpQ!zP!Q![.u!c!}.u#R#S.u#T#g.u#g#h0S#h#o.uV0]SXSpQ!zP!Q![.u!c!}.u#R#S.u#T#o.uV0pUpQ!zP!Q![.u!c!}.u#R#S.u#T#f.u#f#g1S#g#o.uV1ZUpQ!zP!Q![.u!c!}.u#R#S.u#T#c.u#c#d1m#d#o.uV1tUpQ!zP!Q![.u!c!}.u#R#S.u#T#a.u#a#b2W#b#o.uV2aSZSpQ!zP!Q![.u!c!}.u#R#S.u#T#o.u~2rOm~~2uP!`!a2x~2}O!j~~3SOl~",tokenizers:[0,1,2],topRules:{Program:[0,3]},specialized:[{term:88,get:t=>nLe[t]||-1}],tokenPrec:1679}),iLe=XC.define({name:"kcl",parser:rLe.configure({props:[u$.add({Body:dge({closing:"}"}),BlockComment:()=>null,"Statement Property":fge({except:/^{/})}),A$.add({"Body ArrayExpression ObjectExpression":pge,BlockComment(t){return{from:t.from+2,to:t.to-2}},PipeExpression(t){return{from:t.firstChild.to,to:t.to}}})]}),languageData:{commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}});function sLe(t){return new ige(iLe,GPe({documentUri:t.documentUri,workspaceFolders:t.workspaceFolders,allowHTMLContent:!0,client:t.client,processLspNotification:t.processLspNotification}))}function kj(t){return new Worker("/assets/worker-Bkjgb6Gv.js",{name:t==null?void 0:t.name})}var Jf=(t=>(t.Kcl="kcl",t.Copilot="copilot",t))(Jf||{});function Rj(){return[]}function Nu(t,e){return t.replace(e,"").replace(/^\/+/,"").replace(/^\\+/,"")}const wee=P.createContext({}),oLe=({children:t})=>{const[e,n]=P.useState(!1),[r,i]=P.useState(!1),{auth:s,settings:{context:{modeling:{defaultUnit:o}}}}=In(),a=s==null?void 0:s.context.token,l=Ui(),{lspClient:c}=P.useMemo(()=>{if(!a||a===""||Mp)return{lspClient:null};const x=new kj({name:"kcl"}),C={wasmUrl:J4(),token:a,baseUnit:o.current,apiBaseUrl:cf};x.postMessage({worker:Jf.Kcl,eventType:X4.Init,eventData:C}),x.onmessage=function(T){ie(S)||S.add(T.data)};const _=new g7(Jf.Kcl,x),S=w_.create();return ie(S)?{lspClient:null}:{lspClient:new y7({name:Jf.Kcl,fromServer:S,intoServer:_,initializedCallback:()=>{n(!0)}})}},[a]);P.useMemo(()=>{!ft()&&e&&c&&Kt.code&&c.textDocumentDidOpen({textDocument:{uri:`file:///${ea}`,languageId:"kcl",version:1,text:Kt.code}})},[c,e]);const u=P.useMemo(()=>{let x=null;return e&&!Mp&&c&&(x=sLe({documentUri:`file:///${ea}`,workspaceFolders:Rj(),client:c,processLspNotification:(_,S)=>{try{switch(S.method){case"kcl/astUpdated":_.updateFoldingRanges(),_.requestSemanticTokens();break;case"kcl/memoryUpdated":break}}catch(E){console.error(E)}}})),x},[c,e]),{lspClient:d}=P.useMemo(()=>{if(!a||a===""||Mp)return{lspClient:null};const x=new kj({name:"copilot"}),C={wasmUrl:J4(),token:a,apiBaseUrl:cf};x.postMessage({worker:Jf.Copilot,eventType:X4.Init,eventData:C}),x.onmessage=function(T){ie(S)||S.add(T.data)};const _=new g7(Jf.Copilot,x),S=w_.create();return ie(S)?{lspClient:null}:{lspClient:new y7({name:Jf.Copilot,fromServer:S,intoServer:_,initializedCallback:()=>{i(!0)}})}},[a]),f=P.useMemo(()=>{let x=null;return r&&!Mp&&d&&(x=QPe({documentUri:`file:///${ea}`,workspaceFolders:Rj(),client:d,allowHTMLContent:!0})),x},[d,r]);let h=[];c&&h.push(c),d&&h.push(d);const A=(x,C,_)=>{const S=Nu((x==null?void 0:x.path)||ea,C||"");h.forEach(E=>{E.textDocumentDidClose({textDocument:{uri:`file:///${S}`}})}),_&&l(ut.HOME)},p=(x,C)=>{const _=(x==null?void 0:x.name)||"ProjectRoot";if(h.forEach(S=>{S.workspaceDidChangeWorkspaceFolders([{uri:"file://",name:_}],[])}),C){const S=Nu((C==null?void 0:C.path)||ea,(x==null?void 0:x.path)||"");h.forEach(E=>{E.textDocumentDidOpen({textDocument:{uri:`file:///${S}`,languageId:"kcl",version:1,text:""}})})}},m=(x,C)=>{const _=Nu(x||ea,C||"");h.forEach(S=>{S.textDocumentDidOpen({textDocument:{uri:`file:///${_}`,languageId:"kcl",version:1,text:""}})})},g=(x,C)=>{const _=Nu(x||ea,C||"");h.forEach(S=>{S.textDocumentDidClose({textDocument:{uri:`file:///${_}`}})})},y=(x,C)=>{const _=Nu(x.path,C||"");h.forEach(S=>{S.workspaceDidCreateFiles({files:[{uri:`file:///${_}`}]})})},w=(x,C,_)=>{const S=Nu(x.path,_||""),E=Nu(C.path,_||"");h.forEach(T=>{T.workspaceDidRenameFiles({files:[{oldUri:`file:///${S}`,newUri:`file:///${E}`}]})})},v=(x,C)=>{const _=Nu(x.path,C||"");h.forEach(S=>{S.workspaceDidDeleteFiles({files:[{uri:`file:///${_}`}]})})};return b.jsx(wee.Provider,{value:{lspClients:h,copilotLSP:f,kclLSP:u,onProjectClose:A,onProjectOpen:p,onFileOpen:m,onFileClose:g,onFileCreate:y,onFileRename:w,onFileDelete:v},children:t})},bu=()=>P.useContext(wee),aLe=({project:t,file:e,enableMenu:n=!1})=>{const r=ft()&&window.electron.os.isMac?"ml-20":"";return b.jsxs("div",{className:"!no-underline h-full mr-auto max-h-min min-h-12 min-w-max flex items-center gap-2 "+r,children:[b.jsx(lLe,{project:t,file:e}),n?b.jsx(cLe,{project:t,file:e}):b.jsx("span",{className:"hidden select-none cursor-default text-sm text-chalkboard-110 dark:text-chalkboard-20 whitespace-nowrap lg:block","data-testid":"project-name",children:t!=null&&t.name?t.name:nu})]})};function lLe({project:t,file:e}){const{onProjectClose:n}=bu(),r="relative h-full grid place-content-center group p-1.5 before:block before:content-[''] before:absolute before:inset-0 before:bottom-2.5 before:z-[-1] before:bg-primary before:rounded-b-sm",i="w-auto h-4 text-chalkboard-10";return ft()?b.jsxs(Af,{"data-testid":"app-logo",onClick:()=>{n(e||null,(t==null?void 0:t.path)||null,!1),je.endSession()},to:ut.HOME,className:r+" hover:before:brightness-110",children:[b.jsx(cR,{className:i}),b.jsx("span",{className:"sr-only",children:nu})]}):b.jsxs("div",{className:r,"data-testid":"app-logo",children:[b.jsx(cR,{className:i}),b.jsx("span",{className:"sr-only",children:nu})]})}function cLe({project:t,file:e}){const n=kv(),r=Js(),i=Ui(),s=AA(),{commandBarState:o,commandBarSend:a}=ni(),{onProjectClose:l}=bu(),c={name:"Export",groupId:"modeling"},u={name:"Make",groupId:"modeling"},d=A=>!!o.context.commands.find(p=>p.name===A.name&&p.groupId===A.groupId),f=va.machineCount(),h=P.useMemo(()=>[{id:"settings",Element:"button",children:b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"flex-1",children:"Project settings"}),b.jsx("kbd",{className:"hotkey",children:`${n==="macos"?"⌘":"Ctrl"}${ft()?"":"⬆"},`})]}),onClick:()=>{const A=r.pathname.includes(ut.FILE)?s+ut.SETTINGS_PROJECT:ut.HOME+ut.SETTINGS_PROJECT;i(A)}},"break",{id:"export",Element:"button",children:b.jsxs(b.Fragment,{children:[b.jsx("span",{children:"Export current part"}),!d(c)&&b.jsx(Fr,{position:"right",wrapperClassName:"!max-w-none min-w-fit",children:"Awaiting engine connection"})]}),disabled:!d(c),onClick:()=>a({type:"Find and select command",data:c})},"break",{id:"make",Element:"button",className:ft()?"":"hidden",children:b.jsxs(b.Fragment,{children:[b.jsx("span",{children:"Make current part"}),!d(u)&&b.jsx(Fr,{position:"right",wrapperClassName:"!max-w-none min-w-fit",children:"Awaiting engine connection"})]}),disabled:!d(u)||f===0,onClick:()=>{a({type:"Find and select command",data:u})}},"break",{id:"go-home",Element:"button",children:"Go to Home",className:ft()?"":"hidden",onClick:()=>{l(e||null,(t==null?void 0:t.path)||null,!0),je.endSession()}}].filter(A=>{var p;return A==="break"||typeof A!="string"&&!((p=A.className)!=null&&p.includes("hidden"))}),[n,d,a,je,l,ft]);return b.jsxs(er,{className:"relative",children:[b.jsxs(er.Button,{className:"gap-1 rounded-sm h-9 mr-auto max-h-min min-w-max border-0 py-1 px-2 flex items-center focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary dark:hover:bg-chalkboard-90","data-testid":"project-sidebar-toggle",children:[b.jsxs("div",{className:"flex flex-col items-start py-0.5",children:[b.jsx("span",{className:"hidden text-sm text-chalkboard-110 dark:text-chalkboard-20 whitespace-nowrap lg:block",children:ft()&&(e!=null&&e.name)?e.name.slice(e.name.lastIndexOf(window.electron.path.sep)+1):nu}),ft()&&(t==null?void 0:t.name)&&b.jsx("span",{className:"hidden text-xs text-chalkboard-70 dark:text-chalkboard-40 whitespace-nowrap lg:block",children:t.name})]}),b.jsx(nn,{name:"caretDown",className:"w-4 h-4 text-chalkboard-70 dark:text-chalkboard-40 ui-open:rotate-180"})]}),b.jsx(Ci,{enter:"duration-100 ease-out",enterFrom:"opacity-0 -translate-y-2",enterTo:"opacity-100 translate-y-0",as:P.Fragment,children:b.jsx(er.Panel,{className:`z-10 absolute top-full left-0 mt-1 pb-1 w-48 bg-chalkboard-10 dark:bg-chalkboard-90
          border border-solid border-chalkboard-20 dark:border-chalkboard-90 rounded
          shadow-lg`,children:({close:A})=>b.jsx("ul",{className:"relative flex flex-col items-stretch content-stretch p-0.5",children:h.map((p,m)=>{if(p==="break")return m!==h.length-1?b.jsx("li",{className:"contents",children:b.jsx("hr",{className:"border-chalkboard-20 dark:border-chalkboard-80"})},`break-${m}`):null;const{id:g,className:y,children:w,...v}=p;return b.jsx("li",{className:"contents",children:b.jsx($t,{...v,className:"relative !font-sans flex items-center gap-2 rounded-sm py-1.5 px-2 cursor-pointer hover:bg-chalkboard-20 dark:hover:bg-chalkboard-80 border-none text-left "+y,onMouseUp:()=>{A()},children:w})},g)})})})})]})}const uLe="_header_mvd5u_5",dLe="_desktopApp_mvd5u_11",Pj={header:uLe,desktopApp:dLe};function xee(){const t=Js(),e=(n=1)=>{if(t.pathname==="/")return"";const r=t.pathname.slice(0,t.pathname.lastIndexOf("/"));return n<=1?r:e(n-1)};return e}function du(t){return Array.isArray?Array.isArray(t):See(t)==="[object Array]"}const fLe=1/0;function hLe(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-fLe?"-0":e}function ALe(t){return t==null?"":hLe(t)}function Dl(t){return typeof t=="string"}function Cee(t){return typeof t=="number"}function pLe(t){return t===!0||t===!1||mLe(t)&&See(t)=="[object Boolean]"}function _ee(t){return typeof t=="object"}function mLe(t){return _ee(t)&&t!==null}function Lo(t){return t!=null}function CB(t){return!t.trim().length}function See(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const gLe="Incorrect 'index' type",yLe=t=>`Invalid value for key ${t}`,vLe=t=>`Pattern length exceeds max of ${t}.`,bLe=t=>`Missing ${t} property in key`,wLe=t=>`Property 'weight' in key '${t}' must be a positive integer`,Lj=Object.prototype.hasOwnProperty;class xLe{constructor(e){this._keys=[],this._keyMap={};let n=0;e.forEach(r=>{let i=Eee(r);this._keys.push(i),this._keyMap[i.id]=i,n+=i.weight}),this._keys.forEach(r=>{r.weight/=n})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Eee(t){let e=null,n=null,r=null,i=1,s=null;if(Dl(t)||du(t))r=t,e=Ij(t),n=uR(t);else{if(!Lj.call(t,"name"))throw new Error(bLe("name"));const o=t.name;if(r=o,Lj.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(wLe(o));e=Ij(o),n=uR(o),s=t.getFn}return{path:e,id:n,weight:i,src:r,getFn:s}}function Ij(t){return du(t)?t:t.split(".")}function uR(t){return du(t)?t.join("."):t}function CLe(t,e){let n=[],r=!1;const i=(s,o,a)=>{if(Lo(s))if(!o[a])n.push(s);else{let l=o[a];const c=s[l];if(!Lo(c))return;if(a===o.length-1&&(Dl(c)||Cee(c)||pLe(c)))n.push(ALe(c));else if(du(c)){r=!0;for(let u=0,d=c.length;u<d;u+=1)i(c[u],o,a+1)}else o.length&&i(c,o,a+1)}};return i(t,Dl(e)?e.split("."):e,0),r?n:n[0]}const _Le={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},SLe={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},ELe={location:0,threshold:.6,distance:100},TLe={useExtendedSearch:!1,getFn:CLe,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Jt={...SLe,..._Le,...ELe,...TLe};const BLe=/[^ ]+/g;function MLe(t=1,e=3){const n=new Map,r=Math.pow(10,e);return{get(i){const s=i.match(BLe).length;if(n.has(s))return n.get(s);const o=1/Math.pow(s,.5*t),a=parseFloat(Math.round(o*r)/r);return n.set(s,a),a},clear(){n.clear()}}}class X6{constructor({getFn:e=Jt.getFn,fieldNormWeight:n=Jt.fieldNormWeight}={}){this.norm=MLe(n,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((n,r)=>{this._keysMap[n.id]=r})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Dl(this.docs[0])?this.docs.forEach((e,n)=>{this._addString(e,n)}):this.docs.forEach((e,n)=>{this._addObject(e,n)}),this.norm.clear())}add(e){const n=this.size();Dl(e)?this._addString(e,n):this._addObject(e,n)}removeAt(e){this.records.splice(e,1);for(let n=e,r=this.size();n<r;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(e,n){return e[this._keysMap[n]]}size(){return this.records.length}_addString(e,n){if(!Lo(e)||CB(e))return;let r={v:e,i:n,n:this.norm.get(e)};this.records.push(r)}_addObject(e,n){let r={i:n,$:{}};this.keys.forEach((i,s)=>{let o=i.getFn?i.getFn(e):this.getFn(e,i.path);if(Lo(o)){if(du(o)){let a=[];const l=[{nestedArrIndex:-1,value:o}];for(;l.length;){const{nestedArrIndex:c,value:u}=l.pop();if(Lo(u))if(Dl(u)&&!CB(u)){let d={v:u,i:c,n:this.norm.get(u)};a.push(d)}else du(u)&&u.forEach((d,f)=>{l.push({nestedArrIndex:f,value:d})})}r.$[s]=a}else if(Dl(o)&&!CB(o)){let a={v:o,n:this.norm.get(o)};r.$[s]=a}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function Tee(t,e,{getFn:n=Jt.getFn,fieldNormWeight:r=Jt.fieldNormWeight}={}){const i=new X6({getFn:n,fieldNormWeight:r});return i.setKeys(t.map(Eee)),i.setSources(e),i.create(),i}function kLe(t,{getFn:e=Jt.getFn,fieldNormWeight:n=Jt.fieldNormWeight}={}){const{keys:r,records:i}=t,s=new X6({getFn:e,fieldNormWeight:n});return s.setKeys(r),s.setIndexRecords(i),s}function vw(t,{errors:e=0,currentLocation:n=0,expectedLocation:r=0,distance:i=Jt.distance,ignoreLocation:s=Jt.ignoreLocation}={}){const o=e/t.length;if(s)return o;const a=Math.abs(r-n);return i?o+a/i:a?1:o}function RLe(t=[],e=Jt.minMatchCharLength){let n=[],r=-1,i=-1,s=0;for(let o=t.length;s<o;s+=1){let a=t[s];a&&r===-1?r=s:!a&&r!==-1&&(i=s-1,i-r+1>=e&&n.push([r,i]),r=-1)}return t[s-1]&&s-r>=e&&n.push([r,s-1]),n}const lh=32;function PLe(t,e,n,{location:r=Jt.location,distance:i=Jt.distance,threshold:s=Jt.threshold,findAllMatches:o=Jt.findAllMatches,minMatchCharLength:a=Jt.minMatchCharLength,includeMatches:l=Jt.includeMatches,ignoreLocation:c=Jt.ignoreLocation}={}){if(e.length>lh)throw new Error(vLe(lh));const u=e.length,d=t.length,f=Math.max(0,Math.min(r,d));let h=s,A=f;const p=a>1||l,m=p?Array(d):[];let g;for(;(g=t.indexOf(e,A))>-1;){let _=vw(e,{currentLocation:g,expectedLocation:f,distance:i,ignoreLocation:c});if(h=Math.min(_,h),A=g+u,p){let S=0;for(;S<u;)m[g+S]=1,S+=1}}A=-1;let y=[],w=1,v=u+d;const x=1<<u-1;for(let _=0;_<u;_+=1){let S=0,E=v;for(;S<E;)vw(e,{errors:_,currentLocation:f+E,expectedLocation:f,distance:i,ignoreLocation:c})<=h?S=E:v=E,E=Math.floor((v-S)/2+S);v=E;let T=Math.max(1,f-E+1),R=o?d:Math.min(f+E,d)+u,k=Array(R+2);k[R+1]=(1<<_)-1;for(let M=R;M>=T;M-=1){let F=M-1,I=n[t.charAt(F)];if(p&&(m[F]=+!!I),k[M]=(k[M+1]<<1|1)&I,_&&(k[M]|=(y[M+1]|y[M])<<1|1|y[M+1]),k[M]&x&&(w=vw(e,{errors:_,currentLocation:F,expectedLocation:f,distance:i,ignoreLocation:c}),w<=h)){if(h=w,A=F,A<=f)break;T=Math.max(1,2*f-A)}}if(vw(e,{errors:_+1,currentLocation:f,expectedLocation:f,distance:i,ignoreLocation:c})>h)break;y=k}const C={isMatch:A>=0,score:Math.max(.001,w)};if(p){const _=RLe(m,a);_.length?l&&(C.indices=_):C.isMatch=!1}return C}function LLe(t){let e={};for(let n=0,r=t.length;n<r;n+=1){const i=t.charAt(n);e[i]=(e[i]||0)|1<<r-n-1}return e}class Bee{constructor(e,{location:n=Jt.location,threshold:r=Jt.threshold,distance:i=Jt.distance,includeMatches:s=Jt.includeMatches,findAllMatches:o=Jt.findAllMatches,minMatchCharLength:a=Jt.minMatchCharLength,isCaseSensitive:l=Jt.isCaseSensitive,ignoreLocation:c=Jt.ignoreLocation}={}){if(this.options={location:n,threshold:r,distance:i,includeMatches:s,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:l,ignoreLocation:c},this.pattern=l?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const u=(f,h)=>{this.chunks.push({pattern:f,alphabet:LLe(f),startIndex:h})},d=this.pattern.length;if(d>lh){let f=0;const h=d%lh,A=d-h;for(;f<A;)u(this.pattern.substr(f,lh),f),f+=lh;if(h){const p=d-lh;u(this.pattern.substr(p),p)}}else u(this.pattern,0)}searchIn(e){const{isCaseSensitive:n,includeMatches:r}=this.options;if(n||(e=e.toLowerCase()),this.pattern===e){let A={isMatch:!0,score:0};return r&&(A.indices=[[0,e.length-1]]),A}const{location:i,distance:s,threshold:o,findAllMatches:a,minMatchCharLength:l,ignoreLocation:c}=this.options;let u=[],d=0,f=!1;this.chunks.forEach(({pattern:A,alphabet:p,startIndex:m})=>{const{isMatch:g,score:y,indices:w}=PLe(e,A,p,{location:i+m,distance:s,threshold:o,findAllMatches:a,minMatchCharLength:l,includeMatches:r,ignoreLocation:c});g&&(f=!0),d+=y,g&&w&&(u=[...u,...w])});let h={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(h.indices=u),h}}class Mf{constructor(e){this.pattern=e}static isMultiMatch(e){return Oj(e,this.multiRegex)}static isSingleMatch(e){return Oj(e,this.singleRegex)}search(){}}function Oj(t,e){const n=t.match(e);return n?n[1]:null}class ILe extends Mf{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const n=e===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class OLe extends Mf{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const r=e.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class FLe extends Mf{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const n=e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class NLe extends Mf{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const n=!e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class DLe extends Mf{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const n=e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class ULe extends Mf{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const n=!e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Mee extends Mf{constructor(e,{location:n=Jt.location,threshold:r=Jt.threshold,distance:i=Jt.distance,includeMatches:s=Jt.includeMatches,findAllMatches:o=Jt.findAllMatches,minMatchCharLength:a=Jt.minMatchCharLength,isCaseSensitive:l=Jt.isCaseSensitive,ignoreLocation:c=Jt.ignoreLocation}={}){super(e),this._bitapSearch=new Bee(e,{location:n,threshold:r,distance:i,includeMatches:s,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:l,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class kee extends Mf{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let n=0,r;const i=[],s=this.pattern.length;for(;(r=e.indexOf(this.pattern,n))>-1;)n=r+s,i.push([r,n-1]);const o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}}const dR=[ILe,kee,FLe,NLe,ULe,DLe,OLe,Mee],Fj=dR.length,HLe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,jLe="|";function QLe(t,e={}){return t.split(jLe).map(n=>{let r=n.trim().split(HLe).filter(s=>s&&!!s.trim()),i=[];for(let s=0,o=r.length;s<o;s+=1){const a=r[s];let l=!1,c=-1;for(;!l&&++c<Fj;){const u=dR[c];let d=u.isMultiMatch(a);d&&(i.push(new u(d,e)),l=!0)}if(!l)for(c=-1;++c<Fj;){const u=dR[c];let d=u.isSingleMatch(a);if(d){i.push(new u(d,e));break}}}return i})}const zLe=new Set([Mee.type,kee.type]);class VLe{constructor(e,{isCaseSensitive:n=Jt.isCaseSensitive,includeMatches:r=Jt.includeMatches,minMatchCharLength:i=Jt.minMatchCharLength,ignoreLocation:s=Jt.ignoreLocation,findAllMatches:o=Jt.findAllMatches,location:a=Jt.location,threshold:l=Jt.threshold,distance:c=Jt.distance}={}){this.query=null,this.options={isCaseSensitive:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:s,location:a,threshold:l,distance:c},this.pattern=n?e:e.toLowerCase(),this.query=QLe(this.pattern,this.options)}static condition(e,n){return n.useExtendedSearch}searchIn(e){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:i}=this.options;e=i?e:e.toLowerCase();let s=0,o=[],a=0;for(let l=0,c=n.length;l<c;l+=1){const u=n[l];o.length=0,s=0;for(let d=0,f=u.length;d<f;d+=1){const h=u[d],{isMatch:A,indices:p,score:m}=h.search(e);if(A){if(s+=1,a+=m,r){const g=h.constructor.type;zLe.has(g)?o=[...o,...p]:o.push(p)}}else{a=0,s=0,o.length=0;break}}if(s){let d={isMatch:!0,score:a/s};return r&&(d.indices=o),d}}return{isMatch:!1,score:1}}}const fR=[];function GLe(...t){fR.push(...t)}function hR(t,e){for(let n=0,r=fR.length;n<r;n+=1){let i=fR[n];if(i.condition(t,e))return new i(t,e)}return new Bee(t,e)}const q_={AND:"$and",OR:"$or"},AR={PATH:"$path",PATTERN:"$val"},pR=t=>!!(t[q_.AND]||t[q_.OR]),WLe=t=>!!t[AR.PATH],KLe=t=>!du(t)&&_ee(t)&&!pR(t),Nj=t=>({[q_.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function Ree(t,e,{auto:n=!0}={}){const r=i=>{let s=Object.keys(i);const o=WLe(i);if(!o&&s.length>1&&!pR(i))return r(Nj(i));if(KLe(i)){const l=o?i[AR.PATH]:s[0],c=o?i[AR.PATTERN]:i[l];if(!Dl(c))throw new Error(yLe(l));const u={keyId:uR(l),pattern:c};return n&&(u.searcher=hR(c,e)),u}let a={children:[],operator:s[0]};return s.forEach(l=>{const c=i[l];du(c)&&c.forEach(u=>{a.children.push(r(u))})}),a};return pR(t)||(t=Nj(t)),r(t)}function $Le(t,{ignoreFieldNorm:e=Jt.ignoreFieldNorm}){t.forEach(n=>{let r=1;n.matches.forEach(({key:i,norm:s,score:o})=>{const a=i?i.weight:null;r*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(e?1:s))}),n.score=r})}function qLe(t,e){const n=t.matches;e.matches=[],Lo(n)&&n.forEach(r=>{if(!Lo(r.indices)||!r.indices.length)return;const{indices:i,value:s}=r;let o={indices:i,value:s};r.key&&(o.key=r.key.src),r.idx>-1&&(o.refIndex=r.idx),e.matches.push(o)})}function XLe(t,e){e.score=t.score}function YLe(t,e,{includeMatches:n=Jt.includeMatches,includeScore:r=Jt.includeScore}={}){const i=[];return n&&i.push(qLe),r&&i.push(XLe),t.map(s=>{const{idx:o}=s,a={item:e[o],refIndex:o};return i.length&&i.forEach(l=>{l(s,a)}),a})}class wu{constructor(e,n={},r){this.options={...Jt,...n},this.options.useExtendedSearch,this._keyStore=new xLe(this.options.keys),this.setCollection(e,r)}setCollection(e,n){if(this._docs=e,n&&!(n instanceof X6))throw new Error(gLe);this._myIndex=n||Tee(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){Lo(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const n=[];for(let r=0,i=this._docs.length;r<i;r+=1){const s=this._docs[r];e(s,r)&&(this.removeAt(r),r-=1,i-=1,n.push(s))}return n}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:n=-1}={}){const{includeMatches:r,includeScore:i,shouldSort:s,sortFn:o,ignoreFieldNorm:a}=this.options;let l=Dl(e)?Dl(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return $Le(l,{ignoreFieldNorm:a}),s&&l.sort(o),Cee(n)&&n>-1&&(l=l.slice(0,n)),YLe(l,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e){const n=hR(e,this.options),{records:r}=this._myIndex,i=[];return r.forEach(({v:s,i:o,n:a})=>{if(!Lo(s))return;const{isMatch:l,score:c,indices:u}=n.searchIn(s);l&&i.push({item:s,idx:o,matches:[{score:c,value:s,norm:a,indices:u}]})}),i}_searchLogical(e){const n=Ree(e,this.options),r=(a,l,c)=>{if(!a.children){const{keyId:d,searcher:f}=a,h=this._findMatches({key:this._keyStore.get(d),value:this._myIndex.getValueForItemAtKeyId(l,d),searcher:f});return h&&h.length?[{idx:c,item:l,matches:h}]:[]}const u=[];for(let d=0,f=a.children.length;d<f;d+=1){const h=a.children[d],A=r(h,l,c);if(A.length)u.push(...A);else if(a.operator===q_.AND)return[]}return u},i=this._myIndex.records,s={},o=[];return i.forEach(({$:a,i:l})=>{if(Lo(a)){let c=r(n,a,l);c.length&&(s[l]||(s[l]={idx:l,item:a,matches:[]},o.push(s[l])),c.forEach(({matches:u})=>{s[l].matches.push(...u)}))}}),o}_searchObjectList(e){const n=hR(e,this.options),{keys:r,records:i}=this._myIndex,s=[];return i.forEach(({$:o,i:a})=>{if(!Lo(o))return;let l=[];r.forEach((c,u)=>{l.push(...this._findMatches({key:c,value:o[u],searcher:n}))}),l.length&&s.push({idx:a,item:o,matches:l})}),s}_findMatches({key:e,value:n,searcher:r}){if(!Lo(n))return[];let i=[];if(du(n))n.forEach(({v:s,i:o,n:a})=>{if(!Lo(s))return;const{isMatch:l,score:c,indices:u}=r.searchIn(s);l&&i.push({score:c,key:e,value:s,idx:o,norm:a,indices:u})});else{const{v:s,n:o}=n,{isMatch:a,score:l,indices:c}=r.searchIn(s);a&&i.push({score:l,key:e,value:s,norm:o,indices:c})}return i}}wu.version="7.0.0";wu.createIndex=Tee;wu.parseIndex=kLe;wu.config=Jt;wu.parseQuery=Ree;GLe(VLe);const Dj=["Sketching","Modeling","Command Palette","Settings","Panes","Code Editor","File Tree","Miscellaneous"],m0=oI()==="macos"?"Command":"Control",Y6={Settings:[{name:"toggle-settings",sequence:ft()?`${m0}+,`:`Shift+${m0}+,`,title:"Toggle Settings",description:"Opens the settings dialog. Always available."},{name:"settings-search",sequence:"Control+.",title:"Settings Search",description:"Focus the settings search input. Available when settings are open."}],"Command Palette":[{name:"toggle-command-palette",sequence:`${m0}+K`,title:"Toggle Command Palette",description:"Always available."}],Panes:[{name:"toggle-code-pane",sequence:"Shift+C",title:"Toggle Code Pane",description:"Available while modeling when not typing in the code editor."},{name:"toggle-variables-pane",sequence:"Shift+V",title:"Toggle Variables Pane",description:"Available while modeling when not typing in the code editor."},{name:"toggle-logs-pane",sequence:"Shift+L",title:"Toggle Logs Pane",description:"Available while modeling when not typing in the code editor."},{name:"toggle-errors-pane",sequence:"Shift+E",title:"Toggle Errors Pane",description:"Available while modeling when not typing in the code editor."}],Sketching:[{name:"enter-sketch-mode",sequence:"S",title:"Enter Sketch Mode",description:"Available while modeling when not typing in the code editor."},{name:"unequip-sketch-tool",sequence:"Escape",title:"Unequip Sketch Tool",description:"Unequips the current sketch tool. Available while sketching."},{name:"exit-sketch-mode",sequence:"Escape",title:"Exit Sketch Mode",description:"Available while sketching, if no sketch tool is equipped."},{name:"toggle-line-tool",sequence:"L",title:"Toggle Line Tool",description:"Available while sketching, when not typing in the code editor."},{name:"toggle-rectangle-tool",sequence:"R",title:"Toggle Rectangle Tool",description:"Available while sketching, when not typing in the code editor."},{name:"toggle-arc-tool",sequence:"A",title:"Toggle Arc Tool",description:"Available while sketching, when not typing in the code editor."}],Modeling:[{name:"extrude",sequence:"E",title:"Extrude",description:"Available while modeling with either a face selected or an empty selection, when not typing in the code editor."},{name:"center-on-selection",sequence:`${m0}+Alt+C`,title:"Center on selection",description:"Centers the view on the selected geometry, or everything if nothing is selected."}],"Code Editor":[{name:"format-code",sequence:"Shift+Alt+F",title:"Format Code",description:"Nicely formats the KCL code in the editor, available when the editor is focused."}],"File Tree":[{name:"rename-file",sequence:"Enter",title:"Rename File/Folder",description:"Available when a file or folder is selected in the file tree."},{name:"delete-file",sequence:`${m0}+Backspace`,title:"Delete File/Folder",description:"Available when a file or folder is selected in the file tree."}]};function Pee([t],[e]){return Dj.indexOf(t)-Dj.indexOf(e)}function JLe(){const t=P.useRef(null);Tr("Ctrl+.",u=>{var d;u.preventDefault(),(d=t.current)==null||d.focus()},{enableOnFormTags:!0});const e=Ui(),[n,r]=P.useState(""),{settings:i}=In(),s=P.useMemo(()=>[...Object.entries(i.state.context).flatMap(([u,d])=>Object.entries(d).flatMap(([f,h])=>{const A=h;return["project","user"].filter(p=>A.hideOnLevel!==p).map(p=>({category:Wd(u,{separator:" "}),name:f,description:A.description??"",displayName:Wd(f,{separator:" "}),level:p}))})),...Object.entries(Y6).flatMap(([u,d])=>d.map(f=>({name:f.name,displayName:f.title,description:f.description,category:u,level:"keybindings"})))],[i.state.context]),[o,a]=P.useState(s),l=new wu(s,{keys:["category","displayName","description"],includeScore:!0});P.useEffect(()=>{const u=l.search(n).map(d=>d.item);a(n.length>0?u:s)},[n]);function c({level:u,name:d}){e(`?tab=${u}#${d}`)}return b.jsx(fa,{onChange:c,children:b.jsxs("div",{className:"relative group",children:[b.jsxs("div",{className:"flex items-center gap-2 py-0.5 pr-1 pl-2 rounded border-solid border border-primary/10 dark:border-chalkboard-80 focus-within:border-primary dark:focus-within:border-chalkboard-30",children:[b.jsx(fa.Input,{ref:t,onChange:u=>r(u.target.value),className:"w-full bg-transparent focus:outline-none selection:bg-primary/20 dark:selection:bg-primary/40 dark:focus:outline-none",placeholder:"Search settings (^.)",autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoFocus:!0}),b.jsx(nn,{name:"search",className:"w-5 h-5 rounded-sm bg-primary/10 text-primary group-focus-within:bg-primary group-focus-within:text-chalkboard-10"})]}),b.jsx(fa.Options,{className:"absolute top-full mt-2 right-0 w-80 overflow-y-auto z-50 max-h-96 cursor-pointer bg-chalkboard-10 dark:bg-chalkboard-100 border border-solid border-primary dark:border-chalkboard-30 rounded",children:o==null?void 0:o.map(u=>b.jsxs(fa.Option,{value:u,className:"flex flex-col items-start gap-2 px-4 py-2 ui-active:bg-primary/10 dark:ui-active:bg-chalkboard-90",children:[b.jsxs("p",{className:"flex-grow text-base capitalize m-0 leading-none",children:[u.level," ·"," ",Wd(u.category,{separator:" "})," ·"," ",u.displayName]}),u.description&&b.jsx("p",{className:"text-xs leading-tight text-chalkboard-70 dark:text-chalkboard-50",children:u.description})]},`${u.category}-${u.name}-${u.level}`))})]})})}function _B(t){const{checked:e,icon:n,text:r}=t;return b.jsxs("div",{className:`cursor-pointer select-none flex items-center gap-1 p-1 pr-2 -mb-[1px] border-0 border-b ${e?"border-primary":"border-chalkboard-20 dark:border-chalkboard-30 hover:bg-primary/20 dark:hover:bg-primary/50"}`,children:[b.jsx(nn,{name:n,className:"w-5 h-5 "+(e?"bg-primary !text-chalkboard-10":"")}),b.jsx("span",{children:r})]})}function ZLe({value:t,onChange:e,showProjectTab:n}){return b.jsxs(hw,{value:t,onChange:e,className:"flex justify-start pl-4 pr-5 gap-5 border-0 border-b border-b-chalkboard-20 dark:border-b-chalkboard-90",children:[b.jsx(hw.Option,{value:"user",children:({checked:r})=>b.jsx(_B,{checked:r,icon:"person",text:"User"})}),n&&b.jsx(hw.Option,{value:"project",children:({checked:r})=>b.jsx(_B,{checked:r,icon:"folder",text:"This project"})}),b.jsx(hw.Option,{value:"keybindings",children:({checked:r})=>b.jsx(_B,{checked:r,icon:"keyboard",text:"Keybindings"})})]})}function eIe({searchParamTab:t,scrollRef:e}){const{settings:{context:n}}=In();return b.jsxs("div",{className:"flex w-32 flex-col gap-3 pr-2 py-1 border-0 border-r border-r-chalkboard-20 dark:border-r-chalkboard-90",children:[Object.entries(n).filter(([r,i])=>Object.values(i).some(s=>!YI(s,t))).map(([r])=>b.jsx("button",{onClick:()=>{var i,s;return(s=(i=e.current)==null?void 0:i.querySelector(`#category-${r}`))==null?void 0:s.scrollIntoView({block:"center",behavior:"smooth"})},className:"capitalize text-left border-none px-1",children:Wd(r,{separator:" "})},r)),b.jsx("button",{onClick:()=>{var r,i;return(i=(r=e.current)==null?void 0:r.querySelector("#settings-resets"))==null?void 0:i.scrollIntoView({block:"center",behavior:"smooth"})},className:"capitalize text-left border-none px-1",children:"Resets"}),b.jsx("button",{onClick:()=>{var r,i;return(i=(r=e.current)==null?void 0:r.querySelector("#settings-about"))==null?void 0:i.scrollIntoView({block:"center",behavior:"smooth"})},className:"capitalize text-left border-none px-1",children:"About"})]})}function Xx({title:t,id:e,description:n,className:r,children:i,parentLevel:s,settingHasChanged:o,onFallback:a,headingClassName:l="text-lg font-normal capitalize tracking-wide"}){return b.jsxs("section",{id:e,className:"group p-2 pl-0 grid grid-cols-2 gap-6 items-start "+r+(o?" border-0 border-l-2 -ml-0.5 border-primary":""),children:[b.jsxs("div",{className:"ml-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("h2",{className:l,children:t}),a&&s&&o&&b.jsxs("button",{onClick:a,className:"hidden group-hover:block group-focus-within:block border-none p-0 hover:bg-warn-10 dark:hover:bg-warn-80 focus:bg-warn-10 dark:focus:bg-warn-80 focus:outline-none",children:[b.jsx(nn,{name:"refresh",className:"w-4 h-4"}),b.jsxs("span",{className:"sr-only",children:["Roll back ",t]}),b.jsxs(Fr,{position:"right",children:["Roll back to match ",s]})]})]}),n&&b.jsx("p",{className:"mt-2 text-xs text-chalkboard-80 dark:text-chalkboard-30",children:n})]}),b.jsx("div",{children:i})]})}const tIe="_toggle_1appe_1",nIe={toggle:tIe},rIe=({className:t="",offLabel:e="Off",onLabel:n="On",name:r="",onChange:i,checked:s})=>b.jsxs("label",{className:`${nIe.toggle} ${t}`,children:[b.jsx("p",{className:s?"text-chalkboard-70 dark:text-chalkboard-50":"",children:e}),b.jsx("input",{type:"checkbox",name:r,id:r,checked:s,onChange:i}),b.jsx("span",{}),b.jsx("p",{className:s?"":"text-chalkboard-70 dark:text-chalkboard-50",children:n})]});function iIe({category:t,settingName:e,settingsLevel:n,setting:r}){const{settings:{context:i,send:s}}=In(),o=P.useMemo(()=>r.commandConfig&&"options"in r.commandConfig&&r.commandConfig.options?r.commandConfig.options instanceof Array?r.commandConfig.options:r.commandConfig.options({argumentsToSubmit:{level:n}},i):[],[r,n,i]);switch(FEe(r)){case"component":return r.Component&&b.jsx(r.Component,{value:r[n]||r.getFallback(n),updateValue:l=>{s({type:`set.${t}.${e}`,data:{level:n,value:l}})}});case"boolean":return b.jsx(rIe,{offLabel:"Off",onLabel:"On",onChange:l=>s({type:`set.${t}.${e}`,data:{level:n,value:!!l.target.checked}}),checked:!!(r[n]!==void 0?r[n]:r.getFallback(n)),name:`${t}-${e}`,"data-testid":`${t}-${e}`});case"options":return b.jsx("select",{name:`${t}-${e}`,"data-testid":`${t}-${e}`,className:"p-1 bg-transparent border rounded-sm border-chalkboard-30 w-full",value:String(r[n]||r.getFallback(n)),onChange:l=>s({type:`set.${t}.${e}`,data:{level:n,value:l.target.value}}),children:o&&o.length>0&&o.map(l=>b.jsx("option",{value:String(l.value),children:l.name},l.name))});case"string":return b.jsx("input",{name:`${t}-${e}`,"data-testid":`${t}-${e}`,type:"text",className:"p-1 bg-transparent border rounded-sm border-chalkboard-30 w-full",defaultValue:String(r[n]||r.getFallback(n)),onBlur:l=>{(r[n]===void 0?r.getFallback(n)!==l.target.value:r[n]!==l.target.value)&&s({type:`set.${t}.${e}`,data:{level:n,value:l.target.value}})}})}return b.jsxs("p",{className:"text-destroy-70 dark:text-destroy-20",children:["No component or input type found for setting ",e," in category"," ",t]})}const sIe=P.forwardRef(({searchParamTab:t,isFileSettings:e},n)=>{const r=Js(),i=Ui(),{onProjectOpen:s}=bu(),o=xee(),{settings:{send:a,context:l,state:c}}=In(),u=e&&ft()?decodeURI(r.pathname.replace(ut.FILE+"/","").replace(ut.SETTINGS,"").slice(0,decodeURI(r.pathname).lastIndexOf(window.electron.path.sep))):void 0;function d(){a({type:"set.app.onboardingStatus",data:{level:"user",value:""}})}return P.useEffect(()=>{async function f(){c.context.app.onboardingStatus.user===""&&c.matches("idle")&&(e?i(o(1)+ut.ONBOARDING.INDEX):await q6({onProjectOpen:s,navigate:i}))}f()},[e,i,c]),b.jsx("div",{className:"relative overflow-y-auto",children:b.jsxs("div",{ref:n,className:"flex flex-col gap-4 px-2",children:[Object.entries(l).filter(([f,h])=>Object.values(h).some(A=>!YI(A,t))).map(([f,h])=>b.jsxs(b.Fragment,{children:[b.jsx("h2",{id:`category-${f}`,className:"text-xl mt-6 first-of-type:mt-0 capitalize font-bold",children:Wd(f,{separator:" "})}),Object.entries(h).filter(A=>OEe(A[1],t)).map(([A,p])=>{const m=p,g=m[m.getParentLevel(t)];return b.jsx(Xx,{title:Wd(A,{separator:" "}),id:A,className:r.hash===`#${A}`?"bg-primary/5 dark:bg-chalkboard-90":"",description:m.description,settingHasChanged:m[t]!==void 0&&m[t]!==m.getFallback(t),parentLevel:m.getParentLevel(t),onFallback:()=>a({type:`set.${f}.${A}`,data:{level:t,value:g!==void 0?g:m.getFallback(t)}}),children:b.jsx(iIe,{category:f,settingName:A,settingsLevel:t,setting:m})},`${f}-${A}-${t}`)})]},f)),b.jsx("h2",{id:"settings-resets",className:"text-2xl mt-6 font-bold",children:"Resets"}),b.jsx(Xx,{title:"Onboarding",description:"Replay the onboarding process",children:b.jsx($t,{Element:"button",onClick:d,iconStart:{icon:"refresh",size:"sm",className:"p-1"},children:"Replay Onboarding"})}),b.jsx(Xx,{title:"Reset settings",description:`Restore settings to their default values. Your settings are saved in
                    ${ft()?" a file in the app data folder for your OS.":" your browser's local storage."}
                  `,children:b.jsxs("div",{className:"flex flex-col items-start gap-4",children:[ft()&&b.jsx($t,{Element:"button",onClick:Li(async()=>{const h=(await EPe(u?decodeURIComponent(u):void 0))[t];if(!h)return new Error("finalPath undefined");window.electron.showInFolder(h)},Bt),iconStart:{icon:"folder",size:"sm",className:"p-1"},children:"Show in folder"}),b.jsxs($t,{Element:"button",onClick:()=>{a({type:"Reset settings",level:t}),jt.success(`Your ${t}-level settings were reset`)},iconStart:{icon:"refresh",size:"sm",className:"p-1 text-chalkboard-10",bgClassName:"bg-destroy-70"},children:["Reset ",t,"-level settings"]})]})}),b.jsx("h2",{id:"settings-about",className:"text-2xl mt-6 font-bold",children:"About Modeling App"}),b.jsxs("div",{className:"text-sm mb-12",children:[b.jsxs("p",{children:["App version ",Bh,"."," ",b.jsx("a",{href:`https://github.com/KittyCAD/modeling-app/releases/tag/v${Bh}`,target:"_blank",rel:"noopener noreferrer",children:"View release on GitHub"})]}),b.jsxs("p",{className:"max-w-2xl mt-6",children:["Don't see the feature you want? Check to see if it's on"," ",b.jsx("a",{href:"https://github.com/KittyCAD/modeling-app/discussions",target:"_blank",rel:"noopener noreferrer",children:"our roadmap"}),", and start a discussion if you don't see it! Your feedback will help us prioritize what to build next."]})]})]})})}),oIe=P.forwardRef((t,e)=>b.jsx("div",{className:"relative overflow-y-auto pb-16",children:b.jsx("div",{ref:e,className:"flex flex-col gap-12",children:Object.entries(Y6).sort(Pee).map(([n,r])=>b.jsxs("div",{className:"flex flex-col gap-4 px-2 pr-4",children:[b.jsx("h2",{id:`category-${n}`,className:"text-xl mt-6 first-of-type:mt-0 capitalize font-bold",children:n}),r.map(i=>b.jsx(aIe,{category:n,item:i},n+"-"+i.name))]}))})}));function aIe({item:t,category:e}){const n=Js();return b.jsxs("div",{className:"flex gap-16 justify-between items-start py-1 px-2 -my-1 -mx-2 "+(n.hash===`#${t.name}`?"bg-primary/5 dark:bg-chalkboard-90":""),id:t.name,children:[b.jsxs("div",{children:[b.jsx("h3",{className:"text-lg font-normal capitalize tracking-wide",children:t.title}),b.jsx("p",{className:"text-xs text-chalkboard-60 dark:text-chalkboard-50",children:t.description})]}),b.jsx("div",{className:"flex-1 flex flex-wrap justify-end gap-3",children:t.sequence.split(" ").map((r,i)=>b.jsx("kbd",{className:"py-0.5 px-1.5 rounded bg-primary/10 dark:bg-chalkboard-80",children:r},`${e}-${t.name}-${r}-${i}`))})]})}function lIe({scrollRef:t}){return b.jsx("div",{className:"flex w-32 flex-col gap-3 pr-2 py-1 border-0 border-r border-r-chalkboard-20 dark:border-r-chalkboard-90",children:Object.entries(Y6).sort(Pee).map(([e])=>b.jsx("button",{onClick:()=>{var n,r;return(r=(n=t.current)==null?void 0:n.querySelector(`#category-${e}`))==null?void 0:r.scrollIntoView({block:"center",behavior:"smooth"})},className:"capitalize text-left border-none px-1",children:e},e))})}const cIe=(window==null?void 0:window.localStorage.getItem(uJ))==="true",Bh=cIe&&Abe==="development"?"11.22.33":ft()?window.electron.packageJson.version:"main",Uj=()=>{const t=Ui(),[e,n]=GI(),r=()=>t(i.pathname.replace(ut.SETTINGS,"")),i=Js(),s=i.pathname.includes(ut.FILE),o=e.get("tab")??(s?"project":"user"),a=P.useRef(null),l=xee();return Tr("esc",()=>t(l())),P.useEffect(()=>{var c;if(console.log("hash",i.hash),i.hash){const u=document.getElementById(i.hash.slice(1));u&&(u.scrollIntoView({block:"center",behavior:"smooth"}),(c=u.querySelector("input, select, textarea"))==null||c.focus())}},[i.hash]),b.jsx(Ci,{appear:!0,show:!0,as:P.Fragment,children:b.jsxs(ir,{as:"div",open:!0,onClose:r,className:"fixed inset-0 z-40 overflow-y-auto p-4 grid place-items-center",children:[b.jsx(Ci.Child,{as:P.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-75",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:b.jsx(ir.Overlay,{className:"fixed inset-0 bg-chalkboard-110/30 dark:bg-chalkboard-110/50"})}),b.jsx(Ci.Child,{as:P.Fragment,enter:"ease-out duration-75",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:b.jsxs(ir.Panel,{className:"rounded relative mx-auto bg-chalkboard-10 dark:bg-chalkboard-100 border dark:border-chalkboard-70 max-w-3xl w-full max-h-[66vh] shadow-lg flex flex-col gap-8",children:[b.jsxs("div",{className:"p-5 pb-0 flex justify-between items-center",children:[b.jsx("h1",{className:"text-2xl font-bold",children:"Settings"}),b.jsxs("div",{className:"flex gap-4 items-start",children:[b.jsx(JLe,{}),b.jsx("button",{onClick:r,className:"p-0 m-0 focus:ring-0 focus:outline-none border-none hover:bg-destroy-10 focus:bg-destroy-10 dark:hover:bg-destroy-80/50 dark:focus:bg-destroy-80/50","data-testid":"settings-close-button",children:b.jsx(nn,{name:"close",className:"w-5 h-5"})})]})]}),b.jsx(ZLe,{value:o,onChange:c=>n(u=>({...u,tab:c})),showProjectTab:s}),b.jsx("div",{className:"flex-1 grid items-stretch pl-4 pr-5 pb-5 gap-2 overflow-hidden",style:{gridTemplateColumns:"auto 1fr",gridTemplateRows:"1fr"},children:o!=="keybindings"?b.jsxs(b.Fragment,{children:[b.jsx(eIe,{searchParamTab:o,scrollRef:a}),b.jsx(sIe,{searchParamTab:o,isFileSettings:s,ref:a})]}):b.jsxs(b.Fragment,{children:[b.jsx(lIe,{scrollRef:a}),b.jsx(oIe,{ref:a})]})})]})})]})})};var mR={exports:{}};(function(t,e){(function(n,r){var i="1.0.38",s="",o="?",a="function",l="undefined",c="object",u="string",d="major",f="model",h="name",A="type",p="vendor",m="version",g="architecture",y="console",w="mobile",v="tablet",x="smarttv",C="wearable",_="embedded",S=500,E="Amazon",T="Apple",R="ASUS",k="BlackBerry",B="Browser",M="Chrome",F="Edge",I="Firefox",z="Google",Y="Huawei",$="LG",ee="Microsoft",W="Motorola",ne="Opera",Se="Samsung",fe="Sharp",ge="Sony",Oe="Xiaomi",Fe="Zebra",De="Facebook",ke="Chromium OS",Ge="Mac OS",Ve=function(re,ce){var le={};for(var me in re)ce[me]&&ce[me].length%2===0?le[me]=ce[me].concat(re[me]):le[me]=re[me];return le},q=function(re){for(var ce={},le=0;le<re.length;le++)ce[re[le].toUpperCase()]=re[le];return ce},Ue=function(re,ce){return typeof re===u?O(ce).indexOf(O(re))!==-1:!1},O=function(re){return re.toLowerCase()},ve=function(re){return typeof re===u?re.replace(/[^\d\.]/g,s).split(".")[0]:r},Ae=function(re,ce){if(typeof re===u)return re=re.replace(/^\s\s*/,s),typeof ce===l?re:re.substring(0,S)},ae=function(re,ce){for(var le=0,me,Le,Te,Pe,Qe,$e;le<ce.length&&!Qe;){var et=ce[le],st=ce[le+1];for(me=Le=0;me<et.length&&!Qe&&et[me];)if(Qe=et[me++].exec(re),Qe)for(Te=0;Te<st.length;Te++)$e=Qe[++Le],Pe=st[Te],typeof Pe===c&&Pe.length>0?Pe.length===2?typeof Pe[1]==a?this[Pe[0]]=Pe[1].call(this,$e):this[Pe[0]]=Pe[1]:Pe.length===3?typeof Pe[1]===a&&!(Pe[1].exec&&Pe[1].test)?this[Pe[0]]=$e?Pe[1].call(this,$e,Pe[2]):r:this[Pe[0]]=$e?$e.replace(Pe[1],Pe[2]):r:Pe.length===4&&(this[Pe[0]]=$e?Pe[3].call(this,$e.replace(Pe[1],Pe[2])):r):this[Pe]=$e||r;le+=2}},Z=function(re,ce){for(var le in ce)if(typeof ce[le]===c&&ce[le].length>0){for(var me=0;me<ce[le].length;me++)if(Ue(ce[le][me],re))return le===o?r:le}else if(Ue(ce[le],re))return le===o?r:le;return re},pe={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},J={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},H={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[m,[h,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[m,[h,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[h,m],[/opios[\/ ]+([\w\.]+)/i],[m,[h,ne+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[m,[h,ne+" GX"]],[/\bopr\/([\w\.]+)/i],[m,[h,ne]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[m,[h,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[h,m],[/\bddg\/([\w\.]+)/i],[m,[h,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[m,[h,"UC"+B]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[m,[h,"WeChat"]],[/konqueror\/([\w\.]+)/i],[m,[h,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[m,[h,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[m,[h,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[m,[h,"Smart Lenovo "+B]],[/(avast|avg)\/([\w\.]+)/i],[[h,/(.+)/,"$1 Secure "+B],m],[/\bfocus\/([\w\.]+)/i],[m,[h,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[m,[h,ne+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[m,[h,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[m,[h,"Dolphin"]],[/coast\/([\w\.]+)/i],[m,[h,ne+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[m,[h,"MIUI "+B]],[/fxios\/([-\w\.]+)/i],[m,[h,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[h,"360 "+B]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[h,/(.+)/,"$1 "+B],m],[/samsungbrowser\/([\w\.]+)/i],[m,[h,Se+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[h,/_/g," "],m],[/metasr[\/ ]?([\d\.]+)/i],[m,[h,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[h,"Sogou Mobile"],m],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[h,m],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[h],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[h,De],m],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[h,m],[/\bgsa\/([\w\.]+) .*safari\//i],[m,[h,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[m,[h,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[m,[h,M+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[h,M+" WebView"],m],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[m,[h,"Android "+B]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[h,m],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[m,[h,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[m,h],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[h,[m,Z,pe]],[/(webkit|khtml)\/([\w\.]+)/i],[h,m],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[h,"Netscape"],m],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[m,[h,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[h,m],[/(cobalt)\/([\w\.]+)/i],[h,[m,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,O]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,s,O]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,O]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[f,[p,Se],[A,v]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[f,[p,Se],[A,w]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[f,[p,T],[A,w]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[f,[p,T],[A,v]],[/(macintosh);/i],[f,[p,T]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[f,[p,fe],[A,w]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[f,[p,Y],[A,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[f,[p,Y],[A,w]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[f,/_/g," "],[p,Oe],[A,w]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[f,/_/g," "],[p,Oe],[A,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[f,[p,"OPPO"],[A,w]],[/\b(opd2\d{3}a?) bui/i],[f,[p,"OPPO"],[A,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[f,[p,"Vivo"],[A,w]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[f,[p,"Realme"],[A,w]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[f,[p,W],[A,w]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[f,[p,W],[A,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[f,[p,$],[A,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[f,[p,$],[A,w]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[f,[p,"Lenovo"],[A,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[f,/_/g," "],[p,"Nokia"],[A,w]],[/(pixel c)\b/i],[f,[p,z],[A,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[f,[p,z],[A,w]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[f,[p,ge],[A,w]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[f,"Xperia Tablet"],[p,ge],[A,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[f,[p,"OnePlus"],[A,w]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[f,[p,E],[A,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[f,/(.+)/g,"Fire Phone $1"],[p,E],[A,w]],[/(playbook);[-\w\),; ]+(rim)/i],[f,p,[A,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[f,[p,k],[A,w]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[f,[p,R],[A,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[f,[p,R],[A,w]],[/(nexus 9)/i],[f,[p,"HTC"],[A,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[f,/_/g," "],[A,w]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[f,[p,"Acer"],[A,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[f,[p,"Meizu"],[A,w]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[f,[p,"Ulefone"],[A,w]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,f,[A,w]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,f,[A,v]],[/(surface duo)/i],[f,[p,ee],[A,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[f,[p,"Fairphone"],[A,w]],[/(u304aa)/i],[f,[p,"AT&T"],[A,w]],[/\bsie-(\w*)/i],[f,[p,"Siemens"],[A,w]],[/\b(rct\w+) b/i],[f,[p,"RCA"],[A,v]],[/\b(venue[\d ]{2,7}) b/i],[f,[p,"Dell"],[A,v]],[/\b(q(?:mv|ta)\w+) b/i],[f,[p,"Verizon"],[A,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[f,[p,"Barnes & Noble"],[A,v]],[/\b(tm\d{3}\w+) b/i],[f,[p,"NuVision"],[A,v]],[/\b(k88) b/i],[f,[p,"ZTE"],[A,v]],[/\b(nx\d{3}j) b/i],[f,[p,"ZTE"],[A,w]],[/\b(gen\d{3}) b.+49h/i],[f,[p,"Swiss"],[A,w]],[/\b(zur\d{3}) b/i],[f,[p,"Swiss"],[A,v]],[/\b((zeki)?tb.*\b) b/i],[f,[p,"Zeki"],[A,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],f,[A,v]],[/\b(ns-?\w{0,9}) b/i],[f,[p,"Insignia"],[A,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[f,[p,"NextBook"],[A,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],f,[A,w]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],f,[A,w]],[/\b(ph-1) /i],[f,[p,"Essential"],[A,w]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[f,[p,"Envizen"],[A,v]],[/\b(trio[-\w\. ]+) b/i],[f,[p,"MachSpeed"],[A,v]],[/\btu_(1491) b/i],[f,[p,"Rotor"],[A,v]],[/(shield[\w ]+) b/i],[f,[p,"Nvidia"],[A,v]],[/(sprint) (\w+)/i],[p,f,[A,w]],[/(kin\.[onetw]{3})/i],[[f,/\./g," "],[p,ee],[A,w]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[f,[p,Fe],[A,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[f,[p,Fe],[A,w]],[/smart-tv.+(samsung)/i],[p,[A,x]],[/hbbtv.+maple;(\d+)/i],[[f,/^/,"SmartTV"],[p,Se],[A,x]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,$],[A,x]],[/(apple) ?tv/i],[p,[f,T+" TV"],[A,x]],[/crkey/i],[[f,M+"cast"],[p,z],[A,x]],[/droid.+aft(\w+)( bui|\))/i],[f,[p,E],[A,x]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[f,[p,fe],[A,x]],[/(bravia[\w ]+)( bui|\))/i],[f,[p,ge],[A,x]],[/(mitv-\w{5}) bui/i],[f,[p,Oe],[A,x]],[/Hbbtv.*(technisat) (.*);/i],[p,f,[A,x]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,Ae],[f,Ae],[A,x]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[A,x]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,f,[A,y]],[/droid.+; (shield) bui/i],[f,[p,"Nvidia"],[A,y]],[/(playstation [345portablevi]+)/i],[f,[p,ge],[A,y]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[f,[p,ee],[A,y]],[/((pebble))app/i],[p,f,[A,C]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[f,[p,T],[A,C]],[/droid.+; (glass) \d/i],[f,[p,z],[A,C]],[/droid.+; (wt63?0{2,3})\)/i],[f,[p,Fe],[A,C]],[/(quest( \d| pro)?)/i],[f,[p,De],[A,C]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[A,_]],[/(aeobc)\b/i],[f,[p,E],[A,_]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[f,[A,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[f,[A,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[A,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[A,w]],[/(android[-\w\. ]{0,9});.+buil/i],[f,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[m,[h,F+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[m,[h,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[h,m],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[m,h]],os:[[/microsoft (windows) (vista|xp)/i],[h,m],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[h,[m,Z,J]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[m,Z,J],[h,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[m,/_/g,"."],[h,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[h,Ge],[m,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[m,h],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[h,m],[/\(bb(10);/i],[m,[h,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[m,[h,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[m,[h,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[m,[h,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[m,[h,"watchOS"]],[/crkey\/([\d\.]+)/i],[m,[h,M+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[h,ke],m],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[h,m],[/(sunos) ?([\w\.\d]*)/i],[[h,"Solaris"],m],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[h,m]]},oe=function(re,ce){if(typeof re===c&&(ce=re,re=r),!(this instanceof oe))return new oe(re,ce).getResult();var le=typeof n!==l&&n.navigator?n.navigator:r,me=re||(le&&le.userAgent?le.userAgent:s),Le=le&&le.userAgentData?le.userAgentData:r,Te=ce?Ve(H,ce):H,Pe=le&&le.userAgent==me;return this.getBrowser=function(){var Qe={};return Qe[h]=r,Qe[m]=r,ae.call(Qe,me,Te.browser),Qe[d]=ve(Qe[m]),Pe&&le&&le.brave&&typeof le.brave.isBrave==a&&(Qe[h]="Brave"),Qe},this.getCPU=function(){var Qe={};return Qe[g]=r,ae.call(Qe,me,Te.cpu),Qe},this.getDevice=function(){var Qe={};return Qe[p]=r,Qe[f]=r,Qe[A]=r,ae.call(Qe,me,Te.device),Pe&&!Qe[A]&&Le&&Le.mobile&&(Qe[A]=w),Pe&&Qe[f]=="Macintosh"&&le&&typeof le.standalone!==l&&le.maxTouchPoints&&le.maxTouchPoints>2&&(Qe[f]="iPad",Qe[A]=v),Qe},this.getEngine=function(){var Qe={};return Qe[h]=r,Qe[m]=r,ae.call(Qe,me,Te.engine),Qe},this.getOS=function(){var Qe={};return Qe[h]=r,Qe[m]=r,ae.call(Qe,me,Te.os),Pe&&!Qe[h]&&Le&&Le.platform&&Le.platform!="Unknown"&&(Qe[h]=Le.platform.replace(/chrome os/i,ke).replace(/macos/i,Ge)),Qe},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return me},this.setUA=function(Qe){return me=typeof Qe===u&&Qe.length>S?Ae(Qe,S):Qe,this},this.setUA(me),this};oe.VERSION=i,oe.BROWSER=q([h,m,d]),oe.CPU=q([g]),oe.DEVICE=q([f,p,A,y,w,x,v,C,_]),oe.ENGINE=oe.OS=q([h,m]),t.exports&&(e=t.exports=oe),e.UAParser=oe;var we=typeof n!==l&&(n.jQuery||n.Zepto);if(we&&!we.ua){var Ee=new oe;we.ua=Ee.getResult(),we.ua.get=function(){return Ee.getUA()},we.ua.set=function(re){Ee.setUA(re);var ce=Ee.getResult();for(var le in ce)we.ua[le]=ce[le]}}})(typeof window=="object"?window:en)})(mR,mR.exports);var uIe=mR.exports;/*!
 * html2canvas-pro 1.5.8 <https://yorickshan.github.io/html2canvas-pro/>
 * Copyright (c) 2024 yorickshan <https://github.com/yorickshan>
 * Released under MIT License
 *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var gR=function(t,e){return gR=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},gR(t,e)};function al(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");gR(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var yR=function(){return yR=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},yR.apply(this,arguments)};function Os(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(t,[])).next())})}function ps(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){n.label=c[1];break}if(c[0]===6&&n.label<s[1]){n.label=s[1],s=c;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(c);break}s[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(u){c=[6,u],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function bw(t,e,n){if(arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||e)}var fu=function(){function t(e,n,r,i){this.left=e,this.top=n,this.width=r,this.height=i}return t.prototype.add=function(e,n,r,i){return new t(this.left+e,this.top+n,this.width+r,this.height+i)},t.fromClientRect=function(e,n){return new t(n.left+e.windowBounds.left,n.top+e.windowBounds.top,n.width,n.height)},t.fromDOMRectList=function(e,n){var r=Array.from(n).find(function(i){return i.width!==0});return r?new t(r.left+e.windowBounds.left,r.top+e.windowBounds.top,r.width,r.height):t.EMPTY},t.EMPTY=new t(0,0,0,0),t}(),j2=function(t,e){return fu.fromClientRect(t,e.getBoundingClientRect())},dIe=function(t){var e=t.body,n=t.documentElement;if(!e||!n)throw new Error("Unable to get document size");var r=Math.max(Math.max(e.scrollWidth,n.scrollWidth),Math.max(e.offsetWidth,n.offsetWidth),Math.max(e.clientWidth,n.clientWidth)),i=Math.max(Math.max(e.scrollHeight,n.scrollHeight),Math.max(e.offsetHeight,n.offsetHeight),Math.max(e.clientHeight,n.clientHeight));return new fu(0,0,r,i)},Q2=function(t){for(var e=[],n=0,r=t.length;n<r;){var i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){var s=t.charCodeAt(n++);(s&64512)===56320?e.push(((i&1023)<<10)+(s&1023)+65536):(e.push(i),n--)}else e.push(i)}return e},Kr=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var n=t.length;if(!n)return"";for(var r=[],i=-1,s="";++i<n;){var o=t[i];o<=65535?r.push(o):(o-=65536,r.push((o>>10)+55296,o%1024+56320)),(i+1===n||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},Hj="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fIe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var ww=0;ww<Hj.length;ww++)fIe[Hj.charCodeAt(ww)]=ww;var jj="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",V0=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var xw=0;xw<jj.length;xw++)V0[jj.charCodeAt(xw)]=xw;var hIe=function(t){var e=t.length*.75,n=t.length,r,i=0,s,o,a,l;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(r=0;r<n;r+=4)s=V0[t.charCodeAt(r)],o=V0[t.charCodeAt(r+1)],a=V0[t.charCodeAt(r+2)],l=V0[t.charCodeAt(r+3)],u[i++]=s<<2|o>>4,u[i++]=(o&15)<<4|a>>2,u[i++]=(a&3)<<6|l&63;return c},AIe=function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n.push(t[r+1]<<8|t[r]);return n},pIe=function(t){for(var e=t.length,n=[],r=0;r<e;r+=4)n.push(t[r+3]<<24|t[r+2]<<16|t[r+1]<<8|t[r]);return n},Mh=5,J6=11,SB=2,mIe=J6-Mh,Lee=65536>>Mh,gIe=1<<Mh,EB=gIe-1,yIe=1024>>Mh,vIe=Lee+yIe,bIe=vIe,wIe=32,xIe=bIe+wIe,CIe=65536>>J6,_Ie=1<<mIe,SIe=_Ie-1,Qj=function(t,e,n){return t.slice?t.slice(e,n):new Uint16Array(Array.prototype.slice.call(t,e,n))},EIe=function(t,e,n){return t.slice?t.slice(e,n):new Uint32Array(Array.prototype.slice.call(t,e,n))},TIe=function(t,e){var n=hIe(t),r=Array.isArray(n)?pIe(n):new Uint32Array(n),i=Array.isArray(n)?AIe(n):new Uint16Array(n),s=24,o=Qj(i,s/2,r[4]/2),a=r[5]===2?Qj(i,(s+r[4])/2):EIe(r,Math.ceil((s+r[4])/4));return new BIe(r[0],r[1],r[2],r[3],o,a)},BIe=function(){function t(e,n,r,i,s,o){this.initialValue=e,this.errorValue=n,this.highStart=r,this.highValueIndex=i,this.index=s,this.data=o}return t.prototype.get=function(e){var n;if(e>=0){if(e<55296||e>56319&&e<=65535)return n=this.index[e>>Mh],n=(n<<SB)+(e&EB),this.data[n];if(e<=65535)return n=this.index[Lee+(e-55296>>Mh)],n=(n<<SB)+(e&EB),this.data[n];if(e<this.highStart)return n=xIe-CIe+(e>>J6),n=this.index[n],n+=e>>Mh&SIe,n=this.index[n],n=(n<<SB)+(e&EB),this.data[n];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),zj="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",MIe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Cw=0;Cw<zj.length;Cw++)MIe[zj.charCodeAt(Cw)]=Cw;var kIe="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Vj=50,RIe=1,Iee=2,Oee=3,PIe=4,LIe=5,Gj=7,Fee=8,Wj=9,wd=10,vR=11,Kj=12,bR=13,IIe=14,G0=15,wR=16,_w=17,g0=18,OIe=19,$j=20,xR=21,y0=22,TB=23,KA=24,To=25,W0=26,K0=27,$A=28,FIe=29,ch=30,NIe=31,Sw=32,Ew=33,CR=34,_R=35,SR=36,jy=37,ER=38,Yx=39,Jx=40,BB=41,Nee=42,DIe=43,UIe=[9001,65288],Dee="!",gn="×",Tw="÷",TR=TIe(kIe),_c=[ch,SR],BR=[RIe,Iee,Oee,LIe],Uee=[wd,Fee],qj=[K0,W0],HIe=BR.concat(Uee),Xj=[ER,Yx,Jx,CR,_R],jIe=[G0,bR],QIe=function(t,e){e===void 0&&(e="strict");var n=[],r=[],i=[];return t.forEach(function(s,o){var a=TR.get(s);if(a>Vj?(i.push(!0),a-=Vj):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),n.push(wR);if(a===PIe||a===vR){if(o===0)return r.push(o),n.push(ch);var l=n[o-1];return HIe.indexOf(l)===-1?(r.push(r[o-1]),n.push(l)):(r.push(o),n.push(ch))}if(r.push(o),a===NIe)return n.push(e==="strict"?xR:jy);if(a===Nee||a===FIe)return n.push(ch);if(a===DIe)return s>=131072&&s<=196605||s>=196608&&s<=262141?n.push(jy):n.push(ch);n.push(a)}),[r,n,i]},MB=function(t,e,n,r){var i=r[n];if(Array.isArray(t)?t.indexOf(i)!==-1:t===i)for(var s=n;s<=r.length;){s++;var o=r[s];if(o===e)return!0;if(o!==wd)break}if(i===wd)for(var s=n;s>0;){s--;var a=r[s];if(Array.isArray(t)?t.indexOf(a)!==-1:t===a)for(var l=n;l<=r.length;){l++;var o=r[l];if(o===e)return!0;if(o!==wd)break}if(a!==wd)break}return!1},Yj=function(t,e){for(var n=t;n>=0;){var r=e[n];if(r===wd)n--;else return r}return 0},zIe=function(t,e,n,r,i){if(n[r]===0)return gn;var s=r-1;if(Array.isArray(i)&&i[s]===!0)return gn;var o=s-1,a=s+1,l=e[s],c=o>=0?e[o]:0,u=e[a];if(l===Iee&&u===Oee)return gn;if(BR.indexOf(l)!==-1)return Dee;if(BR.indexOf(u)!==-1||Uee.indexOf(u)!==-1)return gn;if(Yj(s,e)===Fee)return Tw;if(TR.get(t[s])===vR||(l===Sw||l===Ew)&&TR.get(t[a])===vR||l===Gj||u===Gj||l===Wj||[wd,bR,G0].indexOf(l)===-1&&u===Wj||[_w,g0,OIe,KA,$A].indexOf(u)!==-1||Yj(s,e)===y0||MB(TB,y0,s,e)||MB([_w,g0],xR,s,e)||MB(Kj,Kj,s,e))return gn;if(l===wd)return Tw;if(l===TB||u===TB)return gn;if(u===wR||l===wR)return Tw;if([bR,G0,xR].indexOf(u)!==-1||l===IIe||c===SR&&jIe.indexOf(l)!==-1||l===$A&&u===SR||u===$j||_c.indexOf(u)!==-1&&l===To||_c.indexOf(l)!==-1&&u===To||l===K0&&[jy,Sw,Ew].indexOf(u)!==-1||[jy,Sw,Ew].indexOf(l)!==-1&&u===W0||_c.indexOf(l)!==-1&&qj.indexOf(u)!==-1||qj.indexOf(l)!==-1&&_c.indexOf(u)!==-1||[K0,W0].indexOf(l)!==-1&&(u===To||[y0,G0].indexOf(u)!==-1&&e[a+1]===To)||[y0,G0].indexOf(l)!==-1&&u===To||l===To&&[To,$A,KA].indexOf(u)!==-1)return gn;if([To,$A,KA,_w,g0].indexOf(u)!==-1)for(var d=s;d>=0;){var f=e[d];if(f===To)return gn;if([$A,KA].indexOf(f)!==-1)d--;else break}if([K0,W0].indexOf(u)!==-1)for(var d=[_w,g0].indexOf(l)!==-1?o:s;d>=0;){var f=e[d];if(f===To)return gn;if([$A,KA].indexOf(f)!==-1)d--;else break}if(ER===l&&[ER,Yx,CR,_R].indexOf(u)!==-1||[Yx,CR].indexOf(l)!==-1&&[Yx,Jx].indexOf(u)!==-1||[Jx,_R].indexOf(l)!==-1&&u===Jx||Xj.indexOf(l)!==-1&&[$j,W0].indexOf(u)!==-1||Xj.indexOf(u)!==-1&&l===K0||_c.indexOf(l)!==-1&&_c.indexOf(u)!==-1||l===KA&&_c.indexOf(u)!==-1||_c.concat(To).indexOf(l)!==-1&&u===y0&&UIe.indexOf(t[a])===-1||_c.concat(To).indexOf(u)!==-1&&l===g0)return gn;if(l===BB&&u===BB){for(var h=n[s],A=1;h>0&&(h--,e[h]===BB);)A++;if(A%2!==0)return gn}return l===Sw&&u===Ew?gn:Tw},VIe=function(t,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var n=QIe(t,e.lineBreak),r=n[0],i=n[1],s=n[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(a){return[To,ch,Nee].indexOf(a)!==-1?jy:a}));var o=e.wordBreak==="keep-all"?s.map(function(a,l){return a&&t[l]>=19968&&t[l]<=40959}):void 0;return[r,i,o]},GIe=function(){function t(e,n,r,i){this.codePoints=e,this.required=n===Dee,this.start=r,this.end=i}return t.prototype.slice=function(){return Kr.apply(void 0,this.codePoints.slice(this.start,this.end))},t}(),WIe=function(t,e){var n=Q2(t),r=VIe(n,e),i=r[0],s=r[1],o=r[2],a=n.length,l=0,c=0;return{next:function(){if(c>=a)return{done:!0,value:null};for(var u=gn;c<a&&(u=zIe(n,s,i,++c,o))===gn;);if(u!==gn||c===a){var d=new GIe(n,u,l,c);return l=c,{value:d,done:!1}}return{done:!0,value:null}}}},KIe=1,$Ie=2,Rv=4,Jj=8,X_=10,Zj=47,T1=92,qIe=9,XIe=32,Bw=34,v0=61,YIe=35,JIe=36,ZIe=37,Mw=39,kw=40,b0=41,e6e=95,no=45,t6e=33,n6e=60,r6e=62,i6e=64,s6e=91,o6e=93,a6e=61,l6e=123,Rw=63,c6e=125,eQ=124,u6e=126,d6e=128,tQ=65533,kB=42,vh=43,f6e=44,h6e=58,A6e=59,Qy=46,p6e=0,m6e=8,g6e=11,y6e=14,v6e=31,b6e=127,hl=-1,Hee=48,jee=97,Qee=101,w6e=102,x6e=117,C6e=122,zee=65,Vee=69,Gee=70,_6e=85,S6e=90,xs=function(t){return t>=Hee&&t<=57},E6e=function(t){return t>=55296&&t<=57343},qA=function(t){return xs(t)||t>=zee&&t<=Gee||t>=jee&&t<=w6e},T6e=function(t){return t>=jee&&t<=C6e},B6e=function(t){return t>=zee&&t<=S6e},M6e=function(t){return T6e(t)||B6e(t)},k6e=function(t){return t>=d6e},Pw=function(t){return t===X_||t===qIe||t===XIe},Y_=function(t){return M6e(t)||k6e(t)||t===e6e},nQ=function(t){return Y_(t)||xs(t)||t===no},R6e=function(t){return t>=p6e&&t<=m6e||t===g6e||t>=y6e&&t<=v6e||t===b6e},Ku=function(t,e){return t!==T1?!1:e!==X_},Lw=function(t,e,n){return t===no?Y_(e)||Ku(e,n):Y_(t)?!0:!!(t===T1&&Ku(t,e))},RB=function(t,e,n){return t===vh||t===no?xs(e)?!0:e===Qy&&xs(n):xs(t===Qy?e:t)},P6e=function(t){var e=0,n=1;(t[e]===vh||t[e]===no)&&(t[e]===no&&(n=-1),e++);for(var r=[];xs(t[e]);)r.push(t[e++]);var i=r.length?parseInt(Kr.apply(void 0,r),10):0;t[e]===Qy&&e++;for(var s=[];xs(t[e]);)s.push(t[e++]);var o=s.length,a=o?parseInt(Kr.apply(void 0,s),10):0;(t[e]===Vee||t[e]===Qee)&&e++;var l=1;(t[e]===vh||t[e]===no)&&(t[e]===no&&(l=-1),e++);for(var c=[];xs(t[e]);)c.push(t[e++]);var u=c.length?parseInt(Kr.apply(void 0,c),10):0;return n*(i+a*Math.pow(10,-o))*Math.pow(10,l*u)},L6e={type:2},I6e={type:3},O6e={type:4},F6e={type:13},N6e={type:8},D6e={type:21},U6e={type:9},H6e={type:10},j6e={type:11},Q6e={type:12},z6e={type:14},Iw={type:23},V6e={type:1},G6e={type:25},W6e={type:24},K6e={type:26},$6e={type:27},q6e={type:28},X6e={type:29},Y6e={type:31},MR={type:32},Wee=function(){function t(){this._value=[]}return t.prototype.write=function(e){this._value=this._value.concat(Q2(e))},t.prototype.read=function(){for(var e=[],n=this.consumeToken();n!==MR;)e.push(n),n=this.consumeToken();return e},t.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Bw:return this.consumeStringToken(Bw);case YIe:var n=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if(nQ(n)||Ku(r,i)){var s=Lw(n,r,i)?$Ie:KIe,o=this.consumeName();return{type:5,value:o,flags:s}}break;case JIe:if(this.peekCodePoint(0)===v0)return this.consumeCodePoint(),F6e;break;case Mw:return this.consumeStringToken(Mw);case kw:return L6e;case b0:return I6e;case kB:if(this.peekCodePoint(0)===v0)return this.consumeCodePoint(),z6e;break;case vh:if(RB(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case f6e:return O6e;case no:var a=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(RB(a,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Lw(a,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===no&&c===r6e)return this.consumeCodePoint(),this.consumeCodePoint(),W6e;break;case Qy:if(RB(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Zj:if(this.peekCodePoint(0)===kB)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===kB&&(u=this.consumeCodePoint(),u===Zj))return this.consumeToken();if(u===hl)return this.consumeToken()}break;case h6e:return K6e;case A6e:return $6e;case n6e:if(this.peekCodePoint(0)===t6e&&this.peekCodePoint(1)===no&&this.peekCodePoint(2)===no)return this.consumeCodePoint(),this.consumeCodePoint(),G6e;break;case i6e:var d=this.peekCodePoint(0),f=this.peekCodePoint(1),h=this.peekCodePoint(2);if(Lw(d,f,h)){var o=this.consumeName();return{type:7,value:o}}break;case s6e:return q6e;case T1:if(Ku(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case o6e:return X6e;case a6e:if(this.peekCodePoint(0)===v0)return this.consumeCodePoint(),N6e;break;case l6e:return j6e;case c6e:return Q6e;case x6e:case _6e:var A=this.peekCodePoint(0),p=this.peekCodePoint(1);return A===vh&&(qA(p)||p===Rw)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case eQ:if(this.peekCodePoint(0)===v0)return this.consumeCodePoint(),U6e;if(this.peekCodePoint(0)===eQ)return this.consumeCodePoint(),D6e;break;case u6e:if(this.peekCodePoint(0)===v0)return this.consumeCodePoint(),H6e;break;case hl:return MR}return Pw(e)?(this.consumeWhiteSpace(),Y6e):xs(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Y_(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Kr(e)}},t.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},t.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},t.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},t.prototype.consumeUnicodeRangeToken=function(){for(var e=[],n=this.consumeCodePoint();qA(n)&&e.length<6;)e.push(n),n=this.consumeCodePoint();for(var r=!1;n===Rw&&e.length<6;)e.push(n),n=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(Kr.apply(void 0,e.map(function(l){return l===Rw?Hee:l})),16),s=parseInt(Kr.apply(void 0,e.map(function(l){return l===Rw?Gee:l})),16);return{type:30,start:i,end:s}}var o=parseInt(Kr.apply(void 0,e),16);if(this.peekCodePoint(0)===no&&qA(this.peekCodePoint(1))){this.consumeCodePoint(),n=this.consumeCodePoint();for(var a=[];qA(n)&&a.length<6;)a.push(n),n=this.consumeCodePoint();var s=parseInt(Kr.apply(void 0,a),16);return{type:30,start:o,end:s}}else return{type:30,start:o,end:o}},t.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===kw?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===kw?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},t.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===hl)return{type:22,value:""};var n=this.peekCodePoint(0);if(n===Mw||n===Bw){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===hl||this.peekCodePoint(0)===b0)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),Iw)}for(;;){var i=this.consumeCodePoint();if(i===hl||i===b0)return{type:22,value:Kr.apply(void 0,e)};if(Pw(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===hl||this.peekCodePoint(0)===b0?(this.consumeCodePoint(),{type:22,value:Kr.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Iw);if(i===Bw||i===Mw||i===kw||R6e(i))return this.consumeBadUrlRemnants(),Iw;if(i===T1)if(Ku(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Iw;else e.push(i)}},t.prototype.consumeWhiteSpace=function(){for(;Pw(this.peekCodePoint(0));)this.consumeCodePoint()},t.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===b0||e===hl)return;Ku(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},t.prototype.consumeStringSlice=function(e){for(var n=5e4,r="";e>0;){var i=Math.min(n,e);r+=Kr.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),r},t.prototype.consumeStringToken=function(e){var n="",r=0;do{var i=this._value[r];if(i===hl||i===void 0||i===e)return n+=this.consumeStringSlice(r),{type:0,value:n};if(i===X_)return this._value.splice(0,r),V6e;if(i===T1){var s=this._value[r+1];s!==hl&&s!==void 0&&(s===X_?(n+=this.consumeStringSlice(r),r=-1,this._value.shift()):Ku(i,s)&&(n+=this.consumeStringSlice(r),n+=Kr(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},t.prototype.consumeNumber=function(){var e=[],n=Rv,r=this.peekCodePoint(0);for((r===vh||r===no)&&e.push(this.consumeCodePoint());xs(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===Qy&&xs(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),n=Jj;xs(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===Vee||r===Qee)&&((i===vh||i===no)&&xs(s)||xs(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),n=Jj;xs(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[P6e(e),n]},t.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),n=e[0],r=e[1],i=this.peekCodePoint(0),s=this.peekCodePoint(1),o=this.peekCodePoint(2);if(Lw(i,s,o)){var a=this.consumeName();return{type:15,number:n,flags:r,unit:a}}return i===ZIe?(this.consumeCodePoint(),{type:16,number:n,flags:r}):{type:17,number:n,flags:r}},t.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(qA(e)){for(var n=Kr(e);qA(this.peekCodePoint(0))&&n.length<6;)n+=Kr(this.consumeCodePoint());Pw(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(n,16);return r===0||E6e(r)||r>1114111?tQ:r}return e===hl?tQ:e},t.prototype.consumeName=function(){for(var e="";;){var n=this.consumeCodePoint();if(nQ(n))e+=Kr(n);else if(Ku(n,this.peekCodePoint(0)))e+=Kr(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(n),e}},t}(),Kee=function(){function t(e){this._tokens=e}return t.create=function(e){var n=new Wee;return n.write(e),new t(n.read())},t.parseValue=function(e){return t.create(e).parseComponentValue()},t.parseValues=function(e){return t.create(e).parseComponentValues()},t.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var n=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return n;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},t.prototype.parseComponentValues=function(){for(var e=[];;){var n=this.consumeComponentValue();if(n.type===32)return e;e.push(n),e.push()}},t.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},t.prototype.consumeSimpleBlock=function(e){for(var n={type:e,values:[]},r=this.consumeToken();;){if(r.type===32||Z6e(r,e))return n;this.reconsumeToken(r),n.values.push(this.consumeComponentValue()),r=this.consumeToken()}},t.prototype.consumeFunction=function(e){for(var n={name:e.value,values:[],type:18};;){var r=this.consumeToken();if(r.type===32||r.type===3)return n;this.reconsumeToken(r),n.values.push(this.consumeComponentValue())}},t.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?MR:e},t.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},t}(),kf=function(t){return t.type===15},ui=function(t){return t.type===17},Cn=function(t){return t.type===20},J6e=function(t){return t.type===0},kR=function(t,e){return Cn(t)&&t.value===e},$ee=function(t){return t.type!==31},ss=function(t){return t.type!==31&&t.type!==4},hc=function(t){var e=[],n=[];return t.forEach(function(r){if(r.type===4){if(n.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(n),n=[];return}r.type!==31&&n.push(r)}),n.length&&e.push(n),e},Z6e=function(t,e){return e===11&&t.type===12||e===28&&t.type===29?!0:e===2&&t.type===3},yf=function(t){return t.type===17||t.type===15},pr=function(t){return t.type===16||yf(t)},qee=function(t){return t.length>1?[t[0],t[1]]:[t[0]]},ns={type:17,number:0,flags:Rv},Z6={type:16,number:50,flags:Rv},xd={type:16,number:100,flags:Rv},$0=function(t,e,n){var r=t[0],i=t[1];return[qn(r,e),qn(typeof i<"u"?i:r,n)]},qn=function(t,e){if(t.type===16)return t.number/100*e;if(kf(t))switch(t.unit){case"rem":case"em":return 16*t.number;case"px":default:return t.number}return t.number},Xee="deg",Yee="grad",Jee="rad",Zee="turn",z2={name:"angle",parse:function(t,e){if(e.type===15)switch(e.unit){case Xee:return Math.PI*e.number/180;case Yee:return Math.PI/200*e.number;case Jee:return e.number;case Zee:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},ete=function(t){return t.type===15&&(t.unit===Xee||t.unit===Yee||t.unit===Jee||t.unit===Zee)},tte=function(t){var e=t.filter(Cn).map(function(n){return n.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ns,ns];case"to top":case"bottom":return ha(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ns,xd];case"to right":case"left":return ha(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[xd,xd];case"to bottom":case"top":return ha(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[xd,ns];case"to left":case"right":return ha(270)}return 0},ha=function(t){return Math.PI*t/180},$d=function(t){return(255&t)===0},Mi=function(t){var e=255&t,n=255&t>>8,r=255&t>>16,i=255&t>>24;return e<255?"rgba(".concat(i,",").concat(r,",").concat(n,",").concat(e/255,")"):"rgb(".concat(i,",").concat(r,",").concat(n,")")},rc=function(t,e,n,r){return(t<<24|e<<16|n<<8|Math.round(r*255)<<0)>>>0},J_=function(t,e){if(t.type===17)return t.number;if(t.type===16){var n=e===3?1:255;return e===3?t.number/100*n:Math.round(t.number/100*n)}return 0},pA=function(t){return(t[0].type===20?t[0].value:"unknown")==="from"},zr=function(t,e,n){return Math.min(Math.max(t,e),n)},yo=function(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2],t[3]*e[0]+t[4]*e[1]+t[5]*e[2],t[6]*e[0]+t[7]*e[1]+t[8]*e[2]]},eOe=function(t){return rc(zr(Math.round(t[0]*255),0,255),zr(Math.round(t[1]*255),0,255),zr(Math.round(t[2]*255),0,255),zr(t[3],0,1))},eO=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],s=mA([e,n,r]);return rc(zr(Math.round(s[0]*255),0,255),zr(Math.round(s[1]*255),0,255),zr(Math.round(s[2]*255),0,255),i)},Pv=function(t){var e=Rf([t[0],t[1],t[2]]);return eO([e[0],e[1],e[2],t[3]])},tOe=function(t,e){if(pA(e.filter(ss)))throw new Error("Relative color not supported for lab()");var n=V2(e),r=n[0],i=n[1],s=n[2],o=n[3],a=mA(Rf(K2([r,i,s])));return rc(zr(Math.round(a[0]*255),0,255),zr(Math.round(a[1]*255),0,255),zr(Math.round(a[2]*255),0,255),o)},nOe=function(t,e){if(pA(e.filter(ss)))throw new Error("Relative color not supported for oklab()");var n=V2(e),r=n[0],i=n[1],s=n[2],o=n[3],a=mA(Rf(W2([r,i,s])));return rc(zr(Math.round(a[0]*255),0,255),zr(Math.round(a[1]*255),0,255),zr(Math.round(a[2]*255),0,255),o)},rOe=function(t,e){if(pA(e.filter(ss)))throw new Error("Relative color not supported for oklch()");var n=ite(e),r=n[0],i=n[1],s=n[2],o=n[3],a=mA(Rf(W2(G2([r,i,s]))));return rc(zr(Math.round(a[0]*255),0,255),zr(Math.round(a[1]*255),0,255),zr(Math.round(a[2]*255),0,255),o)},iOe=function(t,e){if(pA(e.filter(ss)))throw new Error("Relative color not supported for lch()");var n=rte(e),r=n[0],i=n[1],s=n[2],o=n[3],a=mA(Rf(K2(G2([r,i,s]))));return rc(zr(Math.round(a[0]*255),0,255),zr(Math.round(a[1]*255),0,255),zr(Math.round(a[2]*255),0,255),o)},nte=function(t,e){var n=e.filter(ss),r=n[0],i=n[1],s=n[2],o=n[3],a=(r.type===17?ha(r.number):z2.parse(t,r))/(Math.PI*2),l=pr(i)?i.number/100:0,c=pr(s)?s.number/100:0,u=typeof o<"u"&&pr(o)?qn(o,1):1;return[a,l,c,u]},rQ=function(t,e){if(pA(e))throw new Error("Relative color not supported for hsl()");var n=nte(t,e),r=n[0],i=n[1],s=n[2],o=n[3],a=ote([r,i,s]);return rc(a[0]*255,a[1]*255,a[2]*255,i===0?1:o)},rte=function(t){var e=t.filter(ss),n=pr(e[0])?e[0].number:0,r=pr(e[1])?e[1].number:0,i=ui(e[2])||kf(e[2])?e[2].number:0,s=typeof e[4]<"u"&&pr(e[4])?qn(e[4],1):1;return[n,r,i,s]},V2=function(t){var e=t.filter(ss),n=e[0].type===16?e[0].number/100:ui(e[0])?e[0].number:0,r=e[1].type===16?e[1].number/100:ui(e[1])?e[1].number:0,i=ui(e[2])||kf(e[2])?e[2].number:0,s=typeof e[4]<"u"&&pr(e[4])?qn(e[4],1):1;return[n,r,i,s]},ite=function(t){var e=t.filter(ss),n=e[0].type===16?e[0].number/100:ui(e[0])?e[0].number:0,r=e[1].type===16?e[1].number/100:ui(e[1])?e[1].number:0,i=ui(e[2])||kf(e[2])?e[2].number:0,s=typeof e[4]<"u"&&pr(e[4])?qn(e[4],1):1;return[n,r,i,s]},ste=function(t){return yo([1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],t)},tO=function(t){return yo([.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124],t)},PB=function(t,e,n){return n<0&&(n+=1),n>=1&&(n-=1),n<1/6?(e-t)*n*6+t:n<1/2?e:n<2/3?(e-t)*6*(2/3-n)+t:t},ote=function(t){var e=t[0],n=t[1],r=t[2];if(n===0)return[r*255,r*255,r*255];var i=r<=.5?r*(n+1):r+n-r*n,s=r*2-i,o=PB(s,i,e+1/3),a=PB(s,i,e),l=PB(s,i,e-1/3);return[o,a,l]},G2=function(t){var e=t[0],n=t[1],r=t[2];return n<0&&(n=0),isNaN(r)&&(r=0),[e,n*Math.cos(r*Math.PI/180),n*Math.sin(r*Math.PI/180)]},W2=function(t){var e=yo([1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092],t),n=e.map(function(r){return Math.pow(r,3)});return yo([1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],n)},K2=function(t){var e=(t[0]+16)/116,n=t[1]/500+e,r=e-t[2]/200,i=24389/27,s=24/116,o=[(n>s?Math.pow(n,3):(116*n-16)/i)*.3457/.3585,t[0]>8?Math.pow(e,3):t[0]/i,(r>s?Math.pow(r,3):(116*r-16)/i)*(1-.3457-.3585)/.3585];return tO([o[0],o[1],o[2]])},sOe=function(t,e){var n=e.filter(ss);if(n.length===3){var r=n.map(J_),i=r[0],s=r[1],o=r[2],a=PR([i/255,s/255,o/255]),l=RR([a[0],a[1],a[2]]),c=l[0],u=l[1],d=l[2];return[c,u,d,1]}if(n.length===4){var f=n.map(J_),i=f[0],s=f[1],o=f[2],h=f[3],a=PR([i/255,s/255,o/255]),A=RR([a[0],a[1],a[2]]),c=A[0],u=A[1],d=A[2];return[c,u,d,h]}return[0,0,0,1]},oOe=function(t,e){var n=nte(t,e),r=n[0],i=n[1],s=n[2],o=n[3],a=PR(ote([r,i,s])),l=RR([a[0],a[1],a[2]]),c=l[0],u=l[1],d=l[2];return[c,u,d,o]},aOe=function(t,e){var n=V2(e),r=n[0],i=n[1],s=n[2],o=n[3],a=K2([r,i,s]),l=a[0],c=a[1],u=a[2];return[l,c,u,o]},lOe=function(t,e){var n=rte(e),r=n[0],i=n[1],s=n[2],o=n[3],a=K2(G2([r,i,s])),l=a[0],c=a[1],u=a[2];return[l,c,u,o]},cOe=function(t,e){var n=ite(e),r=n[0],i=n[1],s=n[2],o=n[3],a=W2(G2([r,i,s])),l=a[0],c=a[1],u=a[2];return[l,c,u,o]},uOe=function(t,e){var n=V2(e),r=n[0],i=n[1],s=n[2],o=n[3],a=W2([r,i,s]),l=a[0],c=a[1],u=a[2];return[l,c,u,o]},dOe=function(t){return tO([t[0],t[1],t[2]])},iQ=function(t){return t},fOe=function(t){var e=ste([t[0],t[2],t[3]]),n=e[0],r=e[1],i=e[2];return[n,r,i,t[3]]},sQ=function(t){return Pv([t[0],t[1],t[2],t[3]])},hOe=function(t){var e=dOe([t[0],t[1],t[2]]);return Pv([e[0],e[1],e[2],t[3]])},Rf=function(t){return yo([3.2409699419045226,-1.537383177570094,-.4986107602930034,-.9692436362808796,1.8759675015077202,.04155505740717559,.05563007969699366,-.20397695888897652,1.0569715142428786],t)},RR=function(t){return yo([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],t)},mA=function(t){return t.map(function(e){var n=e<0?-1:1,r=Math.abs(e);return r>.0031308?n*(1.055*Math.pow(r,1/2.4)-.055):12.92*e})},PR=function(t){return t.map(function(e){var n=e<0?-1:1,r=Math.abs(e);return r<=.04045?e/12.92:n*Math.pow((r+.055)/1.055,2.4)})},AOe=function(t){var e=mA(Rf([t[0],t[1],t[2]])),n=e[0],r=e[1],i=e[2];return[n,r,i,t[3]]},pOe=function(t){var e=Rf([t[0],t[1],t[2]]),n=e[0],r=e[1],i=e[2];return[zr(Math.round(n*255),0,255),zr(Math.round(r*255),0,255),zr(Math.round(i*255),0,255),t[3]]},mOe=function(t){return yo([.4865709486482162,.26566769316909306,.1982172852343625,.2289745640697488,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],t)},gOe=function(t){return yo([2.493496911941425,-.9313836179191239,-.40271078445071684,-.8294889695615747,1.7626640603183463,.023624685841943577,.03584583024378447,-.07617238926804182,.9568845240076872],t)},yOe=function(t){return t.map(function(e){var n=e<0?-1:1,r=e*n;return r<=.04045?e/12.92:n*Math.pow((e+.055)/1.055,2.4)||0})},vOe=function(t){return mA(t)},bOe=function(t){var e=yOe([t[0],t[1],t[2]]);return mOe([e[0],e[1],e[2]])},wOe=function(t){var e=vOe(gOe([t[0],t[1],t[2]])),n=e[0],r=e[1],i=e[2];return[n,r,i,t[3]]},xOe=function(t){var e=bOe([t[0],t[1],t[2]]);return Pv([e[0],e[1],e[2],t[3]])},COe=function(t){return yo([2.0415879038107465,-.5650069742788596,-.34473135077832956,-.9692436362808795,1.8759675015077202,.04155505740717557,.013444280632031142,-.11836239223101838,1.0151749943912054],t)},_Oe=function(t){return yo([.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.0752914584939978,.02703136138641234,.07068885253582723,.9913375368376388],t)},SOe=function(t){var e=t.map(function(n){var r=n<0?-1:1,i=Math.abs(n);return r*Math.pow(i,2.19921875)});return[e[0],e[1],e[2]]},EOe=function(t){var e=t.map(function(n){var r=n<0?-1:1,i=Math.abs(n);return r*Math.pow(i,.4547069271758437)});return[e[0],e[1],e[2]]},TOe=function(t){var e=EOe(COe([t[0],t[1],t[2]])),n=e[0],r=e[1],i=e[2];return[n,r,i,t[3]]},BOe=function(t){var e=Rf(_Oe(SOe([t[0],t[1],t[2]])));return eO([e[0],e[1],e[2],t[3]])},MOe=function(t){return yo([.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602],t)},kOe=function(t){return yo([1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452],t)},ROe=function(t){return t.map(function(e){return e<16/512?e/16:Math.pow(e,1.8)})},POe=function(t){return t.map(function(e){return e>1/512?Math.pow(e,1/1.8):e*16})},LOe=function(t){var e=ROe([t[0],t[1],t[2]]);return tO(MOe([e[0],e[1],e[2]]))},IOe=function(t){var e=POe(kOe(ste([t[0],t[1],t[2]]))),n=e[0],r=e[1],i=e[2];return[n,r,i,t[3]]},OOe=function(t){var e=LOe([t[0],t[1],t[2]]);return Pv([e[0],e[1],e[2],t[3]])},Z_=1.09929682680944,ate=.018053968510807,FOe=function(t){return t.map(function(e){return e<ate*4.5?e/4.5:Math.pow((e+Z_-1)/Z_,1/.45)})},NOe=function(t){return t.map(function(e){return e>=ate?Z_*Math.pow(e,.45)-(Z_-1):4.5*e})},DOe=function(t){return yo([.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.060985057710791],t)},UOe=function(t){return yo([1.716651187971268,-.355670783776392,-.25336628137366,-.666684351832489,1.616481236634939,.0157685458139111,.017639857445311,-.042770613257809,.942103121235474],t)},HOe=function(t){var e=FOe([t[0],t[1],t[2]]);return DOe([e[0],e[1],e[2]])},jOe=function(t){var e=NOe(UOe([t[0],t[1],t[2]])),n=e[0],r=e[1],i=e[2];return[n,r,i,t[3]]},QOe=function(t){var e=HOe([t[0],t[1],t[2]]);return Pv([e[0],e[1],e[2],t[3]])},qd={name:"color",parse:function(t,e){if(e.type===18){var n=WOe[e.name];if(typeof n>"u")throw new Error('Attempting to parse an unsupported color function "'.concat(e.name,'"'));return n(t,e.values)}if(e.type===5){var r=lte(e),i=r[0],s=r[1],o=r[2],a=r[3];return rc(i,s,o,a)}if(e.type===20){var l=Gl[e.value.toUpperCase()];if(typeof l<"u")return l}return Gl.TRANSPARENT}},lte=function(t){if(t.value.length===3){var e=t.value.substring(0,1),n=t.value.substring(1,2),r=t.value.substring(2,3);return[parseInt(e+e,16),parseInt(n+n,16),parseInt(r+r,16),1]}if(t.value.length===4){var e=t.value.substring(0,1),n=t.value.substring(1,2),r=t.value.substring(2,3),i=t.value.substring(3,4);return[parseInt(e+e,16),parseInt(n+n,16),parseInt(r+r,16),parseInt(i+i,16)/255]}if(t.value.length===6){var e=t.value.substring(0,2),n=t.value.substring(2,4),r=t.value.substring(4,6);return[parseInt(e,16),parseInt(n,16),parseInt(r,16),1]}if(t.value.length===8){var e=t.value.substring(0,2),n=t.value.substring(2,4),r=t.value.substring(4,6),i=t.value.substring(6,8);return[parseInt(e,16),parseInt(n,16),parseInt(r,16),parseInt(i,16)/255]}return[0,0,0,1]},oQ=function(t,e){var n=e.filter(ss);if(pA(n))throw new Error("Relative color not supported for rgb()");if(n.length===3){var r=n.map(J_),i=r[0],s=r[1],o=r[2];return rc(i,s,o,1)}if(n.length===4){var a=n.map(J_),i=a[0],s=a[1],o=a[2],l=a[3];return rc(i,s,o,l)}return 0},zOe=function(t,e){var n=e.filter(ss),r=n[0].type===20?n[0].value:"unknown",i=!pA(n);if(i){var s=r,o=aQ[s];if(typeof o>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(s,'" for color() function'));var a=ui(n[1])?n[1].number:0,l=ui(n[2])?n[2].number:0,c=ui(n[3])?n[3].number:0,u=n.length>4&&n[4].type===6&&n[4].value==="/"&&ui(n[5])?n[5].number:1;return o([a,l,c,u])}else{var d=function(F,I){if(ui(I))return I.number;var z=function(ne){return ne==="r"||ne==="x"?0:ne==="g"||ne==="y"?1:2};if(Cn(I)){var Y=z(I.value);return F[Y]}var $=function(ne){for(var Se=ne.filter(ss),fe="(",ge=0,Oe=Se;ge<Oe.length;ge++){var Fe=Oe[ge];fe+=Fe.type===18&&Fe.name==="calc"?$(Fe.values):ui(Fe)?Fe.number:Fe.type===6||Cn(Fe)?Fe.value:""}return fe+=")",fe};if(I.type===18){var ee=I.values.filter(ss);if(I.name==="calc"){var W=$(ee).replace(/r|x/,F[0].toString()).replace(/g|y/,F[1].toString()).replace(/b|z/,F[2].toString());return new Function("return "+W)()}}return null},f=n[1].type===18?n[1].name:Cn(n[1])||n[1].type===5?"rgb":"unknown",h=Cn(n[2])?n[2].value:"unknown",A=n[1].type===18?n[1].values:Cn(n[1])?[n[1]]:[];if(Cn(n[1])){var p=Gl[n[1].value.toUpperCase()];if(typeof p>"u")throw new Error("Attempting to use unknown color in relative color 'from'");var m=lm(t,n[1].value),g=255&m,y=255&m>>8,w=255&m>>16,v=255&m>>24;A=[{type:17,number:v,flags:1},{type:17,number:w,flags:1},{type:17,number:y,flags:1},{type:17,number:g>1?g/255:g,flags:1}]}else if(n[1].type===5){var x=lte(n[1]),v=x[0],w=x[1],y=x[2],g=x[3];A=[{type:17,number:v,flags:1},{type:17,number:w,flags:1},{type:17,number:y,flags:1},{type:17,number:g>1?g/255:g,flags:1}]}if(A.length===0)throw new Error("Attempting to use unknown color in relative color 'from'");if(h==="unknown")throw new Error("Attempting to use unknown colorspace in relative color 'to'");var C=VOe[f],_=GOe[h],S=aQ[h];if(typeof C>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(f,'" for color() function'));if(typeof _>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(h,'" for color() function'));var E=C(t,A),T=_(E),a=d(T,n[3]),l=d(T,n[4]),c=d(T,n[5]),u=n.length>6&&n[6].type===6&&n[6].value==="/"&&ui(n[7])?n[7].number:1;if(a===null||l===null||c===null)throw new Error("Invalid relative color in color() function");return S([a,l,c,u])}},aQ={srgb:eOe,"srgb-linear":eO,"display-p3":xOe,"a98-rgb":BOe,"prophoto-rgb":OOe,xyz:sQ,"xyz-d50":hOe,"xyz-d65":sQ,rec2020:QOe},VOe={rgb:sOe,hsl:oOe,lab:aOe,lch:lOe,oklab:uOe,oklch:cOe},GOe={srgb:AOe,"srgb-linear":pOe,"display-p3":wOe,"a98-rgb":TOe,"prophoto-rgb":IOe,xyz:iQ,"xyz-d50":fOe,"xyz-d65":iQ,rec2020:jOe},WOe={hsl:rQ,hsla:rQ,rgb:oQ,rgba:oQ,lch:iOe,oklch:rOe,oklab:nOe,lab:tOe,color:zOe},lm=function(t,e){return qd.parse(t,Kee.create(e).parseComponentValue())},Gl={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},KOe={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(n){if(Cn(n))switch(n.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},$Oe={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},$2=function(t,e){var n=qd.parse(t,e[0]),r=e[1];return r&&pr(r)?{color:n,stop:r}:{color:n,stop:null}},lQ=function(t,e){var n=t[0],r=t[t.length-1];n.stop===null&&(n.stop=ns),r.stop===null&&(r.stop=xd);for(var i=[],s=0,o=0;o<t.length;o++){var a=t[o].stop;if(a!==null){var l=qn(a,e);l>s?i.push(l):i.push(s),s=l}else i.push(null)}for(var c=null,o=0;o<i.length;o++){var u=i[o];if(u===null)c===null&&(c=o);else if(c!==null){for(var d=o-c,f=i[c-1],h=(u-f)/(d+1),A=1;A<=d;A++)i[c+A-1]=h*A;c=null}}return t.map(function(p,m){var g=p.color;return{color:g,stop:Math.max(Math.min(1,i[m]/e),0)}})},qOe=function(t,e,n){var r=e/2,i=n/2,s=qn(t[0],e)-r,o=i-qn(t[1],n);return(Math.atan2(o,s)+Math.PI*2)%(Math.PI*2)},XOe=function(t,e,n){var r=typeof t=="number"?t:qOe(t,e,n),i=Math.abs(e*Math.sin(r))+Math.abs(n*Math.cos(r)),s=e/2,o=n/2,a=i/2,l=Math.sin(r-Math.PI/2)*a,c=Math.cos(r-Math.PI/2)*a;return[i,s-c,s+c,o-l,o+l]},Ia=function(t,e){return Math.sqrt(t*t+e*e)},cQ=function(t,e,n,r,i){var s=[[0,0],[0,e],[t,0],[t,e]];return s.reduce(function(o,a){var l=a[0],c=a[1],u=Ia(n-l,r-c);return(i?u<o.optimumDistance:u>o.optimumDistance)?{optimumCorner:a,optimumDistance:u}:o},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},YOe=function(t,e,n,r,i){var s=0,o=0;switch(t.size){case 0:t.shape===0?s=o=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(n),Math.abs(n-i)):t.shape===1&&(s=Math.min(Math.abs(e),Math.abs(e-r)),o=Math.min(Math.abs(n),Math.abs(n-i)));break;case 2:if(t.shape===0)s=o=Math.min(Ia(e,n),Ia(e,n-i),Ia(e-r,n),Ia(e-r,n-i));else if(t.shape===1){var a=Math.min(Math.abs(n),Math.abs(n-i))/Math.min(Math.abs(e),Math.abs(e-r)),l=cQ(r,i,e,n,!0),c=l[0],u=l[1];s=Ia(c-e,(u-n)/a),o=a*s}break;case 1:t.shape===0?s=o=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(n),Math.abs(n-i)):t.shape===1&&(s=Math.max(Math.abs(e),Math.abs(e-r)),o=Math.max(Math.abs(n),Math.abs(n-i)));break;case 3:if(t.shape===0)s=o=Math.max(Ia(e,n),Ia(e,n-i),Ia(e-r,n),Ia(e-r,n-i));else if(t.shape===1){var a=Math.max(Math.abs(n),Math.abs(n-i))/Math.max(Math.abs(e),Math.abs(e-r)),d=cQ(r,i,e,n,!1),c=d[0],u=d[1];s=Ia(c-e,(u-n)/a),o=a*s}break}return Array.isArray(t.size)&&(s=qn(t.size[0],r),o=t.size.length===2?qn(t.size[1],i):s),[s,o]},JOe=function(t,e){var n=ha(180),r=[];return hc(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){n=tte(i);return}else if(ete(o)){n=z2.parse(t,o);return}}var a=$2(t,i);r.push(a)}),{angle:n,stops:r,type:1}},Ow=function(t,e){var n=ha(180),r=[];return hc(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&["top","left","right","bottom"].indexOf(o.value)!==-1){n=tte(i);return}else if(ete(o)){n=(z2.parse(t,o)+ha(270))%ha(360);return}}var a=$2(t,i);r.push(a)}),{angle:n,stops:r,type:1}},ZOe=function(t,e){var n=ha(180),r=[],i=1,s=0,o=3,a=[];return hc(e).forEach(function(l,c){var u=l[0];if(c===0){if(Cn(u)&&u.value==="linear"){i=1;return}else if(Cn(u)&&u.value==="radial"){i=2;return}}if(u.type===18){if(u.name==="from"){var d=qd.parse(t,u.values[0]);r.push({stop:ns,color:d})}else if(u.name==="to"){var d=qd.parse(t,u.values[0]);r.push({stop:xd,color:d})}else if(u.name==="color-stop"){var f=u.values.filter(ss);if(f.length===2){var d=qd.parse(t,f[1]),h=f[0];ui(h)&&r.push({stop:{type:16,number:h.number*100,flags:h.flags},color:d})}}}}),i===1?{angle:(n+ha(180))%ha(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},cte="closest-side",ute="farthest-side",dte="closest-corner",fte="farthest-corner",hte="circle",Ate="ellipse",pte="cover",mte="contain",eFe=function(t,e){var n=0,r=3,i=[],s=[];return hc(e).forEach(function(o,a){var l=!0;if(a===0){var c=!1;l=o.reduce(function(d,f){if(c)if(Cn(f))switch(f.value){case"center":return s.push(Z6),d;case"top":case"left":return s.push(ns),d;case"right":case"bottom":return s.push(xd),d}else(pr(f)||yf(f))&&s.push(f);else if(Cn(f))switch(f.value){case hte:return n=0,!1;case Ate:return n=1,!1;case"at":return c=!0,!1;case cte:return r=0,!1;case pte:case ute:return r=1,!1;case mte:case dte:return r=2,!1;case fte:return r=3,!1}else if(yf(f)||pr(f))return Array.isArray(r)||(r=[]),r.push(f),!1;return d},l)}if(l){var u=$2(t,o);i.push(u)}}),{size:r,shape:n,stops:i,position:s,type:2}},Fw=function(t,e){var n=0,r=3,i=[],s=[];return hc(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(u,d){if(Cn(d))switch(d.value){case"center":return s.push(Z6),!1;case"top":case"left":return s.push(ns),!1;case"right":case"bottom":return s.push(xd),!1}else if(pr(d)||yf(d))return s.push(d),!1;return u},l):a===1&&(l=o.reduce(function(u,d){if(Cn(d))switch(d.value){case hte:return n=0,!1;case Ate:return n=1,!1;case mte:case cte:return r=0,!1;case ute:return r=1,!1;case dte:return r=2,!1;case pte:case fte:return r=3,!1}else if(yf(d)||pr(d))return Array.isArray(r)||(r=[]),r.push(d),!1;return u},l)),l){var c=$2(t,o);i.push(c)}}),{size:r,shape:n,stops:i,position:s,type:2}},tFe=function(t){return t.type===1},nFe=function(t){return t.type===2},nO={name:"image",parse:function(t,e){if(e.type===22){var n={url:e.value,type:0};return t.cache.addImage(e.value),n}if(e.type===18){var r=gte[e.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported image function "'.concat(e.name,'"'));return r(t,e.values)}throw new Error("Unsupported image type ".concat(e.type))}};function rFe(t){return!(t.type===20&&t.value==="none")&&(t.type!==18||!!gte[t.name])}var gte={"linear-gradient":JOe,"-moz-linear-gradient":Ow,"-ms-linear-gradient":Ow,"-o-linear-gradient":Ow,"-webkit-linear-gradient":Ow,"radial-gradient":eFe,"-moz-radial-gradient":Fw,"-ms-radial-gradient":Fw,"-o-radial-gradient":Fw,"-webkit-radial-gradient":Fw,"-webkit-gradient":ZOe},iFe={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(e.length===0)return[];var n=e[0];return n.type===20&&n.value==="none"?[]:e.filter(function(r){return ss(r)&&rFe(r)}).map(function(r){return nO.parse(t,r)})}},sFe={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(n){if(Cn(n))switch(n.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},oFe={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(t,e){return hc(e).map(function(n){return n.filter(pr)}).map(qee)}},aFe={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(t,e){return hc(e).map(function(n){return n.filter(Cn).map(function(r){return r.value}).join(" ")}).map(lFe)}},lFe=function(t){switch(t){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},cm;(function(t){t.AUTO="auto",t.CONTAIN="contain",t.COVER="cover"})(cm||(cm={}));var cFe={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(t,e){return hc(e).map(function(n){return n.filter(uFe)})}},uFe=function(t){return Cn(t)||pr(t)},q2=function(t){return{name:"border-".concat(t,"-color"),initialValue:"transparent",prefix:!1,type:3,format:"color"}},dFe=q2("top"),fFe=q2("right"),hFe=q2("bottom"),AFe=q2("left"),X2=function(t){return{name:"border-radius-".concat(t),initialValue:"0 0",prefix:!1,type:1,parse:function(e,n){return qee(n.filter(pr))}}},pFe=X2("top-left"),mFe=X2("top-right"),gFe=X2("bottom-right"),yFe=X2("bottom-left"),Y2=function(t){return{name:"border-".concat(t,"-style"),initialValue:"solid",prefix:!1,type:2,parse:function(e,n){switch(n){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},vFe=Y2("top"),bFe=Y2("right"),wFe=Y2("bottom"),xFe=Y2("left"),J2=function(t){return{name:"border-".concat(t,"-width"),initialValue:"0",type:0,prefix:!1,parse:function(e,n){return kf(n)?n.number:0}}},CFe=J2("top"),_Fe=J2("right"),SFe=J2("bottom"),EFe=J2("left"),TFe={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},BFe={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(t,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},MFe={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(t,e){return e.filter(Cn).reduce(function(n,r){return n|kFe(r.value)},0)}},kFe=function(t){switch(t){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},RFe={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},PFe={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(t,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},eS;(function(t){t.NORMAL="normal",t.STRICT="strict"})(eS||(eS={}));var LFe={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"strict":return eS.STRICT;case"normal":default:return eS.NORMAL}}},IFe={name:"line-height",initialValue:"normal",prefix:!1,type:4},uQ=function(t,e){return Cn(t)&&t.value==="normal"?1.2*e:t.type===17?e*t.number:pr(t)?qn(t,e):e},OFe={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(t,e){return e.type===20&&e.value==="none"?null:nO.parse(t,e)}},FFe={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(t,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},LR={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},Z2=function(t){return{name:"margin-".concat(t),initialValue:"0",prefix:!1,type:4}},NFe=Z2("top"),DFe=Z2("right"),UFe=Z2("bottom"),HFe=Z2("left"),jFe={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(t,e){return e.filter(Cn).map(function(n){switch(n.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},QFe={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},eE=function(t){return{name:"padding-".concat(t),initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},zFe=eE("top"),VFe=eE("right"),GFe=eE("bottom"),WFe=eE("left"),KFe={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(t,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},$Fe={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(t,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},qFe={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.length===1&&kR(e[0],"none")?[]:hc(e).map(function(n){for(var r={color:Gl.TRANSPARENT,offsetX:ns,offsetY:ns,blur:ns},i=0,s=0;s<n.length;s++){var o=n[s];yf(o)?(i===0?r.offsetX=o:i===1?r.offsetY=o:r.blur=o,i++):r.color=qd.parse(t,o)}return r})}},XFe={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},YFe={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(t,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var n=eNe[e.name];if(typeof n>"u")throw new Error('Attempting to parse an unsupported transform function "'.concat(e.name,'"'));return n(e.values)}return null}},JFe=function(t){var e=t.filter(function(n){return n.type===17}).map(function(n){return n.number});return e.length===6?e:null},ZFe=function(t){var e=t.filter(function(l){return l.type===17}).map(function(l){return l.number}),n=e[0],r=e[1];e[2],e[3];var i=e[4],s=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var o=e[12],a=e[13];return e[14],e[15],e.length===16?[n,r,i,s,o,a]:null},eNe={matrix:JFe,matrix3d:ZFe},dQ={type:16,number:50,flags:Rv},tNe=[dQ,dQ],nNe={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(t,e){var n=e.filter(pr);return n.length!==2?tNe:[n[0],n[1]]}},rNe={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},B1;(function(t){t.NORMAL="normal",t.BREAK_ALL="break-all",t.KEEP_ALL="keep-all"})(B1||(B1={}));var iNe={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-all":return B1.BREAK_ALL;case"keep-all":return B1.KEEP_ALL;case"normal":default:return B1.NORMAL}}},sNe={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(t,e){if(e.type===20)return{auto:!0,order:0};if(ui(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},yte={name:"time",parse:function(t,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},oNe={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(t,e){return ui(e)?e.number:1}},aNe={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},lNe={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(t,e){return e.filter(Cn).map(function(n){switch(n.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(n){return n!==0})}},cNe={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(t,e){var n=[],r=[];return e.forEach(function(i){switch(i.type){case 20:case 0:n.push(i.value);break;case 17:n.push(i.number.toString());break;case 4:r.push(n.join(" ")),n.length=0;break}}),n.length&&r.push(n.join(" ")),r.map(function(i){return i.indexOf(" ")===-1?i:"'".concat(i,"'")})}},uNe={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},dNe={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(t,e){if(ui(e))return e.number;if(Cn(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},fNe={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.filter(Cn).map(function(n){return n.value})}},hNe={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},vi=function(t,e){return(t&e)!==0},ANe={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(e.length===0)return[];var n=e[0];return n.type===20&&n.value==="none"?[]:e}},pNe={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return null;var n=e[0];if(n.type===20&&n.value==="none")return null;for(var r=[],i=e.filter($ee),s=0;s<i.length;s++){var o=i[s],a=i[s+1];if(o.type===20){var l=a&&ui(a)?a.number:1;r.push({counter:o.value,increment:l})}}return r}},mNe={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return[];for(var n=[],r=e.filter($ee),i=0;i<r.length;i++){var s=r[i],o=r[i+1];if(Cn(s)&&s.value!=="none"){var a=o&&ui(o)?o.number:0;n.push({counter:s.value,reset:a})}}return n}},gNe={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(t,e){return e.filter(kf).map(function(n){return yte.parse(t,n)})}},yNe={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return null;var n=e[0];if(n.type===20&&n.value==="none")return null;var r=[],i=e.filter(J6e);if(i.length%2!==0)return null;for(var s=0;s<i.length;s+=2){var o=i[s].value,a=i[s+1].value;r.push({open:o,close:a})}return r}},fQ=function(t,e,n){if(!t)return"";var r=t[Math.min(e,t.length-1)];return r?n?r.open:r.close:""},vNe={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.length===1&&kR(e[0],"none")?[]:hc(e).map(function(n){for(var r={color:255,offsetX:ns,offsetY:ns,blur:ns,spread:ns,inset:!1},i=0,s=0;s<n.length;s++){var o=n[s];kR(o,"inset")?r.inset=!0:yf(o)?(i===0?r.offsetX=o:i===1?r.offsetY=o:i===2?r.blur=o:r.spread=o,i++):r.color=qd.parse(t,o)}return r})}},bNe={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(t,e){var n=[0,1,2],r=[];return e.filter(Cn).forEach(function(i){switch(i.value){case"stroke":r.push(1);break;case"fill":r.push(0);break;case"markers":r.push(2);break}}),n.forEach(function(i){r.indexOf(i)===-1&&r.push(i)}),r}},wNe={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},xNe={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(t,e){return kf(e)?e.number:0}},CNe={name:"objectFit",initialValue:"fill",prefix:!1,type:1,parse:function(t,e){return e.filter(Cn).reduce(function(n,r){return n|_Ne(r.value)},0)}},_Ne=function(t){switch(t){case"contain":return 2;case"cover":return 4;case"none":return 8;case"scale-down":return 16}return 0},SNe=function(){function t(e,n){var r,i;this.animationDuration=wt(e,gNe,n.animationDuration),this.backgroundClip=wt(e,KOe,n.backgroundClip),this.backgroundColor=wt(e,$Oe,n.backgroundColor),this.backgroundImage=wt(e,iFe,n.backgroundImage),this.backgroundOrigin=wt(e,sFe,n.backgroundOrigin),this.backgroundPosition=wt(e,oFe,n.backgroundPosition),this.backgroundRepeat=wt(e,aFe,n.backgroundRepeat),this.backgroundSize=wt(e,cFe,n.backgroundSize),this.borderTopColor=wt(e,dFe,n.borderTopColor),this.borderRightColor=wt(e,fFe,n.borderRightColor),this.borderBottomColor=wt(e,hFe,n.borderBottomColor),this.borderLeftColor=wt(e,AFe,n.borderLeftColor),this.borderTopLeftRadius=wt(e,pFe,n.borderTopLeftRadius),this.borderTopRightRadius=wt(e,mFe,n.borderTopRightRadius),this.borderBottomRightRadius=wt(e,gFe,n.borderBottomRightRadius),this.borderBottomLeftRadius=wt(e,yFe,n.borderBottomLeftRadius),this.borderTopStyle=wt(e,vFe,n.borderTopStyle),this.borderRightStyle=wt(e,bFe,n.borderRightStyle),this.borderBottomStyle=wt(e,wFe,n.borderBottomStyle),this.borderLeftStyle=wt(e,xFe,n.borderLeftStyle),this.borderTopWidth=wt(e,CFe,n.borderTopWidth),this.borderRightWidth=wt(e,_Fe,n.borderRightWidth),this.borderBottomWidth=wt(e,SFe,n.borderBottomWidth),this.borderLeftWidth=wt(e,EFe,n.borderLeftWidth),this.boxShadow=wt(e,vNe,n.boxShadow),this.color=wt(e,TFe,n.color),this.direction=wt(e,BFe,n.direction),this.display=wt(e,MFe,n.display),this.float=wt(e,RFe,n.cssFloat),this.fontFamily=wt(e,cNe,n.fontFamily),this.fontSize=wt(e,uNe,n.fontSize),this.fontStyle=wt(e,hNe,n.fontStyle),this.fontVariant=wt(e,fNe,n.fontVariant),this.fontWeight=wt(e,dNe,n.fontWeight),this.letterSpacing=wt(e,PFe,n.letterSpacing),this.lineBreak=wt(e,LFe,n.lineBreak),this.lineHeight=wt(e,IFe,n.lineHeight),this.listStyleImage=wt(e,OFe,n.listStyleImage),this.listStylePosition=wt(e,FFe,n.listStylePosition),this.listStyleType=wt(e,LR,n.listStyleType),this.marginTop=wt(e,NFe,n.marginTop),this.marginRight=wt(e,DFe,n.marginRight),this.marginBottom=wt(e,UFe,n.marginBottom),this.marginLeft=wt(e,HFe,n.marginLeft),this.opacity=wt(e,oNe,n.opacity);var s=wt(e,jFe,n.overflow);this.overflowX=s[0],this.overflowY=s[s.length>1?1:0],this.overflowWrap=wt(e,QFe,n.overflowWrap),this.paddingTop=wt(e,zFe,n.paddingTop),this.paddingRight=wt(e,VFe,n.paddingRight),this.paddingBottom=wt(e,GFe,n.paddingBottom),this.paddingLeft=wt(e,WFe,n.paddingLeft),this.paintOrder=wt(e,bNe,n.paintOrder),this.position=wt(e,$Fe,n.position),this.textAlign=wt(e,KFe,n.textAlign),this.textDecorationColor=wt(e,aNe,(r=n.textDecorationColor)!==null&&r!==void 0?r:n.color),this.textDecorationLine=wt(e,lNe,(i=n.textDecorationLine)!==null&&i!==void 0?i:n.textDecoration),this.textShadow=wt(e,qFe,n.textShadow),this.textTransform=wt(e,XFe,n.textTransform),this.transform=wt(e,YFe,n.transform),this.transformOrigin=wt(e,nNe,n.transformOrigin),this.visibility=wt(e,rNe,n.visibility),this.webkitTextStrokeColor=wt(e,wNe,n.webkitTextStrokeColor),this.webkitTextStrokeWidth=wt(e,xNe,n.webkitTextStrokeWidth),this.wordBreak=wt(e,iNe,n.wordBreak),this.zIndex=wt(e,sNe,n.zIndex),this.objectFit=wt(e,CNe,n.objectFit)}return t.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},t.prototype.isTransparent=function(){return $d(this.backgroundColor)},t.prototype.isTransformed=function(){return this.transform!==null},t.prototype.isPositioned=function(){return this.position!==0},t.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},t.prototype.isFloating=function(){return this.float!==0},t.prototype.isInlineLevel=function(){return vi(this.display,4)||vi(this.display,33554432)||vi(this.display,268435456)||vi(this.display,536870912)||vi(this.display,67108864)||vi(this.display,134217728)},t}(),ENe=function(){function t(e,n){this.content=wt(e,ANe,n.content),this.quotes=wt(e,yNe,n.quotes)}return t}(),hQ=function(){function t(e,n){this.counterIncrement=wt(e,pNe,n.counterIncrement),this.counterReset=wt(e,mNe,n.counterReset)}return t}(),wt=function(t,e,n){var r=new Wee,i=n!==null&&typeof n<"u"?n.toString():e.initialValue;r.write(i);var s=new Kee(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(t,Cn(o)?o.value:e.initialValue);case 0:return e.parse(t,s.parseComponentValue());case 1:return e.parse(t,s.parseComponentValues());case 4:return s.parseComponentValue();case 3:switch(e.format){case"angle":return z2.parse(t,s.parseComponentValue());case"color":return qd.parse(t,s.parseComponentValue());case"image":return nO.parse(t,s.parseComponentValue());case"length":var a=s.parseComponentValue();return yf(a)?a:ns;case"length-percentage":var l=s.parseComponentValue();return pr(l)?l:ns;case"time":return yte.parse(t,s.parseComponentValue())}break}},TNe="data-html2canvas-debug",BNe=function(t){var e=t.getAttribute(TNe);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},IR=function(t,e){var n=BNe(t);return n===1||e===n},Ac=function(){function t(e,n){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,IR(n,3))debugger;this.styles=new SNe(e,window.getComputedStyle(n,null)),NR(n)&&(this.styles.animationDuration.some(function(r){return r>0})&&(n.style.animationDuration="0s"),this.styles.transform!==null&&(n.style.transform="none")),this.bounds=j2(this.context,n),IR(n,4)&&(this.flags|=16)}return t}(),MNe="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",AQ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",q0=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Nw=0;Nw<AQ.length;Nw++)q0[AQ.charCodeAt(Nw)]=Nw;var kNe=function(t){var e=t.length*.75,n=t.length,r,i=0,s,o,a,l;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(r=0;r<n;r+=4)s=q0[t.charCodeAt(r)],o=q0[t.charCodeAt(r+1)],a=q0[t.charCodeAt(r+2)],l=q0[t.charCodeAt(r+3)],u[i++]=s<<2|o>>4,u[i++]=(o&15)<<4|a>>2,u[i++]=(a&3)<<6|l&63;return c},RNe=function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n.push(t[r+1]<<8|t[r]);return n},PNe=function(t){for(var e=t.length,n=[],r=0;r<e;r+=4)n.push(t[r+3]<<24|t[r+2]<<16|t[r+1]<<8|t[r]);return n},kh=5,rO=11,LB=2,LNe=rO-kh,vte=65536>>kh,INe=1<<kh,IB=INe-1,ONe=1024>>kh,FNe=vte+ONe,NNe=FNe,DNe=32,UNe=NNe+DNe,HNe=65536>>rO,jNe=1<<LNe,QNe=jNe-1,pQ=function(t,e,n){return t.slice?t.slice(e,n):new Uint16Array(Array.prototype.slice.call(t,e,n))},zNe=function(t,e,n){return t.slice?t.slice(e,n):new Uint32Array(Array.prototype.slice.call(t,e,n))},VNe=function(t,e){var n=kNe(t),r=Array.isArray(n)?PNe(n):new Uint32Array(n),i=Array.isArray(n)?RNe(n):new Uint16Array(n),s=24,o=pQ(i,s/2,r[4]/2),a=r[5]===2?pQ(i,(s+r[4])/2):zNe(r,Math.ceil((s+r[4])/4));return new GNe(r[0],r[1],r[2],r[3],o,a)},GNe=function(){function t(e,n,r,i,s,o){this.initialValue=e,this.errorValue=n,this.highStart=r,this.highValueIndex=i,this.index=s,this.data=o}return t.prototype.get=function(e){var n;if(e>=0){if(e<55296||e>56319&&e<=65535)return n=this.index[e>>kh],n=(n<<LB)+(e&IB),this.data[n];if(e<=65535)return n=this.index[vte+(e-55296>>kh)],n=(n<<LB)+(e&IB),this.data[n];if(e<this.highStart)return n=UNe-HNe+(e>>rO),n=this.index[n],n+=e>>kh&QNe,n=this.index[n],n=(n<<LB)+(e&IB),this.data[n];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),mQ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",WNe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Dw=0;Dw<mQ.length;Dw++)WNe[mQ.charCodeAt(Dw)]=Dw;var KNe=1,OB=2,FB=3,gQ=4,yQ=5,$Ne=7,vQ=8,NB=9,DB=10,bQ=11,wQ=12,xQ=13,CQ=14,UB=15,qNe=function(t){for(var e=[],n=0,r=t.length;n<r;){var i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){var s=t.charCodeAt(n++);(s&64512)===56320?e.push(((i&1023)<<10)+(s&1023)+65536):(e.push(i),n--)}else e.push(i)}return e},XNe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var n=t.length;if(!n)return"";for(var r=[],i=-1,s="";++i<n;){var o=t[i];o<=65535?r.push(o):(o-=65536,r.push((o>>10)+55296,o%1024+56320)),(i+1===n||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},YNe=VNe(MNe),Zo="×",HB="÷",JNe=function(t){return YNe.get(t)},ZNe=function(t,e,n){var r=n-2,i=e[r],s=e[n-1],o=e[n];if(s===OB&&o===FB)return Zo;if(s===OB||s===FB||s===gQ||o===OB||o===FB||o===gQ)return HB;if(s===vQ&&[vQ,NB,bQ,wQ].indexOf(o)!==-1||(s===bQ||s===NB)&&(o===NB||o===DB)||(s===wQ||s===DB)&&o===DB||o===xQ||o===yQ||o===$Ne||s===KNe)return Zo;if(s===xQ&&o===CQ){for(;i===yQ;)i=e[--r];if(i===CQ)return Zo}if(s===UB&&o===UB){for(var a=0;i===UB;)a++,i=e[--r];if(a%2===0)return Zo}return HB},eDe=function(t){var e=qNe(t),n=e.length,r=0,i=0,s=e.map(JNe);return{next:function(){if(r>=n)return{done:!0,value:null};for(var o=Zo;r<n&&(o=ZNe(e,s,++r))===Zo;);if(o!==Zo||r===n){var a=XNe.apply(null,e.slice(i,r));return i=r,{value:a,done:!1}}return{done:!0,value:null}}}},tDe=function(t){for(var e=eDe(t),n=[],r;!(r=e.next()).done;)r.value&&n.push(r.value.slice());return n},nDe=function(t){var e=123;if(t.createRange){var n=t.createRange();if(n.getBoundingClientRect){var r=t.createElement("boundtest");r.style.height="".concat(e,"px"),r.style.display="block",t.body.appendChild(r),n.selectNode(r);var i=n.getBoundingClientRect(),s=Math.round(i.height);if(t.body.removeChild(r),s===e)return!0}}return!1},rDe=function(t){var e=t.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",t.body.appendChild(e);var n=t.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var r=e.firstChild,i=Q2(r.data).map(function(l){return Kr(l)}),s=0,o={},a=i.every(function(l,c){n.setStart(r,s),n.setEnd(r,s+l.length);var u=n.getBoundingClientRect();s+=l.length;var d=u.x>o.x||u.y>o.y;return o=u,c===0?!0:d});return t.body.removeChild(e),a},iDe=function(){return typeof new Image().crossOrigin<"u"},sDe=function(){return typeof new XMLHttpRequest().responseType=="string"},oDe=function(t){var e=new Image,n=t.createElement("canvas"),r=n.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{r.drawImage(e,0,0),n.toDataURL()}catch{return!1}return!0},_Q=function(t){return t[0]===0&&t[1]===255&&t[2]===0&&t[3]===255},aDe=function(t){var e=t.createElement("canvas"),n=100;e.width=n,e.height=n;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,n,n);var i=new Image,s=e.toDataURL();i.src=s;var o=OR(n,n,0,0,i);return r.fillStyle="red",r.fillRect(0,0,n,n),SQ(o).then(function(a){r.drawImage(a,0,0);var l=r.getImageData(0,0,n,n).data;r.fillStyle="red",r.fillRect(0,0,n,n);var c=t.createElement("div");return c.style.backgroundImage="url(".concat(s,")"),c.style.height="".concat(n,"px"),_Q(l)?SQ(OR(n,n,0,0,c)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),_Q(r.getImageData(0,0,n,n).data)}).catch(function(){return!1})},OR=function(t,e,n,r,i){var s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return o.setAttributeNS(null,"width",t.toString()),o.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",n.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(a),a.appendChild(i),o},SQ=function(t){return new Promise(function(e,n){var r=new Image;r.onload=function(){return e(r)},r.onerror=n,r.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(t)))})},Wi={get SUPPORT_RANGE_BOUNDS(){var t=nDe(document);return Object.defineProperty(Wi,"SUPPORT_RANGE_BOUNDS",{value:t}),t},get SUPPORT_WORD_BREAKING(){var t=Wi.SUPPORT_RANGE_BOUNDS&&rDe(document);return Object.defineProperty(Wi,"SUPPORT_WORD_BREAKING",{value:t}),t},get SUPPORT_SVG_DRAWING(){var t=oDe(document);return Object.defineProperty(Wi,"SUPPORT_SVG_DRAWING",{value:t}),t},get SUPPORT_FOREIGNOBJECT_DRAWING(){var t=typeof Array.from=="function"&&typeof window.fetch=="function"?aDe(document):Promise.resolve(!1);return Object.defineProperty(Wi,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:t}),t},get SUPPORT_CORS_IMAGES(){var t=iDe();return Object.defineProperty(Wi,"SUPPORT_CORS_IMAGES",{value:t}),t},get SUPPORT_RESPONSE_TYPE(){var t=sDe();return Object.defineProperty(Wi,"SUPPORT_RESPONSE_TYPE",{value:t}),t},get SUPPORT_CORS_XHR(){var t="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Wi,"SUPPORT_CORS_XHR",{value:t}),t},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var t=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Wi,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:t}),t}},M1=function(){function t(e,n){this.text=e,this.bounds=n}return t}(),lDe=function(t,e,n,r){var i=dDe(e,n),s=[],o=0;return i.forEach(function(a){if(n.textDecorationLine.length||a.trim().length>0)if(Wi.SUPPORT_RANGE_BOUNDS){var l=EQ(r,o,a.length).getClientRects();if(l.length>1){var c=iO(a),u=0;c.forEach(function(f){s.push(new M1(f,fu.fromDOMRectList(t,EQ(r,u+o,f.length).getClientRects()))),u+=f.length})}else s.push(new M1(a,fu.fromDOMRectList(t,l)))}else{var d=r.splitText(a.length);s.push(new M1(a,cDe(t,r))),r=d}else Wi.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},cDe=function(t,e){var n=e.ownerDocument;if(n){var r=n.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(r,e);var s=j2(t,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return fu.EMPTY},EQ=function(t,e,n){var r=t.ownerDocument;if(!r)throw new Error("Node has no owner document");var i=r.createRange();return i.setStart(t,e),i.setEnd(t,e+n),i},iO=function(t){if(Wi.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(t)).map(function(n){return n.segment})}return tDe(t)},uDe=function(t,e){if(Wi.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(n.segment(t)).map(function(r){return r.segment})}return hDe(t,e)},dDe=function(t,e){return e.letterSpacing!==0?iO(t):uDe(t,e)},fDe=[32,160,4961,65792,65793,4153,4241],hDe=function(t,e){for(var n=WIe(t,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),r=[],i,s=function(){if(i.value){var o=i.value.slice(),a=Q2(o),l="";a.forEach(function(c){fDe.indexOf(c)===-1?l+=Kr(c):(l.length&&r.push(l),r.push(Kr(c)),l="")}),l.length&&r.push(l)}};!(i=n.next()).done;)s();return r},ADe=function(){function t(e,n,r){this.text=pDe(n.data,r.textTransform),this.textBounds=lDe(e,this.text,r,n)}return t}(),pDe=function(t,e){switch(e){case 1:return t.toLowerCase();case 3:return t.replace(mDe,gDe);case 2:return t.toUpperCase();default:return t}},mDe=/(^|\s|:|-|\(|\))([a-z])/g,gDe=function(t,e,n){return t.length>0?e+n.toUpperCase():t},bte=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.src=r.currentSrc||r.src,i.intrinsicWidth=r.naturalWidth,i.intrinsicHeight=r.naturalHeight,i.context.cache.addImage(i.src),i}return e}(Ac),wte=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.canvas=r,i.intrinsicWidth=r.width,i.intrinsicHeight=r.height,i}return e}(Ac),xte=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this,s=new XMLSerializer,o=j2(n,r);return r.setAttribute("width","".concat(o.width,"px")),r.setAttribute("height","".concat(o.height,"px")),i.svg="data:image/svg+xml,".concat(encodeURIComponent(s.serializeToString(r))),i.intrinsicWidth=r.width.baseVal.value,i.intrinsicHeight=r.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(Ac),Cte=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.value=r.value,i}return e}(Ac),FR=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.start=r.start,i.reversed=typeof r.reversed=="boolean"&&r.reversed===!0,i}return e}(Ac),yDe=[{type:15,flags:0,unit:"px",number:3}],vDe=[{type:16,flags:0,number:50}],bDe=function(t){return t.width>t.height?new fu(t.left+(t.width-t.height)/2,t.top,t.height,t.height):t.width<t.height?new fu(t.left,t.top+(t.height-t.width)/2,t.width,t.width):t},wDe=function(t){var e=t.type===xDe?new Array(t.value.length+1).join("•"):t.value;return e.length===0?t.placeholder||"":e},tS="checkbox",nS="radio",xDe="password",TQ=707406591,sO=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this;switch(i.type=r.type.toLowerCase(),i.checked=r.checked,i.value=wDe(r),(i.type===tS||i.type===nS)&&(i.styles.backgroundColor=3739148031,i.styles.borderTopColor=i.styles.borderRightColor=i.styles.borderBottomColor=i.styles.borderLeftColor=2779096575,i.styles.borderTopWidth=i.styles.borderRightWidth=i.styles.borderBottomWidth=i.styles.borderLeftWidth=1,i.styles.borderTopStyle=i.styles.borderRightStyle=i.styles.borderBottomStyle=i.styles.borderLeftStyle=1,i.styles.backgroundClip=[0],i.styles.backgroundOrigin=[0],i.bounds=bDe(i.bounds)),i.type){case tS:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=yDe;break;case nS:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=vDe;break}return i}return e}(Ac),_te=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this,s=r.options[r.selectedIndex||0];return i.value=s&&s.text||"",i}return e}(Ac),Ste=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.value=r.value,i}return e}(Ac),Ete=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this;i.src=r.src,i.width=parseInt(r.width,10)||0,i.height=parseInt(r.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(r.contentWindow&&r.contentWindow.document&&r.contentWindow.document.documentElement){i.tree=Bte(n,r.contentWindow.document.documentElement);var s=r.contentWindow.document.documentElement?lm(n,getComputedStyle(r.contentWindow.document.documentElement).backgroundColor):Gl.TRANSPARENT,o=r.contentWindow.document.body?lm(n,getComputedStyle(r.contentWindow.document.body).backgroundColor):Gl.TRANSPARENT;i.backgroundColor=$d(s)?$d(o)?i.styles.backgroundColor:o:s}}catch{}return i}return e}(Ac),CDe=["OL","UL","MENU"],Zx=function(t,e,n,r){for(var i=e.firstChild,s=void 0;i;i=s)if(s=i.nextSibling,Mte(i)&&i.data.length>0)n.textNodes.push(new ADe(t,i,n.styles));else if(Dp(i))if(Lte(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return Zx(t,a,n,r)});else{var o=Tte(t,i);o.styles.isVisible()&&(_De(i,o,r)?o.flags|=4:SDe(o.styles)&&(o.flags|=2),CDe.indexOf(i.tagName)!==-1&&(o.flags|=8),n.elements.push(o),i.slot,i.shadowRoot?Zx(t,i.shadowRoot,o,r):!rS(i)&&!kte(i)&&!iS(i)&&Zx(t,i,o,r))}},Tte=function(t,e){return DR(e)?new bte(t,e):Rte(e)?new wte(t,e):kte(e)?new xte(t,e):EDe(e)?new Cte(t,e):TDe(e)?new FR(t,e):BDe(e)?new sO(t,e):iS(e)?new _te(t,e):rS(e)?new Ste(t,e):Pte(e)?new Ete(t,e):new Ac(t,e)},Bte=function(t,e){var n=Tte(t,e);return n.flags|=4,Zx(t,e,n,n),n},_De=function(t,e,n){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||oO(t)&&n.styles.isTransparent()},SDe=function(t){return t.isPositioned()||t.isFloating()},Mte=function(t){return t.nodeType===Node.TEXT_NODE},Dp=function(t){return t.nodeType===Node.ELEMENT_NODE},NR=function(t){return Dp(t)&&typeof t.style<"u"&&!eC(t)},eC=function(t){return typeof t.className=="object"},EDe=function(t){return t.tagName==="LI"},TDe=function(t){return t.tagName==="OL"},BDe=function(t){return t.tagName==="INPUT"},MDe=function(t){return t.tagName==="HTML"},kte=function(t){return t.tagName==="svg"},oO=function(t){return t.tagName==="BODY"},Rte=function(t){return t.tagName==="CANVAS"},BQ=function(t){return t.tagName==="VIDEO"},DR=function(t){return t.tagName==="IMG"},Pte=function(t){return t.tagName==="IFRAME"},MQ=function(t){return t.tagName==="STYLE"},kDe=function(t){return t.tagName==="SCRIPT"},rS=function(t){return t.tagName==="TEXTAREA"},iS=function(t){return t.tagName==="SELECT"},Lte=function(t){return t.tagName==="SLOT"},kQ=function(t){return t.tagName.indexOf("-")>0},RDe=function(){function t(){this.counters={}}return t.prototype.getCounterValue=function(e){var n=this.counters[e];return n&&n.length?n[n.length-1]:1},t.prototype.getCounterValues=function(e){var n=this.counters[e];return n||[]},t.prototype.pop=function(e){var n=this;e.forEach(function(r){return n.counters[r].pop()})},t.prototype.parse=function(e){var n=this,r=e.counterIncrement,i=e.counterReset,s=!0;r!==null&&r.forEach(function(a){var l=n.counters[a.counter];l&&a.increment!==0&&(s=!1,l.length||l.push(1),l[Math.max(0,l.length-1)]+=a.increment)});var o=[];return s&&i.forEach(function(a){var l=n.counters[a.counter];o.push(a.counter),l||(l=n.counters[a.counter]=[]),l.push(a.reset)}),o},t}(),RQ={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},PQ={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},PDe={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},LDe={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},XA=function(t,e,n,r,i,s){return t<e||t>n?zy(t,i,s.length>0):r.integers.reduce(function(o,a,l){for(;t>=a;)t-=a,o+=r.values[l];return o},"")+s},Ite=function(t,e,n,r){var i="";do n||t--,i=r(t)+i,t/=e;while(t*e>=e);return i},Wr=function(t,e,n,r,i){var s=n-e+1;return(t<0?"-":"")+(Ite(Math.abs(t),s,r,function(o){return Kr(Math.floor(o%s)+e)})+i)},zf=function(t,e,n){n===void 0&&(n=". ");var r=e.length;return Ite(Math.abs(t),r,!1,function(i){return e[Math.floor(i%r)]})+n},ap=1,Hu=2,ju=4,X0=8,Sc=function(t,e,n,r,i,s){if(t<-9999||t>9999)return zy(t,4,i.length>0);var o=Math.abs(t),a=i;if(o===0)return e[0]+a;for(var l=0;o>0&&l<=4;l++){var c=o%10;c===0&&vi(s,ap)&&a!==""?a=e[c]+a:c>1||c===1&&l===0||c===1&&l===1&&vi(s,Hu)||c===1&&l===1&&vi(s,ju)&&t>100||c===1&&l>1&&vi(s,X0)?a=e[c]+(l>0?n[l-1]:"")+a:c===1&&l>0&&(a=n[l-1]+a),o=Math.floor(o/10)}return(t<0?r:"")+a},LQ="十百千萬",IQ="拾佰仟萬",OQ="マイナス",jB="마이너스",zy=function(t,e,n){var r=n?". ":"",i=n?"、":"",s=n?", ":"",o=n?" ":"";switch(e){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var a=Wr(t,48,57,!0,r);return a.length<4?"0".concat(a):a;case 4:return zf(t,"〇一二三四五六七八九",i);case 6:return XA(t,1,3999,RQ,3,r).toLowerCase();case 7:return XA(t,1,3999,RQ,3,r);case 8:return Wr(t,945,969,!1,r);case 9:return Wr(t,97,122,!1,r);case 10:return Wr(t,65,90,!1,r);case 11:return Wr(t,1632,1641,!0,r);case 12:case 49:return XA(t,1,9999,PQ,3,r);case 35:return XA(t,1,9999,PQ,3,r).toLowerCase();case 13:return Wr(t,2534,2543,!0,r);case 14:case 30:return Wr(t,6112,6121,!0,r);case 15:return zf(t,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return zf(t,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return Sc(t,"零一二三四五六七八九",LQ,"負",i,Hu|ju|X0);case 47:return Sc(t,"零壹貳參肆伍陸柒捌玖",IQ,"負",i,ap|Hu|ju|X0);case 42:return Sc(t,"零一二三四五六七八九",LQ,"负",i,Hu|ju|X0);case 41:return Sc(t,"零壹贰叁肆伍陆柒捌玖",IQ,"负",i,ap|Hu|ju|X0);case 26:return Sc(t,"〇一二三四五六七八九","十百千万",OQ,i,0);case 25:return Sc(t,"零壱弐参四伍六七八九","拾百千万",OQ,i,ap|Hu|ju);case 31:return Sc(t,"영일이삼사오육칠팔구","십백천만",jB,s,ap|Hu|ju);case 33:return Sc(t,"零一二三四五六七八九","十百千萬",jB,s,0);case 32:return Sc(t,"零壹貳參四五六七八九","拾百千",jB,s,ap|Hu|ju);case 18:return Wr(t,2406,2415,!0,r);case 20:return XA(t,1,19999,LDe,3,r);case 21:return Wr(t,2790,2799,!0,r);case 22:return Wr(t,2662,2671,!0,r);case 22:return XA(t,1,10999,PDe,3,r);case 23:return zf(t,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return zf(t,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Wr(t,3302,3311,!0,r);case 28:return zf(t,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return zf(t,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return Wr(t,3792,3801,!0,r);case 37:return Wr(t,6160,6169,!0,r);case 38:return Wr(t,4160,4169,!0,r);case 39:return Wr(t,2918,2927,!0,r);case 40:return Wr(t,1776,1785,!0,r);case 43:return Wr(t,3046,3055,!0,r);case 44:return Wr(t,3174,3183,!0,r);case 45:return Wr(t,3664,3673,!0,r);case 46:return Wr(t,3872,3881,!0,r);case 3:default:return Wr(t,48,57,!0,r)}},Ote="data-html2canvas-ignore",FQ=function(){function t(e,n,r){if(this.context=e,this.options=r,this.scrolledElements=[],this.referenceElement=n,this.counters=new RDe,this.quoteDepth=0,!n.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(n.ownerDocument.documentElement,!1)}return t.prototype.toIFrame=function(e,n){var r=this,i=IDe(e,n);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var s=e.defaultView.pageXOffset,o=e.defaultView.pageYOffset,a=i.contentWindow,l=a.document,c=NDe(i).then(function(){return Os(r,void 0,void 0,function(){var d,f;return ps(this,function(h){switch(h.label){case 0:return this.scrolledElements.forEach(jDe),a&&(a.scrollTo(n.left,n.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(a.scrollY!==n.top||a.scrollX!==n.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(a.scrollX-n.left,a.scrollY-n.top,0,0))),d=this.options.onclone,f=this.clonedReferenceElement,typeof f>"u"?[2,Promise.reject("Error finding the ".concat(this.referenceElement.nodeName," in the cloned document"))]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:h.sent(),h.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,FDe(l)]:[3,4];case 3:h.sent(),h.label=4;case 4:return typeof d=="function"?[2,Promise.resolve().then(function(){return d(l,f)}).then(function(){return i})]:[2,i]}})})}),u=l.adoptNode(this.documentElement);return WDe(u,l),l.open(),l.write("".concat(UDe(document.doctype),"<html></html>")),HDe(this.referenceElement.ownerDocument,s,o),l.replaceChild(u,l.documentElement),l.close(),c},t.prototype.createElementClone=function(e){if(IR(e,2))debugger;if(Rte(e))return this.createCanvasClone(e);if(BQ(e))return this.createVideoClone(e);if(MQ(e))return this.createStyleClone(e);var n=e.cloneNode(!1);return DR(n)&&(DR(e)&&e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc,n.srcset=""),n.loading==="lazy"&&(n.loading="eager")),kQ(n)?this.createCustomElementClone(n):n},t.prototype.createCustomElementClone=function(e){var n=document.createElement("html2canvascustomelement");return QB(e.style,n),n},t.prototype.createStyleClone=function(e){try{var n=e.sheet;if(n&&n.cssRules){var r=[].slice.call(n.cssRules,0).reduce(function(s,o){return o&&typeof o.cssText=="string"?s+o.cssText:s},""),i=e.cloneNode(!1);return i.textContent=r,i}}catch(s){if(this.context.logger.error("Unable to access cssRules property",s),s.name!=="SecurityError")throw s}return e.cloneNode(!1)},t.prototype.createCanvasClone=function(e){var n;if(this.options.inlineImages&&e.ownerDocument){var r=e.ownerDocument.createElement("img");try{return r.src=e.toDataURL(),r}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var i=e.cloneNode(!1);try{i.width=e.width,i.height=e.height;var s=e.getContext("2d"),o=i.getContext("2d",{willReadFrequently:!0});if(o)if(!this.options.allowTaint&&s)o.putImageData(s.getImageData(0,0,e.width,e.height),0,0);else{var a=(n=e.getContext("webgl2"))!==null&&n!==void 0?n:e.getContext("webgl");if(a){var l=a.getContextAttributes();(l==null?void 0:l.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}o.drawImage(e,0,0)}return i}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return i},t.prototype.createVideoClone=function(e){var n=e.ownerDocument.createElement("canvas");n.width=e.offsetWidth,n.height=e.offsetHeight;var r=n.getContext("2d");try{return r&&(r.drawImage(e,0,0,n.width,n.height),this.options.allowTaint||r.getImageData(0,0,n.width,n.height)),n}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var i=e.ownerDocument.createElement("canvas");return i.width=e.offsetWidth,i.height=e.offsetHeight,i},t.prototype.appendChildNode=function(e,n,r){(!Dp(n)||!kDe(n)&&!n.hasAttribute(Ote)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(n)))&&(!this.options.copyStyles||!Dp(n)||!MQ(n))&&e.appendChild(this.cloneNode(n,r))},t.prototype.cloneChildNodes=function(e,n,r){for(var i=this,s=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;s;s=s.nextSibling)if(Dp(s)&&Lte(s)&&typeof s.assignedNodes=="function"){var o=s.assignedNodes();o.length&&o.forEach(function(a){return i.appendChildNode(n,a,r)})}else this.appendChildNode(n,s,r)},t.prototype.cloneNode=function(e,n){if(Mte(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var r=e.ownerDocument.defaultView;if(r&&Dp(e)&&(NR(e)||eC(e))){var i=this.createElementClone(e);i.style.transitionProperty="none";var s=r.getComputedStyle(e),o=r.getComputedStyle(e,":before"),a=r.getComputedStyle(e,":after");this.referenceElement===e&&NR(i)&&(this.clonedReferenceElement=i),oO(i)&&VDe(i);var l=this.counters.parse(new hQ(this.context,s)),c=this.resolvePseudoContent(e,i,o,k1.BEFORE);kQ(e)&&(n=!0),BQ(e)||this.cloneChildNodes(e,i,n),c&&i.insertBefore(c,i.firstChild);var u=this.resolvePseudoContent(e,i,a,k1.AFTER);return u&&i.appendChild(u),this.counters.pop(l),(s&&(this.options.copyStyles||eC(e))&&!Pte(e)||n)&&QB(s,i),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([i,e.scrollLeft,e.scrollTop]),(rS(e)||iS(e))&&(rS(i)||iS(i))&&(i.value=e.value),i}return e.cloneNode(!1)},t.prototype.resolvePseudoContent=function(e,n,r,i){var s=this;if(r){var o=r.content,a=n.ownerDocument;if(!(!a||!o||o==="none"||o==="-moz-alt-content"||r.display==="none")){this.counters.parse(new hQ(this.context,r));var l=new ENe(this.context,r),c=a.createElement("html2canvaspseudoelement");QB(r,c),l.content.forEach(function(d){if(d.type===0)c.appendChild(a.createTextNode(d.value));else if(d.type===22){var f=a.createElement("img");f.src=d.value,f.style.opacity="1",c.appendChild(f)}else if(d.type===18){if(d.name==="attr"){var h=d.values.filter(Cn);h.length&&c.appendChild(a.createTextNode(e.getAttribute(h[0].value)||""))}else if(d.name==="counter"){var A=d.values.filter(ss),p=A[0],m=A[1];if(p&&Cn(p)){var g=s.counters.getCounterValue(p.value),y=m&&Cn(m)?LR.parse(s.context,m.value):3;c.appendChild(a.createTextNode(zy(g,y,!1)))}}else if(d.name==="counters"){var w=d.values.filter(ss),p=w[0],v=w[1],m=w[2];if(p&&Cn(p)){var x=s.counters.getCounterValues(p.value),C=m&&Cn(m)?LR.parse(s.context,m.value):3,_=v&&v.type===0?v.value:"",S=x.map(function(R){return zy(R,C,!1)}).join(_);c.appendChild(a.createTextNode(S))}}}else if(d.type===20)switch(d.value){case"open-quote":c.appendChild(a.createTextNode(fQ(l.quotes,s.quoteDepth++,!0)));break;case"close-quote":c.appendChild(a.createTextNode(fQ(l.quotes,--s.quoteDepth,!1)));break;default:c.appendChild(a.createTextNode(d.value))}}),c.className="".concat(UR," ").concat(HR);var u=i===k1.BEFORE?" ".concat(UR):" ".concat(HR);return eC(n)?n.className.baseValue+=u:n.className+=u,c}}},t.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},t}(),k1;(function(t){t[t.BEFORE=0]="BEFORE",t[t.AFTER=1]="AFTER"})(k1||(k1={}));var IDe=function(t,e){var n=t.createElement("iframe");return n.className="html2canvas-container",n.style.visibility="hidden",n.style.position="fixed",n.style.left="-10000px",n.style.top="0px",n.style.border="0",n.width=e.width.toString(),n.height=e.height.toString(),n.scrolling="no",n.setAttribute(Ote,"true"),t.body.appendChild(n),n},ODe=function(t){return new Promise(function(e){if(t.complete){e();return}if(!t.src){e();return}t.onload=e,t.onerror=e})},FDe=function(t){return Promise.all([].slice.call(t.images,0).map(ODe))},NDe=function(t){return new Promise(function(e,n){var r=t.contentWindow;if(!r)return n("No window assigned for iframe");var i=r.document;r.onload=t.onload=function(){r.onload=t.onload=null;var s=setInterval(function(){i.body.childNodes.length>0&&i.readyState==="complete"&&(clearInterval(s),e(t))},50)}})},DDe=["all","d","content"],QB=function(t,e){for(var n=t.length-1;n>=0;n--){var r=t.item(n);DDe.indexOf(r)===-1&&e.style.setProperty(r,t.getPropertyValue(r))}return e},UDe=function(t){var e="";return t&&(e+="<!DOCTYPE ",t.name&&(e+=t.name),t.internalSubset&&(e+=t.internalSubset),t.publicId&&(e+='"'.concat(t.publicId,'"')),t.systemId&&(e+='"'.concat(t.systemId,'"')),e+=">"),e},HDe=function(t,e,n){t&&t.defaultView&&(e!==t.defaultView.pageXOffset||n!==t.defaultView.pageYOffset)&&t.defaultView.scrollTo(e,n)},jDe=function(t){var e=t[0],n=t[1],r=t[2];e.scrollLeft=n,e.scrollTop=r},QDe=":before",zDe=":after",UR="___html2canvas___pseudoelement_before",HR="___html2canvas___pseudoelement_after",NQ=`{
    content: "" !important;
    display: none !important;
}`,VDe=function(t){GDe(t,".".concat(UR).concat(QDe).concat(NQ,`
         .`).concat(HR).concat(zDe).concat(NQ))},GDe=function(t,e){var n=t.ownerDocument;if(n){var r=n.createElement("style");r.textContent=e,t.appendChild(r)}},WDe=function(t,e){var n,r=e.createElement("base");r.href=e.baseURI;var i=t.getElementsByTagName("head").item(0);i==null||i.insertBefore(r,(n=i==null?void 0:i.firstChild)!==null&&n!==void 0?n:null)},Fte=function(){function t(){}return t.getOrigin=function(e){var n=t._link;return n?(n.href=e,n.href=n.href,n.protocol+n.hostname+n.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),KDe=function(){function t(e,n){this.context=e,this._options=n,this._cache={}}return t.prototype.addImage=function(e){var n=Promise.resolve();return this.has(e)||(VB(e)||YDe(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),n},t.prototype.match=function(e){return this._cache[e]},t.prototype.loadImage=function(e){return Os(this,void 0,void 0,function(){var n,r,i,s,o=this;return ps(this,function(a){switch(a.label){case 0:return n=Fte.isSameOrigin(e),r=!zB(e)&&this._options.useCORS===!0&&Wi.SUPPORT_CORS_IMAGES&&!n,i=!zB(e)&&!n&&!VB(e)&&typeof this._options.proxy=="string"&&Wi.SUPPORT_CORS_XHR&&!r,!n&&this._options.allowTaint===!1&&!zB(e)&&!VB(e)&&!i&&!r?[2]:(s=e,i?[4,this.proxy(s)]:[3,2]);case 1:s=a.sent(),a.label=2;case 2:return this.context.logger.debug("Added image ".concat(e.substring(0,256))),[4,new Promise(function(l,c){var u=new Image;u.onload=function(){return l(u)},u.onerror=c,(JDe(s)||r)&&(u.crossOrigin="anonymous"),u.src=s,u.complete===!0&&setTimeout(function(){return l(u)},500),o._options.imageTimeout>0&&setTimeout(function(){return c("Timed out (".concat(o._options.imageTimeout,"ms) loading image"))},o._options.imageTimeout)})];case 3:return[2,a.sent()]}})})},t.prototype.has=function(e){return typeof this._cache[e]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(e){var n=this,r=this._options.proxy;if(!r)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(s,o){var a=Wi.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(a==="text")s(l.response);else{var d=new FileReader;d.addEventListener("load",function(){return s(d.result)},!1),d.addEventListener("error",function(f){return o(f)},!1),d.readAsDataURL(l.response)}else o("Failed to proxy resource ".concat(i," with status code ").concat(l.status))},l.onerror=o;var c=r.indexOf("?")>-1?"&":"?";if(l.open("GET","".concat(r).concat(c,"url=").concat(encodeURIComponent(e),"&responseType=").concat(a)),a!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=a),n._options.imageTimeout){var u=n._options.imageTimeout;l.timeout=u,l.ontimeout=function(){return o("Timed out (".concat(u,"ms) proxying ").concat(i))}}l.send()})},t}(),$De=/^data:image\/svg\+xml/i,qDe=/^data:image\/.*;base64,/i,XDe=/^data:image\/.*/i,YDe=function(t){return Wi.SUPPORT_SVG_DRAWING||!ZDe(t)},zB=function(t){return XDe.test(t)},JDe=function(t){return qDe.test(t)},VB=function(t){return t.substr(0,4)==="blob"},ZDe=function(t){return t.substr(-3).toLowerCase()==="svg"||$De.test(t)},vt=function(){function t(e,n){this.type=0,this.x=e,this.y=n}return t.prototype.add=function(e,n){return new t(this.x+e,this.y+n)},t}(),YA=function(t,e,n){return new vt(t.x+(e.x-t.x)*n,t.y+(e.y-t.y)*n)},Uw=function(){function t(e,n,r,i){this.type=1,this.start=e,this.startControl=n,this.endControl=r,this.end=i}return t.prototype.subdivide=function(e,n){var r=YA(this.start,this.startControl,e),i=YA(this.startControl,this.endControl,e),s=YA(this.endControl,this.end,e),o=YA(r,i,e),a=YA(i,s,e),l=YA(o,a,e);return n?new t(this.start,r,o,l):new t(l,a,s,this.end)},t.prototype.add=function(e,n){return new t(this.start.add(e,n),this.startControl.add(e,n),this.endControl.add(e,n),this.end.add(e,n))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),oa=function(t){return t.type===1},e8e=function(){function t(e){var n=e.styles,r=e.bounds,i=$0(n.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=$0(n.borderTopRightRadius,r.width,r.height),l=a[0],c=a[1],u=$0(n.borderBottomRightRadius,r.width,r.height),d=u[0],f=u[1],h=$0(n.borderBottomLeftRadius,r.width,r.height),A=h[0],p=h[1],m=[];m.push((s+l)/r.width),m.push((A+d)/r.width),m.push((o+p)/r.height),m.push((c+f)/r.height);var g=Math.max.apply(Math,m);g>1&&(s/=g,o/=g,l/=g,c/=g,d/=g,f/=g,A/=g,p/=g);var y=r.width-l,w=r.height-f,v=r.width-d,x=r.height-p,C=n.borderTopWidth,_=n.borderRightWidth,S=n.borderBottomWidth,E=n.borderLeftWidth,T=qn(n.paddingTop,e.bounds.width),R=qn(n.paddingRight,e.bounds.width),k=qn(n.paddingBottom,e.bounds.width),B=qn(n.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?vr(r.left+E/3,r.top+C/3,s-E/3,o-C/3,Qn.TOP_LEFT):new vt(r.left+E/3,r.top+C/3),this.topRightBorderDoubleOuterBox=s>0||o>0?vr(r.left+y,r.top+C/3,l-_/3,c-C/3,Qn.TOP_RIGHT):new vt(r.left+r.width-_/3,r.top+C/3),this.bottomRightBorderDoubleOuterBox=d>0||f>0?vr(r.left+v,r.top+w,d-_/3,f-S/3,Qn.BOTTOM_RIGHT):new vt(r.left+r.width-_/3,r.top+r.height-S/3),this.bottomLeftBorderDoubleOuterBox=A>0||p>0?vr(r.left+E/3,r.top+x,A-E/3,p-S/3,Qn.BOTTOM_LEFT):new vt(r.left+E/3,r.top+r.height-S/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?vr(r.left+E*2/3,r.top+C*2/3,s-E*2/3,o-C*2/3,Qn.TOP_LEFT):new vt(r.left+E*2/3,r.top+C*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?vr(r.left+y,r.top+C*2/3,l-_*2/3,c-C*2/3,Qn.TOP_RIGHT):new vt(r.left+r.width-_*2/3,r.top+C*2/3),this.bottomRightBorderDoubleInnerBox=d>0||f>0?vr(r.left+v,r.top+w,d-_*2/3,f-S*2/3,Qn.BOTTOM_RIGHT):new vt(r.left+r.width-_*2/3,r.top+r.height-S*2/3),this.bottomLeftBorderDoubleInnerBox=A>0||p>0?vr(r.left+E*2/3,r.top+x,A-E*2/3,p-S*2/3,Qn.BOTTOM_LEFT):new vt(r.left+E*2/3,r.top+r.height-S*2/3),this.topLeftBorderStroke=s>0||o>0?vr(r.left+E/2,r.top+C/2,s-E/2,o-C/2,Qn.TOP_LEFT):new vt(r.left+E/2,r.top+C/2),this.topRightBorderStroke=s>0||o>0?vr(r.left+y,r.top+C/2,l-_/2,c-C/2,Qn.TOP_RIGHT):new vt(r.left+r.width-_/2,r.top+C/2),this.bottomRightBorderStroke=d>0||f>0?vr(r.left+v,r.top+w,d-_/2,f-S/2,Qn.BOTTOM_RIGHT):new vt(r.left+r.width-_/2,r.top+r.height-S/2),this.bottomLeftBorderStroke=A>0||p>0?vr(r.left+E/2,r.top+x,A-E/2,p-S/2,Qn.BOTTOM_LEFT):new vt(r.left+E/2,r.top+r.height-S/2),this.topLeftBorderBox=s>0||o>0?vr(r.left,r.top,s,o,Qn.TOP_LEFT):new vt(r.left,r.top),this.topRightBorderBox=l>0||c>0?vr(r.left+y,r.top,l,c,Qn.TOP_RIGHT):new vt(r.left+r.width,r.top),this.bottomRightBorderBox=d>0||f>0?vr(r.left+v,r.top+w,d,f,Qn.BOTTOM_RIGHT):new vt(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=A>0||p>0?vr(r.left,r.top+x,A,p,Qn.BOTTOM_LEFT):new vt(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?vr(r.left+E,r.top+C,Math.max(0,s-E),Math.max(0,o-C),Qn.TOP_LEFT):new vt(r.left+E,r.top+C),this.topRightPaddingBox=l>0||c>0?vr(r.left+Math.min(y,r.width-_),r.top+C,y>r.width+_?0:Math.max(0,l-_),Math.max(0,c-C),Qn.TOP_RIGHT):new vt(r.left+r.width-_,r.top+C),this.bottomRightPaddingBox=d>0||f>0?vr(r.left+Math.min(v,r.width-E),r.top+Math.min(w,r.height-S),Math.max(0,d-_),Math.max(0,f-S),Qn.BOTTOM_RIGHT):new vt(r.left+r.width-_,r.top+r.height-S),this.bottomLeftPaddingBox=A>0||p>0?vr(r.left+E,r.top+Math.min(x,r.height-S),Math.max(0,A-E),Math.max(0,p-S),Qn.BOTTOM_LEFT):new vt(r.left+E,r.top+r.height-S),this.topLeftContentBox=s>0||o>0?vr(r.left+E+B,r.top+C+T,Math.max(0,s-(E+B)),Math.max(0,o-(C+T)),Qn.TOP_LEFT):new vt(r.left+E+B,r.top+C+T),this.topRightContentBox=l>0||c>0?vr(r.left+Math.min(y,r.width+E+B),r.top+C+T,y>r.width+E+B?0:l-E+B,c-(C+T),Qn.TOP_RIGHT):new vt(r.left+r.width-(_+R),r.top+C+T),this.bottomRightContentBox=d>0||f>0?vr(r.left+Math.min(v,r.width-(E+B)),r.top+Math.min(w,r.height+C+T),Math.max(0,d-(_+R)),f-(S+k),Qn.BOTTOM_RIGHT):new vt(r.left+r.width-(_+R),r.top+r.height-(S+k)),this.bottomLeftContentBox=A>0||p>0?vr(r.left+E+B,r.top+x,Math.max(0,A-(E+B)),p-(S+k),Qn.BOTTOM_LEFT):new vt(r.left+E+B,r.top+r.height-(S+k))}return t}(),Qn;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Qn||(Qn={}));var vr=function(t,e,n,r,i){var s=4*((Math.sqrt(2)-1)/3),o=n*s,a=r*s,l=t+n,c=e+r;switch(i){case Qn.TOP_LEFT:return new Uw(new vt(t,c),new vt(t,c-a),new vt(l-o,e),new vt(l,e));case Qn.TOP_RIGHT:return new Uw(new vt(t,e),new vt(t+o,e),new vt(l,c-a),new vt(l,c));case Qn.BOTTOM_RIGHT:return new Uw(new vt(l,e),new vt(l,e+a),new vt(t+o,c),new vt(t,c));case Qn.BOTTOM_LEFT:default:return new Uw(new vt(l,c),new vt(l-o,c),new vt(t,e+a),new vt(t,e))}},sS=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},t8e=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},oS=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},n8e=function(){function t(e,n,r){this.offsetX=e,this.offsetY=n,this.matrix=r,this.type=0,this.target=6}return t}(),Hw=function(){function t(e,n){this.path=e,this.target=n,this.type=1}return t}(),r8e=function(){function t(e){this.opacity=e,this.type=2,this.target=6}return t}(),i8e=function(t){return t.type===0},Nte=function(t){return t.type===1},s8e=function(t){return t.type===2},DQ=function(t,e){return t.length===e.length?t.some(function(n,r){return n===e[r]}):!1},o8e=function(t,e,n,r,i){return t.map(function(s,o){switch(o){case 0:return s.add(e,n);case 1:return s.add(e+r,n);case 2:return s.add(e+r,n+i);case 3:return s.add(e,n+i)}return s})},Dte=function(){function t(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t}(),Ute=function(){function t(e,n){if(this.container=e,this.parent=n,this.effects=[],this.curves=new e8e(this.container),this.container.styles.opacity<1&&this.effects.push(new r8e(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new n8e(r,i,s))}if(this.container.styles.overflowX!==0){var o=sS(this.curves),a=oS(this.curves);DQ(o,a)?this.effects.push(new Hw(o,6)):(this.effects.push(new Hw(o,2)),this.effects.push(new Hw(a,4)))}}return t.prototype.getEffects=function(e){for(var n=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,i=this.effects.slice(0);r;){var s=r.effects.filter(function(l){return!Nte(l)});if(n||r.container.styles.position!==0||!r.parent){if(n=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var o=sS(r.curves),a=oS(r.curves);DQ(o,a)||i.unshift(new Hw(a,6))}i.unshift.apply(i,s)}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return vi(l.target,e)})},t}(),jR=function(t,e,n,r){t.container.elements.forEach(function(i){var s=vi(i.flags,4),o=vi(i.flags,2),a=new Ute(i,t);vi(i.styles.display,2048)&&r.push(a);var l=vi(i.flags,8)?[]:r;if(s||o){var c=s||i.styles.isPositioned()?n:e,u=new Dte(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var d=i.styles.zIndex.order;if(d<0){var f=0;c.negativeZIndex.some(function(A,p){return d>A.element.container.styles.zIndex.order?(f=p,!1):f>0}),c.negativeZIndex.splice(f,0,u)}else if(d>0){var h=0;c.positiveZIndex.some(function(A,p){return d>=A.element.container.styles.zIndex.order?(h=p+1,!1):h>0}),c.positiveZIndex.splice(h,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else i.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);jR(a,u,s?u:n,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),jR(a,e,n,l);vi(i.flags,8)&&Hte(i,l)})},Hte=function(t,e){for(var n=t instanceof FR?t.start:1,r=t instanceof FR?t.reversed:!1,i=0;i<e.length;i++){var s=e[i];s.container instanceof Cte&&typeof s.container.value=="number"&&s.container.value!==0&&(n=s.container.value),s.listValue=zy(n,s.container.styles.listStyleType,!0),n+=r?-1:1}},a8e=function(t){var e=new Ute(t,null),n=new Dte(e),r=[];return jR(e,n,n,r),Hte(e.container,r),n},UQ=function(t,e){switch(e){case 0:return Aa(t.topLeftBorderBox,t.topLeftPaddingBox,t.topRightBorderBox,t.topRightPaddingBox);case 1:return Aa(t.topRightBorderBox,t.topRightPaddingBox,t.bottomRightBorderBox,t.bottomRightPaddingBox);case 2:return Aa(t.bottomRightBorderBox,t.bottomRightPaddingBox,t.bottomLeftBorderBox,t.bottomLeftPaddingBox);case 3:default:return Aa(t.bottomLeftBorderBox,t.bottomLeftPaddingBox,t.topLeftBorderBox,t.topLeftPaddingBox)}},l8e=function(t,e){switch(e){case 0:return Aa(t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox,t.topRightBorderBox,t.topRightBorderDoubleOuterBox);case 1:return Aa(t.topRightBorderBox,t.topRightBorderDoubleOuterBox,t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox);case 2:return Aa(t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox,t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox);case 3:default:return Aa(t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox,t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox)}},c8e=function(t,e){switch(e){case 0:return Aa(t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox,t.topRightBorderDoubleInnerBox,t.topRightPaddingBox);case 1:return Aa(t.topRightBorderDoubleInnerBox,t.topRightPaddingBox,t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox);case 2:return Aa(t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox,t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox);case 3:default:return Aa(t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox,t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox)}},u8e=function(t,e){switch(e){case 0:return jw(t.topLeftBorderStroke,t.topRightBorderStroke);case 1:return jw(t.topRightBorderStroke,t.bottomRightBorderStroke);case 2:return jw(t.bottomRightBorderStroke,t.bottomLeftBorderStroke);case 3:default:return jw(t.bottomLeftBorderStroke,t.topLeftBorderStroke)}},jw=function(t,e){var n=[];return oa(t)?n.push(t.subdivide(.5,!1)):n.push(t),oa(e)?n.push(e.subdivide(.5,!0)):n.push(e),n},Aa=function(t,e,n,r){var i=[];return oa(t)?i.push(t.subdivide(.5,!1)):i.push(t),oa(n)?i.push(n.subdivide(.5,!0)):i.push(n),oa(r)?i.push(r.subdivide(.5,!0).reverse()):i.push(r),oa(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},jte=function(t){var e=t.bounds,n=t.styles;return e.add(n.borderLeftWidth,n.borderTopWidth,-(n.borderRightWidth+n.borderLeftWidth),-(n.borderTopWidth+n.borderBottomWidth))},aS=function(t){var e=t.styles,n=t.bounds,r=qn(e.paddingLeft,n.width),i=qn(e.paddingRight,n.width),s=qn(e.paddingTop,n.width),o=qn(e.paddingBottom,n.width);return n.add(r+e.borderLeftWidth,s+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+r+i),-(e.borderTopWidth+e.borderBottomWidth+s+o))},d8e=function(t,e){return t===0?e.bounds:t===2?aS(e):jte(e)},f8e=function(t,e){return t===0?e.bounds:t===2?aS(e):jte(e)},GB=function(t,e,n){var r=d8e(lp(t.styles.backgroundOrigin,e),t),i=f8e(lp(t.styles.backgroundClip,e),t),s=h8e(lp(t.styles.backgroundSize,e),n,r),o=s[0],a=s[1],l=$0(lp(t.styles.backgroundPosition,e),r.width-o,r.height-a),c=A8e(lp(t.styles.backgroundRepeat,e),l,s,r,i),u=Math.round(r.left+l[0]),d=Math.round(r.top+l[1]);return o=Math.max(1,o),a=Math.max(1,a),[c,u,d,o,a]},JA=function(t){return Cn(t)&&t.value===cm.AUTO},Qw=function(t){return typeof t=="number"},h8e=function(t,e,n){var r=e[0],i=e[1],s=e[2],o=t[0],a=t[1];if(!o)return[0,0];if(pr(o)&&a&&pr(a))return[qn(o,n.width),qn(a,n.height)];var l=Qw(s);if(Cn(o)&&(o.value===cm.CONTAIN||o.value===cm.COVER)){if(Qw(s)){var c=n.width/n.height;return c<s!=(o.value===cm.COVER)?[n.width,n.width/s]:[n.height*s,n.height]}return[n.width,n.height]}var u=Qw(r),d=Qw(i),f=u||d;if(JA(o)&&(!a||JA(a))){if(u&&d)return[r,i];if(!l&&!f)return[n.width,n.height];if(f&&l){var h=u?r:i*s,A=d?i:r/s;return[h,A]}var p=u?r:n.width,m=d?i:n.height;return[p,m]}if(l){var g=0,y=0;return pr(o)?g=qn(o,n.width):pr(a)&&(y=qn(a,n.height)),JA(o)?g=y*s:(!a||JA(a))&&(y=g/s),[g,y]}var w=null,v=null;if(pr(o)?w=qn(o,n.width):a&&pr(a)&&(v=qn(a,n.height)),w!==null&&(!a||JA(a))&&(v=u&&d?w/r*i:n.height),v!==null&&JA(o)&&(w=u&&d?v/i*r:n.width),w!==null&&v!==null)return[w,v];throw new Error("Unable to calculate background-size for element")},lp=function(t,e){var n=t[e];return typeof n>"u"?t[0]:n},A8e=function(t,e,n,r,i){var s=e[0],o=e[1],a=n[0],l=n[1];switch(t){case 2:return[new vt(Math.round(r.left),Math.round(r.top+o)),new vt(Math.round(r.left+r.width),Math.round(r.top+o)),new vt(Math.round(r.left+r.width),Math.round(l+r.top+o)),new vt(Math.round(r.left),Math.round(l+r.top+o))];case 3:return[new vt(Math.round(r.left+s),Math.round(r.top)),new vt(Math.round(r.left+s+a),Math.round(r.top)),new vt(Math.round(r.left+s+a),Math.round(r.height+r.top)),new vt(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new vt(Math.round(r.left+s),Math.round(r.top+o)),new vt(Math.round(r.left+s+a),Math.round(r.top+o)),new vt(Math.round(r.left+s+a),Math.round(r.top+o+l)),new vt(Math.round(r.left+s),Math.round(r.top+o+l))];default:return[new vt(Math.round(i.left),Math.round(i.top)),new vt(Math.round(i.left+i.width),Math.round(i.top)),new vt(Math.round(i.left+i.width),Math.round(i.height+i.top)),new vt(Math.round(i.left),Math.round(i.height+i.top))]}},p8e="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",HQ="Hidden Text",m8e=function(){function t(e){this._data={},this._document=e}return t.prototype.parseMetrics=function(e,n){var r=this._document.createElement("div"),i=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=n,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",o.appendChild(r),i.src=p8e,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=n,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(HQ)),r.appendChild(s),r.appendChild(i);var a=i.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(HQ)),r.style.lineHeight="normal",i.style.verticalAlign="super";var l=i.offsetTop-r.offsetTop+2;return o.removeChild(r),{baseline:a,middle:l}},t.prototype.getMetrics=function(e,n){var r="".concat(e," ").concat(n);return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,n)),this._data[r]},t}(),Qte=function(){function t(e,n){this.context=e,this.options=n}return t}(),g8e=1e4,y8e=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i._activeEffects=[],i.canvas=r.canvas?r.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),r.canvas||(i.canvas.width=Math.floor(r.width*r.scale),i.canvas.height=Math.floor(r.height*r.scale),i.canvas.style.width="".concat(r.width,"px"),i.canvas.style.height="".concat(r.height,"px")),i.fontMetrics=new m8e(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-r.x,-r.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized (".concat(r.width,"x").concat(r.height,") with scale ").concat(r.scale)),i}return e.prototype.applyEffects=function(n){for(var r=this;this._activeEffects.length;)this.popEffect();n.forEach(function(i){return r.applyEffect(i)})},e.prototype.applyEffect=function(n){this.ctx.save(),s8e(n)&&(this.ctx.globalAlpha=n.opacity),i8e(n)&&(this.ctx.translate(n.offsetX,n.offsetY),this.ctx.transform(n.matrix[0],n.matrix[1],n.matrix[2],n.matrix[3],n.matrix[4],n.matrix[5]),this.ctx.translate(-n.offsetX,-n.offsetY)),Nte(n)&&(this.path(n.path),this.ctx.clip()),this._activeEffects.push(n)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(n){return Os(this,void 0,void 0,function(){var r;return ps(this,function(i){switch(i.label){case 0:return r=n.element.container.styles,r.isVisible()?[4,this.renderStackContent(n)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(n){return Os(this,void 0,void 0,function(){return ps(this,function(r){switch(r.label){case 0:if(vi(n.container.flags,16))debugger;return n.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(n)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(n)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(n,r,i){var s=this;if(r===0)navigator.userAgent.indexOf("Firefox")===-1?(this.ctx.textBaseline="ideographic",this.ctx.fillText(n.text,n.bounds.left,n.bounds.top+n.bounds.height)):this.ctx.fillText(n.text,n.bounds.left,n.bounds.top+i);else{var o=iO(n.text);o.reduce(function(a,l){return s.ctx.fillText(l,a,n.bounds.top+i),a+s.ctx.measureText(l).width},n.bounds.left)}},e.prototype.createFontStyle=function(n){var r=n.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),i=C8e(n.fontFamily).join(", "),s=kf(n.fontSize)?"".concat(n.fontSize.number).concat(n.fontSize.unit):"".concat(n.fontSize.number,"px");return[[n.fontStyle,r,n.fontWeight,s,i].join(" "),i,s]},e.prototype.renderTextNode=function(n,r){return Os(this,void 0,void 0,function(){var i,s,o=this;return ps(this,function(a){return i=this.createFontStyle(r)[0],this.ctx.font=i,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",s=r.paintOrder,n.textBounds.forEach(function(l){s.forEach(function(c){switch(c){case 0:o.ctx.fillStyle=Mi(r.color),o.renderTextWithLetterSpacing(l,r.letterSpacing,r.fontSize.number);var u=r.textShadow;if(u.length&&l.text.trim().length&&(u.slice(0).reverse().forEach(function(f){o.ctx.shadowColor=Mi(f.color),o.ctx.shadowOffsetX=f.offsetX.number*o.options.scale,o.ctx.shadowOffsetY=f.offsetY.number*o.options.scale,o.ctx.shadowBlur=f.blur.number,o.renderTextWithLetterSpacing(l,r.letterSpacing,r.fontSize.number)}),o.ctx.shadowColor="",o.ctx.shadowOffsetX=0,o.ctx.shadowOffsetY=0,o.ctx.shadowBlur=0),r.textDecorationLine.length){o.ctx.fillStyle=Mi(r.textDecorationColor||r.color);var d=1;r.textDecorationLine.forEach(function(f){switch(f){case 1:o.ctx.fillRect(l.bounds.left,l.bounds.top+l.bounds.height-d,l.bounds.width,d);break;case 2:o.ctx.fillRect(l.bounds.left,l.bounds.top,l.bounds.width,d);break;case 3:o.ctx.fillRect(l.bounds.left,l.bounds.top+(l.bounds.height/2-d/2),l.bounds.width,d);break}})}break;case 1:r.webkitTextStrokeWidth&&l.text.trim().length&&(o.ctx.strokeStyle=Mi(r.webkitTextStrokeColor),o.ctx.lineWidth=r.webkitTextStrokeWidth,o.ctx.lineJoin=window.chrome?"miter":"round",o.ctx.strokeText(l.text,l.bounds.left,l.bounds.top+l.bounds.height)),o.ctx.strokeStyle="",o.ctx.lineWidth=0,o.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(n,r,i){var s=i.naturalWidth||n.intrinsicWidth,o=i.naturalHeight||n.intrinsicHeight;if(i&&s>0&&o>0){var a=aS(n),l=oS(r);this.path(l),this.ctx.save(),this.ctx.clip();var c=0,u=0,d=s,f=o,h=a.left,A=a.top,p=a.width,m=a.height,g=n.styles.objectFit,y=p/m,w=d/f;if(g===2)w>y?(m=p/w,A+=(a.height-m)/2):(p=m*w,h+=(a.width-p)/2);else if(g===4)w>y?(d=f*y,c+=(s-d)/2):(f=d/y,u+=(o-f)/2);else if(g===8)d>p?(c+=(d-p)/2,d=p):(h+=(p-d)/2,p=d),f>m?(u+=(f-m)/2,f=m):(A+=(m-f)/2,m=f);else if(g===16){var v=w>y?p:m*w,x=d>p?d:p;v<x?w>y?(m=p/w,A+=(a.height-m)/2):(p=m*w,h+=(a.width-p)/2):(d>p?(c+=(d-p)/2,d=p):(h+=(p-d)/2,p=d),f>m?(u+=(f-m)/2,f=m):(A+=(m-f)/2,m=f))}this.ctx.drawImage(i,c,u,d,f,h,A,p,m),this.ctx.restore()}},e.prototype.renderNodeContent=function(n){return Os(this,void 0,void 0,function(){var r,i,s,o,a,l,y,y,c,u,d,f,v,h,A,x,p,m,g,y,w,v,x;return ps(this,function(C){switch(C.label){case 0:this.applyEffects(n.getEffects(4)),r=n.container,i=n.curves,s=r.styles,o=0,a=r.textNodes,C.label=1;case 1:return o<a.length?(l=a[o],[4,this.renderTextNode(l,s)]):[3,4];case 2:C.sent(),C.label=3;case 3:return o++,[3,1];case 4:if(!(r instanceof bte))return[3,8];C.label=5;case 5:return C.trys.push([5,7,,8]),[4,this.context.cache.match(r.src)];case 6:return y=C.sent(),this.renderReplacedElement(r,i,y),[3,8];case 7:return C.sent(),this.context.logger.error("Error loading image ".concat(r.src)),[3,8];case 8:if(r instanceof wte&&this.renderReplacedElement(r,i,r.canvas),!(r instanceof xte))return[3,12];C.label=9;case 9:return C.trys.push([9,11,,12]),[4,this.context.cache.match(r.svg)];case 10:return y=C.sent(),this.renderReplacedElement(r,i,y),[3,12];case 11:return C.sent(),this.context.logger.error("Error loading svg ".concat(r.svg.substring(0,255))),[3,12];case 12:return r instanceof Ete&&r.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:r.backgroundColor,x:0,y:0,width:r.width,height:r.height}),[4,c.render(r.tree)]):[3,14];case 13:u=C.sent(),r.width&&r.height&&this.ctx.drawImage(u,0,0,r.width,r.height,r.bounds.left,r.bounds.top,r.bounds.width,r.bounds.height),C.label=14;case 14:if(r instanceof sO&&(d=Math.min(r.bounds.width,r.bounds.height),r.type===tS?r.checked&&(this.ctx.save(),this.path([new vt(r.bounds.left+d*.39363,r.bounds.top+d*.79),new vt(r.bounds.left+d*.16,r.bounds.top+d*.5549),new vt(r.bounds.left+d*.27347,r.bounds.top+d*.44071),new vt(r.bounds.left+d*.39694,r.bounds.top+d*.5649),new vt(r.bounds.left+d*.72983,r.bounds.top+d*.23),new vt(r.bounds.left+d*.84,r.bounds.top+d*.34085),new vt(r.bounds.left+d*.39363,r.bounds.top+d*.79)]),this.ctx.fillStyle=Mi(TQ),this.ctx.fill(),this.ctx.restore()):r.type===nS&&r.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(r.bounds.left+d/2,r.bounds.top+d/2,d/4,0,Math.PI*2,!0),this.ctx.fillStyle=Mi(TQ),this.ctx.fill(),this.ctx.restore())),v8e(r)&&r.value.length){switch(f=this.createFontStyle(s),v=f[0],h=f[1],A=this.fontMetrics.getMetrics(v,h).baseline,this.ctx.font=v,this.ctx.fillStyle=Mi(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=w8e(r.styles.textAlign),x=aS(r),p=0,r.styles.textAlign){case 1:p+=x.width/2;break;case 2:p+=x.width;break}m=x.add(p,0,0,-x.height/2+1),this.ctx.save(),this.path([new vt(x.left,x.top),new vt(x.left+x.width,x.top),new vt(x.left+x.width,x.top+x.height),new vt(x.left,x.top+x.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new M1(r.value,m),s.letterSpacing,A),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!vi(r.styles.display,2048))return[3,20];if(r.styles.listStyleImage===null)return[3,19];if(g=r.styles.listStyleImage,g.type!==0)return[3,18];y=void 0,w=g.url,C.label=15;case 15:return C.trys.push([15,17,,18]),[4,this.context.cache.match(w)];case 16:return y=C.sent(),this.ctx.drawImage(y,r.bounds.left-(y.width+10),r.bounds.top),[3,18];case 17:return C.sent(),this.context.logger.error("Error loading list-style-image ".concat(w)),[3,18];case 18:return[3,20];case 19:n.listValue&&r.styles.listStyleType!==-1&&(v=this.createFontStyle(s)[0],this.ctx.font=v,this.ctx.fillStyle=Mi(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",x=new fu(r.bounds.left,r.bounds.top+qn(r.styles.paddingTop,r.bounds.width),r.bounds.width,uQ(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new M1(n.listValue,x),s.letterSpacing,uQ(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),C.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(n){return Os(this,void 0,void 0,function(){var r,i,g,s,o,g,a,l,g,c,u,g,d,f,g,h,A,g,p,m,g;return ps(this,function(y){switch(y.label){case 0:if(vi(n.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(n.element)];case 1:y.sent(),r=0,i=n.negativeZIndex,y.label=2;case 2:return r<i.length?(g=i[r],[4,this.renderStack(g)]):[3,5];case 3:y.sent(),y.label=4;case 4:return r++,[3,2];case 5:return[4,this.renderNodeContent(n.element)];case 6:y.sent(),s=0,o=n.nonInlineLevel,y.label=7;case 7:return s<o.length?(g=o[s],[4,this.renderNode(g)]):[3,10];case 8:y.sent(),y.label=9;case 9:return s++,[3,7];case 10:a=0,l=n.nonPositionedFloats,y.label=11;case 11:return a<l.length?(g=l[a],[4,this.renderStack(g)]):[3,14];case 12:y.sent(),y.label=13;case 13:return a++,[3,11];case 14:c=0,u=n.nonPositionedInlineLevel,y.label=15;case 15:return c<u.length?(g=u[c],[4,this.renderStack(g)]):[3,18];case 16:y.sent(),y.label=17;case 17:return c++,[3,15];case 18:d=0,f=n.inlineLevel,y.label=19;case 19:return d<f.length?(g=f[d],[4,this.renderNode(g)]):[3,22];case 20:y.sent(),y.label=21;case 21:return d++,[3,19];case 22:h=0,A=n.zeroOrAutoZIndexOrTransformedOrOpacity,y.label=23;case 23:return h<A.length?(g=A[h],[4,this.renderStack(g)]):[3,26];case 24:y.sent(),y.label=25;case 25:return h++,[3,23];case 26:p=0,m=n.positiveZIndex,y.label=27;case 27:return p<m.length?(g=m[p],[4,this.renderStack(g)]):[3,30];case 28:y.sent(),y.label=29;case 29:return p++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(n){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(n.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(n){this.ctx.beginPath(),this.formatPath(n),this.ctx.closePath()},e.prototype.formatPath=function(n){var r=this;n.forEach(function(i,s){var o=oa(i)?i.start:i;s===0?r.ctx.moveTo(o.x,o.y):r.ctx.lineTo(o.x,o.y),oa(i)&&r.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(n,r,i,s){this.path(n),this.ctx.fillStyle=r,this.ctx.translate(i,s),this.ctx.fill(),this.ctx.translate(-i,-s)},e.prototype.resizeImage=function(n,r,i){var s,o=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,a=o.createElement("canvas");a.width=Math.max(1,r),a.height=Math.max(1,i);var l=a.getContext("2d");return l.drawImage(n,0,0,n.width,n.height,0,0,r,i),a},e.prototype.renderBackgroundImage=function(n){return Os(this,void 0,void 0,function(){var r,i,s,o,a,l;return ps(this,function(c){switch(c.label){case 0:r=n.styles.backgroundImage.length-1,i=function(u){var d,f,h,A,p,k,Y,$,F,I,T,m,k,Y,$,F,I,g,y,w,v,x,C,_,S,E,T,R,k,B,M,F,I,z,Y,$,ee,W,ne,Se,fe,ge,Oe,Fe;return ps(this,function(De){switch(De.label){case 0:if(u.type!==0)return[3,5];d=void 0,f=u.url,De.label=1;case 1:return De.trys.push([1,3,,4]),[4,s.context.cache.match(f)];case 2:return d=De.sent(),[3,4];case 3:return De.sent(),s.context.logger.error("Error loading background-image ".concat(f)),[3,4];case 4:return d&&(h=isNaN(d.width)||d.width===0?1:d.width,A=isNaN(d.height)||d.height===0?1:d.height,p=GB(n,r,[h,A,h/A]),k=p[0],Y=p[1],$=p[2],F=p[3],I=p[4],T=s.ctx.createPattern(s.resizeImage(d,F,I),"repeat"),s.renderRepeat(k,T,Y,$)),[3,6];case 5:tFe(u)?(m=GB(n,r,[null,null,null]),k=m[0],Y=m[1],$=m[2],F=m[3],I=m[4],g=XOe(u.angle,F,I),y=g[0],w=g[1],v=g[2],x=g[3],C=g[4],_=document.createElement("canvas"),_.width=F,_.height=I,S=_.getContext("2d"),E=S.createLinearGradient(w,x,v,C),lQ(u.stops,y).forEach(function(ke){return E.addColorStop(ke.stop,Mi(ke.color))}),S.fillStyle=E,S.fillRect(0,0,F,I),F>0&&I>0&&(T=s.ctx.createPattern(_,"repeat"),s.renderRepeat(k,T,Y,$))):nFe(u)&&(R=GB(n,r,[null,null,null]),k=R[0],B=R[1],M=R[2],F=R[3],I=R[4],z=u.position.length===0?[Z6]:u.position,Y=qn(z[0],F),$=qn(z[z.length-1],I),ee=YOe(u,Y,$,F,I),W=ee[0],ne=ee[1],W>0&&ne>0&&(Se=s.ctx.createRadialGradient(B+Y,M+$,0,B+Y,M+$,W),lQ(u.stops,W*2).forEach(function(ke){return Se.addColorStop(ke.stop,Mi(ke.color))}),s.path(k),s.ctx.fillStyle=Se,W!==ne?(fe=n.bounds.left+.5*n.bounds.width,ge=n.bounds.top+.5*n.bounds.height,Oe=ne/W,Fe=1/Oe,s.ctx.save(),s.ctx.translate(fe,ge),s.ctx.transform(1,0,0,Oe,0,0),s.ctx.translate(-fe,-ge),s.ctx.fillRect(B,Fe*(M-ge)+ge,F,I*Fe),s.ctx.restore()):s.ctx.fill())),De.label=6;case 6:return r--,[2]}})},s=this,o=0,a=n.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return o<a.length?(l=a[o],[5,i(l)]):[3,4];case 2:c.sent(),c.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(n,r,i){return Os(this,void 0,void 0,function(){return ps(this,function(s){return this.path(UQ(i,r)),this.ctx.fillStyle=Mi(n),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(n,r,i,s){return Os(this,void 0,void 0,function(){var o,a;return ps(this,function(l){switch(l.label){case 0:return r<3?[4,this.renderSolidBorder(n,i,s)]:[3,2];case 1:return l.sent(),[2];case 2:return o=l8e(s,i),this.path(o),this.ctx.fillStyle=Mi(n),this.ctx.fill(),a=c8e(s,i),this.path(a),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(n){return Os(this,void 0,void 0,function(){var r,i,s,o,a,l,c,u,d=this;return ps(this,function(f){switch(f.label){case 0:return this.applyEffects(n.getEffects(2)),r=n.container.styles,i=!$d(r.backgroundColor)||r.backgroundImage.length,s=[{style:r.borderTopStyle,color:r.borderTopColor,width:r.borderTopWidth},{style:r.borderRightStyle,color:r.borderRightColor,width:r.borderRightWidth},{style:r.borderBottomStyle,color:r.borderBottomColor,width:r.borderBottomWidth},{style:r.borderLeftStyle,color:r.borderLeftColor,width:r.borderLeftWidth}],o=b8e(lp(r.backgroundClip,0),n.curves),i||r.boxShadow.length?(this.ctx.save(),this.path(o),this.ctx.clip(),$d(r.backgroundColor)||(this.ctx.fillStyle=Mi(r.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(n.container)]):[3,2];case 1:f.sent(),this.ctx.restore(),r.boxShadow.slice(0).reverse().forEach(function(h){d.ctx.save();var A=sS(n.curves),p=h.inset?0:g8e,m=o8e(A,-p+(h.inset?1:-1)*h.spread.number,(h.inset?1:-1)*h.spread.number,h.spread.number*(h.inset?-2:2),h.spread.number*(h.inset?-2:2));h.inset?(d.path(A),d.ctx.clip(),d.mask(m)):(d.mask(A),d.ctx.clip(),d.path(m)),d.ctx.shadowOffsetX=h.offsetX.number+p,d.ctx.shadowOffsetY=h.offsetY.number,d.ctx.shadowColor=Mi(h.color),d.ctx.shadowBlur=h.blur.number,d.ctx.fillStyle=h.inset?Mi(h.color):"rgba(0,0,0,1)",d.ctx.fill(),d.ctx.restore()}),f.label=2;case 2:a=0,l=0,c=s,f.label=3;case 3:return l<c.length?(u=c[l],u.style!==0&&!$d(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,a,n.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,a,n.curves,3)];case 6:return f.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,a,n.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,a,n.curves)];case 10:f.sent(),f.label=11;case 11:a++,f.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(n,r,i,s,o){return Os(this,void 0,void 0,function(){var a,l,c,u,d,f,h,A,p,m,g,y,w,v,x,C,x,C;return ps(this,function(_){return this.ctx.save(),a=u8e(s,i),l=UQ(s,i),o===2&&(this.path(l),this.ctx.clip()),oa(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),oa(l[1])?(d=l[1].end.x,f=l[1].end.y):(d=l[1].x,f=l[1].y),i===0||i===2?h=Math.abs(c-d):h=Math.abs(u-f),this.ctx.beginPath(),o===3?this.formatPath(a):this.formatPath(l.slice(0,2)),A=r<3?r*3:r*2,p=r<3?r*2:r,o===3&&(A=r,p=r),m=!0,h<=A*2?m=!1:h<=A*2+p?(g=h/(2*A+p),A*=g,p*=g):(y=Math.floor((h+p)/(A+p)),w=(h-y*A)/(y-1),v=(h-(y+1)*A)/y,p=v<=0||Math.abs(p-w)<Math.abs(p-v)?w:v),m&&(o===3?this.ctx.setLineDash([0,A+p]):this.ctx.setLineDash([A,p])),o===3?(this.ctx.lineCap="round",this.ctx.lineWidth=r):this.ctx.lineWidth=r*2+1.1,this.ctx.strokeStyle=Mi(n),this.ctx.stroke(),this.ctx.setLineDash([]),o===2&&(oa(l[0])&&(x=l[3],C=l[0],this.ctx.beginPath(),this.formatPath([new vt(x.end.x,x.end.y),new vt(C.start.x,C.start.y)]),this.ctx.stroke()),oa(l[1])&&(x=l[1],C=l[2],this.ctx.beginPath(),this.formatPath([new vt(x.end.x,x.end.y),new vt(C.start.x,C.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(n){return Os(this,void 0,void 0,function(){var r;return ps(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Mi(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),r=a8e(n),[4,this.renderStack(r)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(Qte),v8e=function(t){return t instanceof Ste||t instanceof _te?!0:t instanceof sO&&t.type!==nS&&t.type!==tS},b8e=function(t,e){switch(t){case 0:return sS(e);case 2:return t8e(e);case 1:default:return oS(e)}},w8e=function(t){switch(t){case 1:return"center";case 2:return"right";case 0:default:return"left"}},x8e=["-apple-system","system-ui"],C8e=function(t){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?t.filter(function(e){return x8e.indexOf(e)===-1}):t},_8e=function(t){al(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.canvas=r.canvas?r.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=r,i.canvas.width=Math.floor(r.width*r.scale),i.canvas.height=Math.floor(r.height*r.scale),i.canvas.style.width="".concat(r.width,"px"),i.canvas.style.height="".concat(r.height,"px"),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-r.x,-r.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (".concat(r.width,"x").concat(r.height," at ").concat(r.x,",").concat(r.y,") with scale ").concat(r.scale)),i}return e.prototype.render=function(n){return Os(this,void 0,void 0,function(){var r,i;return ps(this,function(s){switch(s.label){case 0:return r=OR(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,n),[4,S8e(r)];case 1:return i=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Mi(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(Qte),S8e=function(t){return new Promise(function(e,n){var r=new Image;r.onload=function(){e(r)},r.onerror=n,r.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(t)))})},E8e=function(){function t(e){var n=e.id,r=e.enabled;this.id=n,this.enabled=r,this.start=Date.now()}return t.prototype.debug=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,bw([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},t.prototype.getTime=function(){return Date.now()-this.start},t.prototype.info=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,bw([this.id,"".concat(this.getTime(),"ms")],e,!1))},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,bw([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,bw([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},t.instances={},t}(),T8e=function(){function t(e,n){var r;this.windowBounds=n,this.instanceName="#".concat(t.instanceCount++),this.logger=new E8e({id:this.instanceName,enabled:e.logging}),this.cache=(r=e.cache)!==null&&r!==void 0?r:new KDe(this,e)}return t.instanceCount=1,t}(),B8e=function(t,e){return e===void 0&&(e={}),M8e(t,e)};typeof window<"u"&&Fte.setContext(window);var M8e=function(t,e){return Os(void 0,void 0,void 0,function(){var n,r,i,s,o,a,l,c,u,d,f,h,A,p,m,g,y,w,v,x,_,C,_,S,E,T,R,k,B,M,F,I,z,Y,$,ee,W,ne,Se,fe;return ps(this,function(ge){switch(ge.label){case 0:if(!t||typeof t!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(n=t.ownerDocument,!n)throw new Error("Element is not attached to a Document");if(r=n.defaultView,!r)throw new Error("Document is not attached to a Window");return i={allowTaint:(S=e.allowTaint)!==null&&S!==void 0?S:!1,imageTimeout:(E=e.imageTimeout)!==null&&E!==void 0?E:15e3,proxy:e.proxy,useCORS:(T=e.useCORS)!==null&&T!==void 0?T:!1},s=yR({logging:(R=e.logging)!==null&&R!==void 0?R:!0,cache:e.cache},i),o={windowWidth:(k=e.windowWidth)!==null&&k!==void 0?k:r.innerWidth,windowHeight:(B=e.windowHeight)!==null&&B!==void 0?B:r.innerHeight,scrollX:(M=e.scrollX)!==null&&M!==void 0?M:r.pageXOffset,scrollY:(F=e.scrollY)!==null&&F!==void 0?F:r.pageYOffset},a=new fu(o.scrollX,o.scrollY,o.windowWidth,o.windowHeight),l=new T8e(s,a),c=(I=e.foreignObjectRendering)!==null&&I!==void 0?I:!1,u={allowTaint:(z=e.allowTaint)!==null&&z!==void 0?z:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size ".concat(a.width,"x").concat(a.height," scrolled to ").concat(-a.left,",").concat(-a.top)),d=new FQ(l,t,u),f=d.clonedReferenceElement,f?[4,d.toIFrame(n,a)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return h=ge.sent(),A=oO(f)||MDe(f)?dIe(f.ownerDocument):j2(l,f),p=A.width,m=A.height,g=A.left,y=A.top,w=k8e(l,f,e.backgroundColor),v={canvas:e.canvas,backgroundColor:w,scale:($=(Y=e.scale)!==null&&Y!==void 0?Y:r.devicePixelRatio)!==null&&$!==void 0?$:1,x:((ee=e.x)!==null&&ee!==void 0?ee:0)+g,y:((W=e.y)!==null&&W!==void 0?W:0)+y,width:(ne=e.width)!==null&&ne!==void 0?ne:Math.ceil(p),height:(Se=e.height)!==null&&Se!==void 0?Se:Math.ceil(m)},c?(l.logger.debug("Document cloned, using foreign object rendering"),_=new _8e(l,v),[4,_.render(f)]):[3,3];case 2:return x=ge.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at ".concat(g,",").concat(y," with size ").concat(p,"x").concat(m," using computed rendering")),l.logger.debug("Starting DOM parsing"),C=Bte(l,f),w===C.styles.backgroundColor&&(C.styles.backgroundColor=Gl.TRANSPARENT),l.logger.debug("Starting renderer for element at ".concat(v.x,",").concat(v.y," with size ").concat(v.width,"x").concat(v.height)),_=new y8e(l,v),[4,_.render(C)];case 4:x=ge.sent(),ge.label=5;case 5:return(!((fe=e.removeContainer)!==null&&fe!==void 0)||fe)&&(FQ.destroy(h)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,x]}})})},k8e=function(t,e,n){var r=e.ownerDocument,i=r.documentElement?lm(t,getComputedStyle(r.documentElement).backgroundColor):Gl.TRANSPARENT,s=r.body?lm(t,getComputedStyle(r.body).backgroundColor):Gl.TRANSPARENT,o=typeof n=="string"?lm(t,n):n===null?Gl.TRANSPARENT:4294967295;return e===r.documentElement?$d(i)?$d(s)?o:s:i:o};async function R8e(){return typeof window>"u"?Promise.reject(new Error("element isn't defined because there's no window, are you running in Node?")):B8e(document.documentElement).then(t=>t.toDataURL()).catch(t=>Promise.reject(t))}class aO{constructor(e,n,r){se(this,"engineCommandManager");se(this,"codeManager");se(this,"token");se(this,"baseUrl",cf);this.engineCommandManager=e,this.codeManager=n,this.token=r}authToken(){if(!this.token)throw new Error("Token not set");return this.token}baseApiUrl(){return this.baseUrl}version(){return Bh}kclCode(){return this.codeManager.code}pool(){return this.engineCommandManager.settings.pool||""}getOsInfo(){if(this.isDesktop()){const s={platform:window.electron.platform??null,arch:window.electron.arch??null,browser:"desktop",version:window.electron.version??null};return JSON.stringify(s)}const e=window.navigator.userAgent||"unknown browser";if(e==="unknown browser")return JSON.stringify({platform:e,arch:e,version:e,browser:e});const r=new uIe.UAParser(e).getResult(),i={platform:r.os.name||e,arch:r.cpu.architecture||e,version:r.os.version||e,browser:e};return JSON.stringify(i)}isDesktop(){return ft()}getWebrtcStats(){return this.engineCommandManager.engineConnection?this.engineCommandManager.engineConnection.webrtcStatsCollector?this.engineCommandManager.engineConnection.webrtcStatsCollector().catch(e=>{throw new Error(`Error getting webrtc stats: ${e}`)}).then(e=>{const n={packets_lost:e.rtc_packets_lost,frames_received:e.rtc_frames_received,frame_width:e.rtc_frame_width,frame_height:e.rtc_frame_height,frame_rate:e.rtc_frames_per_second,key_frames_decoded:e.rtc_keyframes_decoded,frames_dropped:e.rtc_frames_dropped,pause_count:e.rtc_pause_count,total_pauses_duration:e.rtc_total_pauses_duration_sec,freeze_count:e.rtc_freeze_count,total_freezes_duration:e.rtc_total_freezes_duration_sec,pli_count:e.rtc_pli_count,jitter:e.rtc_jitter_sec};return JSON.stringify(n)}):Promise.resolve(JSON.stringify({})):Promise.resolve(JSON.stringify({}))}getClientState(){var i,s,o,a,l,c,u,d,f,h,A,p,m,g;const e=y=>y.length&&y[0]==="_",n=()=>{};console.warn("CoreDump: Gathering client state");let r={engine_command_manager:{artifact_map:{},command_logs:[],engine_connection:{state:{type:""}},default_planes:{},scene_command_artifacts:{}},kcl_manager:{ast:{},kcl_errors:[]},scene_infra:{},scene_entities_manager:{},editor_manager:{},auth_machine:{},command_bar_machine:{},file_machine:{},home_machine:{},modeling_machine:{},settings_machine:{}};try{n("CoreDump: engineCommandManager",this.engineCommandManager),(i=this.engineCommandManager)!=null&&i.artifactGraph&&(n("CoreDump: Engine Command Manager artifact map",this.engineCommandManager.artifactGraph),r.engine_command_manager.artifact_map=structuredClone(this.engineCommandManager.artifactGraph)),(s=this.engineCommandManager)!=null&&s.commandLogs&&(n("CoreDump: Engine Command Manager command logs",this.engineCommandManager.commandLogs),r.engine_command_manager.command_logs=structuredClone(this.engineCommandManager.commandLogs)),(o=this.engineCommandManager)!=null&&o.defaultPlanes&&(n("CoreDump: Engine Command Manager default planes",this.engineCommandManager.defaultPlanes),r.engine_command_manager.default_planes=structuredClone(this.engineCommandManager.defaultPlanes)),(l=(a=this.engineCommandManager)==null?void 0:a.engineConnection)!=null&&l.state&&(n("CoreDump: Engine Command Manager engine connection state",this.engineCommandManager.engineConnection.state),r.engine_command_manager.engine_connection.state=this.engineCommandManager.engineConnection.state),(c=this.engineCommandManager)!=null&&c.inSequence&&(n("CoreDump: Engine Command Manager in sequence",this.engineCommandManager.inSequence),r.engine_command_manager.in_sequence=this.engineCommandManager.inSequence),(u=this.engineCommandManager)!=null&&u.outSequence&&(n("CoreDump: Engine Command Manager out sequence",this.engineCommandManager.outSequence),r.engine_command_manager.out_sequence=this.engineCommandManager.outSequence);const y=(d=globalThis==null?void 0:globalThis.window)==null?void 0:d.kclManager;n("CoreDump: kclManager",y),y&&(n("CoreDump: KCL Manager AST",y==null?void 0:y.ast),y!=null&&y.ast&&(r.kcl_manager.ast=structuredClone(y.ast)),n("CoreDump: KCL Errors",y==null?void 0:y.kclErrors),y!=null&&y.kclErrors&&(r.kcl_manager.kcl_errors=structuredClone(y.kclErrors)),n("CoreDump: KCL isExecuting",y==null?void 0:y.isExecuting),y!=null&&y.isExecuting&&(r.kcl_manager.isExecuting=y.isExecuting),n("CoreDump: KCL logs",y==null?void 0:y.logs),y!=null&&y.logs&&(r.kcl_manager.logs=structuredClone(y.logs)),n("CoreDump: KCL programMemory",y==null?void 0:y.programMemory),y!=null&&y.programMemory&&(r.kcl_manager.programMemory=structuredClone(y.programMemory)),n("CoreDump: KCL wasmInitFailed",y==null?void 0:y.wasmInitFailed),y!=null&&y.wasmInitFailed&&(r.kcl_manager.wasmInitFailed=y.wasmInitFailed));const w=(f=globalThis==null?void 0:globalThis.window)==null?void 0:f.sceneInfra;if(n("CoreDump: Scene Infra",w),w){const _=["camControls"],S=Object.keys(w).sort().filter(E=>typeof w[E]!="function"&&!_.includes(E));n("CoreDump: Scene Infra keys",S),S.forEach(E=>{n("CoreDump: Scene Infra",E,w[E]);try{r.scene_infra[E]=w[E]}catch(T){console.error("CoreDump: unable to parse Scene Infra "+E+" data due to ",T)}})}const v=(h=globalThis==null?void 0:globalThis.window)==null?void 0:h.sceneEntitiesManager;n("CoreDump: sceneEntitiesManager",v),v&&(n("CoreDump: Scene Entities Manager active segments",v==null?void 0:v.activeSegments),v!=null&&v.activeSegments&&(r.scene_entities_manager.activeSegments=structuredClone(v.activeSegments)));const x=(A=globalThis==null?void 0:globalThis.window)==null?void 0:A.editorManager;if(n("CoreDump: editorManager",x),x){const _=["camControls"],S=Object.keys(x).sort().filter(E=>typeof x[E]!="function"&&!e(E)&&!_.includes(E));n("CoreDump: Editor Manager keys",S),S.forEach(E=>{n("CoreDump: Editor Manager",E,x[E]);try{r.editor_manager[E]=structuredClone(x[E])}catch(T){console.error("CoreDump: unable to parse Editor Manager "+E+" data due to ",T)}})}n("CoreDump: enableMousePositionLogs [not coredumped]",(p=globalThis==null?void 0:globalThis.window)==null?void 0:p.enableMousePositionLogs),n("CoreDump: xstate services",(g=(m=globalThis==null?void 0:globalThis.window)==null?void 0:m.__xstate__)==null?void 0:g.services),n("CoreDump: final clientState",r);const C=JSON.stringify(r);return n("CoreDump: final clientState JSON",C),Promise.resolve(C)}catch(y){return console.error("CoreDump: unable to return data due to ",y),Promise.reject(JSON.stringify(y))}}screenshot(){return R8e().then(e=>e).catch(e=>"")}}const P8e=({children:t})=>{var s;const{auth:e}=In(),n=(s=e==null?void 0:e.context)==null?void 0:s.token,r=P.useMemo(()=>new aO(je,Kt,n),[]);async function i(){if(window&&"plausible"in window){const o=window.plausible;await o("Refresh",{props:{method:"UI button"}})}jt.promise(rI(r,!0),{loading:"Starting core dump...",success:"Core dump completed successfully",error:"Error while exporting core dump"},{success:{duration:6e3}}).then(()=>{window==null||window.location.reload()}).catch(Bt)}return b.jsxs("button",{onClick:Li(i,Bt),className:"p-1 m-0 bg-chalkboard-10/80 dark:bg-chalkboard-100/50 hover:bg-chalkboard-10 dark:hover:bg-chalkboard-100 rounded-full border border-solid border-chalkboard-20 dark:border-chalkboard-90",children:[b.jsx(nn,{name:"exclamationMark",className:"w-5 h-5"}),b.jsxs(Fr,{position:"bottom-right",children:[b.jsx("span",{children:"Refresh and report"}),b.jsx("br",{}),b.jsx("span",{className:"text-xs",children:"Send us data on how you got stuck"})]})]})};function Vy(t,e,n){const i={...{preventDefault:!0},...n};Tr(t,e,i),P.useEffect(()=>{for(const s of t){const o=L8e(s);Kt.registerHotkey(o,e)}})}function L8e(t){return t.replaceAll("+","-").replaceAll(" ","").replaceAll("mod","Mod").replaceAll("meta","Meta").replaceAll("ctrl","Ctrl").replaceAll("shift","Shift").replaceAll("alt","Alt")}const I8e=/[a-z]/,O8e=/\s+/g;function zte(t,e){const n=e==="macos",i=e==="windows"?"Win":"Super",s=n?"":"+";return t.split("+").map(a=>a.length===1&&I8e.test(a)?a.toUpperCase():a).join(s).replaceAll(O8e," ").replaceAll("mod",n?"⌘":"Ctrl").replaceAll("meta",n?"⌘":i).replaceAll("ctrl",n?"^":"Ctrl").replaceAll("shift",n?"⬆":"Shift").replaceAll("alt",n?"⌥":"Alt")}const F8e=t=>t==null?void 0:t.context;function jQ({arg:t,argName:e,stepBack:n,onSubmit:r,placeholder:i}){const s=FI(t.machineActor,F8e),{commandBarSend:o,commandBarState:a}=ni(),l=P.useMemo(()=>typeof t.options=="function"?t.options(a.context,s):t.options,[e,t,a.context,s]),c=P.useMemo(()=>l.find(S=>S.value===a.context.argumentsToSubmit[e])||l.find(S=>S.isCurrent),[a.context.argumentsToSubmit,e,l]),u=P.useRef(null),d=P.useRef(null),[f,h]=P.useState(!1),[A,p]=P.useState(c||l[0]),m=P.useMemo(()=>"",[t.options,e]),[g,y]=P.useState(m),[w,v]=P.useState(),x=P.useMemo(()=>new wu(l,{keys:["name","description"],threshold:.3}),[e,l]);P.useEffect(()=>{y(m),p(c||l[0])},[e]),P.useEffect(()=>{var S,E;(S=u.current)==null||S.focus(),(E=u.current)==null||E.select()},[u]),P.useEffect(()=>{var E;const S=new KeyboardEvent("keydown",{key:"ArrowDown",keyCode:40,which:40,bubbles:!0});(E=u==null?void 0:u.current)==null||E.dispatchEvent(S)},[]),P.useEffect(()=>{const S=x.search(g).map(E=>E.item);v(g.length>0?S:l)},[g,l,x]);function C(S){p(S),f&&r(S.value)}function _(S){S.preventDefault(),r(A.value)}return b.jsx("form",{id:"arg-form",onSubmit:_,ref:d,onKeyDownCapture:S=>{S.key==="Enter"?h(!0):h(!1)},children:b.jsxs(fa,{value:A,onChange:C,name:"options",children:[b.jsxs("div",{className:"flex items-center mx-4 mt-4 mb-2",children:[b.jsx("label",{htmlFor:"option-input",className:"capitalize px-2 py-1 rounded-l bg-chalkboard-100 dark:bg-chalkboard-80 text-chalkboard-10 border-b border-b-chalkboard-100 dark:border-b-chalkboard-80",children:e}),b.jsx(fa.Input,{id:"option-input",ref:u,onChange:S=>!S.target.disabled&&y(S.target.value),className:"flex-grow px-2 py-1 border-b border-b-chalkboard-100 dark:border-b-chalkboard-80 !bg-transparent focus:outline-none",onKeyDown:S=>{S.metaKey&&S.key==="k"&&o({type:"Close"}),S.key==="Backspace"&&!S.currentTarget.value&&n(),S.key==="Enter"?h(!0):h(!1)},value:g,placeholder:(c==null?void 0:c.name)||i||e||"Select an option",autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoFocus:!0})]}),b.jsx(fa.Options,{static:!0,className:"overflow-y-auto max-h-96 cursor-pointer",onMouseDown:()=>{h(!0)},children:w==null?void 0:w.map(S=>b.jsxs(fa.Option,{value:S,disabled:S.disabled,className:"flex items-center gap-2 px-4 py-1 first:mt-2 last:mb-2 ui-active:bg-primary/10 dark:ui-active:bg-chalkboard-90",children:[b.jsx("p",{className:`flex-grow ${S.disabled&&"text-chalkboard-70 dark:text-chalkboard-50 cursor-not-allowed"||""}`,children:S.name}),S.value===(c==null?void 0:c.value)&&b.jsx("small",{className:"text-chalkboard-70 dark:text-chalkboard-50",children:"current"})]},S.name))})]})})}function N8e({arg:t,stepBack:e,onSubmit:n}){const{commandBarSend:r,commandBarState:i}=ni();Tr("mod + k, mod + /",()=>r({type:"Close"}));const s=P.useRef(null);P.useEffect(()=>{s.current&&(s.current.focus(),s.current.select())},[t,s]);function o(a){var l;a.preventDefault(),n((l=s.current)==null?void 0:l.value)}return b.jsx("form",{id:"arg-form",onSubmit:o,children:b.jsxs("label",{"data-testid":"cmd-bar-arg-name",className:"flex items-center mx-4 my-4",children:[b.jsx("span",{className:"capitalize px-2 py-1 rounded-l bg-chalkboard-100 dark:bg-chalkboard-80 text-chalkboard-10 border-b border-b-chalkboard-100 dark:border-b-chalkboard-80",children:t.name}),b.jsx("input",{"data-testid":"cmd-bar-arg-value",id:"arg-form",name:t.inputType,ref:s,type:t.inputType,required:!0,className:"flex-grow px-2 py-1 border-b border-b-chalkboard-100 dark:border-b-chalkboard-80 !bg-transparent focus:outline-none",placeholder:"Enter a value",defaultValue:i.context.argumentsToSubmit[t.name]||t.defaultValue,onKeyDown:a=>{a.key==="Backspace"&&!a.currentTarget.value&&e()},autoFocus:!0})]})})}const D8e={face:["extrude-wall","start-cap","end-cap"],edge:["edge","line","arc"],point:["point","line-end","line-mid"]};function U8e(t){const e=new Set;return t.forEach(n=>{Object.entries(D8e).forEach(([r,i])=>{i.includes(n)&&e.add(r)})}),Array.from(e)}const H8e=t=>t==null?void 0:t.context.selectionRanges;function j8e({arg:t,stepBack:e,onSubmit:n}){const{code:r}=uc(),i=P.useRef(null),{commandBarState:s,commandBarSend:o}=ni(),[a,l]=P.useState(!1),c=FI(t.machineActor,H8e),u=P.useMemo(()=>{var p;const A=(p=c==null?void 0:c.codeBasedSelections[0])==null?void 0:p.range[1];return!A||A===r.length?"none":vX(c)},[c,r]),d=P.useMemo(()=>Rxe(u,t),[u]);P.useEffect(()=>{var A;(A=i.current)==null||A.focus()},[c,i]),P.useEffect(()=>{const A=s.context.argumentsToSubmit[t.name];d&&t.skip&&A===void 0&&h()},[d]);function f(){var A;(A=i.current)==null||A.focus()}function h(A){if(A==null||A.preventDefault(),!d){l(!0);return}n(c)}return b.jsx("form",{id:"arg-form",onSubmit:h,children:b.jsxs("label",{className:"relative flex flex-col mx-4 my-4 "+(!a||d||"text-destroy-50"),children:[d?bX(c)+" selected":`Please select ${t.multiple?"one or more ":"one "}${U8e(t.selectionTypes).join(" or ")}`,t.warningMessage&&b.jsx("p",{className:"text-warn-80 bg-warn-10 px-2 py-1 rounded-sm mt-3 mr-2 -mb-2 w-full text-sm cursor-default",children:t.warningMessage}),b.jsx("input",{id:"selection",name:"selection",ref:i,required:!0,placeholder:"Select an entity with your mouse",className:"absolute inset-0 w-full h-full opacity-0 cursor-default",onKeyDown:A=>{A.key==="Backspace"?e():A.key==="Escape"&&o({type:"Close"})},onChange:f,value:JSON.stringify(c||{})})]})})}function Vte({children:t}){const{commandBarState:e,commandBarSend:n}=ni(),{context:{selectedCommand:r,currentArgument:i,argumentsToSubmit:s}}=e,o=e.matches("Review"),[a,l]=P.useState(!1);return Tr("alt",()=>l(!0),{enableOnFormTags:!0,enableOnContentEditable:!0},[a]),Tr("alt",()=>l(!1),{keyup:!0,enableOnFormTags:!0,enableOnContentEditable:!0},[a]),Tr(["alt+1","alt+2","alt+3","alt+4","alt+5","alt+6","alt+7","alt+8","alt+9","alt+0"],(c,u)=>{if(u.keys&&!Number.isNaN(parseInt(u.keys[0],10))){if(!(r!=null&&r.args))return;const d=Object.keys(r.args)[parseInt(u.keys[0],10)-1],f=r==null?void 0:r.args[d];if(!d||!f)return;n({type:"Change current argument",data:{arg:{...f,name:d}}})}},{keyup:!0,enableOnFormTags:!0,enableOnContentEditable:!0},[s,r]),r&&s&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"group px-4 text-sm flex gap-4 items-start",children:[b.jsxs("div",{className:"flex flex-1 flex-wrap gap-2",children:[b.jsxs("p",{"data-command-name":r==null?void 0:r.name,className:"pr-4 flex gap-2 items-center",children:[r&&"icon"in r&&r.icon&&b.jsx(nn,{name:r.icon,className:"w-5 h-5"}),b.jsx("span",{"data-testid":"command-name",children:r.displayName||r.name})]}),Object.entries((r==null?void 0:r.args)||{}).filter(([c,u])=>typeof u.required=="function"?u.required(e.context):u.required).map(([c,u],d)=>{const f=(typeof s[c]=="function"?s[c](e.context):s[c])||"";return b.jsxs("button",{"data-testid":"cmd-bar-input-tab","data-is-current-arg":c===(i==null?void 0:i.name)?"true":"false",disabled:!o&&(i==null?void 0:i.name)===c,onClick:()=>{n({type:o?"Edit argument":"Change current argument",data:{arg:{...u,name:c}}})},className:`relative w-fit px-2 py-1 rounded-sm flex gap-2 items-center border ${c===(i==null?void 0:i.name)?"disabled:bg-primary/10 dark:disabled:bg-primary/20 disabled:border-primary dark:disabled:border-primary disabled:text-chalkboard-100 dark:disabled:text-chalkboard-10":"bg-chalkboard-20/50 dark:bg-chalkboard-80/50 border-chalkboard-20 dark:border-chalkboard-80"}`,children:[b.jsx("span",{"data-testid":`arg-name-${c.toLowerCase()}`,"data-test-name":"arg-name",className:"capitalize",children:c}),b.jsx("span",{className:"sr-only",children:": "}),b.jsx("span",{"data-testid":"header-arg-value",children:f?u.inputType==="selection"?bX(f):u.inputType==="kcl"?ot(Number(f.valueCalculated),4):typeof f=="object"?u.valueSummary?u.valueSummary(f):JSON.stringify(f):b.jsx("em",{children:u.valueSummary?u.valueSummary(f):f}):null}),a&&b.jsxs("small",{className:"absolute -top-[1px] right-full translate-x-1/2 px-0.5 rounded-sm bg-chalkboard-80 text-chalkboard-10 dark:bg-primary dark:text-chalkboard-100",children:[b.jsx("span",{className:"sr-only",children:"Hotkey: "}),d+1]}),u.inputType==="kcl"&&!!f&&"variableName"in f&&b.jsxs(b.Fragment,{children:[b.jsx(nn,{name:"make-variable",className:"w-4 h-4"}),b.jsxs(Fr,{position:"bottom",children:["New variable:"," ",s[c].variableName]})]})]},c)})]}),o?b.jsx(Q8e,{}):b.jsx(z8e,{})]}),b.jsx("div",{className:"block w-full my-2 h-[1px] bg-chalkboard-20 dark:bg-chalkboard-80"}),t]})}function Q8e(){return b.jsx($t,{Element:"button",autoFocus:!0,type:"submit",form:"review-form",className:"w-fit !p-0 rounded-sm border !border-primary hover:shadow",iconStart:{icon:"checkmark",bgClassName:"p-1 rounded-sm !bg-primary hover:brightness-110",iconClassName:"!text-chalkboard-10"},children:b.jsx("span",{className:"sr-only",children:"Submit command"})})}function z8e(){return b.jsx($t,{Element:"button",type:"submit",form:"arg-form",className:"w-fit !p-0 rounded-sm border !border-primary hover:shadow",iconStart:{icon:"arrowRight",bgClassName:"p-1 rounded-sm !bg-primary hover:brightness-110",iconClassName:"!text-chalkboard-10"},children:b.jsx("span",{className:"sr-only",children:"Continue"})})}function Gte(t=[]){return z$({override:[e=>{let n=e.matchBefore(/(\w+)?/);return!n||n&&n.from===n.to&&!e.explicit?null:{from:n==null?void 0:n.from,options:[...t]}}]})}Gte();const V8e="_editor_1ovkq_1",G8e={editor:V8e},W8e="#e5c07b",QQ="#e06c75",K8e="#56b6c2",$8e="#ffffff",tC="#abb2bf",QR="#7d8799",q8e="#61afef",X8e="#98c379",zQ="#d19a66",Y8e="#c678dd",J8e="#21252b",VQ="#2c313a",GQ="#282c34",WB="#353a42",Z8e="#3E4451",WQ="#528bff",eUe=At.theme({"&":{color:tC,backgroundColor:GQ},".cm-content":{caretColor:WQ},".cm-cursor, .cm-dropCursor":{borderLeftColor:WQ},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Z8e},".cm-panels":{backgroundColor:J8e,color:tC},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:GQ,color:QR,border:"none"},".cm-activeLineGutter":{backgroundColor:VQ},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:WB},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:WB,borderBottomColor:WB},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:VQ,color:tC}}},{dark:!0}),tUe=cv.define([{tag:Ie.keyword,color:Y8e},{tag:[Ie.name,Ie.deleted,Ie.character,Ie.propertyName,Ie.macroName],color:QQ},{tag:[Ie.function(Ie.variableName),Ie.labelName],color:q8e},{tag:[Ie.color,Ie.constant(Ie.name),Ie.standard(Ie.name)],color:zQ},{tag:[Ie.definition(Ie.name),Ie.separator],color:tC},{tag:[Ie.typeName,Ie.className,Ie.number,Ie.changed,Ie.annotation,Ie.modifier,Ie.self,Ie.namespace],color:W8e},{tag:[Ie.operator,Ie.operatorKeyword,Ie.url,Ie.escape,Ie.regexp,Ie.link,Ie.special(Ie.string)],color:K8e},{tag:[Ie.meta,Ie.comment],color:QR},{tag:Ie.strong,fontWeight:"bold"},{tag:Ie.emphasis,fontStyle:"italic"},{tag:Ie.strikethrough,textDecoration:"line-through"},{tag:Ie.link,color:QR,textDecoration:"underline"},{tag:Ie.heading,fontWeight:"bold",color:QQ},{tag:[Ie.atom,Ie.bool,Ie.special(Ie.variableName)],color:zQ},{tag:[Ie.processingInstruction,Ie.string,Ie.inserted],color:X8e},{tag:Ie.invalid,color:$8e}]),nUe=[eUe,x$(tUe)],rUe=()=>{const t=P.useRef(!0);return P.useEffect(()=>{t.current=!1},[]),t.current},iUe=At.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),sUe=P.forwardRef((t,e)=>{const{onCreateEditor:n,extensions:r=[],initialDocValue:i,theme:s,autoFocus:o=!1,selection:a}=t,l=P.useRef(null),{view:c,state:u,container:d}=Wte({container:l.current,onCreateEditor:n,extensions:r,initialDocValue:i,theme:s,autoFocus:o,selection:a});return P.useImperativeHandle(e,()=>({editor:l.current,view:c,state:u}),[l,d,c,u]),b.jsx("div",{ref:l})});function Wte(t){const{onCreateEditor:e,extensions:n=[],initialDocValue:r,theme:i,autoFocus:s=!1,selection:o}=t,[a,l]=P.useState(),[c,u]=P.useState(),[d,f]=P.useState(),h=rUe(),A=P.useMemo(()=>{let p=Array.isArray(n)?n:[];return i==="dark"?p=[...p,nUe]:i==="light"&&(p=[...p,iUe]),p},[n,i]);return P.useEffect(()=>{if(a&&!d){const p={doc:r,selection:o,extensions:[...Array.of(n)]},m=Tn.create(p);if(f(m),!c){const g=new At({state:m,parent:a});u(g),e&&e(g)}}return()=>{c&&(f(void 0),u(void 0))}},[a,d]),P.useEffect(()=>l(t.container),[t.container]),P.useEffect(()=>()=>{c&&(c.destroy(),u(void 0))},[c]),P.useEffect(()=>{s&&c&&c.focus()},[s,c]),P.useEffect(()=>{c&&!h&&c.dispatch({effects:Qt.reconfigure.of(A)})},[A,c,h]),{view:c,setView:u,container:a,setContainer:l,state:d,setState:f}}function oUe({arg:t,stepBack:e,onSubmit:n}){const{commandBarSend:r,commandBarState:i}=ni(),s=i.context.argumentsToSubmit[t.name],{settings:o}=In(),a=t.defaultValue||"",[l,c]=P.useState((s==null?void 0:s.valueText)||a||""),[u,d]=P.useState(s&&"variableName"in s),[f,h]=P.useState(!0);Tr("mod + k, mod + /",()=>r({type:"Close"}));const A=P.useRef(null),{prevVariables:p,calcResult:m,newVariableInsertIndex:g,valueNode:y,newVariableName:w,setNewVariableName:v,isNewVariableNameUnique:x}=F2({value:l,initialVariableName:s&&"variableName"in s?s.variableName:t.name}),C=p.map(E=>({label:E.key,detail:String(ot(E.value))})),{setContainer:_}=Wte({container:A.current,initialDocValue:l,autoFocus:!0,selection:{anchor:0,head:s&&"valueText"in s?s.valueText.length:a.length},theme:o.context.app.theme.current==="system"?_f():o.context.app.theme.current,extensions:[At.domEventHandlers({keydown:E=>{E.key==="Backspace"&&l===""?(E.preventDefault(),e()):E.key==="Enter"&&(E.preventDefault(),S())}}),Gte(C),At.updateListener.of(E=>{E.docChanged&&c(E.state.doc.toString())})]});P.useEffect(()=>{A.current&&_(A.current)},[t,A]),P.useEffect(()=>{h(m!=="NAN"&&(!u||x))},[m,u,x]);function S(E){E==null||E.preventDefault(),!(!f||y===null)&&n(u?{valueAst:y,valueText:l,valueCalculated:m,variableName:w,insertIndex:g,variableIdentifierAst:zn(w),variableDeclarationAst:Ta(w,y)}:{valueAst:y,valueText:l,valueCalculated:m})}return b.jsxs("form",{id:"arg-form",onSubmit:S,"data-can-submit":f,children:[b.jsxs("label",{className:"flex gap-4 items-center mx-4 my-4 border-solid border-b border-chalkboard-50",children:[b.jsx("span",{"data-testid":"cmd-bar-arg-name",className:"capitalize text-chalkboard-80 dark:text-chalkboard-20",children:t.name}),b.jsx("div",{"data-testid":"cmd-bar-arg-value",ref:A,className:G8e.editor}),b.jsx(nn,{name:"equal",className:"w-5 h-5 text-chalkboard-70 dark:text-chalkboard-40"}),b.jsx("span",{className:m==="NAN"?"text-destroy-80 dark:text-destroy-40":"text-succeed-80 dark:text-succeed-40",children:m==="NAN"?"Can't calculate":ot(Number(m),4)})]}),u?b.jsxs("div",{className:"flex items-baseline gap-4 mx-4 border-solid border-0 border-b border-chalkboard-50",children:[b.jsx("label",{htmlFor:"variable-name",className:"text-base text-chalkboard-80 dark:text-chalkboard-20",children:"Variable name"}),b.jsx("input",{type:"text",id:"variable-name",name:"variable-name",className:"flex-1 border-none bg-transparent focus:outline-none",placeholder:"Variable name",value:w,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:"false",autoFocus:!0,onChange:E=>v(E.target.value),onKeyDown:E=>{E.currentTarget.value===""&&E.key==="Backspace"&&d(!1)},onKeyUp:E=>{E.key==="Enter"&&S()}}),b.jsx("span",{className:x?"text-succeed-60 dark:text-succeed-40":"text-destroy-60 dark:text-destroy-40",children:x?"Available":"Unavailable"})]}):b.jsx("div",{className:"flex justify-between gap-2 px-4",children:b.jsxs("button",{onClick:()=>d(!0),className:"text-blue border-none bg-transparent font-sm flex gap-1 items-center pl-0 pr-1",children:[b.jsx(nn,{name:"plus",className:"w-5 h-5"}),"Create new variable"]})})]})}function aUe({arg:t,stepBack:e,onSubmit:n}){const{commandBarSend:r,commandBarState:i}=ni();Tr("mod + k, mod + /",()=>r({type:"Close"}));const s=P.useRef(null),o=P.useRef(null);lUe(o),P.useEffect(()=>{o.current&&(o.current.focus(),o.current.select())},[t,o]);function a(l){var c;l.preventDefault(),n((c=o.current)==null?void 0:c.value)}return b.jsx("form",{id:"arg-form",onSubmit:a,ref:s,children:b.jsxs("label",{className:"flex items-start rounded mx-4 my-4 border border-chalkboard-100 dark:border-chalkboard-80",children:[b.jsx("span",{"data-testid":"cmd-bar-arg-name",className:"capitalize px-2 py-1 rounded-br bg-chalkboard-100 dark:bg-chalkboard-80 text-chalkboard-10 border-b border-b-chalkboard-100 dark:border-b-chalkboard-80",children:t.name}),b.jsx("textarea",{"data-testid":"cmd-bar-arg-value",id:"arg-form",name:t.inputType,ref:o,required:!0,className:"flex-grow mx-2 my-1 !bg-transparent focus:outline-none min-h-12",placeholder:"Enter a value",defaultValue:i.context.argumentsToSubmit[t.name]||t.defaultValue,onKeyDown:l=>{var c;if(l.key==="Backspace"&&!l.currentTarget.value)e();else if(l.key==="Enter"&&(l.metaKey||l.shiftKey)){l.preventDefault();const u=l.currentTarget,d=u.value,f=u.selectionStart,h=u.selectionEnd;u.value=d.substring(0,f)+`
`+d.substring(h),u.selectionStart=f+1,u.selectionEnd=f+1}else l.key==="Enter"&&((c=s.current)==null||c.dispatchEvent(new Event("submit",{bubbles:!0})))},autoFocus:!0})]})})}const lUe=t=>{P.useEffect(()=>{const e=()=>{t.current!==null&&(t.current.style.padding="0px",t.current.style.height=t.current.scrollHeight+"px",t.current.style.removeProperty("padding"))};if(t.current!==null)return t.current.addEventListener("input",e),()=>{t.current!==null&&t.current.removeEventListener("input",e)}},[t.current])};function cUe({stepBack:t}){const{commandBarState:e,commandBarSend:n}=ni(),{context:{currentArgument:r}}=e;function i(s){r&&n({type:"Submit argument",data:{[r.name]:s}})}return r&&b.jsx(Vte,{children:b.jsx(uUe,{arg:r,stepBack:t,onSubmit:i})})}function uUe({arg:t,stepBack:e,onSubmit:n}){switch(t.inputType){case"options":return b.jsx(jQ,{arg:t,argName:t.name,stepBack:e,onSubmit:n,placeholder:"Select an option"});case"boolean":return b.jsx(jQ,{arg:{...t,inputType:"options",options:[{name:"On",value:!0},{name:"Off",value:!1}]},argName:t.name,stepBack:e,onSubmit:n,placeholder:"Select an option"});case"selection":return b.jsx(j8e,{arg:t,stepBack:e,onSubmit:n});case"kcl":return b.jsx(oUe,{arg:t,stepBack:e,onSubmit:n});case"text":return b.jsx(aUe,{arg:t,stepBack:e,onSubmit:n});default:return b.jsx(N8e,{arg:t,stepBack:e,onSubmit:n})}}function dUe({options:t,placeholder:e}){const{commandBarSend:n}=ni(),[r,i]=P.useState(""),[s,o]=P.useState(),a=t.find(u=>"isCurrent"in u&&u.isCurrent)||null,l=new wu(t,{keys:["displayName","name","description"],threshold:.3,ignoreLocation:!0});P.useEffect(()=>{const u=l.search(r).map(d=>d.item);o(r.length>0?u:t)},[r]);function c(u){n({type:"Select command",data:{command:u}})}return b.jsxs(fa,{defaultValue:a,onChange:c,children:[b.jsxs("div",{className:"flex items-center gap-2 px-4 pb-2 border-solid border-0 border-b border-b-chalkboard-20 dark:border-b-chalkboard-80",children:[b.jsx(nn,{name:"search",className:"w-5 h-5 bg-primary/10 dark:bg-primary text-primary dark:text-inherit"}),b.jsx(fa.Input,{onChange:u=>i(u.target.value),className:"w-full bg-transparent focus:outline-none selection:bg-primary/20 dark:selection:bg-primary/40 dark:focus:outline-none",onKeyDown:u=>{(u.metaKey&&u.key==="k"||u.key==="Backspace"&&!u.currentTarget.value)&&(u.preventDefault(),n({type:"Close"}))},placeholder:a&&a.name||e||"Search commands",autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoFocus:!0})]}),b.jsx(fa.Options,{static:!0,className:"overflow-y-auto max-h-96 cursor-pointer",children:s==null?void 0:s.map(u=>b.jsxs(fa.Option,{value:u,className:"flex items-center gap-4 px-4 py-1.5 first:mt-2 last:mb-2 ui-active:bg-primary/10 dark:ui-active:bg-chalkboard-90",children:["icon"in u&&u.icon&&b.jsx(nn,{name:u.icon,className:"w-5 h-5"}),b.jsxs("div",{className:"flex-grow flex flex-col",children:[b.jsxs("p",{className:"my-0 leading-tight",children:[u.displayName||u.name," "]}),u.description&&b.jsx("p",{className:"my-0 text-xs text-chalkboard-60 dark:text-chalkboard-50",children:u.description})]})]},u.groupId+u.name+(u.displayName||"")))})]})}function fUe({stepBack:t}){const{commandBarState:e,commandBarSend:n}=ni(),{context:{argumentsToSubmit:r,selectedCommand:i}}=e;Tr("backspace",t,{enableOnFormTags:!0,enableOnContentEditable:!0}),Tr(["alt+1","alt+2","alt+3","alt+4","alt+5","alt+6","alt+7","alt+8","alt+9","alt+0"],(o,a)=>{if(a.keys&&!Number.isNaN(parseInt(a.keys[0],10))){if(!(i!=null&&i.args))return;const l=Object.keys(i.args)[parseInt(a.keys[0],10)-1],c=i==null?void 0:i.args[l];n({type:"Edit argument",data:{arg:{...c,name:l}}})}},{keyup:!0,enableOnFormTags:!0,enableOnContentEditable:!0},[r,i]),Object.keys(r).forEach((o,a)=>{i!=null&&i.args&&i!=null&&i.args[o]});function s(o){o.preventDefault(),n({type:"Submit command",output:r})}return b.jsxs(Vte,{children:[b.jsx("p",{className:"px-4",children:i!=null&&i.reviewMessage?i.reviewMessage instanceof Function?i.reviewMessage(e.context):i.reviewMessage:b.jsxs(b.Fragment,{children:["Confirm ",i==null?void 0:i.name]})}),b.jsx("form",{id:"review-form",className:"absolute opacity-0 inset-0 pointer-events-none",onSubmit:s,children:Object.entries(r).map(([o,a],l)=>(i!=null&&i.args?i==null?void 0:i.args[o]:void 0)?b.jsx("input",{id:o,name:o,type:"text",defaultValue:typeof a=="object"?JSON.stringify(a):a,hidden:!0},o):null)})]})}const lO="mod+k",KQ=()=>{const{pathname:t}=Js(),{commandBarState:e,commandBarSend:n}=ni(),{context:{selectedCommand:r,currentArgument:i,commands:s}}=e,o=(i==null?void 0:i.inputType)==="selection",a=o?er:ir;P.useEffect(()=>{n({type:"Close"})},[t]),Vy([lO],()=>{e.context.commands.length!==0&&(e.matches("Closed")?n({type:"Open"}):n({type:"Close"}))});function l(){if(i){const c=Object.entries((r==null?void 0:r.args)||{}),u=c.findIndex(([d,f])=>d===i.name);n(u===0?{type:"Deselect command"}:{type:"Change current argument",data:{arg:{name:c[u-1][0],...c[u-1][1]}}})}else if(e.matches("Review")){const c=Object.entries((r==null?void 0:r.args)||{}).filter(([f,h])=>typeof h.required=="function"?h.required(e.context):h.required),d={name:c[c.length-1][0],...c[c.length-1][1]};n({type:"Edit argument",data:{arg:d}})}else n({type:"Deselect command"})}return b.jsx(Ci.Root,{show:!e.matches("Closed")||!1,afterLeave:()=>{r!=null&&r.onCancel&&r.onCancel(),n({type:"Clear"})},as:P.Fragment,children:b.jsx(a,{open:!e.matches("Closed")||o,onClose:()=>{n({type:"Close"})},className:"fixed inset-0 z-50 overflow-y-auto pb-4 pt-1 "+(o?"pointer-events-none":""),children:b.jsx(Ci.Child,{enter:"duration-100 ease-out",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"duration-75 ease-in",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:b.jsxs(a.Panel,{className:"relative z-50 pointer-events-auto w-full max-w-xl py-2 mx-auto border rounded rounded-tl-none shadow-lg bg-chalkboard-10 dark:bg-chalkboard-100 dark:border-chalkboard-70",as:"div","data-testid":"command-bar",children:[e.matches("Selecting command")?b.jsx(dUe,{options:s}):e.matches("Gathering arguments")?b.jsx(cUe,{stepBack:l}):e.matches("Review")&&b.jsx(fUe,{stepBack:l}),b.jsxs("button",{onClick:()=>n({type:"Close"}),className:"group block !absolute left-auto right-full top-[-3px] m-2.5 p-0 border-none bg-transparent hover:bg-transparent",children:[b.jsx(nn,{name:"close",className:"w-5 h-5 rounded-sm bg-destroy-10 text-destroy-80 dark:bg-destroy-80 dark:text-destroy-10 group-hover:brightness-110"}),b.jsxs(Fr,{position:"bottom",delay:500,children:["Cancel"," ",b.jsx("kbd",{className:"hotkey ml-4 dark:!bg-chalkboard-80",children:"esc"})]})]})]})})})})};function hUe(){const{commandBarSend:t}=ni(),e=kv();return b.jsxs("button",{className:"group rounded-full flex items-center justify-center gap-2 px-2 py-1 bg-primary/10 dark:bg-chalkboard-90 dark:backdrop-blur-sm border-primary hover:border-primary dark:border-chalkboard-50 dark:hover:border-inherit text-primary dark:text-inherit",onClick:()=>t({type:"Open"}),"data-testid":"command-bar-open-button",children:[b.jsx("span",{children:"Commands"}),b.jsx("kbd",{className:"bg-primary/10 dark:bg-chalkboard-80 dark:group-hover:bg-primary font-mono rounded-sm dark:text-inherit inline-block px-1 border-primary dark:border-chalkboard-90",children:zte(lO,e)})]})}const Kte=({showToolbar:t=!0,project:e,children:n,className:r="",style:i,enableMenu:s=!1})=>{var l;const{auth:o}=In(),a=(l=o==null?void 0:o.context)==null?void 0:l.user;return b.jsxs("header",{id:"app-header",className:"w-full grid "+Pj.header+` ${ft()?Pj.desktopApp+" ":""}overlaid-panes sticky top-0 z-20 px-2 items-start `+r,style:i,children:[b.jsx(aLe,{enableMenu:s,project:e==null?void 0:e.project,file:e==null?void 0:e.file}),b.jsx("div",{className:"flex-grow flex justify-center max-w-lg md:max-w-xl lg:max-w-2xl xl:max-w-4xl 2xl:max-w-5xl",children:t&&b.jsx(NPe,{})}),b.jsxs("div",{className:"flex items-center gap-1 py-1 ml-auto",children:[n||b.jsxs(b.Fragment,{children:[b.jsx(hUe,{}),b.jsx(P8e,{})]}),b.jsx(DPe,{user:a})]})]})};function AUe(){const{send:t,context:e,state:n}=Ti();P.useEffect(()=>{if(!je)return;const r=je.subscribeToUnreliable({event:"highlight_set_entity",callback:({data:s})=>{var o;if(s!=null&&s.entity_id){const a=je.artifactGraph.get(s.entity_id);if((a==null?void 0:a.type)==="solid2D"){const l=Kq(a,je.artifactGraph);if(ie(l))return;Ot.setHighlightRange([l.range])}else if((a==null?void 0:a.type)==="cap"){const l=n5(a,je.artifactGraph);if(ie(l))return;Ot.setHighlightRange([l.range])}else if((a==null?void 0:a.type)==="wall"){const l=k7(s.entity_id,je.artifactGraph),c=r5(a,je.artifactGraph);if(ie(c))return;Ot.setHighlightRange(ie(l)?[c.range]:[c.range,l.codeRef.range])}else if((a==null?void 0:a.type)==="sweepEdge"){const l=lI(a,je.artifactGraph);if(ie(l))return;Ot.setHighlightRange([l.range])}else if((a==null?void 0:a.type)==="segment")Ot.setHighlightRange([((o=a==null?void 0:a.codeRef)==null?void 0:o.range)||[0,0]]);else if((a==null?void 0:a.type)==="edgeCut"){const l=a.codeRef,c=Wbe(a,je.artifactGraph);Ot.setHighlightRange(ie(c)?[l.range]:[l.range,c.range])}else Ot.setHighlightRange([[0,0]])}else(!Ot.highlightRange||Ot.highlightRange[0][0]!==0&&Ot.highlightRange[0][1]!==0)&&Ot.setHighlightRange([[0,0]])}}),i=je.subscribeTo({event:"select_with_point",callback:s=>{(async()=>{const o=await _xe(s);o&&t(o)})().catch(Bt)}});return()=>{r(),i()}},[je,e==null?void 0:e.sketchEnginePathId]),P.useEffect(()=>je.subscribeTo({event:"select_with_point",callback:n.matches("Sketch no face")?({data:i})=>{(async()=>{var w,v,x,C,_,S,E,T,R,k,B,M,F;let s=i.entity_id;if(!s)return;if(((w=je.defaultPlanes)==null?void 0:w.xy)===s||((v=je.defaultPlanes)==null?void 0:v.xz)===s||((x=je.defaultPlanes)==null?void 0:x.yz)===s||((C=je.defaultPlanes)==null?void 0:C.negXy)===s||((_=je.defaultPlanes)==null?void 0:_.negXz)===s||((S=je.defaultPlanes)==null?void 0:S.negYz)===s){let I=s;const z={[je.defaultPlanes.xy]:"XY",[je.defaultPlanes.xz]:"XZ",[je.defaultPlanes.yz]:"YZ",[je.defaultPlanes.negXy]:"-XY",[je.defaultPlanes.negXz]:"-XZ",[je.defaultPlanes.negYz]:"-YZ"};let Y=[0,0,1],$=[0,1,0];const ee=Ke.camControls.camera.position.clone().sub(Ke.camControls.target);((E=je.defaultPlanes)==null?void 0:E.xy)===I?(Y=[0,0,1],$=[0,1,0],ee.z<0&&(Y=[0,0,-1],I=((T=je.defaultPlanes)==null?void 0:T.negXy)||"")):((R=je.defaultPlanes)==null?void 0:R.yz)===I?(Y=[1,0,0],$=[0,0,1],ee.x<0&&(Y=[-1,0,0],I=((k=je.defaultPlanes)==null?void 0:k.negYz)||"")):((B=je.defaultPlanes)==null?void 0:B.xz)===I&&(Y=[0,1,0],$=[0,0,1],I=((M=je.defaultPlanes)==null?void 0:M.negXz)||"",ee.y<0&&(Y=[0,-1,0],I=((F=je.defaultPlanes)==null?void 0:F.xz)||"")),Ke.modelingSend({type:"Select default plane",data:{type:"defaultPlane",planeId:I,plane:z[I],zAxis:Y,yAxis:$}});return}const o=s,a=je.artifactGraph.get(o),l=k7(o,je.artifactGraph);if((a==null?void 0:a.type)!=="cap"&&(a==null?void 0:a.type)!=="wall"&&!((a==null?void 0:a.type)==="edgeCut"&&a.subType==="chamfer"))return;const c=a.type==="cap"?n5(a,je.artifactGraph):a.type==="wall"?r5(a,je.artifactGraph):a.codeRef,u=await bI(o);if(!(u!=null&&u.origin)||!(u!=null&&u.z_axis)||!(u!=null&&u.y_axis))return;const{z_axis:d,y_axis:f,origin:h}=u,A=un(be.ast,ie(c)?[0,0]:c.range),m=(()=>{let I=null;if((a==null?void 0:a.type)==="edgeCut"&&a.subType==="chamfer"){const ee=Yr({key:a.consumedEdgeId,types:["segment","sweepEdge"]},je.artifactGraph);if(ie(ee))return null;if(ee.type==="segment")I={type:"base",segment:ee};else{const W=Yr({key:ee.segId,types:["segment"]},je.artifactGraph);if(ie(W))return null;I={type:ee.subType,segment:W}}}if(!I)return null;const z=Xe(be.ast,(I==null?void 0:I.segment.codeRef.pathToNode)||[],"CallExpression");if(ie(z)||z.node.type!=="CallExpression")return null;const $=z.node.arguments.find(({type:ee})=>ee==="TagDeclarator");return!$||$.type!=="TagDeclarator"?null:{type:"edgeCut",subType:I.type,tagName:$.value}})(),g=m||(a.type==="cap"?{type:"cap",subType:a.subType}:{type:"wall"}),y=ie(l)?[]:un(be.ast,l.codeRef.range);Ke.modelingSend({type:"Select default plane",data:{type:"extrudeFace",zAxis:[d.x,d.y,d.z],yAxis:[f.x,f.y,f.z],position:[h.x,h.y,h.z].map(I=>I/Ke._baseUnitMultiplier),sketchPathToNode:A,extrudePathToNode:y,faceInfo:g,faceId:o}})})().catch(Bt)}:()=>{}}),[n])}function $te(t=ut.INDEX){const e=In(),n=hf(t);if(!e)throw new Error("useRefreshSettings must be used within a SettingsAuthProvider");P.useEffect(()=>{e.settings.send({type:"Set all settings",settings:n})},[])}var pUe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},t(e,n)};return function(e,n){t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),si=function(){return si=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},si.apply(this,arguments)},$Q={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},qQ={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},zw={width:"20px",height:"20px",position:"absolute"},mUe={top:si(si({},$Q),{top:"-5px"}),right:si(si({},qQ),{left:void 0,right:"-5px"}),bottom:si(si({},$Q),{top:void 0,bottom:"-5px"}),left:si(si({},qQ),{left:"-5px"}),topRight:si(si({},zw),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:si(si({},zw),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:si(si({},zw),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:si(si({},zw),{left:"-10px",top:"-10px",cursor:"nw-resize"})},gUe=function(t){pUe(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.onMouseDown=function(r){n.props.onResizeStart(r,n.props.direction)},n.onTouchStart=function(r){n.props.onResizeStart(r,n.props.direction)},n}return e.prototype.render=function(){return P.createElement("div",{className:this.props.className||"",style:si(si({position:"absolute",userSelect:"none"},mUe[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},e}(P.PureComponent),yUe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},t(e,n)};return function(e,n){t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),yl=function(){return yl=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},yl.apply(this,arguments)},vUe={width:"auto",height:"auto"},Vw=function(t,e,n){return Math.max(Math.min(t,n),e)},XQ=function(t,e){return Math.round(t/e)*e},ZA=function(t,e){return new RegExp(t,"i").test(e)},Gw=function(t){return!!(t.touches&&t.touches.length)},bUe=function(t){return!!((t.clientX||t.clientX===0)&&(t.clientY||t.clientY===0))},YQ=function(t,e,n){n===void 0&&(n=0);var r=e.reduce(function(s,o,a){return Math.abs(o-t)<Math.abs(e[s]-t)?a:s},0),i=Math.abs(e[r]-t);return n===0||i<n?e[r]:t},KB=function(t){return t=t.toString(),t==="auto"||t.endsWith("px")||t.endsWith("%")||t.endsWith("vh")||t.endsWith("vw")||t.endsWith("vmax")||t.endsWith("vmin")?t:t+"px"},Ww=function(t,e,n,r){if(t&&typeof t=="string"){if(t.endsWith("px"))return Number(t.replace("px",""));if(t.endsWith("%")){var i=Number(t.replace("%",""))/100;return e*i}if(t.endsWith("vw")){var i=Number(t.replace("vw",""))/100;return n*i}if(t.endsWith("vh")){var i=Number(t.replace("vh",""))/100;return r*i}}return t},wUe=function(t,e,n,r,i,s,o){return r=Ww(r,t.width,e,n),i=Ww(i,t.height,e,n),s=Ww(s,t.width,e,n),o=Ww(o,t.height,e,n),{maxWidth:typeof r>"u"?void 0:Number(r),maxHeight:typeof i>"u"?void 0:Number(i),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof o>"u"?void 0:Number(o)}},xUe=function(t){return Array.isArray(t)?t:[t,t]},CUe=["as","ref","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],JQ="__resizable_base__",_Ue=function(t){yUe(e,t);function e(n){var r,i,s,o,a=t.call(this,n)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.appendBase=function(){if(!a.resizable||!a.window)return null;var l=a.parentNode;if(!l)return null;var c=a.window.document.createElement("div");return c.style.width="100%",c.style.height="100%",c.style.position="absolute",c.style.transform="scale(0, 0)",c.style.left="0",c.style.flex="0 0 100%",c.classList?c.classList.add(JQ):c.className+=JQ,l.appendChild(c),c},a.removeBase=function(l){var c=a.parentNode;c&&c.removeChild(l)},a.state={isResizing:!1,width:(i=(r=a.propsSize)===null||r===void 0?void 0:r.width)!==null&&i!==void 0?i:"auto",height:(o=(s=a.propsSize)===null||s===void 0?void 0:s.height)!==null&&o!==void 0?o:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||vUe},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,s=this.resizable.offsetHeight,o=this.resizable.style.position;o!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:i,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=o}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,i=function(a){var l;if(typeof n.state[a]>"u"||n.state[a]==="auto")return"auto";if(n.propsSize&&n.propsSize[a]&&(!((l=n.propsSize[a])===null||l===void 0)&&l.toString().endsWith("%"))){if(n.state[a].toString().endsWith("%"))return n.state[a].toString();var c=n.getParentSize(),u=Number(n.state[a].toString().replace("px","")),d=u/c[a]*100;return d+"%"}return KB(n.state[a])},s=r&&typeof r.width<"u"&&!this.state.isResizing?KB(r.width):i("width"),o=r&&typeof r.height<"u"&&!this.state.isResizing?KB(r.height):i("height");return{width:s,height:o}},enumerable:!1,configurable:!0}),e.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,i=this.parentNode.style.flexWrap;i!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=i),this.removeBase(n),s},e.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},e.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},e.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},e.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},e.prototype.createSizeForCssProperty=function(n,r){var i=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof i>"u"||i==="auto")?"auto":n},e.prototype.calculateNewMaxFromBoundary=function(n,r){var i=this.props.boundsByDirection,s=this.state.direction,o=i&&ZA("left",s),a=i&&ZA("top",s),l,c;if(this.props.bounds==="parent"){var u=this.parentNode;u&&(l=o?this.resizableRight-this.parentLeft:u.offsetWidth+(this.parentLeft-this.resizableLeft),c=a?this.resizableBottom-this.parentTop:u.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=o?this.resizableRight:this.window.innerWidth-this.resizableLeft,c=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=o?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),c=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(n=n&&n<l?n:l),c&&Number.isFinite(c)&&(r=r&&r<c?r:c),{maxWidth:n,maxHeight:r}},e.prototype.calculateNewSizeFromDirection=function(n,r){var i=this.props.scale||1,s=xUe(this.props.resizeRatio||1),o=s[0],a=s[1],l=this.state,c=l.direction,u=l.original,d=this.props,f=d.lockAspectRatio,h=d.lockAspectRatioExtraHeight,A=d.lockAspectRatioExtraWidth,p=u.width,m=u.height,g=h||0,y=A||0;return ZA("right",c)&&(p=u.width+(n-u.x)*o/i,f&&(m=(p-y)/this.ratio+g)),ZA("left",c)&&(p=u.width-(n-u.x)*o/i,f&&(m=(p-y)/this.ratio+g)),ZA("bottom",c)&&(m=u.height+(r-u.y)*a/i,f&&(p=(m-g)*this.ratio+y)),ZA("top",c)&&(m=u.height-(r-u.y)*a/i,f&&(p=(m-g)*this.ratio+y)),{newWidth:p,newHeight:m}},e.prototype.calculateNewSizeFromAspectRatio=function(n,r,i,s){var o=this.props,a=o.lockAspectRatio,l=o.lockAspectRatioExtraHeight,c=o.lockAspectRatioExtraWidth,u=typeof s.width>"u"?10:s.width,d=typeof i.width>"u"||i.width<0?n:i.width,f=typeof s.height>"u"?10:s.height,h=typeof i.height>"u"||i.height<0?r:i.height,A=l||0,p=c||0;if(a){var m=(f-A)*this.ratio+p,g=(h-A)*this.ratio+p,y=(u-p)/this.ratio+A,w=(d-p)/this.ratio+A,v=Math.max(u,m),x=Math.min(d,g),C=Math.max(f,y),_=Math.min(h,w);n=Vw(n,v,x),r=Vw(r,C,_)}else n=Vw(n,u,d),r=Vw(r,f,h);return{newWidth:n,newHeight:r}},e.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var r=n.getBoundingClientRect();this.parentLeft=r.left,this.parentTop=r.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var s=this.resizable.getBoundingClientRect(),o=s.left,a=s.top,l=s.right,c=s.bottom;this.resizableLeft=o,this.resizableRight=l,this.resizableTop=a,this.resizableBottom=c}},e.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var i=0,s=0;if(n.nativeEvent&&bUe(n.nativeEvent)?(i=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Gw(n.nativeEvent)&&(i=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var o=this.props.onResizeStart(n,r,this.resizable);if(o===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var a,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var c=this.parentNode;if(c){var u=this.window.getComputedStyle(c).flexDirection;this.flexDir=u.startsWith("row")?"row":"column",a=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:i,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:yl(yl({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:a};this.setState(d)}},e.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Gw(n))try{n.preventDefault(),n.stopPropagation()}catch{}var i=this.props,s=i.maxWidth,o=i.maxHeight,a=i.minWidth,l=i.minHeight,c=Gw(n)?n.touches[0].clientX:n.clientX,u=Gw(n)?n.touches[0].clientY:n.clientY,d=this.state,f=d.direction,h=d.original,A=d.width,p=d.height,m=this.getParentSize(),g=wUe(m,this.window.innerWidth,this.window.innerHeight,s,o,a,l);s=g.maxWidth,o=g.maxHeight,a=g.minWidth,l=g.minHeight;var y=this.calculateNewSizeFromDirection(c,u),w=y.newHeight,v=y.newWidth,x=this.calculateNewMaxFromBoundary(s,o);this.props.snap&&this.props.snap.x&&(v=YQ(v,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(w=YQ(w,this.props.snap.y,this.props.snapGap));var C=this.calculateNewSizeFromAspectRatio(v,w,{width:x.maxWidth,height:x.maxHeight},{width:a,height:l});if(v=C.newWidth,w=C.newHeight,this.props.grid){var _=XQ(v,this.props.grid[0]),S=XQ(w,this.props.grid[1]),E=this.props.snapGap||0,T=E===0||Math.abs(_-v)<=E?_:v,R=E===0||Math.abs(S-w)<=E?S:w;v=T,w=R}var k={width:v-h.width,height:w-h.height};if(A&&typeof A=="string"){if(A.endsWith("%")){var B=v/m.width*100;v=B+"%"}else if(A.endsWith("vw")){var M=v/this.window.innerWidth*100;v=M+"vw"}else if(A.endsWith("vh")){var F=v/this.window.innerHeight*100;v=F+"vh"}}if(p&&typeof p=="string"){if(p.endsWith("%")){var B=w/m.height*100;w=B+"%"}else if(p.endsWith("vw")){var M=w/this.window.innerWidth*100;w=M+"vw"}else if(p.endsWith("vh")){var F=w/this.window.innerHeight*100;w=F+"vh"}}var I={width:this.createSizeForCssProperty(v,"width"),height:this.createSizeForCssProperty(w,"height")};this.flexDir==="row"?I.flexBasis=I.width:this.flexDir==="column"&&(I.flexBasis=I.height);var z=this.state.width!==I.width,Y=this.state.height!==I.height,$=this.state.flexBasis!==I.flexBasis,ee=z||Y||$;ee&&bg.flushSync(function(){r.setState(I)}),this.props.onResize&&ee&&this.props.onResize(n,f,this.resizable,k)}},e.prototype.onMouseUp=function(n){var r,i,s=this.state,o=s.isResizing,a=s.direction,l=s.original;if(!(!o||!this.resizable)){var c={width:this.size.width-l.width,height:this.size.height-l.height};this.props.onResizeStop&&this.props.onResizeStop(n,a,this.resizable,c),this.props.size&&this.setState({width:(r=this.props.size.width)!==null&&r!==void 0?r:"auto",height:(i=this.props.size.height)!==null&&i!==void 0?i:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:yl(yl({},this.state.backgroundStyle),{cursor:"auto"})})}},e.prototype.updateSize=function(n){var r,i;this.setState({width:(r=n.width)!==null&&r!==void 0?r:"auto",height:(i=n.height)!==null&&i!==void 0?i:"auto"})},e.prototype.renderResizer=function(){var n=this,r=this.props,i=r.enable,s=r.handleStyles,o=r.handleClasses,a=r.handleWrapperStyle,l=r.handleWrapperClass,c=r.handleComponent;if(!i)return null;var u=Object.keys(i).map(function(d){return i[d]!==!1?P.createElement(gUe,{key:d,direction:d,onResizeStart:n.onResizeStart,replaceStyles:s&&s[d],className:o&&o[d]},c&&c[d]?c[d]:null):null});return P.createElement("div",{className:l,style:a},u)},e.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(o,a){return CUe.indexOf(a)!==-1||(o[a]=n.props[a]),o},{}),i=yl(yl(yl({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return P.createElement(s,yl({style:i,className:this.props.className},r,{ref:function(o){o&&(n.resizable=o)}}),this.state.isResizing&&P.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},e.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},e}(P.PureComponent);const SUe="_button_nepjd_1",w0={button:SUe},ZQ=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class pg{constructor(e,n,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?a=>s(ZQ(a)):ZQ,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return $i(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=xL(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=aa(e);let i=this.normalize(n);for(let s=0,o=r;;s++){let a=i.charCodeAt(s),l=this.match(a,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(l)return this.value=l,this;break}o==r&&s<n.length&&n.charCodeAt(s)==a&&o++}}}match(e,n,r){let i=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?i={from:this.matches[s+1],to:r}:(this.matches[s]++,a=!0)),a||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:n,to:r}:this.matches.push(1,n)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(pg.prototype[Symbol.iterator]=function(){return this});const qte={from:-1,to:-1,match:/.*/.exec("")},cO="gm"+(/x/.unicode==null?"":"u");class Xte{constructor(e,n,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=qte,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Yte(e,n,r,i,s);this.re=new RegExp(n,cO+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=lS(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=lS(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const $B=new WeakMap;class um{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=$B.get(e);if(!i||i.from>=r||i.to<=n){let a=new um(n,e.sliceString(n,r));return $B.set(e,a),a}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to<r&&(s+=e.sliceString(i.to,r)),$B.set(e,new um(o,s)),new um(n,s.slice(n-o,r-o))}}class Yte{constructor(e,n,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=qte,this.matchPos=lS(e,i),this.re=new RegExp(n,cO+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=um.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this.matchPos=lS(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=um.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Xte.prototype[Symbol.iterator]=Yte.prototype[Symbol.iterator]=function(){return this});function EUe(t){try{return new RegExp(t,cO),!0}catch{return!1}}function lS(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}function zR(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=or("input",{class:"cm-textfield",name:"line",value:e}),r=or("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),t.dispatch({effects:cS.of(!1)}),t.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},or("label",t.state.phrase("Go to line"),": ",n)," ",or("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!s)return;let{state:o}=t,a=o.doc.lineAt(o.selection.main.head),[,l,c,u,d]=s,f=u?+u.slice(1):0,h=c?+c:a.number;if(c&&d){let m=h/100;l&&(m=m*(l=="-"?-1:1)+a.number/o.doc.lines),h=Math.round(o.doc.lines*m)}else c&&l&&(h=h*(l=="-"?-1:1)+a.number);let A=o.doc.line(Math.max(1,Math.min(o.doc.lines,h))),p=qe.cursor(A.from+Math.max(0,Math.min(f,A.length)));t.dispatch({effects:[cS.of(!1),At.scrollIntoView(p.from,{y:"center"})],selection:p}),t.focus()}return{dom:r}}const cS=Qt.define(),ez=Mr.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(cS)&&(t=n.value);return t},provide:t=>dy.from(t,e=>e?zR:null)}),TUe=t=>{let e=uy(t,zR);if(!e){let n=[cS.of(!0)];t.state.field(ez,!1)==null&&n.push(Qt.appendConfig.of([ez,BUe])),t.dispatch({effects:n}),e=uy(t,zR)}return e&&e.dom.querySelector("input").select(),!0},BUe=At.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),MUe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},kUe=bt.define({combine(t){return il(t,MUe,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function RUe(t){return[FUe,OUe]}const PUe=Ct.mark({class:"cm-selectionMatch"}),LUe=Ct.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function tz(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=_r.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=_r.Word)}function IUe(t,e,n,r){return t(e.sliceDoc(n,n+1))==_r.Word&&t(e.sliceDoc(r-1,r))==_r.Word}const OUe=Br.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(kUe),{state:n}=t,r=n.selection;if(r.ranges.length>1)return Ct.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return Ct.none;let l=n.wordAt(i.head);if(!l)return Ct.none;o=n.charCategorizer(i.head),s=n.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return Ct.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(tz(o,n,i.from,i.to)&&IUe(o,n,i.from,i.to)))return Ct.none}else if(s=n.sliceDoc(i.from,i.to),!s)return Ct.none}let a=[];for(let l of t.visibleRanges){let c=new pg(n.doc,s,l.from,l.to);for(;!c.next().done;){let{from:u,to:d}=c.value;if((!o||tz(o,n,u,d))&&(i.empty&&u<=i.from&&d>=i.to?a.push(LUe.range(u,d)):(u>=i.to||d<=i.from)&&a.push(PUe.range(u,d)),a.length>e.maxMatches))return Ct.none}}return Ct.set(a)}},{decorations:t=>t.decorations}),FUe=At.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),NUe=({state:t,dispatch:e})=>{let{selection:n}=t,r=qe.create(n.ranges.map(i=>t.wordAt(i.head)||qe.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function DUe(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,a=new pg(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new pg(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const UUe=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return NUe({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=DUe(t,r);return i?(e(t.update({selection:t.selection.addRange(qe.range(i.from,i.to),!1),effects:At.scrollIntoView(i.to)})),!0):!1},Ng=bt.define({combine(t){return il(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new YUe(e),scrollToMatch:e=>At.scrollIntoView(e)})}});class Jte{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||EUe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
`:r=="r"?"\r":r=="t"?"	":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new zUe(this):new jUe(this)}getCursor(e,n=0,r){let i=e.doc?e:Tn.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?up(this,i,n,r):cp(this,i,n,r)}}class Zte{constructor(e){this.spec=e}}function cp(t,e,n,r){return new pg(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?HUe(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function HUe(t,e){return(n,r,i,s)=>((s>n||s+i.length<r)&&(s=Math.max(0,n-2),i=t.sliceString(s,Math.min(t.length,r+2))),(e(uS(i,n-s))!=_r.Word||e(dS(i,n-s))!=_r.Word)&&(e(dS(i,r-s))!=_r.Word||e(uS(i,r-s))!=_r.Word))}class jUe extends Zte{constructor(e){super(e)}nextMatch(e,n,r){let i=cp(this.spec,e,r,e.doc.length).nextOverlapping();return i.done&&(i=cp(this.spec,e,0,n).nextOverlapping()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let s=Math.max(n,i-1e4-this.spec.unquoted.length),o=cp(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==n)return null;i-=1e4}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=cp(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=cp(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function up(t,e,n,r){return new Xte(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?QUe(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function uS(t,e){return t.slice(ts(t,e,!1),e)}function dS(t,e){return t.slice(e,ts(t,e))}function QUe(t){return(e,n,r)=>!r[0].length||(t(uS(r.input,r.index))!=_r.Word||t(dS(r.input,r.index))!=_r.Word)&&(t(dS(r.input,r.index+r[0].length))!=_r.Word||t(uS(r.input,r.index+r[0].length))!=_r.Word)}class zUe extends Zte{nextMatch(e,n,r){let i=up(this.spec,e,r,e.doc.length).next();return i.done&&(i=up(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),o=up(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==n||a.from>s+10))return a;if(s==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(n,r)=>r=="$"?"$":r=="&"?e.match[0]:r!="0"&&+r<e.match.length?e.match[r]:n)}matchAll(e,n){let r=up(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=up(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Gy=Qt.define(),uO=Qt.define(),Xd=Mr.define({create(t){return new qB(VR(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Gy)?t=new qB(n.value.create(),t.panel):n.is(uO)&&(t=new qB(t.query,n.value?dO:null));return t},provide:t=>dy.from(t,e=>e.panel)});class qB{constructor(e,n){this.query=e,this.panel=n}}const VUe=Ct.mark({class:"cm-searchMatch"}),GUe=Ct.mark({class:"cm-searchMatch cm-searchMatch-selected"}),WUe=Br.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Xd))}update(t){let e=t.state.field(Xd);(e!=t.startState.field(Xd)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Ct.none;let{view:n}=this,r=new tf;for(let i=0,s=n.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;t.highlight(n.state,a,l,(c,u)=>{let d=n.state.selection.ranges.some(f=>f.from==c&&f.to==u);r.add(c,u,d?GUe:VUe)})}return r.finish()}},{decorations:t=>t.decorations});function Lv(t){return e=>{let n=e.state.field(Xd,!1);return n&&n.query.spec.valid?t(e,n):nne(e)}}const fS=Lv((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=qe.single(r.from,r.to),s=t.state.facet(Ng);return t.dispatch({selection:i,effects:[fO(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),tne(t),!0}),hS=Lv((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=qe.single(i.from,i.to),o=t.state.facet(Ng);return t.dispatch({selection:s,effects:[fO(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),tne(t),!0}),KUe=Lv((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:qe.create(n.map(r=>qe.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),$Ue=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],o=0;for(let a=new pg(t.doc,t.sliceDoc(r,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(qe.range(a.value.from,a.value.to))}return e(t.update({selection:qe.create(s,o),userEvent:"select.search.matches"})),!0},nz=Lv((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,r,r);if(!s)return!1;let o=[],a,l,c=[];if(s.from==r&&s.to==i&&(l=n.toText(e.getReplacement(s)),o.push({from:s.from,to:s.to,insert:l}),s=e.nextMatch(n,s.from,s.to),c.push(At.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),s){let u=o.length==0||o[0].from>=s.to?0:s.to-s.from-l.length;a=qe.single(s.from-u,s.to-u),c.push(fO(t,s)),c.push(n.facet(Ng).scrollToMatch(a.main,t))}return t.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),qUe=Lv((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:At.announce.of(r),userEvent:"input.replace.all"}),!0});function dO(t){return t.state.facet(Ng).createPanel(t)}function VR(t,e){var n,r,i,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(Ng);return new Jte({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function ene(t){let e=uy(t,dO);return e&&e.dom.querySelector("[main-field]")}function tne(t){let e=ene(t);e&&e==t.root.activeElement&&e.select()}const nne=t=>{let e=t.state.field(Xd,!1);if(e&&e.panel){let n=ene(t);if(n&&n!=t.root.activeElement){let r=VR(t.state,e.query.spec);r.valid&&t.dispatch({effects:Gy.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[uO.of(!0),e?Gy.of(VR(t.state,e.query.spec)):Qt.appendConfig.of(ZUe)]});return!0},rne=t=>{let e=t.state.field(Xd,!1);if(!e||!e.panel)return!1;let n=uy(t,dO);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:uO.of(!1)}),!0},XUe=[{key:"Mod-f",run:nne,scope:"editor search-panel"},{key:"F3",run:fS,shift:hS,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:fS,shift:hS,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:rne,scope:"editor search-panel"},{key:"Mod-Shift-l",run:$Ue},{key:"Mod-Alt-g",run:TUe},{key:"Mod-d",run:UUe,preventDefault:!0}];class YUe{constructor(e){this.view=e;let n=this.query=e.state.field(Xd).query.spec;this.commit=this.commit.bind(this),this.searchField=or("input",{value:n.search,placeholder:Eo(e,"Find"),"aria-label":Eo(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=or("input",{value:n.replace,placeholder:Eo(e,"Replace"),"aria-label":Eo(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=or("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=or("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=or("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return or("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=or("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>fS(e),[Eo(e,"next")]),r("prev",()=>hS(e),[Eo(e,"previous")]),r("select",()=>KUe(e),[Eo(e,"all")]),or("label",null,[this.caseField,Eo(e,"match case")]),or("label",null,[this.reField,Eo(e,"regexp")]),or("label",null,[this.wordField,Eo(e,"by word")]),...e.state.readOnly?[]:[or("br"),this.replaceField,r("replace",()=>nz(e),[Eo(e,"replace")]),r("replaceAll",()=>qUe(e),[Eo(e,"replace all")])],or("button",{name:"close",onclick:()=>rne(e),"aria-label":Eo(e,"close"),type:"button"},["×"])])}commit(){let e=new Jte({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Gy.of(e)}))}keydown(e){Ype(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?hS:fS)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),nz(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Gy)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ng).top}}function Eo(t,e){return t.state.phrase(e)}const Kw=30,$w=/[\s\.,:;?!]/;function fO(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,s=Math.max(r.from,e-Kw),o=Math.min(i,n+Kw),a=t.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<Kw;l++)if(!$w.test(a[l+1])&&$w.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-Kw;l--)if(!$w.test(a[l-1])&&$w.test(a[l])){a=a.slice(0,l);break}}return At.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const JUe=At.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),ZUe=[Xd,Ea.low(WUe),JUe],ine=Mr.define({create:()=>null,update:(t,e)=>{for(const n of e.effects)if(n.is(GR))return n.value;if(!t)return null;if(!e.changes.empty){const n=e.changes.mapPos(t.pos,-1,bi.TrackDel),r=e.changes.mapPos(t.pos+t.text.length,-1,bi.TrackDel);return n===null||r===null||e.newDoc.sliceString(n,r)!==t.text?null:Object.assign(Object.assign({},t),{pos:n})}return t},provide:t=>[At.decorations.from(t,e=>{if(!e)return Ct.none;const n=e.pos,r=e.pos+e.text.length,i=e.rule.className;return Ct.set(e7e({className:i}).range(n,r))}),At.contentAttributes.from(t,e=>!e||!e.rule.cursor?{style:""}:{style:`cursor: ${e.rule.cursor}`})]}),GR=Qt.define(),e7e=t=>{var e;return Ct.mark({class:`cm-interact ${(e=t==null?void 0:t.className)!==null&&e!==void 0?e:""}`})},t7e=At.theme({".cm-interact":{background:"rgba(128, 128, 255, 0.2)",borderRadius:"4px"}}),sne=bt.define(),one=bt.define({combine:t=>t[t.length-1]}),n7e=Br.define(t=>({target:null,dragging:!1,mouseX:0,mouseY:0,getMatch(){const e=t.state.facet(sne),n=t.posAtCoords({x:this.mouseX,y:this.mouseY});if(!n)return null;const r=t.state.doc.lineAt(n),i=n-r.from;let s=null;for(const o of e)for(const a of r.text.matchAll(o.regexp)){if(a.index===void 0)continue;const l=a[0];if(!l)continue;const c=a.index,u=a.index+l.length;i<c||i>u||(!s||l.length<s.text.length)&&(s={rule:o,pos:r.from+c,text:l})}return s},updateText(e){return n=>{t.dispatch({effects:GR.of(Object.assign(Object.assign({},e),{text:n})),changes:{from:e.pos,to:e.pos+e.text.length,insert:n}})}},setTarget(e){this.target=e,t.dispatch({effects:GR.of(e)})},isModKeyDown(e){const n=t.state.facet(one),r=!!window.navigator&&window.navigator.userAgent.includes("Macintosh");switch(n){case"alt":return e.altKey;case"shift":return e.shiftKey;case"ctrl":return e.ctrlKey;case"meta":return e.metaKey;case"mod":return r?e.metaKey:e.ctrlKey}throw new Error(`Invalid mod key: ${n}`)},update(e){const n=e.state.field(ine,!1);n!==void 0&&this.target!==n&&(this.target=n,n===null&&this.endDrag())},startDrag(e){this.dragging||this.target&&(this.dragging=!0,this.target.rule.onDragStart&&this.target.rule.onDragStart(this.target.text,this.updateText(this.target),e))},endDrag(){var e;this.dragging&&(this.dragging=!1,!((e=this.target)===null||e===void 0)&&e.rule.onDragEnd&&this.target.rule.onDragEnd(this.target.text,this.updateText(this.target)))}}),{eventHandlers:{mousedown(t,e){this.isModKeyDown(t)&&this.target&&(t.preventDefault(),this.target.rule.onClick&&this.target.rule.onClick(this.target.text,n=>{this.target&&this.updateText(this.target)(n)},t),this.target.rule.onDrag&&this.startDrag(t))},mousemove(t,e){if(this.mouseX=t.clientX,this.mouseY=t.clientY,!this.isModKeyDown(t)){this.target&&this.setTarget(null);return}this.target&&this.dragging?this.target.rule.onDrag&&this.target.rule.onDrag(this.target.text,this.updateText(this.target),t):this.setTarget(this.getMatch())},mouseup(t,e){this.endDrag(),this.target&&!this.isModKeyDown(t)&&this.setTarget(null),this.isModKeyDown(t)&&this.setTarget(this.getMatch())},mouseleave(t,e){this.endDrag(),this.target&&this.setTarget(null)},keydown(t,e){!this.target&&this.isModKeyDown(t)&&this.setTarget(this.getMatch())},keyup(t,e){this.target&&!this.isModKeyDown(t)&&(this.endDrag(),this.setTarget(null))}}}),r7e=(t={})=>{var e,n;return[ine,t7e,n7e,one.of((e=t.key)!==null&&e!==void 0?e:"alt"),((n=t.rules)!==null&&n!==void 0?n:[]).map(r=>sne.of(r))]},WR={formatCode:{display:"Alt + Shift + F"},convertToVariable:{codeMirror:"Ctrl-Shift-c",display:"Ctrl + Shift + C"}},i7e=()=>{const{settings:{context:t}}=In(),e=t.app.theme.current===Zn.System?_f():t.app.theme.current,{copilotLSP:n,kclLSP:r}=bu();Tr("mod+z",c=>{c.preventDefault(),Ot.undo()}),Tr("mod+shift+z",c=>{c.preventDefault(),Ot.redo()});const i=t.textEditor.textWrapping,s=t.textEditor.blinkingCursor,o=Kt.getCodemirrorHotkeys(),a=P.useMemo(()=>{const c=[rme({cursorBlinkRate:s.current?1200:0}),YCe,h9(),E8(),FL(),oA.of([...B0e,...$Ce,...XUe,...nCe,...Cge,...V$,...V0e,qCe,...o,{key:WR.convertToVariable.codeMirror,run:()=>Ot.convertToVariable()}])];return r&&c.push(Ea.highest(r)),n&&c.push(n),Mp||(c.push(t1e(),Qme(),Gme(),Ame(),h9(),Tge(),Tn.allowMultipleSelections.of(!0),Age(),Uge(),E8(),bme(),RUe(),x$(Pge,{fallback:!0}),Eme(),lme(),r7e({rules:[{regexp:/-?\b\d+\.?\d*\b/g,cursor:"ew-resize",onDrag:(u,d,f)=>{const h=f.shiftKey&&f.metaKey?.01:f.metaKey?.1:f.shiftKey?10:1,A=f.movementX*h,p=ot(Number(u)+A,h===.01?2:h===.1?1:0);isNaN(p)||d(p.toString())}}]})),i.current&&c.push(At.lineWrapping)),c},[r,n,i.current,s.current]),l=P.useRef(Kt.code);return b.jsx("div",{id:"code-mirror-override",className:"absolute inset-0 "+(s.current?"blink":""),children:b.jsx(sUe,{initialDocValue:l.current,extensions:a,theme:e,onCreateEditor:c=>{c!==null&&(Ot.setEditorView(c),U0e(c.state)===0&&be.setDiagnosticsForCurrentErrors())}})})},s7e=({children:t})=>{const{enable:e,handleClick:n}=bRe(),{commandBarSend:r}=ni();return b.jsx(Lu,{children:b.jsxs("div",{className:"relative",onClick:i=>{const s=i.target;i.eventPhase===3&&s.closest("a")===null&&(i.stopPropagation(),i.preventDefault())},children:[b.jsx(Lu.Button,{className:"!p-0 !bg-transparent hover:text-primary border-transparent dark:!border-transparent hover:!border-primary dark:hover:!border-chalkboard-70 ui-open:!border-primary dark:ui-open:!border-chalkboard-70 !outline-none",children:b.jsx(vs,{icon:"three-dots",className:"p-1",size:"sm",bgClassName:"bg-transparent dark:bg-transparent",iconClassName:"!text-chalkboard-90 dark:!text-chalkboard-40"})}),b.jsxs(Lu.Items,{className:"absolute right-0 left-auto w-72 flex flex-col gap-1 divide-y divide-chalkboard-20 dark:divide-chalkboard-70 align-stretch px-0 py-1 bg-chalkboard-10 dark:bg-chalkboard-100 rounded-sm shadow-lg border border-solid border-chalkboard-20/50 dark:border-chalkboard-80/50",children:[b.jsx(Lu.Item,{children:b.jsxs("button",{onClick:()=>be.format(),className:w0.button,children:[b.jsx("span",{children:"Format code"}),b.jsx("small",{children:WR.formatCode.display})]})}),e&&b.jsx(Lu.Item,{children:b.jsxs("button",{onClick:()=>{n().catch(Bt)},className:w0.button,children:[b.jsx("span",{children:"Convert to Variable"}),b.jsx("small",{children:WR.convertToVariable.display})]})}),b.jsx(Lu.Item,{children:b.jsxs("a",{className:w0.button,href:"https://zoo.dev/docs/kcl",target:"_blank",rel:"noopener noreferrer",onClick:tu(),children:[b.jsx("span",{children:"Read the KCL docs"}),b.jsxs("small",{children:["zoo.dev",b.jsx(Zh,{icon:MH,className:"ml-1 align-text-top",width:12})]})]})}),b.jsx(Lu.Item,{children:b.jsx("button",{onClick:()=>{r({type:"Find and select command",data:{groupId:"code",name:"open-kcl-example"}})},className:w0.button,children:b.jsx("span",{children:"Load a sample model"})})}),b.jsx(Lu.Item,{children:b.jsxs("a",{className:w0.button,href:"https://zoo.dev/docs/kcl-samples",target:"_blank",rel:"noopener noreferrer",onClick:tu(),children:[b.jsx("span",{children:"View all samples"}),b.jsxs("small",{children:["zoo.dev",b.jsx(Zh,{icon:MH,className:"ml-1 align-text-top",width:12})]})]})})]})]})})};var ane={exports:{}};(function(t,e){(function(n,r){t.exports=r(P)})(en,function(n){return function(r){var i={};function s(o){if(i[o])return i[o].exports;var a=i[o]={i:o,l:!1,exports:{}};return r[o].call(a.exports,a,a.exports,s),a.l=!0,a.exports}return s.m=r,s.c=i,s.d=function(o,a,l){s.o(o,a)||Object.defineProperty(o,a,{enumerable:!0,get:l})},s.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},s.t=function(o,a){if(1&a&&(o=s(o)),8&a||4&a&&typeof o=="object"&&o&&o.__esModule)return o;var l=Object.create(null);if(s.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:o}),2&a&&typeof o!="string")for(var c in o)s.d(l,c,(function(u){return o[u]}).bind(null,c));return l},s.n=function(o){var a=o&&o.__esModule?function(){return o.default}:function(){return o};return s.d(a,"a",a),a},s.o=function(o,a){return Object.prototype.hasOwnProperty.call(o,a)},s.p="",s(s.s=48)}([function(r,i){r.exports=n},function(r,i){var s=r.exports={version:"2.6.12"};typeof __e=="number"&&(__e=s)},function(r,i,s){var o=s(26)("wks"),a=s(17),l=s(3).Symbol,c=typeof l=="function";(r.exports=function(u){return o[u]||(o[u]=c&&l[u]||(c?l:a)("Symbol."+u))}).store=o},function(r,i){var s=r.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=s)},function(r,i,s){r.exports=!s(8)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(r,i){var s={}.hasOwnProperty;r.exports=function(o,a){return s.call(o,a)}},function(r,i,s){var o=s(7),a=s(16);r.exports=s(4)?function(l,c,u){return o.f(l,c,a(1,u))}:function(l,c,u){return l[c]=u,l}},function(r,i,s){var o=s(10),a=s(35),l=s(23),c=Object.defineProperty;i.f=s(4)?Object.defineProperty:function(u,d,f){if(o(u),d=l(d,!0),o(f),a)try{return c(u,d,f)}catch{}if("get"in f||"set"in f)throw TypeError("Accessors not supported!");return"value"in f&&(u[d]=f.value),u}},function(r,i){r.exports=function(s){try{return!!s()}catch{return!0}}},function(r,i,s){var o=s(40),a=s(22);r.exports=function(l){return o(a(l))}},function(r,i,s){var o=s(11);r.exports=function(a){if(!o(a))throw TypeError(a+" is not an object!");return a}},function(r,i){r.exports=function(s){return typeof s=="object"?s!==null:typeof s=="function"}},function(r,i){r.exports={}},function(r,i,s){var o=s(39),a=s(27);r.exports=Object.keys||function(l){return o(l,a)}},function(r,i){r.exports=!0},function(r,i,s){var o=s(3),a=s(1),l=s(53),c=s(6),u=s(5),d=function(f,h,A){var p,m,g,y=f&d.F,w=f&d.G,v=f&d.S,x=f&d.P,C=f&d.B,_=f&d.W,S=w?a:a[h]||(a[h]={}),E=S.prototype,T=w?o:v?o[h]:(o[h]||{}).prototype;for(p in w&&(A=h),A)(m=!y&&T&&T[p]!==void 0)&&u(S,p)||(g=m?T[p]:A[p],S[p]=w&&typeof T[p]!="function"?A[p]:C&&m?l(g,o):_&&T[p]==g?function(R){var k=function(B,M,F){if(this instanceof R){switch(arguments.length){case 0:return new R;case 1:return new R(B);case 2:return new R(B,M)}return new R(B,M,F)}return R.apply(this,arguments)};return k.prototype=R.prototype,k}(g):x&&typeof g=="function"?l(Function.call,g):g,x&&((S.virtual||(S.virtual={}))[p]=g,f&d.R&&E&&!E[p]&&c(E,p,g)))};d.F=1,d.G=2,d.S=4,d.P=8,d.B=16,d.W=32,d.U=64,d.R=128,r.exports=d},function(r,i){r.exports=function(s,o){return{enumerable:!(1&s),configurable:!(2&s),writable:!(4&s),value:o}}},function(r,i){var s=0,o=Math.random();r.exports=function(a){return"Symbol(".concat(a===void 0?"":a,")_",(++s+o).toString(36))}},function(r,i,s){var o=s(22);r.exports=function(a){return Object(o(a))}},function(r,i){i.f={}.propertyIsEnumerable},function(r,i,s){var o=s(52)(!0);s(34)(String,"String",function(a){this._t=String(a),this._i=0},function(){var a,l=this._t,c=this._i;return c>=l.length?{value:void 0,done:!0}:(a=o(l,c),this._i+=a.length,{value:a,done:!1})})},function(r,i){var s=Math.ceil,o=Math.floor;r.exports=function(a){return isNaN(a=+a)?0:(a>0?o:s)(a)}},function(r,i){r.exports=function(s){if(s==null)throw TypeError("Can't call method on  "+s);return s}},function(r,i,s){var o=s(11);r.exports=function(a,l){if(!o(a))return a;var c,u;if(l&&typeof(c=a.toString)=="function"&&!o(u=c.call(a))||typeof(c=a.valueOf)=="function"&&!o(u=c.call(a))||!l&&typeof(c=a.toString)=="function"&&!o(u=c.call(a)))return u;throw TypeError("Can't convert object to primitive value")}},function(r,i){var s={}.toString;r.exports=function(o){return s.call(o).slice(8,-1)}},function(r,i,s){var o=s(26)("keys"),a=s(17);r.exports=function(l){return o[l]||(o[l]=a(l))}},function(r,i,s){var o=s(1),a=s(3),l=a["__core-js_shared__"]||(a["__core-js_shared__"]={});(r.exports=function(c,u){return l[c]||(l[c]=u!==void 0?u:{})})("versions",[]).push({version:o.version,mode:s(14)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(r,i){r.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(r,i,s){var o=s(7).f,a=s(5),l=s(2)("toStringTag");r.exports=function(c,u,d){c&&!a(c=d?c:c.prototype,l)&&o(c,l,{configurable:!0,value:u})}},function(r,i,s){s(62);for(var o=s(3),a=s(6),l=s(12),c=s(2)("toStringTag"),u="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),d=0;d<u.length;d++){var f=u[d],h=o[f],A=h&&h.prototype;A&&!A[c]&&a(A,c,f),l[f]=l.Array}},function(r,i,s){i.f=s(2)},function(r,i,s){var o=s(3),a=s(1),l=s(14),c=s(30),u=s(7).f;r.exports=function(d){var f=a.Symbol||(a.Symbol=l?{}:o.Symbol||{});d.charAt(0)=="_"||d in f||u(f,d,{value:c.f(d)})}},function(r,i){i.f=Object.getOwnPropertySymbols},function(r,i){r.exports=function(s,o,a){return Math.min(Math.max(s,o),a)}},function(r,i,s){var o=s(14),a=s(15),l=s(37),c=s(6),u=s(12),d=s(55),f=s(28),h=s(61),A=s(2)("iterator"),p=!([].keys&&"next"in[].keys()),m=function(){return this};r.exports=function(g,y,w,v,x,C,_){d(w,y,v);var S,E,T,R=function(ee){if(!p&&ee in F)return F[ee];switch(ee){case"keys":case"values":return function(){return new w(this,ee)}}return function(){return new w(this,ee)}},k=y+" Iterator",B=x=="values",M=!1,F=g.prototype,I=F[A]||F["@@iterator"]||x&&F[x],z=I||R(x),Y=x?B?R("entries"):z:void 0,$=y=="Array"&&F.entries||I;if($&&(T=h($.call(new g)))!==Object.prototype&&T.next&&(f(T,k,!0),o||typeof T[A]=="function"||c(T,A,m)),B&&I&&I.name!=="values"&&(M=!0,z=function(){return I.call(this)}),o&&!_||!p&&!M&&F[A]||c(F,A,z),u[y]=z,u[k]=m,x)if(S={values:B?z:R("values"),keys:C?z:R("keys"),entries:Y},_)for(E in S)E in F||l(F,E,S[E]);else a(a.P+a.F*(p||M),y,S);return S}},function(r,i,s){r.exports=!s(4)&&!s(8)(function(){return Object.defineProperty(s(36)("div"),"a",{get:function(){return 7}}).a!=7})},function(r,i,s){var o=s(11),a=s(3).document,l=o(a)&&o(a.createElement);r.exports=function(c){return l?a.createElement(c):{}}},function(r,i,s){r.exports=s(6)},function(r,i,s){var o=s(10),a=s(56),l=s(27),c=s(25)("IE_PROTO"),u=function(){},d=function(){var f,h=s(36)("iframe"),A=l.length;for(h.style.display="none",s(60).appendChild(h),h.src="javascript:",(f=h.contentWindow.document).open(),f.write("<script>document.F=Object<\/script>"),f.close(),d=f.F;A--;)delete d.prototype[l[A]];return d()};r.exports=Object.create||function(f,h){var A;return f!==null?(u.prototype=o(f),A=new u,u.prototype=null,A[c]=f):A=d(),h===void 0?A:a(A,h)}},function(r,i,s){var o=s(5),a=s(9),l=s(57)(!1),c=s(25)("IE_PROTO");r.exports=function(u,d){var f,h=a(u),A=0,p=[];for(f in h)f!=c&&o(h,f)&&p.push(f);for(;d.length>A;)o(h,f=d[A++])&&(~l(p,f)||p.push(f));return p}},function(r,i,s){var o=s(24);r.exports=Object("z").propertyIsEnumerable(0)?Object:function(a){return o(a)=="String"?a.split(""):Object(a)}},function(r,i,s){var o=s(39),a=s(27).concat("length","prototype");i.f=Object.getOwnPropertyNames||function(l){return o(l,a)}},function(r,i,s){var o=s(24),a=s(2)("toStringTag"),l=o(function(){return arguments}())=="Arguments";r.exports=function(c){var u,d,f;return c===void 0?"Undefined":c===null?"Null":typeof(d=function(h,A){try{return h[A]}catch{}}(u=Object(c),a))=="string"?d:l?o(u):(f=o(u))=="Object"&&typeof u.callee=="function"?"Arguments":f}},function(r,i){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch{typeof window=="object"&&(s=window)}r.exports=s},function(r,i){var s=/-?\d+(\.\d+)?%?/g;r.exports=function(o){return o.match(s)}},function(r,i,s){Object.defineProperty(i,"__esModule",{value:!0}),i.getBase16Theme=i.createStyling=i.invertTheme=void 0;var o=m(s(49)),a=m(s(76)),l=m(s(81)),c=m(s(89)),u=m(s(93)),d=function(E){if(E&&E.__esModule)return E;var T={};if(E!=null)for(var R in E)Object.prototype.hasOwnProperty.call(E,R)&&(T[R]=E[R]);return T.default=E,T}(s(94)),f=m(s(132)),h=m(s(133)),A=m(s(138)),p=s(139);function m(E){return E&&E.__esModule?E:{default:E}}var g=d.default,y=(0,c.default)(g),w=(0,A.default)(h.default,p.rgb2yuv,function(E){var T,R=(0,l.default)(E,3),k=R[0],B=R[1],M=R[2];return[(T=k,T<.25?1:T<.5?.9-T:1.1-T),B,M]},p.yuv2rgb,f.default),v=function(E){return function(T){return{className:[T.className,E.className].filter(Boolean).join(" "),style:(0,a.default)({},T.style||{},E.style||{})}}},x=function(E,T){var R=(0,c.default)(T);for(var k in E)R.indexOf(k)===-1&&R.push(k);return R.reduce(function(B,M){return B[M]=function(F,I){if(F===void 0)return I;if(I===void 0)return F;var z=F===void 0?"undefined":(0,o.default)(F),Y=I===void 0?"undefined":(0,o.default)(I);switch(z){case"string":switch(Y){case"string":return[I,F].filter(Boolean).join(" ");case"object":return v({className:F,style:I});case"function":return function($){for(var ee=arguments.length,W=Array(ee>1?ee-1:0),ne=1;ne<ee;ne++)W[ne-1]=arguments[ne];return v({className:F})(I.apply(void 0,[$].concat(W)))}}case"object":switch(Y){case"string":return v({className:I,style:F});case"object":return(0,a.default)({},I,F);case"function":return function($){for(var ee=arguments.length,W=Array(ee>1?ee-1:0),ne=1;ne<ee;ne++)W[ne-1]=arguments[ne];return v({style:F})(I.apply(void 0,[$].concat(W)))}}case"function":switch(Y){case"string":return function($){for(var ee=arguments.length,W=Array(ee>1?ee-1:0),ne=1;ne<ee;ne++)W[ne-1]=arguments[ne];return F.apply(void 0,[v($)({className:I})].concat(W))};case"object":return function($){for(var ee=arguments.length,W=Array(ee>1?ee-1:0),ne=1;ne<ee;ne++)W[ne-1]=arguments[ne];return F.apply(void 0,[v($)({style:I})].concat(W))};case"function":return function($){for(var ee=arguments.length,W=Array(ee>1?ee-1:0),ne=1;ne<ee;ne++)W[ne-1]=arguments[ne];return F.apply(void 0,[I.apply(void 0,[$].concat(W))].concat(W))}}}}(E[M],T[M]),B},{})},C=function(E,T){for(var R=arguments.length,k=Array(R>2?R-2:0),B=2;B<R;B++)k[B-2]=arguments[B];if(T===null)return E;Array.isArray(T)||(T=[T]);var M=T.map(function(I){return E[I]}).filter(Boolean),F=M.reduce(function(I,z){return typeof z=="string"?I.className=[I.className,z].filter(Boolean).join(" "):(z===void 0?"undefined":(0,o.default)(z))==="object"?I.style=(0,a.default)({},I.style,z):typeof z=="function"&&(I=(0,a.default)({},I,z.apply(void 0,[I].concat(k)))),I},{className:"",style:{}});return F.className||delete F.className,(0,c.default)(F.style).length===0&&delete F.style,F},_=i.invertTheme=function(E){return(0,c.default)(E).reduce(function(T,R){return T[R]=/^base/.test(R)?w(E[R]):R==="scheme"?E[R]+":inverted":E[R],T},{})},S=(i.createStyling=(0,u.default)(function(E){for(var T=arguments.length,R=Array(T>3?T-3:0),k=3;k<T;k++)R[k-3]=arguments[k];var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},F=B.defaultBase16,I=F===void 0?g:F,z=B.base16Themes,Y=z===void 0?null:z,$=S(M,Y);$&&(M=(0,a.default)({},$,M));var ee=y.reduce(function(fe,ge){return fe[ge]=M[ge]||I[ge],fe},{}),W=(0,c.default)(M).reduce(function(fe,ge){return y.indexOf(ge)===-1&&(fe[ge]=M[ge]),fe},{}),ne=E(ee),Se=x(W,ne);return(0,u.default)(C,2).apply(void 0,[Se].concat(R))},3),i.getBase16Theme=function(E,T){if(E&&E.extend&&(E=E.extend),typeof E=="string"){var R=E.split(":"),k=(0,l.default)(R,2),B=k[0],M=k[1];E=(T||{})[B]||d[B],M==="inverted"&&(E=_(E))}return E&&E.hasOwnProperty("base00")?E:void 0})},function(r,i,s){var o,a=typeof Reflect=="object"?Reflect:null,l=a&&typeof a.apply=="function"?a.apply:function(v,x,C){return Function.prototype.apply.call(v,x,C)};o=a&&typeof a.ownKeys=="function"?a.ownKeys:Object.getOwnPropertySymbols?function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:function(v){return Object.getOwnPropertyNames(v)};var c=Number.isNaN||function(v){return v!=v};function u(){u.init.call(this)}r.exports=u,r.exports.once=function(v,x){return new Promise(function(C,_){function S(){E!==void 0&&v.removeListener("error",E),C([].slice.call(arguments))}var E;x!=="error"&&(E=function(T){v.removeListener(x,S),_(T)},v.once("error",E)),v.once(x,S)})},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var d=10;function f(v){if(typeof v!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof v)}function h(v){return v._maxListeners===void 0?u.defaultMaxListeners:v._maxListeners}function A(v,x,C,_){var S,E,T,R;if(f(C),(E=v._events)===void 0?(E=v._events=Object.create(null),v._eventsCount=0):(E.newListener!==void 0&&(v.emit("newListener",x,C.listener?C.listener:C),E=v._events),T=E[x]),T===void 0)T=E[x]=C,++v._eventsCount;else if(typeof T=="function"?T=E[x]=_?[C,T]:[T,C]:_?T.unshift(C):T.push(C),(S=h(v))>0&&T.length>S&&!T.warned){T.warned=!0;var k=new Error("Possible EventEmitter memory leak detected. "+T.length+" "+String(x)+" listeners added. Use emitter.setMaxListeners() to increase limit");k.name="MaxListenersExceededWarning",k.emitter=v,k.type=x,k.count=T.length,R=k,console&&console.warn&&console.warn(R)}return v}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function m(v,x,C){var _={fired:!1,wrapFn:void 0,target:v,type:x,listener:C},S=p.bind(_);return S.listener=C,_.wrapFn=S,S}function g(v,x,C){var _=v._events;if(_===void 0)return[];var S=_[x];return S===void 0?[]:typeof S=="function"?C?[S.listener||S]:[S]:C?function(E){for(var T=new Array(E.length),R=0;R<T.length;++R)T[R]=E[R].listener||E[R];return T}(S):w(S,S.length)}function y(v){var x=this._events;if(x!==void 0){var C=x[v];if(typeof C=="function")return 1;if(C!==void 0)return C.length}return 0}function w(v,x){for(var C=new Array(x),_=0;_<x;++_)C[_]=v[_];return C}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return d},set:function(v){if(typeof v!="number"||v<0||c(v))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+v+".");d=v}}),u.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||c(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this},u.prototype.getMaxListeners=function(){return h(this)},u.prototype.emit=function(v){for(var x=[],C=1;C<arguments.length;C++)x.push(arguments[C]);var _=v==="error",S=this._events;if(S!==void 0)_=_&&S.error===void 0;else if(!_)return!1;if(_){var E;if(x.length>0&&(E=x[0]),E instanceof Error)throw E;var T=new Error("Unhandled error."+(E?" ("+E.message+")":""));throw T.context=E,T}var R=S[v];if(R===void 0)return!1;if(typeof R=="function")l(R,this,x);else{var k=R.length,B=w(R,k);for(C=0;C<k;++C)l(B[C],this,x)}return!0},u.prototype.addListener=function(v,x){return A(this,v,x,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(v,x){return A(this,v,x,!0)},u.prototype.once=function(v,x){return f(x),this.on(v,m(this,v,x)),this},u.prototype.prependOnceListener=function(v,x){return f(x),this.prependListener(v,m(this,v,x)),this},u.prototype.removeListener=function(v,x){var C,_,S,E,T;if(f(x),(_=this._events)===void 0)return this;if((C=_[v])===void 0)return this;if(C===x||C.listener===x)--this._eventsCount==0?this._events=Object.create(null):(delete _[v],_.removeListener&&this.emit("removeListener",v,C.listener||x));else if(typeof C!="function"){for(S=-1,E=C.length-1;E>=0;E--)if(C[E]===x||C[E].listener===x){T=C[E].listener,S=E;break}if(S<0)return this;S===0?C.shift():function(R,k){for(;k+1<R.length;k++)R[k]=R[k+1];R.pop()}(C,S),C.length===1&&(_[v]=C[0]),_.removeListener!==void 0&&this.emit("removeListener",v,T||x)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(v){var x,C,_;if((C=this._events)===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[v]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete C[v]),this;if(arguments.length===0){var S,E=Object.keys(C);for(_=0;_<E.length;++_)(S=E[_])!=="removeListener"&&this.removeAllListeners(S);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(x=C[v])=="function")this.removeListener(v,x);else if(x!==void 0)for(_=x.length-1;_>=0;_--)this.removeListener(v,x[_]);return this},u.prototype.listeners=function(v){return g(this,v,!0)},u.prototype.rawListeners=function(v){return g(this,v,!1)},u.listenerCount=function(v,x){return typeof v.listenerCount=="function"?v.listenerCount(x):y.call(v,x)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?o(this._events):[]}},function(r,i,s){r.exports.Dispatcher=s(140)},function(r,i,s){r.exports=s(142)},function(r,i,s){i.__esModule=!0;var o=c(s(50)),a=c(s(65)),l=typeof a.default=="function"&&typeof o.default=="symbol"?function(u){return typeof u}:function(u){return u&&typeof a.default=="function"&&u.constructor===a.default&&u!==a.default.prototype?"symbol":typeof u};function c(u){return u&&u.__esModule?u:{default:u}}i.default=typeof a.default=="function"&&l(o.default)==="symbol"?function(u){return u===void 0?"undefined":l(u)}:function(u){return u&&typeof a.default=="function"&&u.constructor===a.default&&u!==a.default.prototype?"symbol":u===void 0?"undefined":l(u)}},function(r,i,s){r.exports={default:s(51),__esModule:!0}},function(r,i,s){s(20),s(29),r.exports=s(30).f("iterator")},function(r,i,s){var o=s(21),a=s(22);r.exports=function(l){return function(c,u){var d,f,h=String(a(c)),A=o(u),p=h.length;return A<0||A>=p?l?"":void 0:(d=h.charCodeAt(A))<55296||d>56319||A+1===p||(f=h.charCodeAt(A+1))<56320||f>57343?l?h.charAt(A):d:l?h.slice(A,A+2):f-56320+(d-55296<<10)+65536}}},function(r,i,s){var o=s(54);r.exports=function(a,l,c){if(o(a),l===void 0)return a;switch(c){case 1:return function(u){return a.call(l,u)};case 2:return function(u,d){return a.call(l,u,d)};case 3:return function(u,d,f){return a.call(l,u,d,f)}}return function(){return a.apply(l,arguments)}}},function(r,i){r.exports=function(s){if(typeof s!="function")throw TypeError(s+" is not a function!");return s}},function(r,i,s){var o=s(38),a=s(16),l=s(28),c={};s(6)(c,s(2)("iterator"),function(){return this}),r.exports=function(u,d,f){u.prototype=o(c,{next:a(1,f)}),l(u,d+" Iterator")}},function(r,i,s){var o=s(7),a=s(10),l=s(13);r.exports=s(4)?Object.defineProperties:function(c,u){a(c);for(var d,f=l(u),h=f.length,A=0;h>A;)o.f(c,d=f[A++],u[d]);return c}},function(r,i,s){var o=s(9),a=s(58),l=s(59);r.exports=function(c){return function(u,d,f){var h,A=o(u),p=a(A.length),m=l(f,p);if(c&&d!=d){for(;p>m;)if((h=A[m++])!=h)return!0}else for(;p>m;m++)if((c||m in A)&&A[m]===d)return c||m||0;return!c&&-1}}},function(r,i,s){var o=s(21),a=Math.min;r.exports=function(l){return l>0?a(o(l),9007199254740991):0}},function(r,i,s){var o=s(21),a=Math.max,l=Math.min;r.exports=function(c,u){return(c=o(c))<0?a(c+u,0):l(c,u)}},function(r,i,s){var o=s(3).document;r.exports=o&&o.documentElement},function(r,i,s){var o=s(5),a=s(18),l=s(25)("IE_PROTO"),c=Object.prototype;r.exports=Object.getPrototypeOf||function(u){return u=a(u),o(u,l)?u[l]:typeof u.constructor=="function"&&u instanceof u.constructor?u.constructor.prototype:u instanceof Object?c:null}},function(r,i,s){var o=s(63),a=s(64),l=s(12),c=s(9);r.exports=s(34)(Array,"Array",function(u,d){this._t=c(u),this._i=0,this._k=d},function(){var u=this._t,d=this._k,f=this._i++;return!u||f>=u.length?(this._t=void 0,a(1)):a(0,d=="keys"?f:d=="values"?u[f]:[f,u[f]])},"values"),l.Arguments=l.Array,o("keys"),o("values"),o("entries")},function(r,i){r.exports=function(){}},function(r,i){r.exports=function(s,o){return{value:o,done:!!s}}},function(r,i,s){r.exports={default:s(66),__esModule:!0}},function(r,i,s){s(67),s(73),s(74),s(75),r.exports=s(1).Symbol},function(r,i,s){var o=s(3),a=s(5),l=s(4),c=s(15),u=s(37),d=s(68).KEY,f=s(8),h=s(26),A=s(28),p=s(17),m=s(2),g=s(30),y=s(31),w=s(69),v=s(70),x=s(10),C=s(11),_=s(18),S=s(9),E=s(23),T=s(16),R=s(38),k=s(71),B=s(72),M=s(32),F=s(7),I=s(13),z=B.f,Y=F.f,$=k.f,ee=o.Symbol,W=o.JSON,ne=W&&W.stringify,Se=m("_hidden"),fe=m("toPrimitive"),ge={}.propertyIsEnumerable,Oe=h("symbol-registry"),Fe=h("symbols"),De=h("op-symbols"),ke=Object.prototype,Ge=typeof ee=="function"&&!!M.f,Ve=o.QObject,q=!Ve||!Ve.prototype||!Ve.prototype.findChild,Ue=l&&f(function(){return R(Y({},"a",{get:function(){return Y(this,"a",{value:7}).a}})).a!=7})?function(le,me,Le){var Te=z(ke,me);Te&&delete ke[me],Y(le,me,Le),Te&&le!==ke&&Y(ke,me,Te)}:Y,O=function(le){var me=Fe[le]=R(ee.prototype);return me._k=le,me},ve=Ge&&typeof ee.iterator=="symbol"?function(le){return typeof le=="symbol"}:function(le){return le instanceof ee},Ae=function(le,me,Le){return le===ke&&Ae(De,me,Le),x(le),me=E(me,!0),x(Le),a(Fe,me)?(Le.enumerable?(a(le,Se)&&le[Se][me]&&(le[Se][me]=!1),Le=R(Le,{enumerable:T(0,!1)})):(a(le,Se)||Y(le,Se,T(1,{})),le[Se][me]=!0),Ue(le,me,Le)):Y(le,me,Le)},ae=function(le,me){x(le);for(var Le,Te=w(me=S(me)),Pe=0,Qe=Te.length;Qe>Pe;)Ae(le,Le=Te[Pe++],me[Le]);return le},Z=function(le){var me=ge.call(this,le=E(le,!0));return!(this===ke&&a(Fe,le)&&!a(De,le))&&(!(me||!a(this,le)||!a(Fe,le)||a(this,Se)&&this[Se][le])||me)},pe=function(le,me){if(le=S(le),me=E(me,!0),le!==ke||!a(Fe,me)||a(De,me)){var Le=z(le,me);return!Le||!a(Fe,me)||a(le,Se)&&le[Se][me]||(Le.enumerable=!0),Le}},J=function(le){for(var me,Le=$(S(le)),Te=[],Pe=0;Le.length>Pe;)a(Fe,me=Le[Pe++])||me==Se||me==d||Te.push(me);return Te},H=function(le){for(var me,Le=le===ke,Te=$(Le?De:S(le)),Pe=[],Qe=0;Te.length>Qe;)!a(Fe,me=Te[Qe++])||Le&&!a(ke,me)||Pe.push(Fe[me]);return Pe};Ge||(u((ee=function(){if(this instanceof ee)throw TypeError("Symbol is not a constructor!");var le=p(arguments.length>0?arguments[0]:void 0),me=function(Le){this===ke&&me.call(De,Le),a(this,Se)&&a(this[Se],le)&&(this[Se][le]=!1),Ue(this,le,T(1,Le))};return l&&q&&Ue(ke,le,{configurable:!0,set:me}),O(le)}).prototype,"toString",function(){return this._k}),B.f=pe,F.f=Ae,s(41).f=k.f=J,s(19).f=Z,M.f=H,l&&!s(14)&&u(ke,"propertyIsEnumerable",Z,!0),g.f=function(le){return O(m(le))}),c(c.G+c.W+c.F*!Ge,{Symbol:ee});for(var oe="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),we=0;oe.length>we;)m(oe[we++]);for(var Ee=I(m.store),re=0;Ee.length>re;)y(Ee[re++]);c(c.S+c.F*!Ge,"Symbol",{for:function(le){return a(Oe,le+="")?Oe[le]:Oe[le]=ee(le)},keyFor:function(le){if(!ve(le))throw TypeError(le+" is not a symbol!");for(var me in Oe)if(Oe[me]===le)return me},useSetter:function(){q=!0},useSimple:function(){q=!1}}),c(c.S+c.F*!Ge,"Object",{create:function(le,me){return me===void 0?R(le):ae(R(le),me)},defineProperty:Ae,defineProperties:ae,getOwnPropertyDescriptor:pe,getOwnPropertyNames:J,getOwnPropertySymbols:H});var ce=f(function(){M.f(1)});c(c.S+c.F*ce,"Object",{getOwnPropertySymbols:function(le){return M.f(_(le))}}),W&&c(c.S+c.F*(!Ge||f(function(){var le=ee();return ne([le])!="[null]"||ne({a:le})!="{}"||ne(Object(le))!="{}"})),"JSON",{stringify:function(le){for(var me,Le,Te=[le],Pe=1;arguments.length>Pe;)Te.push(arguments[Pe++]);if(Le=me=Te[1],(C(me)||le!==void 0)&&!ve(le))return v(me)||(me=function(Qe,$e){if(typeof Le=="function"&&($e=Le.call(this,Qe,$e)),!ve($e))return $e}),Te[1]=me,ne.apply(W,Te)}}),ee.prototype[fe]||s(6)(ee.prototype,fe,ee.prototype.valueOf),A(ee,"Symbol"),A(Math,"Math",!0),A(o.JSON,"JSON",!0)},function(r,i,s){var o=s(17)("meta"),a=s(11),l=s(5),c=s(7).f,u=0,d=Object.isExtensible||function(){return!0},f=!s(8)(function(){return d(Object.preventExtensions({}))}),h=function(p){c(p,o,{value:{i:"O"+ ++u,w:{}}})},A=r.exports={KEY:o,NEED:!1,fastKey:function(p,m){if(!a(p))return typeof p=="symbol"?p:(typeof p=="string"?"S":"P")+p;if(!l(p,o)){if(!d(p))return"F";if(!m)return"E";h(p)}return p[o].i},getWeak:function(p,m){if(!l(p,o)){if(!d(p))return!0;if(!m)return!1;h(p)}return p[o].w},onFreeze:function(p){return f&&A.NEED&&d(p)&&!l(p,o)&&h(p),p}}},function(r,i,s){var o=s(13),a=s(32),l=s(19);r.exports=function(c){var u=o(c),d=a.f;if(d)for(var f,h=d(c),A=l.f,p=0;h.length>p;)A.call(c,f=h[p++])&&u.push(f);return u}},function(r,i,s){var o=s(24);r.exports=Array.isArray||function(a){return o(a)=="Array"}},function(r,i,s){var o=s(9),a=s(41).f,l={}.toString,c=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];r.exports.f=function(u){return c&&l.call(u)=="[object Window]"?function(d){try{return a(d)}catch{return c.slice()}}(u):a(o(u))}},function(r,i,s){var o=s(19),a=s(16),l=s(9),c=s(23),u=s(5),d=s(35),f=Object.getOwnPropertyDescriptor;i.f=s(4)?f:function(h,A){if(h=l(h),A=c(A,!0),d)try{return f(h,A)}catch{}if(u(h,A))return a(!o.f.call(h,A),h[A])}},function(r,i){},function(r,i,s){s(31)("asyncIterator")},function(r,i,s){s(31)("observable")},function(r,i,s){i.__esModule=!0;var o,a=s(77),l=(o=a)&&o.__esModule?o:{default:o};i.default=l.default||function(c){for(var u=1;u<arguments.length;u++){var d=arguments[u];for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&(c[f]=d[f])}return c}},function(r,i,s){r.exports={default:s(78),__esModule:!0}},function(r,i,s){s(79),r.exports=s(1).Object.assign},function(r,i,s){var o=s(15);o(o.S+o.F,"Object",{assign:s(80)})},function(r,i,s){var o=s(4),a=s(13),l=s(32),c=s(19),u=s(18),d=s(40),f=Object.assign;r.exports=!f||s(8)(function(){var h={},A={},p=Symbol(),m="abcdefghijklmnopqrst";return h[p]=7,m.split("").forEach(function(g){A[g]=g}),f({},h)[p]!=7||Object.keys(f({},A)).join("")!=m})?function(h,A){for(var p=u(h),m=arguments.length,g=1,y=l.f,w=c.f;m>g;)for(var v,x=d(arguments[g++]),C=y?a(x).concat(y(x)):a(x),_=C.length,S=0;_>S;)v=C[S++],o&&!w.call(x,v)||(p[v]=x[v]);return p}:f},function(r,i,s){i.__esModule=!0;var o=l(s(82)),a=l(s(85));function l(c){return c&&c.__esModule?c:{default:c}}i.default=function(c,u){if(Array.isArray(c))return c;if((0,o.default)(Object(c)))return function(d,f){var h=[],A=!0,p=!1,m=void 0;try{for(var g,y=(0,a.default)(d);!(A=(g=y.next()).done)&&(h.push(g.value),!f||h.length!==f);A=!0);}catch(w){p=!0,m=w}finally{try{!A&&y.return&&y.return()}finally{if(p)throw m}}return h}(c,u);throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(r,i,s){r.exports={default:s(83),__esModule:!0}},function(r,i,s){s(29),s(20),r.exports=s(84)},function(r,i,s){var o=s(42),a=s(2)("iterator"),l=s(12);r.exports=s(1).isIterable=function(c){var u=Object(c);return u[a]!==void 0||"@@iterator"in u||l.hasOwnProperty(o(u))}},function(r,i,s){r.exports={default:s(86),__esModule:!0}},function(r,i,s){s(29),s(20),r.exports=s(87)},function(r,i,s){var o=s(10),a=s(88);r.exports=s(1).getIterator=function(l){var c=a(l);if(typeof c!="function")throw TypeError(l+" is not iterable!");return o(c.call(l))}},function(r,i,s){var o=s(42),a=s(2)("iterator"),l=s(12);r.exports=s(1).getIteratorMethod=function(c){if(c!=null)return c[a]||c["@@iterator"]||l[o(c)]}},function(r,i,s){r.exports={default:s(90),__esModule:!0}},function(r,i,s){s(91),r.exports=s(1).Object.keys},function(r,i,s){var o=s(18),a=s(13);s(92)("keys",function(){return function(l){return a(o(l))}})},function(r,i,s){var o=s(15),a=s(1),l=s(8);r.exports=function(c,u){var d=(a.Object||{})[c]||Object[c],f={};f[c]=u(d),o(o.S+o.F*l(function(){d(1)}),"Object",f)}},function(r,i,s){(function(o){var a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],l=/^\s+|\s+$/g,c=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,u=/\{\n\/\* \[wrapped with (.+)\] \*/,d=/,? & /,f=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,A=/^\[object .+?Constructor\]$/,p=/^0o[0-7]+$/i,m=/^(?:0|[1-9]\d*)$/,g=parseInt,y=typeof o=="object"&&o&&o.Object===Object&&o,w=typeof self=="object"&&self&&self.Object===Object&&self,v=y||w||Function("return this")();function x(re,ce,le){switch(le.length){case 0:return re.call(ce);case 1:return re.call(ce,le[0]);case 2:return re.call(ce,le[0],le[1]);case 3:return re.call(ce,le[0],le[1],le[2])}return re.apply(ce,le)}function C(re,ce){return!!(re&&re.length)&&function(le,me,Le){if(me!=me)return function(Qe,$e,et,st){for(var dt=Qe.length,Mt=et+-1;++Mt<dt;)if($e(Qe[Mt],Mt,Qe))return Mt;return-1}(le,_,Le);for(var Te=Le-1,Pe=le.length;++Te<Pe;)if(le[Te]===me)return Te;return-1}(re,ce,0)>-1}function _(re){return re!=re}function S(re,ce){for(var le=re.length,me=0;le--;)re[le]===ce&&me++;return me}function E(re,ce){for(var le=-1,me=re.length,Le=0,Te=[];++le<me;){var Pe=re[le];Pe!==ce&&Pe!=="__lodash_placeholder__"||(re[le]="__lodash_placeholder__",Te[Le++]=le)}return Te}var T,R,k,B=Function.prototype,M=Object.prototype,F=v["__core-js_shared__"],I=(T=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||""))?"Symbol(src)_1."+T:"",z=B.toString,Y=M.hasOwnProperty,$=M.toString,ee=RegExp("^"+z.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),W=Object.create,ne=Math.max,Se=Math.min,fe=(R=O(Object,"defineProperty"),(k=O.name)&&k.length>2?R:void 0);function ge(re){return oe(re)?W(re):{}}function Oe(re){return!(!oe(re)||function(ce){return!!I&&I in ce}(re))&&(function(ce){var le=oe(ce)?$.call(ce):"";return le=="[object Function]"||le=="[object GeneratorFunction]"}(re)||function(ce){var le=!1;if(ce!=null&&typeof ce.toString!="function")try{le=!!(ce+"")}catch{}return le}(re)?ee:A).test(function(ce){if(ce!=null){try{return z.call(ce)}catch{}try{return ce+""}catch{}}return""}(re))}function Fe(re,ce,le,me){for(var Le=-1,Te=re.length,Pe=le.length,Qe=-1,$e=ce.length,et=ne(Te-Pe,0),st=Array($e+et),dt=!me;++Qe<$e;)st[Qe]=ce[Qe];for(;++Le<Pe;)(dt||Le<Te)&&(st[le[Le]]=re[Le]);for(;et--;)st[Qe++]=re[Le++];return st}function De(re,ce,le,me){for(var Le=-1,Te=re.length,Pe=-1,Qe=le.length,$e=-1,et=ce.length,st=ne(Te-Qe,0),dt=Array(st+et),Mt=!me;++Le<st;)dt[Le]=re[Le];for(var K=Le;++$e<et;)dt[K+$e]=ce[$e];for(;++Pe<Qe;)(Mt||Le<Te)&&(dt[K+le[Pe]]=re[Le++]);return dt}function ke(re){return function(){var ce=arguments;switch(ce.length){case 0:return new re;case 1:return new re(ce[0]);case 2:return new re(ce[0],ce[1]);case 3:return new re(ce[0],ce[1],ce[2]);case 4:return new re(ce[0],ce[1],ce[2],ce[3]);case 5:return new re(ce[0],ce[1],ce[2],ce[3],ce[4]);case 6:return new re(ce[0],ce[1],ce[2],ce[3],ce[4],ce[5]);case 7:return new re(ce[0],ce[1],ce[2],ce[3],ce[4],ce[5],ce[6])}var le=ge(re.prototype),me=re.apply(le,ce);return oe(me)?me:le}}function Ge(re,ce,le,me,Le,Te,Pe,Qe,$e,et){var st=128&ce,dt=1&ce,Mt=2&ce,K=24&ce,Be=512&ce,Re=Mt?void 0:ke(re);return function Me(){for(var We=arguments.length,Je=Array(We),ht=We;ht--;)Je[ht]=arguments[ht];if(K)var Gt=Ue(Me),tn=S(Je,Gt);if(me&&(Je=Fe(Je,me,Le,K)),Te&&(Je=De(Je,Te,Pe,K)),We-=tn,K&&We<et){var Ft=E(Je,Gt);return Ve(re,ce,Ge,Me.placeholder,le,Je,Ft,Qe,$e,et-We)}var Dt=dt?le:this,zt=Mt?Dt[re]:re;return We=Je.length,Qe?Je=Z(Je,Qe):Be&&We>1&&Je.reverse(),st&&$e<We&&(Je.length=$e),this&&this!==v&&this instanceof Me&&(zt=Re||ke(zt)),zt.apply(Dt,Je)}}function Ve(re,ce,le,me,Le,Te,Pe,Qe,$e,et){var st=8&ce;ce|=st?32:64,4&(ce&=~(st?64:32))||(ce&=-4);var dt=le(re,ce,Le,st?Te:void 0,st?Pe:void 0,st?void 0:Te,st?void 0:Pe,Qe,$e,et);return dt.placeholder=me,pe(dt,re,ce)}function q(re,ce,le,me,Le,Te,Pe,Qe){var $e=2&ce;if(!$e&&typeof re!="function")throw new TypeError("Expected a function");var et=me?me.length:0;if(et||(ce&=-97,me=Le=void 0),Pe=Pe===void 0?Pe:ne(Ee(Pe),0),Qe=Qe===void 0?Qe:Ee(Qe),et-=Le?Le.length:0,64&ce){var st=me,dt=Le;me=Le=void 0}var Mt=[re,ce,le,me,Le,st,dt,Te,Pe,Qe];if(re=Mt[0],ce=Mt[1],le=Mt[2],me=Mt[3],Le=Mt[4],!(Qe=Mt[9]=Mt[9]==null?$e?0:re.length:ne(Mt[9]-et,0))&&24&ce&&(ce&=-25),ce&&ce!=1)K=ce==8||ce==16?function(Be,Re,Me){var We=ke(Be);return function Je(){for(var ht=arguments.length,Gt=Array(ht),tn=ht,Ft=Ue(Je);tn--;)Gt[tn]=arguments[tn];var Dt=ht<3&&Gt[0]!==Ft&&Gt[ht-1]!==Ft?[]:E(Gt,Ft);if((ht-=Dt.length)<Me)return Ve(Be,Re,Ge,Je.placeholder,void 0,Gt,Dt,void 0,void 0,Me-ht);var zt=this&&this!==v&&this instanceof Je?We:Be;return x(zt,this,Gt)}}(re,ce,Qe):ce!=32&&ce!=33||Le.length?Ge.apply(void 0,Mt):function(Be,Re,Me,We){var Je=1&Re,ht=ke(Be);return function Gt(){for(var tn=-1,Ft=arguments.length,Dt=-1,zt=We.length,tr=Array(zt+Ft),wn=this&&this!==v&&this instanceof Gt?ht:Be;++Dt<zt;)tr[Dt]=We[Dt];for(;Ft--;)tr[Dt++]=arguments[++tn];return x(wn,Je?Me:this,tr)}}(re,ce,le,me);else var K=function(Be,Re,Me){var We=1&Re,Je=ke(Be);return function ht(){var Gt=this&&this!==v&&this instanceof ht?Je:Be;return Gt.apply(We?Me:this,arguments)}}(re,ce,le);return pe(K,re,ce)}function Ue(re){return re.placeholder}function O(re,ce){var le=function(me,Le){return me==null?void 0:me[Le]}(re,ce);return Oe(le)?le:void 0}function ve(re){var ce=re.match(u);return ce?ce[1].split(d):[]}function Ae(re,ce){var le=ce.length,me=le-1;return ce[me]=(le>1?"& ":"")+ce[me],ce=ce.join(le>2?", ":" "),re.replace(c,`{
/* [wrapped with `+ce+`] */
`)}function ae(re,ce){return!!(ce=ce??9007199254740991)&&(typeof re=="number"||m.test(re))&&re>-1&&re%1==0&&re<ce}function Z(re,ce){for(var le=re.length,me=Se(ce.length,le),Le=function(Pe,Qe){var $e=-1,et=Pe.length;for(Qe||(Qe=Array(et));++$e<et;)Qe[$e]=Pe[$e];return Qe}(re);me--;){var Te=ce[me];re[me]=ae(Te,le)?Le[Te]:void 0}return re}var pe=fe?function(re,ce,le){var me,Le=ce+"";return fe(re,"toString",{configurable:!0,enumerable:!1,value:(me=Ae(Le,J(ve(Le),le)),function(){return me})})}:function(re){return re};function J(re,ce){return function(le,me){for(var Le=-1,Te=le?le.length:0;++Le<Te&&me(le[Le],Le,le)!==!1;);}(a,function(le){var me="_."+le[0];ce&le[1]&&!C(re,me)&&re.push(me)}),re.sort()}function H(re,ce,le){var me=q(re,8,void 0,void 0,void 0,void 0,void 0,ce=le?void 0:ce);return me.placeholder=H.placeholder,me}function oe(re){var ce=typeof re;return!!re&&(ce=="object"||ce=="function")}function we(re){return re?(re=function(ce){if(typeof ce=="number")return ce;if(function(Le){return typeof Le=="symbol"||function(Te){return!!Te&&typeof Te=="object"}(Le)&&$.call(Le)=="[object Symbol]"}(ce))return NaN;if(oe(ce)){var le=typeof ce.valueOf=="function"?ce.valueOf():ce;ce=oe(le)?le+"":le}if(typeof ce!="string")return ce===0?ce:+ce;ce=ce.replace(l,"");var me=h.test(ce);return me||p.test(ce)?g(ce.slice(2),me?2:8):f.test(ce)?NaN:+ce}(re))===1/0||re===-1/0?17976931348623157e292*(re<0?-1:1):re==re?re:0:re===0?re:0}function Ee(re){var ce=we(re),le=ce%1;return ce==ce?le?ce-le:ce:0}H.placeholder={},r.exports=H}).call(this,s(43))},function(r,i,s){function o(De){return De&&De.__esModule?De.default:De}i.__esModule=!0;var a=s(95);i.threezerotwofour=o(a);var l=s(96);i.apathy=o(l);var c=s(97);i.ashes=o(c);var u=s(98);i.atelierDune=o(u);var d=s(99);i.atelierForest=o(d);var f=s(100);i.atelierHeath=o(f);var h=s(101);i.atelierLakeside=o(h);var A=s(102);i.atelierSeaside=o(A);var p=s(103);i.bespin=o(p);var m=s(104);i.brewer=o(m);var g=s(105);i.bright=o(g);var y=s(106);i.chalk=o(y);var w=s(107);i.codeschool=o(w);var v=s(108);i.colors=o(v);var x=s(109);i.default=o(x);var C=s(110);i.eighties=o(C);var _=s(111);i.embers=o(_);var S=s(112);i.flat=o(S);var E=s(113);i.google=o(E);var T=s(114);i.grayscale=o(T);var R=s(115);i.greenscreen=o(R);var k=s(116);i.harmonic=o(k);var B=s(117);i.hopscotch=o(B);var M=s(118);i.isotope=o(M);var F=s(119);i.marrakesh=o(F);var I=s(120);i.mocha=o(I);var z=s(121);i.monokai=o(z);var Y=s(122);i.ocean=o(Y);var $=s(123);i.paraiso=o($);var ee=s(124);i.pop=o(ee);var W=s(125);i.railscasts=o(W);var ne=s(126);i.shapeshifter=o(ne);var Se=s(127);i.solarized=o(Se);var fe=s(128);i.summerfruit=o(fe);var ge=s(129);i.tomorrow=o(ge);var Oe=s(130);i.tube=o(Oe);var Fe=s(131);i.twilight=o(Fe)},function(r,i,s){i.__esModule=!0,i.default={scheme:"threezerotwofour",author:"jan t. sott (http://github.com/idleberg)",base00:"#090300",base01:"#3a3432",base02:"#4a4543",base03:"#5c5855",base04:"#807d7c",base05:"#a5a2a2",base06:"#d6d5d4",base07:"#f7f7f7",base08:"#db2d20",base09:"#e8bbd0",base0A:"#fded02",base0B:"#01a252",base0C:"#b5e4f4",base0D:"#01a0e4",base0E:"#a16a94",base0F:"#cdab53"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"apathy",author:"jannik siebert (https://github.com/janniks)",base00:"#031A16",base01:"#0B342D",base02:"#184E45",base03:"#2B685E",base04:"#5F9C92",base05:"#81B5AC",base06:"#A7CEC8",base07:"#D2E7E4",base08:"#3E9688",base09:"#3E7996",base0A:"#3E4C96",base0B:"#883E96",base0C:"#963E4C",base0D:"#96883E",base0E:"#4C963E",base0F:"#3E965B"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"ashes",author:"jannik siebert (https://github.com/janniks)",base00:"#1C2023",base01:"#393F45",base02:"#565E65",base03:"#747C84",base04:"#ADB3BA",base05:"#C7CCD1",base06:"#DFE2E5",base07:"#F3F4F5",base08:"#C7AE95",base09:"#C7C795",base0A:"#AEC795",base0B:"#95C7AE",base0C:"#95AEC7",base0D:"#AE95C7",base0E:"#C795AE",base0F:"#C79595"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"atelier dune",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)",base00:"#20201d",base01:"#292824",base02:"#6e6b5e",base03:"#7d7a68",base04:"#999580",base05:"#a6a28c",base06:"#e8e4cf",base07:"#fefbec",base08:"#d73737",base09:"#b65611",base0A:"#cfb017",base0B:"#60ac39",base0C:"#1fad83",base0D:"#6684e1",base0E:"#b854d4",base0F:"#d43552"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"atelier forest",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest)",base00:"#1b1918",base01:"#2c2421",base02:"#68615e",base03:"#766e6b",base04:"#9c9491",base05:"#a8a19f",base06:"#e6e2e0",base07:"#f1efee",base08:"#f22c40",base09:"#df5320",base0A:"#d5911a",base0B:"#5ab738",base0C:"#00ad9c",base0D:"#407ee7",base0E:"#6666ea",base0F:"#c33ff3"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"atelier heath",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath)",base00:"#1b181b",base01:"#292329",base02:"#695d69",base03:"#776977",base04:"#9e8f9e",base05:"#ab9bab",base06:"#d8cad8",base07:"#f7f3f7",base08:"#ca402b",base09:"#a65926",base0A:"#bb8a35",base0B:"#379a37",base0C:"#159393",base0D:"#516aec",base0E:"#7b59c0",base0F:"#cc33cc"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"atelier lakeside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/)",base00:"#161b1d",base01:"#1f292e",base02:"#516d7b",base03:"#5a7b8c",base04:"#7195a8",base05:"#7ea2b4",base06:"#c1e4f6",base07:"#ebf8ff",base08:"#d22d72",base09:"#935c25",base0A:"#8a8a0f",base0B:"#568c3b",base0C:"#2d8f6f",base0D:"#257fad",base0E:"#5d5db1",base0F:"#b72dd2"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"atelier seaside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/)",base00:"#131513",base01:"#242924",base02:"#5e6e5e",base03:"#687d68",base04:"#809980",base05:"#8ca68c",base06:"#cfe8cf",base07:"#f0fff0",base08:"#e6193c",base09:"#87711d",base0A:"#c3c322",base0B:"#29a329",base0C:"#1999b3",base0D:"#3d62f5",base0E:"#ad2bee",base0F:"#e619c3"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"bespin",author:"jan t. sott",base00:"#28211c",base01:"#36312e",base02:"#5e5d5c",base03:"#666666",base04:"#797977",base05:"#8a8986",base06:"#9d9b97",base07:"#baae9e",base08:"#cf6a4c",base09:"#cf7d34",base0A:"#f9ee98",base0B:"#54be0d",base0C:"#afc4db",base0D:"#5ea6ea",base0E:"#9b859d",base0F:"#937121"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"brewer",author:"timothée poisot (http://github.com/tpoisot)",base00:"#0c0d0e",base01:"#2e2f30",base02:"#515253",base03:"#737475",base04:"#959697",base05:"#b7b8b9",base06:"#dadbdc",base07:"#fcfdfe",base08:"#e31a1c",base09:"#e6550d",base0A:"#dca060",base0B:"#31a354",base0C:"#80b1d3",base0D:"#3182bd",base0E:"#756bb1",base0F:"#b15928"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"bright",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#303030",base02:"#505050",base03:"#b0b0b0",base04:"#d0d0d0",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ffffff",base08:"#fb0120",base09:"#fc6d24",base0A:"#fda331",base0B:"#a1c659",base0C:"#76c7b7",base0D:"#6fb3d2",base0E:"#d381c3",base0F:"#be643c"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"chalk",author:"chris kempson (http://chriskempson.com)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#f5f5f5",base08:"#fb9fb1",base09:"#eda987",base0A:"#ddb26f",base0B:"#acc267",base0C:"#12cfc0",base0D:"#6fc2ef",base0E:"#e1a3ee",base0F:"#deaf8f"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"codeschool",author:"brettof86",base00:"#232c31",base01:"#1c3657",base02:"#2a343a",base03:"#3f4944",base04:"#84898c",base05:"#9ea7a6",base06:"#a7cfa3",base07:"#b5d8f6",base08:"#2a5491",base09:"#43820d",base0A:"#a03b1e",base0B:"#237986",base0C:"#b02f30",base0D:"#484d79",base0E:"#c59820",base0F:"#c98344"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"colors",author:"mrmrs (http://clrs.cc)",base00:"#111111",base01:"#333333",base02:"#555555",base03:"#777777",base04:"#999999",base05:"#bbbbbb",base06:"#dddddd",base07:"#ffffff",base08:"#ff4136",base09:"#ff851b",base0A:"#ffdc00",base0B:"#2ecc40",base0C:"#7fdbff",base0D:"#0074d9",base0E:"#b10dc9",base0F:"#85144b"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"default",author:"chris kempson (http://chriskempson.com)",base00:"#181818",base01:"#282828",base02:"#383838",base03:"#585858",base04:"#b8b8b8",base05:"#d8d8d8",base06:"#e8e8e8",base07:"#f8f8f8",base08:"#ab4642",base09:"#dc9656",base0A:"#f7ca88",base0B:"#a1b56c",base0C:"#86c1b9",base0D:"#7cafc2",base0E:"#ba8baf",base0F:"#a16946"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"eighties",author:"chris kempson (http://chriskempson.com)",base00:"#2d2d2d",base01:"#393939",base02:"#515151",base03:"#747369",base04:"#a09f93",base05:"#d3d0c8",base06:"#e8e6df",base07:"#f2f0ec",base08:"#f2777a",base09:"#f99157",base0A:"#ffcc66",base0B:"#99cc99",base0C:"#66cccc",base0D:"#6699cc",base0E:"#cc99cc",base0F:"#d27b53"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"embers",author:"jannik siebert (https://github.com/janniks)",base00:"#16130F",base01:"#2C2620",base02:"#433B32",base03:"#5A5047",base04:"#8A8075",base05:"#A39A90",base06:"#BEB6AE",base07:"#DBD6D1",base08:"#826D57",base09:"#828257",base0A:"#6D8257",base0B:"#57826D",base0C:"#576D82",base0D:"#6D5782",base0E:"#82576D",base0F:"#825757"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"flat",author:"chris kempson (http://chriskempson.com)",base00:"#2C3E50",base01:"#34495E",base02:"#7F8C8D",base03:"#95A5A6",base04:"#BDC3C7",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ECF0F1",base08:"#E74C3C",base09:"#E67E22",base0A:"#F1C40F",base0B:"#2ECC71",base0C:"#1ABC9C",base0D:"#3498DB",base0E:"#9B59B6",base0F:"#be643c"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"google",author:"seth wright (http://sethawright.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#CC342B",base09:"#F96A38",base0A:"#FBA922",base0B:"#198844",base0C:"#3971ED",base0D:"#3971ED",base0E:"#A36AC7",base0F:"#3971ED"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"grayscale",author:"alexandre gavioli (https://github.com/alexx2/)",base00:"#101010",base01:"#252525",base02:"#464646",base03:"#525252",base04:"#ababab",base05:"#b9b9b9",base06:"#e3e3e3",base07:"#f7f7f7",base08:"#7c7c7c",base09:"#999999",base0A:"#a0a0a0",base0B:"#8e8e8e",base0C:"#868686",base0D:"#686868",base0E:"#747474",base0F:"#5e5e5e"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"green screen",author:"chris kempson (http://chriskempson.com)",base00:"#001100",base01:"#003300",base02:"#005500",base03:"#007700",base04:"#009900",base05:"#00bb00",base06:"#00dd00",base07:"#00ff00",base08:"#007700",base09:"#009900",base0A:"#007700",base0B:"#00bb00",base0C:"#005500",base0D:"#009900",base0E:"#00bb00",base0F:"#005500"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"harmonic16",author:"jannik siebert (https://github.com/janniks)",base00:"#0b1c2c",base01:"#223b54",base02:"#405c79",base03:"#627e99",base04:"#aabcce",base05:"#cbd6e2",base06:"#e5ebf1",base07:"#f7f9fb",base08:"#bf8b56",base09:"#bfbf56",base0A:"#8bbf56",base0B:"#56bf8b",base0C:"#568bbf",base0D:"#8b56bf",base0E:"#bf568b",base0F:"#bf5656"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"hopscotch",author:"jan t. sott",base00:"#322931",base01:"#433b42",base02:"#5c545b",base03:"#797379",base04:"#989498",base05:"#b9b5b8",base06:"#d5d3d5",base07:"#ffffff",base08:"#dd464c",base09:"#fd8b19",base0A:"#fdcc59",base0B:"#8fc13e",base0C:"#149b93",base0D:"#1290bf",base0E:"#c85e7c",base0F:"#b33508"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"isotope",author:"jan t. sott",base00:"#000000",base01:"#404040",base02:"#606060",base03:"#808080",base04:"#c0c0c0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#ff0000",base09:"#ff9900",base0A:"#ff0099",base0B:"#33ff00",base0C:"#00ffff",base0D:"#0066ff",base0E:"#cc00ff",base0F:"#3300ff"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"marrakesh",author:"alexandre gavioli (http://github.com/alexx2/)",base00:"#201602",base01:"#302e00",base02:"#5f5b17",base03:"#6c6823",base04:"#86813b",base05:"#948e48",base06:"#ccc37a",base07:"#faf0a5",base08:"#c35359",base09:"#b36144",base0A:"#a88339",base0B:"#18974e",base0C:"#75a738",base0D:"#477ca1",base0E:"#8868b3",base0F:"#b3588e"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"mocha",author:"chris kempson (http://chriskempson.com)",base00:"#3B3228",base01:"#534636",base02:"#645240",base03:"#7e705a",base04:"#b8afad",base05:"#d0c8c6",base06:"#e9e1dd",base07:"#f5eeeb",base08:"#cb6077",base09:"#d28b71",base0A:"#f4bc87",base0B:"#beb55b",base0C:"#7bbda4",base0D:"#8ab3b5",base0E:"#a89bb9",base0F:"#bb9584"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"monokai",author:"wimer hazenberg (http://www.monokai.nl)",base00:"#272822",base01:"#383830",base02:"#49483e",base03:"#75715e",base04:"#a59f85",base05:"#f8f8f2",base06:"#f5f4f1",base07:"#f9f8f5",base08:"#f92672",base09:"#fd971f",base0A:"#f4bf75",base0B:"#a6e22e",base0C:"#a1efe4",base0D:"#66d9ef",base0E:"#ae81ff",base0F:"#cc6633"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"ocean",author:"chris kempson (http://chriskempson.com)",base00:"#2b303b",base01:"#343d46",base02:"#4f5b66",base03:"#65737e",base04:"#a7adba",base05:"#c0c5ce",base06:"#dfe1e8",base07:"#eff1f5",base08:"#bf616a",base09:"#d08770",base0A:"#ebcb8b",base0B:"#a3be8c",base0C:"#96b5b4",base0D:"#8fa1b3",base0E:"#b48ead",base0F:"#ab7967"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"paraiso",author:"jan t. sott",base00:"#2f1e2e",base01:"#41323f",base02:"#4f424c",base03:"#776e71",base04:"#8d8687",base05:"#a39e9b",base06:"#b9b6b0",base07:"#e7e9db",base08:"#ef6155",base09:"#f99b15",base0A:"#fec418",base0B:"#48b685",base0C:"#5bc4bf",base0D:"#06b6ef",base0E:"#815ba4",base0F:"#e96ba8"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"pop",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#eb008a",base09:"#f29333",base0A:"#f8ca12",base0B:"#37b349",base0C:"#00aabb",base0D:"#0e5a94",base0E:"#b31e8d",base0F:"#7a2d00"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"railscasts",author:"ryan bates (http://railscasts.com)",base00:"#2b2b2b",base01:"#272935",base02:"#3a4055",base03:"#5a647e",base04:"#d4cfc9",base05:"#e6e1dc",base06:"#f4f1ed",base07:"#f9f7f3",base08:"#da4939",base09:"#cc7833",base0A:"#ffc66d",base0B:"#a5c261",base0C:"#519f50",base0D:"#6d9cbe",base0E:"#b6b3eb",base0F:"#bc9458"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"shapeshifter",author:"tyler benziger (http://tybenz.com)",base00:"#000000",base01:"#040404",base02:"#102015",base03:"#343434",base04:"#555555",base05:"#ababab",base06:"#e0e0e0",base07:"#f9f9f9",base08:"#e92f2f",base09:"#e09448",base0A:"#dddd13",base0B:"#0ed839",base0C:"#23edda",base0D:"#3b48e3",base0E:"#f996e2",base0F:"#69542d"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"solarized",author:"ethan schoonover (http://ethanschoonover.com/solarized)",base00:"#002b36",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"summerfruit",author:"christopher corley (http://cscorley.github.io/)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#B0B0B0",base05:"#D0D0D0",base06:"#E0E0E0",base07:"#FFFFFF",base08:"#FF0086",base09:"#FD8900",base0A:"#ABA800",base0B:"#00C918",base0C:"#1faaaa",base0D:"#3777E6",base0E:"#AD00A1",base0F:"#cc6633"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"tomorrow",author:"chris kempson (http://chriskempson.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#cc6666",base09:"#de935f",base0A:"#f0c674",base0B:"#b5bd68",base0C:"#8abeb7",base0D:"#81a2be",base0E:"#b294bb",base0F:"#a3685a"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"london tube",author:"jan t. sott",base00:"#231f20",base01:"#1c3f95",base02:"#5a5758",base03:"#737171",base04:"#959ca1",base05:"#d9d8d8",base06:"#e7e7e8",base07:"#ffffff",base08:"#ee2e24",base09:"#f386a1",base0A:"#ffd204",base0B:"#00853e",base0C:"#85cebc",base0D:"#009ddc",base0E:"#98005d",base0F:"#b06110"},r.exports=i.default},function(r,i,s){i.__esModule=!0,i.default={scheme:"twilight",author:"david hart (http://hart-dev.com)",base00:"#1e1e1e",base01:"#323537",base02:"#464b50",base03:"#5f5a60",base04:"#838184",base05:"#a7a7a7",base06:"#c3c3c3",base07:"#ffffff",base08:"#cf6a4c",base09:"#cda869",base0A:"#f9ee98",base0B:"#8f9d6a",base0C:"#afc4db",base0D:"#7587a6",base0E:"#9b859d",base0F:"#9b703f"},r.exports=i.default},function(r,i,s){var o=s(33);function a(l){var c=Math.round(o(l,0,255)).toString(16);return c.length==1?"0"+c:c}r.exports=function(l){var c=l.length===4?a(255*l[3]):"";return"#"+a(l[0])+a(l[1])+a(l[2])+c}},function(r,i,s){var o=s(134),a=s(135),l=s(136),c=s(137),u={"#":a,hsl:function(f){var h=o(f),A=c(h);return h.length===4&&A.push(h[3]),A},rgb:l};function d(f){for(var h in u)if(f.indexOf(h)===0)return u[h](f)}d.rgb=l,d.hsl=o,d.hex=a,r.exports=d},function(r,i,s){var o=s(44),a=s(33);function l(c,u){switch(c=parseFloat(c),u){case 0:return a(c,0,360);case 1:case 2:return a(c,0,100);case 3:return a(c,0,1)}}r.exports=function(c){return o(c).map(l)}},function(r,i){r.exports=function(s){s.length!==4&&s.length!==5||(s=function(l){for(var c="#",u=1;u<l.length;u++){var d=l.charAt(u);c+=d+d}return c}(s));var o=[parseInt(s.substring(1,3),16),parseInt(s.substring(3,5),16),parseInt(s.substring(5,7),16)];if(s.length===9){var a=parseFloat((parseInt(s.substring(7,9),16)/255).toFixed(2));o.push(a)}return o}},function(r,i,s){var o=s(44),a=s(33);function l(c,u){return u<3?c.indexOf("%")!=-1?Math.round(255*a(parseInt(c,10),0,100)/100):a(parseInt(c,10),0,255):a(parseFloat(c),0,1)}r.exports=function(c){return o(c).map(l)}},function(r,i){r.exports=function(s){var o,a,l,c,u,d=s[0]/360,f=s[1]/100,h=s[2]/100;if(f==0)return[u=255*h,u,u];o=2*h-(a=h<.5?h*(1+f):h+f-h*f),c=[0,0,0];for(var A=0;A<3;A++)(l=d+1/3*-(A-1))<0&&l++,l>1&&l--,u=6*l<1?o+6*(a-o)*l:2*l<1?a:3*l<2?o+(a-o)*(2/3-l)*6:o,c[A]=255*u;return c}},function(r,i,s){(function(o){var a=typeof o=="object"&&o&&o.Object===Object&&o,l=typeof self=="object"&&self&&self.Object===Object&&self,c=a||l||Function("return this")();function u(E,T,R){switch(R.length){case 0:return E.call(T);case 1:return E.call(T,R[0]);case 2:return E.call(T,R[0],R[1]);case 3:return E.call(T,R[0],R[1],R[2])}return E.apply(T,R)}function d(E,T){for(var R=-1,k=T.length,B=E.length;++R<k;)E[B+R]=T[R];return E}var f=Object.prototype,h=f.hasOwnProperty,A=f.toString,p=c.Symbol,m=f.propertyIsEnumerable,g=p?p.isConcatSpreadable:void 0,y=Math.max;function w(E){return v(E)||function(T){return function(R){return function(k){return!!k&&typeof k=="object"}(R)&&function(k){return k!=null&&function(B){return typeof B=="number"&&B>-1&&B%1==0&&B<=9007199254740991}(k.length)&&!function(B){var M=function(F){var I=typeof F;return!!F&&(I=="object"||I=="function")}(B)?A.call(B):"";return M=="[object Function]"||M=="[object GeneratorFunction]"}(k)}(R)}(T)&&h.call(T,"callee")&&(!m.call(T,"callee")||A.call(T)=="[object Arguments]")}(E)||!!(g&&E&&E[g])}var v=Array.isArray,x,C,_,S=(C=function(E){var T=(E=function(B,M,F,I,z){var Y=-1,$=B.length;for(F||(F=w),z||(z=[]);++Y<$;){var ee=B[Y];F(ee)?d(z,ee):z[z.length]=ee}return z}(E)).length,R=T;for(x;R--;)if(typeof E[R]!="function")throw new TypeError("Expected a function");return function(){for(var k=0,B=T?E[k].apply(this,arguments):arguments[0];++k<T;)B=E[k].call(this,B);return B}},_=y(_===void 0?C.length-1:_,0),function(){for(var E=arguments,T=-1,R=y(E.length-_,0),k=Array(R);++T<R;)k[T]=E[_+T];T=-1;for(var B=Array(_+1);++T<_;)B[T]=E[T];return B[_]=k,u(C,this,B)});r.exports=S}).call(this,s(43))},function(r,i,s){Object.defineProperty(i,"__esModule",{value:!0}),i.yuv2rgb=function(o){var a,l,c,u=o[0],d=o[1],f=o[2];return a=1*u+0*d+1.13983*f,l=1*u+-.39465*d+-.5806*f,c=1*u+2.02311*d+0*f,a=Math.min(Math.max(0,a),1),l=Math.min(Math.max(0,l),1),c=Math.min(Math.max(0,c),1),[255*a,255*l,255*c]},i.rgb2yuv=function(o){var a=o[0]/255,l=o[1]/255,c=o[2]/255;return[.299*a+.587*l+.114*c,-.14713*a+-.28886*l+.436*c,.615*a+-.51499*l+-.10001*c]}},function(r,i,s){function o(c,u,d){return u in c?Object.defineProperty(c,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):c[u]=d,c}var a=s(141),l=function(){function c(){o(this,"_callbacks",void 0),o(this,"_isDispatching",void 0),o(this,"_isHandled",void 0),o(this,"_isPending",void 0),o(this,"_lastID",void 0),o(this,"_pendingPayload",void 0),this._callbacks={},this._isDispatching=!1,this._isHandled={},this._isPending={},this._lastID=1}var u=c.prototype;return u.register=function(d){var f="ID_"+this._lastID++;return this._callbacks[f]=d,f},u.unregister=function(d){this._callbacks[d]||a(!1),delete this._callbacks[d]},u.waitFor=function(d){this._isDispatching||a(!1);for(var f=0;f<d.length;f++){var h=d[f];this._isPending[h]?this._isHandled[h]||a(!1):(this._callbacks[h]||a(!1),this._invokeCallback(h))}},u.dispatch=function(d){this._isDispatching&&a(!1),this._startDispatching(d);try{for(var f in this._callbacks)this._isPending[f]||this._invokeCallback(f)}finally{this._stopDispatching()}},u.isDispatching=function(){return this._isDispatching},u._invokeCallback=function(d){this._isPending[d]=!0,this._callbacks[d](this._pendingPayload),this._isHandled[d]=!0},u._startDispatching=function(d){for(var f in this._callbacks)this._isPending[f]=!1,this._isHandled[f]=!1;this._pendingPayload=d,this._isDispatching=!0},u._stopDispatching=function(){delete this._pendingPayload,this._isDispatching=!1},c}();r.exports=l},function(r,i,s){r.exports=function(o,a){for(var l=arguments.length,c=new Array(l>2?l-2:0),u=2;u<l;u++)c[u-2]=arguments[u];if(!o){var d;if(a===void 0)d=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=0;(d=new Error(a.replace(/%s/g,function(){return String(c[f++])}))).name="Invariant Violation"}throw d.framesToPop=1,d}}},function(r,i,s){function o(D,j,U){return j in D?Object.defineProperty(D,j,{value:U,enumerable:!0,configurable:!0,writable:!0}):D[j]=U,D}function a(D,j){var U=Object.keys(D);if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(D);j&&(G=G.filter(function(L){return Object.getOwnPropertyDescriptor(D,L).enumerable})),U.push.apply(U,G)}return U}function l(D){for(var j=1;j<arguments.length;j++){var U=arguments[j]!=null?arguments[j]:{};j%2?a(Object(U),!0).forEach(function(G){o(D,G,U[G])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(U)):a(Object(U)).forEach(function(G){Object.defineProperty(D,G,Object.getOwnPropertyDescriptor(U,G))})}return D}function c(D,j){if(!(D instanceof j))throw new TypeError("Cannot call a class as a function")}function u(D,j){for(var U=0;U<j.length;U++){var G=j[U];G.enumerable=G.enumerable||!1,G.configurable=!0,"value"in G&&(G.writable=!0),Object.defineProperty(D,G.key,G)}}function d(D,j,U){return j&&u(D.prototype,j),U&&u(D,U),D}function f(D,j){return(f=Object.setPrototypeOf||function(U,G){return U.__proto__=G,U})(D,j)}function h(D,j){if(typeof j!="function"&&j!==null)throw new TypeError("Super expression must either be null or a function");D.prototype=Object.create(j&&j.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),j&&f(D,j)}function A(D){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(j){return j.__proto__||Object.getPrototypeOf(j)})(D)}function p(D){return(p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(j){return typeof j}:function(j){return j&&typeof Symbol=="function"&&j.constructor===Symbol&&j!==Symbol.prototype?"symbol":typeof j})(D)}function m(D){if(D===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function g(D,j){return!j||p(j)!=="object"&&typeof j!="function"?m(D):j}function y(D){var j=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}();return function(){var U,G=A(D);if(j){var L=A(this).constructor;U=Reflect.construct(G,arguments,L)}else U=G.apply(this,arguments);return g(this,U)}}s.r(i);var w=s(0),v=s.n(w);function x(){var D=this.constructor.getDerivedStateFromProps(this.props,this.state);D!=null&&this.setState(D)}function C(D){this.setState((function(j){var U=this.constructor.getDerivedStateFromProps(D,j);return U??null}).bind(this))}function _(D,j){try{var U=this.props,G=this.state;this.props=D,this.state=j,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(U,G)}finally{this.props=U,this.state=G}}function S(D){var j=D.prototype;if(!j||!j.isReactComponent)throw new Error("Can only polyfill class components");if(typeof D.getDerivedStateFromProps!="function"&&typeof j.getSnapshotBeforeUpdate!="function")return D;var U=null,G=null,L=null;if(typeof j.componentWillMount=="function"?U="componentWillMount":typeof j.UNSAFE_componentWillMount=="function"&&(U="UNSAFE_componentWillMount"),typeof j.componentWillReceiveProps=="function"?G="componentWillReceiveProps":typeof j.UNSAFE_componentWillReceiveProps=="function"&&(G="UNSAFE_componentWillReceiveProps"),typeof j.componentWillUpdate=="function"?L="componentWillUpdate":typeof j.UNSAFE_componentWillUpdate=="function"&&(L="UNSAFE_componentWillUpdate"),U!==null||G!==null||L!==null){var Q=D.displayName||D.name,te=typeof D.getDerivedStateFromProps=="function"?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error(`Unsafe legacy lifecycles will not be called for components using new component APIs.

`+Q+" uses "+te+" but also contains the following legacy lifecycles:"+(U!==null?`
  `+U:"")+(G!==null?`
  `+G:"")+(L!==null?`
  `+L:"")+`

The above lifecycles should be removed. Learn more about this warning here:
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof D.getDerivedStateFromProps=="function"&&(j.componentWillMount=x,j.componentWillReceiveProps=C),typeof j.getSnapshotBeforeUpdate=="function"){if(typeof j.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");j.componentWillUpdate=_;var X=j.componentDidUpdate;j.componentDidUpdate=function(V,he,_e){var He=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:_e;X.call(this,V,he,He)}}return D}function E(D,j){if(D==null)return{};var U,G,L=function(te,X){if(te==null)return{};var V,he,_e={},He=Object.keys(te);for(he=0;he<He.length;he++)V=He[he],X.indexOf(V)>=0||(_e[V]=te[V]);return _e}(D,j);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols(D);for(G=0;G<Q.length;G++)U=Q[G],j.indexOf(U)>=0||Object.prototype.propertyIsEnumerable.call(D,U)&&(L[U]=D[U])}return L}function T(D){var j=function(U){return{}.toString.call(U).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}(D);return j==="number"&&(j=isNaN(D)?"nan":(0|D)!=D?"float":"integer"),j}x.__suppressDeprecationWarning=!0,C.__suppressDeprecationWarning=!0,_.__suppressDeprecationWarning=!0;var R={scheme:"rjv-default",author:"mac gainor",base00:"rgba(0, 0, 0, 0)",base01:"rgb(245, 245, 245)",base02:"rgb(235, 235, 235)",base03:"#93a1a1",base04:"rgba(0, 0, 0, 0.3)",base05:"#586e75",base06:"#073642",base07:"#002b36",base08:"#d33682",base09:"#cb4b16",base0A:"#dc322f",base0B:"#859900",base0C:"#6c71c4",base0D:"#586e75",base0E:"#2aa198",base0F:"#268bd2"},k={scheme:"rjv-grey",author:"mac gainor",base00:"rgba(1, 1, 1, 0)",base01:"rgba(1, 1, 1, 0.1)",base02:"rgba(0, 0, 0, 0.2)",base03:"rgba(1, 1, 1, 0.3)",base04:"rgba(0, 0, 0, 0.4)",base05:"rgba(1, 1, 1, 0.5)",base06:"rgba(1, 1, 1, 0.6)",base07:"rgba(1, 1, 1, 0.7)",base08:"rgba(1, 1, 1, 0.8)",base09:"rgba(1, 1, 1, 0.8)",base0A:"rgba(1, 1, 1, 0.8)",base0B:"rgba(1, 1, 1, 0.8)",base0C:"rgba(1, 1, 1, 0.8)",base0D:"rgba(1, 1, 1, 0.8)",base0E:"rgba(1, 1, 1, 0.8)",base0F:"rgba(1, 1, 1, 0.8)"},B={white:"#fff",black:"#000",transparent:"rgba(1, 1, 1, 0)",globalFontFamily:"monospace",globalCursor:"default",indentBlockWidth:"5px",braceFontWeight:"bold",braceCursor:"pointer",ellipsisFontSize:"18px",ellipsisLineHeight:"10px",ellipsisCursor:"pointer",keyMargin:"0px 5px",keyLetterSpacing:"0.5px",keyFontStyle:"none",keyBorderRadius:"3px",keyColonWeight:"bold",keyVerticalAlign:"top",keyOpacity:"0.85",keyOpacityHover:"1",keyValPaddingTop:"3px",keyValPaddingBottom:"3px",keyValPaddingRight:"5px",keyValBorderLeft:"1px solid",keyValBorderHover:"2px solid",keyValPaddingHover:"3px 5px 3px 4px",pushedContentMarginLeft:"6px",variableValuePaddingRight:"6px",nullFontSize:"11px",nullFontWeight:"bold",nullPadding:"1px 2px",nullBorderRadius:"3px",nanFontSize:"11px",nanFontWeight:"bold",nanPadding:"1px 2px",nanBorderRadius:"3px",undefinedFontSize:"11px",undefinedFontWeight:"bold",undefinedPadding:"1px 2px",undefinedBorderRadius:"3px",dataTypeFontSize:"11px",dataTypeMarginRight:"4px",datatypeOpacity:"0.8",objectSizeBorderRadius:"3px",objectSizeFontStyle:"italic",objectSizeMargin:"0px 6px 0px 0px",clipboardCursor:"pointer",clipboardCheckMarginLeft:"-12px",metaDataPadding:"0px 0px 0px 10px",arrayGroupMetaPadding:"0px 0px 0px 4px",iconContainerWidth:"17px",tooltipPadding:"4px",editInputMinWidth:"130px",editInputBorderRadius:"2px",editInputPadding:"5px",editInputMarginRight:"4px",editInputFontFamily:"monospace",iconCursor:"pointer",iconFontSize:"15px",iconPaddingRight:"1px",dateValueMarginLeft:"2px",iconMarginRight:"3px",detectedRowPaddingTop:"3px",addKeyCoverBackground:"rgba(255, 255, 255, 0.3)",addKeyCoverPosition:"absolute",addKeyCoverPositionPx:"0px",addKeyModalWidth:"200px",addKeyModalMargin:"auto",addKeyModalPadding:"10px",addKeyModalRadius:"3px"},M=s(45),F=function(D){var j=function(U){return{backgroundColor:U.base00,ellipsisColor:U.base09,braceColor:U.base07,expandedIcon:U.base0D,collapsedIcon:U.base0E,keyColor:U.base07,arrayKeyColor:U.base0C,objectSize:U.base04,copyToClipboard:U.base0F,copyToClipboardCheck:U.base0D,objectBorder:U.base02,dataTypes:{boolean:U.base0E,date:U.base0D,float:U.base0B,function:U.base0D,integer:U.base0F,string:U.base09,nan:U.base08,null:U.base0A,undefined:U.base05,regexp:U.base0A,background:U.base02},editVariable:{editIcon:U.base0E,cancelIcon:U.base09,removeIcon:U.base09,addIcon:U.base0E,checkIcon:U.base0E,background:U.base01,color:U.base0A,border:U.base07},addKeyModal:{background:U.base05,border:U.base04,color:U.base0A,labelColor:U.base01},validationFailure:{background:U.base09,iconColor:U.base01,fontColor:U.base01}}}(D);return{"app-container":{fontFamily:B.globalFontFamily,cursor:B.globalCursor,backgroundColor:j.backgroundColor,position:"relative"},ellipsis:{display:"inline-block",color:j.ellipsisColor,fontSize:B.ellipsisFontSize,lineHeight:B.ellipsisLineHeight,cursor:B.ellipsisCursor},"brace-row":{display:"inline-block",cursor:"pointer"},brace:{display:"inline-block",cursor:B.braceCursor,fontWeight:B.braceFontWeight,color:j.braceColor},"expanded-icon":{color:j.expandedIcon},"collapsed-icon":{color:j.collapsedIcon},colon:{display:"inline-block",margin:B.keyMargin,color:j.keyColor,verticalAlign:"top"},objectKeyVal:function(U,G){return{style:l({paddingTop:B.keyValPaddingTop,paddingRight:B.keyValPaddingRight,paddingBottom:B.keyValPaddingBottom,borderLeft:B.keyValBorderLeft+" "+j.objectBorder,":hover":{paddingLeft:G.paddingLeft-1+"px",borderLeft:B.keyValBorderHover+" "+j.objectBorder}},G)}},"object-key-val-no-border":{padding:B.keyValPadding},"pushed-content":{marginLeft:B.pushedContentMarginLeft},variableValue:function(U,G){return{style:l({display:"inline-block",paddingRight:B.variableValuePaddingRight,position:"relative"},G)}},"object-name":{display:"inline-block",color:j.keyColor,letterSpacing:B.keyLetterSpacing,fontStyle:B.keyFontStyle,verticalAlign:B.keyVerticalAlign,opacity:B.keyOpacity,":hover":{opacity:B.keyOpacityHover}},"array-key":{display:"inline-block",color:j.arrayKeyColor,letterSpacing:B.keyLetterSpacing,fontStyle:B.keyFontStyle,verticalAlign:B.keyVerticalAlign,opacity:B.keyOpacity,":hover":{opacity:B.keyOpacityHover}},"object-size":{color:j.objectSize,borderRadius:B.objectSizeBorderRadius,fontStyle:B.objectSizeFontStyle,margin:B.objectSizeMargin,cursor:"default"},"data-type-label":{fontSize:B.dataTypeFontSize,marginRight:B.dataTypeMarginRight,opacity:B.datatypeOpacity},boolean:{display:"inline-block",color:j.dataTypes.boolean},date:{display:"inline-block",color:j.dataTypes.date},"date-value":{marginLeft:B.dateValueMarginLeft},float:{display:"inline-block",color:j.dataTypes.float},function:{display:"inline-block",color:j.dataTypes.function,cursor:"pointer",whiteSpace:"pre-line"},"function-value":{fontStyle:"italic"},integer:{display:"inline-block",color:j.dataTypes.integer},string:{display:"inline-block",color:j.dataTypes.string},nan:{display:"inline-block",color:j.dataTypes.nan,fontSize:B.nanFontSize,fontWeight:B.nanFontWeight,backgroundColor:j.dataTypes.background,padding:B.nanPadding,borderRadius:B.nanBorderRadius},null:{display:"inline-block",color:j.dataTypes.null,fontSize:B.nullFontSize,fontWeight:B.nullFontWeight,backgroundColor:j.dataTypes.background,padding:B.nullPadding,borderRadius:B.nullBorderRadius},undefined:{display:"inline-block",color:j.dataTypes.undefined,fontSize:B.undefinedFontSize,padding:B.undefinedPadding,borderRadius:B.undefinedBorderRadius,backgroundColor:j.dataTypes.background},regexp:{display:"inline-block",color:j.dataTypes.regexp},"copy-to-clipboard":{cursor:B.clipboardCursor},"copy-icon":{color:j.copyToClipboard,fontSize:B.iconFontSize,marginRight:B.iconMarginRight,verticalAlign:"top"},"copy-icon-copied":{color:j.copyToClipboardCheck,marginLeft:B.clipboardCheckMarginLeft},"array-group-meta-data":{display:"inline-block",padding:B.arrayGroupMetaPadding},"object-meta-data":{display:"inline-block",padding:B.metaDataPadding},"icon-container":{display:"inline-block",width:B.iconContainerWidth},tooltip:{padding:B.tooltipPadding},removeVarIcon:{verticalAlign:"top",display:"inline-block",color:j.editVariable.removeIcon,cursor:B.iconCursor,fontSize:B.iconFontSize,marginRight:B.iconMarginRight},addVarIcon:{verticalAlign:"top",display:"inline-block",color:j.editVariable.addIcon,cursor:B.iconCursor,fontSize:B.iconFontSize,marginRight:B.iconMarginRight},editVarIcon:{verticalAlign:"top",display:"inline-block",color:j.editVariable.editIcon,cursor:B.iconCursor,fontSize:B.iconFontSize,marginRight:B.iconMarginRight},"edit-icon-container":{display:"inline-block",verticalAlign:"top"},"check-icon":{display:"inline-block",cursor:B.iconCursor,color:j.editVariable.checkIcon,fontSize:B.iconFontSize,paddingRight:B.iconPaddingRight},"cancel-icon":{display:"inline-block",cursor:B.iconCursor,color:j.editVariable.cancelIcon,fontSize:B.iconFontSize,paddingRight:B.iconPaddingRight},"edit-input":{display:"inline-block",minWidth:B.editInputMinWidth,borderRadius:B.editInputBorderRadius,backgroundColor:j.editVariable.background,color:j.editVariable.color,padding:B.editInputPadding,marginRight:B.editInputMarginRight,fontFamily:B.editInputFontFamily},"detected-row":{paddingTop:B.detectedRowPaddingTop},"key-modal-request":{position:B.addKeyCoverPosition,top:B.addKeyCoverPositionPx,left:B.addKeyCoverPositionPx,right:B.addKeyCoverPositionPx,bottom:B.addKeyCoverPositionPx,backgroundColor:B.addKeyCoverBackground},"key-modal":{width:B.addKeyModalWidth,backgroundColor:j.addKeyModal.background,marginLeft:B.addKeyModalMargin,marginRight:B.addKeyModalMargin,padding:B.addKeyModalPadding,borderRadius:B.addKeyModalRadius,marginTop:"15px",position:"relative"},"key-modal-label":{color:j.addKeyModal.labelColor,marginLeft:"2px",marginBottom:"5px",fontSize:"11px"},"key-modal-input-container":{overflow:"hidden"},"key-modal-input":{width:"100%",padding:"3px 6px",fontFamily:"monospace",color:j.addKeyModal.color,border:"none",boxSizing:"border-box",borderRadius:"2px"},"key-modal-cancel":{backgroundColor:j.editVariable.removeIcon,position:"absolute",top:"0px",right:"0px",borderRadius:"0px 3px 0px 3px",cursor:"pointer"},"key-modal-cancel-icon":{color:j.addKeyModal.labelColor,fontSize:B.iconFontSize,transform:"rotate(45deg)"},"key-modal-submit":{color:j.editVariable.addIcon,fontSize:B.iconFontSize,position:"absolute",right:"2px",top:"3px",cursor:"pointer"},"function-ellipsis":{display:"inline-block",color:j.ellipsisColor,fontSize:B.ellipsisFontSize,lineHeight:B.ellipsisLineHeight,cursor:B.ellipsisCursor},"validation-failure":{float:"right",padding:"3px 6px",borderRadius:"2px",cursor:"pointer",color:j.validationFailure.fontColor,backgroundColor:j.validationFailure.background},"validation-failure-label":{marginRight:"6px"},"validation-failure-clear":{position:"relative",verticalAlign:"top",cursor:"pointer",color:j.validationFailure.iconColor,fontSize:B.iconFontSize,transform:"rotate(45deg)"}}};function I(D,j,U){return D||console.error("theme has not been set"),function(G){var L=R;return G!==!1&&G!=="none"||(L=k),Object(M.createStyling)(F,{defaultBase16:L})(G)}(D)(j,U)}var z=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=(G.rjvId,G.type_name),Q=G.displayDataTypes,te=G.theme;return Q?v.a.createElement("span",Object.assign({className:"data-type-label"},I(te,"data-type-label")),L):null}}]),U}(v.a.PureComponent),Y=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props;return v.a.createElement("div",I(G.theme,"boolean"),v.a.createElement(z,Object.assign({type_name:"bool"},G)),G.value?"true":"false")}}]),U}(v.a.PureComponent),$=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props;return v.a.createElement("div",I(G.theme,"date"),v.a.createElement(z,Object.assign({type_name:"date"},G)),v.a.createElement("span",Object.assign({className:"date-value"},I(G.theme,"date-value")),G.value.toLocaleTimeString("en-us",{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})))}}]),U}(v.a.PureComponent),ee=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props;return v.a.createElement("div",I(G.theme,"float"),v.a.createElement(z,Object.assign({type_name:"float"},G)),this.props.value)}}]),U}(v.a.PureComponent);function W(D,j){(j==null||j>D.length)&&(j=D.length);for(var U=0,G=new Array(j);U<j;U++)G[U]=D[U];return G}function ne(D,j){if(D){if(typeof D=="string")return W(D,j);var U=Object.prototype.toString.call(D).slice(8,-1);return U==="Object"&&D.constructor&&(U=D.constructor.name),U==="Map"||U==="Set"?Array.from(D):U==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(U)?W(D,j):void 0}}function Se(D,j){var U;if(typeof Symbol>"u"||D[Symbol.iterator]==null){if(Array.isArray(D)||(U=ne(D))||j){U&&(D=U);var G=0,L=function(){};return{s:L,n:function(){return G>=D.length?{done:!0}:{done:!1,value:D[G++]}},e:function(V){throw V},f:L}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Q,te=!0,X=!1;return{s:function(){U=D[Symbol.iterator]()},n:function(){var V=U.next();return te=V.done,V},e:function(V){X=!0,Q=V},f:function(){try{te||U.return==null||U.return()}finally{if(X)throw Q}}}}function fe(D){return function(j){if(Array.isArray(j))return W(j)}(D)||function(j){if(typeof Symbol<"u"&&Symbol.iterator in Object(j))return Array.from(j)}(D)||ne(D)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}var ge=s(46),Oe=new(s(47)).Dispatcher,Fe=new(function(D){h(U,D);var j=y(U);function U(){var G;c(this,U);for(var L=arguments.length,Q=new Array(L),te=0;te<L;te++)Q[te]=arguments[te];return(G=j.call.apply(j,[this].concat(Q))).objects={},G.set=function(X,V,he,_e){G.objects[X]===void 0&&(G.objects[X]={}),G.objects[X][V]===void 0&&(G.objects[X][V]={}),G.objects[X][V][he]=_e},G.get=function(X,V,he,_e){return G.objects[X]===void 0||G.objects[X][V]===void 0||G.objects[X][V][he]==null?_e:G.objects[X][V][he]},G.handleAction=function(X){var V=X.rjvId,he=X.data;switch(X.name){case"RESET":G.emit("reset-"+V);break;case"VARIABLE_UPDATED":X.data.updated_src=G.updateSrc(V,he),G.set(V,"action","variable-update",l(l({},he),{},{type:"variable-edited"})),G.emit("variable-update-"+V);break;case"VARIABLE_REMOVED":X.data.updated_src=G.updateSrc(V,he),G.set(V,"action","variable-update",l(l({},he),{},{type:"variable-removed"})),G.emit("variable-update-"+V);break;case"VARIABLE_ADDED":X.data.updated_src=G.updateSrc(V,he),G.set(V,"action","variable-update",l(l({},he),{},{type:"variable-added"})),G.emit("variable-update-"+V);break;case"ADD_VARIABLE_KEY_REQUEST":G.set(V,"action","new-key-request",he),G.emit("add-key-request-"+V)}},G.updateSrc=function(X,V){var he=V.name,_e=V.namespace,He=V.new_value,ze=(V.existing_value,V.variable_removed);_e.shift();var lt,rt=G.get(X,"global","src"),ct=G.deepCopy(rt,fe(_e)),kt=ct,yt=Se(_e);try{for(yt.s();!(lt=yt.n()).done;)kt=kt[lt.value]}catch(Ut){yt.e(Ut)}finally{yt.f()}return ze?T(kt)=="array"?kt.splice(he,1):delete kt[he]:he!==null?kt[he]=He:ct=He,G.set(X,"global","src",ct),ct},G.deepCopy=function(X,V){var he,_e=T(X),He=V.shift();return _e=="array"?he=fe(X):_e=="object"&&(he=l({},X)),He!==void 0&&(he[He]=G.deepCopy(X[He],V)),he},G}return U}(ge.EventEmitter));Oe.register(Fe.handleAction.bind(Fe));var De=Fe,ke=function(D){h(U,D);var j=y(U);function U(G){var L;return c(this,U),(L=j.call(this,G)).toggleCollapsed=function(){L.setState({collapsed:!L.state.collapsed},function(){De.set(L.props.rjvId,L.props.namespace,"collapsed",L.state.collapsed)})},L.getFunctionDisplay=function(Q){var te=m(L).props;return Q?v.a.createElement("span",null,L.props.value.toString().slice(9,-1).replace(/\{[\s\S]+/,""),v.a.createElement("span",{className:"function-collapsed",style:{fontWeight:"bold"}},v.a.createElement("span",null,"{"),v.a.createElement("span",I(te.theme,"ellipsis"),"..."),v.a.createElement("span",null,"}"))):L.props.value.toString().slice(9,-1)},L.state={collapsed:De.get(G.rjvId,G.namespace,"collapsed",!0)},L}return d(U,[{key:"render",value:function(){var G=this.props,L=this.state.collapsed;return v.a.createElement("div",I(G.theme,"function"),v.a.createElement(z,Object.assign({type_name:"function"},G)),v.a.createElement("span",Object.assign({},I(G.theme,"function-value"),{className:"rjv-function-container",onClick:this.toggleCollapsed}),this.getFunctionDisplay(L)))}}]),U}(v.a.PureComponent),Ge=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){return v.a.createElement("div",I(this.props.theme,"nan"),"NaN")}}]),U}(v.a.PureComponent),Ve=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){return v.a.createElement("div",I(this.props.theme,"null"),"NULL")}}]),U}(v.a.PureComponent),q=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props;return v.a.createElement("div",I(G.theme,"integer"),v.a.createElement(z,Object.assign({type_name:"int"},G)),this.props.value)}}]),U}(v.a.PureComponent),Ue=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props;return v.a.createElement("div",I(G.theme,"regexp"),v.a.createElement(z,Object.assign({type_name:"regexp"},G)),this.props.value.toString())}}]),U}(v.a.PureComponent),O=function(D){h(U,D);var j=y(U);function U(G){var L;return c(this,U),(L=j.call(this,G)).toggleCollapsed=function(){L.setState({collapsed:!L.state.collapsed},function(){De.set(L.props.rjvId,L.props.namespace,"collapsed",L.state.collapsed)})},L.state={collapsed:De.get(G.rjvId,G.namespace,"collapsed",!0)},L}return d(U,[{key:"render",value:function(){this.state.collapsed;var G=this.props,L=G.collapseStringsAfterLength,Q=G.theme,te=G.value,X={style:{cursor:"default"}};return T(L)==="integer"&&te.length>L&&(X.style.cursor="pointer",this.state.collapsed&&(te=v.a.createElement("span",null,te.substring(0,L),v.a.createElement("span",I(Q,"ellipsis")," ...")))),v.a.createElement("div",I(Q,"string"),v.a.createElement(z,Object.assign({type_name:"string"},G)),v.a.createElement("span",Object.assign({className:"string-value"},X,{onClick:this.toggleCollapsed}),'"',te,'"'))}}]),U}(v.a.PureComponent),ve=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){return v.a.createElement("div",I(this.props.theme,"undefined"),"undefined")}}]),U}(v.a.PureComponent);function Ae(){return(Ae=Object.assign||function(D){for(var j=1;j<arguments.length;j++){var U=arguments[j];for(var G in U)Object.prototype.hasOwnProperty.call(U,G)&&(D[G]=U[G])}return D}).apply(this,arguments)}var ae=w.useLayoutEffect,Z=function(D){var j=Object(w.useRef)(D);return ae(function(){j.current=D}),j},pe=function(D,j){typeof D!="function"?D.current=j:D(j)},J=function(D,j){var U=Object(w.useRef)();return Object(w.useCallback)(function(G){D.current=G,U.current&&pe(U.current,null),U.current=j,j&&pe(j,G)},[j])},H={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},oe=function(D){Object.keys(H).forEach(function(j){D.style.setProperty(j,H[j],"important")})},we=null,Ee=function(){},re=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width"],ce=!!document.documentElement.currentStyle,le=function(D,j){var U=D.cacheMeasurements,G=D.maxRows,L=D.minRows,Q=D.onChange,te=Q===void 0?Ee:Q,X=D.onHeightChange,V=X===void 0?Ee:X,he=function(yt,Ut){if(yt==null)return{};var Pn,Xt,Et={},xt=Object.keys(yt);for(Xt=0;Xt<xt.length;Xt++)Pn=xt[Xt],Ut.indexOf(Pn)>=0||(Et[Pn]=yt[Pn]);return Et}(D,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]),_e,He=he.value!==void 0,ze=Object(w.useRef)(null),lt=J(ze,j),rt=Object(w.useRef)(0),ct=Object(w.useRef)(),kt=function(){var yt=ze.current,Ut=U&&ct.current?ct.current:function(xt){var Rt=window.getComputedStyle(xt);if(Rt===null)return null;var Ln,Wt=(Ln=Rt,re.reduce(function(qo,Gn){return qo[Gn]=Ln[Gn],qo},{})),jn=Wt.boxSizing;return jn===""?null:(ce&&jn==="border-box"&&(Wt.width=parseFloat(Wt.width)+parseFloat(Wt.borderRightWidth)+parseFloat(Wt.borderLeftWidth)+parseFloat(Wt.paddingRight)+parseFloat(Wt.paddingLeft)+"px"),{sizingStyle:Wt,paddingSize:parseFloat(Wt.paddingBottom)+parseFloat(Wt.paddingTop),borderSize:parseFloat(Wt.borderBottomWidth)+parseFloat(Wt.borderTopWidth)})}(yt);if(Ut){ct.current=Ut;var Pn=function(xt,Rt,Ln,Wt){Ln===void 0&&(Ln=1),Wt===void 0&&(Wt=1/0),we||((we=document.createElement("textarea")).setAttribute("tab-index","-1"),we.setAttribute("aria-hidden","true"),oe(we)),we.parentNode===null&&document.body.appendChild(we);var jn=xt.paddingSize,qo=xt.borderSize,Gn=xt.sizingStyle,Ma=Gn.boxSizing;Object.keys(Gn).forEach(function(gA){var yA=gA;we.style[yA]=Gn[yA]}),oe(we),we.value=Rt;var xu=function(gA,yA){var pO=gA.scrollHeight;return yA.sizingStyle.boxSizing==="border-box"?pO+yA.borderSize:pO-yA.paddingSize}(we,xt);we.value="x";var cs=we.scrollHeight-jn,Pf=cs*Ln;Ma==="border-box"&&(Pf=Pf+jn+qo),xu=Math.max(Pf,xu);var Dg=cs*Wt;return Ma==="border-box"&&(Dg=Dg+jn+qo),[xu=Math.min(Dg,xu),cs]}(Ut,yt.value||yt.placeholder||"x",L,G),Xt=Pn[0],Et=Pn[1];rt.current!==Xt&&(rt.current=Xt,yt.style.setProperty("height",Xt+"px","important"),V(Xt,{rowHeight:Et}))}};return Object(w.useLayoutEffect)(kt),_e=Z(kt),Object(w.useLayoutEffect)(function(){var yt=function(Ut){_e.current(Ut)};return window.addEventListener("resize",yt),function(){window.removeEventListener("resize",yt)}},[]),Object(w.createElement)("textarea",Ae({},he,{onChange:function(yt){He||kt(),te(yt)},ref:lt}))},me=Object(w.forwardRef)(le);function Le(D){D=D.trim();try{if((D=JSON.stringify(JSON.parse(D)))[0]==="[")return Te("array",JSON.parse(D));if(D[0]==="{")return Te("object",JSON.parse(D));if(D.match(/\-?\d+\.\d+/)&&D.match(/\-?\d+\.\d+/)[0]===D)return Te("float",parseFloat(D));if(D.match(/\-?\d+e-\d+/)&&D.match(/\-?\d+e-\d+/)[0]===D)return Te("float",Number(D));if(D.match(/\-?\d+/)&&D.match(/\-?\d+/)[0]===D)return Te("integer",parseInt(D));if(D.match(/\-?\d+e\+\d+/)&&D.match(/\-?\d+e\+\d+/)[0]===D)return Te("integer",Number(D))}catch{}switch(D=D.toLowerCase()){case"undefined":return Te("undefined",void 0);case"nan":return Te("nan",NaN);case"null":return Te("null",null);case"true":return Te("boolean",!0);case"false":return Te("boolean",!1);default:if(D=Date.parse(D))return Te("date",new Date(D))}return Te(!1,null)}function Te(D,j){return{type:D,value:j}}var Pe=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]);return v.a.createElement("span",Q,v.a.createElement("svg",Object.assign({},Je(L),{viewBox:"0 0 24 24",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),v.a.createElement("path",{d:"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M7,13H17V11H7"})))}}]),U}(v.a.PureComponent),Qe=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]);return v.a.createElement("span",Q,v.a.createElement("svg",Object.assign({},Je(L),{viewBox:"0 0 24 24",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),v.a.createElement("path",{d:"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z"})))}}]),U}(v.a.PureComponent),$e=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]),te=Je(L).style;return v.a.createElement("span",Q,v.a.createElement("svg",{fill:te.color,width:te.height,height:te.width,style:te,viewBox:"0 0 1792 1792"},v.a.createElement("path",{d:"M1344 800v64q0 14-9 23t-23 9h-832q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h832q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 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"})))}}]),U}(v.a.PureComponent),et=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]),te=Je(L).style;return v.a.createElement("span",Q,v.a.createElement("svg",{fill:te.color,width:te.height,height:te.width,style:te,viewBox:"0 0 1792 1792"},v.a.createElement("path",{d:"M1344 800v64q0 14-9 23t-23 9h-352v352q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-352h-352q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h352v-352q0-14 9-23t23-9h64q14 0 23 9t9 23v352h352q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 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"})))}}]),U}(v.a.PureComponent),st=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]);return v.a.createElement("span",Q,v.a.createElement("svg",{style:l(l({},Je(L).style),{},{paddingLeft:"2px",verticalAlign:"top"}),viewBox:"0 0 15 15",fill:"currentColor"},v.a.createElement("path",{d:"M0 14l6-6-6-6z"})))}}]),U}(v.a.PureComponent),dt=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]);return v.a.createElement("span",Q,v.a.createElement("svg",{style:l(l({},Je(L).style),{},{paddingLeft:"2px",verticalAlign:"top"}),viewBox:"0 0 15 15",fill:"currentColor"},v.a.createElement("path",{d:"M0 5l6 6 6-6z"})))}}]),U}(v.a.PureComponent),Mt=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]);return v.a.createElement("span",Q,v.a.createElement("svg",Object.assign({},Je(L),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),v.a.createElement("g",null,v.a.createElement("path",{d:"m30 35h-25v-22.5h25v7.5h2.5v-12.5c0-1.4-1.1-2.5-2.5-2.5h-7.5c0-2.8-2.2-5-5-5s-5 2.2-5 5h-7.5c-1.4 0-2.5 1.1-2.5 2.5v27.5c0 1.4 1.1 2.5 2.5 2.5h25c1.4 0 2.5-1.1 2.5-2.5v-5h-2.5v5z m-20-27.5h2.5s2.5-1.1 2.5-2.5 1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5 1.3 2.5 2.5 2.5h2.5s2.5 1.1 2.5 2.5h-20c0-1.5 1.1-2.5 2.5-2.5z m-2.5 20h5v-2.5h-5v2.5z m17.5-5v-5l-10 7.5 10 7.5v-5h12.5v-5h-12.5z m-17.5 10h7.5v-2.5h-7.5v2.5z m12.5-17.5h-12.5v2.5h12.5v-2.5z m-7.5 5h-5v2.5h5v-2.5z"}))))}}]),U}(v.a.PureComponent),K=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]);return v.a.createElement("span",Q,v.a.createElement("svg",Object.assign({},Je(L),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),v.a.createElement("g",null,v.a.createElement("path",{d:"m28.6 25q0-0.5-0.4-1l-4-4 4-4q0.4-0.5 0.4-1 0-0.6-0.4-1.1l-2-2q-0.4-0.4-1-0.4-0.6 0-1 0.4l-4.1 4.1-4-4.1q-0.4-0.4-1-0.4-0.6 0-1 0.4l-2 2q-0.5 0.5-0.5 1.1 0 0.5 0.5 1l4 4-4 4q-0.5 0.5-0.5 1 0 0.7 0.5 1.1l2 2q0.4 0.4 1 0.4 0.6 0 1-0.4l4-4.1 4.1 4.1q0.4 0.4 1 0.4 0.6 0 1-0.4l2-2q0.4-0.4 0.4-1z m8.7-5q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),U}(v.a.PureComponent),Be=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]);return v.a.createElement("span",Q,v.a.createElement("svg",Object.assign({},Je(L),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),v.a.createElement("g",null,v.a.createElement("path",{d:"m30.1 21.4v-2.8q0-0.6-0.4-1t-1-0.5h-5.7v-5.7q0-0.6-0.4-1t-1-0.4h-2.9q-0.6 0-1 0.4t-0.4 1v5.7h-5.7q-0.6 0-1 0.5t-0.5 1v2.8q0 0.6 0.5 1t1 0.5h5.7v5.7q0 0.5 0.4 1t1 0.4h2.9q0.6 0 1-0.4t0.4-1v-5.7h5.7q0.6 0 1-0.5t0.4-1z m7.2-1.4q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),U}(v.a.PureComponent),Re=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]);return v.a.createElement("span",Q,v.a.createElement("svg",Object.assign({},Je(L),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),v.a.createElement("g",null,v.a.createElement("path",{d:"m31.6 21.6h-10v10h-3.2v-10h-10v-3.2h10v-10h3.2v10h10v3.2z"}))))}}]),U}(v.a.PureComponent),Me=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]);return v.a.createElement("span",Q,v.a.createElement("svg",Object.assign({},Je(L),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),v.a.createElement("g",null,v.a.createElement("path",{d:"m19.8 26.4l2.6-2.6-3.4-3.4-2.6 2.6v1.3h2.2v2.1h1.2z m9.8-16q-0.3-0.4-0.7 0l-7.8 7.8q-0.4 0.4 0 0.7t0.7 0l7.8-7.8q0.4-0.4 0-0.7z m1.8 13.2v4.3q0 2.6-1.9 4.5t-4.5 1.9h-18.6q-2.6 0-4.5-1.9t-1.9-4.5v-18.6q0-2.7 1.9-4.6t4.5-1.8h18.6q1.4 0 2.6 0.5 0.3 0.2 0.4 0.5 0.1 0.4-0.2 0.7l-1.1 1.1q-0.3 0.3-0.7 0.1-0.5-0.1-1-0.1h-18.6q-1.4 0-2.5 1.1t-1 2.5v18.6q0 1.4 1 2.5t2.5 1h18.6q1.5 0 2.5-1t1.1-2.5v-2.9q0-0.2 0.2-0.4l1.4-1.5q0.3-0.3 0.8-0.1t0.4 0.6z m-2.1-16.5l6.4 6.5-15 15h-6.4v-6.5z m9.9 3l-2.1 2-6.4-6.4 2.1-2q0.6-0.7 1.5-0.7t1.5 0.7l3.4 3.4q0.6 0.6 0.6 1.5t-0.6 1.5z"}))))}}]),U}(v.a.PureComponent),We=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.style,Q=E(G,["style"]);return v.a.createElement("span",Q,v.a.createElement("svg",Object.assign({},Je(L),{viewBox:"0 0 40 40",fill:"currentColor",preserveAspectRatio:"xMidYMid meet"}),v.a.createElement("g",null,v.a.createElement("path",{d:"m31.7 16.4q0-0.6-0.4-1l-2.1-2.1q-0.4-0.4-1-0.4t-1 0.4l-9.1 9.1-5-5q-0.5-0.4-1-0.4t-1 0.4l-2.1 2q-0.4 0.4-0.4 1 0 0.6 0.4 1l8.1 8.1q0.4 0.4 1 0.4 0.6 0 1-0.4l12.2-12.1q0.4-0.4 0.4-1z m5.6 3.6q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"}))))}}]),U}(v.a.PureComponent);function Je(D){return D||(D={}),{style:l(l({verticalAlign:"middle"},D),{},{color:D.color?D.color:"#000000",height:"1em",width:"1em"})}}var ht=function(D){h(U,D);var j=y(U);function U(G){var L;return c(this,U),(L=j.call(this,G)).copiedTimer=null,L.handleCopy=function(){var Q=document.createElement("textarea"),te=L.props,X=te.clickCallback,V=te.src,he=te.namespace;Q.innerHTML=JSON.stringify(L.clipboardValue(V),null,"  "),document.body.appendChild(Q),Q.select(),document.execCommand("copy"),document.body.removeChild(Q),L.copiedTimer=setTimeout(function(){L.setState({copied:!1})},5500),L.setState({copied:!0},function(){typeof X=="function"&&X({src:V,namespace:he,name:he[he.length-1]})})},L.getClippyIcon=function(){var Q=L.props.theme;return L.state.copied?v.a.createElement("span",null,v.a.createElement(Mt,Object.assign({className:"copy-icon"},I(Q,"copy-icon"))),v.a.createElement("span",I(Q,"copy-icon-copied"),"✔")):v.a.createElement(Mt,Object.assign({className:"copy-icon"},I(Q,"copy-icon")))},L.clipboardValue=function(Q){switch(T(Q)){case"function":case"regexp":return Q.toString();default:return Q}},L.state={copied:!1},L}return d(U,[{key:"componentWillUnmount",value:function(){this.copiedTimer&&(clearTimeout(this.copiedTimer),this.copiedTimer=null)}},{key:"render",value:function(){var G=this.props,L=(G.src,G.theme),Q=G.hidden,te=G.rowHovered,X=I(L,"copy-to-clipboard").style,V="inline";return Q&&(V="none"),v.a.createElement("span",{className:"copy-to-clipboard-container",title:"Copy to clipboard",style:{verticalAlign:"top",display:te?"inline-block":"none"}},v.a.createElement("span",{style:l(l({},X),{},{display:V}),onClick:this.handleCopy},this.getClippyIcon()))}}]),U}(v.a.PureComponent),Gt=function(D){h(U,D);var j=y(U);function U(G){var L;return c(this,U),(L=j.call(this,G)).getEditIcon=function(){var Q=L.props,te=Q.variable,X=Q.theme;return v.a.createElement("div",{className:"click-to-edit",style:{verticalAlign:"top",display:L.state.hovered?"inline-block":"none"}},v.a.createElement(Me,Object.assign({className:"click-to-edit-icon"},I(X,"editVarIcon"),{onClick:function(){L.prepopInput(te)}})))},L.prepopInput=function(Q){if(L.props.onEdit!==!1){var te=function(V){var he;switch(T(V)){case"undefined":he="undefined";break;case"nan":he="NaN";break;case"string":he=V;break;case"date":case"function":case"regexp":he=V.toString();break;default:try{he=JSON.stringify(V,null,"  ")}catch{he=""}}return he}(Q.value),X=Le(te);L.setState({editMode:!0,editValue:te,parsedInput:{type:X.type,value:X.value}})}},L.getRemoveIcon=function(){var Q=L.props,te=Q.variable,X=Q.namespace,V=Q.theme,he=Q.rjvId;return v.a.createElement("div",{className:"click-to-remove",style:{verticalAlign:"top",display:L.state.hovered?"inline-block":"none"}},v.a.createElement(K,Object.assign({className:"click-to-remove-icon"},I(V,"removeVarIcon"),{onClick:function(){Oe.dispatch({name:"VARIABLE_REMOVED",rjvId:he,data:{name:te.name,namespace:X,existing_value:te.value,variable_removed:!0}})}})))},L.getValue=function(Q,te){var X=!te&&Q.type,V=m(L).props;switch(X){case!1:return L.getEditInput();case"string":return v.a.createElement(O,Object.assign({value:Q.value},V));case"integer":return v.a.createElement(q,Object.assign({value:Q.value},V));case"float":return v.a.createElement(ee,Object.assign({value:Q.value},V));case"boolean":return v.a.createElement(Y,Object.assign({value:Q.value},V));case"function":return v.a.createElement(ke,Object.assign({value:Q.value},V));case"null":return v.a.createElement(Ve,V);case"nan":return v.a.createElement(Ge,V);case"undefined":return v.a.createElement(ve,V);case"date":return v.a.createElement($,Object.assign({value:Q.value},V));case"regexp":return v.a.createElement(Ue,Object.assign({value:Q.value},V));default:return v.a.createElement("div",{className:"object-value"},JSON.stringify(Q.value))}},L.getEditInput=function(){var Q=L.props.theme,te=L.state.editValue;return v.a.createElement("div",null,v.a.createElement(me,Object.assign({type:"text",inputRef:function(X){return X&&X.focus()},value:te,className:"variable-editor",onChange:function(X){var V=X.target.value,he=Le(V);L.setState({editValue:V,parsedInput:{type:he.type,value:he.value}})},onKeyDown:function(X){switch(X.key){case"Escape":L.setState({editMode:!1,editValue:""});break;case"Enter":(X.ctrlKey||X.metaKey)&&L.submitEdit(!0)}X.stopPropagation()},placeholder:"update this value",minRows:2},I(Q,"edit-input"))),v.a.createElement("div",I(Q,"edit-icon-container"),v.a.createElement(K,Object.assign({className:"edit-cancel"},I(Q,"cancel-icon"),{onClick:function(){L.setState({editMode:!1,editValue:""})}})),v.a.createElement(We,Object.assign({className:"edit-check string-value"},I(Q,"check-icon"),{onClick:function(){L.submitEdit()}})),v.a.createElement("div",null,L.showDetected())))},L.submitEdit=function(Q){var te=L.props,X=te.variable,V=te.namespace,he=te.rjvId,_e=L.state,He=_e.editValue,ze=_e.parsedInput,lt=He;Q&&ze.type&&(lt=ze.value),L.setState({editMode:!1}),Oe.dispatch({name:"VARIABLE_UPDATED",rjvId:he,data:{name:X.name,namespace:V,existing_value:X.value,new_value:lt,variable_removed:!1}})},L.showDetected=function(){var Q=L.props,te=Q.theme,X=(Q.variable,Q.namespace,Q.rjvId,L.state.parsedInput),V=(X.type,X.value,L.getDetectedInput());if(V)return v.a.createElement("div",null,v.a.createElement("div",I(te,"detected-row"),V,v.a.createElement(We,{className:"edit-check detected",style:l({verticalAlign:"top",paddingLeft:"3px"},I(te,"check-icon").style),onClick:function(){L.submitEdit(!0)}})))},L.getDetectedInput=function(){var Q=L.state.parsedInput,te=Q.type,X=Q.value,V=m(L).props,he=V.theme;if(te!==!1)switch(te.toLowerCase()){case"object":return v.a.createElement("span",null,v.a.createElement("span",{style:l(l({},I(he,"brace").style),{},{cursor:"default"})},"{"),v.a.createElement("span",{style:l(l({},I(he,"ellipsis").style),{},{cursor:"default"})},"..."),v.a.createElement("span",{style:l(l({},I(he,"brace").style),{},{cursor:"default"})},"}"));case"array":return v.a.createElement("span",null,v.a.createElement("span",{style:l(l({},I(he,"brace").style),{},{cursor:"default"})},"["),v.a.createElement("span",{style:l(l({},I(he,"ellipsis").style),{},{cursor:"default"})},"..."),v.a.createElement("span",{style:l(l({},I(he,"brace").style),{},{cursor:"default"})},"]"));case"string":return v.a.createElement(O,Object.assign({value:X},V));case"integer":return v.a.createElement(q,Object.assign({value:X},V));case"float":return v.a.createElement(ee,Object.assign({value:X},V));case"boolean":return v.a.createElement(Y,Object.assign({value:X},V));case"function":return v.a.createElement(ke,Object.assign({value:X},V));case"null":return v.a.createElement(Ve,V);case"nan":return v.a.createElement(Ge,V);case"undefined":return v.a.createElement(ve,V);case"date":return v.a.createElement($,Object.assign({value:new Date(X)},V))}},L.state={editMode:!1,editValue:"",hovered:!1,renameKey:!1,parsedInput:{type:!1,value:null}},L}return d(U,[{key:"render",value:function(){var G=this,L=this.props,Q=L.variable,te=L.singleIndent,X=L.type,V=L.theme,he=L.namespace,_e=L.indentWidth,He=L.enableClipboard,ze=L.onEdit,lt=L.onDelete,rt=L.onSelect,ct=L.displayArrayKey,kt=L.quotesOnKeys,yt=this.state.editMode;return v.a.createElement("div",Object.assign({},I(V,"objectKeyVal",{paddingLeft:_e*te}),{onMouseEnter:function(){return G.setState(l(l({},G.state),{},{hovered:!0}))},onMouseLeave:function(){return G.setState(l(l({},G.state),{},{hovered:!1}))},className:"variable-row",key:Q.name}),X=="array"?ct?v.a.createElement("span",Object.assign({},I(V,"array-key"),{key:Q.name+"_"+he}),Q.name,v.a.createElement("div",I(V,"colon"),":")):null:v.a.createElement("span",null,v.a.createElement("span",Object.assign({},I(V,"object-name"),{className:"object-key",key:Q.name+"_"+he}),!!kt&&v.a.createElement("span",{style:{verticalAlign:"top"}},'"'),v.a.createElement("span",{style:{display:"inline-block"}},Q.name),!!kt&&v.a.createElement("span",{style:{verticalAlign:"top"}},'"')),v.a.createElement("span",I(V,"colon"),":")),v.a.createElement("div",Object.assign({className:"variable-value",onClick:rt===!1&&ze===!1?null:function(Ut){var Pn=fe(he);(Ut.ctrlKey||Ut.metaKey)&&ze!==!1?G.prepopInput(Q):rt!==!1&&(Pn.shift(),rt(l(l({},Q),{},{namespace:Pn})))}},I(V,"variableValue",{cursor:rt===!1?"default":"pointer"})),this.getValue(Q,yt)),He?v.a.createElement(ht,{rowHovered:this.state.hovered,hidden:yt,src:Q.value,clickCallback:He,theme:V,namespace:[].concat(fe(he),[Q.name])}):null,ze!==!1&&yt==0?this.getEditIcon():null,lt!==!1&&yt==0?this.getRemoveIcon():null)}}]),U}(v.a.PureComponent),tn=function(D){h(U,D);var j=y(U);function U(){var G;c(this,U);for(var L=arguments.length,Q=new Array(L),te=0;te<L;te++)Q[te]=arguments[te];return(G=j.call.apply(j,[this].concat(Q))).getObjectSize=function(){var X=G.props,V=X.size,he=X.theme;if(X.displayObjectSize)return v.a.createElement("span",Object.assign({className:"object-size"},I(he,"object-size")),V," item",V===1?"":"s")},G.getAddAttribute=function(X){var V=G.props,he=V.theme,_e=V.namespace,He=V.name,ze=V.src,lt=V.rjvId,rt=V.depth;return v.a.createElement("span",{className:"click-to-add",style:{verticalAlign:"top",display:X?"inline-block":"none"}},v.a.createElement(Be,Object.assign({className:"click-to-add-icon"},I(he,"addVarIcon"),{onClick:function(){var ct={name:rt>0?He:null,namespace:_e.splice(0,_e.length-1),existing_value:ze,variable_removed:!1,key_name:null};T(ze)==="object"?Oe.dispatch({name:"ADD_VARIABLE_KEY_REQUEST",rjvId:lt,data:ct}):Oe.dispatch({name:"VARIABLE_ADDED",rjvId:lt,data:l(l({},ct),{},{new_value:[].concat(fe(ze),[null])})})}})))},G.getRemoveObject=function(X){var V=G.props,he=V.theme,_e=(V.hover,V.namespace),He=V.name,ze=V.src,lt=V.rjvId;if(_e.length!==1)return v.a.createElement("span",{className:"click-to-remove",style:{display:X?"inline-block":"none"}},v.a.createElement(K,Object.assign({className:"click-to-remove-icon"},I(he,"removeVarIcon"),{onClick:function(){Oe.dispatch({name:"VARIABLE_REMOVED",rjvId:lt,data:{name:He,namespace:_e.splice(0,_e.length-1),existing_value:ze,variable_removed:!0}})}})))},G.render=function(){var X=G.props,V=X.theme,he=X.onDelete,_e=X.onAdd,He=X.enableClipboard,ze=X.src,lt=X.namespace,rt=X.rowHovered;return v.a.createElement("div",Object.assign({},I(V,"object-meta-data"),{className:"object-meta-data",onClick:function(ct){ct.stopPropagation()}}),G.getObjectSize(),He?v.a.createElement(ht,{rowHovered:rt,clickCallback:He,src:ze,theme:V,namespace:lt}):null,_e!==!1?G.getAddAttribute(rt):null,he!==!1?G.getRemoveObject(rt):null)},G}return U}(v.a.PureComponent);function Ft(D){var j=D.parent_type,U=D.namespace,G=D.quotesOnKeys,L=D.theme,Q=D.jsvRoot,te=D.name,X=D.displayArrayKey,V=D.name?D.name:"";return!Q||te!==!1&&te!==null?j=="array"?X?v.a.createElement("span",Object.assign({},I(L,"array-key"),{key:U}),v.a.createElement("span",{className:"array-key"},V),v.a.createElement("span",I(L,"colon"),":")):v.a.createElement("span",null):v.a.createElement("span",Object.assign({},I(L,"object-name"),{key:U}),v.a.createElement("span",{className:"object-key"},G&&v.a.createElement("span",{style:{verticalAlign:"top"}},'"'),v.a.createElement("span",null,V),G&&v.a.createElement("span",{style:{verticalAlign:"top"}},'"')),v.a.createElement("span",I(L,"colon"),":")):v.a.createElement("span",null)}function Dt(D){var j=D.theme;switch(D.iconStyle){case"triangle":return v.a.createElement(dt,Object.assign({},I(j,"expanded-icon"),{className:"expanded-icon"}));case"square":return v.a.createElement($e,Object.assign({},I(j,"expanded-icon"),{className:"expanded-icon"}));default:return v.a.createElement(Pe,Object.assign({},I(j,"expanded-icon"),{className:"expanded-icon"}))}}function zt(D){var j=D.theme;switch(D.iconStyle){case"triangle":return v.a.createElement(st,Object.assign({},I(j,"collapsed-icon"),{className:"collapsed-icon"}));case"square":return v.a.createElement(et,Object.assign({},I(j,"collapsed-icon"),{className:"collapsed-icon"}));default:return v.a.createElement(Qe,Object.assign({},I(j,"collapsed-icon"),{className:"collapsed-icon"}))}}var tr=function(D){h(U,D);var j=y(U);function U(G){var L;return c(this,U),(L=j.call(this,G)).toggleCollapsed=function(Q){var te=[];for(var X in L.state.expanded)te.push(L.state.expanded[X]);te[Q]=!te[Q],L.setState({expanded:te})},L.state={expanded:[]},L}return d(U,[{key:"getExpandedIcon",value:function(G){var L=this.props,Q=L.theme,te=L.iconStyle;return this.state.expanded[G]?v.a.createElement(Dt,{theme:Q,iconStyle:te}):v.a.createElement(zt,{theme:Q,iconStyle:te})}},{key:"render",value:function(){var G=this,L=this.props,Q=L.src,te=L.groupArraysAfterLength,X=(L.depth,L.name),V=L.theme,he=L.jsvRoot,_e=L.namespace,He=(L.parent_type,E(L,["src","groupArraysAfterLength","depth","name","theme","jsvRoot","namespace","parent_type"])),ze=0,lt=5*this.props.indentWidth;he||(ze=5*this.props.indentWidth);var rt=te,ct=Math.ceil(Q.length/rt);return v.a.createElement("div",Object.assign({className:"object-key-val"},I(V,he?"jsv-root":"objectKeyVal",{paddingLeft:ze})),v.a.createElement(Ft,this.props),v.a.createElement("span",null,v.a.createElement(tn,Object.assign({size:Q.length},this.props))),fe(Array(ct)).map(function(kt,yt){return v.a.createElement("div",Object.assign({key:yt,className:"object-key-val array-group"},I(V,"objectKeyVal",{marginLeft:6,paddingLeft:lt})),v.a.createElement("span",I(V,"brace-row"),v.a.createElement("div",Object.assign({className:"icon-container"},I(V,"icon-container"),{onClick:function(Ut){G.toggleCollapsed(yt)}}),G.getExpandedIcon(yt)),G.state.expanded[yt]?v.a.createElement(kr,Object.assign({key:X+yt,depth:0,name:!1,collapsed:!1,groupArraysAfterLength:rt,index_offset:yt*rt,src:Q.slice(yt*rt,yt*rt+rt),namespace:_e,type:"array",parent_type:"array_group",theme:V},He)):v.a.createElement("span",Object.assign({},I(V,"brace"),{onClick:function(Ut){G.toggleCollapsed(yt)},className:"array-group-brace"}),"[",v.a.createElement("div",Object.assign({},I(V,"array-group-meta-data"),{className:"array-group-meta-data"}),v.a.createElement("span",Object.assign({className:"object-size"},I(V,"object-size")),yt*rt," - ",yt*rt+rt>Q.length?Q.length:yt*rt+rt)),"]")))}))}}]),U}(v.a.PureComponent),wn=function(D){h(U,D);var j=y(U);function U(G){var L;c(this,U),(L=j.call(this,G)).toggleCollapsed=function(){L.setState({expanded:!L.state.expanded},function(){De.set(L.props.rjvId,L.props.namespace,"expanded",L.state.expanded)})},L.getObjectContent=function(te,X,V){return v.a.createElement("div",{className:"pushed-content object-container"},v.a.createElement("div",Object.assign({className:"object-content"},I(L.props.theme,"pushed-content")),L.renderObjectContents(X,V)))},L.getEllipsis=function(){return L.state.size===0?null:v.a.createElement("div",Object.assign({},I(L.props.theme,"ellipsis"),{className:"node-ellipsis",onClick:L.toggleCollapsed}),"...")},L.getObjectMetaData=function(te){var X=L.props,V=(X.rjvId,X.theme,L.state),he=V.size,_e=V.hovered;return v.a.createElement(tn,Object.assign({rowHovered:_e,size:he},L.props))},L.renderObjectContents=function(te,X){var V,he=L.props,_e=he.depth,He=he.parent_type,ze=he.index_offset,lt=he.groupArraysAfterLength,rt=he.namespace,ct=L.state.object_type,kt=[],yt=Object.keys(te||{});return L.props.sortKeys&&ct!=="array"&&(yt=yt.sort()),yt.forEach(function(Ut){if(V=new Vn(Ut,te[Ut]),He==="array_group"&&ze&&(V.name=parseInt(V.name)+ze),te.hasOwnProperty(Ut))if(V.type==="object")kt.push(v.a.createElement(kr,Object.assign({key:V.name,depth:_e+1,name:V.name,src:V.value,namespace:rt.concat(V.name),parent_type:ct},X)));else if(V.type==="array"){var Pn=kr;lt&&V.value.length>lt&&(Pn=tr),kt.push(v.a.createElement(Pn,Object.assign({key:V.name,depth:_e+1,name:V.name,src:V.value,namespace:rt.concat(V.name),type:"array",parent_type:ct},X)))}else kt.push(v.a.createElement(Gt,Object.assign({key:V.name+"_"+rt,variable:V,singleIndent:5,namespace:rt,type:L.props.type},X)))}),kt};var Q=U.getState(G);return L.state=l(l({},Q),{},{prevProps:{}}),L}return d(U,[{key:"getBraceStart",value:function(G,L){var Q=this,te=this.props,X=te.src,V=te.theme,he=te.iconStyle;if(te.parent_type==="array_group")return v.a.createElement("span",null,v.a.createElement("span",I(V,"brace"),G==="array"?"[":"{"),L?this.getObjectMetaData(X):null);var _e=L?Dt:zt;return v.a.createElement("span",null,v.a.createElement("span",Object.assign({onClick:function(He){Q.toggleCollapsed()}},I(V,"brace-row")),v.a.createElement("div",Object.assign({className:"icon-container"},I(V,"icon-container")),v.a.createElement(_e,{theme:V,iconStyle:he})),v.a.createElement(Ft,this.props),v.a.createElement("span",I(V,"brace"),G==="array"?"[":"{")),L?this.getObjectMetaData(X):null)}},{key:"render",value:function(){var G=this,L=this.props,Q=L.depth,te=L.src,X=(L.namespace,L.name,L.type,L.parent_type),V=L.theme,he=L.jsvRoot,_e=L.iconStyle,He=E(L,["depth","src","namespace","name","type","parent_type","theme","jsvRoot","iconStyle"]),ze=this.state,lt=ze.object_type,rt=ze.expanded,ct={};return he||X==="array_group"?X==="array_group"&&(ct.borderLeft=0,ct.display="inline"):ct.paddingLeft=5*this.props.indentWidth,v.a.createElement("div",Object.assign({className:"object-key-val",onMouseEnter:function(){return G.setState(l(l({},G.state),{},{hovered:!0}))},onMouseLeave:function(){return G.setState(l(l({},G.state),{},{hovered:!1}))}},I(V,he?"jsv-root":"objectKeyVal",ct)),this.getBraceStart(lt,rt),rt?this.getObjectContent(Q,te,l({theme:V,iconStyle:_e},He)):this.getEllipsis(),v.a.createElement("span",{className:"brace-row"},v.a.createElement("span",{style:l(l({},I(V,"brace").style),{},{paddingLeft:rt?"3px":"0px"})},lt==="array"?"]":"}"),rt?null:this.getObjectMetaData(te)))}}],[{key:"getDerivedStateFromProps",value:function(G,L){var Q=L.prevProps;return G.src!==Q.src||G.collapsed!==Q.collapsed||G.name!==Q.name||G.namespace!==Q.namespace||G.rjvId!==Q.rjvId?l(l({},U.getState(G)),{},{prevProps:G}):null}}]),U}(v.a.PureComponent);wn.getState=function(D){var j=Object.keys(D.src).length,U=(D.collapsed===!1||D.collapsed!==!0&&D.collapsed>D.depth)&&(!D.shouldCollapse||D.shouldCollapse({name:D.name,src:D.src,type:T(D.src),namespace:D.namespace})===!1)&&j!==0;return{expanded:De.get(D.rjvId,D.namespace,"expanded",U),object_type:D.type==="array"?"array":"object",parent_type:D.type==="array"?"array":"object",size:j,hovered:!1}};var Vn=function D(j,U){c(this,D),this.name=j,this.value=U,this.type=T(U)};S(wn);var kr=wn,ue=function(D){h(U,D);var j=y(U);function U(){var G;c(this,U);for(var L=arguments.length,Q=new Array(L),te=0;te<L;te++)Q[te]=arguments[te];return(G=j.call.apply(j,[this].concat(Q))).render=function(){var X=m(G).props,V=[X.name],he=kr;return Array.isArray(X.src)&&X.groupArraysAfterLength&&X.src.length>X.groupArraysAfterLength&&(he=tr),v.a.createElement("div",{className:"pretty-json-container object-container"},v.a.createElement("div",{className:"object-content"},v.a.createElement(he,Object.assign({namespace:V,depth:0,jsvRoot:!0},X))))},G}return U}(v.a.PureComponent),ye=function(D){h(U,D);var j=y(U);function U(G){var L;return c(this,U),(L=j.call(this,G)).closeModal=function(){Oe.dispatch({rjvId:L.props.rjvId,name:"RESET"})},L.submit=function(){L.props.submit(L.state.input)},L.state={input:G.input?G.input:""},L}return d(U,[{key:"render",value:function(){var G=this,L=this.props,Q=L.theme,te=L.rjvId,X=L.isValid,V=this.state.input,he=X(V);return v.a.createElement("div",Object.assign({className:"key-modal-request"},I(Q,"key-modal-request"),{onClick:this.closeModal}),v.a.createElement("div",Object.assign({},I(Q,"key-modal"),{onClick:function(_e){_e.stopPropagation()}}),v.a.createElement("div",I(Q,"key-modal-label"),"Key Name:"),v.a.createElement("div",{style:{position:"relative"}},v.a.createElement("input",Object.assign({},I(Q,"key-modal-input"),{className:"key-modal-input",ref:function(_e){return _e&&_e.focus()},spellCheck:!1,value:V,placeholder:"...",onChange:function(_e){G.setState({input:_e.target.value})},onKeyPress:function(_e){he&&_e.key==="Enter"?G.submit():_e.key==="Escape"&&G.closeModal()}})),he?v.a.createElement(We,Object.assign({},I(Q,"key-modal-submit"),{className:"key-modal-submit",onClick:function(_e){return G.submit()}})):null),v.a.createElement("span",I(Q,"key-modal-cancel"),v.a.createElement(Re,Object.assign({},I(Q,"key-modal-cancel-icon"),{className:"key-modal-cancel",onClick:function(){Oe.dispatch({rjvId:te,name:"RESET"})}})))))}}]),U}(v.a.PureComponent),xe=function(D){h(U,D);var j=y(U);function U(){var G;c(this,U);for(var L=arguments.length,Q=new Array(L),te=0;te<L;te++)Q[te]=arguments[te];return(G=j.call.apply(j,[this].concat(Q))).isValid=function(X){var V=G.props.rjvId,he=De.get(V,"action","new-key-request");return X!=""&&Object.keys(he.existing_value).indexOf(X)===-1},G.submit=function(X){var V=G.props.rjvId,he=De.get(V,"action","new-key-request");he.new_value=l({},he.existing_value),he.new_value[X]=G.props.defaultValue,Oe.dispatch({name:"VARIABLE_ADDED",rjvId:V,data:he})},G}return d(U,[{key:"render",value:function(){var G=this.props,L=G.active,Q=G.theme,te=G.rjvId;return L?v.a.createElement(ye,{rjvId:te,theme:Q,isValid:this.isValid,submit:this.submit}):null}}]),U}(v.a.PureComponent),Ce=function(D){h(U,D);var j=y(U);function U(){return c(this,U),j.apply(this,arguments)}return d(U,[{key:"render",value:function(){var G=this.props,L=G.message,Q=G.active,te=G.theme,X=G.rjvId;return Q?v.a.createElement("div",Object.assign({className:"validation-failure"},I(te,"validation-failure"),{onClick:function(){Oe.dispatch({rjvId:X,name:"RESET"})}}),v.a.createElement("span",I(te,"validation-failure-label"),L),v.a.createElement(Re,I(te,"validation-failure-clear"))):null}}]),U}(v.a.PureComponent),N=function(D){h(U,D);var j=y(U);function U(G){var L;return c(this,U),(L=j.call(this,G)).rjvId=Date.now().toString(),L.getListeners=function(){return{reset:L.resetState,"variable-update":L.updateSrc,"add-key-request":L.addKeyRequest}},L.updateSrc=function(){var Q,te=De.get(L.rjvId,"action","variable-update"),X=te.name,V=te.namespace,he=te.new_value,_e=te.existing_value,He=(te.variable_removed,te.updated_src),ze=te.type,lt=L.props,rt=lt.onEdit,ct=lt.onDelete,kt=lt.onAdd,yt={existing_src:L.state.src,new_value:he,updated_src:He,name:X,namespace:V,existing_value:_e};switch(ze){case"variable-added":Q=kt(yt);break;case"variable-edited":Q=rt(yt);break;case"variable-removed":Q=ct(yt)}Q!==!1?(De.set(L.rjvId,"global","src",He),L.setState({src:He})):L.setState({validationFailure:!0})},L.addKeyRequest=function(){L.setState({addKeyRequest:!0})},L.resetState=function(){L.setState({validationFailure:!1,addKeyRequest:!1})},L.state={addKeyRequest:!1,editKeyRequest:!1,validationFailure:!1,src:U.defaultProps.src,name:U.defaultProps.name,theme:U.defaultProps.theme,validationMessage:U.defaultProps.validationMessage,prevSrc:U.defaultProps.src,prevName:U.defaultProps.name,prevTheme:U.defaultProps.theme},L}return d(U,[{key:"componentDidMount",value:function(){De.set(this.rjvId,"global","src",this.state.src);var G=this.getListeners();for(var L in G)De.on(L+"-"+this.rjvId,G[L]);this.setState({addKeyRequest:!1,editKeyRequest:!1})}},{key:"componentDidUpdate",value:function(G,L){L.addKeyRequest!==!1&&this.setState({addKeyRequest:!1}),L.editKeyRequest!==!1&&this.setState({editKeyRequest:!1}),G.src!==this.state.src&&De.set(this.rjvId,"global","src",this.state.src)}},{key:"componentWillUnmount",value:function(){var G=this.getListeners();for(var L in G)De.removeListener(L+"-"+this.rjvId,G[L])}},{key:"render",value:function(){var G=this.state,L=G.validationFailure,Q=G.validationMessage,te=G.addKeyRequest,X=G.theme,V=G.src,he=G.name,_e=this.props,He=_e.style,ze=_e.defaultValue;return v.a.createElement("div",{className:"react-json-view",style:l(l({},I(X,"app-container").style),He)},v.a.createElement(Ce,{message:Q,active:L,theme:X,rjvId:this.rjvId}),v.a.createElement(ue,Object.assign({},this.props,{src:V,name:he,theme:X,type:T(V),rjvId:this.rjvId})),v.a.createElement(xe,{active:te,theme:X,rjvId:this.rjvId,defaultValue:ze}))}}],[{key:"getDerivedStateFromProps",value:function(G,L){if(G.src!==L.prevSrc||G.name!==L.prevName||G.theme!==L.prevTheme){var Q={src:G.src,name:G.name,theme:G.theme,validationMessage:G.validationMessage,prevSrc:G.src,prevName:G.name,prevTheme:G.theme};return U.validateState(Q)}return null}}]),U}(v.a.PureComponent);N.defaultProps={src:{},name:"root",theme:"rjv-default",collapsed:!1,collapseStringsAfterLength:!1,shouldCollapse:!1,sortKeys:!1,quotesOnKeys:!0,groupArraysAfterLength:100,indentWidth:4,enableClipboard:!0,displayObjectSize:!0,displayDataTypes:!0,onEdit:!1,onDelete:!1,onAdd:!1,onSelect:!1,iconStyle:"triangle",style:{},validationMessage:"Validation Error",defaultValue:null,displayArrayKey:!0},N.validateState=function(D){var j={};return T(D.theme)!=="object"||function(U){var G=["base00","base01","base02","base03","base04","base05","base06","base07","base08","base09","base0A","base0B","base0C","base0D","base0E","base0F"];if(T(U)==="object"){for(var L=0;L<G.length;L++)if(!(G[L]in U))return!1;return!0}return!1}(D.theme)||(console.error("react-json-view error:","theme prop must be a theme name or valid base-16 theme object.",'defaulting to "rjv-default" theme'),j.theme="rjv-default"),T(D.src)!=="object"&&T(D.src)!=="array"&&(console.error("react-json-view error:","src property must be a valid json object"),j.name="ERROR",j.src={message:"src property must be a valid json object"}),l(l({},D),j)},S(N),i.default=N}])})})(ane);var o7e=ane.exports;const lne=mg(o7e);function cne(){const{settings:{context:t}}=In();return t.app.theme.current===Zn.System?_f():t.app.theme.current}const a7e=()=>{const{programMemory:t}=uc();function e(){globalThis&&"navigator"in globalThis&&navigator.clipboard.writeText(JSON.stringify(t)).then(()=>jt.success("Program memory copied to clipboard")).catch(n=>pt(new Error("Failed to copy program memory to clipboard")))}return b.jsx(b.Fragment,{children:b.jsx($t,{Element:"button",iconStart:{icon:"clipboardPlus",iconClassName:"!text-current",bgClassName:"bg-transparent"},className:"!p-0 !bg-transparent hover:text-primary border-transparent hover:border-primary !outline-none",onClick:e,children:b.jsx(Fr,{position:"bottom-right",delay:750,children:"Copy to clipboard"})})})},l7e=()=>{const t=cne(),{programMemory:e}=uc(),{state:n}=Ti(),r=P.useMemo(()=>c7e(e),[e]);return b.jsxs("div",{className:"h-full relative",children:[b.jsx("div",{className:"absolute inset-0 p-2 flex flex-col items-start",children:b.jsx("div",{className:"overflow-auto h-full w-full pb-12",children:b.jsx(lne,{src:r,collapsed:1,collapseStringsAfterLength:60,enableClipboard:!1,displayDataTypes:!1,displayObjectSize:!0,indentWidth:2,quotesOnKeys:!1,sortKeys:!0,name:!1,theme:t==="light"?"rjv-default":"monokai"})})}),n.matches("Sketch")&&b.jsx("div",{className:"absolute inset-0 dark:bg-chalkboard-90/80 bg-chalkboard-10/80 cursor-not-allowed",title:"Variables won't update in sketch mode"})]})},c7e=t=>{var n,r,i;const e={};for(const[s,o]of t==null?void 0:t.visibleEntries())if(typeof o.value!="function"){const a=js(o,null);o.type==="Solid"?e[s]=o.value.map(({...l})=>l):ie(a)?o.type==="Function"?e[s]=`__function(${(i=(r=(n=o==null?void 0:o.expression)==null?void 0:n.params)==null?void 0:r.map)==null?void 0:i.call(r,({identifier:l})=>(l==null?void 0:l.name)||"").join(", ")})__`:e[s]=o.value:e[s]=a.value.map(({__geoMeta:l,...c})=>c)}else s!=="log"&&(e[s]="__function__");return e},u7e=lne,d7e=()=>{const t=cne(),{logs:e}=uc();return b.jsx("div",{className:"overflow-hidden",children:b.jsx("div",{className:"absolute inset-0 p-2 flex flex-col overflow-auto",children:b.jsx(u7e,{src:e,collapsed:1,collapseStringsAfterLength:60,enableClipboard:!1,displayArrayKey:!1,displayDataTypes:!1,displayObjectSize:!0,indentWidth:2,quotesOnKeys:!1,name:!1,theme:t==="light"?"rjv-default":"monokai"})})})};function une({arr:t,filterKeys:e}){return b.jsx(b.Fragment,{children:t.map((n,r)=>b.jsx("div",{className:"my-2",children:n&&typeof n=="object"?b.jsx(dne,{obj:n,filterKeys:e}):S_(n)?b.jsx("span",{children:n.toString()}):b.jsx("span",{children:n})},r))})}function dne({obj:t,filterKeys:e}){const n=P.useRef(null),[r,i]=P.useState(!1);return b.jsx("pre",{ref:n,className:"ml-2 border-l border-violet-600 pl-1 ",children:r?b.jsxs("button",{className:"m-0 p-0 border-0",onClick:()=>i(!1),children:[">","type: ",t.type]}):b.jsxs("span",{className:"flex",children:[b.jsx("button",{className:"m-0 p-0 border-0 mb-auto",onClick:()=>i(!0),children:"⬇️"}),b.jsx("ul",{className:"inline-block",children:Object.entries(t).map(([s,o])=>e.includes(s)?null:sI(o)?b.jsxs("li",{children:[`${s}: [`,b.jsx(une,{arr:o,filterKeys:e}),"]"]},s):typeof o=="object"&&o!==null?b.jsxs("li",{children:[s,":",b.jsx(dne,{obj:o,filterKeys:e})]},s):S_(o)?b.jsxs("li",{children:[s,": ",o.toString()]},s):null)})]})})}function f7e(){const t=P.useMemo(()=>h7e(je.artifactGraph),[je.artifactGraph]),e=["__meta","codeRef","pathToNode"];return b.jsxs("details",{"data-testid":"debug-feature-tree",className:"relative",children:[b.jsx("summary",{children:"Feature Tree"}),t.length>0?b.jsx("pre",{className:"text-xs",children:b.jsx(une,{arr:t,filterKeys:e})}):b.jsx("p",{children:"(Empty)"})]})}function h7e(t){let e=[];const n=[];for(const i of t.values())i.type==="plane"&&n.push(Gbe(i,t));const r=n.map(i=>i);return e=e.concat(r),e}function A7e(){var o,a;const{context:t}=Ti(),e=un(be.ast,(a=(o=t.selectionRanges.codeBasedSelections)==null?void 0:o[0])==null?void 0:a.range),[n,r]=P.useState(["start","end"]),i=Xe(be.ast,e);if(pt(i))return;const s=i;return b.jsxs("div",{id:"ast-explorer",className:"relative",children:[b.jsxs("div",{className:"",children:["filter out keys:",b.jsx("div",{className:"w-2 inline-block"}),["start","end","type"].map(l=>b.jsxs("label",{className:"inline-flex items-center",children:[b.jsx("input",{type:"checkbox",className:"form-checkbox",checked:n.includes(l),onChange:c=>{n.includes(l)?r(n.filter(u=>u!==l)):r([...n,l])}}),b.jsx("span",{className:"mr-2",children:l})]},l))]}),b.jsx("div",{className:"h-full relative",onMouseLeave:l=>{Ot.setHighlightRange([[0,0]])},children:b.jsx("pre",{className:"text-xs",children:b.jsx(hO,{obj:be.ast,filterKeys:n,node:s})})})]})}function p7e({body:t,filterKeys:e,node:n}){return b.jsx(b.Fragment,{children:t.map((r,i)=>b.jsx("div",{className:"my-2",children:b.jsx(hO,{obj:r,filterKeys:e,node:n})},i))})}function hO({obj:t,filterKeys:e,node:n}){const{send:r}=Ti(),i=P.useRef(null),[s,o]=P.useState(!1),[a,l]=P.useState(!1);return P.useEffect(()=>{var c,u;(n==null?void 0:n.start)===(t==null?void 0:t.start)&&(n==null?void 0:n.end)===(t==null?void 0:t.end)&&n.type===(t==null?void 0:t.type)?((u=(c=i==null?void 0:i.current)==null?void 0:c.scrollIntoView)==null||u.call(c,{behavior:"smooth",block:"center"}),o(!0)):o(!1)},[n.start,n.end,n.type]),b.jsx("pre",{ref:i,className:`ml-2 border-l border-violet-600 pl-1 ${s?"bg-violet-100/80 dark:bg-violet-100/25":""}`,onMouseEnter:c=>{Ot.setHighlightRange([[(t==null?void 0:t.start)||0,t.end]]),c.stopPropagation()},onMouseMove:c=>{c.stopPropagation(),Ot.setHighlightRange([[(t==null?void 0:t.start)||0,t.end]])},onClick:c=>{r({type:"Set selection",data:{selectionType:"singleCodeCursor",selection:{type:"default",range:[(t==null?void 0:t.start)||0,t.end||0]}}}),c.stopPropagation()},children:a?b.jsxs("button",{className:"m-0 p-0 border-0",onClick:()=>l(!1),children:[">","type: ",t.type]}):b.jsx("span",{className:"flex",children:b.jsx("ul",{className:"inline-block",children:Object.entries(t).map(([c,u])=>e.includes(c)?null:Array.isArray(u)?b.jsxs("li",{children:[`${c}: [`,b.jsx(p7e,{body:u,filterKeys:e,node:n}),"]"]},c):typeof u=="object"&&u!==null&&(u!=null&&u.end)?b.jsxs("li",{children:[c,":",b.jsx(hO,{obj:u,filterKeys:e,node:n})]},c):typeof u=="string"||typeof u=="number"?b.jsxs("li",{children:[c,": ",u]},c):null)})})})}function fne(){const[t,e]=P.useState(je.commandLogs);return P.useEffect(()=>{je.registerCommandLogCallback(n=>e(n))},[]),[t,()=>je.clearCommandLogs()]}const m7e=()=>{const[t,e]=fne(),[n,r]=P.useState(""),[i,s]=P.useState("");return b.jsxs("div",{children:[b.jsx("input",{className:"text-gray-800 bg-slate-300 px-2","data-testid":"filter-input",type:"text",value:n,onChange:o=>r(o.target.value),placeholder:"Filter"}),b.jsx("div",{className:"max-w-xl max-h-36 overflow-auto",children:t.map((o,a)=>{var c,u;const l=JSON.stringify(o);return n&&!l.includes(n)?null:b.jsx("pre",{className:"text-xs",children:b.jsx("code",{"data-message-type":o.type,"data-command-type":(o.type==="send-modeling"||o.type==="send-scene")&&o.data.type==="modeling_cmd_req"?(u=(c=o==null?void 0:o.data)==null?void 0:c.cmd)==null?void 0:u.type:"","data-command-id":(o.type==="send-modeling"||o.type==="send-scene")&&o.data.type==="modeling_cmd_req"?o.data.cmd_id:"","data-receive-command-type":o.type==="receive-reliable"?o.cmd_type:"",children:JSON.stringify(o,null,2)},a)},a)})}),b.jsx("button",{"data-testid":"clear-commands",onClick:e,children:"Clear"}),b.jsx("br",{}),b.jsx("input",{className:"text-gray-800 bg-slate-300 px-2",type:"text",value:i,onChange:o=>s(o.target.value),placeholder:"JSON command","data-testid":"custom-cmd-input"}),b.jsx("button",{"data-testid":"custom-cmd-send-button",onClick:()=>{je.sendSceneCommand(JSON.parse(i)).catch(Bt)},children:"Send custom command"})]})},g7e=()=>b.jsx("section",{"data-testid":"debug-panel",className:"absolute inset-0 p-2 box-border overflow-auto",children:b.jsxs("div",{className:"flex flex-col",children:[b.jsx(m7e,{}),b.jsx(Y5e,{}),b.jsx(A7e,{}),b.jsx(f7e,{})]})}),y7e="_folder_1omtm_1",v7e={folder:y7e};function hne({title:t,onConfirm:e,onDismiss:n,children:r}){return b.jsx(ir,{open:!0,onClose:n,className:"relative z-50",children:b.jsx("div",{className:"fixed inset-0 grid bg-chalkboard-110/80 place-content-center",children:b.jsxs(ir.Panel,{className:"max-w-2xl p-4 border rounded bg-chalkboard-10 dark:bg-chalkboard-100 border-destroy-80",children:[b.jsx(ir.Title,{as:"h2",className:"mb-4 text-2xl font-bold",children:t}),b.jsx(ir.Description,{children:r}),b.jsxs("div",{className:"flex justify-between",children:[b.jsx($t,{Element:"button",onClick:e,iconStart:{icon:"trash",bgClassName:"bg-destroy-10 dark:bg-destroy-80",iconClassName:"!text-destroy-80 dark:!text-destroy-20"},className:"hover:border-destroy-40 dark:hover:border-destroy-40 hover:bg-destroy-10/20 dark:hover:bg-destroy-80/20","data-testid":"delete-confirmation",children:"Delete"}),b.jsx($t,{Element:"button",onClick:n,children:"Cancel"})]})]})})})}const b7e=[b.jsx(pne,{}),b.jsx(w7e,{})];function Ane({items:t=b7e,menuTargetElement:e,className:n,...r}){var f,h;const i=P.useRef(null),[s,o]=P.useState(!1),[a,l]=P.useState({width:(f=globalThis==null?void 0:globalThis.window)==null?void 0:f.innerWidth,height:(h=globalThis==null?void 0:globalThis.window)==null?void 0:h.innerHeight}),[c,u]=P.useState({x:0,y:0});Tr("esc",()=>o(!1),{enabled:s});const d=P.useMemo(()=>i.current?{top:c.y+i.current.clientHeight>a.height?"auto":c.y,left:c.x+i.current.clientWidth>a.width?"auto":c.x,right:c.x+i.current.clientWidth>a.width?a.width-c.x:"auto",bottom:c.y+i.current.clientHeight>a.height?a.height-c.y:"auto"}:{top:0,left:0,right:"auto",bottom:"auto"},[c,a,i.current]);return P.useEffect(()=>{var p;const A=()=>{var m,g;l({width:(m=globalThis==null?void 0:globalThis.window)==null?void 0:m.innerWidth,height:(g=globalThis==null?void 0:globalThis.window)==null?void 0:g.innerHeight})};return(p=globalThis==null?void 0:globalThis.window)==null||p.addEventListener("resize",A),()=>{var m;(m=globalThis==null?void 0:globalThis.window)==null||m.removeEventListener("resize",A)}},[]),P.useEffect(()=>{var p;const A=m=>{console.log("context menu",m),m.preventDefault(),u({x:m.x,y:m.y}),o(!0)};return(p=e==null?void 0:e.current)==null||p.addEventListener("contextmenu",A),()=>{var m;(m=e==null?void 0:e.current)==null||m.removeEventListener("contextmenu",A)}},[e==null?void 0:e.current]),b.jsx(ir,{open:s,onClose:()=>o(!1),children:b.jsxs("div",{className:"fixed inset-0 z-50 w-screen h-screen",onContextMenu:A=>A.preventDefault(),children:[b.jsx(ir.Backdrop,{className:"fixed z-10 inset-0"}),b.jsx(ir.Panel,{ref:i,className:`w-48 fixed bg-chalkboard-10 dark:bg-chalkboard-90
          border border-solid border-chalkboard-10 dark:border-chalkboard-90 rounded
          shadow-lg backdrop:fixed backdrop:inset-0 backdrop:bg-primary ${n}`,style:{...d,...r.style},children:b.jsxs("ul",{...r,className:"relative flex flex-col gap-0.5 items-stretch content-stretch",onClick:()=>o(!1),children:[...t]})})]})})}function rz(){return b.jsx("hr",{className:"border-chalkboard-20 dark:border-chalkboard-80"})}function Rh(t){const{children:e,icon:n,onClick:r,hotkey:i}=t;return b.jsxs("button",{"data-testid":t["data-testid"],className:"flex items-center gap-2 py-1 px-2 cursor-pointer hover:bg-chalkboard-20 dark:hover:bg-chalkboard-80 border-none text-left",onClick:r,children:[n&&b.jsx(vs,{icon:n,bgClassName:"!bg-transparent"}),b.jsx("div",{className:"flex-1",children:e}),i&&b.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-primary/10 text-primary dark:bg-chalkboard-80 dark:text-chalkboard-40",children:i})]})}function pne(){return b.jsx(Rh,{icon:"arrowRotateRight",onClick:()=>{var t;return(t=globalThis==null?void 0:globalThis.window)==null?void 0:t.location.reload()},children:"Refresh"})}function w7e({toBeCopiedContent:t=(r=>(r=(n=>(n=globalThis.window)==null?void 0:n.getSelection())())==null?void 0:r.toString())(),toBeCopiedLabel:e="selection"}){return b.jsx(Rh,{icon:"clipboardPlus",onClick:()=>{var i;t&&((i=globalThis==null?void 0:globalThis.navigator)==null||i.clipboard.writeText(t).then(()=>jt.success(`Copied ${e} to clipboard`)).catch(()=>jt.error(`Failed to copy ${e} to clipboard`)))},children:"Copy"})}const mne=(t,e=`
`)=>t.replace(/\r?\n/g,e);function Y0(t){return`calc(1rem * ${t+1})`}function iz({fileOrDir:t,onSubmit:e,level:n=0}){const{send:r}=hA(),i=P.useRef(null);function s(a){var l;a.preventDefault(),r({type:"Rename file",data:{oldName:t.name||"",newName:((l=i.current)==null?void 0:l.value)||t.name||"",isDir:t.children!==null}})}function o(a){a.key==="Escape"&&(a.stopPropagation(),e())}return b.jsxs("form",{onSubmit:s,children:[b.jsxs("label",{children:[b.jsx("span",{className:"sr-only",children:"Rename file"}),b.jsx("input",{"data-testid":"file-rename-field",ref:i,type:"text",autoFocus:!0,autoCapitalize:"off",autoCorrect:"off",placeholder:t.name,className:"w-full py-1 bg-transparent text-chalkboard-100 placeholder:text-chalkboard-70 dark:text-chalkboard-10 dark:placeholder:text-chalkboard-50 focus:outline-none focus:ring-0",onKeyDown:o,onBlur:e,style:{paddingInlineStart:Y0(n)}})]}),b.jsx("button",{className:"sr-only",type:"submit",children:"Submit"})]})}function x7e({fileOrDir:t,setIsOpen:e}){const{send:n}=hA();return b.jsxs(hne,{title:`Delete ${t.children!==null?"folder":"file"}`,onDismiss:()=>e(!1),onConfirm:()=>{n({type:"Delete file",data:t}),e(!1)},children:[b.jsxs("p",{className:"my-4",children:['This will permanently delete "',t.name||"this file",'"',t.children!==null?" and all of its contents. ":". "]}),b.jsxs("p",{className:"my-4",children:['Are you sure you want to delete "',t.name||"this file",'"? This action cannot be undone.']})]})}const gne=({project:t,currentFile:e,fileOrDir:n,onNavigateToFile:r,level:i=0})=>{var v;const{send:s,context:o}=hA(),{onFileOpen:a,onFileClose:l}=bu(),c=Ui(),[u,d]=P.useState(!1),f=n.path===(e==null?void 0:e.path),h=P.useRef(null);x2(async(x,C)=>{if(f&&x!=="unlink"){let _=await window.electron.readFile(C,{encoding:"utf-8"});_=mne(_),Kt.updateCodeStateEditor(_)}s({type:"Refresh"})},[n.path]);const A=o.itemsBeingRenamed.includes(n.path),p=P.useCallback(()=>s({type:"assign",data:{itemsBeingRenamed:o.itemsBeingRenamed.filter(x=>x!==n.path)}}),[o.itemsBeingRenamed,n.path,s]),m=P.useCallback(()=>{s({type:"assign",data:{itemsBeingRenamed:[...o.itemsBeingRenamed,n.path]}})},[o.itemsBeingRenamed,n.path,s]),g=()=>{s({type:"Set selected directory",directory:n})};function y(x){x.metaKey&&x.key==="Backspace"?d(!0):x.key==="Enter"?m():x.code==="Space"&&w()}function w(){var x;n.children===null&&(((x=n.name)==null?void 0:x.endsWith(Ss))===!1&&(t!=null&&t.path)?(Kt.updateCodeStateEditor(`import("${n.path.replace(t.path,".")}")
`+Kt.code),Kt.writeToFile(),be.executeCode(!0)):(l((e==null?void 0:e.path)||null,(t==null?void 0:t.path)||null),a(n.path,(t==null?void 0:t.path)||null),c(`${ut.FILE}/${encodeURIComponent(n.path)}`)),r==null||r())}return b.jsxs("div",{className:"contents","data-testid":"file-tree-item",ref:h,children:[n.children===null?b.jsx("li",{className:"group m-0 p-0 border-solid border-0 hover:bg-primary/5 focus-within:bg-primary/5 dark:hover:bg-primary/20 dark:focus-within:bg-primary/20 "+(f?"!bg-primary/10 !text-primary dark:!bg-primary/20 dark:!text-inherit":""),children:A?b.jsx(iz,{fileOrDir:n,onSubmit:p,level:i}):b.jsxs("button",{className:"flex gap-1 items-center py-0.5 rounded-none border-none p-0 m-0 text-sm w-full hover:!bg-transparent text-left !text-inherit",style:{paddingInlineStart:Y0(i)},onClick:x=>{x.currentTarget.focus(),w()},onKeyUp:y,children:[b.jsx(nn,{name:(v=n.name)!=null&&v.endsWith(Ss)?"kcl":"file",className:"inline-block w-3 text-current"}),n.name]})}):b.jsx(nB,{defaultOpen:e==null?void 0:e.path.includes(n.path),children:({open:x})=>{var C;return b.jsxs("div",{className:"group",children:[A?b.jsxs("div",{className:"flex items-center",style:{paddingInlineStart:Y0(i)},children:[b.jsx(Zh,{icon:kH,className:"inline-block mr-2 m-0 p-0 w-2 h-2 "+(x?"transform rotate-90":"")}),b.jsx(iz,{fileOrDir:n,onSubmit:p,level:-1})]}):b.jsxs(nB.Button,{className:" group border-none text-sm rounded-none p-0 m-0 flex items-center justify-start w-full py-0.5 hover:text-primary hover:bg-primary/5 dark:hover:text-inherit dark:hover:bg-primary/10"+(o.selectedDirectory.path.includes(n.path)?" ui-open:bg-primary/10":""),style:{paddingInlineStart:Y0(i)},onClick:_=>_.currentTarget.focus(),onClickCapture:g,onFocusCapture:g,onKeyDown:_=>_.key==="Enter"&&_.preventDefault(),onKeyUp:y,children:[b.jsx(Zh,{icon:kH,className:"inline-block mr-2 m-0 p-0 w-2 h-2 "+(x?"transform rotate-90":"")}),n.name]}),b.jsx(nB.Panel,{className:v7e.folder,style:{"--indent-line-left":Y0(i)},children:b.jsx("ul",{className:"m-0 p-0",onClickCapture:_=>{s({type:"Set selected directory",directory:n})},onFocusCapture:_=>s({type:"Set selected directory",directory:n}),children:(C=n.children)==null?void 0:C.map(_=>b.jsx(gne,{fileOrDir:_,project:t,currentFile:e,onNavigateToFile:r,level:i+1},i+"-"+_.path))})})]})}}),u&&b.jsx(x7e,{fileOrDir:n,setIsOpen:d}),b.jsx(C7e,{itemRef:h,onRename:m,onDelete:()=>d(!0)})]})};function C7e({itemRef:t,onRename:e,onDelete:n}){const i=kv()==="macos"?"⌘":"Ctrl";return b.jsx(Ane,{menuTargetElement:t,items:[b.jsx(Rh,{"data-testid":"context-menu-rename",onClick:e,hotkey:"Enter",children:"Rename"}),b.jsx(Rh,{"data-testid":"context-menu-delete",onClick:n,hotkey:i+" + Del",children:"Delete"})]})}const _7e=()=>{const{send:t}=hA(),{send:e}=Ti();function n(){t({type:"Create file",data:{name:"",makeDir:!1,shouldSetToRename:!0}}),e({type:"Cancel"})}function r(){t({type:"Create file",data:{name:"",makeDir:!0,shouldSetToRename:!0}})}return Vy(["mod + n"],n),Vy(["mod + shift + n"],r),b.jsxs(b.Fragment,{children:[b.jsx($t,{Element:"button","data-testid":"create-file-button",iconStart:{icon:"filePlus",iconClassName:"!text-current",bgClassName:"bg-transparent"},className:"!p-0 !bg-transparent hover:text-primary border-transparent hover:border-primary !outline-none",onClick:n,children:b.jsx(Fr,{position:"bottom-right",delay:750,children:"Create file"})}),b.jsx($t,{Element:"button","data-testid":"create-folder-button",iconStart:{icon:"folderPlus",iconClassName:"!text-current",bgClassName:"bg-transparent"},className:"!p-0 !bg-transparent hover:text-primary border-transparent hover:border-primary !outline-none",onClick:r,children:b.jsx(Fr,{position:"bottom-right",delay:750,children:"Create folder"})})]})},S7e=({onNavigateToFile:t})=>{var o,a;const e=hf(ut.FILE),{send:n,context:r}=hA(),{send:i}=Ti();x2(async(l,c)=>{var f;((f=e.file)==null?void 0:f.path)===c&&l==="change"||n({type:"Refresh"})},[(o=e==null?void 0:e.project)==null?void 0:o.path,r.selectedDirectory.path].filter(l=>l!==void 0));const s=()=>{n({type:"Set selected directory",directory:r.project})};return b.jsx("div",{className:"overflow-auto pb-12 absolute inset-0","data-testid":"file-pane-scroll-container",children:b.jsx("ul",{className:"m-0 p-0 text-sm",onClickCapture:s,children:fee(((a=r.project)==null?void 0:a.children)||[]).map(l=>b.jsx(gne,{project:r.project,currentFile:e==null?void 0:e.file,fileOrDir:l,onNavigateToFile:()=>{i({type:"Cancel"}),t==null||t()}},l.path))})})},qw=[{id:"code",title:"KCL Code",icon:"code",Content:i7e,keybinding:"Shift + C",Menu:s7e,showBadge:{value:({kclContext:t})=>t.errors.length,onClick:t=>{t.preventDefault(),Ot.scrollToFirstErrorDiagnosticIfExists()}}},{id:"files",title:"Project Files",icon:"folder",Content:S7e,keybinding:"Shift + F",Menu:_7e,hide:({platform:t})=>t==="web"},{id:"variables",title:"Variables",icon:"make-variable",Content:l7e,Menu:a7e,keybinding:"Shift + V"},{id:"logs",title:"Logs",icon:"logs",Content:d7e,keybinding:"Shift + L"},{id:"debug",title:"Debug",icon:Fke,Content:g7e,keybinding:"Shift + D",hide:({settings:t})=>!t.modeling.showDebugPanel.current}],E7e="_grid_rvxv9_1",T7e={grid:E7e},B7e="_panel_4jpay_1",M7e="_header_4jpay_9",yne={panel:B7e,header:M7e},k7e=({icon:t,title:e,Menu:n,onClose:r})=>b.jsxs("div",{className:yne.header,children:[b.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[t&&b.jsx(vs,{icon:t,className:"p-1",size:"sm",iconClassName:"!text-chalkboard-80 dark:!text-chalkboard-30",bgClassName:"!bg-transparent"}),b.jsx("span",{children:e})]}),n instanceof Function?b.jsx(n,{}):n,b.jsx($t,{Element:"button",iconStart:{icon:"close",iconClassName:"!text-current",bgClassName:"bg-transparent dark:bg-transparent"},className:"!p-0 !bg-transparent hover:text-primary border-transparent dark:!border-transparent hover:!border-primary dark:hover:!border-chalkboard-70 !outline-none",onClick:r,children:b.jsx(Fr,{position:"bottom-right",delay:750,children:"Close"})})]}),R7e=({title:t,icon:e,id:n,children:r,className:i,Menu:s,detailsTestId:o,onClose:a,...l})=>{const{settings:c}=In(),d=c.context.app.onboardingStatus.current==="camera"?"pointer-events-none ":"pointer-events-auto ";return b.jsxs("section",{...l,"data-testid":o,id:n,className:"focus-within:border-primary dark:focus-within:border-chalkboard-50 "+d+yne.panel+" group "+(i||""),children:[b.jsx(k7e,{icon:e,title:t,Menu:s,onClose:a}),b.jsx("div",{className:"relative w-full",children:r})]})};function P7e(){return ft()?"desktop":"web"}function L7e({paneOpacity:t}){var p,m,g,y,w,v;const{commandBarSend:e}=ni(),n=uc(),{settings:r}=In(),i=r.context.app.onboardingStatus,{send:s,context:o}=Ti(),a=i.current==="camera"||((p=o.store)==null?void 0:p.openPanes.length)===0?"pointer-events-none ":"pointer-events-auto ",l=r.context.modeling.showDebugPanel,c=P.useMemo(()=>({kclContext:n,settings:r.context,platform:P7e()}),[n.errors,r.context]),d=[{id:"export",title:"Export part",icon:"floppyDiskArrow",keybinding:"Ctrl + Shift + E",action:()=>e({type:"Find and select command",data:{name:"Export",groupId:"modeling"}})},{id:"make",title:"Make part",icon:"printer3d",keybinding:"Ctrl + Shift + M",action:async()=>{e({type:"Find and select command",data:{name:"Make",groupId:"modeling"}})},hide:()=>!ft(),disable:()=>va.noMachinesReason()}].filter(x=>!x.hide||x.hide instanceof Function&&!x.hide(c)),f=P.useMemo(()=>(l.current?qw:qw.filter(x=>x.id!=="debug")).filter(x=>!x.hide||x.hide instanceof Function&&!x.hide(c)),[qw,c]),h=P.useMemo(()=>f.reduce((x,C)=>(C.showBadge&&(x[C.id]={value:C.showBadge.value(c),onClick:C.showBadge.onClick}),x),{}),[c]);P.useEffect(()=>{var C;const x=[];qw.forEach(_=>{(_.hide===!0||_.hide instanceof Function&&_.hide(c))&&x.push(_.id)}),x.length>0&&s({type:"Set context",data:{openPanes:(C=o.store)==null?void 0:C.openPanes.filter(_=>!x.includes(_))}})},[r.context]);const A=P.useCallback(x=>{var C,_,S;s({type:"Set context",data:{openPanes:(C=o.store)!=null&&C.openPanes.includes(x)?(_=o.store)==null?void 0:_.openPanes.filter(E=>E!==x):[...(S=o.store)==null?void 0:S.openPanes,x]}})},[(m=o.store)==null?void 0:m.openPanes,s]);return b.jsx(_Ue,{className:`group flex-1 flex flex-col z-10 my-2 pr-1 ${t} ${a}`,defaultSize:{width:"550px",height:"auto"},minWidth:200,maxWidth:800,handleWrapperClass:"sidebar-resize-handles",handleClasses:{right:(((g=o.store)==null?void 0:g.openPanes.length)===0?"hidden ":"block ")+"translate-x-1/2 hover:bg-chalkboard-10 hover:dark:bg-chalkboard-110 bg-transparent transition-colors duration-75 transition-ease-out delay-100 ",left:"hidden",top:"hidden",topLeft:"hidden",topRight:"hidden",bottom:"hidden",bottomLeft:"hidden",bottomRight:"hidden"},children:b.jsxs("div",{id:"app-sidebar",className:T7e.grid+" flex-1",children:[b.jsxs("ul",{className:(((y=o.store)==null?void 0:y.openPanes.length)===0?"rounded-r ":"")+"relative z-[2] pointer-events-auto p-0 col-start-1 col-span-1 h-fit w-fit flex flex-col bg-chalkboard-10 border border-solid border-chalkboard-30 dark:bg-chalkboard-90 dark:border-chalkboard-80 group-focus-within:border-primary dark:group-focus-within:border-chalkboard-50 shadow-sm ",children:[b.jsx("ul",{id:"pane-buttons-section",className:"w-fit p-2 flex flex-col gap-2 "+(((w=o.store)==null?void 0:w.openPanes.length)>=1?"pr-0.5":""),children:f.map(x=>{var C,_;return b.jsx(sz,{paneConfig:x,paneIsOpen:(C=o.store)==null?void 0:C.openPanes.includes(x.id),onClick:()=>A(x.id),"aria-pressed":(_=o.store)==null?void 0:_.openPanes.includes(x.id),showBadge:h[x.id]},x.id)})}),d.length>0&&b.jsxs(b.Fragment,{children:[b.jsx("hr",{className:"w-full border-chalkboard-30 dark:border-chalkboard-80"}),b.jsx("ul",{id:"sidebar-actions",className:"w-fit p-2 flex flex-col gap-2",children:d.map(x=>{var C;return b.jsx(sz,{paneConfig:{id:x.id,title:x.title,icon:x.icon,keybinding:x.keybinding,iconClassName:x.iconClassName,iconSize:"md"},onClick:x.action,disabledText:(C=x.disable)==null?void 0:C.call(x)},x.id)})})]})]}),b.jsx("ul",{id:"pane-section",className:"ml-[-1px] col-start-2 col-span-1 flex flex-col gap-2 "+(((v=o.store)==null?void 0:v.openPanes.length)>=1?"row-start-1 row-end-3":"hidden"),children:f.filter(x=>o==null?void 0:o.store.openPanes.includes(x.id)).map(x=>b.jsx(R7e,{icon:x.icon,id:`${x.id}-pane`,title:x.title,Menu:x.Menu,onClose:()=>A(x.id),children:x.Content instanceof Function?b.jsx(x.Content,{}):x.Content},x.id))})]})})}function sz({paneConfig:t,onClick:e,paneIsOpen:n,showBadge:r,disabledText:i,...s}){return Tr(t.keybinding,e,{scopes:["modeling"]}),b.jsxs("div",{id:t.id+"-button-holder",children:[b.jsxs("button",{className:"group pointer-events-auto flex items-center justify-center border-transparent dark:border-transparent disabled:!border-transparent p-0 m-0 rounded-sm !outline-0 focus-visible:border-primary",onClick:e,name:t.title,"data-testid":t.id+"-pane-button",disabled:i!==void 0,"aria-disabled":i!==void 0,...s,children:[b.jsx(vs,{icon:t.icon,className:t.iconClassName||"",size:t.iconSize||"md",iconClassName:n?" !text-chalkboard-10":"",bgClassName:"rounded-sm "+(n?"!bg-primary":"!bg-transparent")}),b.jsxs("span",{className:"sr-only",children:[t.title,n!==void 0?" pane":""]}),b.jsxs(Fr,{position:"right",contentClassName:"max-w-none flex items-center gap-4",hoverOnly:!0,children:[b.jsxs("span",{className:"flex-1",children:[t.title,i!==void 0?` (${i})`:"",n!==void 0?" pane":""]}),b.jsx("kbd",{className:"hotkey text-xs capitalize",children:t.keybinding})]})]}),!!(r!=null&&r.value)&&b.jsxs("p",{id:`${t.id}-badge`,className:"absolute m-0 p-0 top-1 right-0 w-3 h-3 flex items-center justify-center text-[10px] font-semibold text-white bg-primary hue-rotate-90 rounded-full border border-chalkboard-10 dark:border-chalkboard-80 z-50 hover:cursor-pointer hover:scale-[2] transition-transform duration-200",onClick:r.onClick,title:`Click to view ${r.value} notification${Number(r.value)>1?"s":""}`,children:[b.jsx("span",{className:"sr-only",children:" has "}),typeof r.value=="number"?b.jsx("span",{children:r.value}):b.jsx("span",{className:"sr-only",children:"a"}),b.jsxs("span",{className:"sr-only",children:[" notification",Number(r.value)>1?"s":""]})]})]})}const oz={[ti.Ok]:"Connected",[ti.Weak]:"Weak",[ti.Issue]:"Problem",[ti.Disconnected]:"Offline"},az={true:"close",undefined:"horizontalDash",false:"checkmark"},Xw={true:{icon:"text-destroy-80 dark:text-destroy-10",bg:"bg-destroy-10 dark:bg-destroy-80"},undefined:{icon:"text-chalkboard-70 dark:text-chalkboard-30",bg:"bg-chalkboard-30 dark:bg-chalkboard-70"},false:{icon:"!text-chalkboard-110 dark:!text-chalkboard-10",bg:"bg-transparent dark:bg-transparent"}},Yw={[ti.Ok]:{icon:"text-succeed-80 dark:text-succeed-10",bg:"bg-succeed-10/30 dark:bg-succeed-80/50"},[ti.Weak]:{icon:"text-warn-80 dark:text-warn-10",bg:"bg-warn-10 dark:bg-warn-80/80"},[ti.Issue]:{icon:"text-destroy-80 dark:text-destroy-10",bg:"bg-destroy-10 dark:bg-destroy-80/80"},[ti.Disconnected]:{icon:"text-destroy-80 dark:text-destroy-10",bg:"bg-destroy-10 dark:bg-destroy-80"}},I7e={[ti.Ok]:"network",[ti.Weak]:"network",[ti.Issue]:"networkCrossedOut",[ti.Disconnected]:"networkCrossedOut"},O7e=()=>{const{hasIssues:t,overallState:e,internetConnected:n,steps:r,issues:i,error:s,setHasCopied:o,hasCopied:a}=Lg();return b.jsxs(er,{className:"relative",children:[b.jsxs(er.Button,{className:"p-0 border-none bg-transparent dark:bg-transparent relative "+(t?"focus-visible:outline-destroy-80":"focus-visible:outline-succeed-80"),"data-testid":"network-toggle",children:[b.jsx(vs,{icon:I7e[e],className:"p-1",iconClassName:Yw[e].icon,bgClassName:"rounded-sm "+Yw[e].bg}),b.jsxs(Fr,{position:"top-right",wrapperClassName:"ui-open:hidden",children:["Network health (",oz[e],")"]})]}),b.jsxs(er.Panel,{className:"absolute right-0 left-auto bottom-full mb-1 w-64 flex flex-col gap-1 align-stretch bg-chalkboard-10 dark:bg-chalkboard-90 rounded shadow-lg border border-solid border-chalkboard-20/50 dark:border-chalkboard-80/50 text-sm","data-testid":"network-popover",children:[b.jsxs("div",{className:`flex items-center justify-between p-2 rounded-t-sm ${Yw[e].bg} ${Yw[e].icon}`,children:[b.jsx("h2",{className:"text-sm font-sans font-normal",children:"Network health"}),b.jsx("p",{"data-testid":"network",className:"font-bold text-xs uppercase px-2 py-1 rounded-sm",children:oz[e]})]}),b.jsx("ul",{className:"divide-y divide-chalkboard-20 dark:divide-chalkboard-80",children:Object.keys(r).map(l=>b.jsxs("li",{className:"flex flex-col px-2 py-4 gap-1 last:mb-0 ",children:[b.jsxs("div",{className:"flex items-center text-left gap-1",children:[b.jsx("p",{className:"flex-1",children:l}),n?b.jsx(vs,{size:"lg",icon:az[String(i[l])],iconClassName:Xw[String(i[l])].icon,bgClassName:"rounded-sm "+Xw[String(i[l])].bg}):b.jsx(vs,{icon:az.true,bgClassName:Xw.true.bg,iconClassName:Xw.true.icon})]}),i[l]&&b.jsxs("button",{onClick:Li(async()=>{await navigator.clipboard.writeText(JSON.stringify(s,null,2)||""),o(!0),setTimeout(()=>o(!1),5e3)},Bt),className:"flex w-fit gap-2 items-center bg-transparent text-sm p-1 py-0 my-0 -mx-1 text-destroy-80 dark:text-destroy-10 hover:bg-transparent border-transparent dark:border-transparent hover:border-destroy-80 dark:hover:border-destroy-80 dark:hover:bg-destroy-80",children:[a?"Copied":"Copy Error",b.jsx(vs,{size:"lg",icon:a?"clipboardCheckmark":"clipboardPlus",iconClassName:"text-inherit dark:text-inherit",bgClassName:"!bg-transparent"})]})]},l))})]})]})},lz=()=>b.jsx("div",{className:"h-[1px] bg-chalkboard-110 dark:bg-chalkboard-80"});function F7e(t){const e=Js(),{onProjectOpen:n}=bu(),r=AA(),i=e.pathname.includes(ut.FILE),s=Ui(),{settings:o}=In();return b.jsxs(er,{className:"relative",children:[b.jsxs(er.Button,{className:"grid p-0 m-0 border-none rounded-full place-content-center","data-testid":"help-button",children:[b.jsx(nn,{name:"questionMark",className:"rounded-full w-7 h-7 bg-chalkboard-110 dark:bg-chalkboard-80 text-chalkboard-10"}),b.jsx("span",{className:"sr-only",children:"Help and resources"}),b.jsx(Fr,{position:"top-right",wrapperClassName:"ui-open:hidden",children:"Help and resources"})]}),b.jsxs(er.Panel,{as:"ul",className:"absolute right-0 left-auto flex flex-col w-64 gap-1 p-0 py-2 m-0 mb-1 text-sm border border-solid rounded shadow-lg bottom-full align-stretch text-chalkboard-10 dark:text-inherit bg-chalkboard-110 dark:bg-chalkboard-100 border-chalkboard-110 dark:border-chalkboard-80",children:[b.jsx(Du,{as:"a",href:"https://github.com/KittyCAD/modeling-app/issues/new/choose",target:"_blank",rel:"noopener noreferrer",children:"Report a bug"}),b.jsx(Du,{as:"a",href:"https://github.com/KittyCAD/modeling-app/discussions",target:"_blank",rel:"noopener noreferrer",children:"Request a feature"}),b.jsx(Du,{as:"a",href:"https://discord.gg/JQEpHR7Nt2",target:"_blank",rel:"noopener noreferrer",children:"Ask the community"}),b.jsx(lz,{}),b.jsx(Du,{as:"a",href:"https://zoo.dev/docs/kcl-samples",target:"_blank",rel:"noopener noreferrer",children:"KCL code samples"}),b.jsx(Du,{as:"a",href:"https://zoo.dev/docs/kcl",target:"_blank",rel:"noopener noreferrer",children:"KCL docs"}),b.jsx(lz,{}),b.jsx(Du,{as:"a",href:"https://github.com/KittyCAD/modeling-app/releases",target:"_blank",rel:"noopener noreferrer",children:"Release notes"}),b.jsx(Du,{as:"button",onClick:()=>{const a=e.pathname.includes(ut.FILE)?r+ut.SETTINGS_KEYBINDINGS:ut.HOME+ut.SETTINGS_KEYBINDINGS;s(a)},"data-testid":"keybindings-button",children:"Keyboard shortcuts"}),b.jsx(Du,{as:"button",onClick:()=>{o.send({type:"set.app.onboardingStatus",data:{value:"",level:"user"}}),i?s(r+ut.ONBOARDING.INDEX):q6({onProjectOpen:n,navigate:s}).catch(Bt)},children:"Reset onboarding"})]})]})}function Du({as:t,children:e,className:n,...r}){const i="block px-2 py-1 hover:bg-chalkboard-80";return b.jsx("li",{className:"p-0 m-0",children:t==="a"?b.jsx("a",{...r,onClick:tu(r.href),className:`no-underline text-inherit ${i} ${n}`,children:e}):b.jsx("button",{...r,className:`border-0 p-0 m-0 text-sm w-full rounded-none text-left ${i} ${n}`,children:e})})}const N7e=({className:t})=>{const e=va.machineCount(),n=va.noMachinesReason(),r=va.machines;return ft()?b.jsxs(er,{className:"relative",children:[b.jsxs(er.Button,{className:"flex items-center p-0 border-none bg-transparent dark:bg-transparent relative "+(t||""),"data-testid":"network-machine-toggle",children:[b.jsx(nn,{name:"printer3d",className:"w-5 h-5"}),e>0&&b.jsx("p",{"aria-hidden":!0,className:"flex items-center justify-center text-xs",children:e}),b.jsxs(Fr,{position:"top-right",wrapperClassName:"ui-open:hidden",children:["Network machines (",e,") ",n&&`: ${n}`]})]}),b.jsxs(er.Panel,{className:"absolute right-0 left-auto bottom-full mb-1 w-64 flex flex-col gap-1 align-stretch bg-chalkboard-10 dark:bg-chalkboard-90 rounded shadow-lg border border-solid border-chalkboard-20/50 dark:border-chalkboard-80/50 text-sm","data-testid":"network-popover",children:[b.jsxs("div",{className:"flex items-center justify-between p-2 rounded-t-sm bg-chalkboard-20 dark:bg-chalkboard-80",children:[b.jsx("h2",{className:"text-sm font-sans font-normal",children:"Network machines"}),b.jsx("p",{"data-testid":"network",className:"font-bold text-xs uppercase px-2 py-1 rounded-sm",children:e})]}),e>0&&b.jsx("ul",{className:"divide-y divide-chalkboard-20 dark:divide-chalkboard-80",children:r.map(i=>b.jsxs("li",{className:"px-2 py-4 gap-1 last:mb-0 ",children:[b.jsx("p",{className:"",children:i.id.toUpperCase()}),b.jsx("p",{className:"text-chalkboard-60 dark:text-chalkboard-50 text-xs",children:i.make_model.model}),i.extra&&i.extra.type==="bambu"&&i.extra.nozzle_diameter&&b.jsxs("p",{className:"text-chalkboard-60 dark:text-chalkboard-50 text-xs",children:["Nozzle Diameter: ",i.extra.nozzle_diameter]}),b.jsxs("p",{className:"text-chalkboard-60 dark:text-chalkboard-50 text-xs",children:[`Status: ${i.state.state.charAt(0).toUpperCase()}${i.state.state.slice(1)}`,i.state.state==="failed"&&i.state.message?` (${i.state.message})`:"",i.state.state==="running"&&i.progress?` (${Math.round(i.progress)}%)`:""]})]},i.id))})]})]}):null},D7e=()=>{var s;const[t]=fne(),e=(s=t[t.length-1])==null?void 0:s.type;let n="w-6 h-6 ",r=b.jsx(iY,{className:n}),i="model-state-indicator";return e==="receive-reliable"?(n+="bg-chalkboard-20 dark:bg-chalkboard-80 !group-disabled:bg-chalkboard-30 !dark:group-disabled:bg-chalkboard-80 rounded-sm bg-succeed-10/30 dark:bg-succeed",r=b.jsx(nn,{"data-testid":i+"-receive-reliable",name:"checkmark"})):e==="execution-done"?(n+="border-6 border border-solid border-chalkboard-60 dark:border-chalkboard-80 bg-chalkboard-20 dark:bg-chalkboard-80 !group-disabled:bg-chalkboard-30 !dark:group-disabled:bg-chalkboard-80 rounded-sm bg-succeed-10/30 dark:bg-succeed",r=b.jsx(nn,{"data-testid":i+"-execution-done",name:"checkmark"})):e==="export-done"&&(n+="border-6 border border-solid border-chalkboard-60 dark:border-chalkboard-80 bg-chalkboard-20 dark:bg-chalkboard-80 !group-disabled:bg-chalkboard-30 !dark:group-disabled:bg-chalkboard-80 rounded-sm bg-succeed-10/30 dark:bg-succeed",r=b.jsx(nn,{"data-testid":i+"-export-done",name:"checkmark"})),b.jsx("div",{className:n,"data-testid":"model-state-indicator",children:r})};function vne({children:t,coreDumpManager:e}){const n=Js(),r=AA(),i="!text-chalkboard-70 hover:!text-chalkboard-80 dark:!text-chalkboard-40 dark:hover:!text-chalkboard-30";function s(o){o==null||o.preventDefault(),o==null||o.stopPropagation(),e?jt.promise(rI(e,!0),{loading:"Preparing bug report...",success:"Bug report opened in new window",error:"Unable to export a core dump. Using default reporting."},{success:{duration:6e3}}).catch(a=>{a&&Y4("https://github.com/KittyCAD/modeling-app/issues/new/choose").catch(Bt)}):Y4("https://github.com/KittyCAD/modeling-app/issues/new/choose").catch(Bt)}return b.jsxs("section",{className:"fixed bottom-2 right-2 flex flex-col items-end gap-3 pointer-events-none",children:[t,b.jsxs("menu",{className:"flex items-center justify-end gap-3 pointer-events-auto",children:[!n.pathname.startsWith(ut.HOME)&&b.jsx(D7e,{}),b.jsxs("a",{onClick:tu(`https://github.com/KittyCAD/modeling-app/releases/tag/v${Bh}`),href:`https://github.com/KittyCAD/modeling-app/releases/tag/v${Bh}`,target:"_blank",rel:"noopener noreferrer",className:"!no-underline font-mono text-xs "+i,children:["v",Bh]}),b.jsxs("a",{onClick:s,href:"https://github.com/KittyCAD/modeling-app/issues/new/choose",target:"_blank",rel:"noopener noreferrer",children:[b.jsx(nn,{name:"bug",className:`w-5 h-5 ${i}`}),b.jsx(Fr,{position:"top",contentClassName:"text-xs",children:"Report a bug"})]}),b.jsxs(Af,{to:n.pathname.includes(ut.FILE)?r+ut.SETTINGS+"?tab=project":ut.HOME+ut.SETTINGS,"data-testid":"settings-link",children:[b.jsx(nn,{name:"settings",className:`w-5 h-5 ${i}`}),b.jsx("span",{className:"sr-only",children:"Settings"}),b.jsx(Fr,{position:"top",contentClassName:"text-xs",children:"Settings"})]}),b.jsx(N7e,{className:i}),!n.pathname.startsWith(ut.HOME)&&b.jsx(O7e,{}),b.jsx(F7e,{})]})]})}const cz=80,Jw=.5,Yo=.35,ep=.02,uz={x:"Right",y:"Back",z:"Top","-x":"Left","-y":"Front","-z":"Bottom"};function U7e(){const t=P.useRef(null),e=P.useRef(null),n=P.useRef(null),r=P.useRef(0),i=P.useRef(0),{send:s}=Ti(),o=P.useMemo(()=>[...Object.entries(uz).map(([a,l])=>b.jsxs(Rh,{onClick:()=>{Ke.camControls.updateCameraToAxis(a).catch(Bt)},children:[l," view"]},a)),b.jsx(rz,{}),b.jsx(Rh,{onClick:()=>{Ke.camControls.resetCameraPosition().catch(Bt)},children:"Reset view"}),b.jsx(Rh,{onClick:()=>{s({type:"Center camera on selection"})},children:"Center view on selection"}),b.jsx(rz,{}),b.jsx(pne,{})],[uz]);return P.useEffect(()=>{if(!e.current)return;const a=e.current,l=new rL({canvas:a,antialias:!0,alpha:!0});l.setSize(cz,cz),l.setPixelRatio(Math.min(window.devicePixelRatio,2));const c=new iL,u=j7e(),{gizmoAxes:d,gizmoAxisHeads:f}=Q7e();c.add(...d,...f);const h=new RM,{mouse:A,disposeMouseEvents:p}=G7e(a,n,Ke),m=[...f],g=new phe,y=Ke.camControls.camera;let w=new $s().copy(y.quaternion);const v=()=>{const x=g.getDelta();z7e(u,w,Ke.camControls.camera.quaternion,x,r),W7e(m,h,A,u,n,x,i),l.render(c,u),requestAnimationFrame(v)};return v(),()=>{l.dispose(),p()}},[]),b.jsxs("div",{className:"relative",children:[b.jsxs("div",{ref:t,"aria-label":"View orientation gizmo",className:"grid place-content-center rounded-full overflow-hidden border border-solid border-primary/50 pointer-events-auto bg-chalkboard-10/70 dark:bg-chalkboard-100/80 backdrop-blur-sm",children:[b.jsx("canvas",{ref:e}),b.jsx(Ane,{menuTargetElement:t,items:o})]}),b.jsx(H7e,{items:o})]})}function H7e({items:t}){return b.jsx(er,{className:"absolute top-0 right-0 pointer-events-auto",children:({close:e})=>b.jsxs(b.Fragment,{children:[b.jsxs(er.Button,{className:"border-none p-0 m-0 -translate-y-1/4 translate-x-1/4",children:[b.jsx(nn,{name:"caretDown",className:"w-4 h-4 ui-open:rotate-180"}),b.jsx("span",{className:"sr-only",children:"View settings"})]}),b.jsx(er.Panel,{className:`absolute bottom-full right-0 mb-2 w-48 bg-chalkboard-10 dark:bg-chalkboard-90
      border border-solid border-chalkboard-10 dark:border-chalkboard-90 rounded
      shadow-lg`,children:b.jsx("ul",{className:"relative flex flex-col items-stretch content-stretch p-0.5",children:t.map((n,r)=>b.jsx("li",{className:"contents",onClick:()=>e(),children:n},r))})})]})})}const j7e=()=>new $r(-Jw,Jw,Jw,-Jw,.5,3),Q7e=()=>{const t=[tp(Yo,ep,"#fa6668",0,"z"),tp(Yo,ep,"#11eb6b",Math.PI/2,"z"),tp(Yo,ep,"#6689ef",-Math.PI/2,"y"),tp(Yo,ep,"#c6c7c2",Math.PI,"z"),tp(Yo,ep,"#c6c7c2",-Math.PI/2,"z"),tp(Yo,ep,"#c6c7c2",Math.PI/2,"y")],e=[np("x","#fa6668",[Yo,0,0]),np("y","#11eb6b",[0,Yo,0]),np("z","#6689ef",[0,0,Yo]),np("-x","#c6c7c2",[-Yo,0,0]),np("-y","#c6c7c2",[0,-Yo,0]),np("-z","#c6c7c2",[0,0,-Yo])];return{gizmoAxes:t,gizmoAxisHeads:e}},tp=(t,e,n,r=0,i="x")=>{const s=new Wl(t,e,e);s.translate(t/2,0,0);const o=new ei({color:new Nt(n)}),a=new xn(s,o);return a.rotation[i]=r,a},np=(t,e,n)=>{const r=new nv(.065,16,8),i=new ei({color:new Nt(e)}),s=new xn(r,i);return s.position.set(n[0],n[1],n[2]),s.updateMatrixWorld(),s.name=t,s},z7e=(t,e,n,r,i)=>{if(i.current+=r,!V7e(e,n)||i.current>=5){const s=1-Math.exp(-30*r);e.slerp(n,s).normalize(),t.position.set(0,0,1).applyQuaternion(e),t.quaternion.copy(e),i.current=0}},V7e=(t,e,n=.001)=>Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n&&Math.abs(t.z-e.z)<n&&Math.abs(t.w-e.w)<n,G7e=(t,e,n)=>{const r=new Ze;r.x=1;const i=a=>{const{left:l,top:c,width:u,height:d}=t.getBoundingClientRect();r.x=(a.clientX-l)/u*2-1,r.y=(a.clientY-c)/d*-2+1},s=()=>{if(e.current){const a=e.current.object.name;n.camControls.updateCameraToAxis(a).catch(Bt)}};return window.addEventListener("mousemove",i),window.addEventListener("click",s),{mouse:r,disposeMouseEvents:()=>{window.removeEventListener("mousemove",i),window.removeEventListener("click",s)}}},W7e=(t,e,n,r,i,s,o)=>{if(o.current+=s,o.current<2&&(n.x<-1||n.x>1||n.y<-1||n.y>1)){i.current=null;return}e.setFromCamera(n,r);const a=e.intersectObjects(t);t.forEach(l=>l.scale.set(1,1,1)),a.length?(a[0].object.scale.set(1.5,1.5,1.5),i.current=a[0]):i.current=null,o.current>2&&(o.current=0)};function K7e(){const{settings:t}=In();return b.jsx(er,{className:"relative pointer-events-auto",children:({close:e})=>b.jsxs(b.Fragment,{children:[b.jsxs(er.Button,{className:`flex items-center gap-2 px-3 py-1 
        text-xs text-primary bg-chalkboard-10/70 dark:bg-chalkboard-100/80 backdrop-blur-sm 
        border !border-primary/50 rounded-full`,children:[b.jsxs("div",{className:"w-4 h-[1px] bg-primary relative",children:[b.jsx("div",{className:"absolute w-[1px] h-[1em] bg-primary left-0 top-1/2 -translate-y-1/2"}),b.jsx("div",{className:"absolute w-[1px] h-[1em] bg-primary right-0 top-1/2 -translate-y-1/2"})]}),b.jsx("span",{className:"sr-only",children:"Current units are: "}),t.context.modeling.defaultUnit.current]}),b.jsx(er.Panel,{className:`absolute bottom-full right-0 mb-2 w-48 bg-chalkboard-10 dark:bg-chalkboard-90
          border border-solid border-chalkboard-10 dark:border-chalkboard-90 rounded
          shadow-lg`,children:b.jsx("ul",{className:"relative flex flex-col items-stretch content-stretch p-0.5",children:C5.map(n=>b.jsx("li",{className:"contents",children:b.jsx("button",{className:"flex items-center gap-2 m-0 py-1.5 px-2 cursor-pointer hover:bg-chalkboard-20 dark:hover:bg-chalkboard-80 border-none text-left",onClick:()=>{t.send({type:"set.modeling.defaultUnit",data:{level:"project",value:n}}),e()},children:CEe[n]})},n))})})]})})}function $7e(){const{settings:t}=In(),e=t.context.modeling.cameraProjection.current==="perspective",[n,r]=P.useState(e);return P.useEffect(()=>{r(t.context.modeling.cameraProjection.current==="perspective")},[t.context.modeling.cameraProjection.current]),b.jsxs(jMe,{checked:n,onChange:i=>{t.send({type:"set.modeling.cameraProjection",data:{level:"user",value:i?"perspective":"orthographic"}})},className:`pointer-events-auto p-0 text-xs text-chalkboard-60 dark:text-chalkboard-40 bg-chalkboard-10/70 hover:bg-chalkboard-10 dark:bg-chalkboard-100/80 dark:hover:bg-chalkboard-100 backdrop-blur-sm 
        border border-primary/10 hover:border-primary/50 focus-visible:border-primary/50 rounded-full`,children:[b.jsx("span",{className:"sr-only",children:"Camera projection: "}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{"aria-hidden":n,className:"border border-solid m-[-1px] rounded-full px-2 py-1 "+(n?"border-transparent":"text-primary border-primary -mr-2"),children:"Orthographic"}),b.jsx("span",{"aria-hidden":n,className:"border border-solid m-[-1px] rounded-full px-2 py-1 "+(n?"text-primary border-primary -ml-2":"border-transparent"),children:"Perspective"})]})]})}function q7e(){var A;const{project:t,file:e}=VI();$te(ut.FILE+"SETTINGS");const n=Ui(),r=AA(),{onProjectOpen:i}=bu(),s=P.useRef(null),o=(t==null?void 0:t.name)||null,a=(t==null?void 0:t.path)||null;P.useEffect(()=>{i({name:o,path:a},e||null)},[o,a]),c_e();const{auth:l,settings:c}=In(),u=(A=l==null?void 0:l.context)==null?void 0:A.token,d=P.useMemo(()=>new aO(je,Kt,u),[]),{app:{onboardingStatus:f}}=c.context;Tr("backspace",p=>{p.preventDefault()}),Vy([ft()?"mod + ,":"shift + mod + ,"],()=>n(r+ut.SETTINGS),{splitKey:"|"});const h=[on.CAMERA,on.STREAMING].some(p=>p===f.current)?"opacity-20":"";return AUe(),b.jsxs("div",{className:"relative h-full flex flex-col",ref:s,children:[b.jsx(Kte,{className:"transition-opacity transition-duration-75 "+h,project:{project:t,file:e},enableMenu:!0}),b.jsx(B6,{}),b.jsx(L7e,{paneOpacity:h}),b.jsx(OPe,{}),b.jsxs(vne,{coreDumpManager:d,children:[b.jsx(K7e,{}),b.jsx(U7e,{}),b.jsx($7e,{})]})]})}const X7e=()=>{let t=qY();return console.error("error",t),b.jsx("div",{className:"flex flex-col items-center justify-center h-screen",children:b.jsxs("section",{className:"max-w-full xl:max-w-4xl mx-auto",children:[b.jsx("h1",{className:"text-4xl mb-8 font-bold","data-testid":"unexpected-error",children:"An unexpected error occurred"}),yv(t)&&b.jsxs("p",{className:"mb-8",children:[t.status,": ",t.data]}),b.jsxs("div",{className:"flex justify-between gap-2 mt-6",children:[ft()&&b.jsx($t,{Element:"link",to:"/",iconStart:{icon:Ike},"data-testid":"unexpected-error-home",children:"Go Home"}),b.jsx($t,{Element:"button",iconStart:{icon:Rke},onClick:()=>window.location.reload(),children:"Reload"}),b.jsx($t,{Element:"button",iconStart:{icon:Pke},onClick:()=>{window.localStorage.clear()},children:"Clear storage"}),b.jsx($t,{Element:"externalLink",iconStart:{icon:Oke},to:"https://github.com/KittyCAD/modeling-app/issues/new",children:"Report Bug"})]})]})})};function Y7e(){const[t,e]=P.useState(Kt.code!==""&&Kt.code!==uf);return t?b.jsx(J7e,{setShouldShowWarning:e}):b.jsx(t9e,{})}function J7e(t){return b.jsx("div",{className:"fixed inset-0 z-50 grid place-content-center bg-chalkboard-110/50",children:b.jsx("div",{className:"max-w-3xl p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90",children:ft()?b.jsx(Z7e,{...t}):b.jsx(e9e,{...t})})})}function Z7e(t){const e=Ui(),n=Zs(),r=hf(ut.FILE),{context:i}=hA(),{onProjectClose:s,onProjectOpen:o}=bu();async function a(){s(r.file||null,i.project.path||null,!1),await q6({onProjectOpen:o,navigate:e}),t.setShouldShowWarning(!1)}return b.jsxs(b.Fragment,{children:[b.jsx("h1",{className:"flex flex-wrap items-center gap-4 text-3xl font-bold",children:"Would you like to create a new project?"}),b.jsx("section",{className:"my-12",children:b.jsx("p",{className:"my-4",children:"You have some content in this project that we don't want to overwrite. If you would like to create a new project, please click the button below."})}),b.jsx(wo,{className:"mt-6",dismiss:n,next:Li(a,Bt),nextText:"Make a new project"})]})}function e9e(t){const e=Zs();return b.jsxs(b.Fragment,{children:[b.jsx("h1",{className:"text-3xl font-bold text-warn-80 dark:text-warn-10",children:"Replaying onboarding resets your code"}),b.jsx("p",{className:"my-4",children:"We see you have some of your own code written in this project. Please save it somewhere else before continuing the onboarding."}),b.jsx(wo,{className:"mt-6",dismiss:e,next:Li(async()=>{Kt.updateCodeStateEditor(uf),await Kt.writeToFile(),await be.executeCode(!0),t.setShouldShowWarning(!1)},Bt),nextText:"Overwrite code and continue"})]})}function t9e(){Iv();const{settings:{state:{context:{app:{theme:t}}}}}=In(),e=()=>t.current===Zn.Light||t.current===Zn.System&&_f()===Zn.Light?"-dark":"",n=Zs(),r=ll(on.CAMERA);return b.jsx("div",{className:"fixed inset-0 z-50 grid place-content-center bg-chalkboard-110/50",children:b.jsxs("div",{className:"max-w-3xl p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90",children:[b.jsxs("h1",{className:"flex flex-wrap items-center gap-4 text-3xl font-bold",children:[b.jsx("img",{src:`${ft()?".":""}/zma-logomark${e()}.svg`,alt:nu,className:"h-20 max-w-full"}),b.jsx("span",{className:"px-3 py-1 text-base rounded-full bg-primary/10 text-primary",children:"Alpha"})]}),b.jsxs("section",{className:"my-12",children:[b.jsxs("p",{className:"my-4",children:["Welcome to ",nu,"! This is a hardware design tool that lets you edit visually, with code, or both. It's powered by the KittyCAD Design API, the first API created for anyone to build hardware design tools. The 3D view is not running on your computer, but is instead being streamed to you from an instance of our Geometry Engine on a remote GPU as video."]}),b.jsxs("p",{className:"my-4",children:["This is an alpha release, so you will encounter bugs and missing features. You can read our"," ",b.jsx("a",{href:"https://gist.github.com/jgomez720/5cd53fb7e8e54079f6dc0d2625de5393",target:"_blank",rel:"noreferrer noopener",children:"expectations for alpha users here"}),", and please give us feedback on your experience"," ",b.jsx("a",{href:"https://discord.com/invite/JQEpHR7Nt2",target:"_blank",rel:"noreferrer noopener",children:"our Discord"}),"! We are trying to release as early as possible to get feedback from users like you."]}),b.jsx("p",{children:"As you go through the onboarding, we'll be changing and resetting your code occasionally, so that we can reference specific code features. So hold off on writing production KCL code until you're done with the onboarding 😉"})]}),b.jsx(wo,{currentSlug:on.INDEX,className:"mt-6",dismiss:n,next:r,nextText:"Mouse Controls"})]})})}function n9e(){const t=Zs(),e=ll(on.STREAMING),{settings:{send:n,state:{context:{modeling:{mouseControls:r}}}}}=In();return b.jsx("div",{className:"fixed inset-0 z-50 grid items-end justify-start px-4 pointer-events-none",children:b.jsxs("div",{className:"pointer-events-auto max-w-2xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsxs(Xx,{title:"Mouse Controls",description:"Choose what buttons you want to use on your mouse or trackpad to move around the 3D view. Try them out above and choose the one that feels most comfortable to you.",className:"my-4 last-of-type:mb-12",headingClassName:"text-3xl font-bold",children:[b.jsx("select",{id:"camera-controls",className:"block w-full px-3 py-1 bg-transparent border border-chalkboard-30",value:r.current,onChange:i=>{n({type:"set.modeling.mouseControls",data:{level:"user",value:i.target.value}})},children:Qx.map(i=>b.jsx("option",{value:i,children:i},i))}),b.jsxs("ul",{className:"mx-4 my-2 text-sm leading-relaxed",children:[b.jsxs("li",{children:[b.jsx("strong",{children:"Pan:"})," ",Gd[r.current].pan.description]}),b.jsxs("li",{children:[b.jsx("strong",{children:"Zoom:"})," ",Gd[r.current].zoom.description]}),b.jsxs("li",{children:[b.jsx("strong",{children:"Rotate:"})," ",Gd[r.current].rotate.description]})]})]}),b.jsx(wo,{currentSlug:on.CAMERA,dismiss:t,next:e,nextText:"Next: Streaming"})]})})}function r9e(){const t=Zs(),e=ll(on.FUTURE_WORK);return P.useEffect(()=>{async function n(){Kt.updateCodeStateEditor(""),await be.executeCode(!0)}n()},[]),b.jsx("div",{className:"fixed grid justify-center items-end inset-0 z-50 pointer-events-none",children:b.jsxs("div",{className:"pointer-events-auto max-w-full xl:max-w-2xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsx("h1",{className:"text-2xl font-bold",children:"Sketching"}),b.jsx("p",{className:"my-4",children:"Our 3D modeling tools are still very much a work in progress, but we want to show you some early features. Try sketching by clicking Start Sketch in the top toolbar and selecting a plane to draw on. Now you can start clicking to draw lines and shapes."}),b.jsx("p",{className:"my-4",children:"The Line tool will be equipped by default, but you can switch it to as you go by clicking another tool in the toolbar, or unequip it by clicking the Line tool button. With no tool selected, you can move points and add constraints to your sketch."}),b.jsx("p",{className:"my-4",children:"Watch the code pane as you click. Point-and-click interactions are always just modifying and generating code in Zoo Modeling App."}),b.jsx(wo,{currentSlug:on.SKETCHING,className:"mt-6",next:e,dismiss:t,nextText:"Next: Future Work"})]})})}function ys(t){return t.replace(/^\//,"")}function i9e(){const t=Zs(),e=ll(on.EDITOR);return b.jsx("div",{className:"fixed grid justify-start items-center inset-0 z-50 pointer-events-none",children:b.jsxs("div",{className:"pointer-events-auto max-w-xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg h-[75vh] flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsxs("section",{className:"flex-1 overflow-y-auto",children:[b.jsx("h2",{className:"text-3xl font-bold",children:"Streaming Video"}),b.jsx("p",{className:"my-4",children:"Historically, CAD programs run on your computer, so to run performance-heavy apps you have to have a powerful, expensive desktop. But the 3D scene you see here is not running on your computer."}),b.jsxs("p",{className:"my-4",children:["Instead, our infrastructure spins up our Geometry Engine on a remote GPU, Modeling App sends it a series of commands"," ",b.jsx("a",{href:"https://zoo.dev/blog/cad-webrtc",rel:"noopener noreferrer",target:"_blank",children:"via Websockets and WebRTC"}),", and the Geometry Engine sends back a video stream of the 3D view."]}),b.jsx("p",{className:"my-4",children:"This means that you could run our Modeling App on nearly any device with a good internet connection."}),b.jsx("p",{className:"my-4",children:"It also means that whatever tools you build on top of our Geometry Engine will be able to run on any device with a browser, and you won't have to worry about the performance of the device."})]}),b.jsx(wo,{currentSlug:on.STREAMING,dismiss:t,next:e,nextText:"Next: Code Editor"})]})})}function s9e(){Iv();const t=Zs(),e=ll(on.PARAMETRIC_MODELING);return b.jsx("div",{className:"fixed grid justify-end items-center inset-0 z-50 pointer-events-none",children:b.jsxs("div",{className:"pointer-events-auto z-10 max-w-xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg h-[75vh] flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsxs("section",{className:"flex-1 overflow-y-auto",children:[b.jsxs("h2",{className:"text-3xl font-bold",children:["Editing code with ",b.jsx("span",{className:"text-primary",children:"kcl"})]}),b.jsx("p",{className:"my-4",children:"kcl is our language for describing geometry. Building our own language is difficult, but we chose to do it to have a language honed for spatial relationships and geometric computation. It'll always be open-source, and we hope it can grow into a new standard for describing parametric objects."}),b.jsxs("p",{className:"my-4",children:["The left pane is where you write your code. It's a code editor with syntax highlighting and autocompletion for kcl. New features arrive in kcl before they're available as point-and-click tools, so it's good to have a link to"," ",b.jsx("a",{href:"https://zoo.dev/docs/kcl",rel:"noreferrer noopener",target:"_blank",children:"our kcl docs"})," ","handy while you design for now. It's also available in the menu in the corner of the code pane."]}),b.jsxs("p",{className:"my-4",children:["We've built a"," ",b.jsx("a",{href:"https://github.com/KittyCAD/kcl-lsp",rel:"noreferrer noopener",target:"_blank",children:"language server"})," ","for kcl that provides documentation and autocompletion automatically generated from our compiler code. You can try it out by hovering over some of the function names in the pane now. If you like using VSCode, you can try out our"," ",b.jsx("a",{href:"https://marketplace.visualstudio.com/items?itemName=KittyCAD.kcl-language-server",rel:"noreferrer noopener",target:"_blank",children:"VSCode extension"}),"."]}),b.jsxs("p",{className:"my-4",children:["You can resize the pane by dragging the handle on the right, and you can collapse it by clicking the X button in the pane's title bar or pressing ",b.jsx("kbd",{className:$u,children:"Shift + C"}),"."]})]}),b.jsx(wo,{currentSlug:on.EDITOR,dismiss:t,next:e,nextText:"Next: Parametric Modeling"})]})})}function o9e(){Iv();const{settings:{context:{app:{theme:{current:t}}}}}=In(),e=()=>t===Zn.Light||t===Zn.System&&_f()===Zn.Light?"-dark":"",n=Zs(),r=ll(on.INTERACTIVE_NUMBERS);return b.jsx("div",{className:"fixed grid justify-end items-center inset-0 z-50 pointer-events-none",children:b.jsxs("div",{className:"pointer-events-auto z-10 max-w-xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg h-[75vh] flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsxs("section",{className:"flex-1 overflow-y-auto mb-6",children:[b.jsx("h2",{className:"text-3xl font-bold",children:"Parametric modeling with kcl"}),b.jsx("p",{className:"my-4",children:"This example script shows how a code representation of your design makes easy work of tedious tasks in traditional CAD software, such as calculating a safety factor."}),b.jsxs("p",{className:"my-4",children:["We've received this sketch from a designer highlighting an"," ",b.jsx("em",{children:b.jsx("strong",{children:"aluminum bracket"})})," ","they need for this shelf:"]}),b.jsxs("figure",{className:"my-4 w-2/3 mx-auto",children:[b.jsx("img",{src:`${ft()?".":""}/onboarding-bracket${e()}.png`,alt:"Bracket"}),b.jsx("figcaption",{className:"text-small italic text-center",children:"A simplified shelf bracket"})]}),b.jsxs("p",{className:"my-4",children:["We are able to easily calculate the thickness of the material based on the width of the bracket to meet a set safety factor on"," ",b.jsx("em",{children:b.jsxs("strong",{children:["line ",o_e]})}),"."]}),b.jsxs("figure",{className:"my-4 w-2/3 mx-auto",children:[b.jsx("img",{src:`${ft()?".":""}/onboarding-bracket-dimensions${e()}.png`,alt:"Bracket Dimensions"}),b.jsx("figcaption",{className:"text-small italic text-center",children:"Bracket Dimensions"})]})]}),b.jsx(wo,{currentSlug:on.PARAMETRIC_MODELING,dismiss:n,next:r,nextText:"Next: Interactive Numbers"})]})})}function a9e(){Iv();const t=Zs(),e=ll(on.COMMAND_K);return b.jsx("div",{className:"fixed grid justify-end items-center inset-0 z-50 pointer-events-none",children:b.jsxs("div",{className:"pointer-events-auto z-10 max-w-xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg h-[75vh] flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsxs("section",{className:"flex-1 overflow-y-auto mb-6",children:[b.jsx("h2",{className:"text-3xl font-bold",children:"Hybrid editing"}),b.jsx("p",{className:"my-4",children:"We believe editing in Modeling App should feel fluid between code and point-and-click, so that you can work in the way that feels most natural to you. Let's try something out that demonstrates this principle, by editing numbers without typing."}),b.jsxs("ol",{className:"pl-6 my-4 list-decimal",children:[b.jsxs("li",{className:"list-decimal",children:["Press and hold the ",b.jsx("kbd",{className:$u,children:"Alt"})," (or"," ",b.jsx("kbd",{className:$u,children:"Option"}),") key"]}),b.jsxs("li",{children:['Hover over the number assigned to "width" on'," ",b.jsx("em",{children:b.jsxs("strong",{children:["line ",s_e]})})]}),b.jsx("li",{children:"Drag the number left and right to change its value"})]}),b.jsx("p",{className:"my-4",children:"You can hold down different modifier keys to change the value by different increments:"}),b.jsxs("ul",{className:"flex flex-col text-sm my-4 mx-12 divide-y divide-chalkboard-20 dark:divide-chalkboard-70",children:[b.jsxs("li",{className:"flex justify-between m-0 px-0 py-2",children:[b.jsx("kbd",{className:$u,children:"Alt + Shift + Cmd/Win"}),"±0.01"]}),b.jsxs("li",{className:"flex justify-between m-0 px-0 py-2",children:[b.jsx("kbd",{className:$u,children:"Alt + Cmd/Win"}),"±0.1"]}),b.jsxs("li",{className:"flex justify-between m-0 px-0 py-2",children:[b.jsx("kbd",{className:$u,children:"Alt"}),"±1"]}),b.jsxs("li",{className:"flex justify-between m-0 px-0 py-2",children:[b.jsx("kbd",{className:$u,children:"Alt + Shift"}),"±10"]})]}),b.jsxs("p",{className:"my-4",children:["Our code editor is built with"," ",b.jsx("a",{href:"https://codemirror.net/",target:"_blank",rel:"noreferrer noopeneer",children:"CodeMirror"}),", a great open-source project with extensions that make it even more dynamic and interactive, including"," ",b.jsx("a",{href:"https://github.com/replit/codemirror-interact/",target:"_blank",rel:"noreferrer noopeneer",children:"one by the Replit team"})," ","lets you interact with numbers in your code by dragging them around."]}),b.jsx("p",{className:"my-4",children:"We're going to keep extending the text editor, and we'd love to hear your ideas for how to make it better."})]}),b.jsx(wo,{currentSlug:on.INTERACTIVE_NUMBERS,dismiss:t,next:e,nextText:"Next: Command Bar"})]})})}function l9e(){const t=Zs(),e=ll(on.USER_MENU),n=kv();return b.jsx("div",{className:"fixed inset-0 z-50 grid items-end justify-center pointer-events-none",children:b.jsxs("div",{className:"pointer-events-auto max-w-full xl:max-w-4xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsx("h2",{className:"text-2xl font-bold",children:"Command Bar"}),b.jsxs("p",{className:"my-4",children:["Press"," ",b.jsx("kbd",{className:$u,children:zte(lO,n)})," ","to open the command bar. Try changing your theme with it."]}),b.jsxs("p",{className:"my-4",children:["We are working on a command bar that will allow you to quickly see and search for any available commands. We are building Zoo Modeling App's state management system on top of"," ",b.jsx("a",{href:"https://xstate.js.org/",rel:"noreferrer noopener",target:"_blank",children:"XState"}),". You can control settings, authentication, and file management from the command bar, as well as a growing number of modeling commands."]}),b.jsx(wo,{currentSlug:on.COMMAND_K,dismiss:t,next:e,nextText:"Next: User Menu"})]})})}function c9e(){var l;const{auth:t}=In(),e=Zs(),n=ll(on.PROJECT_MENU),[r,i]=P.useState(!1),s=(l=t==null?void 0:t.context)==null?void 0:l.user,a=!(s!=null&&s.image)||r?"the menu button":"your avatar";return P.useEffect(()=>{const c=globalThis.document.querySelector('[data-testid="user-sidebar-toggle"] img'),u=()=>i(!0);return(c==null?void 0:c.tagName)==="IMG"&&(c==null||c.addEventListener("error",u)),()=>{c==null||c.removeEventListener("error",u)}},[]),b.jsx("div",{className:"fixed grid justify-center items-start inset-0 z-50 pointer-events-none",children:b.jsxs("div",{className:"pointer-events-auto max-w-xl flex flex-col border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsxs("section",{className:"flex-1",children:[b.jsx("h2",{className:"text-2xl font-bold",children:"User Menu"}),b.jsxs("p",{className:"my-4",children:["Click ",a," in the upper right to open the user menu. You can change your user-level settings, sign out, report a bug, manage your account, request a feature, and more."]}),b.jsx("p",{className:"my-4",children:"Many settings can be set either a user or per-project level. User settings will apply to all projects, while project settings will only apply to the current project."})]}),b.jsx(wo,{currentSlug:on.USER_MENU,dismiss:e,next:n,nextText:"Next: Project Menu"})]})})}function u9e(){const t=Zs(),e=ll(on.EXPORT),n=ft();return b.jsx("div",{className:"fixed grid justify-center items-start inset-0 z-50 pointer-events-none",children:b.jsxs("div",{className:"pointer-events-auto max-w-xl flex flex-col border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsxs("section",{className:"flex-1",children:[b.jsx("h2",{className:"text-2xl font-bold",children:"Project Menu"}),b.jsxs("p",{className:"my-4",children:["Click on ",n?"your part's name":"the app name"," in the upper left to open the project menu, where you can open the project settings and export your current part.",n&&b.jsx(b.Fragment,{children:" You can click the Zoo logo to quickly navigate home."})]}),n?b.jsxs(b.Fragment,{children:[b.jsxs("p",{className:"my-4",children:["From here you can manage files in your project and export your current part. Your projects are"," ",b.jsx("strong",{children:"all saved locally"})," as a folder on your device. You can configure where projects are saved in the settings."]}),b.jsx("p",{className:"my-4",children:"We are working to support assemblies as separate kcl files importing parts from each other, but for now you can only open and export individual parts."})]}):b.jsx(b.Fragment,{children:b.jsxs("p",{className:"my-4",children:["You can't manage separate files and separate projects from the browser; you have to"," ",b.jsx("a",{href:"https://zoo.dev/modeling-app/download",target:"_blank",rel:"noreferrer noopener",children:"download the desktop app"})," ","for that. We aren't hosting files for you at this time but are considering supporting it in the future, so we're building Modeling App with a browser-first experience in mind."]})})]}),b.jsx(wo,{currentSlug:on.PROJECT_MENU,next:e,dismiss:t,nextText:"Next: Export"})]})})}function d9e(){const t=Zs(),e=ll(on.SKETCHING);return b.jsx("div",{className:"fixed grid justify-center items-end inset-0 z-50 pointer-events-none",children:b.jsxs("div",{className:"pointer-events-auto max-w-full xl:max-w-2xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsxs("section",{className:"flex-1",children:[b.jsx("h2",{className:"text-2xl font-bold",children:"Export"}),b.jsx("p",{className:"my-4",children:'In addition to the "Export current part" button in the project menu, you can also click the Export button icon at the bottom of the left sidebar. Try clicking it now.'}),b.jsxs("p",{className:"my-4",children:[nu," uses"," ",b.jsx("a",{href:"https://zoo.dev/gltf-format-extension",rel:"noopener noreferrer",target:"_blank",children:"our open-source extension proposal"})," ","for the glTF file format."," ",b.jsx("a",{href:"https://zoo.dev/docs/api/convert-cad-file",rel:"noopener noreferrer",target:"_blank",children:"Our conversion API"})," ","can convert to and from most common CAD file formats, allowing export to almost any CAD software."]}),b.jsxs("p",{className:"my-4",children:["Our teammate David is working on the file format, check out"," ",b.jsx("a",{href:"https://www.youtube.com/watch?v=8SuW0qkYCZo",target:"_blank",rel:"noreferrer noopener",children:"his talk with the Metaverse Standards Forum"}),"!"]})]}),b.jsx(wo,{currentSlug:on.EXPORT,next:e,dismiss:t,nextText:"Next: Sketching"})]})})}function f9e(){const{send:t}=Ti(),e=Zs();return Iv(),P.useEffect(()=>{t({type:"Cancel"}),Ke.camControls.resetCameraPosition()},[t]),b.jsx("div",{className:"fixed grid justify-center items-center inset-0 bg-chalkboard-100/50 z-50",children:b.jsxs("div",{className:"max-w-full xl:max-w-2xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded",children:[b.jsx("h1",{className:"text-2xl font-bold",children:"Future Work"}),b.jsxs("p",{className:"my-4",children:["We have curves, cuts, multi-profile sketch mode, and many more CAD features coming soon. We want your feedback on this user interface, and we want to know what features you want to see next. Please message us in"," ",b.jsx("a",{href:"https://discord.gg/JQEpHR7Nt2",target:"_blank",rel:"noreferrer noopener",children:"our Discord server"}),"and"," ",b.jsx("a",{href:"https://github.com/KittyCAD/modeling-app/issues/new/choose",rel:"noreferrer noopener",target:"_blank",children:"open issues on GitHub"}),"."]}),b.jsxs("p",{className:"my-4",children:["If you make anything with the app we'd love to see it, feel free to"," ",b.jsx("a",{href:"https://twitter.com/zoodotdev",target:"_blank",rel:"noreferrer noopener",children:"tag us on X"}),"! Thank you for taking time to try out ",nu,", and build the future of hardware design with us."]}),b.jsx("p",{className:"my-4",children:"💚 The Zoo Team"}),b.jsx(wo,{currentSlug:on.FUTURE_WORK,className:"mt-6",dismiss:e,next:e,nextText:"Finish"})]})})}const $u="py-0.5 px-1 text-sm rounded bg-chalkboard-10 dark:bg-chalkboard-100 border border-chalkboard-50 border-b-2",AO=[{index:!0,element:b.jsx(Y7e,{})},{path:ys(on.CAMERA),element:b.jsx(n9e,{})},{path:ys(on.STREAMING),element:b.jsx(i9e,{})},{path:ys(on.EDITOR),element:b.jsx(s9e,{})},{path:ys(on.PARAMETRIC_MODELING),element:b.jsx(o9e,{})},{path:ys(on.INTERACTIVE_NUMBERS),element:b.jsx(a9e,{})},{path:ys(on.COMMAND_K),element:b.jsx(l9e,{})},{path:ys(on.USER_MENU),element:b.jsx(c9e,{})},{path:ys(on.PROJECT_MENU),element:b.jsx(u9e,{})},{path:ys(on.EXPORT),element:b.jsx(d9e,{})},{path:ys(on.SKETCHING),element:b.jsx(r9e,{})},{path:ys(on.FUTURE_WORK),element:b.jsx(f9e,{})}];function Iv(){const{overallState:t,immediateState:e}=Lg();P.useEffect(()=>{!Ot.editorView||Kt.code===uf||t!==ti.Ok||e.type!==No.ConnectionEstablished||setTimeout(Li(async()=>{Kt.updateCodeStateEditor(uf),await be.executeCode(!0),await Kt.writeToFile()},Bt))},[Ot.editorView,e,t])}function ll(t){const e=AA(),{settings:{send:n}}=In(),r=Ui();return P.useCallback(()=>{n({type:"set.app.onboardingStatus",data:{level:"user",value:t}}),r(e+ut.ONBOARDING.INDEX.slice(0,-1)+t)},[e,t,n,r])}function Zs(){const t=AA(),{settings:{state:e,send:n}}=In(),r=Ui(),i=P.useCallback(()=>{n({type:"set.app.onboardingStatus",data:{level:"user",value:"dismissed"}})},[n]);return P.useEffect(()=>{e.context.app.onboardingStatus.user==="dismissed"&&e.matches("idle")&&r(t)},[t,r,e]),i}function h9e(t){return t?t===on.INDEX?1:AO.findIndex(e=>e.path===ys(t))+1:void 0}function wo({next:t,nextText:e,dismiss:n,currentSlug:r,className:i,...s}){const o=h9e(r);return b.jsxs("div",{className:"flex items-center justify-between "+(i??""),...s,children:[b.jsx($t,{Element:"button",onClick:n,iconStart:{icon:"close",className:"text-chalkboard-10",bgClassName:"bg-destroy-80 group-hover:bg-destroy-80"},className:"hover:border-destroy-40 hover:bg-destroy-10/50 dark:hover:bg-destroy-80/50",children:"Dismiss"}),o!==void 0&&b.jsxs("p",{className:"font-mono text-xs text-center m-0",children:[o," / ",AO.length]}),b.jsx($t,{Element:"button",onClick:t,iconStart:{icon:"arrowRight",bgClassName:"dark:bg-chalkboard-80"},className:"dark:hover:bg-chalkboard-80/50","data-testid":"onboarding-next",children:e??"Next"})]})}const A9e=()=>{const t=Zs();return Tr("esc",t),b.jsx("div",{className:"content","data-testid":"onboarding-content",children:b.jsx(Gx,{})})},bne="border border-solid border-chalkboard-30 dark:border-chalkboard-80",XB=`${bne} rounded-lg px-6 py-3 text-chalkboard-70 dark:text-chalkboard-30`,p9e=()=>{const[t,e]=P.useState(""),{auth:{send:n},settings:{state:{context:{app:{theme:r}}}}}=In(),i=`${v7}${ut.SIGN_IN}?callbackUrl=${encodeURIComponent(typeof window<"u"&&window.location.href.replace("signin",""))}`,s=`${v7}/docs/kcl-samples/car-wheel`,o=P.useCallback((l=!0)=>r.current===Zn.Light||r.current===Zn.System&&_f()===Zn.Light?l?"-dark":"":l?"":"-dark",[r.current]),a=async()=>{const l=await window.electron.startDeviceFlow(cf).catch(reportError);if(!l){console.error("No user code received while trying to log in"),jt.error("Error while trying to log in");return}e(l);const c=await window.electron.loginWithDeviceFlow().catch(reportError);if(!c){console.error("No token received while trying to log in"),jt.error("Error while trying to log in");return}n({type:"Log in",token:c})};return b.jsx("main",{className:"bg-primary h-screen grid place-items-stretch m-0 p-2",style:ft()?{"-webkit-app-region":"drag"}:{},children:b.jsx("div",{style:ft()?{"-webkit-app-region":"no-drag"}:{},className:"body-bg py-5 px-12 rounded-lg grid place-items-center overflow-y-auto",children:b.jsxs("div",{className:"max-w-7xl grid gap-5 grid-cols-3 xl:grid-cols-4 xl:grid-rows-5",children:[b.jsxs("div",{className:"col-span-2 xl:col-span-3 xl:row-span-3 max-w-3xl mr-8 mb-8",children:[b.jsxs("div",{className:"flex items-baseline mb-8",children:[b.jsx(cR,{className:"text-primary h-10 lg:h-12 xl:h-16 relative translate-y-1 mr-4 lg:mr-6 xl:mr-8"}),b.jsx("h1",{className:"text-3xl lg:text-4xl xl:text-5xl",children:nu}),b.jsxs("span",{className:"px-3 py-1 text-base rounded-full bg-primary/10 text-primary self-start",children:["alpha v",Bh]})]}),b.jsx("p",{className:"my-4 text-lg xl:text-xl",children:"Thank you for using our hardware design application. It is built on a novel CAD engine and crafted to help you create parametric, version-controlled, and accurate parts ready for manufacturing."}),b.jsxs("p",{className:"my-4 text-lg xl:text-xl",children:["As alpha software, Zoo Modeling App is still in heavy development. We encourage feedback and feature requests that align with"," ",b.jsx("a",{href:"https://github.com/KittyCAD/modeling-app/issues/729",target:"_blank",rel:"noreferrer",children:"our roadmap to v1.0"}),"."]}),ft()?b.jsx("div",{className:"flex flex-col gap-2",children:t?b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"text-xs",children:"You should see the following code in your browser"}),b.jsx("p",{className:"text-lg font-bold inline-flex gap-1",children:t.split("").map((l,c)=>b.jsx("span",{className:"text-xl font-bold p-1 "+(l==="-"?"":"border-2 border-solid"),children:l},c))})]}):b.jsxs("button",{onClick:Li(a,Bt),className:"m-0 mt-8 w-fit flex gap-4 items-center px-3 py-1 !border-transparent !text-lg !text-chalkboard-10 !bg-primary hover:hue-rotate-15","data-testid":"sign-in-button",children:["Sign in to get started",b.jsx(nn,{name:"arrowRight",className:"w-6 h-6"})]})}):b.jsxs(Af,{onClick:tu(i),to:i,className:"w-fit m-0 mt-8 flex gap-4 items-center px-3 py-1 !border-transparent !text-lg !text-chalkboard-10 !bg-primary hover:hue-rotate-15","data-testid":"sign-in-button",children:["Sign in to get started",b.jsx(nn,{name:"arrowRight",className:"w-6 h-6"})]})]}),b.jsxs(Af,{className:`group relative xl:h-full xl:row-span-full col-start--1 xl:col-start-4 rounded-lg overflow-hidden grid place-items-center ${bne}`,to:s,onClick:tu(s),target:"_blank",rel:"noreferrer noopener",children:[b.jsx("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:"h-full object-cover object-center",children:b.jsx("source",{src:`${ft()?".":""}/wheel-loop${o(!1)}.mp4`,type:"video/mp4"})}),b.jsxs("div",{className:"absolute bottom-0 left-0 right-0 transition translate-y-4 opacity-0 group-hover:translate-y-0 group-hover:opacity-100 m-0 mt-8 flex gap-4 items-center px-3 py-1 !border-transparent !text-lg !text-chalkboard-10 !bg-primary hover:hue-rotate-15","data-testid":"sign-in-button",children:["View this sample",b.jsx(nn,{name:"arrowRight",className:"w-6 h-6"})]})]}),b.jsxs("div",{className:"self-end h-min col-span-3 xl:row-span-2 grid grid-cols-2 gap-5",children:[b.jsxs("div",{className:XB,children:[b.jsx("h2",{className:"text-xl",children:"Built in the open"}),b.jsx("p",{className:"text-xs my-4",children:"Open-source and open discussions. Check our public code base and join our Discord."}),b.jsxs("div",{className:"flex gap-4 flex-wrap items-center",children:[b.jsx($t,{Element:"externalLink",to:"https://github.com/KittyCAD/modeling-app",iconStart:{icon:"code"},className:"border-chalkboard-30 dark:border-chalkboard-80",children:b.jsx("span",{className:"py-2 lg:py-0",children:"Read our source code"})}),b.jsx($t,{Element:"externalLink",to:"https://discord.gg/JQEpHR7Nt2",iconStart:{icon:"keyboard"},className:"border-chalkboard-30 dark:border-chalkboard-80",children:b.jsx("span",{className:"py-2 lg:py-0",children:"Join our community"})})]})]}),b.jsxs("div",{className:XB,children:[b.jsx("h2",{className:"text-xl",children:"Ready for the future"}),b.jsx("p",{className:"text-xs my-4",children:"Modern software ideas being brought together to create a familiar modeling experience with new superpowers."}),b.jsxs("div",{className:"flex gap-4 flex-wrap items-center",children:[b.jsx($t,{Element:"externalLink",to:"https://zoo.dev/docs/kcl-samples/a-parametric-bearing-pillow-block",iconStart:{icon:"settings"},className:"border-chalkboard-30 dark:border-chalkboard-80",children:b.jsx("span",{className:"py-2 lg:py-0",children:"Parametric design with KCL"})}),b.jsx($t,{Element:"externalLink",to:"https://zoo.dev/docs/tutorials/text-to-cad",iconStart:{icon:"sparkles"},className:"border-chalkboard-30 dark:border-chalkboard-80",children:b.jsx("span",{className:"py-2 lg:py-0",children:"AI-unlocked CAD"})})]})]}),b.jsxs("div",{className:XB+" col-span-2",children:[b.jsx("h2",{className:"text-xl",children:"Built on the first infrastructure for hardware design"}),b.jsx("p",{className:"text-xs my-4",children:"You can make your own niche hardware design tools with our design and machine learning interfaces. We're building Modeling App in the same way."}),b.jsxs("div",{className:"flex gap-4 flex-wrap items-center",children:[b.jsx($t,{Element:"externalLink",to:"https://zoo.dev/design-api",iconStart:{icon:"sketch"},className:"border-chalkboard-30 dark:border-chalkboard-80",children:b.jsx("span",{className:"py-2 lg:py-0",children:"KittyCAD Design API"})}),b.jsx($t,{Element:"externalLink",to:"https://zoo.dev/machine-learning-api",iconStart:{icon:"elephant"},className:"border-chalkboard-30 dark:border-chalkboard-80",children:b.jsx("span",{className:"py-2 lg:py-0",children:"ML-ephant Machine Learning API"})})]})]})]})]})})})},dz=({children:t})=>{const{auth:e}=In();return(e==null?void 0:e.state.matches("checkIfLoggedIn"))?b.jsx(SI,{children:b.jsx("span",{"data-testid":"initial-load",children:"Loading Modeling App..."})}):b.jsx(b.Fragment,{children:t})},m9e=P.forwardRef(({project:t,onDismiss:e,...n},r)=>b.jsxs("form",{...n,children:[b.jsx("input",{className:"min-w-0 dark:bg-chalkboard-80 dark:border-chalkboard-40 focus:outline-none",type:"text",id:"newProjectName",onClickCapture:i=>i.preventDefault(),name:"newProjectName",required:!0,autoCorrect:"off",autoCapitalize:"off",defaultValue:t.name,ref:r,onKeyDown:i=>{i.key==="Escape"&&e()}}),b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx($t,{Element:"button",type:"submit",iconStart:{icon:"checkmark",bgClassName:"!bg-transparent"},className:"!p-0",children:b.jsx(Fr,{position:"left",delay:1e3,children:"Rename project"})}),b.jsx($t,{Element:"button",iconStart:{icon:"close",iconClassName:"dark:!text-chalkboard-20",bgClassName:"!bg-transparent"},className:"!p-0",onClick:e,children:b.jsx(Fr,{position:"left",delay:1e3,children:"Cancel"})})]})]}));function g9e({project:t,handleRenameProject:e,handleDeleteProject:n,...r}){var p,m;Tr("esc",()=>s(!1));const[i,s]=P.useState(!1),[o,a]=P.useState(!1),[l,c]=P.useState(1),[u,d]=P.useState(0);let f=P.useRef(null);function h(g){g.preventDefault(),e(g,t).then(()=>s(!1))}function A(g){const y=new Date(g),w=new Date;return w.setHours(0,0,0,0),y.getTime()<w.getTime()?y.toLocaleDateString():y.toLocaleTimeString()}return P.useEffect(()=>{async function g(){c(t.kcl_file_count),d(t.directory_count)}g()},[t.kcl_file_count,t.directory_count]),P.useEffect(()=>{f.current&&i&&(f.current.focus(),f.current.select())},[i,f.current]),b.jsxs("li",{...r,className:"group relative flex flex-col rounded-sm border border-primary/40 dark:border-chalkboard-80 hover:!border-primary",children:[b.jsx(Af,{"data-testid":"project-link",to:`${ut.FILE}/${encodeURIComponent(t.default_file)}`,className:"flex flex-col flex-1 !no-underline !text-chalkboard-110 dark:!text-chalkboard-10 group-hover:!hue-rotate-0 min-h-[5em] divide-y divide-primary/40 dark:divide-chalkboard-80 group-hover:!divide-primary",children:b.jsxs("div",{className:"pb-2 flex flex-col flex-grow flex-auto gap-2 rounded-b-sm",children:[i?b.jsx(m9e,{onSubmit:h,className:"flex items-center gap-2 p-2",onClick:g=>g.stopPropagation(),project:t,onDismiss:()=>s(!1),ref:f}):b.jsx("h3",{className:"font-sans relative z-0 p-2","data-testid":"project-title",children:(p=t.name)==null?void 0:p.replace(Ss,"")}),b.jsxs("span",{className:"px-2 text-chalkboard-60 text-xs",children:[b.jsx("span",{"data-testid":"project-file-count",children:l})," file",l===1?"":"s"," ",u>0&&b.jsxs(b.Fragment,{children:["/ ",b.jsx("span",{"data-testid":"project-folder-count",children:u})," ","folder",u===1?"":"s"]})]}),b.jsxs("span",{className:"px-2 text-chalkboard-60 text-xs",children:["Edited"," ",b.jsx("span",{"data-testid":"project-edit-date",children:t.metadata&&t.metadata.modified?A(parseInt(t.metadata.modified)):"never"})]})]})}),!i&&b.jsxs("div",{className:"absolute z-10 flex items-center gap-1 opacity-0 bottom-2 right-2 group-hover:opacity-100 group-focus-within:opacity-100","data-edit-buttons-for":(m=t.name)==null?void 0:m.replace(Ss,""),children:[b.jsx($t,{Element:"button",iconStart:{icon:"sketch",iconClassName:"dark:!text-chalkboard-20",bgClassName:"!bg-transparent"},onClick:g=>{g.stopPropagation(),g.nativeEvent.stopPropagation(),s(!0)},className:"!p-0",children:b.jsx(Fr,{position:"top-right",delay:1e3,children:"Rename project"})}),b.jsx($t,{Element:"button",iconStart:{icon:"trash",iconClassName:"dark:!text-chalkboard-30",bgClassName:"!bg-transparent"},className:"!p-0",onClick:g=>{g.stopPropagation(),g.nativeEvent.stopPropagation(),a(!0)},children:b.jsx(Fr,{position:"top-right",delay:1e3,children:"Delete project"})})]}),o&&b.jsxs(hne,{title:"Delete Project",onConfirm:Li(async()=>{await n(t),a(!1)},Bt),onDismiss:()=>a(!1),children:[b.jsxs("p",{className:"my-4",children:['This will permanently delete "',t.name||"this file",'".']}),b.jsxs("p",{className:"my-4",children:['Are you sure you want to delete "',t.name||"this file",'"? This action cannot be undone.']})]})]})}const y9e=Rg({types:{context:{},events:{},input:{}},actions:{setProjects:An({projects:({context:t,event:e})=>"output"in e?e.output:t.projects}),toastSuccess:()=>{},toastError:()=>{},navigateToProject:()=>{}},actors:{readProjects:Ht(()=>Promise.resolve([])),createProject:Ht(t=>Promise.resolve("")),renameProject:Ht(t=>Promise.resolve("")),deleteProject:Ht(t=>Promise.resolve(""))},guards:{"Has at least 1 project":()=>!1}}).createMachine({id:"Home machine",initial:"Reading projects",context:{projects:[],defaultProjectName:"",defaultDirectory:""},on:{assign:{actions:An(({event:t})=>({...t.data})),target:".Reading projects"}},states:{"Has no projects":{on:{"Read projects":{target:"Reading projects"},"Create project":{target:"Creating project"}}},"Has projects":{on:{"Read projects":{target:"Reading projects"},"Rename project":{target:"Renaming project"},"Create project":{target:"Creating project"},"Delete project":{target:"Deleting project"},"Open project":{target:"Opening project"}}},"Creating project":{invoke:{id:"create-project",src:"createProject",input:({event:t})=>t.type!=="Create project"?{name:""}:{name:t.data.name},onDone:[{target:"Reading projects",actions:["toastSuccess"]}],onError:[{target:"Reading projects",actions:["toastError"]}]}},"Renaming project":{invoke:{id:"rename-project",src:"renameProject",input:({event:t,context:e})=>t.type!=="Rename project"?{defaultProjectName:e.defaultProjectName,defaultDirectory:e.defaultDirectory,oldName:"",newName:""}:{defaultProjectName:e.defaultProjectName,defaultDirectory:e.defaultDirectory,oldName:t.data.oldName,newName:t.data.newName},onDone:[{target:"#Home machine.Reading projects",actions:["toastSuccess"]}],onError:[{target:"#Home machine.Reading projects",actions:["toastError"]}]}},"Deleting project":{invoke:{id:"delete-project",src:"deleteProject",input:({event:t,context:e})=>t.type!=="Delete project"?{defaultDirectory:e.defaultDirectory,name:""}:{defaultDirectory:e.defaultDirectory,name:t.data.name},onDone:[{actions:["toastSuccess"],target:"#Home machine.Reading projects"}],onError:{actions:["toastError"],target:"#Home machine.Has projects"}}},"Reading projects":{invoke:{id:"read-projects",src:"readProjects",onDone:[{guard:"Has at least 1 project",target:"Has projects",actions:["setProjects"]},{target:"Has no projects",actions:["setProjects"]}],onError:[{target:"Has no projects",actions:["toastError"]}]}},"Opening project":{entry:["navigateToProject"]}}}),J0=":desc";function fz(t,e){return t===e?"arrowUp":t===e+J0?"arrowDown":"horizontalDash"}function hz(t,e){return t===null||!t?{sort_by:e+(e!=="modified"?J0:"")}:t.includes(e)&&!t.includes(J0)?{sort_by:""}:{sort_by:e+(t.includes(J0)?"":J0)}}function v9e(t){const e=(r,i)=>r.name&&i.name?t.includes("desc")?r.name.localeCompare(i.name):i.name.localeCompare(r.name):0,n=(r,i)=>{var s,o;if((s=r.metadata)!=null&&s.modified&&((o=i.metadata)!=null&&o.modified)){const a=new Date(r.metadata.modified),l=new Date(i.metadata.modified);return!t||t.includes("desc")?l.getTime()-a.getTime():a.getTime()-l.getTime()}return 0};return t!=null&&t.includes("name")?e:n}const b9e={"Open project":{icon:"arrowRight",description:"Open a project",args:{name:{inputType:"options",required:!0,options:[],optionsFromContext:t=>t.projects.map(e=>({name:e.name,value:e.name}))}}},"Create project":{icon:"folderPlus",description:"Create a project",args:{name:{inputType:"string",required:!0,defaultValueFromContext:t=>t.defaultProjectName}}},"Delete project":{icon:"close",description:"Delete a project",needsReview:!0,args:{name:{inputType:"options",required:!0,options:[],optionsFromContext:t=>t.projects.map(e=>({name:e.name,value:e.name}))}}},"Rename project":{icon:"folder",description:"Rename a project",needsReview:!0,args:{oldName:{inputType:"options",required:!0,options:[],optionsFromContext:t=>t.projects.map(e=>({name:e.name,value:e.name}))},newName:{inputType:"string",required:!0,defaultValueFromContext:t=>t.defaultProjectName}}}};function w9e(t){const[e,n]=P.useState(""),[r,i]=P.useState(t),s=new wu(t,{keys:[{name:"name",weight:.7}],includeScore:!0});return P.useEffect(()=>{const o=s.search(e).map(a=>a.item);i(e.length>0?o:t)},[e,t]),{searchResults:r,query:e,setQuery:n}}function x9e({setQuery:t}){const e=P.useRef(null);return Tr("Ctrl+.",n=>{var r;n.preventDefault(),(r=e.current)==null||r.focus()},{enableOnFormTags:!0}),b.jsx("div",{className:"relative group",children:b.jsxs("div",{className:"flex items-center gap-2 py-0.5 pl-0.5 pr-2 rounded border-solid border border-primary/10 dark:border-chalkboard-80 focus-within:border-primary dark:focus-within:border-chalkboard-30",children:[b.jsx(nn,{name:"search",className:"w-5 h-5 rounded-sm bg-primary/10 dark:bg-transparent text-primary dark:text-chalkboard-10 group-focus-within:bg-primary group-focus-within:text-chalkboard-10"}),b.jsx("input",{ref:e,onChange:n=>t(n.target.value),className:"w-full text-sm bg-transparent focus:outline-none selection:bg-primary/20 dark:selection:bg-primary/40 dark:focus:outline-none",placeholder:"Search projects (^.)",autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:"false"})]})})}const C9e=t=>{const[e,n]=P.useState(-1),[r,i]=P.useState([]),[s,o]=P.useState(void 0);return P.useEffect(()=>{ft&&(t&&t[0]===e||(t&&n(t[0]),(async()=>{const{configuration:a}=await fg(),l=await WI(a);if(o(l),s){const c=await KI(a);i(c)}})().catch(pt)))},t??[]),{projectPaths:r,projectsDir:s}},_9e=()=>{const[t,e]=P.useState(0),{projectPaths:n,projectsDir:r}=C9e([t]);$te(ut.HOME+"SETTINGS");const{commandBarSend:i}=ni(),s=Ui(),{settings:{context:o}}=In(),{onProjectOpen:a}=bu();P.useEffect(()=>{be.cancelAllExecutions()},[]),Tr("backspace",C=>{C.preventDefault()}),Tr(ft()?"mod+,":"shift+mod+,",()=>s(ut.HOME+ut.SETTINGS),{splitKey:"|"});const l=P.useRef(null),[c,u,d]=Ly(y9e.provide({actions:{navigateToProject:({context:C,event:_})=>{if("data"in _&&_.data&&"name"in _.data){let S=C.defaultDirectory+window.electron.path.sep+_.data.name;a({name:_.data.name,path:S},null),i({type:"Close"}),s(`${ut.FILE}/${encodeURIComponent(S)}`)}},toastSuccess:({event:C})=>Zr.success("data"in C&&typeof C.data=="string"&&C.data||"output"in C&&typeof C.output=="string"&&C.output||""),toastError:({event:C})=>Zr.error("data"in C&&typeof C.data=="string"&&C.data||"output"in C&&typeof C.output=="string"&&C.output||"")},actors:{readProjects:Ht(()=>KI()),createProject:Ht(async({input:C})=>{let _=(C&&"name"in C&&C.name?C.name:o.projects.defaultProjectName.current).trim();if(mj(_)){const S=oR(_,f);_=aR(_,S)}return await JY(_),`Successfully created "${_}"`}),renameProject:Ht(async({input:C})=>{const{oldName:_,newName:S,defaultProjectName:E,defaultDirectory:T}=C;let R=S||E;if(mj(R)){const k=await oR(R,f);R=aR(R,k)}return await hEe(window.electron.path.join(T,_),R),`Successfully renamed "${_}" to "${R}"`}),deleteProject:Ht(async({input:C})=>(await window.electron.rm(window.electron.path.join(C.defaultDirectory,C.name),{recursive:!0}),`Successfully deleted "${C.name}"`))},guards:{"Has at least 1 project":({event:C})=>C.type!=="xstate.done.actor.read-projects"?!1:(console.log(`from has at least 1 project: ${C.output.length}`),C.output.length?C.output.length>=1:!1)}}),{input:{projects:n,defaultProjectName:o.projects.defaultProjectName.current,defaultDirectory:o.app.projectDirectory.current}});P.useEffect(()=>{u({type:"Read projects",data:{}})},[n]),x2(async()=>{e(t+1)},r?[r]:[]);const{projects:f}=c.context,[h,A]=GI(),{searchResults:p,query:m,setQuery:g}=w9e(f),y=h.get("sort_by")??"modified:desc",w=(y==null?void 0:y.includes("modified"))||!y||y===null;ZI({machineId:"home",send:u,state:c,commandBarConfig:b9e,actor:d}),P.useEffect(()=>{u({type:"assign",data:{defaultProjectName:o.projects.defaultProjectName.current,defaultDirectory:o.app.projectDirectory.current}})},[o.app.projectDirectory.current,o.projects.defaultProjectName.current,u]);async function v(C,_){const{newProjectName:S}=Object.fromEntries(new FormData(C.target));S!==_.name&&u({type:"Rename project",data:{oldName:_.name,newName:S}})}async function x(C){u({type:"Delete project",data:{name:C.name||""}})}return b.jsxs("div",{className:"relative flex flex-col h-screen overflow-hidden",ref:l,children:[b.jsx(Kte,{showToolbar:!1}),b.jsxs("div",{className:"w-full flex flex-col overflow-hidden max-w-5xl px-4 mx-auto mt-24 lg:px-2",children:[b.jsxs("section",{children:[b.jsxs("div",{className:"flex justify-between items-center select-none",children:[b.jsxs("div",{className:"flex gap-8 items-center",children:[b.jsx("h1",{className:"text-3xl font-bold",children:"Your Projects"}),b.jsx($t,{Element:"button",onClick:()=>u({type:"Create project",data:{name:""}}),className:"group !bg-primary !text-chalkboard-10 !border-primary hover:shadow-inner hover:hue-rotate-15",iconStart:{icon:"plus",bgClassName:"!bg-transparent rounded-sm",iconClassName:"!text-chalkboard-10 transition-transform group-active:rotate-90"},"data-testid":"home-new-file",children:"New project"})]}),b.jsxs("div",{className:"flex gap-2 items-center",children:[b.jsx(x9e,{setQuery:g}),b.jsx("small",{children:"Sort by"}),b.jsx($t,{Element:"button","data-testid":"home-sort-by-name",className:"text-xs border-primary/10 "+(y.includes("name")?"":"text-chalkboard-80 dark:text-chalkboard-40"),onClick:()=>A(hz(y,"name")),iconStart:{icon:fz(y,"name"),bgClassName:"bg-transparent",iconClassName:y.includes("name")?"":"!text-chalkboard-90 dark:!text-chalkboard-30"},children:"Name"}),b.jsx($t,{Element:"button","data-testid":"home-sort-by-modified",className:"text-xs border-primary/10 "+(w?"":"text-chalkboard-80 dark:text-chalkboard-40"),onClick:()=>A(hz(y,"modified")),iconStart:{icon:y?fz(y,"modified"):"arrowDown",bgClassName:"bg-transparent",iconClassName:w?"":"!text-chalkboard-90 dark:!text-chalkboard-30"},children:"Last Modified"})]})]}),b.jsxs("p",{className:"my-4 text-sm text-chalkboard-80 dark:text-chalkboard-30",children:["Loaded from"," ",b.jsx(Af,{"data-testid":"project-directory-settings-link",to:`${ut.HOME+ut.SETTINGS_USER}#projectDirectory`,className:"text-chalkboard-90 dark:text-chalkboard-20 underline underline-offset-2",children:o.app.projectDirectory.current}),"."]})]}),b.jsx("section",{"data-testid":"home-section",className:"flex-1 overflow-y-auto pr-2 pb-24",children:c.matches("Reading projects")?b.jsx(SI,{children:"Loading your Projects..."}):b.jsx(b.Fragment,{children:p.length>0?b.jsx("ul",{className:"grid w-full grid-cols-4 gap-4",children:p.sort(v9e(y)).map(C=>b.jsx(g9e,{project:C,handleRenameProject:v,handleDeleteProject:x},C.name))}):b.jsxs("p",{className:"p-4 my-8 border border-dashed rounded border-chalkboard-30 dark:border-chalkboard-70",children:["No Projects found",f.length===0?", ready to make your first one?":` with the search term "${m}"`]})})}),b.jsx(vne,{})]})]})},S9e=()=>{const{settings:t}=In(),[e,n]=P.useState(t.context.app.dismissWebBanner.current);return b.jsxs(ir,{className:"fixed inset-0 z-50 grid place-items-center",open:!e,onClose:()=>({}),children:[b.jsx(ir.Overlay,{className:"fixed inset-0 bg-chalkboard-10/80 dark:bg-chalkboard-100/70"}),b.jsx(ir.Panel,{className:"relative max-w-xl bg-warn-20 text-warn-80 px-8 py-4 rounded-md",children:b.jsxs("div",{className:"max-w-3xl mx-auto",children:[b.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Be warned!"}),b.jsx("p",{children:"Zoo Modeling App Desktop is more reliable! The web app is not officially supported."}),!(navigator!=null&&navigator.userAgent.includes("Chrome"))&&b.jsxs("p",{className:"mt-6",children:["If you want to stay here on the web-app, we currently only support Chrome. Please use"," ",b.jsx("a",{href:"https://www.google.com/chrome/",rel:"noopener noreferrer",target:"_blank",className:"!text-warn-80 dark:!text-warn-80 dark:hover:!text-warn-70 underline",children:"this link"})," ","to download it."]}),b.jsxs("div",{className:"flex flex-row-reverse gap-4 justify-between mt-6",children:[b.jsx($t,{Element:"externalLink",to:"https://zoo.dev/modeling-app/download",className:"group text-warn-10 dark:!text-warn-10 pr-1 border-warn-70 hover:border-warn-80 dark:!border-warn-70 dark:hover:!border-warn-80 bg-warn-70 group-hover:bg-warn-80 dark:bg-warn-70 dark:group-hover:bg-warn-80",iconEnd:{icon:"arrowRight",iconClassName:"text-warn-10 dark:text-warn-10",bgClassName:"!bg-transparent"},children:"Download Desktop App"}),b.jsx($t,{Element:"button",onClick:()=>n(!0),className:"group text-warn-80 bg-warn-10 border-warn-50 hover:border-warn-80 hover:bg-warn-10 dark:bg-warn-10 dark:!border-warn-50 dark:hover:!border-warn-80 dark:text-warn-80 dark:hover:bg-warn-10",iconStart:{icon:"checkmark",iconClassName:"text-warn-10 dark:text-warn-10",bgClassName:"bg-warn-50 group-hover:bg-warn-80 dark:bg-warn-50 dark:group-hover:bg-warn-80"},children:"Proceed at my own risk"})]})]})})]})};function E9e(){const[t,e]=P.useState(!1),{wasmInitFailed:n}=uc();return n?b.jsx(ir,{className:"fixed inset-0 top-auto z-50 bg-warn-20 text-warn-80 px-8 py-4",open:!t,onClose:()=>({}),children:b.jsxs(ir.Panel,{className:"max-w-3xl mx-auto",children:[b.jsxs("div",{className:"flex gap-2 justify-between items-start",children:[b.jsx("h2",{className:"text-xl font-bold mb-4",children:"Problem with our WASM blob :("}),b.jsx($t,{Element:"button",onClick:()=>e(!0),iconStart:{icon:"close",className:"p-1",bgClassName:"bg-warn-70 hover:bg-warn-80 dark:bg-warn-70 dark:hover:bg-warn-80",iconClassName:"text-warn-10 group-hover:text-warn-10 dark:text-warn-10 dark:group-hover:text-warn-10"},className:"!p-0 !bg-transparent !border-transparent"})]}),b.jsxs("p",{children:[b.jsx("a",{href:"https://webassembly.org/",rel:"noopener noreferrer",target:"_blank",className:"text-warn-80 dark:text-warn-80 dark:hover:text-warn-70 underline",children:"WASM or web assembly"})," ","is core part of how our app works. It might because you OS is not up-to-date. If you're able to update your OS to a later version, try that. If not create an issue on"," ",b.jsx("a",{href:"https://github.com/KittyCAD/modeling-app",rel:"noopener noreferrer",target:"_blank",className:"text-warn-80 dark:text-warn-80 dark:hover:text-warn-70 underline",children:"our Github"}),"."]})]})}):null}const Z0=async({params:t})=>{let{settings:e,configuration:n}=await fg();if(t.id){const r=await dJ(t.id,n);if(r){const{projectPath:i}=r,{settings:s}=await fg(i||void 0);return s}}return e},T9e=async t=>{const{settings:e}=await fg(),n=e.app.onboardingStatus.current||"",r=!t.request.url.includes(ut.ONBOARDING.INDEX),i=n.length===0||!(n==="done"||n==="dismissed");return r&&i?Oy(ys(ut.ONBOARDING.INDEX)+n.slice(1)):Z0(t)},B9e=async t=>{const{params:e}=t;let{configuration:n}=await fg();const r=await dJ(e.id,n);if(!(e.id===decodeURIComponent(T5))&&r){const{projectName:s,projectPath:o,currentFileName:a,currentFilePath:l}=r,c=new URL(t.request.url);let u="";if(!c.pathname.endsWith("/settings")){const A=ft()?(await D_(o)).default_file:"";let p=ft();if(l&&p)try{await window.electron.stat(l)}catch(m){m==="ENOENT"&&(p=!1)}if(!p||!a||!l||!s)return Oy(`${ut.FILE}/${encodeURIComponent(ft()?A:e.id+"/"+ea)}`);u=await window.electron.readFile(l,{encoding:"utf-8"}),u=mne(u),Kt.updateCurrentFilePath(l),Kt.updateCodeStateEditor(u)}Oq.dir=o;const d={name:s||"unnamed",path:o,children:[],kcl_file_count:0,directory_count:0,metadata:null,default_file:o},f=ft()?await D_(o):null;return console.log("maybeProjectInfo",{maybeProjectInfo:f,defaultProjectData:d,projectPathData:r}),{...{code:u,project:f??d,file:{name:a||"",path:l||"",children:[]}}}}return{code:"",project:{name:eg,path:"/"+eg,children:[]},file:{name:Hq,path:decodeURIComponent(T5),children:[]}}},M9e=async()=>ft()?{}:Oy(ut.FILE+"/%2F"+eg),k9e=ft()?Z2e:J2e,R9e=k9e([{loader:Z0,id:ut.INDEX,element:b.jsx($Ee,{children:b.jsx(B5,{children:b.jsx(oLe,{children:b.jsx(XEe,{children:b.jsx(JEe,{children:b.jsx(Gx,{})})})})})}),errorElement:b.jsx(X7e,{}),children:[{path:ut.INDEX,loader:async()=>{const t=ft();return Oy(t?ut.HOME:ut.FILE+"/%2F"+eg)}},{loader:B9e,id:ut.FILE,path:ut.FILE+"/:id",element:b.jsx(dz,{children:b.jsxs(LPe,{children:[b.jsxs(IPe,{children:[b.jsx(L9e,{}),b.jsx(Gx,{}),b.jsx(q7e,{}),b.jsx(KQ,{}),!ft()&&!0&&b.jsx(S9e,{})]}),b.jsx(E9e,{})]})}),children:[{id:ut.FILE+"SETTINGS",loader:Z0,children:[{loader:T9e,index:!0,element:b.jsx(b.Fragment,{})},{path:ys(ut.SETTINGS),element:b.jsx(Uj,{})},{path:ys(ut.ONBOARDING.INDEX),element:b.jsx(A9e,{}),children:AO}]}]},{path:ut.HOME,element:b.jsxs(dz,{children:[b.jsx(Gx,{}),b.jsx(_9e,{}),b.jsx(KQ,{})]}),id:ut.HOME,loader:M9e,children:[{index:!0,element:b.jsx(b.Fragment,{}),id:ut.HOME+"SETTINGS",loader:Z0},{path:ys(ut.SETTINGS),loader:Z0,element:b.jsx(Uj,{})}]},{path:ut.SIGN_IN,element:b.jsx(p9e,{})}]}]),P9e=()=>{const t=YEe();return b.jsx(gJ.Provider,{value:t,children:b.jsx(aEe,{router:R9e})})};function L9e(){var r;const{auth:t}=In(),e=(r=t==null?void 0:t.context)==null?void 0:r.token,n=P.useMemo(()=>new aO(je,Kt,e),[]);return Vy(["mod + shift + ."],()=>{jt.promise(rI(n,!0),{loading:"Starting core dump...",success:"Core dump completed successfully",error:"Error while exporting core dump"},{success:{duration:6e3}}).catch(Bt)}),null}function I9e({version:t,releaseNotes:e,onRestart:n,onDismiss:r}){const i=e==null?void 0:e.toLocaleLowerCase().includes("breaking");return b.jsx("div",{className:"inset-0 z-50 grid place-content-center rounded bg-chalkboard-110/50 shadow-md",children:b.jsxs("div",{className:"max-w-3xl min-w-[35rem] p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90",children:[b.jsxs("div",{className:"my-4 flex items-baseline",children:[b.jsxs("span",{className:"px-3 py-1 text-xl rounded-full bg-primary text-chalkboard-10","data-testid":"update-version",children:["v",t]}),b.jsxs("p",{className:"ml-4 text-md text-bold",children:["A new update has downloaded and will be available next time you start the app. You can view the release notes"," ",b.jsx("a",{onClick:tu(`https://github.com/KittyCAD/modeling-app/releases/tag/v${t}`),href:`https://github.com/KittyCAD/modeling-app/releases/tag/v${t}`,target:"_blank",rel:"noreferrer",children:"here on GitHub."})]})]}),e&&b.jsxs("details",{className:"my-4 border border-chalkboard-30 dark:border-chalkboard-60 rounded",open:i,"data-testid":"release-notes",children:[b.jsxs("summary",{className:"p-2 select-none cursor-pointer",children:["Release notes",i&&b.jsx("strong",{className:"text-destroy-50",children:" (Breaking changes)"})]}),b.jsx("div",{className:"parsed-markdown py-2 px-4 mt-2 border-t border-chalkboard-30 dark:border-chalkboard-60 max-h-60 overflow-y-auto",dangerouslySetInnerHTML:{__html:eu.parse(e,{gfm:!0,breaks:!0,sanitize:!0})}})]}),b.jsxs("div",{className:"flex justify-between gap-8",children:[b.jsx($t,{Element:"button",iconStart:{icon:"arrowRotateRight"},name:"restart",onClick:n,children:"Restart app now"}),b.jsx($t,{Element:"button",iconStart:{icon:"checkmark"},name:"dismiss",onClick:()=>{jt.dismiss(),r()},children:"Got it"})]})]})})}const O9e=YB.createRoot(document.getElementById("root"));O9e.render(b.jsx(ARe,{children:b.jsxs(ZEe,{children:[b.jsx(P9e,{}),b.jsx(zse,{position:"bottom-center",toastOptions:{style:{borderRadius:"3px",maxInlineSize:"min(480px, 100%)"},className:"bg-chalkboard-10 dark:bg-chalkboard-90 text-chalkboard-110 dark:text-chalkboard-10 rounded-sm border-chalkboard-20/50 dark:border-chalkboard-80/50",success:{iconTheme:{primary:"oklch(89% 0.16 143.4deg)",secondary:"oklch(48.62% 0.1654 142.5deg)"},duration:1500}}}),b.jsx(B6,{})]})}));ft()&&(window.electron.onUpdateDownloadStart(()=>{const t="Downloading app update...";console.log(t),jt.loading(t,{id:LT})}),window.electron.onUpdateError(({error:t})=>{console.error(t),jt.error("An error occurred while downloading the update.",{id:LT})}),window.electron.onUpdateDownloaded(({version:t,releaseNotes:e})=>{const n=`A new update (${t}) was downloaded and will be available next time you open the app.`;console.log(n),jt.custom(I9e({version:t,releaseNotes:e,onRestart:()=>{window.electron.appRestart()},onDismiss:()=>{}}),{duration:3e4,id:LT})}));
