winden-tokens 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/cli.mjs +219 -0
- package/package.json +49 -0
- package/server.mjs +692 -0
- package/ui/index.html +226 -0
package/ui/index.html
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Tokens Manager</title>
|
|
7
|
+
<script type="module" crossorigin>
|
|
8
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function oC(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lC={exports:{}},Sp={},aC={exports:{}},He={};/**
|
|
9
|
+
* @license React
|
|
10
|
+
* react.production.min.js
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/var qc=Symbol.for("react.element"),aD=Symbol.for("react.portal"),uD=Symbol.for("react.fragment"),cD=Symbol.for("react.strict_mode"),dD=Symbol.for("react.profiler"),fD=Symbol.for("react.provider"),hD=Symbol.for("react.context"),pD=Symbol.for("react.forward_ref"),mD=Symbol.for("react.suspense"),gD=Symbol.for("react.memo"),yD=Symbol.for("react.lazy"),eb=Symbol.iterator;function xD(t){return t===null||typeof t!="object"?null:(t=eb&&t[eb]||t["@@iterator"],typeof t=="function"?t:null)}var uC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},cC=Object.assign,dC={};function Ha(t,e,n){this.props=t,this.context=e,this.refs=dC,this.updater=n||uC}Ha.prototype.isReactComponent={};Ha.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")};Ha.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function fC(){}fC.prototype=Ha.prototype;function Ry(t,e,n){this.props=t,this.context=e,this.refs=dC,this.updater=n||uC}var By=Ry.prototype=new fC;By.constructor=Ry;cC(By,Ha.prototype);By.isPureReactComponent=!0;var tb=Array.isArray,hC=Object.prototype.hasOwnProperty,Oy={current:null},pC={key:!0,ref:!0,__self:!0,__source:!0};function mC(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)hC.call(e,r)&&!pC.hasOwnProperty(r)&&(i[r]=e[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){for(var a=Array(l),u=0;u<l;u++)a[u]=arguments[u+2];i.children=a}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:qc,type:t,key:s,ref:o,props:i,_owner:Oy.current}}function vD(t,e){return{$$typeof:qc,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function jy(t){return typeof t=="object"&&t!==null&&t.$$typeof===qc}function bD(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var nb=/\/+/g;function Tm(t,e){return typeof t=="object"&&t!==null&&t.key!=null?bD(""+t.key):e.toString(36)}function Nf(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 qc:case aD:o=!0}}if(o)return o=t,i=i(o),t=r===""?"."+Tm(o,0):r,tb(i)?(n="",t!=null&&(n=t.replace(nb,"$&/")+"/"),Nf(i,e,n,"",function(u){return u})):i!=null&&(jy(i)&&(i=vD(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(nb,"$&/")+"/")+t)),e.push(i)),1;if(o=0,r=r===""?".":r+":",tb(t))for(var l=0;l<t.length;l++){s=t[l];var a=r+Tm(s,l);o+=Nf(s,e,n,a,i)}else if(a=xD(t),typeof a=="function")for(t=a.call(t),l=0;!(s=t.next()).done;)s=s.value,a=r+Tm(s,l++),o+=Nf(s,e,n,a,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 Cd(t,e,n){if(t==null)return t;var r=[],i=0;return Nf(t,r,"","",function(s){return e.call(n,s,i++)}),r}function wD(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 Hn={current:null},Af={transition:null},CD={ReactCurrentDispatcher:Hn,ReactCurrentBatchConfig:Af,ReactCurrentOwner:Oy};function gC(){throw Error("act(...) is not supported in production builds of React.")}He.Children={map:Cd,forEach:function(t,e,n){Cd(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Cd(t,function(){e++}),e},toArray:function(t){return Cd(t,function(e){return e})||[]},only:function(t){if(!jy(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};He.Component=Ha;He.Fragment=uD;He.Profiler=dD;He.PureComponent=Ry;He.StrictMode=cD;He.Suspense=mD;He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=CD;He.act=gC;He.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=cC({},t.props),i=t.key,s=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=Oy.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(a in e)hC.call(e,a)&&!pC.hasOwnProperty(a)&&(r[a]=e[a]===void 0&&l!==void 0?l[a]:e[a])}var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){l=Array(a);for(var u=0;u<a;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:qc,type:t.type,key:i,ref:s,props:r,_owner:o}};He.createContext=function(t){return t={$$typeof:hD,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:fD,_context:t},t.Consumer=t};He.createElement=mC;He.createFactory=function(t){var e=mC.bind(null,t);return e.type=t,e};He.createRef=function(){return{current:null}};He.forwardRef=function(t){return{$$typeof:pD,render:t}};He.isValidElement=jy;He.lazy=function(t){return{$$typeof:yD,_payload:{_status:-1,_result:t},_init:wD}};He.memo=function(t,e){return{$$typeof:gD,type:t,compare:e===void 0?null:e}};He.startTransition=function(t){var e=Af.transition;Af.transition={};try{t()}finally{Af.transition=e}};He.unstable_act=gC;He.useCallback=function(t,e){return Hn.current.useCallback(t,e)};He.useContext=function(t){return Hn.current.useContext(t)};He.useDebugValue=function(){};He.useDeferredValue=function(t){return Hn.current.useDeferredValue(t)};He.useEffect=function(t,e){return Hn.current.useEffect(t,e)};He.useId=function(){return Hn.current.useId()};He.useImperativeHandle=function(t,e,n){return Hn.current.useImperativeHandle(t,e,n)};He.useInsertionEffect=function(t,e){return Hn.current.useInsertionEffect(t,e)};He.useLayoutEffect=function(t,e){return Hn.current.useLayoutEffect(t,e)};He.useMemo=function(t,e){return Hn.current.useMemo(t,e)};He.useReducer=function(t,e,n){return Hn.current.useReducer(t,e,n)};He.useRef=function(t){return Hn.current.useRef(t)};He.useState=function(t){return Hn.current.useState(t)};He.useSyncExternalStore=function(t,e,n){return Hn.current.useSyncExternalStore(t,e,n)};He.useTransition=function(){return Hn.current.useTransition()};He.version="18.3.1";aC.exports=He;var w=aC.exports;const be=oC(w);/**
|
|
17
|
+
* @license React
|
|
18
|
+
* react-jsx-runtime.production.min.js
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the MIT license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/var kD=w,SD=Symbol.for("react.element"),ED=Symbol.for("react.fragment"),$D=Object.prototype.hasOwnProperty,MD=kD.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,DD={key:!0,ref:!0,__self:!0,__source:!0};function yC(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)$D.call(e,r)&&!DD.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:SD,type:t,key:s,ref:o,props:i,_owner:MD.current}}Sp.Fragment=ED;Sp.jsx=yC;Sp.jsxs=yC;lC.exports=Sp;var g=lC.exports,xC={exports:{}},Cr={},vC={exports:{}},bC={};/**
|
|
25
|
+
* @license React
|
|
26
|
+
* scheduler.production.min.js
|
|
27
|
+
*
|
|
28
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
29
|
+
*
|
|
30
|
+
* This source code is licensed under the MIT license found in the
|
|
31
|
+
* LICENSE file in the root directory of this source tree.
|
|
32
|
+
*/(function(t){function e(I,P){var F=I.length;I.push(P);e:for(;0<F;){var z=F-1>>>1,j=I[z];if(0<i(j,P))I[z]=P,I[F]=j,F=z;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var P=I[0],F=I.pop();if(F!==P){I[0]=F;e:for(var z=0,j=I.length,R=j>>>1;z<R;){var H=2*(z+1)-1,G=I[H],U=H+1,se=I[U];if(0>i(G,F))U<j&&0>i(se,G)?(I[z]=se,I[U]=F,z=U):(I[z]=G,I[H]=F,z=H);else if(U<j&&0>i(se,F))I[z]=se,I[U]=F,z=U;else break e}}return P}function i(I,P){var F=I.sortIndex-P.sortIndex;return F!==0?F:I.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],u=[],c=1,d=null,f=3,h=!1,m=!1,x=!1,v=typeof setTimeout=="function"?setTimeout:null,p=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 b(I){for(var P=n(u);P!==null;){if(P.callback===null)r(u);else if(P.startTime<=I)r(u),P.sortIndex=P.expirationTime,e(a,P);else break;P=n(u)}}function C(I){if(x=!1,b(I),!m)if(n(a)!==null)m=!0,N(S);else{var P=n(u);P!==null&&O(C,P.startTime-I)}}function S(I,P){m=!1,x&&(x=!1,p($),$=-1),h=!0;var F=f;try{for(b(P),d=n(a);d!==null&&(!(d.expirationTime>P)||I&&!A());){var z=d.callback;if(typeof z=="function"){d.callback=null,f=d.priorityLevel;var j=z(d.expirationTime<=P);P=t.unstable_now(),typeof j=="function"?d.callback=j:d===n(a)&&r(a),b(P)}else r(a);d=n(a)}if(d!==null)var R=!0;else{var H=n(u);H!==null&&O(C,H.startTime-P),R=!1}return R}finally{d=null,f=F,h=!1}}var k=!1,E=null,$=-1,D=5,L=-1;function A(){return!(t.unstable_now()-L<D)}function T(){if(E!==null){var I=t.unstable_now();L=I;var P=!0;try{P=E(!0,I)}finally{P?V():(k=!1,E=null)}}else k=!1}var V;if(typeof y=="function")V=function(){y(T)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,B=M.port2;M.port1.onmessage=T,V=function(){B.postMessage(null)}}else V=function(){v(T,0)};function N(I){E=I,k||(k=!0,V())}function O(I,P){$=v(function(){I(t.unstable_now())},P)}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(I){I.callback=null},t.unstable_continueExecution=function(){m||h||(m=!0,N(S))},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(a)},t.unstable_next=function(I){switch(f){case 1:case 2:case 3:var P=3;break;default:P=f}var F=f;f=P;try{return I()}finally{f=F}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(I,P){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var F=f;f=I;try{return P()}finally{f=F}},t.unstable_scheduleCallback=function(I,P,F){var z=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?z+F:z):F=z,I){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=F+j,I={id:c++,callback:P,priorityLevel:I,startTime:F,expirationTime:j,sortIndex:-1},F>z?(I.sortIndex=F,e(u,I),n(a)===null&&I===n(u)&&(x?(p($),$=-1):x=!0,O(C,F-z))):(I.sortIndex=j,e(a,I),m||h||(m=!0,N(S))),I},t.unstable_shouldYield=A,t.unstable_wrapCallback=function(I){var P=f;return function(){var F=f;f=P;try{return I.apply(this,arguments)}finally{f=F}}}})(bC);vC.exports=bC;var ND=vC.exports;/**
|
|
33
|
+
* @license React
|
|
34
|
+
* react-dom.production.min.js
|
|
35
|
+
*
|
|
36
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
37
|
+
*
|
|
38
|
+
* This source code is licensed under the MIT license found in the
|
|
39
|
+
* LICENSE file in the root directory of this source tree.
|
|
40
|
+
*/var AD=w,br=ND;function ue(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 wC=new Set,tc={};function ul(t,e){ya(t,e),ya(t+"Capture",e)}function ya(t,e){for(tc[t]=e,t=0;t<e.length;t++)wC.add(e[t])}var es=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m0=Object.prototype.hasOwnProperty,TD=/^[: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]*$/,rb={},ib={};function PD(t){return m0.call(ib,t)?!0:m0.call(rb,t)?!1:TD.test(t)?ib[t]=!0:(rb[t]=!0,!1)}function LD(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 ID(t,e,n,r){if(e===null||typeof e>"u"||LD(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 zn(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 wn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){wn[t]=new zn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];wn[e]=new zn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){wn[t]=new zn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){wn[t]=new zn(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){wn[t]=new zn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){wn[t]=new zn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){wn[t]=new zn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){wn[t]=new zn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){wn[t]=new zn(t,5,!1,t.toLowerCase(),null,!1,!1)});var Vy=/[\-:]([a-z])/g;function Fy(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(Vy,Fy);wn[e]=new zn(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(Vy,Fy);wn[e]=new zn(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(Vy,Fy);wn[e]=new zn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){wn[t]=new zn(t,1,!1,t.toLowerCase(),null,!1,!1)});wn.xlinkHref=new zn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){wn[t]=new zn(t,1,!1,t.toLowerCase(),null,!0,!0)});function _y(t,e,n,r){var i=wn.hasOwnProperty(e)?wn[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(ID(e,n,i,r)&&(n=null),r||i===null?PD(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 cs=AD.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,kd=Symbol.for("react.element"),Pl=Symbol.for("react.portal"),Ll=Symbol.for("react.fragment"),Hy=Symbol.for("react.strict_mode"),g0=Symbol.for("react.profiler"),CC=Symbol.for("react.provider"),kC=Symbol.for("react.context"),zy=Symbol.for("react.forward_ref"),y0=Symbol.for("react.suspense"),x0=Symbol.for("react.suspense_list"),Wy=Symbol.for("react.memo"),vs=Symbol.for("react.lazy"),SC=Symbol.for("react.offscreen"),sb=Symbol.iterator;function ru(t){return t===null||typeof t!="object"?null:(t=sb&&t[sb]||t["@@iterator"],typeof t=="function"?t:null)}var Pt=Object.assign,Pm;function wu(t){if(Pm===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Pm=e&&e[1]||""}return`
|
|
41
|
+
`+Pm+t}var Lm=!1;function Im(t,e){if(!t||Lm)return"";Lm=!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(u){var r=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){r=u}t.call(e.prototype)}else{try{throw Error()}catch(u){r=u}t()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(`
|
|
42
|
+
`),s=r.stack.split(`
|
|
43
|
+
`),o=i.length-1,l=s.length-1;1<=o&&0<=l&&i[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==s[l]){var a=`
|
|
44
|
+
`+i[o].replace(" at new "," at ");return t.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{Lm=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?wu(t):""}function RD(t){switch(t.tag){case 5:return wu(t.type);case 16:return wu("Lazy");case 13:return wu("Suspense");case 19:return wu("SuspenseList");case 0:case 2:case 15:return t=Im(t.type,!1),t;case 11:return t=Im(t.type.render,!1),t;case 1:return t=Im(t.type,!0),t;default:return""}}function v0(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 Ll:return"Fragment";case Pl:return"Portal";case g0:return"Profiler";case Hy:return"StrictMode";case y0:return"Suspense";case x0:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case kC:return(t.displayName||"Context")+".Consumer";case CC:return(t._context.displayName||"Context")+".Provider";case zy:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Wy:return e=t.displayName||null,e!==null?e:v0(t.type)||"Memo";case vs:e=t._payload,t=t._init;try{return v0(t(e))}catch{}}return null}function BD(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 v0(e);case 8:return e===Hy?"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 Xs(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function EC(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function OD(t){var e=EC(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 Sd(t){t._valueTracker||(t._valueTracker=OD(t))}function $C(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=EC(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function oh(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 b0(t,e){var n=e.checked;return Pt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function ob(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Xs(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 MC(t,e){e=e.checked,e!=null&&_y(t,"checked",e,!1)}function w0(t,e){MC(t,e);var n=Xs(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")?C0(t,e.type,n):e.hasOwnProperty("defaultValue")&&C0(t,e.type,Xs(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function lb(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 C0(t,e,n){(e!=="number"||oh(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Cu=Array.isArray;function Zl(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=""+Xs(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 k0(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(ue(91));return Pt({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function ab(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(ue(92));if(Cu(n)){if(1<n.length)throw Error(ue(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Xs(n)}}function DC(t,e){var n=Xs(e.value),r=Xs(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 ub(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function NC(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 S0(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?NC(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Ed,AC=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(Ed=Ed||document.createElement("div"),Ed.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Ed.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function nc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Lu={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},jD=["Webkit","ms","Moz","O"];Object.keys(Lu).forEach(function(t){jD.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Lu[e]=Lu[t]})});function TC(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Lu.hasOwnProperty(t)&&Lu[t]?(""+e).trim():e+"px"}function PC(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=TC(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var VD=Pt({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 E0(t,e){if(e){if(VD[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ue(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ue(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ue(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ue(62))}}function $0(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 M0=null;function Gy(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var D0=null,Jl=null,ea=null;function cb(t){if(t=Jc(t)){if(typeof D0!="function")throw Error(ue(280));var e=t.stateNode;e&&(e=Np(e),D0(t.stateNode,t.type,e))}}function LC(t){Jl?ea?ea.push(t):ea=[t]:Jl=t}function IC(){if(Jl){var t=Jl,e=ea;if(ea=Jl=null,cb(t),e)for(t=0;t<e.length;t++)cb(e[t])}}function RC(t,e){return t(e)}function BC(){}var Rm=!1;function OC(t,e,n){if(Rm)return t(e,n);Rm=!0;try{return RC(t,e,n)}finally{Rm=!1,(Jl!==null||ea!==null)&&(BC(),IC())}}function rc(t,e){var n=t.stateNode;if(n===null)return null;var r=Np(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(ue(231,e,typeof n));return n}var N0=!1;if(es)try{var iu={};Object.defineProperty(iu,"passive",{get:function(){N0=!0}}),window.addEventListener("test",iu,iu),window.removeEventListener("test",iu,iu)}catch{N0=!1}function FD(t,e,n,r,i,s,o,l,a){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(c){this.onError(c)}}var Iu=!1,lh=null,ah=!1,A0=null,_D={onError:function(t){Iu=!0,lh=t}};function HD(t,e,n,r,i,s,o,l,a){Iu=!1,lh=null,FD.apply(_D,arguments)}function zD(t,e,n,r,i,s,o,l,a){if(HD.apply(this,arguments),Iu){if(Iu){var u=lh;Iu=!1,lh=null}else throw Error(ue(198));ah||(ah=!0,A0=u)}}function cl(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 jC(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 db(t){if(cl(t)!==t)throw Error(ue(188))}function WD(t){var e=t.alternate;if(!e){if(e=cl(t),e===null)throw Error(ue(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 db(i),t;if(s===r)return db(i),e;s=s.sibling}throw Error(ue(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o)throw Error(ue(189))}}if(n.alternate!==r)throw Error(ue(190))}if(n.tag!==3)throw Error(ue(188));return n.stateNode.current===n?t:e}function VC(t){return t=WD(t),t!==null?FC(t):null}function FC(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=FC(t);if(e!==null)return e;t=t.sibling}return null}var _C=br.unstable_scheduleCallback,fb=br.unstable_cancelCallback,GD=br.unstable_shouldYield,UD=br.unstable_requestPaint,Gt=br.unstable_now,KD=br.unstable_getCurrentPriorityLevel,Uy=br.unstable_ImmediatePriority,HC=br.unstable_UserBlockingPriority,uh=br.unstable_NormalPriority,YD=br.unstable_LowPriority,zC=br.unstable_IdlePriority,Ep=null,Mi=null;function XD(t){if(Mi&&typeof Mi.onCommitFiberRoot=="function")try{Mi.onCommitFiberRoot(Ep,t,void 0,(t.current.flags&128)===128)}catch{}}var Jr=Math.clz32?Math.clz32:ZD,qD=Math.log,QD=Math.LN2;function ZD(t){return t>>>=0,t===0?32:31-(qD(t)/QD|0)|0}var $d=64,Md=4194304;function ku(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 ch(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 l=o&~i;l!==0?r=ku(l):(s&=o,s!==0&&(r=ku(s)))}else o=n&~i,o!==0?r=ku(o):s!==0&&(r=ku(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-Jr(e),i=1<<n,r|=t[n],e&=~i;return r}function JD(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 eN(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var o=31-Jr(s),l=1<<o,a=i[o];a===-1?(!(l&n)||l&r)&&(i[o]=JD(l,e)):a<=e&&(t.expiredLanes|=l),s&=~l}}function T0(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function WC(){var t=$d;return $d<<=1,!($d&4194240)&&($d=64),t}function Bm(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Qc(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Jr(e),t[e]=n}function tN(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-Jr(n),s=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~s}}function Ky(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Jr(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var nt=0;function GC(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var UC,Yy,KC,YC,XC,P0=!1,Dd=[],Is=null,Rs=null,Bs=null,ic=new Map,sc=new Map,Ss=[],nN="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 hb(t,e){switch(t){case"focusin":case"focusout":Is=null;break;case"dragenter":case"dragleave":Rs=null;break;case"mouseover":case"mouseout":Bs=null;break;case"pointerover":case"pointerout":ic.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":sc.delete(e.pointerId)}}function su(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=Jc(e),e!==null&&Yy(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function rN(t,e,n,r,i){switch(e){case"focusin":return Is=su(Is,t,e,n,r,i),!0;case"dragenter":return Rs=su(Rs,t,e,n,r,i),!0;case"mouseover":return Bs=su(Bs,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return ic.set(s,su(ic.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,sc.set(s,su(sc.get(s)||null,t,e,n,r,i)),!0}return!1}function qC(t){var e=Ao(t.target);if(e!==null){var n=cl(e);if(n!==null){if(e=n.tag,e===13){if(e=jC(n),e!==null){t.blockedOn=e,XC(t.priority,function(){KC(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 Tf(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=L0(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);M0=r,n.target.dispatchEvent(r),M0=null}else return e=Jc(n),e!==null&&Yy(e),t.blockedOn=n,!1;e.shift()}return!0}function pb(t,e,n){Tf(t)&&n.delete(e)}function iN(){P0=!1,Is!==null&&Tf(Is)&&(Is=null),Rs!==null&&Tf(Rs)&&(Rs=null),Bs!==null&&Tf(Bs)&&(Bs=null),ic.forEach(pb),sc.forEach(pb)}function ou(t,e){t.blockedOn===e&&(t.blockedOn=null,P0||(P0=!0,br.unstable_scheduleCallback(br.unstable_NormalPriority,iN)))}function oc(t){function e(i){return ou(i,t)}if(0<Dd.length){ou(Dd[0],t);for(var n=1;n<Dd.length;n++){var r=Dd[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Is!==null&&ou(Is,t),Rs!==null&&ou(Rs,t),Bs!==null&&ou(Bs,t),ic.forEach(e),sc.forEach(e),n=0;n<Ss.length;n++)r=Ss[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Ss.length&&(n=Ss[0],n.blockedOn===null);)qC(n),n.blockedOn===null&&Ss.shift()}var ta=cs.ReactCurrentBatchConfig,dh=!0;function sN(t,e,n,r){var i=nt,s=ta.transition;ta.transition=null;try{nt=1,Xy(t,e,n,r)}finally{nt=i,ta.transition=s}}function oN(t,e,n,r){var i=nt,s=ta.transition;ta.transition=null;try{nt=4,Xy(t,e,n,r)}finally{nt=i,ta.transition=s}}function Xy(t,e,n,r){if(dh){var i=L0(t,e,n,r);if(i===null)Um(t,e,r,fh,n),hb(t,r);else if(rN(i,t,e,n,r))r.stopPropagation();else if(hb(t,r),e&4&&-1<nN.indexOf(t)){for(;i!==null;){var s=Jc(i);if(s!==null&&UC(s),s=L0(t,e,n,r),s===null&&Um(t,e,r,fh,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else Um(t,e,r,null,n)}}var fh=null;function L0(t,e,n,r){if(fh=null,t=Gy(r),t=Ao(t),t!==null)if(e=cl(t),e===null)t=null;else if(n=e.tag,n===13){if(t=jC(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 fh=t,null}function QC(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(KD()){case Uy:return 1;case HC:return 4;case uh:case YD:return 16;case zC:return 536870912;default:return 16}default:return 16}}var As=null,qy=null,Pf=null;function ZC(){if(Pf)return Pf;var t,e=qy,n=e.length,r,i="value"in As?As.value:As.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 Pf=i.slice(t,1<r?1-r:void 0)}function Lf(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 Nd(){return!0}function mb(){return!1}function kr(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 l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Nd:mb,this.isPropagationStopped=mb,this}return Pt(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=Nd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Nd)},persist:function(){},isPersistent:Nd}),e}var za={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qy=kr(za),Zc=Pt({},za,{view:0,detail:0}),lN=kr(Zc),Om,jm,lu,$p=Pt({},Zc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zy,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!==lu&&(lu&&t.type==="mousemove"?(Om=t.screenX-lu.screenX,jm=t.screenY-lu.screenY):jm=Om=0,lu=t),Om)},movementY:function(t){return"movementY"in t?t.movementY:jm}}),gb=kr($p),aN=Pt({},$p,{dataTransfer:0}),uN=kr(aN),cN=Pt({},Zc,{relatedTarget:0}),Vm=kr(cN),dN=Pt({},za,{animationName:0,elapsedTime:0,pseudoElement:0}),fN=kr(dN),hN=Pt({},za,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),pN=kr(hN),mN=Pt({},za,{data:0}),yb=kr(mN),gN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yN={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"},xN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vN(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=xN[t])?!!e[t]:!1}function Zy(){return vN}var bN=Pt({},Zc,{key:function(t){if(t.key){var e=gN[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Lf(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?yN[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zy,charCode:function(t){return t.type==="keypress"?Lf(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Lf(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),wN=kr(bN),CN=Pt({},$p,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xb=kr(CN),kN=Pt({},Zc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zy}),SN=kr(kN),EN=Pt({},za,{propertyName:0,elapsedTime:0,pseudoElement:0}),$N=kr(EN),MN=Pt({},$p,{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}),DN=kr(MN),NN=[9,13,27,32],Jy=es&&"CompositionEvent"in window,Ru=null;es&&"documentMode"in document&&(Ru=document.documentMode);var AN=es&&"TextEvent"in window&&!Ru,JC=es&&(!Jy||Ru&&8<Ru&&11>=Ru),vb=" ",bb=!1;function e6(t,e){switch(t){case"keyup":return NN.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function t6(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Il=!1;function TN(t,e){switch(t){case"compositionend":return t6(e);case"keypress":return e.which!==32?null:(bb=!0,vb);case"textInput":return t=e.data,t===vb&&bb?null:t;default:return null}}function PN(t,e){if(Il)return t==="compositionend"||!Jy&&e6(t,e)?(t=ZC(),Pf=qy=As=null,Il=!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 JC&&e.locale!=="ko"?null:e.data;default:return null}}var LN={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 wb(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!LN[t.type]:e==="textarea"}function n6(t,e,n,r){LC(r),e=hh(e,"onChange"),0<e.length&&(n=new Qy("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var Bu=null,lc=null;function IN(t){h6(t,0)}function Mp(t){var e=Ol(t);if($C(e))return t}function RN(t,e){if(t==="change")return e}var r6=!1;if(es){var Fm;if(es){var _m="oninput"in document;if(!_m){var Cb=document.createElement("div");Cb.setAttribute("oninput","return;"),_m=typeof Cb.oninput=="function"}Fm=_m}else Fm=!1;r6=Fm&&(!document.documentMode||9<document.documentMode)}function kb(){Bu&&(Bu.detachEvent("onpropertychange",i6),lc=Bu=null)}function i6(t){if(t.propertyName==="value"&&Mp(lc)){var e=[];n6(e,lc,t,Gy(t)),OC(IN,e)}}function BN(t,e,n){t==="focusin"?(kb(),Bu=e,lc=n,Bu.attachEvent("onpropertychange",i6)):t==="focusout"&&kb()}function ON(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Mp(lc)}function jN(t,e){if(t==="click")return Mp(e)}function VN(t,e){if(t==="input"||t==="change")return Mp(e)}function FN(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ni=typeof Object.is=="function"?Object.is:FN;function ac(t,e){if(ni(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(!m0.call(e,i)||!ni(t[i],e[i]))return!1}return!0}function Sb(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Eb(t,e){var n=Sb(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=Sb(n)}}function s6(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?s6(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function o6(){for(var t=window,e=oh();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=oh(t.document)}return e}function ex(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 _N(t){var e=o6(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&s6(n.ownerDocument.documentElement,n)){if(r!==null&&ex(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=Eb(n,s);var o=Eb(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 HN=es&&"documentMode"in document&&11>=document.documentMode,Rl=null,I0=null,Ou=null,R0=!1;function $b(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;R0||Rl==null||Rl!==oh(r)||(r=Rl,"selectionStart"in r&&ex(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}),Ou&&ac(Ou,r)||(Ou=r,r=hh(I0,"onSelect"),0<r.length&&(e=new Qy("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Rl)))}function Ad(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Bl={animationend:Ad("Animation","AnimationEnd"),animationiteration:Ad("Animation","AnimationIteration"),animationstart:Ad("Animation","AnimationStart"),transitionend:Ad("Transition","TransitionEnd")},Hm={},l6={};es&&(l6=document.createElement("div").style,"AnimationEvent"in window||(delete Bl.animationend.animation,delete Bl.animationiteration.animation,delete Bl.animationstart.animation),"TransitionEvent"in window||delete Bl.transitionend.transition);function Dp(t){if(Hm[t])return Hm[t];if(!Bl[t])return t;var e=Bl[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in l6)return Hm[t]=e[n];return t}var a6=Dp("animationend"),u6=Dp("animationiteration"),c6=Dp("animationstart"),d6=Dp("transitionend"),f6=new Map,Mb="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 oo(t,e){f6.set(t,e),ul(e,[t])}for(var zm=0;zm<Mb.length;zm++){var Wm=Mb[zm],zN=Wm.toLowerCase(),WN=Wm[0].toUpperCase()+Wm.slice(1);oo(zN,"on"+WN)}oo(a6,"onAnimationEnd");oo(u6,"onAnimationIteration");oo(c6,"onAnimationStart");oo("dblclick","onDoubleClick");oo("focusin","onFocus");oo("focusout","onBlur");oo(d6,"onTransitionEnd");ya("onMouseEnter",["mouseout","mouseover"]);ya("onMouseLeave",["mouseout","mouseover"]);ya("onPointerEnter",["pointerout","pointerover"]);ya("onPointerLeave",["pointerout","pointerover"]);ul("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ul("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ul("onBeforeInput",["compositionend","keypress","textInput","paste"]);ul("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ul("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ul("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Su="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(" "),GN=new Set("cancel close invalid load scroll toggle".split(" ").concat(Su));function Db(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,zD(r,e,void 0,t),t.currentTarget=null}function h6(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 l=r[o],a=l.instance,u=l.currentTarget;if(l=l.listener,a!==s&&i.isPropagationStopped())break e;Db(i,l,u),s=a}else for(o=0;o<r.length;o++){if(l=r[o],a=l.instance,u=l.currentTarget,l=l.listener,a!==s&&i.isPropagationStopped())break e;Db(i,l,u),s=a}}}if(ah)throw t=A0,ah=!1,A0=null,t}function gt(t,e){var n=e[F0];n===void 0&&(n=e[F0]=new Set);var r=t+"__bubble";n.has(r)||(p6(e,t,2,!1),n.add(r))}function Gm(t,e,n){var r=0;e&&(r|=4),p6(n,t,r,e)}var Td="_reactListening"+Math.random().toString(36).slice(2);function uc(t){if(!t[Td]){t[Td]=!0,wC.forEach(function(n){n!=="selectionchange"&&(GN.has(n)||Gm(n,!1,t),Gm(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Td]||(e[Td]=!0,Gm("selectionchange",!1,e))}}function p6(t,e,n,r){switch(QC(e)){case 1:var i=sN;break;case 4:i=oN;break;default:i=Xy}n=i.bind(null,e,n,t),i=void 0,!N0||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 Um(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 l=r.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===i||a.nodeType===8&&a.parentNode===i))return;o=o.return}for(;l!==null;){if(o=Ao(l),o===null)return;if(a=o.tag,a===5||a===6){r=s=o;continue e}l=l.parentNode}}r=r.return}OC(function(){var u=s,c=Gy(n),d=[];e:{var f=f6.get(t);if(f!==void 0){var h=Qy,m=t;switch(t){case"keypress":if(Lf(n)===0)break e;case"keydown":case"keyup":h=wN;break;case"focusin":m="focus",h=Vm;break;case"focusout":m="blur",h=Vm;break;case"beforeblur":case"afterblur":h=Vm;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=gb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=uN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=SN;break;case a6:case u6:case c6:h=fN;break;case d6:h=$N;break;case"scroll":h=lN;break;case"wheel":h=DN;break;case"copy":case"cut":case"paste":h=pN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=xb}var x=(e&4)!==0,v=!x&&t==="scroll",p=x?f!==null?f+"Capture":null:f;x=[];for(var y=u,b;y!==null;){b=y;var C=b.stateNode;if(b.tag===5&&C!==null&&(b=C,p!==null&&(C=rc(y,p),C!=null&&x.push(cc(y,C,b)))),v)break;y=y.return}0<x.length&&(f=new h(f,m,null,n,c),d.push({event:f,listeners:x}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",f&&n!==M0&&(m=n.relatedTarget||n.fromElement)&&(Ao(m)||m[ts]))break e;if((h||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,h?(m=n.relatedTarget||n.toElement,h=u,m=m?Ao(m):null,m!==null&&(v=cl(m),m!==v||m.tag!==5&&m.tag!==6)&&(m=null)):(h=null,m=u),h!==m)){if(x=gb,C="onMouseLeave",p="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(x=xb,C="onPointerLeave",p="onPointerEnter",y="pointer"),v=h==null?f:Ol(h),b=m==null?f:Ol(m),f=new x(C,y+"leave",h,n,c),f.target=v,f.relatedTarget=b,C=null,Ao(c)===u&&(x=new x(p,y+"enter",m,n,c),x.target=b,x.relatedTarget=v,C=x),v=C,h&&m)t:{for(x=h,p=m,y=0,b=x;b;b=Cl(b))y++;for(b=0,C=p;C;C=Cl(C))b++;for(;0<y-b;)x=Cl(x),y--;for(;0<b-y;)p=Cl(p),b--;for(;y--;){if(x===p||p!==null&&x===p.alternate)break t;x=Cl(x),p=Cl(p)}x=null}else x=null;h!==null&&Nb(d,f,h,x,!1),m!==null&&v!==null&&Nb(d,v,m,x,!0)}}e:{if(f=u?Ol(u):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var S=RN;else if(wb(f))if(r6)S=VN;else{S=ON;var k=BN}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(S=jN);if(S&&(S=S(t,u))){n6(d,S,n,c);break e}k&&k(t,f,u),t==="focusout"&&(k=f._wrapperState)&&k.controlled&&f.type==="number"&&C0(f,"number",f.value)}switch(k=u?Ol(u):window,t){case"focusin":(wb(k)||k.contentEditable==="true")&&(Rl=k,I0=u,Ou=null);break;case"focusout":Ou=I0=Rl=null;break;case"mousedown":R0=!0;break;case"contextmenu":case"mouseup":case"dragend":R0=!1,$b(d,n,c);break;case"selectionchange":if(HN)break;case"keydown":case"keyup":$b(d,n,c)}var E;if(Jy)e:{switch(t){case"compositionstart":var $="onCompositionStart";break e;case"compositionend":$="onCompositionEnd";break e;case"compositionupdate":$="onCompositionUpdate";break e}$=void 0}else Il?e6(t,n)&&($="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&($="onCompositionStart");$&&(JC&&n.locale!=="ko"&&(Il||$!=="onCompositionStart"?$==="onCompositionEnd"&&Il&&(E=ZC()):(As=c,qy="value"in As?As.value:As.textContent,Il=!0)),k=hh(u,$),0<k.length&&($=new yb($,t,null,n,c),d.push({event:$,listeners:k}),E?$.data=E:(E=t6(n),E!==null&&($.data=E)))),(E=AN?TN(t,n):PN(t,n))&&(u=hh(u,"onBeforeInput"),0<u.length&&(c=new yb("onBeforeInput","beforeinput",null,n,c),d.push({event:c,listeners:u}),c.data=E))}h6(d,e)})}function cc(t,e,n){return{instance:t,listener:e,currentTarget:n}}function hh(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=rc(t,n),s!=null&&r.unshift(cc(t,s,i)),s=rc(t,e),s!=null&&r.push(cc(t,s,i))),t=t.return}return r}function Cl(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Nb(t,e,n,r,i){for(var s=e._reactName,o=[];n!==null&&n!==r;){var l=n,a=l.alternate,u=l.stateNode;if(a!==null&&a===r)break;l.tag===5&&u!==null&&(l=u,i?(a=rc(n,s),a!=null&&o.unshift(cc(n,a,l))):i||(a=rc(n,s),a!=null&&o.push(cc(n,a,l)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var UN=/\r\n?/g,KN=/\u0000|\uFFFD/g;function Ab(t){return(typeof t=="string"?t:""+t).replace(UN,`
|
|
45
|
+
`).replace(KN,"")}function Pd(t,e,n){if(e=Ab(e),Ab(t)!==e&&n)throw Error(ue(425))}function ph(){}var B0=null,O0=null;function j0(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 V0=typeof setTimeout=="function"?setTimeout:void 0,YN=typeof clearTimeout=="function"?clearTimeout:void 0,Tb=typeof Promise=="function"?Promise:void 0,XN=typeof queueMicrotask=="function"?queueMicrotask:typeof Tb<"u"?function(t){return Tb.resolve(null).then(t).catch(qN)}:V0;function qN(t){setTimeout(function(){throw t})}function Km(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),oc(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);oc(e)}function Os(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 Pb(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 Wa=Math.random().toString(36).slice(2),bi="__reactFiber$"+Wa,dc="__reactProps$"+Wa,ts="__reactContainer$"+Wa,F0="__reactEvents$"+Wa,QN="__reactListeners$"+Wa,ZN="__reactHandles$"+Wa;function Ao(t){var e=t[bi];if(e)return e;for(var n=t.parentNode;n;){if(e=n[ts]||n[bi]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Pb(t);t!==null;){if(n=t[bi])return n;t=Pb(t)}return e}t=n,n=t.parentNode}return null}function Jc(t){return t=t[bi]||t[ts],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Ol(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(ue(33))}function Np(t){return t[dc]||null}var _0=[],jl=-1;function lo(t){return{current:t}}function yt(t){0>jl||(t.current=_0[jl],_0[jl]=null,jl--)}function ft(t,e){jl++,_0[jl]=t.current,t.current=e}var qs={},Mn=lo(qs),nr=lo(!1),Uo=qs;function xa(t,e){var n=t.type.contextTypes;if(!n)return qs;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 rr(t){return t=t.childContextTypes,t!=null}function mh(){yt(nr),yt(Mn)}function Lb(t,e,n){if(Mn.current!==qs)throw Error(ue(168));ft(Mn,e),ft(nr,n)}function m6(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(ue(108,BD(t)||"Unknown",i));return Pt({},n,r)}function gh(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||qs,Uo=Mn.current,ft(Mn,t),ft(nr,nr.current),!0}function Ib(t,e,n){var r=t.stateNode;if(!r)throw Error(ue(169));n?(t=m6(t,e,Uo),r.__reactInternalMemoizedMergedChildContext=t,yt(nr),yt(Mn),ft(Mn,t)):yt(nr),ft(nr,n)}var Wi=null,Ap=!1,Ym=!1;function g6(t){Wi===null?Wi=[t]:Wi.push(t)}function JN(t){Ap=!0,g6(t)}function ao(){if(!Ym&&Wi!==null){Ym=!0;var t=0,e=nt;try{var n=Wi;for(nt=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Wi=null,Ap=!1}catch(i){throw Wi!==null&&(Wi=Wi.slice(t+1)),_C(Uy,ao),i}finally{nt=e,Ym=!1}}return null}var Vl=[],Fl=0,yh=null,xh=0,$r=[],Mr=0,Ko=null,Ki=1,Yi="";function wo(t,e){Vl[Fl++]=xh,Vl[Fl++]=yh,yh=t,xh=e}function y6(t,e,n){$r[Mr++]=Ki,$r[Mr++]=Yi,$r[Mr++]=Ko,Ko=t;var r=Ki;t=Yi;var i=32-Jr(r)-1;r&=~(1<<i),n+=1;var s=32-Jr(e)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ki=1<<32-Jr(e)+i|n<<i|r,Yi=s+t}else Ki=1<<s|n<<i|r,Yi=t}function tx(t){t.return!==null&&(wo(t,1),y6(t,1,0))}function nx(t){for(;t===yh;)yh=Vl[--Fl],Vl[Fl]=null,xh=Vl[--Fl],Vl[Fl]=null;for(;t===Ko;)Ko=$r[--Mr],$r[Mr]=null,Yi=$r[--Mr],$r[Mr]=null,Ki=$r[--Mr],$r[Mr]=null}var vr=null,yr=null,wt=!1,Gr=null;function x6(t,e){var n=Nr(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 Rb(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,vr=t,yr=Os(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,vr=t,yr=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Ko!==null?{id:Ki,overflow:Yi}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Nr(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,vr=t,yr=null,!0):!1;default:return!1}}function H0(t){return(t.mode&1)!==0&&(t.flags&128)===0}function z0(t){if(wt){var e=yr;if(e){var n=e;if(!Rb(t,e)){if(H0(t))throw Error(ue(418));e=Os(n.nextSibling);var r=vr;e&&Rb(t,e)?x6(r,n):(t.flags=t.flags&-4097|2,wt=!1,vr=t)}}else{if(H0(t))throw Error(ue(418));t.flags=t.flags&-4097|2,wt=!1,vr=t}}}function Bb(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;vr=t}function Ld(t){if(t!==vr)return!1;if(!wt)return Bb(t),wt=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!j0(t.type,t.memoizedProps)),e&&(e=yr)){if(H0(t))throw v6(),Error(ue(418));for(;e;)x6(t,e),e=Os(e.nextSibling)}if(Bb(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(ue(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){yr=Os(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}yr=null}}else yr=vr?Os(t.stateNode.nextSibling):null;return!0}function v6(){for(var t=yr;t;)t=Os(t.nextSibling)}function va(){yr=vr=null,wt=!1}function rx(t){Gr===null?Gr=[t]:Gr.push(t)}var eA=cs.ReactCurrentBatchConfig;function au(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(ue(309));var r=n.stateNode}if(!r)throw Error(ue(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 l=i.refs;o===null?delete l[s]:l[s]=o},e._stringRef=s,e)}if(typeof t!="string")throw Error(ue(284));if(!n._owner)throw Error(ue(290,t))}return t}function Id(t,e){throw t=Object.prototype.toString.call(e),Error(ue(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Ob(t){var e=t._init;return e(t._payload)}function b6(t){function e(p,y){if(t){var b=p.deletions;b===null?(p.deletions=[y],p.flags|=16):b.push(y)}}function n(p,y){if(!t)return null;for(;y!==null;)e(p,y),y=y.sibling;return null}function r(p,y){for(p=new Map;y!==null;)y.key!==null?p.set(y.key,y):p.set(y.index,y),y=y.sibling;return p}function i(p,y){return p=_s(p,y),p.index=0,p.sibling=null,p}function s(p,y,b){return p.index=b,t?(b=p.alternate,b!==null?(b=b.index,b<y?(p.flags|=2,y):b):(p.flags|=2,y)):(p.flags|=1048576,y)}function o(p){return t&&p.alternate===null&&(p.flags|=2),p}function l(p,y,b,C){return y===null||y.tag!==6?(y=tg(b,p.mode,C),y.return=p,y):(y=i(y,b),y.return=p,y)}function a(p,y,b,C){var S=b.type;return S===Ll?c(p,y,b.props.children,C,b.key):y!==null&&(y.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===vs&&Ob(S)===y.type)?(C=i(y,b.props),C.ref=au(p,y,b),C.return=p,C):(C=Ff(b.type,b.key,b.props,null,p.mode,C),C.ref=au(p,y,b),C.return=p,C)}function u(p,y,b,C){return y===null||y.tag!==4||y.stateNode.containerInfo!==b.containerInfo||y.stateNode.implementation!==b.implementation?(y=ng(b,p.mode,C),y.return=p,y):(y=i(y,b.children||[]),y.return=p,y)}function c(p,y,b,C,S){return y===null||y.tag!==7?(y=Fo(b,p.mode,C,S),y.return=p,y):(y=i(y,b),y.return=p,y)}function d(p,y,b){if(typeof y=="string"&&y!==""||typeof y=="number")return y=tg(""+y,p.mode,b),y.return=p,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case kd:return b=Ff(y.type,y.key,y.props,null,p.mode,b),b.ref=au(p,null,y),b.return=p,b;case Pl:return y=ng(y,p.mode,b),y.return=p,y;case vs:var C=y._init;return d(p,C(y._payload),b)}if(Cu(y)||ru(y))return y=Fo(y,p.mode,b,null),y.return=p,y;Id(p,y)}return null}function f(p,y,b,C){var S=y!==null?y.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return S!==null?null:l(p,y,""+b,C);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case kd:return b.key===S?a(p,y,b,C):null;case Pl:return b.key===S?u(p,y,b,C):null;case vs:return S=b._init,f(p,y,S(b._payload),C)}if(Cu(b)||ru(b))return S!==null?null:c(p,y,b,C,null);Id(p,b)}return null}function h(p,y,b,C,S){if(typeof C=="string"&&C!==""||typeof C=="number")return p=p.get(b)||null,l(y,p,""+C,S);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case kd:return p=p.get(C.key===null?b:C.key)||null,a(y,p,C,S);case Pl:return p=p.get(C.key===null?b:C.key)||null,u(y,p,C,S);case vs:var k=C._init;return h(p,y,b,k(C._payload),S)}if(Cu(C)||ru(C))return p=p.get(b)||null,c(y,p,C,S,null);Id(y,C)}return null}function m(p,y,b,C){for(var S=null,k=null,E=y,$=y=0,D=null;E!==null&&$<b.length;$++){E.index>$?(D=E,E=null):D=E.sibling;var L=f(p,E,b[$],C);if(L===null){E===null&&(E=D);break}t&&E&&L.alternate===null&&e(p,E),y=s(L,y,$),k===null?S=L:k.sibling=L,k=L,E=D}if($===b.length)return n(p,E),wt&&wo(p,$),S;if(E===null){for(;$<b.length;$++)E=d(p,b[$],C),E!==null&&(y=s(E,y,$),k===null?S=E:k.sibling=E,k=E);return wt&&wo(p,$),S}for(E=r(p,E);$<b.length;$++)D=h(E,p,$,b[$],C),D!==null&&(t&&D.alternate!==null&&E.delete(D.key===null?$:D.key),y=s(D,y,$),k===null?S=D:k.sibling=D,k=D);return t&&E.forEach(function(A){return e(p,A)}),wt&&wo(p,$),S}function x(p,y,b,C){var S=ru(b);if(typeof S!="function")throw Error(ue(150));if(b=S.call(b),b==null)throw Error(ue(151));for(var k=S=null,E=y,$=y=0,D=null,L=b.next();E!==null&&!L.done;$++,L=b.next()){E.index>$?(D=E,E=null):D=E.sibling;var A=f(p,E,L.value,C);if(A===null){E===null&&(E=D);break}t&&E&&A.alternate===null&&e(p,E),y=s(A,y,$),k===null?S=A:k.sibling=A,k=A,E=D}if(L.done)return n(p,E),wt&&wo(p,$),S;if(E===null){for(;!L.done;$++,L=b.next())L=d(p,L.value,C),L!==null&&(y=s(L,y,$),k===null?S=L:k.sibling=L,k=L);return wt&&wo(p,$),S}for(E=r(p,E);!L.done;$++,L=b.next())L=h(E,p,$,L.value,C),L!==null&&(t&&L.alternate!==null&&E.delete(L.key===null?$:L.key),y=s(L,y,$),k===null?S=L:k.sibling=L,k=L);return t&&E.forEach(function(T){return e(p,T)}),wt&&wo(p,$),S}function v(p,y,b,C){if(typeof b=="object"&&b!==null&&b.type===Ll&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case kd:e:{for(var S=b.key,k=y;k!==null;){if(k.key===S){if(S=b.type,S===Ll){if(k.tag===7){n(p,k.sibling),y=i(k,b.props.children),y.return=p,p=y;break e}}else if(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===vs&&Ob(S)===k.type){n(p,k.sibling),y=i(k,b.props),y.ref=au(p,k,b),y.return=p,p=y;break e}n(p,k);break}else e(p,k);k=k.sibling}b.type===Ll?(y=Fo(b.props.children,p.mode,C,b.key),y.return=p,p=y):(C=Ff(b.type,b.key,b.props,null,p.mode,C),C.ref=au(p,y,b),C.return=p,p=C)}return o(p);case Pl:e:{for(k=b.key;y!==null;){if(y.key===k)if(y.tag===4&&y.stateNode.containerInfo===b.containerInfo&&y.stateNode.implementation===b.implementation){n(p,y.sibling),y=i(y,b.children||[]),y.return=p,p=y;break e}else{n(p,y);break}else e(p,y);y=y.sibling}y=ng(b,p.mode,C),y.return=p,p=y}return o(p);case vs:return k=b._init,v(p,y,k(b._payload),C)}if(Cu(b))return m(p,y,b,C);if(ru(b))return x(p,y,b,C);Id(p,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,y!==null&&y.tag===6?(n(p,y.sibling),y=i(y,b),y.return=p,p=y):(n(p,y),y=tg(b,p.mode,C),y.return=p,p=y),o(p)):n(p,y)}return v}var ba=b6(!0),w6=b6(!1),vh=lo(null),bh=null,_l=null,ix=null;function sx(){ix=_l=bh=null}function ox(t){var e=vh.current;yt(vh),t._currentValue=e}function W0(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 na(t,e){bh=t,ix=_l=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Zn=!0),t.firstContext=null)}function Br(t){var e=t._currentValue;if(ix!==t)if(t={context:t,memoizedValue:e,next:null},_l===null){if(bh===null)throw Error(ue(308));_l=t,bh.dependencies={lanes:0,firstContext:t}}else _l=_l.next=t;return e}var To=null;function lx(t){To===null?To=[t]:To.push(t)}function C6(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,lx(e)):(n.next=i.next,i.next=n),e.interleaved=n,ns(t,r)}function ns(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 bs=!1;function ax(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function k6(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 qi(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function js(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,qe&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,ns(t,n)}return i=r.interleaved,i===null?(e.next=e,lx(r)):(e.next=i.next,i.next=e),r.interleaved=e,ns(t,n)}function If(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,Ky(t,n)}}function jb(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 wh(t,e,n,r){var i=t.updateQueue;bs=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var a=l,u=a.next;a.next=null,o===null?s=u:o.next=u,o=a;var c=t.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==o&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(s!==null){var d=i.baseState;o=0,c=u=a=null,l=s;do{var f=l.lane,h=l.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=t,x=l;switch(f=e,h=n,x.tag){case 1:if(m=x.payload,typeof m=="function"){d=m.call(h,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=x.payload,f=typeof m=="function"?m.call(h,d,f):m,f==null)break e;d=Pt({},d,f);break e;case 2:bs=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=h,a=d):c=c.next=h,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;f=l,l=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(c===null&&(a=d),i.baseState=a,i.firstBaseUpdate=u,i.lastBaseUpdate=c,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);Xo|=o,t.lanes=o,t.memoizedState=d}}function Vb(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(ue(191,i));i.call(r)}}}var ed={},Di=lo(ed),fc=lo(ed),hc=lo(ed);function Po(t){if(t===ed)throw Error(ue(174));return t}function ux(t,e){switch(ft(hc,e),ft(fc,t),ft(Di,ed),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:S0(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=S0(e,t)}yt(Di),ft(Di,e)}function wa(){yt(Di),yt(fc),yt(hc)}function S6(t){Po(hc.current);var e=Po(Di.current),n=S0(e,t.type);e!==n&&(ft(fc,t),ft(Di,n))}function cx(t){fc.current===t&&(yt(Di),yt(fc))}var At=lo(0);function Ch(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 Xm=[];function dx(){for(var t=0;t<Xm.length;t++)Xm[t]._workInProgressVersionPrimary=null;Xm.length=0}var Rf=cs.ReactCurrentDispatcher,qm=cs.ReactCurrentBatchConfig,Yo=0,Tt=null,tn=null,ln=null,kh=!1,ju=!1,pc=0,tA=0;function Cn(){throw Error(ue(321))}function fx(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!ni(t[n],e[n]))return!1;return!0}function hx(t,e,n,r,i,s){if(Yo=s,Tt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Rf.current=t===null||t.memoizedState===null?sA:oA,t=n(r,i),ju){s=0;do{if(ju=!1,pc=0,25<=s)throw Error(ue(301));s+=1,ln=tn=null,e.updateQueue=null,Rf.current=lA,t=n(r,i)}while(ju)}if(Rf.current=Sh,e=tn!==null&&tn.next!==null,Yo=0,ln=tn=Tt=null,kh=!1,e)throw Error(ue(300));return t}function px(){var t=pc!==0;return pc=0,t}function gi(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ln===null?Tt.memoizedState=ln=t:ln=ln.next=t,ln}function Or(){if(tn===null){var t=Tt.alternate;t=t!==null?t.memoizedState:null}else t=tn.next;var e=ln===null?Tt.memoizedState:ln.next;if(e!==null)ln=e,tn=t;else{if(t===null)throw Error(ue(310));tn=t,t={memoizedState:tn.memoizedState,baseState:tn.baseState,baseQueue:tn.baseQueue,queue:tn.queue,next:null},ln===null?Tt.memoizedState=ln=t:ln=ln.next=t}return ln}function mc(t,e){return typeof e=="function"?e(t):e}function Qm(t){var e=Or(),n=e.queue;if(n===null)throw Error(ue(311));n.lastRenderedReducer=t;var r=tn,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 l=o=null,a=null,u=s;do{var c=u.lane;if((Yo&c)===c)a!==null&&(a=a.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:t(r,u.action);else{var d={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};a===null?(l=a=d,o=r):a=a.next=d,Tt.lanes|=c,Xo|=c}u=u.next}while(u!==null&&u!==s);a===null?o=r:a.next=l,ni(r,e.memoizedState)||(Zn=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=a,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do s=i.lane,Tt.lanes|=s,Xo|=s,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Zm(t){var e=Or(),n=e.queue;if(n===null)throw Error(ue(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);ni(s,e.memoizedState)||(Zn=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function E6(){}function $6(t,e){var n=Tt,r=Or(),i=e(),s=!ni(r.memoizedState,i);if(s&&(r.memoizedState=i,Zn=!0),r=r.queue,mx(N6.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||ln!==null&&ln.memoizedState.tag&1){if(n.flags|=2048,gc(9,D6.bind(null,n,r,i,e),void 0,null),cn===null)throw Error(ue(349));Yo&30||M6(n,e,i)}return i}function M6(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Tt.updateQueue,e===null?(e={lastEffect:null,stores:null},Tt.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function D6(t,e,n,r){e.value=n,e.getSnapshot=r,A6(e)&&T6(t)}function N6(t,e,n){return n(function(){A6(e)&&T6(t)})}function A6(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!ni(t,n)}catch{return!0}}function T6(t){var e=ns(t,1);e!==null&&ei(e,t,1,-1)}function Fb(t){var e=gi();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:mc,lastRenderedState:t},e.queue=t,t=t.dispatch=iA.bind(null,Tt,t),[e.memoizedState,t]}function gc(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Tt.updateQueue,e===null?(e={lastEffect:null,stores:null},Tt.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 P6(){return Or().memoizedState}function Bf(t,e,n,r){var i=gi();Tt.flags|=t,i.memoizedState=gc(1|e,n,void 0,r===void 0?null:r)}function Tp(t,e,n,r){var i=Or();r=r===void 0?null:r;var s=void 0;if(tn!==null){var o=tn.memoizedState;if(s=o.destroy,r!==null&&fx(r,o.deps)){i.memoizedState=gc(e,n,s,r);return}}Tt.flags|=t,i.memoizedState=gc(1|e,n,s,r)}function _b(t,e){return Bf(8390656,8,t,e)}function mx(t,e){return Tp(2048,8,t,e)}function L6(t,e){return Tp(4,2,t,e)}function I6(t,e){return Tp(4,4,t,e)}function R6(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 B6(t,e,n){return n=n!=null?n.concat([t]):null,Tp(4,4,R6.bind(null,e,t),n)}function gx(){}function O6(t,e){var n=Or();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&fx(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function j6(t,e){var n=Or();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&fx(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function V6(t,e,n){return Yo&21?(ni(n,e)||(n=WC(),Tt.lanes|=n,Xo|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Zn=!0),t.memoizedState=n)}function nA(t,e){var n=nt;nt=n!==0&&4>n?n:4,t(!0);var r=qm.transition;qm.transition={};try{t(!1),e()}finally{nt=n,qm.transition=r}}function F6(){return Or().memoizedState}function rA(t,e,n){var r=Fs(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},_6(t))H6(e,n);else if(n=C6(t,e,n,r),n!==null){var i=jn();ei(n,t,r,i),z6(n,e,r)}}function iA(t,e,n){var r=Fs(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(_6(t))H6(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,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,ni(l,o)){var a=e.interleaved;a===null?(i.next=i,lx(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=C6(t,e,i,r),n!==null&&(i=jn(),ei(n,t,r,i),z6(n,e,r))}}function _6(t){var e=t.alternate;return t===Tt||e!==null&&e===Tt}function H6(t,e){ju=kh=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function z6(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Ky(t,n)}}var Sh={readContext:Br,useCallback:Cn,useContext:Cn,useEffect:Cn,useImperativeHandle:Cn,useInsertionEffect:Cn,useLayoutEffect:Cn,useMemo:Cn,useReducer:Cn,useRef:Cn,useState:Cn,useDebugValue:Cn,useDeferredValue:Cn,useTransition:Cn,useMutableSource:Cn,useSyncExternalStore:Cn,useId:Cn,unstable_isNewReconciler:!1},sA={readContext:Br,useCallback:function(t,e){return gi().memoizedState=[t,e===void 0?null:e],t},useContext:Br,useEffect:_b,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Bf(4194308,4,R6.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Bf(4194308,4,t,e)},useInsertionEffect:function(t,e){return Bf(4,2,t,e)},useMemo:function(t,e){var n=gi();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=gi();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=rA.bind(null,Tt,t),[r.memoizedState,t]},useRef:function(t){var e=gi();return t={current:t},e.memoizedState=t},useState:Fb,useDebugValue:gx,useDeferredValue:function(t){return gi().memoizedState=t},useTransition:function(){var t=Fb(!1),e=t[0];return t=nA.bind(null,t[1]),gi().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Tt,i=gi();if(wt){if(n===void 0)throw Error(ue(407));n=n()}else{if(n=e(),cn===null)throw Error(ue(349));Yo&30||M6(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,_b(N6.bind(null,r,s,t),[t]),r.flags|=2048,gc(9,D6.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=gi(),e=cn.identifierPrefix;if(wt){var n=Yi,r=Ki;n=(r&~(1<<32-Jr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=pc++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=tA++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},oA={readContext:Br,useCallback:O6,useContext:Br,useEffect:mx,useImperativeHandle:B6,useInsertionEffect:L6,useLayoutEffect:I6,useMemo:j6,useReducer:Qm,useRef:P6,useState:function(){return Qm(mc)},useDebugValue:gx,useDeferredValue:function(t){var e=Or();return V6(e,tn.memoizedState,t)},useTransition:function(){var t=Qm(mc)[0],e=Or().memoizedState;return[t,e]},useMutableSource:E6,useSyncExternalStore:$6,useId:F6,unstable_isNewReconciler:!1},lA={readContext:Br,useCallback:O6,useContext:Br,useEffect:mx,useImperativeHandle:B6,useInsertionEffect:L6,useLayoutEffect:I6,useMemo:j6,useReducer:Zm,useRef:P6,useState:function(){return Zm(mc)},useDebugValue:gx,useDeferredValue:function(t){var e=Or();return tn===null?e.memoizedState=t:V6(e,tn.memoizedState,t)},useTransition:function(){var t=Zm(mc)[0],e=Or().memoizedState;return[t,e]},useMutableSource:E6,useSyncExternalStore:$6,useId:F6,unstable_isNewReconciler:!1};function _r(t,e){if(t&&t.defaultProps){e=Pt({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function G0(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Pt({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Pp={isMounted:function(t){return(t=t._reactInternals)?cl(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=jn(),i=Fs(t),s=qi(r,i);s.payload=e,n!=null&&(s.callback=n),e=js(t,s,i),e!==null&&(ei(e,t,i,r),If(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=jn(),i=Fs(t),s=qi(r,i);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=js(t,s,i),e!==null&&(ei(e,t,i,r),If(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=jn(),r=Fs(t),i=qi(n,r);i.tag=2,e!=null&&(i.callback=e),e=js(t,i,r),e!==null&&(ei(e,t,r,n),If(e,t,r))}};function Hb(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?!ac(n,r)||!ac(i,s):!0}function W6(t,e,n){var r=!1,i=qs,s=e.contextType;return typeof s=="object"&&s!==null?s=Br(s):(i=rr(e)?Uo:Mn.current,r=e.contextTypes,s=(r=r!=null)?xa(t,i):qs),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Pp,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function zb(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&&Pp.enqueueReplaceState(e,e.state,null)}function U0(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},ax(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=Br(s):(s=rr(e)?Uo:Mn.current,i.context=xa(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(G0(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&&Pp.enqueueReplaceState(i,i.state,null),wh(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function Ca(t,e){try{var n="",r=e;do n+=RD(r),r=r.return;while(r);var i=n}catch(s){i=`
|
|
46
|
+
Error generating stack: `+s.message+`
|
|
47
|
+
`+s.stack}return{value:t,source:e,stack:i,digest:null}}function Jm(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function K0(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var aA=typeof WeakMap=="function"?WeakMap:Map;function G6(t,e,n){n=qi(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){$h||($h=!0,r1=r),K0(t,e)},n}function U6(t,e,n){n=qi(-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(){K0(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){K0(t,e),typeof r!="function"&&(Vs===null?Vs=new Set([this]):Vs.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function Wb(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new aA;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=CA.bind(null,t,e,n),e.then(t,t))}function Gb(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 Ub(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=qi(-1,1),e.tag=2,js(n,e,1))),n.lanes|=1),t)}var uA=cs.ReactCurrentOwner,Zn=!1;function Ln(t,e,n,r){e.child=t===null?w6(e,null,n,r):ba(e,t.child,n,r)}function Kb(t,e,n,r,i){n=n.render;var s=e.ref;return na(e,i),r=hx(t,e,n,r,s,i),n=px(),t!==null&&!Zn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,rs(t,e,i)):(wt&&n&&tx(e),e.flags|=1,Ln(t,e,r,i),e.child)}function Yb(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!Sx(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,K6(t,e,s,r,i)):(t=Ff(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:ac,n(o,r)&&t.ref===e.ref)return rs(t,e,i)}return e.flags|=1,t=_s(s,r),t.ref=e.ref,t.return=e,e.child=t}function K6(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(ac(s,r)&&t.ref===e.ref)if(Zn=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(Zn=!0);else return e.lanes=t.lanes,rs(t,e,i)}return Y0(t,e,n,r,i)}function Y6(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},ft(zl,hr),hr|=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,ft(zl,hr),hr|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,ft(zl,hr),hr|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,ft(zl,hr),hr|=r;return Ln(t,e,i,n),e.child}function X6(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Y0(t,e,n,r,i){var s=rr(n)?Uo:Mn.current;return s=xa(e,s),na(e,i),n=hx(t,e,n,r,s,i),r=px(),t!==null&&!Zn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,rs(t,e,i)):(wt&&r&&tx(e),e.flags|=1,Ln(t,e,n,i),e.child)}function Xb(t,e,n,r,i){if(rr(n)){var s=!0;gh(e)}else s=!1;if(na(e,i),e.stateNode===null)Of(t,e),W6(e,n,r),U0(e,n,r,i),r=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var a=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Br(u):(u=rr(n)?Uo:Mn.current,u=xa(e,u));var c=n.getDerivedStateFromProps,d=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||a!==u)&&zb(e,o,r,u),bs=!1;var f=e.memoizedState;o.state=f,wh(e,r,o,i),a=e.memoizedState,l!==r||f!==a||nr.current||bs?(typeof c=="function"&&(G0(e,n,c,r),a=e.memoizedState),(l=bs||Hb(e,n,l,r,f,a,u))?(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=a),o.props=r,o.state=a,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,k6(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:_r(e.type,l),o.props=u,d=e.pendingProps,f=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=Br(a):(a=rr(n)?Uo:Mn.current,a=xa(e,a));var h=n.getDerivedStateFromProps;(c=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||f!==a)&&zb(e,o,r,a),bs=!1,f=e.memoizedState,o.state=f,wh(e,r,o,i);var m=e.memoizedState;l!==d||f!==m||nr.current||bs?(typeof h=="function"&&(G0(e,n,h,r),m=e.memoizedState),(u=bs||Hb(e,n,u,r,f,m,a)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,a)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=m),o.props=r,o.state=m,o.context=a,r=u):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return X0(t,e,n,r,s,i)}function X0(t,e,n,r,i,s){X6(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&Ib(e,n,!1),rs(t,e,s);r=e.stateNode,uA.current=e;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=ba(e,t.child,null,s),e.child=ba(e,null,l,s)):Ln(t,e,l,s),e.memoizedState=r.state,i&&Ib(e,n,!0),e.child}function q6(t){var e=t.stateNode;e.pendingContext?Lb(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Lb(t,e.context,!1),ux(t,e.containerInfo)}function qb(t,e,n,r,i){return va(),rx(i),e.flags|=256,Ln(t,e,n,r),e.child}var q0={dehydrated:null,treeContext:null,retryLane:0};function Q0(t){return{baseLanes:t,cachePool:null,transitions:null}}function Q6(t,e,n){var r=e.pendingProps,i=At.current,s=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(i&2)!==0),l?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),ft(At,i&1),t===null)return z0(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=Rp(o,r,0,null),t=Fo(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Q0(n),e.memoizedState=q0,t):yx(e,o));if(i=t.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return cA(t,e,o,r,l,i,n);if(s){s=r.fallback,o=e.mode,i=t.child,l=i.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=a,e.deletions=null):(r=_s(i,a),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=_s(l,s):(s=Fo(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?Q0(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~n,e.memoizedState=q0,r}return s=t.child,t=s.sibling,r=_s(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 yx(t,e){return e=Rp({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Rd(t,e,n,r){return r!==null&&rx(r),ba(e,t.child,null,n),t=yx(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function cA(t,e,n,r,i,s,o){if(n)return e.flags&256?(e.flags&=-257,r=Jm(Error(ue(422))),Rd(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=Rp({mode:"visible",children:r.children},i,0,null),s=Fo(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&ba(e,t.child,null,o),e.child.memoizedState=Q0(o),e.memoizedState=q0,s);if(!(e.mode&1))return Rd(t,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(ue(419)),r=Jm(s,r,void 0),Rd(t,e,o,r)}if(l=(o&t.childLanes)!==0,Zn||l){if(r=cn,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,ns(t,i),ei(r,t,i,-1))}return kx(),r=Jm(Error(ue(421))),Rd(t,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=kA.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,yr=Os(i.nextSibling),vr=e,wt=!0,Gr=null,t!==null&&($r[Mr++]=Ki,$r[Mr++]=Yi,$r[Mr++]=Ko,Ki=t.id,Yi=t.overflow,Ko=e),e=yx(e,r.children),e.flags|=4096,e)}function Qb(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),W0(t.return,e,n)}function eg(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 Z6(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(Ln(t,e,r.children,n),r=At.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&&Qb(t,n,e);else if(t.tag===19)Qb(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(ft(At,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&&Ch(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),eg(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&&Ch(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}eg(e,!0,n,null,s);break;case"together":eg(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Of(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function rs(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Xo|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(ue(153));if(e.child!==null){for(t=e.child,n=_s(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=_s(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function dA(t,e,n){switch(e.tag){case 3:q6(e),va();break;case 5:S6(e);break;case 1:rr(e.type)&&gh(e);break;case 4:ux(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;ft(vh,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(ft(At,At.current&1),e.flags|=128,null):n&e.child.childLanes?Q6(t,e,n):(ft(At,At.current&1),t=rs(t,e,n),t!==null?t.sibling:null);ft(At,At.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Z6(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ft(At,At.current),r)break;return null;case 22:case 23:return e.lanes=0,Y6(t,e,n)}return rs(t,e,n)}var J6,Z0,e5,t5;J6=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}};Z0=function(){};e5=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Po(Di.current);var s=null;switch(n){case"input":i=b0(t,i),r=b0(t,r),s=[];break;case"select":i=Pt({},i,{value:void 0}),r=Pt({},r,{value:void 0}),s=[];break;case"textarea":i=k0(t,i),r=k0(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=ph)}E0(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(tc.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var a=r[u];if(l=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(s||(s=[]),s.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(s=s||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(tc.hasOwnProperty(u)?(a!=null&&u==="onScroll"&>("scroll",t),s||l===a||(s=[])):(s=s||[]).push(u,a))}n&&(s=s||[]).push("style",n);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};t5=function(t,e,n,r){n!==r&&(e.flags|=4)};function uu(t,e){if(!wt)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 kn(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 fA(t,e,n){var r=e.pendingProps;switch(nx(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kn(e),null;case 1:return rr(e.type)&&mh(),kn(e),null;case 3:return r=e.stateNode,wa(),yt(nr),yt(Mn),dx(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Ld(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Gr!==null&&(o1(Gr),Gr=null))),Z0(t,e),kn(e),null;case 5:cx(e);var i=Po(hc.current);if(n=e.type,t!==null&&e.stateNode!=null)e5(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(ue(166));return kn(e),null}if(t=Po(Di.current),Ld(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[bi]=e,r[dc]=s,t=(e.mode&1)!==0,n){case"dialog":gt("cancel",r),gt("close",r);break;case"iframe":case"object":case"embed":gt("load",r);break;case"video":case"audio":for(i=0;i<Su.length;i++)gt(Su[i],r);break;case"source":gt("error",r);break;case"img":case"image":case"link":gt("error",r),gt("load",r);break;case"details":gt("toggle",r);break;case"input":ob(r,s),gt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},gt("invalid",r);break;case"textarea":ab(r,s),gt("invalid",r)}E0(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?r.textContent!==l&&(s.suppressHydrationWarning!==!0&&Pd(r.textContent,l,t),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Pd(r.textContent,l,t),i=["children",""+l]):tc.hasOwnProperty(o)&&l!=null&&o==="onScroll"&>("scroll",r)}switch(n){case"input":Sd(r),lb(r,s,!0);break;case"textarea":Sd(r),ub(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=ph)}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=NC(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[bi]=e,t[dc]=r,J6(t,e,!1,!1),e.stateNode=t;e:{switch(o=$0(n,r),n){case"dialog":gt("cancel",t),gt("close",t),i=r;break;case"iframe":case"object":case"embed":gt("load",t),i=r;break;case"video":case"audio":for(i=0;i<Su.length;i++)gt(Su[i],t);i=r;break;case"source":gt("error",t),i=r;break;case"img":case"image":case"link":gt("error",t),gt("load",t),i=r;break;case"details":gt("toggle",t),i=r;break;case"input":ob(t,r),i=b0(t,r),gt("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=Pt({},r,{value:void 0}),gt("invalid",t);break;case"textarea":ab(t,r),i=k0(t,r),gt("invalid",t);break;default:i=r}E0(n,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?PC(t,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&AC(t,a)):s==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&nc(t,a):typeof a=="number"&&nc(t,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(tc.hasOwnProperty(s)?a!=null&&s==="onScroll"&>("scroll",t):a!=null&&_y(t,s,a,o))}switch(n){case"input":Sd(t),lb(t,r,!1);break;case"textarea":Sd(t),ub(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Xs(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?Zl(t,!!r.multiple,s,!1):r.defaultValue!=null&&Zl(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=ph)}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 kn(e),null;case 6:if(t&&e.stateNode!=null)t5(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(ue(166));if(n=Po(hc.current),Po(Di.current),Ld(e)){if(r=e.stateNode,n=e.memoizedProps,r[bi]=e,(s=r.nodeValue!==n)&&(t=vr,t!==null))switch(t.tag){case 3:Pd(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Pd(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[bi]=e,e.stateNode=r}return kn(e),null;case 13:if(yt(At),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(wt&&yr!==null&&e.mode&1&&!(e.flags&128))v6(),va(),e.flags|=98560,s=!1;else if(s=Ld(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(ue(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ue(317));s[bi]=e}else va(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;kn(e),s=!1}else Gr!==null&&(o1(Gr),Gr=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||At.current&1?rn===0&&(rn=3):kx())),e.updateQueue!==null&&(e.flags|=4),kn(e),null);case 4:return wa(),Z0(t,e),t===null&&uc(e.stateNode.containerInfo),kn(e),null;case 10:return ox(e.type._context),kn(e),null;case 17:return rr(e.type)&&mh(),kn(e),null;case 19:if(yt(At),s=e.memoizedState,s===null)return kn(e),null;if(r=(e.flags&128)!==0,o=s.rendering,o===null)if(r)uu(s,!1);else{if(rn!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=Ch(t),o!==null){for(e.flags|=128,uu(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 ft(At,At.current&1|2),e.child}t=t.sibling}s.tail!==null&&Gt()>ka&&(e.flags|=128,r=!0,uu(s,!1),e.lanes=4194304)}else{if(!r)if(t=Ch(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),uu(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!wt)return kn(e),null}else 2*Gt()-s.renderingStartTime>ka&&n!==1073741824&&(e.flags|=128,r=!0,uu(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=Gt(),e.sibling=null,n=At.current,ft(At,r?n&1|2:n&1),e):(kn(e),null);case 22:case 23:return Cx(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?hr&1073741824&&(kn(e),e.subtreeFlags&6&&(e.flags|=8192)):kn(e),null;case 24:return null;case 25:return null}throw Error(ue(156,e.tag))}function hA(t,e){switch(nx(e),e.tag){case 1:return rr(e.type)&&mh(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return wa(),yt(nr),yt(Mn),dx(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return cx(e),null;case 13:if(yt(At),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ue(340));va()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return yt(At),null;case 4:return wa(),null;case 10:return ox(e.type._context),null;case 22:case 23:return Cx(),null;case 24:return null;default:return null}}var Bd=!1,$n=!1,pA=typeof WeakSet=="function"?WeakSet:Set,ke=null;function Hl(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Rt(t,e,r)}else n.current=null}function J0(t,e,n){try{n()}catch(r){Rt(t,e,r)}}var Zb=!1;function mA(t,e){if(B0=dh,t=o6(),ex(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,l=-1,a=-1,u=0,c=0,d=t,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(l=o+i),d!==s||r!==0&&d.nodeType!==3||(a=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&&++u===i&&(l=o),f===s&&++c===r&&(a=o),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(O0={focusedElem:t,selectionRange:n},dh=!1,ke=e;ke!==null;)if(e=ke,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ke=t;else for(;ke!==null;){e=ke;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var x=m.memoizedProps,v=m.memoizedState,p=e.stateNode,y=p.getSnapshotBeforeUpdate(e.elementType===e.type?x:_r(e.type,x),v);p.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ue(163))}}catch(C){Rt(e,e.return,C)}if(t=e.sibling,t!==null){t.return=e.return,ke=t;break}ke=e.return}return m=Zb,Zb=!1,m}function Vu(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&&J0(e,n,s)}i=i.next}while(i!==r)}}function Lp(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 e1(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 n5(t){var e=t.alternate;e!==null&&(t.alternate=null,n5(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[bi],delete e[dc],delete e[F0],delete e[QN],delete e[ZN])),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 r5(t){return t.tag===5||t.tag===3||t.tag===4}function Jb(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||r5(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 t1(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=ph));else if(r!==4&&(t=t.child,t!==null))for(t1(t,e,n),t=t.sibling;t!==null;)t1(t,e,n),t=t.sibling}function n1(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(n1(t,e,n),t=t.sibling;t!==null;)n1(t,e,n),t=t.sibling}var mn=null,Hr=!1;function ms(t,e,n){for(n=n.child;n!==null;)i5(t,e,n),n=n.sibling}function i5(t,e,n){if(Mi&&typeof Mi.onCommitFiberUnmount=="function")try{Mi.onCommitFiberUnmount(Ep,n)}catch{}switch(n.tag){case 5:$n||Hl(n,e);case 6:var r=mn,i=Hr;mn=null,ms(t,e,n),mn=r,Hr=i,mn!==null&&(Hr?(t=mn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):mn.removeChild(n.stateNode));break;case 18:mn!==null&&(Hr?(t=mn,n=n.stateNode,t.nodeType===8?Km(t.parentNode,n):t.nodeType===1&&Km(t,n),oc(t)):Km(mn,n.stateNode));break;case 4:r=mn,i=Hr,mn=n.stateNode.containerInfo,Hr=!0,ms(t,e,n),mn=r,Hr=i;break;case 0:case 11:case 14:case 15:if(!$n&&(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)&&J0(n,e,o),i=i.next}while(i!==r)}ms(t,e,n);break;case 1:if(!$n&&(Hl(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Rt(n,e,l)}ms(t,e,n);break;case 21:ms(t,e,n);break;case 22:n.mode&1?($n=(r=$n)||n.memoizedState!==null,ms(t,e,n),$n=r):ms(t,e,n);break;default:ms(t,e,n)}}function e4(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new pA),e.forEach(function(r){var i=SA.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Fr(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,l=o;e:for(;l!==null;){switch(l.tag){case 5:mn=l.stateNode,Hr=!1;break e;case 3:mn=l.stateNode.containerInfo,Hr=!0;break e;case 4:mn=l.stateNode.containerInfo,Hr=!0;break e}l=l.return}if(mn===null)throw Error(ue(160));i5(s,o,i),mn=null,Hr=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(u){Rt(i,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)s5(e,t),e=e.sibling}function s5(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Fr(e,t),di(t),r&4){try{Vu(3,t,t.return),Lp(3,t)}catch(x){Rt(t,t.return,x)}try{Vu(5,t,t.return)}catch(x){Rt(t,t.return,x)}}break;case 1:Fr(e,t),di(t),r&512&&n!==null&&Hl(n,n.return);break;case 5:if(Fr(e,t),di(t),r&512&&n!==null&&Hl(n,n.return),t.flags&32){var i=t.stateNode;try{nc(i,"")}catch(x){Rt(t,t.return,x)}}if(r&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,o=n!==null?n.memoizedProps:s,l=t.type,a=t.updateQueue;if(t.updateQueue=null,a!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&MC(i,s),$0(l,o);var u=$0(l,s);for(o=0;o<a.length;o+=2){var c=a[o],d=a[o+1];c==="style"?PC(i,d):c==="dangerouslySetInnerHTML"?AC(i,d):c==="children"?nc(i,d):_y(i,c,d,u)}switch(l){case"input":w0(i,s);break;case"textarea":DC(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?Zl(i,!!s.multiple,h,!1):f!==!!s.multiple&&(s.defaultValue!=null?Zl(i,!!s.multiple,s.defaultValue,!0):Zl(i,!!s.multiple,s.multiple?[]:"",!1))}i[dc]=s}catch(x){Rt(t,t.return,x)}}break;case 6:if(Fr(e,t),di(t),r&4){if(t.stateNode===null)throw Error(ue(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(x){Rt(t,t.return,x)}}break;case 3:if(Fr(e,t),di(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{oc(e.containerInfo)}catch(x){Rt(t,t.return,x)}break;case 4:Fr(e,t),di(t);break;case 13:Fr(e,t),di(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(bx=Gt())),r&4&&e4(t);break;case 22:if(c=n!==null&&n.memoizedState!==null,t.mode&1?($n=(u=$n)||c,Fr(e,t),$n=u):Fr(e,t),di(t),r&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!c&&t.mode&1)for(ke=t,c=t.child;c!==null;){for(d=ke=c;ke!==null;){switch(f=ke,h=f.child,f.tag){case 0:case 11:case 14:case 15:Vu(4,f,f.return);break;case 1:Hl(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(x){Rt(r,n,x)}}break;case 5:Hl(f,f.return);break;case 22:if(f.memoizedState!==null){n4(d);continue}}h!==null?(h.return=f,ke=h):n4(d)}c=c.sibling}e:for(c=null,d=t;;){if(d.tag===5){if(c===null){c=d;try{i=d.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=d.stateNode,a=d.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=TC("display",o))}catch(x){Rt(t,t.return,x)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(x){Rt(t,t.return,x)}}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;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Fr(e,t),di(t),r&4&&e4(t);break;case 21:break;default:Fr(e,t),di(t)}}function di(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(r5(n)){var r=n;break e}n=n.return}throw Error(ue(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(nc(i,""),r.flags&=-33);var s=Jb(t);n1(t,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,l=Jb(t);t1(t,l,o);break;default:throw Error(ue(161))}}catch(a){Rt(t,t.return,a)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function gA(t,e,n){ke=t,o5(t)}function o5(t,e,n){for(var r=(t.mode&1)!==0;ke!==null;){var i=ke,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Bd;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||$n;l=Bd;var u=$n;if(Bd=o,($n=a)&&!u)for(ke=i;ke!==null;)o=ke,a=o.child,o.tag===22&&o.memoizedState!==null?r4(i):a!==null?(a.return=o,ke=a):r4(i);for(;s!==null;)ke=s,o5(s),s=s.sibling;ke=i,Bd=l,$n=u}t4(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,ke=s):t4(t)}}function t4(t){for(;ke!==null;){var e=ke;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:$n||Lp(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!$n)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:_r(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&Vb(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}Vb(e,o,n)}break;case 5:var l=e.stateNode;if(n===null&&e.flags&4){n=l;var a=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break;case"img":a.src&&(n.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&oc(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ue(163))}$n||e.flags&512&&e1(e)}catch(f){Rt(e,e.return,f)}}if(e===t){ke=null;break}if(n=e.sibling,n!==null){n.return=e.return,ke=n;break}ke=e.return}}function n4(t){for(;ke!==null;){var e=ke;if(e===t){ke=null;break}var n=e.sibling;if(n!==null){n.return=e.return,ke=n;break}ke=e.return}}function r4(t){for(;ke!==null;){var e=ke;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Lp(4,e)}catch(a){Rt(e,n,a)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(a){Rt(e,i,a)}}var s=e.return;try{e1(e)}catch(a){Rt(e,s,a)}break;case 5:var o=e.return;try{e1(e)}catch(a){Rt(e,o,a)}}}catch(a){Rt(e,e.return,a)}if(e===t){ke=null;break}var l=e.sibling;if(l!==null){l.return=e.return,ke=l;break}ke=e.return}}var yA=Math.ceil,Eh=cs.ReactCurrentDispatcher,xx=cs.ReactCurrentOwner,Lr=cs.ReactCurrentBatchConfig,qe=0,cn=null,Qt=null,vn=0,hr=0,zl=lo(0),rn=0,yc=null,Xo=0,Ip=0,vx=0,Fu=null,Kn=null,bx=0,ka=1/0,Hi=null,$h=!1,r1=null,Vs=null,Od=!1,Ts=null,Mh=0,_u=0,i1=null,jf=-1,Vf=0;function jn(){return qe&6?Gt():jf!==-1?jf:jf=Gt()}function Fs(t){return t.mode&1?qe&2&&vn!==0?vn&-vn:eA.transition!==null?(Vf===0&&(Vf=WC()),Vf):(t=nt,t!==0||(t=window.event,t=t===void 0?16:QC(t.type)),t):1}function ei(t,e,n,r){if(50<_u)throw _u=0,i1=null,Error(ue(185));Qc(t,n,r),(!(qe&2)||t!==cn)&&(t===cn&&(!(qe&2)&&(Ip|=n),rn===4&&Es(t,vn)),ir(t,r),n===1&&qe===0&&!(e.mode&1)&&(ka=Gt()+500,Ap&&ao()))}function ir(t,e){var n=t.callbackNode;eN(t,e);var r=ch(t,t===cn?vn:0);if(r===0)n!==null&&fb(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&fb(n),e===1)t.tag===0?JN(i4.bind(null,t)):g6(i4.bind(null,t)),XN(function(){!(qe&6)&&ao()}),n=null;else{switch(GC(r)){case 1:n=Uy;break;case 4:n=HC;break;case 16:n=uh;break;case 536870912:n=zC;break;default:n=uh}n=p5(n,l5.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function l5(t,e){if(jf=-1,Vf=0,qe&6)throw Error(ue(327));var n=t.callbackNode;if(ra()&&t.callbackNode!==n)return null;var r=ch(t,t===cn?vn:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Dh(t,r);else{e=r;var i=qe;qe|=2;var s=u5();(cn!==t||vn!==e)&&(Hi=null,ka=Gt()+500,Vo(t,e));do try{bA();break}catch(l){a5(t,l)}while(!0);sx(),Eh.current=s,qe=i,Qt!==null?e=0:(cn=null,vn=0,e=rn)}if(e!==0){if(e===2&&(i=T0(t),i!==0&&(r=i,e=s1(t,i))),e===1)throw n=yc,Vo(t,0),Es(t,r),ir(t,Gt()),n;if(e===6)Es(t,r);else{if(i=t.current.alternate,!(r&30)&&!xA(i)&&(e=Dh(t,r),e===2&&(s=T0(t),s!==0&&(r=s,e=s1(t,s))),e===1))throw n=yc,Vo(t,0),Es(t,r),ir(t,Gt()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(ue(345));case 2:Co(t,Kn,Hi);break;case 3:if(Es(t,r),(r&130023424)===r&&(e=bx+500-Gt(),10<e)){if(ch(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){jn(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=V0(Co.bind(null,t,Kn,Hi),e);break}Co(t,Kn,Hi);break;case 4:if(Es(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var o=31-Jr(r);s=1<<o,o=e[o],o>i&&(i=o),r&=~s}if(r=i,r=Gt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*yA(r/1960))-r,10<r){t.timeoutHandle=V0(Co.bind(null,t,Kn,Hi),r);break}Co(t,Kn,Hi);break;case 5:Co(t,Kn,Hi);break;default:throw Error(ue(329))}}}return ir(t,Gt()),t.callbackNode===n?l5.bind(null,t):null}function s1(t,e){var n=Fu;return t.current.memoizedState.isDehydrated&&(Vo(t,e).flags|=256),t=Dh(t,e),t!==2&&(e=Kn,Kn=n,e!==null&&o1(e)),t}function o1(t){Kn===null?Kn=t:Kn.push.apply(Kn,t)}function xA(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(!ni(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 Es(t,e){for(e&=~vx,e&=~Ip,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Jr(e),r=1<<n;t[n]=-1,e&=~r}}function i4(t){if(qe&6)throw Error(ue(327));ra();var e=ch(t,0);if(!(e&1))return ir(t,Gt()),null;var n=Dh(t,e);if(t.tag!==0&&n===2){var r=T0(t);r!==0&&(e=r,n=s1(t,r))}if(n===1)throw n=yc,Vo(t,0),Es(t,e),ir(t,Gt()),n;if(n===6)throw Error(ue(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Co(t,Kn,Hi),ir(t,Gt()),null}function wx(t,e){var n=qe;qe|=1;try{return t(e)}finally{qe=n,qe===0&&(ka=Gt()+500,Ap&&ao())}}function qo(t){Ts!==null&&Ts.tag===0&&!(qe&6)&&ra();var e=qe;qe|=1;var n=Lr.transition,r=nt;try{if(Lr.transition=null,nt=1,t)return t()}finally{nt=r,Lr.transition=n,qe=e,!(qe&6)&&ao()}}function Cx(){hr=zl.current,yt(zl)}function Vo(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,YN(n)),Qt!==null)for(n=Qt.return;n!==null;){var r=n;switch(nx(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&mh();break;case 3:wa(),yt(nr),yt(Mn),dx();break;case 5:cx(r);break;case 4:wa();break;case 13:yt(At);break;case 19:yt(At);break;case 10:ox(r.type._context);break;case 22:case 23:Cx()}n=n.return}if(cn=t,Qt=t=_s(t.current,null),vn=hr=e,rn=0,yc=null,vx=Ip=Xo=0,Kn=Fu=null,To!==null){for(e=0;e<To.length;e++)if(n=To[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}To=null}return t}function a5(t,e){do{var n=Qt;try{if(sx(),Rf.current=Sh,kh){for(var r=Tt.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}kh=!1}if(Yo=0,ln=tn=Tt=null,ju=!1,pc=0,xx.current=null,n===null||n.return===null){rn=1,yc=e,Qt=null;break}e:{var s=t,o=n.return,l=n,a=e;if(e=vn,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var u=a,c=l,d=c.tag;if(!(c.mode&1)&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var h=Gb(o);if(h!==null){h.flags&=-257,Ub(h,o,l,s,e),h.mode&1&&Wb(s,u,e),e=h,a=u;var m=e.updateQueue;if(m===null){var x=new Set;x.add(a),e.updateQueue=x}else m.add(a);break e}else{if(!(e&1)){Wb(s,u,e),kx();break e}a=Error(ue(426))}}else if(wt&&l.mode&1){var v=Gb(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),Ub(v,o,l,s,e),rx(Ca(a,l));break e}}s=a=Ca(a,l),rn!==4&&(rn=2),Fu===null?Fu=[s]:Fu.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var p=G6(s,a,e);jb(s,p);break e;case 1:l=a;var y=s.type,b=s.stateNode;if(!(s.flags&128)&&(typeof y.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Vs===null||!Vs.has(b)))){s.flags|=65536,e&=-e,s.lanes|=e;var C=U6(s,l,e);jb(s,C);break e}}s=s.return}while(s!==null)}d5(n)}catch(S){e=S,Qt===n&&n!==null&&(Qt=n=n.return);continue}break}while(!0)}function u5(){var t=Eh.current;return Eh.current=Sh,t===null?Sh:t}function kx(){(rn===0||rn===3||rn===2)&&(rn=4),cn===null||!(Xo&268435455)&&!(Ip&268435455)||Es(cn,vn)}function Dh(t,e){var n=qe;qe|=2;var r=u5();(cn!==t||vn!==e)&&(Hi=null,Vo(t,e));do try{vA();break}catch(i){a5(t,i)}while(!0);if(sx(),qe=n,Eh.current=r,Qt!==null)throw Error(ue(261));return cn=null,vn=0,rn}function vA(){for(;Qt!==null;)c5(Qt)}function bA(){for(;Qt!==null&&!GD();)c5(Qt)}function c5(t){var e=h5(t.alternate,t,hr);t.memoizedProps=t.pendingProps,e===null?d5(t):Qt=e,xx.current=null}function d5(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=hA(n,e),n!==null){n.flags&=32767,Qt=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{rn=6,Qt=null;return}}else if(n=fA(n,e,hr),n!==null){Qt=n;return}if(e=e.sibling,e!==null){Qt=e;return}Qt=e=t}while(e!==null);rn===0&&(rn=5)}function Co(t,e,n){var r=nt,i=Lr.transition;try{Lr.transition=null,nt=1,wA(t,e,n,r)}finally{Lr.transition=i,nt=r}return null}function wA(t,e,n,r){do ra();while(Ts!==null);if(qe&6)throw Error(ue(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(ue(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(tN(t,s),t===cn&&(Qt=cn=null,vn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Od||(Od=!0,p5(uh,function(){return ra(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Lr.transition,Lr.transition=null;var o=nt;nt=1;var l=qe;qe|=4,xx.current=null,mA(t,n),s5(n,t),_N(O0),dh=!!B0,O0=B0=null,t.current=n,gA(n),UD(),qe=l,nt=o,Lr.transition=s}else t.current=n;if(Od&&(Od=!1,Ts=t,Mh=i),s=t.pendingLanes,s===0&&(Vs=null),XD(n.stateNode),ir(t,Gt()),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($h)throw $h=!1,t=r1,r1=null,t;return Mh&1&&t.tag!==0&&ra(),s=t.pendingLanes,s&1?t===i1?_u++:(_u=0,i1=t):_u=0,ao(),null}function ra(){if(Ts!==null){var t=GC(Mh),e=Lr.transition,n=nt;try{if(Lr.transition=null,nt=16>t?16:t,Ts===null)var r=!1;else{if(t=Ts,Ts=null,Mh=0,qe&6)throw Error(ue(331));var i=qe;for(qe|=4,ke=t.current;ke!==null;){var s=ke,o=s.child;if(ke.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var u=l[a];for(ke=u;ke!==null;){var c=ke;switch(c.tag){case 0:case 11:case 15:Vu(8,c,s)}var d=c.child;if(d!==null)d.return=c,ke=d;else for(;ke!==null;){c=ke;var f=c.sibling,h=c.return;if(n5(c),c===u){ke=null;break}if(f!==null){f.return=h,ke=f;break}ke=h}}}var m=s.alternate;if(m!==null){var x=m.child;if(x!==null){m.child=null;do{var v=x.sibling;x.sibling=null,x=v}while(x!==null)}}ke=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,ke=o;else e:for(;ke!==null;){if(s=ke,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Vu(9,s,s.return)}var p=s.sibling;if(p!==null){p.return=s.return,ke=p;break e}ke=s.return}}var y=t.current;for(ke=y;ke!==null;){o=ke;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,ke=b;else e:for(o=y;ke!==null;){if(l=ke,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Lp(9,l)}}catch(S){Rt(l,l.return,S)}if(l===o){ke=null;break e}var C=l.sibling;if(C!==null){C.return=l.return,ke=C;break e}ke=l.return}}if(qe=i,ao(),Mi&&typeof Mi.onPostCommitFiberRoot=="function")try{Mi.onPostCommitFiberRoot(Ep,t)}catch{}r=!0}return r}finally{nt=n,Lr.transition=e}}return!1}function s4(t,e,n){e=Ca(n,e),e=G6(t,e,1),t=js(t,e,1),e=jn(),t!==null&&(Qc(t,1,e),ir(t,e))}function Rt(t,e,n){if(t.tag===3)s4(t,t,n);else for(;e!==null;){if(e.tag===3){s4(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Vs===null||!Vs.has(r))){t=Ca(n,t),t=U6(e,t,1),e=js(e,t,1),t=jn(),e!==null&&(Qc(e,1,t),ir(e,t));break}}e=e.return}}function CA(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=jn(),t.pingedLanes|=t.suspendedLanes&n,cn===t&&(vn&n)===n&&(rn===4||rn===3&&(vn&130023424)===vn&&500>Gt()-bx?Vo(t,0):vx|=n),ir(t,e)}function f5(t,e){e===0&&(t.mode&1?(e=Md,Md<<=1,!(Md&130023424)&&(Md=4194304)):e=1);var n=jn();t=ns(t,e),t!==null&&(Qc(t,e,n),ir(t,n))}function kA(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),f5(t,n)}function SA(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(ue(314))}r!==null&&r.delete(e),f5(t,n)}var h5;h5=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||nr.current)Zn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Zn=!1,dA(t,e,n);Zn=!!(t.flags&131072)}else Zn=!1,wt&&e.flags&1048576&&y6(e,xh,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Of(t,e),t=e.pendingProps;var i=xa(e,Mn.current);na(e,n),i=hx(null,e,r,t,i,n);var s=px();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,rr(r)?(s=!0,gh(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,ax(e),i.updater=Pp,e.stateNode=i,i._reactInternals=e,U0(e,r,t,n),e=X0(null,e,r,!0,s,n)):(e.tag=0,wt&&s&&tx(e),Ln(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Of(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=$A(r),t=_r(r,t),i){case 0:e=Y0(null,e,r,t,n);break e;case 1:e=Xb(null,e,r,t,n);break e;case 11:e=Kb(null,e,r,t,n);break e;case 14:e=Yb(null,e,r,_r(r.type,t),n);break e}throw Error(ue(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:_r(r,i),Y0(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:_r(r,i),Xb(t,e,r,i,n);case 3:e:{if(q6(e),t===null)throw Error(ue(387));r=e.pendingProps,s=e.memoizedState,i=s.element,k6(t,e),wh(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=Ca(Error(ue(423)),e),e=qb(t,e,r,n,i);break e}else if(r!==i){i=Ca(Error(ue(424)),e),e=qb(t,e,r,n,i);break e}else for(yr=Os(e.stateNode.containerInfo.firstChild),vr=e,wt=!0,Gr=null,n=w6(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(va(),r===i){e=rs(t,e,n);break e}Ln(t,e,r,n)}e=e.child}return e;case 5:return S6(e),t===null&&z0(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,j0(r,i)?o=null:s!==null&&j0(r,s)&&(e.flags|=32),X6(t,e),Ln(t,e,o,n),e.child;case 6:return t===null&&z0(e),null;case 13:return Q6(t,e,n);case 4:return ux(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ba(e,null,r,n):Ln(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:_r(r,i),Kb(t,e,r,i,n);case 7:return Ln(t,e,e.pendingProps,n),e.child;case 8:return Ln(t,e,e.pendingProps.children,n),e.child;case 12:return Ln(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,ft(vh,r._currentValue),r._currentValue=o,s!==null)if(ni(s.value,o)){if(s.children===i.children&&!nr.current){e=rs(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=qi(-1,n&-n),a.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),W0(s.return,n,e),l.lanes|=n;break}a=a.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(ue(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),W0(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}Ln(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,na(e,n),i=Br(i),r=r(i),e.flags|=1,Ln(t,e,r,n),e.child;case 14:return r=e.type,i=_r(r,e.pendingProps),i=_r(r.type,i),Yb(t,e,r,i,n);case 15:return K6(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:_r(r,i),Of(t,e),e.tag=1,rr(r)?(t=!0,gh(e)):t=!1,na(e,n),W6(e,r,i),U0(e,r,i,n),X0(null,e,r,!0,t,n);case 19:return Z6(t,e,n);case 22:return Y6(t,e,n)}throw Error(ue(156,e.tag))};function p5(t,e){return _C(t,e)}function EA(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 Nr(t,e,n,r){return new EA(t,e,n,r)}function Sx(t){return t=t.prototype,!(!t||!t.isReactComponent)}function $A(t){if(typeof t=="function")return Sx(t)?1:0;if(t!=null){if(t=t.$$typeof,t===zy)return 11;if(t===Wy)return 14}return 2}function _s(t,e){var n=t.alternate;return n===null?(n=Nr(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 Ff(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")Sx(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Ll:return Fo(n.children,i,s,e);case Hy:o=8,i|=8;break;case g0:return t=Nr(12,n,e,i|2),t.elementType=g0,t.lanes=s,t;case y0:return t=Nr(13,n,e,i),t.elementType=y0,t.lanes=s,t;case x0:return t=Nr(19,n,e,i),t.elementType=x0,t.lanes=s,t;case SC:return Rp(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case CC:o=10;break e;case kC:o=9;break e;case zy:o=11;break e;case Wy:o=14;break e;case vs:o=16,r=null;break e}throw Error(ue(130,t==null?t:typeof t,""))}return e=Nr(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function Fo(t,e,n,r){return t=Nr(7,t,r,e),t.lanes=n,t}function Rp(t,e,n,r){return t=Nr(22,t,r,e),t.elementType=SC,t.lanes=n,t.stateNode={isHidden:!1},t}function tg(t,e,n){return t=Nr(6,t,null,e),t.lanes=n,t}function ng(t,e,n){return e=Nr(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function MA(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=Bm(0),this.expirationTimes=Bm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bm(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Ex(t,e,n,r,i,s,o,l,a){return t=new MA(t,e,n,l,a),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Nr(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ax(s),t}function DA(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Pl,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function m5(t){if(!t)return qs;t=t._reactInternals;e:{if(cl(t)!==t||t.tag!==1)throw Error(ue(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(rr(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(ue(171))}if(t.tag===1){var n=t.type;if(rr(n))return m6(t,n,e)}return e}function g5(t,e,n,r,i,s,o,l,a){return t=Ex(n,r,!0,t,i,s,o,l,a),t.context=m5(null),n=t.current,r=jn(),i=Fs(n),s=qi(r,i),s.callback=e??null,js(n,s,i),t.current.lanes=i,Qc(t,i,r),ir(t,r),t}function Bp(t,e,n,r){var i=e.current,s=jn(),o=Fs(i);return n=m5(n),e.context===null?e.context=n:e.pendingContext=n,e=qi(s,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=js(i,e,o),t!==null&&(ei(t,i,o,s),If(t,i,o)),o}function Nh(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 o4(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function $x(t,e){o4(t,e),(t=t.alternate)&&o4(t,e)}function NA(){return null}var y5=typeof reportError=="function"?reportError:function(t){console.error(t)};function Mx(t){this._internalRoot=t}Op.prototype.render=Mx.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(ue(409));Bp(t,e,null,null)};Op.prototype.unmount=Mx.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;qo(function(){Bp(null,t,null,null)}),e[ts]=null}};function Op(t){this._internalRoot=t}Op.prototype.unstable_scheduleHydration=function(t){if(t){var e=YC();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Ss.length&&e!==0&&e<Ss[n].priority;n++);Ss.splice(n,0,t),n===0&&qC(t)}};function Dx(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function jp(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function l4(){}function AA(t,e,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=Nh(o);s.call(u)}}var o=g5(e,r,t,0,null,!1,!1,"",l4);return t._reactRootContainer=o,t[ts]=o.current,uc(t.nodeType===8?t.parentNode:t),qo(),o}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var u=Nh(a);l.call(u)}}var a=Ex(t,0,!1,null,null,!1,!1,"",l4);return t._reactRootContainer=a,t[ts]=a.current,uc(t.nodeType===8?t.parentNode:t),qo(function(){Bp(e,a,n,r)}),a}function Vp(t,e,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var a=Nh(o);l.call(a)}}Bp(e,o,t,i)}else o=AA(n,e,t,i,r);return Nh(o)}UC=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=ku(e.pendingLanes);n!==0&&(Ky(e,n|1),ir(e,Gt()),!(qe&6)&&(ka=Gt()+500,ao()))}break;case 13:qo(function(){var r=ns(t,1);if(r!==null){var i=jn();ei(r,t,1,i)}}),$x(t,1)}};Yy=function(t){if(t.tag===13){var e=ns(t,134217728);if(e!==null){var n=jn();ei(e,t,134217728,n)}$x(t,134217728)}};KC=function(t){if(t.tag===13){var e=Fs(t),n=ns(t,e);if(n!==null){var r=jn();ei(n,t,e,r)}$x(t,e)}};YC=function(){return nt};XC=function(t,e){var n=nt;try{return nt=t,e()}finally{nt=n}};D0=function(t,e,n){switch(e){case"input":if(w0(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=Np(r);if(!i)throw Error(ue(90));$C(r),w0(r,i)}}}break;case"textarea":DC(t,n);break;case"select":e=n.value,e!=null&&Zl(t,!!n.multiple,e,!1)}};RC=wx;BC=qo;var TA={usingClientEntryPoint:!1,Events:[Jc,Ol,Np,LC,IC,wx]},cu={findFiberByHostInstance:Ao,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},PA={bundleType:cu.bundleType,version:cu.version,rendererPackageName:cu.rendererPackageName,rendererConfig:cu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:cs.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=VC(t),t===null?null:t.stateNode},findFiberByHostInstance:cu.findFiberByHostInstance||NA,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 jd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!jd.isDisabled&&jd.supportsFiber)try{Ep=jd.inject(PA),Mi=jd}catch{}}Cr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=TA;Cr.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Dx(e))throw Error(ue(200));return DA(t,e,null,n)};Cr.createRoot=function(t,e){if(!Dx(t))throw Error(ue(299));var n=!1,r="",i=y5;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=Ex(t,1,!1,null,null,n,!1,r,i),t[ts]=e.current,uc(t.nodeType===8?t.parentNode:t),new Mx(e)};Cr.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(ue(188)):(t=Object.keys(t).join(","),Error(ue(268,t)));return t=VC(e),t=t===null?null:t.stateNode,t};Cr.flushSync=function(t){return qo(t)};Cr.hydrate=function(t,e,n){if(!jp(e))throw Error(ue(200));return Vp(null,t,e,!0,n)};Cr.hydrateRoot=function(t,e,n){if(!Dx(t))throw Error(ue(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=y5;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=g5(e,null,t,1,n??null,i,!1,s,o),t[ts]=e.current,uc(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 Op(e)};Cr.render=function(t,e,n){if(!jp(e))throw Error(ue(200));return Vp(null,t,e,!1,n)};Cr.unmountComponentAtNode=function(t){if(!jp(t))throw Error(ue(40));return t._reactRootContainer?(qo(function(){Vp(null,null,t,!1,function(){t._reactRootContainer=null,t[ts]=null})}),!0):!1};Cr.unstable_batchedUpdates=wx;Cr.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!jp(n))throw Error(ue(200));if(t==null||t._reactInternals===void 0)throw Error(ue(38));return Vp(t,e,n,!1,r)};Cr.version="18.3.1-next-f1338f8080-20240426";function x5(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(x5)}catch(t){console.error(t)}}x5(),xC.exports=Cr;var Nx=xC.exports,v5,a4=Nx;v5=a4.createRoot,a4.hydrateRoot;const b5=w.createContext(null);function LA({children:t}){const[e,n]=w.useState([]),[r,i]=w.useState([]),[s,o]=w.useState([]),[l,a]=w.useState(null),u=w.useCallback((p,y,b)=>{n(p),i(y),o(b),a(C=>p.length===0?null:!C||!p.some(S=>S.id===C)?p[0].id:C)},[]),c=w.useCallback(p=>{a(p)},[]),d=w.useMemo(()=>r.filter(p=>p.collectionId===l&&p.resolvedType==="COLOR"),[r,l]),f=w.useMemo(()=>{const p=new Map;for(const y of s)p.set(y.sourceVariableId,y);return p},[s]),h=w.useMemo(()=>{const p=new Map;for(const y of s)p.set(`${y.collectionId}:${y.sourceVariableName}`,y);return p},[s]),m=w.useCallback(p=>f.get(p)||null,[f]),x=w.useCallback(p=>l&&h.get(`${l}:${p}`)||null,[h,l]),v=w.useMemo(()=>({collections:e,variables:r,shadeGroups:s,setData:u,selectedCollectionId:l,setSelectedCollectionId:c,colorVariables:d,getShadeGroupBySourceId:m,getShadeGroupByGroupName:x}),[e,r,s,u,l,c,d,m,x]);return g.jsx(b5.Provider,{value:v,children:t})}function w5(){const t=w.useContext(b5);if(!t)throw new Error("useDataContext must be used within DataProvider");return t}function rg(t=new Set){const[e,n]=w.useState(t),r=w.useCallback(o=>{n(l=>{const a=new Set(l);return a.has(o)?a.delete(o):a.add(o),a})},[]),i=w.useCallback(o=>{n(l=>l.size===o.length&&o.every(a=>l.has(a))?new Set:new Set(o))},[]),s=w.useCallback(()=>{n(new Set)},[]);return{items:e,toggle:r,toggleAll:i,clear:s,setItems:n}}function Qi(t){const e=t.split("/");return e.length<=1?null:e.slice(0,-1).join("/")}function Hs(t,e){return`${t}::${e}`}function C5(t,e){const n=Qi(t.name);return n?e.has(Hs(t.collectionId,n)):!0}const k5=w.createContext(null);function IA({children:t}){const{collections:e,variables:n,selectedCollectionId:r}=w5(),[i,s]=w.useState(""),[o,l]=w.useState(null),a=rg(new Set),u=rg(new Set(["COLOR","FLOAT","STRING","BOOLEAN"])),c=rg(new Set),d=be.useRef(!1),f=be.useRef(new Set),h=be.useRef(new Set);w.useEffect(()=>{var A,T;if(d.current||e.length===0)return;d.current=!0,a.setItems(new Set(e.map(V=>V.id))),h.current=new Set(e.map(V=>V.id));const D=new Set;n.forEach(V=>{const M=Qi(V.name);M&&D.add(Hs(V.collectionId,M))}),c.setItems(D),f.current=D;const L=e.flatMap(V=>V.modes);L.length>0&&(!o||!L.some(V=>V.modeId===o))&&l(((T=(A=e[0])==null?void 0:A.modes[0])==null?void 0:T.modeId)||null)},[e,n]),w.useEffect(()=>{if(!d.current)return;const D=new Set(e.map(A=>A.id)),L=Array.from(D).filter(A=>!h.current.has(A));L.length>0&&a.setItems(A=>{const T=new Set(A);return L.forEach(V=>T.add(V)),T}),h.current=D},[e]),w.useEffect(()=>{if(!d.current)return;const D=new Set;n.forEach(A=>{const T=Qi(A.name);T&&D.add(Hs(A.collectionId,T))});const L=Array.from(D).filter(A=>!f.current.has(A));L.length>0&&c.setItems(A=>{const T=new Set(A);return L.forEach(V=>T.add(V)),T}),f.current=D},[n]);const m=w.useCallback(D=>{s(D.toLowerCase().trim())},[]),x=a.toggle,v=w.useCallback(()=>{a.toggleAll(e.map(D=>D.id))},[e,a.toggleAll]),p=u.toggle,y=w.useCallback(()=>{u.toggleAll(["COLOR","FLOAT","STRING","BOOLEAN"])},[u.toggleAll]),b=w.useCallback(D=>{c.toggle(D)},[c.toggle]),C=w.useCallback(()=>{const D=[];n.forEach(L=>{const A=Qi(L.name);if(!A)return;const T=Hs(L.collectionId,A);D.includes(T)||D.push(T)}),c.toggleAll(D)},[n,c.toggleAll]),S=w.useCallback(D=>{l(D)},[]),k=w.useMemo(()=>{let D=n.filter(L=>a.items.has(L.collectionId));return D=D.filter(L=>u.items.has(L.resolvedType)),i&&(D=D.filter(L=>L.name.toLowerCase().includes(i))),D},[n,a.items,u.items,i]),E=w.useCallback(()=>{const D=n.filter(L=>L.collectionId===r).length;return{shown:k.length,total:D}},[n,r,k.length]),$=w.useMemo(()=>({selectedModeId:o,setSelectedModeId:S,selectedVariableTypes:u.items,toggleVariableType:p,toggleAllVariableTypes:y,selectedCollectionIds:a.items,toggleCollection:x,toggleAllCollections:v,selectedGroups:c.items,toggleSelectedGroup:b,toggleAllGroups:C,searchQuery:i,setSearchQuery:m,filteredVariables:k,getFilteredCount:E}),[o,S,u.items,p,y,a.items,x,v,c.items,b,C,i,m,k,E]);return g.jsx(k5.Provider,{value:$,children:t})}function RA(){const t=w.useContext(k5);if(!t)throw new Error("useFilterContext must be used within FilterProvider");return t}const S5=w.createContext(null);function BA({children:t}){const[e,n]=w.useState(new Set),[r,i]=w.useState({}),[s,o]=w.useState({}),l=w.useCallback(v=>{n(p=>{const y=new Set(p);return y.has(v)?y.delete(v):y.add(v),y})},[]),a=w.useCallback(v=>{n(p=>{const y=new Set(p);return v.forEach(b=>y.add(b)),y})},[]),u=w.useCallback(v=>{n(p=>{const y=new Set(p);return v.forEach(b=>y.delete(b)),y})},[]),c=w.useCallback(v=>e.has(v),[e]),d=w.useCallback((v,p)=>{i(y=>{if(p===null){const{[v]:b,...C}=y;return C}return{...y,[v]:p}})},[]),f=w.useCallback(v=>r[v]||null,[r]),h=w.useCallback((v,p)=>{o(y=>{if(p===null){const{[v]:b,...C}=y;return C}return{...y,[v]:p}})},[]),m=w.useCallback(v=>s[v]||null,[s]),x=w.useMemo(()=>({collapsedGroups:e,toggleGroup:l,collapseGroups:a,expandGroups:u,isGroupCollapsed:c,groupContrastColors:r,setGroupContrastColor:d,getGroupContrastColor:f,singleContrastColors:s,setSingleContrastColor:h,getSingleContrastColor:m}),[e,l,a,u,c,r,d,f,s,h,m]);return g.jsx(S5.Provider,{value:x,children:t})}function OA(){const t=w.useContext(S5);if(!t)throw new Error("useUIStateContext must be used within UIStateProvider");return t}const E5=w.createContext(null);function jA({children:t}){const[e,n]=w.useState(null),[r,i]=w.useState(!1),s=w.useCallback((l,a)=>{n(l),i(a)},[]),o=w.useMemo(()=>({selectedNode:e,hasMultipleSelection:r,setSelection:s}),[e,r,s]);return g.jsx(E5.Provider,{value:o,children:t})}function VA(){const t=w.useContext(E5);if(!t)throw new Error("useSelectionContext must be used within SelectionProvider");return t}function FA({children:t}){return g.jsx(LA,{children:g.jsx(IA,{children:g.jsx(BA,{children:g.jsx(jA,{children:t})})})})}function Zt(){const t=w5(),e=RA(),n=OA(),r=VA();return{...t,...e,...n,...r}}const $5=w.createContext(null);function _A({children:t}){const[e,n]=w.useState({inputModal:null,colorPicker:null,colorReference:null,bulkEdit:null,shadesModal:null,stepsModal:null,addVariableModal:null}),r=w.useCallback(y=>{n(b=>({...b,inputModal:y}))},[]),i=w.useCallback(()=>{n(y=>({...y,inputModal:null}))},[]),s=w.useCallback(y=>{n(b=>({...b,colorPicker:y}))},[]),o=w.useCallback(()=>{n(y=>({...y,colorPicker:null}))},[]),l=w.useCallback(y=>{n(b=>({...b,colorReference:y}))},[]),a=w.useCallback(()=>{n(y=>({...y,colorReference:null}))},[]),u=w.useCallback(y=>{n(b=>({...b,bulkEdit:y}))},[]),c=w.useCallback(()=>{n(y=>({...y,bulkEdit:null}))},[]),d=w.useCallback(y=>{n(b=>({...b,shadesModal:y}))},[]),f=w.useCallback(()=>{n(y=>({...y,shadesModal:null}))},[]),h=w.useCallback(y=>{n(b=>({...b,stepsModal:y}))},[]),m=w.useCallback(()=>{n(y=>({...y,stepsModal:null}))},[]),x=w.useCallback(y=>{n(b=>({...b,addVariableModal:y}))},[]),v=w.useCallback(()=>{n(y=>({...y,addVariableModal:null}))},[]),p={modals:e,openInputModal:r,closeInputModal:i,openColorPicker:s,closeColorPicker:o,openColorReference:l,closeColorReference:a,openBulkEdit:u,closeBulkEdit:c,openShadesModal:d,closeShadesModal:f,openStepsModal:h,closeStepsModal:m,openAddVariableModal:x,closeAddVariableModal:v};return g.jsx($5.Provider,{value:p,children:t})}function ar(){const t=w.useContext($5);if(!t)throw new Error("useModalContext must be used within ModalProvider");return t}const HA=9337,ig=`ws://localhost:${HA}`,Ax=1,zA=4002;function WA(t){return t.protocol!=="http:"&&t.protocol!=="https:"||!t.hostname||!t.port?null:`${t.protocol==="https:"?"wss":"ws"}://${t.hostname}:${t.port}`}function GA(t){return t!=="client"||typeof window>"u"?ig:WA(window.location)??ig}const l1="__windenBridge",UA=new Set(["resize","ui-ready","get-history-state","cancel"]);function KA(t){return typeof t=="string"&&UA.has(t)}const YA="bridge/plugin-connected",XA="bridge/plugin-disconnected",qA="bridge/client-attached",QA="bridge/client-detached",ZA="bridge/version-mismatch",JA=1e3,eT=15e3,tT=100,nT=3e4,u4=`Bridge protocol mismatch. The relay and the Winden Tokens plugin are different versions (this side speaks v${Ax}). Update the older half: npm i -g winden-tokens@latest, or rebuild the plugin from current source.`;function Tx(){return typeof window>"u"?!1:window.parent!==window}function rT(){return Tx()?"plugin":"client"}function c4(t,e,n){const r={v:Ax,role:t,kind:e};return e==="message"&&(r.payload=n),JSON.stringify(r)}function iT(t){if(typeof t!="string")return null;let e;try{e=JSON.parse(t)}catch{return null}return!e||typeof e!="object"||e.v!==Ax||e.role!=="plugin"&&e.role!=="client"&&e.role!=="relay"||e.kind!=="hello"&&e.kind!=="message"&&e.kind!=="status"||e.role==="relay"!=(e.kind==="status")||e.kind!=="hello"&&(!e.payload||typeof e.payload!="object")?null:e}function d4(t){typeof window>"u"||(window.__WINDEN_BRIDGE_ACTIVE__=t)}function sT(){if(typeof window>"u")return;const t=window.__WINDEN_INJECT_MOCK__;typeof t=="function"&&t()}class oT{constructor(e){this.socket=null,this.started=!1,this.abandoned=!1,this.attempts=0,this.everConnected=!1,this.timer=null,this.queue=[],this.connected=!1,this.peerAttached=!1,this.probed=!1,this.error=null,this.refreshDeadline=0,this.payloadListeners=new Set,this.statusListeners=new Set,this.figmaListener=null,this.role=e}getStatus(){return{enabled:!0,role:this.role,connected:this.connected,peerAttached:this.peerAttached,probed:this.probed,error:this.error}}start(){if(!(this.started||this.abandoned)){if(typeof WebSocket>"u"){this.abandoned=!0;return}this.started=!0,this.role==="plugin"?this.mirrorFigmaMessages():d4(!0),this.connect()}}stop(){this.abandoned=!0,this.timer&&(clearTimeout(this.timer),this.timer=null);const e=this.socket;if(this.socket=null,e){e.onopen=e.onmessage=e.onerror=e.onclose=null;try{e.close()}catch{}}this.setConnected(!1)}send(e){if(this.socket&&this.socket.readyState===WebSocket.OPEN)try{return this.socket.send(c4(this.role,"message",e)),!0}catch{return!1}return this.role==="client"&&!this.abandoned&&this.queue.length<tT&&this.queue.push(e),!1}onPayload(e){return this.payloadListeners.add(e),()=>{this.payloadListeners.delete(e)}}onStatus(e){return this.statusListeners.add(e),()=>{this.statusListeners.delete(e)}}releasePeer(){this.setPeerAttached(!1)}connect(){if(this.abandoned||this.socket)return;this.attempts+=1;let e;try{e=new WebSocket(GA(this.role))}catch{this.setProbed(),this.scheduleReconnect();return}this.socket=e,e.onopen=()=>{if(this.socket===e){this.everConnected=!0,this.attempts=0;try{e.send(c4(this.role,"hello"))}catch{return}this.setProbed(),this.setConnected(!0),this.flushQueue()}},e.onmessage=n=>{this.socket===e&&this.handleEnvelope(iT(n.data))},e.onerror=()=>{},e.onclose=n=>{if(this.socket===e){if(this.socket=null,this.setProbed(),this.setConnected(!1),this.setPeerAttached(!1),this.refreshDeadline=0,(n==null?void 0:n.code)===zA){this.giveUp(n.reason||u4);return}this.scheduleReconnect()}}}scheduleReconnect(){if(this.abandoned||this.timer)return;this.everConnected||this.role==="client"&&this.attempts===1&&(d4(!1),sT());const e=Math.min(JA*2**Math.max(0,this.attempts-1),eT);this.timer=setTimeout(()=>{this.timer=null,this.connect()},e)}flushQueue(){if(!this.queue.length)return;const e=this.queue;this.queue=[];for(const n of e)this.send(n)}handleEnvelope(e){if(!e)return;if(e.role==="relay"){this.handleRelayStatus(e.payload);return}if(e.role===this.role)return;if(e.kind==="hello"){this.setPeerAttached(!0),this.role==="plugin"&&this.requestFullRefresh();return}const n=e.payload;if(this.role==="plugin"){window.parent.postMessage({pluginMessage:n},"*");return}for(const r of this.payloadListeners)r(n);window.postMessage({pluginMessage:n,[l1]:!0},"*")}handleRelayStatus(e){const n=e==null?void 0:e.type;if(n===ZA){const r=e==null?void 0:e.message;this.setError(typeof r=="string"&&r?r:u4);return}if(this.role==="client"){n===YA?this.setPeerAttached(!0):n===XA&&this.setPeerAttached(!1);return}if(n===qA){this.setPeerAttached(!0),this.requestFullRefresh();return}n===QA&&(e==null?void 0:e.clients)===0&&this.setPeerAttached(!1)}requestFullRefresh(){const e=Date.now();e<this.refreshDeadline||(this.refreshDeadline=e+nT,window.parent.postMessage({pluginMessage:{type:"ui-ready"}},"*"),window.parent.postMessage({pluginMessage:{type:"get-history-state"}},"*"))}mirrorFigmaMessages(){this.figmaListener||(this.figmaListener=e=>{var r,i;if((r=e.data)!=null&&r[l1])return;const n=(i=e.data)==null?void 0:i.pluginMessage;!n||typeof n!="object"||(n.type==="data-loaded"&&(this.refreshDeadline=0),this.send(n))},window.addEventListener("message",this.figmaListener))}giveUp(e){this.abandoned=!0,this.timer&&(clearTimeout(this.timer),this.timer=null),this.setError(e),console.error(`[winden-tokens bridge] ${e}`)}setError(e){this.error!==e&&(this.error=e,this.emitStatus())}setConnected(e){this.connected!==e&&(this.connected=e,e||(this.peerAttached=!1),this.emitStatus())}setProbed(){this.probed||(this.probed=!0,this.emitStatus())}setPeerAttached(e){this.peerAttached!==e&&(this.peerAttached=e,this.emitStatus())}emitStatus(){const e=this.getStatus();for(const n of this.statusListeners)n(e)}}const yn=new oT(rT()),lT={enabled:!1,role:"plugin",connected:!1,peerAttached:!1,probed:!1,error:null};function aT(){yn==null||yn.start()}function f4(t){return yn?yn.send(t):!1}function uT(t){return yn?yn.onPayload(t):()=>{}}function cT(){const[t,e]=w.useState(()=>(yn==null?void 0:yn.getStatus())??lT);return w.useEffect(()=>{if(!yn)return;const n=yn.onStatus(e);return yn.start(),e(yn.getStatus()),n},[]),t}function dT(){yn==null||yn.releasePeer()}function fT(t){w.useEffect(()=>{const e=i=>{if(!i)return;const s=t[i.type];s&&s(i)},n=i=>{var s,o;(s=i.data)!=null&&s[l1]||e((o=i.data)==null?void 0:o.pluginMessage)};window.addEventListener("message",n);const r=uT(e);return aT(),()=>{window.removeEventListener("message",n),r()}},[t])}function Se(t){if(Tx()){parent.postMessage({pluginMessage:t},"*"),f4(t);return}KA(t.type)||f4(t)}const Ah={primary:"bg-primary text-white hover:bg-primary/80 active:bg-primary/90 cursor-pointer",secondary:"bg-base-3 text-text hover:bg-base-3 active:bg-base-3 cursor-pointer",danger:"bg-danger text-base hover:bg-danger/80 active:bg-danger/90 cursor-pointer",ghost:"bg-transparent text-text hover:bg-base-2 active:bg-base-3 cursor-pointer",outline:"bg-transparent text-text border border-border hover:bg-base-2 active:bg-base-3 cursor-pointer"},Ye=w.forwardRef(function({variant:e="ghost",size:n="md",fullWidth:r=!1,loading:i=!1,className:s="",disabled:o,children:l,...a},u){const c="inline-flex items-center justify-center rounded font-medium transition-colors",d={sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"},f=[c,Ah[e],d[n],r&&"w-full",(o||i)&&"opacity-50 cursor-not-allowed",s].filter(Boolean).join(" ");return g.jsx("button",{ref:u,type:"button",className:f,disabled:o||i,...a,children:i?"Loading...":l})}),is=w.forwardRef(function({icon:e,iconPosition:n="left",variant:r="ghost",fullWidth:i=!1,loading:s=!1,className:o="",disabled:l,children:a,...u},c){const d="inline-flex items-center justify-center gap-1 rounded font-medium transition-colors text-xs",f=n==="left"?"pl-1 pr-3 py-1":"pl-3 pr-1 py-1",h=[d,Ah[r],f,i&&"w-full",(l||s)&&"opacity-50 cursor-not-allowed",o].filter(Boolean).join(" ");return g.jsx("button",{ref:c,type:"button",className:h,disabled:l||s,...u,children:s?"Loading...":g.jsxs(g.Fragment,{children:[n==="left"&&g.jsx("span",{className:"inline-flex items-center",children:e}),g.jsx("span",{children:a}),n==="right"&&g.jsx("span",{className:"inline-flex items-center",children:e})]})})}),On=w.forwardRef(function({icon:e,variant:n="ghost",size:r="md",className:i="",disabled:s,...o},l){const a="inline-flex items-center justify-center rounded transition-colors",u={default:Ah.secondary,danger:"bg-red-100 text-red-600 hover:bg-red-200 active:bg-red-300",ghost:Ah.ghost},c={sm:"w-6 h-6 text-sm",md:"w-8 h-8 text-base",lg:"w-10 h-10 text-lg"},d=[a,u[n],c[r],s&&"opacity-50 cursor-not-allowed",i].filter(Boolean).join(" ");return g.jsx("button",{ref:l,type:"button",className:d,disabled:s,...o,children:g.jsx("span",{className:"inline-flex items-center justify-center","aria-hidden":"true",children:e})})}),hT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
48
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 6C12.1326 6 12.2598 6.05268 12.3536 6.14645C12.4473 6.24021 12.5 6.36739 12.5 6.5V11.5H17.5C17.6326 11.5 17.7598 11.5527 17.8536 11.6464C17.9473 11.7402 18 11.8674 18 12C18 12.1326 17.9473 12.2598 17.8536 12.3536C17.7598 12.4473 17.6326 12.5 17.5 12.5H12.5V17.5C12.5 17.6326 12.4473 17.7598 12.3536 17.8536C12.2598 17.9473 12.1326 18 12 18C11.8674 18 11.7402 17.9473 11.6464 17.8536C11.5527 17.7598 11.5 17.6326 11.5 17.5V12.5H6.5C6.36739 12.5 6.24021 12.4473 6.14645 12.3536C6.05268 12.2598 6 12.1326 6 12C6 11.8674 6.05268 11.7402 6.14645 11.6464C6.24021 11.5527 6.36739 11.5 6.5 11.5H11.5V6.5C11.5 6.36739 11.5527 6.24021 11.6464 6.14645C11.7402 6.05268 11.8674 6 12 6Z" fill="black"/>
|
|
49
|
+
</svg>
|
|
50
|
+
`,pT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
51
|
+
<path d="M16.2411 7.76401C15.2574 6.78271 13.9639 6.17289 12.581 6.03846C11.1981 5.90404 9.8113 6.25333 8.65704 7.02681C7.50279 7.80029 6.65248 8.9501 6.251 10.2803C5.84953 11.6105 5.92175 13.0387 6.45534 14.3216C6.98894 15.6045 7.9509 16.6627 9.17728 17.3158C10.4037 17.9689 11.8186 18.1766 13.1809 17.9033C14.5432 17.6301 15.7686 16.8929 16.6483 15.8174C17.528 14.7419 18.0075 13.3946 18.0051 12.0051H16.5038C16.5048 13.0472 16.1443 14.0573 15.4839 14.8634C14.8236 15.6694 13.9041 16.2216 12.8823 16.4257C11.8604 16.6298 10.7994 16.4733 9.88 15.9828C8.96062 15.4923 8.23977 14.6982 7.84027 13.7358C7.44077 12.7734 7.38736 11.7022 7.68913 10.7048C7.9909 9.70742 8.62919 8.84553 9.49521 8.26601C10.3612 7.68649 11.4014 7.42519 12.4385 7.52665C13.4756 7.62811 14.4454 8.08604 15.1827 8.82242L13.5013 10.5039H18.0051V6L16.2411 7.76401Z" fill="black"/>
|
|
52
|
+
</svg>
|
|
53
|
+
`,mT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
54
|
+
<path d="M10.2 6.94998L7 10.15L10.2 13.35" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
55
|
+
<path d="M8 10.15H13.3C14.2813 10.15 15.2224 10.5398 15.9163 11.2337C16.6102 11.9276 17 12.8687 17 13.85C17 14.8313 16.6102 15.7724 15.9163 16.4663C15.2224 17.1602 14.2813 17.55 13.3 17.55H11.8" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
56
|
+
</svg>
|
|
57
|
+
`,gT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
58
|
+
<path d="M13.8 6.94998L17 10.15L13.8 13.35" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
59
|
+
<path d="M16 10.15H10.7C9.7187 10.15 8.77759 10.5398 8.0837 11.2337C7.38982 11.9276 7 12.8687 7 13.85C7 14.8313 7.38982 15.7724 8.0837 16.4663C8.77759 17.1602 9.7187 17.55 10.7 17.55H12.2" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
60
|
+
</svg>
|
|
61
|
+
`,yT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
62
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M17 7.707L13.854 10.854C13.7601 10.9479 13.6328 11.0006 13.5 11.0006C13.3672 11.0006 13.2399 10.9479 13.146 10.854C13.0521 10.7601 12.9994 10.6328 12.9994 10.5C12.9994 10.3672 13.0521 10.2399 13.146 10.146L16.293 7H13.5C13.3674 7 13.2402 6.94732 13.1464 6.85355C13.0527 6.75979 13 6.63261 13 6.5C13 6.36739 13.0527 6.24021 13.1464 6.14645C13.2402 6.05268 13.3674 6 13.5 6H17.5C17.6326 6 17.7598 6.05268 17.8536 6.14645C17.9473 6.24021 18 6.36739 18 6.5V10.5C18 10.6326 17.9473 10.7598 17.8536 10.8536C17.7598 10.9473 17.6326 11 17.5 11C17.3674 11 17.2402 10.9473 17.1464 10.8536C17.0527 10.7598 17 10.6326 17 10.5V7.707ZM10.146 13.147C10.2398 13.0531 10.367 13.0003 10.4996 13.0002C10.6323 13.0001 10.7596 13.0527 10.8535 13.1465C10.9474 13.2403 11.0002 13.3675 11.0003 13.5001C11.0004 13.6328 10.9478 13.7601 10.854 13.854L7.707 17H10.5C10.6326 17 10.7598 17.0527 10.8536 17.1464C10.9473 17.2402 11 17.3674 11 17.5C11 17.6326 10.9473 17.7598 10.8536 17.8536C10.7598 17.9473 10.6326 18 10.5 18H6.5C6.36739 18 6.24021 17.9473 6.14645 17.8536C6.05268 17.7598 6 17.6326 6 17.5V13.5C6 13.3674 6.05268 13.2402 6.14645 13.1464C6.24021 13.0527 6.36739 13 6.5 13C6.63261 13 6.75979 13.0527 6.85355 13.1464C6.94732 13.2402 7 13.3674 7 13.5V16.293L10.146 13.147Z" fill="black"/>
|
|
63
|
+
</svg>
|
|
64
|
+
`,xT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
65
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.146 6.14599C17.2399 6.0521 17.3672 5.99936 17.5 5.99936C17.6328 5.99936 17.7601 6.0521 17.854 6.14599C17.9479 6.23988 18.0006 6.36722 18.0006 6.49999C18.0006 6.63277 17.9479 6.7601 17.854 6.85399L14.707 9.99999H17.5C17.6326 9.99999 17.7598 10.0527 17.8536 10.1464C17.9473 10.2402 18 10.3674 18 10.5C18 10.6326 17.9473 10.7598 17.8536 10.8535C17.7598 10.9473 17.6326 11 17.5 11H13.5C13.3674 11 13.2402 10.9473 13.1465 10.8535C13.0527 10.7598 13 10.6326 13 10.5V6.49999C13 6.36738 13.0527 6.24021 13.1465 6.14644C13.2402 6.05267 13.3674 5.99999 13.5 5.99999C13.6326 5.99999 13.7598 6.05267 13.8536 6.14644C13.9473 6.24021 14 6.36738 14 6.49999V9.29299L17.146 6.14599ZM6.85401 17.854C6.76012 17.9479 6.63278 18.0006 6.50001 18.0006C6.36723 18.0006 6.23989 17.9479 6.14601 17.854C6.05212 17.7601 5.99937 17.6328 5.99937 17.5C5.99937 17.3672 6.05212 17.2399 6.14601 17.146L9.29301 14H6.50001C6.3674 14 6.24022 13.9473 6.14645 13.8535C6.05268 13.7598 6.00001 13.6326 6.00001 13.5C6.00001 13.3674 6.05268 13.2402 6.14645 13.1464C6.24022 13.0527 6.3674 13 6.50001 13H10.5C10.6326 13 10.7598 13.0527 10.8536 13.1464C10.9473 13.2402 11 13.3674 11 13.5V17.5C11 17.6326 10.9473 17.7598 10.8536 17.8535C10.7598 17.9473 10.6326 18 10.5 18C10.3674 18 10.2402 17.9473 10.1465 17.8535C10.0527 17.7598 10 17.6326 10 17.5V14.707L6.85401 17.854Z" fill="black"/>
|
|
66
|
+
</svg>
|
|
67
|
+
`,vT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
68
|
+
<path d="M17.499 13.999C17.6318 13.999 17.7596 14.0516 17.8535 14.1455C17.9474 14.2394 18 14.3672 18 14.5C17.9999 14.6326 17.9472 14.7597 17.8535 14.8535L15.8535 16.8535C15.8071 16.9 15.7521 16.9377 15.6914 16.9629C15.6307 16.9881 15.5648 17.001 15.499 17.001C15.4334 17.0009 15.3682 16.988 15.3076 16.9629C15.2469 16.9377 15.192 16.9001 15.1455 16.8535L13.1455 14.8535C13.0517 14.7597 12.9991 14.6327 12.999 14.5C12.999 14.3672 13.0516 14.2394 13.1455 14.1455C13.2393 14.0518 13.3665 13.9991 13.499 13.999C13.6318 13.999 13.7596 14.0516 13.8535 14.1455L15.499 15.793L17.1455 14.1455C17.2393 14.0518 17.3665 13.9991 17.499 13.999Z" fill="black"/>
|
|
69
|
+
<path d="M11.5 16C11.6326 16 11.7597 16.0527 11.8535 16.1465C11.9473 16.2403 12 16.3674 12 16.5C12 16.6326 11.9473 16.7597 11.8535 16.8535C11.7597 16.9473 11.6326 17 11.5 17H6.5C6.36739 17 6.24025 16.9473 6.14648 16.8535C6.05272 16.7597 6 16.6326 6 16.5C6 16.3674 6.05272 16.2403 6.14648 16.1465C6.24025 16.0527 6.36739 16 6.5 16H11.5Z" fill="black"/>
|
|
70
|
+
<path d="M11.5 13C11.6326 13 11.7597 13.0527 11.8535 13.1465C11.9473 13.2403 12 13.3674 12 13.5C12 13.6326 11.9473 13.7597 11.8535 13.8535C11.7597 13.9473 11.6326 14 11.5 14H6.5C6.36739 14 6.24025 13.9473 6.14648 13.8535C6.05272 13.7597 6 13.6326 6 13.5C6 13.3674 6.05272 13.2403 6.14648 13.1465C6.24025 13.0527 6.36739 13 6.5 13H11.5Z" fill="black"/>
|
|
71
|
+
<path d="M11.5 10C11.6326 10 11.7597 10.0527 11.8535 10.1465C11.9473 10.2403 12 10.3674 12 10.5C12 10.6326 11.9473 10.7597 11.8535 10.8535C11.7597 10.9473 11.6326 11 11.5 11H6.5C6.36739 11 6.24025 10.9473 6.14648 10.8535C6.05272 10.7597 6 10.6326 6 10.5C6 10.3674 6.05272 10.2403 6.14648 10.1465C6.24025 10.0527 6.36739 10 6.5 10H11.5Z" fill="black"/>
|
|
72
|
+
<path d="M15.499 6.99902C15.5648 6.99902 15.6307 7.0119 15.6914 7.03711C15.7521 7.06231 15.8071 7.09997 15.8535 7.14648L17.8535 9.14648C17.8999 9.19291 17.9368 9.24796 17.9619 9.30859C17.987 9.36925 18 9.43435 18 9.5C18 9.5656 17.987 9.63078 17.9619 9.69141C17.9368 9.75215 17.9 9.808 17.8535 9.85449C17.7596 9.94836 17.6318 10.001 17.499 10.001C17.4334 10.0009 17.3683 9.98801 17.3076 9.96289C17.247 9.93776 17.1919 9.90087 17.1455 9.85449L15.499 8.20703L13.8535 9.85449C13.7596 9.94836 13.6318 10.001 13.499 10.001C13.3665 10.0009 13.2393 9.94819 13.1455 9.85449C13.0516 9.76061 12.999 9.63278 12.999 9.5C12.9991 9.36734 13.0517 9.2403 13.1455 9.14648L15.1455 7.14648C15.192 7.09992 15.2469 7.06232 15.3076 7.03711C15.3682 7.01196 15.4334 6.99907 15.499 6.99902Z" fill="black"/>
|
|
73
|
+
<path d="M11.5 7C11.6326 7 11.7597 7.05272 11.8535 7.14648C11.9473 7.24025 12 7.36739 12 7.5C12 7.63261 11.9473 7.75975 11.8535 7.85352C11.7597 7.94728 11.6326 8 11.5 8H6.5C6.36739 8 6.24025 7.94728 6.14648 7.85352C6.05272 7.75975 6 7.63261 6 7.5C6 7.36739 6.05272 7.24025 6.14648 7.14648C6.24025 7.05272 6.36739 7 6.5 7H11.5Z" fill="black"/>
|
|
74
|
+
</svg>
|
|
75
|
+
`,bT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
76
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.5 6.99999C6.36739 6.99999 6.24021 7.05267 6.14645 7.14644C6.05268 7.24021 6 7.36738 6 7.49999C6 7.6326 6.05268 7.75978 6.14645 7.85354C6.24021 7.94731 6.36739 7.99999 6.5 7.99999H11.5C11.6326 7.99999 11.7598 7.94731 11.8536 7.85354C11.9473 7.75978 12 7.6326 12 7.49999C12 7.36738 11.9473 7.24021 11.8536 7.14644C11.7598 7.05267 11.6326 6.99999 11.5 6.99999H6.5ZM6.5 9.99999C6.36739 9.99999 6.24021 10.0527 6.14645 10.1464C6.05268 10.2402 6 10.3674 6 10.5C6 10.6326 6.05268 10.7598 6.14645 10.8535C6.24021 10.9473 6.36739 11 6.5 11H11.5C11.6326 11 11.7598 10.9473 11.8536 10.8535C11.9473 10.7598 12 10.6326 12 10.5C12 10.3674 11.9473 10.2402 11.8536 10.1464C11.7598 10.0527 11.6326 9.99999 11.5 9.99999H6.5ZM6 13.5C6 13.3674 6.05268 13.2402 6.14645 13.1464C6.24021 13.0527 6.36739 13 6.5 13H11.5C11.6326 13 11.7598 13.0527 11.8536 13.1464C11.9473 13.2402 12 13.3674 12 13.5C12 13.6326 11.9473 13.7598 11.8536 13.8535C11.7598 13.9473 11.6326 14 11.5 14H6.5C6.36739 14 6.24021 13.9473 6.14645 13.8535C6.05268 13.7598 6 13.6326 6 13.5ZM6.5 16C6.36739 16 6.24021 16.0527 6.14645 16.1464C6.05268 16.2402 6 16.3674 6 16.5C6 16.6326 6.05268 16.7598 6.14645 16.8535C6.24021 16.9473 6.36739 17 6.5 17H11.5C11.6326 17 11.7598 16.9473 11.8536 16.8535C11.9473 16.7598 12 16.6326 12 16.5C12 16.3674 11.9473 16.2402 11.8536 16.1464C11.7598 16.0527 11.6326 16 11.5 16H6.5ZM13.146 16.146L15.146 14.146C15.1924 14.0994 15.2476 14.0625 15.3084 14.0373C15.3691 14.0121 15.4342 13.9991 15.5 13.9991C15.5658 13.9991 15.6309 14.0121 15.6916 14.0373C15.7524 14.0625 15.8076 14.0994 15.854 14.146L17.854 16.146C17.9479 16.2399 18.0006 16.3672 18.0006 16.5C18.0006 16.6328 17.9479 16.7601 17.854 16.854C17.7601 16.9479 17.6328 17.0006 17.5 17.0006C17.3672 17.0006 17.2399 16.9479 17.146 16.854L15.5 15.207L13.854 16.854C13.7601 16.9479 13.6328 17.0006 13.5 17.0006C13.3672 17.0006 13.2399 16.9479 13.146 16.854C13.0521 16.7601 12.9994 16.6328 12.9994 16.5C12.9994 16.3672 13.0521 16.2399 13.146 16.146ZM15.854 9.85399C15.8076 9.90055 15.7524 9.9375 15.6916 9.9627C15.6309 9.98791 15.5658 10.0009 15.5 10.0009C15.4342 10.0009 15.3691 9.98791 15.3084 9.9627C15.2476 9.9375 15.1924 9.90055 15.146 9.85399L13.146 7.85399C13.0995 7.8075 13.0626 7.75231 13.0375 7.69157C13.0123 7.63084 12.9994 7.56573 12.9994 7.49999C12.9994 7.43425 13.0123 7.36915 13.0375 7.30841C13.0626 7.24767 13.0995 7.19248 13.146 7.14599C13.2399 7.0521 13.3672 6.99936 13.5 6.99936C13.5657 6.99936 13.6308 7.01231 13.6916 7.03747C13.7523 7.06263 13.8075 7.0995 13.854 7.14599L15.5 8.79299L17.146 7.14599C17.2399 7.0521 17.3672 6.99936 17.5 6.99936C17.6328 6.99936 17.7601 7.0521 17.854 7.14599C17.9479 7.23988 18.0006 7.36722 18.0006 7.49999C18.0006 7.63277 17.9479 7.7601 17.854 7.85399L15.854 9.85399Z" fill="black"/>
|
|
77
|
+
</svg>
|
|
78
|
+
`,wT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
79
|
+
<path d="M10.9 15.3C13.3301 15.3 15.3 13.3301 15.3 10.9C15.3 8.46995 13.3301 6.5 10.9 6.5C8.46995 6.5 6.5 8.46995 6.5 10.9C6.5 13.3301 8.46995 15.3 10.9 15.3Z" stroke="black" stroke-width="1.2"/>
|
|
80
|
+
<path d="M14 14L17.5 17.5" stroke="black" stroke-width="1.2" stroke-linecap="round"/>
|
|
81
|
+
</svg>
|
|
82
|
+
`,CT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
83
|
+
<path d="M16.224 7.08201C16.3203 7.01897 16.4353 6.99099 16.5497 7.00275C16.6642 7.01451 16.7711 7.06531 16.8525 7.14661C16.9339 7.2279 16.9849 7.33475 16.9968 7.44918C17.0087 7.56362 16.9809 7.67867 16.918 7.77501L16.853 7.85301L12.707 12L16.853 16.146L16.918 16.224C16.9828 16.3202 17.0121 16.4359 17.0009 16.5514C16.9898 16.6668 16.9388 16.7748 16.8568 16.8568C16.7748 16.9388 16.6668 16.9898 16.5514 17.0009C16.4359 17.0121 16.3202 16.9828 16.224 16.918L16.146 16.853L12 12.706L7.85301 16.853C7.80688 16.9008 7.75171 16.9389 7.69071 16.9651C7.62971 16.9913 7.5641 17.0051 7.49771 17.0056C7.43132 17.0062 7.36548 16.9936 7.30403 16.9684C7.24258 16.9433 7.18676 16.9062 7.13981 16.8592C7.09286 16.8123 7.05574 16.7564 7.0306 16.695C7.00546 16.6335 6.9928 16.5677 6.99338 16.5013C6.99396 16.4349 7.00775 16.3693 7.03396 16.3083C7.06016 16.2473 7.09825 16.1921 7.14601 16.146L11.293 11.999L7.14601 7.85301L7.08201 7.77501C7.01953 7.67875 6.99199 7.56395 7.004 7.44982C7.01601 7.33569 7.06684 7.22914 7.14799 7.148C7.22914 7.06685 7.33569 7.01602 7.44982 7.00401C7.56395 6.992 7.67874 7.01953 7.77501 7.08201L7.85301 7.14601L12 11.293L16.146 7.14601L16.224 7.08201Z" fill="black"/>
|
|
84
|
+
</svg>
|
|
85
|
+
`,kT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
86
|
+
<path d="M16.224 7.08201C16.3202 7.01897 16.4353 6.99099 16.5497 7.00275C16.6642 7.01451 16.7711 7.06531 16.8525 7.14661C16.9339 7.2279 16.9849 7.33475 16.9968 7.44918C17.0087 7.56362 16.9809 7.67867 16.918 7.77501L16.853 7.85301L12.707 12L16.853 16.146L16.918 16.224C16.9828 16.3202 17.0121 16.4359 17.0009 16.5514C16.9898 16.6668 16.9388 16.7748 16.8568 16.8568C16.7748 16.9388 16.6668 16.9898 16.5514 17.0009C16.4359 17.0121 16.3202 16.9828 16.224 16.918L16.146 16.853L12 12.706L7.853 16.853C7.80688 16.9008 7.7517 16.9389 7.6907 16.9651C7.6297 16.9913 7.56409 17.0051 7.4977 17.0056C7.43131 17.0062 7.36547 16.9936 7.30402 16.9684C7.24257 16.9433 7.18675 16.9062 7.1398 16.8592C7.09285 16.8123 7.05573 16.7564 7.03059 16.695C7.00545 16.6335 6.9928 16.5677 6.99337 16.5013C6.99395 16.4349 7.00774 16.3693 7.03395 16.3083C7.06015 16.2473 7.09824 16.1921 7.146 16.146L11.293 11.999L7.146 7.85301L7.082 7.77501C7.01952 7.67875 6.99198 7.56395 7.00399 7.44982C7.01601 7.33569 7.06683 7.22914 7.14798 7.148C7.22913 7.06685 7.33568 7.01602 7.44981 7.00401C7.56394 6.992 7.67874 7.01953 7.775 7.08201L7.853 7.14601L12 11.293L16.146 7.14601L16.224 7.08201Z" fill="black"/>
|
|
87
|
+
</svg>
|
|
88
|
+
`,ST=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
89
|
+
<path d="M11.2 16.5C11.2 17.325 10.48 18 9.6 18C8.72 18 8 17.325 8 16.5C8 15.675 8.72 15 9.6 15C10.48 15 11.2 15.675 11.2 16.5ZM9.6 10.5C8.72 10.5 8 11.175 8 12C8 12.825 8.72 13.5 9.6 13.5C10.48 13.5 11.2 12.825 11.2 12C11.2 11.175 10.48 10.5 9.6 10.5ZM9.6 6C8.72 6 8 6.675 8 7.5C8 8.325 8.72 9 9.6 9C10.48 9 11.2 8.325 11.2 7.5C11.2 6.675 10.48 6 9.6 6ZM14.4 9C15.28 9 16 8.325 16 7.5C16 6.675 15.28 6 14.4 6C13.52 6 12.8 6.675 12.8 7.5C12.8 8.325 13.52 9 14.4 9ZM14.4 10.5C13.52 10.5 12.8 11.175 12.8 12C12.8 12.825 13.52 13.5 14.4 13.5C15.28 13.5 16 12.825 16 12C16 11.175 15.28 10.5 14.4 10.5ZM14.4 15C13.52 15 12.8 15.675 12.8 16.5C12.8 17.325 13.52 18 14.4 18C15.28 18 16 17.325 16 16.5C16 15.675 15.28 15 14.4 15Z" fill="black"/>
|
|
90
|
+
</svg>
|
|
91
|
+
`,ET=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
92
|
+
<path d="M7.55566 15.0557C7.83175 15.0557 8.05566 15.2796 8.05566 15.5557V17.333C8.0556 17.6091 7.83171 17.8329 7.55566 17.833C7.27956 17.833 7.05573 17.6091 7.05566 17.333V15.5557C7.05566 15.2795 7.27952 15.0557 7.55566 15.0557Z" fill="black"/>
|
|
93
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.2129 4.00488C10.7173 4.05595 11.1113 4.48213 11.1113 5V7.6709L12.1865 6.50781C13.1498 5.46536 14.7864 5.43292 15.79 6.43652L17.5039 8.14941C18.48 9.12563 18.4799 10.7083 17.5039 11.6846L16.7998 12.3887H19C19.8284 12.3887 20.4999 13.0603 20.5 13.8887V18.5557C20.4998 19.3839 19.8283 20.0557 19 20.0557H7.55566V20L7.37305 19.9951C5.49425 19.9001 4 18.3468 4 16.4443V5C4 4.44772 4.44773 4 5 4H10.1113L10.2129 4.00488ZM10.1328 19.0557H15.0557V14.1328L10.1328 19.0557ZM16.0557 19.0557H19C19.276 19.0557 19.4998 18.8317 19.5 18.5557V13.8887C19.4999 13.6126 19.2761 13.3887 19 13.3887H16.0557V19.0557ZM5 16.4443C5 17.8557 6.14431 19 7.55566 19C8.96692 18.9999 10.1113 17.8557 10.1113 16.4443V13.3887H5V16.4443ZM11.1113 16.4443L11.1064 16.627C11.1057 16.6417 11.1035 16.6562 11.1025 16.6709L12.4219 15.3506L11.1113 14.04V16.4443ZM11.1113 12.626L13.1289 14.6436L14.7139 13.0596L11.1113 9.45703V12.626ZM5 12.3887H10.1113V8.94434H5V12.3887ZM15.083 7.14355C14.4808 6.54138 13.4988 6.56094 12.9209 7.18652L11.6406 8.57129L15.4209 12.3525L16.7969 10.9775C17.3823 10.3918 17.3825 9.44214 16.7969 8.85645L15.083 7.14355ZM5 7.94434H10.1113V5H5V7.94434Z" fill="black"/>
|
|
94
|
+
</svg>
|
|
95
|
+
`,$T=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
96
|
+
<path d="M18 4L18 20M12 9L12 20M6 14L6 20" stroke="black"/>
|
|
97
|
+
</svg>
|
|
98
|
+
`,MT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
99
|
+
<path d="M7.64687 7.16532C8.88398 6.04924 10.5024 5.45085 12.1681 5.4937C13.8337 5.53655 15.4192 6.21739 16.5973 7.39561L16.8573 7.67232C17.9891 8.94539 18.576 10.6119 18.4916 12.3133L18.4646 12.6661C18.3207 14.0543 17.0569 14.7768 15.9389 14.7768H13.3928L13.299 14.786C13.1942 14.8075 13.0999 14.8644 13.0322 14.9473C12.9645 15.0303 12.9276 15.134 12.9276 15.241V15.7053C12.9276 16.4667 12.6138 17.1938 12.0733 17.6804C11.5162 18.1837 10.7102 18.4232 9.87263 18.1335C9.06401 17.8534 8.31867 17.4163 7.67937 16.8475L7.40358 16.5875C6.79994 15.9839 6.32109 15.2673 5.9944 14.4786C5.66771 13.69 5.49956 12.8447 5.49956 11.9911C5.49956 11.1374 5.66771 10.2921 5.9944 9.50349C6.32109 8.71484 6.79994 7.99826 7.40358 7.39468L7.64687 7.16532ZM15.9389 8.0521C14.8941 7.00734 13.4771 6.42041 11.9995 6.42041C10.522 6.42041 9.1049 7.00734 8.06008 8.0521L7.86322 8.26103C7.24694 8.94412 6.80942 9.7692 6.58971 10.6626C6.37 11.556 6.37496 12.4899 6.60412 13.3809C6.83329 14.2719 7.27954 15.0923 7.90302 15.7688C8.52651 16.4453 9.30782 16.9569 10.1772 17.2579C11.0853 17.5708 11.8932 16.8335 11.9907 15.8957L12 15.7053V15.242C12 14.8726 12.1467 14.5183 12.4079 14.2571C12.6691 13.9959 13.0234 13.8491 13.3928 13.8491H15.9399L16.0866 13.8436C16.7672 13.7906 17.3782 13.3672 17.5194 12.7144L17.5416 12.5705C17.6222 11.8002 17.5412 11.0217 17.3039 10.2844C17.0667 9.54724 16.6783 8.86759 16.1637 8.28888L15.9389 8.0521ZM8.75 11.992C8.99627 11.992 9.23245 12.0898 9.40659 12.264C9.58073 12.4381 9.67856 12.6743 9.67856 12.9206C9.67856 13.1668 9.58073 13.403 9.40659 13.5772C9.23245 13.7513 8.99627 13.8491 8.75 13.8491C8.50373 13.8491 8.26755 13.7513 8.09341 13.5772C7.91927 13.403 7.82144 13.1668 7.82144 12.9206C7.82144 12.6743 7.91927 12.4381 8.09341 12.264C8.26755 12.0898 8.50373 11.992 8.75 11.992ZM15.2499 10.1349C15.4962 10.135 15.7324 10.2329 15.9064 10.4072C16.0805 10.5814 16.1782 10.8176 16.178 11.0639C16.1779 11.3102 16.08 11.5463 15.9057 11.7204C15.7315 11.8944 15.4953 11.9921 15.249 11.992C15.0027 11.992 14.7666 11.8942 14.5924 11.72C14.4183 11.5459 14.3205 11.3097 14.3205 11.0634C14.3205 10.8172 14.4183 10.581 14.5924 10.4068C14.7666 10.2327 15.0027 10.1349 15.249 10.1349M9.67763 8.74202C9.92403 8.74202 10.1603 8.8399 10.3346 9.01413C10.5088 9.18836 10.6067 9.42466 10.6067 9.67105C10.6067 9.91744 10.5088 10.1537 10.3346 10.328C10.1603 10.5022 9.92403 10.6001 9.67763 10.6001C9.43136 10.6001 9.19518 10.5022 9.02104 10.3281C8.8469 10.154 8.74907 9.91779 8.74907 9.67152C8.74907 9.42524 8.8469 9.18906 9.02104 9.01492C9.19518 8.84078 9.43136 8.74202 9.67763 8.74202ZM12.9276 7.81439C13.1739 7.81439 13.4101 7.91222 13.5842 8.08636C13.7583 8.2605 13.8562 8.49668 13.8562 8.74295C13.8562 8.98922 13.7583 9.22541 13.5842 9.39955C13.4101 9.57368 13.1739 9.67152 12.9276 9.67152C12.6813 9.67152 12.4452 9.57368 12.271 9.39955C12.0969 9.22541 11.999 8.98922 11.999 8.74295C11.999 8.49668 12.0969 8.2605 12.271 8.08636C12.4452 7.91222 12.6813 7.81439 12.9276 7.81439Z" fill="black"/>
|
|
100
|
+
</svg>
|
|
101
|
+
`,DT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
102
|
+
<path d="M16 6C16.5304 6 17.0391 6.21071 17.4142 6.58579C17.7893 6.96086 18 7.46957 18 8V16C18 16.5304 17.7893 17.0391 17.4142 17.4142C17.0391 17.7893 16.5304 18 16 18H8C7.46957 18 6.96086 17.7893 6.58579 17.4142C6.21071 17.0391 6 16.5304 6 16V8C6 7.46957 6.21071 6.96086 6.58579 6.58579C6.96086 6.21071 7.46957 6 8 6H16ZM8 7C7.73478 7 7.48043 7.10536 7.29289 7.29289C7.10536 7.48043 7 7.73478 7 8V16C7 16.2652 7.10536 16.5196 7.29289 16.7071C7.48043 16.8946 7.73478 17 8 17H16C16.2652 17 16.5196 16.8946 16.7071 16.7071C16.8946 16.5196 17 16.2652 17 16V8C17 7.73478 16.8946 7.48043 16.7071 7.29289C16.5196 7.10536 16.2652 7 16 7H8ZM11.05 9.002C11.1819 9.01514 11.3033 9.08015 11.3873 9.18273C11.4713 9.28531 11.5111 9.41706 11.498 9.549L11.453 10.001H12.948L13.003 9.451C13.0183 9.32096 13.0841 9.20213 13.1861 9.12004C13.2881 9.03795 13.4183 8.99916 13.5486 9.01199C13.6789 9.02483 13.799 9.08827 13.883 9.18868C13.967 9.28909 14.0083 9.41847 13.998 9.549L13.953 10.001H14.5C14.6326 10.001 14.7598 10.0537 14.8536 10.1474C14.9473 10.2412 15 10.3684 15 10.501C15 10.6336 14.9473 10.7608 14.8536 10.8546C14.7598 10.9483 14.6326 11.001 14.5 11.001H13.852L13.653 13.001H14.5C14.6326 13.001 14.7598 13.0537 14.8536 13.1474C14.9473 13.2412 15 13.3684 15 13.501C15 13.6336 14.9473 13.7608 14.8536 13.8546C14.7598 13.9483 14.6326 14.001 14.5 14.001H13.552L13.498 14.549C13.4772 14.6744 13.4095 14.7873 13.3086 14.8647C13.2077 14.942 13.0812 14.9781 12.9546 14.9657C12.8281 14.9532 12.711 14.8931 12.6272 14.7975C12.5433 14.702 12.4989 14.5781 12.503 14.451L12.547 14.001H11.052L10.998 14.549C10.9772 14.6744 10.9095 14.7873 10.8086 14.8647C10.7077 14.942 10.5812 14.9781 10.4546 14.9657C10.3281 14.9532 10.211 14.8931 10.1272 14.7975C10.0433 14.702 9.99892 14.5781 10.003 14.451L10.047 14.001H9.5C9.36739 14.001 9.24021 13.9483 9.14645 13.8546C9.05268 13.7608 9 13.6336 9 13.501C9 13.3684 9.05268 13.2412 9.14645 13.1474C9.24021 13.0537 9.36739 13.001 9.5 13.001H10.147L10.347 11.001H9.5C9.36739 11.001 9.24021 10.9483 9.14645 10.8546C9.05268 10.7608 9 10.6336 9 10.501C9 10.3684 9.05268 10.2412 9.14645 10.1474C9.24021 10.0537 9.36739 10.001 9.5 10.001H10.448L10.503 9.451C10.5159 9.31907 10.5807 9.19766 10.683 9.11347C10.7854 9.02927 10.9171 8.98918 11.049 9.002M11.351 11.001L11.152 13.001H12.646L12.846 11.001H11.351Z" fill="black"/>
|
|
103
|
+
</svg>
|
|
104
|
+
`,NT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
105
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 7H16C16.2652 7 16.5196 7.10536 16.7071 7.29289C16.8946 7.48043 17 7.73478 17 8V16C17 16.2652 16.8946 16.5196 16.7071 16.7071C16.5196 16.8946 16.2652 17 16 17H8C7.73478 17 7.48043 16.8946 7.29289 16.7071C7.10536 16.5196 7 16.2652 7 16V8C7 7.73478 7.10536 7.48043 7.29289 7.29289C7.48043 7.10536 7.73478 7 8 7ZM6 8C6 7.46957 6.21071 6.96086 6.58579 6.58579C6.96086 6.21071 7.46957 6 8 6H16C16.5304 6 17.0391 6.21071 17.4142 6.58579C17.7893 6.96086 18 7.46957 18 8V16C18 16.5304 17.7893 17.0391 17.4142 17.4142C17.0391 17.7893 16.5304 18 16 18H8C7.46957 18 6.96086 17.7893 6.58579 17.4142C6.21071 17.0391 6 16.5304 6 16V8ZM9.5 9C9.36739 9 9.24021 9.05268 9.14645 9.14645C9.05268 9.24021 9 9.36739 9 9.5V10.5C9 10.6326 9.05268 10.7598 9.14645 10.8536C9.24021 10.9473 9.36739 11 9.5 11C9.63261 11 9.75979 10.9473 9.85355 10.8536C9.94732 10.7598 10 10.6326 10 10.5V10H11.5V14H11C10.8674 14 10.7402 14.0527 10.6464 14.1464C10.5527 14.2402 10.5 14.3674 10.5 14.5C10.5 14.6326 10.5527 14.7598 10.6464 14.8536C10.7402 14.9473 10.8674 15 11 15H13C13.1326 15 13.2598 14.9473 13.3536 14.8536C13.4473 14.7598 13.5 14.6326 13.5 14.5C13.5 14.3674 13.4473 14.2402 13.3536 14.1464C13.2598 14.0527 13.1326 14 13 14H12.5V10H14V10.5C14 10.6326 14.0527 10.7598 14.1464 10.8536C14.2402 10.9473 14.3674 11 14.5 11C14.6326 11 14.7598 10.9473 14.8536 10.8536C14.9473 10.7598 15 10.6326 15 10.5V9.5C15 9.36739 14.9473 9.24021 14.8536 9.14645C14.7598 9.05268 14.6326 9 14.5 9H9.5Z" fill="black"/>
|
|
106
|
+
</svg>
|
|
107
|
+
`,AT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
108
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 8H14C15.0609 8 16.0783 8.42143 16.8284 9.17157C17.5786 9.92172 18 10.9391 18 12C18 13.0609 17.5786 14.0783 16.8284 14.8284C16.0783 15.5786 15.0609 16 14 16H10C8.93913 16 7.92172 15.5786 7.17157 14.8284C6.42143 14.0783 6 13.0609 6 12C6 10.9391 6.42143 9.92172 7.17157 9.17157C7.92172 8.42143 8.93913 8 10 8ZM5 12C5 10.6739 5.52678 9.40215 6.46447 8.46447C7.40215 7.52678 8.67392 7 10 7H14C15.3261 7 16.5979 7.52678 17.5355 8.46447C18.4732 9.40215 19 10.6739 19 12C19 13.3261 18.4732 14.5979 17.5355 15.5355C16.5979 16.4732 15.3261 17 14 17H10C8.67392 17 7.40215 16.4732 6.46447 15.5355C5.52678 14.5979 5 13.3261 5 12ZM10 14C9.46957 14 8.96086 13.7893 8.58579 13.4142C8.21071 13.0391 8 12.5304 8 12C8 11.4696 8.21071 10.9609 8.58579 10.5858C8.96086 10.2107 9.46957 10 10 10C10.5304 10 11.0391 10.2107 11.4142 10.5858C11.7893 10.9609 12 11.4696 12 12C12 12.5304 11.7893 13.0391 11.4142 13.4142C11.0391 13.7893 10.5304 14 10 14ZM7 12C7 11.2044 7.31607 10.4413 7.87868 9.87868C8.44129 9.31607 9.20435 9 10 9C10.7956 9 11.5587 9.31607 12.1213 9.87868C12.6839 10.4413 13 11.2044 13 12C13 12.7956 12.6839 13.5587 12.1213 14.1213C11.5587 14.6839 10.7956 15 10 15C9.20435 15 8.44129 14.6839 7.87868 14.1213C7.31607 13.5587 7 12.7956 7 12Z" fill="black"/>
|
|
109
|
+
</svg>
|
|
110
|
+
`,TT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
111
|
+
<path d="M7 9.5L12 14.5L17 9.5" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
112
|
+
</svg>
|
|
113
|
+
`,PT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
114
|
+
<path d="M12.9167 9.25H7.41667C6.91041 9.25 6.5 9.66041 6.5 10.1667V16.5833C6.5 17.0896 6.91041 17.5 7.41667 17.5H12.9167C13.4229 17.5 13.8333 17.0896 13.8333 16.5833V10.1667C13.8333 9.66041 13.4229 9.25 12.9167 9.25Z" stroke="black"/>
|
|
115
|
+
<path d="M9.25 9.25V7.41667C9.25 7.17355 9.34658 6.94039 9.51849 6.76849C9.69039 6.59658 9.92355 6.5 10.1667 6.5H16.5833C16.8264 6.5 17.0596 6.59658 17.2315 6.76849C17.4034 6.94039 17.5 7.17355 17.5 7.41667V13.8333C17.5 14.0764 17.4034 14.3096 17.2315 14.4815C17.0596 14.6534 16.8264 14.75 16.5833 14.75H14.75" stroke="black"/>
|
|
116
|
+
</svg>
|
|
117
|
+
`,LT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
118
|
+
<path d="M16.5 4.5L18.6304 6.63043M6.56522 14.3044L5.5 17.5L8.69565 16.4348L17.2174 7.91306L15.087 5.78262L6.56522 14.3044Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
|
119
|
+
</svg>
|
|
120
|
+
`,IT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
121
|
+
<path d="M10.9219 6.5L11.0674 6.64648L12.3496 7.92871H17.8574C18.3687 7.92878 18.8591 8.13168 19.2207 8.49316C19.5824 8.85484 19.7861 9.34593 19.7861 9.85742V15.5713C19.7861 16.0828 19.5824 16.5739 19.2207 16.9355C18.8591 17.297 18.3687 17.4999 17.8574 17.5H6.42871C5.91722 17.5 5.42613 17.2972 5.06445 16.9355C4.70278 16.5739 4.5 16.0828 4.5 15.5713V8.42871C4.5 7.91722 4.70278 7.42613 5.06445 7.06445C5.42613 6.70278 5.91722 6.5 6.42871 6.5H10.9219Z" stroke="black"/>
|
|
122
|
+
</svg>
|
|
123
|
+
`,RT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
124
|
+
<path d="M8.33333 10.1667C9.34586 10.1667 10.1667 9.34586 10.1667 8.33333C10.1667 7.32081 9.34586 6.5 8.33333 6.5C7.32081 6.5 6.5 7.32081 6.5 8.33333C6.5 9.34586 7.32081 10.1667 8.33333 10.1667Z" stroke="black" stroke-width="1.2"/>
|
|
125
|
+
<path d="M15.6667 10.1667C16.6792 10.1667 17.5 9.34586 17.5 8.33333C17.5 7.32081 16.6792 6.5 15.6667 6.5C14.6542 6.5 13.8333 7.32081 13.8333 8.33333C13.8333 9.34586 14.6542 10.1667 15.6667 10.1667Z" stroke="black" stroke-width="1.2"/>
|
|
126
|
+
<path d="M12 17.5C13.0125 17.5 13.8333 16.6792 13.8333 15.6667C13.8333 14.6542 13.0125 13.8333 12 13.8333C10.9875 13.8333 10.1667 14.6542 10.1667 15.6667C10.1667 16.6792 10.9875 17.5 12 17.5Z" stroke="black" stroke-width="1.2"/>
|
|
127
|
+
<path d="M9.70834 9.70834L11.0833 13.8333M14.2917 9.70834L12.9167 13.8333M10.1667 8.33334H13.8333" stroke="black" stroke-width="1.2" stroke-linecap="round"/>
|
|
128
|
+
</svg>
|
|
129
|
+
`,BT=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
130
|
+
<path d="M4 6H20M4 12H20M4 18H20" stroke="black"/>
|
|
131
|
+
</svg>
|
|
132
|
+
`,OT={plus:hT,refresh:pT,undo:mT,redo:gT,expand:yT,collapse:xT,"expand-all":vT,"collapse-all":bT,search:wT,trash:CT,close:kT,drag:ST,shades:ET,steps:$T,color:MT,float:DT,string:NT,boolean:AT,triangle:TT,copy:PT,edit:LT,folder:IT,relationships:RT,menu:BT};function tt({name:t,size:e=24,className:n=""}){const i=OT[t].replace(/width="24"/,`width="${e}"`).replace(/height="24"/,`height="${e}"`).replace(/fill="black"/g,'fill="currentColor"').replace(/stroke="black"/g,'stroke="currentColor"');return g.jsx("span",{className:`inline-block leading-0 ${n}`,dangerouslySetInnerHTML:{__html:i}})}const td={COLOR:g.jsx(tt,{name:"color"}),FLOAT:g.jsx(tt,{name:"float"}),STRING:g.jsx(tt,{name:"string"}),BOOLEAN:g.jsx(tt,{name:"boolean"})};function M5(){return g.jsx(tt,{name:"plus"})}function jT(){return g.jsx(tt,{name:"close"})}function Fp(){return g.jsx(tt,{name:"refresh"})}function VT(){return g.jsx(tt,{name:"undo"})}function FT(){return g.jsx(tt,{name:"redo"})}function _T(){return g.jsx(tt,{name:"expand"})}function HT(){return g.jsx(tt,{name:"collapse"})}function D5(){return g.jsx(tt,{name:"expand-all"})}function N5(){return g.jsx(tt,{name:"collapse-all"})}function zT(){return g.jsx(tt,{name:"triangle"})}function nd(){return g.jsx(tt,{name:"shades"})}function A5(){return g.jsx(tt,{name:"steps"})}function WT(){return g.jsx(tt,{name:"copy"})}function Px(){return g.jsx(tt,{name:"trash"})}function GT(){return g.jsx(tt,{name:"search"})}function UT(){return g.jsx(tt,{name:"edit"})}function _p({type:t}){return td[t]||null}function KT({label:t,isActive:e,onClick:n}){return g.jsx("button",{className:`tab leading-none p-4 border-2 border-solid border-transparent ${e?"active font-bold border-b-primary":""}`,onClick:n,children:t})}const YT=[{id:"table",label:"Table"},{id:"relationships",label:"Relationships"},{id:"json",label:"JSON"},{id:"settings",label:"Settings"}],sg={width:750,height:500};function XT({activeTab:t,onTabChange:e,canUndo:n,canRedo:r}){const[i,s]=be.useState(!1),[o,l]=be.useState(sg);be.useEffect(()=>{const f=Math.max(400,window.screen.availWidth-20),h=Math.max(300,window.screen.availHeight-100);Se({type:"resize",width:f,height:h}),s(!0)},[]);const a=()=>{Se({type:"refresh"})},u=()=>{n&&Se({type:"undo"})},c=()=>{r&&Se({type:"redo"})},d=()=>{if(i){const f=o.width||sg.width,h=o.height||sg.height;Se({type:"resize",width:f,height:h}),s(!1)}else{l({width:window.innerWidth,height:window.innerHeight});const f=Math.max(400,window.screen.availWidth-20),h=Math.max(300,window.screen.availHeight-100);Se({type:"resize",width:f,height:h}),s(!0)}};return g.jsxs("div",{className:"tabs flex items-center justify-between border-b border-border",children:[g.jsx("div",{children:YT.map(f=>g.jsx(KT,{label:f.label,isActive:t===f.id,onClick:()=>e(f.id)},f.id))}),g.jsxs("div",{className:"flex mr-4 gap-2",children:[g.jsx(On,{id:"undo-btn",icon:g.jsx(VT,{}),onClick:u,disabled:!n,title:"Undo (Ctrl/Cmd+Z)","aria-label":"Undo"}),g.jsx(On,{id:"redo-btn",icon:g.jsx(FT,{}),onClick:c,disabled:!r,title:"Redo (Ctrl/Cmd+Shift+Z)","aria-label":"Redo"}),g.jsx(On,{id:"refresh-btn",icon:g.jsx(Fp,{}),onClick:a,title:"Refresh","aria-label":"Refresh"}),g.jsx(On,{id:"expand-btn",icon:i?g.jsx(HT,{}):g.jsx(_T,{}),onClick:d,title:i?"Collapse":"Expand","aria-label":i?"Collapse":"Expand"})]})]})}function xc({label:t,children:e,className:n=""}){const[r,i]=w.useState(!1),s=w.useRef(null);return w.useEffect(()=>{if(!r)return;const o=l=>{s.current&&!s.current.contains(l.target)&&i(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[r]),w.useEffect(()=>{if(!r)return;const o=l=>{l.key==="Escape"&&i(!1)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[r]),g.jsxs("div",{className:`relative ${n}`.trim(),ref:s,children:[g.jsx(is,{variant:"ghost",icon:g.jsx(zT,{}),iconPosition:"right",onClick:()=>i(!r),"aria-expanded":r,"aria-haspopup":"menu",children:t}),r&&g.jsx("div",{className:"absolute top-full left-0 mt-1 bg-base border border-border rounded shadow-lg z-50 min-w-[200px] p-2",children:e})]})}function qT(t,e){if(!e)return null;for(const n of t){const r=n.modes.find(i=>i.modeId===e);if(r)return r.name}return null}function Qo(t,e,n){const r=t.find(s=>s.id===e);if(!r||r.modes.length===0)return null;if(n&&r.modes.some(s=>s.modeId===n))return n;const i=qT(t,n);if(i){const s=r.modes.find(o=>o.name===i);if(s)return s.modeId}return r.modes[0].modeId}function ia(t,e,n){const r=Qo(t,e.collectionId,n);return r&&e.valuesByMode[r]!==void 0?e.valuesByMode[r]:e.value}function QT(t,e,n,r,i=10){const s=/^\{(.+)\}$/;let o=n;for(let l=0;l<i;l++){const a=o.match(s);if(!a)return o;const u=e.find(c=>c.name===a[1]);if(!u)return o;o=ia(t,u,r)}return o}function ZT(t){if(!t)return"#000000";if(t.startsWith("#"))return t;const e=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return e?"#"+[e[1],e[2],e[3]].map(n=>parseInt(n).toString(16).padStart(2,"0")).join(""):"#000000"}function Sa(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?`rgb(${parseInt(e[1],16)}, ${parseInt(e[2],16)}, ${parseInt(e[3],16)})`:t}function JT(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16),...e[4]!==void 0?{a:parseInt(e[4],16)/255}:{}}:{r:0,g:0,b:0}}function Zo(t){const e="#"+[t.r,t.g,t.b].map(n=>Math.round(n).toString(16).padStart(2,"0")).join("");return t.a===void 0||t.a>=1?e:e+Math.round(t.a*255).toString(16).padStart(2,"0")}function eP(t,e,n){e/=100,n/=100;const r=Math.floor(t/60)%6,i=t/60-Math.floor(t/60),s=n*(1-e),o=n*(1-i*e),l=n*(1-(1-i)*e);let a,u,c;switch(r){case 0:a=n,u=l,c=s;break;case 1:a=o,u=n,c=s;break;case 2:a=s,u=n,c=l;break;case 3:a=s,u=o,c=n;break;case 4:a=l,u=s,c=n;break;default:a=n,u=s,c=o;break}return{r:Math.round(a*255),g:Math.round(u*255),b:Math.round(c*255)}}function tP(t,e,n){t/=255,e/=255,n/=255;const r=Math.max(t,e,n),i=Math.min(t,e,n),s=r-i;let o=0;const l=r===0?0:s/r,a=r;if(s!==0)switch(r){case t:o=((e-n)/s+(e<n?6:0))*60;break;case e:o=((n-t)/s+2)*60;break;case n:o=((t-e)/s+4)*60;break}return{h:o,s:l*100,v:a*100}}function nP(t,e){if(e<=50){const n=e/50,r={r:Math.round(255+(t.r-255)*n),g:Math.round(255+(t.g-255)*n),b:Math.round(255+(t.b-255)*n)};return Zo(r)}else{const n=(e-50)/50,r={r:Math.round(t.r*(1-n)),g:Math.round(t.g*(1-n)),b:Math.round(t.b*(1-n))};return Zo(r)}}function T5(t){if(t===5)return["100","300","500","700","900"];if(t===10)return["50","100","200","300","400","500","600","700","800","900"];if(t===11)return["50","100","200","300","400","500","600","700","800","900","950"];const e=[];for(let n=0;n<t;n++){const r=Math.round(50+n/(t-1)*900);e.push(String(r))}return e}function rP(t,e,n,r,i){if(e<=1)return 50;const o=Math.max(0,Math.min(e-1,Math.round(n)))/(e-1),l=Math.max(0,Math.min(1,t));if(l<=o){const u=o===0?0:l/o;return r+(50-r)*u}const a=o===1?0:(l-o)/(1-o);return 50+(i-50)*a}function Ir(t){if(!t)return null;if(t.startsWith("#"))return JT(t);const e=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?/);return e?{r:parseInt(e[1]),g:parseInt(e[2]),b:parseInt(e[3]),...e[4]!==void 0?{a:parseFloat(e[4])}:{}}:null}function h4(t){const[e,n,r]=[t.r,t.g,t.b].map(i=>(i=i/255,i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)));return .2126*e+.7152*n+.0722*r}function iP(t,e){const n=h4(t),r=h4(e),i=Math.max(n,r),s=Math.min(n,r);return(i+.05)/(s+.05)}function sP(t,e){const n=iP(t,e);return{ratio:Math.round(n*100)/100,aa:n>=4.5,aaa:n>=7,aaLarge:n>=3}}function oP(t,e,n){t/=255,e/=255,n/=255;const r=Math.max(t,e,n),i=Math.min(t,e,n),s=(r+i)/2;let o=0,l=0;if(r!==i){const a=r-i;switch(l=s>.5?a/(2-r-i):a/(r+i),r){case t:o=((e-n)/a+(e<n?6:0))/6;break;case e:o=((n-t)/a+2)/6;break;case n:o=((t-e)/a+4)/6;break}}return{h:Math.round(o*360),s:Math.round(l*100),l:Math.round(s*100)}}function lP(t,e,n,r,i,s,o,l){const a=[],u=tP(n.r,n.g,n.b);for(let c=0;c<r;c++){const d=c/(r-1),f=rP(d,r,i,t,e),h=Math.max(0,Math.min(100,f+(s[c]||0))),m=Math.max(0,Math.min(100,u.s+(o[c]||0))),x=(u.h+(l[c]||0)+360)%360,v=eP(x,m,u.v);a.push(nP(v,h))}return a}const Lx=be.forwardRef(({className:t="",...e},n)=>g.jsx("input",{ref:n,className:`flex-1 max-w-full py-1.5 h-full border-none bg-transparent outline-none focus:bg-bg-input ${t}`,...e}));Lx.displayName="InputTable";function ti({color:t,onClick:e,className:n="",title:r}){return g.jsx("div",{className:`bg-checkerboard w-5 h-5 rounded border border-border ${e?"cursor-pointer":""} relative overflow-hidden shrink-0 ${n}`,onClick:e,title:r,children:g.jsx("div",{className:"absolute inset-0",style:{background:t}})})}function aP({color:t,onPickColor:e,onReferenceColor:n}){const[r,i]=w.useState(!1),s=w.useRef(null);w.useEffect(()=>{if(!r)return;const a=u=>{s.current&&!s.current.contains(u.target)&&i(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[r]),w.useEffect(()=>{if(!r)return;const a=u=>{u.key==="Escape"&&i(!1)};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[r]);const o=()=>{i(!1),e()},l=()=>{i(!1),n()};return g.jsxs("div",{className:"relative",ref:s,children:[g.jsx(ti,{color:t,onClick:()=>i(!r)}),r&&g.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-base border border-border rounded-lg shadow-lg py-1 min-w-[160px]",children:[g.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-text bg-transparent hover:bg-base-2 transition-colors text-left",onClick:o,children:[g.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-4 h-4",children:g.jsx(nd,{})}),g.jsx("span",{className:"flex-1",children:"Pick Color"})]}),g.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-text bg-transparent hover:bg-base-2 transition-colors text-left",onClick:l,children:[g.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-4 h-4",children:td.COLOR}),g.jsx("span",{className:"flex-1",children:"Reference Color"})]})]})]})}function uP({variable:t,modifierButton:e}){const{collections:n,variables:r,selectedModeId:i}=Zt(),{openColorPicker:s,openColorReference:o}=ar(),l=ia(n,t,i),[a,u]=w.useState(l),c=w.useCallback(h=>{const m=Qo(n,t.collectionId,i);Se({type:"update-variable-value",id:t.id,value:h,modeId:m})},[n,t.collectionId,t.id,i]),d=w.useCallback(()=>{a!==l&&c(a)},[a,l,c]);be.useEffect(()=>{u(l)},[l]);const f=g.jsx(Lx,{value:a,onChange:h=>u(h.target.value),onBlur:d});if(t.resolvedType==="COLOR"){const h=/^\{(.+)\}$/.test(l),m=QT(n,r,l,i),x=Ir(m),v=x?Zo(x):h?"#888888":m,p=Qo(n,t.collectionId,i),y=()=>{s({initialColor:l,onConfirm:C=>{Se({type:"update-variable-value",id:t.id,value:Sa(C),modeId:p})}})},b=()=>{o({currentVariableId:t.id,currentValue:l,onSelect:C=>{Se({type:"update-variable-value",id:t.id,value:`{${C}}`,modeId:p})}})};return g.jsxs("div",{className:"flex items-center gap-2 h-full",children:[g.jsx(aP,{color:v,onPickColor:y,onReferenceColor:b}),f,e]})}return t.resolvedType==="BOOLEAN"?g.jsxs("div",{className:"px-2.5 h-full flex items-center gap-2",children:[g.jsxs("div",{className:"flex border border-border rounded overflow-hidden",children:[g.jsx(Ye,{size:"sm",className:`rounded-none border-r border-border ${l==="true"?"bg-primary text-base":"bg-transparent"}`,onClick:()=>c("true"),children:"True"}),g.jsx(Ye,{size:"sm",className:`rounded-none ${l==="false"?"bg-primary text-base":"bg-transparent"}`,onClick:()=>c("false"),children:"False"})]}),e]}):g.jsxs("div",{className:"flex items-center h-full pl-2.5 gap-2",children:[f,e]})}const Hp=w.forwardRef(({label:t,description:e,error:n,className:r="",id:i,...s},o)=>{const l=i||`radio-${Math.random().toString(36).substr(2,9)}`,a=`appearance-none w-5 h-5 rounded-full border-2 border-zinc-300 cursor-pointer flex-shrink-0 mt-0.5
|
|
133
|
+
checked:bg-primary checked:border-primary
|
|
134
|
+
focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
|
|
135
|
+
relative
|
|
136
|
+
after:content-[''] after:absolute after:inset-0 after:m-auto after:w-2 after:h-2 after:rounded-full after:bg-base after:opacity-0
|
|
137
|
+
checked:after:opacity-100`;return t?g.jsxs("div",{className:`block ${r}`,children:[g.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[g.jsx("input",{ref:o,type:"radio",id:l,className:a,"aria-invalid":!!n,"aria-describedby":n?`${l}-error`:void 0,...s}),g.jsxs("div",{className:"flex-1",children:[g.jsx("span",{className:"block text-sm font-medium text-text leading-tight",children:t}),e&&g.jsx("div",{className:"block text-sm text-text opacity-60 mt-0.5 leading-tight",children:e})]})]}),n&&g.jsx("span",{id:`${l}-error`,className:"text-xs text-danger mt-1 ml-8",role:"alert",children:n})]}):g.jsx("input",{ref:o,type:"radio",id:l,className:`${a} ${r}`,"aria-invalid":!!n,"aria-describedby":n?`${l}-error`:void 0,...s})});Hp.displayName="Radio";function cP({variable:t}){const{collections:e}=Zt(),n=e.find(s=>s.id===t.collectionId),r=n?n.name:"Unknown",i=s=>{s!==t.collectionId&&Se({type:"move-variable-to-collection",variableId:t.id,targetCollectionId:s})};return e.length===0?g.jsx("div",{className:"collection-cell-empty",children:"—"}):g.jsx("div",{className:"collection-cell",children:g.jsx(xc,{label:r,children:e.map(s=>g.jsx(Hp,{className:"dropdown-item",name:"collection-cell",label:s.name,checked:t.collectionId===s.id,onChange:()=>i(s.id)},s.id))})})}function a1({contrastColor:t,onPickColor:e,onReferenceColor:n,onClear:r}){return g.jsxs(g.Fragment,{children:[t&&g.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-text bg-transparent hover:bg-base-2 transition-colors text-left",onClick:r,children:[g.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-4 h-4",children:g.jsx(ti,{color:t,className:"w-4 h-4"})}),g.jsx("span",{className:"flex-1",children:"Clear"})]}),g.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-text bg-transparent hover:bg-base-2 transition-colors text-left",onClick:e,children:[g.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-4 h-4",children:g.jsx(nd,{})}),g.jsx("span",{className:"flex-1",children:"Pick Color"})]}),g.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-text bg-transparent hover:bg-base-2 transition-colors text-left",onClick:n,children:[g.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-4 h-4",children:td.COLOR}),g.jsx("span",{className:"flex-1",children:"Reference Color"})]})]})}const p4=w.memo(function({variable:e,isGrouped:n,isHidden:r=!1,groupName:i="",isLastInGroup:s=!1,contrastColor:o,colorVariables:l}){const{setSingleContrastColor:a,getShadeGroupBySourceId:u,collections:c,selectedModeId:d}=Zt(),{openColorPicker:f,openColorReference:h,openShadesModal:m,openStepsModal:x}=ar(),[v,p]=w.useState(e.displayName||e.name),y=w.useMemo(()=>n||e.resolvedType!=="COLOR"?null:u(e.id),[u,n,e.id,e.resolvedType]),b=w.useMemo(()=>{if(e.resolvedType!=="COLOR"||!o)return null;const B=ia(c,e,d),N=Ir(B),O=Ir(o);return!N||!O?null:sP(N,O)},[c,e,d,e.resolvedType,o]),C=w.useCallback(()=>{const B=e.name.split("/");let N;B.length>1?(B[B.length-1]=v,N=B.join("/")):N=v,N!==e.name&&Se({type:"update-variable-name",id:e.id,name:N})},[e.id,e.name,v]),S=w.useCallback(()=>{confirm("Delete this variable?")&&Se({type:"delete-variable",id:e.id})},[e.id]),k=w.useCallback(()=>{Se({type:"duplicate-variable",id:e.id})},[e.id]),E=w.useCallback(()=>{f({initialColor:o||"#ffffff",onConfirm:B=>a(e.id,B)})},[f,o,a,e.id]),$=w.useCallback(()=>{h({onConfirm:B=>{const N=l.find(O=>O.id===B);N&&a(e.id,N.value)}})},[h,l,a,e.id]),D=w.useCallback(()=>{a(e.id,null)},[a,e.id]),L=w.useCallback(B=>{B.stopPropagation(),m({groupName:e.name,modeId:d})},[m,e.name,d]),A=w.useCallback(B=>{B.stopPropagation(),x({groupName:e.name,collectionId:e.collectionId})},[x,e.collectionId,e.name]),T=r?"hidden":"",V=n?"grouped-item":"",M=!n&&g.jsxs(g.Fragment,{children:[e.resolvedType==="COLOR"&&g.jsx(is,{icon:g.jsx(nd,{}),onClick:L,title:(y==null?void 0:y.status)==="dirty"?"Managed shades need refresh":"Generate shades",className:(y==null?void 0:y.status)==="dirty"?"dirty":"",children:"Shades"}),e.resolvedType==="FLOAT"&&g.jsx(is,{icon:g.jsx(A5,{}),onClick:A,title:"Generate number steps",children:"Steps"})]});return g.jsxs("tr",{"data-id":e.id,className:`group ${V} ${T}`.trim(),"data-parent-group":i||void 0,children:[g.jsx("td",{className:"border border-border px-3 py-2 relative",children:g.jsxs("div",{className:`max-w-full overflow-hidden flex items-center gap-2 ${n?"pl-6":""}`,children:[n&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:`absolute left-5 top-0 w-px bg-text/30 ${s?"h-1/2":"h-full"}`}),g.jsx("div",{className:"absolute left-5 top-1/2 w-4 h-px bg-text/50"})]}),g.jsx("span",{className:`type-icon ${e.resolvedType}`,children:g.jsx(_p,{type:e.resolvedType})}),g.jsx(Lx,{value:v,onChange:B=>p(B.target.value),onBlur:C,"data-full-name":e.name})]})}),g.jsx("td",{className:"border border-border px-3 py-2",children:g.jsx(uP,{variable:e,modifierButton:M})}),g.jsx("td",{className:"border border-border px-3 py-2",children:g.jsx(cP,{variable:e})}),g.jsx("td",{className:"border border-border px-3 py-2 text-xs",children:b?g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx(xc,{label:g.jsxs("span",{className:"font-semibold mr-2",children:[b.ratio,":1"]}),children:g.jsx(a1,{contrastColor:o,onPickColor:E,onReferenceColor:$,onClear:D})}),g.jsxs("div",{className:"flex gap-1",children:[g.jsxs("span",{className:`inline-block px-1.5 py-0.5 rounded text-footnote ml-1 transition-all ${b.aa?"bg-badge-success":"bg-badge-danger"}`,children:[b.aa?"✓":"✗","AA"]}),g.jsxs("span",{className:`inline-block px-1.5 py-0.5 rounded text-footnote ml-1 transition-all ${b.aaa?"bg-badge-success":"bg-badge-danger"}`,children:[b.aaa?"✓":"✗","AAA"]})]})]}):!n&&e.resolvedType==="COLOR"?g.jsx(xc,{label:g.jsxs(g.Fragment,{children:[o&&g.jsx(ti,{color:o,className:"mr-1"}),"Contrast"]}),children:g.jsx(a1,{contrastColor:o,onPickColor:E,onReferenceColor:$,onClear:D})}):null}),g.jsx("td",{className:"w-25 border border-border px-3 py-2",children:g.jsxs("div",{className:"row-actions flex gap-2",children:[g.jsx(On,{icon:g.jsx(WT,{}),onClick:k,title:"Duplicate","aria-label":"Duplicate"}),g.jsx(On,{icon:g.jsx(Px,{}),onClick:S,title:"Delete","aria-label":"Delete"})]})})]})});function dP({variables:t}){var o;const{collections:e}=Zt(),n=(o=t[0])==null?void 0:o.collectionId,r=e.find(l=>l.id===n),i=r?r.name:"Unknown",s=l=>{if(l===n)return;const a=t.map(u=>u.id);Se({type:"move-group-to-collection",variableIds:a,targetCollectionId:l})};return e.length===0?g.jsx("div",{className:"collection-cell-empty",children:"—"}):g.jsx("div",{className:"collection-cell",children:g.jsx(xc,{label:i,children:e.map(l=>g.jsx(Hp,{className:"dropdown-item",name:"group-collection-cell",label:l.name,checked:n===l.id,onChange:()=>s(l.id)},l.id))})})}const $o=5,Mo=90,m4=.02;function st(t,e,n){return Math.max(e,Math.min(n,t))}function u1(t,e,n,r,i){const s=1-i;return s*s*s*t+3*s*s*i*e+3*s*i*i*n+i*i*i*r}function fP(t,e,n,r,i){const s=1-i;return 3*s*s*(e-t)+6*s*i*(n-e)+3*i*i*(r-n)}function c1(t,e,n,r,i){if(Math.abs(i-e)<1e-6)return 0;let s=st((t-e)/(i-e),0,1);for(let o=0;o<6;o++){const a=u1(e,n,r,i,s)-t;if(Math.abs(a)<1e-4)break;const u=fP(e,n,r,i,s);if(Math.abs(u)<1e-6)break;s=st(s-a/u,0,1)}return s}function g4(t,e,n,r,i){const s=t+(e-t)*i,o=e+(n-e)*i,l=n+(r-n)*i,a=s+(o-s)*i,u=o+(l-o)*i,c=a+(u-a)*i;return{left:[t,s,a,c],right:[c,u,l,r]}}function hP(t){const e=t;return!!e&&typeof e.startValue=="number"&&typeof e.endValue=="number"&&!!e.leftHandle1&&!!e.leftHandle2&&!!e.rightHandle1&&!!e.rightHandle2}function pP(t){const e=t;return!!e&&typeof e.startValue=="number"&&typeof e.endValue=="number"&&!!e.handle1&&!!e.handle2}function Gn(t){const e=T5(t),n=e.indexOf("500");if(n>=0)return n;let r=0,i=Number.POSITIVE_INFINITY;return e.forEach((s,o)=>{const l=Math.abs(parseInt(s,10)-500);l<i&&(i=l,r=o)}),r}function Dl(t,e){const n=Ir(t);if(!n)return Gn(e);const{l:r}=oP(n.r,n.g,n.b),i=1-st(r/100,0,1);return qn(Math.round(i*(e-1)),e)}function qn(t,e){return e<=1?0:typeof t!="number"||Number.isNaN(t)?Gn(e):st(Math.round(t),0,e-1)}function mP(t,e,n){if(n<=1)return 0;if(e<=1)return qn(void 0,n);const r=st(t/(e-1),0,1);return qn(Math.round(r*(n-1)),n)}function Ea(t,e){return t<=1?0:qn(e,t)/(t-1)}function y4(t,e,n,r){const i=Math.max(0,r-n);if(i<1e-6)return[{t:n,value:t.value},{t:r,value:e.value}];const s=Math.min(m4,i/4),o=Math.min(m4,i/4),l=n+s,a=r-s,u=st(t.t,l,a-o),c=st(e.t,u+o,a);return[{t:u,value:t.value},{t:c,value:e.value}]}function Pn(t=11,e=Gn(t)){const n=Ea(t,e),r=Math.max(n,0),i=Math.max(1-n,0);return{startValue:0,leftHandle1:{t:n-r*.66,value:0},leftHandle2:{t:n-r*.33,value:0},rightHandle1:{t:n+i*.33,value:0},rightHandle2:{t:n+i*.66,value:0},endValue:0}}function Un(t,e,n){const r=qn(n,e),i=Ea(e,r);if(hP(t)){const[s,o]=y4(t.leftHandle1,t.leftHandle2,0,i),[l,a]=y4(t.rightHandle1,t.rightHandle2,i,1);return{startValue:t.startValue,leftHandle1:s,leftHandle2:o,rightHandle1:l,rightHandle2:a,endValue:t.endValue}}if(pP(t)&&i>0&&i<1){const s=st(t.handle1.t,0,1),o=st(t.handle2.t,0,1),l=c1(i,0,s,o,1),a=g4(0,s,o,1,l),u=g4(t.startValue,t.handle1.value,t.handle2.value,t.endValue,l);return Un({startValue:t.startValue,leftHandle1:{t:a.left[1],value:u.left[1]},leftHandle2:{t:a.left[2],value:u.left[2]},rightHandle1:{t:a.right[1],value:u.right[1]},rightHandle2:{t:a.right[2],value:u.right[2]},endValue:t.endValue},e,r)}return Un(Pn(e,r),e,r)}function gP(t,e,n,r){const i=Ea(n,r),s=st(e,0,1);if(i<=0||s<=i){const l=c1(s,0,t.leftHandle1.t,t.leftHandle2.t,i);return u1(t.startValue,t.leftHandle1.value,t.leftHandle2.value,0,l)}const o=c1(s,i,t.rightHandle1.t,t.rightHandle2.t,1);return u1(0,t.rightHandle1.value,t.rightHandle2.value,t.endValue,o)}function _f(t,e,n){const r=Un(t,e,n),i=[];for(let s=0;s<e;s++){const o=e>1?s/(e-1):0;i.push(s===qn(n,e)?0:gP(r,o,e,n))}return i}function Vd(t,e,n){const r=Ir(t);if(!r||e.length===0)return qn(void 0,n);let i=0,s=Number.POSITIVE_INFINITY;return e.forEach((o,l)=>{const a=Ir(o.value);if(!a)return;const u=(r.r-a.r)**2+(r.g-a.g)**2+(r.b-a.b)**2;u<s&&(s=u,i=l)}),qn(i,n)}function og(t,e,n,r=$o,i=Mo){if(e<=1)return 50;const s=Ea(e,n),o=st(t,0,1);if(o<=s){const a=s===0?0:o/s;return r+(50-r)*a}const l=s===1?0:(o-s)/(1-s);return 50+(i-50)*l}function P5(t,e,n,r,i,s,o,l=$o,a=Mo){const u=Ir(t);if(!u)return[];const c=qn(r,n),d=_f(i,n,c),f=_f(s,n,c),h=_f(o,n,c),m=T5(n),x=lP(l,a,u,n,c,d,f,h);return x[c]&&(x[c]=Zo(u)),x.map((v,p)=>({name:`${e}/${m[p]}`,value:Sa(v)}))}function yP(t){return t.startsWith("#")?Sa(t):t}function xP(t,e){const n=Dl(e.value,t.config.shadeCount),r=P5(e.value,e.name,t.config.shadeCount,n,t.config.lightnessCurve,t.config.saturationCurve,t.config.hueCurve,t.config.lightValue,t.config.darkValue);return r.length===0?!1:(Se({type:"update-shades",collectionId:e.collectionId,deleteIds:t.deleteIds,shades:r,source:{id:e.id,name:e.name,value:yP(e.value)},config:{shadeCount:t.config.shadeCount,baseIndex:n,lightValue:t.config.lightValue,darkValue:t.config.darkValue,lightnessCurve:t.config.lightnessCurve,saturationCurve:t.config.saturationCurve,hueCurve:t.config.hueCurve}}),!0)}function vP({groupName:t,variables:e,isCollapsed:n}){var V;const{toggleGroup:r,getGroupContrastColor:i,setGroupContrastColor:s,variables:o,selectedCollectionId:l,getShadeGroupByGroupName:a,selectedModeId:u}=Zt(),{openBulkEdit:c,openColorPicker:d,openColorReference:f,openShadesModal:h,openStepsModal:m}=ar(),x=e.map(M=>M.id),v=((V=e[0])==null?void 0:V.resolvedType)||"STRING",p=i(t),y=v==="COLOR"?a(t):null,b=y&&o.find(M=>M.id===y.sourceVariableId)||null,C=be.useMemo(()=>o.filter(M=>M.collectionId===l&&M.resolvedType==="COLOR"),[o,l]),S=w.useCallback(()=>{r(t)},[r,t]),k=w.useCallback(M=>{var B;M.stopPropagation(),c({groupName:t,collectionId:(B=e[0])==null?void 0:B.collectionId})},[c,t,e]),E=w.useCallback(M=>{if(M.stopPropagation(),y&&b){confirm(`Remove generated shades for ${t}?`)&&Se({type:"remove-shades",collectionId:b.collectionId,deleteIds:y.deleteIds,source:{id:b.id,name:b.name,value:b.value}});return}confirm(`Delete all ${x.length} variables in this group?`)&&Se({type:"delete-group",ids:x})},[x,t,y,b]),$=w.useCallback(()=>{d({initialColor:p||"#ffffff",onConfirm:M=>s(t,M)})},[d,p,s,t]),D=w.useCallback(()=>{f({onConfirm:M=>{const B=C.find(N=>N.id===M);B&&s(t,B.value)}})},[f,C,s,t]),L=w.useCallback(()=>{s(t,null)},[s,t]),A=w.useCallback(M=>{M.stopPropagation(),!((y==null?void 0:y.status)==="dirty"&&b&&xP(y,b))&&h({groupName:t,modeId:u})},[t,h,y,b,u]),T=w.useCallback(M=>{var B;M.stopPropagation(),m({groupName:t,collectionId:(B=e[0])==null?void 0:B.collectionId})},[m,t,e]);return g.jsxs("tr",{className:`group group-row ${n?"collapsed":""}`,"data-group":t,children:[g.jsx("td",{className:"border border-border px-3 py-2",children:g.jsxs("div",{className:"group-header flex items-center gap-2",children:[g.jsx("span",{className:`type-icon ${v}`,children:g.jsx(_p,{type:v})}),g.jsxs("span",{onClick:S,className:"flex-1 cursor-pointer",children:[t,g.jsxs("span",{className:"text-text opacity-50 font-normal text-[10px]",children:[" ","(",e.length,")"]})]}),g.jsx(On,{icon:n?g.jsx(D5,{}):g.jsx(N5,{}),onClick:S,"aria-label":n?"Expand group":"Collapse group"})]})}),g.jsx("td",{className:"border border-border px-3 py-2",children:g.jsxs("div",{className:"flex items-center justify-end gap-2 h-full",children:[v==="COLOR"&&g.jsx(is,{icon:(y==null?void 0:y.status)==="dirty"?g.jsx(Fp,{}):g.jsx(nd,{}),onClick:A,title:(y==null?void 0:y.status)==="dirty"?"Refresh generated shades":"Generate shades",className:(y==null?void 0:y.status)==="dirty"?"dirty":"",children:(y==null?void 0:y.status)==="dirty"?"Refresh":"Shades"}),v==="FLOAT"&&g.jsx(is,{icon:g.jsx(A5,{}),onClick:T,title:"Generate steps",children:"Steps"})]})}),g.jsx("td",{className:"border border-border px-3 py-2",children:g.jsx(dP,{variables:e})}),g.jsx("td",{className:"accessibility-cell border border-border px-3 py-2",children:v==="COLOR"&&g.jsx(xc,{label:g.jsxs(g.Fragment,{children:[p&&g.jsx(ti,{color:p,className:"mr-1"}),"Contrast"]}),children:g.jsx(a1,{contrastColor:p,onPickColor:$,onReferenceColor:D,onClear:L})})}),g.jsx("td",{className:"w-25 border border-border px-3 py-2",children:g.jsxs("div",{className:"row-actions flex gap-2",children:[g.jsx(On,{icon:g.jsx(UT,{}),onClick:k,title:"Edit as text","aria-label":"Edit as text"}),g.jsx(On,{icon:g.jsx(Px,{}),onClick:E,title:"Delete group","aria-label":"Delete group"})]})})]})}const fr=260,Lo=32,Eu=36,Wl=8,ko=180,yi=40,bP="base",wP=26,L5="tier-label:",d1="group:",Yr="wrapper:",f1=36,zi=16,CP=2,kP=8,xs=kP+CP,Hu=28,Th="var(--color-secondary)",Qs="var(--color-primary)",SP="#EC4899",vc="var(--color-border)",bc="var(--color-base)",ws="var(--color-base-2)",lg="var(--color-base-3)";function x4(t){switch(t){case"COLOR":return"rgb(0, 0, 0)";case"FLOAT":return"0";case"STRING":return"";case"BOOLEAN":return"false"}}function Fd(t){return t.trim().replace(/^\/+|\/+$/g,"")}function zr(t){const e=Math.max(t.variables.length,1);return Eu+e*Lo+Wl*2}function I5(t){const e=(t==null?void 0:t.variables.length)??0;return e===0?0:e*Lo+Wl*2}function du(t){const e=t&&typeof t=="object"?t:{},n=typeof e.gapX=="number"&&e.gapX>=0?e.gapX:ko,r=typeof e.gapY=="number"&&e.gapY>=0?e.gapY:yi;return{gapX:n,gapY:r}}function _d(t){return{gapX:String(t.gapX),gapY:String(t.gapY)}}function Hf(t,e){return t.y!==e.y?t.y-e.y:t.x-e.x}function kl(t){if(!t.sourceGroupName)return null;switch(t.kind){case"source":return 0;case"shader":return 1;case"shades":return 2;default:return null}}function EP(t,e){return e?t===0?0:Math.max(t,2):t}function v4(t){const e=t.match(/\/(\d+)$/);return e?parseInt(e[1],10):0}function fu(t,e,n,r,i){const s=/^\{(.+)\}$/,o=ia(r,t,i),l=o.match(s),a=!!l,u=l?l[1]:null;let c=o;if(a&&u){const m=e.get(u);if(m){const x=ia(r,m,i),v=x.match(s);if(v){const p=e.get(v[1]);p&&(c=ia(r,p,i))}else c=x}}let d="#888888",f=c;if(t.resolvedType==="COLOR"){const m=Ir(c);d=m?Zo(m):"#888888",f=a?`{${u}}`:d.toUpperCase()}else t.resolvedType==="BOOLEAN"?f=a&&u?`{${u}}`:c:t.resolvedType==="STRING"?f=a&&u?`{${u}}`:c||'""':f=a&&u?`{${u}:${c}}`:c;const h=t.name.split("/");return{id:t.id,name:t.name,shortName:h[h.length-1],displayName:f,color:d,value:o,resolvedValue:t.resolvedType==="COLOR"?d:c,resolvedType:t.resolvedType,isReference:a,referenceName:u}}function $P(t,e){return{id:`shader:${t.sourceVariableId}`,name:`shader:${t.sourceVariableId}`,shortName:"shader",displayName:`${t.config.shadeCount} shades`,color:e,value:"",resolvedValue:"",isReference:!1,referenceName:null,isVirtual:!0,virtualType:"shader",connectionsDisabled:!0}}function MP(t,e){return{id:`shader:${t}`,name:`shader:${t}`,shortName:"steps",displayName:`${e} steps`,color:Th,value:"",resolvedValue:"",isReference:!1,referenceName:null,isVirtual:!0,virtualType:"shader",connectionsDisabled:!0}}function DP(t,e,n){return{id:`palette:${t.sourceVariableId}`,name:`palette:${t.sourceVariableId}`,shortName:"generated",displayName:`${e} outputs`,color:n,value:"",resolvedValue:"",isReference:!1,referenceName:null,isVirtual:!0,virtualType:"palette",connectionsDisabled:!0}}function NP(t){const e=t.map(i=>({sourceVariable:i,stepVariables:[]})),n=new Map(e.map(i=>[i.sourceVariable.id,i])),r=t.map(i=>({variable:i,prefix:`${i.name}/`}));return t.forEach(i=>{var o;let s=null;r.forEach(l=>{l.variable.id!==i.id&&i.name.startsWith(l.prefix)&&(!s||l.variable.name.length>s.name.length)&&(s=l.variable)}),s&&((o=n.get(s.id))==null||o.stepVariables.push(i))}),e.filter(i=>i.stepVariables.length>0)}function AP(t,e,n,r,i={}){var j;const{heightOverrides:s,depthConnections:o}=i,l=fr+n,a=new Map,u=new Map(t.map(R=>[R.key,R])),c=R=>(s==null?void 0:s.get(R.key))??zr(R),d=new Map,f=new Map;t.forEach(R=>{d.set(R.key,new Set),f.set(R.key,new Set)}),e.forEach(R=>{var H,G;!u.has(R.fromGroup)||!u.has(R.toGroup)||R.fromGroup!==R.toGroup&&((H=d.get(R.fromGroup))==null||H.add(R.toGroup),(G=f.get(R.toGroup))==null||G.add(R.fromGroup))});const h=o??e,m=new Map,x=new Map,v=R=>{m.has(R)||m.set(R,new Set),x.has(R)||x.set(R,new Set)};t.forEach(R=>v(R.key)),h.forEach(R=>{var H,G;R.fromGroup!==R.toGroup&&(v(R.fromGroup),v(R.toGroup),(H=m.get(R.fromGroup))==null||H.add(R.toGroup),(G=x.get(R.toGroup))==null||G.add(R.fromGroup))});const p=Array.from(m.keys()),y=new Map,b=new Map;p.forEach(R=>{var H;y.set(R,0),b.set(R,((H=x.get(R))==null?void 0:H.size)||0)});const C=p.filter(R=>(b.get(R)||0)===0),S=new Set;for(;C.length>0;){C.sort((G,U)=>{const se=u.get(G),ne=u.get(U);return!se||!ne?G.localeCompare(U):Hf(se,ne)});const R=C.shift();if(!R||S.has(R))continue;S.add(R);const H=y.get(R)||0;(j=m.get(R))==null||j.forEach(G=>{y.set(G,Math.max(y.get(G)||0,H+1)),b.set(G,(b.get(G)||0)-1),(b.get(G)||0)===0&&C.push(G)})}if(S.size!==p.length){const R=S.size>0?Math.max(...Array.from(S).map(H=>y.get(H)||0)):-1;p.forEach(H=>{S.has(H)||y.set(H,R+1)})}const k=new Map;t.forEach(R=>{kl(R)!==null&&R.sourceGroupName&&k.set(R.key,R.sourceGroupName)});const E=new Map,$=[];t.forEach(R=>{const H=k.get(R.key);if(H){const G=E.get(H)||[];G.push(R),E.set(H,G)}else $.push(R)});const D=Array.from(E.entries()).sort((R,H)=>{const G=R[1].find(se=>kl(se)===0)||R[1][0],U=H[1].find(se=>kl(se)===0)||H[1][0];return!G||!U?0:Hf(G,U)}),L=[];let A=0;const T=D.length>0,V=new Map,M=new Set;D.forEach(([,R])=>{R.sort((U,se)=>{const ne=kl(U)??Number.MAX_SAFE_INTEGER,le=kl(se)??Number.MAX_SAFE_INTEGER;return ne!==le?ne-le:Hf(U,se)});let H=0;const G=new Set;R.forEach(U=>{const se=kl(U)??0;L.push({key:U.key,lane:se,y:A}),G.add(se),M.add(se),H=Math.max(H,c(U))}),A+=H+r,G.forEach(U=>{V.set(U,A)})});const B=new Map;$.forEach(R=>{const H=y.get(R.key)||0,G=EP(H,T),U=B.get(G)||[];U.push(R),B.set(G,U)});const N=Array.from(B.keys()).sort((R,H)=>R-H),O=new Map;N.forEach(R=>{const H=(B.get(R)||[]).slice().sort((G,U)=>G.title.localeCompare(U.title));O.set(R,H.map(G=>G.key))});const I=4;for(let R=0;R<I;R++){const H=R%2===0,G=H?N:N.slice().reverse(),U=H?f:d;G.forEach((se,ne)=>{if(ne===0)return;const le=G[ne-1],Ee=O.get(le)||[],xe=new Map(Ee.map((ae,we)=>[ae,we])),oe=(O.get(se)||[]).map((ae,we)=>{const $e=Array.from(U.get(ae)||[]).filter(We=>xe.has(We)),Ve=$e.length>0?$e.reduce((We,ie)=>We+(xe.get(ie)||0),0)/$e.length:we;return{key:ae,barycenter:Ve,originalIndex:we}});oe.sort((ae,we)=>ae.barycenter!==we.barycenter?ae.barycenter-we.barycenter:ae.originalIndex-we.originalIndex),O.set(se,oe.map(ae=>ae.key))})}const P=Array.from(new Set([...M,...N])).sort((R,H)=>R-H),F=new Map,z=[];return P.forEach((R,H)=>{const G=H*l;F.set(R,G),z.push({tier:H+1,x:G,width:fr})}),L.forEach(R=>{a.set(R.key,{x:F.get(R.lane)??0,y:R.y})}),N.forEach(R=>{const H=F.get(R)??0;let G=V.get(R)??0;(O.get(R)||[]).forEach(U=>{const se=u.get(U);se&&(a.set(se.key,{x:H,y:G}),G+=c(se)+r)}),V.set(R,G)}),{positions:a,tiers:z}}function b4(t){return t.startsWith(L5)}function sr(t,e){return`${t}::${e}`}function Ix(t){const e=t.indexOf("::");return e<0?null:{collectionId:t.slice(0,e),path:t.slice(e+2)}}function TP(t,e,n){const r=e?e.split("/"):[];for(let i=0;i<=r.length;i++){const s=sr(t,r.slice(0,i).join("/"));if(n.has(s))return s}return null}function R5(t,e){return t.kind!=="standard"&&t.kind!=="collection"?!1:e.has(sr(t.collectionId,t.sourceGroupName||""))}function w4(t,e,n={}){const r=new Map(t.map((o,l)=>[o.id,l])),i=new Map;e.forEach(o=>{if(!r.has(o.collectionId))return;const l=o.name.split("/"),a=l.length-1,u=n.exactPathOnly?Math.max(a,1):1;for(let c=u;c<=a;c++){const d=l.slice(0,c).join("/");let f=i.get(d);f||(f=new Set,i.set(d,f)),f.add(o.collectionId)}});const s=new Map;return i.forEach((o,l)=>{s.set(l,Array.from(o).sort((a,u)=>r.get(a)-r.get(u)))}),s}function PP(t,e){if(!Array.isArray(t))return[];const n=new Set;return t.forEach(r=>{if(!(typeof r!="string"||!r)){if(r.includes("::")){n.add(r);return}(e.get(r)||[]).forEach(i=>n.add(sr(i,r)))}}),Array.from(n)}function LP(t,e,n){if(!t||typeof t!="object"||Array.isArray(t))return{};const r=t,i={},s=[];return Object.entries(r).forEach(([o,l])=>{const a=o.startsWith("rel:")?"rel:":"",u=o.slice(a.length),c=u.startsWith(Yr)?Yr:u.startsWith(d1)?d1:null;if(!c){i[o]=l;return}const d=u.slice(c.length);if(d.includes("::")){i[o]=l;return}const h=((c===Yr?e:n).get(d)||[])[0];h&&s.push([`${a}${c}${sr(h,d)}`,l])}),s.forEach(([o,l])=>{o in i||(i[o]=l)}),i}function IP(t,e,n,r){const i=m=>{if(m.kind!=="standard"&&m.kind!=="collection")return m.key;const x=TP(m.collectionId,m.sourceGroupName||"",e);return x?`${Yr}${x}`:m.key},s=new Map,o=new Map,l=new Map,a=new Map,u=new Map,c=new Map;t.forEach(m=>{const x=i(m),v=zf(m,n);if(s.set(m.key,v),o.set(m.key,x),a.set(x,(a.get(x)??!0)&&v),x===m.key){l.set(x,m);return}if(!l.has(x)){const p=r.get(x),y=Ix(x.slice(Yr.length));l.set(x,{...m,key:x,title:y?y.path||y.collectionId:x.slice(Yr.length),x:(p==null?void 0:p.position.x)??m.x,y:(p==null?void 0:p.position.y)??m.y})}R5(m,e)?c.set(x,(c.get(x)||0)+I5(m)):u.set(x,(u.get(x)||0)+zr(m)+Hu)});const d=new Map;l.forEach((m,x)=>{var C;if(!x.startsWith(Yr))return;const v=(C=r.get(x))==null?void 0:C.measuredHeight;if(typeof v=="number"&&v>0){d.set(x,v);return}const p=u.get(x)||0,y=c.get(x)||0,b=p>0?p-Hu+zi*2:y>0?0:zi*2;d.set(x,xs*2+f1+y+b)});const f=[],h=[];return l.forEach((m,x)=>{(a.get(x)?h:f).push(m)}),{units:f,hiddenUnits:h,heightOverrides:d,unitKeyByGroupKey:o,hiddenByKey:s}}function zf(t,e){var i;if((i=e.selectionProviderGroupKeys)!=null&&i.has(t.key))return!1;if(!e.selectedCollections.has(t.collectionId))return!0;if(t.kind==="collection"&&t.variables.length===0)return!1;if(!t.variables.some(s=>{if(s.isVirtual)return!0;const o=e.variablesById.get(s.id);return o&&e.selectedTypes.has(o.resolvedType)}))return!0;let r=!1;return t.kind==="shader"||t.kind==="shades"?t.sourceGroupName&&(r=e.selectedGroups.has(Hs(t.collectionId,t.sourceGroupName))):r=t.variables.some(s=>s.isVirtual?!1:C5({collectionId:t.collectionId,name:s.name},e.selectedGroups)),!r}function RP(t,e){const n=new Map,r=new Map;return t.forEach(i=>{const s=i.name.split("/"),o=e(i);if(s.length===1){const c=r.get(i.collectionId)||[];c.push(o),r.set(i.collectionId,c);return}const l=s.slice(0,-1).join("/"),a=sr(i.collectionId,l),u=n.get(a)||{nodes:[],collectionId:i.collectionId,groupName:l};u.nodes.push(o),n.set(a,u)}),{groups:n,loose:r}}function BP(t,e,n){const r=[...t].sort((s,o)=>s.name.localeCompare(o.name));let i=n;return r.map(s=>{const o={key:OP(s.id),title:s.name,variables:e.get(s.id)||[],x:0,y:0,initialX:0,initialY:i,kind:"collection",headerFill:ws,collectionId:s.id};return i+=zr(o)+yi,o})}function OP(t){return`collection:${t}`}function h1(t,e){return`${d1}${sr(t,e)}`}const mr=w.forwardRef(({error:t,fullWidth:e=!1,mono:n=!1,className:r="",type:i="text",id:s,...o},l)=>{const a=w.useId(),u=s??a,c=["form-input w-full bg-base text-text border-border border border-solid p-2 rounded focus:outline-1 focus:outline-text focus:outline-offset-2 focus:ring-0 h-[34px] leading-tight text-sm",n&&"mono",e&&"full-width",t&&"has-error",r].filter(Boolean).join(" ");return g.jsxs("div",{className:e?"input-wrapper w-full":"input-wrapper",children:[g.jsx("input",{ref:l,id:u,type:i,className:c,"aria-invalid":!!t,"aria-describedby":t?`${u}-error`:void 0,...o}),t&&g.jsx("span",{id:`${u}-error`,className:"input-error",role:"alert",children:t})]})});mr.displayName="Input";function zp({value:t="",onChange:e,onClear:n,onEnter:r,placeholder:i="Search...",count:s,className:o="",autoFocus:l=!1,fullWidth:a=!1,id:u}){const c=w.useRef(null),d=h=>{e(h.target.value)},f=h=>{h.key==="Escape"?(e(""),n&&n()):h.key==="Enter"&&r&&r()};return g.jsxs("div",{className:`flex items-center gap-2 relative ${a?"w-full":""} ${o}`,children:[g.jsx("span",{className:"absolute left-0 pointer-events-none",children:g.jsx(GT,{})}),g.jsx(mr,{ref:c,type:"text",id:u,className:"pl-6",placeholder:i,autoComplete:"off",value:t,onChange:d,onKeyDown:f,autoFocus:l,fullWidth:a}),s&&g.jsx("span",{className:"absolute right-2 text-xs text-text-secondary pointer-events-none",children:s})]})}function jP(t){const e=new Map;t.forEach(r=>{const i=r.split("/");let s=e,o="";i.forEach((l,a)=>{o=o?`${o}/${l}`:l,s.has(l)||s.set(l,{path:o,label:l,isGroup:!1,childrenMap:new Map});const u=s.get(l);a===i.length-1&&(u.isGroup=!0),s=u.childrenMap})});const n=r=>Array.from(r.values()).sort((i,s)=>i.label.localeCompare(s.label)).map(i=>({path:i.path,label:i.label,isGroup:i.isGroup,children:n(i.childrenMap)}));return n(e)}function B5(t,e){return[...t.isGroup?[Hs(e,t.path)]:[],...t.children.flatMap(r=>B5(r,e))]}function O5({node:t,depth:e,collectionId:n,variables:r,selectedGroups:i,onGroupToggle:s,selectedCollections:o,onCollectionToggle:l,collapsedGroups:a,setCollapsedGroups:u,highlightedGroupKey:c,onHighlightGroup:d,forceExpanded:f=!1}){const h=`${n}::${t.path}`,m=t.children.length>0,x=f?!1:a.has(h),v=h1(n,t.path),p=t.isGroup&&c===v,y=r.filter($=>$.collectionId===n&&$.name.startsWith(`${t.path}/`)).length,b=be.useMemo(()=>B5(t,n),[t,n]),C=b.every($=>i.has($)),k=b.some($=>i.has($))&&!C,E=()=>{const $=o.has(n);C?b.forEach(D=>{i.has(D)&&s(D)}):(b.forEach(D=>{i.has(D)||s(D)}),$||l(n))};return g.jsxs("div",{className:"space-y-0.5",children:[g.jsxs("div",{className:`flex items-center gap-2 px-2 py-1 rounded transition-colors ${p?"bg-brand/10 ring-1 ring-brand":"hover:bg-base-2"}`,style:{marginLeft:e*16},children:[m?g.jsx("button",{type:"button",onClick:$=>{$.stopPropagation(),u(D=>{const L=new Set(D);return L.has(h)?L.delete(h):L.add(h),L})},className:"w-4 h-4 flex items-center justify-center text-text-muted hover:text-text transition-colors",children:x?"▶":"▼"}):g.jsx("div",{className:"w-4 shrink-0"}),g.jsx("input",{type:"checkbox",ref:$=>{$&&($.indeterminate=k)},checked:C,onChange:E,className:"w-3.5 h-3.5 cursor-pointer"}),g.jsx("span",{onClick:t.isGroup&&d?()=>d(v):void 0,title:t.isGroup?"Click to find in graph":void 0,className:`text-xs flex-1 ${t.isGroup&&d?"cursor-pointer hover:underline":""}`,children:t.label}),g.jsx("span",{className:"text-xs opacity-60",children:y})]}),m&&!x&&g.jsx("div",{children:t.children.map($=>g.jsx(O5,{node:$,depth:e+1,collectionId:n,variables:r,selectedGroups:i,onGroupToggle:s,selectedCollections:o,onCollectionToggle:l,collapsedGroups:a,setCollapsedGroups:u,highlightedGroupKey:c,onHighlightGroup:d,forceExpanded:f},$.path))})]})}function j5({selectedModeId:t,onModeChange:e,selectedTypes:n,onTypeToggle:r,selectedCollections:i,onCollectionToggle:s,selectedGroups:o,onGroupToggle:l,highlightedGroupKey:a,onHighlightGroup:u,onZoomToCollection:c,showTypeFilters:d=!0,footer:f}){var xe;const{collections:h,variables:m}=Zt(),{openInputModal:x}=ar(),[v,p]=w.useState(new Set),[y,b]=w.useState(new Set),[C,S]=w.useState(""),k=C.trim().toLowerCase(),E=k.length>0,$=be.useRef(!1),D=200,L=560,A="sidebar-filter-width",[T,V]=w.useState(256),M=be.useRef(!1),B=be.useRef({x:0,width:256});be.useEffect(()=>{Se({type:"get-client-storage",key:A});const W=oe=>{const ae=oe.data.pluginMessage;(ae==null?void 0:ae.type)==="client-storage-data"&&ae.key===A&&typeof ae.value=="number"&&V(Math.min(L,Math.max(D,ae.value)))};return window.addEventListener("message",W),()=>window.removeEventListener("message",W)},[]),be.useEffect(()=>{const W=ae=>{if(!M.current)return;const we=ae.clientX-B.current.x,$e=Math.min(L,Math.max(D,B.current.width+we));V($e)},oe=()=>{M.current&&(M.current=!1,document.body.style.cursor="",document.body.style.userSelect="",V(ae=>(Se({type:"set-client-storage",key:A,value:ae}),ae)))};return window.addEventListener("mousemove",W),window.addEventListener("mouseup",oe),()=>{window.removeEventListener("mousemove",W),window.removeEventListener("mouseup",oe)}},[]);const N=W=>{W.preventDefault(),M.current=!0,B.current={x:W.clientX,width:T},document.body.style.cursor="col-resize",document.body.style.userSelect="none"};be.useEffect(()=>{if(o&&l&&!$.current){const W=new Set;h.forEach(oe=>{m.some(we=>we.collectionId!==oe.id?!1:we.name.split("/").length>1)&&W.add(oe.id)}),p(W),$.current=!0}},[h,m,o,l]);const O=()=>{x({title:"New Collection",label:"Collection name",confirmText:"Create",onConfirm:W=>{Se({type:"create-collection",name:W})}})},I=be.useMemo(()=>{const W=new Set;return m.forEach(oe=>W.add(oe.resolvedType)),Array.from(W).sort()},[m]),P=be.useMemo(()=>{const W=new Map;return m.forEach(oe=>{const ae=Qi(oe.name);ae&&(W.has(oe.collectionId)||W.set(oe.collectionId,new Set),W.get(oe.collectionId).add(ae))}),W},[m]),[F,z]=w.useState(null),j=be.useMemo(()=>{var W;return((W=h.find(oe=>oe.modes.some(ae=>ae.modeId===t)))==null?void 0:W.id)??null},[h,t]),R=F??j??((xe=h[0])==null?void 0:xe.id)??null,H=h.find(W=>W.id===R)||null,G=H?Qo(h,H.id,t):null,U=n?I.every(W=>n.has(W)):!1,se=()=>{!n||!r||(U?I.forEach(W=>r(W)):I.forEach(W=>{n.has(W)||r(W)}))},ne=be.useMemo(()=>{const W=[];return P.forEach((oe,ae)=>{oe.forEach(we=>W.push(Hs(ae,we)))}),W},[P]),le=h.every(W=>i.has(W.id)),Ee=()=>{le?(h.forEach(W=>s(W.id)),o&&l&&ne.forEach(W=>{o.has(W)&&l(W)})):(h.forEach(W=>{i.has(W.id)||s(W.id)}),o&&l&&ne.forEach(W=>{o.has(W)||l(W)}))};return g.jsxs("div",{className:"relative flex flex-col h-full border-r border-border bg-base shrink-0",style:{width:T},children:[g.jsxs("div",{className:"p-3 border-b border-border",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsx("label",{className:"text-xs font-semibold",children:"Mode"}),t&&g.jsx("button",{type:"button",className:"text-[11px] text-text-muted hover:text-text cursor-pointer bg-transparent border-none p-0",onClick:()=>e(""),children:"Reset"})]}),g.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:h.map(W=>{const oe=W.id===R;return g.jsx("button",{type:"button",className:`px-2 py-1 rounded text-xs font-medium border cursor-pointer transition-all ${oe?"bg-primary text-base border-primary":"bg-base-2 text-text border-border hover:bg-base-3"}`,onClick:()=>z(W.id),children:W.name},W.id)})}),H&&H.modes.length>1&&g.jsxs("div",{className:"ml-2 mt-2 pt-3 border-t border-border",children:[g.jsxs("label",{className:"block text-[11px] font-semibold text-text-muted mb-1.5",children:[H.name," modes"]}),g.jsx("div",{className:"flex flex-wrap gap-1.5",children:H.modes.map(W=>{const oe=W.modeId===G;return g.jsx("button",{type:"button",className:`px-2 py-1 rounded text-xs font-medium border cursor-pointer transition-all ${oe?"bg-primary text-base border-primary":"bg-base-2 text-text border-border hover:bg-base-3"}`,onClick:()=>e(W.modeId),children:W.name},W.modeId)})})]})]}),d&&n&&r&&g.jsxs("div",{className:"p-3 border-b border-border",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsx("label",{className:"text-xs font-semibold",children:"Types"}),g.jsx(Ye,{onClick:se,size:"sm",children:U?"Deselect All":"Select All"})]}),g.jsx("div",{className:"space-y-1",children:I.map(W=>g.jsxs("label",{className:"flex items-center gap-2 cursor-pointer hover:bg-base-2 px-2 py-1 rounded transition-colors",children:[g.jsx("input",{type:"checkbox",checked:n.has(W),onChange:()=>r(W),className:"w-4 h-4"}),g.jsx("span",{className:"text-sm flex-1",children:W}),g.jsx(_p,{type:W})]},W))})]}),g.jsxs("div",{className:"flex-1 p-3 flex flex-col min-h-0",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsx("label",{className:"text-xs font-semibold",children:"Collections"}),g.jsx(Ye,{onClick:Ee,size:"sm",children:le?"Deselect All":"Select All"})]}),g.jsx(zp,{value:C,onChange:S,placeholder:"Search collections & groups...",className:"mb-2",fullWidth:!0}),g.jsx("div",{className:"space-y-1 overflow-auto flex-1 min-h-0",children:h.map(W=>{const oe=m.filter(X=>X.collectionId===W.id).length,ae=P.get(W.id),we=ae&&ae.size>0,$e=E?Array.from(ae??[]).filter(X=>X.toLowerCase().includes(k)||m.some(re=>re.collectionId===W.id&&re.name.startsWith(`${X}/`)&&re.name.toLowerCase().includes(k))):Array.from(ae??[]);if(!(!E||W.name.toLowerCase().includes(k)||$e.length>0||m.some(X=>X.collectionId===W.id&&!Qi(X.name)&&X.name.toLowerCase().includes(k))))return null;const We=E?!0:v.has(W.id),ie=i.has(W.id),Te=!!we&&!!o&&!!l,Ke=Te?Array.from(ae).map(X=>Hs(W.id,X)):[],rt=Ke.length>0&&Ke.every(X=>o.has(X)),te=Te?ie&&rt:ie,ce=Te&&ie&&!rt,K=()=>{if(!Te){s(W.id);return}te?(s(W.id),Ke.forEach(X=>{o.has(X)&&l(X)})):(ie||s(W.id),Ke.forEach(X=>{o.has(X)||l(X)}))};return g.jsxs("div",{className:"space-y-0.5",children:[g.jsxs("div",{className:"flex items-center gap-2 hover:bg-base-2 px-2 py-1 rounded transition-colors",children:[we&&g.jsx("button",{type:"button",onClick:X=>{X.stopPropagation(),p(re=>{const he=new Set(re);return he.has(W.id)?he.delete(W.id):he.add(W.id),he})},className:"w-4 h-4 flex items-center justify-center text-text-muted hover:text-text transition-colors",children:We?"▼":"▶"}),!we&&g.jsx("div",{className:"w-4"}),g.jsxs("label",{className:"flex items-center gap-2 cursor-pointer flex-1",children:[g.jsx("input",{type:"checkbox",ref:X=>{X&&(X.indeterminate=ce)},checked:te,onChange:K,className:"w-4 h-4"}),g.jsx("span",{onClick:c?X=>{X.preventDefault(),X.stopPropagation(),c(W.id)}:void 0,title:c?"Click to find in graph":void 0,className:`text-sm flex-1 ${c?"hover:underline":""}`,children:W.name}),g.jsx("span",{className:"text-xs opacity-60",children:oe})]})]}),we&&We&&o&&l&&g.jsx("div",{className:"ml-8 space-y-0.5",children:jP($e).map(X=>g.jsx(O5,{node:X,depth:0,collectionId:W.id,variables:m,selectedGroups:o,onGroupToggle:l,selectedCollections:i,onCollectionToggle:s,collapsedGroups:y,setCollapsedGroups:b,highlightedGroupKey:a,onHighlightGroup:u,forceExpanded:E},X.path))})]},W.id)})}),g.jsx("div",{className:"pt-3 mt-3 border-t border-border",children:g.jsx(is,{icon:g.jsx(M5,{}),onClick:O,className:"w-full justify-center",size:"sm",children:"Add Collection"})})]}),f&&g.jsx("div",{className:"p-3 border-t border-border",children:f}),g.jsx("div",{onMouseDown:N,className:"absolute top-0 right-0 h-full w-1 cursor-col-resize hover:bg-brand/50 active:bg-brand transition-colors z-10"})]})}const VP=[{type:"COLOR",label:"Color"},{type:"FLOAT",label:"Number"},{type:"STRING",label:"String"},{type:"BOOLEAN",label:"Boolean"}];function FP({position:t,onClose:e}){const{selectedCollectionId:n}=Zt(),{openInputModal:r}=ar(),i=s=>{e(),r({title:"New Variable",label:"Variable name",confirmText:"Create",onConfirm:o=>{let l="";s==="COLOR"?l="rgb(0, 0, 0)":s==="FLOAT"?l="0":s==="BOOLEAN"&&(l="true"),Se({type:"create-variable",collectionId:n,name:o,varType:s,value:l})}})};return g.jsx("div",{id:"add-menu",className:"add-menu open",style:{top:t.top,left:t.left},children:VP.map(({type:s,label:o})=>g.jsx(is,{icon:td[s],onClick:()=>i(s),children:o},s))})}function _P({status:t}){const{setSearchQuery:e,getFilteredCount:n,searchQuery:r}=Zt(),[i,s]=w.useState(!1),[o,l]=w.useState({top:0,left:0}),a=w.useRef(null),u=f=>{const h=f.currentTarget.getBoundingClientRect();l({top:h.bottom+4,left:h.left}),s(!0)},{shown:c,total:d}=n();return w.useEffect(()=>{const f=h=>{const m=h.target;!m.closest("#add-menu")&&!m.closest("#add-variable-btn")&&s(!1)};return document.addEventListener("click",f),()=>document.removeEventListener("click",f)},[]),g.jsxs("div",{className:"flex items-center justify-between gap-4 p-4 border-b border-border",children:[g.jsx(is,{id:"add-variable-btn",ref:a,variant:"primary",icon:g.jsx(M5,{}),onClick:u,children:"Add Variable"}),g.jsx(zp,{id:"search-input",value:r,onChange:e,placeholder:"Search...",count:r?`${c}/${d}`:""}),t.message&&g.jsx("span",{id:"status",className:`status ${t.type} ${t.type==="warning"?"clickable":""}`,onClick:t.type==="warning"?()=>{Se({type:"refresh"})}:void 0,style:t.type==="warning"?{cursor:"pointer"}:void 0,children:t.message}),i&&g.jsx(FP,{position:o,onClose:()=>s(!1)})]})}function HP({status:t}){const{filteredVariables:e,colorVariables:n,isGroupCollapsed:r,collapseGroups:i,expandGroups:s,getGroupContrastColor:o,getSingleContrastColor:l,selectedModeId:a,setSelectedModeId:u,selectedVariableTypes:c,selectedCollectionIds:d,selectedGroups:f,toggleVariableType:h,toggleCollection:m,toggleSelectedGroup:x}=Zt(),v=w.useRef(null),p=w.useMemo(()=>e.filter(D=>C5(D,f)),[e,f]),{grouped:y,ungrouped:b,sortedGroups:C}=be.useMemo(()=>{const D={},L=[];return p.forEach(A=>{const T=Qi(A.name);if(T){const V=A.name.split("/");D[T]||(D[T]=[]),D[T].push({...A,displayName:V[V.length-1]})}else L.push({...A,displayName:A.name})}),{grouped:D,ungrouped:L,sortedGroups:Object.keys(D).sort()}},[p]),S=C.some(D=>r(D));C.some(D=>!r(D));const k=w.useCallback(()=>{s(C)},[s,C]),E=w.useCallback(()=>{i(C)},[i,C]),$=g.jsxs("div",{className:"table-header-content flex justify-between items-center",children:[g.jsx("span",{children:"Name"}),C.length>0&&g.jsx("div",{className:"table-header-actions",children:g.jsx("button",{type:"button",className:"table-header-action",onClick:S?k:E,title:S?"Expand all groups":"Collapse all groups","aria-label":S?"Expand all groups":"Collapse all groups",children:S?g.jsx(D5,{}):g.jsx(N5,{})})})]});return g.jsxs("div",{className:"flex h-full",children:[g.jsx(j5,{selectedModeId:a,onModeChange:u,selectedTypes:c,onTypeToggle:h,selectedCollections:d,onCollectionToggle:m,selectedGroups:f,onGroupToggle:x}),g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[g.jsx(_P,{status:t}),g.jsx("div",{className:"flex-1 overflow-auto border-l-0",children:p.length?g.jsx("div",{className:"table-container relative",ref:v,tabIndex:0,children:g.jsxs("table",{className:"spreadsheet w-full border border-l-0 border-border border-collapse",children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{className:"text-left font-semibold border border-border px-3 py-2 bg-base-2",children:$}),g.jsx("th",{className:"text-left font-semibold border border-border px-3 py-2 bg-base-2",children:"Value"}),g.jsx("th",{className:"text-left font-semibold border border-border px-3 py-2 bg-base-2",children:"Collection"}),g.jsx("th",{className:"text-left font-semibold border border-border px-3 py-2 bg-base-2",children:"Accessibility"}),g.jsx("th",{className:"w-[100px] min-w-[100px] max-w-[100px] text-left font-semibold border border-border px-3 py-2 bg-base-2",children:"Actions"})]})}),g.jsxs("tbody",{id:"table-body",children:[b.map(D=>g.jsx(p4,{variable:D,isGrouped:!1,contrastColor:D.resolvedType==="COLOR"?l(D.id):null,colorVariables:n,selectedModeId:a},D.id)),C.map(D=>{const L=r(D),A=y[D],T=o(D);return g.jsxs(be.Fragment,{children:[g.jsx(vP,{groupName:D,variables:A,isCollapsed:L}),A.map((V,M)=>g.jsx(p4,{variable:V,isGrouped:!0,isHidden:L,groupName:D,isLastInGroup:M===A.length-1,contrastColor:T,colorVariables:n,selectedModeId:a},V.id))]},D)})]})]})}):g.jsx("div",{className:"table-container",children:g.jsxs("table",{className:"spreadsheet w-full border border-l-0 border-border border-collapse",children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{className:"text-left font-semibold border border-border px-3 py-2 bg-base-2",children:$}),g.jsx("th",{className:"text-left font-semibold border border-border px-3 py-2 bg-base-2",children:"Value"}),g.jsx("th",{className:"text-left font-semibold border border-border px-3 py-2 bg-base-2",children:"Collection"}),g.jsx("th",{className:"text-left font-semibold border border-border px-3 py-2 bg-base-2",children:"Accessibility"}),g.jsx("th",{className:"w-[100px] min-w-[100px] max-w-[100px] text-left font-semibold border border-border px-3 py-2 bg-base-2",children:"Actions"})]})}),g.jsx("tbody",{children:g.jsx("tr",{className:"empty-state-row",children:g.jsx("td",{colSpan:5,children:g.jsx("div",{className:"empty-state",children:"No variables match the selected filters"})})})})]})})})]})]})}function p1(){return p1=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},p1.apply(null,arguments)}function zP(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}let m1=[],V5=[];(()=>{let t="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,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?V5:m1).push(n=n+t[e])})();function WP(t){if(t<768)return!1;for(let e=0,n=m1.length;;){let r=e+n>>1;if(t<m1[r])n=r;else if(t>=V5[r])e=r+1;else return!0;if(e==n)return!1}}function C4(t){return t>=127462&&t<=127487}const k4=8205;function GP(t,e,n=!0,r=!0){return(n?F5:UP)(t,e,r)}function F5(t,e,n){if(e==t.length)return e;e&&_5(t.charCodeAt(e))&&H5(t.charCodeAt(e-1))&&e--;let r=ag(t,e);for(e+=S4(r);e<t.length;){let i=ag(t,e);if(r==k4||i==k4||n&&WP(i))e+=S4(i),r=i;else if(C4(i)){let s=0,o=e-2;for(;o>=0&&C4(ag(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function UP(t,e,n){for(;e>1;){let r=F5(t,e-2,n);if(r<e)return r;e--}return 0}function ag(t,e){let n=t.charCodeAt(e);if(!H5(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return _5(r)?(n-55296<<10)+(r-56320)+65536:n}function _5(t){return t>=56320&&t<57344}function H5(t){return t>=55296&&t<56320}function S4(t){return t<65536?1:2}class Xe{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]=$a(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),wi.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]=$a(this,e,n);let r=[];return this.decompose(e,n,r,0),wi.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 zu(this),s=new zu(e);for(let o=n,l=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(l+=i.value.length,i.done||l>=r)return!0}}iter(e=1){return new zu(this,e)}iterRange(e,n=this.length){return new z5(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 W5(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]?Xe.empty:e.length<=32?new Wt(e):wi.from(Wt.split(e,[]))}}class Wt extends Xe{constructor(e,n=KP(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],l=i+o.length;if((n?r:l)>=e)return new YP(i,l,r,o);i=l+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new Wt(E4(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),l=Wf(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new Wt(l,o.length+s.length));else{let a=l.length>>1;r.push(new Wt(l.slice(0,a)),new Wt(l.slice(a)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof Wt))return super.replace(e,n,r);[e,n]=$a(this,e,n);let i=Wf(this.text,Wf(r.text,E4(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new Wt(i,s):wi.from(Wt.split(i,[]),s)}sliceString(e,n=this.length,r=`
|
|
138
|
+
`){[e,n]=$a(this,e,n);let i="";for(let s=0,o=0;s<=n&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(i+=r),e<a&&n>s&&(i+=l.slice(Math.max(0,e-s),n-s)),s=a+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 Wt(r,i)),r=[],i=-1);return i>-1&&n.push(new Wt(r,i)),n}}class wi extends Xe{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],l=i+o.length,a=r+o.lines-1;if((n?a:l)>=e)return o.lineInner(e,n,r,i);i=l+1,r=a+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&n>=o){let u=i&((o<=e?1:0)|(a>=n?2:0));o>=e&&a<=n&&!u?r.push(l):l.decompose(e-o,n-o,r,u)}o=a+1}}replace(e,n,r){if([e,n]=$a(this,e,n),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],l=s+o.length;if(e>=s&&n<=l){let a=o.replace(e-s,n-s,r),u=this.lines-o.lines+a.lines;if(a.lines<u>>4&&a.lines>u>>6){let c=this.children.slice();return c[i]=a,new wi(c,this.length-(n-e)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
|
|
139
|
+
`){[e,n]=$a(this,e,n);let i="";for(let s=0,o=0;s<this.children.length&&o<=n;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(i+=r),e<a&&n>o&&(i+=l.sliceString(e-o,n-o,r)),o=a+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof wi))return 0;let r=0,[i,s,o,l]=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==l)return r;let a=this.children[i],u=e.children[s];if(a!=u)return r+a.scanIdentical(u,n);r+=a.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 m of e)m.flatten(h);return new Wt(h,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,l=[],a=0,u=-1,c=[];function d(h){let m;if(h.lines>s&&h instanceof wi)for(let x of h.children)d(x);else h.lines>o&&(a>o||!a)?(f(),l.push(h)):h instanceof Wt&&a&&(m=c[c.length-1])instanceof Wt&&h.lines+m.lines<=32?(a+=h.lines,u+=h.length+1,c[c.length-1]=new Wt(m.text.concat(h.text),m.length+1+h.length)):(a+h.lines>i&&f(),a+=h.lines,u+=h.length+1,c.push(h))}function f(){a!=0&&(l.push(c.length==1?c[0]:wi.from(c,u)),u=-1,a=c.length=0)}for(let h of e)d(h);return f(),l.length==1?l[0]:new wi(l,n)}}Xe.empty=new Wt([""],0);function KP(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Wf(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s<t.length&&i<=r;s++){let l=t[s],a=i+l.length;a>=n&&(a>r&&(l=l.slice(0,r-i)),i<n&&(l=l.slice(n-i)),o?(e[e.length-1]+=l,o=!1):e.push(l)),i=a+1}return e}function E4(t,e,n){return Wf(t,[""],e,n)}class zu{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 Wt?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,l=i instanceof Wt?i.text.length:i.children.length;if(o==(n>0?l: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=`
|
|
140
|
+
`,this;e--}else if(i instanceof Wt){let a=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,a.length>Math.max(0,e))return this.value=e==0?a:n>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=i.children[o+(n<0?-1:0)];e>a.length?(e-=a.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(n>0?1:(a instanceof Wt?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class z5{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new zu(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 W5{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"&&(Xe.prototype[Symbol.iterator]=function(){return this.iter()},zu.prototype[Symbol.iterator]=z5.prototype[Symbol.iterator]=W5.prototype[Symbol.iterator]=function(){return this});class YP{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 $a(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function un(t,e,n=!0,r=!0){return GP(t,e,n,r)}function XP(t){return t>=56320&&t<57344}function qP(t){return t>=55296&&t<56320}function Yn(t,e){let n=t.charCodeAt(e);if(!qP(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return XP(r)?(n-55296<<10)+(r-56320)+65536:n}function Rx(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Ci(t){return t<65536?1:2}const g1=/\r\n?|\n/;var Bn=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(Bn||(Bn={}));class Ni{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){y1(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 Ni(e)}composeDesc(e){return this.empty?e:e.empty?this:G5(this,e)}mapDesc(e,n=!1){return e.empty?this:x1(this,e,n)}mapPos(e,n=-1,r=Bn.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],u=i+l;if(a<0){if(u>e)return s+(e-i);s+=l}else{if(r!=Bn.Simple&&u>=e&&(r==Bn.TrackDel&&i<e&&u>e||r==Bn.TrackBefore&&i<e||r==Bn.TrackAfter&&u>e))return null;if(u>e||u==e&&n<0&&!l)return e==i||n<0?s:s+a;s+=a}i=u}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++],l=i+s;if(o>=0&&i<=n&&l>=e)return i<e&&l>n?"cover":!0;i=l}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 Ni(e)}static create(e){return new Ni(e)}}class nn extends Ni{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 y1(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return x1(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],l=n[i+1];if(l>=0){n[i]=l,n[i+1]=o;let a=i>>1;for(;r.length<a;)r.push(Xe.empty);r.push(o?e.slice(s,s+o):Xe.empty)}s+=o}return new nn(n,r)}compose(e){return this.empty?e:e.empty?this:G5(this,e,!0)}map(e,n=!1){return e.empty?this:x1(this,e,n,!0)}iterChanges(e,n=!1){y1(this,e,n)}get desc(){return Ni.create(this.sections)}filter(e){let n=[],r=[],i=[],s=new wc(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-l);En(i,c,-1);let d=s.ins==-1?-1:s.off==0?s.ins:0;En(n,c,d),d>0&&Ps(r,n,s.text),s.forward(c),l+=c}let u=e[o++];for(;l<u;){if(s.done)break e;let c=Math.min(s.len,u-l);En(n,c,-1),En(i,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new nn(n,r),filtered:Ni.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,l=null;function a(c=!1){if(!c&&!i.length)return;o<n&&En(i,n-o,-1);let d=new nn(i,s);l=l?l.compose(d.map(l)):d,i=[],s=[],o=0}function u(c){if(Array.isArray(c))for(let d of c)u(d);else if(c instanceof nn){if(c.length!=n)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${n})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:d,to:f=d,insert:h}=c;if(d>f||d<0||f>n)throw new RangeError(`Invalid change range ${d} to ${f} (in doc of length ${n})`);let m=h?typeof h=="string"?Xe.of(h.split(r||g1)):h:Xe.empty,x=m.length;if(d==f&&x==0)return;d<o&&a(),d>o&&En(i,d-o,-1),En(i,f-d,x),Ps(s,i,m),o=f}}return u(e),a(!l),l}static empty(e){return new nn(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,l)=>l&&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(Xe.empty);r[i]=Xe.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new nn(n,r)}static createSet(e,n){return new nn(e,n)}}function En(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:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function Ps(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(Xe.empty);t.push(n)}}function y1(t,e,n){let r=t.inserted;for(let i=0,s=0,o=0;o<t.sections.length;){let l=t.sections[o++],a=t.sections[o++];if(a<0)i+=l,s+=l;else{let u=i,c=s,d=Xe.empty;for(;u+=l,c+=a,a&&r&&(d=d.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(i,u,s,c,d),i=u,s=c}}}function x1(t,e,n,r=!1){let i=[],s=r?[]:null,o=new wc(t),l=new wc(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);En(i,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!n))){let u=l.len;for(En(i,l.ins,-1);u;){let c=Math.min(o.len,u);o.ins>=0&&a<o.i&&o.len<=c&&(En(i,0,o.ins),s&&Ps(s,i,o.text),a=o.i),o.forward(c),u-=c}l.next()}else if(o.ins>=0){let u=0,c=o.len;for(;c;)if(l.ins==-1){let d=Math.min(c,l.len);u+=d,c-=d,l.forward(d)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;En(i,u,a<o.i?o.ins:0),s&&a<o.i&&Ps(s,i,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?nn.createSet(i,s):Ni.create(i);throw new Error("Mismatched change set lengths")}}}function G5(t,e,n=!1){let r=[],i=n?[]:null,s=new wc(t),o=new wc(e);for(let l=!1;;){if(s.done&&o.done)return i?nn.createSet(r,i):Ni.create(r);if(s.ins==0)En(r,s.len,0,l),s.next();else if(o.len==0&&!o.done)En(r,0,o.ins,l),i&&Ps(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),u=r.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;En(r,a,c,l),i&&c&&Ps(i,r,o.text)}else o.ins==-1?(En(r,s.off?0:s.len,a,l),i&&Ps(i,r,s.textBit(a))):(En(r,s.off?0:s.len,o.off?0:o.ins,l),i&&!o.off&&Ps(i,r,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||r.length>u),s.forward2(a),o.forward(a)}}}}class wc{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?Xe.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Xe.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)}}class $s{constructor(e,n,r,i){this.from=e,this.to=n,this.flags=r,this.goalColumn=i}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 undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null: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 $s(r,i,this.flags,this.goalColumn)}extend(e,n=e,r=0){if(e<=this.anchor&&n>=this.anchor)return J.range(e,n,void 0,void 0,r);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return J.range(this.anchor,i,void 0,void 0,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!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 J.range(e.anchor,e.head)}static create(e,n,r,i){return new $s(e,n,r,i)}}class J{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:J.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 J([this.main],0)}addRange(e,n=!0){return J.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,J.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 J(e.ranges.map(n=>$s.fromJSON(n)),e.main)}static single(e,n=e){return new J([J.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 J.normalized(e.slice(),n);r=s.to}return new J(e,n)}static cursor(e,n=0,r,i){return $s.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r)),i)}static range(e,n,r,i,s){let o=i==null?7:Math.min(6,i);return!s&&e!=n&&(s=n<e?1:-1),s&&(o|=s<0?8:16),n<e?$s.create(n,e,o|32,r):$s.create(e,n,o,r)}static undirectionalRange(e,n){return $s.create(e,n,64,void 0)}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 l=o.from,a=Math.max(s.to,o.to);i<=n&&n--,e.splice(--i,2,s.anchor>s.head?J.range(a,l):J.range(l,a))}}return new J(e,n)}}function U5(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Bx=0;class ve{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=Bx++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new ve(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Ox),!!e.static,e.enables)}of(e){return new Gf([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Gf(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Gf(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Ox(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Gf{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=Bx++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,u=!1,c=[];for(let d of this.dependencies)d=="doc"?a=!0:d=="selection"?u=!0:((n=e[d.id])!==null&&n!==void 0?n:1)&1||c.push(e[d.id]);return{create(d){return d.values[o]=r(d),1},update(d,f){if(a&&f.docChanged||u&&(f.docChanged||f.selection)||v1(d,c)){let h=r(d);if(l?!$4(h,d.values[o],i):!i(h,d.values[o]))return d.values[o]=h,1}return 0},reconfigure:(d,f)=>{let h,m=f.config.address[s];if(m!=null){let x=Lh(f,m);if(this.dependencies.every(v=>v instanceof ve?f.facet(v)===d.facet(v):v instanceof Nn?f.field(v,!1)==d.field(v,!1):!0)||(l?$4(h=r(d),x,i):i(h=r(d),x)))return d.values[o]=x,0}else h=r(d);return d.values[o]=h,1}}}get extension(){return this}}function $4(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 v1(t,e){let n=!1;for(let r of e)Wu(t,r)&1&&(n=!0);return n}function QP(t,e,n){let r=n.map(a=>t[a.id]),i=n.map(a=>a.type),s=r.filter(a=>!(a&1)),o=t[e.id]>>1;function l(a){let u=[];for(let c=0;c<r.length;c++){let d=Lh(a,r[c]);if(i[c]==2)for(let f of d)u.push(f);else u.push(d)}return e.combine(u)}return{create(a){for(let u of r)Wu(a,u);return a.values[o]=l(a),1},update(a,u){if(!v1(a,s))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,u){let c=v1(a,r),d=u.config.facets[e.id],f=u.facet(e);if(d&&!c&&Ox(n,d))return a.values[o]=f,0;let h=l(a);return e.compare(h,f)?(a.values[o]=f,0):(a.values[o]=h,1)}}}const Hd=ve.define({static:!0});class Nn{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 Nn(Bx++,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(Hd).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)=>{let s=r.facet(Hd),o=i.facet(Hd),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(r.values[n]=l.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Hd.of({field:this,create:e})]}get extension(){return this}}const Do={lowest:4,low:3,default:2,high:1,highest:0};function hu(t){return e=>new K5(e,t)}const dl={highest:hu(Do.highest),high:hu(Do.high),default:hu(Do.default),low:hu(Do.low),lowest:hu(Do.lowest)};class K5{constructor(e,n){this.inner=e,this.prec=n}get extension(){return this}}class Wp{of(e){return new b1(this,e)}reconfigure(e){return Wp.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class b1{constructor(e,n){this.compartment=e,this.inner=n}get extension(){return this}}class Ph{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 ZP(e,n,o))f instanceof Nn?i.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],u=[];for(let f of i)l[f.id]=u.length<<1,u.push(h=>f.slot(h));let c=r==null?void 0:r.config.facets;for(let f in s){let h=s[f],m=h[0].facet,x=c&&c[f]||[];if(h.every(v=>v.type==0))if(l[m.id]=a.length<<1|1,Ox(x,h))a.push(r.facet(m));else{let v=m.combine(h.map(p=>p.value));a.push(r&&m.compare(v,r.facet(m))?r.facet(m):v)}else{for(let v of h)v.type==0?(l[v.id]=a.length<<1|1,a.push(v.value)):(l[v.id]=u.length<<1,u.push(p=>v.dynamicSlot(p)));l[m.id]=u.length<<1,u.push(v=>QP(v,m,h))}}let d=u.map(f=>f(l));return new Ph(e,o,d,l,a,s)}}function ZP(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,l){let a=i.get(o);if(a!=null){if(a<=l)return;let u=r[a].indexOf(o);u>-1&&r[a].splice(u,1),o instanceof b1&&n.delete(o.compartment)}if(i.set(o,l),Array.isArray(o))for(let u of o)s(u,l);else if(o instanceof b1){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,l)}else if(o instanceof K5)s(o.inner,o.prec);else if(o instanceof Nn)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Gf)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,Do.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(u==o)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(u,l)}}return s(t,Do.default),r.reduce((o,l)=>o.concat(l))}function Wu(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 Lh(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const Y5=ve.define(),w1=ve.define({combine:t=>t.some(e=>e),static:!0}),X5=ve.define({combine:t=>t.length?t[0]:void 0,static:!0}),q5=ve.define(),Q5=ve.define(),Z5=ve.define(),J5=ve.define({combine:t=>t.length?t[0]:!1});class Pi{constructor(e,n){this.type=e,this.value=n}static define(){return new JP}}class JP{of(e){return new Pi(this,e)}}class eL{constructor(e){this.map=e}of(e){return new Be(this,e)}}class Be{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 Be(this.type,n)}is(e){return this.type==e}static define(e={}){return new eL(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}}Be.reconfigure=Be.define();Be.appendConfig=Be.define();class sn{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&&U5(r,n.newLength),s.some(l=>l.type==sn.time)||(this.annotations=s.concat(sn.time.of(Date.now())))}static create(e,n,r,i,s,o){return new sn(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(sn.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}sn.time=Pi.define();sn.userEvent=Pi.define();sn.addToHistory=Pi.define();sn.remote=Pi.define();function tL(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 ek(t,e,n){var r;let i,s,o;return n?(i=e.changes,s=nn.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:Be.mapEffects(t.effects,i).concat(Be.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function C1(t,e,n){let r=e.selection,i=sa(e.annotations);return e.userEvent&&(i=i.concat(sn.userEvent.of(e.userEvent))),{changes:e.changes instanceof nn?e.changes:nn.of(e.changes||[],n,t.facet(X5)),selection:r&&(r instanceof J?r:J.single(r.anchor,r.head)),effects:sa(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function tk(t,e,n){let r=C1(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=ek(r,C1(t,e[s],o?r.changes.newLength:t.doc.length),o)}let i=sn.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return rL(n?nL(i):i)}function nL(t){let e=t.startState,n=!0;for(let i of e.facet(q5)){let s=i(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:tL(n,s))}if(n!==!0){let i,s;if(n===!1)s=t.changes.invertedDesc,i=nn.empty(e.doc.length);else{let o=t.changes.filter(n);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=sn.create(e,i,t.selection&&t.selection.map(s),Be.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let r=e.facet(Q5);for(let i=r.length-1;i>=0;i--){let s=r[i](t);s instanceof sn?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof sn?t=s[0]:t=tk(e,sa(s),!1)}return t}function rL(t){let e=t.startState,n=e.facet(Z5),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=ek(r,C1(e,s,t.changes.newLength),!0))}return r==t?t:sn.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const iL=[];function sa(t){return t==null?iL:Array.isArray(t)?t:[t]}var Ct=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Ct||(Ct={}));const sL=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let k1;try{k1=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function oL(t){if(k1)return k1.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||sL.test(n)))return!0}return!1}function lL(t){return e=>{if(!/\S/.test(e))return Ct.Space;if(oL(e))return Ct.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Ct.Word;return Ct.Other}}class Ge{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 l=0;l<this.config.dynamicSlots.length;l++)Wu(this,l<<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 Wu(this,r),Lh(this,r)}update(...e){return tk(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let l of e.effects)l.is(Wp.reconfigure)?(n&&(i=new Map,n.compartments.forEach((a,u)=>i.set(u,a)),n=null),i.set(l.value.compartment,l.value.extension)):l.is(Be.reconfigure)?(n=null,r=l.value):l.is(Be.appendConfig)&&(n=null,r=sa(r).concat(l.value));let s;n?s=e.startState.values.slice():(n=Ph.resolve(r,i,this),s=new Ge(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,u)=>u.reconfigure(a,this),null).values);let o=e.startState.facet(w1)?e.newSelection:e.newSelection.asSingle();new Ge(n,e.newDoc,o,s,(l,a)=>a.update(l,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:J.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=sa(r.effects);for(let l=1;l<n.ranges.length;l++){let a=e(n.ranges[l]),u=this.changes(a.changes),c=u.map(i);for(let f=0;f<l;f++)s[f]=s[f].map(c);let d=i.mapDesc(u,!0);s.push(a.range.map(d)),i=i.compose(c),o=Be.mapEffects(o,c).concat(Be.mapEffects(sa(a.effects),d))}return{changes:i,selection:J.create(s,n.mainIndex),effects:o}}changes(e=[]){return e instanceof nn?e:nn.of(e,this.doc.length,this.facet(Ge.lineSeparator))}toText(e){return Xe.of(e.split(this.facet(Ge.lineSeparator)||g1))}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:(Wu(this,n),Lh(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 Nn&&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],l=e[s];i.push(o.init(a=>o.spec.fromJSON(l,a)))}}return Ge.create({doc:e.doc,selection:J.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=Ph.resolve(e.extensions||[],new Map),r=e.doc instanceof Xe?e.doc:Xe.of((e.doc||"").split(n.staticFacet(Ge.lineSeparator)||g1)),i=e.selection?e.selection instanceof J?e.selection:J.single(e.selection.anchor,e.selection.head):J.single(0);return U5(i,r.length),n.staticFacet(w1)||(i=i.asSingle()),new Ge(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Ge.tabSize)}get lineBreak(){return this.facet(Ge.lineSeparator)||`
|
|
141
|
+
`}get readOnly(){return this.facet(J5)}phrase(e,...n){for(let r of this.facet(Ge.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(Y5))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return lL(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,l=e-r;for(;o>0;){let a=un(n,o,!1);if(s(n.slice(a,o))!=Ct.Word)break;o=a}for(;l<i;){let a=un(n,l);if(s(n.slice(l,a))!=Ct.Word)break;l=a}return o==l?null:J.range(o+r,l+r)}}Ge.allowMultipleSelections=w1;Ge.tabSize=ve.define({combine:t=>t.length?t[0]:4});Ge.lineSeparator=X5;Ge.readOnly=J5;Ge.phrases=ve.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])}});Ge.languageData=Y5;Ge.changeFilter=q5;Ge.transactionFilter=Q5;Ge.transactionExtender=Z5;Wp.reconfigure=Be.define();function Li(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](l,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 Zs{eq(e){return this==e}range(e,n=e){return S1.create(e,n,this)}}Zs.prototype.startSide=Zs.prototype.endSide=0;Zs.prototype.point=!1;Zs.prototype.mapMode=Bn.TrackDel;function jx(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let S1=class nk{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new nk(e,n,r)}};function E1(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Vx{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,l=s.length;;){if(o==l)return o;let a=o+l>>1,u=s[a]-e||(r?this.value[a].endSide:this.value[a].startSide)-n;if(a==o)return u>=0?o:l;u>=0?l=a:o=a+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,l=-1;for(let a=0;a<this.value.length;a++){let u=this.value[a],c=this.from[a]+e,d=this.to[a]+e,f,h;if(c==d){let m=n.mapPos(c,u.startSide,u.mapMode);if(m==null||(f=h=m,u.startSide!=u.endSide&&(h=n.mapPos(c,u.endSide),h<f)))continue}else if(f=n.mapPos(c,u.startSide),h=n.mapPos(d,u.endSide),f>h||f==h&&u.startSide>0&&u.endSide<=0)continue;(h-f||u.endSide-u.startSide)<0||(o<0&&(o=f),u.point&&(l=Math.max(l,h-f)),r.push(u),i.push(f-o),s.push(h-o))}return{mapped:r.length?new Vx(i,s,r,l):null,pos:o}}}class _e{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 _e(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(E1)),this.isEmpty)return n.length?_e.of(n):this;let l=new rk(this,null,-1).goto(0),a=0,u=[],c=new ss;for(;l.value||a<n.length;)if(a<n.length&&(l.from-n[a].from||l.startSide-n[a].value.startSide)>=0){let d=n[a++];c.addInner(d.from,d.to,d.value)||u.push(d)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==n.length||this.chunkEnd(l.chunkIndex)<n[a].from)&&(!o||i>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||i>l.to||s<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||u.push(S1.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!u.length?_e.empty:this.nextLayer.update({add:u,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 l=this.chunkPos[o],a=this.chunk[o],u=e.touchesRange(l,l+a.length);if(u===!1)i=Math.max(i,a.maxPoint),n.push(a),r.push(e.mapPos(l));else if(u===!0){let{mapped:c,pos:d}=a.map(l,e);c&&(i=Math.max(i,c.maxPoint),n.push(c),r.push(d))}}let s=this.nextLayer.map(e);return n.length==0?s:new _e(r,n,s||_e.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 Cc.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Cc.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),l=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=s),a=M4(o,l,r),u=new pu(o,a,s),c=new pu(l,a,s);r.iterGaps((d,f,h)=>D4(u,d,c,f,h,i)),r.empty&&r.length==0&&D4(u,0,c,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(c=>!c.isEmpty&&n.indexOf(c)<0),o=n.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=M4(s,o),a=new pu(s,l,0).goto(r),u=new pu(o,l,0).goto(r);for(;;){if(a.to!=u.to||!$1(a.active,u.active)||a.point&&(!u.point||!jx(a.point,u.point)))return!1;if(a.to>i)return!0;a.next(),u.next()}}static spans(e,n,r,i,s=-1){let o=new pu(e,null,s).goto(n),l=n,a=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let c=o.activeForPoint(o.to),d=o.pointFrom<n?c.length+1:o.point.startSide<0?c.length:Math.min(c.length,a);i.point(l,u,o.point,c,d,o.pointRank),a=Math.min(o.openEnd(u),c.length)}else u>l&&(i.span(l,u,o.active,a),a=o.openEnd(u));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(e,n=!1){let r=new ss;for(let i of e instanceof S1?[e]:n?aL(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return _e.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=_e.empty;i=i.nextLayer)n=new _e(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}_e.empty=new _e([],[],null,-1);function aL(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(E1(e,r)>0)return t.slice().sort(E1);e=r}return t}_e.empty.nextLayer=_e.empty;class ss{finishChunk(e){this.chunks.push(new Vx(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 ss)).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(_e.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=_e.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function M4(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 l=r.get(s.chunk[o]);l!=null&&(n?n.mapPos(l):l)==s.chunkPos[o]&&!(n!=null&&n.touchesRange(l,l+s.chunk[o].length))&&i.add(s.chunk[o])}return i}class rk{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 Cc{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 rk(o,n,r,s));return i.length==1?i[0]:new Cc(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--)ug(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--)ug(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(),ug(this.heap,0)}}}function ug(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 pu{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=Cc.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){zd(this.active,e),zd(this.activeTo,e),zd(this.activeRank,e),this.minActive=N4(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++;Wd(this.active,n,r),Wd(this.activeTo,n,i),Wd(this.activeRank,n,s),e&&Wd(e,n,this.cursor.from),this.minActive=N4(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&&zd(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 D4(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,l=r,a=r-e,u=!!s.boundChange;for(let c=!1;;){let d=t.to+a-n.to,f=d||t.endSide-n.endSide,h=f<0?t.to+a:n.to,m=Math.min(h,o);if(t.point||n.point?(t.point&&n.point&&jx(t.point,n.point)&&$1(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,m,t.point,n.point),c=!1):(c&&s.boundChange(l),m>l&&!$1(t.active,n.active)&&s.compareRange(l,m,t.active,n.active),u&&m<o&&(d||t.openEnd(h)!=n.openEnd(h))&&(c=!0)),h>o)break;l=h,f<=0&&t.next(),f>=0&&n.next()}}function $1(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!jx(t[n],e[n]))return!1;return!0}function zd(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function Wd(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function N4(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 Ga(t,e,n=t.length){let r=0;for(let i=0;i<n&&i<t.length;)t.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=un(t,i));return r}function M1(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=un(t,i)}return r===!0?-1:t.length}const D1="ͼ",A4=typeof Symbol>"u"?"__"+D1:Symbol.for(D1),N1=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),T4=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Js{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,u){let c=[],d=/^@(\w+)\b/.exec(o[0]),f=d&&d[1]=="keyframes";if(d&&l==null)return a.push(o[0]+";");for(let h in l){let m=l[h];if(/&/.test(h))s(h.split(/,\s*/).map(x=>o.map(v=>x.replace(/&/,v))).reduce((x,v)=>x.concat(v)),m,a);else if(m&&typeof m=="object"){if(!d)throw new RangeError("The value of a property ("+h+") should be a primitive value.");s(i(h),m,c,f)}else m!=null&&c.push(h.replace(/_.*/,"").replace(/[A-Z]/g,x=>"-"+x.toLowerCase())+": "+m+";")}(c.length||f)&&a.push((r&&!d&&!u?o.map(r):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
142
|
+
`)}static newName(){let e=T4[A4]||1;return T4[A4]=e+1,D1+e.toString(36)}static mount(e,n,r){let i=e[N1],s=r&&r.nonce;i?s&&i.setNonce(s):i=new uL(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let P4=new Map;class uL{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=P4.get(r);if(s)return e[N1]=s;this.sheet=new i.CSSStyleSheet,P4.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[N1]=this}mount(e,n){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),r)for(let u=0;u<l.rules.length;u++)r.insertRule(l.rules[u],i++)}else{for(;s<a;)i+=this.modules[s++].rules.length;i+=l.rules.length,s++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
|
|
143
|
+
`;this.styleTag.textContent=o;let l=n.head||n;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var eo={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:"'"},kc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},cL=typeof navigator<"u"&&/Mac/.test(navigator.platform),dL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var xn=0;xn<10;xn++)eo[48+xn]=eo[96+xn]=String(xn);for(var xn=1;xn<=24;xn++)eo[xn+111]="F"+xn;for(var xn=65;xn<=90;xn++)eo[xn]=String.fromCharCode(xn+32),kc[xn]=String.fromCharCode(xn);for(var cg in eo)kc.hasOwnProperty(cg)||(kc[cg]=eo[cg]);function fL(t){var e=cL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||dL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?kc:eo)[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 ot(){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++)ik(t,arguments[e]);return t}function ik(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++)ik(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}let In=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},A1=typeof document<"u"?document:{documentElement:{style:{}}};const T1=/Edge\/(\d+)/.exec(In.userAgent),sk=/MSIE \d/.test(In.userAgent),P1=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(In.userAgent),Gp=!!(sk||P1||T1),L4=!Gp&&/gecko\/(\d+)/i.test(In.userAgent),dg=!Gp&&/Chrome\/(\d+)/.exec(In.userAgent),I4="webkitFontSmoothing"in A1.documentElement.style,L1=!Gp&&/Apple Computer/.test(In.vendor),R4=L1&&(/Mobile\/\w+/.test(In.userAgent)||In.maxTouchPoints>2);var ge={mac:R4||/Mac/.test(In.platform),windows:/Win/.test(In.platform),linux:/Linux|X11/.test(In.platform),ie:Gp,ie_version:sk?A1.documentMode||6:P1?+P1[1]:T1?+T1[1]:0,gecko:L4,gecko_version:L4?+(/Firefox\/(\d+)/.exec(In.userAgent)||[0,0])[1]:0,chrome:!!dg,chrome_version:dg?+dg[1]:0,ios:R4,android:/Android\b/.test(In.userAgent),webkit:I4,webkit_version:I4?+(/\bAppleWebKit\/(\d+)/.exec(In.userAgent)||[0,0])[1]:0,safari:L1,safari_version:L1?+(/\bVersion\/(\d+(\.\d+)?)/.exec(In.userAgent)||[0,0])[1]:0,tabSize:A1.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Fx(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 Ih=Object.create(null);function _x(t,e,n){if(t==e)return!0;t||(t=Ih),e||(e=Ih);let r=Object.keys(t),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function hL(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function B4(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 pL(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 Ii{eq(e){return!1}updateDOM(e,n,r){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 bn=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(bn||(bn={}));class Ae extends Zs{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 rd(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 Jo(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}=ok(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new Jo(e,r,i,n,e.widget||null,!0)}static line(e){return new id(e)}static set(e,n=!1){return _e.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ae.none=_e.empty;class rd extends Ae{constructor(e){let{start:n,end:r}=ok(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Fx(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Ih}eq(e){return this==e||e instanceof rd&&this.tagName==e.tagName&&_x(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}rd.prototype.point=!1;class id extends Ae{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof id&&this.spec.class==e.spec.class&&_x(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)}}id.prototype.mapMode=Bn.TrackBefore;id.prototype.point=!0;class Jo extends Ae{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?Bn.TrackBefore:Bn.TrackAfter:Bn.TrackDel}get type(){return this.startSide!=this.endSide?bn.WidgetRange:this.startSide<=0?bn.WidgetBefore:bn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Jo&&mL(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)}}Jo.prototype.point=!0;function ok(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 mL(t,e){return t==e||!!(t&&e&&t.compare(e))}function oa(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 Sc extends Zs{constructor(e,n,r){super(),this.tagName=e,this.attributes=n,this.rank=r}eq(e){return e==this||e instanceof Sc&&this.tagName==e.tagName&&_x(this.attributes,e.attributes)}static create(e){return new Sc(e.tagName,e.attributes||Ih,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,n=!1){return _e.of(e,n)}}Sc.prototype.startSide=Sc.prototype.endSide=-1;function Ec(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function I1(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Gu(t,e){if(!e.anchorNode)return!1;try{return I1(t,e.anchorNode)}catch{return!1}}function Uu(t){return t.nodeType==3?Mc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Ku(t,e,n,r){return n?O4(t,e,n,r,-1)||O4(t,e,n,r,1):!1}function to(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Rh(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function O4(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:os(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=to(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?os(t):0}else return!1}}function os(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $c(t,e){let{left:n,right:r}=t;if(n==r)return t;let i=e?n:r;return{left:i,right:i,top:t.top,bottom:t.bottom}}function gL(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 lk(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 yL(t,e,n,r,i,s,o,l){let a=t.ownerDocument,u=a.defaultView||window;for(let c=t,d=!1;c&&!d;)if(c.nodeType==1){let f,h=c==a.body,m=1,x=1;if(h)f=gL(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(d=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let y=c.getBoundingClientRect();({scaleX:m,scaleY:x}=lk(c,y)),f={left:y.left,right:y.left+c.clientWidth*m,top:y.top,bottom:y.top+c.clientHeight*x}}let v=0,p=0;if(i=="nearest")e.top<f.top+o?(p=e.top-(f.top+o),n>0&&e.bottom>f.bottom+p&&(p=e.bottom-f.bottom+o)):e.bottom>f.bottom-o&&(p=e.bottom-f.bottom+o,n<0&&e.top-p<f.top&&(p=e.top-(f.top+o)));else{let y=e.bottom-e.top,b=f.bottom-f.top;p=(i=="center"&&y<=b?e.top+y/2-b/2:i=="start"||i=="center"&&n<0?e.top-o:e.bottom-b+o)-f.top}if(r=="nearest"?e.left<f.left+s?(v=e.left-(f.left+s),n>0&&e.right>f.right+v&&(v=e.right-f.right+s)):e.right>f.right-s&&(v=e.right-f.right+s,n<0&&e.left<f.left+v&&(v=e.left-(f.left+s))):v=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==l?e.left-s:e.right-(f.right-f.left)+s)-f.left,v||p)if(h)u.scrollBy(v,p);else{let y=0,b=0;if(p){let C=c.scrollTop;c.scrollTop+=p/x,b=(c.scrollTop-C)*x}if(v){let C=c.scrollLeft;c.scrollLeft+=v/m,y=(c.scrollLeft-C)*m}e={left:e.left-y,top:e.top-b,right:e.right-y,bottom:e.bottom-b},y&&Math.abs(y-v)<1&&(r="nearest"),b&&Math.abs(b-p)<1&&(i="nearest")}if(h)break;(e.top<f.top||e.bottom>f.bottom||e.left<f.left||e.right>f.right)&&(e={left:Math.max(e.left,f.left),right:Math.min(e.right,f.right),top:Math.max(e.top,f.top),bottom:Math.min(e.bottom,f.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function ak(t,e=!0){let n=t.ownerDocument,r=null,i=null;for(let s=t.parentNode;s&&!(s==n.body||(!e||r)&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),e&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:i}}class xL{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?os(n):0),r,Math.min(e.focusOffset,r?os(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}function uk(t){let e=[];for(let n=t;n;n=n.nodeType==11?n.host:n.parentNode)n.nodeType==1&&e.push({node:n,left:n.scrollLeft,top:n.scrollTop});return e}function ck(t,e=!0){for(let{node:n,left:r,top:i}of t)e&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}let So=null;ge.safari&&ge.safari_version>=26&&(So=!1);function dk(t){if(t.setActive)return t.setActive();if(So)return t.focus(So);let e=uk(t);t.focus(So==null?{get preventScroll(){return So={preventScroll:!0},!0}}:void 0),So||(So=!1,ck(e))}let j4;function Mc(t,e,n=e){let r=j4||(j4=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function la(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 vL(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function bL(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,os(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=os(n))}else{if(n==t)return!0;r=to(n),n=n.parentNode}}function fk(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function hk(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=os(n)}else if(n.parentNode&&!Rh(n))r=to(n),n=n.parentNode;else return null}}function pk(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&&!Rh(n))r=to(n)+1,n=n.parentNode;else return null}}class Xr{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new Xr(e.parentNode,to(e),n)}static after(e,n){return new Xr(e.parentNode,to(e)+1,n)}}var at=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(at||(at={}));const el=at.LTR,Hx=at.RTL;function mk(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const wL=mk("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),CL=mk("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),R1=Object.create(null),fi=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);R1[e]=n,R1[n]=-e}function gk(t){return t<=247?wL[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?CL[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const kL=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Si{get dir(){return this.level%2?Hx:el}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 l=e[o];if(l.from<=n&&l.to>=n){if(l.level==r)return o;(s<0||(i!=0?i<0?l.from<n:l.to>n:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function yk(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||!yk(r.inner,i.inner))return!1}return!0}const lt=[];function SL(t,e,n,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,l=s<r.length?r[s].from:n,a=s?256:i;for(let u=o,c=a,d=a;u<l;u++){let f=gk(t.charCodeAt(u));f==512?f=c:f==8&&d==4&&(f=16),lt[u]=f==4?2:f,f&7&&(d=f),c=f}for(let u=o,c=a,d=a;u<l;u++){let f=lt[u];if(f==128)u<l-1&&c==lt[u+1]&&c&24?f=lt[u]=c:lt[u]=256;else if(f==64){let h=u+1;for(;h<l&<[h]==64;)h++;let m=u&&c==8||h<n&<[h]==8?d==1?1:8:256;for(let x=u;x<h;x++)lt[x]=m;u=h-1}else f==8&&d==1&&(lt[u]=1);c=f,f&7&&(d=f)}}}function EL(t,e,n,r,i){let s=i==1?2:1;for(let o=0,l=0,a=0;o<=r.length;o++){let u=o?r[o-1].to:e,c=o<r.length?r[o].from:n;for(let d=u,f,h,m;d<c;d++)if(h=R1[f=t.charCodeAt(d)])if(h<0){for(let x=l-3;x>=0;x-=3)if(fi[x+1]==-h){let v=fi[x+2],p=v&2?i:v&4?v&1?s:i:0;p&&(lt[d]=lt[fi[x]]=p),l=x;break}}else{if(fi.length==189)break;fi[l++]=d,fi[l++]=f,fi[l++]=a}else if((m=lt[d])==2||m==1){let x=m==i;a=x?0:1;for(let v=l-3;v>=0;v-=3){let p=fi[v+2];if(p&2)break;if(x)fi[v+2]|=2;else{if(p&4)break;fi[v+2]|=4}}}}}function $L(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,l=i<n.length?n[i].from:e;for(let a=o;a<l;){let u=lt[a];if(u==256){let c=a+1;for(;;)if(c==l){if(i==n.length)break;c=n[i++].to,l=i<n.length?n[i].from:e}else if(lt[c]==256)c++;else break;let d=s==1,f=(c<e?lt[c]:r)==1,h=d==f?d?1:2:r;for(let m=c,x=i,v=x?n[x-1].to:t;m>a;)m==v&&(m=n[--x].from,v=x?n[x-1].to:t),lt[--m]=h;a=c}else s=u,a++}}}function B1(t,e,n,r,i,s,o){let l=r%2?2:1;if(r%2==i%2)for(let a=e,u=0;a<n;){let c=!0,d=!1;if(u==s.length||a<s[u].from){let x=lt[a];x!=l&&(c=!1,d=x==16)}let f=!c&&l==1?[]:null,h=c?r:r+1,m=a;e:for(;;)if(u<s.length&&m==s[u].from){if(d)break e;let x=s[u];if(!c)for(let v=x.to,p=u+1;;){if(v==n)break e;if(p<s.length&&s[p].from==v)v=s[p++].to;else{if(lt[v]==l)break e;break}}if(u++,f)f.push(x);else{x.from>a&&o.push(new Si(a,x.from,h));let v=x.direction==el!=!(h%2);O1(t,v?r+1:r,i,x.inner,x.from,x.to,o),a=x.to}m=x.to}else{if(m==n||(c?lt[m]!=l:lt[m]==l))break;m++}f?B1(t,a,m,r+1,i,f,o):a<m&&o.push(new Si(a,m,h)),a=m}else for(let a=n,u=s.length;a>e;){let c=!0,d=!1;if(!u||a>s[u-1].to){let x=lt[a-1];x!=l&&(c=!1,d=x==16)}let f=!c&&l==1?[]:null,h=c?r:r+1,m=a;e:for(;;)if(u&&m==s[u-1].to){if(d)break e;let x=s[--u];if(!c)for(let v=x.from,p=u;;){if(v==e)break e;if(p&&s[p-1].to==v)v=s[--p].from;else{if(lt[v-1]==l)break e;break}}if(f)f.push(x);else{x.to<a&&o.push(new Si(x.to,a,h));let v=x.direction==el!=!(h%2);O1(t,v?r+1:r,i,x.inner,x.from,x.to,o),a=x.from}m=x.from}else{if(m==e||(c?lt[m-1]!=l:lt[m-1]==l))break;m--}f?B1(t,m,a,r+1,i,f,o):m<a&&o.push(new Si(m,a,h)),a=m}}function O1(t,e,n,r,i,s,o){let l=e%2?2:1;SL(t,i,s,r,l),EL(t,i,s,r,l),$L(i,s,r,l),B1(t,i,s,e,n,r,o)}function ML(t,e,n){if(!t)return[new Si(0,0,e==Hx?1:0)];if(e==el&&!n.length&&!kL.test(t))return xk(t.length);if(n.length)for(;t.length>lt.length;)lt[lt.length]=256;let r=[],i=e==el?0:1;return O1(t,i,i,n,0,t.length,r),r}function xk(t){return[new Si(0,t,0)]}let vk="";function DL(t,e,n,r,i){var s;let o=r.head-t.from,l=Si.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=e[l],u=a.side(i,n);if(o==u){let f=l+=i?1:-1;if(f<0||f>=e.length)return null;a=e[l=f],o=a.side(!i,n),u=a.side(i,n)}let c=un(t.text,o,a.forward(i,n));(c<a.from||c>a.to)&&(c=u),vk=t.text.slice(Math.min(o,c),Math.max(o,c));let d=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return d&&c==u&&d.level+(i?0:1)<a.level?J.cursor(d.side(!i,n)+t.from,d.forward(i,n)?1:-1,d.level):J.cursor(c+t.from,a.forward(i,n)?-1:1,a.level)}function NL(t,e,n){for(let r=e;r<n;r++){let i=gk(t.charCodeAt(r));if(i==1)return el;if(i==2||i==4)return Hx}return el}const bk=ve.define(),wk=ve.define(),Ck=ve.define(),kk=ve.define(),j1=ve.define(),Sk=ve.define(),Ek=ve.define(),zx=ve.define(),Wx=ve.define(),$k=ve.define({combine:t=>t.some(e=>e)}),Mk=ve.define({combine:t=>t.some(e=>e)}),Dk=ve.define();class aa{constructor(e,n,r,i,s,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 aa(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 aa(J.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Gd=Be.define({map:(t,e)=>t.map(e)}),Nk=Be.define();function Jn(t,e,n){let r=t.facet(kk);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 Ui=ve.define({combine:t=>t.length?t[0]:!0});let AL=0;const Gl=ve.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class Vt{constructor(e,n,r,i,s){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(Gl.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Gl.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=n||{};return new Vt(AL++,e,r,i,l=>{let a=[];return o&&a.push(Up.of(u=>{let c=u.plugin(l);return c?o(c):Ae.none})),s&&a.push(s(l)),a})}static fromClass(e,n){return Vt.define((r,i)=>new e(r,i),n)}}class fg{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}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(Jn(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.plugin.create(e,this.spec.arg)}catch(n){Jn(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){Jn(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ak=ve.define(),Gx=ve.define(),Up=ve.define(),Tk=ve.define(),Ux=ve.define(),sd=ve.define(),Pk=ve.define();function V4(t,e){let n=t.state.facet(Pk);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return _e.spans(r,e.from,e.to,{point(){},span(s,o,l,a){let u=s-e.from,c=o-e.from,d=i;for(let f=l.length-1;f>=0;f--,a--){let h=l[f].spec.bidiIsolate,m;if(h==null&&(h=NL(e.text,u,c)),a>0&&d.length&&(m=d[d.length-1]).to==u&&m.direction==h)m.to=c,d=m.inner;else{let x={from:u,to:c,direction:h,inner:[]};d.push(x),d=x.inner}}}}),i}const Lk=ve.define();function Kx(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(Lk)){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 $u=ve.define();class Ar{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new Ar(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;;){let l=i<e.length?e[i].fromB:1e9,a=s<n.length?n[s]:1e9,u=Math.min(l,a);if(u==1e9)break;let c=u+o,d=u,f=c;for(;;)if(s<n.length&&n[s]<=d){let h=n[s+1];s+=2,d=Math.max(d,h);for(let m=i;m<e.length&&e[m].fromB<=d;m++)o=e[m].toA-e[m].toB;f=Math.max(f,h+o)}else if(i<e.length&&e[i].fromB<=d){let h=e[i++];d=Math.max(d,h.toB),f=Math.max(f,h.toA),o=h.toA-h.toB}else break;r.push(new Ar(c,f,u,d))}return r}}class Bh{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=nn.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,l,a)=>i.push(new Ar(s,o,l,a))),this.changedRanges=i}static create(e,n,r){return new Bh(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>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}}const TL=[];class Ot{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return TL}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&hL(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n,r){return null}domPosFor(e,n){let r=to(this.dom),i=this.length?e>0:n>0;return new Xr(this.parent.dom,r+(i?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Yp)return e;return null}static get(e){return e.cmTile}}class Kp extends Ot{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let n=this.dom,r=null,i,s=(e==null?void 0:e.node)==n?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=l.dom&&(s.written=!0),l.dom.parentNode==n)for(;i&&i!=l.dom;)i=F4(i);else n.insertBefore(l.dom,i);r=l.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=F4(i);this.length=o}}function F4(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Yp extends Kp{constructor(e,n){super(n),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let n=Ot.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let o=r.children[i++];if(o instanceof Zi)n.push(i),r=o,i=0;else{let l=s+o.length,a=e(o,s);if(a!==void 0)return a;s=l+o.breakAfter}}}resolveBlock(e,n){let r,i=-1,s,o=-1;if(this.blockTiles((l,a)=>{let u=a+l.length;if(e>=a&&e<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(r=void 0)}(a<e||e==u&&(n<-1?l.length:l.covers(1)))&&(!r||!l.isWidget()&&r.isWidget())&&(r=l,i=e-a),(u>e||e==a&&(n>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,o=e-a)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class Zi extends Kp{constructor(e,n){super(e),this.wrapper=n}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,n){let r=new Zi(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Ma extends Kp{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let i=new Ma(n||document.createElement("div"),e);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,n,r){let i=null,s=-1,o=null,l=-1;function a(c,d){for(let f=0,h=0;f<c.children.length&&h<=d;f++){let m=c.children[f],x=h+m.length;x>=d&&(m.isComposite()?a(m,d-h):(!o||o.isHidden&&(n>0&&!(o.flags&32)||r&&LL(o,m)))&&(x>d||m.flags&32&&n<=1)?(o=m,l=d-h):(h<d||m.flags&16&&!m.isHidden&&n>=-1)&&(i=m,s=d-h)),h=x}}a(this,e);let u=(n<0?i:o)||i||o;return u?{tile:u,offset:u==i?s:l}:null}coordsIn(e,n,r){let i=this.resolveInline(e,n,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),n,r):PL(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new Xr(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:n);let o=r.tile.parent,l=!1;for(let a of o.children){if(l)return new Xr(a.dom,0);a==r.tile&&(l=!0)}}return new Xr(this.dom,0)}}function PL(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=Uu(e);return n[n.length-1]||null}function LL(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.top<n.bottom}class Qn extends Kp{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let r=new Qn(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Io extends Ot{constructor(e,n){super(e,n.length),this.text=n}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,n,r){let i=this.dom.nodeValue.length;e>i&&(e=i);let s=e,o=e,l=0;e==0&&n<0||e==i&&n>=0?ge.chrome||ge.gecko||(e?(s--,l=1):o<i&&(o++,l=-1)):n<0?s--:o<i&&o++;let a=Mc(this.dom,s,o).getClientRects();if(!a.length)return null;let u=a[(l?l<0:n>=0)?0:a.length-1];return ge.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(a,c=>c.width)||u),r==null?u:$c(u,(l?l>0:n<0)==r)}static of(e,n){let r=new Io(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class tl extends Ot{constructor(e,n,r,i){super(e,n,i),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;if(r)return $c(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?s.length-1:0;o=s[a],!(e>0?a==0:a==s.length-1||o.top<o.bottom);a+=l?-1:1);return $c(o,!l)}}get overrideDOMText(){if(!this.length)return Xe.empty;let{root:e}=this;if(!e)return Xe.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,r,i,s){return s||(s=e.toDOM(n),e.editable||(s.contentEditable="false")),new tl(s,r,e,i)}}class Oh extends Ot{constructor(e){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,e)}get isHidden(){return!0}get overrideDOMText(){return Xe.empty}coordsIn(e,n,r){let i=this.dom.getBoundingClientRect();return r==null?i:$c(i,n>0==r)}}class IL{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:i,index:s,beforeBreak:o,parents:l}=this;for(;e||n>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!l.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=l.pop(),s++}else{let a=i.children[s],u=a.breakAfter;(n>0?a.length<=e:a.length<e)&&(!r||r.skip(a,0,a.length)!==!1||!a.isComposite)?(o=!!u,s++,e-=a.length):(l.push({tile:i,index:s}),i=a,s=0,r&&a.isComposite()&&r.enter(a))}else{let a=i.length;if(s<a&&e){let u=Math.min(e,a-s);r&&r.skip(i,s,s+u),e-=u,s+=u}if(s==a)o=!!i.breakAfter,{tile:i,index:s}=l.pop(),s++;else if(!e)break}return this.tile=i,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class RL{constructor(e,n,r,i){this.from=e,this.to=n,this.wrapper=r,this.rank=i}}class BL{constructor(e,n,r){this.cache=e,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,r,i){var s;this.flushBuffer();let o=this.ensureMarks(n,r),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+e.length<512){this.cache.reused.set(l,2);let a=o.children[o.children.length-1]=new Io(l.dom,l.text+e);a.parent=o}else o.append(i||Io.of(e,(s=this.cache.find(Io))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?hg(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let i=r;for(let l=n.marks.length-1;l>=0;l--){let a=n.marks[l],u=i.lastChild;if(u instanceof Qn&&u.mark.eq(a.mark))u.dom!=a.dom&&u.setDOM(hg(a.dom)),i=u;else{if(this.cache.reused.get(a)){let d=Ot.get(a.dom);d&&d.setDOM(hg(a.dom))}let c=Qn.of(a.mark,a.dom);i.append(c),i=c}this.cache.reused.set(a,2)}let s=Ot.get(e.text);s&&this.cache.reused.set(s,2);let o=new Io(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,n,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=Ik);let i=Ma.start(e,n||((r=this.cache.find(Ma))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,n){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],l;if(n>0&&(l=i.lastChild)&&l instanceof Qn&&l.mark.eq(o))i=l,n--;else{let a=Qn.of(o,(r=this.cache.find(Qn,u=>u.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(a),i=a,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!_4(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(ge.ios&&_4(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(pg,0,32)||new tl(pg.toDOM(),0,pg,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let n=e.rank*102+e.value.rank,r=new RL(e.from,e.to,e.value,n),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.from<this.pos&&i instanceof Zi&&i.wrapper.eq(r.wrapper))n=i;else{let s=Zi.of(r.wrapper,(e=this.cache.find(Zi,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(s),n=s}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(Oh,void 0,1);return r&&(r.flags=n),r||new Oh(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class OL{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=i;let l=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,l)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const jh=[tl,Ma,Io,Qn,Oh,Zi,Yp];for(let t=0;t<jh.length;t++)jh[t].bucket=t;class jL{constructor(e){this.view=e,this.buckets=jh.map(()=>[]),this.index=jh.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let l=0;l<s.length;l++){let a=(l+o)%s.length,u=s[a];if((!n||n(u))&&!this.reused.has(u))return s.splice(a,1),a<o&&this.index[i]--,this.reused.set(u,r),u}return null}findWidget(e,n,r){let i=this.buckets[0];if(i.length)for(let s=0,o=0;;s++){if(s==i.length){if(o)return null;o=1,s=0}let l=i[s];if(!this.reused.has(l)&&(o==0?l.widget.compare(e):l.widget.constructor==e.constructor&&e.updateDOM(l.dom,this.view,l.widget)))return i.splice(s,1),s<this.index[0]&&this.index[0]--,l.widget==e&&l.length==n&&(l.flags&497)==r?(this.reused.set(l,1),l):(this.reused.set(l,2),new tl(l.dom,n,e,l.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class VL{constructor(e,n,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new jL(e),this.text=new OL(e.state.doc),this.builder=new BL(this.cache,new Yp(e,e.contentDOM),_e.iter(r)),this.cache.reused.set(n,2),this.old=new IL(n),this.reuseWalker={skip:(o,l,a)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let i=0,s=0,o=0;;){let l=o<e.length?e[o++]:null,a=l?l.fromA:this.old.root.length;if(a>i){let u=a-i;this.preserve(u,!o,!l),i=a,s+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(s,n.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,l.toA),this.emit(n.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(s,l.toB)),s=l.toB,i=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,r){let i=HL(this.old),s=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,l,a)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let u=a>0||l<o.length?tl.of(o.widget,this.view,a-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);u.flags&256?(u.flags&=-2,this.builder.addBlockWidget(u)):(this.builder.ensureLine(null),this.builder.addInlineWidget(u,i,s),s=i.length)}else if(o.isText())this.builder.ensureLine(null),!l&&a==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,i,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,a),i,s)),s=i.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Oh)this.cache.add(o);else if(o instanceof Qn)this.builder.ensureLine(null),this.builder.addMark(o,i,s),this.cache.reused.set(o,1),s=i.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Qn&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof Qn&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,i=this.builder,s=-1,o=_e.spans(this.decorations,e,n,{point:(l,a,u,c,d,f)=>{if(u instanceof Jo){if(this.disallowBlockEffectsFor[f]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=c.length,d>c.length)i.continueWidget(a-l);else{let h=u.widget||(u.block?Da.block:Da.inline),m=FL(u),x=this.cache.findWidget(h,a-l,m)||tl.of(h,this.view,a-l,m);u.block?(u.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(x)):(i.ensureLine(r),i.addInlineWidget(x,c,d))}r=null}else r=_L(r,u);a>l&&this.text.skip(a-l)},span:(l,a,u,c)=>{for(let d=l;d<a;){let f=this.text.next(Math.min(512,a-d));f==null?(i.addLineStartIfNotCovered(r),i.addBreak(),d++):(i.ensureLine(r),i.addText(f,u,d==l?c:u.length),d+=f.length),r=null}s=u.length}});s>-1&&(this.openWidget=o>s),this.openWidget||i.addLineStartIfNotCovered(r),this.openMarks=o}forward(e,n,r=1){n-e<=10?this.old.advance(n-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=Ot.get(i);if(i==this.view.contentDOM)break;s instanceof Qn?n.push(s):s!=null&&s.isLine()?r=s:s instanceof Zi||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new Ma(i,Ik):r||n.push(Qn.of(new rd({tagName:i.nodeName.toLowerCase(),attributes:pL(i)}),i)))}return{line:r,marks:n}}}function _4(t,e){let n=r=>{for(let i of r.children)if((e?i.isText():i.length)||n(i))return!0;return!1};return n(t)}function FL(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const Ik={class:"cm-line"};function _L(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&Fx(n,t),r&&(t.class+=" "+r)),t}function HL(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof Qn&&e.push(r.mark)}return e}function hg(t){let e=Ot.get(t);return e&&e.setDOM(t.cloneNode()),t}class Da extends Ii{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}}Da.inline=new Da("span");Da.block=new Da("div");const pg=new class extends Ii{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class H4{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Ae.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.updateDeco(),this.tile=new Yp(e,e.contentDOM),this.updateInner([new Ar(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:d})=>d<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:!QL(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?WL(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:d}=this.hasComposition;r=new Ar(c,d,e.changes.mapPos(c,-1),e.changes.mapPos(d,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(ge.ie||ge.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=KL(o,this.decorations,e.changes);a.length&&(r=Ar.extendWithRanges(r,a));let u=XL(l,this.blockWrappers,e.changes);return u.length&&(r=Ar.extendWithRanges(r,u)),s&&!r.some(c=>c.fromA<=s.range.fromA&&c.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let o=this.tile,l=new VL(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Ot.get(n.text)&&l.cache.reused.set(Ot.get(n.text),2),this.tile=l.run(e,n),V1(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=ge.chrome||ge.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof mg&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(Nk)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,i=this.view.root.activeElement,s=i==r,o=!s&&!(this.view.state.facet(Ui)||r.tabIndex>-1)&&Gu(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,u,c;if(a.empty?c=u=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),u=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),ge.gecko&&a.empty&&!this.hasComposition&&zL(u)){let f=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(f,u.node.childNodes[u.offset]||null)),u=c=new Xr(f,0),l=!0}let d=this.view.observer.selectionRange;(l||!d.focusNode||(!Ku(u.node,u.offset,d.anchorNode,d.anchorOffset)||!Ku(c.node,c.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,a))&&(this.view.observer.ignore(()=>{ge.android&&ge.chrome&&r.contains(d.focusNode)&&qL(d.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=Ec(this.view.root);if(f)if(a.empty){if(ge.gecko){let h=GL(u.node,u.offset);if(h&&h!=3){let m=(h==1?hk:pk)(u.node,u.offset);m&&(u=new Xr(m.node,m.offset))}}f.collapse(u.node,u.offset),a.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=a.bidiLevel)}else if(f.extend){f.collapse(u.node,u.offset);try{f.extend(c.node,c.offset)}catch{}}else{let h=document.createRange();a.anchor>a.head&&([u,c]=[c,u]),h.setEnd(c.node,c.offset),h.setStart(u.node,u.offset),f.removeAllRanges(),f.addRange(h)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(u,c)),this.impreciseAnchor=u.precise?null:new Xr(d.anchorNode,d.anchorOffset),this.impreciseHead=c.precise?null:new Xr(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&Ku(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=Ec(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.length)return;let a=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!a||!u||a.bottom>u.top)return;let c=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(c.node,c.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)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[n];else{let o=os(e)==0?0:n==0?-1:1;for(;;){let l=e.parentNode;if(l==r.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!Ot.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,l=i;;o++){let a=r.children[o];if(a.dom==s)return l;l+=a.length+a.breakAfter}}else return r.isText()?e==r.dom?i+n:i+(n?r.length:0):i}domAtPos(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(i,n):r.domIn(i,n)}inlineDOMNearPos(e,n){let r,i=-1,s=!1,o,l=-1,a=!1;return this.tile.blockTiles((u,c)=>{if(u.isWidget()){if(u.flags&32&&c>=e)return!0;u.flags&16&&(s=!0)}else{let d=c+u.length;if(c<=e&&(r=u,i=e-c,s=d<e),d>=e&&!o&&(o=u,l=e-c,a=c>e),c>e&&o)return!0}}),!r&&!o?this.domAtPos(e,n):(s&&o?r=null:a&&r&&(o=null),r&&n<0||!o?r.domIn(i,n):o.domIn(l,n))}coordsAt(e,n,r){let{tile:i,offset:s}=this.tile.resolveBlock(e,n);return i.isWidget()?i.widget instanceof mg?null:i.coordsInWidget(s,n,!0):i.coordsIn(s,n,r)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function i(s,o){if(s.isComposite())for(let l of s.children){if(l.length>=o){let a=i(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(s.isText()&&o<s.length){let l=un(s.text,o);if(l==o)return null;let a=Mc(s.dom,o,l).getClientRects();for(let u=0;u<a.length;u++){let c=a[u];if(u==a.length-1||c.top<c.bottom&&c.left<c.right)return c}}return null}return i(n,r)}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,l=-1,a=this.view.textDirection==at.LTR,u=0,c=(d,f,h)=>{for(let m=0;m<d.children.length&&!(f>i);m++){let x=d.children[m],v=f+x.length,p=x.dom.getBoundingClientRect(),{height:y}=p;if(h&&!m&&(u+=p.top-h.top),x instanceof Zi)v>r&&c(x,f,p);else if(f>=r&&(u>0&&n.push(-u),n.push(y+u),u=0,o)){let b=x.dom.lastChild,C=b?Uu(b):[];if(C.length){let S=C[C.length-1],k=a?S.right-p.left:p.right-S.left;k>l&&(l=k,this.minWidth=s,this.minWidthFrom=f,this.minWidthTo=v)}}h&&m==d.children.length-1&&(u+=h.bottom-p.bottom),f=v+x.breakAfter}};return c(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?at.RTL:at.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let c=Uu(u.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=Uu(n.firstChild)[0];r=n.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}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.view.state.doc.length;if(o>r){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Ae.replace({widget:new mg(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return Ae.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Up).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Ux).map((s,o)=>{let l=typeof s=="function";return l&&(r=!0),l?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(_e.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Tk).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(Dk))try{if(u(this.view,e.range,e))return!0}catch(c){Jn(this.view.state,c,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,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=Kx(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(yL(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==at.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.visualViewport.offsetTop)){let u=this.view.docView.lineAt(n.head,1);if(u){let c=uk(u.dom);u.dom.scrollIntoView({block:"nearest"}),ck(c,!1)}}}lineHasWidget(e){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){V1(this.tile)}}function V1(t,e){let n=e==null?void 0:e.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)V1(r,e)}}function zL(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")}function Rk(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=hk(n.focusNode,n.focusOffset),i=pk(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=Ot.get(i.node);if(!l||l.isText()&&l.text!=i.node.nodeValue)s=i;else if(t.docView.lastCompositionAfterCursor){let a=Ot.get(r.node);!a||a.isText()&&a.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 WL(t,e,n){let r=Rk(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,l=i.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(r.from,r.to)!=l)return null;let a=e.invertedDesc;return{range:new Ar(a.mapPos(s),a.mapPos(o),s,o),text:i}}function GL(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 UL=class{constructor(){this.changes=[]}compareRange(e,n){oa(e,n,this.changes)}comparePoint(e,n){oa(e,n,this.changes)}boundChange(e){oa(e,e,this.changes)}};function KL(t,e,n){let r=new UL;return _e.compare(t,e,n,r),r.changes}class YL{constructor(){this.changes=[]}compareRange(e,n){oa(e,n,this.changes)}comparePoint(){}boundChange(e){oa(e,e,this.changes)}}function XL(t,e,n){let r=new YL;return _e.compare(t,e,n,r),r.changes}function qL(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 QL(t,e){let n=!1;return e&&t.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(n=!0)}),n}class mg extends Ii{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 ZL(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return J.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,l=s;n<0?o=un(i.text,s,!1):l=un(i.text,s);let a=r(i.text.slice(o,l));for(;o>0;){let u=un(i.text,o,!1);if(r(i.text.slice(u,o))!=a)break;o=u}for(;l<i.length;){let u=un(i.text,l);if(r(i.text.slice(l,u))!=a)break;l=u}return J.undirectionalRange(o+i.from,l+i.from)}function JL(t,e,n,r,i){let s=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,a=Math.floor((i-n.top-(t.defaultLineHeight-l)*.5)/l);s+=a*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+M1(o,s,t.state.tabSize)}function F1(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==bn.Text&&(i.type!=s.type||(n<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function eI(t,e,n,r){let i=F1(t,e.head,e.assoc||-1),s=!r||i.type!=bn.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(),l=t.textDirectionAt(i.from),a=t.posAtCoords({x:n==(l==at.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return J.cursor(a,n?-1:1)}return J.cursor(n?i.to:i.from,n?-1:1)}function z4(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let l=e,a=null;;){let u=DL(i,s,o,l,n),c=vk;if(!u){if(i.number==(n?t.state.doc.lines:1))return l;c=`
|
|
144
|
+
`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),u=t.visualLineSide(i,!n)}if(a){if(!a(c))return l}else{if(!r)return u;a=r(c)}l=u}}function tI(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Ct.Space&&(i=o),i==o}}function nI(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return J.cursor(i,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(i,e.assoc||((e.empty?n:e.head==e.from)?1:-1)),c=t.documentTop;if(u)o==null&&(o=u.left-a.left),l=s<0?u.top:u.bottom;else{let m=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(i-m.from))),l=(s<0?m.top:m.bottom)+c}let d=a.left+o,f=t.viewState.heightOracle.textHeight>>1,h=r??f;for(let m=0;;m+=f){let x=l+(h+m)*s,v=_1(t,{x:d,y:x},!1,s);if(n?x>a.bottom:x<a.top)return J.cursor(v.pos,v.assoc);let p=t.coordsAtPos(v.pos,v.assoc),y=p?(p.top+p.bottom)/2:0;if(!p||(n?y>l:y<l))return J.cursor(v.pos,v.assoc,void 0,o)}}function Yu(t,e,n){for(;;){let r=0;for(let i of t)i.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=r||n||(e-s<o-e?-1:1);e=a<0?s:o,r=a}});if(!r)return e}}function Bk(t,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=Yu(t,i.from,0);o!=i.from&&(s=J.cursor(o,-1))}else{let o=Yu(t,i.from,-1),l=Yu(t,i.to,1);(o!=i.from||l!=i.to)&&(i.undirectional?s=J.undirectionalRange(i.from,i.to):s=J.range(i.from==i.anchor?o:l,i.from==i.head?o:l))}s&&(n||(n=e.ranges.slice()),n[r]=s)}return n?J.create(n,e.mainIndex):e}function gg(t,e,n){let r=Yu(t.state.facet(sd).map(i=>i(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:J.cursor(r,r<n.from?1:-1)}class ki{constructor(e,n){this.pos=e,this.assoc=n}}function _1(t,e,n,r){let i=t.contentDOM.getBoundingClientRect(),s=i.top+t.viewState.paddingTop,{x:o,y:l}=e,a=l-s,u;for(;;){if(a<0)return new ki(0,1);if(a>t.viewState.docHeight)return new ki(t.state.doc.length,-1);if(u=t.elementAtHeight(a),r==null)break;if(u.type==bn.Text){if(r<0?u.to<t.viewport.from:u.from>t.viewport.to)break;let f=t.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(f&&(r<0?f.top<=a+s:f.bottom>=a+s))break}let d=t.viewState.heightOracle.textHeight/2;a=r>0?u.bottom+d:u.top-d}if(t.viewport.from>=u.to||t.viewport.to<=u.from){if(n)return null;if(u.type==bn.Text){let d=JL(t,i,u,o,l);return new ki(d,d==u.from?1:-1)}}if(u.type!=bn.Text)return a<(u.top+u.bottom)/2?new ki(u.from,1):new ki(u.to,-1);let c=t.docView.lineAt(u.from,2);return(!c||c.length!=u.length)&&(c=t.docView.lineAt(u.from,-2)),new rI(t,o,l,t.textDirectionAt(u.from)).scanTile(c,u.from)}class rI{constructor(e,n,r,i){this.view=e,this.x=n,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,n){let{line:r,spans:i}=this.bidiSpansAt(e);return i[Si.find(i,e-r.from,-1,n)].level==this.baseDir}dirAt(e,n){let{line:r,spans:i}=this.bidiSpansAt(e);return i[Si.find(i,e-r.from,-1,n)].dir}bidiIn(e,n){let{spans:r,line:i}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from<n)}scan(e,n,r=!1){let i=0,s=e.length-1,o=new Set,l=this.bidiIn(e[0],e[s]),a,u,c=-1,d=1e9,f;e:for(;i<s;){let m=s-i,x=i+s>>1;t:if(o.has(x)){for(let y=1;y<m;y++){let b=x+y;if(b>=s&&(b-=m),!o.has(b)){x=b;break t}}break e}o.add(x);let v=n(x),p=0;if(v)for(let y=0;y<v.length;y++){let b=v[y];if(!(b.width==0&&v.length>1))if(b.bottom<this.y)(!a||a.bottom<b.bottom)&&(a=b),p=1;else if(b.top>this.y)(!u||u.top>b.top)&&(u=b),p=-1;else{let C=b.left>this.x?this.x-b.left:b.right<this.x?this.x-b.right:0,S=Math.abs(C);S<d&&(c=x,d=S,f=b),C&&(p=C<0==(this.baseDir==at.LTR)?-1:1)}}p==-1&&(!l||this.baseDirAt(e[x],1))?s=x:p==1&&(!l||this.baseDirAt(e[x+1],-1))&&(i=x+1)}if(!f){if(!u&&!a)return{i:e[0],after:!1};let m=a&&(!u||this.y-a.bottom<u.top-this.y)?a:u;return this.y=(m.top+m.bottom)/2,this.scan(e,n,!0)}if(d&&!r){let{top:m,bottom:x}=f;if(a&&a.bottom>(m+m+x)/3)return this.y=a.bottom-1,this.scan(e,n,!0);if(u&&u.top<(m+x+x)/3)return this.y=u.top+1,this.scan(e,n,!0)}let h=(l?this.dirAt(e[c],1):this.baseDir)==at.LTR;return{i:c,after:this.x>(f.left+f.right)/2==h}}scanText(e,n){let r=[];for(let s=0;s<e.length;s=un(e.text,s))r.push(n+s);r.push(n+e.length);let i=this.scan(r,s=>{let o=r[s]-n,l=r[s+1]-n;return Mc(e.dom,o,l).getClientRects()});return i.after?new ki(r[i.i+1],-1):new ki(r[i.i],1)}scanTile(e,n){if(!e.length)return new ki(n,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let r=[n];for(let l=0,a=n;l<e.children.length;l++)r.push(a+=e.children[l].length);let i=this.scan(r,l=>{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:Mc(a.dom,0,a.length)).getClientRects()}),s=e.children[i.i],o=r[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new ki(r[i.i+1],-1):new ki(o,1)}}const Nl="";class iI{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(Ge.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Nl}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=Ot.get(i),l=i.nextSibling;if(l==n){o!=null&&o.breakAfter&&!l&&r!=this.view.contentDOM&&this.lineBreak();break}let a=Ot.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:Rh(i))||Rh(l)&&(i.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!oI(l,n)&&this.lineBreak(),i=l}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,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=i.exec(n))&&(s=l.index,o=l[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(e){let n=Ot.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+(sI(e,r.node,r.offset)?n:0))}}function sI(t,e,n){for(;;){if(!e||n<os(e))return!1;if(e==t)return!0;n=to(e)+1,e=e.parentNode}}function oI(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=Ot.get(t);if(!(r!=null&&r.isWidget()))return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let i=r.overrideDOMText;if(i!=null&&i.length)return!1}return!0}class W4{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class lI{constructor(e,n,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,l=e.state.selection;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=Ok(e.docView.tile,n,r,0))){let a=s||o?[]:uI(e),u=new iI(a,e);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=cI(a,this.bounds.from)}else{let a=e.observer.selectionRange,u=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!I1(e.contentDOM,a.focusNode)?l.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!I1(e.contentDOM,a.anchorNode)?l.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),d=e.viewport;if((ge.ios||ge.chrome)&&u!=c&&Math.min(u,c)<=l.main.from&&Math.max(u,c)>=l.main.to&&(d.from>0||d.to<e.state.doc.length)){let f=Math.min(u,c),h=Math.max(u,c),m=d.from-f,x=d.to-h;(m==0||m==1||f==0)&&(x==0||x==-1||h==e.state.doc.length)&&(u=0,c=e.state.doc.length)}if(e.inputState.composing>-1&&l.ranges.length>1)this.newSel=l.replaceRange(J.range(c,u));else if(e.lineWrapping&&c==u&&!(l.main.empty&&l.main.head==u)&&e.inputState.lastTouchTime>Date.now()-100){let f=e.coordsAtPos(u,-1),h=0;f&&(h=e.inputState.lastTouchY<=f.bottom?-1:1),this.newSel=J.create([J.cursor(u,h)])}else this.newSel=J.single(c,u)}}}function Ok(t,e,n,r){if(t.isComposite()){let i=-1,s=-1,o=-1,l=-1;for(let a=0,u=r,c=r;a<t.children.length;a++){let d=t.children[a],f=u+d.length;if(u<e&&f>n)return Ok(d,e,n,u);if(f>=e&&i==-1&&(i=a,s=u),u>n&&d.dom.parentNode==t.dom){o=a,l=c;break}c=f,u=f+d.breakAfter}return{from:s,to:l<0?r+t.length:l,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function jk(t,e){let n,{newSel:r}=e,{state:i}=t,s=i.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:a}=e.bounds,u=s.from,c=null;(o===8||ge.android&&e.text.length<a-l)&&(u=s.to,c="end");let d=i.doc.sliceString(l,a,Nl),f,h;!s.empty&&s.from>=l&&s.to<=a&&(e.typeOver||d!=e.text)&&d.slice(0,s.from-l)==e.text.slice(0,s.from-l)&&d.slice(s.to-l)==e.text.slice(f=e.text.length-(d.length-(s.to-l)))?n={from:s.from,to:s.to,insert:Xe.of(e.text.slice(s.from-l,f).split(Nl))}:(h=Vk(d,e.text,u-l,c))&&(ge.chrome&&o==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==Nl+Nl&&h.toB--,n={from:l+h.from,to:l+h.toA,insert:Xe.of(e.text.slice(h.from,h.toB).split(Nl))})}else r&&(!t.hasFocus&&i.facet(Ui)||Vh(r,s))&&(r=null);if(!n&&!r)return!1;if((ge.mac||ge.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=J.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Xe.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).to<s.to&&t.docView.lineHasWidget(s.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:i.toText(t.inputState.insertingText)}:ge.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==`
|
|
145
|
+
`&&t.lineWrapping&&(r&&(r=J.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Xe.of([" "])}),n)return Yx(t,n,r,o);if(r&&!Vh(r,s)){let l=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=Bk(i.facet(sd).map(u=>u(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:a}),!0}else return!1}function Yx(t,e,n,r=-1){if(ge.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(ge.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&&la(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)&&la(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&la(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,l=()=>o||(o=aI(t,e,n));return t.state.facet(Sk).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function aI(t,e,n){let r,i=t.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let a=e.from<s.from?-1:1,u=a<0?s.from:s.to,c=Yu(i.facet(sd).map(d=>d(t)),u,a);e.from==c&&(o=c)}if(o>-1)r={changes:e,selection:J.cursor(e.from+e.insert.length,-1)};else 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):"",u=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)+u))}else{let a=i.changes(e),u=n&&n.main.to<=a.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),d,f=n&&Rk(t,n.main.head);if(f){let m=e.insert.length-(e.to-e.from);d={from:f.from,to:f.to-m}}else d=t.state.doc.lineAt(s.head);let h=s.to-e.to;r=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:a,range:u||m.map(a)};let x=m.to-h,v=x-c.length;if(t.state.sliceDoc(v,x)!=c||x>=d.from&&v<=d.to)return{range:m};let p=i.changes({from:v,to:x,insert:e.insert}),y=m.to-s.to;return{changes:p,range:u?J.range(Math.max(0,u.anchor+y),Math.max(0,u.head+y)):m.map(p)}})}else r={changes:a,selection:u&&i.selection.replaceRange(u)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:l,scrollIntoView:!0})}function Vk(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,l=e.length;for(;o>0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(r=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o<s&&t.length<e.length){let a=n<=s&&n>=o?s-n:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=n<=s&&n>=l?s-n:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function uI(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 W4(n,r)),(i!=n||s!=r)&&e.push(new W4(i,s))),e}function cI(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?J.single(n+e,r+e):null}function Vh(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class dI{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=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.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ge.safari&&e.contentDOM.addEventListener("input",()=>null),ge.gecko&&MI(e.contentDOM.ownerDocument)}handleEvent(e){!bI(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,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=hI(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||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&&_k.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ge.android&&ge.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(ge.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(Fk.some(n=>n.keyCode==e.keyCode)&&!e.ctrlKey||pI.indexOf(e.key)>-1&&e.ctrlKey)){let n={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return n.shiftKey&&ge.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&fI(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}return 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,la(this.view.contentDOM,n.key,n.keyCode,n.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:ge.safari&&!ge.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!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 fI(t){return t.visualViewport?t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85:!1}function G4(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){Jn(n.state,i)}}}function hI(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,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&n(l).handlers.push(G4(r.value,a))}if(o)for(let l in o){let a=o[l];a&&n(l).observers.push(G4(r.value,a))}}for(let r in ri)n(r).handlers.push(ri[r]);for(let r in _n)n(r).observers.push(_n[r]);return e}const Fk=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],pI="dthko",_k=[16,17,18,20,91,92,224,225],Ud=6;function Kd(t){return Math.max(0,t)*.7+8}function mI(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class gI{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=ak(e.contentDOM),this.atoms=e.state.facet(sd).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(Ge.allowMultipleSelections)&&yI(e,n),this.dragging=vI(e,n)&&Wk(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&&mI(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Kx(this.view);e.clientX-a.left<=i+Ud?n=-Kd(i-e.clientX):e.clientX+a.right>=o-Ud&&(n=Kd(e.clientX-o)),e.clientY-a.top<=s+Ud?r=-Kd(s-e.clientY):e.clientY+a.bottom>=l-Ud&&(r=Kd(e.clientY-l)),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)}select(e){let{view:n}=this,r=Bk(this.atoms,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 yI(t,e){let n=t.state.facet(bk);return n.length?n[0](e):ge.mac?e.metaKey:e.ctrlKey}function xI(t,e){let n=t.state.facet(wk);return n.length?n[0](e):ge.mac?!e.altKey:!e.ctrlKey}function vI(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Ec(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 bI(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=Ot.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const ri=Object.create(null),_n=Object.create(null),Hk=ge.ie&&ge.ie_version<15||ge.ios&&ge.webkit_version<604;function wI(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(),zk(t,n.value)},50)}function Xp(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function zk(t,e){e=Xp(t.state,zx,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(H1!=null&&n.selection.ranges.every(a=>a.empty)&&H1==s.toString()){let a=-1;r=n.changeByRange(u=>{let c=n.doc.lineAt(u.from);if(c.from==a)return{range:u};a=c.from;let d=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:c.from,insert:d},range:J.cursor(u.from+d.length)}})}else o?r=n.changeByRange(a=>{let u=s.line(i++);return{changes:{from:a.from,to:a.to,insert:u.text},range:J.cursor(a.from+u.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}_n.scroll=t=>{let e=t.inputState;e.lastScrollTop=t.scrollDOM.scrollTop,e.lastScrollLeft=t.scrollDOM.scrollLeft,ge.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};_n.wheel=_n.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};ri.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);_n.touchstart=(t,e)=>{let n=t.inputState,r=e.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};_n.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};_n.touchend=(t,e)=>{t.inputState.touchActive=!1};ri.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(Ck))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=kI(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new gI(t,e,n,r)),r&&t.observer.ignore(()=>{dk(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}else t.inputState.setSelectionOrigin("select.pointer");return!1};function U4(t,e,n,r){if(r==1)return J.cursor(e,n);if(r==2)return ZL(t.state,e,n);{let i=t.docView.lineAt(e,n),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return l<t.state.doc.length&&l==s.to&&l++,J.undirectionalRange(o,l)}}const CI=ge.ie&&ge.ie_version<=11;let K4=null,Y4=0,X4=0;function Wk(t){if(!CI)return t.detail;let e=K4,n=X4;return K4=t,X4=Date.now(),Y4=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Y4+1)%3:1}function kI(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=Wk(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,l){let a=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),u,c=U4(t,a.pos,a.assoc,r);if(n.pos!=a.pos&&!o){let d=U4(t,n.pos,n.assoc,r),f=Math.min(d.from,c.from),h=Math.max(d.to,c.to);c=f<c.from?J.range(f,h,c.assoc):J.range(h,f,c.assoc)}return o?i.replaceRange(i.main.extend(c.from,c.to,c.assoc)):l&&r==1&&i.ranges.length>1&&(u=SI(i,a.pos))?u:l?i.addRange(c):J.create([c])}}}function SI(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 J.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}ri.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=J.undirectionalRange(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Xp(t.state,Wx,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};ri.dragend=t=>(t.inputState.draggedContent=null,!1);function q4(t,e,n,r){if(n=Xp(t.state,zx,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&xI(t,e)?{from:s.from,to:s.to}:null,l={from:i,insert:n},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(i,-1),head:a.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}ri.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&&q4(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let l=new FileReader;l.onerror=s,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return q4(t,e,r,!0),!0}return!1};ri.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=Hk?null:e.clipboardData;return n?(zk(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(wI(t),!1)};function EI(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 $I(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:Xp(t,Wx,e.join(t.lineBreak)),ranges:n,linewise:r}}let H1=null;ri.copy=ri.cut=(t,e)=>{if(!Gu(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=$I(t.state);if(!n&&!i)return!1;H1=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=Hk?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(EI(t,n),!1)};const Gk=Pi.define();function Uk(t,e){let n=[];for(let r of t.facet(Ek)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:Gk.of(!0)}):null}function Kk(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=Uk(t.state,e);n?t.dispatch(n):t.update([])}},10)}_n.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),Kk(t)};_n.blur=t=>{t.observer.clearSelectionRange(),Kk(t)};_n.compositionstart=_n.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};_n.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,ge.chrome&&ge.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};_n.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};ri.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=t.posAtDOM(l.startContainer,l.startOffset),u=t.posAtDOM(l.endContainer,l.endOffset);return Yx(t,{from:a,to:u,insert:t.state.toText(s)},null),!0}}let i;if(ge.chrome&&ge.android&&(i=Fk.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return ge.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),ge.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>_n.compositionend(t,e),20),!1};const Q4=new Set;function MI(t){Q4.has(t)||(Q4.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Z4=["pre-wrap","normal","pre-line","break-spaces"];let Na=!1;function J4(){Na=!1}class DI{constructor(e){this.lineWrapping=e,this.doc=Xe.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)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Z4.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 l=Z4.indexOf(e)>-1,a=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let u=0;u<o.length;u++){let c=o[u];c<0?u++:this.heightSamples[Math.floor(c*10)]=!0}}return a}}class NI{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Ur{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"?bn.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 Jo?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 Ur(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var dt=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(dt||(dt={}));const Uf=.001;class Vn{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)>Uf&&(Na=!0),this.height=e)}replace(e,n,r){return Vn.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 l=i.length-1;l>=0;l--){let{fromA:a,toA:u,fromB:c,toB:d}=i[l],f=s.lineAt(a,dt.ByPosNoHeight,r.setDoc(n),0,0),h=f.to>=u?f:s.lineAt(u,dt.ByPosNoHeight,r,0,0);for(d+=h.to-u,u=h.to;l>0&&f.from<=i[l-1].toA;)a=i[l-1].fromA,c=i[l-1].fromB,l--,a<f.from&&(f=s.lineAt(a,dt.ByPosNoHeight,r,0,0));c+=f.from-a,a=f.from;let m=Xx.build(r.setDoc(o),e,c,d);s=Fh(s,s.replace(a,u,m))}return s.updateHeight(r,0)}static empty(){return new pr(0,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 l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,i-=l.size}else if(s>i*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(i<s){let l=e[n++];l&&(i+=l.size)}else{let l=e[--r];l&&(s+=l.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,r++),new TI(Vn.of(e.slice(0,n)),o,Vn.of(e.slice(r)))}}function Fh(t,e){return t==e?t:(t.constructor!=e.constructor&&(Na=!0),e)}Vn.prototype.size=1;const AI=Ae.replace({});class Yk extends Vn{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new Ur(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new Ur(i,0,r,this.spaceAbove,AI):this.mainBlock(r,i)}lineAt(e,n,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,n,r,i,s,o){e<=s+this.length&&n>=s&&o(this.lineAt(0,dt.ByPos,r,i,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class pr extends Yk{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new Ur(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof pr||i instanceof gn&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof gn?i=new pr(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Vn.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,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 gn extends Vn{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,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:l}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(n,i);if(n.lineWrapping){let u=i+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),c=n.doc.lineAt(u),d=l+c.length*a,f=Math.max(r,e-d/2);return new Ur(c.from,c.length,f,d,0)}else{let u=Math.max(0,Math.min(o-s,Math.floor((e-r)/l))),{from:c,length:d}=n.doc.line(s+u);return new Ur(c,d,r+l*u,l,0)}}lineAt(e,n,r,i,s){if(n==dt.ByHeight)return this.blockAt(e,r,i,s);if(n==dt.ByPosNoHeight){let{from:h,to:m}=r.doc.lineAt(e);return new Ur(h,m-h,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),u=r.doc.lineAt(e),c=l+u.length*a,d=u.number-o,f=i+l*d+a*(u.from-s-d);return new Ur(u.from,u.length,Math.max(i,Math.min(f,i+this.height-c)),c,0)}forEachLine(e,n,r,i,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:l,perLine:a,perChar:u}=this.heightMetrics(r,s);for(let c=e,d=i;c<=n;){let f=r.doc.lineAt(c);if(c==e){let m=f.number-l;d+=a*m+u*(e-s-m)}let h=a+u*f.length;o(new Ur(f.from,f.length,d,h,0)),d+=h,c=f.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let s=r[r.length-1];s instanceof gn?r[r.length-1]=new gn(s.length+i):r.push(null,new gn(i-1))}if(e>0){let s=r[0];s instanceof gn?r[0]=new gn(e+s.length):r.unshift(new gn(e-1),null)}return Vn.of(r)}decomposeLeft(e,n){n.push(new gn(e-1),null)}decomposeRight(e,n){n.push(null,new gn(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=[],l=Math.max(n,i.from),a=-1;for(i.from>n&&o.push(new gn(i.from-n-1).updateHeight(e,n));l<=s&&i.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let d=i.heights[i.index++],f=0;d<0&&(f=-d,d=i.heights[i.index++]),a==-1?a=d:Math.abs(d-a)>=Uf&&(a=-2);let h=new pr(c,d,f);h.outdated=!1,o.push(h),l+=c+1}l<=s&&o.push(null,new gn(s-l).updateHeight(e,l));let u=Vn.of(o);return(a<0||Math.abs(u.height-this.height)>=Uf||Math.abs(a-this.heightMetrics(e,n).perLine)>=Uf)&&(Na=!0),Fh(this,u)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class TI extends Vn{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,l=s+this.left.length+this.break,a=n==dt.ByHeight?e<o:e<l,u=a?this.left.lineAt(e,n,r,i,s):this.right.lineAt(e,n,r,o,l);if(this.break||(a?u.to<l:u.from>l))return u;let c=n==dt.ByPosNoHeight?dt.ByPosNoHeight:dt.ByPos;return a?u.join(this.right.lineAt(l,c,r,o,l)):this.left.lineAt(l,c,r,i,s).join(u)}forEachLine(e,n,r,i,s,o){let l=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,n,r,i,s,o),n>=a&&this.right.forEachLine(e,n,r,l,a,o);else{let u=this.lineAt(a,dt.ByPos,r,i,s);e<u.from&&this.left.forEachLine(e,u.from-1,r,i,s,o),u.to>=e&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,a,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 l of r)s.push(l);if(e>0&&e3(s,o-1),n<this.length){let l=s.length;this.decomposeRight(n,s),e3(s,l)}return Vn.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?Vn.of(this.break?[e,null,n]:[e,n]):(this.left=Fh(this.left,e),this.right=Fh(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,l=n+s.length+this.break,a=null;return i&&i.from<=n+s.length&&i.more?a=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=l+o.length&&i.more?a=o=o.updateHeight(e,l,r,i):o.updateHeight(e,l,r),a?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 e3(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof gn&&(r=t[e+1])instanceof gn&&t.splice(e-1,3,new gn(n.length+1+r.length))}const PI=5;class Xx{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 pr?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new pr(r-this.pos,-1,0)),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 Yk(o,i,r)):(o||s||i>=PI)&&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 pr(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new gn(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 pr)return e;let n=new pr(0,-1,0);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 pr)&&!this.isCovered?this.nodes.push(new pr(0,-1,0)):(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 pr&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,n,r,i){let s=new Xx(r,e);return _e.spans(n,r,i,s,0),s.finish(r)}}function LI(t,e,n){let r=new II;return _e.compare(t,e,n,r,0),r.changes}class II{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&oa(e,n,this.changes,5)}}function RI(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),l=Math.max(0,n.top),a=Math.min(i.innerHeight,n.bottom);for(let u=t.parentNode;u&&u!=r.body;)if(u.nodeType==1){let c=u,d=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&d.overflow!="visible"){let f=c.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),l=Math.max(l,f.top),a=Math.min(u==t.parentNode?i.innerHeight:a,f.bottom)}u=d.position=="absolute"||d.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function BI(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function OI(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class yg{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}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 Ae.replace({widget:new jI(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class jI extends Ii{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 t3{constructor(e,n){this.view=e,this.state=n,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.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=n3,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=at.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(Gx).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new DI(r),this.stateDeco=r3(n),this.heightMap=Vn.empty().applyChanges(this.stateDeco,Xe.empty,this.heightOracle.setDoc(n.doc),[new Ar(0,0,0,n.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ae.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,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 Yd(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?n3:new qx(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(Mu(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=r3(this.state);let i=e.changedRanges,s=Ar.extendWithRanges(i,LI(r,this.stateDeco,e?e.changes:nn.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);J4(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Na)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<a.from||n.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,n));let u=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(u||!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(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Mk)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?at.RTL:at.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,c=0;if(l.width&&l.height){let{scaleX:S,scaleY:k}=lk(n,l);(S>.005&&Math.abs(this.scaleX-S)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=S,this.scaleY=k,u|=16,o=a=!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,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let h=ak(this.view.contentDOM,!1).y;h!=this.scrollParent&&(this.scrollParent=h,this.scrollAnchorHeight=-1,this.scrollOffset=0);let m=this.getScrollOffset();this.scrollOffset!=m&&(this.scrollAnchorHeight=-1,this.scrollOffset=m),this.scrolledToBottom=fk(this.scrollParent||e.win);let x=(this.printing?OI:RI)(n,this.paddingTop),v=x.top-this.pixelViewport.top,p=x.bottom-this.pixelViewport.bottom;this.pixelViewport=x;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget&&!BI(e.dom))return 0;let b=l.width;if((this.contentDOMWidth!=b||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),a){let S=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(S)&&(o=!0),o||i.lineWrapping&&Math.abs(b-this.contentDOMWidth)>i.charWidth){let{lineHeight:k,charWidth:E,textHeight:$}=e.docView.measureTextSize();o=k>0&&i.refresh(s,k,E,$,Math.max(5,b/E),S),o&&(e.docView.minWidth=0,u|=16)}v>0&&p>0?c=Math.max(v,p):v<0&&p<0&&(c=Math.min(v,p)),J4();for(let k of this.viewports){let E=k.from==this.viewport.from?S:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?Vn.empty().applyChanges(this.stateDeco,Xe.empty,this.heightOracle,[new Ar(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new NI(k.from,E))}Na&&(u|=2)}let C=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return C&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),u|=this.updateForViewport()),(u&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}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:l}=this,a=new Yd(i.lineAt(o-r*1e3,dt.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,dt.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(u<a.from||u>a.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=i.lineAt(u,dt.ByPos,s,0,0),f;n.y=="center"?f=(d.top+d.bottom)/2-c/2:n.y=="start"||n.y=="nearest"&&u<a.from?f=d.top:f=d.bottom-c,a=new Yd(i.lineAt(f-1e3/2,dt.ByHeight,s,0,0).from,i.lineAt(f+c+1e3/2,dt.ByHeight,s,0,0).to)}}return a}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new Yd(this.heightMap.lineAt(r,dt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,dt.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,dt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(n,dt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||s>=l+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<l+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 yg(n.mapPos(i.from),n.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=at.LTR&&!r)return[];let l=[],a=(c,d,f,h)=>{if(d-c<s)return;let m=this.state.selection.main,x=[m.from];m.empty||x.push(m.to);for(let p of x)if(p>c&&p<d){a(c,p-10,f,h),a(p+10,d,f,h);return}let v=FI(e,p=>p.from>=f.from&&p.to<=f.to&&Math.abs(p.from-c)<s&&Math.abs(p.to-d)<s&&!x.some(y=>p.from<y&&p.to>y));if(!v){if(d<f.to&&n&&r&&n.visibleRanges.some(b=>b.from<=d&&b.to>=d)){let b=n.moveToLineBoundary(J.cursor(d),!1,!0).head;b>c&&(d=b)}let p=this.gapSize(f,c,d,h),y=r||p<2e6?p:2e6;v=new yg(c,d,p,y)}l.push(v)},u=c=>{if(c.length<o||c.type!=bn.Text)return;let d=VI(c.from,c.to,this.stateDeco);if(d.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,h,m;if(r){let x=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,p;if(f!=null){let y=qd(d,f),b=((this.visibleBottom-this.visibleTop)/2+x)/c.height;v=y-b,p=y+b}else v=(this.visibleTop-c.top-x)/c.height,p=(this.visibleBottom-c.top+x)/c.height;h=Xd(d,v),m=Xd(d,p)}else{let x=d.total*this.heightOracle.charWidth,v=i*this.heightOracle.charWidth,p=0;if(x>2e6)for(let k of e)k.from>=c.from&&k.from<c.to&&k.size!=k.displaySize&&k.from*this.heightOracle.charWidth+p<this.pixelViewport.left&&(p=k.size-k.displaySize);let y=this.pixelViewport.left+p,b=this.pixelViewport.right+p,C,S;if(f!=null){let k=qd(d,f),E=((b-y)/2+v)/x;C=k-E,S=k+E}else C=(y-v)/x,S=(b+v)/x;h=Xd(d,C),m=Xd(d,S)}h>c.from&&a(c.from,h,c,d),m<c.to&&a(m,c.to,c,d)};for(let c of this.viewportLines)Array.isArray(c.type)?c.type.forEach(u):u(c);return l}gapSize(e,n,r,i){let s=qd(i,r)-qd(i,n);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){yg.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ae.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];_e.spans(n,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],l=r[s];(o.from!=l.from||o.to!=l.to)&&(i|=4,e&&e.mapPos(o.from,-1)==l.from&&e.mapPos(o.to,1)==l.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Mu(this.heightMap.lineAt(e,dt.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)||Mu(this.heightMap.lineAt(this.scaler.fromDOM(e),dt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}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 Mu(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}}let Yd=class{constructor(e,n){this.from=e,this.to=n}};function VI(t,e,n){let r=[],i=t,s=0;return _e.spans(n,t,e,{span(){},point(o,l){o>i&&(r.push({from:i,to:o}),s+=o-i),i=l}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function Xd({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],l=o-s;if(r<=l)return s+r;r-=l}}function qd(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 FI(t,e){for(let n of t)if(e(n))return n}const n3={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function r3(t){let e=t.facet(Up).filter(r=>typeof r!="function"),n=t.facet(Ux).filter(r=>typeof r!="function");return n.length&&e.push(_e.join(n)),e}class qx{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let u=n.lineAt(l,dt.ByPos,e,0,0).top,c=n.lineAt(a,dt.ByPos,e,0,0).bottom;return i+=c-u,{from:l,to:a,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.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 qx?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 Mu(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Ur(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>Mu(i,e)):t._content)}const Qd=ve.define({combine:t=>t.join(" ")}),z1=ve.define({combine:t=>t.indexOf(!0)>-1}),W1=Js.newName(),Xk=Js.newName(),qk=Js.newName(),Qk={"&light":"."+Xk,"&dark":"."+qk};function G1(t,e,n){return new Js(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 _I=G1("."+W1,{"&":{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,overflowAnchor:"none"},".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":{userSelect:"none",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:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".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",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&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,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".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",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".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),HI={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},xg=ge.ie&&ge.ie_version<=11;class zI{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new xL,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);(ge.ie&&ge.ie_version<=11||ge.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&&ge.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ge.chrome&&ge.chrome_version<126)&&(this.editContext=new GI(e),e.state.facet(Ui)&&(e.contentDOM.editContext=this.editContext.editContext)),xg&&(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(Ui)?r.root.activeElement!=this.dom:!Gu(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(ge.ie&&ge.ie_version<=11||ge.android&&ge.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Ku(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Ec(e.root);if(!n)return!1;let r=ge.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&WI(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=Gu(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&bL(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,HI),xg&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),xg&&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&&la(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&&Gu(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 lI(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=jk(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!Vh(this.view.state.selection,n.newSel.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=i3(n,e.previousSibling||e.target.previousSibling,-1),i=i3(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(Ui)!=e.state.facet(Ui)&&(e.view.contentDOM.editContext=e.state.facet(Ui)?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 i3(t,e,n){for(;e;){let r=Ot.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 s3(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return Ku(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function WI(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return s3(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?s3(t,n):null}class GI{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=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 i=e.state.selection.main,{anchor:s,head:o}=i,l=this.toEditorPos(r.updateRangeStart),a=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let u=a-l>r.text.length;l==this.from&&s<this.from?l=s:a==this.to&&s>this.to&&(a=s);let c=Vk(e.state.sliceDoc(l,a),r.text,(u?i.from:i.to)-l,u?"end":null);if(!c){let f=J.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));Vh(f,i)||e.dispatch({selection:f,userEvent:"select"});return}let d={from:c.from+l,to:c.toA+l,insert:Xe.of(r.text.slice(c.from,c.toB).split(`
|
|
146
|
+
`))};if((ge.mac||ge.android)&&d.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:l,to:a,insert:Xe.of([r.text.replace("."," ")])}),this.pendingContextChange=d,!e.state.readOnly){let f=this.to-this.from+(d.to-d.from+d.insert.length);Yx(e,d,J.single(this.toEditorPos(r.selectionStart,f),this.toEditorPos(r.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),d.from<d.to&&!d.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.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,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(a<u){let c=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;i.push(Ae.mark({attributes:{style:c}}).range(a,u))}}}e.dispatch({effects:Nk.of(Ae.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let i=Ec(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,l,a,u)=>{if(r)return;let c=u.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(u)){i=this.pendingContextChange=null,n+=c,this.to+=c;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=c,this.to+=c;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),u.toString()),this.to+=c}n+=c}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(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)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}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,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class me{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&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;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:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||vL(e.parent)||document,this.viewState=new t3(this,e.state||Ge.create(e)),e.scrollTo&&e.scrollTo.is(Gd)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Gl).map(i=>new fg(i));for(let i of this.plugins)i.update(this);this.observer=new zI(this),this.inputState=new dI(this),this.inputState.ensureHandlers(this.plugins),this.docView=new H4(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof sn?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,l=0,a=null;e.some(f=>f.annotation(Gk))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Uk(s,o),a||(l=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(Ge.phrases)!=this.state.facet(Ge.phrases))return this.setState(s);i=Bh.create(this,s,e),i.flags|=l;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,{x:m,y:x}=this.state.facet(me.cursorScrollMargin);d=new aa(h.empty?h:J.cursor(h.head,h.head>h.anchor?-1:1),"nearest","nearest",x,m)}for(let h of f.effects)h.is(Gd)&&(d=h.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=_h.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet($u)!=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(Qd)!=i.state.facet(Qd)&&(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(j1))try{f(i)}catch(h){Jn(this.state,h,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!jk(this,c)&&u.force&&la(this.contentDOM,u.key,u.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 t3(this,e),this.plugins=e.facet(Gl).map(r=>new fg(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new H4(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(Gl),r=e.state.facet(Gl);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new fg(s));else{let l=this.plugins[o];l.mustUpdate=e,i.push(l)}}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){Jn(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.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(fk(r||this.win))s=-1,o=this.viewState.heightMap.height;else{let h=this.viewState.scrollAnchorAt(i);s=h.from,o=h.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];a&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(h=>{try{return h.read(this)}catch(m){return Jn(this.state,m),o3}}),d=Bh.create(this,this.state,[]),f=!1;d.flags|=a,n?n.flags|=a: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<u.length;h++)if(c[h]!=o3)try{let m=u[h];m.write&&m.write(c[h],this)}catch(m){Jn(this.state,m)}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 m=((s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o)/this.scaleY;if((m>1||m<-1)&&!(ge.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+m,r?s<0?r.scrollTop=r.scrollHeight:r.scrollTop+=m:this.win.scrollBy(0,m),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(j1))l(n)}get themeClasses(){return W1+" "+(this.state.facet(z1)?qk:Xk)+" "+this.state.facet(Qd)}updateAttrs(){let e=l3(this,Ak,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ui)?"true":"false",class:"cm-content",style:`${ge.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),l3(this,Gx,n);let r=this.observer.ignore(()=>{let i=B4(this.contentDOM,this.contentAttrs,n),s=B4(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(me.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($u);let e=this.state.facet(me.cspNonce);Js.mount(this.root,this.styleModules.concat(_I).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.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==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 gg(this,e,z4(this,e,n,r))}moveByGroup(e,n){return gg(this,e,z4(this,e,n,r=>tI(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 J.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return eI(this,e,n,r)}moveVertically(e,n,r){return gg(this,e,nI(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=_1(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),_1(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),s=i[Si.find(i,e-r.from,-1,n)];return this.docView.coordsAt(e,n,s.dir==at.RTL)}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($k)||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>UI)return xk(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||yk(s.isolates,r=V4(this,e))))return s.order;r||(r=V4(this,e));let i=ML(e.text,n,r);return this.bidiCache.push(new _h(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ge.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{dk(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={}){var r,i,s,o;return Gd.of(new aa(typeof e=="number"?J.cursor(e):e,(r=n.y)!==null&&r!==void 0?r:"nearest",(i=n.x)!==null&&i!==void 0?i:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Gd.of(new aa(J.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 Vt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Vt.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Js.newName(),i=[Qd.of(r),$u.of(G1(`.${r}`,e))];return n&&n.dark&&i.push(z1.of(!0)),i}static baseTheme(e){return dl.lowest($u.of(G1("."+W1,e,Qk)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&Ot.get(r)||Ot.get(e);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}}me.styleModule=$u;me.inputHandler=Sk;me.clipboardInputFilter=zx;me.clipboardOutputFilter=Wx;me.scrollHandler=Dk;me.focusChangeEffect=Ek;me.perLineTextDirection=$k;me.exceptionSink=kk;me.updateListener=j1;me.editable=Ui;me.mouseSelectionStyle=Ck;me.dragMovesSelection=wk;me.clickAddsSelectionRange=bk;me.decorations=Up;me.blockWrappers=Tk;me.outerDecorations=Ux;me.atomicRanges=sd;me.bidiIsolatedRanges=Pk;me.cursorScrollMargin=ve.define({combine:t=>{let e=5,n=5;for(let r of t)typeof r=="number"?e=n=r:{x:e,y:n}=r;return{x:e,y:n}}});me.scrollMargins=Lk;me.darkTheme=z1;me.cspNonce=ve.define({combine:t=>t.length?t[0]:""});me.contentAttributes=Gx;me.editorAttributes=Ak;me.lineWrapping=me.contentAttributes.of({class:"cm-lineWrapping"});me.announce=Be.define();const UI=4096,o3={};class _h{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:at.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 _h(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function l3(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&&Fx(o,n)}return n}const KI=ge.mac?"mac":ge.windows?"win":ge.linux?"linux":"key";function YI(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,l;for(let a=0;a<n.length-1;++a){const u=n[a];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))i=!0;else if(/^(c|ctrl|control)$/i.test(u))s=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))e=="mac"?l=!0:s=!0;else throw new Error("Unrecognized modifier name: "+u)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),l&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Zd(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 XI=dl.default(me.domEventHandlers({keydown(t,e){return Jk(Zk(e.state),t,e,"editor")}})),qp=ve.define({enables:XI}),a3=new WeakMap;function Zk(t){let e=t.facet(qp),n=a3.get(e);return n||a3.set(e,n=ZI(e.reduce((r,i)=>r.concat(i),[]))),n}function qI(t,e,n){return Jk(Zk(t.state),e,t,n)}let Ms=null;const QI=4e3;function ZI(t,e=KI){let n=Object.create(null),r=Object.create(null),i=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,u,c)=>{var d,f;let h=n[o]||(n[o]=Object.create(null)),m=l.split(/ (?!$)/).map(p=>YI(p,e));for(let p=1;p<m.length;p++){let y=m.slice(0,p).join(" ");i(y,!0),h[y]||(h[y]={preventDefault:!0,stopPropagation:!1,run:[b=>{let C=Ms={view:b,prefix:y,scope:o};return setTimeout(()=>{Ms==C&&(Ms=null)},QI),!0}]})}let x=m.join(" ");i(x,!1);let v=h[x]||(h[x]={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())||[]});a&&v.run.push(a),u&&(v.preventDefault=!0),c&&(v.stopPropagation=!0)};for(let o of t){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=o;for(let f in c)c[f].run.push(h=>d(h,U1))}let a=o[e]||o.key;if(a)for(let u of l)s(u,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return n}let U1=null;function Jk(t,e,n,r){U1=e;let i=fL(e),s=Yn(i,0),o=Ci(s)==i.length&&i!=" ",l="",a=!1,u=!1,c=!1;Ms&&Ms.view==n&&Ms.scope==r&&(l=Ms.prefix+" ",_k.indexOf(e.keyCode)<0&&(u=!0,Ms=null));let d=new Set,f=v=>{if(v){for(let p of v.run)if(!d.has(p)&&(d.add(p),p(n)))return v.stopPropagation&&(c=!0),!0;v.preventDefault&&(v.stopPropagation&&(c=!0),u=!0)}return!1},h=t[r],m,x;return h&&(f(h[l+Zd(i,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ge.windows&&e.ctrlKey&&e.altKey)&&!(ge.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=eo[e.keyCode])&&m!=i?(f(h[l+Zd(m,e,!0)])||e.shiftKey&&(x=kc[e.keyCode])!=i&&x!=m&&f(h[l+Zd(x,e,!1)]))&&(a=!0):o&&e.shiftKey&&f(h[l+Zd(i,e,!0)])&&(a=!0),!a&&f(h._any)&&(a=!0)),u&&(a=!0),a&&c&&e.stopPropagation(),U1=null,a}class _o{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=eS(e);return[new _o(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return JI(e,n,r)}}function eS(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==at.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function u3(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,l=t.posAtCoords({x:s.left+1,y:o}),a=t.posAtCoords({x:s.right-1,y:o});return l==null||a==null?r:{from:Math.max(r.from,Math.min(l,a)),to:Math.min(r.to,Math.max(l,a))}}function JI(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==at.LTR,o=t.contentDOM,l=o.getBoundingClientRect(),a=eS(t),u=o.querySelector(".cm-line"),c=u&&window.getComputedStyle(u),d=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),f=l.right-(c?parseInt(c.paddingRight):0),h=F1(t,r,1),m=F1(t,i,-1),x=h.type==bn.Text?h:null,v=m.type==bn.Text?m:null;if(x&&(t.lineWrapping||h.widgetLineBreaks)&&(x=u3(t,r,1,x)),v&&(t.lineWrapping||m.widgetLineBreaks)&&(v=u3(t,i,-1,v)),x&&v&&x.from==v.from&&x.to==v.to)return y(b(n.from,n.to,x));{let S=x?b(n.from,null,x):C(h,!1),k=v?b(null,n.to,v):C(m,!0),E=[];return(x||h).to<(v||m).from-(x&&v?1:0)||h.widgetLineBreaks>1&&S.bottom+t.defaultLineHeight/2<k.top?E.push(p(d,S.bottom,f,k.top)):S.bottom<k.top&&t.elementAtHeight((S.bottom+k.top)/2).type==bn.Text&&(S.bottom=k.top=(S.bottom+k.top)/2),y(S).concat(E).concat(y(k))}function p(S,k,E,$){return new _o(e,S-a.left,k-a.top,Math.max(0,E-S),$-k)}function y({top:S,bottom:k,horizontal:E}){let $=[];for(let D=0;D<E.length;D+=2)$.push(p(E[D],S,E[D+1],k));return $}function b(S,k,E){let $=1e9,D=-1e9,L=[];function A(M,B,N,O,I){let P=t.coordsAtPos(M,M==E.to?-2:2),F=t.coordsAtPos(N,N==E.from?2:-2);!P||!F||($=Math.min(P.top,F.top,$),D=Math.max(P.bottom,F.bottom,D),I==at.LTR?L.push(s&&B?d:P.left,s&&O?f:F.right):L.push(!s&&O?d:F.left,!s&&B?f:P.right))}let T=S??E.from,V=k??E.to;for(let M of t.visibleRanges)if(M.to>T&&M.from<V)for(let B=Math.max(M.from,T),N=Math.min(M.to,V);;){let O=t.state.doc.lineAt(B);for(let I of t.bidiSpans(O)){let P=I.from+O.from,F=I.to+O.from;if(P>=N)break;F>B&&A(Math.max(P,B),S==null&&P<=T,Math.min(F,N),k==null&&F>=V,I.dir)}if(B=O.to+1,B>=N)break}return L.length==0&&A(T,S==null,V,k==null,t.textDirection),{top:$,bottom:D,horizontal:L}}function C(S,k){let E=l.top+(k?S.top:S.bottom);return{top:E,bottom:E,horizontal:[]}}}function eR(t,e){return t.constructor==e.constructor&&t.eq(e)}class tR{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(Kf)!=e.state.facet(Kf)&&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(Kf);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)=>!eR(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,ge.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Kf=ve.define();function tS(t){return[Vt.define(e=>new tR(e,t)),Kf.of(t)]}const Aa=ve.define({combine(t){return Li(t,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function nR(t={}){return[Aa.of(t),rR,iR,oR,Mk.of(!0)]}function nS(t){return t.startState.facet(Aa)!=t.state.facet(Aa)}const rR=tS({above:!0,markers(t){let{state:e}=t,n=e.facet(Aa),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||n.drawRangeCursor&&!(s&&ge.ios&&n.iosSelectionHandles)){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:J.cursor(i.head,i.assoc);for(let a of _o.forRange(t,o,l))r.push(a)}}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=nS(t);return n&&c3(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){c3(e.state,t)},class:"cm-cursorLayer"});function c3(t,e){e.style.animationDuration=t.facet(Aa).cursorBlinkRate+"ms"}const iR=tS({above:!1,markers(t){let e=[],{main:n,ranges:r}=t.state.selection;for(let i of r)if(!i.empty)for(let s of _o.forRange(t,"cm-selectionBackground",i))e.push(s);if(ge.ios&&!n.empty&&t.state.facet(Aa).iosSelectionHandles){for(let i of _o.forRange(t,"cm-selectionHandle cm-selectionHandle-start",J.cursor(n.from,1)))e.push(i);for(let i of _o.forRange(t,"cm-selectionHandle cm-selectionHandle-end",J.cursor(n.to,1)))e.push(i)}return e},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||nS(t)},class:"cm-selectionLayer"}),sR=ge.gecko&&ge.gecko_version==153?"#ffffff01":"transparent",oR=dl.highest(me.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${sR} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),rS=Be.define({map(t,e){return t==null?null:e.mapPos(t)}}),Du=Nn.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(rS)?r.value:n,t)}}),lR=Vt.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(Du);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(Du)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Du),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(Du)!=t&&this.view.dispatch({effects:rS.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 aR(){return[Du,lR]}function d3(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)i(o+l.index,l)}function uR(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 cR{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=(l,a,u,c)=>i(c,u,u+l[0].length,l,a);else if(typeof r=="function")this.addMatch=(l,a,u,c)=>{let d=r(l,a,u);d&&c(u,u+l[0].length,d)};else if(r)this.addMatch=(l,a,u,c)=>c(u,u+l[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 ss,r=n.add.bind(n);for(let{from:i,to:s}of uR(e,this.maxLength))d3(e.state.doc,this.regexp,i,s,(o,l)=>this.addMatch(l,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(r=Math.min(l,r),i=Math.max(a,i))}),e.viewportMoved||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),l=Math.min(s.to,i);if(l>=o){let a=e.state.doc.lineAt(o),u=a.to<l?e.state.doc.lineAt(l):a,c=Math.max(s.from,a.from),d=Math.min(s.to,u.to);if(this.boundary){for(;o>a.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;l<u.to;l++)if(this.boundary.test(u.text[l-u.from])){d=l;break}}let f=[],h,m=(x,v,p)=>f.push(p.range(x,v));if(a==u)for(this.regexp.lastIndex=c-a.from;(h=this.regexp.exec(a.text))&&h.index<d-a.from;)this.addMatch(h,e,h.index+a.from,m);else d3(e.state.doc,this.regexp,c,d,(x,v)=>this.addMatch(v,e,x,m));n=n.update({filterFrom:c,filterTo:d,filter:(x,v)=>x<c||v>d,add:f})}}return n}}const K1=/x/.unicode!=null?"gu":"g",dR=new RegExp(`[\0-\b
|
|
147
|
+
--\u2028\u2029\uFEFF-]`,K1),fR={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 vg=null;function hR(){var t;if(vg==null&&typeof document<"u"&&document.body){let e=document.body.style;vg=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return vg||!1}const Yf=ve.define({combine(t){let e=Li(t,{render:null,specialChars:dR,addSpecialChars:null});return(e.replaceTabs=!hR())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,K1)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,K1)),e}});function pR(t={}){return[Yf.of(t),mR()]}let f3=null;function mR(){return f3||(f3=Vt.fromClass(class{constructor(t){this.view=t,this.decorations=Ae.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Yf)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new cR({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=Yn(e[0],0);if(s==9){let o=i.lineAt(r),l=n.state.tabSize,a=Ga(o.text,l,r-o.from);return Ae.replace({widget:new vR((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Ae.replace({widget:new xR(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Yf);t.startState.facet(Yf)!=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 gR="•";function yR(t){return t>=32?gR:t==10?"":String.fromCharCode(9216+t)}class xR extends Ii{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=yR(this.code),r=e.state.phrase("Control character")+" "+(fR[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 vR extends Ii{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 bR(){return CR}const wR=Ae.line({class:"cm-activeLine"}),CR=Vt.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(wR.range(i.from)),e=i.from)}return Ae.set(n)}},{decorations:t=>t.decorations});class kR extends Ii{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?Uu(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=$c(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function SR(t){let e=Vt.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Ae.set([Ae.widget({widget:new kR(t),side:1}).range(0)]):Ae.none}get decorations(){return this.view.state.doc.length?Ae.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,me.contentAttributes.of({"aria-placeholder":t})]:e}const Y1=2e3;function ER(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>Y1||n.off>Y1||e.col<0||n.col<0){let o=Math.min(e.off,n.off),l=Math.max(e.off,n.off);for(let a=r;a<=i;a++){let u=t.doc.line(a);u.length<=l&&s.push(J.range(u.from+o,u.to+l))}}else{let o=Math.min(e.col,n.col),l=Math.max(e.col,n.col);for(let a=r;a<=i;a++){let u=t.doc.line(a),c=M1(u.text,o,t.tabSize,!0);if(c<0)s.push(J.cursor(u.to));else{let d=M1(u.text,l,t.tabSize);s.push(J.range(u.from+c,u.from+d))}}}return s}function $R(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function h3(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>Y1?-1:i==r.length?$R(t,e.clientX):Ga(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function MR(t,e){let n=h3(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 l=h3(t,i);if(!l)return r;let a=ER(t.state,n,l);return a.length?o?J.create(a.concat(r.ranges)):J.create(a):r}}:null}function DR(t){let e=n=>n.altKey&&n.button==0;return me.mouseSelectionStyle.of((n,r)=>e(r)?MR(n,r):null)}const NR={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},AR={style:"cursor: crosshair"};function TR(t={}){let[e,n]=NR[t.key||"Alt"],r=Vt.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,me.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?AR:null})]}const Jd="-10000px";class iS{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(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=n?[]:null;for(let a=0;a<s.length;a++){let u=s[a],c=-1;if(u){for(let d=0;d<this.tooltips.length;d++){let f=this.tooltips[d];f&&f.create==u.create&&(c=d)}if(c<0)o[a]=this.createTooltipView(u,a?o[a-1]:null),l&&(l[a]=!!u.above);else{let d=o[a]=this.tooltipViews[c];l&&(l[a]=n[c]),d.update&&d.update(e)}}}for(let a of this.tooltipViews)o.indexOf(a)<0&&(this.removeTooltipView(a),(r=a.destroy)===null||r===void 0||r.call(a));return n&&(l.forEach((a,u)=>n[u]=a),n.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function PR(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const bg=ve.define({combine:t=>{var e,n,r;return{position:ge.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)||PR}}}),p3=new WeakMap,Qx=Vt.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(bg);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 iS(t,Zx,(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(bg);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=Jd,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=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(ge.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Kx(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(bg).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],u=this.manager.tooltipViews[l],{dom:c}=u,d=t.pos[l],f=t.size[l];if(!d||a.clip!==!1&&(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)){c.style.top=Jd;continue}let h=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,m=h?7:0,x=f.right-f.left,v=(e=p3.get(u))!==null&&e!==void 0?e:f.bottom-f.top,p=u.offset||IR,y=this.view.textDirection==at.LTR,b=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)+p.x,r.right-x)):Math.min(Math.max(r.left,d.left-x+(h?14:0)-p.x),r.right-x),C=this.above[l];!a.strictSide&&(C?d.top-v-m-p.y<r.top:d.bottom+v+m+p.y>r.bottom)&&C==r.bottom-d.bottom>d.top-r.top&&(C=this.above[l]=!C);let S=(C?d.top-r.top:r.bottom-d.bottom)-m;if(S<v&&u.resize!==!1){if(S<this.view.defaultLineHeight){c.style.top=Jd;continue}p3.set(u,v),c.style.height=(v=S)/s+"px"}else c.style.height&&(c.style.height="");let k=C?d.top-v-m-p.y:d.bottom+m+p.y,E=b+x;if(u.overlap!==!0)for(let $ of o)$.left<E&&$.right>b&&$.top<k+v&&$.bottom>k&&(k=C?$.top-v-2-m:$.bottom+m+2);if(this.position=="absolute"?(c.style.top=(k-t.parent.top)/s+"px",m3(c,(b-t.parent.left)/i)):(c.style.top=k/s+"px",m3(c,b/i)),h){let $=d.left+(y?p.x:-p.x)-(b+14-7);h.style.left=$/i+"px"}u.overlap!==!0&&o.push({left:b,top:k,right:E,bottom:k+v}),c.classList.toggle("cm-tooltip-above",C),c.classList.toggle("cm-tooltip-below",!C),u.positioned&&u.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=Jd}},{eventObservers:{scroll(){this.maybeMeasure()}}});function m3(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const LR=me.baseTheme({".cm-tooltip":{zIndex:500,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"}}}),IR={x:0,y:0},Zx=ve.define({enables:[Qx,LR]}),Hh=ve.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Qp{static create(e){return new Qp(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new iS(e,Hh,(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 RR=Zx.compute([Hh],t=>{let e=t.facet(Hh);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:Qp.create,above:e[0].above,arrow:e.some(n=>n.arrow)}}),sS=ve.define();class BR{constructor(e,n,r,i,s,o){this.view=e,this.source=n,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=o,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(e){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.tile.nearest(n.target);if(!r)return;let i,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let o=e.coordsAtPos(i);if(!o||n.y<o.top||n.y>o.bottom||n.x<o.left-e.defaultCharacterWidth||n.x>o.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),a=l&&l.dir==at.RTL?-1:1;s=n.x<o.left?-a:a}this.activateHover(e,i,s)}activateHover(e,n,r,i){let s=this.source(e,n,r),o=l=>{if(l&&!(Array.isArray(l)&&!l.length)){let a=Array.isArray(l)?l:[l];i&&this.locked.set(a,i),e.dispatch({effects:this.setHover.of(a)})}};if(s&&"then"in s){let l=this.pending={pos:n};s.then(a=>{this.pending==l&&(this.pending=null,o(a))},a=>Jn(e.state,a,"hover tooltip"))}else o(s)}get tooltip(){let e=this.view.plugin(Qx),n=e?e.manager.tooltips.findIndex(r=>r.create==Qp.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&&!this.locked.has(i)&&s&&!OR(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,l=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!jR(this.view,o,l,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&&!this.locked.has(n)){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);let{active:i}=this;i.length&&!this.locked.has(i)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const ef=4;function OR(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();i=Math.min(l.top,i),s=Math.max(l.bottom,s)}return e.clientX>=n-ef&&e.clientX<=r+ef&&e.clientY>=i-ef&&e.clientY<=s+ef}function jR(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,l)<i)return!1;let a=t.posAtCoords({x:r,y:i},!1);return a>=e&&a<=n}function VR(t,e={}){let n=Be.define(),r=new WeakMap,i=Nn.define({create(){return[]},update(o,l){let a=r.get(o);if(o.length&&(e.hideOnChange&&(l.docChanged||l.selection)?o=[]:a&&a(l)?o=[]:e.hideOn&&(o=o.filter(u=>!e.hideOn(l,u)))),l.docChanged&&o.length){let u=[];for(let c of o){let d=l.changes.mapPos(c.pos,-1,Bn.TrackDel);if(d!=null){let f=Object.assign(Object.create(null),c);f.pos=d,f.end!=null&&(f.end=l.changes.mapPos(f.end)),u.push(f)}}o=u}for(let u of l.effects)u.is(n)&&(o=u.value,a=void 0),(u.is(_R)&&!u.value||u.value==i)&&(o=[]);return o.length&&a&&r.set(o,a),o},provide:o=>Hh.from(o)});const s=Vt.define(o=>new BR(o,t,i,r,n,e.hoverTime||300));return{active:i,extension:[i,s,sS.of(s),RR]}}function FR(t,e,n,r={}){var i;let s=t.state.facet(sS).map(o=>t.plugin(o)).filter(o=>!!o);if(r.tooltip&&r.tooltip.active){let o=s.find(l=>l.field==r.tooltip.active);o&&(s=[o])}for(let o of s)o.activateHover(t,e,n,(i=r.until)!==null&&i!==void 0?i:()=>!1)}function oS(t,e){let n=t.plugin(Qx);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const _R=Be.define(),g3=ve.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 Jx(t,e){let n=t.plugin(lS),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const lS=Vt.fromClass(class{constructor(t){this.input=t.state.facet(Dc),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(g3);this.top=new tf(t,!0,e.topContainer),this.bottom=new tf(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(g3);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new tf(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new tf(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Dc);if(n!=this.input){let r=n.filter(a=>a),i=[],s=[],o=[],l=[];for(let a of r){let u=this.specs.indexOf(a),c;u<0?(c=a(t.view),l.push(c)):(c=this.panels[u],c.update&&c.update(t)),i.push(c),(c.top?s:o).push(c)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>me.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class tf{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";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=y3(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=y3(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 y3(t){let e=t.nextSibling;return t.remove(),e}const Dc=ve.define({enables:lS});function HR(t,e){let n,r=new Promise(o=>n=o),i=o=>zR(o,e,n);t.state.field(wg,!1)?t.dispatch({effects:aS.of(i)}):t.dispatch({effects:Be.appendConfig.of(wg.init(()=>[i]))});let s=uS.of(i);return{close:s,result:r.then(o=>((t.win.queueMicrotask||(a=>t.win.setTimeout(a,10)))(()=>{t.state.field(wg).indexOf(i)>-1&&t.dispatch({effects:s})}),o))}}const wg=Nn.define({create(){return[]},update(t,e){for(let n of e.effects)n.is(aS)?t=[n.value].concat(t):n.is(uS)&&(t=t.filter(r=>r!=n.value));return t},provide:t=>Dc.computeN([t],e=>e.field(t))}),aS=Be.define(),uS=Be.define();function zR(t,e,n){let r=e.content?e.content(t,()=>o(null)):null;if(!r){if(r=ot("form"),e.input){let l=ot("input",e.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),r.appendChild(ot("label",(e.label||"")+": ",l))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(ot("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let i=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let l=0;l<i.length;l++){let a=i[l];a.addEventListener("keydown",u=>{u.keyCode==27?(u.preventDefault(),o(null)):u.keyCode==13&&(u.preventDefault(),o(a))}),a.addEventListener("submit",u=>{u.preventDefault(),o(a)})}let s=ot("div",r,ot("button",{onclick:()=>o(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(s.className=e.class),s.classList.add("cm-dialog");function o(l){s.contains(s.ownerDocument.activeElement)&&t.focus(),n(l)}return{dom:s,top:e.top,mount:()=>{if(e.focus){let l;typeof e.focus=="string"?l=r.querySelector(e.focus):l=r.querySelector("input")||r.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class ls extends Zs{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ls.prototype.elementClass="";ls.prototype.toDOM=void 0;ls.prototype.mapMode=Bn.TrackBefore;ls.prototype.startSide=ls.prototype.endSide=-1;ls.prototype.point=!0;const Xf=ve.define(),WR=ve.define(),GR={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_e.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Xu=ve.define();function UR(t){return[cS(),Xu.of({...GR,...t})]}const x3=ve.define({combine:t=>t.some(e=>e)});function cS(t){return[KR]}const KR=Vt.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Xu).map(e=>new b3(t,e)),this.fixed=!t.state.facet(x3);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}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)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(x3)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=_e.iter(this.view.state.facet(Xf),this.view.viewport.from),r=[],i=this.gutters.map(s=>new YR(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 l of s.type)if(l.type==bn.Text&&o){X1(n,r,l.from);for(let a of i)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of i)a.widget(this.view,l)}else if(s.type==bn.Text){X1(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),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Xu),n=t.state.facet(Xu),r=t.docChanged||t.heightChanged||t.viewportChanged||!_e.eq(t.startState.facet(Xf),t.state.facet(Xf),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 b3(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)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>me.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,i=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==at.LTR?{left:r,right:i}:{right:r,left:i}})});function v3(t){return Array.isArray(t)?t:[t]}function X1(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class YR{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=_e.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 l=new dS(e,o,s,r);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(e,o,s,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];X1(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),i=r?[r]:null;for(let s of e.state.facet(WR)){let o=s(e,n.widget,n);o&&(i||(i=[])).push(o)}i&&this.addElement(e,n,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class b3{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 a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=i.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,l,i)&&i.preventDefault()});this.markers=v3(n.markers(e)),n.initialSpacer&&(this.spacer=new dS(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=v3(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!_e.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 dS{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":""),XR(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 l=o,a=s<n.length?n[s++]:null,u=!1;if(a){let c=a.elementClass;c&&(r+=" "+c);for(let d=o;d<this.markers.length;d++)if(this.markers[d].compare(a)){l=d,u=!0;break}}else l=this.markers.length;for(;o<l;){let c=this.markers[o++];if(c.toDOM){c.destroy(i);let d=i.nextSibling;i.remove(),i=d}}if(!a)break;a.toDOM&&(u?i=i.nextSibling:this.dom.insertBefore(a.toDOM(e),i)),u&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function XR(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 qR=ve.define(),QR=ve.define(),Ul=ve.define({combine(t){return Li(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?(l,a,u)=>s(l,a,u)||o(l,a,u):o}return r}})}});class Cg extends ls{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function kg(t,e){return t.state.facet(Ul).formatNumber(e,t.state)}const ZR=Xu.compute([Ul],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(qR)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new Cg(kg(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(QR)){let s=i(e,n,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Ul)!=e.state.facet(Ul),initialSpacer(e){return new Cg(kg(e,w3(e.state.doc.lines)))},updateSpacer(e,n){let r=kg(n.view,w3(n.view.state.doc.lines));return r==e.number?e:new Cg(r)},domEventHandlers:t.facet(Ul).domEventHandlers,side:"before"}));function JR(t={}){return[Ul.of(t),cS(),ZR]}function w3(t){let e=9;for(;e<t;)e=e*10+9;return e}const eB=new class extends ls{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},tB=Xf.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(eB.range(i)))}return _e.of(e)});function nB(){return tB}const fS=1024;let rB=0;class Sg{constructor(e,n){this.from=e,this.to=n}}class Fe{constructor(e={}){this.id=rB++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=lr.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Fe.closedBy=new Fe({deserialize:t=>t.split(" ")});Fe.openedBy=new Fe({deserialize:t=>t.split(" ")});Fe.group=new Fe({deserialize:t=>t.split(" ")});Fe.isolate=new Fe({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Fe.contextHash=new Fe({perNode:!0});Fe.lookAhead=new Fe({perNode:!0});Fe.mounted=new Fe({perNode:!0});class qu{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[Fe.mounted.id]}}const iB=Object.create(null);class lr{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):iB,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new lr(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(Fe.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(Fe.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}lr.none=new lr("",Object.create(null),0,8);class ev{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);if(o){i||(i=Object.assign({},r.props));let l=o[1],a=o[0];a.combine&&a.id in i&&(l=a.combine(i[a.id],l)),i[a.id]=l}}n.push(i?new lr(r.name,i,r.id,r.flags):r)}return new ev(n)}}const nf=new WeakMap,C3=new WeakMap;var Bt;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(Bt||(Bt={}));class Ut{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,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=qu.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 Q1(this.topNode,e)}cursorAt(e,n=0,r=0){let i=nf.get(this)||this.topNode,s=new Q1(i);return s.moveTo(e,n),nf.set(this,s._tree),s}get topNode(){return new Rr(this,0,0,null)}resolve(e,n=0){let r=Nc(nf.get(this)||this.topNode,e,n,!1);return nf.set(this,r),r}resolveInner(e,n=0){let r=Nc(C3.get(this)||this.topNode,e,n,!0);return C3.set(this,r),r}resolveStack(e,n=0){return lB(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,l=(o&Bt.IncludeAnonymous)>0;for(let a=this.cursor(o|Bt.IncludeAnonymous);;){let u=!1;if(a.from<=s&&a.to>=i&&(!l&&a.type.isAnonymous||n(a)!==!1)){if(a.firstChild())continue;u=!0}for(;u&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;u=!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:rv(lr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Ut(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new Ut(lr.none,n,r,i)))}static build(e){return aB(e)}}Ut.empty=new Ut(lr.none,[],[],0);class tv{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 tv(this.buffer,this.index)}}class no{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return lr.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,l=-1;for(let a=e;a!=n&&!(hS(s,i,o[a+1],o[a+2])&&(l=a,r>0));a=o[a+3]);return l}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let l=e,a=0;l<n;){s[a++]=i[l++],s[a++]=i[l++]-r;let u=s[a++]=i[l++]-r;s[a++]=i[l++]-e,o=Math.max(o,u)}return new no(s,o,this.set)}}function hS(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 Nc(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 Rr&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:Bt.IgnoreOverlays;if(r)for(let o=t,l=o.parent;l;o=l,l=o.parent)o instanceof Rr&&o.index<0&&((i=l.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=l);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class pS{cursor(e=0){return new Q1(this,e)}getChild(e,n=null,r=null){let i=k3(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return k3(this,e,n,r)}resolve(e,n=0){return Nc(this,e,n,!1)}resolveInner(e,n=0){return Nc(this,e,n,!0)}matchContext(e){return q1(this.parent,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 Rr extends pS{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:l,positions:a}=o._tree,u=n>0?l.length:-1;e!=u;e+=n){let c=l[e],d=a[e]+o.from,f;if(!(!(s&Bt.EnterBracketed&&c instanceof Ut&&(f=qu.get(c))&&!f.overlay&&f.bracketed&&r>=d&&r<=d+c.length)&&!hS(i,r,d,d+c.length))){if(c instanceof no){if(s&Bt.ExcludeBuffers)continue;let h=c.findChild(0,c.buffer.length,n,r-d,i);if(h>-1)return new Ls(new sB(o,c,e,d),null,h)}else if(s&Bt.IncludeAnonymous||!c.type.isAnonymous||nv(c)){let h;if(!(s&Bt.IgnoreMounts)&&(h=qu.get(c))&&!h.overlay)return new Rr(h.tree,d,e,o);let m=new Rr(c,d,e,o);return s&Bt.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(n<0?c.children.length-1:0,n,r,i,s)}}}if(s&Bt.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)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&Bt.IgnoreOverlays)&&(i=qu.get(this._tree))&&i.overlay){let s=e-this.from,o=r&Bt.EnterBracketed&&i.bracketed;for(let{from:l,to:a}of i.overlay)if((n>0||o?l<=s:l<s)&&(n<0||o?a>=s:a>s))return new Rr(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 k3(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 q1(t,e,n=e.length-1){for(let r=t;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 sB{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class Ls extends pS{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 Ls(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)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&Bt.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 Ls(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 Ls(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 Ls(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 Ut(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function mS(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 Rr&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new oB(i,n)}class oB{constructor(e,n){this.heads=e,this.node=n}get next(){return mS(this.heads)}}function lB(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof Rr?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=qu.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new Rr(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Nc(l,e,n,!1))}}return i?mS(i):r}class Q1{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Bt.EnterBracketed,e instanceof Rr)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 Rr?(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&Bt.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Bt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Bt.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 l=r._tree.children[s];if(this.mode&Bt.IncludeAnonymous||l instanceof no||!l.type.isAnonymous||nv(l))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 Ls(this.buffer,n,this.stack[i]);return this.bufferNode=new Ls(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(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return q1(this.node.parent,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 q1(this._tree,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 nv(t){return t.children.some(e=>e instanceof no||!e.type.isAnonymous||nv(e))}function aB(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=fS,reused:s=[],minRepeatType:o=r.types.length}=t,l=Array.isArray(n)?new tv(n,n.length):n,a=r.types,u=0,c=0;function d(S,k,E,$,D,L){let{id:A,start:T,end:V,size:M}=l,B=c,N=u;if(M<0)if(l.next(),M==-1){let z=s[A];E.push(z),$.push(T-S);return}else if(M==-3){u=A;return}else if(M==-4){c=A;return}else throw new RangeError(`Unrecognized record size: ${M}`);let O=a[A],I,P,F=T-S;if(V-T<=i&&(P=v(l.pos-k,D))){let z=new Uint16Array(P.size-P.skip),j=l.pos-P.size,R=z.length;for(;l.pos>j;)R=p(P.start,z,R);I=new no(z,V-P.start,r),F=P.start-S}else{let z=l.pos-M;l.next();let j=[],R=[],H=A>=o?A:-1,G=0,U=V;for(;l.pos>z;)H>=0&&l.id==H&&l.size>=0?(l.end<=U-i&&(m(j,R,T,G,l.end,U,H,B,N),G=j.length,U=l.end),l.next()):L>2500?f(T,z,j,R):d(T,z,j,R,H,L+1);if(H>=0&&G>0&&G<j.length&&m(j,R,T,G,T,U,H,B,N),j.reverse(),R.reverse(),H>-1&&G>0){let se=h(O,N);I=rv(O,j,R,0,j.length,0,V-T,se,se)}else I=x(O,j,R,V-T,B-V,N)}E.push(I),$.push(F)}function f(S,k,E,$){let D=[],L=0,A=-1;for(;l.pos>k;){let{id:T,start:V,end:M,size:B}=l;if(B>4)l.next();else{if(A>-1&&V<A)break;A<0&&(A=M-i),D.push(T,V,M),L++,l.next()}}if(L){let T=new Uint16Array(L*4),V=D[D.length-2];for(let M=D.length-3,B=0;M>=0;M-=3)T[B++]=D[M],T[B++]=D[M+1]-V,T[B++]=D[M+2]-V,T[B++]=B;E.push(new no(T,D[2]-V,r)),$.push(V-S)}}function h(S,k){return(E,$,D)=>{let L=0,A=E.length-1,T,V;if(A>=0&&(T=E[A])instanceof Ut){if(!A&&T.type==S&&T.length==D)return T;(V=T.prop(Fe.lookAhead))&&(L=$[A]+T.length+V)}return x(S,E,$,D,L,k)}}function m(S,k,E,$,D,L,A,T,V){let M=[],B=[];for(;S.length>$;)M.push(S.pop()),B.push(k.pop()+E-D);S.push(x(r.types[A],M,B,L-D,T-L,V)),k.push(D-E)}function x(S,k,E,$,D,L,A){if(L){let T=[Fe.contextHash,L];A=A?[T].concat(A):[T]}if(D>25){let T=[Fe.lookAhead,D];A=A?[T].concat(A):[T]}return new Ut(S,k,E,$,A)}function v(S,k){let E=l.fork(),$=0,D=0,L=0,A=E.end-i,T={size:0,start:0,skip:0};e:for(let V=E.pos-S;E.pos>V;){let M=E.size;if(E.id==k&&M>=0){T.size=$,T.start=D,T.skip=L,L+=4,$+=4,E.next();continue}let B=E.pos-M;if(M<0||B<V||E.start<A)break;let N=E.id>=o?4:0,O=E.start;for(E.next();E.pos>B;){if(E.size<0)if(E.size==-3||E.size==-4)N+=4;else break e;else E.id>=o&&(N+=4);E.next()}D=O,$+=M,L+=N}return(k<0||$==S)&&(T.size=$,T.start=D,T.skip=L),T.size>4?T:void 0}function p(S,k,E){let{id:$,start:D,end:L,size:A}=l;if(l.next(),A>=0&&$<o){let T=E;if(A>4){let V=l.pos-(A-4);for(;l.pos>V;)E=p(S,k,E)}k[--E]=T,k[--E]=L-S,k[--E]=D-S,k[--E]=$}else A==-3?u=$:A==-4&&(c=$);return E}let y=[],b=[];for(;l.pos>0;)d(t.start||0,t.bufferStart||0,y,b,-1,0);let C=(e=t.length)!==null&&e!==void 0?e:y.length?b[0]+y[0].length:0;return new Ut(a[t.topID],y.reverse(),b.reverse(),C)}const S3=new WeakMap;function qf(t,e){if(!t.isAnonymous||e instanceof no||e.type!=t)return 1;let n=S3.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Ut)){n=1;break}n+=qf(t,r)}S3.set(e,n)}return n}function rv(t,e,n,r,i,s,o,l,a){let u=0;for(let m=r;m<i;m++)u+=qf(t,e[m]);let c=Math.ceil(u*1.5/8),d=[],f=[];function h(m,x,v,p,y){for(let b=v;b<p;){let C=b,S=x[b],k=qf(t,m[b]);for(b++;b<p;b++){let E=qf(t,m[b]);if(k+E>=c)break;k+=E}if(b==C+1){if(k>c){let E=m[C];h(E.children,E.positions,0,E.children.length,x[C]+y);continue}d.push(m[C])}else{let E=x[b-1]+m[b-1].length-S;d.push(rv(t,m,x,C,b,S,E,null,a))}f.push(S+y-s)}}return h(e,n,r,i,0),(l||a)(d,f,o)}class Ho{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 Ho(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 l=0,a=0,u=0;;l++){let c=l<n.length?n[l]:null,d=c?c.fromA:1e9;if(d-a>=r)for(;o&&o.from<d;){let f=o;if(a>=f.from||d<=f.to||u){let h=Math.max(f.from,a)-u,m=Math.min(f.to,d)-u;f=h>=m?null:new Ho(h,m,f.tree,f.offset+u,l>0,!!c)}if(f&&i.push(f),o.to>d)break;o=s<e.length?e[s++]:null}if(!c)break;a=c.toA,u=c.toA-c.toB}return i}}class gS{startParse(e,n,r){return typeof e=="string"&&(e=new uB(e)),r=r?r.length?r.map(i=>new Sg(i.from,i.to)):[new Sg(0,0)]:[new Sg(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 uB{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 Fe({perNode:!0});let cB=0;class Dr{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=cB++}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 Dr&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new Dr(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 zh(e);return r=>r.modified.indexOf(n)>-1?r:zh.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let dB=0;class zh{constructor(e){this.name=e,this.instances=[],this.id=dB++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&fB(n,l.modified));if(r)return r;let i=[],s=new Dr(e.name,i,e,n);for(let l of n)l.instances.push(s);let o=hB(n);for(let l of e.set)if(!l.modified.length)for(let a of o)i.push(zh.get(l,a));return s}}function fB(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function hB(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 yS(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,l=i;for(let d=0;;){if(l=="..."&&d>0&&d+3==i.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);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);l=i.slice(d)}let a=s.length-1,u=s[a];if(!u)throw new RangeError("Invalid path: "+i);let c=new Ac(r,o,a>0?s.slice(0,a):null);e[u]=c.sort(e[u])}}return xS.add(e)}const xS=new Fe({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new Ac(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class Ac{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}}Ac.empty=new Ac([],2,null);function vS(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 l of s)for(let a of l.set){let u=n[a.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function pB(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function mB(t,e,n,r=0,i=t.length){let s=new gB(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class gB{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:l,to:a}=e;if(l>=r||a<=n)return;o.isTop&&(s=this.highlighters.filter(h=>!h.scope||h.scope(o)));let u=i,c=yB(e)||Ac.empty,d=pB(s,c.tags);if(d&&(u&&(u+=" "),u+=d,c.mode==1&&(i+=(i?" ":"")+d)),this.startSpan(Math.max(n,l),u),c.opaque)return;let f=e.tree&&e.tree.prop(Fe.mounted);if(f&&f.overlay){let h=e.node.enter(f.overlay[0].from+l,1),m=this.highlighters.filter(v=>!v.scope||v.scope(f.tree.type)),x=e.firstChild();for(let v=0,p=l;;v++){let y=v<f.overlay.length?f.overlay[v]:null,b=y?y.from+l:a,C=Math.max(n,p),S=Math.min(r,b);if(C<S&&x)for(;e.from<S&&(this.highlightRange(e,C,S,i,s),this.startSpan(Math.min(S,e.to),u),!(e.to>=b||!e.nextSibling())););if(!y||b>r)break;p=y.to+l,p>n&&(this.highlightRange(h.cursor(),Math.max(n,y.from+l),Math.min(r,p),"",m),this.startSpan(Math.min(r,p),u))}x&&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),u)}while(e.nextSibling());e.parent()}}}function yB(t){let e=t.type.prop(xS);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const pe=Dr.define,rf=pe(),Cs=pe(),E3=pe(Cs),$3=pe(Cs),ks=pe(),sf=pe(ks),Eg=pe(ks),mi=pe(),go=pe(mi),hi=pe(),pi=pe(),Z1=pe(),mu=pe(Z1),of=pe(),q={comment:rf,lineComment:pe(rf),blockComment:pe(rf),docComment:pe(rf),name:Cs,variableName:pe(Cs),typeName:E3,tagName:pe(E3),propertyName:$3,attributeName:pe($3),className:pe(Cs),labelName:pe(Cs),namespace:pe(Cs),macroName:pe(Cs),literal:ks,string:sf,docString:pe(sf),character:pe(sf),attributeValue:pe(sf),number:Eg,integer:pe(Eg),float:pe(Eg),bool:pe(ks),regexp:pe(ks),escape:pe(ks),color:pe(ks),url:pe(ks),keyword:hi,self:pe(hi),null:pe(hi),atom:pe(hi),unit:pe(hi),modifier:pe(hi),operatorKeyword:pe(hi),controlKeyword:pe(hi),definitionKeyword:pe(hi),moduleKeyword:pe(hi),operator:pi,derefOperator:pe(pi),arithmeticOperator:pe(pi),logicOperator:pe(pi),bitwiseOperator:pe(pi),compareOperator:pe(pi),updateOperator:pe(pi),definitionOperator:pe(pi),typeOperator:pe(pi),controlOperator:pe(pi),punctuation:Z1,separator:pe(Z1),bracket:mu,angleBracket:pe(mu),squareBracket:pe(mu),paren:pe(mu),brace:pe(mu),content:mi,heading:go,heading1:pe(go),heading2:pe(go),heading3:pe(go),heading4:pe(go),heading5:pe(go),heading6:pe(go),contentSeparator:pe(mi),list:pe(mi),quote:pe(mi),emphasis:pe(mi),strong:pe(mi),link:pe(mi),monospace:pe(mi),strikethrough:pe(mi),inserted:pe(),deleted:pe(),changed:pe(),invalid:pe(),meta:of,documentMeta:pe(of),annotation:pe(of),processingInstruction:pe(of),definition:Dr.defineModifier("definition"),constant:Dr.defineModifier("constant"),function:Dr.defineModifier("function"),standard:Dr.defineModifier("standard"),local:Dr.defineModifier("local"),special:Dr.defineModifier("special")};for(let t in q){let e=q[t];e instanceof Dr&&(e.name=t)}vS([{tag:q.link,class:"tok-link"},{tag:q.heading,class:"tok-heading"},{tag:q.emphasis,class:"tok-emphasis"},{tag:q.strong,class:"tok-strong"},{tag:q.keyword,class:"tok-keyword"},{tag:q.atom,class:"tok-atom"},{tag:q.bool,class:"tok-bool"},{tag:q.url,class:"tok-url"},{tag:q.labelName,class:"tok-labelName"},{tag:q.inserted,class:"tok-inserted"},{tag:q.deleted,class:"tok-deleted"},{tag:q.literal,class:"tok-literal"},{tag:q.string,class:"tok-string"},{tag:q.number,class:"tok-number"},{tag:[q.regexp,q.escape,q.special(q.string)],class:"tok-string2"},{tag:q.variableName,class:"tok-variableName"},{tag:q.local(q.variableName),class:"tok-variableName tok-local"},{tag:q.definition(q.variableName),class:"tok-variableName tok-definition"},{tag:q.special(q.variableName),class:"tok-variableName2"},{tag:q.definition(q.propertyName),class:"tok-propertyName tok-definition"},{tag:q.typeName,class:"tok-typeName"},{tag:q.namespace,class:"tok-namespace"},{tag:q.className,class:"tok-className"},{tag:q.macroName,class:"tok-macroName"},{tag:q.propertyName,class:"tok-propertyName"},{tag:q.operator,class:"tok-operator"},{tag:q.comment,class:"tok-comment"},{tag:q.meta,class:"tok-meta"},{tag:q.invalid,class:"tok-invalid"},{tag:q.punctuation,class:"tok-punctuation"}]);var $g;const Kl=new Fe;function xB(t){return ve.define({combine:t?e=>e.concat(t):void 0})}const vB=new Fe;class qr{constructor(e,n,r=[],i=""){this.data=e,this.name=i,Ge.prototype.hasOwnProperty("tree")||Object.defineProperty(Ge.prototype,"tree",{get(){return Dn(this)}}),this.parser=n,this.extension=[ro.of(this),Ge.languageData.of((s,o,l)=>{let a=M3(s,o,l),u=a.type.prop(Kl);if(!u)return[];let c=s.facet(u),d=a.type.prop(vB);if(d){let f=a.resolve(o-a.from,l);for(let h of d)if(h.test(f,s)){let m=s.facet(h.facet);return h.type=="replace"?m:m.concat(c)}}return c})].concat(r)}isActiveAt(e,n,r=-1){return M3(e,n,r).type.prop(Kl)==this.data}findRegions(e){let n=e.facet(ro);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(Kl)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(Fe.mounted);if(l){if(l.tree.prop(Kl)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;a<s.children.length;a++){let u=s.children[a];u instanceof Ut&&i(u,s.positions[a]+o)}};return i(Dn(e),0),r}get allowsNesting(){return!0}}qr.setState=Be.define();function M3(t,e,n){let r=t.facet(ro),i=Dn(t).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,n,Bt.ExcludeBuffers|Bt.EnterBracketed))s.type.isTop&&(i=s);return i}class Wh extends qr{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=xB(e.languageData);return new Wh(n,e.parser.configure({props:[Kl.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new Wh(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Dn(t){let e=t.field(qr.state,!1);return e?e.tree:Ut.empty}class bB{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 gu=null;class Gh{constructor(e,n,r=[],i,s,o,l,a){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new Gh(e,n,[],Ut.empty,0,r,[],null)}startParse(){return this.parser.startParse(new bB(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Ut.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(Ho.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(Ho.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=gu;gu=this;try{return e()}finally{gu=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=D3(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((u,c,d,f)=>a.push({fromA:u,toA:c,fromB:d,toB:f})),r=Ho.applyChanges(r,a),i=Ut.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let c=e.mapPos(u.from,1),d=e.mapPos(u.to,-1);c<d&&l.push({from:c,to:d})}}}return new Gh(this.parser,n,r,i,s,o,l,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=D3(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 gS{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=gu;if(a){for(let u of i)a.tempSkipped.push(u);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new Ut(lr.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 gu}}function D3(t,e,n){return Ho.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Ta{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 Ta(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=Gh.create(e.facet(ro).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Ta(r)}}qr.state=Nn.define({create:Ta.init,update(t,e){for(let n of e.effects)if(n.is(qr.setState))return n.value;return e.startState.facet(ro)!=e.state.facet(ro)?Ta.init(e.state):t.apply(e)}});let bS=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(bS=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Mg=typeof navigator<"u"&&(!(($g=navigator.scheduling)===null||$g===void 0)&&$g.isInputPending)?()=>navigator.scheduling.isInputPending():null,wB=Vt.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(qr.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(qr.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=bS(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(qr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Mg?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<i&&r.doc.length>i+1e3,a=s.context.work(()=>Mg&&Mg()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:qr.setState.of(new Ta(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Jn(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()}}}),ro=ve.define({combine(t){return t.length?t[0]:null},enables:t=>[qr.state,wB,me.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class CB{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const kB=ve.define(),Zp=ve.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 Uh(t){let e=t.facet(Zp);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Tc(t,e){let n="",r=t.tabSize,i=t.facet(Zp)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s<e;s++)n+=i;return n}function iv(t,e){t instanceof Ge&&(t=new Jp(t));for(let r of t.state.facet(kB)){let i=r(t,e);if(i!==void 0)return i}let n=Dn(t.state);return n.length>=e?SB(t,n,e):null}class Jp{constructor(e,n={}){this.state=e,this.options=n,this.unit=Uh(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 Ga(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 wS=new Fe;function SB(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return CS(r,t,n)}function CS(t,e,n){for(let r=t;r;r=r.next){let i=$B(r.node);if(i)return i(sv.create(e,n,r))}return 0}function EB(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function $B(t){let e=t.type.prop(wS);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Fe.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>AB(o,!0,1,void 0,s&&!EB(o)?i.from:void 0)}return t.parent==null?MB:null}function MB(){return 0}class sv extends Jp{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 sv(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(DB(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return CS(this.context.next,this.base,this.pos)}}function DB(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function NB(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 l=n.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}l=a.to}}function AB(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||i==t.pos+o,a=NB(t);return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}function N3({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const TB=200;function PB(){return Ge.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+TB)return t;let s=n.sliceString(i.from,r);if(!e.some(u=>u.test(s)))return t;let{state:o}=t,l=-1,a=[];for(let{head:u}of o.selection.ranges){let c=o.doc.lineAt(u);if(c.from==l)continue;l=c.from;let d=iv(o,c.from);if(d==null)continue;let f=/^\s*/.exec(c.text)[0],h=Tc(o,d);f!=h&&a.push({from:c.from,to:c.from+f.length,insert:h})}return a.length?[t,{changes:a,sequential:!0}]:t})}const LB=ve.define(),kS=new Fe;function IB(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 RB(t,e,n){let r=Dn(t);if(r.length<n)return null;let i=r.resolveStack(n,1),s=null;for(let o=i;o;o=o.next){let l=o.node;if(l.to<=n||l.from>n)continue;if(s&&l.from<e)break;let a=l.type.prop(kS);if(a&&(l.to<r.length-50||r.length==t.doc.length||!BB(l))){let u=a(l,t);u&&u.from<=n&&u.from>=e&&u.to>n&&(s=u)}}return s}function BB(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Kh(t,e,n){for(let r of t.facet(LB)){let i=r(t,e,n);if(i)return i}return RB(t,e,n)}function SS(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 em=Be.define({map:SS}),od=Be.define({map:SS});function ES(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 nl=Nn.define({create(){return Ae.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((r,i)=>t=A3(t,r,i)),t=t.map(e.changes);let n=[];for(let r of e.effects)r.is(em)&&!OB(t,r.value.from,r.value.to)?n.push(r.value):r.is(od)&&(t=t.update({filter:(i,s)=>r.value.from!=i||r.value.to!=s,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=e.state.facet(DS),i=n.map(s=>(r?Ae.replace({widget:new WB(r(e.state,s))}):T3).range(s.from,s.to));t=t.update({add:i})}return e.selection&&(t=A3(t,e.selection.main.head)),t},provide:t=>me.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(T3.range(r,i))}return Ae.set(e,!0)}});function A3(t,e,n=e){let r=!1;return t.between(e,n,(i,s)=>{i<n&&s>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(i,s)=>i>=n||s<=e}):t}function Yh(t,e,n){var r;let i=null;return(r=t.field(nl,!1))===null||r===void 0||r.between(e,n,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function OB(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function $S(t,e){return t.field(nl,!1)?e:e.concat(Be.appendConfig.of(NS()))}const jB=t=>{for(let e of ES(t)){let n=Kh(t.state,e.from,e.to);if(n)return t.dispatch({effects:$S(t.state,[em.of(n),MS(t,n)])}),!0}return!1},VB=t=>{if(!t.state.field(nl,!1))return!1;let e=[];for(let n of ES(t)){let r=Yh(t.state,n.from,n.to);r&&e.push(od.of(r),MS(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function MS(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return me.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const FB=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),s=Kh(e,i.from,i.to);s&&n.push(em.of(s)),r=(s?t.lineBlockAt(s.to):i).to+1}return n.length&&t.dispatch({effects:$S(t.state,n)}),!!n.length},_B=t=>{let e=t.state.field(nl,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(od.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},HB=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:jB},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:VB},{key:"Ctrl-Alt-[",run:FB},{key:"Ctrl-Alt-]",run:_B}],zB={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},DS=ve.define({combine(t){return Li(t,zB)}});function NS(t){return[nl,KB]}function AS(t,e){let{state:n}=t,r=n.facet(DS),i=o=>{let l=t.lineBlockAt(t.posAtDOM(o.target)),a=Yh(t.state,l.from,l.to);a&&t.dispatch({effects:od.of(a)}),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 T3=Ae.replace({widget:new class extends Ii{toDOM(t){return AS(t,null)}}});class WB extends Ii{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return AS(e,this.value)}}const GB={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Dg extends ls{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 UB(t={}){let e={...GB,...t},n=new Dg(e,!0),r=new Dg(e,!1),i=Vt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(ro)!=o.state.facet(ro)||o.startState.field(nl,!1)!=o.state.field(nl,!1)||Dn(o.startState)!=Dn(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new ss;for(let a of o.viewportLineBlocks){let u=Yh(o.state,a.from,a.to)?r:Kh(o.state,a.from,a.to)?n:null;u&&l.add(a.from,a.from,u)}return l.finish()}}),{domEventHandlers:s}=e;return[i,UR({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(i))===null||l===void 0?void 0:l.markers)||_e.empty},initialSpacer(){return new Dg(e,!1)},domEventHandlers:{...s,click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let u=Yh(o.state,l.from,l.to);if(u)return o.dispatch({effects:od.of(u)}),!0;let c=Kh(o.state,l.from,l.to);return c?(o.dispatch({effects:em.of(c)}),!0):!1}}}),NS()]}const KB=me.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 ld{constructor(e,n){this.specs=e;let r;function i(l){let a=Js.newName();return(r||(r=Object.create(null)))["."+a]=l,a}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof qr?l=>l.prop(Kl)==o.data:o?l=>l==o:void 0,this.style=vS(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Js(r):null,this.themeType=n.themeType}static define(e,n){return new ld(e,n||{})}}const J1=ve.define(),TS=ve.define({combine(t){return t.length?[t[0]]:null}});function Ng(t){let e=t.facet(J1);return e.length?e:t.facet(TS)}function PS(t,e){let n=[XB],r;return t instanceof ld&&(t.module&&n.push(me.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(TS.of(t)):r?n.push(J1.computeN([me.darkTheme],i=>i.facet(me.darkTheme)==(r=="dark")?[t]:[])):n.push(J1.of(t)),n}class YB{constructor(e){this.markCache=Object.create(null),this.tree=Dn(e.state),this.decorations=this.buildDeco(e,Ng(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Dn(e.state),r=Ng(e.state),i=r!=Ng(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 Ae.none;let r=new ss;for(let{from:i,to:s}of e.visibleRanges)mB(this.tree,n,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=Ae.mark({class:a})))},i,s);return r.finish()}}const XB=dl.high(Vt.fromClass(YB,{decorations:t=>t.decorations})),qB=ld.define([{tag:q.meta,color:"#404740"},{tag:q.link,textDecoration:"underline"},{tag:q.heading,textDecoration:"underline",fontWeight:"bold"},{tag:q.emphasis,fontStyle:"italic"},{tag:q.strong,fontWeight:"bold"},{tag:q.strikethrough,textDecoration:"line-through"},{tag:q.keyword,color:"#708"},{tag:[q.atom,q.bool,q.url,q.contentSeparator,q.labelName],color:"#219"},{tag:[q.literal,q.inserted],color:"#164"},{tag:[q.string,q.deleted],color:"#a11"},{tag:[q.regexp,q.escape,q.special(q.string)],color:"#e40"},{tag:q.definition(q.variableName),color:"#00f"},{tag:q.local(q.variableName),color:"#30a"},{tag:[q.typeName,q.namespace],color:"#085"},{tag:q.className,color:"#167"},{tag:[q.special(q.variableName),q.macroName],color:"#256"},{tag:q.definition(q.propertyName),color:"#00c"},{tag:q.comment,color:"#940"},{tag:q.invalid,color:"#f00"}]),QB=me.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),LS=1e4,IS="()[]{}",RS=ve.define({combine(t){return Li(t,{afterCursor:!0,brackets:IS,maxScanDistance:LS,renderMatch:eO})}}),ZB=Ae.mark({class:"cm-matchingBracket"}),JB=Ae.mark({class:"cm-nonmatchingBracket"});function eO(t){let e=[],n=t.matched?ZB:JB;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}function P3(t){let e=[],n=t.facet(RS);for(let r of t.selection.ranges){if(!r.empty)continue;let i=Ei(t,r.head,-1,n)||r.head>0&&Ei(t,r.head-1,1,n)||n.afterCursor&&(Ei(t,r.head,1,n)||r.head<t.doc.length&&Ei(t,r.head+1,-1,n));i&&(e=e.concat(n.renderMatch(i,t)))}return Ae.set(e,!0)}const tO=Vt.fromClass(class{constructor(t){this.paused=!1,this.decorations=P3(t.state)}update(t){(t.docChanged||t.selectionSet||this.paused)&&(t.view.composing?(this.decorations=this.decorations.map(t.changes),this.paused=!0):(this.decorations=P3(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),nO=[tO,QB];function rO(t={}){return[RS.of(t),nO]}const iO=new Fe;function ey(t,e,n){let r=t.prop(e<0?Fe.openedBy:Fe.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 ty(t){let e=t.type.prop(iO);return e?e(t.node):t}function Ei(t,e,n,r={}){let i=r.maxScanDistance||LS,s=r.brackets||IS,o=Dn(t),l=o.resolveInner(e,n);for(let a=l;a;a=a.parent){let u=ey(a.type,n,s);if(u&&a.from<a.to){let c=ty(a);if(c&&(n>0?e>=c.from&&e<c.to:e>c.from&&e<=c.to))return sO(t,e,n,a,c,u,s)}}return oO(t,e,n,o,l.type,i,s)}function sO(t,e,n,r,i,s,o){let l=r.parent,a={from:i.from,to:i.to},u=0,c=l==null?void 0:l.cursor();if(c&&(n<0?c.childBefore(r.from):c.childAfter(r.to)))do if(n<0?c.to<=r.from:c.from>=r.to){if(u==0&&s.indexOf(c.type.name)>-1&&c.from<c.to){let d=ty(c);return{start:a,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(ey(c.type,n,o))u++;else if(ey(c.type,-n,o)){if(u==0){let d=ty(c);return{start:a,end:d&&d.from<d.to?{from:d.from,to:d.to}:void 0,matched:!1}}u--}}while(n<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function oO(t,e,n,r,i,s,o){if(n<0?!e:e==t.doc.length)return null;let l=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=n>0)return null;let u={from:n<0?e-1:e,to:n>0?e+1:e},c=t.doc.iterRange(e,n>0?t.doc.length:0),d=0;for(let f=0;!c.next().done&&f<=s;){let h=c.value;n<0&&(f+=h.length);let m=e+f*n;for(let x=n>0?0:h.length-1,v=n>0?h.length:-1;x!=v;x+=n){let p=o.indexOf(h[x]);if(!(p<0||r.resolveInner(m+x,1).type!=i))if(p%2==0==n>0)d++;else{if(d==1)return{start:u,end:{from:m+x,to:m+x+1},matched:p>>1==a>>1};d--}}n>0&&(f+=h.length)}return c.done?{start:u,matched:!1}:null}const lO=Object.create(null),L3=[lr.none],I3=[],R3=Object.create(null),aO=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"]])aO[t]=uO(lO,e);function Ag(t,e){I3.indexOf(t)>-1||(I3.push(t),console.warn(e))}function uO(t,e){let n=[];for(let l of e.split(" ")){let a=[];for(let u of l.split(".")){let c=t[u]||q[u];c?typeof c=="function"?a.length?a=a.map(c):Ag(u,`Modifier ${u} used at start of tag`):a.length?Ag(u,`Tag ${u} used as modifier`):a=Array.isArray(c)?c:[c]:Ag(u,`Unknown highlighting tag ${u}`)}for(let u of a)n.push(u)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),s=R3[i];if(s)return s.id;let o=R3[i]=lr.define({id:L3.length,name:r,props:[yS({[r]:n})]});return L3.push(o),o.id}at.RTL,at.LTR;const cO=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=lv(t.state,n.from);return r.line?dO(t):r.block?hO(t):!1};function ov(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 dO=ov(gO,0),fO=ov(BS,0),hO=ov((t,e)=>BS(t,e,mO(e)),0);function lv(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const yu=50;function pO(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-yu,r),o=t.sliceDoc(i,i+yu),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,u=s.length-l;if(s.slice(u-e.length,u)==e&&o.slice(a,a+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let c,d;i-r<=2*yu?c=d=t.sliceDoc(r,i):(c=t.sliceDoc(r,r+yu),d=t.sliceDoc(i-yu,i));let f=/^\s*/.exec(c)[0].length,h=/\s*$/.exec(d)[0].length,m=d.length-h-n.length;return c.slice(f,f+e.length)==e&&d.slice(m,m+n.length)==n?{open:{pos:r+f+e.length,margin:/\s/.test(c.charAt(f+e.length))?1:0},close:{pos:i-h-n.length,margin:/\s/.test(d.charAt(m-1))?1:0}}:null}function mO(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);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let 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 BS(t,e,n=e.selection.ranges){let r=n.map(s=>lv(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>pO(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,l;o<i.length;o++)if(l=i[o]){let a=r[o],{open:u,close:c}=l;s.push({from:u.pos-a.open.length,to:u.pos+u.margin},{from:c.pos-c.margin,to:c.pos+a.close.length})}return{changes:s}}return null}function gO(t,e,n=e.selection.ranges){let r=[],i=-1;e:for(let{from:s,to:o}of n){let l=r.length,a=1e9,u;for(let c=s;c<=o;){let d=e.doc.lineAt(c);if(u==null&&(u=lv(e,d.from).line,!u))continue e;if(d.from>i&&(s==o||o>d.from)){i=d.from;let f=/^\s*/.exec(d.text)[0].length,h=f==d.length,m=d.text.slice(f,f+u.length)==u?f:-1;f<d.text.length&&f<a&&(a=f),r.push({line:d,comment:m,token:u,indent:f,empty:h,single:!1})}c=d.to+1}if(a<1e9)for(let c=l;c<r.length;c++)r[c].indent<r[c].line.text.length&&(r[c].indent=a);r.length==l+1&&(r[l].single=!0)}if(t!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:u,empty:c,single:d}of r)(d||!c)&&s.push({from:l.from+u,insert:a+" "});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:l,token:a}of r)if(l>=0){let u=o.from+l,c=u+a.length;o.text[c-o.from]==" "&&c++,s.push({from:u,to:c})}return{changes:s}}return null}const ny=Pi.define(),yO=Pi.define(),xO=ve.define(),OS=ve.define({combine(t){return Li(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)})}}),jS=Nn.define({create(){return $i.empty},update(t,e){let n=e.state.facet(OS),r=e.annotation(ny);if(r){let a=er.fromTransaction(e,r.selection),u=r.side,c=u==0?t.undone:t.done;return a?c=Xh(c,c.length,n.minDepth,a):c=_S(c,e.startState.selection),new $i(u==0?r.rest:c,u==0?c:r.rest)}let i=e.annotation(yO);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(sn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=er.fromTransaction(e),o=e.annotation(sn.time),l=e.annotation(sn.userEvent);return s?t=t.addChanges(s,o,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,l,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 $i(t.done.map(er.fromJSON),t.undone.map(er.fromJSON))}});function vO(t={}){return[jS,OS.of(t),me.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?VS:e.inputType=="historyRedo"?ry:null;return r?(e.preventDefault(),r(n)):!1}})]}function tm(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(jS,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const VS=tm(0,!1),ry=tm(1,!1),bO=tm(0,!0),wO=tm(1,!0);class er{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 er(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 er(e.changes&&nn.fromJSON(e.changes),[],e.mapped&&Ni.fromJSON(e.mapped),e.startSelection&&J.fromJSON(e.startSelection),e.selectionsAfter.map(J.fromJSON))}static fromTransaction(e,n){let r=Tr;for(let i of e.startState.facet(xO)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new er(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Tr)}static selection(e){return new er(void 0,Tr,void 0,void 0,e)}}function Xh(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 CO(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,l)=>{for(let a=0;a<n.length;){let u=n[a++],c=n[a++];l>=u&&o<=c&&(r=!0)}}),r}function kO(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function FS(t,e){return t.length?e.length?t.concat(e):t:e}const Tr=[],SO=200;function _S(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-SO));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Xh(t,t.length-1,1e9,n.setSelAfter(r)))}else return[er.selection([e])]}function EO(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 Tg(t,e){if(!t.length)return t;let n=t.length,r=Tr;for(;n;){let i=$O(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?[er.selection(r)]:Tr}function $O(t,e,n){let r=FS(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):Tr,n);if(!t.changes)return er.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new er(i,Be.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const MO=/^(input\.type|delete)($|\.)/;class $i{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 $i(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||MO.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,CO(l.changes,e.changes))||r=="input.type.compose")?o=Xh(o,o.length-1,i.minDepth,new er(e.changes.compose(l.changes),FS(Be.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,Tr)):o=Xh(o,o.length,i.minDepth,e),new $i(o,Tr,n,r)}addSelection(e,n,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Tr;return s.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&kO(s[s.length-1],e)?this:new $i(_S(this.done,e),this.undone,n,r)}addMapping(e){return new $i(Tg(this.done,e),Tg(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]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):n.selection);if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:ny.of({side:e,rest:EO(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=i.length==1?Tr:i.slice(0,i.length-1);return s.mapped&&(l=Tg(l,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:ny.of({side:e,rest:l,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}$i.empty=new $i(Tr,Tr);const DO=[{key:"Mod-z",run:VS,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:ry,preventDefault:!0},{linux:"Ctrl-Shift-z",run:ry,preventDefault:!0},{key:"Mod-u",run:bO,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:wO,preventDefault:!0}];function Ua(t,e){return J.create(t.ranges.map(e),t.mainIndex)}function ii(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function si({state:t,dispatch:e},n){let r=Ua(t.selection,n);return r.eq(t.selection,!0)?!1:(e(ii(t,r)),!0)}function nm(t,e){return J.cursor(e?t.to:t.from)}function HS(t,e){return si(t,n=>n.empty?t.moveByChar(n,e):nm(n,e))}function An(t){return t.textDirectionAt(t.state.selection.main.head)==at.LTR}const zS=t=>HS(t,!An(t)),WS=t=>HS(t,An(t));function GS(t,e){return si(t,n=>n.empty?t.moveByGroup(n,e):nm(n,e))}const NO=t=>GS(t,!An(t)),AO=t=>GS(t,An(t));function TO(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 rm(t,e,n){let r=Dn(t).resolveInner(e.head),i=n?Fe.closedBy:Fe.openedBy;for(let a=e.head;;){let u=n?r.childAfter(a):r.childBefore(a);if(!u)break;TO(t,u,i)?r=u:a=n?u.to:u.from}let s=r.type.prop(i),o,l;return s&&(o=n?Ei(t,r.from,1):Ei(t,r.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?r.to:r.from,J.cursor(l,n?-1:1)}const PO=t=>si(t,e=>rm(t.state,e,!An(t))),LO=t=>si(t,e=>rm(t.state,e,An(t)));function US(t,e){return si(t,n=>{if(!n.empty)return nm(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const KS=t=>US(t,!1),YS=t=>US(t,!0);function XS(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let s of t.state.facet(me.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 qS(t,e){let n=XS(t),{state:r}=t,i=Ua(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):nm(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>a&&o.bottom<u&&(s=me.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-a}))}return t.dispatch(ii(r,i),{effects:s}),!0}const B3=t=>qS(t,!1),iy=t=>qS(t,!0);function uo(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=J.cursor(r.from+s))}return i}const IO=t=>si(t,e=>uo(t,e,!0)),RO=t=>si(t,e=>uo(t,e,!1)),BO=t=>si(t,e=>uo(t,e,!An(t))),OO=t=>si(t,e=>uo(t,e,An(t))),jO=t=>si(t,e=>J.cursor(t.lineBlockAt(e.head).from,1)),VO=t=>si(t,e=>J.cursor(t.lineBlockAt(e.head).to,-1));function FO(t,e,n){let r=!1,i=Ua(t.selection,s=>{let o=Ei(t,s.head,-1)||Ei(t,s.head,1)||s.head>0&&Ei(t,s.head-1,1)||s.head<t.doc.length&&Ei(t,s.head+1,-1);if(!o||!o.end)return s;r=!0;let l=o.start.from==s.head?o.end.to:o.end.from;return J.cursor(l)});return r?(e(ii(t,i)),!0):!1}const _O=({state:t,dispatch:e})=>FO(t,e);function jr(t,e,n){let r=Ua(t.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=e&&(i=J.range(i.head,i.anchor));let s=n(i);return J.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(t.state.selection)?!1:(t.dispatch(ii(t.state,r)),!0)}function QS(t,e){return jr(t,e,n=>t.moveByChar(n,e))}const ZS=t=>QS(t,!An(t)),JS=t=>QS(t,An(t));function e7(t,e){return jr(t,e,n=>t.moveByGroup(n,e))}const HO=t=>e7(t,!An(t)),zO=t=>e7(t,An(t)),WO=t=>{let e=!An(t);return jr(t,e,n=>rm(t.state,n,e))},GO=t=>{let e=An(t);return jr(t,e,n=>rm(t.state,n,e))};function t7(t,e){return jr(t,e,n=>t.moveVertically(n,e))}const n7=t=>t7(t,!1),r7=t=>t7(t,!0);function i7(t,e){return jr(t,e,n=>t.moveVertically(n,e,XS(t).height))}const O3=t=>i7(t,!1),j3=t=>i7(t,!0),UO=t=>jr(t,!0,e=>uo(t,e,!0)),KO=t=>jr(t,!1,e=>uo(t,e,!1)),YO=t=>{let e=!An(t);return jr(t,e,n=>uo(t,n,e))},XO=t=>{let e=An(t);return jr(t,e,n=>uo(t,n,e))},qO=t=>jr(t,!1,e=>J.cursor(t.lineBlockAt(e.head).from)),QO=t=>jr(t,!0,e=>J.cursor(t.lineBlockAt(e.head).to)),V3=({state:t,dispatch:e})=>(e(ii(t,{anchor:0})),!0),F3=({state:t,dispatch:e})=>(e(ii(t,{anchor:t.doc.length})),!0),_3=({state:t,dispatch:e})=>(e(ii(t,{anchor:t.selection.main.anchor,head:0})),!0),H3=({state:t,dispatch:e})=>(e(ii(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),ZO=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),JO=({state:t,dispatch:e})=>{let n=im(t).map(({from:r,to:i})=>J.undirectionalRange(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:J.create(n),userEvent:"select"})),!0},ej=({state:t,dispatch:e})=>{let n=Ua(t.selection,r=>{let i=Dn(t),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&o.next)return J.undirectionalRange(l.from,l.to)}return r});return n.eq(t.selection)?!1:(e(ii(t,n)),!0)};function s7(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to<t.state.doc.length:o.from>0)for(let l=s;;){let a=t.moveVertically(l,e);if(a.head<o.from||a.head>o.to){i.some(u=>u.head==a.head)||i.push(a);break}else{if(a.head==l.head)break;l=a}}}return i.length==r.ranges.length?!1:(t.dispatch(ii(n,J.create(i,i.length-1))),!0)}const tj=t=>s7(t,!1),nj=t=>s7(t,!0),rj=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=J.create([n.main]):n.main.empty||(r=J.create([J.cursor(n.main.head)])),r?(e(ii(t,r)),!0):!1};function ad(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);a<o?(n="delete.backward",a=lf(t,a,!1)):a>o&&(n="delete.forward",a=lf(t,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=lf(t,o,!1),l=lf(t,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:J.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"?me.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function lf(t,e,n){if(t instanceof me)for(let r of t.state.facet(me.atomicRanges).map(i=>i(t)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=n?s:i)});return e}const o7=(t,e,n)=>ad(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),l,a;if(n&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,i-o.from))){if(l[l.length-1]==" ")return i-1;let u=Ga(l,s.tabSize),c=u%Uh(s)||Uh(s);for(let d=0;d<c&&l[l.length-1-d]==" ";d++)i--;a=i}else a=un(o.text,i-o.from,e,e)+o.from,a==i&&o.number!=(e?s.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(a-o.from,i-o.from))&&(a=un(o.text,a-o.from,!1,!1)+o.from);return a}),sy=t=>o7(t,!1,!0),l7=t=>o7(t,!0,!1),a7=(t,e)=>ad(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let l=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=un(s.text,r-s.from,e)+s.from,u=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),c=o(u);if(l!=null&&c!=l)break;(u!=" "||r!=n.head)&&(l=c),r=a}return r}),u7=t=>a7(t,!1),ij=t=>a7(t,!0),sj=t=>ad(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),oj=t=>ad(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),lj=t=>ad(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),aj=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Xe.of(["",""])},range:J.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},uj=({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:un(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:un(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:t.doc.slice(i,l).append(t.doc.slice(o,i))},range:J.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function im(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 c7(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of im(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),l=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let a of s.ranges)i.push(J.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let a of s.ranges)i.push(J.range(a.anchor-l,a.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:J.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const cj=({state:t,dispatch:e})=>c7(t,e,!1),dj=({state:t,dispatch:e})=>c7(t,e,!0);function d7(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of im(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const fj=({state:t,dispatch:e})=>d7(t,e,!1),hj=({state:t,dispatch:e})=>d7(t,e,!0),pj=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(im(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=Ua(e.selection,i=>{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),l=t.coordsAtPos(i.head,i.assoc||1);l&&(s=o.bottom+t.documentTop-l.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 mj(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Dn(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(Fe.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 z3=f7(!1),gj=f7(!0);function f7(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,l=e.doc.lineAt(s),a=!t&&s==o&&mj(e,s);t&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let u=new Jp(e,{simulateBreak:s,simulateDoubleBreak:!!a}),c=iv(u,s);for(c==null&&(c=Ga(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:s,to:o}=a:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let d=["",Tc(e,c)];return a&&d.push(Tc(e,u.lineIndent(l.from,-1))),{changes:{from:s,to:o,insert:Xe.of(d)},range:J.cursor(s+1+d[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function av(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let l=t.doc.lineAt(o);l.number>n&&(r.empty||r.to>l.from)&&(e(l,i,r),n=l.number),o=l.to+1}let s=t.changes(i);return{changes:i,range:J.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const yj=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Jp(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=av(t,(s,o,l)=>{let a=iv(r,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let u=/^\s*/.exec(s.text)[0],c=Tc(t,a);(u!=c||l.from<s.from+u.length)&&(n[s.from]=a,o.push({from:s.from,to:s.from+u.length,insert:c}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},h7=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(av(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Zp)})}),{userEvent:"input.indent"})),!0),p7=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(av(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=Ga(i,t.tabSize),o=0,l=Tc(t,Math.max(0,s-Uh(t)));for(;o<i.length&&o<l.length&&i.charCodeAt(o)==l.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+i.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),xj=t=>(t.setTabFocusMode(),!0),vj=[{key:"Ctrl-b",run:zS,shift:ZS,preventDefault:!0},{key:"Ctrl-f",run:WS,shift:JS},{key:"Ctrl-p",run:KS,shift:n7},{key:"Ctrl-n",run:YS,shift:r7},{key:"Ctrl-a",run:jO,shift:qO},{key:"Ctrl-e",run:VO,shift:QO},{key:"Ctrl-d",run:l7},{key:"Ctrl-h",run:sy},{key:"Ctrl-k",run:sj},{key:"Ctrl-Alt-h",run:u7},{key:"Ctrl-o",run:aj},{key:"Ctrl-t",run:uj},{key:"Ctrl-v",run:iy}],bj=[{key:"ArrowLeft",run:zS,shift:ZS,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:NO,shift:HO,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:BO,shift:YO,preventDefault:!0},{key:"ArrowRight",run:WS,shift:JS,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:AO,shift:zO,preventDefault:!0},{mac:"Cmd-ArrowRight",run:OO,shift:XO,preventDefault:!0},{key:"ArrowUp",run:KS,shift:n7,preventDefault:!0},{mac:"Cmd-ArrowUp",run:V3,shift:_3},{mac:"Ctrl-ArrowUp",run:B3,shift:O3},{key:"ArrowDown",run:YS,shift:r7,preventDefault:!0},{mac:"Cmd-ArrowDown",run:F3,shift:H3},{mac:"Ctrl-ArrowDown",run:iy,shift:j3},{key:"PageUp",run:B3,shift:O3},{key:"PageDown",run:iy,shift:j3},{key:"Home",run:RO,shift:KO,preventDefault:!0},{key:"Mod-Home",run:V3,shift:_3},{key:"End",run:IO,shift:UO,preventDefault:!0},{key:"Mod-End",run:F3,shift:H3},{key:"Enter",run:z3,shift:z3},{key:"Mod-a",run:ZO},{key:"Backspace",run:sy,shift:sy,preventDefault:!0},{key:"Delete",run:l7,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:u7,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:ij,preventDefault:!0},{mac:"Mod-Backspace",run:oj,preventDefault:!0},{mac:"Mod-Delete",run:lj,preventDefault:!0}].concat(vj.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),wj=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:PO,shift:WO},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:LO,shift:GO},{key:"Alt-ArrowUp",run:cj},{key:"Shift-Alt-ArrowUp",run:fj},{key:"Alt-ArrowDown",run:dj},{key:"Shift-Alt-ArrowDown",run:hj},{key:"Mod-Alt-ArrowUp",run:tj},{key:"Mod-Alt-ArrowDown",run:nj},{key:"Escape",run:rj},{key:"Mod-Enter",run:gj},{key:"Alt-l",mac:"Ctrl-l",run:JO},{key:"Mod-i",run:ej,preventDefault:!0},{key:"Mod-[",run:p7},{key:"Mod-]",run:h7},{key:"Mod-Alt-\\",run:yj},{key:"Shift-Mod-k",run:pj},{key:"Shift-Mod-\\",run:_O},{key:"Mod-/",run:cO},{key:"Alt-A",mac:"Ctrl-A",run:fO},{key:"Ctrl-m",mac:"Shift-Alt-m",run:xj}].concat(bj),Cj={key:"Tab",run:h7,shift:p7},W3=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Pa{constructor(e,n,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?l=>s(W3(l)):W3,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 Yn(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=Rx(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Ci(e);let i=this.normalize(n);if(i.length)for(let s=0,o=r,l=!0;;s++){let a=i.charCodeAt(s),u=this.match(a,o,l,this.bufferPos+this.bufferStart,s==i.length-1);if(u)return this.value=u,this;if(s==i.length-1)break;l&&s<n.length&&n.charCodeAt(s)==a?o++:l=!1}}}match(e,n,r,i,s){let o=null;for(let l=0;l<this.matches.length;){let a=this.matches[l],u=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?o={from:a.from,to:i,precise:s&&a.precise}:(a.index++,u=!0)),u?l++:this.matches.splice(l,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:n,to:i,precise:r&&s}:this.matches.push({from:n,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(Pa.prototype[Symbol.iterator]=function(){return this});const m7={from:-1,to:-1,match:/.*/.exec(""),precise:!0},uv="gm"+(/x/.unicode==null?"":"u");class g7{constructor(e,n,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=m7,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new y7(e,n,r,i,s);this.re=new RegExp(n,uv+(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=qh(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=qh(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,precise:!0,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 Pg=new WeakMap;class ua{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=Pg.get(e);if(!i||i.from>=r||i.to<=n){let l=new ua(n,e.sliceString(n,r));return Pg.set(e,l),l}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)),Pg.set(e,new ua(o,s)),new ua(n,s.slice(n-o,r-o))}}class y7{constructor(e,n,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=m7,this.matchPos=qh(e,i),this.re=new RegExp(n,uv+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=ua.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,precise:!0,match:n},this.matchPos=qh(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ua.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(g7.prototype[Symbol.iterator]=y7.prototype[Symbol.iterator]=function(){return this});function kj(t){try{return new RegExp(t,uv),!0}catch{return!1}}function qh(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}const Sj=t=>{let{state:e}=t,n=String(e.doc.lineAt(t.state.selection.main.head).number),{close:r,result:i}=HR(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:e.phrase("go")});return i.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){t.dispatch({effects:r});return}let l=e.doc.lineAt(e.selection.main.head),[,a,u,c,d]=o,f=c?+c.slice(1):0,h=u?+u:l.number;if(u&&d){let v=h/100;a&&(v=v*(a=="-"?-1:1)+l.number/e.doc.lines),h=Math.round(e.doc.lines*v)}else u&&a&&(h=h*(a=="-"?-1:1)+l.number);let m=e.doc.line(Math.max(1,Math.min(e.doc.lines,h))),x=J.cursor(m.from+Math.max(0,Math.min(f,m.length)));t.dispatch({effects:[r,me.scrollIntoView(x.from,{y:"center"})],selection:x})}),!0},Ej={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},$j=ve.define({combine(t){return Li(t,Ej,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Mj(t){return[Pj,Tj]}const Dj=Ae.mark({class:"cm-selectionMatch"}),Nj=Ae.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function G3(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Ct.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Ct.Word)}function Aj(t,e,n,r){return t(e.sliceDoc(n,n+1))==Ct.Word&&t(e.sliceDoc(r-1,r))==Ct.Word}const Tj=Vt.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($j),{state:n}=t,r=n.selection;if(r.ranges.length>1)return Ae.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return Ae.none;let a=n.wordAt(i.head);if(!a)return Ae.none;o=n.charCategorizer(i.head),s=n.sliceDoc(a.from,a.to)}else{let a=i.to-i.from;if(a<e.minSelectionLength||a>200)return Ae.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(G3(o,n,i.from,i.to)&&Aj(o,n,i.from,i.to)))return Ae.none}else if(s=n.sliceDoc(i.from,i.to),!s)return Ae.none}let l=[];for(let a of t.visibleRanges){let u=new Pa(n.doc,s,a.from,a.to);for(;!u.next().done;){let{from:c,to:d}=u.value;if((!o||G3(o,n,c,d))&&(i.empty&&c<=i.from&&d>=i.to?l.push(Nj.range(c,d)):(c>=i.to||d<=i.from)&&l.push(Dj.range(c,d)),l.length>e.maxMatches))return Ae.none}}return Ae.set(l)}},{decorations:t=>t.decorations}),Pj=me.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Lj=({state:t,dispatch:e})=>{let{selection:n}=t,r=J.create(n.ranges.map(i=>t.wordAt(i.head)||J.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Ij(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,l=new Pa(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Pa(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=t.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const Rj=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return Lj({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=Ij(t,r);return i?(e(t.update({selection:t.selection.addRange(J.range(i.from,i.to),!1),effects:me.scrollIntoView(i.to)})),!0):!1},Ka=ve.define({combine(t){return Li(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Xj(e),scrollToMatch:e=>me.scrollIntoView(e)})}});class x7{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||kj(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
148
|
+
`: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&&this.test==e.test}create(){return this.regexp?new _j(this):new jj(this)}getCursor(e,n=0,r){let i=e.doc?e:Ge.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?Tl(this,i,n,r):Al(this,i,n,r)}}class v7{constructor(e){this.spec=e}}function Bj(t,e,n){return(r,i,s,o)=>{if(n&&!n(r,i,s,o))return!1;let l=r>=o&&i<=o+s.length?s.slice(r-o,i-o):e.doc.sliceString(r,i);return t(l,e,r,i)}}function Al(t,e,n,r){let i;return t.wholeWord&&(i=Oj(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(i=Bj(t.test,e,i)),new Pa(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),i)}function Oj(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(Qh(i,n-s))!=Ct.Word||e(Zh(i,n-s))!=Ct.Word)&&(e(Zh(i,r-s))!=Ct.Word||e(Qh(i,r-s))!=Ct.Word))}class jj extends v7{constructor(e){super(e)}nextMatch(e,n,r){let i=Al(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,n+this.spec.unquoted.length);i=Al(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==n&&i.value.to==r?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let s=Math.max(n,i-1e4-this.spec.unquoted.length),o=Al(this.spec,e,s,i),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==n)return null;i-=1e4}}prevMatch(e,n,r){let i=this.prevMatchInRange(e,0,n);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=n||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=Al(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=Al(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 Vj(t,e,n){return(r,i,s)=>(!n||n(r,i,s))&&t(s[0],e,r,i)}function Tl(t,e,n,r){let i;return t.wholeWord&&(i=Fj(e.charCategorizer(e.selection.main.head))),t.test&&(i=Vj(t.test,e,i)),new g7(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:i},n,r)}function Qh(t,e){return t.slice(un(t,e,!1),e)}function Zh(t,e){return t.slice(e,un(t,e))}function Fj(t){return(e,n,r)=>!r[0].length||(t(Qh(r.input,r.index))!=Ct.Word||t(Zh(r.input,r.index))!=Ct.Word)&&(t(Zh(r.input,r.index+r[0].length))!=Ct.Word||t(Qh(r.input,r.index+r[0].length))!=Ct.Word)}class _j extends v7{nextMatch(e,n,r){let i=Tl(this.spec,e,r,e.doc.length).next();return i.done&&(i=Tl(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=Tl(this.spec,e,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==n||l.from>s+10))return l;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)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return n})}matchAll(e,n){let r=Tl(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=Tl(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 Pc=Be.define(),cv=Be.define(),zs=Nn.define({create(t){return new Lg(oy(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Pc)?t=new Lg(n.value.create(),t.panel):n.is(cv)&&(t=new Lg(t.query,n.value?dv:null));return t},provide:t=>Dc.from(t,e=>e.panel)});class Lg{constructor(e,n){this.query=e,this.panel=n}}const Hj=Ae.mark({class:"cm-searchMatch"}),zj=Ae.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Wj=Vt.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(zs))}update(t){let e=t.state.field(zs);(e!=t.startState.field(zs)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Ae.none;let{view:n}=this,r=new ss;for(let i=0,s=n.visibleRanges,o=s.length;i<o;i++){let{from:l,to:a}=s[i];for(;i<o-1&&a>s[i+1].from-2*250;)a=s[++i].to;t.highlight(n.state,l,a,(u,c)=>{let d=n.state.selection.ranges.some(f=>f.from==u&&f.to==c);r.add(u,c,d?zj:Hj)})}return r.finish()}},{decorations:t=>t.decorations});function ud(t){return e=>{let n=e.state.field(zs,!1);return n&&n.query.spec.valid?t(e,n):C7(e)}}const Jh=ud((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=J.single(r.from,r.to),s=t.state.facet(Ka);return t.dispatch({selection:i,effects:[fv(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),w7(t),!0}),ep=ud((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=J.single(i.from,i.to),o=t.state.facet(Ka);return t.dispatch({selection:s,effects:[fv(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),w7(t),!0}),Gj=ud((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:J.create(n.map(r=>J.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Uj=({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 l=new Pa(t.doc,t.sliceDoc(r,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(J.range(l.value.from,l.value.to))}return e(t.update({selection:J.create(s,o),userEvent:"select.search.matches"})),!0},U3=ud((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=s,l=[],a,u,c=[];o.precise?o.from==r&&o.to==i&&(u=n.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:u}),o=e.nextMatch(n,o.from,o.to),c.push(me.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):o=e.nextMatch(n,o.from,o.to);let d=t.state.changes(l);return o&&(a=J.single(o.from,o.to).map(d),c.push(fv(t,o)),c.push(n.facet(Ka).scrollToMatch(a.main,t))),t.dispatch({changes:d,selection:a,effects:c,userEvent:"input.replace"}),!0}),Kj=ud((t,{query:e})=>{if(t.state.readOnly)return!1;let n=[];for(let i of e.matchAll(t.state,1e9)){let{from:s,to:o,precise:l}=i;l&&n.push({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:me.announce.of(r),userEvent:"input.replace.all"}),!0});function dv(t){return t.state.facet(Ka).createPanel(t)}function oy(t,e){var n,r,i,s,o;let l=t.selection.main,a=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!a)return e;let u=t.facet(Ka);return new x7({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:u.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:u.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:u.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function b7(t){let e=Jx(t,dv);return e&&e.dom.querySelector("[main-field]")}function w7(t){let e=b7(t);e&&e==t.root.activeElement&&e.select()}const C7=t=>{let e=t.state.field(zs,!1);if(e&&e.panel){let n=b7(t);if(n&&n!=t.root.activeElement){let r=oy(t.state,e.query.spec);r.valid&&t.dispatch({effects:Pc.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[cv.of(!0),e?Pc.of(oy(t.state,e.query.spec)):Be.appendConfig.of(Qj)]});return!0},k7=t=>{let e=t.state.field(zs,!1);if(!e||!e.panel)return!1;let n=Jx(t,dv);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:cv.of(!1)}),!0},Yj=[{key:"Mod-f",run:C7,scope:"editor search-panel"},{key:"F3",run:Jh,shift:ep,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Jh,shift:ep,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:k7,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Uj},{key:"Mod-Alt-g",run:Sj},{key:"Mod-d",run:Rj,preventDefault:!0}];class Xj{constructor(e){this.view=e;let n=this.query=e.state.field(zs).query.spec;this.commit=this.commit.bind(this),this.searchField=ot("input",{value:n.search,placeholder:cr(e,"Find"),"aria-label":cr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ot("input",{value:n.replace,placeholder:cr(e,"Replace"),"aria-label":cr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ot("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=ot("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=ot("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return ot("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=ot("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>Jh(e),[cr(e,"next")]),r("prev",()=>ep(e),[cr(e,"previous")]),r("select",()=>Gj(e),[cr(e,"all")]),ot("label",null,[this.caseField,cr(e,"match case")]),ot("label",null,[this.reField,cr(e,"regexp")]),ot("label",null,[this.wordField,cr(e,"by word")]),...e.state.readOnly?[]:[ot("br"),this.replaceField,r("replace",()=>U3(e),[cr(e,"replace")]),r("replaceAll",()=>Kj(e),[cr(e,"replace all")])],ot("button",{name:"close",onclick:()=>k7(e),"aria-label":cr(e,"close"),type:"button"},["×"])])}commit(){let e=new x7({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:Pc.of(e)}))}keydown(e){qI(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ep:Jh)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),U3(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Pc)&&!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(Ka).top}}function cr(t,e){return t.state.phrase(e)}const af=30,uf=/[\s\.,:;?!]/;function fv(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-af),o=Math.min(i,n+af),l=t.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;a<af;a++)if(!uf.test(l[a+1])&&uf.test(l[a])){l=l.slice(a);break}}if(o!=i){for(let a=l.length-1;a>l.length-af;a--)if(!uf.test(l[a-1])&&uf.test(l[a])){l=l.slice(0,a);break}}return me.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${r.number}.`)}const qj=me.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"}}),Qj=[zs,dl.low(Wj),qj];class S7{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Dn(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(E7(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,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function K3(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 Zj(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=K3(e)+K3(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function Jj(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Zj(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}class Y3{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function zo(t){return t.selection.main.from}function E7(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 $7=Pi.define();function eV(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return{...t.changeByRange(l=>{if(l!=i&&n!=r&&t.sliceDoc(l.from+s,l.from+o)!=t.sliceDoc(n,r))return{range:l};let a=t.toText(e);return{changes:{from:l.from+s,to:r==i.from?l.to:l.from+o,insert:a},range:J.cursor(l.from+s+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const X3=new WeakMap;function tV(t){if(!Array.isArray(t))return t;let e=X3.get(t);return e||X3.set(t,e=Jj(t)),e}const tp=Be.define(),Lc=Be.define();class nV{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=Yn(e,n),i=Ci(r);this.chars.push(r);let s=e.slice(n,n+i),o=s.toUpperCase();this.folded.push(Yn(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=Yn(e,0),b=Ci(y),C=b==e.length?0:-100;if(y!=n[0])if(y==r[0])C+=-200;else return null;return this.ret(C,[0,b])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=n.length,u=0;if(l<0){for(let y=0,b=Math.min(e.length,200);y<b&&u<a;){let C=Yn(e,y);(C==n[u]||C==r[u])&&(i[u++]=y),y+=Ci(C)}if(u<a)return null}let c=0,d=0,f=!1,h=0,m=-1,x=-1,v=/[a-z]/.test(e),p=!0;for(let y=0,b=Math.min(e.length,200),C=0;y<b&&d<a;){let S=Yn(e,y);l<0&&(c<a&&S==n[c]&&(s[c++]=y),h<a&&(S==n[h]||S==r[h]?(h==0&&(m=y),x=y+1,h++):h=0));let k,E=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(k=Rx(S))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!y||E==1&&v||C==0&&E!=0)&&(n[d]==S||r[d]==S&&(f=!0)?o[d++]=y:o.length&&(p=!1)),C=E,y+=Ci(S)}return d==a&&o[0]==0&&p?this.result(-100+(f?-200:0),o,e):h==a&&m==0?this.ret(-200-e.length+(x==e.length?0:-100),[0,x]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):h==a?this.ret(-900-e.length,[m,x]):d==a?this.result(-100+(f?-200:0)+-700+(p?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 l=o+(this.astral?Ci(Yn(r,o)):1);s&&i[s-1]==o?i[s-1]=l:(i[s++]=o,i[s++]=l)}return this.ret(e-r.length,i)}}class rV{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 an=ve.define({combine(t){return Li(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:iV,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||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=>q3(e(r),n(r)),optionClass:(e,n)=>r=>q3(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function q3(t,e){return t?e?t+" "+e:t:e}function iV(t,e,n,r,i,s){let o=t.textDirection==at.RTL,l=o,a=!1,u="top",c,d,f=e.left-i.left,h=i.right-e.right,m=r.right-r.left,x=r.bottom-r.top;if(l&&f<Math.min(m,h)?l=!1:!l&&h<Math.min(m,f)&&(l=!0),m<=(l?f:h))c=Math.max(i.top,Math.min(n.top,i.bottom-x))-e.top,d=Math.min(400,l?f:h);else{a=!0,d=Math.min(400,(o?e.right:i.right-e.left)-30);let y=i.bottom-e.bottom;y>=x||y>e.top?c=n.bottom-e.top:(u="bottom",c=e.bottom-n.top)}let v=(e.bottom-e.top)/s.offsetHeight,p=(e.right-e.left)/s.offsetWidth;return{style:`${u}: ${c/v}px; max-width: ${d/p}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}const hv=Be.define();function sV(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 l=n.displayLabel||n.label,a=0;for(let u=0;u<s.length;){let c=s[u++],d=s[u++];c>a&&o.appendChild(document.createTextNode(l.slice(a,c)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(l.slice(c,d))),f.className="cm-completionMatchedText",a=d}return a<l.length&&o.appendChild(document.createTextNode(l.slice(a))),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 Ig(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.ceil((t-e)/n);return{from:t-r*n,to:t-(r-1)*n}}class oV{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:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:s,selected:o}=i.open,l=e.state.facet(an);this.optionContent=sV(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Ig(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:u}=e.state.field(n).open;for(let c=a.target,d;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(d=/-(\d+)$/.exec(c.id))&&+d[1]<u.length){this.applyCompletion(e,u[+d[1]]),a.preventDefault();return}if(a.target==this.list){let c=this.list.classList.contains("cm-completionListIncompleteTop")&&a.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&a.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:hv.of(c)}),a.preventDefault())}}),this.dom.addEventListener("focusout",a=>{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet(an).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Lc.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:l}=r.open;(!i.open||i.open.options!=s)&&(this.range=Ig(s.length,o,e.state.facet(an).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}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;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=Ig(n.options.length,n.selected,this.view.state.facet(an).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:s}=i;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(i);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,i)}).catch(l=>Jn(this.view.state,l,"completion info")):(this.addInfoPane(o,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),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"),r.removeAttribute("aria-describedby"));return n&&aV(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.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(an).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")),i.addEventListener("mousedown",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:l,match:a}=e[o],{section:u}=l;if(u){let f=typeof u=="string"?u:u.name;if(f!=s&&(o>r.from||r.from==0))if(s=f,typeof u!="string"&&u.header)i.appendChild(u.header(u));else{let h=i.appendChild(document.createElement("completion-section"));h.textContent=f}}const c=i.appendChild(document.createElement("li"));c.id=n+"-"+o,c.setAttribute("role","option");let d=this.optionClass(l);d&&(c.className=d);for(let f of this.optionContent){let h=f(l,this.view.state,this.view,a);h&&c.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 lV(t,e){return n=>new oV(n,t,e)}function aV(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 Q3(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function uV(t,e){let n=[],r=null,i=null,s=c=>{n.push(c);let{section:d}=c.completion;if(d){r||(r=[]);let f=typeof d=="string"?d:d.name;r.some(h=>h.name==f)||r.push(typeof d=="string"?{name:f}:d)}},o=e.facet(an);for(let c of t)if(c.hasResult()){let d=c.result.getMatch;if(c.result.filter===!1)for(let f of c.result.options)s(new Y3(f,c.source,d?d(f):[],1e9-n.length));else{let f=e.sliceDoc(c.from,c.to),h,m=o.filterStrict?new rV(f):new nV(f);for(let x of c.result.options)if(h=m.match(x.label)){let v=x.displayLabel?d?d(x,h.matched):[]:h.matched,p=h.score+(x.boost||0);if(s(new Y3(x,c.source,v,p)),typeof x.section=="object"&&x.section.rank==="dynamic"){let{name:y}=x.section;i||(i=Object.create(null)),i[y]=Math.max(p,i[y]||-1e9)}}}}if(r){let c=Object.create(null),d=0,f=(h,m)=>(h.rank==="dynamic"&&m.rank==="dynamic"?i[m.name]-i[h.name]:0)||(typeof h.rank=="number"?h.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(h.name<m.name?-1:1);for(let h of r.sort(f))d-=1e5,c[h.name]=d;for(let h of n){let{section:m}=h.completion;m&&(h.score+=c[typeof m=="string"?m:m.name])}}let l=[],a=null,u=o.compareCompletions;for(let c of n.sort((d,f)=>f.score-d.score||u(d.completion,f.completion))){let d=c.completion;!a||a.label!=d.label||a.detail!=d.detail||a.type!=null&&d.type!=null&&a.type!=d.type||a.apply!=d.apply||a.boost!=d.boost?l.push(c):Q3(c.completion)>Q3(a)&&(l[l.length-1]=c),a=c.completion}return l}class Yl{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 Yl(this.options,Z3(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s,o){if(i&&!o&&e.some(u=>u.isPending))return i.setDisabled();let l=uV(e,n);if(!l.length)return i&&e.some(u=>u.isPending)?i.setDisabled():null;let a=n.facet(an).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let u=i.options[i.selected].completion;for(let c=0;c<l.length;c++)if(l[c].completion==u){a=c;break}}return new Yl(l,Z3(r,a),{pos:e.reduce((u,c)=>c.hasResult()?Math.min(u,c.from):u,1e8),create:mV,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new Yl(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Yl(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class np{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new np(hV,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(an),s=(r.override||n.languageDataAt("autocomplete",zo(n)).map(tV)).map(a=>(this.active.find(c=>c.source==a)||new Pr(a,this.active.some(c=>c.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((a,u)=>a==this.active[u])&&(s=this.active);let o=this.open,l=e.effects.some(a=>a.is(pv));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!cV(s,this.active)||l?o=Yl.build(s,n,this.id,o,r,l):o&&o.disabled&&!s.some(a=>a.isPending)&&(o=null),!o&&s.every(a=>!a.isPending)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new Pr(a.source,0):a));for(let a of e.effects)a.is(hv)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new np(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?dV:fV}}function cV(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 dV={"aria-autocomplete":"list"},fV={};function Z3(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const hV=[];function M7(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation($7);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 Pr{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=M7(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new Pr(i.source,0)),r&4&&i.state==0&&(i=new Pr(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(tp))i=new Pr(i.source,1,s.value);else if(s.is(Lc))i=new Pr(i.source,0);else if(s.is(pv))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 this}touches(e){return e.changes.touchesRange(zo(e.state))}}class ca extends Pr{constructor(e,n,r,i,s,o){super(e,3,n),this.limit=r,this.result=i,this.from=s,this.to=o}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),l=zo(e.state);if(l>o||!i||n&2&&(zo(e.startState)==this.from||l<this.limit))return new Pr(this.source,n&4?1:0);let a=e.changes.mapPos(this.limit);return pV(i.validFor,e.state,s,o)?new ca(this.source,this.explicit,a,i,s,o):i.update&&(i=i.update(i,s,o,new S7(e.state,l,!1)))?new ca(this.source,this.explicit,a,i,i.from,(r=i.to)!==null&&r!==void 0?r:zo(e.state)):new Pr(this.source,1,this.explicit)}map(e){if(e.empty)return this;let n=this.result.map?this.result.map(this.result,e):this.result;return n?new ca(this.source,this.explicit,e.mapPos(this.limit),n,e.mapPos(this.from),e.mapPos(this.to,1)):new Pr(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function pV(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):E7(t,!0).test(i)}const pv=Be.define({map(t,e){return t.map(n=>n.map(e))}}),Xn=Nn.define({create(){return np.start()},update(t,e){return t.update(e)},provide:t=>[Zx.from(t,e=>e.tooltip),me.contentAttributes.from(t,e=>e.attrs)]});function mv(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Xn).active.find(i=>i.source==e.source);return r instanceof ca?(typeof n=="string"?t.dispatch({...eV(t.state,n,r.from,r.to),annotations:$7.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const mV=lV(Xn,mv);function cf(t,e="option"){return n=>{let r=n.state.field(Xn,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(an).interactionDelay)return!1;let i=1,s;e=="page"&&(s=oS(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,l=r.open.selected>-1?r.open.selected+i*(t?1:-1):t?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),n.dispatch({effects:hv.of(l)}),!0}}const gV=t=>{let e=t.state.field(Xn,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(an).interactionDelay?!1:mv(t,e.open.options[e.open.selected])},Rg=t=>t.state.field(Xn,!1)?(t.dispatch({effects:tp.of(!0)}),!0):!1,yV=t=>{let e=t.state.field(Xn,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Lc.of(null)}),!0)};class xV{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const vV=50,bV=1e3,wV=Vt.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(Xn).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Xn),n=t.state.facet(an);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Xn)==e)return;let r=t.transactions.some(s=>{let o=M7(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.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>vV&&Date.now()-o.time>bV){for(let l of o.context.abortListeners)try{l()}catch(a){Jn(this.view.state,a)}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(tp)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!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(Xn);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(an).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=zo(e),r=new S7(e,n,t.explicit,this.view),i=new xV(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:Lc.of(null)}),Jn(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(an).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(an),r=this.view.state.field(Xn);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let l=zo(s.updates.length?s.updates[0].startState:this.view.state),a=Math.min(l,s.done.from+(s.active.explicit?0:1)),u=new ca(s.active.source,s.active.explicit,a,s.done,s.done.from,(t=s.done.to)!==null&&t!==void 0?t:l);for(let c of s.updates)u=u.update(c,n);if(u.hasResult()){e.push(u);continue}}let o=r.active.find(l=>l.source==s.active.source);if(o&&o.isPending)if(s.done==null){let l=new Pr(s.active.source,0);for(let a of s.updates)l=l.update(a,n);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:pv.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Xn,!1);if(e&&e.tooltip&&this.view.state.facet(an).closeOnBlur){let n=e.open&&oS(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Lc.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:tp.of(!1)}),20),this.composing=0}}}),CV=typeof navigator=="object"&&/Win/.test(navigator.platform),kV=dl.highest(me.domEventHandlers({keydown(t,e){let n=e.state.field(Xn,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(CV&&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&&mv(e,r),!1}})),SV=me.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",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".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"}}}),Ic={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ro=Be.define({map(t,e){let n=e.mapPos(t,-1,Bn.TrackAfter);return n??void 0}}),gv=new class extends Zs{};gv.startSide=1;gv.endSide=-1;const D7=Nn.define({create(){return _e.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(Ro)&&(t=t.update({add:[gv.range(n.value,n.value+1)]}));return t}});function EV(){return[MV,D7]}const Bg="()[]{}<>«»»«[]{}";function N7(t){for(let e=0;e<Bg.length;e+=2)if(Bg.charCodeAt(e)==t)return Bg.charAt(e+1);return Rx(t<128?t:t+1)}function A7(t,e){return t.languageDataAt("closeBrackets",e)[0]||Ic}const $V=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),MV=me.inputHandler.of((t,e,n,r)=>{if(($V?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&Ci(Yn(r,0))==1||e!=i.from||n!=i.to)return!1;let s=AV(t.state,r);return s?(t.dispatch(s),!0):!1}),DV=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=A7(t,t.selection.main.head).brackets||Ic.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let l=TV(t.doc,o.head);for(let a of r)if(a==l&&sm(t.doc,o.head)==N7(Yn(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:J.cursor(o.head-a.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},NV=[{key:"Backspace",run:DV}];function AV(t,e){let n=A7(t,t.selection.main.head),r=n.brackets||Ic.brackets;for(let i of r){let s=N7(Yn(i,0));if(e==i)return s==i?IV(t,i,r.indexOf(i+i+i)>-1,n):PV(t,i,s,n.before||Ic.before);if(e==s&&T7(t,t.selection.main.from))return LV(t,i,s)}return null}function T7(t,e){let n=!1;return t.field(D7).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function sm(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Ci(Yn(n,0)))}function TV(t,e){let n=t.sliceString(e-2,e);return Ci(Yn(n,0))==n.length?n:n.slice(1)}function PV(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:Ro.of(o.to+e.length),range:J.range(o.anchor+e.length,o.head+e.length)};let l=sm(t.doc,o.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:o.head},effects:Ro.of(o.head+e.length),range:J.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function LV(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&sm(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:J.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function IV(t,e,n,r){let i=r.stringPrefixes||Ic.stringPrefixes,s=null,o=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Ro.of(l.to+e.length),range:J.range(l.anchor+e.length,l.head+e.length)};let a=l.head,u=sm(t.doc,a),c;if(u==e){if(J3(t,a))return{changes:{insert:e+e,from:a},effects:Ro.of(a+e.length),range:J.cursor(a+e.length)};if(T7(t,a)){let f=n&&t.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+f.length,insert:f},range:J.cursor(a+f.length)}}}else{if(n&&t.sliceDoc(a-2*e.length,a)==e+e&&(c=ew(t,a-2*e.length,i))>-1&&J3(t,c))return{changes:{insert:e+e+e+e,from:a},effects:Ro.of(a+e.length),range:J.cursor(a+e.length)};if(t.charCategorizer(a)(u)!=Ct.Word&&ew(t,a,i)>-1&&!RV(t,a,e,i))return{changes:{insert:e+e,from:a},effects:Ro.of(a+e.length),range:J.cursor(a+e.length)}}return{range:s=l}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function J3(t,e){let n=Dn(t).resolveInner(e+1);return n.parent&&n.from==e}function RV(t,e,n,r){let i=Dn(t).resolveInner(e,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),a=l.indexOf(n);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let c=i.firstChild;for(;c&&c.from==i.from&&c.to-c.from>n.length+a;){if(t.sliceDoc(c.to-n.length,c.to)==n)return!1;c=c.firstChild}return!0}let u=i.to==e&&i.parent;if(!u)break;i=u}return!1}function ew(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Ct.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))!=Ct.Word)return s}return-1}function BV(t={}){return[kV,Xn,an.of(t),wV,OV,SV]}const P7=[{key:"Ctrl-Space",run:Rg},{mac:"Alt-`",run:Rg},{mac:"Alt-i",run:Rg},{key:"Escape",run:yV},{key:"ArrowDown",run:cf(!0)},{key:"ArrowUp",run:cf(!1)},{key:"PageDown",run:cf(!0,"page")},{key:"PageUp",run:cf(!1,"page")},{key:"Enter",run:gV}],OV=dl.highest(qp.computeN([an],t=>t.facet(an).defaultKeymap?[P7]:[]));class tw{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class No{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(Rc).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((h,m)=>h.from-m.from||h.to-m.to),o=new ss,l=[],a=0,u=r.doc.iter(),c=0,d=r.doc.length;for(let h=0;;){let m=h==s.length?null:s[h];if(!m&&!l.length)break;let x,v;if(l.length)x=a,v=l.reduce((b,C)=>Math.min(b,C.to),m&&m.from>x?m.from:1e8);else{if(x=m.from,x>d)break;v=m.to,l.push(m),h++}for(;h<s.length;){let b=s[h];if(b.from==x&&(b.to>b.from||b.to==x))l.push(b),h++,v=Math.min(b.to,v);else{v=Math.min(b.from,v);break}}v=Math.min(v,d);let p=!1;if(l.some(b=>b.from==x&&(b.to==v||v==d))&&(p=x==v,!p&&v-x<10)){let b=x-(c+u.value.length);b>0&&(u.next(b),c=x);for(let C=x;;){if(C>=v){p=!0;break}if(!u.lineBreak&&c+u.value.length>C)break;C=c+u.value.length,c+=u.value.length,u.next()}}let y=qV(l);if(p)o.add(x,x,Ae.widget({widget:new UV(y),diagnostics:l.slice()}));else{let b=l.reduce((C,S)=>S.markClass?C+" "+S.markClass:C,"");o.add(x,v,Ae.mark({class:"cm-lintRange cm-lintRange-"+y+b,diagnostics:l.slice(),inclusiveEnd:l.some(C=>C.to>v)}))}if(a=v,a==d)break;for(let b=0;b<l.length;b++)l[b].to<=a&&l.splice(b--,1)}let f=o.finish();return new No(f,n,io(f))}}function io(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new tw(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new tw(r.from,s,r.diagnostic)}}),r}function jV(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(Rc).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(L7))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function VV(t,e){return t.field(xr,!1)?e:e.concat(Be.appendConfig.of(QV))}const L7=Be.define(),yv=Be.define(),I7=Be.define(),xr=Nn.define({create(){return new No(Ae.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=io(n,t.selected.diagnostic,s)||io(n,null,s)}!n.size&&i&&e.state.facet(Rc).autoPanel&&(i=null),t=new No(n,i,r)}for(let n of e.effects)if(n.is(L7)){let r=e.state.facet(Rc).autoPanel?n.value.length?Bc.open:null:t.panel;t=No.init(n.value,r,e.state)}else n.is(yv)?t=new No(t.diagnostics,n.value?Bc.open:null,t.selected):n.is(I7)&&(t=new No(t.diagnostics,t.panel,n.value));return t},provide:t=>[Dc.from(t,e=>e.panel),me.decorations.from(t,e=>e.diagnostics)]}),FV=Ae.mark({class:"cm-lintRange cm-lintRange-active"});function _V(t,e,n){let{diagnostics:r}=t.state.field(xr),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(a,u,{spec:c})=>{if(e>=a&&e<=u&&(a==u||(e>a||n>0)&&(e<u||n<0)))return i=c.diagnostics,s=a,o=u,!1});let l=t.state.facet(Rc).tooltipFilter;return i&&l&&(i=l(i,t.state)),i?{pos:s,end:o,above:!0,create(){return{dom:HV(t,i)}}}:null}function HV(t,e){return ot("ul",{class:"cm-tooltip-lint"},e.map(n=>B7(t,n,!1)))}const zV=t=>{let e=t.state.field(xr,!1);(!e||!e.panel)&&t.dispatch({effects:VV(t.state,[yv.of(!0)])});let n=Jx(t,Bc.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},nw=t=>{let e=t.state.field(xr,!1);return!e||!e.panel?!1:(t.dispatch({effects:yv.of(!1)}),!0)},WV=t=>{let e=t.state.field(xr,!1);if(!e)return!1;let n=t.state.selection.main,r=io(e.diagnostics,null,n.to+1);return!r&&(r=io(e.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),FR(t,r.from,1,{tooltip:O7,until:i=>i.docChanged||i.newSelection.main.head<r.from||i.newSelection.main.head>r.to}),!0)},GV=[{key:"Mod-Shift-m",run:zV,preventDefault:!0},{key:"F8",run:WV}],Rc=ve.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Li(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:rw,tooltipFilter:rw,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,s)=>e(r,i,s)||n(r,i,s):e:n,autoPanel:(e,n)=>e||n})}}});function rw(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function R7(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 B7(t,e,n){var r;let i=n?R7(e.actions):[];return ot("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ot("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 l=!1,a=h=>{if(h.preventDefault(),l)return;l=!0;let m=io(t.state.field(xr).diagnostics,e);m&&s.apply(t,m.from,m.to)},{name:u}=s,c=i[o]?u.indexOf(i[o]):-1,d=c<0?u:[u.slice(0,c),ot("u",u.slice(c,c+1)),u.slice(c+1)],f=s.markClass?" "+s.markClass:"";return ot("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:a,onmousedown:a,"aria-label":` Action: ${u}${c<0?"":` (access key "${i[o]})"`}.`},d)}),e.source&&ot("div",{class:"cm-diagnosticSource"},e.source))}class UV extends Ii{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return ot("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class iw{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=B7(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Bc{constructor(e){this.view=e,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)nw(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=R7(s.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==i.keyCode){let a=io(this.view.state.field(xr).diagnostics,s);a&&s.actions[l].apply(e,a.from,a.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=ot("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=ot("div",{class:"cm-panel-lint"},this.list,ot("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>nw(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(xr).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(xr),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(l,a,{spec:u})=>{for(let c of u.diagnostics){if(o.has(c))continue;o.add(c);let d=-1,f;for(let h=r;h<this.items.length;h++)if(this.items[h].diagnostic==c){d=h;break}d<0?(f=new iw(this.view,c),this.items.splice(r,0,f),i=!0):(f=this.items[d],d>r&&(this.items.splice(r,d-r),i=!0)),n&&f.diagnostic==n.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),s=f):f.dom.hasAttribute("aria-selected")&&f.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 iw(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:l,panel:a})=>{let u=a.height/this.list.offsetHeight;l.top<a.top?this.list.scrollTop-=(a.top-l.top)/u:l.bottom>a.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/u)}})):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(xr),r=io(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:I7.of(r)})}static open(e){return new Bc(e)}}function KV(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 df(t){return KV(`<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 YV=me.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:df("#f11")},".cm-lintRange-warning":{backgroundImage:df("orange")},".cm-lintRange-info":{backgroundImage:df("#999")},".cm-lintRange-hint":{backgroundImage:df("#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}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function XV(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function qV(t){let e="hint",n=1;for(let r of t){let i=XV(r.severity);i>n&&(n=i,e=r.severity)}return e}const O7=VR(_V,{hideOn:jV}),QV=[xr,me.decorations.compute([xr],t=>{let{selected:e,panel:n}=t.field(xr);return!e||!n||e.from==e.to?Ae.none:Ae.set([FV.range(e.from,e.to)])}),O7,YV];var sw=function(e){e===void 0&&(e={});var n=e,r=n.crosshairCursor,i=r===void 0?!1:r,s=[];e.closeBracketsKeymap!==!1&&(s=s.concat(NV)),e.defaultKeymap!==!1&&(s=s.concat(wj)),e.searchKeymap!==!1&&(s=s.concat(Yj)),e.historyKeymap!==!1&&(s=s.concat(DO)),e.foldKeymap!==!1&&(s=s.concat(HB)),e.completionKeymap!==!1&&(s=s.concat(P7)),e.lintKeymap!==!1&&(s=s.concat(GV));var o=[];return e.lineNumbers!==!1&&o.push(JR()),e.highlightActiveLineGutter!==!1&&o.push(nB()),e.highlightSpecialChars!==!1&&o.push(pR()),e.history!==!1&&o.push(vO()),e.foldGutter!==!1&&o.push(UB()),e.drawSelection!==!1&&o.push(nR()),e.dropCursor!==!1&&o.push(aR()),e.allowMultipleSelections!==!1&&o.push(Ge.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&o.push(PB()),e.syntaxHighlighting!==!1&&o.push(PS(qB,{fallback:!0})),e.bracketMatching!==!1&&o.push(rO()),e.closeBrackets!==!1&&o.push(EV()),e.autocompletion!==!1&&o.push(BV()),e.rectangularSelection!==!1&&o.push(DR()),i!==!1&&o.push(TR()),e.highlightActiveLine!==!1&&o.push(bR()),e.highlightSelectionMatches!==!1&&o.push(Mj()),e.tabSize&&typeof e.tabSize=="number"&&o.push(Zp.of(" ".repeat(e.tabSize))),o.concat([qp.of(s.flat())]).filter(Boolean)};const ZV="#e5c07b",ow="#e06c75",JV="#56b6c2",eF="#ffffff",Qf="#abb2bf",ly="#7d8799",tF="#61afef",nF="#98c379",lw="#d19a66",rF="#c678dd",iF="#21252b",aw="#2c313a",uw="#282c34",Og="#353a42",sF="#3E4451",cw="#528bff",oF=me.theme({"&":{color:Qf,backgroundColor:uw},".cm-content":{caretColor:cw},".cm-cursor, .cm-dropCursor":{borderLeftColor:cw},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:sF},".cm-panels":{backgroundColor:iF,color:Qf},".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:uw,color:ly,border:"none"},".cm-activeLineGutter":{backgroundColor:aw},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Og},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Og,borderBottomColor:Og},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:aw,color:Qf}}},{dark:!0}),lF=ld.define([{tag:q.keyword,color:rF},{tag:[q.name,q.deleted,q.character,q.propertyName,q.macroName],color:ow},{tag:[q.function(q.variableName),q.labelName],color:tF},{tag:[q.color,q.constant(q.name),q.standard(q.name)],color:lw},{tag:[q.definition(q.name),q.separator],color:Qf},{tag:[q.typeName,q.className,q.number,q.changed,q.annotation,q.modifier,q.self,q.namespace],color:ZV},{tag:[q.operator,q.operatorKeyword,q.url,q.escape,q.regexp,q.link,q.special(q.string)],color:JV},{tag:[q.meta,q.comment],color:ly},{tag:q.strong,fontWeight:"bold"},{tag:q.emphasis,fontStyle:"italic"},{tag:q.strikethrough,textDecoration:"line-through"},{tag:q.link,color:ly,textDecoration:"underline"},{tag:q.heading,fontWeight:"bold",color:ow},{tag:[q.atom,q.bool,q.special(q.variableName)],color:lw},{tag:[q.processingInstruction,q.string,q.inserted],color:nF},{tag:q.invalid,color:eF}]),aF=[oF,PS(lF)];var uF=me.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),cF=function(e){e===void 0&&(e={});var n=e,r=n.indentWithTab,i=r===void 0?!0:r,s=n.editable,o=s===void 0?!0:s,l=n.readOnly,a=l===void 0?!1:l,u=n.theme,c=u===void 0?"light":u,d=n.placeholder,f=d===void 0?"":d,h=n.basicSetup,m=h===void 0?!0:h,x=[];switch(i&&x.unshift(qp.of([Cj])),m&&(typeof m=="boolean"?x.unshift(sw()):x.unshift(sw(m))),f&&x.unshift(SR(f)),c){case"light":x.push(uF);break;case"dark":x.push(aF);break;case"none":break;default:x.push(c);break}return o===!1&&x.push(me.editable.of(!1)),a&&x.push(Ge.readOnly.of(!0)),[...x]},dF=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class fF{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class dw{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var jg=null,hF=()=>typeof window>"u"?new dw:(jg||(jg=new dw),jg),pF=me.theme({"& .cm-scroller":{height:"100% !important"}}),fw=null,Vg=null;function mF(t,e,n,r,i,s){if(!t&&!e&&!n&&!r&&!i&&!s)return null;var o=JSON.stringify({height:t,minHeight:e,maxHeight:n,width:r,minWidth:i,maxWidth:s});return o===fw||(fw=o,Vg=me.theme({"&":{height:t,minHeight:e,maxHeight:n,width:r,minWidth:i,maxWidth:s}})),Vg}var hw=Pi.define(),gF=200,yF=[];function xF(t){var e=t.value,n=t.selection,r=t.onChange,i=t.onStatistics,s=t.onCreateEditor,o=t.onUpdate,l=t.extensions,a=l===void 0?yF:l,u=t.autoFocus,c=t.theme,d=c===void 0?"light":c,f=t.height,h=f===void 0?null:f,m=t.minHeight,x=m===void 0?null:m,v=t.maxHeight,p=v===void 0?null:v,y=t.width,b=y===void 0?null:y,C=t.minWidth,S=C===void 0?null:C,k=t.maxWidth,E=k===void 0?null:k,$=t.placeholder,D=$===void 0?"":$,L=t.editable,A=L===void 0?!0:L,T=t.readOnly,V=T===void 0?!1:T,M=t.indentWithTab,B=M===void 0?!0:M,N=t.basicSetup,O=N===void 0?!0:N,I=t.root,P=t.initialState,F=w.useState(),z=F[0],j=F[1],R=w.useState(),H=R[0],G=R[1],U=w.useState(),se=U[0],ne=U[1],le=w.useState(()=>({current:null}))[0],Ee=w.useState(()=>({current:null}))[0],xe=mF(h,x,p,b,S,E),W=me.updateListener.of(we=>{if(we.docChanged&&typeof r=="function"&&!we.transactions.some(We=>We.annotation(hw))){le.current?le.current.reset():(le.current=new fF(()=>{if(Ee.current){var We=Ee.current;Ee.current=null,We()}le.current=null},gF),hF().add(le.current));var $e=we.state.doc,Ve=$e.toString();r(Ve,we)}i&&i(dF(we))}),oe=cF({theme:d,editable:A,readOnly:V,placeholder:D,indentWithTab:B,basicSetup:O}),ae=[W,...xe?[xe]:[],pF,...oe];return o&&typeof o=="function"&&ae.push(me.updateListener.of(o)),ae=ae.concat(a),w.useLayoutEffect(()=>{if(z&&!se){var we={doc:e,selection:n,extensions:ae},$e=P?Ge.fromJSON(P.json,we,P.fields):Ge.create(we);if(ne($e),!H){var Ve=new me({state:$e,parent:z,root:I});G(Ve),s&&s(Ve,$e)}}return()=>{H&&(ne(void 0),G(void 0))}},[z,se]),w.useEffect(()=>{t.container&&j(t.container)},[t.container]),w.useEffect(()=>()=>{H&&(H.destroy(),G(void 0)),le.current&&(le.current.cancel(),le.current=null)},[H]),w.useEffect(()=>{u&&H&&H.focus()},[u,H]),w.useEffect(()=>{H&&H.dispatch({effects:Be.reconfigure.of(ae)})},[d,a,h,x,p,b,S,E,D,A,V,B,O,r,o]),w.useEffect(()=>{if(e!==void 0){var we=H?H.state.doc.toString():"";if(H&&e!==we){var $e=le.current&&!le.current.isDone,Ve=()=>{H&&e!==H.state.doc.toString()&&H.dispatch({changes:{from:0,to:H.state.doc.toString().length,insert:e||""},annotations:[hw.of(!0)]})};$e?Ee.current=Ve:Ve()}}},[e,H]),{state:se,setState:ne,view:H,setView:G,container:z,setContainer:j}}var vF=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],j7=w.forwardRef((t,e)=>{var n=t.className,r=t.value,i=r===void 0?"":r,s=t.selection,o=t.extensions,l=o===void 0?[]:o,a=t.onChange,u=t.onStatistics,c=t.onCreateEditor,d=t.onUpdate,f=t.autoFocus,h=t.theme,m=h===void 0?"light":h,x=t.height,v=t.minHeight,p=t.maxHeight,y=t.width,b=t.minWidth,C=t.maxWidth,S=t.basicSetup,k=t.placeholder,E=t.indentWithTab,$=t.editable,D=t.readOnly,L=t.root,A=t.initialState,T=zP(t,vF),V=w.useRef(null),M=xF({root:L,value:i,autoFocus:f,theme:m,height:x,minHeight:v,maxHeight:p,width:y,minWidth:b,maxWidth:C,basicSetup:S,placeholder:k,indentWithTab:E,editable:$,readOnly:D,selection:s,onChange:a,onStatistics:u,onCreateEditor:c,onUpdate:d,extensions:l,initialState:A}),B=M.state,N=M.view,O=M.container,I=M.setContainer;w.useImperativeHandle(e,()=>({editor:V.current,state:B,view:N}),[V,O,B,N]);var P=w.useCallback(z=>{V.current=z,I(z)},[I]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var F=typeof m=="string"?"cm-theme-"+m:"cm-theme";return g.jsx("div",p1({ref:P,className:""+F+(n?" "+n:"")},T))});j7.displayName="CodeMirror";var pw={};class rp{constructor(e,n,r,i,s,o,l,a,u,c=0,d){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=u,this.lookAhead=c,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 rp(e,[],n,r,r,0,[],0,i?new mw(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&&this.setLookAhead(this.pos),l=s.dynamicPrecedence(i);if(l&&(this.score+=l),r==0){i<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),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 a=this.stack.length-(r-1)*3-(e&262144?6:0),u=a?this.stack[a-2]:this.p.ranges[0].from;i<s.minRepeatTerm&&u==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-u;c>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=u,this.p.lastBigReductionSize=c));let d=a?this.stack[a-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,u,h,f+4,!0)}if(e&262144)this.state=this.stack[a];else{let h=this.stack[a-3];this.state=s.getGoto(h,i,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(i,u)}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.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(n==r)return;if(this.buffer[o-2]>=n){this.buffer[o-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||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>r;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)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;this.pos=i;let l=o.stateFlag(s,1);!l&&(i>r||n<=o.maxNode)&&(this.reducePos=i),this.pushState(s,l?r:Math.min(r,this.reducePos)),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&&e.buffer[n-4]==0&&(n-=4);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 rp(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 bF(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((l,a)=>a&1&&l==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 l=(o>>19)-s;if(l>1){let a=o&65535,u=this.stack.length-l*3;if(u>=0&&e.getGoto(this.stack[u],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};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 mw(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class mw{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class bF{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 ip{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 ip(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 ip(this.stack,this.pos,this.index)}}function ff(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++),l=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class Zf{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const gw=new Zf;class wF{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=gw,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,l=this.range;for(;l.to<=r;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.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=gw,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 da{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;CF(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}da.prototype.contextual=da.prototype.fallback=da.prototype.extend=!1;da.prototype.fallback=da.prototype.extend=!1;function CF(t,e,n,r,i,s){let o=0,l=1<<r,{dialect:a}=n.p.parser;e:for(;l&t[o];){let u=t[o+1];for(let h=o+3;h<u;h+=2)if((t[h+1]&l)>0){let m=t[h];if(a.allows(m)&&(e.token.value==-1||e.token.value==m||kF(m,e.token.value,i,s))){e.acceptToken(m);break}}let c=e.next,d=0,f=t[o+2];if(e.next<0&&f>d&&t[u+f*3-3]==65535){o=t[u+f*3-1];continue e}for(;d<f;){let h=d+f>>1,m=u+h+(h<<1),x=t[m],v=t[m+1]||65536;if(c<x)f=h;else if(c>=v)d=h+1;else{o=t[m+2],e.advance();continue e}}break}}function yw(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function kF(t,e,n,r){let i=yw(n,r,e);return i<0||yw(n,r,t)<i}const dr=typeof process<"u"&&pw&&/\bparse\b/.test(pw.LOG);let Fg=null;function xw(t,e,n){let r=t.cursor(Bt.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 SF{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?xw(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?xw(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 Ut){if(o==e){if(o<this.safeFrom)return null;let l=o+s.length;if(l<=this.safeTo){let a=s.prop(Fe.lookAhead);if(!a||l+a<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 EF{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Zf)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let u=0;u<s.length;u++){if(!(1<<u&o))continue;let c=s[u],d=this.tokens[u];if(!(r&&!c.fallback)&&((c.contextual||d.start!=e.pos||d.mask!=o||d.context!=l)&&(this.updateCachedToken(d,c,e),d.mask=o,d.context=l),d.lookAhead>d.end+25&&(a=Math.max(d.lookAhead,a)),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),!c.extend&&(r=d,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return a&&e.setLookAhead(a),!r&&e.pos==this.stream.end&&(r=new Zf,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 Zf,{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 l=s.specializers[o](this.stream.read(e.start,e.end),r);if(l>=0&&r.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>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:l}=o;for(let a=0;a<2;a++)for(let u=o.stateSlot(s,a?2:1);;u+=3){if(l[u]==65535)if(l[u+1]==1)u=Gi(l,u+2);else{i==0&&l[u+1]==2&&(i=this.putAction(Gi(l,u+2),n,r,i));break}l[u]==n&&(i=this.putAction(Gi(l,u+1),n,r,i))}return i}}class $F{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 wF(n,i),this.tokens=new EF(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[rp.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new SF(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 l=e[o];for(;;){if(this.tokens.mainToken=null,l.pos>n)r.push(l);else{if(this.advanceStack(l,r,e))continue;{i||(i=[],s=[]),i.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=i&&DF(i);if(o)return dr&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw dr&&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 dr&&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((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let l=r[o];for(let a=o+1;a<r.length;a++){let u=r[a];if(l.sameState(u)||l.buffer.length>500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,l)=>l.score-o.score),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=dr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,c=u?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&&(!u||(d.prop(Fe.contextHash)||0)==c))return e.useNode(d,f),dr&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(d.type.id)})`),!0;if(!(d instanceof Ut)||d.children.length==0||d.positions[0]>0)break;let h=d.children[0];if(h instanceof Ut&&d.positions[0]==0)d=h;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),dr&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let u=0;u<a.length;){let c=a[u++],d=a[u++],f=a[u++],h=u==a.length||!r,m=h?e:e.split(),x=this.tokens.mainToken;if(m.apply(c,d,x?x.start:m.pos,f),dr&&console.log(o+this.stackID(m)+` (via ${c&65536?`reduce of ${s.getName(c&65535)}`:"shift"} for ${s.getName(d)} @ ${i}${m==e?"":", split"})`),h)return!0;m.pos>i?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return vw(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let l=e[o],a=n[o<<1],u=n[(o<<1)+1],c=dr?this.stackID(l)+" -> ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),dr&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let d=l.split(),f=c;for(let h=0;h<10&&d.forceReduce()&&(dr&&console.log(f+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,r));h++)dr&&(f=this.stackID(d)+" -> ");for(let h of l.recoverByInsert(a))dr&&console.log(c+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,r);this.stream.end>l.pos?(u==l.pos&&(u++,a=0),l.recoverByDelete(a,u),dr&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),vw(l,r)):(!i||i.score<d.score)&&(i=d)}return i}stackToTree(e){return e.close(),Ut.build({buffer:ip.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=(Fg||(Fg=new WeakMap)).get(e);return n||Fg.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function vw(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 MF{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class sp extends gS{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 l=0;l<e.repeatNodeCount;l++)n.push("");let r=Object.keys(e.topRules).map(l=>e.topRules[l][1]),i=[];for(let l=0;l<n.length;l++)i.push([]);function s(l,a,u){i[l].push([a,a.deserialize(String(u))])}if(e.nodeProps)for(let l of e.nodeProps){let a=l[0];typeof a=="string"&&(a=Fe[a]);for(let u=1;u<l.length;){let c=l[u++];if(c>=0)s(c,a,l[u++]);else{let d=l[u+-c];for(let f=-c;f>0;f--)s(l[u++],a,d);u++}}}this.nodeSet=new ev(n.map((l,a)=>lr.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:i[a],top:r.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=fS;let o=ff(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(bw),this.states=ff(e.states,Uint32Array),this.data=ff(e.stateData),this.goto=ff(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new da(o,l):l),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 $F(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++],l=o&1,a=i[s++];if(l&&r)return a;for(let u=s+(o>>1);s<u;s++)if(i[s]==e)return a;if(l)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=Gi(r,s+2)];else{if(r[s+1]==2)return Gi(r,s+2);break}if(o==n||o==0)return Gi(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=Gi(this.data,s+2);else break;i=n(Gi(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=Gi(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(sp.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(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=bw(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]],l;(l=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[l]=1;return new MF(e,r,i)}static deserialize(e){return new sp(e)}}function Gi(t,e){return t[e]|t[e+1]<<16}function DF(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 bw(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const NF=yS({String:q.string,Number:q.number,"True False":q.bool,PropertyName:q.propertyName,Null:q.null,", :":q.separator,"[ ]":q.squareBracket,"{ }":q.brace}),AF=sp.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[NF],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),TF=Wh.define({name:"json",parser:AF.configure({props:[wS.add({Object:N3({except:/^\s*\}/}),Array:N3({except:/^\s*\]/})}),kS.add({"Object Array":IB})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function PF(){return new CB(TF)}const Qu=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function LF(t,e){const n={},r=new Map;return t.forEach(i=>{const s={$id:i.id,$modes:i.modes.map(o=>o.name)};n[i.name]=s,r.set(i.id,s)}),e.forEach(i=>{const s=r.get(i.collectionId);if(!s)return;const o=i.name.split("/");let l=s;for(let c=0;c<o.length-1;c++){const d=o[c];Qu(l[d])||(l[d]={}),l=l[d]}const a=o[o.length-1],u=Qu(l[a])?l[a]:{};l[a]={...u,$id:i.id,$type:i.resolvedType,$value:i.value}}),n}function IF(t,e){return JSON.stringify(LF(t,e),null,2)}function RF(t,e){if(!Qu(t))return null;if(Array.isArray(t.collections)&&Array.isArray(t.variables))return t;const n=new Map(e.map(s=>[s.name,s])),r=[],i=[];for(const[s,o]of Object.entries(t)){if(!Qu(o))continue;const l=typeof o.$id=="string"?o.$id:void 0,a=l&&e.find(c=>c.id===l)||n.get(s);if(!a)continue;r.push(a);const u=(c,d)=>{c.$value!==void 0&&d.length>0&&i.push({id:typeof c.$id=="string"?c.$id:"",collectionId:a.id,name:d.join("/"),type:typeof c.$type=="string"?c.$type:"STRING",value:String(c.$value)});for(const[f,h]of Object.entries(c))f.startsWith("$")||Qu(h)&&u(h,[...d,f])};u(o,[])}return{collections:r,variables:i}}const BF=me.theme({"&":{backgroundColor:"transparent",height:"100%",fontSize:"12px"},".cm-gutters":{backgroundColor:"transparent",border:"none"},".cm-activeLine":{backgroundColor:"transparent"},".cm-activeLineGutter":{backgroundColor:"transparent"}});function OF(){const{collections:t,variables:e}=Zt(),[n,r]=w.useState(""),[i,s]=w.useState(!1),[o,l]=w.useState(!1),a=w.useRef(null);w.useEffect(()=>{r(IF(t,e)),s(!1),l(!1)},[t,e]);const u=w.useCallback(d=>{r(d),l(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{try{const f=JSON.parse(d),h=RF(f,t);if(!h){s(!0);return}Se({type:"update-from-json",data:h}),s(!1)}catch{s(!0)}},600)},[t]);w.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]);const c=w.useCallback(()=>{try{r(JSON.stringify(JSON.parse(n),null,2)),s(!1),l(!1)}catch{s(!0)}},[n]);return g.jsxs("div",{className:"relative w-full h-full",children:[g.jsx("div",{className:"absolute top-3 right-3 z-10",children:g.jsx(Ye,{variant:o?"primary":void 0,onClick:c,children:"Format"})}),g.jsx("div",{className:`w-full h-full overflow-auto ${i?"ring-1 ring-danger ring-inset":""}`,children:g.jsx(j7,{value:n,onChange:u,extensions:[PF(),BF],basicSetup:{foldGutter:!0,lineNumbers:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1,highlightSelectionMatches:!1,autocompletion:!1},height:"100%",style:{height:"100%"}})})]})}function Jt(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=Jt(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var jF={value:()=>{}};function om(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Jf(n)}function Jf(t){this._=t}function VF(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Jf.prototype=om.prototype={constructor:Jf,on:function(t,e){var n=this._,r=VF(t+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(t=r[s]).type)&&(i=FF(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(i=(t=r[s]).type)n[i]=ww(n[i],t.name,e);else if(e==null)for(i in n)n[i]=ww(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Jf(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,i=s.length;r<i;++r)s[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,s=r.length;i<s;++i)r[i].value.apply(e,n)}};function FF(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function ww(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=jF,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var ay="http://www.w3.org/1999/xhtml";const Cw={svg:"http://www.w3.org/2000/svg",xhtml:ay,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function lm(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Cw.hasOwnProperty(e)?{space:Cw[e],local:t}:t}function _F(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===ay&&e.documentElement.namespaceURI===ay?e.createElement(t):e.createElementNS(n,t)}}function HF(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function V7(t){var e=lm(t);return(e.local?HF:_F)(e)}function zF(){}function xv(t){return t==null?zF:function(){return this.querySelector(t)}}function WF(t){typeof t!="function"&&(t=xv(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,l=r[i]=new Array(o),a,u,c=0;c<o;++c)(a=s[c])&&(u=t.call(a,a.__data__,c,s))&&("__data__"in a&&(u.__data__=a.__data__),l[c]=u);return new wr(r,this._parents)}function GF(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function UF(){return[]}function F7(t){return t==null?UF:function(){return this.querySelectorAll(t)}}function KF(t){return function(){return GF(t.apply(this,arguments))}}function YF(t){typeof t=="function"?t=KF(t):t=F7(t);for(var e=this._groups,n=e.length,r=[],i=[],s=0;s<n;++s)for(var o=e[s],l=o.length,a,u=0;u<l;++u)(a=o[u])&&(r.push(t.call(a,a.__data__,u,o)),i.push(a));return new wr(r,i)}function _7(t){return function(){return this.matches(t)}}function H7(t){return function(e){return e.matches(t)}}var XF=Array.prototype.find;function qF(t){return function(){return XF.call(this.children,t)}}function QF(){return this.firstElementChild}function ZF(t){return this.select(t==null?QF:qF(typeof t=="function"?t:H7(t)))}var JF=Array.prototype.filter;function e_(){return Array.from(this.children)}function t_(t){return function(){return JF.call(this.children,t)}}function n_(t){return this.selectAll(t==null?e_:t_(typeof t=="function"?t:H7(t)))}function r_(t){typeof t!="function"&&(t=_7(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,l=r[i]=[],a,u=0;u<o;++u)(a=s[u])&&t.call(a,a.__data__,u,s)&&l.push(a);return new wr(r,this._parents)}function z7(t){return new Array(t.length)}function i_(){return new wr(this._enter||this._groups.map(z7),this._parents)}function op(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}op.prototype={constructor:op,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function s_(t){return function(){return t}}function o_(t,e,n,r,i,s){for(var o=0,l,a=e.length,u=s.length;o<u;++o)(l=e[o])?(l.__data__=s[o],r[o]=l):n[o]=new op(t,s[o]);for(;o<a;++o)(l=e[o])&&(i[o]=l)}function l_(t,e,n,r,i,s,o){var l,a,u=new Map,c=e.length,d=s.length,f=new Array(c),h;for(l=0;l<c;++l)(a=e[l])&&(f[l]=h=o.call(a,a.__data__,l,e)+"",u.has(h)?i[l]=a:u.set(h,a));for(l=0;l<d;++l)h=o.call(t,s[l],l,s)+"",(a=u.get(h))?(r[l]=a,a.__data__=s[l],u.delete(h)):n[l]=new op(t,s[l]);for(l=0;l<c;++l)(a=e[l])&&u.get(f[l])===a&&(i[l]=a)}function a_(t){return t.__data__}function u_(t,e){if(!arguments.length)return Array.from(this,a_);var n=e?l_:o_,r=this._parents,i=this._groups;typeof t!="function"&&(t=s_(t));for(var s=i.length,o=new Array(s),l=new Array(s),a=new Array(s),u=0;u<s;++u){var c=r[u],d=i[u],f=d.length,h=c_(t.call(c,c&&c.__data__,u,r)),m=h.length,x=l[u]=new Array(m),v=o[u]=new Array(m),p=a[u]=new Array(f);n(c,d,x,v,p,h,e);for(var y=0,b=0,C,S;y<m;++y)if(C=x[y]){for(y>=b&&(b=y+1);!(S=v[b])&&++b<m;);C._next=S||null}}return o=new wr(o,r),o._enter=l,o._exit=a,o}function c_(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function d_(){return new wr(this._exit||this._groups.map(z7),this._parents)}function f_(t,e,n){var r=this.enter(),i=this,s=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function h_(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,s=r.length,o=Math.min(i,s),l=new Array(i),a=0;a<o;++a)for(var u=n[a],c=r[a],d=u.length,f=l[a]=new Array(d),h,m=0;m<d;++m)(h=u[m]||c[m])&&(f[m]=h);for(;a<i;++a)l[a]=n[a];return new wr(l,this._parents)}function p_(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,s=r[i],o;--i>=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function m_(t){t||(t=g_);function e(d,f){return d&&f?t(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var o=n[s],l=o.length,a=i[s]=new Array(l),u,c=0;c<l;++c)(u=o[c])&&(a[c]=u);a.sort(e)}return new wr(i,this._parents).order()}function g_(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function y_(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function x_(){return Array.from(this)}function v_(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,s=r.length;i<s;++i){var o=r[i];if(o)return o}return null}function b_(){let t=0;for(const e of this)++t;return t}function w_(){return!this.node()}function C_(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],s=0,o=i.length,l;s<o;++s)(l=i[s])&&t.call(l,l.__data__,s,i);return this}function k_(t){return function(){this.removeAttribute(t)}}function S_(t){return function(){this.removeAttributeNS(t.space,t.local)}}function E_(t,e){return function(){this.setAttribute(t,e)}}function $_(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function M_(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function D_(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function N_(t,e){var n=lm(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?S_:k_:typeof e=="function"?n.local?D_:M_:n.local?$_:E_)(n,e))}function W7(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function A_(t){return function(){this.style.removeProperty(t)}}function T_(t,e,n){return function(){this.style.setProperty(t,e,n)}}function P_(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function L_(t,e,n){return arguments.length>1?this.each((e==null?A_:typeof e=="function"?P_:T_)(t,e,n??"")):La(this.node(),t)}function La(t,e){return t.style.getPropertyValue(e)||W7(t).getComputedStyle(t,null).getPropertyValue(e)}function I_(t){return function(){delete this[t]}}function R_(t,e){return function(){this[t]=e}}function B_(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function O_(t,e){return arguments.length>1?this.each((e==null?I_:typeof e=="function"?B_:R_)(t,e)):this.node()[t]}function G7(t){return t.trim().split(/^|\s+/)}function vv(t){return t.classList||new U7(t)}function U7(t){this._node=t,this._names=G7(t.getAttribute("class")||"")}U7.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function K7(t,e){for(var n=vv(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Y7(t,e){for(var n=vv(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function j_(t){return function(){K7(this,t)}}function V_(t){return function(){Y7(this,t)}}function F_(t,e){return function(){(e.apply(this,arguments)?K7:Y7)(this,t)}}function __(t,e){var n=G7(t+"");if(arguments.length<2){for(var r=vv(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?F_:e?j_:V_)(n,e))}function H_(){this.textContent=""}function z_(t){return function(){this.textContent=t}}function W_(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function G_(t){return arguments.length?this.each(t==null?H_:(typeof t=="function"?W_:z_)(t)):this.node().textContent}function U_(){this.innerHTML=""}function K_(t){return function(){this.innerHTML=t}}function Y_(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function X_(t){return arguments.length?this.each(t==null?U_:(typeof t=="function"?Y_:K_)(t)):this.node().innerHTML}function q_(){this.nextSibling&&this.parentNode.appendChild(this)}function Q_(){return this.each(q_)}function Z_(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function J_(){return this.each(Z_)}function eH(t){var e=typeof t=="function"?t:V7(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function tH(){return null}function nH(t,e){var n=typeof t=="function"?t:V7(t),r=e==null?tH:typeof e=="function"?e:xv(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function rH(){var t=this.parentNode;t&&t.removeChild(this)}function iH(){return this.each(rH)}function sH(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function oH(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function lH(t){return this.select(t?oH:sH)}function aH(t){return arguments.length?this.property("__data__",t):this.node().__data__}function uH(t){return function(e){t.call(this,e,this.__data__)}}function cH(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function dH(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,s;n<i;++n)s=e[n],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++r]=s;++r?e.length=r:delete this.__on}}}function fH(t,e,n){return function(){var r=this.__on,i,s=uH(e);if(r){for(var o=0,l=r.length;o<l;++o)if((i=r[o]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=e;return}}this.addEventListener(t.type,s,n),i={type:t.type,name:t.name,value:e,listener:s,options:n},r?r.push(i):this.__on=[i]}}function hH(t,e,n){var r=cH(t+""),i,s=r.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var a=0,u=l.length,c;a<u;++a)for(i=0,c=l[a];i<s;++i)if((o=r[i]).type===c.type&&o.name===c.name)return c.value}return}for(l=e?fH:dH,i=0;i<s;++i)this.each(l(r[i],e,n));return this}function X7(t,e,n){var r=W7(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function pH(t,e){return function(){return X7(this,t,e)}}function mH(t,e){return function(){return X7(this,t,e.apply(this,arguments))}}function gH(t,e){return this.each((typeof e=="function"?mH:pH)(t,e))}function*yH(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,s=r.length,o;i<s;++i)(o=r[i])&&(yield o)}var q7=[null];function wr(t,e){this._groups=t,this._parents=e}function cd(){return new wr([[document.documentElement]],q7)}function xH(){return this}wr.prototype=cd.prototype={constructor:wr,select:WF,selectAll:YF,selectChild:ZF,selectChildren:n_,filter:r_,data:u_,enter:i_,exit:d_,join:f_,merge:h_,selection:xH,order:p_,sort:m_,call:y_,nodes:x_,node:v_,size:b_,empty:w_,each:C_,attr:N_,style:L_,property:O_,classed:__,text:G_,html:X_,raise:Q_,lower:J_,append:eH,insert:nH,remove:iH,clone:lH,datum:aH,on:hH,dispatch:gH,[Symbol.iterator]:yH};function gr(t){return typeof t=="string"?new wr([[document.querySelector(t)]],[document.documentElement]):new wr([[t]],q7)}function vH(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Wr(t,e){if(t=vH(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}const bH={passive:!1},Oc={capture:!0,passive:!1};function _g(t){t.stopImmediatePropagation()}function fa(t){t.preventDefault(),t.stopImmediatePropagation()}function Q7(t){var e=t.document.documentElement,n=gr(t).on("dragstart.drag",fa,Oc);"onselectstart"in e?n.on("selectstart.drag",fa,Oc):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Z7(t,e){var n=t.document.documentElement,r=gr(t).on("dragstart.drag",null);e&&(r.on("click.drag",fa,Oc),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const hf=t=>()=>t;function uy(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:s,x:o,y:l,dx:a,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}uy.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function wH(t){return!t.ctrlKey&&!t.button}function CH(){return this.parentNode}function kH(t,e){return e??{x:t.x,y:t.y}}function SH(){return navigator.maxTouchPoints||"ontouchstart"in this}function J7(){var t=wH,e=CH,n=kH,r=SH,i={},s=om("start","drag","end"),o=0,l,a,u,c,d=0;function f(C){C.on("mousedown.drag",h).filter(r).on("touchstart.drag",v).on("touchmove.drag",p,bH).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(C,S){if(!(c||!t.call(this,C,S))){var k=b(this,e.call(this,C,S),C,S,"mouse");k&&(gr(C.view).on("mousemove.drag",m,Oc).on("mouseup.drag",x,Oc),Q7(C.view),_g(C),u=!1,l=C.clientX,a=C.clientY,k("start",C))}}function m(C){if(fa(C),!u){var S=C.clientX-l,k=C.clientY-a;u=S*S+k*k>d}i.mouse("drag",C)}function x(C){gr(C.view).on("mousemove.drag mouseup.drag",null),Z7(C.view,u),fa(C),i.mouse("end",C)}function v(C,S){if(t.call(this,C,S)){var k=C.changedTouches,E=e.call(this,C,S),$=k.length,D,L;for(D=0;D<$;++D)(L=b(this,E,C,S,k[D].identifier,k[D]))&&(_g(C),L("start",C,k[D]))}}function p(C){var S=C.changedTouches,k=S.length,E,$;for(E=0;E<k;++E)($=i[S[E].identifier])&&(fa(C),$("drag",C,S[E]))}function y(C){var S=C.changedTouches,k=S.length,E,$;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),E=0;E<k;++E)($=i[S[E].identifier])&&(_g(C),$("end",C,S[E]))}function b(C,S,k,E,$,D){var L=s.copy(),A=Wr(D||k,S),T,V,M;if((M=n.call(C,new uy("beforestart",{sourceEvent:k,target:f,identifier:$,active:o,x:A[0],y:A[1],dx:0,dy:0,dispatch:L}),E))!=null)return T=M.x-A[0]||0,V=M.y-A[1]||0,function B(N,O,I){var P=A,F;switch(N){case"start":i[$]=B,F=o++;break;case"end":delete i[$],--o;case"drag":A=Wr(I||O,S),F=o;break}L.call(N,C,new uy(N,{sourceEvent:O,subject:M,target:f,identifier:$,active:F,x:A[0]+T,y:A[1]+V,dx:A[0]-P[0],dy:A[1]-P[1],dispatch:L}),E)}}return f.filter=function(C){return arguments.length?(t=typeof C=="function"?C:hf(!!C),f):t},f.container=function(C){return arguments.length?(e=typeof C=="function"?C:hf(C),f):e},f.subject=function(C){return arguments.length?(n=typeof C=="function"?C:hf(C),f):n},f.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:hf(!!C),f):r},f.on=function(){var C=s.on.apply(s,arguments);return C===s?f:C},f.clickDistance=function(C){return arguments.length?(d=(C=+C)*C,f):Math.sqrt(d)},f}function bv(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function e9(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function dd(){}var jc=.7,lp=1/jc,ha="\\s*([+-]?\\d+)\\s*",Vc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ai="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",EH=/^#([0-9a-f]{3,8})$/,$H=new RegExp(`^rgb\\(${ha},${ha},${ha}\\)$`),MH=new RegExp(`^rgb\\(${Ai},${Ai},${Ai}\\)$`),DH=new RegExp(`^rgba\\(${ha},${ha},${ha},${Vc}\\)$`),NH=new RegExp(`^rgba\\(${Ai},${Ai},${Ai},${Vc}\\)$`),AH=new RegExp(`^hsl\\(${Vc},${Ai},${Ai}\\)$`),TH=new RegExp(`^hsla\\(${Vc},${Ai},${Ai},${Vc}\\)$`),kw={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};bv(dd,rl,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Sw,formatHex:Sw,formatHex8:PH,formatHsl:LH,formatRgb:Ew,toString:Ew});function Sw(){return this.rgb().formatHex()}function PH(){return this.rgb().formatHex8()}function LH(){return t9(this).formatHsl()}function Ew(){return this.rgb().formatRgb()}function rl(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=EH.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?$w(e):n===3?new tr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?pf(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?pf(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=$H.exec(t))?new tr(e[1],e[2],e[3],1):(e=MH.exec(t))?new tr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=DH.exec(t))?pf(e[1],e[2],e[3],e[4]):(e=NH.exec(t))?pf(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=AH.exec(t))?Nw(e[1],e[2]/100,e[3]/100,1):(e=TH.exec(t))?Nw(e[1],e[2]/100,e[3]/100,e[4]):kw.hasOwnProperty(t)?$w(kw[t]):t==="transparent"?new tr(NaN,NaN,NaN,0):null}function $w(t){return new tr(t>>16&255,t>>8&255,t&255,1)}function pf(t,e,n,r){return r<=0&&(t=e=n=NaN),new tr(t,e,n,r)}function IH(t){return t instanceof dd||(t=rl(t)),t?(t=t.rgb(),new tr(t.r,t.g,t.b,t.opacity)):new tr}function cy(t,e,n,r){return arguments.length===1?IH(t):new tr(t,e,n,r??1)}function tr(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}bv(tr,cy,e9(dd,{brighter(t){return t=t==null?lp:Math.pow(lp,t),new tr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?jc:Math.pow(jc,t),new tr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new tr(Wo(this.r),Wo(this.g),Wo(this.b),ap(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Mw,formatHex:Mw,formatHex8:RH,formatRgb:Dw,toString:Dw}));function Mw(){return`#${Bo(this.r)}${Bo(this.g)}${Bo(this.b)}`}function RH(){return`#${Bo(this.r)}${Bo(this.g)}${Bo(this.b)}${Bo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Dw(){const t=ap(this.opacity);return`${t===1?"rgb(":"rgba("}${Wo(this.r)}, ${Wo(this.g)}, ${Wo(this.b)}${t===1?")":`, ${t})`}`}function ap(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Wo(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Bo(t){return t=Wo(t),(t<16?"0":"")+t.toString(16)}function Nw(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Kr(t,e,n,r)}function t9(t){if(t instanceof Kr)return new Kr(t.h,t.s,t.l,t.opacity);if(t instanceof dd||(t=rl(t)),!t)return new Kr;if(t instanceof Kr)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,l=s-i,a=(s+i)/2;return l?(e===s?o=(n-r)/l+(n<r)*6:n===s?o=(r-e)/l+2:o=(e-n)/l+4,l/=a<.5?s+i:2-s-i,o*=60):l=a>0&&a<1?0:o,new Kr(o,l,a,t.opacity)}function BH(t,e,n,r){return arguments.length===1?t9(t):new Kr(t,e,n,r??1)}function Kr(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}bv(Kr,BH,e9(dd,{brighter(t){return t=t==null?lp:Math.pow(lp,t),new Kr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?jc:Math.pow(jc,t),new Kr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new tr(Hg(t>=240?t-240:t+120,i,r),Hg(t,i,r),Hg(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Kr(Aw(this.h),mf(this.s),mf(this.l),ap(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=ap(this.opacity);return`${t===1?"hsl(":"hsla("}${Aw(this.h)}, ${mf(this.s)*100}%, ${mf(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Aw(t){return t=(t||0)%360,t<0?t+360:t}function mf(t){return Math.max(0,Math.min(1,t||0))}function Hg(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const wv=t=>()=>t;function OH(t,e){return function(n){return t+n*e}}function jH(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function VH(t){return(t=+t)==1?n9:function(e,n){return n-e?jH(e,n,t):wv(isNaN(e)?n:e)}}function n9(t,e){var n=e-t;return n?OH(t,n):wv(isNaN(t)?e:t)}const up=function t(e){var n=VH(e);function r(i,s){var o=n((i=cy(i)).r,(s=cy(s)).r),l=n(i.g,s.g),a=n(i.b,s.b),u=n9(i.opacity,s.opacity);return function(c){return i.r=o(c),i.g=l(c),i.b=a(c),i.opacity=u(c),i+""}}return r.gamma=t,r}(1);function FH(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;i<n;++i)r[i]=t[i]*(1-s)+e[i]*s;return r}}function _H(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function HH(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),s=new Array(n),o;for(o=0;o<r;++o)i[o]=Zu(t[o],e[o]);for(;o<n;++o)s[o]=e[o];return function(l){for(o=0;o<r;++o)s[o]=i[o](l);return s}}function zH(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function vi(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function WH(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=Zu(t[i],e[i]):r[i]=e[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var dy=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zg=new RegExp(dy.source,"g");function GH(t){return function(){return t}}function UH(t){return function(e){return t(e)+""}}function r9(t,e){var n=dy.lastIndex=zg.lastIndex=0,r,i,s,o=-1,l=[],a=[];for(t=t+"",e=e+"";(r=dy.exec(t))&&(i=zg.exec(e));)(s=i.index)>n&&(s=e.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,a.push({i:o,x:vi(r,i)})),n=zg.lastIndex;return n<e.length&&(s=e.slice(n),l[o]?l[o]+=s:l[++o]=s),l.length<2?a[0]?UH(a[0].x):GH(e):(e=a.length,function(u){for(var c=0,d;c<e;++c)l[(d=a[c]).i]=d.x(u);return l.join("")})}function Zu(t,e){var n=typeof e,r;return e==null||n==="boolean"?wv(e):(n==="number"?vi:n==="string"?(r=rl(e))?(e=r,up):r9:e instanceof rl?up:e instanceof Date?zH:_H(e)?FH:Array.isArray(e)?HH:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?WH:vi)(t,e)}var Tw=180/Math.PI,fy={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function i9(t,e,n,r,i,s){var o,l,a;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(a=t*n+e*r)&&(n-=t*a,r-=e*a),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,a/=l),t*r<e*n&&(t=-t,e=-e,a=-a,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*Tw,skewX:Math.atan(a)*Tw,scaleX:o,scaleY:l}}var gf;function KH(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?fy:i9(e.a,e.b,e.c,e.d,e.e,e.f)}function YH(t){return t==null||(gf||(gf=document.createElementNS("http://www.w3.org/2000/svg","g")),gf.setAttribute("transform",t),!(t=gf.transform.baseVal.consolidate()))?fy:(t=t.matrix,i9(t.a,t.b,t.c,t.d,t.e,t.f))}function s9(t,e,n,r){function i(u){return u.length?u.pop()+" ":""}function s(u,c,d,f,h,m){if(u!==d||c!==f){var x=h.push("translate(",null,e,null,n);m.push({i:x-4,x:vi(u,d)},{i:x-2,x:vi(c,f)})}else(d||f)&&h.push("translate("+d+e+f+n)}function o(u,c,d,f){u!==c?(u-c>180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:vi(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function l(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:vi(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function a(u,c,d,f,h,m){if(u!==d||c!==f){var x=h.push(i(h)+"scale(",null,",",null,")");m.push({i:x-4,x:vi(u,d)},{i:x-2,x:vi(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=t(u),c=t(c),s(u.translateX,u.translateY,c.translateX,c.translateY,d,f),o(u.rotate,c.rotate,d,f),l(u.skewX,c.skewX,d,f),a(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var m=-1,x=f.length,v;++m<x;)d[(v=f[m]).i]=v.x(h);return d.join("")}}}var XH=s9(KH,"px, ","px)","deg)"),qH=s9(YH,", ",")",")"),QH=1e-12;function Pw(t){return((t=Math.exp(t))+1/t)/2}function ZH(t){return((t=Math.exp(t))-1/t)/2}function JH(t){return((t=Math.exp(2*t))-1)/(t+1)}const eh=function t(e,n,r){function i(s,o){var l=s[0],a=s[1],u=s[2],c=o[0],d=o[1],f=o[2],h=c-l,m=d-a,x=h*h+m*m,v,p;if(x<QH)p=Math.log(f/u)/e,v=function(E){return[l+E*h,a+E*m,u*Math.exp(e*E*p)]};else{var y=Math.sqrt(x),b=(f*f-u*u+r*x)/(2*u*n*y),C=(f*f-u*u-r*x)/(2*f*n*y),S=Math.log(Math.sqrt(b*b+1)-b),k=Math.log(Math.sqrt(C*C+1)-C);p=(k-S)/e,v=function(E){var $=E*p,D=Pw(S),L=u/(n*y)*(D*JH(e*$+S)-ZH(S));return[l+L*h,a+L*m,u*D/Pw(e*$+S)]}}return v.duration=p*1e3*e/Math.SQRT2,v}return i.rho=function(s){var o=Math.max(.001,+s),l=o*o,a=l*l;return t(o,l,a)},i}(Math.SQRT2,2,4);var Ia=0,Nu=0,xu=0,o9=1e3,cp,Au,dp=0,il=0,am=0,Fc=typeof performance=="object"&&performance.now?performance:Date,l9=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Cv(){return il||(l9(ez),il=Fc.now()+am)}function ez(){il=0}function fp(){this._call=this._time=this._next=null}fp.prototype=a9.prototype={constructor:fp,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Cv():+n)+(e==null?0:+e),!this._next&&Au!==this&&(Au?Au._next=this:cp=this,Au=this),this._call=t,this._time=n,hy()},stop:function(){this._call&&(this._call=null,this._time=1/0,hy())}};function a9(t,e,n){var r=new fp;return r.restart(t,e,n),r}function tz(){Cv(),++Ia;for(var t=cp,e;t;)(e=il-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ia}function Lw(){il=(dp=Fc.now())+am,Ia=Nu=0;try{tz()}finally{Ia=0,rz(),il=0}}function nz(){var t=Fc.now(),e=t-dp;e>o9&&(am-=e,dp=t)}function rz(){for(var t,e=cp,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:cp=n);Au=t,hy(r)}function hy(t){if(!Ia){Nu&&(Nu=clearTimeout(Nu));var e=t-il;e>24?(t<1/0&&(Nu=setTimeout(Lw,t-Fc.now()-am)),xu&&(xu=clearInterval(xu))):(xu||(dp=Fc.now(),xu=setInterval(nz,o9)),Ia=1,l9(Lw))}}function Iw(t,e,n){var r=new fp;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var iz=om("start","end","cancel","interrupt"),sz=[],u9=0,Rw=1,py=2,th=3,Bw=4,my=5,nh=6;function um(t,e,n,r,i,s){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;oz(t,n,{name:e,index:r,group:i,on:iz,tween:sz,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:u9})}function kv(t,e){var n=oi(t,e);if(n.state>u9)throw new Error("too late; already scheduled");return n}function Ri(t,e){var n=oi(t,e);if(n.state>th)throw new Error("too late; already running");return n}function oi(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function oz(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=a9(s,0,n.time);function s(u){n.state=Rw,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var c,d,f,h;if(n.state!==Rw)return a();for(c in r)if(h=r[c],h.name===n.name){if(h.state===th)return Iw(o);h.state===Bw?(h.state=nh,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[c]):+c<e&&(h.state=nh,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete r[c])}if(Iw(function(){n.state===th&&(n.state=Bw,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=py,n.on.call("start",t,t.__data__,n.index,n.group),n.state===py){for(n.state=th,i=new Array(f=n.tween.length),c=0,d=-1;c<f;++c)(h=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(i[++d]=h);i.length=d+1}}function l(u){for(var c=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(a),n.state=my,1),d=-1,f=i.length;++d<f;)i[d].call(t,c);n.state===my&&(n.on.call("end",t,t.__data__,n.index,n.group),a())}function a(){n.state=nh,n.timer.stop(),delete r[e];for(var u in r)return;delete t.__transition}}function rh(t,e){var n=t.__transition,r,i,s=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((r=n[o]).name!==e){s=!1;continue}i=r.state>py&&r.state<my,r.state=nh,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[o]}s&&delete t.__transition}}function lz(t){return this.each(function(){rh(this,t)})}function az(t,e){var n,r;return function(){var i=Ri(this,t),s=i.tween;if(s!==n){r=n=s;for(var o=0,l=r.length;o<l;++o)if(r[o].name===e){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function uz(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=Ri(this,t),o=s.tween;if(o!==r){i=(r=o).slice();for(var l={name:e,value:n},a=0,u=i.length;a<u;++a)if(i[a].name===e){i[a]=l;break}a===u&&i.push(l)}s.tween=i}}function cz(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=oi(this.node(),n).tween,i=0,s=r.length,o;i<s;++i)if((o=r[i]).name===t)return o.value;return null}return this.each((e==null?az:uz)(n,t,e))}function Sv(t,e,n){var r=t._id;return t.each(function(){var i=Ri(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return oi(i,r).value[e]}}function c9(t,e){var n;return(typeof e=="number"?vi:e instanceof rl?up:(n=rl(e))?(e=n,up):r9)(t,e)}function dz(t){return function(){this.removeAttribute(t)}}function fz(t){return function(){this.removeAttributeNS(t.space,t.local)}}function hz(t,e,n){var r,i=n+"",s;return function(){var o=this.getAttribute(t);return o===i?null:o===r?s:s=e(r=o,n)}}function pz(t,e,n){var r,i=n+"",s;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?s:s=e(r=o,n)}}function mz(t,e,n){var r,i,s;return function(){var o,l=n(this),a;return l==null?void this.removeAttribute(t):(o=this.getAttribute(t),a=l+"",o===a?null:o===r&&a===i?s:(i=a,s=e(r=o,l)))}}function gz(t,e,n){var r,i,s;return function(){var o,l=n(this),a;return l==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),a=l+"",o===a?null:o===r&&a===i?s:(i=a,s=e(r=o,l)))}}function yz(t,e){var n=lm(t),r=n==="transform"?qH:c9;return this.attrTween(t,typeof e=="function"?(n.local?gz:mz)(n,r,Sv(this,"attr."+t,e)):e==null?(n.local?fz:dz)(n):(n.local?pz:hz)(n,r,e))}function xz(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function vz(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function bz(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&vz(t,s)),n}return i._value=e,i}function wz(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&xz(t,s)),n}return i._value=e,i}function Cz(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=lm(t);return this.tween(n,(r.local?bz:wz)(r,e))}function kz(t,e){return function(){kv(this,t).delay=+e.apply(this,arguments)}}function Sz(t,e){return e=+e,function(){kv(this,t).delay=e}}function Ez(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?kz:Sz)(e,t)):oi(this.node(),e).delay}function $z(t,e){return function(){Ri(this,t).duration=+e.apply(this,arguments)}}function Mz(t,e){return e=+e,function(){Ri(this,t).duration=e}}function Dz(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?$z:Mz)(e,t)):oi(this.node(),e).duration}function Nz(t,e){if(typeof e!="function")throw new Error;return function(){Ri(this,t).ease=e}}function Az(t){var e=this._id;return arguments.length?this.each(Nz(e,t)):oi(this.node(),e).ease}function Tz(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Ri(this,t).ease=n}}function Pz(t){if(typeof t!="function")throw new Error;return this.each(Tz(this._id,t))}function Lz(t){typeof t!="function"&&(t=_7(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,l=r[i]=[],a,u=0;u<o;++u)(a=s[u])&&t.call(a,a.__data__,u,s)&&l.push(a);return new as(r,this._parents,this._name,this._id)}function Iz(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,s=Math.min(r,i),o=new Array(r),l=0;l<s;++l)for(var a=e[l],u=n[l],c=a.length,d=o[l]=new Array(c),f,h=0;h<c;++h)(f=a[h]||u[h])&&(d[h]=f);for(;l<r;++l)o[l]=e[l];return new as(o,this._parents,this._name,this._id)}function Rz(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Bz(t,e,n){var r,i,s=Rz(e)?kv:Ri;return function(){var o=s(this,t),l=o.on;l!==r&&(i=(r=l).copy()).on(e,n),o.on=i}}function Oz(t,e){var n=this._id;return arguments.length<2?oi(this.node(),n).on.on(t):this.each(Bz(n,t,e))}function jz(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Vz(){return this.on("end.remove",jz(this._id))}function Fz(t){var e=this._name,n=this._id;typeof t!="function"&&(t=xv(t));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var l=r[o],a=l.length,u=s[o]=new Array(a),c,d,f=0;f<a;++f)(c=l[f])&&(d=t.call(c,c.__data__,f,l))&&("__data__"in c&&(d.__data__=c.__data__),u[f]=d,um(u[f],e,n,f,u,oi(c,n)));return new as(s,this._parents,e,n)}function _z(t){var e=this._name,n=this._id;typeof t!="function"&&(t=F7(t));for(var r=this._groups,i=r.length,s=[],o=[],l=0;l<i;++l)for(var a=r[l],u=a.length,c,d=0;d<u;++d)if(c=a[d]){for(var f=t.call(c,c.__data__,d,a),h,m=oi(c,n),x=0,v=f.length;x<v;++x)(h=f[x])&&um(h,e,n,x,f,m);s.push(f),o.push(c)}return new as(s,o,e,n)}var Hz=cd.prototype.constructor;function zz(){return new Hz(this._groups,this._parents)}function Wz(t,e){var n,r,i;return function(){var s=La(this,t),o=(this.style.removeProperty(t),La(this,t));return s===o?null:s===n&&o===r?i:i=e(n=s,r=o)}}function d9(t){return function(){this.style.removeProperty(t)}}function Gz(t,e,n){var r,i=n+"",s;return function(){var o=La(this,t);return o===i?null:o===r?s:s=e(r=o,n)}}function Uz(t,e,n){var r,i,s;return function(){var o=La(this,t),l=n(this),a=l+"";return l==null&&(a=l=(this.style.removeProperty(t),La(this,t))),o===a?null:o===r&&a===i?s:(i=a,s=e(r=o,l))}}function Kz(t,e){var n,r,i,s="style."+e,o="end."+s,l;return function(){var a=Ri(this,t),u=a.on,c=a.value[s]==null?l||(l=d9(e)):void 0;(u!==n||i!==c)&&(r=(n=u).copy()).on(o,i=c),a.on=r}}function Yz(t,e,n){var r=(t+="")=="transform"?XH:c9;return e==null?this.styleTween(t,Wz(t,r)).on("end.style."+t,d9(t)):typeof e=="function"?this.styleTween(t,Uz(t,r,Sv(this,"style."+t,e))).each(Kz(this._id,t)):this.styleTween(t,Gz(t,r,e),n).on("end.style."+t,null)}function Xz(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function qz(t,e,n){var r,i;function s(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&Xz(t,o,n)),r}return s._value=e,s}function Qz(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,qz(t,e,n??""))}function Zz(t){return function(){this.textContent=t}}function Jz(t){return function(){var e=t(this);this.textContent=e??""}}function eW(t){return this.tween("text",typeof t=="function"?Jz(Sv(this,"text",t)):Zz(t==null?"":t+""))}function tW(t){return function(e){this.textContent=t.call(this,e)}}function nW(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&tW(i)),e}return r._value=t,r}function rW(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,nW(t))}function iW(){for(var t=this._name,e=this._id,n=f9(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],l=o.length,a,u=0;u<l;++u)if(a=o[u]){var c=oi(a,e);um(a,t,n,u,o,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new as(r,this._parents,t,n)}function sW(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var l={value:o},a={value:function(){--i===0&&s()}};n.each(function(){var u=Ri(this,r),c=u.on;c!==t&&(e=(t=c).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(a)),u.on=e}),i===0&&s()})}var oW=0;function as(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function f9(){return++oW}var _i=cd.prototype;as.prototype={constructor:as,select:Fz,selectAll:_z,selectChild:_i.selectChild,selectChildren:_i.selectChildren,filter:Lz,merge:Iz,selection:zz,transition:iW,call:_i.call,nodes:_i.nodes,node:_i.node,size:_i.size,empty:_i.empty,each:_i.each,on:Oz,attr:yz,attrTween:Cz,style:Yz,styleTween:Qz,text:eW,textTween:rW,remove:Vz,tween:cz,delay:Ez,duration:Dz,ease:Az,easeVarying:Pz,end:sW,[Symbol.iterator]:_i[Symbol.iterator]};function lW(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var aW={time:null,delay:0,duration:250,ease:lW};function uW(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function cW(t){var e,n;t instanceof as?(e=t._id,t=t._name):(e=f9(),(n=aW).time=Cv(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],l=o.length,a,u=0;u<l;++u)(a=o[u])&&um(a,t,e,u,o,n||uW(a,e));return new as(r,this._parents,t,e)}cd.prototype.interrupt=lz;cd.prototype.transition=cW;const yf=t=>()=>t;function dW(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Xi(t,e,n){this.k=t,this.x=e,this.y=n}Xi.prototype={constructor:Xi,scale:function(t){return t===1?this:new Xi(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Xi(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var cm=new Xi(1,0,0);h9.prototype=Xi.prototype;function h9(t){for(;!t.__zoom;)if(!(t=t.parentNode))return cm;return t.__zoom}function Wg(t){t.stopImmediatePropagation()}function vu(t){t.preventDefault(),t.stopImmediatePropagation()}function fW(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function hW(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Ow(){return this.__zoom||cm}function pW(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function mW(){return navigator.maxTouchPoints||"ontouchstart"in this}function gW(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function p9(){var t=fW,e=hW,n=gW,r=pW,i=mW,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,a=eh,u=om("start","zoom","end"),c,d,f,h=500,m=150,x=0,v=10;function p(M){M.property("__zoom",Ow).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",L).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(M,B,N,O){var I=M.selection?M.selection():M;I.property("__zoom",Ow),M!==I?S(M,B,N,O):I.interrupt().each(function(){k(this,arguments).event(O).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},p.scaleBy=function(M,B,N,O){p.scaleTo(M,function(){var I=this.__zoom.k,P=typeof B=="function"?B.apply(this,arguments):B;return I*P},N,O)},p.scaleTo=function(M,B,N,O){p.transform(M,function(){var I=e.apply(this,arguments),P=this.__zoom,F=N==null?C(I):typeof N=="function"?N.apply(this,arguments):N,z=P.invert(F),j=typeof B=="function"?B.apply(this,arguments):B;return n(b(y(P,j),F,z),I,o)},N,O)},p.translateBy=function(M,B,N,O){p.transform(M,function(){return n(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof N=="function"?N.apply(this,arguments):N),e.apply(this,arguments),o)},null,O)},p.translateTo=function(M,B,N,O,I){p.transform(M,function(){var P=e.apply(this,arguments),F=this.__zoom,z=O==null?C(P):typeof O=="function"?O.apply(this,arguments):O;return n(cm.translate(z[0],z[1]).scale(F.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof N=="function"?-N.apply(this,arguments):-N),P,o)},O,I)};function y(M,B){return B=Math.max(s[0],Math.min(s[1],B)),B===M.k?M:new Xi(B,M.x,M.y)}function b(M,B,N){var O=B[0]-N[0]*M.k,I=B[1]-N[1]*M.k;return O===M.x&&I===M.y?M:new Xi(M.k,O,I)}function C(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function S(M,B,N,O){M.on("start.zoom",function(){k(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(O).end()}).tween("zoom",function(){var I=this,P=arguments,F=k(I,P).event(O),z=e.apply(I,P),j=N==null?C(z):typeof N=="function"?N.apply(I,P):N,R=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),H=I.__zoom,G=typeof B=="function"?B.apply(I,P):B,U=a(H.invert(j).concat(R/H.k),G.invert(j).concat(R/G.k));return function(se){if(se===1)se=G;else{var ne=U(se),le=R/ne[2];se=new Xi(le,j[0]-ne[0]*le,j[1]-ne[1]*le)}F.zoom(null,se)}})}function k(M,B,N){return!N&&M.__zooming||new E(M,B)}function E(M,B){this.that=M,this.args=B,this.active=0,this.sourceEvent=null,this.extent=e.apply(M,B),this.taps=0}E.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,B){return this.mouse&&M!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var B=gr(this.that).datum();u.call(M,this.that,new dW(M,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:u}),B)}};function $(M,...B){if(!t.apply(this,arguments))return;var N=k(this,B).event(M),O=this.__zoom,I=Math.max(s[0],Math.min(s[1],O.k*Math.pow(2,r.apply(this,arguments)))),P=Wr(M);if(N.wheel)(N.mouse[0][0]!==P[0]||N.mouse[0][1]!==P[1])&&(N.mouse[1]=O.invert(N.mouse[0]=P)),clearTimeout(N.wheel);else{if(O.k===I)return;N.mouse=[P,O.invert(P)],rh(this),N.start()}vu(M),N.wheel=setTimeout(F,m),N.zoom("mouse",n(b(y(O,I),N.mouse[0],N.mouse[1]),N.extent,o));function F(){N.wheel=null,N.end()}}function D(M,...B){if(f||!t.apply(this,arguments))return;var N=M.currentTarget,O=k(this,B,!0).event(M),I=gr(M.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",R,!0),P=Wr(M,N),F=M.clientX,z=M.clientY;Q7(M.view),Wg(M),O.mouse=[P,this.__zoom.invert(P)],rh(this),O.start();function j(H){if(vu(H),!O.moved){var G=H.clientX-F,U=H.clientY-z;O.moved=G*G+U*U>x}O.event(H).zoom("mouse",n(b(O.that.__zoom,O.mouse[0]=Wr(H,N),O.mouse[1]),O.extent,o))}function R(H){I.on("mousemove.zoom mouseup.zoom",null),Z7(H.view,O.moved),vu(H),O.event(H).end()}}function L(M,...B){if(t.apply(this,arguments)){var N=this.__zoom,O=Wr(M.changedTouches?M.changedTouches[0]:M,this),I=N.invert(O),P=N.k*(M.shiftKey?.5:2),F=n(b(y(N,P),O,I),e.apply(this,B),o);vu(M),l>0?gr(this).transition().duration(l).call(S,F,O,M):gr(this).call(p.transform,F,O,M)}}function A(M,...B){if(t.apply(this,arguments)){var N=M.touches,O=N.length,I=k(this,B,M.changedTouches.length===O).event(M),P,F,z,j;for(Wg(M),F=0;F<O;++F)z=N[F],j=Wr(z,this),j=[j,this.__zoom.invert(j),z.identifier],I.touch0?!I.touch1&&I.touch0[2]!==j[2]&&(I.touch1=j,I.taps=0):(I.touch0=j,P=!0,I.taps=1+!!c);c&&(c=clearTimeout(c)),P&&(I.taps<2&&(d=j[0],c=setTimeout(function(){c=null},h)),rh(this),I.start())}}function T(M,...B){if(this.__zooming){var N=k(this,B).event(M),O=M.changedTouches,I=O.length,P,F,z,j;for(vu(M),P=0;P<I;++P)F=O[P],z=Wr(F,this),N.touch0&&N.touch0[2]===F.identifier?N.touch0[0]=z:N.touch1&&N.touch1[2]===F.identifier&&(N.touch1[0]=z);if(F=N.that.__zoom,N.touch1){var R=N.touch0[0],H=N.touch0[1],G=N.touch1[0],U=N.touch1[1],se=(se=G[0]-R[0])*se+(se=G[1]-R[1])*se,ne=(ne=U[0]-H[0])*ne+(ne=U[1]-H[1])*ne;F=y(F,Math.sqrt(se/ne)),z=[(R[0]+G[0])/2,(R[1]+G[1])/2],j=[(H[0]+U[0])/2,(H[1]+U[1])/2]}else if(N.touch0)z=N.touch0[0],j=N.touch0[1];else return;N.zoom("touch",n(b(F,z,j),N.extent,o))}}function V(M,...B){if(this.__zooming){var N=k(this,B).event(M),O=M.changedTouches,I=O.length,P,F;for(Wg(M),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),P=0;P<I;++P)F=O[P],N.touch0&&N.touch0[2]===F.identifier?delete N.touch0:N.touch1&&N.touch1[2]===F.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(F=Wr(F,this),Math.hypot(d[0]-F[0],d[1]-F[1])<v)){var z=gr(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return p.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:yf(+M),p):r},p.filter=function(M){return arguments.length?(t=typeof M=="function"?M:yf(!!M),p):t},p.touchable=function(M){return arguments.length?(i=typeof M=="function"?M:yf(!!M),p):i},p.extent=function(M){return arguments.length?(e=typeof M=="function"?M:yf([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),p):e},p.scaleExtent=function(M){return arguments.length?(s[0]=+M[0],s[1]=+M[1],p):[s[0],s[1]]},p.translateExtent=function(M){return arguments.length?(o[0][0]=+M[0][0],o[1][0]=+M[1][0],o[0][1]=+M[0][1],o[1][1]=+M[1][1],p):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},p.constrain=function(M){return arguments.length?(n=M,p):n},p.duration=function(M){return arguments.length?(l=+M,p):l},p.interpolate=function(M){return arguments.length?(a=M,p):a},p.on=function(){var M=u.on.apply(u,arguments);return M===u?p:M},p.clickDistance=function(M){return arguments.length?(x=(M=+M)*M,p):Math.sqrt(x)},p.tapDistance=function(M){return arguments.length?(v=+M,p):v},p}const Ti={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:r}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},_c=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],m9=["Enter"," ","Escape"],g9={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ra;(function(t){t.Strict="strict",t.Loose="loose"})(Ra||(Ra={}));var Go;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Go||(Go={}));var Ba;(function(t){t.Partial="partial",t.Full="full"})(Ba||(Ba={}));const y9={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ds;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Ds||(Ds={}));var hp;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(hp||(hp={}));var Ne;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Ne||(Ne={}));const jw={[Ne.Left]:Ne.Right,[Ne.Right]:Ne.Left,[Ne.Top]:Ne.Bottom,[Ne.Bottom]:Ne.Top};function x9(t){return t===null?null:t?"valid":"invalid"}const v9=t=>"id"in t&&"source"in t&&"target"in t,yW=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Ev=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),fd=(t,e=[0,0])=>{const{width:n,height:r}=ds(t),i=t.origin??e,s=n*i[0],o=r*i[1];return{x:t.position.x-s,y:t.position.y-o}},xW=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,i)=>{const s=typeof i=="string";let o=!e.nodeLookup&&!s?i:void 0;e.nodeLookup&&(o=s?e.nodeLookup.get(i):Ev(i)?i:e.nodeLookup.get(i.id));const l=o?pp(o,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return dm(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fm(n)},hd=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return t.forEach(i=>{(e.filter===void 0||e.filter(i))&&(n=dm(n,pp(i)),r=!0)}),r?fm(n):{x:0,y:0,width:0,height:0}},$v=(t,e,[n,r,i]=[0,0,1],s=!1,o=!1)=>{const l={...md(e,[n,r,i]),width:e.width/i,height:e.height/i},a=[];for(const u of t.values()){const{measured:c,selectable:d=!0,hidden:f=!1}=u;if(o&&!d||f)continue;const h=c.width??u.width??u.initialWidth??null,m=c.height??u.height??u.initialHeight??null,x=Hc(l,ja(u)),v=(h??0)*(m??0),p=s&&x>0;(!u.internals.handleBounds||p||x>=v||u.dragging)&&a.push(u)}return a},vW=(t,e)=>{const n=new Set;return t.forEach(r=>{n.add(r.id)}),e.filter(r=>n.has(r.source)||n.has(r.target))};function bW(t,e){const n=new Map,r=e!=null&&e.nodes?new Set(e.nodes.map(i=>i.id)):null;return t.forEach(i=>{i.measured.width&&i.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function wW({nodes:t,width:e,height:n,panZoom:r,minZoom:i,maxZoom:s},o){if(t.size===0)return Promise.resolve(!0);const l=bW(t,o),a=hd(l),u=Mv(a,e,n,(o==null?void 0:o.minZoom)??i,(o==null?void 0:o.maxZoom)??s,(o==null?void 0:o.padding)??.1);return await r.setViewport(u,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),Promise.resolve(!0)}function b9({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const o=n.get(t),l=o.parentId?n.get(o.parentId):void 0,{x:a,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},c=o.origin??r;let d=o.extent||i;if(o.extent==="parent"&&!o.expandParent)if(!l)s==null||s("005",Ti.error005());else{const h=l.measured.width,m=l.measured.height;h&&m&&(d=[[a,u],[a+h,u+m]])}else l&&Va(o.extent)&&(d=[[o.extent[0][0]+a,o.extent[0][1]+u],[o.extent[1][0]+a,o.extent[1][1]+u]]);const f=Va(d)?sl(e,d,o.measured):e;return(o.measured.width===void 0||o.measured.height===void 0)&&(s==null||s("015",Ti.error015())),{position:{x:f.x-a+(o.measured.width??0)*c[0],y:f.y-u+(o.measured.height??0)*c[1]},positionAbsolute:f}}async function CW({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(t.map(f=>f.id)),o=[];for(const f of n){if(f.deletable===!1)continue;const h=s.has(f.id),m=!h&&f.parentId&&o.find(x=>x.id===f.parentId);(h||m)&&o.push(f)}const l=new Set(e.map(f=>f.id)),a=r.filter(f=>f.deletable!==!1),c=vW(o,a);for(const f of a)l.has(f.id)&&!c.find(m=>m.id===f.id)&&c.push(f);if(!i)return{edges:c,nodes:o};const d=await i({nodes:o,edges:c});return typeof d=="boolean"?d?{edges:c,nodes:o}:{edges:[],nodes:[]}:d}const Oa=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),sl=(t={x:0,y:0},e,n)=>({x:Oa(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Oa(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function w9(t,e,n){const{width:r,height:i}=ds(n),{x:s,y:o}=n.internals.positionAbsolute;return sl(t,[[s,o],[s+r,o+i]],e)}const Vw=(t,e,n)=>t<e?Oa(Math.abs(t-e),1,e)/e:t>n?-Oa(Math.abs(t-n),1,e)/e:0,C9=(t,e,n=15,r=40)=>{const i=Vw(t.x,r,e.width-r)*n,s=Vw(t.y,r,e.height-r)*n;return[i,s]},dm=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),gy=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),fm=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),ja=(t,e=[0,0])=>{var i,s;const{x:n,y:r}=Ev(t)?t.internals.positionAbsolute:fd(t,e);return{x:n,y:r,width:((i=t.measured)==null?void 0:i.width)??t.width??t.initialWidth??0,height:((s=t.measured)==null?void 0:s.height)??t.height??t.initialHeight??0}},pp=(t,e=[0,0])=>{var i,s;const{x:n,y:r}=Ev(t)?t.internals.positionAbsolute:fd(t,e);return{x:n,y:r,x2:n+(((i=t.measured)==null?void 0:i.width)??t.width??t.initialWidth??0),y2:r+(((s=t.measured)==null?void 0:s.height)??t.height??t.initialHeight??0)}},k9=(t,e)=>fm(dm(gy(t),gy(e))),Hc=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},Fw=t=>Qr(t.width)&&Qr(t.height)&&Qr(t.x)&&Qr(t.y),Qr=t=>!isNaN(t)&&isFinite(t),kW=(t,e)=>{},pd=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),md=({x:t,y:e},[n,r,i],s=!1,o=[1,1])=>{const l={x:(t-n)/i,y:(e-r)/i};return s?pd(l,o):l},mp=({x:t,y:e},[n,r,i])=>({x:t*i+n,y:e*i+r});function Sl(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function SW(t,e,n){if(typeof t=="string"||typeof t=="number"){const r=Sl(t,n),i=Sl(t,e);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof t=="object"){const r=Sl(t.top??t.y??0,n),i=Sl(t.bottom??t.y??0,n),s=Sl(t.left??t.x??0,e),o=Sl(t.right??t.x??0,e);return{top:r,right:o,bottom:i,left:s,x:s+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function EW(t,e,n,r,i,s){const{x:o,y:l}=mp(t,[e,n,r]),{x:a,y:u}=mp({x:t.x+t.width,y:t.y+t.height},[e,n,r]),c=i-a,d=s-u;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(c),bottom:Math.floor(d)}}const Mv=(t,e,n,r,i,s)=>{const o=SW(s,e,n),l=(e-o.x)/t.width,a=(n-o.y)/t.height,u=Math.min(l,a),c=Oa(u,r,i),d=t.x+t.width/2,f=t.y+t.height/2,h=e/2-d*c,m=n/2-f*c,x=EW(t,h,m,c,e,n),v={left:Math.min(x.left-o.left,0),top:Math.min(x.top-o.top,0),right:Math.min(x.right-o.right,0),bottom:Math.min(x.bottom-o.bottom,0)};return{x:h-v.left+v.right,y:m-v.top+v.bottom,zoom:c}},zc=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Va(t){return t!=null&&t!=="parent"}function ds(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function S9(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function E9(t,e={width:0,height:0},n,r,i){const s={...t},o=r.get(n);if(o){const l=o.origin||i;s.x+=o.internals.positionAbsolute.x-(e.width??0)*l[0],s.y+=o.internals.positionAbsolute.y-(e.height??0)*l[1]}return s}function _w(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function $W(){let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}}function MW(t){return{...g9,...t||{}}}function Ju(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:o}=Zr(t),l=md({x:s-((i==null?void 0:i.left)??0),y:o-((i==null?void 0:i.top)??0)},r),{x:a,y:u}=n?pd(l,e):l;return{xSnapped:a,ySnapped:u,...l}}const Dv=t=>({width:t.offsetWidth,height:t.offsetHeight}),$9=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},DW=["INPUT","SELECT","TEXTAREA"];function M9(t){var r,i;const e=((i=(r=t.composedPath)==null?void 0:r.call(t))==null?void 0:i[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:DW.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const D9=t=>"clientX"in t,Zr=(t,e)=>{var s,o;const n=D9(t),r=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,i=n?t.clientY:(o=t.touches)==null?void 0:o[0].clientY;return{x:r-((e==null?void 0:e.left)??0),y:i-((e==null?void 0:e.top)??0)}},Hw=(t,e,n,r,i)=>{const s=e.querySelectorAll(`.${t}`);return!s||!s.length?null:Array.from(s).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:t,nodeId:i,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...Dv(o)}})};function N9({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:o,targetControlY:l}){const a=t*.125+i*.375+o*.375+n*.125,u=e*.125+s*.375+l*.375+r*.125,c=Math.abs(a-t),d=Math.abs(u-e);return[a,u,c,d]}function xf(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function zw({pos:t,x1:e,y1:n,x2:r,y2:i,c:s}){switch(t){case Ne.Left:return[e-xf(e-r,s),n];case Ne.Right:return[e+xf(r-e,s),n];case Ne.Top:return[e,n-xf(n-i,s)];case Ne.Bottom:return[e,n+xf(i-n,s)]}}function Nv({sourceX:t,sourceY:e,sourcePosition:n=Ne.Bottom,targetX:r,targetY:i,targetPosition:s=Ne.Top,curvature:o=.25}){const[l,a]=zw({pos:n,x1:t,y1:e,x2:r,y2:i,c:o}),[u,c]=zw({pos:s,x1:r,y1:i,x2:t,y2:e,c:o}),[d,f,h,m]=N9({sourceX:t,sourceY:e,targetX:r,targetY:i,sourceControlX:l,sourceControlY:a,targetControlX:u,targetControlY:c});return[`M${t},${e} C${l},${a} ${u},${c} ${r},${i}`,d,f,h,m]}function A9({sourceX:t,sourceY:e,targetX:n,targetY:r}){const i=Math.abs(n-t)/2,s=n<t?n+i:n-i,o=Math.abs(r-e)/2,l=r<e?r+o:r-o;return[s,l,i,o]}function NW({sourceNode:t,targetNode:e,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const o=i&&n?r+1e3:r,l=Math.max(t.parentId||i&&t.selected?t.internals.z:0,e.parentId||i&&e.selected?e.internals.z:0);return o+l}function AW({sourceNode:t,targetNode:e,width:n,height:r,transform:i}){const s=dm(pp(t),pp(e));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const o={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return Hc(o,fm(s))>0}const TW=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`xy-edge__${t}${e||""}-${n}${r||""}`,PW=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),LW=(t,e,n={})=>{if(!t.source||!t.target)return e;const r=n.getEdgeId||TW;let i;return v9(t)?i={...t}:i={...t,id:r(t)},PW(i,e)?e:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,e.concat(i))};function T9({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[i,s,o,l]=A9({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,i,s,o,l]}const Ww={[Ne.Left]:{x:-1,y:0},[Ne.Right]:{x:1,y:0},[Ne.Top]:{x:0,y:-1},[Ne.Bottom]:{x:0,y:1}},IW=({source:t,sourcePosition:e=Ne.Bottom,target:n})=>e===Ne.Left||e===Ne.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},Gw=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function RW({source:t,sourcePosition:e=Ne.Bottom,target:n,targetPosition:r=Ne.Top,center:i,offset:s,stepPosition:o}){const l=Ww[e],a=Ww[r],u={x:t.x+l.x*s,y:t.y+l.y*s},c={x:n.x+a.x*s,y:n.y+a.y*s},d=IW({source:u,sourcePosition:e,target:c}),f=d.x!==0?"x":"y",h=d[f];let m=[],x,v;const p={x:0,y:0},y={x:0,y:0},[,,b,C]=A9({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(l[f]*a[f]===-1){f==="x"?(x=i.x??u.x+(c.x-u.x)*o,v=i.y??(u.y+c.y)/2):(x=i.x??(u.x+c.x)/2,v=i.y??u.y+(c.y-u.y)*o);const k=[{x,y:u.y},{x,y:c.y}],E=[{x:u.x,y:v},{x:c.x,y:v}];l[f]===h?m=f==="x"?k:E:m=f==="x"?E:k}else{const k=[{x:u.x,y:c.y}],E=[{x:c.x,y:u.y}];if(f==="x"?m=l.x===h?E:k:m=l.y===h?k:E,e===r){const T=Math.abs(t[f]-n[f]);if(T<=s){const V=Math.min(s-1,s-T);l[f]===h?p[f]=(u[f]>t[f]?-1:1)*V:y[f]=(c[f]>n[f]?-1:1)*V}}if(e!==r){const T=f==="x"?"y":"x",V=l[f]===a[T],M=u[T]>c[T],B=u[T]<c[T];(l[f]===1&&(!V&&M||V&&B)||l[f]!==1&&(!V&&B||V&&M))&&(m=f==="x"?k:E)}const $={x:u.x+p.x,y:u.y+p.y},D={x:c.x+y.x,y:c.y+y.y},L=Math.max(Math.abs($.x-m[0].x),Math.abs(D.x-m[0].x)),A=Math.max(Math.abs($.y-m[0].y),Math.abs(D.y-m[0].y));L>=A?(x=($.x+D.x)/2,v=m[0].y):(x=m[0].x,v=($.y+D.y)/2)}return[[t,{x:u.x+p.x,y:u.y+p.y},...m,{x:c.x+y.x,y:c.y+y.y},n],x,v,b,C]}function BW(t,e,n,r){const i=Math.min(Gw(t,e)/2,Gw(e,n)/2,r),{x:s,y:o}=e;if(t.x===s&&s===n.x||t.y===o&&o===n.y)return`L${s} ${o}`;if(t.y===o){const u=t.x<n.x?-1:1,c=t.y<n.y?1:-1;return`L ${s+i*u},${o}Q ${s},${o} ${s},${o+i*c}`}const l=t.x<n.x?1:-1,a=t.y<n.y?-1:1;return`L ${s},${o+i*a}Q ${s},${o} ${s+i*l},${o}`}function yy({sourceX:t,sourceY:e,sourcePosition:n=Ne.Bottom,targetX:r,targetY:i,targetPosition:s=Ne.Top,borderRadius:o=5,centerX:l,centerY:a,offset:u=20,stepPosition:c=.5}){const[d,f,h,m,x]=RW({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:l,y:a},offset:u,stepPosition:c});return[d.reduce((p,y,b)=>{let C="";return b>0&&b<d.length-1?C=BW(d[b-1],y,d[b+1],o):C=`${b===0?"M":"L"}${y.x} ${y.y}`,p+=C,p},""),f,h,m,x]}function Uw(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function OW(t){var d;const{sourceNode:e,targetNode:n}=t;if(!Uw(e)||!Uw(n))return null;const r=e.internals.handleBounds||Kw(e.handles),i=n.internals.handleBounds||Kw(n.handles),s=Yw((r==null?void 0:r.source)??[],t.sourceHandle),o=Yw(t.connectionMode===Ra.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),t.targetHandle);if(!s||!o)return(d=t.onError)==null||d.call(t,"008",Ti.error008(s?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const l=(s==null?void 0:s.position)||Ne.Bottom,a=(o==null?void 0:o.position)||Ne.Top,u=ol(e,s,l),c=ol(n,o,a);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y,sourcePosition:l,targetPosition:a}}function Kw(t){if(!t)return null;const e=[],n=[];for(const r of t)r.width=r.width??1,r.height=r.height??1,r.type==="source"?e.push(r):r.type==="target"&&n.push(r);return{source:e,target:n}}function ol(t,e,n=Ne.Left,r=!1){const i=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,s=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:o,height:l}=e??ds(t);if(r)return{x:i+o/2,y:s+l/2};switch((e==null?void 0:e.position)??n){case Ne.Top:return{x:i+o/2,y:s};case Ne.Right:return{x:i+o,y:s+l/2};case Ne.Bottom:return{x:i+o/2,y:s+l};case Ne.Left:return{x:i,y:s+l/2}}}function Yw(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function xy(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`:""}function jW(t,{id:e,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return t.reduce((o,l)=>([l.markerStart||r,l.markerEnd||i].forEach(a=>{if(a&&typeof a=="object"){const u=xy(a,e);s.has(u)||(o.push({id:u,color:a.color||n,...a}),s.add(u))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const P9=1e3,VW=10,Av={nodeOrigin:[0,0],nodeExtent:_c,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},FW={...Av,checkEquality:!0};function Tv(t,e){const n={...t};for(const r in e)e[r]!==void 0&&(n[r]=e[r]);return n}function _W(t,e,n){const r=Tv(Av,n);for(const i of t.values())if(i.parentId)Lv(i,t,e,r);else{const s=fd(i,r.nodeOrigin),o=Va(i.extent)?i.extent:r.nodeExtent,l=sl(s,o,ds(i));i.internals.positionAbsolute=l}}function HW(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],r=[];for(const i of t.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:t.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}function Pv(t){return t==="manual"}function vy(t,e,n,r={}){var u,c;const i=Tv(FW,r),s={i:0},o=new Map(e),l=i!=null&&i.elevateNodesOnSelect&&!Pv(i.zIndexMode)?P9:0;let a=t.length>0;e.clear(),n.clear();for(const d of t){let f=o.get(d.id);if(i.checkEquality&&d===(f==null?void 0:f.internals.userNode))e.set(d.id,f);else{const h=fd(d,i.nodeOrigin),m=Va(d.extent)?d.extent:i.nodeExtent,x=sl(h,m,ds(d));f={...i.defaults,...d,measured:{width:(u=d.measured)==null?void 0:u.width,height:(c=d.measured)==null?void 0:c.height},internals:{positionAbsolute:x,handleBounds:HW(d,f),z:L9(d,l,i.zIndexMode),userNode:d}},e.set(d.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(a=!1),d.parentId&&Lv(f,e,n,r,s)}return a}function zW(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function Lv(t,e,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:o,nodeExtent:l,zIndexMode:a}=Tv(Av,r),u=t.parentId,c=e.get(u);if(!c){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}zW(t,n),i&&!c.parentId&&c.internals.rootParentIndex===void 0&&a==="auto"&&(c.internals.rootParentIndex=++i.i,c.internals.z=c.internals.z+i.i*VW),i&&c.internals.rootParentIndex!==void 0&&(i.i=c.internals.rootParentIndex);const d=s&&!Pv(a)?P9:0,{x:f,y:h,z:m}=WW(t,c,o,l,d,a),{positionAbsolute:x}=t.internals,v=f!==x.x||h!==x.y;(v||m!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:v?{x:f,y:h}:x,z:m}})}function L9(t,e,n){const r=Qr(t.zIndex)?t.zIndex:0;return Pv(n)?r:r+(t.selected?e:0)}function WW(t,e,n,r,i,s){const{x:o,y:l}=e.internals.positionAbsolute,a=ds(t),u=fd(t,n),c=Va(t.extent)?sl(u,t.extent,a):u;let d=sl({x:o+c.x,y:l+c.y},r,a);t.extent==="parent"&&(d=w9(d,a,e));const f=L9(t,i,s),h=e.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function Iv(t,e,n,r=[0,0]){var o;const i=[],s=new Map;for(const l of t){const a=e.get(l.parentId);if(!a)continue;const u=((o=s.get(l.parentId))==null?void 0:o.expandedRect)??ja(a),c=k9(u,l.rect);s.set(l.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:l,parent:a},u)=>{var b;const c=a.internals.positionAbsolute,d=ds(a),f=a.origin??r,h=l.x<c.x?Math.round(Math.abs(c.x-l.x)):0,m=l.y<c.y?Math.round(Math.abs(c.y-l.y)):0,x=Math.max(d.width,Math.round(l.width)),v=Math.max(d.height,Math.round(l.height)),p=(x-d.width)*f[0],y=(v-d.height)*f[1];(h>0||m>0||p||y)&&(i.push({id:u,type:"position",position:{x:a.position.x-h+p,y:a.position.y-m+y}}),(b=n.get(u))==null||b.forEach(C=>{t.some(S=>S.id===C.id)||i.push({id:C.id,type:"position",position:{x:C.position.x+h,y:C.position.y+m}})})),(d.width<l.width||d.height<l.height||h||m)&&i.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?f[0]*h-p:0),height:v+(m?f[1]*m-y:0)}})}),i}function GW(t,e,n,r,i,s,o){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let a=!1;if(!l)return{changes:[],updatedInternals:a};const u=[],c=window.getComputedStyle(l),{m22:d}=new window.DOMMatrixReadOnly(c.transform),f=[];for(const h of t.values()){const m=e.get(h.id);if(!m)continue;if(m.hidden){e.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),a=!0;continue}const x=Dv(h.nodeElement),v=m.measured.width!==x.width||m.measured.height!==x.height;if(!!(x.width&&x.height&&(v||!m.internals.handleBounds||h.force))){const y=h.nodeElement.getBoundingClientRect(),b=Va(m.extent)?m.extent:s;let{positionAbsolute:C}=m.internals;m.parentId&&m.extent==="parent"?C=w9(C,x,e.get(m.parentId)):b&&(C=sl(C,b,x));const S={...m,measured:x,internals:{...m.internals,positionAbsolute:C,handleBounds:{source:Hw("source",h.nodeElement,y,d,m.id),target:Hw("target",h.nodeElement,y,d,m.id)}}};e.set(m.id,S),m.parentId&&Lv(S,e,n,{nodeOrigin:i,zIndexMode:o}),a=!0,v&&(u.push({id:m.id,type:"dimensions",dimensions:x}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:ja(S,i)}))}}if(f.length>0){const h=Iv(f,e,n,i);u.push(...h)}return{changes:u,updatedInternals:a}}async function UW({delta:t,panZoom:e,transform:n,translateExtent:r,width:i,height:s}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const o=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[i,s]],r),l=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(l)}function Xw(t,e,n,r,i,s){let o=i;const l=r.get(o)||new Map;r.set(o,l.set(n,e)),o=`${i}-${t}`;const a=r.get(o)||new Map;if(r.set(o,a.set(n,e)),s){o=`${i}-${t}-${s}`;const u=r.get(o)||new Map;r.set(o,u.set(n,e))}}function I9(t,e,n){t.clear(),e.clear();for(const r of n){const{source:i,target:s,sourceHandle:o=null,targetHandle:l=null}=r,a={edgeId:r.id,source:i,target:s,sourceHandle:o,targetHandle:l},u=`${i}-${o}--${s}-${l}`,c=`${s}-${l}--${i}-${o}`;Xw("source",a,c,t,i,o),Xw("target",a,u,t,s,l),e.set(r.id,r)}}function R9(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:R9(n,e):!1}function qw(t,e,n){var i;let r=t;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,e))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function KW(t,e,n,r){const i=new Map;for(const[s,o]of t)if((o.selected||o.id===r)&&(!o.parentId||!R9(o,t))&&(o.draggable||e&&typeof o.draggable>"u")){const l=t.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function Gg({nodeId:t,dragItems:e,nodeLookup:n,dragging:r=!0}){var o,l,a;const i=[];for(const[u,c]of e){const d=(o=n.get(u))==null?void 0:o.internals.userNode;d&&i.push({...d,position:c.position,dragging:r})}if(!t)return[i[0],i];const s=(l=n.get(t))==null?void 0:l.internals.userNode;return[s?{...s,position:((a=e.get(t))==null?void 0:a.position)||s.position,dragging:r}:i[0],i]}function YW({dragItems:t,snapGrid:e,x:n,y:r}){const i=t.values().next().value;if(!i)return null;const s={x:n-i.distance.x,y:r-i.distance.y},o=pd(s,e);return{x:o.x-s.x,y:o.y-s.y}}function XW({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},o=0,l=new Map,a=!1,u={x:0,y:0},c=null,d=!1,f=null,h=!1,m=!1,x=null;function v({noDragClassName:y,handleSelector:b,domNode:C,isSelectable:S,nodeId:k,nodeClickDistance:E=0}){f=gr(C);function $({x:T,y:V}){const{nodeLookup:M,nodeExtent:B,snapGrid:N,snapToGrid:O,nodeOrigin:I,onNodeDrag:P,onSelectionDrag:F,onError:z,updateNodePositions:j}=e();s={x:T,y:V};let R=!1;const H=l.size>1,G=H&&B?gy(hd(l)):null,U=H&&O?YW({dragItems:l,snapGrid:N,x:T,y:V}):null;for(const[se,ne]of l){if(!M.has(se))continue;let le={x:T-ne.distance.x,y:V-ne.distance.y};O&&(le=U?{x:Math.round(le.x+U.x),y:Math.round(le.y+U.y)}:pd(le,N));let Ee=null;if(H&&B&&!ne.extent&&G){const{positionAbsolute:oe}=ne.internals,ae=oe.x-G.x+B[0][0],we=oe.x+ne.measured.width-G.x2+B[1][0],$e=oe.y-G.y+B[0][1],Ve=oe.y+ne.measured.height-G.y2+B[1][1];Ee=[[ae,$e],[we,Ve]]}const{position:xe,positionAbsolute:W}=b9({nodeId:se,nextPosition:le,nodeLookup:M,nodeExtent:Ee||B,nodeOrigin:I,onError:z});R=R||ne.position.x!==xe.x||ne.position.y!==xe.y,ne.position=xe,ne.internals.positionAbsolute=W}if(m=m||R,!!R&&(j(l,!0),x&&(r||P||!k&&F))){const[se,ne]=Gg({nodeId:k,dragItems:l,nodeLookup:M});r==null||r(x,l,se,ne),P==null||P(x,se,ne),k||F==null||F(x,ne)}}async function D(){if(!c)return;const{transform:T,panBy:V,autoPanSpeed:M,autoPanOnNodeDrag:B}=e();if(!B){a=!1,cancelAnimationFrame(o);return}const[N,O]=C9(u,c,M);(N!==0||O!==0)&&(s.x=(s.x??0)-N/T[2],s.y=(s.y??0)-O/T[2],await V({x:N,y:O})&&$(s)),o=requestAnimationFrame(D)}function L(T){var H;const{nodeLookup:V,multiSelectionActive:M,nodesDraggable:B,transform:N,snapGrid:O,snapToGrid:I,selectNodesOnDrag:P,onNodeDragStart:F,onSelectionDragStart:z,unselectNodesAndEdges:j}=e();d=!0,(!P||!S)&&!M&&k&&((H=V.get(k))!=null&&H.selected||j()),S&&P&&k&&(t==null||t(k));const R=Ju(T.sourceEvent,{transform:N,snapGrid:O,snapToGrid:I,containerBounds:c});if(s=R,l=KW(V,B,R,k),l.size>0&&(n||F||!k&&z)){const[G,U]=Gg({nodeId:k,dragItems:l,nodeLookup:V});n==null||n(T.sourceEvent,l,G,U),F==null||F(T.sourceEvent,G,U),k||z==null||z(T.sourceEvent,U)}}const A=J7().clickDistance(E).on("start",T=>{const{domNode:V,nodeDragThreshold:M,transform:B,snapGrid:N,snapToGrid:O}=e();c=(V==null?void 0:V.getBoundingClientRect())||null,h=!1,m=!1,x=T.sourceEvent,M===0&&L(T),s=Ju(T.sourceEvent,{transform:B,snapGrid:N,snapToGrid:O,containerBounds:c}),u=Zr(T.sourceEvent,c)}).on("drag",T=>{const{autoPanOnNodeDrag:V,transform:M,snapGrid:B,snapToGrid:N,nodeDragThreshold:O,nodeLookup:I}=e(),P=Ju(T.sourceEvent,{transform:M,snapGrid:B,snapToGrid:N,containerBounds:c});if(x=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||k&&!I.has(k))&&(h=!0),!h){if(!a&&V&&d&&(a=!0,D()),!d){const F=Zr(T.sourceEvent,c),z=F.x-u.x,j=F.y-u.y;Math.sqrt(z*z+j*j)>O&&L(T)}(s.x!==P.xSnapped||s.y!==P.ySnapped)&&l&&d&&(u=Zr(T.sourceEvent,c),$(P))}}).on("end",T=>{if(!(!d||h)&&(a=!1,d=!1,cancelAnimationFrame(o),l.size>0)){const{nodeLookup:V,updateNodePositions:M,onNodeDragStop:B,onSelectionDragStop:N}=e();if(m&&(M(l,!1),m=!1),i||B||!k&&N){const[O,I]=Gg({nodeId:k,dragItems:l,nodeLookup:V,dragging:!1});i==null||i(T.sourceEvent,l,O,I),B==null||B(T.sourceEvent,O,I),k||N==null||N(T.sourceEvent,I)}}}).filter(T=>{const V=T.target;return!T.button&&(!y||!qw(V,`.${y}`,C))&&(!b||qw(V,b,C))});f.call(A)}function p(){f==null||f.on(".drag",null)}return{update:v,destroy:p}}function qW(t,e,n){const r=[],i={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const s of e.values())Hc(i,ja(s))>0&&r.push(s);return r}const QW=250;function ZW(t,e,n,r){var l,a;let i=[],s=1/0;const o=qW(t,n,e+QW);for(const u of o){const c=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((a=u.internals.handleBounds)==null?void 0:a.target)??[]];for(const d of c){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:f,y:h}=ol(u,d,d.position,!0),m=Math.sqrt(Math.pow(f-t.x,2)+Math.pow(h-t.y,2));m>e||(m<s?(i=[{...d,x:f,y:h}],s=m):m===s&&i.push({...d,x:f,y:h}))}}if(!i.length)return null;if(i.length>1){const u=r.type==="source"?"target":"source";return i.find(c=>c.type===u)??i[0]}return i[0]}function B9(t,e,n,r,i,s=!1){var u,c,d;const o=r.get(t);if(!o)return null;const l=i==="strict"?(u=o.internals.handleBounds)==null?void 0:u[e]:[...((c=o.internals.handleBounds)==null?void 0:c.source)??[],...((d=o.internals.handleBounds)==null?void 0:d.target)??[]],a=(n?l==null?void 0:l.find(f=>f.id===n):l==null?void 0:l[0])??null;return a&&s?{...a,...ol(o,a,a.position,!0)}:a}function O9(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function JW(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const j9=()=>!0;function eG(t,{connectionMode:e,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:o,domNode:l,nodeLookup:a,lib:u,autoPanOnConnect:c,flowId:d,panBy:f,cancelConnection:h,onConnectStart:m,onConnect:x,onConnectEnd:v,isValidConnection:p=j9,onReconnectEnd:y,updateConnection:b,getTransform:C,getFromHandle:S,autoPanSpeed:k,dragThreshold:E=1,handleDomNode:$}){const D=$9(t.target);let L=0,A;const{x:T,y:V}=Zr(t),M=O9(s,$),B=l==null?void 0:l.getBoundingClientRect();let N=!1;if(!B||!M)return;const O=B9(i,M,r,a,e);if(!O)return;let I=Zr(t,B),P=!1,F=null,z=!1,j=null;function R(){if(!c||!B)return;const[xe,W]=C9(I,B,k);f({x:xe,y:W}),L=requestAnimationFrame(R)}const H={...O,nodeId:i,type:M,position:O.position},G=a.get(i);let se={inProgress:!0,isValid:null,from:ol(G,H,Ne.Left,!0),fromHandle:H,fromPosition:H.position,fromNode:G,to:I,toHandle:null,toPosition:jw[H.position],toNode:null,pointer:I};function ne(){N=!0,b(se),m==null||m(t,{nodeId:i,handleId:r,handleType:M})}E===0&&ne();function le(xe){if(!N){const{x:Ve,y:We}=Zr(xe),ie=Ve-T,Te=We-V;if(!(ie*ie+Te*Te>E*E))return;ne()}if(!S()||!H){Ee(xe);return}const W=C();I=Zr(xe,B),A=ZW(md(I,W,!1,[1,1]),n,a,H),P||(R(),P=!0);const oe=V9(xe,{handle:A,connectionMode:e,fromNodeId:i,fromHandleId:r,fromType:o?"target":"source",isValidConnection:p,doc:D,lib:u,flowId:d,nodeLookup:a});j=oe.handleDomNode,F=oe.connection,z=JW(!!A,oe.isValid);const ae=a.get(i),we=ae?ol(ae,H,Ne.Left,!0):se.from,$e={...se,from:we,isValid:z,to:oe.toHandle&&z?mp({x:oe.toHandle.x,y:oe.toHandle.y},W):I,toHandle:oe.toHandle,toPosition:z&&oe.toHandle?oe.toHandle.position:jw[H.position],toNode:oe.toHandle?a.get(oe.toHandle.nodeId):null,pointer:I};b($e),se=$e}function Ee(xe){if(!("touches"in xe&&xe.touches.length>0)){if(N){(A||j)&&F&&z&&(x==null||x(F));const{inProgress:W,...oe}=se,ae={...oe,toPosition:se.toHandle?se.toPosition:null};v==null||v(xe,ae),s&&(y==null||y(xe,ae))}h(),cancelAnimationFrame(L),P=!1,z=!1,F=null,j=null,D.removeEventListener("mousemove",le),D.removeEventListener("mouseup",Ee),D.removeEventListener("touchmove",le),D.removeEventListener("touchend",Ee)}}D.addEventListener("mousemove",le),D.addEventListener("mouseup",Ee),D.addEventListener("touchmove",le),D.addEventListener("touchend",Ee)}function V9(t,{handle:e,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:o,lib:l,flowId:a,isValidConnection:u=j9,nodeLookup:c}){const d=s==="target",f=e?o.querySelector(`.${l}-flow__handle[data-id="${a}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:h,y:m}=Zr(t),x=o.elementFromPoint(h,m),v=x!=null&&x.classList.contains(`${l}-flow__handle`)?x:f,p={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const y=O9(void 0,v),b=v.getAttribute("data-nodeid"),C=v.getAttribute("data-handleid"),S=v.classList.contains("connectable"),k=v.classList.contains("connectableend");if(!b||!y)return p;const E={source:d?b:r,sourceHandle:d?C:i,target:d?r:b,targetHandle:d?i:C};p.connection=E;const D=S&&k&&(n===Ra.Strict?d&&y==="source"||!d&&y==="target":b!==r||C!==i);p.isValid=D&&u(E),p.toHandle=B9(b,y,C,c,n,!0)}return p}const by={onPointerDown:eG,isValid:V9};function tG({domNode:t,panZoom:e,getTransform:n,getViewScale:r}){const i=gr(t);function s({translateExtent:l,width:a,height:u,zoomStep:c=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const m=b=>{if(b.sourceEvent.type!=="wheel"||!e)return;const C=n(),S=b.sourceEvent.ctrlKey&&zc()?10:1,k=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*c,E=C[2]*Math.pow(2,k*S);e.scaleTo(E)};let x=[0,0];const v=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(x=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},p=b=>{const C=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!e)return;const S=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],k=[S[0]-x[0],S[1]-x[1]];x=S;const E=r()*Math.max(C[2],Math.log(C[2]))*(h?-1:1),$={x:C[0]-k[0]*E,y:C[1]-k[1]*E},D=[[0,0],[a,u]];e.setViewportConstrained({x:$.x,y:$.y,zoom:C[2]},D,l)},y=p9().on("start",v).on("zoom",d?p:null).on("zoom.wheel",f?m:null);i.call(y,{})}function o(){i.on("zoom",null)}return{update:s,destroy:o,pointer:Wr}}const hm=t=>({x:t.x,y:t.y,zoom:t.k}),Ug=({x:t,y:e,zoom:n})=>cm.translate(t,e).scale(n),Xl=(t,e)=>t.target.closest(`.${e}`),F9=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),nG=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,Kg=(t,e=0,n=nG,r=()=>{})=>{const i=typeof e=="number"&&e>0;return i||r(),i?t.transition().duration(e).ease(n).on("end",r):t},_9=t=>{const e=t.ctrlKey&&zc()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function rG({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:a,onPanZoomEnd:u}){return c=>{if(Xl(c,e))return c.ctrlKey&&c.preventDefault(),!1;c.preventDefault(),c.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(c.ctrlKey&&o){const v=Wr(c),p=_9(c),y=d*Math.pow(2,p);r.scaleTo(n,y,v,c);return}const f=c.deltaMode===1?20:1;let h=i===Go.Vertical?0:c.deltaX*f,m=i===Go.Horizontal?0:c.deltaY*f;!zc()&&c.shiftKey&&i!==Go.Vertical&&(h=c.deltaY*f,m=0),r.translateBy(n,-(h/d)*s,-(m/d)*s,{internal:!0});const x=hm(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(a==null||a(c,x),t.panScrollTimeout=setTimeout(()=>{u==null||u(c,x),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,l==null||l(c,x))}}function iG({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",o=!e&&s&&!r.ctrlKey,l=Xl(r,t);if(r.ctrlKey&&s&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,i)}}function sG({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return r=>{var s,o,l;if((s=r.sourceEvent)!=null&&s.internal)return;const i=hm(r.transform);t.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=i,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&e(!0),n&&(n==null||n(r.sourceEvent,i))}}function oG({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var o,l;t.usedRightMouseButton=!!(n&&F9(e,t.mouseButton??0)),(o=s.sourceEvent)!=null&&o.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!((l=s.sourceEvent)!=null&&l.internal)&&(i==null||i(s.sourceEvent,hm(s.transform)))}}function lG({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(t.isZoomingOrPanning=!1,s&&F9(e,t.mouseButton??0)&&!t.usedRightMouseButton&&o.sourceEvent&&s(o.sourceEvent),t.usedRightMouseButton=!1,r(!1),i)){const a=hm(o.transform);t.prevViewport=a,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{i==null||i(o.sourceEvent,a)},n?150:0)}}}function aG({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:o,noWheelClassName:l,noPanClassName:a,lib:u,connectionInProgress:c}){return d=>{var v;const f=t||e,h=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Xl(d,`${u}-flow__node`)||Xl(d,`${u}-flow__edge`)))return!0;if(!r&&!f&&!i&&!s&&!n||o||c&&!m||Xl(d,l)&&m||Xl(d,a)&&(!m||i&&m&&!t)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&((v=d.touches)==null?void 0:v.length)>1)return d.preventDefault(),!1;if(!f&&!i&&!h&&m||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&x}}function uG({domNode:t,minZoom:e,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:a}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},c=t.getBoundingClientRect(),d=p9().scaleExtent([e,n]).translateExtent(r),f=gr(t).call(d);y({x:i.x,y:i.y,zoom:Oa(i.zoom,e,n)},[[0,0],[c.width,c.height]],r);const h=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(_9);function x(A,T){return f?new Promise(V=>{d==null||d.interpolate((T==null?void 0:T.interpolate)==="linear"?Zu:eh).transform(Kg(f,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>V(!0)),A)}):Promise.resolve(!1)}function v({noWheelClassName:A,noPanClassName:T,onPaneContextMenu:V,userSelectionActive:M,panOnScroll:B,panOnDrag:N,panOnScrollMode:O,panOnScrollSpeed:I,preventScrolling:P,zoomOnPinch:F,zoomOnScroll:z,zoomOnDoubleClick:j,zoomActivationKeyPressed:R,lib:H,onTransformChange:G,connectionInProgress:U,paneClickDistance:se,selectionOnDrag:ne}){M&&!u.isZoomingOrPanning&&p();const le=B&&!R&&!M;d.clickDistance(ne?1/0:!Qr(se)||se<0?0:se);const Ee=le?rG({zoomPanValues:u,noWheelClassName:A,d3Selection:f,d3Zoom:d,panOnScrollMode:O,panOnScrollSpeed:I,zoomOnPinch:F,onPanZoomStart:o,onPanZoom:s,onPanZoomEnd:l}):iG({noWheelClassName:A,preventScrolling:P,d3ZoomHandler:h});if(f.on("wheel.zoom",Ee,{passive:!1}),!M){const W=sG({zoomPanValues:u,onDraggingChange:a,onPanZoomStart:o});d.on("start",W);const oe=oG({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!V,onPanZoom:s,onTransformChange:G});d.on("zoom",oe);const ae=lG({zoomPanValues:u,panOnDrag:N,panOnScroll:B,onPaneContextMenu:V,onPanZoomEnd:l,onDraggingChange:a});d.on("end",ae)}const xe=aG({zoomActivationKeyPressed:R,panOnDrag:N,zoomOnScroll:z,panOnScroll:B,zoomOnDoubleClick:j,zoomOnPinch:F,userSelectionActive:M,noPanClassName:T,noWheelClassName:A,lib:H,connectionInProgress:U});d.filter(xe),j?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function p(){d.on("zoom",null)}async function y(A,T,V){const M=Ug(A),B=d==null?void 0:d.constrain()(M,T,V);return B&&await x(B),new Promise(N=>N(B))}async function b(A,T){const V=Ug(A);return await x(V,T),new Promise(M=>M(V))}function C(A){if(f){const T=Ug(A),V=f.property("__zoom");(V.k!==A.zoom||V.x!==A.x||V.y!==A.y)&&(d==null||d.transform(f,T,null,{sync:!0}))}}function S(){const A=f?h9(f.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function k(A,T){return f?new Promise(V=>{d==null||d.interpolate((T==null?void 0:T.interpolate)==="linear"?Zu:eh).scaleTo(Kg(f,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>V(!0)),A)}):Promise.resolve(!1)}function E(A,T){return f?new Promise(V=>{d==null||d.interpolate((T==null?void 0:T.interpolate)==="linear"?Zu:eh).scaleBy(Kg(f,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>V(!0)),A)}):Promise.resolve(!1)}function $(A){d==null||d.scaleExtent(A)}function D(A){d==null||d.translateExtent(A)}function L(A){const T=!Qr(A)||A<0?0:A;d==null||d.clickDistance(T)}return{update:v,destroy:p,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:k,scaleBy:E,setScaleExtent:$,setTranslateExtent:D,syncViewport:C,setClickDistance:L}}var Fa;(function(t){t.Line="line",t.Handle="handle"})(Fa||(Fa={}));function cG({width:t,prevWidth:e,height:n,prevHeight:r,affectsX:i,affectsY:s}){const o=t-e,l=n-r,a=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&i&&(a[0]=a[0]*-1),l&&s&&(a[1]=a[1]*-1),a}function Qw(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),r=t.includes("left"),i=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:r,affectsY:i}}function gs(t,e){return Math.max(0,e-t)}function ys(t,e){return Math.max(0,t-e)}function vf(t,e,n){return Math.max(0,e-t,t-n)}function Zw(t,e){return t?!e:e}function dG(t,e,n,r,i,s,o,l){let{affectsX:a,affectsY:u}=e;const{isHorizontal:c,isVertical:d}=e,f=c&&d,{xSnapped:h,ySnapped:m}=n,{minWidth:x,maxWidth:v,minHeight:p,maxHeight:y}=r,{x:b,y:C,width:S,height:k,aspectRatio:E}=t;let $=Math.floor(c?h-t.pointerX:0),D=Math.floor(d?m-t.pointerY:0);const L=S+(a?-$:$),A=k+(u?-D:D),T=-s[0]*S,V=-s[1]*k;let M=vf(L,x,v),B=vf(A,p,y);if(o){let I=0,P=0;a&&$<0?I=gs(b+$+T,o[0][0]):!a&&$>0&&(I=ys(b+L+T,o[1][0])),u&&D<0?P=gs(C+D+V,o[0][1]):!u&&D>0&&(P=ys(C+A+V,o[1][1])),M=Math.max(M,I),B=Math.max(B,P)}if(l){let I=0,P=0;a&&$>0?I=ys(b+$,l[0][0]):!a&&$<0&&(I=gs(b+L,l[1][0])),u&&D>0?P=ys(C+D,l[0][1]):!u&&D<0&&(P=gs(C+A,l[1][1])),M=Math.max(M,I),B=Math.max(B,P)}if(i){if(c){const I=vf(L/E,p,y)*E;if(M=Math.max(M,I),o){let P=0;!a&&!u||a&&!u&&f?P=ys(C+V+L/E,o[1][1])*E:P=gs(C+V+(a?$:-$)/E,o[0][1])*E,M=Math.max(M,P)}if(l){let P=0;!a&&!u||a&&!u&&f?P=gs(C+L/E,l[1][1])*E:P=ys(C+(a?$:-$)/E,l[0][1])*E,M=Math.max(M,P)}}if(d){const I=vf(A*E,x,v)/E;if(B=Math.max(B,I),o){let P=0;!a&&!u||u&&!a&&f?P=ys(b+A*E+T,o[1][0])/E:P=gs(b+(u?D:-D)*E+T,o[0][0])/E,B=Math.max(B,P)}if(l){let P=0;!a&&!u||u&&!a&&f?P=gs(b+A*E,l[1][0])/E:P=ys(b+(u?D:-D)*E,l[0][0])/E,B=Math.max(B,P)}}}D=D+(D<0?B:-B),$=$+($<0?M:-M),i&&(f?L>A*E?D=(Zw(a,u)?-$:$)/E:$=(Zw(a,u)?-D:D)*E:c?(D=$/E,u=a):($=D*E,a=u));const N=a?b+$:b,O=u?C+D:C;return{width:S+(a?-$:$),height:k+(u?-D:D),x:s[0]*$*(a?-1:1)+N,y:s[1]*D*(u?-1:1)+O}}const H9={width:0,height:0,x:0,y:0},fG={...H9,pointerX:0,pointerY:0,aspectRatio:1};function hG(t){return[[0,0],[t.measured.width,t.measured.height]]}function pG(t,e,n){const r=e.position.x+t.position.x,i=e.position.y+t.position.y,s=t.measured.width??0,o=t.measured.height??0,l=n[0]*s,a=n[1]*o;return[[r-l,i-a],[r+s-l,i+o-a]]}function mG({domNode:t,nodeId:e,getStoreItems:n,onChange:r,onEnd:i}){const s=gr(t);let o={controlDirection:Qw("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:c,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:m,onResizeEnd:x,shouldResize:v}){let p={...H9},y={...fG};o={boundaries:c,resizeDirection:f,keepAspectRatio:d,controlDirection:Qw(u)};let b,C=null,S=[],k,E,$,D=!1;const L=J7().on("start",A=>{const{nodeLookup:T,transform:V,snapGrid:M,snapToGrid:B,nodeOrigin:N,paneDomNode:O}=n();if(b=T.get(e),!b)return;C=(O==null?void 0:O.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:P}=Ju(A.sourceEvent,{transform:V,snapGrid:M,snapToGrid:B,containerBounds:C});p={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},y={...p,pointerX:I,pointerY:P,aspectRatio:p.width/p.height},k=void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(k=T.get(b.parentId),E=k&&b.extent==="parent"?hG(k):void 0),S=[],$=void 0;for(const[F,z]of T)if(z.parentId===e&&(S.push({id:F,position:{...z.position},extent:z.extent}),z.extent==="parent"||z.expandParent)){const j=pG(z,b,z.origin??N);$?$=[[Math.min(j[0][0],$[0][0]),Math.min(j[0][1],$[0][1])],[Math.max(j[1][0],$[1][0]),Math.max(j[1][1],$[1][1])]]:$=j}h==null||h(A,{...p})}).on("drag",A=>{const{transform:T,snapGrid:V,snapToGrid:M,nodeOrigin:B}=n(),N=Ju(A.sourceEvent,{transform:T,snapGrid:V,snapToGrid:M,containerBounds:C}),O=[];if(!b)return;const{x:I,y:P,width:F,height:z}=p,j={},R=b.origin??B,{width:H,height:G,x:U,y:se}=dG(y,o.controlDirection,N,o.boundaries,o.keepAspectRatio,R,E,$),ne=H!==F,le=G!==z,Ee=U!==I&&ne,xe=se!==P&≤if(!Ee&&!xe&&!ne&&!le)return;if((Ee||xe||R[0]===1||R[1]===1)&&(j.x=Ee?U:p.x,j.y=xe?se:p.y,p.x=j.x,p.y=j.y,S.length>0)){const we=U-I,$e=se-P;for(const Ve of S)Ve.position={x:Ve.position.x-we+R[0]*(H-F),y:Ve.position.y-$e+R[1]*(G-z)},O.push(Ve)}if((ne||le)&&(j.width=ne&&(!o.resizeDirection||o.resizeDirection==="horizontal")?H:p.width,j.height=le&&(!o.resizeDirection||o.resizeDirection==="vertical")?G:p.height,p.width=j.width,p.height=j.height),k&&b.expandParent){const we=R[0]*(j.width??0);j.x&&j.x<we&&(p.x=we,y.x=y.x-(j.x-we));const $e=R[1]*(j.height??0);j.y&&j.y<$e&&(p.y=$e,y.y=y.y-(j.y-$e))}const W=cG({width:p.width,prevWidth:F,height:p.height,prevHeight:z,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),oe={...p,direction:W};(v==null?void 0:v(A,oe))!==!1&&(D=!0,m==null||m(A,oe),r(j,O))}).on("end",A=>{D&&(x==null||x(A,{...p}),i==null||i({...p}),D=!1)});s.call(L)}function a(){s.on(".drag",null)}return{update:l,destroy:a}}var z9={exports:{}},W9={},G9={exports:{}},U9={};/**
|
|
149
|
+
* @license React
|
|
150
|
+
* use-sync-external-store-shim.production.js
|
|
151
|
+
*
|
|
152
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the MIT license found in the
|
|
155
|
+
* LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/var _a=w;function gG(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var yG=typeof Object.is=="function"?Object.is:gG,xG=_a.useState,vG=_a.useEffect,bG=_a.useLayoutEffect,wG=_a.useDebugValue;function CG(t,e){var n=e(),r=xG({inst:{value:n,getSnapshot:e}}),i=r[0].inst,s=r[1];return bG(function(){i.value=n,i.getSnapshot=e,Yg(i)&&s({inst:i})},[t,n,e]),vG(function(){return Yg(i)&&s({inst:i}),t(function(){Yg(i)&&s({inst:i})})},[t]),wG(n),n}function Yg(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!yG(t,n)}catch{return!0}}function kG(t,e){return e()}var SG=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?kG:CG;U9.useSyncExternalStore=_a.useSyncExternalStore!==void 0?_a.useSyncExternalStore:SG;G9.exports=U9;var EG=G9.exports;/**
|
|
157
|
+
* @license React
|
|
158
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
159
|
+
*
|
|
160
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
161
|
+
*
|
|
162
|
+
* This source code is licensed under the MIT license found in the
|
|
163
|
+
* LICENSE file in the root directory of this source tree.
|
|
164
|
+
*/var pm=w,$G=EG;function MG(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var DG=typeof Object.is=="function"?Object.is:MG,NG=$G.useSyncExternalStore,AG=pm.useRef,TG=pm.useEffect,PG=pm.useMemo,LG=pm.useDebugValue;W9.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var s=AG(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=PG(function(){function a(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&o.hasValue){var m=o.value;if(i(m,h))return d=m}return d=h}if(m=d,DG(c,h))return m;var x=r(h);return i!==void 0&&i(m,x)?(c=h,m):(c=h,d=x)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return a(e())},f===null?void 0:function(){return a(f())}]},[e,n,r,i]);var l=NG(t,s[0],s[1]);return TG(function(){o.hasValue=!0,o.value=l},[l]),LG(l),l};z9.exports=W9;var IG=z9.exports;const RG=oC(IG),BG={},Jw=t=>{let e;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(e):c;if(!Object.is(f,e)){const h=e;e=d??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(m=>m(e,h))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>u,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(BG?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=e=t(r,i,a);return a},OG=t=>t?Jw(t):Jw,{useDebugValue:jG}=be,{useSyncExternalStoreWithSelector:VG}=RG,FG=t=>t;function K9(t,e=FG,n){const r=VG(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return jG(r),r}const e2=(t,e)=>{const n=OG(t),r=(i,s=e)=>K9(n,i,s);return Object.assign(r,n),r},_G=(t,e)=>t?e2(t,e):e2;function kt(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,i]of t)if(!Object.is(i,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}const mm=w.createContext(null),HG=mm.Provider,Y9=Ti.error001();function Ue(t,e){const n=w.useContext(mm);if(n===null)throw new Error(Y9);return K9(n,t,e)}function vt(){const t=w.useContext(mm);if(t===null)throw new Error(Y9);return w.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const t2={display:"none"},zG={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},X9="react-flow__node-desc",q9="react-flow__edge-desc",WG="react-flow__aria-live",GG=t=>t.ariaLiveMessage,UG=t=>t.ariaLabelConfig;function KG({rfId:t}){const e=Ue(GG);return g.jsx("div",{id:`${WG}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:zG,children:e})}function YG({rfId:t,disableKeyboardA11y:e}){const n=Ue(UG);return g.jsxs(g.Fragment,{children:[g.jsx("div",{id:`${X9}-${t}`,style:t2,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),g.jsx("div",{id:`${q9}-${t}`,style:t2,children:n["edge.a11yDescription.default"]}),!e&&g.jsx(KG,{rfId:t})]})}const gm=w.forwardRef(({position:t="top-left",children:e,className:n,style:r,...i},s)=>{const o=`${t}`.split("-");return g.jsx("div",{className:Jt(["react-flow__panel",n,...o]),style:r,ref:s,...i,children:e})});gm.displayName="Panel";function XG({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:g.jsx(gm,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:g.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const qG=t=>{const e=[],n=[];for(const[,r]of t.nodeLookup)r.selected&&e.push(r.internals.userNode);for(const[,r]of t.edgeLookup)r.selected&&n.push(r);return{selectedNodes:e,selectedEdges:n}},bf=t=>t.id;function QG(t,e){return kt(t.selectedNodes.map(bf),e.selectedNodes.map(bf))&&kt(t.selectedEdges.map(bf),e.selectedEdges.map(bf))}function ZG({onSelectionChange:t}){const e=vt(),{selectedNodes:n,selectedEdges:r}=Ue(qG,QG);return w.useEffect(()=>{const i={nodes:n,edges:r};t==null||t(i),e.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,t]),null}const JG=t=>!!t.onSelectionChangeHandlers;function eU({onSelectionChange:t}){const e=Ue(JG);return t||e?g.jsx(ZG,{onSelectionChange:t}):null}const Q9=[0,0],tU={x:0,y:0,zoom:1},nU=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],n2=[...nU,"rfId"],rU=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),r2={translateExtent:_c,nodeOrigin:Q9,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function iU(t){const{setNodes:e,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:a}=Ue(rU,kt),u=vt();w.useEffect(()=>(a(t.defaultNodes,t.defaultEdges),()=>{c.current=r2,l()}),[]);const c=w.useRef(r2);return w.useEffect(()=>{for(const d of n2){const f=t[d],h=c.current[d];f!==h&&(typeof t[d]>"u"||(d==="nodes"?e(f):d==="edges"?n(f):d==="minZoom"?r(f):d==="maxZoom"?i(f):d==="translateExtent"?s(f):d==="nodeExtent"?o(f):d==="ariaLabelConfig"?u.setState({ariaLabelConfig:MW(f)}):d==="fitView"?u.setState({fitViewQueued:f}):d==="fitViewOptions"?u.setState({fitViewOptions:f}):u.setState({[d]:f})))}c.current=t},n2.map(d=>t[d])),null}function i2(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function sU(t){var r;const[e,n]=w.useState(t==="system"?null:t);return w.useEffect(()=>{if(t!=="system"){n(t);return}const i=i2(),s=()=>n(i!=null&&i.matches?"dark":"light");return s(),i==null||i.addEventListener("change",s),()=>{i==null||i.removeEventListener("change",s)}},[t]),e!==null?e:(r=i2())!=null&&r.matches?"dark":"light"}const s2=typeof document<"u"?document:null;function Wc(t=null,e={target:s2,actInsideInputWithModifier:!0}){const[n,r]=w.useState(!1),i=w.useRef(!1),s=w.useRef(new Set([])),[o,l]=w.useMemo(()=>{if(t!==null){const u=(Array.isArray(t)?t:[t]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
165
|
+
`).replace(`
|
|
166
|
+
|
|
167
|
+
`,`
|
|
168
|
+
+`).split(`
|
|
169
|
+
`)),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[t]);return w.useEffect(()=>{const a=(e==null?void 0:e.target)??s2,u=(e==null?void 0:e.actInsideInputWithModifier)??!0;if(t!==null){const c=h=>{var v,p;if(i.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!i.current||i.current&&!u)&&M9(h))return!1;const x=l2(h.code,l);if(s.current.add(h[x]),o2(o,s.current,!1)){const y=((p=(v=h.composedPath)==null?void 0:v.call(h))==null?void 0:p[0])||h.target,b=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";e.preventDefault!==!1&&(i.current||!b)&&h.preventDefault(),r(!0)}},d=h=>{const m=l2(h.code,l);o2(o,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(h[m]),h.key==="Meta"&&s.current.clear(),i.current=!1},f=()=>{s.current.clear(),r(!1)};return a==null||a.addEventListener("keydown",c),a==null||a.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{a==null||a.removeEventListener("keydown",c),a==null||a.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[t,r]),n}function o2(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(i=>e.has(i)))}function l2(t,e){return e.includes(t)?"code":"key"}const oU=()=>{const t=vt();return w.useMemo(()=>({zoomIn:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,{duration:e==null?void 0:e.duration}):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,{duration:e==null?void 0:e.duration}):Promise.resolve(!1)},zoomTo:(e,n)=>{const{panZoom:r}=t.getState();return r?r.scaleTo(e,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{const{transform:[r,i,s],panZoom:o}=t.getState();return o?(await o.setViewport({x:e.x??r,y:e.y??i,zoom:e.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,n,r]=t.getState().transform;return{x:e,y:n,zoom:r}},setCenter:async(e,n,r)=>t.getState().setCenter(e,n,r),fitBounds:async(e,n)=>{const{width:r,height:i,minZoom:s,maxZoom:o,panZoom:l}=t.getState(),a=Mv(e,r,i,s,o,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(a,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,n={})=>{const{transform:r,snapGrid:i,snapToGrid:s,domNode:o}=t.getState();if(!o)return e;const{x:l,y:a}=o.getBoundingClientRect(),u={x:e.x-l,y:e.y-a},c=n.snapGrid??i,d=n.snapToGrid??s;return md(u,r,d,c)},flowToScreenPosition:e=>{const{transform:n,domNode:r}=t.getState();if(!r)return e;const{x:i,y:s}=r.getBoundingClientRect(),o=mp(e,n);return{x:o.x+i,y:o.y+s}}}),[])};function Z9(t,e){const n=[],r=new Map,i=[];for(const s of t)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const o=r.get(s.id);o?o.push(s):r.set(s.id,[s])}for(const s of e){const o=r.get(s.id);if(!o){n.push(s);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...s};for(const a of o)lU(a,l);n.push(l)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function lU(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function J9(t,e){return Z9(t,e)}function e8(t,e){return Z9(t,e)}function Eo(t,e){return{id:t,type:"select",selected:e}}function ql(t,e=new Set,n=!1){const r=[];for(const[i,s]of t){const o=e.has(i);!(s.selected===void 0&&!o)&&s.selected!==o&&(n&&(s.selected=o),r.push(Eo(s.id,o)))}return r}function a2({items:t=[],lookup:e}){var i;const n=[],r=new Map(t.map(s=>[s.id,s]));for(const[s,o]of t.entries()){const l=e.get(o.id),a=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;a!==void 0&&a!==o&&n.push({id:o.id,item:o,type:"replace"}),a===void 0&&n.push({item:o,type:"add",index:s})}for(const[s]of e)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function u2(t){return{id:t.id,type:"remove"}}const c2=t=>yW(t),aU=t=>v9(t);function t8(t){return w.forwardRef(t)}const uU=typeof window<"u"?w.useLayoutEffect:w.useEffect;function d2(t){const[e,n]=w.useState(BigInt(0)),[r]=w.useState(()=>cU(()=>n(i=>i+BigInt(1))));return uU(()=>{const i=r.get();i.length&&(t(i),r.reset())},[e]),r}function cU(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:n=>{e.push(n),t()}}}const n8=w.createContext(null);function dU({children:t}){const e=vt(),n=w.useCallback(l=>{const{nodes:a=[],setNodes:u,hasDefaultNodes:c,onNodesChange:d,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:m}=e.getState();let x=a;for(const p of l)x=typeof p=="function"?p(x):p;let v=a2({items:x,lookup:f});for(const p of m.values())v=p(v);c&&u(x),v.length>0?d==null||d(v):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:p,nodes:y,setNodes:b}=e.getState();p&&b(y)})},[]),r=d2(n),i=w.useCallback(l=>{const{edges:a=[],setEdges:u,hasDefaultEdges:c,onEdgesChange:d,edgeLookup:f}=e.getState();let h=a;for(const m of l)h=typeof m=="function"?m(h):m;c?u(h):d&&d(a2({items:h,lookup:f}))},[]),s=d2(i),o=w.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return g.jsx(n8.Provider,{value:o,children:t})}function fU(){const t=w.useContext(n8);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const hU=t=>!!t.panZoom;function ym(){const t=oU(),e=vt(),n=fU(),r=Ue(hU),i=w.useMemo(()=>{const s=d=>e.getState().nodeLookup.get(d),o=d=>{n.nodeQueue.push(d)},l=d=>{n.edgeQueue.push(d)},a=d=>{var p,y;const{nodeLookup:f,nodeOrigin:h}=e.getState(),m=c2(d)?d:f.get(d.id),x=m.parentId?E9(m.position,m.measured,m.parentId,f,h):m.position,v={...m,position:x,width:((p=m.measured)==null?void 0:p.width)??m.width,height:((y=m.measured)==null?void 0:y.height)??m.height};return ja(v)},u=(d,f,h={replace:!1})=>{o(m=>m.map(x=>{if(x.id===d){const v=typeof f=="function"?f(x):f;return h.replace&&c2(v)?v:{...x,...v}}return x}))},c=(d,f,h={replace:!1})=>{l(m=>m.map(x=>{if(x.id===d){const v=typeof f=="function"?f(x):f;return h.replace&&aU(v)?v:{...x,...v}}return x}))};return{getNodes:()=>e.getState().nodes.map(d=>({...d})),getNode:d=>{var f;return(f=s(d))==null?void 0:f.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:d=[]}=e.getState();return d.map(f=>({...f}))},getEdge:d=>e.getState().edgeLookup.get(d),setNodes:o,setEdges:l,addNodes:d=>{const f=Array.isArray(d)?d:[d];n.nodeQueue.push(h=>[...h,...f])},addEdges:d=>{const f=Array.isArray(d)?d:[d];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:d=[],edges:f=[],transform:h}=e.getState(),[m,x,v]=h;return{nodes:d.map(p=>({...p})),edges:f.map(p=>({...p})),viewport:{x:m,y:x,zoom:v}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{const{nodes:h,edges:m,onNodesDelete:x,onEdgesDelete:v,triggerNodeChanges:p,triggerEdgeChanges:y,onDelete:b,onBeforeDelete:C}=e.getState(),{nodes:S,edges:k}=await CW({nodesToRemove:d,edgesToRemove:f,nodes:h,edges:m,onBeforeDelete:C}),E=k.length>0,$=S.length>0;if(E){const D=k.map(u2);v==null||v(k),y(D)}if($){const D=S.map(u2);x==null||x(S),p(D)}return($||E)&&(b==null||b({nodes:S,edges:k})),{deletedNodes:S,deletedEdges:k}},getIntersectingNodes:(d,f=!0,h)=>{const m=Fw(d),x=m?d:a(d),v=h!==void 0;return x?(h||e.getState().nodes).filter(p=>{const y=e.getState().nodeLookup.get(p.id);if(y&&!m&&(p.id===d.id||!y.internals.positionAbsolute))return!1;const b=ja(v?p:y),C=Hc(b,x);return f&&C>0||C>=b.width*b.height||C>=x.width*x.height}):[]},isNodeIntersecting:(d,f,h=!0)=>{const x=Fw(d)?d:a(d);if(!x)return!1;const v=Hc(x,f);return h&&v>0||v>=f.width*f.height||v>=x.width*x.height},updateNode:u,updateNodeData:(d,f,h={replace:!1})=>{u(d,m=>{const x=typeof f=="function"?f(m):f;return h.replace?{...m,data:x}:{...m,data:{...m.data,...x}}},h)},updateEdge:c,updateEdgeData:(d,f,h={replace:!1})=>{c(d,m=>{const x=typeof f=="function"?f(m):f;return h.replace?{...m,data:x}:{...m,data:{...m.data,...x}}},h)},getNodesBounds:d=>{const{nodeLookup:f,nodeOrigin:h}=e.getState();return xW(d,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:d,id:f,nodeId:h})=>{var m;return Array.from(((m=e.getState().connectionLookup.get(`${h}-${d}${f?`-${f}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:d,handleId:f,nodeId:h})=>{var m;return Array.from(((m=e.getState().connectionLookup.get(`${h}${d?f?`-${d}-${f}`:`-${d}`:""}`))==null?void 0:m.values())??[])},fitView:async d=>{const f=e.getState().fitViewResolver??$W();return e.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return w.useMemo(()=>({...i,...t,viewportInitialized:r}),[r])}const f2=t=>t.selected,pU=typeof window<"u"?window:void 0;function mU({deleteKeyCode:t,multiSelectionKeyCode:e}){const n=vt(),{deleteElements:r}=ym(),i=Wc(t,{actInsideInputWithModifier:!1}),s=Wc(e,{target:pU});w.useEffect(()=>{if(i){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(f2),edges:o.filter(f2)}),n.setState({nodesSelectionActive:!1})}},[i]),w.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function gU(t){const e=vt();w.useEffect(()=>{const n=()=>{var i,s,o,l;if(!t.current||!(((s=(i=t.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const r=Dv(t.current);(r.height===0||r.width===0)&&((l=(o=e.getState()).onError)==null||l.call(o,"004",Ti.error004())),e.setState({width:r.width||500,height:r.height||500})};if(t.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(t.current),()=>{window.removeEventListener("resize",n),r&&t.current&&r.unobserve(t.current)}}},[])}const xm={position:"absolute",width:"100%",height:"100%",top:0,left:0},yU=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function xU({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=Go.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:a,translateExtent:u,minZoom:c,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:h=!0,children:m,noWheelClassName:x,noPanClassName:v,onViewportChange:p,isControlledViewport:y,paneClickDistance:b,selectionOnDrag:C}){const S=vt(),k=w.useRef(null),{userSelectionActive:E,lib:$,connectionInProgress:D}=Ue(yU,kt),L=Wc(f),A=w.useRef();gU(k);const T=w.useCallback(V=>{p==null||p({x:V[0],y:V[1],zoom:V[2]}),y||S.setState({transform:V})},[p,y]);return w.useEffect(()=>{if(k.current){A.current=uG({domNode:k.current,minZoom:c,maxZoom:d,translateExtent:u,viewport:a,onDraggingChange:N=>S.setState(O=>O.paneDragging===N?O:{paneDragging:N}),onPanZoomStart:(N,O)=>{const{onViewportChangeStart:I,onMoveStart:P}=S.getState();P==null||P(N,O),I==null||I(O)},onPanZoom:(N,O)=>{const{onViewportChange:I,onMove:P}=S.getState();P==null||P(N,O),I==null||I(O)},onPanZoomEnd:(N,O)=>{const{onViewportChangeEnd:I,onMoveEnd:P}=S.getState();P==null||P(N,O),I==null||I(O)}});const{x:V,y:M,zoom:B}=A.current.getViewport();return S.setState({panZoom:A.current,transform:[V,M,B],domNode:k.current.closest(".react-flow")}),()=>{var N;(N=A.current)==null||N.destroy()}}},[]),w.useEffect(()=>{var V;(V=A.current)==null||V.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:L,preventScrolling:h,noPanClassName:v,userSelectionActive:E,noWheelClassName:x,lib:$,onTransformChange:T,connectionInProgress:D,selectionOnDrag:C,paneClickDistance:b})},[t,e,n,r,i,s,o,l,L,h,v,E,x,$,T,D,C,b]),g.jsx("div",{className:"react-flow__renderer",ref:k,style:xm,children:m})}const vU=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function bU(){const{userSelectionActive:t,userSelectionRect:e}=Ue(vU,kt);return t&&e?g.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const Xg=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},wU=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function CU({isSelecting:t,selectionKeyPressed:e,selectionMode:n=Ba.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:o,onSelectionEnd:l,onPaneClick:a,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:h,children:m}){const x=vt(),{userSelectionActive:v,elementsSelectable:p,dragging:y,connectionInProgress:b}=Ue(wU,kt),C=p&&(t||v),S=w.useRef(null),k=w.useRef(),E=w.useRef(new Set),$=w.useRef(new Set),D=w.useRef(!1),L=I=>{if(D.current||b){D.current=!1;return}a==null||a(I),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},A=I=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){I.preventDefault();return}u==null||u(I)},T=c?I=>c(I):void 0,V=I=>{D.current&&(I.stopPropagation(),D.current=!1)},M=I=>{var G,U;const{domNode:P}=x.getState();if(k.current=P==null?void 0:P.getBoundingClientRect(),!k.current)return;const F=I.target===S.current;if(!F&&!!I.target.closest(".nokey")||!t||!(s&&F||e)||I.button!==0||!I.isPrimary)return;(U=(G=I.target)==null?void 0:G.setPointerCapture)==null||U.call(G,I.pointerId),D.current=!1;const{x:R,y:H}=Zr(I.nativeEvent,k.current);x.setState({userSelectionRect:{width:0,height:0,startX:R,startY:H,x:R,y:H}}),F||(I.stopPropagation(),I.preventDefault())},B=I=>{const{userSelectionRect:P,transform:F,nodeLookup:z,edgeLookup:j,connectionLookup:R,triggerNodeChanges:H,triggerEdgeChanges:G,defaultEdgeOptions:U,resetSelectedElements:se}=x.getState();if(!k.current||!P)return;const{x:ne,y:le}=Zr(I.nativeEvent,k.current),{startX:Ee,startY:xe}=P;if(!D.current){const $e=e?0:i;if(Math.hypot(ne-Ee,le-xe)<=$e)return;se(),o==null||o(I)}D.current=!0;const W={startX:Ee,startY:xe,x:ne<Ee?ne:Ee,y:le<xe?le:xe,width:Math.abs(ne-Ee),height:Math.abs(le-xe)},oe=E.current,ae=$.current;E.current=new Set($v(z,W,F,n===Ba.Partial,!0).map($e=>$e.id)),$.current=new Set;const we=(U==null?void 0:U.selectable)??!0;for(const $e of E.current){const Ve=R.get($e);if(Ve)for(const{edgeId:We}of Ve.values()){const ie=j.get(We);ie&&(ie.selectable??we)&&$.current.add(We)}}if(!_w(oe,E.current)){const $e=ql(z,E.current,!0);H($e)}if(!_w(ae,$.current)){const $e=ql(j,$.current);G($e)}x.setState({userSelectionRect:W,userSelectionActive:!0,nodesSelectionActive:!1})},N=I=>{var P,F;I.button===0&&((F=(P=I.target)==null?void 0:P.releasePointerCapture)==null||F.call(P,I.pointerId),!v&&I.target===S.current&&x.getState().userSelectionRect&&(L==null||L(I)),x.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(l==null||l(I),x.setState({nodesSelectionActive:E.current.size>0})))},O=r===!0||Array.isArray(r)&&r.includes(0);return g.jsxs("div",{className:Jt(["react-flow__pane",{draggable:O,dragging:y,selection:t}]),onClick:C?void 0:Xg(L,S),onContextMenu:Xg(A,S),onWheel:Xg(T,S),onPointerEnter:C?void 0:d,onPointerMove:C?B:f,onPointerUp:C?N:void 0,onPointerDownCapture:C?M:void 0,onClickCapture:C?V:void 0,onPointerLeave:h,ref:S,style:xm,children:[m,g.jsx(bU,{})]})}function wy({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:o,nodeLookup:l,onError:a}=e.getState(),u=l.get(t);if(!u){a==null||a("012",Ti.error012(t));return}e.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([t])}function r8({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:o}){const l=vt(),[a,u]=w.useState(!1),c=w.useRef();return w.useEffect(()=>{c.current=XW({getStoreItems:()=>l.getState(),onNodeMouseDown:d=>{wy({id:d,store:l,nodeRef:t})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),w.useEffect(()=>{if(!(e||!t.current||!c.current))return c.current.update({noDragClassName:n,handleSelector:r,domNode:t.current,isSelectable:s,nodeId:i,nodeClickDistance:o}),()=>{var d;(d=c.current)==null||d.destroy()}},[n,r,e,s,t,i,o]),a}const kU=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function i8(){const t=vt();return w.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:o,onError:l,updateNodePositions:a,nodeLookup:u,nodeOrigin:c}=t.getState(),d=new Map,f=kU(o),h=i?s[0]:5,m=i?s[1]:5,x=n.direction.x*h*n.factor,v=n.direction.y*m*n.factor;for(const[,p]of u){if(!f(p))continue;let y={x:p.internals.positionAbsolute.x+x,y:p.internals.positionAbsolute.y+v};i&&(y=pd(y,s));const{position:b,positionAbsolute:C}=b9({nodeId:p.id,nextPosition:y,nodeLookup:u,nodeExtent:r,nodeOrigin:c,onError:l});p.position=b,p.internals.positionAbsolute=C,d.set(p.id,p)}a(d)},[])}const Rv=w.createContext(null),SU=Rv.Provider;Rv.Consumer;const s8=()=>w.useContext(Rv),EU=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),$U=(t,e,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:o}=r,{fromHandle:l,toHandle:a,isValid:u}=o,c=(a==null?void 0:a.nodeId)===t&&(a==null?void 0:a.id)===e&&(a==null?void 0:a.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===t&&(l==null?void 0:l.id)===e&&(l==null?void 0:l.type)===n,connectingTo:c,clickConnecting:(i==null?void 0:i.nodeId)===t&&(i==null?void 0:i.id)===e&&(i==null?void 0:i.type)===n,isPossibleEndHandle:s===Ra.Strict?(l==null?void 0:l.type)!==n:t!==(l==null?void 0:l.nodeId)||e!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:c&&u}};function MU({type:t="source",position:e=Ne.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:o,onConnect:l,children:a,className:u,onMouseDown:c,onTouchStart:d,...f},h){var B,N;const m=o||null,x=t==="target",v=vt(),p=s8(),{connectOnClick:y,noPanClassName:b,rfId:C}=Ue(EU,kt),{connectingFrom:S,connectingTo:k,clickConnecting:E,isPossibleEndHandle:$,connectionInProcess:D,clickConnectionInProcess:L,valid:A}=Ue($U(p,m,t),kt);p||(N=(B=v.getState()).onError)==null||N.call(B,"010",Ti.error010());const T=O=>{const{defaultEdgeOptions:I,onConnect:P,hasDefaultEdges:F}=v.getState(),z={...I,...O};if(F){const{edges:j,setEdges:R}=v.getState();R(LW(z,j))}P==null||P(z),l==null||l(z)},V=O=>{if(!p)return;const I=D9(O.nativeEvent);if(i&&(I&&O.button===0||!I)){const P=v.getState();by.onPointerDown(O.nativeEvent,{handleDomNode:O.currentTarget,autoPanOnConnect:P.autoPanOnConnect,connectionMode:P.connectionMode,connectionRadius:P.connectionRadius,domNode:P.domNode,nodeLookup:P.nodeLookup,lib:P.lib,isTarget:x,handleId:m,nodeId:p,flowId:P.rfId,panBy:P.panBy,cancelConnection:P.cancelConnection,onConnectStart:P.onConnectStart,onConnectEnd:(...F)=>{var z,j;return(j=(z=v.getState()).onConnectEnd)==null?void 0:j.call(z,...F)},updateConnection:P.updateConnection,onConnect:T,isValidConnection:n||((...F)=>{var z,j;return((j=(z=v.getState()).isValidConnection)==null?void 0:j.call(z,...F))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:P.autoPanSpeed,dragThreshold:P.connectionDragThreshold})}I?c==null||c(O):d==null||d(O)},M=O=>{const{onClickConnectStart:I,onClickConnectEnd:P,connectionClickStartHandle:F,connectionMode:z,isValidConnection:j,lib:R,rfId:H,nodeLookup:G,connection:U}=v.getState();if(!p||!F&&!i)return;if(!F){I==null||I(O.nativeEvent,{nodeId:p,handleId:m,handleType:t}),v.setState({connectionClickStartHandle:{nodeId:p,type:t,id:m}});return}const se=$9(O.target),ne=n||j,{connection:le,isValid:Ee}=by.isValid(O.nativeEvent,{handle:{nodeId:p,id:m,type:t},connectionMode:z,fromNodeId:F.nodeId,fromHandleId:F.id||null,fromType:F.type,isValidConnection:ne,flowId:H,doc:se,lib:R,nodeLookup:G});Ee&&le&&T(le);const xe=structuredClone(U);delete xe.inProgress,xe.toPosition=xe.toHandle?xe.toHandle.position:null,P==null||P(O,xe),v.setState({connectionClickStartHandle:null})};return g.jsx("div",{"data-handleid":m,"data-nodeid":p,"data-handlepos":e,"data-id":`${C}-${p}-${m}-${t}`,className:Jt(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",b,u,{source:!x,target:x,connectable:r,connectablestart:i,connectableend:s,clickconnecting:E,connectingfrom:S,connectingto:k,valid:A,connectionindicator:r&&(!D||$)&&(D||L?s:i)}]),onMouseDown:V,onTouchStart:V,onClick:y?M:void 0,ref:h,...f,children:a})}const Gc=w.memo(t8(MU));function DU({data:t,isConnectable:e,sourcePosition:n=Ne.Bottom}){return g.jsxs(g.Fragment,{children:[t==null?void 0:t.label,g.jsx(Gc,{type:"source",position:n,isConnectable:e})]})}function NU({data:t,isConnectable:e,targetPosition:n=Ne.Top,sourcePosition:r=Ne.Bottom}){return g.jsxs(g.Fragment,{children:[g.jsx(Gc,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,g.jsx(Gc,{type:"source",position:r,isConnectable:e})]})}function AU(){return null}function TU({data:t,isConnectable:e,targetPosition:n=Ne.Top}){return g.jsxs(g.Fragment,{children:[g.jsx(Gc,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label]})}const gp={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},h2={input:DU,default:NU,output:TU,group:AU};function PU(t){var e,n,r,i;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((e=t.style)==null?void 0:e.width),height:t.height??t.initialHeight??((n=t.style)==null?void 0:n.height)}:{width:t.width??((r=t.style)==null?void 0:r.width),height:t.height??((i=t.style)==null?void 0:i.height)}}const LU=t=>{const{width:e,height:n,x:r,y:i}=hd(t.nodeLookup,{filter:s=>!!s.selected});return{width:Qr(e)?e:null,height:Qr(n)?n:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${r}px,${i}px)`}};function IU({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=vt(),{width:i,height:s,transformString:o,userSelectionActive:l}=Ue(LU,kt),a=i8(),u=w.useRef(null);w.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const c=!l&&i!==null&&s!==null;if(r8({nodeRef:u,disabled:!c}),!c)return null;const d=t?h=>{const m=r.getState().nodes.filter(x=>x.selected);t(h,m)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(gp,h.key)&&(h.preventDefault(),a({direction:gp[h.key],factor:h.shiftKey?4:1}))};return g.jsx("div",{className:Jt(["react-flow__nodesselection","react-flow__container",e]),style:{transform:o},children:g.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:i,height:s}})})}const p2=typeof window<"u"?window:void 0,RU=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function o8({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:a,selectionKeyCode:u,selectionOnDrag:c,selectionMode:d,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:m,panActivationKeyCode:x,zoomActivationKeyCode:v,elementsSelectable:p,zoomOnScroll:y,zoomOnPinch:b,panOnScroll:C,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:E,panOnDrag:$,defaultViewport:D,translateExtent:L,minZoom:A,maxZoom:T,preventScrolling:V,onSelectionContextMenu:M,noWheelClassName:B,noPanClassName:N,disableKeyboardA11y:O,onViewportChange:I,isControlledViewport:P}){const{nodesSelectionActive:F,userSelectionActive:z}=Ue(RU,kt),j=Wc(u,{target:p2}),R=Wc(x,{target:p2}),H=R||$,G=R||C,U=c&&H!==!0,se=j||z||U;return mU({deleteKeyCode:a,multiSelectionKeyCode:m}),g.jsx(xU,{onPaneContextMenu:s,elementsSelectable:p,zoomOnScroll:y,zoomOnPinch:b,panOnScroll:G,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:E,panOnDrag:!j&&H,defaultViewport:D,translateExtent:L,minZoom:A,maxZoom:T,zoomActivationKeyCode:v,preventScrolling:V,noWheelClassName:B,noPanClassName:N,onViewportChange:I,isControlledViewport:P,paneClickDistance:l,selectionOnDrag:U,children:g.jsxs(CU,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,panOnDrag:H,isSelecting:!!se,selectionMode:d,selectionKeyPressed:j,paneClickDistance:l,selectionOnDrag:U,children:[t,F&&g.jsx(IU,{onSelectionContextMenu:M,noPanClassName:N,disableKeyboardA11y:O})]})})}o8.displayName="FlowRenderer";const BU=w.memo(o8),OU=t=>e=>t?$v(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(n=>n.id):Array.from(e.nodeLookup.keys());function jU(t){return Ue(w.useCallback(OU(t),[t]),kt)}const VU=t=>t.updateNodeInternals;function FU(){const t=Ue(VU),[e]=w.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),t(r)}));return w.useEffect(()=>()=>{e==null||e.disconnect()},[e]),e}function _U({node:t,nodeType:e,hasDimensions:n,resizeObserver:r}){const i=vt(),s=w.useRef(null),o=w.useRef(null),l=w.useRef(t.sourcePosition),a=w.useRef(t.targetPosition),u=w.useRef(e),c=n&&!!t.internals.handleBounds;return w.useEffect(()=>{s.current&&!t.hidden&&(!c||o.current!==s.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(s.current),o.current=s.current)},[c,t.hidden]),w.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),w.useEffect(()=>{if(s.current){const d=u.current!==e,f=l.current!==t.sourcePosition,h=a.current!==t.targetPosition;(d||f||h)&&(u.current=e,l.current=t.sourcePosition,a.current=t.targetPosition,i.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:s.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),s}function HU({id:t,onClick:e,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:o,nodesDraggable:l,elementsSelectable:a,nodesConnectable:u,nodesFocusable:c,resizeObserver:d,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:m,rfId:x,nodeTypes:v,nodeClickDistance:p,onError:y}){const{node:b,internals:C,isParent:S}=Ue(ne=>{const le=ne.nodeLookup.get(t),Ee=ne.parentLookup.has(t);return{node:le,internals:le.internals,isParent:Ee}},kt);let k=b.type||"default",E=(v==null?void 0:v[k])||h2[k];E===void 0&&(y==null||y("003",Ti.error003(k)),k="default",E=(v==null?void 0:v.default)||h2.default);const $=!!(b.draggable||l&&typeof b.draggable>"u"),D=!!(b.selectable||a&&typeof b.selectable>"u"),L=!!(b.connectable||u&&typeof b.connectable>"u"),A=!!(b.focusable||c&&typeof b.focusable>"u"),T=vt(),V=S9(b),M=_U({node:b,nodeType:k,hasDimensions:V,resizeObserver:d}),B=r8({nodeRef:M,disabled:b.hidden||!$,noDragClassName:f,handleSelector:b.dragHandle,nodeId:t,isSelectable:D,nodeClickDistance:p}),N=i8();if(b.hidden)return null;const O=ds(b),I=PU(b),P=D||$||e||n||r||i,F=n?ne=>n(ne,{...C.userNode}):void 0,z=r?ne=>r(ne,{...C.userNode}):void 0,j=i?ne=>i(ne,{...C.userNode}):void 0,R=s?ne=>s(ne,{...C.userNode}):void 0,H=o?ne=>o(ne,{...C.userNode}):void 0,G=ne=>{const{selectNodesOnDrag:le,nodeDragThreshold:Ee}=T.getState();D&&(!le||!$||Ee>0)&&wy({id:t,store:T,nodeRef:M}),e&&e(ne,{...C.userNode})},U=ne=>{if(!(M9(ne.nativeEvent)||m)){if(m9.includes(ne.key)&&D){const le=ne.key==="Escape";wy({id:t,store:T,unselect:le,nodeRef:M})}else if($&&b.selected&&Object.prototype.hasOwnProperty.call(gp,ne.key)){ne.preventDefault();const{ariaLabelConfig:le}=T.getState();T.setState({ariaLiveMessage:le["node.a11yDescription.ariaLiveMessage"]({direction:ne.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),N({direction:gp[ne.key],factor:ne.shiftKey?4:1})}}},se=()=>{var ae;if(m||!((ae=M.current)!=null&&ae.matches(":focus-visible")))return;const{transform:ne,width:le,height:Ee,autoPanOnNodeFocus:xe,setCenter:W}=T.getState();if(!xe)return;$v(new Map([[t,b]]),{x:0,y:0,width:le,height:Ee},ne,!0).length>0||W(b.position.x+O.width/2,b.position.y+O.height/2,{zoom:ne[2]})};return g.jsx("div",{className:Jt(["react-flow__node",`react-flow__node-${k}`,{[h]:$},b.className,{selected:b.selected,selectable:D,parent:S,draggable:$,dragging:B}]),ref:M,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:P?"all":"none",visibility:V?"visible":"hidden",...b.style,...I},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:F,onMouseMove:z,onMouseLeave:j,onContextMenu:R,onClick:G,onDoubleClick:H,onKeyDown:A?U:void 0,tabIndex:A?0:void 0,onFocus:A?se:void 0,role:b.ariaRole??(A?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${X9}-${x}`,"aria-label":b.ariaLabel,...b.domAttributes,children:g.jsx(SU,{value:t,children:g.jsx(E,{id:t,data:b.data,type:k,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:b.selected??!1,selectable:D,draggable:$,deletable:b.deletable??!0,isConnectable:L,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:B,dragHandle:b.dragHandle,zIndex:C.z,parentId:b.parentId,...O})})})}var zU=w.memo(HU);const WU=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function l8(t){const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=Ue(WU,kt),o=jU(t.onlyRenderVisibleElements),l=FU();return g.jsx("div",{className:"react-flow__nodes",style:xm,children:o.map(a=>g.jsx(zU,{id:a,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:l,nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:t.nodeClickDistance,onError:s},a))})}l8.displayName="NodeRenderer";const GU=w.memo(l8);function UU(t){return Ue(w.useCallback(n=>{if(!t)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),o=n.nodeLookup.get(i.target);s&&o&&AW({sourceNode:s,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[t]),kt)}const KU=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t}};return g.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},YU=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t,fill:t}};return g.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},m2={[hp.Arrow]:KU,[hp.ArrowClosed]:YU};function XU(t){const e=vt();return w.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(m2,t)?m2[t]:((s=(i=e.getState()).onError)==null||s.call(i,"009",Ti.error009(t)),null)},[t])}const qU=({id:t,type:e,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const a=XU(e);return a?g.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:g.jsx(a,{color:n,strokeWidth:o})}):null},a8=({defaultColor:t,rfId:e})=>{const n=Ue(s=>s.edges),r=Ue(s=>s.defaultEdgeOptions),i=w.useMemo(()=>jW(n,{id:e,defaultColor:t,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,e,t]);return i.length?g.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:g.jsx("defs",{children:i.map(s=>g.jsx(qU,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};a8.displayName="MarkerDefinitions";var QU=w.memo(a8);function u8({x:t,y:e,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:a,className:u,...c}){const[d,f]=w.useState({x:1,y:0,width:0,height:0}),h=Jt(["react-flow__edge-textwrapper",u]),m=w.useRef(null);return w.useEffect(()=>{if(m.current){const x=m.current.getBBox();f({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?g.jsxs("g",{transform:`translate(${t-d.width/2} ${e-d.height/2})`,className:h,visibility:d.width?"visible":"hidden",...c,children:[i&&g.jsx("rect",{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),g.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:m,style:r,children:n}),a]}):null}u8.displayName="EdgeText";const ZU=w.memo(u8);function vm({path:t,labelX:e,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:a,interactionWidth:u=20,...c}){return g.jsxs(g.Fragment,{children:[g.jsx("path",{...c,d:t,fill:"none",className:Jt(["react-flow__edge-path",c.className])}),u?g.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Qr(e)&&Qr(n)?g.jsx(ZU,{x:e,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:a}):null]})}function g2({pos:t,x1:e,y1:n,x2:r,y2:i}){return t===Ne.Left||t===Ne.Right?[.5*(e+r),n]:[e,.5*(n+i)]}function c8({sourceX:t,sourceY:e,sourcePosition:n=Ne.Bottom,targetX:r,targetY:i,targetPosition:s=Ne.Top}){const[o,l]=g2({pos:n,x1:t,y1:e,x2:r,y2:i}),[a,u]=g2({pos:s,x1:r,y1:i,x2:t,y2:e}),[c,d,f,h]=N9({sourceX:t,sourceY:e,targetX:r,targetY:i,sourceControlX:o,sourceControlY:l,targetControlX:a,targetControlY:u});return[`M${t},${e} C${o},${l} ${a},${u} ${r},${i}`,c,d,f,h]}function d8(t){return w.memo(({id:e,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o,targetPosition:l,label:a,labelStyle:u,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:m,markerEnd:x,markerStart:v,interactionWidth:p})=>{const[y,b,C]=c8({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:l}),S=t.isInternal?void 0:e;return g.jsx(vm,{id:S,path:y,labelX:b,labelY:C,label:a,labelStyle:u,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:m,markerEnd:x,markerStart:v,interactionWidth:p})})}const JU=d8({isInternal:!1}),f8=d8({isInternal:!0});JU.displayName="SimpleBezierEdge";f8.displayName="SimpleBezierEdgeInternal";function h8(t){return w.memo(({id:e,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,sourcePosition:h=Ne.Bottom,targetPosition:m=Ne.Top,markerEnd:x,markerStart:v,pathOptions:p,interactionWidth:y})=>{const[b,C,S]=yy({sourceX:n,sourceY:r,sourcePosition:h,targetX:i,targetY:s,targetPosition:m,borderRadius:p==null?void 0:p.borderRadius,offset:p==null?void 0:p.offset,stepPosition:p==null?void 0:p.stepPosition}),k=t.isInternal?void 0:e;return g.jsx(vm,{id:k,path:b,labelX:C,labelY:S,label:o,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:x,markerStart:v,interactionWidth:y})})}const p8=h8({isInternal:!1}),m8=h8({isInternal:!0});p8.displayName="SmoothStepEdge";m8.displayName="SmoothStepEdgeInternal";function g8(t){return w.memo(({id:e,...n})=>{var i;const r=t.isInternal?void 0:e;return g.jsx(p8,{...n,id:r,pathOptions:w.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const eK=g8({isInternal:!1}),y8=g8({isInternal:!0});eK.displayName="StepEdge";y8.displayName="StepEdgeInternal";function x8(t){return w.memo(({id:e,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:m,interactionWidth:x})=>{const[v,p,y]=T9({sourceX:n,sourceY:r,targetX:i,targetY:s}),b=t.isInternal?void 0:e;return g.jsx(vm,{id:b,path:v,labelX:p,labelY:y,label:o,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:m,interactionWidth:x})})}const tK=x8({isInternal:!1}),v8=x8({isInternal:!0});tK.displayName="StraightEdge";v8.displayName="StraightEdgeInternal";function b8(t){return w.memo(({id:e,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o=Ne.Bottom,targetPosition:l=Ne.Top,label:a,labelStyle:u,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:m,markerEnd:x,markerStart:v,pathOptions:p,interactionWidth:y})=>{const[b,C,S]=Nv({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:l,curvature:p==null?void 0:p.curvature}),k=t.isInternal?void 0:e;return g.jsx(vm,{id:k,path:b,labelX:C,labelY:S,label:a,labelStyle:u,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:m,markerEnd:x,markerStart:v,interactionWidth:y})})}const nK=b8({isInternal:!1}),w8=b8({isInternal:!0});nK.displayName="BezierEdge";w8.displayName="BezierEdgeInternal";const y2={default:w8,straight:v8,step:y8,smoothstep:m8,simplebezier:f8},x2={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},rK=(t,e,n)=>n===Ne.Left?t-e:n===Ne.Right?t+e:t,iK=(t,e,n)=>n===Ne.Top?t-e:n===Ne.Bottom?t+e:t,v2="react-flow__edgeupdater";function b2({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:o,type:l}){return g.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:o,className:Jt([v2,`${v2}-${l}`]),cx:rK(e,r,t),cy:iK(n,r,t),r,stroke:"transparent",fill:"transparent"})}function sK({isReconnectable:t,reconnectRadius:e,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:o,sourcePosition:l,targetPosition:a,onReconnect:u,onReconnectStart:c,onReconnectEnd:d,setReconnecting:f,setUpdateHover:h}){const m=vt(),x=(C,S)=>{if(C.button!==0)return;const{autoPanOnConnect:k,domNode:E,connectionMode:$,connectionRadius:D,lib:L,onConnectStart:A,cancelConnection:T,nodeLookup:V,rfId:M,panBy:B,updateConnection:N}=m.getState(),O=S.type==="target",I=(z,j)=>{f(!1),d==null||d(z,n,S.type,j)},P=z=>u==null?void 0:u(n,z),F=(z,j)=>{f(!0),c==null||c(C,n,S.type),A==null||A(z,j)};by.onPointerDown(C.nativeEvent,{autoPanOnConnect:k,connectionMode:$,connectionRadius:D,domNode:E,handleId:S.id,nodeId:S.nodeId,nodeLookup:V,isTarget:O,edgeUpdaterType:S.type,lib:L,flowId:M,cancelConnection:T,panBy:B,isValidConnection:(...z)=>{var j,R;return((R=(j=m.getState()).isValidConnection)==null?void 0:R.call(j,...z))??!0},onConnect:P,onConnectStart:F,onConnectEnd:(...z)=>{var j,R;return(R=(j=m.getState()).onConnectEnd)==null?void 0:R.call(j,...z)},onReconnectEnd:I,updateConnection:N,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},v=C=>x(C,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),p=C=>x(C,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),y=()=>h(!0),b=()=>h(!1);return g.jsxs(g.Fragment,{children:[(t===!0||t==="source")&&g.jsx(b2,{position:l,centerX:r,centerY:i,radius:e,onMouseDown:v,onMouseEnter:y,onMouseOut:b,type:"source"}),(t===!0||t==="target")&&g.jsx(b2,{position:a,centerX:s,centerY:o,radius:e,onMouseDown:p,onMouseEnter:y,onMouseOut:b,type:"target"})]})}function oK({id:t,edgesFocusable:e,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:o,onMouseEnter:l,onMouseMove:a,onMouseLeave:u,reconnectRadius:c,onReconnect:d,onReconnectStart:f,onReconnectEnd:h,rfId:m,edgeTypes:x,noPanClassName:v,onError:p,disableKeyboardA11y:y}){let b=Ue(W=>W.edgeLookup.get(t));const C=Ue(W=>W.defaultEdgeOptions);b=C?{...C,...b}:b;let S=b.type||"default",k=(x==null?void 0:x[S])||y2[S];k===void 0&&(p==null||p("011",Ti.error011(S)),S="default",k=(x==null?void 0:x.default)||y2.default);const E=!!(b.focusable||e&&typeof b.focusable>"u"),$=typeof d<"u"&&(b.reconnectable||n&&typeof b.reconnectable>"u"),D=!!(b.selectable||r&&typeof b.selectable>"u"),L=w.useRef(null),[A,T]=w.useState(!1),[V,M]=w.useState(!1),B=vt(),{zIndex:N,sourceX:O,sourceY:I,targetX:P,targetY:F,sourcePosition:z,targetPosition:j}=Ue(w.useCallback(W=>{const oe=W.nodeLookup.get(b.source),ae=W.nodeLookup.get(b.target);if(!oe||!ae)return{zIndex:b.zIndex,...x2};const we=OW({id:t,sourceNode:oe,targetNode:ae,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:W.connectionMode,onError:p});return{zIndex:NW({selected:b.selected,zIndex:b.zIndex,sourceNode:oe,targetNode:ae,elevateOnSelect:W.elevateEdgesOnSelect,zIndexMode:W.zIndexMode}),...we||x2}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex]),kt),R=w.useMemo(()=>b.markerStart?`url('#${xy(b.markerStart,m)}')`:void 0,[b.markerStart,m]),H=w.useMemo(()=>b.markerEnd?`url('#${xy(b.markerEnd,m)}')`:void 0,[b.markerEnd,m]);if(b.hidden||O===null||I===null||P===null||F===null)return null;const G=W=>{var $e;const{addSelectedEdges:oe,unselectNodesAndEdges:ae,multiSelectionActive:we}=B.getState();D&&(B.setState({nodesSelectionActive:!1}),b.selected&&we?(ae({nodes:[],edges:[b]}),($e=L.current)==null||$e.blur()):oe([t])),i&&i(W,b)},U=s?W=>{s(W,{...b})}:void 0,se=o?W=>{o(W,{...b})}:void 0,ne=l?W=>{l(W,{...b})}:void 0,le=a?W=>{a(W,{...b})}:void 0,Ee=u?W=>{u(W,{...b})}:void 0,xe=W=>{var oe;if(!y&&m9.includes(W.key)&&D){const{unselectNodesAndEdges:ae,addSelectedEdges:we}=B.getState();W.key==="Escape"?((oe=L.current)==null||oe.blur(),ae({edges:[b]})):we([t])}};return g.jsx("svg",{style:{zIndex:N},children:g.jsxs("g",{className:Jt(["react-flow__edge",`react-flow__edge-${S}`,b.className,v,{selected:b.selected,animated:b.animated,inactive:!D&&!i,updating:A,selectable:D}]),onClick:G,onDoubleClick:U,onContextMenu:se,onMouseEnter:ne,onMouseMove:le,onMouseLeave:Ee,onKeyDown:E?xe:void 0,tabIndex:E?0:void 0,role:b.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":E?`${q9}-${m}`:void 0,ref:L,...b.domAttributes,children:[!V&&g.jsx(k,{id:t,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:D,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:O,sourceY:I,targetX:P,targetY:F,sourcePosition:z,targetPosition:j,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:R,markerEnd:H,pathOptions:"pathOptions"in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),$&&g.jsx(sK,{edge:b,isReconnectable:$,reconnectRadius:c,onReconnect:d,onReconnectStart:f,onReconnectEnd:h,sourceX:O,sourceY:I,targetX:P,targetY:F,sourcePosition:z,targetPosition:j,setUpdateHover:T,setReconnecting:M})]})})}var lK=w.memo(oK);const aK=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function C8({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:a,onEdgeMouseLeave:u,onEdgeClick:c,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:m,disableKeyboardA11y:x}){const{edgesFocusable:v,edgesReconnectable:p,elementsSelectable:y,onError:b}=Ue(aK,kt),C=UU(e);return g.jsxs("div",{className:"react-flow__edges",children:[g.jsx(QU,{defaultColor:t,rfId:n}),C.map(S=>g.jsx(lK,{id:S,edgesFocusable:v,edgesReconnectable:p,elementsSelectable:y,noPanClassName:i,onReconnect:s,onContextMenu:o,onMouseEnter:l,onMouseMove:a,onMouseLeave:u,onClick:c,reconnectRadius:d,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:x},S))]})}C8.displayName="EdgeRenderer";const uK=w.memo(C8),cK=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function dK({children:t}){const e=Ue(cK);return g.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function fK(t){const e=ym(),n=w.useRef(!1);w.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const hK=t=>{var e;return(e=t.panZoom)==null?void 0:e.syncViewport};function pK(t){const e=Ue(hK),n=vt();return w.useEffect(()=>{t&&(e==null||e(t),n.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function mK(t){return t.connection.inProgress?{...t.connection,to:md(t.connection.to,t.transform)}:{...t.connection}}function gK(t){return mK}function yK(t){const e=gK();return Ue(e,kt)}const xK=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function vK({containerStyle:t,style:e,type:n,component:r}){const{nodesConnectable:i,width:s,height:o,isValid:l,inProgress:a}=Ue(xK,kt);return!(s&&i&&a)?null:g.jsx("svg",{style:t,width:s,height:o,className:"react-flow__connectionline react-flow__container",children:g.jsx("g",{className:Jt(["react-flow__connection",x9(l)]),children:g.jsx(k8,{style:e,type:n,CustomComponent:r,isValid:l})})})}const k8=({style:t,type:e=Ds.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:o,fromHandle:l,fromPosition:a,to:u,toNode:c,toHandle:d,toPosition:f,pointer:h}=yK();if(!i)return;if(n)return g.jsx(n,{connectionLineType:e,connectionLineStyle:t,fromNode:o,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:a,toPosition:f,connectionStatus:x9(r),toNode:c,toHandle:d,pointer:h});let m="";const x={sourceX:s.x,sourceY:s.y,sourcePosition:a,targetX:u.x,targetY:u.y,targetPosition:f};switch(e){case Ds.Bezier:[m]=Nv(x);break;case Ds.SimpleBezier:[m]=c8(x);break;case Ds.Step:[m]=yy({...x,borderRadius:0});break;case Ds.SmoothStep:[m]=yy(x);break;default:[m]=T9(x)}return g.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:t})};k8.displayName="ConnectionLine";const bK={};function w2(t=bK){w.useRef(t),vt(),w.useEffect(()=>{},[t])}function wK(){vt(),w.useRef(!1),w.useEffect(()=>{},[])}function S8({nodeTypes:t,edgeTypes:e,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:a,onNodeMouseLeave:u,onNodeContextMenu:c,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:h,connectionLineType:m,connectionLineStyle:x,connectionLineComponent:v,connectionLineContainerStyle:p,selectionKeyCode:y,selectionOnDrag:b,selectionMode:C,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:E,deleteKeyCode:$,onlyRenderVisibleElements:D,elementsSelectable:L,defaultViewport:A,translateExtent:T,minZoom:V,maxZoom:M,preventScrolling:B,defaultMarkerColor:N,zoomOnScroll:O,zoomOnPinch:I,panOnScroll:P,panOnScrollSpeed:F,panOnScrollMode:z,zoomOnDoubleClick:j,panOnDrag:R,onPaneClick:H,onPaneMouseEnter:G,onPaneMouseMove:U,onPaneMouseLeave:se,onPaneScroll:ne,onPaneContextMenu:le,paneClickDistance:Ee,nodeClickDistance:xe,onEdgeContextMenu:W,onEdgeMouseEnter:oe,onEdgeMouseMove:ae,onEdgeMouseLeave:we,reconnectRadius:$e,onReconnect:Ve,onReconnectStart:We,onReconnectEnd:ie,noDragClassName:Te,noWheelClassName:Ke,noPanClassName:rt,disableKeyboardA11y:te,nodeExtent:ce,rfId:K,viewport:X,onViewportChange:re}){return w2(t),w2(e),wK(),fK(n),pK(X),g.jsx(BU,{onPaneClick:H,onPaneMouseEnter:G,onPaneMouseMove:U,onPaneMouseLeave:se,onPaneContextMenu:le,onPaneScroll:ne,paneClickDistance:Ee,deleteKeyCode:$,selectionKeyCode:y,selectionOnDrag:b,selectionMode:C,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:E,elementsSelectable:L,zoomOnScroll:O,zoomOnPinch:I,zoomOnDoubleClick:j,panOnScroll:P,panOnScrollSpeed:F,panOnScrollMode:z,panOnDrag:R,defaultViewport:A,translateExtent:T,minZoom:V,maxZoom:M,onSelectionContextMenu:d,preventScrolling:B,noDragClassName:Te,noWheelClassName:Ke,noPanClassName:rt,disableKeyboardA11y:te,onViewportChange:re,isControlledViewport:!!X,children:g.jsxs(dK,{children:[g.jsx(uK,{edgeTypes:e,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:Ve,onReconnectStart:We,onReconnectEnd:ie,onlyRenderVisibleElements:D,onEdgeContextMenu:W,onEdgeMouseEnter:oe,onEdgeMouseMove:ae,onEdgeMouseLeave:we,reconnectRadius:$e,defaultMarkerColor:N,noPanClassName:rt,disableKeyboardA11y:te,rfId:K}),g.jsx(vK,{style:x,type:m,component:v,containerStyle:p}),g.jsx("div",{className:"react-flow__edgelabel-renderer"}),g.jsx(GU,{nodeTypes:t,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:a,onNodeMouseLeave:u,onNodeContextMenu:c,nodeClickDistance:xe,onlyRenderVisibleElements:D,noPanClassName:rt,noDragClassName:Te,disableKeyboardA11y:te,nodeExtent:ce,rfId:K}),g.jsx("div",{className:"react-flow__viewport-portal"})]})})}S8.displayName="GraphView";const CK=w.memo(S8),C2=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,fitViewOptions:l,minZoom:a=.5,maxZoom:u=2,nodeOrigin:c,nodeExtent:d,zIndexMode:f="basic"}={})=>{const h=new Map,m=new Map,x=new Map,v=new Map,p=r??e??[],y=n??t??[],b=c??[0,0],C=d??_c;I9(x,v,p);const S=vy(y,h,m,{nodeOrigin:b,nodeExtent:C,zIndexMode:f});let k=[0,0,1];if(o&&i&&s){const E=hd(h,{filter:A=>!!((A.width||A.initialWidth)&&(A.height||A.initialHeight))}),{x:$,y:D,zoom:L}=Mv(E,i,s,a,u,(l==null?void 0:l.padding)??.1);k=[$,D,L]}return{rfId:"1",width:i??0,height:s??0,transform:k,nodes:y,nodesInitialized:S,nodeLookup:h,parentLookup:m,edges:p,edgeLookup:v,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:a,maxZoom:u,translateExtent:_c,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ra.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...y9},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:kW,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:g9,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},kK=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,fitViewOptions:l,minZoom:a,maxZoom:u,nodeOrigin:c,nodeExtent:d,zIndexMode:f})=>_G((h,m)=>{async function x(){const{nodeLookup:v,panZoom:p,fitViewOptions:y,fitViewResolver:b,width:C,height:S,minZoom:k,maxZoom:E}=m();p&&(await wW({nodes:v,width:C,height:S,panZoom:p,minZoom:k,maxZoom:E},y),b==null||b.resolve(!0),h({fitViewResolver:null}))}return{...C2({nodes:t,edges:e,width:i,height:s,fitView:o,fitViewOptions:l,minZoom:a,maxZoom:u,nodeOrigin:c,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:v=>{const{nodeLookup:p,parentLookup:y,nodeOrigin:b,elevateNodesOnSelect:C,fitViewQueued:S,zIndexMode:k}=m(),E=vy(v,p,y,{nodeOrigin:b,nodeExtent:d,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:k});S&&E?(x(),h({nodes:v,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:v,nodesInitialized:E})},setEdges:v=>{const{connectionLookup:p,edgeLookup:y}=m();I9(p,y,v),h({edges:v})},setDefaultNodesAndEdges:(v,p)=>{if(v){const{setNodes:y}=m();y(v),h({hasDefaultNodes:!0})}if(p){const{setEdges:y}=m();y(p),h({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:p,nodeLookup:y,parentLookup:b,domNode:C,nodeOrigin:S,nodeExtent:k,debug:E,fitViewQueued:$,zIndexMode:D}=m(),{changes:L,updatedInternals:A}=GW(v,y,b,C,S,k,D);A&&(_W(y,b,{nodeOrigin:S,nodeExtent:k,zIndexMode:D}),$?(x(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(L==null?void 0:L.length)>0&&(E&&console.log("React Flow: trigger node changes",L),p==null||p(L)))},updateNodePositions:(v,p=!1)=>{const y=[];let b=[];const{nodeLookup:C,triggerNodeChanges:S,connection:k,updateConnection:E,onNodesChangeMiddlewareMap:$}=m();for(const[D,L]of v){const A=C.get(D),T=!!(A!=null&&A.expandParent&&(A!=null&&A.parentId)&&(L!=null&&L.position)),V={id:D,type:"position",position:T?{x:Math.max(0,L.position.x),y:Math.max(0,L.position.y)}:L.position,dragging:p};if(A&&k.inProgress&&k.fromNode.id===A.id){const M=ol(A,k.fromHandle,Ne.Left,!0);E({...k,from:M})}T&&A.parentId&&y.push({id:D,parentId:A.parentId,rect:{...L.internals.positionAbsolute,width:L.measured.width??0,height:L.measured.height??0}}),b.push(V)}if(y.length>0){const{parentLookup:D,nodeOrigin:L}=m(),A=Iv(y,C,D,L);b.push(...A)}for(const D of $.values())b=D(b);S(b)},triggerNodeChanges:v=>{const{onNodesChange:p,setNodes:y,nodes:b,hasDefaultNodes:C,debug:S}=m();if(v!=null&&v.length){if(C){const k=J9(v,b);y(k)}S&&console.log("React Flow: trigger node changes",v),p==null||p(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:p,setEdges:y,edges:b,hasDefaultEdges:C,debug:S}=m();if(v!=null&&v.length){if(C){const k=e8(v,b);y(k)}S&&console.log("React Flow: trigger edge changes",v),p==null||p(v)}},addSelectedNodes:v=>{const{multiSelectionActive:p,edgeLookup:y,nodeLookup:b,triggerNodeChanges:C,triggerEdgeChanges:S}=m();if(p){const k=v.map(E=>Eo(E,!0));C(k);return}C(ql(b,new Set([...v]),!0)),S(ql(y))},addSelectedEdges:v=>{const{multiSelectionActive:p,edgeLookup:y,nodeLookup:b,triggerNodeChanges:C,triggerEdgeChanges:S}=m();if(p){const k=v.map(E=>Eo(E,!0));S(k);return}S(ql(y,new Set([...v]))),C(ql(b,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:p}={})=>{const{edges:y,nodes:b,nodeLookup:C,triggerNodeChanges:S,triggerEdgeChanges:k}=m(),E=v||b,$=p||y,D=[];for(const A of E){if(!A.selected)continue;const T=C.get(A.id);T&&(T.selected=!1),D.push(Eo(A.id,!1))}const L=[];for(const A of $)A.selected&&L.push(Eo(A.id,!1));S(D),k(L)},setMinZoom:v=>{const{panZoom:p,maxZoom:y}=m();p==null||p.setScaleExtent([v,y]),h({minZoom:v})},setMaxZoom:v=>{const{panZoom:p,minZoom:y}=m();p==null||p.setScaleExtent([y,v]),h({maxZoom:v})},setTranslateExtent:v=>{var p;(p=m().panZoom)==null||p.setTranslateExtent(v),h({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:p,triggerNodeChanges:y,triggerEdgeChanges:b,elementsSelectable:C}=m();if(!C)return;const S=p.reduce((E,$)=>$.selected?[...E,Eo($.id,!1)]:E,[]),k=v.reduce((E,$)=>$.selected?[...E,Eo($.id,!1)]:E,[]);y(S),b(k)},setNodeExtent:v=>{const{nodes:p,nodeLookup:y,parentLookup:b,nodeOrigin:C,elevateNodesOnSelect:S,nodeExtent:k,zIndexMode:E}=m();v[0][0]===k[0][0]&&v[0][1]===k[0][1]&&v[1][0]===k[1][0]&&v[1][1]===k[1][1]||(vy(p,y,b,{nodeOrigin:C,nodeExtent:v,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:E}),h({nodeExtent:v}))},panBy:v=>{const{transform:p,width:y,height:b,panZoom:C,translateExtent:S}=m();return UW({delta:v,panZoom:C,transform:p,translateExtent:S,width:y,height:b})},setCenter:async(v,p,y)=>{const{width:b,height:C,maxZoom:S,panZoom:k}=m();if(!k)return Promise.resolve(!1);const E=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:S;return await k.setViewport({x:b/2-v*E,y:C/2-p*E,zoom:E},{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...y9}})},updateConnection:v=>{h({connection:v})},reset:()=>h({...C2()})}},Object.is);function E8({initialNodes:t,initialEdges:e,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:a,fitView:u,nodeOrigin:c,nodeExtent:d,zIndexMode:f,children:h}){const[m]=w.useState(()=>kK({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:u,minZoom:o,maxZoom:l,fitViewOptions:a,nodeOrigin:c,nodeExtent:d,zIndexMode:f}));return g.jsx(HG,{value:m,children:g.jsx(dU,{children:h})})}function SK({children:t,nodes:e,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:o,fitView:l,fitViewOptions:a,minZoom:u,maxZoom:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}){return w.useContext(mm)?g.jsx(g.Fragment,{children:t}):g.jsx(E8,{initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:o,fitView:l,initialFitViewOptions:a,initialMinZoom:u,initialMaxZoom:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:t})}const EK={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function $K({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:o,onNodeClick:l,onEdgeClick:a,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:m,onConnectEnd:x,onClickConnectStart:v,onClickConnectEnd:p,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:C,onNodeContextMenu:S,onNodeDoubleClick:k,onNodeDragStart:E,onNodeDrag:$,onNodeDragStop:D,onNodesDelete:L,onEdgesDelete:A,onDelete:T,onSelectionChange:V,onSelectionDragStart:M,onSelectionDrag:B,onSelectionDragStop:N,onSelectionContextMenu:O,onSelectionStart:I,onSelectionEnd:P,onBeforeDelete:F,connectionMode:z,connectionLineType:j=Ds.Bezier,connectionLineStyle:R,connectionLineComponent:H,connectionLineContainerStyle:G,deleteKeyCode:U="Backspace",selectionKeyCode:se="Shift",selectionOnDrag:ne=!1,selectionMode:le=Ba.Full,panActivationKeyCode:Ee="Space",multiSelectionKeyCode:xe=zc()?"Meta":"Control",zoomActivationKeyCode:W=zc()?"Meta":"Control",snapToGrid:oe,snapGrid:ae,onlyRenderVisibleElements:we=!1,selectNodesOnDrag:$e,nodesDraggable:Ve,autoPanOnNodeFocus:We,nodesConnectable:ie,nodesFocusable:Te,nodeOrigin:Ke=Q9,edgesFocusable:rt,edgesReconnectable:te,elementsSelectable:ce=!0,defaultViewport:K=tU,minZoom:X=.5,maxZoom:re=2,translateExtent:he=_c,preventScrolling:De=!0,nodeExtent:je,defaultMarkerColor:Lt="#b1b1b7",zoomOnScroll:ht=!0,zoomOnPinch:en=!0,panOnScroll:Le=!1,panOnScrollSpeed:ut=.5,panOnScrollMode:Je=Go.Free,zoomOnDoubleClick:Kt=!0,panOnDrag:St=!0,onPaneClick:Et,onPaneMouseEnter:dn,onPaneMouseMove:ze,onPaneMouseLeave:pt,onPaneScroll:Oi,onPaneContextMenu:ji,paneClickDistance:ai=1,nodeClickDistance:hs=0,children:Vi,onReconnect:Fi,onReconnectStart:ho,onReconnectEnd:po,onEdgeContextMenu:ui,onEdgeDoubleClick:xl,onEdgeMouseEnter:ci,onEdgeMouseMove:Ft,onEdgeMouseLeave:$t,reconnectRadius:Mt=10,onNodesChange:fn,onEdgesChange:Yt,noDragClassName:ps="nodrag",noWheelClassName:Sr="nowheel",noPanClassName:vl="nopan",fitView:bl,fitViewOptions:wl,connectOnClick:xd,attributionPosition:Sm,proOptions:Em,defaultEdgeOptions:$m,elevateNodesOnSelect:Ja=!0,elevateEdgesOnSelect:vd=!1,disableKeyboardA11y:mo=!1,autoPanOnConnect:eu,autoPanOnNodeDrag:Mm,autoPanSpeed:Dm,connectionRadius:tu,isValidConnection:Nm,onError:nu,style:bd,id:wd,nodeDragThreshold:_,connectionDragThreshold:Q,viewport:Y,onViewportChange:Z,width:ye,height:fe,colorMode:Qe="light",debug:Dt,onScroll:Ze,ariaLabelConfig:bt,zIndexMode:_t="basic",...ur},hn){const Ht=wd||"1",Wn=sU(Qe),zt=w.useCallback(Ie=>{Ie.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ze==null||Ze(Ie)},[Ze]);return g.jsx("div",{"data-testid":"rf__wrapper",...ur,onScroll:zt,style:{...bd,...EK},ref:hn,className:Jt(["react-flow",i,Wn]),id:wd,role:"application",children:g.jsxs(SK,{nodes:t,edges:e,width:ye,height:fe,fitView:bl,fitViewOptions:wl,minZoom:X,maxZoom:re,nodeOrigin:Ke,nodeExtent:je,zIndexMode:_t,children:[g.jsx(CK,{onInit:u,onNodeClick:l,onEdgeClick:a,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:C,onNodeContextMenu:S,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:o,connectionLineType:j,connectionLineStyle:R,connectionLineComponent:H,connectionLineContainerStyle:G,selectionKeyCode:se,selectionOnDrag:ne,selectionMode:le,deleteKeyCode:U,multiSelectionKeyCode:xe,panActivationKeyCode:Ee,zoomActivationKeyCode:W,onlyRenderVisibleElements:we,defaultViewport:K,translateExtent:he,minZoom:X,maxZoom:re,preventScrolling:De,zoomOnScroll:ht,zoomOnPinch:en,zoomOnDoubleClick:Kt,panOnScroll:Le,panOnScrollSpeed:ut,panOnScrollMode:Je,panOnDrag:St,onPaneClick:Et,onPaneMouseEnter:dn,onPaneMouseMove:ze,onPaneMouseLeave:pt,onPaneScroll:Oi,onPaneContextMenu:ji,paneClickDistance:ai,nodeClickDistance:hs,onSelectionContextMenu:O,onSelectionStart:I,onSelectionEnd:P,onReconnect:Fi,onReconnectStart:ho,onReconnectEnd:po,onEdgeContextMenu:ui,onEdgeDoubleClick:xl,onEdgeMouseEnter:ci,onEdgeMouseMove:Ft,onEdgeMouseLeave:$t,reconnectRadius:Mt,defaultMarkerColor:Lt,noDragClassName:ps,noWheelClassName:Sr,noPanClassName:vl,rfId:Ht,disableKeyboardA11y:mo,nodeExtent:je,viewport:Y,onViewportChange:Z}),g.jsx(iU,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:m,onConnectEnd:x,onClickConnectStart:v,onClickConnectEnd:p,nodesDraggable:Ve,autoPanOnNodeFocus:We,nodesConnectable:ie,nodesFocusable:Te,edgesFocusable:rt,edgesReconnectable:te,elementsSelectable:ce,elevateNodesOnSelect:Ja,elevateEdgesOnSelect:vd,minZoom:X,maxZoom:re,nodeExtent:je,onNodesChange:fn,onEdgesChange:Yt,snapToGrid:oe,snapGrid:ae,connectionMode:z,translateExtent:he,connectOnClick:xd,defaultEdgeOptions:$m,fitView:bl,fitViewOptions:wl,onNodesDelete:L,onEdgesDelete:A,onDelete:T,onNodeDragStart:E,onNodeDrag:$,onNodeDragStop:D,onSelectionDrag:B,onSelectionDragStart:M,onSelectionDragStop:N,onMove:c,onMoveStart:d,onMoveEnd:f,noPanClassName:vl,nodeOrigin:Ke,rfId:Ht,autoPanOnConnect:eu,autoPanOnNodeDrag:Mm,autoPanSpeed:Dm,onError:nu,connectionRadius:tu,isValidConnection:Nm,selectNodesOnDrag:$e,nodeDragThreshold:_,connectionDragThreshold:Q,onBeforeDelete:F,debug:Dt,ariaLabelConfig:bt,zIndexMode:_t}),g.jsx(eU,{onSelectionChange:V}),Vi,g.jsx(XG,{proOptions:Em,position:Sm}),g.jsx(YG,{rfId:Ht,disableKeyboardA11y:mo})]})})}var MK=t8($K);function $8(){const t=vt();return w.useCallback(e=>{const{domNode:n,updateNodeInternals:r}=t.getState(),i=Array.isArray(e)?e:[e],s=new Map;i.forEach(o=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${o}"]`);l&&s.set(o,{id:o,nodeElement:l,force:!0})}),requestAnimationFrame(()=>r(s,{triggerFitView:!1}))},[])}function DK(t){const[e,n]=w.useState(t),r=w.useCallback(i=>n(s=>J9(i,s)),[]);return[e,n,r]}function NK(t){const[e,n]=w.useState(t),r=w.useCallback(i=>n(s=>e8(i,s)),[]);return[e,n,r]}function AK({dimensions:t,lineWidth:e,variant:n,className:r}){return g.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:Jt(["react-flow__background-pattern",n,r])})}function TK({radius:t,className:e}){return g.jsx("circle",{cx:t,cy:t,r:t,className:Jt(["react-flow__background-pattern","dots",e])})}var Ji;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Ji||(Ji={}));const PK={[Ji.Dots]:1,[Ji.Lines]:1,[Ji.Cross]:6},LK=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function M8({id:t,variant:e=Ji.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:o,bgColor:l,style:a,className:u,patternClassName:c}){const d=w.useRef(null),{transform:f,patternId:h}=Ue(LK,kt),m=r||PK[e],x=e===Ji.Dots,v=e===Ji.Cross,p=Array.isArray(n)?n:[n,n],y=[p[0]*f[2]||1,p[1]*f[2]||1],b=m*f[2],C=Array.isArray(s)?s:[s,s],S=v?[b,b]:y,k=[C[0]*f[2]||1+S[0]/2,C[1]*f[2]||1+S[1]/2],E=`${h}${t||""}`;return g.jsxs("svg",{className:Jt(["react-flow__background",u]),style:{...a,...xm,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:d,"data-testid":"rf__background",children:[g.jsx("pattern",{id:E,x:f[0]%y[0],y:f[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:x?g.jsx(TK,{radius:b/2,className:c}):g.jsx(AK,{dimensions:S,lineWidth:i,variant:e,className:c})}),g.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}M8.displayName="Background";const IK=w.memo(M8);function RK(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:g.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function BK(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:g.jsx("path",{d:"M0 0h32v4.2H0z"})})}function OK(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:g.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function jK(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:g.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function VK(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:g.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function wf({children:t,className:e,...n}){return g.jsx("button",{type:"button",className:Jt(["react-flow__controls-button",e]),...n,children:t})}const FK=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function D8({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:o,onFitView:l,onInteractiveChange:a,className:u,children:c,position:d="bottom-left",orientation:f="vertical","aria-label":h}){const m=vt(),{isInteractive:x,minZoomReached:v,maxZoomReached:p,ariaLabelConfig:y}=Ue(FK,kt),{zoomIn:b,zoomOut:C,fitView:S}=ym(),k=()=>{b(),s==null||s()},E=()=>{C(),o==null||o()},$=()=>{S(i),l==null||l()},D=()=>{m.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),a==null||a(!x)},L=f==="horizontal"?"horizontal":"vertical";return g.jsxs(gm,{className:Jt(["react-flow__controls",L,u]),position:d,style:t,"data-testid":"rf__controls","aria-label":h??y["controls.ariaLabel"],children:[e&&g.jsxs(g.Fragment,{children:[g.jsx(wf,{onClick:k,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:p,children:g.jsx(RK,{})}),g.jsx(wf,{onClick:E,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:v,children:g.jsx(BK,{})})]}),n&&g.jsx(wf,{className:"react-flow__controls-fitview",onClick:$,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:g.jsx(OK,{})}),r&&g.jsx(wf,{className:"react-flow__controls-interactive",onClick:D,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:x?g.jsx(VK,{}):g.jsx(jK,{})}),c]})}D8.displayName="Controls";const _K=w.memo(D8);function HK({id:t,x:e,y:n,width:r,height:i,style:s,color:o,strokeColor:l,strokeWidth:a,className:u,borderRadius:c,shapeRendering:d,selected:f,onClick:h}){const{background:m,backgroundColor:x}=s||{},v=o||m||x;return g.jsx("rect",{className:Jt(["react-flow__minimap-node",{selected:f},u]),x:e,y:n,rx:c,ry:c,width:r,height:i,style:{fill:v,stroke:l,strokeWidth:a},shapeRendering:d,onClick:h?p=>h(p,t):void 0})}const zK=w.memo(HK),WK=t=>t.nodes.map(e=>e.id),qg=t=>t instanceof Function?t:()=>t;function GK({nodeStrokeColor:t,nodeColor:e,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=zK,onClick:o}){const l=Ue(WK,kt),a=qg(e),u=qg(t),c=qg(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return g.jsx(g.Fragment,{children:l.map(f=>g.jsx(KK,{id:f,nodeColorFunc:a,nodeStrokeColorFunc:u,nodeClassNameFunc:c,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:o,shapeRendering:d},f))})}function UK({id:t,nodeColorFunc:e,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:o,NodeComponent:l,onClick:a}){const{node:u,x:c,y:d,width:f,height:h}=Ue(m=>{const x=m.nodeLookup.get(t);if(!x)return{node:void 0,x:0,y:0,width:0,height:0};const v=x.internals.userNode,{x:p,y}=x.internals.positionAbsolute,{width:b,height:C}=ds(v);return{node:v,x:p,y,width:b,height:C}},kt);return!u||u.hidden||!S9(u)?null:g.jsx(l,{x:c,y:d,width:f,height:h,style:u.style,selected:!!u.selected,className:r(u),color:e(u),borderRadius:i,strokeColor:n(u),strokeWidth:s,shapeRendering:o,onClick:a,id:u.id})}const KK=w.memo(UK);var YK=w.memo(GK);const XK=200,qK=150,QK=t=>!t.hidden,ZK=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?k9(hd(t.nodeLookup,{filter:QK}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},JK="react-flow__minimap-desc";function N8({style:t,className:e,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:a,maskColor:u,maskStrokeColor:c,maskStrokeWidth:d,position:f="bottom-right",onClick:h,onNodeClick:m,pannable:x=!1,zoomable:v=!1,ariaLabel:p,inversePan:y,zoomStep:b=1,offsetScale:C=5}){const S=vt(),k=w.useRef(null),{boundingRect:E,viewBB:$,rfId:D,panZoom:L,translateExtent:A,flowWidth:T,flowHeight:V,ariaLabelConfig:M}=Ue(ZK,kt),B=(t==null?void 0:t.width)??XK,N=(t==null?void 0:t.height)??qK,O=E.width/B,I=E.height/N,P=Math.max(O,I),F=P*B,z=P*N,j=C*P,R=E.x-(F-E.width)/2-j,H=E.y-(z-E.height)/2-j,G=F+j*2,U=z+j*2,se=`${JK}-${D}`,ne=w.useRef(0),le=w.useRef();ne.current=P,w.useEffect(()=>{if(k.current&&L)return le.current=tG({domNode:k.current,panZoom:L,getTransform:()=>S.getState().transform,getViewScale:()=>ne.current}),()=>{var oe;(oe=le.current)==null||oe.destroy()}},[L]),w.useEffect(()=>{var oe;(oe=le.current)==null||oe.update({translateExtent:A,width:T,height:V,inversePan:y,pannable:x,zoomStep:b,zoomable:v})},[x,v,y,b,A,T,V]);const Ee=h?oe=>{var $e;const[ae,we]=(($e=le.current)==null?void 0:$e.pointer(oe))||[0,0];h(oe,{x:ae,y:we})}:void 0,xe=m?w.useCallback((oe,ae)=>{const we=S.getState().nodeLookup.get(ae).internals.userNode;m(oe,we)},[]):void 0,W=p??M["minimap.ariaLabel"];return g.jsx(gm,{position:f,style:{...t,"--xy-minimap-background-color-props":typeof a=="string"?a:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*P:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:Jt(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:g.jsxs("svg",{width:B,height:N,viewBox:`${R} ${H} ${G} ${U}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":se,ref:k,onClick:Ee,children:[W&&g.jsx("title",{id:se,children:W}),g.jsx(YK,{onClick:xe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:l}),g.jsx("path",{className:"react-flow__minimap-mask",d:`M${R-j},${H-j}h${G+j*2}v${U+j*2}h${-G-j*2}z
|
|
170
|
+
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}N8.displayName="MiniMap";const eY=w.memo(N8),tY=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,nY={[Fa.Line]:"right",[Fa.Handle]:"bottom-right"};function rY({nodeId:t,position:e,variant:n=Fa.Handle,className:r,style:i=void 0,children:s,color:o,minWidth:l=10,minHeight:a=10,maxWidth:u=Number.MAX_VALUE,maxHeight:c=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:h=!0,shouldResize:m,onResizeStart:x,onResize:v,onResizeEnd:p}){const y=s8(),b=typeof t=="string"?t:y,C=vt(),S=w.useRef(null),k=n===Fa.Handle,E=Ue(w.useCallback(tY(k&&h),[k,h]),kt),$=w.useRef(null),D=e??nY[n];w.useEffect(()=>{if(!(!S.current||!b))return $.current||($.current=mG({domNode:S.current,nodeId:b,getStoreItems:()=>{const{nodeLookup:A,transform:T,snapGrid:V,snapToGrid:M,nodeOrigin:B,domNode:N}=C.getState();return{nodeLookup:A,transform:T,snapGrid:V,snapToGrid:M,nodeOrigin:B,paneDomNode:N}},onChange:(A,T)=>{const{triggerNodeChanges:V,nodeLookup:M,parentLookup:B,nodeOrigin:N}=C.getState(),O=[],I={x:A.x,y:A.y},P=M.get(b);if(P&&P.expandParent&&P.parentId){const F=P.origin??N,z=A.width??P.measured.width??0,j=A.height??P.measured.height??0,R={id:P.id,parentId:P.parentId,rect:{width:z,height:j,...E9({x:A.x??P.position.x,y:A.y??P.position.y},{width:z,height:j},P.parentId,M,F)}},H=Iv([R],M,B,N);O.push(...H),I.x=A.x?Math.max(F[0]*z,A.x):void 0,I.y=A.y?Math.max(F[1]*j,A.y):void 0}if(I.x!==void 0&&I.y!==void 0){const F={id:b,type:"position",position:{...I}};O.push(F)}if(A.width!==void 0&&A.height!==void 0){const z={id:b,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:A.width,height:A.height}};O.push(z)}for(const F of T){const z={...F,type:"position"};O.push(z)}V(O)},onEnd:({width:A,height:T})=>{const V={id:b,type:"dimensions",resizing:!1,dimensions:{width:A,height:T}};C.getState().triggerNodeChanges([V])}})),$.current.update({controlPosition:D,boundaries:{minWidth:l,minHeight:a,maxWidth:u,maxHeight:c},keepAspectRatio:d,resizeDirection:f,onResizeStart:x,onResize:v,onResizeEnd:p,shouldResize:m}),()=>{var A;(A=$.current)==null||A.destroy()}},[D,l,a,u,c,d,x,v,p,m]);const L=D.split("-");return g.jsx("div",{className:Jt(["react-flow__resize-control","nodrag",...L,n,r]),ref:S,style:{...i,scale:E,...o&&{[k?"backgroundColor":"borderColor"]:o}},children:s})}w.memo(rY);function iY({position:t,options:e,onPickColor:n,onReferenceColor:r,onClear:i,currentColor:s,className:o="",id:l}){const a=`bg-base border border-border rounded-lg shadow-lg py-1 min-w-[160px] ${o}`;return g.jsx("div",{id:l,className:`${a} absolute z-50`,style:{top:t.top,left:t.left},children:e?e.map((u,c)=>g.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-text bg-transparent hover:bg-base-2 transition-colors text-left",onClick:u.onClick,style:u.style,children:[u.icon&&g.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-4 h-4",children:u.icon}),g.jsx("span",{className:"flex-1",children:u.label})]},c)):g.jsxs(g.Fragment,{children:[i&&s&&g.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-text bg-transparent hover:bg-base-2 transition-colors text-left",onClick:i,children:[g.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-4 h-4",children:g.jsx(ti,{color:s})}),g.jsx("span",{className:"flex-1",children:"Clear"})]}),n&&g.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-text bg-transparent hover:bg-base-2 transition-colors text-left",onClick:n,children:[g.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-4 h-4",children:g.jsx(nd,{})}),g.jsx("span",{className:"flex-1",children:"Pick Color"})]}),r&&g.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-text bg-transparent hover:bg-base-2 transition-colors text-left",onClick:r,children:[g.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-4 h-4",children:td.COLOR}),g.jsx("span",{className:"flex-1",children:"Reference Color"})]})]})})}function sY({position:t,variableId:e,currentValue:n,onClose:r}){const{openColorPicker:i,openColorReference:s}=ar(),{collections:o,variables:l,selectedModeId:a}=Zt(),u=l.find(h=>h.id===e),c=u?Qo(o,u.collectionId,a):a,d=()=>{r(),i({initialColor:n,onConfirm:h=>{Se({type:"update-variable-value",id:e,value:Sa(h),modeId:c})}})},f=()=>{r(),s({currentVariableId:e,currentValue:n,onSelect:h=>{Se({type:"update-variable-value",id:e,value:`{${h}}`,modeId:c})}})};return g.jsx(iY,{id:"color-value-menu",position:t,onPickColor:d,onReferenceColor:f,className:"color-value-menu"})}function oY(t,e=!0){const n=w.useRef(null);return w.useEffect(()=>{if(!e)return;const r=i=>{n.current&&!n.current.contains(i.target)&&t()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[t,e]),n}const A8=w.createContext(null);function Bv(){const t=w.useContext(A8);if(!t)throw new Error("Dropdown compound components must be used within <Dropdown>");return t}function lY({children:t,defaultOpen:e=!1,onOpenChange:n,position:r="bottom-left",align:i="start",className:s=""}){const[o,l]=w.useState(e),a=w.useCallback(()=>{l(!1),n==null||n(!1)},[n]),u=w.useCallback(()=>{const d=!o;l(d),n==null||n(d)},[o,n]),c=oY(a,o);return w.useEffect(()=>{if(!o)return;const d=f=>{f.key==="Escape"&&a()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[o,a]),g.jsx(A8.Provider,{value:{isOpen:o,toggle:u,close:a,position:r,align:i},children:g.jsx("div",{className:`relative ${s}`,ref:c,children:t})})}function aY({children:t,className:e="",asChild:n=!1}){const{toggle:r}=Bv();return n&&be.isValidElement(t)?be.cloneElement(t,{onClick:i=>{var s,o;r(),(o=(s=t.props).onClick)==null||o.call(s,i)}}):g.jsx("div",{className:e,onClick:r,children:t})}function uY({children:t,className:e=""}){const{isOpen:n,position:r,align:i}=Bv();if(!n)return null;const s={"bottom-left":"top-full left-0 mt-1","bottom-right":"top-full right-0 mt-1","top-left":"bottom-full left-0 mb-1","top-right":"bottom-full right-0 mb-1"};return g.jsx("div",{className:`absolute ${s[r]} z-50 bg-base border border-border rounded-lg shadow-lg py-1 min-w-[160px] ${e}`,onMouseDown:o=>o.stopPropagation(),children:t})}function cY({onClick:t,disabled:e=!1,icon:n,children:r,className:i=""}){const{close:s}=Bv(),o=()=>{!e&&t&&(t(),s())};return g.jsxs("button",{type:"button",className:`w-full flex items-center gap-2 px-3 py-2 text-xs text-text bg-transparent hover:bg-base-2 transition-colors text-left ${e?"opacity-50 cursor-not-allowed hover:bg-transparent":""} ${i}`,onClick:o,disabled:e,children:[n&&g.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-4 h-4",children:n}),g.jsx("span",{className:"flex-1",children:r})]})}function dY(){return g.jsx("div",{className:"h-px bg-border my-1"})}const Sn=Object.assign(lY,{Trigger:aY,Menu:uY,Item:cY,Divider:dY});function Uc({type:t,position:e,id:n,isConnected:r,isDisabled:i,isConnectable:s,connectionColor:o,idleColor:l,idleBorderColor:a}){return g.jsx(Gc,{type:t,position:e,id:n,className:`w-2.5! h-2.5! rounded-full border-text/50! cursor-crosshair transition-all duration-200 hover:w-4! hover:h-4! ${r?"w-3 h-3":""} ${i?"opacity-30 cursor-not-allowed":""}`,isConnectable:s,style:{top:Lo/2,background:r?o:l,borderColor:r?o:a}})}function fY(t){return 36+Math.max(t,1)*32+8*2}function T8({title:t,headerFill:e,className:n="",children:r}){return g.jsxs("div",{className:`group-header flex items-center justify-between px-3 cursor-move select-none h-9 ${n}`,style:{background:e},children:[g.jsx("span",{className:"text-[13px] font-semibold text-text overflow-hidden text-ellipsis whitespace-nowrap",title:t,children:t}),g.jsx("div",{className:"flex gap-1 items-center",children:r})]})}function P8({data:t,showLevelUp:e=!0}){const{group:n,onHighlightPath:r,onAddVariable:i,onRenameGroup:s,onDuplicateGroup:o,onEditAsText:l,onLevelUp:a,onDeleteGroup:u}=t,c=n.kind==="standard";return n.kind==="collection"?g.jsx(On,{icon:g.jsx(tt,{name:"plus",size:20}),size:"sm",variant:"ghost","aria-label":`Add variable to ${n.title}`,onMouseDown:f=>f.stopPropagation(),onClick:f=>{f.stopPropagation(),i(n)}}):c?g.jsxs(g.Fragment,{children:[e&&n.canGroup&&n.sourceGroupName&&g.jsx(On,{icon:g.jsx(tt,{name:"collapse-all",size:18}),size:"sm",variant:"ghost","aria-label":`Group ${n.title} with its siblings`,title:"Group with siblings (level up)",onMouseDown:f=>f.stopPropagation(),onClick:f=>{f.stopPropagation(),a(n.collectionId,n.sourceGroupName)}}),g.jsx(On,{icon:g.jsx(tt,{name:"plus",size:20}),size:"sm",variant:"ghost","aria-label":`Add variable to ${n.title}`,onMouseDown:f=>f.stopPropagation(),onClick:f=>{f.stopPropagation(),i(n)}}),g.jsxs(Sn,{position:"bottom-right",children:[g.jsx(Sn.Trigger,{asChild:!0,children:g.jsx(On,{icon:g.jsx(tt,{name:"menu",size:20}),size:"sm",variant:"ghost","aria-label":`Open actions for ${n.title}`,onMouseDown:f=>f.stopPropagation(),onClick:f=>f.stopPropagation()})}),g.jsxs(Sn.Menu,{children:[g.jsx(Sn.Item,{onClick:()=>r(n),children:"Highlight path"}),g.jsx(Sn.Item,{onClick:()=>s(n),children:"Rename"}),g.jsx(Sn.Item,{onClick:()=>o(n),children:"Duplicate"}),g.jsx(Sn.Item,{onClick:()=>l(n),children:"Edit as Text"}),g.jsx(Sn.Divider,{}),g.jsx(Sn.Item,{onClick:()=>u(n),className:"text-danger hover:bg-danger hover:text-white",children:"Delete"})]})]})]}):null}function L8({data:t,showEmptyState:e=!0,keepLastBorder:n=!1}){const{group:r,connectedVars:i,isHighlighted:s,highlightActive:o,highlightedVars:l,highlightedVarSeed:a,onHighlightVariable:u,onGeneratorOpen:c,onShowColorMenu:d,onRenameVariable:f,onDeleteVariable:h}=t,m=r.kind==="collection",x=!!a&&r.variables.some(p=>p.name===a),v=e&&m&&r.variables.length===0;return r.variables.length===0&&!v?null:g.jsxs("div",{className:"bg-base py-2",children:[v&&g.jsx("div",{className:"flex items-center justify-center h-8 px-2 text-xs text-text-muted select-none",children:"No variables at the collection root"}),r.variables.map(p=>{const y=i.get(p.name),b=(y==null?void 0:y.hasInput)||!1,C=(y==null?void 0:y.hasOutput)||!1,S=(y==null?void 0:y.inputKind)==="generated"?Th:Qs,k=(y==null?void 0:y.outputKind)==="generated"?Th:Qs,E=r.kind==="shader"&&p.virtualType==="shader",$=!p.isVirtual&&(r.kind==="standard"||r.kind==="source"||m),D=(r.kind==="standard"||m)&&!p.isVirtual,L=!p.connectionsDisabled||p.virtualType==="shader",A=o&&s&&!(l!=null&&l.has(p.name)),T=o&&s&&a===p.name,V=A&&x;return g.jsxs("div",{className:`group relative flex items-center px-2 h-8 border-b border-border ${n?"":"last:border-b-0"} bg-base hover:bg-base-2 transition-[background,opacity] duration-150 cursor-pointer ${E?"bg-gradient-to-r from-base via-base-2 to-base hover:bg-base-3":""} ${V?"opacity-45 shadow-[inset_2px_0_0_rgba(236,72,153,0.45)]":A?"opacity-30":""} ${T?"bg-base-2 shadow-[inset_2px_0_0_#EC4899]":""}`,onClick:M=>{M.stopPropagation(),E?c(r,p):u(r,p)},children:[g.jsx(Uc,{type:"target",position:Ne.Left,id:`${p.name}::in`,isConnected:b,isDisabled:p.connectionsDisabled,isConnectable:!p.connectionsDisabled,connectionColor:S,idleColor:bc,idleBorderColor:vc}),p.resolvedType==="COLOR"&&!p.isVirtual&&g.jsx("div",{className:"absolute left-3.5",children:g.jsx(ti,{color:p.color,onClick:M=>{M.stopPropagation(),d(M,p)},className:"w-4.5 h-4.5 transition-all duration-150 hover:scale-115 hover:shadow-[0_2px_6px_rgba(0,0,0,0.2)]",title:"Edit color"})}),p.isVirtual&&g.jsx("span",{className:`absolute left-3.5 w-7 h-4.5 flex items-center justify-center rounded text-[10px] font-semibold uppercase border ${p.virtualType==="shader"?"bg-secondary text-white border-secondary":"bg-primary text-white border-primary"}`,children:p.virtualType==="shader"?"fx":"out"}),g.jsx("span",{className:`absolute text-xs font-medium text-text overflow-hidden text-ellipsis whitespace-nowrap max-w-30 ${$?"cursor-pointer hover:text-primary":""}`,style:{left:p.isVirtual?52:p.resolvedType==="COLOR"?42:14},onDoubleClick:$?M=>{M.stopPropagation(),f(p)}:void 0,title:$?`${p.name} (double-click to rename)`:p.name,children:p.shortName}),g.jsx("span",{className:`absolute text-[11px] font-mono overflow-hidden text-ellipsis whitespace-nowrap max-w-25 ${p.isReference?"text-text-secondary":"text-text-muted"}`,style:{right:D?42:16},title:p.displayName,children:p.displayName}),D&&g.jsx("button",{type:"button",className:"absolute right-3.5 w-5 h-5 flex items-center justify-center rounded border border-transparent bg-transparent cursor-pointer text-[16px] text-text opacity-0 group-hover:opacity-50 hover:opacity-100! hover:bg-danger hover:text-white hover:border-danger transition-all duration-150",onClick:M=>{M.stopPropagation(),h(p)},children:"×"}),L&&g.jsx(Uc,{type:"source",position:Ne.Right,id:`${p.name}::out`,isConnected:C,isDisabled:p.connectionsDisabled,isConnectable:!p.connectionsDisabled,connectionColor:k,idleColor:bc,idleBorderColor:vc})]},p.id)})]})}function hY({data:t}){const{group:e,isHighlighted:n,isDimmed:r}=t,i=fY(e.variables.length);return g.jsxs("div",{className:`rf-group-box ${e.kind==="shader"?"border-secondary":"border-text/40"} border rounded-sm bg-base h-fit! shadow-xs w-65 p-0.5 ${e.kind} transition-[opacity,box-shadow] duration-150 ${r?"opacity-55":""} ${n?"ring-1 ring-[#EC4899] ring-offset-2 ring-offset-base-2":""}`,style:{height:i},children:[g.jsx(T8,{title:e.title,headerFill:e.headerFill,children:g.jsx(P8,{data:t})}),g.jsx(L8,{data:t})]})}const pY=be.memo(hY);function mY({data:t}){const e=t.card,n=!!(e!=null&&e.isHighlighted),r=!!(e!=null&&e.isDimmed);return g.jsx("div",{className:`rf-group-outline w-full h-full rounded-sm border border-dashed p-2 ${r?"border-text/30 opacity-55":"border-text/40"} transition-[opacity,box-shadow] duration-150 ${n?"ring-1 ring-[#EC4899] ring-offset-2 ring-offset-base-2":""}`,children:g.jsxs("div",{className:"rf-group-wrapper w-full h-full rounded-sm border border-text/40 bg-base shadow-xs p-0.5",children:[g.jsxs(T8,{title:t.title,headerFill:(e==null?void 0:e.group.headerFill)??ws,className:"rounded-t-sm",children:[t.path!==""&&g.jsx(On,{icon:g.jsx(tt,{name:"collapse-all",size:18}),size:"sm",variant:"ghost","aria-label":`Group ${t.title} with its siblings`,title:"Group with siblings (level up)",onMouseDown:i=>i.stopPropagation(),onClick:i=>{i.stopPropagation(),t.onLevelUp(t.collectionId,t.path)}}),e&&g.jsx(P8,{data:e,showLevelUp:!1}),g.jsx(On,{icon:g.jsx(tt,{name:"expand-all",size:18}),size:"sm",variant:"ghost","aria-label":`Ungroup ${t.title}`,title:"Ungroup",onMouseDown:i=>i.stopPropagation(),onClick:i=>{i.stopPropagation(),t.onUngroup(t.collectionId,t.path)}})]}),e&&!t.cardHidden&&g.jsx(L8,{data:e,showEmptyState:!1,keepLastBorder:!!t.hasChildren})]})})}const gY=be.memo(mY);function yY({data:t}){const e=t.tier===1?"no dependencies":`references tier ${t.tier-1}`;return g.jsxs("div",{className:"w-full h-full flex items-end gap-2 px-1 pb-1 border-b border-border pointer-events-none select-none",children:[g.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-text/70 whitespace-nowrap",children:["Tier ",t.tier]}),g.jsx("span",{className:"text-[11px] text-text/40 overflow-hidden text-ellipsis whitespace-nowrap",children:e})]})}const xY=be.memo(yY),Cy=32,vY=36,bY=32,wY=28,CY=8,kY=380,Ov=12,SY=new Set(["COMPONENT","COMPONENT_SET","INSTANCE"]);function EY(t){return SY.has(t)}function $Y(t){const e=[],n=(r,i)=>{var s;e.push({layerIndex:e.length,depth:i,id:r.id,name:r.name,type:r.type,entries:r.entries}),(s=r.children)==null||s.forEach(o=>n(o,i+1))};return n(t,0),e}function jv(t,e){const n=e.bindingTarget;if(!n)return`${t}|label:${e.category}:${e.property}`;switch(n.kind){case"node-field":return`${t}|field:${n.field}`;case"paint":return`${t}|paint:${n.prop}:${n.index}`;case"effect":return`${t}|effect:${n.index}`}}function MY(t){return t.kind==="variable"||t.kind==="style"}function DY(t,e,n){const r=[];return t.entries.forEach((i,s)=>{(!e||MY(i)||i.isDefault!==!0||n.has(jv(t.id,i)))&&r.push(s)}),r}function NY(t,e,n,r){const i=[];return t.map(s=>{for(;i.length>0&&i[i.length-1].depth>=s.depth;)i.pop();const o=i.length>0?i[i.length-1].anchor:-1,l=s.layerIndex>0&&r.has(s.id),a=o===-1,u=o!==-1?o:l?s.layerIndex:-1;i.push({depth:s.depth,anchor:u});const c=DY(s,e,n),d=new Set(c),f=e?s.entries.map((h,m)=>!d.has(m)&&h.bindingTarget?m:-1).filter(h=>h!==-1):[];return{layer:s,visibleEntryIndexes:c,addableEntryIndexes:f,headerVisible:a,collapsed:l,rowsVisible:a&&!l,anchorLayerIndex:u}})}function I8(t){return t.length===1&&t[0].visibleEntryIndexes.length===0&&t[0].addableEntryIndexes.length===0}function AY(t){let e=vY+CY;return t.forEach(n=>{n.layer.layerIndex>0&&n.headerVisible&&(e+=bY),n.rowsVisible&&(e+=n.visibleEntryIndexes.length*Cy,n.addableEntryIndexes.length>0&&(e+=wY))}),I8(t)&&(e+=Cy),e}const TY=/^#[0-9A-Fa-f]{6,8}$/,PY={hardcoded:"bg-text/30",variable:"bg-primary",style:"bg-secondary"},LY={hardcoded:"text-text/70",variable:"text-primary",style:"text-secondary"},IY={hardcoded:"Hardcoded value",variable:"Bound to token",style:"Bound to style"},yp=(t,e,n)=>`prop:${t}:${e}::${n}`,RY=t=>t.category!==t.property?`${t.category} · ${t.property}`:t.property;function BY({layerIndex:t,entryIndex:e,entry:n,depth:r}){const i=!!n.bindingTarget,s=n.kind==="variable",o=n.kind==="variable"&&n.token?`${n.rawValue} · {${n.token.name}}`:n.rawValue,l=n.kind==="variable"&&n.token?`${n.token.name}${n.token.collectionName?` (${n.token.collectionName})`:""}`:n.rawValue,a=RY(n),u=TY.test(n.rawValue),c=r*Ov;return g.jsxs("div",{className:"group relative flex items-center px-2 h-8 border-b border-border last:border-b-0 bg-base hover:bg-base-2 transition-[background] duration-150",children:[i&&g.jsx(Uc,{type:"target",position:Ne.Left,id:yp(t,e,"in"),isConnected:s,isConnectable:!0,connectionColor:Qs,idleColor:bc,idleBorderColor:vc}),g.jsxs("div",{className:"flex items-center gap-2.5 min-w-0 w-full",style:{paddingLeft:6+c,paddingRight:12},children:[u&&g.jsx(ti,{color:n.rawValue,className:"w-4.5 h-4.5 shrink-0"}),g.jsx("span",{className:"flex-1 min-w-0 text-xs font-medium text-text overflow-hidden text-ellipsis whitespace-nowrap",title:a,children:a}),g.jsx("span",{className:`shrink-0 max-w-[55%] text-[11px] font-mono whitespace-nowrap overflow-hidden text-ellipsis ${LY[n.kind]}`,title:l,children:o})]}),g.jsx("span",{className:`absolute w-1.5 h-1.5 rounded-full ${PY[n.kind]}`,style:{right:6},title:IY[n.kind]}),i&&g.jsx(Uc,{type:"source",position:Ne.Right,id:yp(t,e,"out"),isConnected:s,isConnectable:!0,connectionColor:Qs,idleColor:bc,idleBorderColor:vc})]})}function OY({layer:t,entryIndexes:e,onReveal:n}){return g.jsx("div",{className:"flex items-center h-7 border-b border-border last:border-b-0",style:{paddingLeft:8+t.depth*Ov},children:g.jsxs(Sn,{position:"bottom-left",children:[g.jsx(Sn.Trigger,{asChild:!0,children:g.jsx(is,{icon:g.jsx(tt,{name:"plus",size:16}),className:"nodrag",title:`Add a property of ${t.name}`,children:"Add property"})}),g.jsx(Sn.Menu,{className:"nowheel nodrag max-h-60 overflow-y-auto",children:e.map(r=>{const i=t.entries[r];return g.jsx(Sn.Item,{onClick:()=>n(jv(t.id,i)),children:`${i.category} · ${i.property}`},r)})})]})})}function jY({sections:t,anchorLayerIndex:e}){return g.jsx(g.Fragment,{children:t.filter(n=>n.anchorLayerIndex===e).flatMap(n=>n.visibleEntryIndexes.filter(r=>{const i=n.layer.entries[r];return i.kind==="variable"&&!!i.bindingTarget}).map(r=>g.jsx(Uc,{type:"target",position:Ne.Left,id:yp(n.layer.layerIndex,r,"in"),isConnected:!0,isConnectable:!1,connectionColor:Qs,idleColor:bc,idleBorderColor:vc},`${n.layer.layerIndex}:${r}`)))})}function VY({id:t,data:e}){const{nodeName:n,nodeType:r,layers:i,truncated:s}=e,o=EY(r),l=$8(),[a,u]=w.useState(()=>new Set),[c,d]=w.useState(()=>new Set),f=w.useRef(new Set),h=w.useMemo(()=>{const p=new Set([...a,...f.current]),y=NY(i,o,p,c);return y.forEach(b=>{b.visibleEntryIndexes.forEach(C=>{f.current.add(jv(b.layer.id,b.layer.entries[C]))})}),y},[i,o,a,c]);w.useEffect(()=>{const p=requestAnimationFrame(()=>l(t));return()=>cancelAnimationFrame(p)},[t,h,l]);const m=AY(h)+(s?Cy:0),x=p=>{u(y=>new Set(y).add(p))},v=p=>{d(y=>{const b=new Set(y);return b.has(p)?b.delete(p):b.add(p),b})};return g.jsxs("div",{className:"rf-group-box border border-text/40 rounded-sm bg-base h-fit! shadow-xs p-0.5",style:{height:m,width:kY},children:[g.jsxs("div",{className:`group-header flex items-center justify-between px-3 cursor-move select-none h-9 ${o?"bg-component":"bg-base-3"}`,children:[g.jsx("span",{className:`text-[13px] font-semibold overflow-hidden text-ellipsis whitespace-nowrap ${o?"text-white":"text-text"}`,title:n,children:n}),g.jsx("span",{className:`text-[10px] shrink-0 ml-2 ${o?"text-white/70":"text-text/50"}`,children:r})]}),g.jsxs("div",{className:"bg-base py-1",children:[I8(h)&&g.jsx("div",{className:"px-3 py-2 text-xs text-text/50",children:"No inspectable properties"}),h.map(p=>{const{layer:y}=p;if(!p.headerVisible)return null;const b=y.layerIndex===0;return g.jsxs(be.Fragment,{children:[!b&&g.jsxs("div",{className:"relative flex items-center gap-1 h-8 pr-3 bg-base-2 border-b border-border select-none",style:{paddingLeft:4+(y.depth-1)*Ov},children:[p.collapsed&&g.jsx(jY,{sections:h,anchorLayerIndex:y.layerIndex}),g.jsx("button",{type:"button",className:"nodrag w-5 h-5 shrink-0 flex items-center justify-center rounded text-text/60 hover:text-text hover:bg-base-3 cursor-pointer","aria-expanded":!p.collapsed,"aria-label":`${p.collapsed?"Expand":"Collapse"} ${y.name}`,onClick:()=>v(y.id),children:g.jsx(tt,{name:"triangle",size:16,className:`transition-transform duration-150 ${p.collapsed?"-rotate-90":""}`})}),g.jsx("span",{className:"text-xs font-medium text-text overflow-hidden text-ellipsis whitespace-nowrap",title:y.name,children:y.name}),g.jsx("span",{className:"text-[10px] text-text/50 shrink-0 ml-auto pl-2",children:y.type})]}),p.rowsVisible&&p.visibleEntryIndexes.map(C=>g.jsx(BY,{layerIndex:y.layerIndex,entryIndex:C,entry:y.entries[C],depth:y.depth},`${y.layerIndex}:${C}:${y.entries[C].property}`)),p.rowsVisible&&p.addableEntryIndexes.length>0&&g.jsx(OY,{layer:y,entryIndexes:p.addableEntryIndexes,onReveal:x})]},`${y.layerIndex}:${y.id}`)}),s&&g.jsx("div",{className:"px-3 py-2 text-xs text-text/50",children:"Large component: only the first layers are listed"})]})]})}const FY=be.memo(VY);function _Y(t,e,n,r){const i=e?e.split("/"):[],s=r?i.length:i.length-1;let o=null;for(let l=0;l<=s;l++){const a=sr(t,i.slice(0,l).join("/"));n.has(a)&&(o=a)}return o}const Qg=(t,e)=>`${Yr}${sr(t,e)}`;function HY(t,e,n){if(t.length===0)return[];const r=new Set;t.forEach(v=>{const p=v.sourceGroupName||"",y=p?p.split("/"):[];for(let b=0;b<=y.length;b++){const C=sr(v.collectionId,y.slice(0,b).join("/"));e.has(C)&&r.add(C)}});const i=new Map;r.forEach(v=>{const p=Ix(v);p&&i.set(Qg(p.collectionId,p.path),{kind:"wrapper",path:p.path,collectionId:p.collectionId,children:[],width:0,height:0,rel:{x:0,y:0}})}),t.forEach(v=>{const p=sr(v.collectionId,v.sourceGroupName||""),y=i.get(`${Yr}${p}`);if(y){y.group=v;return}i.set(v.key,{kind:"card",path:v.sourceGroupName||"",collectionId:v.collectionId,group:v,children:[],width:0,height:0,rel:{x:0,y:0}})});const s=[],o=v=>{const p=_Y(v.collectionId,v.path,e,v.kind==="card"),y=p?`${Yr}${p}`:null;y&&i.has(y)?i.get(y).children.push(v):s.push(v)};i.forEach(v=>o(v));const l=v=>sr(v.collectionId,v.path),a=v=>{v.children.sort((p,y)=>l(p).localeCompare(l(y))),v.children.forEach(a)};s.sort((v,p)=>l(v).localeCompare(l(p))),s.forEach(a);const u=v=>v.kind==="card"&&v.group?v.group.key:Qg(v.collectionId,v.path),c=v=>{if(v.kind==="card"){v.width=fr,v.height=v.group?zr(v.group):0;return}const p=I5(v.group);let y=xs+f1+p+zi,b=0,C=0,S=0;v.children.forEach($=>{c($);const D=n[`rel:${u($)}`];D?$.rel=D:($.rel={x:xs+zi,y},y+=$.height+Hu),b=Math.max(b,$.width),C=Math.max(C,$.rel.x+$.width),S=Math.max(S,$.rel.y+$.height)});const k=Math.max(b+(xs+zi)*2,fr),E=v.children.length>0?y-Hu+zi+xs:xs*2+f1+(p>0?p:zi*2);v.width=Math.max(k,C+zi+xs),v.height=Math.max(E,S+zi+xs)};s.forEach(c);const d=v=>{if(v.kind==="card"&&v.group)return{x:v.group.initialX,y:v.group.initialY};let p=1/0,y=1/0;const b=C=>{C.group&&(p=Math.min(p,C.group.initialX),y=Math.min(y,C.group.initialY)),C.children.forEach(b)};return b(v),{x:p===1/0?0:p,y:y===1/0?0:y}},f=[],h=(v,p,y)=>{if(v.kind==="card"&&v.group)f.push({kind:"card",id:v.group.key,group:v.group,parentId:p,position:y});else{const b=Qg(v.collectionId,v.path);f.push({kind:"wrapper",id:b,path:v.path,collectionId:v.collectionId,parentId:p,position:y,width:v.width,height:v.height,...v.group?{group:v.group}:{}}),v.children.forEach(C=>h(C,b,C.rel))}},m=[...s].sort((v,p)=>{const y=d(v),b=d(p);return y.x-b.x||y.y-b.y}),x=new Map;return m.forEach(v=>{const p=n[u(v)];let y;if(p)y=p;else{const b=d(v),C=Math.round(b.x),S=Math.max(x.get(C)??0,b.y);y={x:b.x,y:S},x.set(C,S+v.height+Hu)}h(v,null,y)}),f}function zY({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:i,targetPosition:s,data:o}){const[l]=Nv({sourceX:t,sourceY:e,sourcePosition:i,targetX:n,targetY:r,targetPosition:s}),a=(o==null?void 0:o.kind)||"reference",u=(o==null?void 0:o.isDimmed)||!1,c=(o==null?void 0:o.isHighlighted)||!1,d=(o==null?void 0:o.isGroupSibling)||!1,h=c||d?SP:a==="generated"?Th:Qs,m=a==="generated"?"7 5":void 0,x=a==="generated"?2.5:2,v=c?1:d?.35:u?.45:1,p=y=>{var b;y.stopPropagation(),!(a!=="reference"||!o)&&confirm(`Disconnect ${o.receiverShortName}?`)&&(o.onUnbindProperty&&o.unbindNodeId&&o.unbindTarget?o.onUnbindProperty(o.unbindNodeId,o.unbindTarget):(b=o.onDisconnect)==null||b.call(o,o.receiverName,o.resolvedValue))};return g.jsxs("g",{children:[a==="reference"&&g.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:12,style:{cursor:"pointer"},onClick:p}),g.jsx("path",{d:l,fill:"none",stroke:h,strokeWidth:x,strokeDasharray:m,style:{pointerEvents:"none",opacity:v,transition:"opacity 150ms, stroke 150ms"}})]})}const WY=be.memo(zY);function fl({isOpen:t,onClose:e,children:n}){const r=w.useRef(null);if(w.useEffect(()=>{if(!t)return;const s=o=>{o.key==="Escape"&&e()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,e]),w.useEffect(()=>{if(!t)return;const s=r.current;if(!s)return;const o=s.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),l=o[0],a=o[o.length-1];l==null||l.focus();const u=c=>{c.key==="Tab"&&(c.shiftKey?document.activeElement===l&&(c.preventDefault(),a==null||a.focus()):document.activeElement===a&&(c.preventDefault(),l==null||l.focus()))};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[t]),!t)return null;const i=s=>{s.target===s.currentTarget&&e()};return g.jsx("div",{ref:r,className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:i,role:"dialog","aria-modal":"true",children:n})}function hl({width:t=400,children:e,className:n=""}){const r=typeof t=="number"?`${t}px`:t;return g.jsx("div",{className:`bg-base rounded-lg shadow-xl flex flex-col ${n}`,style:{width:r,maxHeight:"90vh"},role:"document","aria-labelledby":"modal-title",children:e})}function Ya({title:t,onClose:e}){return g.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[g.jsx("h3",{id:"modal-title",className:"text-sm font-semibold text-text",children:t}),g.jsx("button",{type:"button",className:"w-6 h-6 flex items-center justify-center text-text opacity-40 hover:opacity-60 transition-opacity",onClick:e,"aria-label":"Close modal",children:g.jsx(jT,{})})]})}function Xa({children:t,className:e=""}){return g.jsx("div",{className:`px-6 py-4 overflow-y-auto flex-1 ${e}`,children:t})}function qa({children:t,className:e=""}){return g.jsx("div",{className:`flex items-center justify-end gap-2 px-6 py-4 border-t border-border ${e}`,children:t})}function R8({isOpen:t,onClose:e,title:n,children:r,footer:i,width:s}){return g.jsx(fl,{isOpen:t,onClose:e,children:g.jsxs(hl,{width:s,children:[g.jsx(Ya,{title:n,onClose:e}),g.jsx(Xa,{children:r}),i&&g.jsx(qa,{children:i})]})})}const GY={collection:"folder",card:"collapse-all",container:"expand-all",variable:"color"},k2={collection:"Collection",card:"Card",container:"Container",variable:"Variable"},S2={collection:0,card:1,container:1,variable:2},UY=40;function KY(){if(typeof navigator>"u")return!1;const t=navigator.platform||"",e=navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(t||e)}function YY(t){return t.key!=="k"&&t.key!=="K"||t.altKey?!1:KY()?t.metaKey&&!t.ctrlKey:t.ctrlKey&&!t.metaKey}function XY(t,e){const n=t.label.toLowerCase();return n===e?0:n.startsWith(e)?1:n.includes(e)?2:t.context.toLowerCase().includes(e)?3:-1}function qY(t,e,n=UY){const r=e.trim().toLowerCase();if(!r){const o=t.filter(l=>l.target.kind==="collection");return{results:o.filter(l=>!l.hidden).slice(0,n),hiddenCount:o.filter(l=>l.hidden).length,isDefault:!0}}let i=0;const s=[];return t.forEach(o=>{const l=XY(o,r);if(!(l<0)){if(o.hidden){i+=1;return}s.push({item:o,score:l})}}),s.sort((o,l)=>o.score-l.score||S2[o.item.target.kind]-S2[l.item.target.kind]||o.item.label.localeCompare(l.item.label)||o.item.context.localeCompare(l.item.context)),{results:s.slice(0,n).map(o=>o.item),hiddenCount:i,isDefault:!1}}function QY({isOpen:t,items:e,onClose:n,onActivate:r}){const[i,s]=w.useState(""),[o,l]=w.useState(0),a=w.useRef(null);w.useEffect(()=>{t&&(s(""),l(0))},[t]);const{results:u,hiddenCount:c,isDefault:d}=w.useMemo(()=>qY(e,i),[e,i]),f=u.length===0?-1:Math.min(o,u.length-1);w.useEffect(()=>{l(0)},[i]),w.useEffect(()=>{var v;if(f<0)return;const x=(v=a.current)==null?void 0:v.children[f];typeof(x==null?void 0:x.scrollIntoView)=="function"&&x.scrollIntoView({block:"nearest"})},[f]);const h=w.useCallback(x=>{x&&r(x.target)},[r]),m=w.useCallback(x=>{x.key==="ArrowDown"?(x.preventDefault(),l(v=>u.length===0?0:(Math.min(v,u.length-1)+1)%u.length)):x.key==="ArrowUp"?(x.preventDefault(),l(v=>u.length===0?0:(Math.min(v,u.length-1)+u.length-1)%u.length)):x.key==="Enter"&&(x.preventDefault(),h(u[f]))},[u,f,h]);return t?g.jsx(fl,{isOpen:t,onClose:n,children:g.jsx(hl,{width:520,className:"overflow-hidden",children:g.jsxs("div",{"data-graph-quick-search":"",onKeyDown:m,children:[g.jsx("div",{className:"border-b border-border p-3",children:g.jsx(zp,{value:i,onChange:s,onClear:n,placeholder:"Jump to a collection, card or variable...",count:u.length>0?`${u.length}`:void 0,autoFocus:!0,fullWidth:!0})}),u.length===0?g.jsx("div",{className:"px-4 py-6 text-center text-[11px] text-text opacity-60",children:c>0?`Nothing to jump to — ${c} ${c===1?"match is":"matches are"} hidden by the current filters.`:"No matches."}):g.jsx("div",{ref:a,className:"max-h-80 overflow-y-auto py-1",role:"listbox","aria-label":"Graph search results",children:u.map((x,v)=>g.jsxs("button",{type:"button",role:"option","aria-selected":v===f,className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-base-2 ${v===f?"bg-base-3":""}`,onClick:()=>h(x),title:`${k2[x.target.kind]} · ${x.label}`,children:[g.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center text-text opacity-60 [&_svg]:size-4","aria-hidden":"true",children:x.variableType?g.jsx(_p,{type:x.variableType}):g.jsx(tt,{name:GY[x.target.kind],size:16})}),g.jsx("span",{className:"sr-only",children:k2[x.target.kind]}),g.jsx("span",{className:"truncate text-xs text-text",children:x.label}),g.jsx("span",{className:"ml-auto shrink-0 truncate text-[11px] text-text opacity-50",children:x.context})]},x.id))}),c>0&&u.length>0||d?g.jsxs("div",{className:"flex items-center gap-3 border-t border-border px-3 py-2 text-[10px] text-text opacity-50",children:[d&&g.jsx("span",{children:"Type to search cards and variables"}),c>0&&u.length>0&&g.jsxs("span",{className:"ml-auto",children:[c," more hidden by the current filters"]})]}):null]})})}):null}const ZY={groupNode:pY,groupWrapper:gY,propertyNode:FY,tierLabel:xY},JY=-40,E2=220,Cf=t=>`selection:${t}`,eX=t=>Array.isArray(t)?t.filter(e=>!!e&&typeof e=="object"&&typeof e.tier=="number"&&typeof e.x=="number"&&typeof e.width=="number").map(({tier:e,x:n,width:r})=>({tier:e,x:n,width:r})):[],tX=[],nX={customEdge:WY};function rX(){const{collections:t,variables:e,shadeGroups:n,selectedModeId:r,selectedNode:i,hasMultipleSelection:s}=Zt(),{modals:o,openShadesModal:l,openStepsModal:a,openInputModal:u,openAddVariableModal:c,openBulkEdit:d}=ar(),f=w.useRef(null),h=$8(),m=w.useMemo(()=>i?$Y(i):[],[i]),x=e.some(_=>_.resolvedType==="COLOR");e.some(_=>_.resolvedType==="FLOAT");const v=x?"COLOR":"FLOAT",p=v==="COLOR",[y,b]=w.useState({}),[C,S]=w.useState(()=>du({})),[k,E]=w.useState(()=>_d(du({}))),[$,D]=w.useState([]),[L,A]=w.useState(!1),T=w.useRef(y),[V,M]=w.useState(0);w.useEffect(()=>{T.current=y},[y]);const[B,N]=w.useState(null),O=(B==null?void 0:B.groupKey)??null,I=(B==null?void 0:B.varName)??null,[P,F]=w.useState(new Set),z=w.useRef(new Map),j=w.useCallback(_=>z.current.get(_)??_,[]),R=w.useRef({positions:null,groupedPaths:null}),[H,G]=w.useState(0),U=ym(),se=w.useRef(null),ne=w.useRef([]),[le,Ee]=w.useState(!1),{setSelectedModeId:xe,selectedVariableTypes:W,selectedCollectionIds:oe,selectedGroups:ae,toggleVariableType:we,toggleCollection:$e,toggleSelectedGroup:Ve}=Zt(),[We,ie,Te]=DK([]),[Ke,rt,te]=NK([]),ce=w.useMemo(()=>new Map(e.map(_=>[_.id,_])),[e]),K=w.useMemo(()=>new Map(t.map(_=>[_.id,_.name])),[t]),[X,re]=w.useState({show:!1,position:{top:0,left:0},variableId:"",value:""}),he=w.useCallback(()=>{re(_=>({..._,show:!1}))},[]),De=w.useCallback(_=>{xe(_)},[xe]),je=w.useCallback(_=>{$e(_)},[$e]),Lt=w.useCallback(_=>{we(_)},[we]),ht=w.useCallback(_=>{Ve(_)},[Ve]),en=w.useCallback((_,Q)=>{if(_.stopPropagation(),!p||Q.isVirtual||!f.current)return;const Y=f.current.getBoundingClientRect(),Z=_.currentTarget.getBoundingClientRect();re({show:!0,position:{top:Z.bottom-Y.top+4,left:Z.left-Y.left},variableId:Q.id,value:Q.value})},[p]);w.useEffect(()=>{const _="graph-positions";b({}),A(!1),R.current.positions=null,Se({type:"get-client-storage",key:_});const Q=Z=>{const ye=Z.data.pluginMessage;(ye==null?void 0:ye.type)==="client-storage-data"&&ye.key===_&&(R.current.positions=ye.value||{},G(fe=>fe+1),A(!0))},Y=setTimeout(()=>{A(!0)},100);return window.addEventListener("message",Q),()=>{window.removeEventListener("message",Q),clearTimeout(Y)}},[v]),w.useEffect(()=>{const _="graph-layout-settings";S(du({})),Se({type:"get-client-storage",key:_});const Q=Y=>{const Z=Y.data.pluginMessage;(Z==null?void 0:Z.type)==="client-storage-data"&&Z.key===_&&S(du(Z.value))};return window.addEventListener("message",Q),()=>window.removeEventListener("message",Q)},[v]),w.useEffect(()=>{const _="graph-grouped-paths";F(new Set),R.current.groupedPaths=null,Se({type:"get-client-storage",key:_});const Q=Y=>{const Z=Y.data.pluginMessage;(Z==null?void 0:Z.type)==="client-storage-data"&&Z.key===_&&(R.current.groupedPaths=Z.value,G(ye=>ye+1))};return window.addEventListener("message",Q),()=>window.removeEventListener("message",Q)},[v]),w.useEffect(()=>{if(H===0)return;const _=R.current;if(_.positions===null&&_.groupedPaths===null||t.length===0)return;const Q=w4(t,e),Y=w4(t,e,{exactPathOnly:!0});if(_.groupedPaths!==null){const Z=_.groupedPaths,ye=PP(Z,Q);_.groupedPaths=null,F(new Set(ye)),JSON.stringify(Z)!==JSON.stringify(ye)&&Se({type:"set-client-storage",key:"graph-grouped-paths",value:ye})}if(_.positions!==null){const Z=_.positions,ye=LP(Z,Q,Y);_.positions=null,b(ye),M(fe=>fe+1),JSON.stringify(Z)!==JSON.stringify(ye)&&Se({type:"set-client-storage",key:"graph-positions",value:ye})}},[H,t,e]),w.useEffect(()=>{const _="graph-tier-labels";D([]),Se({type:"get-client-storage",key:_});const Q=Y=>{const Z=Y.data.pluginMessage;(Z==null?void 0:Z.type)==="client-storage-data"&&Z.key===_&&D(eX(Z.value))};return window.addEventListener("message",Q),()=>window.removeEventListener("message",Q)},[v]);const Le=w.useCallback(_=>{F(Q=>{const Y=_(Q);return Se({type:"set-client-storage",key:"graph-grouped-paths",value:Array.from(Y)}),Y})},[]),ut=w.useCallback((_,Q)=>{if(!_||!Q)return;const Y=Q.split("/").slice(0,-1).join("/");Le(Z=>{const ye=new Set(Z);return ye.add(sr(_,Y)),ye})},[Le]),Je=w.useCallback((_,Q)=>{_&&Le(Y=>{const Z=new Set(Y);return Z.delete(sr(_,Q)),Z})},[Le]);w.useEffect(()=>{if(!X.show)return;const _=Q=>{const Y=Q.target;!Y.closest("#color-value-menu")&&!Y.closest(".rf-color-swatch")&&he()};return document.addEventListener("click",_),()=>document.removeEventListener("click",_)},[X.show,he]);const Kt=w.useCallback((_,Q)=>{_.kind==="shader"&&Q.virtualType==="shader"&&_.sourceGroupName&&(p?l({groupName:_.sourceGroupName,modeId:r}):a({groupName:_.sourceGroupName,collectionId:_.collectionId}))},[p,l,a,r]),St=w.useCallback(_=>{const Q=_.kind==="collection";if(!Q&&(_.kind!=="standard"||!_.sourceGroupName))return;const Y=Q?"":`${_.sourceGroupName}/`;c({title:`New Variable in ${Q?_.title:_.sourceGroupName}`,confirmText:"Add",onConfirm:(Z,ye)=>{const fe=Fd(Z);fe&&Se({type:"create-variable",collectionId:_.collectionId,name:`${Y}${fe}`,varType:ye,value:x4(ye)})}})},[c]),Et=w.useCallback(_=>{_.kind!=="standard"||!_.sourceGroupName||u({title:`Rename ${_.sourceGroupName}`,label:"Group name",confirmText:"Rename",initialValue:_.sourceGroupName,onConfirm:Q=>{const Y=Fd(Q);!Y||Y===_.sourceGroupName||Se({type:"rename-group",variableIds:_.variables.filter(Z=>!Z.isVirtual).map(Z=>Z.id),groupName:_.sourceGroupName,newGroupName:Y})}})},[u]),dn=w.useCallback(_=>{_.kind!=="standard"||!_.sourceGroupName||Se({type:"duplicate-group",variableIds:_.variables.filter(Q=>!Q.isVirtual).map(Q=>Q.id),groupName:_.sourceGroupName})},[]),ze=w.useCallback(_=>{_.kind!=="standard"||!_.sourceGroupName||d({groupName:_.sourceGroupName,collectionId:_.collectionId})},[d]),pt=w.useCallback(_=>{if(_.kind!=="standard"||!_.sourceGroupName)return;const Q=_.variables.filter(Y=>!Y.isVirtual).map(Y=>Y.id);Q.length!==0&&confirm(`Delete group ${_.sourceGroupName}?`)&&Se({type:"delete-group",ids:Q})},[]),Oi=w.useCallback(_=>{_.isVirtual||confirm(`Delete ${_.name}?`)&&Se({type:"delete-variable",id:_.id})},[]),ji=w.useCallback(_=>{_.isVirtual||u({title:`Rename ${_.shortName}`,label:"Variable name",confirmText:"Rename",initialValue:_.shortName,onConfirm:Q=>{const Y=Fd(Q);if(!Y||Y===_.shortName)return;const Z=_.name.split("/");Z[Z.length-1]=Y,Se({type:"update-variable-name",id:_.id,name:Z.join("/")})}})},[u]),ai=w.useCallback((_,Q)=>{const Y=ce.get(_),Z=Y?Qo(t,Y.collectionId,r):r;Se({type:"update-variable-value",id:_,value:Q,modeId:Z})},[t,r,ce]),hs=w.useCallback((_,Q)=>{Se({type:"unbind-node-property",nodeId:_,target:Q})},[]),Vi=w.useCallback(_=>{N(Q=>(Q==null?void 0:Q.groupKey)===_.key&&Q.varName===null?null:{groupKey:_.key,varName:null})},[]),Fi=w.useCallback((_,Q)=>{N(Y=>(Y==null?void 0:Y.groupKey)===_.key&&Y.varName===Q.name?null:{groupKey:_.key,varName:Q.name})},[]),ho=w.useCallback((_,Q)=>{var Z;if(Q.type!=="groupNode")return;const Y=(Z=Q.data)==null?void 0:Z.group;(Y==null?void 0:Y.kind)==="collection"&&Y.variables.length===0||N(ye=>(ye==null?void 0:ye.groupKey)===Q.id&&ye.varName===null?null:{groupKey:Q.id,varName:null})},[]),po=w.useCallback(()=>N(null),[]),ui=w.useCallback(_=>{requestAnimationFrame(()=>{try{U.fitView({nodes:[{id:_}],duration:400,padding:.5,maxZoom:1})}catch{}})},[U]),xl=w.useCallback(_=>{N(Q=>{const Y=(Q==null?void 0:Q.groupKey)===_&&Q.varName===null?null:{groupKey:_,varName:null};return Y&&ui(j(_)),Y})},[ui,j]),ci=w.useCallback((_,Q)=>{N({groupKey:_,varName:Q}),ui(j(_))},[ui,j]),Ft=w.useCallback(_=>{const Q=U.getNodes().filter(Y=>{var Z,ye,fe;return Y.hidden?!1:Y.type==="groupNode"?((ye=(Z=Y.data)==null?void 0:Z.group)==null?void 0:ye.collectionId)===_:Y.type==="groupWrapper"?((fe=Y.data)==null?void 0:fe.collectionId)===_:!1}).map(Y=>({id:Y.id}));if(Q.length!==0)try{U.fitView({nodes:Q,duration:400,padding:.2,maxZoom:1})}catch{}},[U]),$t=w.useCallback(()=>{const _=Array.from(oe)[0];if(!_)return;const Q=new Set;e.forEach(Y=>{if(Y.collectionId!==_)return;const Z=Qi(Y.name);Z&&Q.add(Z)}),u({title:`New ${p?"Color":"Number"} Group`,label:"Group name",confirmText:"Create",suggestions:Array.from(Q).sort((Y,Z)=>Y.localeCompare(Z)),onConfirm:Y=>{const Z=Fd(Y);Z&&Se({type:"create-variable",collectionId:_,name:`${Z}/${bP}`,varType:v,value:x4(v)})}})},[p,u,oe,v,e]),{groupsData:Mt,connectionData:fn,variableMap:Yt}=w.useMemo(()=>{const _=e,Q=new Map;_.forEach(de=>Q.set(de.name,de));const Y=[],Z=new Map,ye=[],fe=new Set,Qe=new Set,Dt=p?n.sort((de,Re)=>de.sourceVariableName.localeCompare(Re.sourceVariableName)):[],Ze=p?[]:NP(_);Dt.forEach((de,Re)=>{const Me=_.find(It=>It.id===de.sourceVariableId);if(!Me)return;fe.add(Me.id),de.deleteIds.forEach(It=>{It!==Me.id&&Qe.add(It)});const it=fu(Me,Q,!0,t,r),pn=`source:${Me.id}`,ee=`shader:${Me.id}`,Ce=`shades:${Me.id}`,Pe=it.color,mt=_.filter(It=>de.deleteIds.includes(It.id)&&It.id!==Me.id).sort((It,Vr)=>v4(It.name)-v4(Vr.name)).map(It=>fu(It,Q,!0,t,r)),Oe=$P(de,Pe),on=DP(de,mt.length,Pe),Nt=Re*(Math.max(Eu+Lo+Wl*2,Eu+(mt.length+1)*Lo+Wl*2)+yi);[{key:pn,title:Me.name,variables:[it],x:0,y:0,initialX:0,initialY:Nt,kind:"source",sourceGroupName:Me.name,headerFill:ws,collectionId:de.collectionId},{key:ee,title:"Shader",variables:[Oe],x:0,y:0,initialX:fr+ko,initialY:Nt,kind:"shader",sourceGroupName:Me.name,headerFill:lg,collectionId:de.collectionId},{key:Ce,title:`${Me.name} shades`,variables:[on,...mt],x:0,y:0,initialX:(fr+ko)*2,initialY:Nt,kind:"shades",sourceGroupName:Me.name,headerFill:ws,collectionId:de.collectionId}].forEach(It=>{Y.push(It),It.variables.forEach((Vr,Am)=>{Z.set(Vr.name,{group:It.key,index:Am,node:Vr})})}),ye.push({id:`generated:${Me.id}:source-to-shader`,kind:"generated",fromGroup:pn,fromVar:it.name,toGroup:ee,toVar:Oe.name}),ye.push({id:`generated:${Me.id}:shader-to-palette`,kind:"generated",fromGroup:ee,fromVar:Oe.name,toGroup:Ce,toVar:on.name})}),Ze.forEach((de,Re)=>{const Me=de.sourceVariable,it=fu(Me,Q,!1,t,r),pn=`source:${Me.id}`,ee=`shader:${Me.id}`,Ce=`steps:${Me.id}`,Pe=de.stepVariables.map(Nt=>fu(Nt,Q,!1,t,r)),et=MP(Me.id,Pe.length),mt={id:`palette:${Me.id}`,name:`palette:${Me.id}`,shortName:"generated",displayName:`${Pe.length} outputs`,color:Qs,value:"",resolvedValue:"",isReference:!1,referenceName:null,isVirtual:!0,virtualType:"palette",connectionsDisabled:!0};fe.add(Me.id),de.stepVariables.forEach(Nt=>Qe.add(Nt.id));const Oe=Re*(Math.max(Eu+Lo+Wl*2,Eu+(Pe.length+1)*Lo+Wl*2)+yi);[{key:pn,title:Me.name,variables:[it],x:0,y:0,initialX:0,initialY:Oe,kind:"source",sourceGroupName:Me.name,headerFill:ws,collectionId:Me.collectionId},{key:ee,title:"Steps",variables:[et],x:0,y:0,initialX:fr+ko,initialY:Oe,kind:"shader",sourceGroupName:Me.name,headerFill:lg,collectionId:Me.collectionId},{key:Ce,title:`${Me.name} steps`,variables:[mt,...Pe],x:0,y:0,initialX:(fr+ko)*2,initialY:Oe,kind:"shades",sourceGroupName:Me.name,headerFill:ws,collectionId:Me.collectionId}].forEach(Nt=>{Y.push(Nt),Nt.variables.forEach((Tn,It)=>{Z.set(Tn.name,{group:Nt.key,index:It,node:Tn})})}),ye.push({id:`generated:${Me.id}:source-to-steps`,kind:"generated",fromGroup:pn,fromVar:it.name,toGroup:ee,toVar:et.name}),ye.push({id:`generated:${Me.id}:steps-to-output`,kind:"generated",fromGroup:ee,fromVar:et.name,toGroup:Ce,toVar:mt.name})});const bt=_.filter(de=>!fe.has(de.id)&&!Qe.has(de.id)),{groups:_t,loose:ur}=RP(bt,de=>fu(de,Q,de.resolvedType==="COLOR",t,r)),hn=fr+ko,Ht=new Map;Y.forEach(de=>{if(de.kind==="standard")return;const Re=Math.round(de.initialX/hn),Me=de.initialY+zr(de)+yi;Ht.set(Re,Math.max(Ht.get(Re)||0,Me))});const Wn=[];Array.from(_t.values()).sort((de,Re)=>de.groupName.localeCompare(Re.groupName)||de.collectionId.localeCompare(Re.collectionId)).forEach(({groupName:de,nodes:Re,collectionId:Me})=>{const it=Re.some(pn=>pn.isReference);Wn.push({groupName:de,groupVariables:Re,collectionId:Me,hasReferences:it})});let zt=Ht.get(0)||0;Wn.filter(de=>!de.hasReferences).forEach(de=>{const Re=h1(de.collectionId,de.groupName),Me={key:Re,title:de.groupName,variables:de.groupVariables,x:0,y:0,initialX:0,initialY:zt,kind:"standard",sourceGroupName:de.groupName,headerFill:ws,collectionId:de.collectionId,canGroup:!0};Y.push(Me),de.groupVariables.forEach((it,pn)=>{Z.set(it.name,{group:Re,index:pn,node:it})}),zt+=zr(Me)+yi}),BP(t,ur,zt).forEach(de=>{Y.push(de),de.variables.forEach((Re,Me)=>{Z.set(Re.name,{group:de.key,index:Me,node:Re})}),zt+=zr(de)+yi});const Ie=[];let ct=0;if(Wn.filter(de=>de.hasReferences).forEach(de=>{const Re=h1(de.collectionId,de.groupName),Me={key:Re,title:de.groupName,variables:de.groupVariables,x:0,y:0,initialX:0,initialY:ct,kind:"standard",sourceGroupName:de.groupName,headerFill:ws,collectionId:de.collectionId,canGroup:!0};Y.push(Me),Ie.push(Me),de.groupVariables.forEach((it,pn)=>{Z.set(it.name,{group:Re,index:pn,node:it})}),ct+=zr(Me)+yi}),Y.forEach(de=>{de.variables.forEach(Re=>{if(Re.isReference&&Re.referenceName){const Me=Z.get(Re.referenceName),it=Z.get(Re.name);Me&&it&&ye.push({id:`reference:${it.node.id}->${Me.node.id}`,kind:"reference",fromGroup:Me.group,fromVar:Me.node.name,toGroup:it.group,toVar:it.node.name})}})}),Ie.length>0){const de=Y.some(ee=>ee.kind==="shader"),Re=new Map;Y.forEach(ee=>{Re.set(ee.key,Math.round(ee.initialX/(fr+ko)))});let Me=!0,it=0;for(;Me&&it<20;)Me=!1,it++,ye.forEach(ee=>{const Ce=Re.get(ee.fromGroup)??0,Pe=Re.get(ee.toGroup)??0,et=de&&Ce<2?2:Ce+1;et>Pe&&(Re.set(ee.toGroup,et),Me=!0)});const pn=new Map;Ie.forEach(ee=>{const Ce=Re.get(ee.key)??0,Pe=pn.get(Ce)??Ht.get(Ce)??0;ee.initialX=Ce*hn,ee.initialY=Pe,pn.set(Ce,Pe+zr(ee)+yi)})}return{groupsData:Y,connectionData:ye,variableMap:Z}},[t,e,v,n,p,r]),ps=w.useMemo(()=>{const _=new Set;return m.forEach(Q=>Q.entries.forEach(Y=>{if(Y.kind!=="variable"||!Y.token)return;const Z=Yt.get(Y.token.name);Z&&_.add(Z.group)})),_},[m,Yt]),Sr=w.useMemo(()=>({selectedCollections:oe,selectedTypes:W,selectedGroups:ae,variablesById:ce,selectionProviderGroupKeys:ps}),[oe,W,ae,ce,ps]),vl=w.useMemo(()=>{const _=new Map,Q=Y=>{const Z=_.get(Y)||{hasInput:!1,hasOutput:!1,inputKind:null,outputKind:null};return _.set(Y,Z),Z};return fn.forEach(Y=>{const Z=Q(Y.fromVar);Z.hasOutput=!0,Z.outputKind=Z.outputKind||Y.kind;const ye=Q(Y.toVar);ye.hasInput=!0,ye.inputKind=ye.inputKind||Y.kind}),_},[fn]),[bl,wl]=w.useState(!1),xd=w.useRef(!1);w.useEffect(()=>{xd.current=Object.values(o).some(Boolean)},[o]),w.useEffect(()=>{const _=Q=>{if(Q.defaultPrevented||!YY(Q))return;const Y=Q.target,Z=!!(Y!=null&&Y.closest("[data-graph-quick-search]"));Y&&!Z&&(Y.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(Y.tagName))||!Z&&xd.current||(Q.preventDefault(),wl(fe=>!fe))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[]);const Sm=w.useMemo(()=>{if(!bl)return tX;const _=fe=>K.get(fe)||fe,Q=[],Y=new Set,Z=new Map;Mt.forEach(fe=>{const Qe=zf(fe,Sr);Qe||Z.set(fe.collectionId,(Z.get(fe.collectionId)||0)+1),(fe.kind==="standard"||fe.kind==="collection")&&Y.add(sr(fe.collectionId,fe.sourceGroupName||""));const Dt=_(fe.collectionId);fe.kind==="collection"&&fe.variables.length===0||Q.push({id:`card:${fe.key}`,label:fe.title,context:Dt,target:{kind:"card",cardKey:fe.key},hidden:Qe}),fe.variables.forEach(bt=>{var _t;bt.isVirtual||Q.push({id:`var:${fe.key}::${bt.name}`,label:bt.name,context:`${fe.title} · ${Dt}`,target:{kind:"variable",cardKey:fe.key,varName:bt.name},hidden:Qe,variableType:bt.resolvedType??((_t=ce.get(bt.id??""))==null?void 0:_t.resolvedType)??"COLOR"})})});const ye=new Map(U.getNodes().map(fe=>[fe.id,fe]));return P.forEach(fe=>{if(Y.has(fe))return;const Qe=Ix(fe);if(!Qe)return;const Dt=`${Yr}${fe}`,Ze=ye.get(Dt);Ze&&Q.push({id:`container:${Dt}`,label:Qe.path||_(Qe.collectionId),context:_(Qe.collectionId),target:{kind:"container",nodeId:Dt},hidden:Ze.hidden===!0})}),t.forEach(fe=>{const Qe=Z.get(fe.id)||0;Q.push({id:`collection:${fe.id}`,label:fe.name,context:`${Qe} ${Qe===1?"card":"cards"}`,target:{kind:"collection",collectionId:fe.id},hidden:Qe===0})}),Q},[bl,Mt,t,K,Sr,P,U]),Em=w.useCallback(_=>{switch(wl(!1),_.kind){case"collection":Ft(_.collectionId);break;case"container":ui(_.nodeId);break;case"card":ci(_.cardKey,null);break;case"variable":ci(_.cardKey,_.varName);break}},[Ft,ui,ci]),$m=w.useCallback(()=>wl(!1),[]);w.useEffect(()=>{if(!L)return;const _=T.current,Q=new Set,Y=new Set,Z=new Set,ye=new Set;if(O){const ee=new Map,Ce=new Map;fn.forEach(Oe=>{ee.has(Oe.fromVar)||ee.set(Oe.fromVar,[]),ee.get(Oe.fromVar).push({edgeId:Oe.id,varName:Oe.toVar}),Ce.has(Oe.toVar)||Ce.set(Oe.toVar,[]),Ce.get(Oe.toVar).push({edgeId:Oe.id,varName:Oe.fromVar})});const Pe=Mt.find(Oe=>Oe.key===O);Pe==null||Pe.variables.forEach(Oe=>ye.add(Oe.name));const et=I?[I]:((Pe==null?void 0:Pe.variables)||[]).map(Oe=>Oe.name);et.forEach(Oe=>Y.add(Oe));const mt=Oe=>{const on=new Set(et),Nt=[...et];for(;Nt.length>0;){const Tn=Nt.pop();(Oe.get(Tn)||[]).forEach(({edgeId:It,varName:Vr})=>{Z.add(It),Y.add(Vr),on.has(Vr)||(on.add(Vr),Nt.push(Vr))})}};mt(Ce),mt(ee),Y.forEach(Oe=>{const on=Yt.get(Oe);on&&Q.add(on.group)}),Q.add(O)}const fe=O!==null,Qe=/^#[0-9A-Fa-f]{6,8}$/,Dt=new Map,Ze=new Map;m.forEach(ee=>{ee.entries.forEach(Ce=>{if(Ce.kind!=="variable"||!Ce.token||Yt.get(Ce.token.name))return;const Pe=Ce.token.name.split("/"),et=Pe.length>1?Pe.slice(0,-1).join("/"):Ce.token.name,mt=`ext-group:${et}`;Dt.set(Ce.token.name,mt);const Oe=Ze.get(mt)||{title:et,collectionId:Ce.token.collectionId||"external",nodes:[]};if(!Oe.nodes.some(on=>on.name===Ce.token.name)){const on=Qe.test(Ce.rawValue);Oe.nodes.push({id:`ext:${Ce.token.name}`,name:Ce.token.name,shortName:Pe[Pe.length-1],displayName:Ce.token.collectionName||"library",color:on?Ce.rawValue:"#888888",value:Ce.rawValue,resolvedValue:Ce.rawValue,resolvedType:on?"COLOR":"STRING",isReference:!1,referenceName:null,connectionsDisabled:!1})}Ze.set(mt,Oe)})});const bt=ee=>zf(ee,Sr),_t=ee=>{const Ce=ee.variables.find(mt=>!mt.isVirtual),Pe=Ce?ce.get(Ce.id):null,et=(Pe==null?void 0:Pe.resolvedType)==="COLOR";return{group:ee,isColorType:et,variableType:et?"COLOR":"FLOAT",connectedVars:vl,isHighlighted:fe&&Q.has(ee.key),isDimmed:fe&&!Q.has(ee.key),highlightActive:fe,highlightedVars:Y,highlightedVarSeed:I,onHighlightPath:Vi,onHighlightVariable:Fi,onGeneratorOpen:Kt,onShowColorMenu:en,onAddVariable:St,onRenameGroup:Et,onDuplicateGroup:dn,onEditAsText:ze,onLevelUp:ut,onDeleteGroup:pt,onRenameVariable:ji,onDeleteVariable:Oi,onDisconnect:ai}},ur=(ee,Ce,Pe)=>({id:ee.key,type:"groupNode",position:Ce,hidden:bt(ee),...Pe?{parentId:Pe,extent:"parent"}:{},data:_t(ee),dragHandle:".group-header"}),hn=ee=>ee.kind==="standard"||ee.kind==="collection",Ht=Mt.filter(hn),Wn=Mt.filter(ee=>!hn(ee)),zt=[];$.forEach(ee=>{zt.push({id:`${L5}${ee.tier}`,type:"tierLabel",position:{x:ee.x,y:JY},style:{width:ee.width,height:wP,pointerEvents:"none"},draggable:!1,selectable:!1,connectable:!1,focusable:!1,deletable:!1,data:ee})}),Wn.forEach(ee=>{const Ce=_[ee.key]||{x:ee.initialX,y:ee.initialY};zt.push(ur(ee,Ce,null))});const Ie=HY(Ht,P,_),ct=new Map;Ht.forEach(ee=>ct.set(ee.key,bt(ee)));const de=new Map,Re=new Map;Ie.forEach(ee=>{ee.kind==="wrapper"&&ee.group&&de.set(ee.group.key,ee.id),ee.parentId&&Re.set(ee.parentId,(Re.get(ee.parentId)||0)+1)}),z.current=de;const Me=ee=>de.get(ee)??ee;if(Ie.forEach(ee=>{if(ee.kind==="card")zt.push(ur(ee.group,ee.position,ee.parentId));else{const Ce=Ht.some(et=>{if(et.collectionId!==ee.collectionId)return!1;const mt=et.sourceGroupName||"";return(ee.path===""||mt===ee.path||mt.startsWith(ee.path+"/"))&&!ct.get(et.key)}),Pe={path:ee.path,collectionId:ee.collectionId,title:ee.path||K.get(ee.collectionId)||ee.collectionId,onLevelUp:ut,onUngroup:Je,card:ee.group?_t(ee.group):null,cardHidden:ee.group?ct.get(ee.group.key)??!1:!0,hasChildren:(Re.get(ee.id)||0)>0};zt.push({id:ee.id,type:"groupWrapper",position:ee.position,...ee.parentId?{parentId:ee.parentId,extent:"parent"}:{},hidden:!Ce,selectable:!1,style:{width:ee.width,height:ee.height},data:Pe,dragHandle:".group-header"})}}),i){const Ce=Mt.reduce((Nt,Tn)=>Math.max(Nt,Tn.initialX+fr),0)+E2,Pe=Array.from(Ze.entries());let et=0;Pe.forEach(([Nt,Tn])=>{const It={key:Nt,title:Tn.title,variables:Tn.nodes,x:0,y:0,initialX:Ce,initialY:et,kind:"shader",sourceGroupName:Tn.title,headerFill:lg,collectionId:Tn.collectionId},Vr=_[Nt]||{x:Ce,y:et};zt.push({id:Nt,type:"groupNode",position:Vr,hidden:!1,data:{group:It,isColorType:Tn.nodes.every(Am=>Am.resolvedType==="COLOR"),variableType:"FLOAT",connectedVars:vl,isHighlighted:!1,isDimmed:!1,highlightActive:fe,highlightedVars:Y,highlightedVarSeed:I,onHighlightPath:Vi,onHighlightVariable:Fi,onGeneratorOpen:Kt,onShowColorMenu:en,onAddVariable:St,onRenameGroup:Et,onDuplicateGroup:dn,onEditAsText:ze,onLevelUp:ut,onDeleteGroup:pt,onRenameVariable:ji,onDeleteVariable:Oi,onDisconnect:ai},dragHandle:".group-header"}),et+=zr(It)+yi});const mt=Pe.length>0?Ce+fr+E2:Ce,Oe=Cf(i.id),on=_[Oe]||{x:mt,y:0};zt.push({id:Oe,type:"propertyNode",position:on,data:{nodeName:i.name,nodeType:i.type,layers:m,truncated:i.truncated},dragHandle:".group-header"})}const it=new Map;zt.forEach(ee=>{if(ee.type==="groupNode"){it.set(ee.id,!ee.hidden);return}if(ee.type==="groupWrapper"){const Ce=ee.data;Ce.card&&it.set(Ce.card.group.key,!ee.hidden&&!Ce.cardHidden)}});const pn=fn.map(ee=>{const Ce=Yt.get(ee.toVar),Pe=it.get(ee.fromGroup)??!1,et=it.get(ee.toGroup)??!1,mt=!Pe||!et;return{id:ee.id,source:Me(ee.fromGroup),target:Me(ee.toGroup),sourceHandle:`${ee.fromVar}::out`,targetHandle:`${ee.toVar}::in`,type:"customEdge",hidden:mt,data:{kind:ee.kind,receiverName:(Ce==null?void 0:Ce.node.id)||"",receiverShortName:(Ce==null?void 0:Ce.node.shortName)||"",resolvedValue:(Ce==null?void 0:Ce.node.resolvedValue)||"",isHighlighted:fe&&Z.has(ee.id),isDimmed:fe&&!Z.has(ee.id),isGroupSibling:fe&&!Z.has(ee.id)&&(ye.has(ee.fromVar)||ye.has(ee.toVar)),onDisconnect:ai}}});if(i){const ee=Cf(i.id);m.forEach(Ce=>Ce.entries.forEach((Pe,et)=>{if(Pe.kind!=="variable"||!Pe.token||!Pe.bindingTarget)return;const mt=Yt.get(Pe.token.name),Oe=mt?mt.group:Dt.get(Pe.token.name);if(!Oe)return;const on=it.get(Oe)??!1,Nt=Pe.bindingTarget,Tn=Ce.id;pn.push({id:`prop-edge:${Ce.layerIndex}:${et}`,source:Me(Oe),target:ee,sourceHandle:`${Pe.token.name}::out`,targetHandle:yp(Ce.layerIndex,et,"in"),type:"customEdge",hidden:!on,data:{kind:"reference",receiverName:Pe.property,receiverShortName:Pe.property,resolvedValue:"",onUnbindProperty:hs,unbindNodeId:Tn,unbindTarget:Nt}})}))}ie(zt),rt(pn)},[Mt,fn,vl,Yt,L,V,P,$,Sr,ce,K,i,m,p,v,Kt,St,Et,dn,ze,ut,Je,pt,ji,Oi,ai,hs,en,Vi,Fi,O,I,ie,rt]);const Ja=w.useMemo(()=>{const _=Mt.map(Z=>`${Z.key}[${Z.variables.map(ye=>`${ye.name}|${ye.connectionsDisabled?1:0}|${ye.virtualType||""}`).join(",")}]`).join(";"),Q=Mt.filter(Z=>R5(Z,P)).map(Z=>`${Z.key}|${zf(Z,Sr)?0:1}`).join(","),Y=i?`${Cf(i.id)}[${m.map(Z=>`${Z.layerIndex}:${Z.entries.map(ye=>{var fe;return`${ye.kind}|${ye.bindingTarget?1:0}|${((fe=ye.token)==null?void 0:fe.name)||""}`}).join(",")}`).join(";")}]`:"";return`${_}#${Q}#${Y}`},[Mt,i,m,P,Sr]),vd=w.useRef(null),mo=w.useRef(null);w.useEffect(()=>{if(vd.current!==Ja&&(vd.current=Ja,mo.current=We),mo.current===null||We.length===0||We===mo.current)return;const _=We.map(Y=>Y.id),Q=requestAnimationFrame(()=>{mo.current=null,h(_)});return()=>cancelAnimationFrame(Q)},[We,Ja,h]);const eu=w.useRef(null),Mm=w.useCallback(_=>{Te(_),_.some(Y=>Y.type==="position"&&Y.position)&&(eu.current&&clearTimeout(eu.current),eu.current=setTimeout(()=>{const Y=U.getNodes(),Z={};Y.forEach(fe=>{b4(fe.id)||(fe.parentId?Z[`rel:${fe.id}`]={x:fe.position.x,y:fe.position.y}:Z[fe.id]={x:fe.position.x,y:fe.position.y})});const ye="graph-positions";b(Z),Se({type:"set-client-storage",key:ye,value:Z})},300))},[Te,U,v,b]),Dm=w.useCallback(_=>{if(!_.sourceHandle||!_.targetHandle)return;const Q=_.sourceHandle.startsWith("prop:"),Y=_.targetHandle.startsWith("prop:");if(Q||Y){if(Q===Y)return;const _t=Q?_.sourceHandle:_.targetHandle,ur=Q?_.targetHandle:_.sourceHandle,hn=_t.match(/^prop:(\d+):(\d+)::/);if(!hn)return;const Ht=m[parseInt(hn[1],10)],Wn=Ht==null?void 0:Ht.entries[parseInt(hn[2],10)];if(!Ht||!Wn||!Wn.bindingTarget)return;const zt=ur.replace("::out","").replace("::in",""),Ie=Yt.get(zt);if(!Ie||Ie.node.connectionsDisabled)return;Se({type:"bind-node-property",nodeId:Ht.id,target:Wn.bindingTarget,variableId:Ie.node.id});return}const Z=_.sourceHandle.replace("::out",""),ye=_.targetHandle.replace("::in",""),fe=Yt.get(Z),Qe=Yt.get(ye);if(!fe||!Qe||fe.node.connectionsDisabled||Qe.node.connectionsDisabled)return;const Dt=`{${fe.node.name}}`,Ze=ce.get(Qe.node.id),bt=Ze?Qo(t,Ze.collectionId,r):r;Se({type:"update-variable-value",id:Qe.node.id,value:Dt,modeId:bt})},[t,r,Yt,ce,m]),tu=w.useCallback(_=>{const Q=_||C,Y=U.getNodes(),Z=Mt.map(Ie=>{const ct=j(Ie.key),de=Y.find(Re=>Re.id===ct);return{...Ie,x:(de==null?void 0:de.position.x)??Ie.initialX,y:(de==null?void 0:de.position.y)??Ie.initialY}}),ye=new Map;Y.forEach(Ie=>{var ct;Ie.type==="groupWrapper"&&ye.set(Ie.id,{position:Ie.position,measuredHeight:(ct=Ie.measured)==null?void 0:ct.height})});const{units:fe,hiddenUnits:Qe,heightOverrides:Dt,unitKeyByGroupKey:Ze,hiddenByKey:bt}=IP(Z,P,Sr,ye),_t=[],ur=[];fn.forEach(Ie=>{const ct=Ze.get(Ie.fromGroup),de=Ze.get(Ie.toGroup);if(!ct||!de||ct===de)return;const Re={...Ie,fromGroup:ct,toGroup:de};_t.push(Re),!(bt.get(Ie.fromGroup)||bt.get(Ie.toGroup))&&ur.push(Re)});const{positions:hn,tiers:Ht}=AP(fe,ur,Q.gapX,Q.gapY,{heightOverrides:Dt,depthConnections:_t});if(Qe.length>0){Qe.sort(Hf);const Ie=hn.size>0?Math.max(...Array.from(hn.values(),de=>de.x))+fr+Q.gapX:0;let ct=0;Qe.forEach(de=>{hn.set(de.key,{x:Ie,y:ct}),ct+=(Dt.get(de.key)??zr(de))+Q.gapY})}const Wn={};Y.forEach(Ie=>{Ie.parentId||b4(Ie.id)||(Wn[Ie.id]={x:Ie.position.x,y:Ie.position.y})}),se.current=Wn,ne.current=$,Ee(!0),ie(Ie=>Ie.map(ct=>{if(ct.parentId)return ct;const de=hn.get(ct.id);return de?{...ct,position:{x:de.x,y:de.y}}:ct}));const zt={};hn.forEach((Ie,ct)=>{zt[ct]=Ie}),b(zt),M(Ie=>Ie+1),Se({type:"set-client-storage",key:"graph-positions",value:zt}),D(Ht),Se({type:"set-client-storage",key:"graph-tier-labels",value:Ht}),setTimeout(()=>{U.fitView({padding:.15,duration:400})},50)},[U,Mt,fn,C,P,Sr,ie,v,$,j]),Nm=w.useCallback(()=>{const _=se.current;if(!_)return;ie(Y=>Y.map(Z=>{if(Z.parentId)return Z;const ye=_[Z.id];return ye?{...Z,position:{x:ye.x,y:ye.y}}:Z})),b(_),M(Y=>Y+1),Se({type:"set-client-storage",key:"graph-positions",value:_});const Q=ne.current;D(Q),Se({type:"set-client-storage",key:"graph-tier-labels",value:Q}),se.current=null,ne.current=[],Ee(!1)},[ie]),nu=w.useCallback(()=>{if(!i)return;const _=new Set([Cf(i.id)]);m.forEach(Dt=>Dt.entries.forEach(Ze=>{if(Ze.kind!=="variable"||!Ze.token)return;const bt=Yt.get(Ze.token.name);if(bt)_.add(j(bt.group));else{const _t=Ze.token.name.split("/"),ur=_t.length>1?_t.slice(0,-1).join("/"):Ze.token.name;_.add(`ext-group:${ur}`)}}));const Q=U.getViewport().zoom||1;let Y=1/0,Z=1/0,ye=-1/0,fe=-1/0,Qe=!1;_.forEach(Dt=>{const Ze=U.getNode(Dt),bt=document.querySelector(`.react-flow__node[data-id="${CSS.escape(Dt)}"]`);if(!Ze||!bt)return;const _t=bt.getBoundingClientRect();Y=Math.min(Y,Ze.position.x),Z=Math.min(Z,Ze.position.y),ye=Math.max(ye,Ze.position.x+_t.width/Q),fe=Math.max(fe,Ze.position.y+_t.height/Q),Qe=!0}),Qe&&U.fitBounds({x:Y,y:Z,width:ye-Y,height:fe-Z},{padding:.2,duration:400})},[i,m,Yt,U,j]),bd=i==null?void 0:i.id;w.useEffect(()=>{if(!bd)return;const _=setTimeout(()=>nu(),150);return()=>clearTimeout(_)},[bd,nu]);const wd=w.useCallback(()=>{const _=du({gapX:Number.parseInt(k.gapX,10),gapY:Number.parseInt(k.gapY,10)});S(_),E(_d(_)),Se({type:"set-client-storage",key:"graph-layout-settings",value:_}),tu(_)},[k,v,tu]);return g.jsxs("div",{className:"flex flex-col w-full h-full",ref:f,children:[g.jsx("div",{className:"flex items-center gap-3 p-3 bg-base border-b border-border shrink-0",onMouseDown:_=>_.stopPropagation(),children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Ye,{variant:"secondary",onClick:$t,disabled:oe.size===0,children:"New Group"}),g.jsx(Ye,{variant:"secondary",onClick:()=>tu(),children:"Arrange Grid"}),le&&g.jsx(Ye,{variant:"secondary",onClick:Nm,children:"Undo Arrange"}),i&&!s&&g.jsx(Ye,{variant:"secondary",onClick:nu,children:"Focus Selection"}),g.jsxs(Sn,{position:"bottom-right",onOpenChange:_=>{_&&E(_d(C))},children:[g.jsx(Sn.Trigger,{asChild:!0,children:g.jsx(Ye,{variant:"secondary",children:"Grid Settings"})}),g.jsxs(Sn.Menu,{className:"min-w-50 p-3",children:[g.jsx("div",{className:"font-semibold mb-3 text-sm",children:"Grid Layout"}),g.jsxs("div",{className:"mb-3",children:[g.jsx("label",{htmlFor:"grid-gap-x",className:"block text-[11px] mb-1 opacity-70",children:"Horizontal gap"}),g.jsx(mr,{id:"grid-gap-x",type:"number",min:"0",value:k.gapX,onChange:_=>E(Q=>({...Q,gapX:_.target.value}))})]}),g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{htmlFor:"grid-gap-y",className:"block text-[11px] mb-1 opacity-70",children:"Vertical gap"}),g.jsx(mr,{id:"grid-gap-y",type:"number",min:"0",value:k.gapY,onChange:_=>E(Q=>({...Q,gapY:_.target.value}))})]}),g.jsxs("div",{className:"flex gap-2 justify-end",children:[g.jsx(Ye,{variant:"ghost",onClick:()=>E(_d(C)),children:"Cancel"}),g.jsx(Ye,{variant:"primary",onClick:wd,children:"Apply"})]})]})]})]})}),g.jsxs("div",{className:"relative flex-1 w-full flex min-h-0",children:[g.jsx(j5,{selectedModeId:r,onModeChange:De,selectedTypes:W,onTypeToggle:Lt,selectedCollections:oe,onCollectionToggle:je,selectedGroups:ae,onGroupToggle:ht,highlightedGroupKey:O,onHighlightGroup:xl,onZoomToCollection:Ft,showTypeFilters:!0}),g.jsx("div",{className:"flex-1 relative",children:g.jsxs(MK,{nodes:We,edges:Ke,onNodesChange:Mm,onEdgesChange:te,onConnect:Dm,onNodeClick:ho,onPaneClick:po,nodeTypes:ZY,edgeTypes:nX,fitView:!1,minZoom:.2,maxZoom:3,defaultViewport:{x:50,y:50,zoom:1},proOptions:{hideAttribution:!0},connectionLineStyle:{stroke:Qs,strokeWidth:2,strokeDasharray:"4 2"},className:"w-full h-full bg-base-2!",snapToGrid:!0,snapGrid:[8,8],selectionOnDrag:!0,selectionMode:Ba.Partial,panOnDrag:[1,2],panOnScroll:!0,children:[g.jsx(IK,{variant:Ji.Dots,gap:16,size:1}),g.jsx(eY,{pannable:!0,zoomable:!0}),g.jsx(_K,{showInteractive:!1})]})})]}),g.jsx(QY,{isOpen:bl,items:Sm,onClose:$m,onActivate:Em}),X.show&&g.jsx(sY,{position:X.position,variableId:X.variableId,currentValue:X.value,onClose:he})]})}function iX(){return g.jsx(E8,{children:g.jsx(rX,{})})}function sX(){const{variables:t,selectedCollectionIds:e}=Zt(),n=t.filter(r=>e.has(r.collectionId));return g.jsxs("div",{className:"relative w-full h-full",children:[g.jsx(iX,{}),n.length===0&&g.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center z-[1]",children:g.jsx("p",{className:"text-sm text-text opacity-50",children:"No variables in selected collections"})})]})}function oX(){const{collections:t,variables:e}=Zt(),[n,r]=w.useState(!1),i=()=>{const o=`Delete ALL variables and collections?
|
|
171
|
+
|
|
172
|
+
This will delete:
|
|
173
|
+
- ${t.length} collections
|
|
174
|
+
- ${e.length} variables
|
|
175
|
+
|
|
176
|
+
This action cannot be undone!`;confirm(o)&&(r(!0),Se({type:"delete-all-variables"}),setTimeout(()=>r(!1),2e3))},s=o=>{const l=`Import "${o}" preset?
|
|
177
|
+
|
|
178
|
+
This will create new variables and collections.`;confirm(l)&&Se({type:"import-preset",preset:o})};return g.jsxs("div",{className:"flex flex-col gap-8 p-6 max-w-2xl mx-auto",children:[g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsx("h3",{className:"text-lg font-bold text-text",children:"Danger Zone"}),g.jsx("p",{className:"text-sm text-text/60 leading-relaxed",children:"Destructive actions that cannot be undone."}),g.jsx(Ye,{variant:"danger",onClick:i,disabled:n||e.length===0,children:n?"Deleting...":"Delete All Variables"}),g.jsxs("p",{className:"text-sm text-text/60 leading-relaxed",children:["Current: ",t.length," collections, ",e.length," variables"]})]}),g.jsx("div",{className:"border-t border-border"}),g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsx("h3",{className:"text-lg font-bold text-text",children:"Import Presets"}),g.jsx("p",{className:"text-sm text-text/60 leading-relaxed",children:"Quick start with pre-configured design token sets."}),g.jsxs("div",{className:"flex flex-col gap-3",children:[g.jsx(Ye,{variant:"outline",onClick:()=>s("tailwind-complete"),children:"Import Tailwind CSS"}),g.jsx(Ye,{variant:"outline",onClick:()=>s("basic"),children:"Import Basic Tokens"})]})]})]})}function lX({activeTab:t,status:e}){const n=()=>{switch(t){case"table":return g.jsx(HP,{status:e});case"json":return g.jsx(OF,{});case"relationships":return g.jsx(sX,{});case"settings":return g.jsx(oX,{});default:return null}},r=t==="relationships";return g.jsx("div",{id:`${t}-tab`,className:`flex-1 ${r?"overflow-hidden":"overflow-auto"}`,children:n()})}const B8=w.forwardRef(({options:t,placeholder:e,error:n,fullWidth:r=!1,className:i="",id:s,children:o,...l},a)=>{const u=s||`select-${Math.random().toString(36).substr(2,9)}`,c=["w-full p-2 rounded border bg-base text-text text-sm leading-tight","transition-colors duration-200",n?"border-danger focus:border-danger":"border-border focus:border-primary","focus:outline-1 focus:outline-text focus:outline-offset-2","hover:border-primary/50","disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-base-2","appearance-none bg-no-repeat bg-right pr-8","h-[34px]",i].filter(Boolean).join(" "),d=()=>g.jsxs(g.Fragment,{children:[e&&g.jsx("option",{value:"",disabled:!0,children:e}),t==null?void 0:t.map(h=>g.jsx("option",{value:h.value,disabled:h.disabled,children:h.label},h.value))]}),f=()=>g.jsxs(g.Fragment,{children:[e&&g.jsx("option",{value:"",disabled:!0,children:e}),o]});return g.jsxs("div",{className:"relative w-full",children:[g.jsx("select",{ref:a,id:u,className:c,"aria-invalid":!!n,"aria-describedby":n?`${u}-error`:void 0,autoComplete:"off",...l,children:t?d():f()}),g.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-text-secondary",children:g.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),n&&g.jsx("span",{id:`${u}-error`,className:"text-xs text-danger mt-1 block",role:"alert",children:n})]})});B8.displayName="Select";function aX({children:t,className:e="",...n}){return g.jsx("option",{className:`bg-base text-text py-1 ${e}`,...n,children:t})}function uX({label:t,children:e,className:n="",...r}){return g.jsx("optgroup",{label:t,className:`font-medium text-text-secondary ${n}`,...r,children:e})}const xi=Object.assign(B8,{Option:aX,Group:uX});function O8({options:t,value:e,onChange:n,variant:r="bordered",fullWidth:i=!1,className:s=""}){const o=r==="bordered"?"flex gap-1 border border-border rounded p-0.5":"flex gap-1 bg-base-2 rounded p-1",l=a=>{const u="flex-1 rounded text-xs font-medium transition-all";return r==="bordered"?`${u} px-3 py-1.5 ${a?"bg-primary text-base shadow-sm":"bg-transparent text-text hover:bg-base-2"}`:`${u} px-3 py-1.5 ${a?"bg-primary text-base":"bg-transparent text-text hover:bg-base-3"}`};return g.jsx("div",{className:`${o} ${i?"w-full":""} ${s}`,role:"tablist",children:t.map(a=>g.jsxs("button",{type:"button",role:"tab","aria-selected":e===a.value,className:`${l(e===a.value)} flex items-center justify-center gap-1`,onClick:()=>n(a.value),children:[a.label,a.badge&&g.jsx("span",{onClick:u=>{a.onBadgeClick&&(u.stopPropagation(),a.onBadgeClick(u))},className:"inline-flex items-center justify-center w-4 h-4",children:a.badge})]},a.value))})}const cX=[{value:"lightness",label:"Lightness"},{value:"saturation",label:"Saturation"},{value:"hue",label:"Hue"}],El=200,kf=12,Sf=.05,dX={lightness:{min:-100,max:100,unit:"%",label:"Lightness offset"},saturation:{min:-100,max:100,unit:"%",label:"Saturation offset"},hue:{min:-180,max:180,unit:"deg",label:"Hue shift"}},Vv={lightness:{min:0,max:100},saturation:{min:-100,max:100},hue:{min:-180,max:180}};function $2(t){return dX[t]}function yo(t,e,n,r){const{min:i,max:s}=Vv[e],o=(st(t,i,s)-i)/(s-i);return n+o*(r-n)}function fX(t,e,n,r){const{min:i,max:s}=Vv[e],l=(st(t,n,r)-n)/(r-n);return st(i+l*(s-i),i,s)}function Zg(t,e,n){const r=Pn(e,n);return t.startValue===r.startValue&&t.leftHandle1.t===r.leftHandle1.t&&t.leftHandle1.value===r.leftHandle1.value&&t.leftHandle2.t===r.leftHandle2.t&&t.leftHandle2.value===r.leftHandle2.value&&t.rightHandle1.t===r.rightHandle1.t&&t.rightHandle1.value===r.rightHandle1.value&&t.rightHandle2.t===r.rightHandle2.t&&t.rightHandle2.value===r.rightHandle2.value&&t.endValue===r.endValue}function hX(t){return/^(.+)\/(\d+)$/.test(t)}function M2(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ef(t){const e=t.match(/\/(\d+)$/);return e?parseInt(e[1],10):0}function pX(t){const e=t.find(r=>/\/500$/.test(r.name))||t[Math.floor(t.length/2)]||t[0],n=e?Ir(e.value):null;return n?Zo(n):"#000000"}function mX(){var Ke,rt;const{modals:t,closeShadesModal:e,openColorPicker:n}=ar(),{variables:r,selectedCollectionId:i,getShadeGroupByGroupName:s,getShadeGroupBySourceId:o}=Zt(),l=!!t.shadesModal,a=((Ke=t.shadesModal)==null?void 0:Ke.groupName)||"",u=((rt=t.shadesModal)==null?void 0:rt.modeId)||null,[c,d]=w.useState(""),[f,h]=w.useState(""),[m,x]=w.useState("#000000"),[v,p]=w.useState(11),[y,b]=w.useState(Gn(11)),[C,S]=w.useState(()=>Pn(11,Gn(11))),[k,E]=w.useState(()=>Pn(11,Gn(11))),[$,D]=w.useState(()=>Pn(11,Gn(11))),[L,A]=w.useState("lightness"),[T,V]=w.useState(null),M=w.useRef(null),B=w.useRef(null),[N,O]=w.useState(0),I=w.useRef({lightness:Pn(11,Gn(11)),saturation:Pn(11,Gn(11)),hue:Pn(11,Gn(11))});w.useEffect(()=>{if(!l||!f)return;const te=()=>{B.current&&O(B.current.offsetWidth)},ce=requestAnimationFrame(te);return window.addEventListener("resize",te),()=>{cancelAnimationFrame(ce),window.removeEventListener("resize",te)}},[l,f]);const P=w.useMemo(()=>r.filter(te=>te.collectionId===i&&te.resolvedType==="COLOR"&&!hX(te.name)).sort((te,ce)=>te.name.localeCompare(ce.name)),[r,i]),F=w.useMemo(()=>c&&P.find(te=>te.id===c)||null,[c,P]),z=w.useMemo(()=>{if(!f||!i)return[];const te=new RegExp(`^${M2(f)}/\\d+$`);return r.filter(ce=>ce.collectionId===i&&ce.resolvedType==="COLOR"&&te.test(ce.name)).sort((ce,K)=>Ef(ce.name)-Ef(K.name))},[f,i,r]),j=w.useMemo(()=>F?o(F.id):f?s(f):null,[F,f,o,s]),R=w.useMemo(()=>j?j.deleteIds:z.map(te=>te.id),[j,z]),H=R.length>0,G=w.useCallback(te=>{if(!te||!i)return[];const ce=new RegExp(`^${M2(te)}/\\d+$`);return r.filter(K=>K.collectionId===i&&K.resolvedType==="COLOR"&&ce.test(K.name)).sort((K,X)=>Ef(K.name)-Ef(X.name))},[i,r]),U=w.useCallback((te,ce)=>{const K=(te==null?void 0:te.name)||ce||"",X=G(K),re=te?o(te.id):ce?s(ce):null,he=(re==null?void 0:re.config.shadeCount)||X.length||11,De=te?Ir(te.value)||Ir((re==null?void 0:re.config.sourceValue)||""):ce?Ir(pX(X)):null,je=De?Zo(De):"#000000";if(d((te==null?void 0:te.id)||""),h(K),A("lightness"),x(je),re){const ht=De?Dl(je,re.config.shadeCount):qn(re.config.baseIndex,re.config.shadeCount);p(re.config.shadeCount),b(ht),S(Un(re.config.lightnessCurve,re.config.shadeCount,ht)),E(Un(re.config.saturationCurve,re.config.shadeCount,ht)),D(Un(re.config.hueCurve,re.config.shadeCount,ht));return}const Lt=X.length>0?Vd(je,X,he):Dl(je,he);p(he),b(Lt),S(Pn(he,Lt)),E(Pn(he,Lt)),D(Pn(he,Lt))},[Vd,s,o,G]);w.useEffect(()=>{if(l){if(a){const te=P.find(ce=>ce.name===a)||null;U(te,a);return}if(F){U(F);return}d(""),h(""),x("#000000"),p(11),b(Gn(11)),S(Pn(11,Gn(11))),E(Pn(11,Gn(11))),D(Pn(11,Gn(11))),A("lightness")}},[l,a,P,F,U]),w.useEffect(()=>{if(!f)return;const te=j?Dl(m,v):z.length>0?Vd(m,z,v):Dl(m,v);te!==y&&(b(te),S(ce=>Un(ce,v,te)),E(ce=>Un(ce,v,te)),D(ce=>Un(ce,v,te)))},[m,y,Vd,Dl,f,z,j,v]);const se=te=>{const ce=te.target.value,K=P.find(X=>X.id===ce)||null;U(K)},ne=w.useMemo(()=>{switch(L){case"saturation":return k;case"hue":return $;default:return C}},[L,C,k,$]);w.useEffect(()=>{I.current={lightness:C,saturation:k,hue:$}},[C,k,$]);const le=w.useCallback((te,ce)=>{const K=Un(ce,v,y);switch(te){case"saturation":E(K);break;case"hue":D(K);break;default:S(K);break}},[y,v]),Ee=w.useMemo(()=>f?P5(m,f,v,y,C,k,$,$o,Mo):[],[m,y,f,$,C,k,v]),xe=w.useMemo(()=>Ee.map(te=>ZT(te.value)),[Ee]),W=w.useMemo(()=>({lightness:!Zg(C,v,y),saturation:!Zg(k,v,y),hue:!Zg($,v,y)}),[y,$,C,k,v]),oe=w.useCallback((te,ce,K)=>{if(te==="lightness"){const he=og(ce,v,y,$o,Mo);return st(he+K,0,100)}const{min:X,max:re}=Vv[te];return st(K,X,re)},[y,v]),ae=w.useCallback((te,ce,K)=>{if(te==="lightness"){const he=og(ce,v,y,$o,Mo),{min:De,max:je}=$2(te);return st(K-he,De,je)}const{min:X,max:re}=$2(te);return st(K,X,re)},[y,v]),we=w.useCallback(te=>{const ce=st(Number(te.target.value)||0,2,20),K=mP(y,v,ce);p(ce),b(K),S(X=>Un(X,ce,K)),E(X=>Un(X,ce,K)),D(X=>Un(X,ce,K))},[y,v]),$e=()=>{!f||!m||!i||!u||Ee.length===0||(Se({type:"update-shades",collectionId:i,modeId:u,deleteIds:R,shades:Ee,source:{id:F==null?void 0:F.id,name:f,value:Sa(m)},config:{shadeCount:v,baseIndex:y,lightValue:$o,darkValue:Mo,lightnessCurve:C,saturationCurve:k,hueCurve:$}}),e())},Ve=()=>{!f||R.length===0||!i||!u||(Se({type:"remove-shades",collectionId:i,modeId:u,deleteIds:R,source:{id:F==null?void 0:F.id,name:f,value:Sa(m)}}),e())},We=w.useCallback(te=>{le(te,Pn(v,y)),V(ce=>(ce==null?void 0:ce.property)===te?null:ce)},[y,le,v]),ie=w.useCallback((te,ce)=>{te.preventDefault(),V({target:ce,property:L})},[L]);w.useEffect(()=>{if(!T||N===0)return;const te=K=>{var dn;const X=I.current[T.property],re={...X},he=qn(y,v),De=Ea(v,he),je=kf,Lt=El-kf,ht=N/v,en=ht/2,Le=N-ht/2,ut=Math.max(1,Le-en),Je=(dn=M.current)==null?void 0:dn.getBoundingClientRect();if(!Je||Je.width===0||Je.height===0)return;const Kt=(K.clientX-Je.left)/Je.width*N,St=(K.clientY-Je.top)/Je.height*El,Et=fX(St,T.property,je,Lt);if(T.target==="leftHandle1"||T.target==="leftHandle2"||T.target==="rightHandle1"||T.target==="rightHandle2"){let ze=st((Kt-en)/ut,0,1);if(T.target==="leftHandle1"){const pt=st(X.leftHandle2.t-Sf,0,De);ze=st(ze,0,pt),re.leftHandle1={t:ze,value:ae(T.property,ze,Et)}}else if(T.target==="leftHandle2"){const pt=st(X.leftHandle1.t+Sf,0,De);ze=st(ze,pt,De),re.leftHandle2={t:ze,value:ae(T.property,ze,Et)}}else if(T.target==="rightHandle1"){const pt=st(X.rightHandle2.t-Sf,De,1);ze=st(ze,De,pt),re.rightHandle1={t:ze,value:ae(T.property,ze,Et)}}else{const pt=st(X.rightHandle1.t+Sf,De,1);ze=st(ze,pt,1),re.rightHandle2={t:ze,value:ae(T.property,ze,Et)}}}else{const ze=T.target==="startNode"?0:1,pt=ae(T.property,ze,Et);T.target==="startNode"?re.startValue=pt:re.endValue=pt}le(T.property,re)},ce=()=>{V(null)};return document.addEventListener("mousemove",te),document.addEventListener("mouseup",ce),()=>{document.removeEventListener("mousemove",te),document.removeEventListener("mouseup",ce)}},[y,T,ae,le,v,N]);const Te=()=>{const te=Un(ne,v,y),ce=v;if(ce<2||N===0)return null;const K=8,X=10,re=8,he=16,De=kf,je=El-kf,Lt=yo(0,L,De,je),ht=qn(y,ce);Ea(ce,ht);const en=N/ce,Le=en/2,ut=N-en/2,Je=Math.max(1,ut-Le),Kt=_f(te,ce,ht),St=[],Et=[];for(let Ft=0;Ft<ce;Ft++){const $t=Ft/(ce-1),Mt=Le+Je*$t,fn=Kt[Ft],Yt=oe(L,$t,fn),ps=yo(Yt,L,De,je);if(St.push({x:Mt,y:ps,value:Yt}),L==="lightness"){const Sr=og($t,ce,ht,$o,Mo);Et.push({x:Mt,y:yo(Sr,L,De,je)})}}const dn=St[0],ze=St[ht],pt=St[ce-1],Oi=Le+Je*te.leftHandle1.t,ji=yo(oe(L,te.leftHandle1.t,te.leftHandle1.value),L,De,je),ai=Le+Je*te.leftHandle2.t,hs=yo(oe(L,te.leftHandle2.t,te.leftHandle2.value),L,De,je),Vi=Le+Je*te.rightHandle1.t,Fi=yo(oe(L,te.rightHandle1.t,te.rightHandle1.value),L,De,je),ho=Le+Je*te.rightHandle2.t,po=yo(oe(L,te.rightHandle2.t,te.rightHandle2.value),L,De,je),ui=[`M ${dn.x} ${dn.y}`,`C ${Oi} ${ji}, ${ai} ${hs}, ${ze.x} ${ze.y}`,`C ${Vi} ${Fi}, ${ho} ${po}, ${pt.x} ${pt.y}`].join(" "),xl=L==="lightness"&&Et.length>1?Et.map((Ft,$t)=>`${$t===0?"M":"L"} ${Ft.x} ${Ft.y}`).join(" "):null,ci=(Ft,$t,Mt)=>g.jsxs("g",{children:[g.jsx("circle",{cx:$t,cy:Mt,r:he,fill:"transparent",style:{cursor:"move"},onMouseDown:fn=>ie(fn,Ft)}),g.jsx("rect",{x:$t-re,y:Mt-re,width:re*2,height:re*2,fill:"var(--color-text)",stroke:"var(--color-base)",strokeWidth:2,rx:2,style:{cursor:"move",pointerEvents:"none"},className:(T==null?void 0:T.target)===Ft?"handle-active":""})]},Ft);return g.jsxs("svg",{ref:M,viewBox:`0 0 ${N} ${El}`,style:{width:N,height:El},className:"curve-svg",children:[Array.from({length:ce+1}).map((Ft,$t)=>g.jsx("line",{x1:$t*en,y1:0,x2:$t*en,y2:El,stroke:"var(--color-border)",strokeWidth:1,opacity:.35},`grid-${$t}`)),L==="lightness"&&xl?g.jsx("path",{d:xl,fill:"none",stroke:"var(--color-border)",strokeWidth:1.5,strokeDasharray:"4,4",opacity:.8}):g.jsx("line",{x1:0,y1:Lt,x2:N,y2:Lt,stroke:"var(--color-border)",strokeWidth:1,strokeDasharray:"4,4",opacity:.3}),g.jsx("path",{d:ui,fill:"none",stroke:"var(--color-text)",strokeWidth:2}),g.jsx("line",{x1:dn.x,y1:dn.y,x2:Oi,y2:ji,stroke:"var(--color-text)",strokeWidth:1.5,opacity:.6}),g.jsx("line",{x1:ze.x,y1:ze.y,x2:ai,y2:hs,stroke:"var(--color-text)",strokeWidth:1.5,opacity:.6}),g.jsx("line",{x1:ze.x,y1:ze.y,x2:Vi,y2:Fi,stroke:"var(--color-text)",strokeWidth:1.5,opacity:.6}),g.jsx("line",{x1:pt.x,y1:pt.y,x2:ho,y2:po,stroke:"var(--color-text)",strokeWidth:1.5,opacity:.6}),ci("leftHandle1",Oi,ji),ci("leftHandle2",ai,hs),ci("rightHandle1",Vi,Fi),ci("rightHandle2",ho,po),St.map((Ft,$t)=>{const Mt=$t===0||$t===St.length-1,fn=$t===ht,Yt=xe[$t]||"var(--color-base)";return g.jsx("circle",{cx:Ft.x,cy:Ft.y,r:fn?X:K,fill:Yt,stroke:"var(--color-text)",strokeWidth:fn?3:2,className:fn?"curve-node curve-node-base":"curve-node",style:Mt?{cursor:"ns-resize"}:void 0,onMouseDown:Mt?ps=>ie(ps,$t===0?"startNode":"endNode"):void 0},`node-${$t}`)})]})};return l?g.jsx(fl,{isOpen:l,onClose:e,children:g.jsxs(hl,{width:800,children:[g.jsx(Ya,{title:"Generate Color Shades",onClose:e}),g.jsxs(Xa,{children:[!a&&g.jsxs("div",{className:"flex flex-col gap-2 mb-4",children:[g.jsx("label",{className:"text-xs font-medium text-text",children:"Select Color Group"}),g.jsxs(xi,{value:c,onChange:se,children:[g.jsx(xi.Option,{value:"",children:"-- Select a group --"}),P.map(te=>g.jsx(xi.Option,{value:te.id,children:te.name},te.id))]})]}),f&&g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsxs("div",{className:"flex gap-4 items-end",children:[g.jsxs("div",{className:"flex flex-col gap-2 flex-1",children:[g.jsx("label",{className:"text-xs font-medium text-text",children:"Base Color"}),g.jsxs("div",{className:"flex gap-2 items-center",children:[g.jsx("div",{className:"w-8 h-8 rounded border border-border bg-checkerboard cursor-pointer relative overflow-hidden flex-shrink-0",onClick:()=>n({initialColor:m,onConfirm:x}),children:g.jsx("div",{className:"absolute inset-0",style:{background:m}})}),g.jsx(mr,{type:"text",className:"font-mono text-xs",value:m,onChange:te=>x(te.target.value),placeholder:"#000000"})]})]}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{className:"text-xs font-medium text-text",children:"Shades"}),g.jsx(mr,{type:"number",className:"w-16",value:v,onChange:we,min:2,max:20})]}),g.jsxs("div",{className:"flex flex-col gap-2 flex-1",children:[g.jsx("label",{className:"text-xs font-medium text-text",children:"Curve Property"}),g.jsx(O8,{options:cX.map(te=>({...te,badge:W[te.value]?g.jsx(Fp,{}):void 0,onBadgeClick:W[te.value]?()=>We(te.value):void 0})),value:L,onChange:A,variant:"bordered",fullWidth:!0})]})]}),g.jsx("div",{className:"flex flex-col gap-3",children:g.jsxs("div",{className:"bg-base rounded-lg border border-border",children:[g.jsx("div",{ref:B,className:"w-full overflow-visible",style:{height:"200px"},children:Te()}),g.jsx("div",{className:"flex h-8 relative border border-border rounded overflow-hidden mt-2",children:xe.map((te,ce)=>g.jsxs("div",{className:"flex-1 relative",style:{background:te},title:ce===qn(y,v)?`${te} (Base)`:te,children:[ce===qn(y,v)&&g.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:g.jsx("div",{className:"w-2 h-2 rounded-full border-2 border-text",style:{backgroundColor:"var(--color-base)"}})}),ce<xe.length-1&&g.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-px",style:{backgroundColor:"var(--color-text)",opacity:.2}})]},ce))})]})})]})]}),g.jsxs(qa,{children:[H&&g.jsx(Ye,{variant:"danger",onClick:Ve,children:"Remove Shades"}),g.jsx("div",{className:"flex-1"}),g.jsx(Ye,{onClick:e,children:"Cancel"}),g.jsx(Ye,{variant:"primary",onClick:$e,disabled:!f||Ee.length===0,children:H?"Update":"Generate"})]})]})}):null}const gX=[{value:"1.125",label:"Minor Second (1.125)"},{value:"1.2",label:"Minor Third (1.2)"},{value:"1.25",label:"Major Third (1.25)"},{value:"1.333",label:"Perfect Fourth (1.333)"},{value:"1.414",label:"Augmented Fourth (1.414)"},{value:"1.5",label:"Perfect Fifth (1.5)"},{value:"1.618",label:"Golden Ratio (1.618)"},{value:"2",label:"Octave (2)"},{value:"custom",label:"Custom..."}],D2=[{value:"tshirt",label:"T-shirt (xs-4xl)",steps:"xs, sm, md, lg, xl, 2xl, 3xl, 4xl",baseStep:"md"},{value:"numeric",label:"Numeric (1-10)",steps:"1, 2, 3, 4, 5, 6, 7, 8, 9, 10",baseStep:"5"},{value:"gutenberg",label:"Gutenberg (xs-ultra)",steps:"xs, sm, md, lg, xl, 2xl, 3xl, ultra",baseStep:"md"},{value:"custom",label:"Custom..."}],Jg="1.25",e0=1.25,t0="tshirt",n0="xs, sm, md, lg, xl, 2xl, 3xl, 4xl",r0="md";function yX(t){if(!t||typeof t!="object")return null;const e=t;if(typeof e.ratioPreset!="string"||typeof e.customRatio!="number"||typeof e.stepsPreset!="string"||typeof e.stepsList!="string"||typeof e.baseStep!="string"||!Array.isArray(e.editableSteps))return null;const n=e.editableSteps.filter(r=>r&&typeof r.name=="string"&&typeof r.value=="number").map(r=>({name:r.name,value:r.value}));return{ratioPreset:e.ratioPreset,customRatio:e.customRatio,stepsPreset:e.stepsPreset,stepsList:e.stepsList,baseStep:e.baseStep,editableSteps:n}}function j8(t,e,n,r=new Set){var a;if(!t)return 0;const i=n&&((a=t.valuesByMode)!=null&&a[n])?t.valuesByMode[n]:t.value,s=Number.parseFloat(i);if(!Number.isNaN(s))return s;const o=i.match(/^\{(.+)\}$/);if(!o)return 0;const l=o[1];return r.has(l)?0:(r.add(l),j8(e.get(l)||null,e,n,r))}function xX(){var Ke,rt,te,ce;const{modals:t,closeStepsModal:e}=ar(),{variables:n,selectedCollectionId:r,selectedModeId:i}=Zt(),s=!!t.stepsModal,o=((Ke=t.stepsModal)==null?void 0:Ke.groupName)||"",l=((rt=t.stepsModal)==null?void 0:rt.collectionId)||r,[a,u]=w.useState(""),[c,d]=w.useState(""),[f,h]=w.useState(Jg),[m,x]=w.useState(e0),[v,p]=w.useState(t0),[y,b]=w.useState(n0),[C,S]=w.useState(r0),[k,E]=w.useState(!1),[$,D]=w.useState([]),[L,A]=w.useState(null),T=w.useRef(!1),V=w.useMemo(()=>n.filter(K=>K.collectionId===l&&K.resolvedType==="FLOAT"),[n,l]),M=w.useMemo(()=>new Map(V.map(K=>[K.name,K])),[V]),B=w.useMemo(()=>{const K=new Map;return V.forEach(X=>{const re=X.name.split("/"),he=re.length>1?re[0]:X.name,De=K.get(he)||[];De.push(X),K.set(he,De)}),Array.from(K.entries()).map(([X,re])=>{const he=re.find(De=>De.name===X)||re.find(De=>De.name.endsWith("/base"))||re[0]||null;return{name:X,count:re.length,firstVar:re[0]||null,variables:re,sourceVar:he,resolvedBaseValue:j8(he,M,i)}})},[V,M,i]),N=w.useMemo(()=>B.find(K=>K.name===a)||null,[B,a]),O=((te=N==null?void 0:N.sourceVar)==null?void 0:te.name)||"",I=O?`{${O}}`:"",P=(N==null?void 0:N.resolvedBaseValue)??0,F=O?`{${O}:${P}}`:"",z=((ce=N==null?void 0:N.sourceVar)==null?void 0:ce.id)||null;be.useEffect(()=>{if(!s){u("");return}u(K=>o||K),A(null)},[s,o,i]),be.useEffect(()=>{if(!s)return;if(!N){T.current=!1,d(""),E(!1),h(Jg),x(e0),p(t0),b(n0),S(r0),D([]);return}d(N.name),E(N.count>1),!!o||(T.current=!1,h(Jg),x(e0),p(t0),b(n0),S(r0),D([]))},[s,N,i,o]),be.useEffect(()=>{if(!s||!z)return;const K=X=>{const re=X.data.pluginMessage;if((re==null?void 0:re.type)!=="step-modal-state"||re.sourceVariableId!==z||re.modeId!==(i||null))return;const he=yX(re.state);he&&(T.current=!0,h(he.ratioPreset),x(he.customRatio),p(he.stepsPreset),b(he.stepsList),S(he.baseStep),D(he.editableSteps))};return window.addEventListener("message",K),Se({type:"get-step-modal-state",sourceVariableId:z,modeId:i}),()=>window.removeEventListener("message",K)},[s,z,i]);const j=w.useMemo(()=>y.split(",").map(K=>K.trim()).filter(Boolean),[y]),R=f==="custom"?m:parseFloat(f),H=w.useMemo(()=>{const K=j.indexOf(C);return K===-1?[]:j.map((X,re)=>{const he=re-K,De=P*Math.pow(R,he);return{name:X,value:Math.round(De*100)/100}})},[j,C,P,R]);be.useEffect(()=>{if(T.current){T.current=!1;return}H.length>0&&D(H)},[H]);const G=K=>{u(K.target.value)},U=K=>{const X=K.target.value;h(X),X!=="custom"&&x(parseFloat(X))},se=K=>{const X=K.target.value;p(X);const re=D2.find(he=>he.value===X);re&&re.steps&&(b(re.steps),"baseStep"in re&&re.baseStep&&S(re.baseStep))},ne=(K,X)=>{D(re=>{const he=[...re];return he[K]={...he[K],name:X},he})},le=(K,X)=>{D(re=>{const he=[...re];return he[K]={...he[K],value:X},he})},Ee=K=>{var re,he;if(((re=$[K])==null?void 0:re.name)===C)return;const X=(he=H[K])==null?void 0:he.value;X!==void 0&&D(De=>{const je=[...De];return je[K]={...je[K],value:X},je})},xe=K=>{var he,De,je;if(((he=$[K])==null?void 0:he.name)===C)return!1;const X=(De=$[K])==null?void 0:De.value,re=(je=H[K])==null?void 0:je.value;return X!==void 0&&re!==void 0&&X!==re},W=K=>{S(K)},oe=K=>{D(X=>{const re=X.filter((De,je)=>je!==K);return X[K].name===C&&re.length>0&&S(re[0].name),re})},ae=()=>{D(K=>{const X={name:`step-${Date.now()}`,value:0};return[...K,X]})},we=(K,X)=>{K.dataTransfer.effectAllowed="move",K.dataTransfer.setData("text/plain",String(X)),A(X)},$e=()=>{A(null)},Ve=K=>{K.preventDefault(),K.dataTransfer.dropEffect="move"},We=(K,X)=>{K.preventDefault();const re=parseInt(K.dataTransfer.getData("text/plain"),10);re!==X&&D(he=>{const De=[...he],[je]=De.splice(re,1);De.splice(X,0,je);const Lt=De.findIndex(ht=>ht.name===C);return Lt!==-1?De.map((ht,en)=>{const Le=en-Lt,ut=P*Math.pow(R,Le);return{...ht,value:Math.round(ut*100)/100}}):De})},ie=()=>{if(!c||$.length===0||!N)return;const K=$.map(he=>({name:`${c}/${he.name}`,value:he.name===C&&I?I:String(he.value)})),X={ratioPreset:f,customRatio:m,stepsPreset:v,stepsList:$.map(he=>he.name).join(", "),baseStep:C},re=N.variables.filter(he=>{var De;return he.id!==((De=N.sourceVar)==null?void 0:De.id)}).map(he=>he.id);Se({type:k?"update-steps":"create-steps",collectionId:l,deleteIds:re,steps:K,modeId:i,modalState:X}),e()},Te=()=>{z&&(Se({type:"remove-steps",sourceVariableId:z}),e())};return s?g.jsx(fl,{isOpen:s,onClose:e,children:g.jsxs(hl,{width:600,children:[g.jsx(Ya,{title:"Generate Number Steps",onClose:e}),g.jsxs(Xa,{children:[!o&&g.jsxs("div",{className:"flex flex-col gap-2 mb-4",children:[g.jsx("label",{className:"text-sm font-medium text-text",children:"Select Number Group"}),g.jsxs(xi,{value:a,onChange:G,children:[g.jsx(xi.Option,{value:"",children:"-- Select a group --"}),B.map(K=>g.jsxs(xi.Option,{value:K.name,children:[K.name," (",K.count,")"]},K.name))]})]}),a&&!N&&g.jsx("div",{className:"text-sm text-text-secondary p-4 text-center",children:"This number group is not available in the selected collection."}),a&&N&&g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{className:"text-sm font-medium text-text",children:"Base Reference"}),g.jsx(mr,{type:"text",value:F,readOnly:!0,fullWidth:!0})]}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{className:"text-sm font-medium text-text",children:"Scale Ratio"}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("div",{className:"flex-1",children:g.jsx(xi,{value:f,onChange:U,children:gX.map(K=>g.jsx(xi.Option,{value:K.value,children:K.label},K.value))})}),f==="custom"&&g.jsx(mr,{type:"number",value:m,onChange:K=>x(parseFloat(K.target.value)||1),min:1,step:.001,style:{width:80}})]})]}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{className:"text-sm font-medium text-text",children:"Steps"}),g.jsx(xi,{value:v,onChange:se,children:D2.map(K=>g.jsx(xi.Option,{value:K.value,children:K.label},K.value))})]}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsxs("div",{className:"grid gap-2",style:{gridTemplateColumns:"20px 40px 1fr 120px 60px"},children:[g.jsx("div",{}),g.jsx("label",{className:"text-xs text-text-secondary font-medium text-center m-0",children:"Base"}),g.jsx("label",{className:"text-xs text-text-secondary font-medium m-0",children:"Label"}),g.jsx("label",{className:"text-xs text-text-secondary font-medium text-right m-0",children:"Value"}),g.jsx("div",{})]}),g.jsx(Ye,{type:"button",size:"sm",onClick:ae,className:"ml-2",children:"+ Add Step"})]}),g.jsx("div",{className:"flex flex-col gap-1 max-h-96 overflow-y-auto",children:$.map((K,X)=>g.jsxs("div",{className:`grid gap-2 items-center p-2 rounded border ${K.name===C?"bg-primary/10 border-primary":"bg-base-2 border-border"} ${L===X?"opacity-50":""}`,style:{gridTemplateColumns:"20px 40px 1fr 120px 60px"},onDragOver:Ve,onDrop:re=>We(re,X),children:[g.jsx("div",{className:"flex items-center justify-center cursor-move text-text-secondary hover:text-text",title:"Drag to reorder",draggable:!0,onDragStart:re=>we(re,X),onDragEnd:$e,children:g.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor",children:[g.jsx("circle",{cx:"3",cy:"3",r:"1.5"}),g.jsx("circle",{cx:"9",cy:"3",r:"1.5"}),g.jsx("circle",{cx:"3",cy:"9",r:"1.5"}),g.jsx("circle",{cx:"9",cy:"9",r:"1.5"})]})}),g.jsx("div",{className:"flex justify-center",children:g.jsx(Hp,{name:"base-step",checked:K.name===C,onChange:()=>W(K.name)})}),g.jsx(mr,{type:"text",value:K.name,onChange:re=>ne(X,re.target.value),fullWidth:!0}),K.name===C?g.jsx(mr,{type:"text",value:F,readOnly:!0,title:`Resolved value: ${P}`,fullWidth:!0}):g.jsx(mr,{type:"number",value:K.value,onChange:re=>le(X,parseFloat(re.target.value)||0),step:"any",fullWidth:!0}),g.jsxs("div",{className:"flex items-center justify-end gap-1",children:[xe(X)&&g.jsx("button",{type:"button",className:"inline-flex items-center justify-center rounded transition-colors bg-transparent text-text hover:bg-base-2 active:bg-base-3 w-6 h-6 text-sm p-0",onClick:()=>Ee(X),title:"Reset to calculated value",children:g.jsx(Fp,{})}),g.jsx("button",{type:"button",className:"inline-flex items-center justify-center rounded transition-colors bg-transparent text-text hover:bg-base-2 active:bg-base-3 w-6 h-6 text-sm p-0 disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>oe(X),title:"Delete step",disabled:$.length<=1,children:g.jsx(Px,{})})]})]},X))})]})]})]}),g.jsxs(qa,{children:[k&&g.jsx(Ye,{variant:"danger",onClick:Te,children:"Remove Steps"}),g.jsx("div",{className:"flex-1"}),g.jsx(Ye,{onClick:e,children:"Cancel"}),g.jsx(Ye,{variant:"primary",onClick:ie,disabled:!a||!c||!N||!l,children:k?"Update":"Generate"})]})]})}):null}function vX(){const{modals:t,closeInputModal:e}=ar(),n=t.inputModal,[r,i]=w.useState(""),[s,o]=w.useState(!1),[l,a]=w.useState(null),u=w.useRef(null),c=w.useRef(null);w.useEffect(()=>{n&&(i(n.initialValue||""),o(!1),setTimeout(()=>{var p;return(p=u.current)==null?void 0:p.focus()},50))},[n]);const d=(n==null?void 0:n.suggestions)??[],f=w.useMemo(()=>{const p=r.trim().toLowerCase();return p.length<2?[]:d.filter(y=>{const b=y.toLowerCase();return b===p?!1:b.includes(p)})},[d,r]),h=s&&f.length>0;if(w.useLayoutEffect(()=>{if(!h)return;const p=()=>{const y=c.current;if(!y)return;const b=y.getBoundingClientRect();a({left:b.left,top:b.bottom+4,width:b.width})};return p(),window.addEventListener("resize",p),window.addEventListener("scroll",p,!0),()=>{window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0)}},[h,r]),!n)return null;const m=()=>{r.trim()&&(n.onConfirm(r.trim()),e())},x=p=>{p.key==="Enter"?m():p.key==="Escape"&&e()},v=p=>{var y;i(p),o(!1),(y=u.current)==null||y.focus()};return g.jsx(R8,{isOpen:!!n,onClose:e,title:n.title,width:300,footer:g.jsxs(g.Fragment,{children:[g.jsx(Ye,{onClick:e,children:"Cancel"}),g.jsx(Ye,{variant:"primary",onClick:m,children:n.confirmText})]}),children:g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{className:"text-xs font-medium text-text",children:n.label}),g.jsx("div",{ref:c,children:g.jsx(mr,{ref:u,type:"text",placeholder:"Enter name...",value:r,onChange:p=>{i(p.target.value),o(!0)},onFocus:()=>o(!0),onBlur:()=>o(!1),onKeyDown:x})}),h&&l&&Nx.createPortal(g.jsx("ul",{className:"fixed z-[60] max-h-40 overflow-y-auto rounded-lg border border-border bg-base py-1 shadow-lg list-none m-0 p-0",style:{left:l.left,top:l.top,width:l.width},children:f.map(p=>g.jsx("li",{children:g.jsx("button",{type:"button",className:"block w-full cursor-pointer border-0 bg-transparent px-3 py-2 text-left text-xs text-text hover:bg-base-2 transition-colors",onMouseDown:y=>{y.preventDefault(),v(p)},children:p})},p))}),document.body)]})})}function bX(){const{modals:t,closeAddVariableModal:e}=ar(),n=t.addVariableModal,[r,i]=w.useState(""),[s,o]=w.useState("COLOR"),l=w.useRef(null);if(w.useEffect(()=>{n&&(i(""),o("COLOR"),setTimeout(()=>{var c;return(c=l.current)==null?void 0:c.focus()},50))},[n]),!n)return null;const a=()=>{r.trim()&&(n.onConfirm(r.trim(),s),e())},u=c=>{c.key==="Enter"?a():c.key==="Escape"&&e()};return g.jsx(R8,{isOpen:!!n,onClose:e,title:n.title,width:320,footer:g.jsxs(g.Fragment,{children:[g.jsx(Ye,{onClick:e,children:"Cancel"}),g.jsx(Ye,{variant:"primary",onClick:a,children:n.confirmText})]}),children:g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{className:"text-xs font-medium text-text",children:"Variable name"}),g.jsx(mr,{ref:l,type:"text",placeholder:"Enter name...",value:r,onChange:c=>i(c.target.value),onKeyDown:u})]}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{className:"text-xs font-medium text-text",children:"Type"}),g.jsx("div",{className:"flex flex-col gap-1.5",children:["COLOR","FLOAT","STRING","BOOLEAN"].map(c=>g.jsxs("label",{className:"flex items-center gap-2.5 px-3 py-2 rounded border border-border cursor-pointer hover:bg-base-2 transition-colors",children:[g.jsx("input",{type:"radio",name:"variableType",value:c,checked:s===c,onChange:()=>o(c),className:"w-4 h-4 accent-primary cursor-pointer"}),g.jsxs("span",{className:"text-sm text-text select-none",children:[c==="COLOR"&&"Color",c==="FLOAT"&&"Number",c==="STRING"&&"String",c==="BOOLEAN"&&"Boolean"]})]},c))})]})]})})}w.createContext(null);const V8=w.createContext(null),F8=w.createContext(null),_8=w.createContext(null),wX=w.createContext(null);w.createContext({});w.createContext(null);w.createContext(null);const Bi=typeof document<"u"?be.useLayoutEffect:()=>{};function CX(t){let[e,n]=w.useState(t),r=w.useRef(e),i=w.useRef(null),s=w.useRef(()=>{if(!i.current)return;let l=i.current.next();if(l.done){i.current=null;return}r.current===l.value?s.current():n(l.value)});Bi(()=>{r.current=e,i.current&&s.current()});let o=w.useCallback(l=>{i.current=l(r.current),s.current()},[s]);return[e,o]}const H8={prefix:String(Math.round(Math.random()*1e10)),current:0},z8=be.createContext(H8),kX=be.createContext(!1);let i0=new WeakMap;function SX(t=!1){let e=w.useContext(z8),n=w.useRef(null);if(n.current===null&&!t){var r,i;let s=(i=be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||i===void 0||(r=i.ReactCurrentOwner)===null||r===void 0?void 0:r.current;if(s){let o=i0.get(s);o==null?i0.set(s,{id:e.current,state:s.memoizedState}):s.memoizedState!==o.state&&(e.current=o.id,i0.delete(s))}n.current=++e.current}return n.current}function EX(t){let e=w.useContext(z8),n=SX(!!t),r=`react-aria${e.prefix}`;return t||`${r}-${n}`}function $X(t){let e=be.useId(),[n]=w.useState(W8()),r=n?"react-aria":`react-aria${H8.prefix}`;return t||`${r}-${e}`}const MX=typeof be.useId=="function"?$X:EX;function DX(){return!1}function NX(){return!0}function AX(t){return()=>{}}function W8(){return typeof be.useSyncExternalStore=="function"?be.useSyncExternalStore(AX,DX,NX):w.useContext(kX)}let TX=!!(typeof window<"u"&&window.document&&window.document.createElement),pa=new Map,Tu;typeof FinalizationRegistry<"u"&&(Tu=new FinalizationRegistry(t=>{pa.delete(t)}));function Ws(t){let[e,n]=w.useState(t),r=w.useRef(null),i=MX(e),s=w.useRef(null);if(Tu&&Tu.register(s,i),TX){const o=pa.get(i);o&&!o.includes(r)?o.push(r):pa.set(i,[r])}return Bi(()=>{let o=i;return()=>{Tu&&Tu.unregister(s),pa.delete(o)}},[i]),w.useEffect(()=>{let o=r.current;return o&&n(o),()=>{o&&(r.current=null)}}),i}function PX(t,e){if(t===e)return t;let n=pa.get(t);if(n)return n.forEach(i=>i.current=e),e;let r=pa.get(e);return r?(r.forEach(i=>i.current=t),t):e}function N2(t=[]){let e=Ws(),[n,r]=CX(e),i=w.useCallback(()=>{r(function*(){yield e,yield document.getElementById(e)?e:void 0})},[e,r]);return Bi(i,[e,i,...t]),n}function G8(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}const li=t=>{var e;return(e=t==null?void 0:t.ownerDocument)!==null&&e!==void 0?e:document},Oo=t=>t&&"window"in t&&t.window===t?t:li(t).defaultView||window;function LX(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&typeof t.nodeType=="number"}function IX(t){return LX(t)&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in t}let RX=!1;function Fv(){return RX}function jo(t,e){if(!Fv())return e&&t?t.contains(e):!1;if(!t||!e)return!1;let n=e;for(;n!==null;){if(n===t)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:IX(n)?n=n.host:n=n.parentNode}return!1}const us=(t=document)=>{var e;if(!Fv())return t.activeElement;let n=t.activeElement;for(;n&&"shadowRoot"in n&&(!((e=n.shadowRoot)===null||e===void 0)&&e.activeElement);)n=n.shadowRoot.activeElement;return n};function xt(t){if(Fv()&&t.target instanceof Element&&t.target.shadowRoot){var e,n;if("composedPath"in t)return(e=t.composedPath()[0])!==null&&e!==void 0?e:null;if("composedPath"in t.nativeEvent)return(n=t.nativeEvent.composedPath()[0])!==null&&n!==void 0?n:null}return t.target}function _v(...t){return t.length===1&&t[0]?t[0]:e=>{let n=!1;const r=t.map(i=>{const s=A2(i,e);return n||(n=typeof s=="function"),s});if(n)return()=>{r.forEach((i,s)=>{typeof i=="function"?i():A2(t[s],null)})}}}function A2(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function U8(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=U8(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function BX(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=U8(t))&&(r&&(r+=" "),r+=e);return r}function jt(...t){let e={...t[0]};for(let n=1;n<t.length;n++){let r=t[n];for(let i in r){let s=e[i],o=r[i];typeof s=="function"&&typeof o=="function"&&i[0]==="o"&&i[1]==="n"&&i.charCodeAt(2)>=65&&i.charCodeAt(2)<=90?e[i]=G8(s,o):(i==="className"||i==="UNSAFE_className")&&typeof s=="string"&&typeof o=="string"?e[i]=BX(s,o):i==="id"&&s&&o?e.id=PX(s,o):i==="ref"&&s&&o?e.ref=_v(s,o):e[i]=o!==void 0?o:s}}return e}const OX=new Set(["id"]),jX=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),VX=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),FX=new Set(["dir","lang","hidden","inert","translate"]),T2=new Set(["onClick","onAuxClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onGotPointerCapture","onLostPointerCapture","onScroll","onWheel","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionCancel","onTransitionEnd","onTransitionRun","onTransitionStart"]),_X=/^(data-.*)$/;function Qa(t,e={}){let{labelable:n,isLink:r,global:i,events:s=i,propNames:o}=e,l={};for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&(OX.has(a)||n&&jX.has(a)||r&&VX.has(a)||i&&FX.has(a)||s&&(T2.has(a)||a.endsWith("Capture")&&T2.has(a.slice(0,-7)))||o!=null&&o.has(a)||_X.test(a))&&(l[a]=t[a]);return l}function Kc(t){if(HX())t.focus({preventScroll:!0});else{let e=zX(t);t.focus(),WX(e)}}let $f=null;function HX(){if($f==null){$f=!1;try{document.createElement("div").focus({get preventScroll(){return $f=!0,!0}})}catch{}}return $f}function zX(t){let e=t.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;e instanceof HTMLElement&&e!==r;)(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&n.push({element:e,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),e=e.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function WX(t){for(let{element:e,scrollTop:n,scrollLeft:r}of t)e.scrollTop=n,e.scrollLeft=r}function bm(t){var e;if(typeof window>"u"||window.navigator==null)return!1;let n=(e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands;return Array.isArray(n)&&n.some(r=>t.test(r.brand))||t.test(window.navigator.userAgent)}function Hv(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function co(t){let e=null;return()=>(e==null&&(e=t()),e)}const xp=co(function(){return Hv(/^Mac/i)}),K8=co(function(){return Hv(/^iPhone/i)}),Y8=co(function(){return Hv(/^iPad/i)||xp()&&navigator.maxTouchPoints>1}),wm=co(function(){return K8()||Y8()}),GX=co(function(){return bm(/AppleWebKit/i)&&!UX()}),UX=co(function(){return bm(/Chrome/i)}),zv=co(function(){return bm(/Android/i)}),KX=co(function(){return bm(/Firefox/i)});function Yc(t,e,n=!0){var r,i;let{metaKey:s,ctrlKey:o,altKey:l,shiftKey:a}=e;KX()&&(!((i=window.event)===null||i===void 0||(r=i.type)===null||r===void 0)&&r.startsWith("key"))&&t.target==="_blank"&&(xp()?s=!0:o=!0);let u=GX()&&xp()&&!Y8()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:o,altKey:l,shiftKey:a}):new MouseEvent("click",{metaKey:s,ctrlKey:o,altKey:l,shiftKey:a,detail:1,bubbles:!0,cancelable:!0});Yc.isOpening=n,Kc(t),t.dispatchEvent(u),Yc.isOpening=!1}Yc.isOpening=!1;let Ns=new Map,ky=new Set;function P2(){if(typeof window>"u")return;function t(r){return"propertyName"in r}let e=r=>{let i=xt(r);if(!t(r)||!i)return;let s=Ns.get(i);s||(s=new Set,Ns.set(i,s),i.addEventListener("transitioncancel",n,{once:!0})),s.add(r.propertyName)},n=r=>{let i=xt(r);if(!t(r)||!i)return;let s=Ns.get(i);if(s&&(s.delete(r.propertyName),s.size===0&&(i.removeEventListener("transitioncancel",n),Ns.delete(i)),Ns.size===0)){for(let o of ky)o();ky.clear()}};document.body.addEventListener("transitionrun",e),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?P2():document.addEventListener("DOMContentLoaded",P2));function YX(){for(const[t]of Ns)"isConnected"in t&&!t.isConnected&&Ns.delete(t)}function X8(t){requestAnimationFrame(()=>{YX(),Ns.size===0?t():ky.add(t)})}function pl(){let t=w.useRef(new Map),e=w.useCallback((i,s,o,l)=>{let a=l!=null&&l.once?(...u)=>{t.current.delete(o),o(...u)}:o;t.current.set(o,{type:s,eventTarget:i,fn:a,options:l}),i.addEventListener(s,a,l)},[]),n=w.useCallback((i,s,o,l)=>{var a;let u=((a=t.current.get(o))===null||a===void 0?void 0:a.fn)||o;i.removeEventListener(s,u,l),t.current.delete(o)},[]),r=w.useCallback(()=>{t.current.forEach((i,s)=>{n(i.eventTarget,i.type,s,i.options)})},[n]);return w.useEffect(()=>r,[r]),{addGlobalListener:e,removeGlobalListener:n,removeAllGlobalListeners:r}}function ih(t,e){let{id:n,"aria-label":r,"aria-labelledby":i}=t;return n=Ws(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(" "):i&&(i=i.trim().split(/\s+/).join(" ")),!r&&!i&&e&&(r=e),{id:n,"aria-label":r,"aria-labelledby":i}}function XX(t){const e=w.useRef(null),n=w.useRef(void 0),r=w.useCallback(i=>{if(typeof t=="function"){const s=t,o=s(i);return()=>{typeof o=="function"?o():s(null)}}else if(t)return t.current=i,()=>{t.current=null}},[t]);return w.useMemo(()=>({get current(){return e.current},set current(i){e.current=i,n.current&&(n.current(),n.current=void 0),i!=null&&(n.current=r(i))}}),[r])}var s0;const qX=(s0=be.useInsertionEffect)!==null&&s0!==void 0?s0:Bi;function Rn(t){const e=w.useRef(null);return qX(()=>{e.current=t},[t]),w.useCallback((...n)=>{const r=e.current;return r==null?void 0:r(...n)},[])}function QX(t,e){Bi(()=>{if(t&&t.ref&&e)return t.ref.current=e.current,()=>{t.ref&&(t.ref.current=null)}})}function ZX(t,e,n,r){let i=Rn(n),s=n==null;w.useEffect(()=>{if(s||!t.current)return;let o=t.current;return o.addEventListener(e,i,r),()=>{o.removeEventListener(e,i,r)}},[t,e,r,s])}function JX(t){return t.pointerType===""&&t.isTrusted?!0:zv()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function gd(t,e,n){let r=Rn(()=>{n&&n(e)});w.useEffect(()=>{var i;let s=t==null||(i=t.current)===null||i===void 0?void 0:i.form;return s==null||s.addEventListener("reset",r),()=>{s==null||s.removeEventListener("reset",r)}},[t])}var o0;const eq=typeof document<"u"?(o0=be.useInsertionEffect)!==null&&o0!==void 0?o0:be.useLayoutEffect:()=>{};function fo(t,e,n){let[r,i]=w.useState(t||e),s=w.useRef(r),o=w.useRef(t!==void 0),l=t!==void 0;w.useEffect(()=>{o.current,o.current=l},[l]);let a=l?t:r;eq(()=>{s.current=a});let[,u]=w.useReducer(()=>({}),{}),c=w.useCallback((d,...f)=>{let h=typeof d=="function"?d(s.current):d;Object.is(s.current,h)||(s.current=h,i(h),u(),n==null||n(h,...f))},[n]);return[a,c]}function Fn(t,e=-1/0,n=1/0){return Math.min(Math.max(t,e),n)}function Mf(t,e){let n=t,r=0,i=e.toString(),s=i.toLowerCase().indexOf("e-");if(s>0)r=Math.abs(Math.floor(Math.log10(Math.abs(e))))+s;else{let o=i.indexOf(".");o>=0&&(r=i.length-o)}if(r>0){let o=Math.pow(10,r);n=Math.round(n*o)/o}return n}function Xt(t,e,n,r){e=Number(e),n=Number(n);let i=(t-(isNaN(e)?0:e))%r,s=Mf(Math.abs(i)*2>=r?t+Math.sign(i)*(r-Math.abs(i)):t-i,r);return isNaN(e)?!isNaN(n)&&s>n&&(s=Math.floor(Mf(n/r,r))*r):s<e?s=e:!isNaN(n)&&s>n&&(s=e+Math.floor(Mf((n-e)/r,r))*r),s=Mf(s,r),s}function qt(t,e,n=10){const r=Math.pow(n,e);return Math.round(t*r)/r}const tq=Symbol("default");function Cm({values:t,children:e}){for(let[n,r]of t)e=be.createElement(n.Provider,{value:r},e);return e}function ml(t){let{className:e,style:n,children:r,defaultClassName:i,defaultChildren:s,defaultStyle:o,values:l,render:a}=t;return w.useMemo(()=>{let u,c,d;return typeof e=="function"?u=e({...l,defaultClassName:i}):u=e,typeof n=="function"?c=n({...l,defaultStyle:o||{}}):c=n,typeof r=="function"?d=r({...l,defaultChildren:s}):r==null?d=s:d=r,{className:u??i,style:c||o?{...o,...c}:void 0,children:d??s,"data-rac":"",render:a?f=>a(f,l):void 0}},[e,n,r,i,s,o,l,a])}function q8(t,e){let n=w.useContext(t);if(e===null)return null;if(n&&typeof n=="object"&&"slots"in n&&n.slots){let r=e||tq;if(!n.slots[r]){let i=new Intl.ListFormat().format(Object.keys(n.slots).map(o=>`"${o}"`)),s=e?`Invalid slot "${e}".`:"A slot prop is required.";throw new Error(`${s} Valid slot names are ${i}.`)}return n.slots[r]}return n}function Za(t,e,n){let r=q8(n,t.slot)||{},{ref:i,...s}=r,o=XX(w.useMemo(()=>_v(e,i),[e,i])),l=jt(s,t);return"style"in s&&s.style&&"style"in t&&t.style&&(typeof s.style=="function"||typeof t.style=="function"?l.style=a=>{let u=typeof s.style=="function"?s.style(a):s.style,c={...a.defaultStyle,...u},d=typeof t.style=="function"?t.style({...a,defaultStyle:c}):t.style;return{...c,...d}}:l.style={...s.style,...t.style}),[l,o]}function Wv(t=!0){let[e,n]=w.useState(t),r=w.useRef(!1),i=w.useCallback(s=>{r.current=!0,n(!!s)},[]);return Bi(()=>{r.current||n(!1)},[]),[i,e]}function Q8(t){const e=/^(data-.*)$/;let n={};for(const r in t)e.test(r)||(n[r]=t[r]);return n}function nq(t,e,n){let{render:r,...i}=e,s=w.useRef(null),o=w.useMemo(()=>_v(n,s),[n,s]);Bi(()=>{},[t,r]);let l={...i,ref:o};return r?r(l,void 0):be.createElement(t,l)}const L2={},gl=new Proxy({},{get(t,e){if(typeof e!="string")return;let n=L2[e];return n||(n=w.forwardRef(nq.bind(null,e)),L2[e]=n),n}}),Z8=7e3;let Er=null;function J8(t,e="assertive",n=Z8){Er?Er.announce(t,e,n):(Er=new iq,(typeof IS_REACT_ACT_ENVIRONMENT=="boolean"?IS_REACT_ACT_ENVIRONMENT:typeof jest<"u")?Er.announce(t,e,n):setTimeout(()=>{Er!=null&&Er.isAttached()&&(Er==null||Er.announce(t,e,n))},100))}function rq(t){Er&&Er.clear(t)}class iq{isAttached(){var e;return(e=this.node)===null||e===void 0?void 0:e.isConnected}createLog(e){let n=document.createElement("div");return n.setAttribute("role","log"),n.setAttribute("aria-live",e),n.setAttribute("aria-relevant","additions"),n}destroy(){this.node&&(document.body.removeChild(this.node),this.node=null)}announce(e,n="assertive",r=Z8){var i,s;if(!this.node)return;let o=document.createElement("div");typeof e=="object"?(o.setAttribute("role","img"),o.setAttribute("aria-labelledby",e["aria-labelledby"])):o.textContent=e,n==="assertive"?(i=this.assertiveLog)===null||i===void 0||i.appendChild(o):(s=this.politeLog)===null||s===void 0||s.appendChild(o),e!==""&&setTimeout(()=>{o.remove()},r)}clear(e){this.node&&((!e||e==="assertive")&&this.assertiveLog&&(this.assertiveLog.innerHTML=""),(!e||e==="polite")&&this.politeLog&&(this.politeLog.innerHTML=""))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<"u"&&(this.node=document.createElement("div"),this.node.dataset.liveAnnouncer="true",Object.assign(this.node.style,{border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"}),this.assertiveLog=this.createLog("assertive"),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog("polite"),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}}const sq=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),oq=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function lq(t){if(Intl.Locale){let n=new Intl.Locale(t).maximize(),r=typeof n.getTextInfo=="function"?n.getTextInfo():n.textInfo;if(r)return r.direction==="rtl";if(n.script)return sq.has(n.script)}let e=t.split("-")[0];return oq.has(e)}const eE=Symbol.for("react-aria.i18n.locale");function tE(){let t=typeof window<"u"&&window[eE]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([t])}catch{t="en-US"}return{locale:t,direction:lq(t)?"rtl":"ltr"}}let Sy=tE(),Pu=new Set;function I2(){Sy=tE();for(let t of Pu)t(Sy)}function aq(){let t=W8(),[e,n]=w.useState(Sy);return w.useEffect(()=>(Pu.size===0&&window.addEventListener("languagechange",I2),Pu.add(n),()=>{Pu.delete(n),Pu.size===0&&window.removeEventListener("languagechange",I2)}),[]),t?{locale:typeof window<"u"&&window[eE]||"en-US",direction:"ltr"}:e}const uq=be.createContext(null);function fs(){let t=aq();return w.useContext(uq)||t}const cq=Symbol.for("react-aria.i18n.locale"),dq=Symbol.for("react-aria.i18n.strings");let $l;class Gs{getStringForLocale(e,n){let i=this.getStringsForLocale(n)[e];if(!i)throw new Error(`Could not find intl message ${e} in ${n} locale`);return i}getStringsForLocale(e){let n=this.strings[e];return n||(n=fq(e,this.strings,this.defaultLocale),this.strings[e]=n),n}static getGlobalDictionaryForPackage(e){if(typeof window>"u")return null;let n=window[cq];if($l===void 0){let i=window[dq];if(!i)return null;$l={};for(let s in i)$l[s]=new Gs({[n]:i[s]},n)}let r=$l==null?void 0:$l[e];if(!r)throw new Error(`Strings for package "${e}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}constructor(e,n="en-US"){this.strings=Object.fromEntries(Object.entries(e).filter(([,r])=>r)),this.defaultLocale=n}}function fq(t,e,n="en-US"){if(e[t])return e[t];let r=hq(t);if(e[r])return e[r];for(let i in e)if(i.startsWith(r+"-"))return e[i];return e[n]}function hq(t){return Intl.Locale?new Intl.Locale(t).language:t.split("-")[0]}const R2=new Map,B2=new Map;class nE{format(e,n){let r=this.strings.getStringForLocale(e,this.locale);return typeof r=="function"?r(n,this):r}plural(e,n,r="cardinal"){let i=n["="+e];if(i)return typeof i=="function"?i():i;let s=this.locale+":"+r,o=R2.get(s);o||(o=new Intl.PluralRules(this.locale,{type:r}),R2.set(s,o));let l=o.select(e);return i=n[l]||n.other,typeof i=="function"?i():i}number(e){let n=B2.get(this.locale);return n||(n=new Intl.NumberFormat(this.locale),B2.set(this.locale,n)),n.format(e)}select(e,n){let r=e[n]||e.other;return typeof r=="function"?r():r}constructor(e,n){this.locale=e,this.strings=n}}const O2=new WeakMap;function pq(t){let e=O2.get(t);return e||(e=new Gs(t),O2.set(t,e)),e}function mq(t,e){return e&&Gs.getGlobalDictionaryForPackage(e)||pq(t)}function Gv(t,e){let{locale:n}=fs(),r=mq(t,e);return w.useMemo(()=>new nE(n,r),[n,r])}let l0=new Map,Ey=!1;try{Ey=new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay==="exceptZero"}catch{}let vp=!1;try{vp=new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style==="unit"}catch{}const rE={degree:{narrow:{default:"°","ja-JP":" 度","zh-TW":"度","sl-SI":" °"}}};class so{format(e){let n="";if(!Ey&&this.options.signDisplay!=null?n=yq(this.numberFormatter,this.options.signDisplay,e):n=this.numberFormatter.format(e),this.options.style==="unit"&&!vp){var r;let{unit:i,unitDisplay:s="short",locale:o}=this.resolvedOptions();if(!i)return n;let l=(r=rE[i])===null||r===void 0?void 0:r[s];n+=l[o]||l.default}return n}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,n){if(typeof this.numberFormatter.formatRange=="function")return this.numberFormatter.formatRange(e,n);if(n<e)throw new RangeError("End date must be >= start date");return`${this.format(e)} – ${this.format(n)}`}formatRangeToParts(e,n){if(typeof this.numberFormatter.formatRangeToParts=="function")return this.numberFormatter.formatRangeToParts(e,n);if(n<e)throw new RangeError("End date must be >= start date");let r=this.numberFormatter.formatToParts(e),i=this.numberFormatter.formatToParts(n);return[...r.map(s=>({...s,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...i.map(s=>({...s,source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!Ey&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!vp&&this.options.style==="unit"&&(e={...e,style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}constructor(e,n={}){this.numberFormatter=gq(e,n),this.options=n}}function gq(t,e={}){let{numberingSystem:n}=e;if(n&&t.includes("-nu-")&&(t.includes("-u-")||(t+="-u-"),t+=`-nu-${n}`),e.style==="unit"&&!vp){var r;let{unit:o,unitDisplay:l="short"}=e;if(!o)throw new Error('unit option must be provided with style: "unit"');if(!(!((r=rE[o])===null||r===void 0)&&r[l]))throw new Error(`Unsupported unit ${o} with unitDisplay = ${l}`);e={...e,style:"decimal"}}let i=t+(e?Object.entries(e).sort((o,l)=>o[0]<l[0]?-1:1).join():"");if(l0.has(i))return l0.get(i);let s=new Intl.NumberFormat(t,e);return l0.set(i,s),s}function yq(t,e,n){if(e==="auto")return t.format(n);if(e==="never")return t.format(Math.abs(n));{let r=!1;if(e==="always"?r=n>0||Object.is(n,0):e==="exceptZero"&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):r=n>0),r){let i=t.format(-n),s=t.format(n),o=i.replace(s,"").replace(/\u200e|\u061C/,"");return[...o].length!==1&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),i.replace(s,"!!!").replace(o,"+").replace("!!!",s)}else return t.format(n)}}const xq=new RegExp("^.*\\(.*\\).*$"),vq=["latn","arab","hanidec","deva","beng","fullwide"];class iE{parse(e){return a0(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,n,r){return a0(this.locale,this.options,e).isValidPartialNumber(e,n,r)}getNumberingSystem(e){return a0(this.locale,this.options,e).options.numberingSystem}constructor(e,n={}){this.locale=e,this.options=n}}const j2=new Map;function a0(t,e,n){let r=V2(t,e);if(!t.includes("-nu-")&&!r.isValidPartialNumber(n)){for(let i of vq)if(i!==r.options.numberingSystem){let s=V2(t+(t.includes("-u-")?"-nu-":"-u-nu-")+i,e);if(s.isValidPartialNumber(n))return s}}return r}function V2(t,e){let n=t+(e?Object.entries(e).sort((i,s)=>i[0]<s[0]?-1:1).join():""),r=j2.get(n);return r||(r=new bq(t,e),j2.set(n,r)),r}class bq{parse(e){let n=this.sanitize(e);if(this.symbols.group&&(n=Ml(n,this.symbols.group,"")),this.symbols.decimal&&(n=n.replace(this.symbols.decimal,".")),this.symbols.minusSign&&(n=n.replace(this.symbols.minusSign,"-")),n=n.replace(this.symbols.numeral,this.symbols.index),this.options.style==="percent"){let o=n.indexOf("-");n=n.replace("-",""),n=n.replace("+","");let l=n.indexOf(".");l===-1&&(l=n.length),n=n.replace(".",""),l-2===0?n=`0.${n}`:l-2===-1?n=`0.0${n}`:l-2===-2?n="0.00":n=`${n.slice(0,l-2)}.${n.slice(l-2)}`,o>-1&&(n=`-${n}`)}let r=n?+n:NaN;if(isNaN(r))return NaN;if(this.options.style==="percent"){var i,s;let o={...this.options,style:"decimal",minimumFractionDigits:Math.min(((i=this.options.minimumFractionDigits)!==null&&i!==void 0?i:0)+2,20),maximumFractionDigits:Math.min(((s=this.options.maximumFractionDigits)!==null&&s!==void 0?s:0)+2,20)};return new iE(this.locale,o).parse(new so(this.locale,o).format(r))}return this.options.currencySign==="accounting"&&xq.test(e)&&(r=-1*r),r}sanitize(e){return e=e.replace(this.symbols.literals,""),this.symbols.minusSign&&(e=e.replace("-",this.symbols.minusSign)),this.options.numberingSystem==="arab"&&(this.symbols.decimal&&(e=e.replace(",",this.symbols.decimal),e=e.replace("،",this.symbols.decimal)),this.symbols.group&&(e=Ml(e,".",this.symbols.group))),this.symbols.group==="’"&&e.includes("'")&&(e=Ml(e,"'",this.symbols.group)),this.options.locale==="fr-FR"&&this.symbols.group&&(e=Ml(e," ",this.symbols.group),e=Ml(e,/\u00A0/g,this.symbols.group)),e}isValidPartialNumber(e,n=-1/0,r=1/0){return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&n<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&r>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.group&&e.startsWith(this.symbols.group)||this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&(e=Ml(e,this.symbols.group,"")),e=e.replace(this.symbols.numeral,""),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,"")),e.length===0)}constructor(e,n={}){this.locale=e,n.roundingIncrement!==1&&n.roundingIncrement!=null&&(n.maximumFractionDigits==null&&n.minimumFractionDigits==null?(n.maximumFractionDigits=0,n.minimumFractionDigits=0):n.maximumFractionDigits==null?n.maximumFractionDigits=n.minimumFractionDigits:n.minimumFractionDigits==null&&(n.minimumFractionDigits=n.maximumFractionDigits)),this.formatter=new Intl.NumberFormat(e,n),this.options=this.formatter.resolvedOptions(),this.symbols=Cq(e,this.formatter,this.options,n);var r,i;this.options.style==="percent"&&(((r=this.options.minimumFractionDigits)!==null&&r!==void 0?r:0)>18||((i=this.options.maximumFractionDigits)!==null&&i!==void 0?i:0)>18)&&console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.")}}const F2=new Set(["decimal","fraction","integer","minusSign","plusSign","group"]),wq=[0,4,2,1,11,20,3,7,100,21,.1,1.1];function Cq(t,e,n,r){var i,s,o,l;let a=new Intl.NumberFormat(t,{...n,minimumSignificantDigits:1,maximumSignificantDigits:21,roundingIncrement:1,roundingPriority:"auto",roundingMode:"halfExpand"}),u=a.formatToParts(-10000.111),c=a.formatToParts(10000.111),d=wq.map(L=>a.formatToParts(L));var f;let h=(f=(i=u.find(L=>L.type==="minusSign"))===null||i===void 0?void 0:i.value)!==null&&f!==void 0?f:"-",m=(s=c.find(L=>L.type==="plusSign"))===null||s===void 0?void 0:s.value;!m&&((r==null?void 0:r.signDisplay)==="exceptZero"||(r==null?void 0:r.signDisplay)==="always")&&(m="+");let v=(o=new Intl.NumberFormat(t,{...n,minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(.001).find(L=>L.type==="decimal"))===null||o===void 0?void 0:o.value,p=(l=u.find(L=>L.type==="group"))===null||l===void 0?void 0:l.value,y=u.filter(L=>!F2.has(L.type)).map(L=>_2(L.value)),b=d.flatMap(L=>L.filter(A=>!F2.has(A.type)).map(A=>_2(A.value))),C=[...new Set([...y,...b])].sort((L,A)=>A.length-L.length),S=C.length===0?new RegExp("[\\p{White_Space}]","gu"):new RegExp(`${C.join("|")}|[\\p{White_Space}]`,"gu"),k=[...new Intl.NumberFormat(n.locale,{useGrouping:!1}).format(9876543210)].reverse(),E=new Map(k.map((L,A)=>[L,A])),$=new RegExp(`[${k.join("")}]`,"g");return{minusSign:h,plusSign:m,decimal:v,group:p,literals:S,numeral:$,index:L=>String(E.get(L))}}function Ml(t,e,n){return t.replaceAll?t.replaceAll(e,n):t.split(e).join(n)}function _2(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function H2(t={}){let{locale:e}=fs();return w.useMemo(()=>new so(e,t),[e,t])}function sE(t){let e=t;return e.nativeEvent=t,e.isDefaultPrevented=()=>e.defaultPrevented,e.isPropagationStopped=()=>e.cancelBubble,e.persist=()=>{},e}function kq(t,e){Object.defineProperty(t,"target",{value:e}),Object.defineProperty(t,"currentTarget",{value:e})}function oE(t){let e=w.useRef({isFocused:!1,observer:null});return Bi(()=>{const n=e.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]),w.useCallback(n=>{let r=xt(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){e.current.isFocused=!0;let i=r,s=o=>{if(e.current.isFocused=!1,i.disabled){let l=sE(o);t==null||t(l)}e.current.observer&&(e.current.observer.disconnect(),e.current.observer=null)};i.addEventListener("focusout",s,{once:!0}),e.current.observer=new MutationObserver(()=>{if(e.current.isFocused&&i.disabled){var o;(o=e.current.observer)===null||o===void 0||o.disconnect();let l=i===us()?null:us();i.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),i.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),e.current.observer.observe(i,{attributes:!0,attributeFilter:["disabled"]})}},[t])}let Sq=!1,Ql="default",$y="",sh=new WeakMap;function Eq(t){if(wm()){if(Ql==="default"){const e=li(t);$y=e.documentElement.style.webkitUserSelect,e.documentElement.style.webkitUserSelect="none"}Ql="disabled"}else if(t instanceof HTMLElement||t instanceof SVGElement){let e="userSelect"in t.style?"userSelect":"webkitUserSelect";sh.set(t,t.style[e]),t.style[e]="none"}}function $q(t){if(wm()){if(Ql!=="disabled")return;Ql="restoring",setTimeout(()=>{X8(()=>{if(Ql==="restoring"){const e=li(t);e.documentElement.style.webkitUserSelect==="none"&&(e.documentElement.style.webkitUserSelect=$y||""),$y="",Ql="default"}})},300)}else if((t instanceof HTMLElement||t instanceof SVGElement)&&t&&sh.has(t)){let e=sh.get(t),n="userSelect"in t.style?"userSelect":"webkitUserSelect";t.style[n]==="none"&&(t.style[n]=e),t.getAttribute("style")===""&&t.removeAttribute("style"),sh.delete(t)}}let yl=null;const My=new Set;let ec=new Map,ll=!1,Dy=!1;const Mq={Tab:!0,Escape:!0};function km(t,e){for(let n of My)n(t,e)}function Dq(t){return!(t.metaKey||!xp()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function bp(t){ll=!0,!Yc.isOpening&&Dq(t)&&(yl="keyboard",km("keyboard",t))}function ma(t){yl="pointer","pointerType"in t&&t.pointerType,(t.type==="mousedown"||t.type==="pointerdown")&&(ll=!0,km("pointer",t))}function lE(t){!Yc.isOpening&&JX(t)&&(ll=!0,yl="virtual")}function aE(t){xt(t)===window||xt(t)===document||Sq||!t.isTrusted||(!ll&&!Dy&&(yl="virtual",km("virtual",t)),ll=!1,Dy=!1)}function uE(){ll=!1,Dy=!0}function Ny(t){if(typeof window>"u"||typeof document>"u"||ec.get(Oo(t)))return;const e=Oo(t),n=li(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){ll=!0,r.apply(this,arguments)},n.addEventListener("keydown",bp,!0),n.addEventListener("keyup",bp,!0),n.addEventListener("click",lE,!0),e.addEventListener("focus",aE,!0),e.addEventListener("blur",uE,!1),typeof PointerEvent<"u"&&(n.addEventListener("pointerdown",ma,!0),n.addEventListener("pointermove",ma,!0),n.addEventListener("pointerup",ma,!0)),e.addEventListener("beforeunload",()=>{cE(t)},{once:!0}),ec.set(e,{focus:r})}const cE=(t,e)=>{const n=Oo(t),r=li(t);e&&r.removeEventListener("DOMContentLoaded",e),ec.has(n)&&(n.HTMLElement.prototype.focus=ec.get(n).focus,r.removeEventListener("keydown",bp,!0),r.removeEventListener("keyup",bp,!0),r.removeEventListener("click",lE,!0),n.removeEventListener("focus",aE,!0),n.removeEventListener("blur",uE,!1),typeof PointerEvent<"u"&&(r.removeEventListener("pointerdown",ma,!0),r.removeEventListener("pointermove",ma,!0),r.removeEventListener("pointerup",ma,!0)),ec.delete(n))};function Nq(t){const e=li(t);let n;return e.readyState!=="loading"?Ny(t):(n=()=>{Ny(t)},e.addEventListener("DOMContentLoaded",n)),()=>cE(t,n)}typeof document<"u"&&Nq();function Ay(){return yl!=="pointer"}function Aq(){return yl}function dE(t){yl=t,km(t,null)}const Tq=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Pq(t,e,n){let r=li(n?xt(n):void 0),i=n?xt(n):void 0;const s=typeof window<"u"?Oo(i).HTMLInputElement:HTMLInputElement,o=typeof window<"u"?Oo(i).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?Oo(i).HTMLElement:HTMLElement,a=typeof window<"u"?Oo(i).KeyboardEvent:KeyboardEvent;let u=us(r);return t=t||u instanceof s&&!Tq.has(u.type)||u instanceof o||u instanceof l&&u.isContentEditable,!(t&&e==="keyboard"&&n instanceof a&&!Mq[n.key])}function Lq(t,e,n){Ny(),w.useEffect(()=>{if((n==null?void 0:n.enabled)===!1)return;let r=(i,s)=>{Pq(!!(n!=null&&n.isTextInput),i,s)&&t(Ay())};return My.add(r),()=>{My.delete(r)}},e)}function Iq(t){if(!t.isConnected)return;const e=li(t);if(Aq()==="virtual"){let n=us(e);X8(()=>{const r=us(e);(r===n||r===e.body)&&t.isConnected&&Kc(t)})}else Kc(t)}function Xc(t){let{isDisabled:e,onFocus:n,onBlur:r,onFocusChange:i}=t;const s=w.useCallback(a=>{if(xt(a)===a.currentTarget)return r&&r(a),i&&i(!1),!0},[r,i]),o=oE(s),l=w.useCallback(a=>{let u=xt(a);const c=li(u),d=c?us(c):us();u===a.currentTarget&&u===d&&(n&&n(a),i&&i(!0),o(a))},[i,n,o]);return{focusProps:{onFocus:!e&&(n||i||r)?l:void 0,onBlur:!e&&(r||i)?s:void 0}}}function z2(t){if(!t)return;let e=!0;return n=>{let r={...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){e=!0},continuePropagation(){e=!1},isPropagationStopped(){return e}};t(r),e&&n.stopPropagation()}}function Uv(t){return{keyboardProps:t.isDisabled?{}:{onKeyDown:z2(t.onKeyDown),onKeyUp:z2(t.onKeyUp)}}}let Rq=be.createContext(null);function Bq(t){let e=w.useContext(Rq)||{};QX(e,t);let{ref:n,...r}=e;return r}function fE(t,e){let{focusProps:n}=Xc(t),{keyboardProps:r}=Uv(t),i=jt(n,r),s=Bq(e),o=t.isDisabled?{}:s,l=w.useRef(t.autoFocus);w.useEffect(()=>{l.current&&e.current&&Iq(e.current),l.current=!1},[e]);let a=t.excludeFromTabOrder?-1:0;return t.isDisabled&&(a=void 0),{focusableProps:jt({...i,tabIndex:a},o)}}function yd(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=t,s=w.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:l}=pl(),a=w.useCallback(d=>{jo(d.currentTarget,xt(d))&&s.current.isFocusWithin&&!jo(d.currentTarget,d.relatedTarget)&&(s.current.isFocusWithin=!1,l(),n&&n(d),i&&i(!1))},[n,i,s,l]),u=oE(a),c=w.useCallback(d=>{if(!jo(d.currentTarget,xt(d)))return;let f=xt(d);const h=li(f),m=us(h);if(!s.current.isFocusWithin&&m===f){r&&r(d),i&&i(!0),s.current.isFocusWithin=!0,u(d);let x=d.currentTarget;o(h,"focus",v=>{let p=xt(v);if(s.current.isFocusWithin&&!jo(x,p)){let y=new h.defaultView.FocusEvent("blur",{relatedTarget:p});kq(y,x);let b=sE(y);a(b)}},{capture:!0})}},[r,i,u,o,a]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:a}}}let Ty=!1,Df=0;function Oq(){Ty=!0,setTimeout(()=>{Ty=!1},50)}function W2(t){t.pointerType==="touch"&&Oq()}function jq(){if(!(typeof document>"u"))return Df===0&&typeof PointerEvent<"u"&&document.addEventListener("pointerup",W2),Df++,()=>{Df--,!(Df>0)&&typeof PointerEvent<"u"&&document.removeEventListener("pointerup",W2)}}function Kv(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:i}=t,[s,o]=w.useState(!1),l=w.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;w.useEffect(jq,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=pl(),{hoverProps:c,triggerHoverEnd:d}=w.useMemo(()=>{let f=(x,v)=>{if(l.pointerType=v,i||v==="touch"||l.isHovered||!jo(x.currentTarget,xt(x)))return;l.isHovered=!0;let p=x.currentTarget;l.target=p,a(li(xt(x)),"pointerover",y=>{l.isHovered&&l.target&&!jo(l.target,xt(y))&&h(y,y.pointerType)},{capture:!0}),e&&e({type:"hoverstart",target:p,pointerType:v}),n&&n(!0),o(!0)},h=(x,v)=>{let p=l.target;l.pointerType="",l.target=null,!(v==="touch"||!l.isHovered||!p)&&(l.isHovered=!1,u(),r&&r({type:"hoverend",target:p,pointerType:v}),n&&n(!1),o(!1))},m={};return typeof PointerEvent<"u"&&(m.onPointerEnter=x=>{Ty&&x.pointerType==="mouse"||f(x,x.pointerType)},m.onPointerLeave=x=>{!i&&jo(x.currentTarget,xt(x))&&h(x,x.pointerType)}),{hoverProps:m,triggerHoverEnd:h}},[e,n,r,i,l,a,u]);return w.useEffect(()=>{i&&d({currentTarget:l.target},l.pointerType)},[i]),{hoverProps:c,isHovered:s}}function wp(t){let{onMoveStart:e,onMove:n,onMoveEnd:r}=t,i=w.useRef({didMove:!1,lastPosition:null,id:null}),{addGlobalListener:s,removeGlobalListener:o}=pl(),l=w.useCallback((m,x,v,p)=>{v===0&&p===0||(i.current.didMove||(i.current.didMove=!0,e==null||e({type:"movestart",pointerType:x,shiftKey:m.shiftKey,metaKey:m.metaKey,ctrlKey:m.ctrlKey,altKey:m.altKey})),n==null||n({type:"move",pointerType:x,deltaX:v,deltaY:p,shiftKey:m.shiftKey,metaKey:m.metaKey,ctrlKey:m.ctrlKey,altKey:m.altKey}))},[e,n,i]),a=Rn(l),u=w.useCallback((m,x)=>{$q(),i.current.didMove&&(r==null||r({type:"moveend",pointerType:x,shiftKey:m.shiftKey,metaKey:m.metaKey,ctrlKey:m.ctrlKey,altKey:m.altKey}))},[r,i]),c=Rn(u),[d,f]=w.useState(null);return Bi(()=>{if(d==="pointer"){let m=v=>{if(v.pointerId===i.current.id){var p,y;let S=v.pointerType||"mouse";var b,C;a(v,S,v.pageX-((b=(p=i.current.lastPosition)===null||p===void 0?void 0:p.pageX)!==null&&b!==void 0?b:0),v.pageY-((C=(y=i.current.lastPosition)===null||y===void 0?void 0:y.pageY)!==null&&C!==void 0?C:0)),i.current.lastPosition={pageX:v.pageX,pageY:v.pageY}}},x=v=>{if(v.pointerId===i.current.id){let p=v.pointerType||"mouse";c(v,p),i.current.id=null,o(window,"pointermove",m,!1),o(window,"pointerup",x,!1),o(window,"pointercancel",x,!1),f(null)}};return s(window,"pointermove",m,!1),s(window,"pointerup",x,!1),s(window,"pointercancel",x,!1),()=>{o(window,"pointermove",m,!1),o(window,"pointerup",x,!1),o(window,"pointercancel",x,!1)}}},[d,s,o]),{moveProps:w.useMemo(()=>{let m={},x=()=>{Eq(),i.current.didMove=!1};m.onPointerDown=p=>{p.button===0&&i.current.id==null&&(x(),p.stopPropagation(),p.preventDefault(),i.current.lastPosition={pageX:p.pageX,pageY:p.pageY},i.current.id=p.pointerId,f("pointer"))};let v=(p,y,b)=>{x(),l(p,"keyboard",y,b),u(p,"keyboard")};return m.onKeyDown=p=>{switch(p.key){case"Left":case"ArrowLeft":p.preventDefault(),p.stopPropagation(),v(p,-1,0);break;case"Right":case"ArrowRight":p.preventDefault(),p.stopPropagation(),v(p,1,0);break;case"Up":case"ArrowUp":p.preventDefault(),p.stopPropagation(),v(p,0,-1);break;case"Down":case"ArrowDown":p.preventDefault(),p.stopPropagation(),v(p,0,1);break}},m},[i,l,u])}}function hE(t,e){let{onScroll:n,isDisabled:r}=t,i=w.useCallback(s=>{s.ctrlKey||(s.preventDefault(),s.stopPropagation(),n&&n({deltaX:s.deltaX,deltaY:s.deltaY}))},[n]);ZX(e,"wheel",r?void 0:i)}function pE(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,i=w.useRef({isFocused:!1,isFocusVisible:e||Ay()}),[s,o]=w.useState(!1),[l,a]=w.useState(()=>i.current.isFocused&&i.current.isFocusVisible),u=w.useCallback(()=>a(i.current.isFocused&&i.current.isFocusVisible),[]),c=w.useCallback(h=>{i.current.isFocused=h,i.current.isFocusVisible=Ay(),o(h),u()},[u]);Lq(h=>{i.current.isFocusVisible=h,u()},[n,s],{enabled:s,isTextInput:n});let{focusProps:d}=Xc({isDisabled:r,onFocusChange:c}),{focusWithinProps:f}=yd({isDisabled:!r,onFocusWithinChange:c});return{isFocused:s,isFocusVisible:l,focusProps:r?f:d}}const G2={border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"};function mE(t={}){let{style:e,isFocusable:n}=t,[r,i]=w.useState(!1),{focusWithinProps:s}=yd({isDisabled:!n,onFocusWithinChange:l=>i(l)}),o=w.useMemo(()=>r?e:e?{...G2,...e}:G2,[r]);return{visuallyHiddenProps:{...s,style:o}}}function Yv(t){let{id:e,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:s="label"}=t;e=Ws(e);let o=Ws(),l={};n&&(r=r?`${o} ${r}`:o,l={id:o,htmlFor:s==="label"?e:void 0});let a=ih({id:e,"aria-label":i,"aria-labelledby":r});return{labelProps:l,fieldProps:a}}function Vq(t){let{description:e,errorMessage:n,isInvalid:r,validationState:i}=t,{labelProps:s,fieldProps:o}=Yv(t),l=N2([!!e,!!n,r,i]),a=N2([!!e,!!n,r,i]);return o=jt(o,{"aria-describedby":[l,a,t["aria-describedby"]].filter(Boolean).join(" ")||void 0}),{labelProps:s,fieldProps:o,descriptionProps:{id:l},errorMessageProps:{id:a}}}const gE={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},yE={...gE,customError:!0,valid:!1},bu={isInvalid:!1,validationDetails:gE,validationErrors:[]},Fq=w.createContext({}),Cp="__formValidationState"+Date.now();function Xv(t){if(t[Cp]){let{realtimeValidation:e,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:s}=t[Cp];return{realtimeValidation:e,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:s}}return _q(t)}function _q(t){let{isInvalid:e,validationState:n,name:r,value:i,builtinValidation:s,validate:o,validationBehavior:l="aria"}=t;n&&(e||(e=n==="invalid"));let a=e!==void 0?{isInvalid:e,validationErrors:[],validationDetails:yE}:null,u=w.useMemo(()=>{if(!o||i==null)return null;let L=Hq(o,i);return U2(L)},[o,i]);s!=null&&s.validationDetails.valid&&(s=void 0);let c=w.useContext(Fq),d=w.useMemo(()=>r?Array.isArray(r)?r.flatMap(L=>Py(c[L])):Py(c[r]):[],[c,r]),[f,h]=w.useState(c),[m,x]=w.useState(!1);c!==f&&(h(c),x(!1));let v=w.useMemo(()=>U2(m?[]:d),[m,d]),p=w.useRef(bu),[y,b]=w.useState(bu),C=w.useRef(bu),S=()=>{if(!k)return;E(!1);let L=u||s||p.current;u0(L,C.current)||(C.current=L,b(L))},[k,E]=w.useState(!1);return w.useEffect(S),{realtimeValidation:a||v||u||s||bu,displayValidation:l==="native"?a||v||y:a||v||u||s||y,updateValidation(L){l==="aria"&&!u0(y,L)?b(L):p.current=L},resetValidation(){let L=bu;u0(L,C.current)||(C.current=L,b(L)),l==="native"&&E(!1),x(!0)},commitValidation(){l==="native"&&E(!0),x(!0)}}}function Py(t){return t?Array.isArray(t)?t:[t]:[]}function Hq(t,e){if(typeof t=="function"){let n=t(e);if(n&&typeof n!="boolean")return Py(n)}return[]}function U2(t){return t.length?{isInvalid:!0,validationErrors:t,validationDetails:yE}:null}function u0(t,e){return t===e?!0:!!t&&!!e&&t.isInvalid===e.isInvalid&&t.validationErrors.length===e.validationErrors.length&&t.validationErrors.every((n,r)=>n===e.validationErrors[r])&&Object.entries(t.validationDetails).every(([n,r])=>e.validationDetails[n]===r)}function zq(t,e,n){let{validationBehavior:r,focus:i}=t;Bi(()=>{if(r==="native"&&(n!=null&&n.current)&&!n.current.disabled){let u=e.realtimeValidation.isInvalid?e.realtimeValidation.validationErrors.join(" ")||"Invalid value.":"";n.current.setCustomValidity(u),n.current.hasAttribute("title")||(n.current.title=""),e.realtimeValidation.isInvalid||e.updateValidation(Gq(n.current))}});let s=w.useRef(!1),o=Rn(()=>{s.current||e.resetValidation()}),l=Rn(u=>{var c;e.displayValidation.isInvalid||e.commitValidation();let d=n==null||(c=n.current)===null||c===void 0?void 0:c.form;if(!u.defaultPrevented&&n&&d&&Uq(d)===n.current){var f;i?i():(f=n.current)===null||f===void 0||f.focus(),dE("keyboard")}u.preventDefault()}),a=Rn(()=>{e.commitValidation()});w.useEffect(()=>{let u=n==null?void 0:n.current;if(!u)return;let c=u.form,d=c==null?void 0:c.reset;return c&&(c.reset=()=>{s.current=!window.event||window.event.type==="message"&&xt(window.event)instanceof MessagePort,d==null||d.call(c),s.current=!1}),u.addEventListener("invalid",l),u.addEventListener("change",a),c==null||c.addEventListener("reset",o),()=>{u.removeEventListener("invalid",l),u.removeEventListener("change",a),c==null||c.removeEventListener("reset",o),c&&(c.reset=d)}},[n,r])}function Wq(t){let e=t.validity;return{badInput:e.badInput,customError:e.customError,patternMismatch:e.patternMismatch,rangeOverflow:e.rangeOverflow,rangeUnderflow:e.rangeUnderflow,stepMismatch:e.stepMismatch,tooLong:e.tooLong,tooShort:e.tooShort,typeMismatch:e.typeMismatch,valueMissing:e.valueMissing,valid:e.valid}}function Gq(t){return{isInvalid:!t.validity.valid,validationDetails:Wq(t),validationErrors:t.validationMessage?[t.validationMessage]:[]}}function Uq(t){for(let n=0;n<t.elements.length;n++){var e;let r=t.elements[n];if(((e=r.validity)===null||e===void 0?void 0:e.valid)===!1)return r}return null}function Kq(t,e){let{inputElementType:n="input",isDisabled:r=!1,isRequired:i=!1,isReadOnly:s=!1,type:o="text",validationBehavior:l="aria"}=t,[a,u]=fo(t.value,t.defaultValue||"",t.onChange),{focusableProps:c}=fE(t,e),d=Xv({...t,value:a}),{isInvalid:f,validationErrors:h,validationDetails:m}=d.displayValidation,{labelProps:x,fieldProps:v,descriptionProps:p,errorMessageProps:y}=Vq({...t,isInvalid:f,errorMessage:t.errorMessage||h}),b=Qa(t,{labelable:!0});const C={type:o,pattern:t.pattern};let[S]=w.useState(a);var k;return gd(e,(k=t.defaultValue)!==null&&k!==void 0?k:S,u),zq(t,d,e),{labelProps:x,inputProps:jt(b,n==="input"?C:void 0,{disabled:r,readOnly:s,required:i&&l==="native","aria-required":i&&l==="aria"||void 0,"aria-invalid":f||void 0,"aria-errormessage":t["aria-errormessage"],"aria-activedescendant":t["aria-activedescendant"],"aria-autocomplete":t["aria-autocomplete"],"aria-haspopup":t["aria-haspopup"],"aria-controls":t["aria-controls"],value:a,onChange:E=>u(xt(E).value),autoComplete:t.autoComplete,autoCapitalize:t.autoCapitalize,maxLength:t.maxLength,minLength:t.minLength,name:t.name,form:t.form,placeholder:t.placeholder,inputMode:t.inputMode,autoCorrect:t.autoCorrect,spellCheck:t.spellCheck,[parseInt(be.version,10)>=17?"enterKeyHint":"enterkeyhint"]:t.enterKeyHint,onCopy:t.onCopy,onCut:t.onCut,onPaste:t.onPaste,onCompositionEnd:t.onCompositionEnd,onCompositionStart:t.onCompositionStart,onCompositionUpdate:t.onCompositionUpdate,onSelect:t.onSelect,onBeforeInput:t.onBeforeInput,onInput:t.onInput,...c,...v}),descriptionProps:p,errorMessageProps:y,isInvalid:f,validationErrors:h,validationDetails:m}}function K2(){return typeof window<"u"&&window.InputEvent&&typeof InputEvent.prototype.getTargetRanges=="function"}function xE(t,e,n){let r=Rn(d=>{let f=n.current;if(!f)return;let h=null;switch(d.inputType){case"historyUndo":case"historyRedo":return;case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":h=f.value.slice(0,f.selectionStart)+f.value.slice(f.selectionEnd);break;case"deleteContentForward":h=f.selectionEnd===f.selectionStart?f.value.slice(0,f.selectionStart)+f.value.slice(f.selectionEnd+1):f.value.slice(0,f.selectionStart)+f.value.slice(f.selectionEnd);break;case"deleteContentBackward":h=f.selectionEnd===f.selectionStart?f.value.slice(0,f.selectionStart-1)+f.value.slice(f.selectionStart):f.value.slice(0,f.selectionStart)+f.value.slice(f.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":h=f.value.slice(f.selectionStart);break;default:d.data!=null&&(h=f.value.slice(0,f.selectionStart)+d.data+f.value.slice(f.selectionEnd));break}(h==null||!e.validate(h))&&d.preventDefault()});w.useEffect(()=>{if(!K2()||!n.current)return;let d=n.current;return d.addEventListener("beforeinput",r,!1),()=>{d.removeEventListener("beforeinput",r,!1)}},[n]);let i=K2()?null:d=>{let f=xt(d).value.slice(0,xt(d).selectionStart)+d.data+xt(d).value.slice(xt(d).selectionEnd);e.validate(f)||d.preventDefault()},{labelProps:s,inputProps:o,descriptionProps:l,errorMessageProps:a,...u}=Kq(t,n),c=w.useRef(null);return{inputProps:jt(o,{onBeforeInput:i,onCompositionStart(){let{value:d,selectionStart:f,selectionEnd:h}=n.current;c.current={value:d,selectionStart:f,selectionEnd:h}},onCompositionEnd(){if(n.current&&!e.validate(n.current.value)){let{value:d,selectionStart:f,selectionEnd:h}=c.current;n.current.value=d,n.current.setSelectionRange(f,h),e.setInputValue(d)}}}),labelProps:s,descriptionProps:l,errorMessageProps:a,...u}}typeof HTMLTemplateElement<"u"&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(t){return this.content.appendChild(t)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(t){return this.content.removeChild(t)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(t,e){return this.content.insertBefore(t,e)}}));const Yq=w.createContext(!1);function vE(t){let e=(n,r)=>w.useContext(Yq)?null:t(n,r);return e.displayName=t.displayName||t.name,w.forwardRef(e)}var bE={};bE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"أداة انتقاء اللون",colorSwatch:"تغيير الألوان",transparent:"شفاف",twoDimensionalSlider:"مُنزلق 2D"};var wE={};wE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Средство за избиране на цвят",colorSwatch:"цветна мостра",transparent:"прозрачен",twoDimensionalSlider:"2D плъзгач"};var CE={};CE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Výběr barvy",colorSwatch:"barevný vzorek",transparent:"průhledný",twoDimensionalSlider:"2D posuvník"};var kE={};kE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Farvevælger",colorSwatch:"farveprøve",transparent:"gennemsigtig",twoDimensionalSlider:"2D-skyder"};var SE={};SE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Farbwähler",colorSwatch:"Farbfeld",transparent:"transparent",twoDimensionalSlider:"2D-Schieberegler"};var EE={};EE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Επιλογέας χρωμάτων",colorSwatch:"χρωματικό δείγμα",transparent:"διαφανές",twoDimensionalSlider:"Ρυθμιστικό 2D"};var $E={};$E={colorPicker:"Color picker",twoDimensionalSlider:"2D slider",colorNameAndValue:t=>`${t.name}: ${t.value}`,colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorSwatch:"color swatch",transparent:"transparent"};var ME={};ME={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Selector de color",colorSwatch:"muestra de color",transparent:"transparente",twoDimensionalSlider:"Regulador 2D"};var DE={};DE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Värvivalija",colorSwatch:"värvinäidis",transparent:"läbipaistev",twoDimensionalSlider:"2D-liugur"};var NE={};NE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Värimuokkain",colorSwatch:"värimalli",transparent:"läpinäkyvä",twoDimensionalSlider:"2D-liukusäädin"};var AE={};AE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name} : ${t.value}`,colorPicker:"Sélecteur de couleurs",colorSwatch:"Échantillon de couleurs",transparent:"Transparent",twoDimensionalSlider:"Curseur 2D"};var TE={};TE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"בוחר הצבעים",colorSwatch:"דוגמית צבע",transparent:"שקוף",twoDimensionalSlider:"מחוון דו מימדי"};var PE={};PE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Odabir boje",colorSwatch:"uzorak boje",transparent:"transparentno",twoDimensionalSlider:"2D klizač"};var LE={};LE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Színválasztó",colorSwatch:"színtár",transparent:"átlátszó",twoDimensionalSlider:"2D-csúszka"};var IE={};IE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Selettore colore",colorSwatch:"campione di colore",transparent:"trasparente",twoDimensionalSlider:"Cursore 2D"};var RE={};RE={colorInputLabel:t=>`${t.label}、${t.channelLabel}`,colorNameAndValue:t=>`${t.name} : ${t.value}`,colorPicker:"カラーピッカー",colorSwatch:"カラースウォッチ",transparent:"透明",twoDimensionalSlider:"2D スライダー"};var BE={};BE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"색상 피커",colorSwatch:"색상 견본",transparent:"투명도",twoDimensionalSlider:"2D 슬라이더"};var OE={};OE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Spalvų parinkiklis",colorSwatch:"spalvų pavyzdys",transparent:"skaidrus",twoDimensionalSlider:"2D slankiklis"};var jE={};jE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Krāsu atlasītājs",colorSwatch:"krāsu paraugs",transparent:"caurspīdīgs",twoDimensionalSlider:"2D slīdnis"};var VE={};VE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Fargevelger",colorSwatch:"fargekart",transparent:"gjennomsiktig",twoDimensionalSlider:"2D-glidebryter"};var FE={};FE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Kleurkiezer",colorSwatch:"kleurstaal",transparent:"transparant",twoDimensionalSlider:"2D-schuifregelaar"};var _E={};_E={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Próbnik kolorów",colorSwatch:"próbka koloru",transparent:"przezroczysty",twoDimensionalSlider:"Suwak 2D"};var HE={};HE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Seletor de cores",colorSwatch:"amostra de cores",transparent:"transparente",twoDimensionalSlider:"Controle deslizante 2D"};var zE={};zE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Seletor de cores",colorSwatch:"amostra de cor",transparent:"transparente",twoDimensionalSlider:"Controle deslizante 2D"};var WE={};WE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Selector de culori",colorSwatch:"specimen de culoare",transparent:"transparent",twoDimensionalSlider:"Glisor 2D"};var GE={};GE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Палитра цветов",colorSwatch:"цветовой образец",transparent:"прозрачный",twoDimensionalSlider:"Ползунок 2D"};var UE={};UE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Výber farieb",colorSwatch:"vzorkovník farieb",transparent:"transparentný",twoDimensionalSlider:"2D jazdec"};var KE={};KE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Izbirnik barv",colorSwatch:"barvna paleta",transparent:"prozorno",twoDimensionalSlider:"2D drsnik"};var YE={};YE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Birač boja",colorSwatch:"Uzorak boje",transparent:"providno",twoDimensionalSlider:"2D klizač"};var XE={};XE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Färgväljaren",colorSwatch:"färgruta",transparent:"genomskinlig",twoDimensionalSlider:"2D-reglage"};var qE={};qE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Renk Seçici",colorSwatch:"renk örneği",transparent:"saydam",twoDimensionalSlider:"2D sürgü"};var QE={};QE={colorInputLabel:t=>`${t.label}, ${t.channelLabel}`,colorNameAndValue:t=>`${t.name}: ${t.value}`,colorPicker:"Палітра кольорів",colorSwatch:"зразок кольору",transparent:"прозорий",twoDimensionalSlider:"Повзунок 2D"};var ZE={};ZE={colorInputLabel:t=>`${t.label}、${t.channelLabel}`,colorNameAndValue:t=>`${t.name}:${t.value}`,colorPicker:"拾色器",colorSwatch:"颜色色板",transparent:"透明",twoDimensionalSlider:"2D 滑块"};var JE={};JE={colorInputLabel:t=>`${t.label},${t.channelLabel}`,colorNameAndValue:t=>`${t.name}:${t.value}`,colorPicker:"檢色器",colorSwatch:"色票",transparent:"透明",twoDimensionalSlider:"2D 滑桿"};var e$={};e$={"ar-AE":bE,"bg-BG":wE,"cs-CZ":CE,"da-DK":kE,"de-DE":SE,"el-GR":EE,"en-US":$E,"es-ES":ME,"et-EE":DE,"fi-FI":NE,"fr-FR":AE,"he-IL":TE,"hr-HR":PE,"hu-HU":LE,"it-IT":IE,"ja-JP":RE,"ko-KR":BE,"lt-LT":OE,"lv-LV":jE,"nb-NO":VE,"nl-NL":FE,"pl-PL":_E,"pt-BR":HE,"pt-PT":zE,"ro-RO":WE,"ru-RU":GE,"sk-SK":UE,"sl-SI":KE,"sr-SP":YE,"sv-SE":XE,"tr-TR":qE,"uk-UA":QE,"zh-CN":ZE,"zh-TW":JE};var t$={};t$={alpha:"ألفا",black:"أسود",blue:"أزرق","blue purple":"أرجواني مزرق",brightness:"السطوع",brown:"بني","brown yellow":"أصفر بني",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"سماوي","cyan blue":"أزرق سماوي",dark:"داكن",gray:"رمادي",grayish:"مائل للرمادي",green:"أخضر","green cyan":"سماوي مخضر",hue:"درجة اللون",light:"فاتح",lightness:"الإضاءة",magenta:"أرجواني","magenta pink":"أرجواني وردي",orange:"برتقالي","orange yellow":"أصفر برتقالي",pale:"باهت",pink:"وردي","pink red":"أحمر وردي",purple:"أرجواني","purple magenta":"بنفسجي",red:"أحمر","red orange":"برتقالي محمر",saturation:"التشبع",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} شفاف`,"very dark":"داكن جدًا","very light":"فاتح جدًا",vibrant:"ساطع",white:"أبيض",yellow:"أصفر","yellow green":"أخضر مصفر"};var n$={};n$={alpha:"Алфа",black:"черно",blue:"Синьо","blue purple":"синьо лилаво",brightness:"Яркост",brown:"кафяво","brown yellow":"кафяво жълто",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"циан","cyan blue":"циан синьо",dark:"тъмно",gray:"сиво",grayish:"сивкав",green:"Зелено","green cyan":"зелен циан",hue:"Оттенък",light:"светло",lightness:"Лекота",magenta:"магента","magenta pink":"магента розово",orange:"оранжево","orange yellow":"оранжево жълто",pale:"бледо",pink:"розово","pink red":"розово червено",purple:"лилаво","purple magenta":"лилаво магента",red:"Червено","red orange":"червен портокал",saturation:"Наситеност",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} прозрачен`,"very dark":"много тъмно","very light":"много светло",vibrant:" ярко",white:"бяло",yellow:"жълто","yellow green":"жълто зелен"};var r$={};r$={alpha:"Alfa",black:"černá",blue:"Modrá","blue purple":"modrofialová",brightness:"Jas",brown:"hnědá","brown yellow":"hnědožlutá",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"tyrkysová","cyan blue":"tyrkysovomodrá",dark:"tmavá",gray:"šedá",grayish:"našedlá",green:"Zelená","green cyan":"zelenotyrkysová",hue:"Odstín",light:"světlá",lightness:"Světlost",magenta:"purpurová","magenta pink":"purpurově růžová",orange:"oranžová","orange yellow":"oranžovožlutá",pale:"bledá",pink:"růžová","pink red":"růžovočervená",purple:"fialová","purple magenta":"fialově purpurová",red:"Červená","red orange":"červenooranžová",saturation:"Sytost",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} průhledné`,"very dark":"velmi tmavá","very light":"velmi světlá",vibrant:"zářivá",white:"bílá",yellow:"žlutá","yellow green":"žlutozelená"};var i$={};i$={alpha:"Alfa",black:"sort",blue:"Blå","blue purple":"blålilla",brightness:"Lysstyrke",brown:"brun","brown yellow":"brungul",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cyan","cyan blue":"cyan blå",dark:"mørk",gray:"grå",grayish:"grålig",green:"Grøn","green cyan":"grøn cyan",hue:"Tone",light:"lys",lightness:"Lyshed",magenta:"magenta","magenta pink":"magenta pink",orange:"orange","orange yellow":"orangegul",pale:"bleg",pink:"lyserød","pink red":"lyserødlig rød",purple:"lilla","purple magenta":"lilla magenta",red:"Rød","red orange":"rødorange",saturation:"Farvemætning",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} gennemsigtig`,"very dark":"meget mørk","very light":"meget lys",vibrant:"klar",white:"hvid",yellow:"gul","yellow green":"gulgrøn"};var s$={};s$={alpha:"Alpha",black:"Schwarz",blue:"Blau","blue purple":"Blaulila",brightness:"Helligkeit",brown:"Braun","brown yellow":"Braungelb",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"Cyan","cyan blue":"Cyanblau",dark:"dunkles",gray:"Grau",grayish:"gräuliches",green:"Grün","green cyan":"Grüncyan",hue:"Farbton",light:"helles",lightness:"Leuchtkraft",magenta:"Magenta","magenta pink":"Magentarosa",orange:"Orange","orange yellow":"Orangegelb",pale:"blasses",pink:"Rosa","pink red":"Rosarot",purple:"Lila","purple magenta":"Lilamagenta",red:"Rot","red orange":"Rotorange",saturation:"Sättigung",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, zu ${t.percentTransparent} transparent`,"very dark":"sehr dunkles","very light":"sehr helles",vibrant:"lebhaftes",white:"Weiß",yellow:"Gelb","yellow green":"Gelbgrün"};var o$={};o$={alpha:"Άλφα",black:"μαύρο",blue:"Μπλε","blue purple":"μπλε μωβ",brightness:"Φωτεινότητα",brown:"καφέ","brown yellow":"καφέ κίτρινο",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"κυανό","cyan blue":"κυανό μπλε",dark:"σκούρο",gray:"γκρι",grayish:"γκριζωπό",green:"Πράσινο","green cyan":"πράσινο κυανό",hue:"Τόνος",light:"ανοιχτό",lightness:"Φωτεινότητα",magenta:"ματζέντα","magenta pink":"ματζέντα ροζ",orange:"πορτοκαλί","orange yellow":"πορτοκαλί κίτρινο",pale:"ανοιχτό",pink:"ροζ","pink red":"ροζ κόκκινο",purple:"μωβ","purple magenta":"μωβ ματζέντα",red:"Κόκκινο","red orange":"κόκκινο πορτοκαλί",saturation:"Κορεσμός",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} διαφανές`,"very dark":"πολύ σκούρο","very light":"πολύ ανοιχτό",vibrant:"έντονο",white:"λευκό",yellow:"κίτρινο","yellow green":"κίτρινο πράσινο"};var l$={};l$={hue:"Hue",saturation:"Saturation",lightness:"Lightness",brightness:"Brightness",red:"Red",green:"Green",blue:"Blue",alpha:"Alpha",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparent`,"very dark":"very dark",dark:"dark",light:"light","very light":"very light",pale:"pale",grayish:"grayish",vibrant:"vibrant",black:"black",white:"white",gray:"gray",pink:"pink","pink red":"pink red","red orange":"red orange",brown:"brown",orange:"orange","orange yellow":"orange yellow","brown yellow":"brown yellow",yellow:"yellow","yellow green":"yellow green","green cyan":"green cyan",cyan:"cyan","cyan blue":"cyan blue","blue purple":"blue purple",purple:"purple","purple magenta":"purple magenta",magenta:"magenta","magenta pink":"magenta pink"};var a$={};a$={alpha:"Alpha",black:"negro",blue:"Azul","blue purple":"púrpura azulado",brightness:"Brillo",brown:"marrón","brown yellow":"amarillo amarronado",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cian","cyan blue":"azul cian",dark:"oscuro",gray:"gris",grayish:"grisáceo",green:"Verde","green cyan":"cian verdoso",hue:"Tono",light:"claro",lightness:"Luminosidad",magenta:"magenta","magenta pink":"rosa magenta",orange:"naranja","orange yellow":"amarillo anaranjado",pale:"pálido",pink:"rosa","pink red":"rojo rosado",purple:"morado","purple magenta":"magenta violáceo",red:"Rojo","red orange":"naranja rojizo",saturation:"Saturación",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparente`,"very dark":"muy oscuro","very light":"muy claro",vibrant:"intenso",white:"blanco",yellow:"amarillo","yellow green":"verde amarillento"};var u$={};u$={alpha:"Alfa",black:"must",blue:"Sinine","blue purple":"sinakaslilla",brightness:"Heledus",brown:"pruun","brown yellow":"pruunikaskollane",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"tsüaan","cyan blue":"tsüaansinine",dark:"tume",gray:"hall",grayish:"hallikas",green:"Roheline","green cyan":"tsüaanroheline",hue:"Värv",light:"valgus",lightness:"Valgus",magenta:"magentapunane","magenta pink":"magentaroosa",orange:"oranž","orange yellow":"oranžikaskollane",pale:"kahvatu",pink:"roosa","pink red":"vaarikapunane",purple:"lilla","purple magenta":"purpurne magenta",red:"Punane","red orange":"punakasoranž",saturation:"Küllastus",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} läbipaistev`,"very dark":"väga tume","very light":"väga hele",vibrant:"ere",white:"valge",yellow:"kollane","yellow green":"kollakasroheline"};var c$={};c$={alpha:"Alpha",black:"musta",blue:"Sininen","blue purple":"sinivioletti",brightness:"Kirkkaus",brown:"ruskea","brown yellow":"ruskeankeltainen",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"syaani","cyan blue":"syaaninsininen",dark:"tumma",gray:"harmaa",grayish:"harmahtava",green:"Vihreä","green cyan":"vihreänsyaani",hue:"Sävy",light:"vaalea",lightness:"Valomäärä",magenta:"magenta","magenta pink":"magentapinkki",orange:"oranssi","orange yellow":"oranssinkeltainen",pale:"vaalea",pink:"pinkki","pink red":"vaaleanpunainen",purple:"violetti","purple magenta":"violettimagenta",red:"Punainen","red orange":"punaoranssi",saturation:"Värikylläisyys",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} läpinäkyvä`,"very dark":"hyvin tumma","very light":"erittäin vaalea",vibrant:"eloisa",white:"valkea",yellow:"keltainen","yellow green":"keltavihreä"};var d$={};d$={alpha:"Alpha",black:"Noir",blue:"Bleu","blue purple":"Violet bleu",brightness:"Luminosité",brown:"Brun","brown yellow":"Jaune brun",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"Cyan","cyan blue":"Bleu cyan",dark:"Sombre",gray:"Gris",grayish:"Grisâtre",green:"Vert","green cyan":"Cyan vert",hue:"Teinte",light:"Clair",lightness:"Luminosité",magenta:"Magenta","magenta pink":"Rose magenta",orange:"Orange","orange yellow":"Jaune orangé",pale:"Pâle",pink:"Rose","pink red":"Rouge rosé",purple:"Violet","purple magenta":"Magenta violet",red:"Rouge","red orange":"Orange rouge",saturation:"Saturation",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparent`,"very dark":"Très sombre","very light":"Très clair",vibrant:"Vif",white:"Blanc",yellow:"Jaune","yellow green":"Vert jaune"};var f$={};f$={alpha:"אלפא",black:"שחור",blue:"כחול","blue purple":"כחול סגול",brightness:"בהירות",brown:"חום","brown yellow":"חום צהוב",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"טורקיז","cyan blue":"כחול ציאן",dark:"כהה",gray:"אפור",grayish:"אפרפר",green:"ירוק","green cyan":"ציאן ירוק",hue:"גוון",light:"אור",lightness:"כמות אור",magenta:"מג'נטה","magenta pink":"ורוד מג'נטה",orange:"כתום","orange yellow":"כתום צהוב",pale:"חיוור",pink:"ורוד","pink red":"ורוד אדום",purple:"סגול","purple magenta":"מג'נטה סגול",red:"אדום","red orange":"כתום אדום",saturation:"רוויה",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} שקוף`,"very dark":"כהה מאוד","very light":"בהיר מאוד",vibrant:"תוסס",white:"לבן",yellow:"צהוב","yellow green":"צהוב ירוק"};var h$={};h$={alpha:"Alfa",black:"crno",blue:"Plava","blue purple":"plavo ljubičasta",brightness:"Svjetlina",brown:"smeđa","brown yellow":"smeđe žuta",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cijan","cyan blue":"cijan plava",dark:"tamno",gray:"siva",grayish:"sivkasto",green:"Zelena","green cyan":"zelena cijan",hue:"Nijansa",light:"svjetlo",lightness:"Osvijetljenost",magenta:"magenta","magenta pink":"magentno ružičasta",orange:"narančasta","orange yellow":"narančasto žuta",pale:"blijeda",pink:"ružičasta","pink red":"ružičasto crvena",purple:"ljubičasta","purple magenta":"ljubičasta magenta",red:"Crvena","red orange":"crveno narančasta",saturation:"Zasićenost",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} prozirnosti`,"very dark":"jako tamna","very light":"vrlo svijetlo",vibrant:"vibrantna",white:"bijela",yellow:"žuto","yellow green":"žuto zelena"};var p$={};p$={alpha:"Alfa",black:"fekete",blue:"Kék","blue purple":"kék lila",brightness:"Fényesség",brown:"barna","brown yellow":"barna sárga",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"ciánkék","cyan blue":"ciánkék",dark:"sötét",gray:"szürke",grayish:"szürkés",green:"Zöld","green cyan":"zöld ciánkék",hue:"Színárnyalat",light:"világos",lightness:"Világosság",magenta:"bíbor","magenta pink":"bíbor rózsaszín",orange:"narancs","orange yellow":"narancssárga",pale:"halvány",pink:"rózsaszín","pink red":"rózsaszín piros",purple:"lila","purple magenta":"lila bíbor",red:"Piros","red orange":"piros narancs",saturation:"Telítettség",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} átlátszó`,"very dark":"nagyon sötét","very light":"nagyon világos",vibrant:"élénk",white:"fehér",yellow:"sárga","yellow green":"sárga zöld"};var m$={};m$={alpha:"Alfa",black:"nero",blue:"Blu","blue purple":"blu viola",brightness:"Luminosità",brown:"marrone","brown yellow":"giallo bruno",colorName:t=>`${t.hue} ${t.chroma} ${t.lightness}`,cyan:"ciano","cyan blue":"blu ciano",dark:"scuro",gray:"grigio",grayish:"grigiastro",green:"Verde","green cyan":"verde ciano",hue:"Tonalità",light:"chiaro",lightness:"Luminosità",magenta:"magenta","magenta pink":"rosa magenta",orange:"arancio","orange yellow":"giallo arancio",pale:"tenue",pink:"rosa","pink red":"rosa rosso",purple:"viola","purple magenta":"viola magenta",red:"Rosso","red orange":"rosso arancio",saturation:"Saturazione",transparentColorName:t=>`${t.hue} ${t.chroma} ${t.lightness}, trasparenza ${t.percentTransparent}`,"very dark":"molto scuro","very light":"molto chiaro",vibrant:"vivace",white:"bianco",yellow:"giallo","yellow green":"giallo verde"};var g$={};g$={alpha:"アルファ",black:"ブラック",blue:"青","blue purple":"ブルーパープル",brightness:"明るさ",brown:"ブラウン","brown yellow":"ブラウンイエロー",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"シアン","cyan blue":"シアンブルー",dark:"ダーク",gray:"グレー",grayish:"グレイッシュ",green:"緑","green cyan":"グリーンシアン",hue:"色相",light:"ライト",lightness:"明度",magenta:"マゼンタ","magenta pink":"マゼンタピンク",orange:"オレンジ","orange yellow":"オレンジイエロー",pale:"ペール",pink:"ピンク","pink red":"ピンクレッド",purple:"パープル","purple magenta":"パープルマゼンタ",red:"赤","red orange":"レッドオレンジ",saturation:"彩度",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} 透明`,"very dark":"最も暗い","very light":"ベリーライト",vibrant:"鮮やか",white:"ホワイト",yellow:"イエロー","yellow green":"イエローグリーン"};var y$={};y$={alpha:"알파",black:"검은색",blue:"파랑","blue purple":"청자색",brightness:"명도",brown:"갈색","brown yellow":"황갈색",colorName:t=>`${t.lightness}, ${t.chroma}, ${t.hue}`,cyan:"청록색","cyan blue":"청록색",dark:"다크",gray:"회색",grayish:"회갈색",green:"초록","green cyan":"청록색",hue:"색조",light:"라이트",lightness:"밝기",magenta:"자홍색","magenta pink":"마젠타 핑크",orange:"주황색","orange yellow":"불그스름한 노랑",pale:"흙색",pink:"분홍색","pink red":"핑크 레드",purple:"자주색","purple magenta":"보라빛 자홍색",red:"빨강","red orange":"붉은 주황색",saturation:"채도",transparentColorName:t=>`${t.lightness}, ${t.chroma}, ${t.hue}, ${t.percentTransparent} 투명도`,"very dark":"매우 어두운","very light":"매우 연함",vibrant:"강렬한",white:"흰색",yellow:"노란색","yellow green":"연두색"};var x$={};x$={alpha:"Alfa",black:"juoda",blue:"Mėlyna","blue purple":"melsvai violetinė",brightness:"Ryškumas",brown:"ruda","brown yellow":"rusvai geltona",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"žalsvai mėlyna","cyan blue":"žalsvai mėlyna",dark:"tamsi",gray:"pilka",grayish:"pilkšva",green:"Žalia","green cyan":"žalsvai mėlyna",hue:"Atspalvis",light:"šviesi",lightness:"Šviesumas",magenta:"rausvai raudona","magenta pink":"purpurinė",orange:"oranžinė","orange yellow":"oranžinio atspalvio geltona",pale:"blyški",pink:"rožinė","pink red":"rožinė raudona",purple:"violetinė","purple magenta":"purpurinė rausvai raudona",red:"Raudona","red orange":"rausvai oranžinė",saturation:"Įsotinimas",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} skaidri`,"very dark":"labai tamsi","very light":"labai šviesi",vibrant:"ryški",white:"balta",yellow:"geltona","yellow green":"gelsvai žalia"};var v$={};v$={alpha:"Alfa",black:"melns",blue:"Zila","blue purple":"zili violets",brightness:"Spilgtums",brown:"brūns","brown yellow":"brūni dzeltens",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"ciāns","cyan blue":"ciāna zils",dark:"tumšs",gray:"pelēks",grayish:"pelēcīgs",green:"Zaļa","green cyan":"zaļš ciāns",hue:"Nokrāsa",light:"gaišs",lightness:"Gaišums",magenta:"fuksiju","magenta pink":"fuksiju rozā",orange:"oranžs","orange yellow":"oranži dzeltens",pale:"bāls",pink:"rozā","pink red":"rozīgi sarkans",purple:"violets","purple magenta":"violets fuksiju",red:"Sarkana","red orange":"sarkanīgi oranžs",saturation:"Piesātinājums",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} caurspīdīgs`,"very dark":"ļoti tumšs","very light":"ļoti gaišs",vibrant:"košs",white:"balts",yellow:"dzeltens","yellow green":"dzelteni zaļš"};var b$={};b$={alpha:"Alfa",black:"svart",blue:"Blå","blue purple":"blålilla",brightness:"Lysstyrke",brown:"brun","brown yellow":"brungul",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cyan","cyan blue":"cyanblå",dark:"mørk",gray:"grå",grayish:"gråaktig",green:"Grønn","green cyan":"grønncyan",hue:"Fargetone",light:"lys",lightness:"Lyshet",magenta:"magenta","magenta pink":"magentarosa",orange:"oransje","orange yellow":"oransjegul",pale:"blek",pink:"rosa","pink red":"rosarød",purple:"lilla","purple magenta":"lillamagenta",red:"Rød","red orange":"rødoransje",saturation:"Metning",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} gjennomsiktig`,"very dark":"svært mørk","very light":"svært lys",vibrant:"levende",white:"hvit",yellow:"gul","yellow green":"gulgrønn"};var w$={};w$={alpha:"Alfa",black:"zwart",blue:"Blauw","blue purple":"paarsblauw",brightness:"Helderheid",brown:"bruin","brown yellow":"bruingeel",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cyaan","cyan blue":"cyaanblauw",dark:"donker",gray:"grijs",grayish:"grijsachtig",green:"Groen","green cyan":"cyaangroen",hue:"Kleurtoon",light:"licht",lightness:"Lichtsterkte",magenta:"magenta","magenta pink":"magentaroze",orange:"oranje","orange yellow":"oranjegeel",pale:"bleek",pink:"roze","pink red":"rozerood",purple:"paars","purple magenta":"magentapaars",red:"Rood","red orange":"roodoranje",saturation:"Verzadiging",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparant`,"very dark":"heel donker","very light":"heel licht",vibrant:"levendig",white:"wit",yellow:"geel","yellow green":"geelgroen"};var C$={};C$={alpha:"Alfa",black:"czarny",blue:"Niebieski","blue purple":"niebiesko-fioletowy",brightness:"Jasność",brown:"brązowy","brown yellow":"brązowo-żółty",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cyjanowy","cyan blue":"cyjanowo-niebieski",dark:"ciemny",gray:"szary",grayish:"szarawy",green:"Zielony","green cyan":"zielono-cyjanowy",hue:"Odcień",light:"jasny",lightness:"Jaskrawość",magenta:"purpurowy","magenta pink":"purpurowo-różowy",orange:"pomarańczowy","orange yellow":"pomarańczowo-żółty",pale:"blady",pink:"różowy","pink red":"różowo-czerwony",purple:"fioletowy","purple magenta":"fioletowo-purpurowy",red:"Czerwony","red orange":"czerwono-pomarańczowy",saturation:"Nasycenie",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} przezroczystości`,"very dark":"bardzo ciemny","very light":"bardzo jasny",vibrant:"intensywny",white:"biały",yellow:"żółty","yellow green":"żółto-zielony"};var k$={};k$={alpha:"Alfa",black:"preto",blue:"Azul","blue purple":"roxo azulado",brightness:"Brilho",brown:"marrom","brown yellow":"marrom amarelado",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"ciano","cyan blue":"azul-ciano",dark:"escuro",gray:"cinza",grayish:"acinzentado",green:"Verde","green cyan":"verde-ciano",hue:"Matiz",light:"claro",lightness:"Luminosidade",magenta:"magenta","magenta pink":"rosa-magenta",orange:"laranja","orange yellow":"amarelo alaranjado",pale:"pálido",pink:"rosa","pink red":"rosa avermelhado",purple:"roxo","purple magenta":"roxo-magenta",red:"Vermelho","red orange":"laranja avermelhado",saturation:"Saturação",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparente`,"very dark":"muito escuro","very light":"muito claro",vibrant:"vibrante",white:"branco",yellow:"amarelo","yellow green":"verde amarelado"};var S$={};S$={alpha:"Alfa",black:"preto",blue:"Azul","blue purple":"azul-púrpura",brightness:"Luminosidade",brown:"castanho","brown yellow":"amarelo-castanho",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"ciano","cyan blue":"azul-ciano",dark:"escuro",gray:"cinzento",grayish:"acinzentado",green:"Verde","green cyan":"verde-ciano",hue:"Tonalidade",light:"claro",lightness:"Claridade",magenta:"magenta","magenta pink":"rosa-magenta",orange:"laranja","orange yellow":"amarelo-laranja",pale:"pálido",pink:"cor-de-rosa","pink red":"vermelho-rosa",purple:"púrpura","purple magenta":"púrpura-magenta",red:"Vermelho","red orange":"laranja-vermelho",saturation:"Saturação",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparente`,"very dark":"muito escuro","very light":"muito claro",vibrant:"vibrante",white:"branco",yellow:"amarelo","yellow green":"verde-amarelo"};var E$={};E$={alpha:"Alfa",black:"negru",blue:"Albastru","blue purple":"albastru-violet",brightness:"Luminozitate",brown:"maro","brown yellow":"galben maro",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"bleu","cyan blue":"albastru-bleu",dark:"închis",gray:"gri",grayish:"cenușiu",green:"Verde","green cyan":"verde bleu",hue:"Nuanță",light:"deschis",lightness:"Luminozitate",magenta:"fucsia","magenta pink":"roz-fucsia",orange:"portocaliu","orange yellow":"galben-portocaliu",pale:"pal",pink:"roz","pink red":"roz-roșu",purple:"violet","purple magenta":"violet-fucsia",red:"Roșu","red orange":"portocaliu-roșu",saturation:"Saturație",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparent`,"very dark":"foarte închis","very light":"foarte deschis",vibrant:"plin de viață",white:"alb",yellow:"galben","yellow green":"galben-verde"};var $$={};$$={alpha:"Альфа",black:"черный",blue:"Синий","blue purple":"сине-фиолетовый",brightness:"Яркость",brown:"коричневый","brown yellow":"коричнево-желтый",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"голубой","cyan blue":"цвет морской волны",dark:"темный",gray:"серый",grayish:"сероватый",green:"Зеленый","green cyan":"сине-зеленый",hue:"Оттенок",light:"светлый",lightness:"Освещенность",magenta:"пурпурный","magenta pink":"пурпурно-розовый",orange:"оранжевый","orange yellow":"оранжево-желтый",pale:"бледный",pink:"розовый","pink red":"розово-красный",purple:"фиолетовый","purple magenta":"фиолетово-пурпурный",red:"Красный","red orange":"красно-оранжевый",saturation:"Насыщенность",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, прозрачный на ${t.percentTransparent}`,"very dark":"очень темный","very light":"очень светлый",vibrant:"яркий",white:"белый",yellow:"желтый","yellow green":"желто-зеленый"};var M$={};M$={alpha:"Alfa",black:"čierna",blue:"Modrá","blue purple":"modrofialová",brightness:"Jas",brown:"hnedá","brown yellow":"hnedožltá",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"azúrová","cyan blue":"azúrová modrá",dark:"tmavá",gray:"sivá",grayish:"sivastá",green:"Zelená","green cyan":"zelená azúrová",hue:"Odtieň",light:"svetlá",lightness:"Svetlosť",magenta:"purpurová","magenta pink":"ružová purpurová",orange:"oranžová","orange yellow":"oranžovožltá",pale:"bledá",pink:"ružová","pink red":"ružovočervená",purple:"fialová","purple magenta":"fialová purpurová",red:"Červená","red orange":"červenooranžová",saturation:"Sýtosť",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} priehľadná`,"very dark":"veľmi tmavá","very light":"veľmi svetlá",vibrant:"energická",white:"biela",yellow:"žltá","yellow green":"žltozelená"};var D$={};D$={alpha:"Alfa",black:"črna",blue:"Modra","blue purple":"modro vijolična",brightness:"Svetlost",brown:"rjava","brown yellow":"rjavo rumena",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cian","cyan blue":"cian modra",dark:"temna",gray:"siva",grayish:"sivkasta",green:"Zelena","green cyan":"zelena cian",hue:"Barva",light:"svetla",lightness:"Lahkost",magenta:"škrlatna","magenta pink":"škrlatno roza",orange:"oranžna","orange yellow":"oranžno rumena",pale:"bleda",pink:"roza","pink red":"roza rdeča",purple:"vijolična","purple magenta":"vijolično škrlatna",red:"Rdeča","red orange":"rdeče oranžna",saturation:"Nasičenost",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} prozorna`,"very dark":"zelo temna","very light":"zelo svetla",vibrant:"živahna",white:"bela",yellow:"rumena","yellow green":"rumeno zelena"};var N$={};N$={alpha:"Alfa",black:"crno",blue:"Plava","blue purple":"plavoljubičasta",brightness:"Osvetljenost",brown:"smeđa","brown yellow":"smeđežuta",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cijan","cyan blue":"cijan plava",dark:"tamno",gray:"siva",grayish:"sivkasta",green:"Zelena","green cyan":"zeleno cijan",hue:"Nijansa",light:"svetla",lightness:"Osvetljenje",magenta:"purpurnocrvena","magenta pink":"magenta ružičasta",orange:"narandžasta","orange yellow":"narandžastožuta",pale:"bledo",pink:"ružičasta","pink red":"ružičastocrvena",purple:"ljubičasta","purple magenta":"ljubičasta magenta",red:"Crvena","red orange":"crvenonarandžasta",saturation:"Zasićenje",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} prozirna`,"very dark":"veoma tamno","very light":"vrlo svetlo",vibrant:"živopisna",white:"bela",yellow:"žuto","yellow green":"žutozelena"};var A$={};A$={alpha:"Alfa",black:"svart",blue:"Blått","blue purple":"blålila",brightness:"Ljusstyrka",brown:"brun","brown yellow":"brungul",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cyan","cyan blue":"cyanblå",dark:"mörk",gray:"grå",grayish:"gråaktig",green:"Grönt","green cyan":"grön cyan",hue:"Nyans",light:"ljus",lightness:"Ljushet",magenta:"magenta","magenta pink":"magentarosa",orange:"orange","orange yellow":"orangegul",pale:"blek",pink:"rosa","pink red":"rosaröd",purple:"lila","purple magenta":"lila magenta",red:"Rött","red orange":"rödorange",saturation:"Mättnad",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} genomskinlig`,"very dark":"mycket mörk","very light":"mycket ljus",vibrant:"livfull",white:"vit",yellow:"gul","yellow green":"gulgrön"};var T$={};T$={alpha:"Alfa",black:"siyah",blue:"Mavi","blue purple":"mavi mor",brightness:"Parlaklık",brown:"kahverengi","brown yellow":"kahverengi sarı",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"camgöbeği","cyan blue":"camgöbeği mavi",dark:"koyu",gray:"gri",grayish:"grimsi",green:"Yeşil","green cyan":"yeşil camgöbeği",hue:"Ton",light:"açık",lightness:"Canlılık",magenta:"eflatun","magenta pink":"eflatun pembe",orange:"turuncu","orange yellow":"turuncu sarı",pale:"solgun",pink:"pembe","pink red":"pembe kırmızı",purple:"mor","purple magenta":"mor eflatun",red:"Kırmızı","red orange":"kırmızı portakal",saturation:"Doygunluk",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} saydam`,"very dark":"çok koyu","very light":"çok açık",vibrant:"canlı",white:"beyaz",yellow:"sarı","yellow green":"sarı yeşil"};var P$={};P$={alpha:"Альфа",black:"чорний",blue:"Синій","blue purple":"синьо-фіолетовий",brightness:"Яскравість",brown:"коричневий","brown yellow":"коричнево-жовтий",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"блакитний","cyan blue":"синьо-блакитний",dark:"темний",gray:"сірий",grayish:"сіруватий",green:"Зелений","green cyan":"зелено-блакитний",hue:"Тон",light:"світлий",lightness:"Освітленість",magenta:"пурпуровий","magenta pink":"пурпурово-рожевий",orange:"помаранчевий","orange yellow":"помаранчево-жовтий",pale:"блідий",pink:"рожевий","pink red":"рожево-червоний",purple:"фіолетовий","purple magenta":"фіолетово-пурпуровий",red:"Червоний","red orange":"червоно-помаранчевий",saturation:"Насиченість",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, прозорий на ${t.percentTransparent}`,"very dark":"дуже темний","very light":"дуже світлий",vibrant:"яскравий",white:"білий",yellow:"жовтий","yellow green":"жовто-зелений"};var L$={};L$={alpha:"Alpha",black:"黑色",blue:"蓝色","blue purple":"蓝紫色",brightness:"亮度",brown:"棕色的","brown yellow":"棕黄色",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"蓝绿色","cyan blue":"青蓝色",dark:"深色",gray:"灰色",grayish:"浅灰色的",green:"绿色","green cyan":"绿青色",hue:"色相",light:"浅色",lightness:"明亮度",magenta:"紫红色","magenta pink":"紫粉色",orange:"橙色","orange yellow":"橙黄色",pale:"苍白的",pink:"粉色","pink red":"粉红色",purple:"紫色","purple magenta":"紫洋红色",red:"红色","red orange":"红橙色",saturation:"饱和度",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} 透明`,"very dark":"很暗","very light":"很浅",vibrant:"生机勃勃",white:"白色",yellow:"黄色","yellow green":"黄色/绿色"};var I$={};I$={alpha:"Alpha",black:"黑",blue:"藍色","blue purple":"藍紫",brightness:"亮度",brown:"棕","brown yellow":"棕黃",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"青","cyan blue":"青藍",dark:"暗",gray:"灰",grayish:"偏灰",green:"綠色","green cyan":"青綠",hue:"色相",light:"淺",lightness:"明亮",magenta:"洋紅","magenta pink":"淺洋紅",orange:"橙","orange yellow":"橙黃",pale:"淡",pink:"粉紅","pink red":"粉紅",purple:"紫","purple magenta":"紫洋紅",red:"紅色","red orange":"橙紅",saturation:"飽和度",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} 透明`,"very dark":"很暗","very light":"很淺",vibrant:"鮮豔",white:"白",yellow:"黃","yellow green":"黃綠"};var R$={};R$={"ar-AE":t$,"bg-BG":n$,"cs-CZ":r$,"da-DK":i$,"de-DE":s$,"el-GR":o$,"en-US":l$,"es-ES":a$,"et-EE":u$,"fi-FI":c$,"fr-FR":d$,"he-IL":f$,"hr-HR":h$,"hu-HU":p$,"it-IT":m$,"ja-JP":g$,"ko-KR":y$,"lt-LT":x$,"lv-LV":v$,"nb-NO":b$,"nl-NL":w$,"pl-PL":C$,"pt-BR":k$,"pt-PT":S$,"ro-RO":E$,"ru-RU":$$,"sk-SK":M$,"sl-SI":D$,"sr-SP":N$,"sv-SE":A$,"tr-TR":T$,"uk-UA":P$,"zh-CN":L$,"zh-TW":I$};function Xq(t){return t&&t.__esModule?t.default:t}let c0=new Gs(Xq(R$));function or(t){let e=Us.parse(t)||Ks.parse(t)||Ys.parse(t);if(e)return e;throw new Error("Invalid color value: "+t)}function ga(t){return typeof t=="string"?or(t):t}function B$(t){return t===360?t:(t%360+360)%360}const Y2=.68,qq=.85,X2=.55,q2=.001,d0=[[0,"pink"],[15,"red"],[48,"orange"],[94,"yellow"],[135,"green"],[175,"cyan"],[264,"blue"],[284,"purple"],[320,"magenta"],[349,"pink"]];class qv{toHexInt(){return this.toFormat("rgb").toHexInt()}getChannelValue(e){if(e in this)return this[e];throw new Error("Unsupported color channel: "+e)}withChannelValue(e,n){if(e in this){let r=this.clone();return r[e]=n,r}throw new Error("Unsupported color channel: "+e)}getChannelName(e,n){return(Gs.getGlobalDictionaryForPackage("@react-stately/color")||c0).getStringForLocale(e,n)}getColorSpaceAxes(e){let{xChannel:n,yChannel:r}=e,i=n||this.getColorChannels().find(l=>l!==r),s=r||this.getColorChannels().find(l=>l!==i),o=this.getColorChannels().find(l=>l!==i&&l!==s);return{xChannel:i,yChannel:s,zChannel:o}}getColorName(e){let[n,r,i]=Q2(this),s=Gs.getGlobalDictionaryForPackage("@react-stately/color")||c0;if(n>.999)return s.getStringForLocale("white",e);if(n<.001)return s.getStringForLocale("black",e);let o;[o,n]=this.getOklchHue(n,r,i,e);let l="",a="";r<=.1&&r>=q2?n>=.7?a="pale":a="grayish":r>=.15&&(a="vibrant"),n<.3?l="very dark":n<X2?l="dark":n<.7||(n<.85?l="light":l="very light"),a&&(a=s.getStringForLocale(a,e)),l&&(l=s.getStringForLocale(l,e));let u=this.getChannelValue("alpha"),c=new nE(e,s);if(u<1){let d=new so(e,{style:"percent"}).format(1-u);return c.format("transparentColorName",{lightness:l,chroma:a,hue:o,percentTransparent:d}).replace(/\s+/g," ").trim()}else return c.format("colorName",{lightness:l,chroma:a,hue:o}).replace(/\s+/g," ").trim()}getOklchHue(e,n,r,i){let s=Gs.getGlobalDictionaryForPackage("@react-stately/color")||c0;if(n<q2)return[s.getStringForLocale("gray",i),e];for(let o=0;o<d0.length;o++){let[l,a]=d0[o],[u,c]=d0[o+1]||[360,"pink"];if(r>=l&&r<u)return a==="orange"&&(e<Y2?a="brown":e=e-Y2+X2),r>l+(u-l)/2&&a!==c?a=`${a} ${c}`:a==="yellow"&&e<qq&&(a="yellow green"),[s.getStringForLocale(a,i).toLocaleLowerCase(i),e]}throw new Error("Unexpected hue")}getHueName(e){let[n,r,i]=Q2(this),[s]=this.getOklchHue(n,r,i,e);return s}}class Us extends qv{static parse(e){let n=[];if(/^#[\da-f]+$/i.test(e)&&[4,5,7,9].includes(e.length)){const s=(e.length<6?e.replace(/[^#]/gi,"$&$&"):e).slice(1).split("");for(;s.length>0;)n.push(parseInt(s.splice(0,2).join(""),16));n[3]=n[3]!==void 0?n[3]/255:void 0}const r=e.match(/^rgba?\((.*)\)$/);if(r!=null&&r[1]&&(n=r[1].split(",").map(s=>Number(s.trim())),n=n.map((s,o)=>Fn(s??0,0,o<3?255:1))),!(n[0]===void 0||n[1]===void 0||n[2]===void 0)){var i;return n.length<3?void 0:new Us(n[0],n[1],n[2],(i=n[3])!==null&&i!==void 0?i:1)}}toString(e="css"){switch(e){case"hex":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")).toUpperCase();case"hexa":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")+Math.round(this.alpha*255).toString(16).padStart(2,"0")).toUpperCase();case"rgb":return`rgb(${this.red}, ${this.green}, ${this.blue})`;case"css":case"rgba":return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case"hex":case"hexa":case"rgb":case"rgba":return this;case"hsb":case"hsba":return this.toHSB();case"hsl":case"hsla":return this.toHSL();default:throw new Error("Unsupported color conversion: rgb -> "+e)}}toHexInt(){return this.red<<16|this.green<<8|this.blue}toHSB(){const e=this.red/255,n=this.green/255,r=this.blue/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=s-i,l=s===0?0:o/s;let a=0;if(o!==0){switch(s){case e:a=(n-r)/o+(n<r?6:0);break;case n:a=(r-e)/o+2;break;case r:a=(e-n)/o+4;break}a/=6}return new Ks(qt(a*360,2),qt(l*100,2),qt(s*100,2),this.alpha)}toHSL(){const e=this.red/255,n=this.green/255,r=this.blue/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=(s+i)/2,l=s-i;let a,u;if(l===0)a=u=0;else{switch(u=l/(o<.5?s+i:2-s-i),s){case e:a=(n-r)/l+(n<r?6:0);break;case n:a=(r-e)/l+2;break;case r:default:a=(e-n)/l+4;break}a/=6}return new Ys(qt(a*360,2),qt(u*100,2),qt(o*100,2),this.alpha)}clone(){return new Us(this.red,this.green,this.blue,this.alpha)}getChannelRange(e){switch(e){case"red":case"green":case"blue":return{minValue:0,maxValue:255,step:1,pageSize:17};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+e)}}getChannelFormatOptions(e){switch(e){case"red":case"green":case"blue":return{style:"decimal"};case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+e)}}formatChannelValue(e,n){let r=this.getChannelFormatOptions(e),i=this.getChannelValue(e);return new so(n,r).format(i)}getColorSpace(){return"rgb"}getColorChannels(){return Us.colorChannels}constructor(e,n,r,i){super(),this.red=e,this.green=n,this.blue=r,this.alpha=i}}Us.colorChannels=["red","green","blue"];const Qq=/hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;class Ks extends qv{static parse(e){let n;if(n=e.match(Qq)){var r;const[i,s,o,l]=((r=n[1])!==null&&r!==void 0?r:n[2]).split(",").map(a=>Number(a.trim().replace("%","")));return new Ks(B$(i),Fn(s,0,100),Fn(o,0,100),Fn(l??1,0,1))}}toString(e="css"){switch(e){case"css":return this.toHSL().toString("css");case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsb":return`hsb(${this.hue}, ${qt(this.saturation,2)}%, ${qt(this.brightness,2)}%)`;case"hsba":return`hsba(${this.hue}, ${qt(this.saturation,2)}%, ${qt(this.brightness,2)}%, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case"hsb":case"hsba":return this;case"hsl":case"hsla":return this.toHSL();case"rgb":case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsb -> "+e)}}toHSL(){let e=this.saturation/100,n=this.brightness/100,r=n*(1-e/2);return e=r===0||r===1?0:(n-r)/Math.min(r,1-r),new Ys(qt(this.hue,2),qt(e*100,2),qt(r*100,2),this.alpha)}toRGB(){let e=this.hue,n=this.saturation/100,r=this.brightness/100,i=(s,o=(s+e/60)%6)=>r-n*r*Math.max(Math.min(o,4-o,1),0);return new Us(Math.round(i(5)*255),Math.round(i(3)*255),Math.round(i(1)*255),this.alpha)}clone(){return new Ks(this.hue,this.saturation,this.brightness,this.alpha)}getChannelRange(e){switch(e){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"brightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+e)}}getChannelFormatOptions(e){switch(e){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"brightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+e)}}formatChannelValue(e,n){let r=this.getChannelFormatOptions(e),i=this.getChannelValue(e);return(e==="saturation"||e==="brightness")&&(i/=100),new so(n,r).format(i)}getColorSpace(){return"hsb"}getColorChannels(){return Ks.colorChannels}constructor(e,n,r,i){super(),this.hue=e,this.saturation=n,this.brightness=r,this.alpha=i}}Ks.colorChannels=["hue","saturation","brightness"];const Zq=/hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;class Ys extends qv{static parse(e){let n;if(n=e.match(Zq)){var r;const[i,s,o,l]=((r=n[1])!==null&&r!==void 0?r:n[2]).split(",").map(a=>Number(a.trim().replace("%","")));return new Ys(B$(i),Fn(s,0,100),Fn(o,0,100),Fn(l??1,0,1))}}toString(e="css"){switch(e){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${qt(this.saturation,2)}%, ${qt(this.lightness,2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${qt(this.saturation,2)}%, ${qt(this.lightness,2)}%, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case"hsl":case"hsla":return this;case"hsb":case"hsba":return this.toHSB();case"rgb":case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsl -> "+e)}}toHSB(){let e=this.saturation/100,n=this.lightness/100,r=n+e*Math.min(n,1-n);return e=r===0?0:2*(1-n/r),new Ks(qt(this.hue,2),qt(e*100,2),qt(r*100,2),this.alpha)}toRGB(){let e=this.hue,n=this.saturation/100,r=this.lightness/100,i=n*Math.min(r,1-r),s=(o,l=(o+e/30)%12)=>r-i*Math.max(Math.min(l-3,9-l,1),-1);return new Us(Math.round(s(0)*255),Math.round(s(8)*255),Math.round(s(4)*255),this.alpha)}clone(){return new Ys(this.hue,this.saturation,this.lightness,this.alpha)}getChannelRange(e){switch(e){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"lightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+e)}}getChannelFormatOptions(e){switch(e){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"lightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+e)}}formatChannelValue(e,n){let r=this.getChannelFormatOptions(e),i=this.getChannelValue(e);return(e==="saturation"||e==="lightness")&&(i/=100),new so(n,r).format(i)}getColorSpace(){return"hsl"}getColorChannels(){return Ys.colorChannels}constructor(e,n,r,i){super(),this.hue=e,this.saturation=n,this.lightness=r,this.alpha=i}}Ys.colorChannels=["hue","saturation","lightness"];function Q2(t){let e=t.toFormat("rgb"),n=e.getChannelValue("red")/255,r=e.getChannelValue("green")/255,i=e.getChannelValue("blue")/255;[n,r,i]=eQ(n,r,i);let[s,o,l]=tQ(n,r,i),[a,u,c]=nQ(s,o,l);return Jq(a,u,c)}function Jq(t,e,n){var r=Math.atan2(n,e)*180/Math.PI;return[t,Math.sqrt(e**2+n**2),r>=0?r:r+360]}function eQ(t,e,n){return[f0(t),f0(e),f0(n)]}function f0(t){let e=t<0?-1:1,n=Math.abs(t);return n<=.04045?t/12.92:e*Math.pow((n+.055)/1.055,2.4)}function tQ(t,e,n){return Ly([.4123907992659595,.35758433938387796,.1804807884018343,.21263900587151036,.7151686787677559,.07219231536073371,.01933081871559185,.11919477979462599,.9505321522496606],t,e,n)}function nQ(t,e,n){const r=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],i=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774];let[s,o,l]=Ly(r,t,e,n);return Ly(i,Math.cbrt(s),Math.cbrt(o),Math.cbrt(l))}function Ly(t,e,n,r){let i=t[0]*e+t[1]*n+t[2]*r,s=t[3]*e+t[4]*n+t[5]*r,o=t[6]*e+t[7]*n+t[8]*r;return[i,s,o]}const rQ=or("#ffffff");function iQ(t){let{value:e,defaultValue:n,colorSpace:r,xChannel:i,yChannel:s,onChange:o,onChangeEnd:l}=t;!e&&!n&&(n=rQ),e&&(e=ga(e)),n&&(n=ga(n));let[a,u]=fo(e,n,o),[c]=w.useState(a),d=w.useMemo(()=>r&&a?a.toFormat(r):a,[a,r]),f=w.useRef(d),h=N=>{f.current=N,u(N)},m=w.useMemo(()=>d.getColorSpaceAxes({xChannel:i,yChannel:s}),[d,i,s]),x=d.getChannelRange(m.xChannel),v=d.getChannelRange(m.yChannel),{minValue:p,maxValue:y,step:b,pageSize:C}=x,{minValue:S,maxValue:k,step:E,pageSize:$}=v,[D,L]=w.useState(!1),A=w.useRef(!1),T=d.getChannelValue(m.xChannel),V=d.getChannelValue(m.yChannel),M=N=>{if(N===T)return;let O=d.withChannelValue(m.xChannel,N);h(O)},B=N=>{if(N===V)return;let O=d.withChannelValue(m.yChannel,N);h(O)};return{channels:m,xChannelStep:b,yChannelStep:E,xChannelPageStep:C,yChannelPageStep:$,value:d,defaultValue:e!==void 0?c:n,setValue(N){h(ga(N))},xValue:T,setXValue:M,yValue:V,setYValue:B,setColorFromPoint(N,O){let I=p+Fn(N,0,1)*(y-p),P=S+(1-Fn(O,0,1))*(k-S),F;I!==T&&(I=Xt(I,p,y,b),F=d.withChannelValue(m.xChannel,I)),P!==V&&(P=Xt(P,S,k,E),F=(F||d).withChannelValue(m.yChannel,P)),F&&h(F)},getThumbPosition(){let N=(T-p)/(y-p),O=1-(V-S)/(k-S);return{x:N,y:O}},incrementX(N=1){M(T+N>y?y:Xt(T+N,p,y,b))},incrementY(N=1){B(V+N>k?k:Xt(V+N,S,k,E))},decrementX(N=1){M(Xt(T-N,p,y,b))},decrementY(N=1){B(Xt(V-N,S,k,E))},setDragging(N){let O=A.current;A.current=N,l&&!N&&O&&l(f.current),L(N)},isDragging:D,getDisplayColor(){return d.withChannelValue("alpha",1)}}}const sQ=0,oQ=100,lQ=1;function aQ(t){const{isDisabled:e=!1,minValue:n=sQ,maxValue:r=oQ,numberFormatter:i,step:s=lQ,orientation:o="horizontal"}=t;let l=w.useMemo(()=>{let j=(r-n)/10;return j=Xt(j,0,j+s,s),Math.max(j,s)},[s,r,n]),a=w.useCallback(j=>j==null?void 0:j.map((R,H)=>{let G=H===0?n:j[H-1],U=H===j.length-1?r:j[H+1];return Xt(R,G,U,s)}),[n,r,s]),u=w.useMemo(()=>a(J2(t.value)),[t.value,a]),c=w.useMemo(()=>{var j;return a((j=J2(t.defaultValue))!==null&&j!==void 0?j:[n])},[t.defaultValue,n,a]),d=eC(t.value,t.defaultValue,t.onChange),f=eC(t.value,t.defaultValue,t.onChangeEnd);const[h,m]=fo(u,c,d);let[x]=w.useState(h);const[v,p]=w.useState(new Array(h.length).fill(!1)),y=w.useRef(new Array(h.length).fill(!0)),[b,C]=w.useState(void 0),S=w.useRef(h),k=w.useRef(v);let E=j=>{S.current=j,m(j)},$=j=>{k.current=j,p(j)};function D(j){return(j-n)/(r-n)}function L(j){return j===0?n:h[j-1]}function A(j){return j===h.length-1?r:h[j+1]}function T(j){return y.current[j]}function V(j,R){y.current[j]=R}function M(j,R){if(e||!T(j))return;const H=L(j),G=A(j);R=Xt(R,H,G,s);let U=Z2(S.current,j,R);E(U)}function B(j,R){if(e||!T(j))return;R&&(S.current=h);const H=k.current[j];k.current=Z2(k.current,j,R),$(k.current),f&&H&&!k.current.some(Boolean)&&f(S.current)}function N(j){return i.format(j)}function O(j,R){M(j,P(R))}function I(j){return Math.round((j-n)/s)*s+n}function P(j){const R=j*(r-n)+n;return Fn(I(R),n,r)}function F(j,R=1){let H=Math.max(R,s);M(j,Xt(h[j]+H,n,r,s))}function z(j,R=1){let H=Math.max(R,s);M(j,Xt(h[j]-H,n,r,s))}return{values:h,defaultValues:t.defaultValue!==void 0?c:x,getThumbValue:j=>h[j],setThumbValue:M,setThumbPercent:O,isThumbDragging:j=>v[j],setThumbDragging:B,focusedThumb:b,setFocusedThumb:C,getThumbPercent:j=>D(h[j]),getValuePercent:D,getThumbValueLabel:j=>N(h[j]),getFormattedValue:N,getThumbMinValue:L,getThumbMaxValue:A,getPercentValue:P,isThumbEditable:T,setThumbEditable:V,incrementThumb:F,decrementThumb:z,step:s,pageSize:l,orientation:o,isDisabled:e}}function Z2(t,e,n){return t[e]===n?t:[...t.slice(0,e),n,...t.slice(e+1)]}function J2(t){if(t!=null)return Array.isArray(t)?t:[t]}function eC(t,e,n){return r=>{typeof t=="number"||typeof e=="number"?n==null||n(r[0]):n==null||n(r)}}function uQ(t){let{channel:e,colorSpace:n,value:r,defaultValue:i,onChange:s,locale:o,...l}=t;if(r==null&&i==null)throw new Error("useColorSliderState requires a value or defaultValue");r&&(r=ga(r)),i&&(i=ga(i));let[a,u]=fo(r,i,s),c=w.useMemo(()=>n&&a?a.toFormat(n):a,[a,n]),[d]=w.useState(a),f=i??d,h=w.useMemo(()=>n&&f?f.toFormat(n):f,[f,n]),m=aQ({...c.getChannelRange(e),...l,numberFormatter:null,value:c.getChannelValue(e),defaultValue:h.getChannelValue(e),onChange(p){u(c.withChannelValue(e,p))},onChangeEnd(p){t.onChangeEnd&&t.onChangeEnd(c.withChannelValue(e,p))}}),{step:x,pageSize:v}=c.getChannelRange(e);return{...m,value:c,setValue(p){u(ga(p))},getDisplayColor(){switch(e){case"hue":return or(`hsl(${c.getChannelValue("hue")}, 100%, 50%)`);case"lightness":case"brightness":case"saturation":case"red":case"green":case"blue":return c.withChannelValue("alpha",1);case"alpha":return c;default:throw new Error("Unknown color channel: "+e)}},getThumbValueLabel(){return c.formatChannelValue(e,o)},step:x,pageSize:v,isDragging:m.isThumbDragging(0)}}function al(t){return w.useMemo(()=>{if(typeof t=="string")try{return or(t)}catch{return}return t},[t])}const kp=or("#000000"),O$=or("#FFFFFF"),cQ=kp.toHexInt(),dQ=O$.toHexInt();function fQ(t){let{value:e,defaultValue:n,onChange:r}=t,{step:i}=kp.getChannelRange("red"),s=al(n),[o,l]=fo(al(e),s,r),[a]=w.useState(o),[u,c]=w.useState(()=>(e||n)&&o?o.toString("hex"):""),d=Xv({...t,value:o}),f=k=>{if(!o||!k){l(k);return}if(k.toHexInt()!==o.toHexInt()){l(k);return}},[h,m]=w.useState(o);h!==o&&(c(o?o.toString("hex"):""),m(o));let x=w.useMemo(()=>{let k;try{k=or(u.startsWith("#")?u:`#${u}`)}catch{k=null}return k},[u]);return{...d,validate:k=>{var E;return k===""||!!(!((E=k.match(/^#?[0-9a-f]{0,6}$/i))===null||E===void 0)&&E[0])},colorValue:o,defaultColorValue:s??a,setColorValue:l,inputValue:u,setInputValue:c,commit:()=>{if(!u.length){f(null),c(e===void 0||o===null?"":o.toString("hex"));return}if(x==null){c(o?o.toString("hex"):"");return}f(x);let k="";o&&(k=o.toString("hex")),c(k),d.commitValidation()},increment:()=>{let k=tC(x,i);k===o&&c(k.toString("hex")),f(k),d.commitValidation()},incrementToMax:()=>f(O$),decrement:()=>{let k=tC(x,-i);k===o&&c(k.toString("hex")),f(k),d.commitValidation()},decrementToMin:()=>f(kp)}}function tC(t,e){let n=t||kp,r=n.toHexInt(),i=Math.min(Math.max(r+e,cQ),dQ);if(i!==r){let s=`#${i.toString(16).padStart(6,"0").toUpperCase()}`;n=or(s)}return n}function hQ(t){let{minValue:e,maxValue:n,step:r,formatOptions:i,value:s,defaultValue:o=NaN,onChange:l,locale:a,isDisabled:u,isReadOnly:c}=t;s===null&&(s=NaN),s!==void 0&&!isNaN(s)&&(r!==void 0&&!isNaN(r)?s=Xt(s,e,n,r):s=Fn(s,e,n)),isNaN(o)||(r!==void 0&&!isNaN(r)?o=Xt(o,e,n,r):o=Fn(o,e,n));let[d,f]=fo(s,isNaN(o)?NaN:o,l),[h]=w.useState(d),[m,x]=w.useState(()=>isNaN(d)?"":new so(a,i).format(d)),v=w.useMemo(()=>new iE(a,i),[a,i]),p=w.useMemo(()=>v.getNumberingSystem(m),[v,m]),y=w.useMemo(()=>new so(a,{...i,numberingSystem:p}),[a,i,p]),b=w.useMemo(()=>y.resolvedOptions(),[y]),C=w.useCallback(R=>isNaN(R)||R===null?"":y.format(R),[y]),S=Xv({...t,value:d}),k=r!==void 0&&!isNaN(r)?r:1;b.style==="percent"&&(r===void 0||isNaN(r))&&(k=.01);let[E,$]=w.useState(d),[D,L]=w.useState(a),[A,T]=w.useState(i);(!Object.is(d,E)||a!==D||i!==A)&&(x(C(d)),$(d),L(a),T(i));let V=w.useMemo(()=>v.parse(m),[v,m]),M=R=>{let H=R===void 0?m:R,G=V;if(R!==void 0&&(G=v.parse(H)),!H.length){f(NaN),x(s===void 0?"":C(d));return}if(isNaN(G)){x(C(d));return}let U;r===void 0||isNaN(r)?U=Fn(G,e,n):U=Xt(G,e,n,r),U=v.parse(C(U)),f(U),x(C(s===void 0?U:d)),S.commitValidation()},B=(R,H=0)=>{let G=V;if(isNaN(G)){let U=isNaN(H)?0:H;return Xt(U,e,n,k)}else{let U=Xt(G,e,n,k);return R==="+"&&U>G||R==="-"&&U<G?U:Xt(h0(R,G,k),e,n,k)}},N=()=>{let R=B("+",e);R===d&&x(C(R)),f(R),S.commitValidation()},O=()=>{let R=B("-",n);R===d&&x(C(R)),f(R),S.commitValidation()},I=()=>{n!=null&&(f(Xt(n,e,n,k)),S.commitValidation())},P=()=>{e!=null&&(f(e),S.commitValidation())},F=w.useMemo(()=>!u&&!c&&(isNaN(V)||n===void 0||isNaN(n)||Xt(V,e,n,k)>V||h0("+",V,k)<=n),[u,c,e,n,k,V]),z=w.useMemo(()=>!u&&!c&&(isNaN(V)||e===void 0||isNaN(e)||Xt(V,e,n,k)<V||h0("-",V,k)>=e),[u,c,e,n,k,V]);return{...S,validate:R=>v.isValidPartialNumber(R,e,n),increment:N,incrementToMax:I,decrement:O,decrementToMin:P,canIncrement:F,canDecrement:z,minValue:e,maxValue:n,numberValue:V,defaultNumberValue:isNaN(o)?h:o,setNumberValue:f,setInputValue:x,inputValue:m,commit:M}}function h0(t,e,n){let r=t==="+"?e+n:e-n;if(e%1!==0||n%1!==0){const i=e.toString().split("."),s=n.toString().split("."),o=i[1]&&i[1].length||0,l=s[1]&&s[1].length||0,a=Math.pow(10,Math.max(o,l));e=Math.round(e*a),n=Math.round(n*a),r=t==="+"?e+n:e-n,r/=a}return r}function pQ(t){let{channel:e,colorSpace:n,locale:r}=t,i=al(t.value),s=al(t.defaultValue),[o,l]=fo(i,s??null,t.onChange),a=nC(o,n),[u]=w.useState(o),c=s??u,d=nC(c,n),f=a.getChannelValue(e),h=a.getChannelRange(e),m=w.useMemo(()=>a.getChannelFormatOptions(e),[a,e]),x=m.style==="percent"&&h.maxValue===100?100:1;return{...hQ({locale:r,value:o===null?NaN:f/x,defaultValue:c===null?NaN:d.getChannelValue(e)/x,onChange:p=>{Number.isNaN(p)?l(null):l(a.withChannelValue(e,p*x))},minValue:h.minValue/x,maxValue:h.maxValue/x,step:h.step/x,formatOptions:m}),colorValue:a,defaultColorValue:c,setColorValue:l}}function nC(t,e){let n=al("#000");return w.useMemo(()=>{let r=t||n;return e&&r?r.toFormat(e):r},[n,t,e])}function mQ(t){let e=al(t.value),n=al(t.defaultValue||"#000000"),[r,i]=fo(e||void 0,n,t.onChange);return{color:r,setColor(s){s!=null&&i(s||or("#000000"))}}}const j$=t=>[0,60,120,180,240,300,360].map(e=>t.withChannelValue("hue",e).toString("css")).join(", "),V$=t=>`${t.withChannelValue("saturation",0)}, transparent`,gQ={hue:j$,saturation:V$,lightness:()=>"black, transparent, white"},yQ={hue:j$,saturation:V$,brightness:()=>"black, transparent"};function xQ({direction:t,state:e,zChannel:n,xChannel:r,yChannel:i}){return w.useMemo(()=>{let o=t==="rtl"?"left":"right",l={},a=e.value.getChannelValue(n);switch(e.value.getColorSpace()){case"rgb":{let f=or("rgb(0, 0, 0)");l={background:[`linear-gradient(to ${o}, ${f.withChannelValue(r,0)}, ${f.withChannelValue(r,255)})`,`linear-gradient(to top, ${f.withChannelValue(i,0)}, ${f.withChannelValue(i,255)})`,f.withChannelValue(n,a)].join(","),backgroundBlendMode:"screen"};break}case"hsl":{let f=e.value.getColorChannels(),h=or("hsl(0, 100%, 50%)").withChannelValue(n,a),m=f.filter(x=>x!==n).map(x=>`linear-gradient(to ${x===r?o:"top"}, ${gQ[x](h)})`).reverse();n==="hue"&&m.push(h.toString("css")),l={background:m.join(", ")};break}case"hsb":{let f=e.value.getColorChannels(),h=or("hsb(0, 100%, 100%)").withChannelValue(n,a),m=f.filter(x=>x!==n).map(x=>`linear-gradient(to ${x===r?o:"top"}, ${yQ[x](h)})`).reverse();n==="hue"&&m.push(h.toString("css")),l={background:m.join(", ")};break}}let{x:u,y:c}=e.getThumbPosition();t==="rtl"&&(u=1-u);let d={forcedColorAdjust:"none"};return{colorAreaStyleProps:{style:{position:"relative",touchAction:"none",...d,...l}},thumbStyleProps:{style:{position:"absolute",left:`${u*100}%`,top:`${c*100}%`,transform:"translate(-50%, -50%)",touchAction:"none",...d}}}},[t,e,n,r,i])}function vQ(t){return t&&t.__esModule?t.default:t}function bQ(t,e){let{isDisabled:n,inputXRef:r,inputYRef:i,containerRef:s,"aria-label":o,xName:l,yName:a,form:u}=t,c=Gv(vQ(e$),"@react-aria/color"),{addGlobalListener:d,removeGlobalListener:f}=pl(),{direction:h,locale:m}=fs(),[x,v]=w.useState(null),p=w.useCallback((ie=r)=>{ie.current&&Kc(ie.current)},[r]);gd(r,e.defaultValue,e.setValue);let[y,b]=w.useState(!1),[C,S]=w.useState(!1),{xChannel:k,yChannel:E,zChannel:$}=e.channels,D=e.xChannelStep,L=e.yChannelStep,A=w.useRef(null),{keyboardProps:T}=Uv({onKeyDown(ie){if(!/^(PageUp|PageDown|Home|End)$/.test(ie.key)){ie.continuePropagation();return}ie.preventDefault(),e.setDragging(!0),b(!0);let Te;switch(ie.key){case"PageUp":e.incrementY(e.yChannelPageStep),Te="y";break;case"PageDown":e.decrementY(e.yChannelPageStep),Te="y";break;case"Home":h==="rtl"?e.incrementX(e.xChannelPageStep):e.decrementX(e.xChannelPageStep),Te="x";break;case"End":h==="rtl"?e.decrementX(e.xChannelPageStep):e.incrementX(e.xChannelPageStep),Te="x";break}e.setDragging(!1),Te&&(p(Te==="x"?r:i),v(Te))}}),V={onMoveStart(){A.current=null,e.setDragging(!0)},onMove({deltaX:ie,deltaY:Te,pointerType:Ke,shiftKey:rt}){var te;let{incrementX:ce,decrementX:K,incrementY:X,decrementY:re,xChannelPageStep:he,xChannelStep:De,yChannelPageStep:je,yChannelStep:Lt,getThumbPosition:ht,setColorFromPoint:en}=e;A.current==null&&(A.current=ht());let{width:Le,height:ut}=((te=s.current)===null||te===void 0?void 0:te.getBoundingClientRect())||{width:0,height:0},Je=ie!==0||Te!==0;if(Ke==="keyboard"){let Kt=rt&&he>De?he:De,St=rt&&je>Lt?je:Lt;ie>0&&h==="ltr"||ie<0&&h==="rtl"?ce(Kt):ie<0&&h==="ltr"||ie>0&&h==="rtl"?K(Kt):Te>0?re(St):Te<0&&X(St),b(Je),x=Je&&Math.abs(Te)>Math.abs(ie)?"y":"x",v(x)}else A.current.x+=(h==="rtl"?-1:1)*ie/Le,A.current.y+=Te/ut,en(A.current.x,A.current.y)},onMoveEnd(){O.current=!1,e.setDragging(!1),p(x==="x"?r:i)}},{moveProps:M}=wp(V),{focusWithinProps:B}=yd({onFocusWithinChange:ie=>{ie||(b(!1),S(!1))}}),N=w.useRef(void 0),O=w.useRef(!1),{moveProps:I}=wp({onMoveStart(){O.current&&V.onMoveStart()},onMove(ie){O.current&&V.onMove(ie)},onMoveEnd(){O.current&&V.onMoveEnd()}}),P=ie=>{e.isDragging||(N.current=ie,b(!1),p(),e.setDragging(!0),typeof PointerEvent<"u"?d(window,"pointerup",F,!1):(d(window,"mouseup",F,!1),d(window,"touchend",F,!1)))},F=ie=>{var Te,Ke;((Ke=ie.pointerId)!==null&&Ke!==void 0?Ke:(Te=ie.changedTouches)===null||Te===void 0?void 0:Te[0].identifier)===N.current&&(b(!1),p(),e.setDragging(!1),N.current=void 0,O.current=!1,typeof PointerEvent<"u"?f(window,"pointerup",F,!1):(f(window,"mouseup",F,!1),f(window,"touchend",F,!1)))},z=(ie,Te,Ke,rt)=>{let te=ie.getBoundingClientRect(),{width:ce,height:K}=te,X=(Ke-te.x)/ce,re=(rt-te.y)/K;h==="rtl"&&(X=1-X),X>=0&&X<=1&&re>=0&&re<=1&&!e.isDragging&&N.current===void 0&&(O.current=!0,b(!1),N.current=Te,e.setColorFromPoint(X,re),p(),e.setDragging(!0),typeof PointerEvent<"u"?d(window,"pointerup",j,!1):(d(window,"mouseup",j,!1),d(window,"touchend",j,!1)))},j=ie=>{var Te,Ke;let rt=(Ke=ie.pointerId)!==null&&Ke!==void 0?Ke:(Te=ie.changedTouches)===null||Te===void 0?void 0:Te[0].identifier;O.current&&rt===N.current&&(O.current=!1,b(!1),N.current=void 0,e.setDragging(!1),p(),typeof PointerEvent<"u"?f(window,"pointerup",j,!1):(f(window,"mouseup",j,!1),f(window,"touchend",j,!1)))},R=n?{}:jt({...typeof PointerEvent<"u"?{onPointerDown:ie=>{ie.pointerType==="mouse"&&(ie.button!==0||ie.altKey||ie.ctrlKey||ie.metaKey)||z(ie.currentTarget,ie.pointerId,ie.clientX,ie.clientY)}}:{onMouseDown:ie=>{ie.button!==0||ie.altKey||ie.ctrlKey||ie.metaKey||z(ie.currentTarget,void 0,ie.clientX,ie.clientY)},onTouchStart:ie=>{z(ie.currentTarget,ie.changedTouches[0].identifier,ie.changedTouches[0].clientX,ie.changedTouches[0].clientY)}}},I),H=n?{}:jt({...typeof PointerEvent<"u"?{onPointerDown:ie=>{ie.pointerType==="mouse"&&(ie.button!==0||ie.altKey||ie.ctrlKey||ie.metaKey)||P(ie.pointerId)}}:{onMouseDown:ie=>{ie.button!==0||ie.altKey||ie.ctrlKey||ie.metaKey||P(void 0)},onTouchStart:ie=>{P(ie.changedTouches[0].identifier)}}},B,T,M),{focusProps:G}=Xc({onFocus:()=>{v("x")}}),{focusProps:U}=Xc({onFocus:()=>{v("y")}});const se=ie=>{const{target:Te}=ie;S(!0),Te===r.current?e.setXValue(parseFloat(Te.value)):Te===i.current&&e.setYValue(parseFloat(Te.value))};let ne=wm()||zv(),le=e.getDisplayColor();const Ee=w.useCallback(ie=>`${C||y?c.format("colorNameAndValue",{name:le.getChannelName(ie,m),value:le.formatChannelValue(ie,m)}):[c.format("colorNameAndValue",{name:le.getChannelName(ie,m),value:le.formatChannelValue(ie,m)}),c.format("colorNameAndValue",{name:le.getChannelName(ie===E?k:E,m),value:le.formatChannelValue(ie===E?k:E,m)}),c.format("colorNameAndValue",{name:le.getChannelName($,m),value:le.formatChannelValue($,m)})].join(", ")}, ${le.getColorName(m)}`,[m,le,c,C,y,k,E,$]);let xe=c.format("colorPicker"),W=ih({...t,"aria-label":o?c.format("colorInputLabel",{label:o,channelLabel:xe}):xe}),oe=ih({...t,"aria-label":o?c.format("colorInputLabel",{label:o,channelLabel:xe}):xe}),ae=ih({...t,"aria-label":o?`${o}, ${xe}`:void 0},ne?xe:void 0),we=c.format("twoDimensionalSlider"),{visuallyHiddenProps:$e}=mE({style:{opacity:"0.0001",width:"100%",height:"100%",pointerEvents:"none"}}),{colorAreaStyleProps:Ve,thumbStyleProps:We}=xQ({direction:h,state:e,xChannel:k,yChannel:E,zChannel:$});return{colorAreaProps:{...ae,...R,...Ve,role:"group"},thumbProps:{...H,...We,role:"presentation"},xInputProps:{...W,...$e,...G,type:"range",min:e.value.getChannelRange(k).minValue,max:e.value.getChannelRange(k).maxValue,step:D,"aria-roledescription":we,"aria-valuetext":Ee(k),"aria-orientation":"horizontal","aria-describedby":t["aria-describedby"],"aria-details":t["aria-details"],disabled:n,value:e.value.getChannelValue(k),name:l,form:u,tabIndex:ne||!x||x==="x"?void 0:-1,"aria-hidden":ne||!x||x==="x"||y?void 0:"true",onChange:se},yInputProps:{...oe,...$e,...U,type:"range",min:e.value.getChannelRange(E).minValue,max:e.value.getChannelRange(E).maxValue,step:L,"aria-roledescription":we,"aria-valuetext":Ee(E),"aria-orientation":"vertical","aria-describedby":t["aria-describedby"],"aria-details":t["aria-details"],disabled:n,value:e.value.getChannelValue(E),name:a,form:u,tabIndex:ne||x==="y"?void 0:-1,"aria-hidden":ne||x==="y"||y?void 0:"true",onChange:se}}}const Qv=new WeakMap;function Iy(t,e){let n=Qv.get(t);if(!n)throw new Error("Unknown slider state");return`${n.id}-${e}`}function wQ(t,e,n){let{labelProps:r,fieldProps:i}=Yv(t),s=t.orientation==="vertical";var o;Qv.set(e,{id:(o=r.id)!==null&&o!==void 0?o:i.id,"aria-describedby":t["aria-describedby"],"aria-details":t["aria-details"]});let{direction:l}=fs(),{addGlobalListener:a,removeGlobalListener:u}=pl();const c=w.useRef(null),d=l==="rtl",f=w.useRef(null),{moveProps:h}=wp({onMoveStart(){f.current=null},onMove({deltaX:p,deltaY:y}){if(!n.current)return;let{height:b,width:C}=n.current.getBoundingClientRect(),S=s?b:C;f.current==null&&c.current!=null&&(f.current=e.getThumbPercent(c.current)*S);let k=s?y:p;if((s||d)&&(k=-k),f.current+=k,c.current!=null&&n.current){const E=Fn(f.current/S,0,1);e.setThumbPercent(c.current,E)}},onMoveEnd(){c.current!=null&&(e.setThumbDragging(c.current,!1),c.current=null)}});let m=w.useRef(void 0),x=(p,y,b,C)=>{if(n.current&&!t.isDisabled&&e.values.every((S,k)=>!e.isThumbDragging(k))){let{height:S,width:k,top:E,left:$}=n.current.getBoundingClientRect(),D=s?S:k,V=((s?C:b)-(s?E:$))/D;(l==="rtl"||s)&&(V=1-V);let M=e.getPercentValue(V),B,N=e.values.findIndex(O=>M-O<0);if(N===0)B=N;else if(N===-1)B=e.values.length-1;else{let O=e.values[N-1],I=e.values[N];Math.abs(O-M)<Math.abs(I-M)?B=N-1:B=N}B>=0&&e.isThumbEditable(B)?(p.preventDefault(),c.current=B,e.setFocusedThumb(B),m.current=y,e.setThumbDragging(c.current,!0),e.setThumbValue(B,M),a(window,"mouseup",v,!1),a(window,"touchend",v,!1),a(window,"pointerup",v,!1)):c.current=null}},v=p=>{var y,b;((b=p.pointerId)!==null&&b!==void 0?b:(y=p.changedTouches)===null||y===void 0?void 0:y[0].identifier)===m.current&&(c.current!=null&&(e.setThumbDragging(c.current,!1),c.current=null),u(window,"mouseup",v,!1),u(window,"touchend",v,!1),u(window,"pointerup",v,!1))};return"htmlFor"in r&&r.htmlFor&&(delete r.htmlFor,r.onClick=()=>{var p;(p=document.getElementById(Iy(e,0)))===null||p===void 0||p.focus(),dE("keyboard")}),{labelProps:r,groupProps:{role:"group",...i},trackProps:jt({onMouseDown(p){p.button!==0||p.altKey||p.ctrlKey||p.metaKey||x(p,void 0,p.clientX,p.clientY)},onPointerDown(p){p.pointerType==="mouse"&&(p.button!==0||p.altKey||p.ctrlKey||p.metaKey)||x(p,p.pointerId,p.clientX,p.clientY)},onTouchStart(p){x(p,p.changedTouches[0].identifier,p.changedTouches[0].clientX,p.changedTouches[0].clientY)},style:{position:"relative",touchAction:"none"}},h),outputProps:{htmlFor:e.values.map((p,y)=>Iy(e,y)).join(" "),"aria-live":"off"}}}function CQ(t,e){let{index:n=0,isRequired:r,validationState:i,isInvalid:s,trackRef:o,inputRef:l,orientation:a=e.orientation,name:u,form:c}=t,d=t.isDisabled||e.isDisabled,f=a==="vertical",{direction:h}=fs(),{addGlobalListener:m,removeGlobalListener:x}=pl(),v=Qv.get(e);var p;const{labelProps:y,fieldProps:b}=Yv({...t,id:Iy(e,n),"aria-labelledby":`${v.id} ${(p=t["aria-labelledby"])!==null&&p!==void 0?p:""}`.trim()}),C=e.values[n],S=w.useCallback(()=>{l.current&&Kc(l.current)},[l]),k=e.focusedThumb===n;w.useEffect(()=>{k&&S()},[k,S]);let E=h==="rtl",$=w.useRef(null),{keyboardProps:D}=Uv({onKeyDown(O){let{getThumbMaxValue:I,getThumbMinValue:P,decrementThumb:F,incrementThumb:z,setThumbValue:j,setThumbDragging:R,pageSize:H}=e;if(!/^(PageUp|PageDown|Home|End)$/.test(O.key)){O.continuePropagation();return}switch(O.preventDefault(),R(n,!0),O.key){case"PageUp":z(n,H);break;case"PageDown":F(n,H);break;case"Home":j(n,P(n));break;case"End":j(n,I(n));break}R(n,!1)}}),{moveProps:L}=wp({onMoveStart(){$.current=null,e.setThumbDragging(n,!0)},onMove({deltaX:O,deltaY:I,pointerType:P,shiftKey:F}){const{getThumbPercent:z,setThumbPercent:j,decrementThumb:R,incrementThumb:H,step:G,pageSize:U}=e;if(!o.current)return;let{width:se,height:ne}=o.current.getBoundingClientRect(),le=f?ne:se;if($.current==null&&($.current=z(n)*le),P==="keyboard")O>0&&E||O<0&&!E||I>0?R(n,F?U:G):H(n,F?U:G);else{let Ee=f?I:O;(f||E)&&(Ee=-Ee),$.current+=Ee,j(n,Fn($.current/le,0,1))}},onMoveEnd(){e.setThumbDragging(n,!1)}});e.setThumbEditable(n,!d);const{focusableProps:A}=fE(jt(t,{onFocus:()=>e.setFocusedThumb(n),onBlur:()=>e.setFocusedThumb(void 0)}),l);let T=w.useRef(void 0),V=O=>{S(),T.current=O,e.setThumbDragging(n,!0),m(window,"mouseup",M,!1),m(window,"touchend",M,!1),m(window,"pointerup",M,!1)},M=O=>{var I,P;((P=O.pointerId)!==null&&P!==void 0?P:(I=O.changedTouches)===null||I===void 0?void 0:I[0].identifier)===T.current&&(S(),e.setThumbDragging(n,!1),x(window,"mouseup",M,!1),x(window,"touchend",M,!1),x(window,"pointerup",M,!1))},B=e.getThumbPercent(n);(f||h==="rtl")&&(B=1-B);let N=d?{}:jt(D,L,{onMouseDown:O=>{O.button!==0||O.altKey||O.ctrlKey||O.metaKey||V()},onPointerDown:O=>{O.button!==0||O.altKey||O.ctrlKey||O.metaKey||V(O.pointerId)},onTouchStart:O=>{V(O.changedTouches[0].identifier)}});return gd(l,e.defaultValues[n],O=>{e.setThumbValue(n,O)}),{inputProps:jt(A,b,{type:"range",tabIndex:d?void 0:0,min:e.getThumbMinValue(n),max:e.getThumbMaxValue(n),step:e.step,value:C,name:u,form:c,disabled:d,"aria-orientation":a,"aria-valuetext":e.getThumbValueLabel(n),"aria-required":r||void 0,"aria-invalid":s||i==="invalid"||void 0,"aria-errormessage":t["aria-errormessage"],"aria-describedby":[v["aria-describedby"],t["aria-describedby"]].filter(Boolean).join(" "),"aria-details":[v["aria-details"],t["aria-details"]].filter(Boolean).join(" "),onChange:O=>{e.setThumbValue(n,parseFloat(xt(O).value))}}),thumbProps:{...N,style:{position:"absolute",[f?"top":"left"]:`${B*100}%`,transform:"translate(-50%, -50%)",touchAction:"none"}},labelProps:y,isDragging:e.isThumbDragging(n),isDisabled:d,isFocused:k}}function kQ(t,e){let{trackRef:n,inputRef:r,orientation:i,channel:s,"aria-label":o,name:l,form:a}=t,{locale:u,direction:c}=fs();!t.label&&!o&&!t["aria-labelledby"]&&(o=e.value.getChannelName(s,u));let{groupProps:d,trackProps:f,labelProps:h,outputProps:m}=wQ({...t,"aria-label":o},e,n),{inputProps:x,thumbProps:v}=CQ({index:0,orientation:i,isDisabled:t.isDisabled,name:l,form:a,trackRef:n,inputRef:r},e),p=e.getDisplayColor(),y=()=>{let S;switch(i==="vertical"?S="top":c==="ltr"?S="right":S="left",s){case"hue":{let k=[0,60,120,180,240,300,360].map(E=>p.withChannelValue("hue",E).toString("css")).join(", ");return`linear-gradient(to ${S}, ${k})`}case"lightness":{let k=e.getThumbMinValue(0),E=e.getThumbMaxValue(0),$=p.withChannelValue(s,k).toString("css"),D=p.withChannelValue(s,(E-k)/2).toString("css"),L=p.withChannelValue(s,E).toString("css");return`linear-gradient(to ${S}, ${$}, ${D}, ${L})`}case"saturation":case"brightness":case"red":case"green":case"blue":case"alpha":{let k=p.withChannelValue(s,e.getThumbMinValue(0)).toString("css"),E=p.withChannelValue(s,e.getThumbMaxValue(0)).toString("css");return`linear-gradient(to ${S}, ${k}, ${E})`}default:throw new Error("Unknown color channel: "+s)}},b={forcedColorAdjust:"none"};s==="hue"?x["aria-valuetext"]+=`, ${p.getHueName(u)}`:s!=="alpha"&&(x["aria-valuetext"]+=`, ${p.getColorName(u)}`);let{visuallyHiddenProps:C}=mE({style:{opacity:"0.0001",width:"100%",height:"100%",pointerEvents:"none"}});return{trackProps:{...jt(d,f),style:{...f.style,...b,background:y()}},inputProps:{...x,style:{...x.style,...C.style}},thumbProps:{...v,style:{...v.style,...b}},labelProps:h,outputProps:m}}var F$={};F$={Empty:"فارغ"};var _$={};_$={Empty:"Изпразни"};var H$={};H$={Empty:"Prázdné"};var z$={};z$={Empty:"Tom"};var W$={};W$={Empty:"Leer"};var G$={};G$={Empty:"Άδειο"};var U$={};U$={Empty:"Empty"};var K$={};K$={Empty:"Vacío"};var Y$={};Y$={Empty:"Tühjenda"};var X$={};X$={Empty:"Tyhjä"};var q$={};q$={Empty:"Vide"};var Q$={};Q$={Empty:"ריק"};var Z$={};Z$={Empty:"Prazno"};var J$={};J$={Empty:"Üres"};var eM={};eM={Empty:"Vuoto"};var tM={};tM={Empty:"空"};var nM={};nM={Empty:"비어 있음"};var rM={};rM={Empty:"Tuščias"};var iM={};iM={Empty:"Tukšs"};var sM={};sM={Empty:"Tom"};var oM={};oM={Empty:"Leeg"};var lM={};lM={Empty:"Pusty"};var aM={};aM={Empty:"Vazio"};var uM={};uM={Empty:"Vazio"};var cM={};cM={Empty:"Gol"};var dM={};dM={Empty:"Не заполнено"};var fM={};fM={Empty:"Prázdne"};var hM={};hM={Empty:"Prazen"};var pM={};pM={Empty:"Prazno"};var mM={};mM={Empty:"Tomt"};var gM={};gM={Empty:"Boş"};var yM={};yM={Empty:"Пусто"};var xM={};xM={Empty:"空"};var vM={};vM={Empty:"空白"};var bM={};bM={"ar-AE":F$,"bg-BG":_$,"cs-CZ":H$,"da-DK":z$,"de-DE":W$,"el-GR":G$,"en-US":U$,"es-ES":K$,"et-EE":Y$,"fi-FI":X$,"fr-FR":q$,"he-IL":Q$,"hr-HR":Z$,"hu-HU":J$,"it-IT":eM,"ja-JP":tM,"ko-KR":nM,"lt-LT":rM,"lv-LV":iM,"nb-NO":sM,"nl-NL":oM,"pl-PL":lM,"pt-BR":aM,"pt-PT":uM,"ro-RO":cM,"ru-RU":dM,"sk-SK":fM,"sl-SI":hM,"sr-SP":pM,"sv-SE":mM,"tr-TR":gM,"uk-UA":yM,"zh-CN":xM,"zh-TW":vM};function SQ(t){return t&&t.__esModule?t.default:t}const rC=()=>{};function wM(t){const e=w.useRef(void 0);let{value:n,textValue:r,minValue:i,maxValue:s,isDisabled:o,isReadOnly:l,isRequired:a,onIncrement:u,onIncrementPage:c,onDecrement:d,onDecrementPage:f,onDecrementToMin:h,onIncrementToMax:m}=t;const x=Gv(SQ(bM),"@react-aria/spinbutton");let v=w.useRef(!1);const p=w.useCallback(()=>{clearTimeout(e.current),v.current=!1},[]),y=Rn(()=>{p()});w.useEffect(()=>()=>y(),[]);let b=R=>{if(!(R.ctrlKey||R.metaKey||R.shiftKey||R.altKey||l||R.nativeEvent.isComposing))switch(R.key){case"PageUp":if(c){R.preventDefault(),c==null||c();break}case"ArrowUp":case"Up":u&&(R.preventDefault(),u==null||u());break;case"PageDown":if(f){R.preventDefault(),f==null||f();break}case"ArrowDown":case"Down":d&&(R.preventDefault(),d==null||d());break;case"Home":h&&(R.preventDefault(),h==null||h());break;case"End":m&&(R.preventDefault(),m==null||m());break}},C=w.useRef(!1),S=()=>{C.current=!0},k=()=>{C.current=!1},E=r===""?x.format("Empty"):(r||`${n}`).replace("-","−");w.useEffect(()=>{C.current&&(rq("assertive"),J8(E,"assertive"))},[E]);let $=w.useCallback(()=>{p()},[p]);const D=Rn(u??rC),L=Rn(d??rC),A=Rn(()=>{(s===void 0||isNaN(s)||n===void 0||isNaN(n)||n<s)&&(D(),T(60))}),T=Rn(R=>{y(),v.current=!0,e.current=window.setTimeout(A,R)}),V=Rn(()=>{(i===void 0||isNaN(i)||n===void 0||isNaN(n)||n>i)&&(L(),M(60))}),M=Rn(R=>{y(),v.current=!0,e.current=window.setTimeout(V,R)});let B=R=>{R.preventDefault()},{addGlobalListener:N,removeAllGlobalListeners:O}=pl(),I=w.useRef(!1),[P,F]=w.useState(null);w.useEffect(()=>{P==="touch"?T(600):P&&T(400)},[P]);let[z,j]=w.useState(null);return w.useEffect(()=>{z==="touch"?M(600):z&&M(400)},[z]),{spinButtonProps:{role:"spinbutton","aria-valuenow":n!==void 0&&!isNaN(n)?n:void 0,"aria-valuetext":E,"aria-valuemin":i,"aria-valuemax":s,"aria-disabled":o||void 0,"aria-readonly":l||void 0,"aria-required":a||void 0,onKeyDown:b,onFocus:S,onBlur:k},incrementButtonProps:{onPressStart:R=>{p(),R.pointerType!=="touch"?(u==null||u(),F("mouse")):(N(window,"pointercancel",$,{capture:!0}),I.current=!1,F("touch")),N(window,"contextmenu",B)},onPressUp:R=>{p(),R.pointerType==="touch"&&(I.current=!0),O(),F(null)},onPressEnd:R=>{p(),R.pointerType==="touch"&&!v.current&&I.current&&(u==null||u()),I.current=!1,F(null)},onFocus:S,onBlur:k},decrementButtonProps:{onPressStart:R=>{p(),R.pointerType!=="touch"?(d==null||d(),j("mouse")):(N(window,"pointercancel",$,{capture:!0}),I.current=!1,j("touch"))},onPressUp:R=>{p(),R.pointerType==="touch"&&(I.current=!0),O(),j(null)},onPressEnd:R=>{p(),R.pointerType==="touch"&&!v.current&&I.current&&(d==null||d()),I.current=!1,j(null)},onFocus:S,onBlur:k}}}function EQ(t,e,n){let{isDisabled:r,isReadOnly:i,isRequired:s,isWheelDisabled:o,validationBehavior:l="aria"}=t,{colorValue:a,inputValue:u,increment:c,decrement:d,incrementToMax:f,decrementToMin:h,commit:m}=e,x=Ws(),{spinButtonProps:v}=wM({isDisabled:r,isReadOnly:i,isRequired:s,maxValue:16777215,minValue:0,onIncrement:c,onIncrementToMax:f,onDecrement:d,onDecrementToMin:h,value:a?a.toHexInt():void 0,textValue:a?a.toString("hex"):void 0}),[p,y]=w.useState(!1),{focusWithinProps:b}=yd({isDisabled:r,onFocusWithinChange:y}),C=w.useCallback(D=>{Math.abs(D.deltaY)<=Math.abs(D.deltaX)||(D.deltaY>0?c():D.deltaY<0&&d())},[d,c]);hE({onScroll:C,isDisabled:o||r||i||!p},n);let k=D=>{e.validate(D)&&e.setInputValue(D)},{inputProps:E,...$}=xE({...t,id:x,value:u,defaultValue:"!",validate:void 0,[Cp]:e,type:"text",autoComplete:"off",onChange:k},e,n);return gd(n,e.defaultColorValue,e.setColorValue),E=jt(E,v,b,{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false",onBlur:m}),l==="native"&&(E["aria-required"]=void 0),{inputProps:E,...$}}var CM={};CM={decrease:t=>`خفض ${t.fieldLabel}`,increase:t=>`زيادة ${t.fieldLabel}`,numberField:"حقل رقمي"};var kM={};kM={decrease:t=>`Намаляване ${t.fieldLabel}`,increase:t=>`Усилване ${t.fieldLabel}`,numberField:"Номер на полето"};var SM={};SM={decrease:t=>`Snížit ${t.fieldLabel}`,increase:t=>`Zvýšit ${t.fieldLabel}`,numberField:"Číselné pole"};var EM={};EM={decrease:t=>`Reducer ${t.fieldLabel}`,increase:t=>`Øg ${t.fieldLabel}`,numberField:"Talfelt"};var $M={};$M={decrease:t=>`${t.fieldLabel} verringern`,increase:t=>`${t.fieldLabel} erhöhen`,numberField:"Nummernfeld"};var MM={};MM={decrease:t=>`Μείωση ${t.fieldLabel}`,increase:t=>`Αύξηση ${t.fieldLabel}`,numberField:"Πεδίο αριθμού"};var DM={};DM={decrease:t=>`Decrease ${t.fieldLabel}`,increase:t=>`Increase ${t.fieldLabel}`,numberField:"Number field"};var NM={};NM={decrease:t=>`Reducir ${t.fieldLabel}`,increase:t=>`Aumentar ${t.fieldLabel}`,numberField:"Campo de número"};var AM={};AM={decrease:t=>`Vähenda ${t.fieldLabel}`,increase:t=>`Suurenda ${t.fieldLabel}`,numberField:"Numbri väli"};var TM={};TM={decrease:t=>`Vähennä ${t.fieldLabel}`,increase:t=>`Lisää ${t.fieldLabel}`,numberField:"Numerokenttä"};var PM={};PM={decrease:t=>`Diminuer ${t.fieldLabel}`,increase:t=>`Augmenter ${t.fieldLabel}`,numberField:"Champ de nombre"};var LM={};LM={decrease:t=>`הקטן ${t.fieldLabel}`,increase:t=>`הגדל ${t.fieldLabel}`,numberField:"שדה מספר"};var IM={};IM={decrease:t=>`Smanji ${t.fieldLabel}`,increase:t=>`Povećaj ${t.fieldLabel}`,numberField:"Polje broja"};var RM={};RM={decrease:t=>`${t.fieldLabel} csökkentése`,increase:t=>`${t.fieldLabel} növelése`,numberField:"Számmező"};var BM={};BM={decrease:t=>`Riduci ${t.fieldLabel}`,increase:t=>`Aumenta ${t.fieldLabel}`,numberField:"Campo numero"};var OM={};OM={decrease:t=>`${t.fieldLabel}を縮小`,increase:t=>`${t.fieldLabel}を拡大`,numberField:"数値フィールド"};var jM={};jM={decrease:t=>`${t.fieldLabel} 감소`,increase:t=>`${t.fieldLabel} 증가`,numberField:"번호 필드"};var VM={};VM={decrease:t=>`Sumažinti ${t.fieldLabel}`,increase:t=>`Padidinti ${t.fieldLabel}`,numberField:"Numerio laukas"};var FM={};FM={decrease:t=>`Samazināšana ${t.fieldLabel}`,increase:t=>`Palielināšana ${t.fieldLabel}`,numberField:"Skaitļu lauks"};var _M={};_M={decrease:t=>`Reduser ${t.fieldLabel}`,increase:t=>`Øk ${t.fieldLabel}`,numberField:"Tallfelt"};var HM={};HM={decrease:t=>`${t.fieldLabel} verlagen`,increase:t=>`${t.fieldLabel} verhogen`,numberField:"Getalveld"};var zM={};zM={decrease:t=>`Zmniejsz ${t.fieldLabel}`,increase:t=>`Zwiększ ${t.fieldLabel}`,numberField:"Pole numeru"};var WM={};WM={decrease:t=>`Diminuir ${t.fieldLabel}`,increase:t=>`Aumentar ${t.fieldLabel}`,numberField:"Campo de número"};var GM={};GM={decrease:t=>`Diminuir ${t.fieldLabel}`,increase:t=>`Aumentar ${t.fieldLabel}`,numberField:"Campo numérico"};var UM={};UM={decrease:t=>`Scădere ${t.fieldLabel}`,increase:t=>`Creștere ${t.fieldLabel}`,numberField:"Câmp numeric"};var KM={};KM={decrease:t=>`Уменьшение ${t.fieldLabel}`,increase:t=>`Увеличение ${t.fieldLabel}`,numberField:"Числовое поле"};var YM={};YM={decrease:t=>`Znížiť ${t.fieldLabel}`,increase:t=>`Zvýšiť ${t.fieldLabel}`,numberField:"Číselné pole"};var XM={};XM={decrease:t=>`Upadati ${t.fieldLabel}`,increase:t=>`Povečajte ${t.fieldLabel}`,numberField:"Številčno polje"};var qM={};qM={decrease:t=>`Smanji ${t.fieldLabel}`,increase:t=>`Povećaj ${t.fieldLabel}`,numberField:"Polje broja"};var QM={};QM={decrease:t=>`Minska ${t.fieldLabel}`,increase:t=>`Öka ${t.fieldLabel}`,numberField:"Nummerfält"};var ZM={};ZM={decrease:t=>`${t.fieldLabel} azalt`,increase:t=>`${t.fieldLabel} arttır`,numberField:"Sayı alanı"};var JM={};JM={decrease:t=>`Зменшити ${t.fieldLabel}`,increase:t=>`Збільшити ${t.fieldLabel}`,numberField:"Поле номера"};var eD={};eD={decrease:t=>`降低 ${t.fieldLabel}`,increase:t=>`提高 ${t.fieldLabel}`,numberField:"数字字段"};var tD={};tD={decrease:t=>`縮小 ${t.fieldLabel}`,increase:t=>`放大 ${t.fieldLabel}`,numberField:"數字欄位"};var nD={};nD={"ar-AE":CM,"bg-BG":kM,"cs-CZ":SM,"da-DK":EM,"de-DE":$M,"el-GR":MM,"en-US":DM,"es-ES":NM,"et-EE":AM,"fi-FI":TM,"fr-FR":PM,"he-IL":LM,"hr-HR":IM,"hu-HU":RM,"it-IT":BM,"ja-JP":OM,"ko-KR":jM,"lt-LT":VM,"lv-LV":FM,"nb-NO":_M,"nl-NL":HM,"pl-PL":zM,"pt-BR":WM,"pt-PT":GM,"ro-RO":UM,"ru-RU":KM,"sk-SK":YM,"sl-SI":XM,"sr-SP":qM,"sv-SE":QM,"tr-TR":ZM,"uk-UA":JM,"zh-CN":eD,"zh-TW":tD};function $Q(t){return t&&t.__esModule?t.default:t}function MQ(t,e,n){let{id:r,decrementAriaLabel:i,incrementAriaLabel:s,isDisabled:o,isReadOnly:l,isRequired:a,minValue:u,maxValue:c,autoFocus:d,label:f,formatOptions:h,onBlur:m=()=>{},onFocus:x,onFocusChange:v,onKeyDown:p,onKeyUp:y,description:b,errorMessage:C,isWheelDisabled:S,...k}=t,{increment:E,incrementToMax:$,decrement:D,decrementToMin:L,numberValue:A,inputValue:T,commit:V,commitValidation:M}=e;const B=Gv($Q(nD),"@react-aria/numberfield");let N=w.useCallback(()=>{var Le,ut,Je,Kt;let St=(Kt=(Le=n.current)===null||Le===void 0?void 0:Le.value)!==null&&Kt!==void 0?Kt:"";Nx.flushSync(()=>{V()});var Et;((ut=n.current)===null||ut===void 0?void 0:ut.value)!==St&&J8((Et=(Je=n.current)===null||Je===void 0?void 0:Je.value)!==null&&Et!==void 0?Et:"","assertive")},[V,n]),O=Ws(r),{focusProps:I}=Xc({onBlur(){N()}}),P=H2(h),F=w.useMemo(()=>P.resolvedOptions(),[P]),z=H2({...h,currencySign:void 0}),j=w.useMemo(()=>isNaN(A)?"":z.format(A),[z,A]),{spinButtonProps:R,incrementButtonProps:H,decrementButtonProps:G}=wM({isDisabled:o,isReadOnly:l,isRequired:a,maxValue:c,minValue:u,onIncrement:E,onIncrementToMax:$,onDecrement:D,onDecrementToMin:L,value:A,textValue:j}),[U,se]=w.useState(!1),{focusWithinProps:ne}=yd({isDisabled:o,onFocusWithinChange:se}),le=w.useCallback(Le=>{Math.abs(Le.deltaY)<=Math.abs(Le.deltaX)||(Le.deltaY>0?E():Le.deltaY<0&&D())},[D,E]);hE({onScroll:le,isDisabled:S||o||l||!U},n);var xe;let W=((xe=F.maximumFractionDigits)!==null&&xe!==void 0?xe:0)>0,oe=e.minValue===void 0||isNaN(e.minValue)||e.minValue<0,ae="numeric";K8()?oe?ae="text":W&&(ae="decimal"):zv()&&(oe?ae="numeric":W&&(ae="decimal"));let we=Le=>{e.validate(Le)&&e.setInputValue(Le)},$e=Le=>{var ut;(ut=t.onPaste)===null||ut===void 0||ut.call(t,Le);let Je=xt(Le);var Kt,St;if(Je&&((Kt=Je.selectionEnd)!==null&&Kt!==void 0?Kt:-1)-((St=Je.selectionStart)!==null&&St!==void 0?St:0)===Je.value.length){var Et,dn,ze;Le.preventDefault();var pt;V((pt=(ze=Le.clipboardData)===null||ze===void 0||(dn=ze.getData)===null||dn===void 0||(Et=dn.call(ze,"text/plain"))===null||Et===void 0?void 0:Et.trim())!==null&&pt!==void 0?pt:"")}},Ve=Qa(t),We=w.useCallback(Le=>{Le.nativeEvent.isComposing||(Le.key==="Enter"?(V(),M()):Le.continuePropagation())},[V,M]),{isInvalid:ie,validationErrors:Te,validationDetails:Ke}=e.displayValidation,{labelProps:rt,inputProps:te,descriptionProps:ce,errorMessageProps:K}=xE({...k,...Ve,name:void 0,form:void 0,label:f,autoFocus:d,isDisabled:o,isReadOnly:l,isRequired:a,validate:void 0,[Cp]:e,value:T,defaultValue:"!",autoComplete:"off","aria-label":t["aria-label"]||void 0,"aria-labelledby":t["aria-labelledby"]||void 0,id:O,type:"text",inputMode:ae,onChange:we,onBlur:m,onFocus:x,onFocusChange:v,onKeyDown:w.useMemo(()=>G8(We,p),[We,p]),onKeyUp:y,onPaste:$e,description:b,errorMessage:C},e,n);gd(n,e.defaultNumberValue,e.setNumberValue);let X=jt(R,I,te,{role:null,"aria-roledescription":wm()?null:B.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});t.validationBehavior==="native"&&(X["aria-required"]=void 0);let re=Le=>{var ut;us()!==n.current&&(Le.pointerType==="mouse"?(ut=n.current)===null||ut===void 0||ut.focus():Le.target.focus())},he=t["aria-label"]||(typeof t.label=="string"?t.label:""),De;he||(De=t.label!=null?rt.id:t["aria-labelledby"]);let je=Ws(),Lt=Ws(),ht=jt(H,{"aria-label":s||B.format("increase",{fieldLabel:he}).trim(),id:De&&!s?je:null,"aria-labelledby":De&&!s?`${je} ${De}`:null,"aria-controls":O,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!e.canIncrement,onPressStart:re}),en=jt(G,{"aria-label":i||B.format("decrease",{fieldLabel:he}).trim(),id:De&&!i?Lt:null,"aria-labelledby":De&&!i?`${Lt} ${De}`:null,"aria-controls":O,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!e.canDecrement,onPressStart:re});return{groupProps:{...ne,role:"group","aria-disabled":o,"aria-invalid":ie?"true":void 0},labelProps:rt,inputProps:X,incrementButtonProps:ht,decrementButtonProps:en,errorMessageProps:K,descriptionProps:ce,isInvalid:ie,validationErrors:Te,validationDetails:Ke}}function DQ(t,e,n){let{locale:r}=fs();return MQ({...t,value:void 0,defaultValue:void 0,onChange:void 0,validate:void 0,"aria-label":t["aria-label"]||(t.label||t["aria-labelledby"]?void 0:e.colorValue.getChannelName(t.channel,r))},e,n)}const Zv=w.createContext({}),xo=vE(function(e,n){[e,n]=Za(e,n,Zv);let{elementType:r="label",...i}=e,s=gl[r];return be.createElement(s,{className:"react-aria-Label",...i,ref:n})}),NQ=w.createContext({}),AQ=w.createContext(null),Jv=w.createContext(null),iC=w.forwardRef(function(e,n){let{state:r,thumbProps:i,inputXRef:s,inputYRef:o,xInputProps:l,yInputProps:a,isDisabled:u=!1}=w.useContext(Jv),{focusProps:c,isFocused:d,isFocusVisible:f}=pE(),{hoverProps:h,isHovered:m}=Kv(e),x=ml({...e,defaultClassName:"react-aria-ColorThumb",defaultStyle:{...i.style,backgroundColor:r.getDisplayColor().toString()},values:{color:r.getDisplayColor(),isHovered:m,isDragging:r.isDragging,isFocused:d,isFocusVisible:f,isDisabled:u}}),v=Qa(e,{global:!0});return delete v.id,be.createElement(gl.div,{...jt(i,h,v),...x,ref:n,"data-hovered":m||void 0,"data-dragging":r.isDragging||void 0,"data-focused":d||void 0,"data-focus-visible":f||void 0,"data-disabled":u||void 0},be.createElement("input",{ref:s,...l,...c}),a&&be.createElement("input",{ref:o,...a,...c}),x.children)}),TQ=w.createContext(null),PQ=w.forwardRef(function(e,n){[e,n]=Za(e,n,V8);let r=w.useRef(null),i=w.useRef(null),s=iQ(e),{colorAreaProps:o,xInputProps:l,yInputProps:a,thumbProps:u}=bQ({...e,inputXRef:r,inputYRef:i,containerRef:n},s),c=ml({...e,defaultClassName:"react-aria-ColorArea",defaultStyle:o.style,values:{state:s,isDisabled:e.isDisabled||!1}}),d=Qa(e,{global:!0});return delete d.id,be.createElement(gl.div,{ref:n,...jt(d,o,c),slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0},be.createElement(Cm,{values:[[TQ,s],[Jv,{state:s,thumbProps:u,inputXRef:r,xInputProps:l,inputYRef:i,yInputProps:a,isDisabled:e.isDisabled}]]},c.children))}),LQ=w.createContext({}),rD=w.createContext({});let IQ=t=>{let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,...i}=t;return i};const vo=vE(function(e,n){[e,n]=Za(e,n,rD);let{hoverProps:r,isHovered:i}=Kv({...e,isDisabled:e.disabled}),{isFocused:s,isFocusVisible:o,focusProps:l}=pE({isTextInput:!0,autoFocus:e.autoFocus}),a=!!e["aria-invalid"]&&e["aria-invalid"]!=="false",u=ml({...e,values:{isHovered:i,isFocused:s,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:a},defaultClassName:"react-aria-Input"});return be.createElement(gl.input,{...jt(IQ(e),l,r),...u,ref:n,"data-focused":s||void 0,"data-disabled":e.disabled||void 0,"data-hovered":i||void 0,"data-focus-visible":o||void 0,"data-invalid":a||void 0})}),RQ=w.createContext(null),bo=w.forwardRef(function(e,n){return[e,n]=Za(e,n,F8),e.channel?be.createElement(BQ,{...e,channel:e.channel,forwardedRef:n}):be.createElement(OQ,{...e,forwardedRef:n})});function BQ(t){let{locale:e}=fs(),n=pQ({...t,locale:e}),r=w.useRef(null),[i,s]=Wv(!t["aria-label"]&&!t["aria-labelledby"]);var o;let{labelProps:l,inputProps:a,descriptionProps:u,errorMessageProps:c,...d}=DQ({...Q8(t),label:s,validationBehavior:(o=t.validationBehavior)!==null&&o!==void 0?o:"native"},n,r);return be.createElement(be.Fragment,null,iD(t,n,t.forwardedRef,a,r,l,i,u,c,d),t.name&&be.createElement("input",{type:"hidden",name:t.name,form:t.form,value:isNaN(n.numberValue)?"":n.numberValue}))}function OQ(t){var e;let n=fQ({...t,validationBehavior:(e=t.validationBehavior)!==null&&e!==void 0?e:"native"}),r=w.useRef(null),[i,s]=Wv(!t["aria-label"]&&!t["aria-labelledby"]);var o;let{labelProps:l,inputProps:a,descriptionProps:u,errorMessageProps:c,...d}=EQ({...Q8(t),label:s,validationBehavior:(o=t.validationBehavior)!==null&&o!==void 0?o:"native"},n,r);return iD(t,n,t.forwardedRef,a,r,l,i,u,c,d)}function iD(t,e,n,r,i,s,o,l,a,u){let c=ml({...t,values:{state:e,channel:t.channel||"hex",isDisabled:t.isDisabled||!1,isInvalid:u.isInvalid||!1,isReadOnly:t.isReadOnly||!1,isRequired:t.isRequired||!1},defaultClassName:"react-aria-ColorField"}),d=Qa(t,{global:!0});return delete d.id,be.createElement(Cm,{values:[[RQ,e],[rD,{...r,ref:i}],[Zv,{...s,ref:o}],[LQ,{role:"presentation",isInvalid:u.isInvalid,isDisabled:t.isDisabled||!1}],[NQ,{slots:{description:l,errorMessage:a}}],[AQ,u]]},be.createElement(gl.div,{...d,...c,ref:n,slot:t.slot||void 0,"data-channel":t.channel||"hex","data-disabled":t.isDisabled||void 0,"data-invalid":u.isInvalid||void 0,"data-readonly":t.isReadOnly||void 0,"data-required":t.isRequired||void 0}))}const jQ=w.createContext(null),VQ=w.createContext(null),FQ=w.createContext(null),_Q=w.createContext(null);function HQ(t){let e=q8(FQ,t.slot);t=jt(e,t);let n=mQ(t),r=ml({...t,values:{color:n.color}});return be.createElement(Cm,{values:[[_Q,n],[_8,{value:n.color,onChange:n.setColor}],[V8,{value:n.color,onChange:n.setColor}],[wX,{value:n.color,onChange:n.setColor}],[F8,{value:n.color,onChange:n.setColor}],[jQ,{color:n.color}],[VQ,{value:n.color,onChange:n.setColor}]]},r.children)}const sD=w.createContext(null),oD=w.createContext(null),zQ=w.createContext(null),WQ=w.forwardRef(function(e,n){[e,n]=Za(e,n,oD);let r=w.useContext(sD),{onHoverStart:i,onHoverEnd:s,onHoverChange:o,...l}=e,{hoverProps:a,isHovered:u}=Kv({onHoverStart:i,onHoverEnd:s,onHoverChange:o}),c=ml({...e,defaultClassName:"react-aria-SliderTrack",values:{orientation:r.orientation,isDisabled:r.isDisabled,isHovered:u,state:r}});return be.createElement(gl.div,{...jt(l,a),...c,ref:n,"data-hovered":u||void 0,"data-orientation":r.orientation||void 0,"data-disabled":r.isDisabled||void 0})}),GQ=w.createContext(null),UQ=w.forwardRef(function(e,n){[e,n]=Za(e,n,_8);let{locale:r}=fs(),i=uQ({...e,locale:r}),s=be.useRef(null),o=be.useRef(null),[l,a]=Wv(!e["aria-label"]&&!e["aria-labelledby"]),{trackProps:u,thumbProps:c,inputProps:d,labelProps:f,outputProps:h}=kQ({...e,label:a,trackRef:s,inputRef:o},i),m=ml({...e,values:{orientation:i.orientation,isDisabled:i.isDisabled,state:i},defaultClassName:"react-aria-ColorSlider"}),x=Qa(e,{global:!0});return delete x.id,be.createElement(Cm,{values:[[GQ,i],[sD,i],[oD,{...u,ref:s}],[zQ,h],[Zv,{...f,ref:l,children:i.value.getChannelName(e.channel,r)}],[Jv,{state:i,thumbProps:c,inputXRef:o,xInputProps:d,isDisabled:e.isDisabled}]]},be.createElement(gl.div,{...x,...m,ref:n,slot:e.slot||void 0,"data-orientation":i.orientation,"data-disabled":i.isDisabled||void 0}))}),KQ=[{value:"hex",label:"HEX"},{value:"rgb",label:"RGB"},{value:"hsl",label:"HSL"}];function YQ(){const{modals:t,closeColorPicker:e}=ar(),n=t.colorPicker,[r,i]=w.useState("hex"),[s,o]=w.useState(()=>or("#000000"));if(w.useEffect(()=>{n!=null&&n.initialColor&&o(or(n.initialColor))},[n==null?void 0:n.initialColor]),!n)return null;const l=()=>{n==null||n.onConfirm(s.toString("hex")),e()};return g.jsx(fl,{isOpen:!!n,onClose:e,children:g.jsxs(hl,{width:300,children:[g.jsx(Ya,{title:"Pick Color",onClose:e}),g.jsx(Xa,{children:g.jsxs(HQ,{value:s,onChange:o,children:[g.jsx(PQ,{colorSpace:"hsb",xChannel:"saturation",yChannel:"brightness",className:"w-full h-[180px] rounded mb-3",children:g.jsx(iC,{className:"w-5 h-5 border-2 border-white rounded-full shadow-md"})}),g.jsx(UQ,{colorSpace:"hsb",channel:"hue",className:"w-full mb-4",children:g.jsx(WQ,{className:"h-6 rounded relative",children:g.jsx(iC,{className:"w-5 h-5 border-2 border-white rounded-full shadow-md top-1/2 -translate-y-1/2"})})}),g.jsx(O8,{options:KQ,value:r,onChange:i,fullWidth:!0,className:"mb-3"}),g.jsxs("div",{children:[r==="hex"&&g.jsxs(bo,{className:"flex flex-col gap-1",children:[g.jsx(xo,{className:"text-xs font-medium text-text",children:"HEX"}),g.jsx(vo,{})]}),r==="rgb"&&g.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[g.jsxs(bo,{channel:"red",colorSpace:"rgb",className:"flex flex-col gap-1",children:[g.jsx(xo,{className:"text-xs font-medium text-text",children:"R"}),g.jsx(vo,{})]}),g.jsxs(bo,{channel:"green",colorSpace:"rgb",className:"flex flex-col gap-1",children:[g.jsx(xo,{className:"text-xs font-medium text-text",children:"G"}),g.jsx(vo,{})]}),g.jsxs(bo,{channel:"blue",colorSpace:"rgb",className:"flex flex-col gap-1",children:[g.jsx(xo,{className:"text-xs font-medium text-text",children:"B"}),g.jsx(vo,{})]})]}),r==="hsl"&&g.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[g.jsxs(bo,{channel:"hue",colorSpace:"hsl",className:"flex flex-col gap-1",children:[g.jsx(xo,{className:"text-xs font-medium text-text",children:"H"}),g.jsx(vo,{})]}),g.jsxs(bo,{channel:"saturation",colorSpace:"hsl",className:"flex flex-col gap-1",children:[g.jsx(xo,{className:"text-xs font-medium text-text",children:"S"}),g.jsx(vo,{})]}),g.jsxs(bo,{channel:"lightness",colorSpace:"hsl",className:"flex flex-col gap-1",children:[g.jsx(xo,{className:"text-xs font-medium text-text",children:"L"}),g.jsx(vo,{})]})]})]})]})}),g.jsxs(qa,{children:[g.jsx(Ye,{onClick:e,children:"Cancel"}),g.jsx(Ye,{variant:"primary",onClick:l,children:"Apply"})]})]})})}function XQ({sections:t,onItemClick:e,className:n=""}){return g.jsx("div",{className:`flex flex-col max-h-96 overflow-y-auto border border-border rounded ${n}`,children:t.map((r,i)=>g.jsxs("div",{className:"flex flex-col",children:[r.title&&g.jsx("div",{className:"px-4 py-2 text-xs font-semibold text-text-secondary uppercase bg-base-2 border-b border-border",children:r.title}),r.items.map((s,o)=>{const l=o===r.items.length-1,a=i===t.length-1,u=!l||!a;return g.jsxs("button",{type:"button",className:`flex items-center gap-3 px-4 py-3 hover:bg-base-2 transition-colors text-left ${u?"border-b border-border":""} ${s.isActive?"bg-base-2":""}`,onClick:()=>e(s),children:[s.icon&&g.jsx("div",{className:"shrink-0",children:s.icon}),g.jsx("span",{className:"text-sm text-text",children:s.label})]},s.id)})]},r.title||`section-${i}`))})}function qQ(){const{modals:t,closeColorReference:e}=ar(),{variables:n}=Zt(),r=t.colorReference,[i,s]=w.useState("");w.useEffect(()=>{r&&s("")},[r]);const o=w.useMemo(()=>r?n.filter(x=>x.resolvedType==="COLOR"&&x.id!==(r.currentVariableId||"")):[],[n,r]),{grouped:l,ungrouped:a,sortedGroups:u}=w.useMemo(()=>{const x={},v=[];return o.forEach(p=>{const y=p.name.split("/");if(y.length>1){const b=y.slice(0,-1).join("/");x[b]||(x[b]=[]),x[b].push(p)}else v.push(p)}),{grouped:x,ungrouped:v,sortedGroups:Object.keys(x).sort()}},[o]),c=x=>{const v=x.value.match(/^\{(.+)\}$/);if(v){const p=n.find(y=>y.name===v[1]);return(p==null?void 0:p.resolvedType)==="COLOR"?p.value:"#888888"}return x.value},d=x=>i?x.toLowerCase().includes(i.toLowerCase()):!0,f=x=>{r!=null&&r.onConfirm?r.onConfirm(x.id):r!=null&&r.onSelect&&r.onSelect(x.name),e()},h=()=>{const x=[...a,...u.flatMap(v=>l[v])].find(v=>d(v.name));x&&f(x)},m=w.useMemo(()=>{var b;const x=(b=r==null?void 0:r.currentValue)==null?void 0:b.match(/^\{(.+)\}$/),v=x==null?void 0:x[1],p=[],y=a.filter(C=>d(C.name));return y.length>0&&u.length>0&&p.push({title:"Variables",items:y.map(C=>({id:C.id,label:C.name,icon:g.jsx(ti,{color:c(C)}),isActive:C.name===v,_data:C}))}),u.forEach(C=>{const S=l[C].filter(k=>d(k.name));S.length>0&&p.push({title:C,items:S.map(k=>({id:k.id,label:k.name.split("/").pop()||k.name,icon:g.jsx(ti,{color:c(k)}),isActive:k.name===v,_data:k}))})}),p.length===0&&y.length>0&&p.push({title:"",items:y.map(C=>({id:C.id,label:C.name,icon:g.jsx(ti,{color:c(C)}),isActive:C.name===v,_data:C}))}),p},[r,a,u,l,i,n]);return r?g.jsx(fl,{isOpen:!!r,onClose:e,children:g.jsxs(hl,{width:360,children:[g.jsx(Ya,{title:"Reference Color",onClose:e}),g.jsxs(Xa,{children:[g.jsx(zp,{value:i,onChange:s,onEnter:h,placeholder:"Search colors...",autoFocus:!0,fullWidth:!0,className:"mb-4"}),g.jsx(XQ,{sections:m,onItemClick:x=>f(x._data)})]}),g.jsx(qa,{children:g.jsx(Ye,{onClick:e,children:"Cancel"})})]})}):null}const lD=w.forwardRef(({error:t,fullWidth:e=!1,mono:n=!1,resize:r="vertical",className:i="",id:s,...o},l)=>{const a=s||`textarea-${Math.random().toString(36).substr(2,9)}`,u=["w-full px-3 py-2 border border-border rounded bg-base text-text","focus:outline focus:outline-2 focus:outline-primary focus:outline-offset-2","leading-relaxed",n&&"font-mono",t&&"border-danger",i].filter(Boolean).join(" "),c={resize:r,...o.style};return g.jsxs("div",{className:e?"w-full":"",children:[g.jsx("textarea",{ref:l,id:a,className:u,style:c,"aria-invalid":!!t,"aria-describedby":t?`${a}-error`:void 0,...o}),t&&g.jsx("span",{id:`${a}-error`,className:"text-xs text-danger mt-1 block",role:"alert",children:t})]})});lD.displayName="Textarea";function QQ(){const{modals:t,closeBulkEdit:e}=ar(),{variables:n,selectedCollectionId:r}=Zt(),i=t.bulkEdit,[s,o]=w.useState(""),l=(i==null?void 0:i.collectionId)??r,a=w.useMemo(()=>i?n.filter(f=>f.collectionId===l&&Qi(f.name)===i.groupName):[],[n,l,i]);w.useEffect(()=>{if(i&&a.length>0){const f=a.map(h=>`${h.name.replace(i.groupName+"/","")}, ${h.value}`);o(f.join(`
|
|
179
|
+
`))}},[i,a]);const u=w.useMemo(()=>{if(!i)return[];const f=s.split(`
|
|
180
|
+
`).filter(m=>m.trim()),h=new Set(a.map(m=>m.name.replace(i.groupName+"/","")));return f.map(m=>{const[x,...v]=m.split(/[,\t]/),p=x==null?void 0:x.trim(),y=v.join(",").trim();if(!p)return null;const b=!h.has(p),C=a.find($=>$.name===i.groupName+"/"+p),S=C&&C.value!==y,k=y.startsWith("#")||y.startsWith("rgb")||y.startsWith("{");let E=y;if(y.startsWith("{")&&y.endsWith("}")){const $=y.slice(1,-1),D=n.find(L=>L.name===$);D&&D.resolvedType==="COLOR"&&(E=D.value)}return{name:p,value:y,isNew:b,isModified:S,isColor:k,resolvedColor:E,fullName:`${i.groupName}/${p}`}}).filter(Boolean)},[s,i,a,n]),c=()=>{if(!i)return;const f=u.filter(h=>h!==null).map(h=>({name:h.fullName,value:h.value}));f.length>0&&Se({type:"bulk-update-group",collectionId:l,groupName:i.groupName,updates:f}),e()},d=f=>{f.key==="Escape"&&e()};return i?g.jsx(fl,{isOpen:!!i,onClose:e,children:g.jsxs(hl,{width:480,children:[g.jsx(Ya,{title:g.jsxs(g.Fragment,{children:["Edit as Text: ",g.jsx("span",{className:"font-normal text-text opacity-60",children:i.groupName})]}),onClose:e}),g.jsxs(Xa,{children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("label",{className:"text-sm",children:["One variable per line: ",g.jsx("code",{className:"text-xs bg-base-2 px-1 py-0.5 rounded",children:"name, value"})]}),g.jsx(lD,{className:"min-h-[120px] mt-2",spellCheck:!1,mono:!0,placeholder:`50, #FFFFFF
|
|
181
|
+
100, #F5F5F5
|
|
182
|
+
200, #EEEEEE`,value:s,onChange:f=>o(f.target.value),onKeyDown:d})]}),u.length>0&&g.jsx("div",{className:"mt-4 space-y-1 max-h-[200px] overflow-auto border border-border rounded p-2",children:u.map((f,h)=>f&&g.jsxs("div",{className:"flex items-center gap-2 text-sm py-1",children:[f.isColor&&g.jsx(ti,{color:f.resolvedColor}),g.jsx("span",{className:"font-mono text-xs opacity-60",children:f.fullName}),g.jsx("span",{className:"font-mono text-xs flex-1",children:f.value}),(f.isNew||f.isModified)&&g.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${f.isNew?"bg-primary/20 text-primary":"bg-warning/20 text-warning"}`,children:f.isNew?"new":"modified"})]},h))})]}),g.jsxs(qa,{children:[g.jsx(Ye,{onClick:e,children:"Cancel"}),g.jsx(Ye,{variant:"primary",onClick:c,children:"Apply Changes"})]})]})}):null}function ZQ(){const t=w.useRef(!1),e=w.useRef({x:0,y:0,width:0,height:0}),n=w.useRef("corner");w.useEffect(()=>{const i=o=>{if(!t.current)return;const l=o.clientX-e.current.x,a=o.clientY-e.current.y,u=n.current;let c=e.current.width,d=e.current.height;u==="right"||u==="corner"?c=e.current.width+l:u==="left"&&(c=e.current.width-l),u==="bottom"||u==="corner"?d=e.current.height+a:u==="top"&&(d=e.current.height-a),c=Math.max(400,c),d=Math.max(300,d),Se({type:"resize",width:c,height:d})},s=()=>{t.current=!1};return document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}},[]);const r=i=>s=>{t.current=!0,n.current=i,e.current={x:s.clientX,y:s.clientY,width:window.innerWidth,height:window.innerHeight},s.preventDefault()};return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"resize-handle resize-handle--top",onMouseDown:r("top")}),g.jsx("div",{className:"resize-handle resize-handle--right",onMouseDown:r("right")}),g.jsx("div",{className:"resize-handle resize-handle--bottom",onMouseDown:r("bottom")}),g.jsx("div",{className:"resize-handle resize-handle--left",onMouseDown:r("left")}),g.jsx("div",{className:"resize-handle resize-handle--corner",onMouseDown:r("corner")})]})}const JQ={width:320,height:52},p0="bridge-auto-handover";function eZ(){const{setData:t,setSelection:e}=Zt(),n=!Tx(),[r,i]=w.useState(n?"relationships":"table"),[s,o]=w.useState({message:"",type:""}),[l,a]=w.useState({canUndo:!1,canRedo:!1}),u=w.useCallback((k,E)=>{o({message:k,type:E}),E==="success"&&setTimeout(()=>o({message:"",type:""}),2e3)},[]),c=w.useCallback(()=>({"data-loaded":k=>{t(k.collections||[],k.variables||[],k.shadeGroups||[]),o({message:"",type:""})},"update-success":()=>{u("Saved","success")},"update-error":k=>{u("Error: "+k.error,"warning")},"history-state":k=>{a({canUndo:!!k.canUndo,canRedo:!!k.canRedo})},"history-applied":k=>{u(k.direction==="redo"?"Redid":"Undid","success")},"history-error":k=>{u(k.error,"warning")},"selection-changed":k=>{e(k.node||null,!!k.multiple)}}),[t,e,u]);fT(c());const d=cT(),f=d.role==="plugin"&&d.connected&&d.peerAttached,[h,m]=w.useState(!1);w.useEffect(()=>{if(n)return;const k=E=>{var D;const $=(D=E.data)==null?void 0:D.pluginMessage;($==null?void 0:$.type)==="client-storage-data"&&$.key===p0&&m($.value===!0)};return window.addEventListener("message",k),Se({type:"get-client-storage",key:p0}),()=>window.removeEventListener("message",k)},[n]);const x=w.useCallback(k=>{m(k),Se({type:"set-client-storage",key:p0,value:k})},[]),v=w.useCallback(()=>x(!0),[x]),p=w.useCallback(()=>{x(!1),dT()},[x]),y=f&&h,b=d.role==="client"&&d.probed&&!d.peerAttached,C=d.error,S=w.useRef(null);return w.useEffect(()=>{if(n)return;if(y){S.current||(S.current={width:window.innerWidth,height:window.innerHeight}),Se({type:"resize",...JQ});return}const k=S.current;k&&(S.current=null,Se({type:"resize",...k}))},[y,n]),w.useEffect(()=>{Se({type:"ui-ready"}),Se({type:"get-history-state"})},[]),w.useEffect(()=>{const k=$=>$ instanceof HTMLElement?$.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes($.tagName):!1,E=$=>{if($.defaultPrevented||k($.target)||!($.metaKey||$.ctrlKey))return;const L=$.key.toLowerCase(),A=L==="y"||L==="z"&&$.shiftKey;L==="z"&&!$.shiftKey&&l.canUndo?($.preventDefault(),Se({type:"undo"})):A&&l.canRedo&&($.preventDefault(),Se({type:"redo"}))};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[l.canRedo,l.canUndo]),y?g.jsxs("div",{className:"flex h-full items-center gap-2 bg-base px-3",title:"Keep this window open — it is the only thing that can talk to Figma.",children:[g.jsx("span",{className:"size-2 shrink-0 rounded-full bg-success","aria-hidden":"true"}),g.jsx("span",{className:"truncate text-xs text-text",children:"Browser has the wheel"}),g.jsx(Ye,{variant:"outline",size:"sm",className:"ml-auto shrink-0 px-2 py-1 text-xs",onClick:p,children:"Take over"})]}):g.jsxs(g.Fragment,{children:[(b||C)&&g.jsxs("div",{role:"status",className:"flex shrink-0 items-center justify-center gap-2 border-b border-border bg-base-2 px-4 py-2 text-center",children:[g.jsx("span",{className:"size-2 shrink-0 rounded-full bg-danger","aria-hidden":"true"}),g.jsx("span",{className:"text-xs text-text",children:C??(d.connected?"No plugin connected. Open the Winden Tokens plugin in Figma — this tab has no data of its own.":"Bridge relay not reachable. Run winden-tokens (or npm run dev:bridge), then open the Winden Tokens plugin in Figma.")})]}),f&&!h&&g.jsxs("div",{role:"status",className:"flex shrink-0 items-center gap-2 border-b border-border bg-base-2 px-4 py-2",children:[g.jsx("span",{className:"size-2 shrink-0 rounded-full bg-success","aria-hidden":"true"}),g.jsx("span",{className:"truncate text-xs text-text",children:"Browser tab connected. Both windows are live — edits from either one land in this file."}),g.jsx(Ye,{variant:"outline",size:"sm",className:"ml-auto shrink-0 px-2 py-1 text-xs",onClick:v,children:"Hand over"})]}),!n&&g.jsx(XT,{activeTab:r,onTabChange:i,canUndo:l.canUndo,canRedo:l.canRedo}),g.jsx(lX,{activeTab:r,status:s}),g.jsx(mX,{}),g.jsx(xX,{}),g.jsx(vX,{}),g.jsx(bX,{}),g.jsx(YQ,{}),g.jsx(qQ,{}),g.jsx(QQ,{}),g.jsx(ZQ,{})]})}const sC=document.getElementById("root");sC&&v5(sC).render(g.jsx(FA,{children:g.jsx(_A,{children:g.jsx(eZ,{})})}));
|
|
183
|
+
|
|
184
|
+
</script>
|
|
185
|
+
<style>
|
|
186
|
+
.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-content:"";--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-zinc-100:oklch(96.7% .001 286.375);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-zinc-950:oklch(14.1% .005 285.823);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-primary:var(--color-blue-500);--color-secondary:var(--color-purple-500);--color-danger:var(--color-red-500);--color-success:var(--color-green-500);--color-component:#9747ff;--color-text:black;--color-base:white;--color-base-2:var(--color-zinc-100);--color-base-3:var(--color-zinc-200);--color-border:var(--color-zinc-200);--color-bg-input:var(--color-zinc-100);--color-badge-success:#22c55e26;--color-badge-danger:#ef444426}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-1\/2{top:50%}.top-3{top:calc(var(--spacing) * 3)}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.right-3\.5{right:calc(var(--spacing) * 3.5)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.left-3\.5{left:calc(var(--spacing) * 3.5)}.left-5{left:calc(var(--spacing) * 5)}.z-10{z-index:10}.z-50{z-index:50}.z-\[1\]{z-index:1}.z-\[60\]{z-index:60}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing) * 0)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing) * 1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-4{margin-right:calc(var(--spacing) * 4)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-8{margin-left:calc(var(--spacing) * 8)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-1\/2{height:50%}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5\!{height:calc(var(--spacing) * 2.5)!important}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-4\.5{height:calc(var(--spacing) * 4.5)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-96{height:calc(var(--spacing) * 96)}.h-\[34px\]{height:34px}.h-\[180px\]{height:180px}.h-fit{height:fit-content}.h-fit\!{height:fit-content!important}.h-full{height:100%}.h-px{height:1px}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[200px\]{max-height:200px}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\[120px\]{min-height:120px}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5\!{width:calc(var(--spacing) * 2.5)!important}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-4\.5{width:calc(var(--spacing) * 4.5)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-16{width:calc(var(--spacing) * 16)}.w-25{width:calc(var(--spacing) * 25)}.w-65{width:calc(var(--spacing) * 65)}.w-80{width:calc(var(--spacing) * 80)}.w-96{width:calc(var(--spacing) * 96)}.w-\[100px\]{width:100px}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-25{max-width:calc(var(--spacing) * 25)}.max-w-30{max-width:calc(var(--spacing) * 30)}.max-w-\[55\%\]{max-width:55%}.max-w-\[100px\]{max-width:100px}.max-w-full{max-width:100%}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-50{min-width:calc(var(--spacing) * 50)}.min-w-\[100px\]{min-width:100px}.min-w-\[160px\]{min-width:160px}.min-w-\[200px\]{min-width:200px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-rotate-90{rotate:-90deg}.cursor-col-resize{cursor:col-resize}.cursor-crosshair{cursor:crosshair}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.list-none{list-style-type:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-8{gap:calc(var(--spacing) * 8)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t-sm{border-top-left-radius:var(--radius-sm);border-top-right-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-0{border-left-style:var(--tw-border-style);border-left-width:0}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-border{border-color:var(--color-border)}.border-danger{border-color:var(--color-danger)}.border-primary{border-color:var(--color-primary)}.border-secondary{border-color:var(--color-secondary)}.border-text{border-color:var(--color-text)}.border-text\/30{border-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.border-text\/30{border-color:color-mix(in oklab,var(--color-text) 30%,transparent)}}.border-text\/40{border-color:#0006}@supports (color:color-mix(in lab,red,red)){.border-text\/40{border-color:color-mix(in oklab,var(--color-text) 40%,transparent)}}.border-text\/50\!{border-color:#00000080!important}@supports (color:color-mix(in lab,red,red)){.border-text\/50\!{border-color:color-mix(in oklab,var(--color-text) 50%,transparent)!important}}.border-transparent{border-color:#0000}.border-white{border-color:var(--color-white)}.border-zinc-300{border-color:var(--color-zinc-300)}.border-b-primary{border-bottom-color:var(--color-primary)}.bg-badge-danger{background-color:var(--color-badge-danger)}.bg-badge-success{background-color:var(--color-badge-success)}.bg-base{background-color:var(--color-base)}.bg-base-2{background-color:var(--color-base-2)}.bg-base-2\!{background-color:var(--color-base-2)!important}.bg-base-3{background-color:var(--color-base-3)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-border{background-color:var(--color-border)}.bg-component{background-color:var(--color-component)}.bg-danger{background-color:var(--color-danger)}.bg-primary{background-color:var(--color-primary)}.bg-primary\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,var(--color-primary) 10%,transparent)}}.bg-primary\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-primary\/20{background-color:color-mix(in oklab,var(--color-primary) 20%,transparent)}}.bg-red-100{background-color:var(--color-red-100)}.bg-secondary{background-color:var(--color-secondary)}.bg-success{background-color:var(--color-success)}.bg-text\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-text\/30{background-color:color-mix(in oklab,var(--color-text) 30%,transparent)}}.bg-text\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-text\/50{background-color:color-mix(in oklab,var(--color-text) 50%,transparent)}}.bg-transparent{background-color:#0000}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-base{--tw-gradient-from:var(--color-base);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-base-2{--tw-gradient-via:var(--color-base-2);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-base{--tw-gradient-to:var(--color-base);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-center{background-position:50%}.bg-right{background-position:100%}.bg-no-repeat{background-repeat:no-repeat}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pl-1{padding-left:calc(var(--spacing) * 1)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-\[16px\]{font-size:16px}.leading-0{--tw-leading:calc(var(--spacing) * 0);line-height:calc(var(--spacing) * 0)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.text-base{color:var(--color-base)}.text-danger{color:var(--color-danger)}.text-primary{color:var(--color-primary)}.text-red-600{color:var(--color-red-600)}.text-secondary{color:var(--color-secondary)}.text-text{color:var(--color-text)}.text-text\/40{color:#0006}@supports (color:color-mix(in lab,red,red)){.text-text\/40{color:color-mix(in oklab,var(--color-text) 40%,transparent)}}.text-text\/50{color:#00000080}@supports (color:color-mix(in lab,red,red)){.text-text\/50{color:color-mix(in oklab,var(--color-text) 50%,transparent)}}.text-text\/60{color:#0009}@supports (color:color-mix(in lab,red,red)){.text-text\/60{color:color-mix(in oklab,var(--color-text) 60%,transparent)}}.text-text\/70{color:#000000b3}@supports (color:color-mix(in lab,red,red)){.text-text\/70{color:color-mix(in oklab,var(--color-text) 70%,transparent)}}.text-white{color:var(--color-white)}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white) 70%,transparent)}}.uppercase{text-transform:uppercase}.accent-primary{accent-color:var(--color-primary)}.opacity-0{opacity:0}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-45{opacity:.45}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[inset_2px_0_0_\#EC4899\]{--tw-shadow:inset 2px 0 0 var(--tw-shadow-color,#ec4899);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[inset_2px_0_0_rgba\(236\,72\,153\,0\.45\)\]{--tw-shadow:inset 2px 0 0 var(--tw-shadow-color,#ec489973);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-\[\#EC4899\]{--tw-ring-color:#ec4899}.ring-danger{--tw-ring-color:var(--color-danger)}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-base-2{--tw-ring-offset-color:var(--color-base-2)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[background\,opacity\]{transition-property:background,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[background\]{transition-property:background;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[opacity\,box-shadow\]{transition-property:opacity,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.ring-inset{--tw-ring-inset:inset}@media (hover:hover){.group-hover\:opacity-50:is(:where(.group):hover *){opacity:.5}}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:inset-0:after{content:var(--tw-content);inset:calc(var(--spacing) * 0)}.after\:m-auto:after{content:var(--tw-content);margin:auto}.after\:h-2:after{content:var(--tw-content);height:calc(var(--spacing) * 2)}.after\:w-2:after{content:var(--tw-content);width:calc(var(--spacing) * 2)}.after\:rounded-full:after{content:var(--tw-content);border-radius:3.40282e38px}.after\:bg-base:after{content:var(--tw-content);background-color:var(--color-base)}.after\:opacity-0:after{content:var(--tw-content);opacity:0}.after\:content-\[\'\'\]:after{--tw-content:"";content:var(--tw-content)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.checked\:border-primary:checked{border-color:var(--color-primary)}.checked\:bg-primary:checked{background-color:var(--color-primary)}.checked\:after\:opacity-100:checked:after{content:var(--tw-content);opacity:1}@media (hover:hover){.hover\:h-4\!:hover{height:calc(var(--spacing) * 4)!important}.hover\:w-4\!:hover{width:calc(var(--spacing) * 4)!important}.hover\:scale-115:hover{--tw-scale-x:115%;--tw-scale-y:115%;--tw-scale-z:115%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:border-danger:hover{border-color:var(--color-danger)}.hover\:border-primary\/50:hover{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab,var(--color-primary) 50%,transparent)}}.hover\:bg-base-2:hover{background-color:var(--color-base-2)}.hover\:bg-base-3:hover{background-color:var(--color-base-3)}.hover\:bg-danger:hover{background-color:var(--color-danger)}.hover\:bg-danger\/80:hover{background-color:#fb2c36cc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-danger\/80:hover{background-color:color-mix(in oklab,var(--color-danger) 80%,transparent)}}.hover\:bg-primary\/80:hover{background-color:#3080ffcc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/80:hover{background-color:color-mix(in oklab,var(--color-primary) 80%,transparent)}}.hover\:bg-red-200:hover{background-color:var(--color-red-200)}.hover\:bg-transparent:hover{background-color:#0000}.hover\:text-primary:hover{color:var(--color-primary)}.hover\:text-text:hover{color:var(--color-text)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-60:hover{opacity:.6}.hover\:opacity-100\!:hover{opacity:1!important}.hover\:shadow-\[0_2px_6px_rgba\(0\,0\,0\,0\.2\)\]:hover{--tw-shadow:0 2px 6px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:border-danger:focus{border-color:var(--color-danger)}.focus\:border-primary:focus{border-color:var(--color-primary)}.focus\:bg-bg-input:focus{background-color:var(--color-bg-input)}.focus\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-primary:focus{--tw-ring-color:var(--color-primary)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus\:outline:focus,.focus\:outline-1:focus{outline-style:var(--tw-outline-style);outline-width:1px}.focus\:outline-2:focus{outline-style:var(--tw-outline-style);outline-width:2px}.focus\:outline-offset-2:focus{outline-offset:2px}.focus\:outline-primary:focus{outline-color:var(--color-primary)}.focus\:outline-text:focus{outline-color:var(--color-text)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\:bg-base-3:active{background-color:var(--color-base-3)}.active\:bg-danger\/90:active{background-color:#fb2c36e6}@supports (color:color-mix(in lab,red,red)){.active\:bg-danger\/90:active{background-color:color-mix(in oklab,var(--color-danger) 90%,transparent)}}.active\:bg-primary\/90:active{background-color:#3080ffe6}@supports (color:color-mix(in lab,red,red)){.active\:bg-primary\/90:active{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.active\:bg-red-300:active{background-color:var(--color-red-300)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-base-2:disabled{background-color:var(--color-base-2)}.disabled\:opacity-50:disabled{opacity:.5}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}}.react-flow{--xy-edge-stroke-default:#b1b1b7;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#555;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#ffffff80;--xy-minimap-background-color-default:#fff;--xy-minimap-mask-background-color-default:#f0f0f099;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#e2e2e2;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:transparent;--xy-background-pattern-dots-color-default:#91919a;--xy-background-pattern-lines-color-default:#eee;--xy-background-pattern-cross-color-default:#e2e2e2;background-color:var(--xy-background-color,var(--xy-background-color-default));--xy-node-color-default:inherit;--xy-node-border-default:1px solid #1a192b;--xy-node-background-color-default:#fff;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #00000014;--xy-node-boxshadow-selected-default:0 0 0 .5px #1a192b;--xy-node-border-radius-default:3px;--xy-handle-background-color-default:#1a192b;--xy-handle-border-color-default:#fff;--xy-selection-background-color-default:#0059dc14;--xy-selection-border-default:1px dotted #0059dccc;--xy-controls-button-background-color-default:#fefefe;--xy-controls-button-background-color-hover-default:#f4f4f4;--xy-controls-button-color-default:inherit;--xy-controls-button-color-hover-default:inherit;--xy-controls-button-border-color-default:#eee;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#fff;--xy-edge-label-color-default:inherit;--xy-resize-background-color-default:#3367d9;direction:ltr}.react-flow.dark{--xy-edge-stroke-default:#3e3e3e;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#727272;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#96969640;--xy-minimap-background-color-default:#141414;--xy-minimap-mask-background-color-default:#3c3c3c99;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#2b2b2b;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:#141414;--xy-background-pattern-dots-color-default:#777;--xy-background-pattern-lines-color-default:#777;--xy-background-pattern-cross-color-default:#777;--xy-node-color-default:#f8f8f8;--xy-node-border-default:1px solid #3c3c3c;--xy-node-background-color-default:#1e1e1e;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #ffffff14;--xy-node-boxshadow-selected-default:0 0 0 .5px #999;--xy-handle-background-color-default:#bebebe;--xy-handle-border-color-default:#1e1e1e;--xy-selection-background-color-default:#c8c8dc14;--xy-selection-border-default:1px dotted #c8c8dccc;--xy-controls-button-background-color-default:#2b2b2b;--xy-controls-button-background-color-hover-default:#3e3e3e;--xy-controls-button-color-default:#f8f8f8;--xy-controls-button-color-hover-default:#fff;--xy-controls-button-border-color-default:#5b5b5b;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#141414;--xy-edge-label-color-default:#f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props,var(--xy-background-color,var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width,var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke,var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width,var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{pointer-events:none;position:absolute;overflow:visible}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected,var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}svg.react-flow__connectionline{z-index:1001;position:absolute;overflow:visible}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.react-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.react-flow__handle{pointer-events:none;background-color:var(--xy-handle-background-color,var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color,var(--xy-handle-border-color-default));border-radius:100%;width:6px;min-width:5px;height:6px;min-height:5px;position:absolute}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;bottom:0;left:50%;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{z-index:5;margin:15px;position:absolute}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px)translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px)translateY(-50%)}.react-flow__attribution{background:var(--xy-attribution-background-color,var(--xy-attribution-background-color-default));margin:0;padding:2px 3px;font-size:10px}.react-flow__attribution a{color:#999;text-decoration:none}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.react-flow__edgelabel-renderer{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__viewport-portal{-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__minimap{background:var(--xy-minimap-background-color-props,var(--xy-minimap-background-color,var(--xy-minimap-background-color-default)))}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var(--xy-minimap-mask-background-color-props,var(--xy-minimap-mask-background-color,var(--xy-minimap-mask-background-color-default)));stroke:var(--xy-minimap-mask-stroke-color-props,var(--xy-minimap-mask-stroke-color,var(--xy-minimap-mask-stroke-color-default)));stroke-width:var(--xy-minimap-mask-stroke-width-props,var(--xy-minimap-mask-stroke-width,var(--xy-minimap-mask-stroke-width-default)))}.react-flow__minimap-node{fill:var(--xy-minimap-node-background-color-props,var(--xy-minimap-node-background-color,var(--xy-minimap-node-background-color-default)));stroke:var(--xy-minimap-node-stroke-color-props,var(--xy-minimap-node-stroke-color,var(--xy-minimap-node-stroke-color-default)));stroke-width:var(--xy-minimap-node-stroke-width-props,var(--xy-minimap-node-stroke-width,var(--xy-minimap-node-stroke-width-default)))}.react-flow__background-pattern.dots{fill:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-dots-color-default)))}.react-flow__background-pattern.lines{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-lines-color-default)))}.react-flow__background-pattern.cross{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-cross-color-default)))}.react-flow__controls{box-shadow:var(--xy-controls-box-shadow,var(--xy-controls-box-shadow-default));flex-direction:column;display:flex}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{background:var(--xy-controls-button-background-color,var(--xy-controls-button-background-color-default));border:none;border-bottom:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)));width:26px;height:26px;color:var(--xy-controls-button-color-props,var(--xy-controls-button-color,var(--xy-controls-button-color-default)));cursor:pointer;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;padding:4px;display:flex}.react-flow__controls-button svg{fill:currentColor;width:100%;max-width:12px;max-height:12px}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{border-radius:var(--xy-node-border-radius,var(--xy-node-border-radius-default));width:150px;color:var(--xy-node-color,var(--xy-node-color-default));text-align:center;border:var(--xy-node-border,var(--xy-node-border-default));background-color:var(--xy-node-background-color,var(--xy-node-background-color-default));padding:10px;font-size:12px}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover,var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected,var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color,var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color,var(--xy-selection-background-color-default));border:var(--xy-selection-border,var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var(--xy-controls-button-background-color-hover-props,var(--xy-controls-button-background-color-hover,var(--xy-controls-button-background-color-hover-default)));color:var(--xy-controls-button-color-hover-props,var(--xy-controls-button-color-hover,var(--xy-controls-button-color-hover-default)))}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)))}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border:1px solid #fff;border-radius:1px;width:5px;height:5px;translate:-50% -50%}.react-flow__resize-control.handle.left{top:50%;left:0}.react-flow__resize-control.handle.right{top:50%;left:100%}.react-flow__resize-control.handle.top{top:0;left:50%}.react-flow__resize-control.handle.bottom{top:100%;left:50%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border-style:solid;border-width:0}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;height:100%;top:0;transform:translate(-50%)}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{width:100%;height:1px;left:0;transform:translateY(-50%)}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color,var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color,var(--xy-edge-label-color-default))}.react-aria-ColorArea{cursor:pointer;forced-color-adjust:none;position:relative;overflow:hidden}.react-aria-ColorArea:before{content:"";background:linear-gradient(90deg,#fff,#0000);position:absolute;top:0;right:0;bottom:0;left:0}.react-aria-ColorArea:after{content:"";background:linear-gradient(#0000,#000);position:absolute;top:0;right:0;bottom:0;left:0}.react-aria-ColorThumb{forced-color-adjust:none;box-sizing:border-box;border:2px solid #fff;border-radius:9999px;width:1.25rem;height:1.25rem;margin-top:-.625rem;margin-left:-.625rem;position:absolute;box-shadow:0 4px 6px -1px #0000001a}.react-aria-ColorThumb[data-focus-visible]{outline:2px solid var(--color-primary);outline-offset:2px}.react-aria-ColorSlider{forced-color-adjust:none;position:relative}.react-aria-ColorSlider[data-orientation=horizontal]{flex-direction:column;align-items:center;display:flex}.react-aria-ColorSlider .react-aria-SliderTrack{border-radius:.25rem;width:100%;height:1.5rem;position:relative}.react-aria-ColorSlider[data-channel=hue] .react-aria-SliderTrack{background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.react-aria-ColorSlider .react-aria-SliderThumb{forced-color-adjust:none;border:2px solid #fff;border-radius:9999px;width:1.25rem;height:1.25rem;position:absolute;top:50%;transform:translateY(-50%);box-shadow:0 4px 6px -1px #0000001a}.react-aria-ColorSlider .react-aria-SliderThumb[data-focus-visible]{outline:2px solid var(--color-primary);outline-offset:2px}.react-aria-Input{background-color:var(--color-bg-input);border:1px solid var(--color-border);border-radius:.25rem;width:100%;padding:.5rem;font-size:.875rem}.react-aria-Input:focus,.react-aria-Input:focus-visible{outline:1px solid var(--color-text);outline-offset:2px;box-shadow:none}.react-aria-ColorField{outline:none}.json-panel{flex-direction:column;gap:12px;height:100%;padding:12px;display:flex}.json-editor{background:var(--color-base);border:1px solid var(--color-border);color:var(--color-text);resize:none;-moz-tab-size:2;tab-size:2;border-radius:4px;padding:12px;font-family:Monaco,Menlo,Courier New,monospace;font-size:12px;line-height:1.5;overflow:auto}.json-editor.w-full.h-full{height:100%!important}.textarea-wrapper:has(.json-editor){width:100%;height:100%}.json-editor:focus{outline:none}.json-editor.error{border-color:var(--color-danger);background:#ef44440d}.json-highlight{background:var(--color-base);border:1px solid var(--color-border);white-space:pre;color:var(--color-text);border-radius:4px;padding:12px;font-family:Monaco,Menlo,Courier New,monospace;font-size:12px;line-height:1.5;overflow:auto}.json-highlight .json-key{color:var(--color-primary);font-weight:500}.json-highlight .json-string{color:var(--color-secondary)}.json-highlight .json-number{color:#d97706}.json-highlight .json-boolean{color:#7c3aed;font-weight:600}.json-highlight .json-null{color:#ef4444;font-style:italic}.json-highlight .json-punctuation{color:var(--color-text);opacity:.7}@media (prefers-color-scheme:dark){.json-highlight .json-key{color:var(--color-blue-400)}.json-highlight .json-string{color:var(--color-purple-400)}.json-highlight .json-number{color:#fb923c}.json-highlight .json-boolean{color:#a78bfa}.json-highlight .json-null{color:#f87171}:root{--color-primary:var(--color-blue-600);--color-secondary:var(--color-purple-600);--color-danger:var(--color-red-600);--color-success:var(--color-green-600);--color-text:var(--color-zinc-100);--color-base:var(--color-zinc-950);--color-base-2:var(--color-zinc-900);--color-base-3:var(--color-zinc-800);--color-border:var(--color-zinc-700);--color-bg-input:var(--color-zinc-900);--color-badge-success:#22c55e33;--color-badge-danger:#ef444433}}html,body,#root{height:100%;margin:0;padding:0}body{background-color:var(--color-base);color:var(--color-text);flex-direction:column;line-height:1;display:flex}#root{flex-direction:column;display:flex}body,input,button,table,span,div{font-size:12px}.bg-checkerboard{background-image:linear-gradient(45deg,#e5e5e5 25%,#0000 25%),linear-gradient(-45deg,#e5e5e5 25%,#0000 25%),linear-gradient(45deg,#0000 75%,#e5e5e5 75%),linear-gradient(-45deg,#0000 75%,#e5e5e5 75%);background-position:0 0,0 3px,3px -3px,-3px 0;background-size:6px 6px}input[type=checkbox]:checked{background-size:12px 10px!important}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}
|
|
187
|
+
|
|
188
|
+
</style>
|
|
189
|
+
</head>
|
|
190
|
+
<body>
|
|
191
|
+
<div id="root"></div>
|
|
192
|
+
|
|
193
|
+
<!-- Mock data for browser preview (only loads if not in Figma) -->
|
|
194
|
+
<script>
|
|
195
|
+
if (!window.parent || window.parent === window) {
|
|
196
|
+
// We're in browser, not Figma. Inject mock data unless the dev bridge is
|
|
197
|
+
// feeding this tab real data from the open Figma file
|
|
198
|
+
// (see src/ui/hooks/useBridge.ts).
|
|
199
|
+
let mockInjected = false;
|
|
200
|
+
window.__WINDEN_INJECT_MOCK__ = () => {
|
|
201
|
+
if (mockInjected) return;
|
|
202
|
+
mockInjected = true;
|
|
203
|
+
{
|
|
204
|
+
const mockData = {"collections":[{"id":"VariableCollectionId:5:2","name":"colors","modes":[{"modeId":"5:0","name":"Mode 1"}]}],"variables":[{"id":"VariableID:23:21","collectionId":"VariableCollectionId:5:2","name":"spacing/lg","resolvedType":"FLOAT","value":"16","valuesByMode":{"5:0":"16"},"scopes":[],"hiddenFromPublishing":false,"description":"","codeSyntax":{}},{"id":"VariableID:99:377","collectionId":"VariableCollectionId:5:2","name":"accent/50","resolvedType":"COLOR","value":"#D5E1AE","valuesByMode":{"5:0":"#D5E1AE"},"scopes":[],"hiddenFromPublishing":false,"description":"","codeSyntax":{}},{"id":"VariableID:99:378","collectionId":"VariableCollectionId:5:2","name":"accent/100","resolvedType":"COLOR","value":"#8CC047","valuesByMode":{"5:0":"#8CC047"},"scopes":[],"hiddenFromPublishing":false,"description":"","codeSyntax":{}},{"id":"VariableID:99:379","collectionId":"VariableCollectionId:5:2","name":"accent/200","resolvedType":"COLOR","value":"#4EA902","valuesByMode":{"5:0":"#4EA902"},"scopes":[],"hiddenFromPublishing":false,"description":"","codeSyntax":{}},{"id":"VariableID:99:399","collectionId":"VariableCollectionId:5:2","name":"action/500","resolvedType":"COLOR","value":"#EF1AD4","valuesByMode":{"5:0":"#EF1AD4"},"scopes":[],"hiddenFromPublishing":false,"description":"","codeSyntax":{}},{"id":"VariableID:98:295","collectionId":"VariableCollectionId:5:2","name":"card/text","resolvedType":"COLOR","value":"{accent/50}","valuesByMode":{"5:0":"{accent/50}"},"scopes":[],"hiddenFromPublishing":false,"description":"","codeSyntax":{}},{"id":"VariableID:109:13","collectionId":"VariableCollectionId:5:2","name":"red","resolvedType":"COLOR","value":"#EB1010","valuesByMode":{"5:0":"#EB1010"},"scopes":[],"hiddenFromPublishing":false,"description":"","codeSyntax":{}}],"shadeGroups":[{"sourceVariableId":"VariableID:99:377","sourceVariableName":"accent/50","collectionId":"VariableCollectionId:5:2","deleteIds":["VariableID:99:377","VariableID:99:378","VariableID:99:379"],"status":"clean","dirtyReasons":[],"config":{"version":1,"sourceVariableId":"VariableID:99:377","sourceName":"accent/50","sourceValue":"#D5E1AE","shadeCount":3,"baseIndex":0,"lightValue":98,"darkValue":10,"lightnessCurve":{"startValue":98,"leftHandle1":{"t":0,"value":98},"leftHandle2":{"t":0.4,"value":70},"rightHandle1":{"t":0.6,"value":30},"rightHandle2":{"t":1,"value":10},"endValue":10},"saturationCurve":{"startValue":50,"leftHandle1":{"t":0,"value":50},"leftHandle2":{"t":0.5,"value":50},"rightHandle1":{"t":0.5,"value":50},"rightHandle2":{"t":1,"value":50},"endValue":50},"hueCurve":{"startValue":0,"leftHandle1":{"t":0,"value":0},"leftHandle2":{"t":0.5,"value":0},"rightHandle1":{"t":0.5,"value":0},"rightHandle2":{"t":1,"value":0},"endValue":0},"generatedShades":[{"id":"VariableID:99:377","name":"accent/50","value":"#D5E1AE"},{"id":"VariableID:99:378","name":"accent/100","value":"#8CC047"},{"id":"VariableID:99:379","name":"accent/200","value":"#4EA902"}],"updatedAt":"2024-01-01T00:00:00.000Z"}}],"stepGroups":[{"sourceVariableId":"VariableID:23:21","sourceVariableName":"spacing/lg","collectionId":"VariableCollectionId:5:2","deleteIds":[],"status":"clean","dirtyReasons":[],"config":{"baseValue":16,"ratio":2,"baseStep":"spacing/lg","steps":[{"name":"spacing/xs","value":4},{"name":"spacing/sm","value":8},{"name":"spacing/lg","value":16},{"name":"spacing/xl","value":32}]}}]};
|
|
205
|
+
|
|
206
|
+
const mockMessage = {
|
|
207
|
+
pluginMessage: {
|
|
208
|
+
type: 'data-loaded',
|
|
209
|
+
...mockData
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
window.postMessage(mockMessage, '*');
|
|
213
|
+
console.log('[Mock] Injected sample data:', mockData);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
window.addEventListener('DOMContentLoaded', () => {
|
|
217
|
+
setTimeout(() => {
|
|
218
|
+
if (window.__WINDEN_BRIDGE_ACTIVE__) return;
|
|
219
|
+
window.__WINDEN_INJECT_MOCK__();
|
|
220
|
+
}, 100);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
</script>
|
|
224
|
+
|
|
225
|
+
</body>
|
|
226
|
+
</html>
|