@xcr1234/dbhub-fork 1.4.0 → 1.5.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/README.md +3 -2
- package/dist/index.js +1 -1
- package/dist/{oracle-TD3RWFFI.js → oracle-POFDPF45.js} +0 -1
- package/dist/public/assets/index-B728NGNx.js +159 -0
- package/dist/public/assets/index-aU1SXgf0.css +1 -0
- package/dist/public/index.html +2 -2
- package/package.json +1 -1
- package/dist/public/assets/index-CfPYb3wl.css +0 -1
- package/dist/public/assets/index-CtE4wTlN.js +0 -144
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
var XT=Object.defineProperty;var JT=(n,e,t)=>e in n?XT(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Je=(n,e,t)=>JT(n,typeof e!="symbol"?e+"":e,t);function ZT(n,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in n)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(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=t(i);fetch(i.href,s)}})();function e4(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var mp={exports:{}},Yl={},gp={exports:{}},je={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var C1;function t4(){if(C1)return je;C1=1;var n=Symbol.for("react.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.iterator;function g(M){return M===null||typeof M!="object"?null:(M=p&&M[p]||M["@@iterator"],typeof M=="function"?M:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,b={};function S(M,V,ne){this.props=M,this.context=V,this.refs=b,this.updater=ne||v}S.prototype.isReactComponent={},S.prototype.setState=function(M,V){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,V,"setState")},S.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function C(){}C.prototype=S.prototype;function R(M,V,ne){this.props=M,this.context=V,this.refs=b,this.updater=ne||v}var O=R.prototype=new C;O.constructor=R,x(O,S.prototype),O.isPureReactComponent=!0;var P=Array.isArray,D=Object.prototype.hasOwnProperty,N={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function z(M,V,ne){var ee,fe={},se=null,me=null;if(V!=null)for(ee in V.ref!==void 0&&(me=V.ref),V.key!==void 0&&(se=""+V.key),V)D.call(V,ee)&&!L.hasOwnProperty(ee)&&(fe[ee]=V[ee]);var xe=arguments.length-2;if(xe===1)fe.children=ne;else if(1<xe){for(var ye=Array(xe),Ve=0;Ve<xe;Ve++)ye[Ve]=arguments[Ve+2];fe.children=ye}if(M&&M.defaultProps)for(ee in xe=M.defaultProps,xe)fe[ee]===void 0&&(fe[ee]=xe[ee]);return{$$typeof:n,type:M,key:se,ref:me,props:fe,_owner:N.current}}function Q(M,V){return{$$typeof:n,type:M.type,key:V,ref:M.ref,props:M.props,_owner:M._owner}}function G(M){return typeof M=="object"&&M!==null&&M.$$typeof===n}function X(M){var V={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(ne){return V[ne]})}var W=/\/+/g;function Y(M,V){return typeof M=="object"&&M!==null&&M.key!=null?X(""+M.key):V.toString(36)}function J(M,V,ne,ee,fe){var se=typeof M;(se==="undefined"||se==="boolean")&&(M=null);var me=!1;if(M===null)me=!0;else switch(se){case"string":case"number":me=!0;break;case"object":switch(M.$$typeof){case n:case e:me=!0}}if(me)return me=M,fe=fe(me),M=ee===""?"."+Y(me,0):ee,P(fe)?(ne="",M!=null&&(ne=M.replace(W,"$&/")+"/"),J(fe,V,ne,"",function(Ve){return Ve})):fe!=null&&(G(fe)&&(fe=Q(fe,ne+(!fe.key||me&&me.key===fe.key?"":(""+fe.key).replace(W,"$&/")+"/")+M)),V.push(fe)),1;if(me=0,ee=ee===""?".":ee+":",P(M))for(var xe=0;xe<M.length;xe++){se=M[xe];var ye=ee+Y(se,xe);me+=J(se,V,ne,ye,fe)}else if(ye=g(M),typeof ye=="function")for(M=ye.call(M),xe=0;!(se=M.next()).done;)se=se.value,ye=ee+Y(se,xe++),me+=J(se,V,ne,ye,fe);else if(se==="object")throw V=String(M),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return me}function $(M,V,ne){if(M==null)return M;var ee=[],fe=0;return J(M,ee,"","",function(se){return V.call(ne,se,fe++)}),ee}function te(M){if(M._status===-1){var V=M._result;V=V(),V.then(function(ne){(M._status===0||M._status===-1)&&(M._status=1,M._result=ne)},function(ne){(M._status===0||M._status===-1)&&(M._status=2,M._result=ne)}),M._status===-1&&(M._status=0,M._result=V)}if(M._status===1)return M._result.default;throw M._result}var q={current:null},I={transition:null},_={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:I,ReactCurrentOwner:N};function B(){throw Error("act(...) is not supported in production builds of React.")}return je.Children={map:$,forEach:function(M,V,ne){$(M,function(){V.apply(this,arguments)},ne)},count:function(M){var V=0;return $(M,function(){V++}),V},toArray:function(M){return $(M,function(V){return V})||[]},only:function(M){if(!G(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},je.Component=S,je.Fragment=t,je.Profiler=i,je.PureComponent=R,je.StrictMode=r,je.Suspense=u,je.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_,je.act=B,je.cloneElement=function(M,V,ne){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var ee=x({},M.props),fe=M.key,se=M.ref,me=M._owner;if(V!=null){if(V.ref!==void 0&&(se=V.ref,me=N.current),V.key!==void 0&&(fe=""+V.key),M.type&&M.type.defaultProps)var xe=M.type.defaultProps;for(ye in V)D.call(V,ye)&&!L.hasOwnProperty(ye)&&(ee[ye]=V[ye]===void 0&&xe!==void 0?xe[ye]:V[ye])}var ye=arguments.length-2;if(ye===1)ee.children=ne;else if(1<ye){xe=Array(ye);for(var Ve=0;Ve<ye;Ve++)xe[Ve]=arguments[Ve+2];ee.children=xe}return{$$typeof:n,type:M.type,key:fe,ref:se,props:ee,_owner:me}},je.createContext=function(M){return M={$$typeof:o,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:s,_context:M},M.Consumer=M},je.createElement=z,je.createFactory=function(M){var V=z.bind(null,M);return V.type=M,V},je.createRef=function(){return{current:null}},je.forwardRef=function(M){return{$$typeof:a,render:M}},je.isValidElement=G,je.lazy=function(M){return{$$typeof:d,_payload:{_status:-1,_result:M},_init:te}},je.memo=function(M,V){return{$$typeof:h,type:M,compare:V===void 0?null:V}},je.startTransition=function(M){var V=I.transition;I.transition={};try{M()}finally{I.transition=V}},je.unstable_act=B,je.useCallback=function(M,V){return q.current.useCallback(M,V)},je.useContext=function(M){return q.current.useContext(M)},je.useDebugValue=function(){},je.useDeferredValue=function(M){return q.current.useDeferredValue(M)},je.useEffect=function(M,V){return q.current.useEffect(M,V)},je.useId=function(){return q.current.useId()},je.useImperativeHandle=function(M,V,ne){return q.current.useImperativeHandle(M,V,ne)},je.useInsertionEffect=function(M,V){return q.current.useInsertionEffect(M,V)},je.useLayoutEffect=function(M,V){return q.current.useLayoutEffect(M,V)},je.useMemo=function(M,V){return q.current.useMemo(M,V)},je.useReducer=function(M,V,ne){return q.current.useReducer(M,V,ne)},je.useRef=function(M){return q.current.useRef(M)},je.useState=function(M){return q.current.useState(M)},je.useSyncExternalStore=function(M,V,ne){return q.current.useSyncExternalStore(M,V,ne)},je.useTransition=function(){return q.current.useTransition()},je.version="18.3.1",je}var E1;function Ua(){return E1||(E1=1,gp.exports=t4()),gp.exports}/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var T1;function n4(){if(T1)return Yl;T1=1;var n=Ua(),e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,h){var d,p={},g=null,v=null;h!==void 0&&(g=""+h),u.key!==void 0&&(g=""+u.key),u.ref!==void 0&&(v=u.ref);for(d in u)r.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:e,type:a,key:g,ref:v,props:p,_owner:i.current}}return Yl.Fragment=t,Yl.jsx=o,Yl.jsxs=o,Yl}var R1;function r4(){return R1||(R1=1,mp.exports=n4()),mp.exports}var E=r4(),k=Ua();const i4=e4(k),s4=ZT({__proto__:null,default:i4},[k]);var cu={},yp={exports:{}},Bn={},vp={exports:{}},xp={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var O1;function o4(){return O1||(O1=1,(function(n){function e(I,_){var B=I.length;I.push(_);e:for(;0<B;){var M=B-1>>>1,V=I[M];if(0<i(V,_))I[M]=_,I[B]=V,B=M;else break e}}function t(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var _=I[0],B=I.pop();if(B!==_){I[0]=B;e:for(var M=0,V=I.length,ne=V>>>1;M<ne;){var ee=2*(M+1)-1,fe=I[ee],se=ee+1,me=I[se];if(0>i(fe,B))se<V&&0>i(me,fe)?(I[M]=me,I[se]=B,M=se):(I[M]=fe,I[ee]=B,M=ee);else if(se<V&&0>i(me,B))I[M]=me,I[se]=B,M=se;else break e}}return _}function i(I,_){var B=I.sortIndex-_.sortIndex;return B!==0?B:I.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var u=[],h=[],d=1,p=null,g=3,v=!1,x=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function O(I){for(var _=t(h);_!==null;){if(_.callback===null)r(h);else if(_.startTime<=I)r(h),_.sortIndex=_.expirationTime,e(u,_);else break;_=t(h)}}function P(I){if(b=!1,O(I),!x)if(t(u)!==null)x=!0,te(D);else{var _=t(h);_!==null&&q(P,_.startTime-I)}}function D(I,_){x=!1,b&&(b=!1,C(z),z=-1),v=!0;var B=g;try{for(O(_),p=t(u);p!==null&&(!(p.expirationTime>_)||I&&!X());){var M=p.callback;if(typeof M=="function"){p.callback=null,g=p.priorityLevel;var V=M(p.expirationTime<=_);_=n.unstable_now(),typeof V=="function"?p.callback=V:p===t(u)&&r(u),O(_)}else r(u);p=t(u)}if(p!==null)var ne=!0;else{var ee=t(h);ee!==null&&q(P,ee.startTime-_),ne=!1}return ne}finally{p=null,g=B,v=!1}}var N=!1,L=null,z=-1,Q=5,G=-1;function X(){return!(n.unstable_now()-G<Q)}function W(){if(L!==null){var I=n.unstable_now();G=I;var _=!0;try{_=L(!0,I)}finally{_?Y():(N=!1,L=null)}}else N=!1}var Y;if(typeof R=="function")Y=function(){R(W)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,$=J.port2;J.port1.onmessage=W,Y=function(){$.postMessage(null)}}else Y=function(){S(W,0)};function te(I){L=I,N||(N=!0,Y())}function q(I,_){z=S(function(){I(n.unstable_now())},_)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(I){I.callback=null},n.unstable_continueExecution=function(){x||v||(x=!0,te(D))},n.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"):Q=0<I?Math.floor(1e3/I):5},n.unstable_getCurrentPriorityLevel=function(){return g},n.unstable_getFirstCallbackNode=function(){return t(u)},n.unstable_next=function(I){switch(g){case 1:case 2:case 3:var _=3;break;default:_=g}var B=g;g=_;try{return I()}finally{g=B}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(I,_){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var B=g;g=I;try{return _()}finally{g=B}},n.unstable_scheduleCallback=function(I,_,B){var M=n.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?M+B:M):B=M,I){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=B+V,I={id:d++,callback:_,priorityLevel:I,startTime:B,expirationTime:V,sortIndex:-1},B>M?(I.sortIndex=B,e(h,I),t(u)===null&&I===t(h)&&(b?(C(z),z=-1):b=!0,q(P,B-M))):(I.sortIndex=V,e(u,I),x||v||(x=!0,te(D))),I},n.unstable_shouldYield=X,n.unstable_wrapCallback=function(I){var _=g;return function(){var B=g;g=_;try{return I.apply(this,arguments)}finally{g=B}}}})(xp)),xp}var P1;function l4(){return P1||(P1=1,vp.exports=o4()),vp.exports}/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var M1;function a4(){if(M1)return Bn;M1=1;var n=Ua(),e=l4();function t(l){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+l,f=1;f<arguments.length;f++)c+="&args[]="+encodeURIComponent(arguments[f]);return"Minified React error #"+l+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,i={};function s(l,c){o(l,c),o(l+"Capture",c)}function o(l,c){for(i[l]=c,l=0;l<c.length;l++)r.add(c[l])}var a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[: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]*$/,d={},p={};function g(l){return u.call(p,l)?!0:u.call(d,l)?!1:h.test(l)?p[l]=!0:(d[l]=!0,!1)}function v(l,c,f,m){if(f!==null&&f.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return m?!1:f!==null?!f.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function x(l,c,f,m){if(c===null||typeof c>"u"||v(l,c,f,m))return!0;if(m)return!1;if(f!==null)switch(f.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function b(l,c,f,m,y,w,T){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=m,this.attributeNamespace=y,this.mustUseProperty=f,this.propertyName=l,this.type=c,this.sanitizeURL=w,this.removeEmptyString=T}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){S[l]=new b(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var c=l[0];S[c]=new b(c,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){S[l]=new b(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){S[l]=new b(l,2,!1,l,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(l){S[l]=new b(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){S[l]=new b(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){S[l]=new b(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){S[l]=new b(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){S[l]=new b(l,5,!1,l.toLowerCase(),null,!1,!1)});var C=/[\-:]([a-z])/g;function R(l){return l[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(l){var c=l.replace(C,R);S[c]=new b(c,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var c=l.replace(C,R);S[c]=new b(c,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var c=l.replace(C,R);S[c]=new b(c,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){S[l]=new b(l,1,!1,l.toLowerCase(),null,!1,!1)}),S.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){S[l]=new b(l,1,!1,l.toLowerCase(),null,!0,!0)});function O(l,c,f,m){var y=S.hasOwnProperty(c)?S[c]:null;(y!==null?y.type!==0:m||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(x(c,f,y,m)&&(f=null),m||y===null?g(c)&&(f===null?l.removeAttribute(c):l.setAttribute(c,""+f)):y.mustUseProperty?l[y.propertyName]=f===null?y.type===3?!1:"":f:(c=y.attributeName,m=y.attributeNamespace,f===null?l.removeAttribute(c):(y=y.type,f=y===3||y===4&&f===!0?"":""+f,m?l.setAttributeNS(m,c,f):l.setAttribute(c,f))))}var P=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,D=Symbol.for("react.element"),N=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),G=Symbol.for("react.provider"),X=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),I=Symbol.iterator;function _(l){return l===null||typeof l!="object"?null:(l=I&&l[I]||l["@@iterator"],typeof l=="function"?l:null)}var B=Object.assign,M;function V(l){if(M===void 0)try{throw Error()}catch(f){var c=f.stack.trim().match(/\n( *(at )?)/);M=c&&c[1]||""}return`
|
|
34
|
-
`+M+l}var ne=!1;function ee(l,c){if(!l||ne)return"";ne=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(K){var m=K}Reflect.construct(l,[],c)}else{try{c.call()}catch(K){m=K}l.call(c.prototype)}else{try{throw Error()}catch(K){m=K}l()}}catch(K){if(K&&m&&typeof K.stack=="string"){for(var y=K.stack.split(`
|
|
35
|
-
`),w=m.stack.split(`
|
|
36
|
-
`),T=y.length-1,A=w.length-1;1<=T&&0<=A&&y[T]!==w[A];)A--;for(;1<=T&&0<=A;T--,A--)if(y[T]!==w[A]){if(T!==1||A!==1)do if(T--,A--,0>A||y[T]!==w[A]){var F=`
|
|
37
|
-
`+y[T].replace(" at new "," at ");return l.displayName&&F.includes("<anonymous>")&&(F=F.replace("<anonymous>",l.displayName)),F}while(1<=T&&0<=A);break}}}finally{ne=!1,Error.prepareStackTrace=f}return(l=l?l.displayName||l.name:"")?V(l):""}function fe(l){switch(l.tag){case 5:return V(l.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return l=ee(l.type,!1),l;case 11:return l=ee(l.type.render,!1),l;case 1:return l=ee(l.type,!0),l;default:return""}}function se(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case L:return"Fragment";case N:return"Portal";case Q:return"Profiler";case z:return"StrictMode";case Y:return"Suspense";case J:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case X:return(l.displayName||"Context")+".Consumer";case G:return(l._context.displayName||"Context")+".Provider";case W:var c=l.render;return l=l.displayName,l||(l=c.displayName||c.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case $:return c=l.displayName||null,c!==null?c:se(l.type)||"Memo";case te:c=l._payload,l=l._init;try{return se(l(c))}catch{}}return null}function me(l){var c=l.type;switch(l.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=c.render,l=l.displayName||l.name||"",c.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return se(c);case 8:return c===z?"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 c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function xe(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ye(l){var c=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function Ve(l){var c=ye(l)?"checked":"value",f=Object.getOwnPropertyDescriptor(l.constructor.prototype,c),m=""+l[c];if(!l.hasOwnProperty(c)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var y=f.get,w=f.set;return Object.defineProperty(l,c,{configurable:!0,get:function(){return y.call(this)},set:function(T){m=""+T,w.call(this,T)}}),Object.defineProperty(l,c,{enumerable:f.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){l._valueTracker=null,delete l[c]}}}}function it(l){l._valueTracker||(l._valueTracker=Ve(l))}function Ee(l){if(!l)return!1;var c=l._valueTracker;if(!c)return!0;var f=c.getValue(),m="";return l&&(m=ye(l)?l.checked?"true":"false":l.value),l=m,l!==f?(c.setValue(l),!0):!1}function Ye(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Xe(l,c){var f=c.checked;return B({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:f??l._wrapperState.initialChecked})}function wt(l,c){var f=c.defaultValue==null?"":c.defaultValue,m=c.checked!=null?c.checked:c.defaultChecked;f=xe(c.value!=null?c.value:f),l._wrapperState={initialChecked:m,initialValue:f,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function At(l,c){c=c.checked,c!=null&&O(l,"checked",c,!1)}function tn(l,c){At(l,c);var f=xe(c.value),m=c.type;if(f!=null)m==="number"?(f===0&&l.value===""||l.value!=f)&&(l.value=""+f):l.value!==""+f&&(l.value=""+f);else if(m==="submit"||m==="reset"){l.removeAttribute("value");return}c.hasOwnProperty("value")?Bt(l,c.type,f):c.hasOwnProperty("defaultValue")&&Bt(l,c.type,xe(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(l.defaultChecked=!!c.defaultChecked)}function ht(l,c,f){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var m=c.type;if(!(m!=="submit"&&m!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+l._wrapperState.initialValue,f||c===l.value||(l.value=c),l.defaultValue=c}f=l.name,f!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,f!==""&&(l.name=f)}function Bt(l,c,f){(c!=="number"||Ye(l.ownerDocument)!==l)&&(f==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+f&&(l.defaultValue=""+f))}var vn=Array.isArray;function Ft(l,c,f,m){if(l=l.options,c){c={};for(var y=0;y<f.length;y++)c["$"+f[y]]=!0;for(f=0;f<l.length;f++)y=c.hasOwnProperty("$"+l[f].value),l[f].selected!==y&&(l[f].selected=y),y&&m&&(l[f].defaultSelected=!0)}else{for(f=""+xe(f),c=null,y=0;y<l.length;y++){if(l[y].value===f){l[y].selected=!0,m&&(l[y].defaultSelected=!0);return}c!==null||l[y].disabled||(c=l[y])}c!==null&&(c.selected=!0)}}function jt(l,c){if(c.dangerouslySetInnerHTML!=null)throw Error(t(91));return B({},c,{value:void 0,defaultValue:void 0,children:""+l._wrapperState.initialValue})}function ct(l,c){var f=c.value;if(f==null){if(f=c.children,c=c.defaultValue,f!=null){if(c!=null)throw Error(t(92));if(vn(f)){if(1<f.length)throw Error(t(93));f=f[0]}c=f}c==null&&(c=""),f=c}l._wrapperState={initialValue:xe(f)}}function or(l,c){var f=xe(c.value),m=xe(c.defaultValue);f!=null&&(f=""+f,f!==l.value&&(l.value=f),c.defaultValue==null&&l.defaultValue!==f&&(l.defaultValue=f)),m!=null&&(l.defaultValue=""+m)}function re(l){var c=l.textContent;c===l._wrapperState.initialValue&&c!==""&&c!==null&&(l.value=c)}function oe(l){switch(l){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 Ce(l,c){return l==null||l==="http://www.w3.org/1999/xhtml"?oe(c):l==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":l}var Le,Ue=(function(l){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,f,m,y){MSApp.execUnsafeLocalFunction(function(){return l(c,f,m,y)})}:l})(function(l,c){if(l.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in l)l.innerHTML=c;else{for(Le=Le||document.createElement("div"),Le.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=Le.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;c.firstChild;)l.appendChild(c.firstChild)}});function qe(l,c){if(c){var f=l.firstChild;if(f&&f===l.lastChild&&f.nodeType===3){f.nodeValue=c;return}}l.textContent=c}var Be={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},st=["Webkit","ms","Moz","O"];Object.keys(Be).forEach(function(l){st.forEach(function(c){c=c+l.charAt(0).toUpperCase()+l.substring(1),Be[c]=Be[l]})});function zt(l,c,f){return c==null||typeof c=="boolean"||c===""?"":f||typeof c!="number"||c===0||Be.hasOwnProperty(l)&&Be[l]?(""+c).trim():c+"px"}function bt(l,c){l=l.style;for(var f in c)if(c.hasOwnProperty(f)){var m=f.indexOf("--")===0,y=zt(f,c[f],m);f==="float"&&(f="cssFloat"),m?l.setProperty(f,y):l[f]=y}}var xn=B({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 Pn(l,c){if(c){if(xn[l]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(t(137,l));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(t(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(t(61))}if(c.style!=null&&typeof c.style!="object")throw Error(t(62))}}function Mn(l,c){if(l.indexOf("-")===-1)return typeof c.is=="string";switch(l){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 De=null;function gt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var nn=null,Me=null,Ze=null;function rn(l){if(l=Ll(l)){if(typeof nn!="function")throw Error(t(280));var c=l.stateNode;c&&(c=Cc(c),nn(l.stateNode,l.type,c))}}function Wt(l){Me?Ze?Ze.push(l):Ze=[l]:Me=l}function wn(){if(Me){var l=Me,c=Ze;if(Ze=Me=null,rn(l),c)for(l=0;l<c.length;l++)rn(c[l])}}function sn(l,c){return l(c)}function zr(){}var Wr=!1;function kr(l,c,f){if(Wr)return l(c,f);Wr=!0;try{return sn(l,c,f)}finally{Wr=!1,(Me!==null||Ze!==null)&&(zr(),wn())}}function ci(l,c){var f=l.stateNode;if(f===null)return null;var m=Cc(f);if(m===null)return null;f=m[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(l=l.type,m=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!m;break e;default:l=!1}if(l)return null;if(f&&typeof f!="function")throw Error(t(231,c,typeof f));return f}var Cs=!1;if(a)try{var ui={};Object.defineProperty(ui,"passive",{get:function(){Cs=!0}}),window.addEventListener("test",ui,ui),window.removeEventListener("test",ui,ui)}catch{Cs=!1}function Dh(l,c,f,m,y,w,T,A,F){var K=Array.prototype.slice.call(arguments,3);try{c.apply(f,K)}catch(le){this.onError(le)}}var fi=!1,Es=null,oo=!1,dl=null,Ts={onError:function(l){fi=!0,Es=l}};function Ih(l,c,f,m,y,w,T,A,F){fi=!1,Es=null,Dh.apply(Ts,arguments)}function Lh(l,c,f,m,y,w,T,A,F){if(Ih.apply(this,arguments),fi){if(fi){var K=Es;fi=!1,Es=null}else throw Error(t(198));oo||(oo=!0,dl=K)}}function hi(l){var c=l,f=l;if(l.alternate)for(;c.return;)c=c.return;else{l=c;do c=l,(c.flags&4098)!==0&&(f=c.return),l=c.return;while(l)}return c.tag===3?f:null}function pl(l){if(l.tag===13){var c=l.memoizedState;if(c===null&&(l=l.alternate,l!==null&&(c=l.memoizedState)),c!==null)return c.dehydrated}return null}function ml(l){if(hi(l)!==l)throw Error(t(188))}function rc(l){var c=l.alternate;if(!c){if(c=hi(l),c===null)throw Error(t(188));return c!==l?null:l}for(var f=l,m=c;;){var y=f.return;if(y===null)break;var w=y.alternate;if(w===null){if(m=y.return,m!==null){f=m;continue}break}if(y.child===w.child){for(w=y.child;w;){if(w===f)return ml(y),l;if(w===m)return ml(y),c;w=w.sibling}throw Error(t(188))}if(f.return!==m.return)f=y,m=w;else{for(var T=!1,A=y.child;A;){if(A===f){T=!0,f=y,m=w;break}if(A===m){T=!0,m=y,f=w;break}A=A.sibling}if(!T){for(A=w.child;A;){if(A===f){T=!0,f=w,m=y;break}if(A===m){T=!0,m=w,f=y;break}A=A.sibling}if(!T)throw Error(t(189))}}if(f.alternate!==m)throw Error(t(190))}if(f.tag!==3)throw Error(t(188));return f.stateNode.current===f?l:c}function Y0(l){return l=rc(l),l!==null?G0(l):null}function G0(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var c=G0(l);if(c!==null)return c;l=l.sibling}return null}var X0=e.unstable_scheduleCallback,J0=e.unstable_cancelCallback,aE=e.unstable_shouldYield,cE=e.unstable_requestPaint,Dt=e.unstable_now,uE=e.unstable_getCurrentPriorityLevel,Nh=e.unstable_ImmediatePriority,Z0=e.unstable_UserBlockingPriority,ic=e.unstable_NormalPriority,fE=e.unstable_LowPriority,ey=e.unstable_IdlePriority,sc=null,Hr=null;function hE(l){if(Hr&&typeof Hr.onCommitFiberRoot=="function")try{Hr.onCommitFiberRoot(sc,l,void 0,(l.current.flags&128)===128)}catch{}}var Cr=Math.clz32?Math.clz32:mE,dE=Math.log,pE=Math.LN2;function mE(l){return l>>>=0,l===0?32:31-(dE(l)/pE|0)|0}var oc=64,lc=4194304;function gl(l){switch(l&-l){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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function ac(l,c){var f=l.pendingLanes;if(f===0)return 0;var m=0,y=l.suspendedLanes,w=l.pingedLanes,T=f&268435455;if(T!==0){var A=T&~y;A!==0?m=gl(A):(w&=T,w!==0&&(m=gl(w)))}else T=f&~y,T!==0?m=gl(T):w!==0&&(m=gl(w));if(m===0)return 0;if(c!==0&&c!==m&&(c&y)===0&&(y=m&-m,w=c&-c,y>=w||y===16&&(w&4194240)!==0))return c;if((m&4)!==0&&(m|=f&16),c=l.entangledLanes,c!==0)for(l=l.entanglements,c&=m;0<c;)f=31-Cr(c),y=1<<f,m|=l[f],c&=~y;return m}function gE(l,c){switch(l){case 1:case 2:case 4:return c+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 c+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 yE(l,c){for(var f=l.suspendedLanes,m=l.pingedLanes,y=l.expirationTimes,w=l.pendingLanes;0<w;){var T=31-Cr(w),A=1<<T,F=y[T];F===-1?((A&f)===0||(A&m)!==0)&&(y[T]=gE(A,c)):F<=c&&(l.expiredLanes|=A),w&=~A}}function Bh(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function ty(){var l=oc;return oc<<=1,(oc&4194240)===0&&(oc=64),l}function Fh(l){for(var c=[],f=0;31>f;f++)c.push(l);return c}function yl(l,c,f){l.pendingLanes|=c,c!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,c=31-Cr(c),l[c]=f}function vE(l,c){var f=l.pendingLanes&~c;l.pendingLanes=c,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=c,l.mutableReadLanes&=c,l.entangledLanes&=c,c=l.entanglements;var m=l.eventTimes;for(l=l.expirationTimes;0<f;){var y=31-Cr(f),w=1<<y;c[y]=0,m[y]=-1,l[y]=-1,f&=~w}}function _h(l,c){var f=l.entangledLanes|=c;for(l=l.entanglements;f;){var m=31-Cr(f),y=1<<m;y&c|l[m]&c&&(l[m]|=c),f&=~y}}var tt=0;function ny(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var ry,jh,iy,sy,oy,zh=!1,cc=[],Fi=null,_i=null,ji=null,vl=new Map,xl=new Map,zi=[],xE="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 ly(l,c){switch(l){case"focusin":case"focusout":Fi=null;break;case"dragenter":case"dragleave":_i=null;break;case"mouseover":case"mouseout":ji=null;break;case"pointerover":case"pointerout":vl.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":xl.delete(c.pointerId)}}function wl(l,c,f,m,y,w){return l===null||l.nativeEvent!==w?(l={blockedOn:c,domEventName:f,eventSystemFlags:m,nativeEvent:w,targetContainers:[y]},c!==null&&(c=Ll(c),c!==null&&jh(c)),l):(l.eventSystemFlags|=m,c=l.targetContainers,y!==null&&c.indexOf(y)===-1&&c.push(y),l)}function wE(l,c,f,m,y){switch(c){case"focusin":return Fi=wl(Fi,l,c,f,m,y),!0;case"dragenter":return _i=wl(_i,l,c,f,m,y),!0;case"mouseover":return ji=wl(ji,l,c,f,m,y),!0;case"pointerover":var w=y.pointerId;return vl.set(w,wl(vl.get(w)||null,l,c,f,m,y)),!0;case"gotpointercapture":return w=y.pointerId,xl.set(w,wl(xl.get(w)||null,l,c,f,m,y)),!0}return!1}function ay(l){var c=Rs(l.target);if(c!==null){var f=hi(c);if(f!==null){if(c=f.tag,c===13){if(c=pl(f),c!==null){l.blockedOn=c,oy(l.priority,function(){iy(f)});return}}else if(c===3&&f.stateNode.current.memoizedState.isDehydrated){l.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}l.blockedOn=null}function uc(l){if(l.blockedOn!==null)return!1;for(var c=l.targetContainers;0<c.length;){var f=Hh(l.domEventName,l.eventSystemFlags,c[0],l.nativeEvent);if(f===null){f=l.nativeEvent;var m=new f.constructor(f.type,f);De=m,f.target.dispatchEvent(m),De=null}else return c=Ll(f),c!==null&&jh(c),l.blockedOn=f,!1;c.shift()}return!0}function cy(l,c,f){uc(l)&&f.delete(c)}function bE(){zh=!1,Fi!==null&&uc(Fi)&&(Fi=null),_i!==null&&uc(_i)&&(_i=null),ji!==null&&uc(ji)&&(ji=null),vl.forEach(cy),xl.forEach(cy)}function bl(l,c){l.blockedOn===c&&(l.blockedOn=null,zh||(zh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,bE)))}function Sl(l){function c(y){return bl(y,l)}if(0<cc.length){bl(cc[0],l);for(var f=1;f<cc.length;f++){var m=cc[f];m.blockedOn===l&&(m.blockedOn=null)}}for(Fi!==null&&bl(Fi,l),_i!==null&&bl(_i,l),ji!==null&&bl(ji,l),vl.forEach(c),xl.forEach(c),f=0;f<zi.length;f++)m=zi[f],m.blockedOn===l&&(m.blockedOn=null);for(;0<zi.length&&(f=zi[0],f.blockedOn===null);)ay(f),f.blockedOn===null&&zi.shift()}var lo=P.ReactCurrentBatchConfig,fc=!0;function SE(l,c,f,m){var y=tt,w=lo.transition;lo.transition=null;try{tt=1,Wh(l,c,f,m)}finally{tt=y,lo.transition=w}}function kE(l,c,f,m){var y=tt,w=lo.transition;lo.transition=null;try{tt=4,Wh(l,c,f,m)}finally{tt=y,lo.transition=w}}function Wh(l,c,f,m){if(fc){var y=Hh(l,c,f,m);if(y===null)sd(l,c,m,hc,f),ly(l,m);else if(wE(y,l,c,f,m))m.stopPropagation();else if(ly(l,m),c&4&&-1<xE.indexOf(l)){for(;y!==null;){var w=Ll(y);if(w!==null&&ry(w),w=Hh(l,c,f,m),w===null&&sd(l,c,m,hc,f),w===y)break;y=w}y!==null&&m.stopPropagation()}else sd(l,c,m,null,f)}}var hc=null;function Hh(l,c,f,m){if(hc=null,l=gt(m),l=Rs(l),l!==null)if(c=hi(l),c===null)l=null;else if(f=c.tag,f===13){if(l=pl(c),l!==null)return l;l=null}else if(f===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;l=null}else c!==l&&(l=null);return hc=l,null}function uy(l){switch(l){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(uE()){case Nh:return 1;case Z0:return 4;case ic:case fE:return 16;case ey:return 536870912;default:return 16}default:return 16}}var Wi=null,Vh=null,dc=null;function fy(){if(dc)return dc;var l,c=Vh,f=c.length,m,y="value"in Wi?Wi.value:Wi.textContent,w=y.length;for(l=0;l<f&&c[l]===y[l];l++);var T=f-l;for(m=1;m<=T&&c[f-m]===y[w-m];m++);return dc=y.slice(l,1<m?1-m:void 0)}function pc(l){var c=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&c===13&&(l=13)):l=c,l===10&&(l=13),32<=l||l===13?l:0}function mc(){return!0}function hy(){return!1}function Kn(l){function c(f,m,y,w,T){this._reactName=f,this._targetInst=y,this.type=m,this.nativeEvent=w,this.target=T,this.currentTarget=null;for(var A in l)l.hasOwnProperty(A)&&(f=l[A],this[A]=f?f(w):w[A]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?mc:hy,this.isPropagationStopped=hy,this}return B(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=mc)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=mc)},persist:function(){},isPersistent:mc}),c}var ao={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$h=Kn(ao),kl=B({},ao,{view:0,detail:0}),CE=Kn(kl),Uh,qh,Cl,gc=B({},kl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qh,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==Cl&&(Cl&&l.type==="mousemove"?(Uh=l.screenX-Cl.screenX,qh=l.screenY-Cl.screenY):qh=Uh=0,Cl=l),Uh)},movementY:function(l){return"movementY"in l?l.movementY:qh}}),dy=Kn(gc),EE=B({},gc,{dataTransfer:0}),TE=Kn(EE),RE=B({},kl,{relatedTarget:0}),Kh=Kn(RE),OE=B({},ao,{animationName:0,elapsedTime:0,pseudoElement:0}),PE=Kn(OE),ME=B({},ao,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),AE=Kn(ME),DE=B({},ao,{data:0}),py=Kn(DE),IE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},LE={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"},NE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function BE(l){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(l):(l=NE[l])?!!c[l]:!1}function Qh(){return BE}var FE=B({},kl,{key:function(l){if(l.key){var c=IE[l.key]||l.key;if(c!=="Unidentified")return c}return l.type==="keypress"?(l=pc(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?LE[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qh,charCode:function(l){return l.type==="keypress"?pc(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?pc(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),_E=Kn(FE),jE=B({},gc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),my=Kn(jE),zE=B({},kl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qh}),WE=Kn(zE),HE=B({},ao,{propertyName:0,elapsedTime:0,pseudoElement:0}),VE=Kn(HE),$E=B({},gc,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),UE=Kn($E),qE=[9,13,27,32],Yh=a&&"CompositionEvent"in window,El=null;a&&"documentMode"in document&&(El=document.documentMode);var KE=a&&"TextEvent"in window&&!El,gy=a&&(!Yh||El&&8<El&&11>=El),yy=" ",vy=!1;function xy(l,c){switch(l){case"keyup":return qE.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var co=!1;function QE(l,c){switch(l){case"compositionend":return wy(c);case"keypress":return c.which!==32?null:(vy=!0,yy);case"textInput":return l=c.data,l===yy&&vy?null:l;default:return null}}function YE(l,c){if(co)return l==="compositionend"||!Yh&&xy(l,c)?(l=fy(),dc=Vh=Wi=null,co=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return gy&&c.locale!=="ko"?null:c.data;default:return null}}var GE={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function by(l){var c=l&&l.nodeName&&l.nodeName.toLowerCase();return c==="input"?!!GE[l.type]:c==="textarea"}function Sy(l,c,f,m){Wt(m),c=bc(c,"onChange"),0<c.length&&(f=new $h("onChange","change",null,f,m),l.push({event:f,listeners:c}))}var Tl=null,Rl=null;function XE(l){zy(l,0)}function yc(l){var c=mo(l);if(Ee(c))return l}function JE(l,c){if(l==="change")return c}var ky=!1;if(a){var Gh;if(a){var Xh="oninput"in document;if(!Xh){var Cy=document.createElement("div");Cy.setAttribute("oninput","return;"),Xh=typeof Cy.oninput=="function"}Gh=Xh}else Gh=!1;ky=Gh&&(!document.documentMode||9<document.documentMode)}function Ey(){Tl&&(Tl.detachEvent("onpropertychange",Ty),Rl=Tl=null)}function Ty(l){if(l.propertyName==="value"&&yc(Rl)){var c=[];Sy(c,Rl,l,gt(l)),kr(XE,c)}}function ZE(l,c,f){l==="focusin"?(Ey(),Tl=c,Rl=f,Tl.attachEvent("onpropertychange",Ty)):l==="focusout"&&Ey()}function eT(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return yc(Rl)}function tT(l,c){if(l==="click")return yc(c)}function nT(l,c){if(l==="input"||l==="change")return yc(c)}function rT(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var Er=typeof Object.is=="function"?Object.is:rT;function Ol(l,c){if(Er(l,c))return!0;if(typeof l!="object"||l===null||typeof c!="object"||c===null)return!1;var f=Object.keys(l),m=Object.keys(c);if(f.length!==m.length)return!1;for(m=0;m<f.length;m++){var y=f[m];if(!u.call(c,y)||!Er(l[y],c[y]))return!1}return!0}function Ry(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function Oy(l,c){var f=Ry(l);l=0;for(var m;f;){if(f.nodeType===3){if(m=l+f.textContent.length,l<=c&&m>=c)return{node:f,offset:c-l};l=m}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=Ry(f)}}function Py(l,c){return l&&c?l===c?!0:l&&l.nodeType===3?!1:c&&c.nodeType===3?Py(l,c.parentNode):"contains"in l?l.contains(c):l.compareDocumentPosition?!!(l.compareDocumentPosition(c)&16):!1:!1}function My(){for(var l=window,c=Ye();c instanceof l.HTMLIFrameElement;){try{var f=typeof c.contentWindow.location.href=="string"}catch{f=!1}if(f)l=c.contentWindow;else break;c=Ye(l.document)}return c}function Jh(l){var c=l&&l.nodeName&&l.nodeName.toLowerCase();return c&&(c==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||c==="textarea"||l.contentEditable==="true")}function iT(l){var c=My(),f=l.focusedElem,m=l.selectionRange;if(c!==f&&f&&f.ownerDocument&&Py(f.ownerDocument.documentElement,f)){if(m!==null&&Jh(f)){if(c=m.start,l=m.end,l===void 0&&(l=c),"selectionStart"in f)f.selectionStart=c,f.selectionEnd=Math.min(l,f.value.length);else if(l=(c=f.ownerDocument||document)&&c.defaultView||window,l.getSelection){l=l.getSelection();var y=f.textContent.length,w=Math.min(m.start,y);m=m.end===void 0?w:Math.min(m.end,y),!l.extend&&w>m&&(y=m,m=w,w=y),y=Oy(f,w);var T=Oy(f,m);y&&T&&(l.rangeCount!==1||l.anchorNode!==y.node||l.anchorOffset!==y.offset||l.focusNode!==T.node||l.focusOffset!==T.offset)&&(c=c.createRange(),c.setStart(y.node,y.offset),l.removeAllRanges(),w>m?(l.addRange(c),l.extend(T.node,T.offset)):(c.setEnd(T.node,T.offset),l.addRange(c)))}}for(c=[],l=f;l=l.parentNode;)l.nodeType===1&&c.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;f<c.length;f++)l=c[f],l.element.scrollLeft=l.left,l.element.scrollTop=l.top}}var sT=a&&"documentMode"in document&&11>=document.documentMode,uo=null,Zh=null,Pl=null,ed=!1;function Ay(l,c,f){var m=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;ed||uo==null||uo!==Ye(m)||(m=uo,"selectionStart"in m&&Jh(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Pl&&Ol(Pl,m)||(Pl=m,m=bc(Zh,"onSelect"),0<m.length&&(c=new $h("onSelect","select",null,c,f),l.push({event:c,listeners:m}),c.target=uo)))}function vc(l,c){var f={};return f[l.toLowerCase()]=c.toLowerCase(),f["Webkit"+l]="webkit"+c,f["Moz"+l]="moz"+c,f}var fo={animationend:vc("Animation","AnimationEnd"),animationiteration:vc("Animation","AnimationIteration"),animationstart:vc("Animation","AnimationStart"),transitionend:vc("Transition","TransitionEnd")},td={},Dy={};a&&(Dy=document.createElement("div").style,"AnimationEvent"in window||(delete fo.animationend.animation,delete fo.animationiteration.animation,delete fo.animationstart.animation),"TransitionEvent"in window||delete fo.transitionend.transition);function xc(l){if(td[l])return td[l];if(!fo[l])return l;var c=fo[l],f;for(f in c)if(c.hasOwnProperty(f)&&f in Dy)return td[l]=c[f];return l}var Iy=xc("animationend"),Ly=xc("animationiteration"),Ny=xc("animationstart"),By=xc("transitionend"),Fy=new Map,_y="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 Hi(l,c){Fy.set(l,c),s(c,[l])}for(var nd=0;nd<_y.length;nd++){var rd=_y[nd],oT=rd.toLowerCase(),lT=rd[0].toUpperCase()+rd.slice(1);Hi(oT,"on"+lT)}Hi(Iy,"onAnimationEnd"),Hi(Ly,"onAnimationIteration"),Hi(Ny,"onAnimationStart"),Hi("dblclick","onDoubleClick"),Hi("focusin","onFocus"),Hi("focusout","onBlur"),Hi(By,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ml="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(" "),aT=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ml));function jy(l,c,f){var m=l.type||"unknown-event";l.currentTarget=f,Lh(m,c,void 0,l),l.currentTarget=null}function zy(l,c){c=(c&4)!==0;for(var f=0;f<l.length;f++){var m=l[f],y=m.event;m=m.listeners;e:{var w=void 0;if(c)for(var T=m.length-1;0<=T;T--){var A=m[T],F=A.instance,K=A.currentTarget;if(A=A.listener,F!==w&&y.isPropagationStopped())break e;jy(y,A,K),w=F}else for(T=0;T<m.length;T++){if(A=m[T],F=A.instance,K=A.currentTarget,A=A.listener,F!==w&&y.isPropagationStopped())break e;jy(y,A,K),w=F}}}if(oo)throw l=dl,oo=!1,dl=null,l}function dt(l,c){var f=c[fd];f===void 0&&(f=c[fd]=new Set);var m=l+"__bubble";f.has(m)||(Wy(c,l,2,!1),f.add(m))}function id(l,c,f){var m=0;c&&(m|=4),Wy(f,l,m,c)}var wc="_reactListening"+Math.random().toString(36).slice(2);function Al(l){if(!l[wc]){l[wc]=!0,r.forEach(function(f){f!=="selectionchange"&&(aT.has(f)||id(f,!1,l),id(f,!0,l))});var c=l.nodeType===9?l:l.ownerDocument;c===null||c[wc]||(c[wc]=!0,id("selectionchange",!1,c))}}function Wy(l,c,f,m){switch(uy(c)){case 1:var y=SE;break;case 4:y=kE;break;default:y=Wh}f=y.bind(null,c,f,l),y=void 0,!Cs||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(y=!0),m?y!==void 0?l.addEventListener(c,f,{capture:!0,passive:y}):l.addEventListener(c,f,!0):y!==void 0?l.addEventListener(c,f,{passive:y}):l.addEventListener(c,f,!1)}function sd(l,c,f,m,y){var w=m;if((c&1)===0&&(c&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var A=m.stateNode.containerInfo;if(A===y||A.nodeType===8&&A.parentNode===y)break;if(T===4)for(T=m.return;T!==null;){var F=T.tag;if((F===3||F===4)&&(F=T.stateNode.containerInfo,F===y||F.nodeType===8&&F.parentNode===y))return;T=T.return}for(;A!==null;){if(T=Rs(A),T===null)return;if(F=T.tag,F===5||F===6){m=w=T;continue e}A=A.parentNode}}m=m.return}kr(function(){var K=w,le=gt(f),ae=[];e:{var ie=Fy.get(l);if(ie!==void 0){var ve=$h,be=l;switch(l){case"keypress":if(pc(f)===0)break e;case"keydown":case"keyup":ve=_E;break;case"focusin":be="focus",ve=Kh;break;case"focusout":be="blur",ve=Kh;break;case"beforeblur":case"afterblur":ve=Kh;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ve=dy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ve=TE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ve=WE;break;case Iy:case Ly:case Ny:ve=PE;break;case By:ve=VE;break;case"scroll":ve=CE;break;case"wheel":ve=UE;break;case"copy":case"cut":case"paste":ve=AE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ve=my}var Se=(c&4)!==0,It=!Se&&l==="scroll",H=Se?ie!==null?ie+"Capture":null:ie;Se=[];for(var j=K,U;j!==null;){U=j;var ue=U.stateNode;if(U.tag===5&&ue!==null&&(U=ue,H!==null&&(ue=ci(j,H),ue!=null&&Se.push(Dl(j,ue,U)))),It)break;j=j.return}0<Se.length&&(ie=new ve(ie,be,null,f,le),ae.push({event:ie,listeners:Se}))}}if((c&7)===0){e:{if(ie=l==="mouseover"||l==="pointerover",ve=l==="mouseout"||l==="pointerout",ie&&f!==De&&(be=f.relatedTarget||f.fromElement)&&(Rs(be)||be[di]))break e;if((ve||ie)&&(ie=le.window===le?le:(ie=le.ownerDocument)?ie.defaultView||ie.parentWindow:window,ve?(be=f.relatedTarget||f.toElement,ve=K,be=be?Rs(be):null,be!==null&&(It=hi(be),be!==It||be.tag!==5&&be.tag!==6)&&(be=null)):(ve=null,be=K),ve!==be)){if(Se=dy,ue="onMouseLeave",H="onMouseEnter",j="mouse",(l==="pointerout"||l==="pointerover")&&(Se=my,ue="onPointerLeave",H="onPointerEnter",j="pointer"),It=ve==null?ie:mo(ve),U=be==null?ie:mo(be),ie=new Se(ue,j+"leave",ve,f,le),ie.target=It,ie.relatedTarget=U,ue=null,Rs(le)===K&&(Se=new Se(H,j+"enter",be,f,le),Se.target=U,Se.relatedTarget=It,ue=Se),It=ue,ve&&be)t:{for(Se=ve,H=be,j=0,U=Se;U;U=ho(U))j++;for(U=0,ue=H;ue;ue=ho(ue))U++;for(;0<j-U;)Se=ho(Se),j--;for(;0<U-j;)H=ho(H),U--;for(;j--;){if(Se===H||H!==null&&Se===H.alternate)break t;Se=ho(Se),H=ho(H)}Se=null}else Se=null;ve!==null&&Hy(ae,ie,ve,Se,!1),be!==null&&It!==null&&Hy(ae,It,be,Se,!0)}}e:{if(ie=K?mo(K):window,ve=ie.nodeName&&ie.nodeName.toLowerCase(),ve==="select"||ve==="input"&&ie.type==="file")var ke=JE;else if(by(ie))if(ky)ke=nT;else{ke=eT;var Re=ZE}else(ve=ie.nodeName)&&ve.toLowerCase()==="input"&&(ie.type==="checkbox"||ie.type==="radio")&&(ke=tT);if(ke&&(ke=ke(l,K))){Sy(ae,ke,f,le);break e}Re&&Re(l,ie,K),l==="focusout"&&(Re=ie._wrapperState)&&Re.controlled&&ie.type==="number"&&Bt(ie,"number",ie.value)}switch(Re=K?mo(K):window,l){case"focusin":(by(Re)||Re.contentEditable==="true")&&(uo=Re,Zh=K,Pl=null);break;case"focusout":Pl=Zh=uo=null;break;case"mousedown":ed=!0;break;case"contextmenu":case"mouseup":case"dragend":ed=!1,Ay(ae,f,le);break;case"selectionchange":if(sT)break;case"keydown":case"keyup":Ay(ae,f,le)}var Oe;if(Yh)e:{switch(l){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else co?xy(l,f)&&(Ae="onCompositionEnd"):l==="keydown"&&f.keyCode===229&&(Ae="onCompositionStart");Ae&&(gy&&f.locale!=="ko"&&(co||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&co&&(Oe=fy()):(Wi=le,Vh="value"in Wi?Wi.value:Wi.textContent,co=!0)),Re=bc(K,Ae),0<Re.length&&(Ae=new py(Ae,l,null,f,le),ae.push({event:Ae,listeners:Re}),Oe?Ae.data=Oe:(Oe=wy(f),Oe!==null&&(Ae.data=Oe)))),(Oe=KE?QE(l,f):YE(l,f))&&(K=bc(K,"onBeforeInput"),0<K.length&&(le=new py("onBeforeInput","beforeinput",null,f,le),ae.push({event:le,listeners:K}),le.data=Oe))}zy(ae,c)})}function Dl(l,c,f){return{instance:l,listener:c,currentTarget:f}}function bc(l,c){for(var f=c+"Capture",m=[];l!==null;){var y=l,w=y.stateNode;y.tag===5&&w!==null&&(y=w,w=ci(l,f),w!=null&&m.unshift(Dl(l,w,y)),w=ci(l,c),w!=null&&m.push(Dl(l,w,y))),l=l.return}return m}function ho(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5);return l||null}function Hy(l,c,f,m,y){for(var w=c._reactName,T=[];f!==null&&f!==m;){var A=f,F=A.alternate,K=A.stateNode;if(F!==null&&F===m)break;A.tag===5&&K!==null&&(A=K,y?(F=ci(f,w),F!=null&&T.unshift(Dl(f,F,A))):y||(F=ci(f,w),F!=null&&T.push(Dl(f,F,A)))),f=f.return}T.length!==0&&l.push({event:c,listeners:T})}var cT=/\r\n?/g,uT=/\u0000|\uFFFD/g;function Vy(l){return(typeof l=="string"?l:""+l).replace(cT,`
|
|
38
|
-
`).replace(uT,"")}function Sc(l,c,f){if(c=Vy(c),Vy(l)!==c&&f)throw Error(t(425))}function kc(){}var od=null,ld=null;function ad(l,c){return l==="textarea"||l==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var cd=typeof setTimeout=="function"?setTimeout:void 0,fT=typeof clearTimeout=="function"?clearTimeout:void 0,$y=typeof Promise=="function"?Promise:void 0,hT=typeof queueMicrotask=="function"?queueMicrotask:typeof $y<"u"?function(l){return $y.resolve(null).then(l).catch(dT)}:cd;function dT(l){setTimeout(function(){throw l})}function ud(l,c){var f=c,m=0;do{var y=f.nextSibling;if(l.removeChild(f),y&&y.nodeType===8)if(f=y.data,f==="/$"){if(m===0){l.removeChild(y),Sl(c);return}m--}else f!=="$"&&f!=="$?"&&f!=="$!"||m++;f=y}while(f);Sl(c)}function Vi(l){for(;l!=null;l=l.nextSibling){var c=l.nodeType;if(c===1||c===3)break;if(c===8){if(c=l.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return l}function Uy(l){l=l.previousSibling;for(var c=0;l;){if(l.nodeType===8){var f=l.data;if(f==="$"||f==="$!"||f==="$?"){if(c===0)return l;c--}else f==="/$"&&c++}l=l.previousSibling}return null}var po=Math.random().toString(36).slice(2),Vr="__reactFiber$"+po,Il="__reactProps$"+po,di="__reactContainer$"+po,fd="__reactEvents$"+po,pT="__reactListeners$"+po,mT="__reactHandles$"+po;function Rs(l){var c=l[Vr];if(c)return c;for(var f=l.parentNode;f;){if(c=f[di]||f[Vr]){if(f=c.alternate,c.child!==null||f!==null&&f.child!==null)for(l=Uy(l);l!==null;){if(f=l[Vr])return f;l=Uy(l)}return c}l=f,f=l.parentNode}return null}function Ll(l){return l=l[Vr]||l[di],!l||l.tag!==5&&l.tag!==6&&l.tag!==13&&l.tag!==3?null:l}function mo(l){if(l.tag===5||l.tag===6)return l.stateNode;throw Error(t(33))}function Cc(l){return l[Il]||null}var hd=[],go=-1;function $i(l){return{current:l}}function pt(l){0>go||(l.current=hd[go],hd[go]=null,go--)}function ut(l,c){go++,hd[go]=l.current,l.current=c}var Ui={},fn=$i(Ui),An=$i(!1),Os=Ui;function yo(l,c){var f=l.type.contextTypes;if(!f)return Ui;var m=l.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===c)return m.__reactInternalMemoizedMaskedChildContext;var y={},w;for(w in f)y[w]=c[w];return m&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=c,l.__reactInternalMemoizedMaskedChildContext=y),y}function Dn(l){return l=l.childContextTypes,l!=null}function Ec(){pt(An),pt(fn)}function qy(l,c,f){if(fn.current!==Ui)throw Error(t(168));ut(fn,c),ut(An,f)}function Ky(l,c,f){var m=l.stateNode;if(c=c.childContextTypes,typeof m.getChildContext!="function")return f;m=m.getChildContext();for(var y in m)if(!(y in c))throw Error(t(108,me(l)||"Unknown",y));return B({},f,m)}function Tc(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Ui,Os=fn.current,ut(fn,l),ut(An,An.current),!0}function Qy(l,c,f){var m=l.stateNode;if(!m)throw Error(t(169));f?(l=Ky(l,c,Os),m.__reactInternalMemoizedMergedChildContext=l,pt(An),pt(fn),ut(fn,l)):pt(An),ut(An,f)}var pi=null,Rc=!1,dd=!1;function Yy(l){pi===null?pi=[l]:pi.push(l)}function gT(l){Rc=!0,Yy(l)}function qi(){if(!dd&&pi!==null){dd=!0;var l=0,c=tt;try{var f=pi;for(tt=1;l<f.length;l++){var m=f[l];do m=m(!0);while(m!==null)}pi=null,Rc=!1}catch(y){throw pi!==null&&(pi=pi.slice(l+1)),X0(Nh,qi),y}finally{tt=c,dd=!1}}return null}var vo=[],xo=0,Oc=null,Pc=0,lr=[],ar=0,Ps=null,mi=1,gi="";function Ms(l,c){vo[xo++]=Pc,vo[xo++]=Oc,Oc=l,Pc=c}function Gy(l,c,f){lr[ar++]=mi,lr[ar++]=gi,lr[ar++]=Ps,Ps=l;var m=mi;l=gi;var y=32-Cr(m)-1;m&=~(1<<y),f+=1;var w=32-Cr(c)+y;if(30<w){var T=y-y%5;w=(m&(1<<T)-1).toString(32),m>>=T,y-=T,mi=1<<32-Cr(c)+y|f<<y|m,gi=w+l}else mi=1<<w|f<<y|m,gi=l}function pd(l){l.return!==null&&(Ms(l,1),Gy(l,1,0))}function md(l){for(;l===Oc;)Oc=vo[--xo],vo[xo]=null,Pc=vo[--xo],vo[xo]=null;for(;l===Ps;)Ps=lr[--ar],lr[ar]=null,gi=lr[--ar],lr[ar]=null,mi=lr[--ar],lr[ar]=null}var Qn=null,Yn=null,yt=!1,Tr=null;function Xy(l,c){var f=hr(5,null,null,0);f.elementType="DELETED",f.stateNode=c,f.return=l,c=l.deletions,c===null?(l.deletions=[f],l.flags|=16):c.push(f)}function Jy(l,c){switch(l.tag){case 5:var f=l.type;return c=c.nodeType!==1||f.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(l.stateNode=c,Qn=l,Yn=Vi(c.firstChild),!0):!1;case 6:return c=l.pendingProps===""||c.nodeType!==3?null:c,c!==null?(l.stateNode=c,Qn=l,Yn=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(f=Ps!==null?{id:mi,overflow:gi}:null,l.memoizedState={dehydrated:c,treeContext:f,retryLane:1073741824},f=hr(18,null,null,0),f.stateNode=c,f.return=l,l.child=f,Qn=l,Yn=null,!0):!1;default:return!1}}function gd(l){return(l.mode&1)!==0&&(l.flags&128)===0}function yd(l){if(yt){var c=Yn;if(c){var f=c;if(!Jy(l,c)){if(gd(l))throw Error(t(418));c=Vi(f.nextSibling);var m=Qn;c&&Jy(l,c)?Xy(m,f):(l.flags=l.flags&-4097|2,yt=!1,Qn=l)}}else{if(gd(l))throw Error(t(418));l.flags=l.flags&-4097|2,yt=!1,Qn=l}}}function Zy(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;Qn=l}function Mc(l){if(l!==Qn)return!1;if(!yt)return Zy(l),yt=!0,!1;var c;if((c=l.tag!==3)&&!(c=l.tag!==5)&&(c=l.type,c=c!=="head"&&c!=="body"&&!ad(l.type,l.memoizedProps)),c&&(c=Yn)){if(gd(l))throw ev(),Error(t(418));for(;c;)Xy(l,c),c=Vi(c.nextSibling)}if(Zy(l),l.tag===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(t(317));e:{for(l=l.nextSibling,c=0;l;){if(l.nodeType===8){var f=l.data;if(f==="/$"){if(c===0){Yn=Vi(l.nextSibling);break e}c--}else f!=="$"&&f!=="$!"&&f!=="$?"||c++}l=l.nextSibling}Yn=null}}else Yn=Qn?Vi(l.stateNode.nextSibling):null;return!0}function ev(){for(var l=Yn;l;)l=Vi(l.nextSibling)}function wo(){Yn=Qn=null,yt=!1}function vd(l){Tr===null?Tr=[l]:Tr.push(l)}var yT=P.ReactCurrentBatchConfig;function Nl(l,c,f){if(l=f.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(f._owner){if(f=f._owner,f){if(f.tag!==1)throw Error(t(309));var m=f.stateNode}if(!m)throw Error(t(147,l));var y=m,w=""+l;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===w?c.ref:(c=function(T){var A=y.refs;T===null?delete A[w]:A[w]=T},c._stringRef=w,c)}if(typeof l!="string")throw Error(t(284));if(!f._owner)throw Error(t(290,l))}return l}function Ac(l,c){throw l=Object.prototype.toString.call(c),Error(t(31,l==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":l))}function tv(l){var c=l._init;return c(l._payload)}function nv(l){function c(H,j){if(l){var U=H.deletions;U===null?(H.deletions=[j],H.flags|=16):U.push(j)}}function f(H,j){if(!l)return null;for(;j!==null;)c(H,j),j=j.sibling;return null}function m(H,j){for(H=new Map;j!==null;)j.key!==null?H.set(j.key,j):H.set(j.index,j),j=j.sibling;return H}function y(H,j){return H=es(H,j),H.index=0,H.sibling=null,H}function w(H,j,U){return H.index=U,l?(U=H.alternate,U!==null?(U=U.index,U<j?(H.flags|=2,j):U):(H.flags|=2,j)):(H.flags|=1048576,j)}function T(H){return l&&H.alternate===null&&(H.flags|=2),H}function A(H,j,U,ue){return j===null||j.tag!==6?(j=cp(U,H.mode,ue),j.return=H,j):(j=y(j,U),j.return=H,j)}function F(H,j,U,ue){var ke=U.type;return ke===L?le(H,j,U.props.children,ue,U.key):j!==null&&(j.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===te&&tv(ke)===j.type)?(ue=y(j,U.props),ue.ref=Nl(H,j,U),ue.return=H,ue):(ue=tu(U.type,U.key,U.props,null,H.mode,ue),ue.ref=Nl(H,j,U),ue.return=H,ue)}function K(H,j,U,ue){return j===null||j.tag!==4||j.stateNode.containerInfo!==U.containerInfo||j.stateNode.implementation!==U.implementation?(j=up(U,H.mode,ue),j.return=H,j):(j=y(j,U.children||[]),j.return=H,j)}function le(H,j,U,ue,ke){return j===null||j.tag!==7?(j=_s(U,H.mode,ue,ke),j.return=H,j):(j=y(j,U),j.return=H,j)}function ae(H,j,U){if(typeof j=="string"&&j!==""||typeof j=="number")return j=cp(""+j,H.mode,U),j.return=H,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case D:return U=tu(j.type,j.key,j.props,null,H.mode,U),U.ref=Nl(H,null,j),U.return=H,U;case N:return j=up(j,H.mode,U),j.return=H,j;case te:var ue=j._init;return ae(H,ue(j._payload),U)}if(vn(j)||_(j))return j=_s(j,H.mode,U,null),j.return=H,j;Ac(H,j)}return null}function ie(H,j,U,ue){var ke=j!==null?j.key:null;if(typeof U=="string"&&U!==""||typeof U=="number")return ke!==null?null:A(H,j,""+U,ue);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case D:return U.key===ke?F(H,j,U,ue):null;case N:return U.key===ke?K(H,j,U,ue):null;case te:return ke=U._init,ie(H,j,ke(U._payload),ue)}if(vn(U)||_(U))return ke!==null?null:le(H,j,U,ue,null);Ac(H,U)}return null}function ve(H,j,U,ue,ke){if(typeof ue=="string"&&ue!==""||typeof ue=="number")return H=H.get(U)||null,A(j,H,""+ue,ke);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case D:return H=H.get(ue.key===null?U:ue.key)||null,F(j,H,ue,ke);case N:return H=H.get(ue.key===null?U:ue.key)||null,K(j,H,ue,ke);case te:var Re=ue._init;return ve(H,j,U,Re(ue._payload),ke)}if(vn(ue)||_(ue))return H=H.get(U)||null,le(j,H,ue,ke,null);Ac(j,ue)}return null}function be(H,j,U,ue){for(var ke=null,Re=null,Oe=j,Ae=j=0,Gt=null;Oe!==null&&Ae<U.length;Ae++){Oe.index>Ae?(Gt=Oe,Oe=null):Gt=Oe.sibling;var Ge=ie(H,Oe,U[Ae],ue);if(Ge===null){Oe===null&&(Oe=Gt);break}l&&Oe&&Ge.alternate===null&&c(H,Oe),j=w(Ge,j,Ae),Re===null?ke=Ge:Re.sibling=Ge,Re=Ge,Oe=Gt}if(Ae===U.length)return f(H,Oe),yt&&Ms(H,Ae),ke;if(Oe===null){for(;Ae<U.length;Ae++)Oe=ae(H,U[Ae],ue),Oe!==null&&(j=w(Oe,j,Ae),Re===null?ke=Oe:Re.sibling=Oe,Re=Oe);return yt&&Ms(H,Ae),ke}for(Oe=m(H,Oe);Ae<U.length;Ae++)Gt=ve(Oe,H,Ae,U[Ae],ue),Gt!==null&&(l&&Gt.alternate!==null&&Oe.delete(Gt.key===null?Ae:Gt.key),j=w(Gt,j,Ae),Re===null?ke=Gt:Re.sibling=Gt,Re=Gt);return l&&Oe.forEach(function(ts){return c(H,ts)}),yt&&Ms(H,Ae),ke}function Se(H,j,U,ue){var ke=_(U);if(typeof ke!="function")throw Error(t(150));if(U=ke.call(U),U==null)throw Error(t(151));for(var Re=ke=null,Oe=j,Ae=j=0,Gt=null,Ge=U.next();Oe!==null&&!Ge.done;Ae++,Ge=U.next()){Oe.index>Ae?(Gt=Oe,Oe=null):Gt=Oe.sibling;var ts=ie(H,Oe,Ge.value,ue);if(ts===null){Oe===null&&(Oe=Gt);break}l&&Oe&&ts.alternate===null&&c(H,Oe),j=w(ts,j,Ae),Re===null?ke=ts:Re.sibling=ts,Re=ts,Oe=Gt}if(Ge.done)return f(H,Oe),yt&&Ms(H,Ae),ke;if(Oe===null){for(;!Ge.done;Ae++,Ge=U.next())Ge=ae(H,Ge.value,ue),Ge!==null&&(j=w(Ge,j,Ae),Re===null?ke=Ge:Re.sibling=Ge,Re=Ge);return yt&&Ms(H,Ae),ke}for(Oe=m(H,Oe);!Ge.done;Ae++,Ge=U.next())Ge=ve(Oe,H,Ae,Ge.value,ue),Ge!==null&&(l&&Ge.alternate!==null&&Oe.delete(Ge.key===null?Ae:Ge.key),j=w(Ge,j,Ae),Re===null?ke=Ge:Re.sibling=Ge,Re=Ge);return l&&Oe.forEach(function(GT){return c(H,GT)}),yt&&Ms(H,Ae),ke}function It(H,j,U,ue){if(typeof U=="object"&&U!==null&&U.type===L&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case D:e:{for(var ke=U.key,Re=j;Re!==null;){if(Re.key===ke){if(ke=U.type,ke===L){if(Re.tag===7){f(H,Re.sibling),j=y(Re,U.props.children),j.return=H,H=j;break e}}else if(Re.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===te&&tv(ke)===Re.type){f(H,Re.sibling),j=y(Re,U.props),j.ref=Nl(H,Re,U),j.return=H,H=j;break e}f(H,Re);break}else c(H,Re);Re=Re.sibling}U.type===L?(j=_s(U.props.children,H.mode,ue,U.key),j.return=H,H=j):(ue=tu(U.type,U.key,U.props,null,H.mode,ue),ue.ref=Nl(H,j,U),ue.return=H,H=ue)}return T(H);case N:e:{for(Re=U.key;j!==null;){if(j.key===Re)if(j.tag===4&&j.stateNode.containerInfo===U.containerInfo&&j.stateNode.implementation===U.implementation){f(H,j.sibling),j=y(j,U.children||[]),j.return=H,H=j;break e}else{f(H,j);break}else c(H,j);j=j.sibling}j=up(U,H.mode,ue),j.return=H,H=j}return T(H);case te:return Re=U._init,It(H,j,Re(U._payload),ue)}if(vn(U))return be(H,j,U,ue);if(_(U))return Se(H,j,U,ue);Ac(H,U)}return typeof U=="string"&&U!==""||typeof U=="number"?(U=""+U,j!==null&&j.tag===6?(f(H,j.sibling),j=y(j,U),j.return=H,H=j):(f(H,j),j=cp(U,H.mode,ue),j.return=H,H=j),T(H)):f(H,j)}return It}var bo=nv(!0),rv=nv(!1),Dc=$i(null),Ic=null,So=null,xd=null;function wd(){xd=So=Ic=null}function bd(l){var c=Dc.current;pt(Dc),l._currentValue=c}function Sd(l,c,f){for(;l!==null;){var m=l.alternate;if((l.childLanes&c)!==c?(l.childLanes|=c,m!==null&&(m.childLanes|=c)):m!==null&&(m.childLanes&c)!==c&&(m.childLanes|=c),l===f)break;l=l.return}}function ko(l,c){Ic=l,xd=So=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&c)!==0&&(In=!0),l.firstContext=null)}function cr(l){var c=l._currentValue;if(xd!==l)if(l={context:l,memoizedValue:c,next:null},So===null){if(Ic===null)throw Error(t(308));So=l,Ic.dependencies={lanes:0,firstContext:l}}else So=So.next=l;return c}var As=null;function kd(l){As===null?As=[l]:As.push(l)}function iv(l,c,f,m){var y=c.interleaved;return y===null?(f.next=f,kd(c)):(f.next=y.next,y.next=f),c.interleaved=f,yi(l,m)}function yi(l,c){l.lanes|=c;var f=l.alternate;for(f!==null&&(f.lanes|=c),f=l,l=l.return;l!==null;)l.childLanes|=c,f=l.alternate,f!==null&&(f.childLanes|=c),f=l,l=l.return;return f.tag===3?f.stateNode:null}var Ki=!1;function Cd(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function sv(l,c){l=l.updateQueue,c.updateQueue===l&&(c.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function vi(l,c){return{eventTime:l,lane:c,tag:0,payload:null,callback:null,next:null}}function Qi(l,c,f){var m=l.updateQueue;if(m===null)return null;if(m=m.shared,(Ke&2)!==0){var y=m.pending;return y===null?c.next=c:(c.next=y.next,y.next=c),m.pending=c,yi(l,f)}return y=m.interleaved,y===null?(c.next=c,kd(m)):(c.next=y.next,y.next=c),m.interleaved=c,yi(l,f)}function Lc(l,c,f){if(c=c.updateQueue,c!==null&&(c=c.shared,(f&4194240)!==0)){var m=c.lanes;m&=l.pendingLanes,f|=m,c.lanes=f,_h(l,f)}}function ov(l,c){var f=l.updateQueue,m=l.alternate;if(m!==null&&(m=m.updateQueue,f===m)){var y=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var T={eventTime:f.eventTime,lane:f.lane,tag:f.tag,payload:f.payload,callback:f.callback,next:null};w===null?y=w=T:w=w.next=T,f=f.next}while(f!==null);w===null?y=w=c:w=w.next=c}else y=w=c;f={baseState:m.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:m.shared,effects:m.effects},l.updateQueue=f;return}l=f.lastBaseUpdate,l===null?f.firstBaseUpdate=c:l.next=c,f.lastBaseUpdate=c}function Nc(l,c,f,m){var y=l.updateQueue;Ki=!1;var w=y.firstBaseUpdate,T=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var F=A,K=F.next;F.next=null,T===null?w=K:T.next=K,T=F;var le=l.alternate;le!==null&&(le=le.updateQueue,A=le.lastBaseUpdate,A!==T&&(A===null?le.firstBaseUpdate=K:A.next=K,le.lastBaseUpdate=F))}if(w!==null){var ae=y.baseState;T=0,le=K=F=null,A=w;do{var ie=A.lane,ve=A.eventTime;if((m&ie)===ie){le!==null&&(le=le.next={eventTime:ve,lane:0,tag:A.tag,payload:A.payload,callback:A.callback,next:null});e:{var be=l,Se=A;switch(ie=c,ve=f,Se.tag){case 1:if(be=Se.payload,typeof be=="function"){ae=be.call(ve,ae,ie);break e}ae=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Se.payload,ie=typeof be=="function"?be.call(ve,ae,ie):be,ie==null)break e;ae=B({},ae,ie);break e;case 2:Ki=!0}}A.callback!==null&&A.lane!==0&&(l.flags|=64,ie=y.effects,ie===null?y.effects=[A]:ie.push(A))}else ve={eventTime:ve,lane:ie,tag:A.tag,payload:A.payload,callback:A.callback,next:null},le===null?(K=le=ve,F=ae):le=le.next=ve,T|=ie;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;ie=A,A=ie.next,ie.next=null,y.lastBaseUpdate=ie,y.shared.pending=null}}while(!0);if(le===null&&(F=ae),y.baseState=F,y.firstBaseUpdate=K,y.lastBaseUpdate=le,c=y.shared.interleaved,c!==null){y=c;do T|=y.lane,y=y.next;while(y!==c)}else w===null&&(y.shared.lanes=0);Ls|=T,l.lanes=T,l.memoizedState=ae}}function lv(l,c,f){if(l=c.effects,c.effects=null,l!==null)for(c=0;c<l.length;c++){var m=l[c],y=m.callback;if(y!==null){if(m.callback=null,m=f,typeof y!="function")throw Error(t(191,y));y.call(m)}}}var Bl={},$r=$i(Bl),Fl=$i(Bl),_l=$i(Bl);function Ds(l){if(l===Bl)throw Error(t(174));return l}function Ed(l,c){switch(ut(_l,c),ut(Fl,l),ut($r,Bl),l=c.nodeType,l){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:Ce(null,"");break;default:l=l===8?c.parentNode:c,c=l.namespaceURI||null,l=l.tagName,c=Ce(c,l)}pt($r),ut($r,c)}function Co(){pt($r),pt(Fl),pt(_l)}function av(l){Ds(_l.current);var c=Ds($r.current),f=Ce(c,l.type);c!==f&&(ut(Fl,l),ut($r,f))}function Td(l){Fl.current===l&&(pt($r),pt(Fl))}var St=$i(0);function Bc(l){for(var c=l;c!==null;){if(c.tag===13){var f=c.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||f.data==="$?"||f.data==="$!"))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Rd=[];function Od(){for(var l=0;l<Rd.length;l++)Rd[l]._workInProgressVersionPrimary=null;Rd.length=0}var Fc=P.ReactCurrentDispatcher,Pd=P.ReactCurrentBatchConfig,Is=0,kt=null,Ht=null,Qt=null,_c=!1,jl=!1,zl=0,vT=0;function hn(){throw Error(t(321))}function Md(l,c){if(c===null)return!1;for(var f=0;f<c.length&&f<l.length;f++)if(!Er(l[f],c[f]))return!1;return!0}function Ad(l,c,f,m,y,w){if(Is=w,kt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Fc.current=l===null||l.memoizedState===null?ST:kT,l=f(m,y),jl){w=0;do{if(jl=!1,zl=0,25<=w)throw Error(t(301));w+=1,Qt=Ht=null,c.updateQueue=null,Fc.current=CT,l=f(m,y)}while(jl)}if(Fc.current=Wc,c=Ht!==null&&Ht.next!==null,Is=0,Qt=Ht=kt=null,_c=!1,c)throw Error(t(300));return l}function Dd(){var l=zl!==0;return zl=0,l}function Ur(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?kt.memoizedState=Qt=l:Qt=Qt.next=l,Qt}function ur(){if(Ht===null){var l=kt.alternate;l=l!==null?l.memoizedState:null}else l=Ht.next;var c=Qt===null?kt.memoizedState:Qt.next;if(c!==null)Qt=c,Ht=l;else{if(l===null)throw Error(t(310));Ht=l,l={memoizedState:Ht.memoizedState,baseState:Ht.baseState,baseQueue:Ht.baseQueue,queue:Ht.queue,next:null},Qt===null?kt.memoizedState=Qt=l:Qt=Qt.next=l}return Qt}function Wl(l,c){return typeof c=="function"?c(l):c}function Id(l){var c=ur(),f=c.queue;if(f===null)throw Error(t(311));f.lastRenderedReducer=l;var m=Ht,y=m.baseQueue,w=f.pending;if(w!==null){if(y!==null){var T=y.next;y.next=w.next,w.next=T}m.baseQueue=y=w,f.pending=null}if(y!==null){w=y.next,m=m.baseState;var A=T=null,F=null,K=w;do{var le=K.lane;if((Is&le)===le)F!==null&&(F=F.next={lane:0,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),m=K.hasEagerState?K.eagerState:l(m,K.action);else{var ae={lane:le,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null};F===null?(A=F=ae,T=m):F=F.next=ae,kt.lanes|=le,Ls|=le}K=K.next}while(K!==null&&K!==w);F===null?T=m:F.next=A,Er(m,c.memoizedState)||(In=!0),c.memoizedState=m,c.baseState=T,c.baseQueue=F,f.lastRenderedState=m}if(l=f.interleaved,l!==null){y=l;do w=y.lane,kt.lanes|=w,Ls|=w,y=y.next;while(y!==l)}else y===null&&(f.lanes=0);return[c.memoizedState,f.dispatch]}function Ld(l){var c=ur(),f=c.queue;if(f===null)throw Error(t(311));f.lastRenderedReducer=l;var m=f.dispatch,y=f.pending,w=c.memoizedState;if(y!==null){f.pending=null;var T=y=y.next;do w=l(w,T.action),T=T.next;while(T!==y);Er(w,c.memoizedState)||(In=!0),c.memoizedState=w,c.baseQueue===null&&(c.baseState=w),f.lastRenderedState=w}return[w,m]}function cv(){}function uv(l,c){var f=kt,m=ur(),y=c(),w=!Er(m.memoizedState,y);if(w&&(m.memoizedState=y,In=!0),m=m.queue,Nd(dv.bind(null,f,m,l),[l]),m.getSnapshot!==c||w||Qt!==null&&Qt.memoizedState.tag&1){if(f.flags|=2048,Hl(9,hv.bind(null,f,m,y,c),void 0,null),Yt===null)throw Error(t(349));(Is&30)!==0||fv(f,c,y)}return y}function fv(l,c,f){l.flags|=16384,l={getSnapshot:c,value:f},c=kt.updateQueue,c===null?(c={lastEffect:null,stores:null},kt.updateQueue=c,c.stores=[l]):(f=c.stores,f===null?c.stores=[l]:f.push(l))}function hv(l,c,f,m){c.value=f,c.getSnapshot=m,pv(c)&&mv(l)}function dv(l,c,f){return f(function(){pv(c)&&mv(l)})}function pv(l){var c=l.getSnapshot;l=l.value;try{var f=c();return!Er(l,f)}catch{return!0}}function mv(l){var c=yi(l,1);c!==null&&Mr(c,l,1,-1)}function gv(l){var c=Ur();return typeof l=="function"&&(l=l()),c.memoizedState=c.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Wl,lastRenderedState:l},c.queue=l,l=l.dispatch=bT.bind(null,kt,l),[c.memoizedState,l]}function Hl(l,c,f,m){return l={tag:l,create:c,destroy:f,deps:m,next:null},c=kt.updateQueue,c===null?(c={lastEffect:null,stores:null},kt.updateQueue=c,c.lastEffect=l.next=l):(f=c.lastEffect,f===null?c.lastEffect=l.next=l:(m=f.next,f.next=l,l.next=m,c.lastEffect=l)),l}function yv(){return ur().memoizedState}function jc(l,c,f,m){var y=Ur();kt.flags|=l,y.memoizedState=Hl(1|c,f,void 0,m===void 0?null:m)}function zc(l,c,f,m){var y=ur();m=m===void 0?null:m;var w=void 0;if(Ht!==null){var T=Ht.memoizedState;if(w=T.destroy,m!==null&&Md(m,T.deps)){y.memoizedState=Hl(c,f,w,m);return}}kt.flags|=l,y.memoizedState=Hl(1|c,f,w,m)}function vv(l,c){return jc(8390656,8,l,c)}function Nd(l,c){return zc(2048,8,l,c)}function xv(l,c){return zc(4,2,l,c)}function wv(l,c){return zc(4,4,l,c)}function bv(l,c){if(typeof c=="function")return l=l(),c(l),function(){c(null)};if(c!=null)return l=l(),c.current=l,function(){c.current=null}}function Sv(l,c,f){return f=f!=null?f.concat([l]):null,zc(4,4,bv.bind(null,c,l),f)}function Bd(){}function kv(l,c){var f=ur();c=c===void 0?null:c;var m=f.memoizedState;return m!==null&&c!==null&&Md(c,m[1])?m[0]:(f.memoizedState=[l,c],l)}function Cv(l,c){var f=ur();c=c===void 0?null:c;var m=f.memoizedState;return m!==null&&c!==null&&Md(c,m[1])?m[0]:(l=l(),f.memoizedState=[l,c],l)}function Ev(l,c,f){return(Is&21)===0?(l.baseState&&(l.baseState=!1,In=!0),l.memoizedState=f):(Er(f,c)||(f=ty(),kt.lanes|=f,Ls|=f,l.baseState=!0),c)}function xT(l,c){var f=tt;tt=f!==0&&4>f?f:4,l(!0);var m=Pd.transition;Pd.transition={};try{l(!1),c()}finally{tt=f,Pd.transition=m}}function Tv(){return ur().memoizedState}function wT(l,c,f){var m=Ji(l);if(f={lane:m,action:f,hasEagerState:!1,eagerState:null,next:null},Rv(l))Ov(c,f);else if(f=iv(l,c,f,m),f!==null){var y=Sn();Mr(f,l,m,y),Pv(f,c,m)}}function bT(l,c,f){var m=Ji(l),y={lane:m,action:f,hasEagerState:!1,eagerState:null,next:null};if(Rv(l))Ov(c,y);else{var w=l.alternate;if(l.lanes===0&&(w===null||w.lanes===0)&&(w=c.lastRenderedReducer,w!==null))try{var T=c.lastRenderedState,A=w(T,f);if(y.hasEagerState=!0,y.eagerState=A,Er(A,T)){var F=c.interleaved;F===null?(y.next=y,kd(c)):(y.next=F.next,F.next=y),c.interleaved=y;return}}catch{}finally{}f=iv(l,c,y,m),f!==null&&(y=Sn(),Mr(f,l,m,y),Pv(f,c,m))}}function Rv(l){var c=l.alternate;return l===kt||c!==null&&c===kt}function Ov(l,c){jl=_c=!0;var f=l.pending;f===null?c.next=c:(c.next=f.next,f.next=c),l.pending=c}function Pv(l,c,f){if((f&4194240)!==0){var m=c.lanes;m&=l.pendingLanes,f|=m,c.lanes=f,_h(l,f)}}var Wc={readContext:cr,useCallback:hn,useContext:hn,useEffect:hn,useImperativeHandle:hn,useInsertionEffect:hn,useLayoutEffect:hn,useMemo:hn,useReducer:hn,useRef:hn,useState:hn,useDebugValue:hn,useDeferredValue:hn,useTransition:hn,useMutableSource:hn,useSyncExternalStore:hn,useId:hn,unstable_isNewReconciler:!1},ST={readContext:cr,useCallback:function(l,c){return Ur().memoizedState=[l,c===void 0?null:c],l},useContext:cr,useEffect:vv,useImperativeHandle:function(l,c,f){return f=f!=null?f.concat([l]):null,jc(4194308,4,bv.bind(null,c,l),f)},useLayoutEffect:function(l,c){return jc(4194308,4,l,c)},useInsertionEffect:function(l,c){return jc(4,2,l,c)},useMemo:function(l,c){var f=Ur();return c=c===void 0?null:c,l=l(),f.memoizedState=[l,c],l},useReducer:function(l,c,f){var m=Ur();return c=f!==void 0?f(c):c,m.memoizedState=m.baseState=c,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:c},m.queue=l,l=l.dispatch=wT.bind(null,kt,l),[m.memoizedState,l]},useRef:function(l){var c=Ur();return l={current:l},c.memoizedState=l},useState:gv,useDebugValue:Bd,useDeferredValue:function(l){return Ur().memoizedState=l},useTransition:function(){var l=gv(!1),c=l[0];return l=xT.bind(null,l[1]),Ur().memoizedState=l,[c,l]},useMutableSource:function(){},useSyncExternalStore:function(l,c,f){var m=kt,y=Ur();if(yt){if(f===void 0)throw Error(t(407));f=f()}else{if(f=c(),Yt===null)throw Error(t(349));(Is&30)!==0||fv(m,c,f)}y.memoizedState=f;var w={value:f,getSnapshot:c};return y.queue=w,vv(dv.bind(null,m,w,l),[l]),m.flags|=2048,Hl(9,hv.bind(null,m,w,f,c),void 0,null),f},useId:function(){var l=Ur(),c=Yt.identifierPrefix;if(yt){var f=gi,m=mi;f=(m&~(1<<32-Cr(m)-1)).toString(32)+f,c=":"+c+"R"+f,f=zl++,0<f&&(c+="H"+f.toString(32)),c+=":"}else f=vT++,c=":"+c+"r"+f.toString(32)+":";return l.memoizedState=c},unstable_isNewReconciler:!1},kT={readContext:cr,useCallback:kv,useContext:cr,useEffect:Nd,useImperativeHandle:Sv,useInsertionEffect:xv,useLayoutEffect:wv,useMemo:Cv,useReducer:Id,useRef:yv,useState:function(){return Id(Wl)},useDebugValue:Bd,useDeferredValue:function(l){var c=ur();return Ev(c,Ht.memoizedState,l)},useTransition:function(){var l=Id(Wl)[0],c=ur().memoizedState;return[l,c]},useMutableSource:cv,useSyncExternalStore:uv,useId:Tv,unstable_isNewReconciler:!1},CT={readContext:cr,useCallback:kv,useContext:cr,useEffect:Nd,useImperativeHandle:Sv,useInsertionEffect:xv,useLayoutEffect:wv,useMemo:Cv,useReducer:Ld,useRef:yv,useState:function(){return Ld(Wl)},useDebugValue:Bd,useDeferredValue:function(l){var c=ur();return Ht===null?c.memoizedState=l:Ev(c,Ht.memoizedState,l)},useTransition:function(){var l=Ld(Wl)[0],c=ur().memoizedState;return[l,c]},useMutableSource:cv,useSyncExternalStore:uv,useId:Tv,unstable_isNewReconciler:!1};function Rr(l,c){if(l&&l.defaultProps){c=B({},c),l=l.defaultProps;for(var f in l)c[f]===void 0&&(c[f]=l[f]);return c}return c}function Fd(l,c,f,m){c=l.memoizedState,f=f(m,c),f=f==null?c:B({},c,f),l.memoizedState=f,l.lanes===0&&(l.updateQueue.baseState=f)}var Hc={isMounted:function(l){return(l=l._reactInternals)?hi(l)===l:!1},enqueueSetState:function(l,c,f){l=l._reactInternals;var m=Sn(),y=Ji(l),w=vi(m,y);w.payload=c,f!=null&&(w.callback=f),c=Qi(l,w,y),c!==null&&(Mr(c,l,y,m),Lc(c,l,y))},enqueueReplaceState:function(l,c,f){l=l._reactInternals;var m=Sn(),y=Ji(l),w=vi(m,y);w.tag=1,w.payload=c,f!=null&&(w.callback=f),c=Qi(l,w,y),c!==null&&(Mr(c,l,y,m),Lc(c,l,y))},enqueueForceUpdate:function(l,c){l=l._reactInternals;var f=Sn(),m=Ji(l),y=vi(f,m);y.tag=2,c!=null&&(y.callback=c),c=Qi(l,y,m),c!==null&&(Mr(c,l,m,f),Lc(c,l,m))}};function Mv(l,c,f,m,y,w,T){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(m,w,T):c.prototype&&c.prototype.isPureReactComponent?!Ol(f,m)||!Ol(y,w):!0}function Av(l,c,f){var m=!1,y=Ui,w=c.contextType;return typeof w=="object"&&w!==null?w=cr(w):(y=Dn(c)?Os:fn.current,m=c.contextTypes,w=(m=m!=null)?yo(l,y):Ui),c=new c(f,w),l.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Hc,l.stateNode=c,c._reactInternals=l,m&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=y,l.__reactInternalMemoizedMaskedChildContext=w),c}function Dv(l,c,f,m){l=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(f,m),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(f,m),c.state!==l&&Hc.enqueueReplaceState(c,c.state,null)}function _d(l,c,f,m){var y=l.stateNode;y.props=f,y.state=l.memoizedState,y.refs={},Cd(l);var w=c.contextType;typeof w=="object"&&w!==null?y.context=cr(w):(w=Dn(c)?Os:fn.current,y.context=yo(l,w)),y.state=l.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(Fd(l,c,w,f),y.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(c=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),c!==y.state&&Hc.enqueueReplaceState(y,y.state,null),Nc(l,f,y,m),y.state=l.memoizedState),typeof y.componentDidMount=="function"&&(l.flags|=4194308)}function Eo(l,c){try{var f="",m=c;do f+=fe(m),m=m.return;while(m);var y=f}catch(w){y=`
|
|
39
|
-
Error generating stack: `+w.message+`
|
|
40
|
-
`+w.stack}return{value:l,source:c,stack:y,digest:null}}function jd(l,c,f){return{value:l,source:null,stack:f??null,digest:c??null}}function zd(l,c){try{console.error(c.value)}catch(f){setTimeout(function(){throw f})}}var ET=typeof WeakMap=="function"?WeakMap:Map;function Iv(l,c,f){f=vi(-1,f),f.tag=3,f.payload={element:null};var m=c.value;return f.callback=function(){Yc||(Yc=!0,tp=m),zd(l,c)},f}function Lv(l,c,f){f=vi(-1,f),f.tag=3;var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var y=c.value;f.payload=function(){return m(y)},f.callback=function(){zd(l,c)}}var w=l.stateNode;return w!==null&&typeof w.componentDidCatch=="function"&&(f.callback=function(){zd(l,c),typeof m!="function"&&(Gi===null?Gi=new Set([this]):Gi.add(this));var T=c.stack;this.componentDidCatch(c.value,{componentStack:T!==null?T:""})}),f}function Nv(l,c,f){var m=l.pingCache;if(m===null){m=l.pingCache=new ET;var y=new Set;m.set(c,y)}else y=m.get(c),y===void 0&&(y=new Set,m.set(c,y));y.has(f)||(y.add(f),l=jT.bind(null,l,c,f),c.then(l,l))}function Bv(l){do{var c;if((c=l.tag===13)&&(c=l.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return l;l=l.return}while(l!==null);return null}function Fv(l,c,f,m,y){return(l.mode&1)===0?(l===c?l.flags|=65536:(l.flags|=128,f.flags|=131072,f.flags&=-52805,f.tag===1&&(f.alternate===null?f.tag=17:(c=vi(-1,1),c.tag=2,Qi(f,c,1))),f.lanes|=1),l):(l.flags|=65536,l.lanes=y,l)}var TT=P.ReactCurrentOwner,In=!1;function bn(l,c,f,m){c.child=l===null?rv(c,null,f,m):bo(c,l.child,f,m)}function _v(l,c,f,m,y){f=f.render;var w=c.ref;return ko(c,y),m=Ad(l,c,f,m,w,y),f=Dd(),l!==null&&!In?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~y,xi(l,c,y)):(yt&&f&&pd(c),c.flags|=1,bn(l,c,m,y),c.child)}function jv(l,c,f,m,y){if(l===null){var w=f.type;return typeof w=="function"&&!ap(w)&&w.defaultProps===void 0&&f.compare===null&&f.defaultProps===void 0?(c.tag=15,c.type=w,zv(l,c,w,m,y)):(l=tu(f.type,null,m,c,c.mode,y),l.ref=c.ref,l.return=c,c.child=l)}if(w=l.child,(l.lanes&y)===0){var T=w.memoizedProps;if(f=f.compare,f=f!==null?f:Ol,f(T,m)&&l.ref===c.ref)return xi(l,c,y)}return c.flags|=1,l=es(w,m),l.ref=c.ref,l.return=c,c.child=l}function zv(l,c,f,m,y){if(l!==null){var w=l.memoizedProps;if(Ol(w,m)&&l.ref===c.ref)if(In=!1,c.pendingProps=m=w,(l.lanes&y)!==0)(l.flags&131072)!==0&&(In=!0);else return c.lanes=l.lanes,xi(l,c,y)}return Wd(l,c,f,m,y)}function Wv(l,c,f){var m=c.pendingProps,y=m.children,w=l!==null?l.memoizedState:null;if(m.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},ut(Ro,Gn),Gn|=f;else{if((f&1073741824)===0)return l=w!==null?w.baseLanes|f:f,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:l,cachePool:null,transitions:null},c.updateQueue=null,ut(Ro,Gn),Gn|=l,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=w!==null?w.baseLanes:f,ut(Ro,Gn),Gn|=m}else w!==null?(m=w.baseLanes|f,c.memoizedState=null):m=f,ut(Ro,Gn),Gn|=m;return bn(l,c,y,f),c.child}function Hv(l,c){var f=c.ref;(l===null&&f!==null||l!==null&&l.ref!==f)&&(c.flags|=512,c.flags|=2097152)}function Wd(l,c,f,m,y){var w=Dn(f)?Os:fn.current;return w=yo(c,w),ko(c,y),f=Ad(l,c,f,m,w,y),m=Dd(),l!==null&&!In?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~y,xi(l,c,y)):(yt&&m&&pd(c),c.flags|=1,bn(l,c,f,y),c.child)}function Vv(l,c,f,m,y){if(Dn(f)){var w=!0;Tc(c)}else w=!1;if(ko(c,y),c.stateNode===null)$c(l,c),Av(c,f,m),_d(c,f,m,y),m=!0;else if(l===null){var T=c.stateNode,A=c.memoizedProps;T.props=A;var F=T.context,K=f.contextType;typeof K=="object"&&K!==null?K=cr(K):(K=Dn(f)?Os:fn.current,K=yo(c,K));var le=f.getDerivedStateFromProps,ae=typeof le=="function"||typeof T.getSnapshotBeforeUpdate=="function";ae||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(A!==m||F!==K)&&Dv(c,T,m,K),Ki=!1;var ie=c.memoizedState;T.state=ie,Nc(c,m,T,y),F=c.memoizedState,A!==m||ie!==F||An.current||Ki?(typeof le=="function"&&(Fd(c,f,le,m),F=c.memoizedState),(A=Ki||Mv(c,f,A,m,ie,F,K))?(ae||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(c.flags|=4194308)):(typeof T.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=m,c.memoizedState=F),T.props=m,T.state=F,T.context=K,m=A):(typeof T.componentDidMount=="function"&&(c.flags|=4194308),m=!1)}else{T=c.stateNode,sv(l,c),A=c.memoizedProps,K=c.type===c.elementType?A:Rr(c.type,A),T.props=K,ae=c.pendingProps,ie=T.context,F=f.contextType,typeof F=="object"&&F!==null?F=cr(F):(F=Dn(f)?Os:fn.current,F=yo(c,F));var ve=f.getDerivedStateFromProps;(le=typeof ve=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(A!==ae||ie!==F)&&Dv(c,T,m,F),Ki=!1,ie=c.memoizedState,T.state=ie,Nc(c,m,T,y);var be=c.memoizedState;A!==ae||ie!==be||An.current||Ki?(typeof ve=="function"&&(Fd(c,f,ve,m),be=c.memoizedState),(K=Ki||Mv(c,f,K,m,ie,be,F)||!1)?(le||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,be,F),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,be,F)),typeof T.componentDidUpdate=="function"&&(c.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof T.componentDidUpdate!="function"||A===l.memoizedProps&&ie===l.memoizedState||(c.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||A===l.memoizedProps&&ie===l.memoizedState||(c.flags|=1024),c.memoizedProps=m,c.memoizedState=be),T.props=m,T.state=be,T.context=F,m=K):(typeof T.componentDidUpdate!="function"||A===l.memoizedProps&&ie===l.memoizedState||(c.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||A===l.memoizedProps&&ie===l.memoizedState||(c.flags|=1024),m=!1)}return Hd(l,c,f,m,w,y)}function Hd(l,c,f,m,y,w){Hv(l,c);var T=(c.flags&128)!==0;if(!m&&!T)return y&&Qy(c,f,!1),xi(l,c,w);m=c.stateNode,TT.current=c;var A=T&&typeof f.getDerivedStateFromError!="function"?null:m.render();return c.flags|=1,l!==null&&T?(c.child=bo(c,l.child,null,w),c.child=bo(c,null,A,w)):bn(l,c,A,w),c.memoizedState=m.state,y&&Qy(c,f,!0),c.child}function $v(l){var c=l.stateNode;c.pendingContext?qy(l,c.pendingContext,c.pendingContext!==c.context):c.context&&qy(l,c.context,!1),Ed(l,c.containerInfo)}function Uv(l,c,f,m,y){return wo(),vd(y),c.flags|=256,bn(l,c,f,m),c.child}var Vd={dehydrated:null,treeContext:null,retryLane:0};function $d(l){return{baseLanes:l,cachePool:null,transitions:null}}function qv(l,c,f){var m=c.pendingProps,y=St.current,w=!1,T=(c.flags&128)!==0,A;if((A=T)||(A=l!==null&&l.memoizedState===null?!1:(y&2)!==0),A?(w=!0,c.flags&=-129):(l===null||l.memoizedState!==null)&&(y|=1),ut(St,y&1),l===null)return yd(c),l=c.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((c.mode&1)===0?c.lanes=1:l.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(T=m.children,l=m.fallback,w?(m=c.mode,w=c.child,T={mode:"hidden",children:T},(m&1)===0&&w!==null?(w.childLanes=0,w.pendingProps=T):w=nu(T,m,0,null),l=_s(l,m,f,null),w.return=c,l.return=c,w.sibling=l,c.child=w,c.child.memoizedState=$d(f),c.memoizedState=Vd,l):Ud(c,T));if(y=l.memoizedState,y!==null&&(A=y.dehydrated,A!==null))return RT(l,c,T,m,A,y,f);if(w){w=m.fallback,T=c.mode,y=l.child,A=y.sibling;var F={mode:"hidden",children:m.children};return(T&1)===0&&c.child!==y?(m=c.child,m.childLanes=0,m.pendingProps=F,c.deletions=null):(m=es(y,F),m.subtreeFlags=y.subtreeFlags&14680064),A!==null?w=es(A,w):(w=_s(w,T,f,null),w.flags|=2),w.return=c,m.return=c,m.sibling=w,c.child=m,m=w,w=c.child,T=l.child.memoizedState,T=T===null?$d(f):{baseLanes:T.baseLanes|f,cachePool:null,transitions:T.transitions},w.memoizedState=T,w.childLanes=l.childLanes&~f,c.memoizedState=Vd,m}return w=l.child,l=w.sibling,m=es(w,{mode:"visible",children:m.children}),(c.mode&1)===0&&(m.lanes=f),m.return=c,m.sibling=null,l!==null&&(f=c.deletions,f===null?(c.deletions=[l],c.flags|=16):f.push(l)),c.child=m,c.memoizedState=null,m}function Ud(l,c){return c=nu({mode:"visible",children:c},l.mode,0,null),c.return=l,l.child=c}function Vc(l,c,f,m){return m!==null&&vd(m),bo(c,l.child,null,f),l=Ud(c,c.pendingProps.children),l.flags|=2,c.memoizedState=null,l}function RT(l,c,f,m,y,w,T){if(f)return c.flags&256?(c.flags&=-257,m=jd(Error(t(422))),Vc(l,c,T,m)):c.memoizedState!==null?(c.child=l.child,c.flags|=128,null):(w=m.fallback,y=c.mode,m=nu({mode:"visible",children:m.children},y,0,null),w=_s(w,y,T,null),w.flags|=2,m.return=c,w.return=c,m.sibling=w,c.child=m,(c.mode&1)!==0&&bo(c,l.child,null,T),c.child.memoizedState=$d(T),c.memoizedState=Vd,w);if((c.mode&1)===0)return Vc(l,c,T,null);if(y.data==="$!"){if(m=y.nextSibling&&y.nextSibling.dataset,m)var A=m.dgst;return m=A,w=Error(t(419)),m=jd(w,m,void 0),Vc(l,c,T,m)}if(A=(T&l.childLanes)!==0,In||A){if(m=Yt,m!==null){switch(T&-T){case 4:y=2;break;case 16:y=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:y=32;break;case 536870912:y=268435456;break;default:y=0}y=(y&(m.suspendedLanes|T))!==0?0:y,y!==0&&y!==w.retryLane&&(w.retryLane=y,yi(l,y),Mr(m,l,y,-1))}return lp(),m=jd(Error(t(421))),Vc(l,c,T,m)}return y.data==="$?"?(c.flags|=128,c.child=l.child,c=zT.bind(null,l),y._reactRetry=c,null):(l=w.treeContext,Yn=Vi(y.nextSibling),Qn=c,yt=!0,Tr=null,l!==null&&(lr[ar++]=mi,lr[ar++]=gi,lr[ar++]=Ps,mi=l.id,gi=l.overflow,Ps=c),c=Ud(c,m.children),c.flags|=4096,c)}function Kv(l,c,f){l.lanes|=c;var m=l.alternate;m!==null&&(m.lanes|=c),Sd(l.return,c,f)}function qd(l,c,f,m,y){var w=l.memoizedState;w===null?l.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:m,tail:f,tailMode:y}:(w.isBackwards=c,w.rendering=null,w.renderingStartTime=0,w.last=m,w.tail=f,w.tailMode=y)}function Qv(l,c,f){var m=c.pendingProps,y=m.revealOrder,w=m.tail;if(bn(l,c,m.children,f),m=St.current,(m&2)!==0)m=m&1|2,c.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=c.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&Kv(l,f,c);else if(l.tag===19)Kv(l,f,c);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===c)break e;for(;l.sibling===null;){if(l.return===null||l.return===c)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}m&=1}if(ut(St,m),(c.mode&1)===0)c.memoizedState=null;else switch(y){case"forwards":for(f=c.child,y=null;f!==null;)l=f.alternate,l!==null&&Bc(l)===null&&(y=f),f=f.sibling;f=y,f===null?(y=c.child,c.child=null):(y=f.sibling,f.sibling=null),qd(c,!1,y,f,w);break;case"backwards":for(f=null,y=c.child,c.child=null;y!==null;){if(l=y.alternate,l!==null&&Bc(l)===null){c.child=y;break}l=y.sibling,y.sibling=f,f=y,y=l}qd(c,!0,f,null,w);break;case"together":qd(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function $c(l,c){(c.mode&1)===0&&l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2)}function xi(l,c,f){if(l!==null&&(c.dependencies=l.dependencies),Ls|=c.lanes,(f&c.childLanes)===0)return null;if(l!==null&&c.child!==l.child)throw Error(t(153));if(c.child!==null){for(l=c.child,f=es(l,l.pendingProps),c.child=f,f.return=c;l.sibling!==null;)l=l.sibling,f=f.sibling=es(l,l.pendingProps),f.return=c;f.sibling=null}return c.child}function OT(l,c,f){switch(c.tag){case 3:$v(c),wo();break;case 5:av(c);break;case 1:Dn(c.type)&&Tc(c);break;case 4:Ed(c,c.stateNode.containerInfo);break;case 10:var m=c.type._context,y=c.memoizedProps.value;ut(Dc,m._currentValue),m._currentValue=y;break;case 13:if(m=c.memoizedState,m!==null)return m.dehydrated!==null?(ut(St,St.current&1),c.flags|=128,null):(f&c.child.childLanes)!==0?qv(l,c,f):(ut(St,St.current&1),l=xi(l,c,f),l!==null?l.sibling:null);ut(St,St.current&1);break;case 19:if(m=(f&c.childLanes)!==0,(l.flags&128)!==0){if(m)return Qv(l,c,f);c.flags|=128}if(y=c.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),ut(St,St.current),m)break;return null;case 22:case 23:return c.lanes=0,Wv(l,c,f)}return xi(l,c,f)}var Yv,Kd,Gv,Xv;Yv=function(l,c){for(var f=c.child;f!==null;){if(f.tag===5||f.tag===6)l.appendChild(f.stateNode);else if(f.tag!==4&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return;f=f.return}f.sibling.return=f.return,f=f.sibling}},Kd=function(){},Gv=function(l,c,f,m){var y=l.memoizedProps;if(y!==m){l=c.stateNode,Ds($r.current);var w=null;switch(f){case"input":y=Xe(l,y),m=Xe(l,m),w=[];break;case"select":y=B({},y,{value:void 0}),m=B({},m,{value:void 0}),w=[];break;case"textarea":y=jt(l,y),m=jt(l,m),w=[];break;default:typeof y.onClick!="function"&&typeof m.onClick=="function"&&(l.onclick=kc)}Pn(f,m);var T;f=null;for(K in y)if(!m.hasOwnProperty(K)&&y.hasOwnProperty(K)&&y[K]!=null)if(K==="style"){var A=y[K];for(T in A)A.hasOwnProperty(T)&&(f||(f={}),f[T]="")}else K!=="dangerouslySetInnerHTML"&&K!=="children"&&K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&K!=="autoFocus"&&(i.hasOwnProperty(K)?w||(w=[]):(w=w||[]).push(K,null));for(K in m){var F=m[K];if(A=y!=null?y[K]:void 0,m.hasOwnProperty(K)&&F!==A&&(F!=null||A!=null))if(K==="style")if(A){for(T in A)!A.hasOwnProperty(T)||F&&F.hasOwnProperty(T)||(f||(f={}),f[T]="");for(T in F)F.hasOwnProperty(T)&&A[T]!==F[T]&&(f||(f={}),f[T]=F[T])}else f||(w||(w=[]),w.push(K,f)),f=F;else K==="dangerouslySetInnerHTML"?(F=F?F.__html:void 0,A=A?A.__html:void 0,F!=null&&A!==F&&(w=w||[]).push(K,F)):K==="children"?typeof F!="string"&&typeof F!="number"||(w=w||[]).push(K,""+F):K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&(i.hasOwnProperty(K)?(F!=null&&K==="onScroll"&&dt("scroll",l),w||A===F||(w=[])):(w=w||[]).push(K,F))}f&&(w=w||[]).push("style",f);var K=w;(c.updateQueue=K)&&(c.flags|=4)}},Xv=function(l,c,f,m){f!==m&&(c.flags|=4)};function Vl(l,c){if(!yt)switch(l.tailMode){case"hidden":c=l.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?l.tail=null:f.sibling=null;break;case"collapsed":f=l.tail;for(var m=null;f!==null;)f.alternate!==null&&(m=f),f=f.sibling;m===null?c||l.tail===null?l.tail=null:l.tail.sibling=null:m.sibling=null}}function dn(l){var c=l.alternate!==null&&l.alternate.child===l.child,f=0,m=0;if(c)for(var y=l.child;y!==null;)f|=y.lanes|y.childLanes,m|=y.subtreeFlags&14680064,m|=y.flags&14680064,y.return=l,y=y.sibling;else for(y=l.child;y!==null;)f|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=l,y=y.sibling;return l.subtreeFlags|=m,l.childLanes=f,c}function PT(l,c,f){var m=c.pendingProps;switch(md(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(c),null;case 1:return Dn(c.type)&&Ec(),dn(c),null;case 3:return m=c.stateNode,Co(),pt(An),pt(fn),Od(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(l===null||l.child===null)&&(Mc(c)?c.flags|=4:l===null||l.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Tr!==null&&(ip(Tr),Tr=null))),Kd(l,c),dn(c),null;case 5:Td(c);var y=Ds(_l.current);if(f=c.type,l!==null&&c.stateNode!=null)Gv(l,c,f,m,y),l.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!m){if(c.stateNode===null)throw Error(t(166));return dn(c),null}if(l=Ds($r.current),Mc(c)){m=c.stateNode,f=c.type;var w=c.memoizedProps;switch(m[Vr]=c,m[Il]=w,l=(c.mode&1)!==0,f){case"dialog":dt("cancel",m),dt("close",m);break;case"iframe":case"object":case"embed":dt("load",m);break;case"video":case"audio":for(y=0;y<Ml.length;y++)dt(Ml[y],m);break;case"source":dt("error",m);break;case"img":case"image":case"link":dt("error",m),dt("load",m);break;case"details":dt("toggle",m);break;case"input":wt(m,w),dt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!w.multiple},dt("invalid",m);break;case"textarea":ct(m,w),dt("invalid",m)}Pn(f,w),y=null;for(var T in w)if(w.hasOwnProperty(T)){var A=w[T];T==="children"?typeof A=="string"?m.textContent!==A&&(w.suppressHydrationWarning!==!0&&Sc(m.textContent,A,l),y=["children",A]):typeof A=="number"&&m.textContent!==""+A&&(w.suppressHydrationWarning!==!0&&Sc(m.textContent,A,l),y=["children",""+A]):i.hasOwnProperty(T)&&A!=null&&T==="onScroll"&&dt("scroll",m)}switch(f){case"input":it(m),ht(m,w,!0);break;case"textarea":it(m),re(m);break;case"select":case"option":break;default:typeof w.onClick=="function"&&(m.onclick=kc)}m=y,c.updateQueue=m,m!==null&&(c.flags|=4)}else{T=y.nodeType===9?y:y.ownerDocument,l==="http://www.w3.org/1999/xhtml"&&(l=oe(f)),l==="http://www.w3.org/1999/xhtml"?f==="script"?(l=T.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild)):typeof m.is=="string"?l=T.createElement(f,{is:m.is}):(l=T.createElement(f),f==="select"&&(T=l,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):l=T.createElementNS(l,f),l[Vr]=c,l[Il]=m,Yv(l,c,!1,!1),c.stateNode=l;e:{switch(T=Mn(f,m),f){case"dialog":dt("cancel",l),dt("close",l),y=m;break;case"iframe":case"object":case"embed":dt("load",l),y=m;break;case"video":case"audio":for(y=0;y<Ml.length;y++)dt(Ml[y],l);y=m;break;case"source":dt("error",l),y=m;break;case"img":case"image":case"link":dt("error",l),dt("load",l),y=m;break;case"details":dt("toggle",l),y=m;break;case"input":wt(l,m),y=Xe(l,m),dt("invalid",l);break;case"option":y=m;break;case"select":l._wrapperState={wasMultiple:!!m.multiple},y=B({},m,{value:void 0}),dt("invalid",l);break;case"textarea":ct(l,m),y=jt(l,m),dt("invalid",l);break;default:y=m}Pn(f,y),A=y;for(w in A)if(A.hasOwnProperty(w)){var F=A[w];w==="style"?bt(l,F):w==="dangerouslySetInnerHTML"?(F=F?F.__html:void 0,F!=null&&Ue(l,F)):w==="children"?typeof F=="string"?(f!=="textarea"||F!=="")&&qe(l,F):typeof F=="number"&&qe(l,""+F):w!=="suppressContentEditableWarning"&&w!=="suppressHydrationWarning"&&w!=="autoFocus"&&(i.hasOwnProperty(w)?F!=null&&w==="onScroll"&&dt("scroll",l):F!=null&&O(l,w,F,T))}switch(f){case"input":it(l),ht(l,m,!1);break;case"textarea":it(l),re(l);break;case"option":m.value!=null&&l.setAttribute("value",""+xe(m.value));break;case"select":l.multiple=!!m.multiple,w=m.value,w!=null?Ft(l,!!m.multiple,w,!1):m.defaultValue!=null&&Ft(l,!!m.multiple,m.defaultValue,!0);break;default:typeof y.onClick=="function"&&(l.onclick=kc)}switch(f){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(c.flags|=4)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return dn(c),null;case 6:if(l&&c.stateNode!=null)Xv(l,c,l.memoizedProps,m);else{if(typeof m!="string"&&c.stateNode===null)throw Error(t(166));if(f=Ds(_l.current),Ds($r.current),Mc(c)){if(m=c.stateNode,f=c.memoizedProps,m[Vr]=c,(w=m.nodeValue!==f)&&(l=Qn,l!==null))switch(l.tag){case 3:Sc(m.nodeValue,f,(l.mode&1)!==0);break;case 5:l.memoizedProps.suppressHydrationWarning!==!0&&Sc(m.nodeValue,f,(l.mode&1)!==0)}w&&(c.flags|=4)}else m=(f.nodeType===9?f:f.ownerDocument).createTextNode(m),m[Vr]=c,c.stateNode=m}return dn(c),null;case 13:if(pt(St),m=c.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(yt&&Yn!==null&&(c.mode&1)!==0&&(c.flags&128)===0)ev(),wo(),c.flags|=98560,w=!1;else if(w=Mc(c),m!==null&&m.dehydrated!==null){if(l===null){if(!w)throw Error(t(318));if(w=c.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(t(317));w[Vr]=c}else wo(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;dn(c),w=!1}else Tr!==null&&(ip(Tr),Tr=null),w=!0;if(!w)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=f,c):(m=m!==null,m!==(l!==null&&l.memoizedState!==null)&&m&&(c.child.flags|=8192,(c.mode&1)!==0&&(l===null||(St.current&1)!==0?Vt===0&&(Vt=3):lp())),c.updateQueue!==null&&(c.flags|=4),dn(c),null);case 4:return Co(),Kd(l,c),l===null&&Al(c.stateNode.containerInfo),dn(c),null;case 10:return bd(c.type._context),dn(c),null;case 17:return Dn(c.type)&&Ec(),dn(c),null;case 19:if(pt(St),w=c.memoizedState,w===null)return dn(c),null;if(m=(c.flags&128)!==0,T=w.rendering,T===null)if(m)Vl(w,!1);else{if(Vt!==0||l!==null&&(l.flags&128)!==0)for(l=c.child;l!==null;){if(T=Bc(l),T!==null){for(c.flags|=128,Vl(w,!1),m=T.updateQueue,m!==null&&(c.updateQueue=m,c.flags|=4),c.subtreeFlags=0,m=f,f=c.child;f!==null;)w=f,l=m,w.flags&=14680066,T=w.alternate,T===null?(w.childLanes=0,w.lanes=l,w.child=null,w.subtreeFlags=0,w.memoizedProps=null,w.memoizedState=null,w.updateQueue=null,w.dependencies=null,w.stateNode=null):(w.childLanes=T.childLanes,w.lanes=T.lanes,w.child=T.child,w.subtreeFlags=0,w.deletions=null,w.memoizedProps=T.memoizedProps,w.memoizedState=T.memoizedState,w.updateQueue=T.updateQueue,w.type=T.type,l=T.dependencies,w.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),f=f.sibling;return ut(St,St.current&1|2),c.child}l=l.sibling}w.tail!==null&&Dt()>Oo&&(c.flags|=128,m=!0,Vl(w,!1),c.lanes=4194304)}else{if(!m)if(l=Bc(T),l!==null){if(c.flags|=128,m=!0,f=l.updateQueue,f!==null&&(c.updateQueue=f,c.flags|=4),Vl(w,!0),w.tail===null&&w.tailMode==="hidden"&&!T.alternate&&!yt)return dn(c),null}else 2*Dt()-w.renderingStartTime>Oo&&f!==1073741824&&(c.flags|=128,m=!0,Vl(w,!1),c.lanes=4194304);w.isBackwards?(T.sibling=c.child,c.child=T):(f=w.last,f!==null?f.sibling=T:c.child=T,w.last=T)}return w.tail!==null?(c=w.tail,w.rendering=c,w.tail=c.sibling,w.renderingStartTime=Dt(),c.sibling=null,f=St.current,ut(St,m?f&1|2:f&1),c):(dn(c),null);case 22:case 23:return op(),m=c.memoizedState!==null,l!==null&&l.memoizedState!==null!==m&&(c.flags|=8192),m&&(c.mode&1)!==0?(Gn&1073741824)!==0&&(dn(c),c.subtreeFlags&6&&(c.flags|=8192)):dn(c),null;case 24:return null;case 25:return null}throw Error(t(156,c.tag))}function MT(l,c){switch(md(c),c.tag){case 1:return Dn(c.type)&&Ec(),l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 3:return Co(),pt(An),pt(fn),Od(),l=c.flags,(l&65536)!==0&&(l&128)===0?(c.flags=l&-65537|128,c):null;case 5:return Td(c),null;case 13:if(pt(St),l=c.memoizedState,l!==null&&l.dehydrated!==null){if(c.alternate===null)throw Error(t(340));wo()}return l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 19:return pt(St),null;case 4:return Co(),null;case 10:return bd(c.type._context),null;case 22:case 23:return op(),null;case 24:return null;default:return null}}var Uc=!1,pn=!1,AT=typeof WeakSet=="function"?WeakSet:Set,we=null;function To(l,c){var f=l.ref;if(f!==null)if(typeof f=="function")try{f(null)}catch(m){Ct(l,c,m)}else f.current=null}function Qd(l,c,f){try{f()}catch(m){Ct(l,c,m)}}var Jv=!1;function DT(l,c){if(od=fc,l=My(),Jh(l)){if("selectionStart"in l)var f={start:l.selectionStart,end:l.selectionEnd};else e:{f=(f=l.ownerDocument)&&f.defaultView||window;var m=f.getSelection&&f.getSelection();if(m&&m.rangeCount!==0){f=m.anchorNode;var y=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var T=0,A=-1,F=-1,K=0,le=0,ae=l,ie=null;t:for(;;){for(var ve;ae!==f||y!==0&&ae.nodeType!==3||(A=T+y),ae!==w||m!==0&&ae.nodeType!==3||(F=T+m),ae.nodeType===3&&(T+=ae.nodeValue.length),(ve=ae.firstChild)!==null;)ie=ae,ae=ve;for(;;){if(ae===l)break t;if(ie===f&&++K===y&&(A=T),ie===w&&++le===m&&(F=T),(ve=ae.nextSibling)!==null)break;ae=ie,ie=ae.parentNode}ae=ve}f=A===-1||F===-1?null:{start:A,end:F}}else f=null}f=f||{start:0,end:0}}else f=null;for(ld={focusedElem:l,selectionRange:f},fc=!1,we=c;we!==null;)if(c=we,l=c.child,(c.subtreeFlags&1028)!==0&&l!==null)l.return=c,we=l;else for(;we!==null;){c=we;try{var be=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(be!==null){var Se=be.memoizedProps,It=be.memoizedState,H=c.stateNode,j=H.getSnapshotBeforeUpdate(c.elementType===c.type?Se:Rr(c.type,Se),It);H.__reactInternalSnapshotBeforeUpdate=j}break;case 3:var U=c.stateNode.containerInfo;U.nodeType===1?U.textContent="":U.nodeType===9&&U.documentElement&&U.removeChild(U.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(t(163))}}catch(ue){Ct(c,c.return,ue)}if(l=c.sibling,l!==null){l.return=c.return,we=l;break}we=c.return}return be=Jv,Jv=!1,be}function $l(l,c,f){var m=c.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var y=m=m.next;do{if((y.tag&l)===l){var w=y.destroy;y.destroy=void 0,w!==void 0&&Qd(c,f,w)}y=y.next}while(y!==m)}}function qc(l,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var f=c=c.next;do{if((f.tag&l)===l){var m=f.create;f.destroy=m()}f=f.next}while(f!==c)}}function Yd(l){var c=l.ref;if(c!==null){var f=l.stateNode;switch(l.tag){case 5:l=f;break;default:l=f}typeof c=="function"?c(l):c.current=l}}function Zv(l){var c=l.alternate;c!==null&&(l.alternate=null,Zv(c)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(c=l.stateNode,c!==null&&(delete c[Vr],delete c[Il],delete c[fd],delete c[pT],delete c[mT])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function e1(l){return l.tag===5||l.tag===3||l.tag===4}function t1(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||e1(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Gd(l,c,f){var m=l.tag;if(m===5||m===6)l=l.stateNode,c?f.nodeType===8?f.parentNode.insertBefore(l,c):f.insertBefore(l,c):(f.nodeType===8?(c=f.parentNode,c.insertBefore(l,f)):(c=f,c.appendChild(l)),f=f._reactRootContainer,f!=null||c.onclick!==null||(c.onclick=kc));else if(m!==4&&(l=l.child,l!==null))for(Gd(l,c,f),l=l.sibling;l!==null;)Gd(l,c,f),l=l.sibling}function Xd(l,c,f){var m=l.tag;if(m===5||m===6)l=l.stateNode,c?f.insertBefore(l,c):f.appendChild(l);else if(m!==4&&(l=l.child,l!==null))for(Xd(l,c,f),l=l.sibling;l!==null;)Xd(l,c,f),l=l.sibling}var on=null,Or=!1;function Yi(l,c,f){for(f=f.child;f!==null;)n1(l,c,f),f=f.sibling}function n1(l,c,f){if(Hr&&typeof Hr.onCommitFiberUnmount=="function")try{Hr.onCommitFiberUnmount(sc,f)}catch{}switch(f.tag){case 5:pn||To(f,c);case 6:var m=on,y=Or;on=null,Yi(l,c,f),on=m,Or=y,on!==null&&(Or?(l=on,f=f.stateNode,l.nodeType===8?l.parentNode.removeChild(f):l.removeChild(f)):on.removeChild(f.stateNode));break;case 18:on!==null&&(Or?(l=on,f=f.stateNode,l.nodeType===8?ud(l.parentNode,f):l.nodeType===1&&ud(l,f),Sl(l)):ud(on,f.stateNode));break;case 4:m=on,y=Or,on=f.stateNode.containerInfo,Or=!0,Yi(l,c,f),on=m,Or=y;break;case 0:case 11:case 14:case 15:if(!pn&&(m=f.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){y=m=m.next;do{var w=y,T=w.destroy;w=w.tag,T!==void 0&&((w&2)!==0||(w&4)!==0)&&Qd(f,c,T),y=y.next}while(y!==m)}Yi(l,c,f);break;case 1:if(!pn&&(To(f,c),m=f.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=f.memoizedProps,m.state=f.memoizedState,m.componentWillUnmount()}catch(A){Ct(f,c,A)}Yi(l,c,f);break;case 21:Yi(l,c,f);break;case 22:f.mode&1?(pn=(m=pn)||f.memoizedState!==null,Yi(l,c,f),pn=m):Yi(l,c,f);break;default:Yi(l,c,f)}}function r1(l){var c=l.updateQueue;if(c!==null){l.updateQueue=null;var f=l.stateNode;f===null&&(f=l.stateNode=new AT),c.forEach(function(m){var y=WT.bind(null,l,m);f.has(m)||(f.add(m),m.then(y,y))})}}function Pr(l,c){var f=c.deletions;if(f!==null)for(var m=0;m<f.length;m++){var y=f[m];try{var w=l,T=c,A=T;e:for(;A!==null;){switch(A.tag){case 5:on=A.stateNode,Or=!1;break e;case 3:on=A.stateNode.containerInfo,Or=!0;break e;case 4:on=A.stateNode.containerInfo,Or=!0;break e}A=A.return}if(on===null)throw Error(t(160));n1(w,T,y),on=null,Or=!1;var F=y.alternate;F!==null&&(F.return=null),y.return=null}catch(K){Ct(y,c,K)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)i1(c,l),c=c.sibling}function i1(l,c){var f=l.alternate,m=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:if(Pr(c,l),qr(l),m&4){try{$l(3,l,l.return),qc(3,l)}catch(Se){Ct(l,l.return,Se)}try{$l(5,l,l.return)}catch(Se){Ct(l,l.return,Se)}}break;case 1:Pr(c,l),qr(l),m&512&&f!==null&&To(f,f.return);break;case 5:if(Pr(c,l),qr(l),m&512&&f!==null&&To(f,f.return),l.flags&32){var y=l.stateNode;try{qe(y,"")}catch(Se){Ct(l,l.return,Se)}}if(m&4&&(y=l.stateNode,y!=null)){var w=l.memoizedProps,T=f!==null?f.memoizedProps:w,A=l.type,F=l.updateQueue;if(l.updateQueue=null,F!==null)try{A==="input"&&w.type==="radio"&&w.name!=null&&At(y,w),Mn(A,T);var K=Mn(A,w);for(T=0;T<F.length;T+=2){var le=F[T],ae=F[T+1];le==="style"?bt(y,ae):le==="dangerouslySetInnerHTML"?Ue(y,ae):le==="children"?qe(y,ae):O(y,le,ae,K)}switch(A){case"input":tn(y,w);break;case"textarea":or(y,w);break;case"select":var ie=y._wrapperState.wasMultiple;y._wrapperState.wasMultiple=!!w.multiple;var ve=w.value;ve!=null?Ft(y,!!w.multiple,ve,!1):ie!==!!w.multiple&&(w.defaultValue!=null?Ft(y,!!w.multiple,w.defaultValue,!0):Ft(y,!!w.multiple,w.multiple?[]:"",!1))}y[Il]=w}catch(Se){Ct(l,l.return,Se)}}break;case 6:if(Pr(c,l),qr(l),m&4){if(l.stateNode===null)throw Error(t(162));y=l.stateNode,w=l.memoizedProps;try{y.nodeValue=w}catch(Se){Ct(l,l.return,Se)}}break;case 3:if(Pr(c,l),qr(l),m&4&&f!==null&&f.memoizedState.isDehydrated)try{Sl(c.containerInfo)}catch(Se){Ct(l,l.return,Se)}break;case 4:Pr(c,l),qr(l);break;case 13:Pr(c,l),qr(l),y=l.child,y.flags&8192&&(w=y.memoizedState!==null,y.stateNode.isHidden=w,!w||y.alternate!==null&&y.alternate.memoizedState!==null||(ep=Dt())),m&4&&r1(l);break;case 22:if(le=f!==null&&f.memoizedState!==null,l.mode&1?(pn=(K=pn)||le,Pr(c,l),pn=K):Pr(c,l),qr(l),m&8192){if(K=l.memoizedState!==null,(l.stateNode.isHidden=K)&&!le&&(l.mode&1)!==0)for(we=l,le=l.child;le!==null;){for(ae=we=le;we!==null;){switch(ie=we,ve=ie.child,ie.tag){case 0:case 11:case 14:case 15:$l(4,ie,ie.return);break;case 1:To(ie,ie.return);var be=ie.stateNode;if(typeof be.componentWillUnmount=="function"){m=ie,f=ie.return;try{c=m,be.props=c.memoizedProps,be.state=c.memoizedState,be.componentWillUnmount()}catch(Se){Ct(m,f,Se)}}break;case 5:To(ie,ie.return);break;case 22:if(ie.memoizedState!==null){l1(ae);continue}}ve!==null?(ve.return=ie,we=ve):l1(ae)}le=le.sibling}e:for(le=null,ae=l;;){if(ae.tag===5){if(le===null){le=ae;try{y=ae.stateNode,K?(w=y.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none"):(A=ae.stateNode,F=ae.memoizedProps.style,T=F!=null&&F.hasOwnProperty("display")?F.display:null,A.style.display=zt("display",T))}catch(Se){Ct(l,l.return,Se)}}}else if(ae.tag===6){if(le===null)try{ae.stateNode.nodeValue=K?"":ae.memoizedProps}catch(Se){Ct(l,l.return,Se)}}else if((ae.tag!==22&&ae.tag!==23||ae.memoizedState===null||ae===l)&&ae.child!==null){ae.child.return=ae,ae=ae.child;continue}if(ae===l)break e;for(;ae.sibling===null;){if(ae.return===null||ae.return===l)break e;le===ae&&(le=null),ae=ae.return}le===ae&&(le=null),ae.sibling.return=ae.return,ae=ae.sibling}}break;case 19:Pr(c,l),qr(l),m&4&&r1(l);break;case 21:break;default:Pr(c,l),qr(l)}}function qr(l){var c=l.flags;if(c&2){try{e:{for(var f=l.return;f!==null;){if(e1(f)){var m=f;break e}f=f.return}throw Error(t(160))}switch(m.tag){case 5:var y=m.stateNode;m.flags&32&&(qe(y,""),m.flags&=-33);var w=t1(l);Xd(l,w,y);break;case 3:case 4:var T=m.stateNode.containerInfo,A=t1(l);Gd(l,A,T);break;default:throw Error(t(161))}}catch(F){Ct(l,l.return,F)}l.flags&=-3}c&4096&&(l.flags&=-4097)}function IT(l,c,f){we=l,s1(l)}function s1(l,c,f){for(var m=(l.mode&1)!==0;we!==null;){var y=we,w=y.child;if(y.tag===22&&m){var T=y.memoizedState!==null||Uc;if(!T){var A=y.alternate,F=A!==null&&A.memoizedState!==null||pn;A=Uc;var K=pn;if(Uc=T,(pn=F)&&!K)for(we=y;we!==null;)T=we,F=T.child,T.tag===22&&T.memoizedState!==null?a1(y):F!==null?(F.return=T,we=F):a1(y);for(;w!==null;)we=w,s1(w),w=w.sibling;we=y,Uc=A,pn=K}o1(l)}else(y.subtreeFlags&8772)!==0&&w!==null?(w.return=y,we=w):o1(l)}}function o1(l){for(;we!==null;){var c=we;if((c.flags&8772)!==0){var f=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:pn||qc(5,c);break;case 1:var m=c.stateNode;if(c.flags&4&&!pn)if(f===null)m.componentDidMount();else{var y=c.elementType===c.type?f.memoizedProps:Rr(c.type,f.memoizedProps);m.componentDidUpdate(y,f.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var w=c.updateQueue;w!==null&&lv(c,w,m);break;case 3:var T=c.updateQueue;if(T!==null){if(f=null,c.child!==null)switch(c.child.tag){case 5:f=c.child.stateNode;break;case 1:f=c.child.stateNode}lv(c,T,f)}break;case 5:var A=c.stateNode;if(f===null&&c.flags&4){f=A;var F=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":F.autoFocus&&f.focus();break;case"img":F.src&&(f.src=F.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var K=c.alternate;if(K!==null){var le=K.memoizedState;if(le!==null){var ae=le.dehydrated;ae!==null&&Sl(ae)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(t(163))}pn||c.flags&512&&Yd(c)}catch(ie){Ct(c,c.return,ie)}}if(c===l){we=null;break}if(f=c.sibling,f!==null){f.return=c.return,we=f;break}we=c.return}}function l1(l){for(;we!==null;){var c=we;if(c===l){we=null;break}var f=c.sibling;if(f!==null){f.return=c.return,we=f;break}we=c.return}}function a1(l){for(;we!==null;){var c=we;try{switch(c.tag){case 0:case 11:case 15:var f=c.return;try{qc(4,c)}catch(F){Ct(c,f,F)}break;case 1:var m=c.stateNode;if(typeof m.componentDidMount=="function"){var y=c.return;try{m.componentDidMount()}catch(F){Ct(c,y,F)}}var w=c.return;try{Yd(c)}catch(F){Ct(c,w,F)}break;case 5:var T=c.return;try{Yd(c)}catch(F){Ct(c,T,F)}}}catch(F){Ct(c,c.return,F)}if(c===l){we=null;break}var A=c.sibling;if(A!==null){A.return=c.return,we=A;break}we=c.return}}var LT=Math.ceil,Kc=P.ReactCurrentDispatcher,Jd=P.ReactCurrentOwner,fr=P.ReactCurrentBatchConfig,Ke=0,Yt=null,_t=null,ln=0,Gn=0,Ro=$i(0),Vt=0,Ul=null,Ls=0,Qc=0,Zd=0,ql=null,Ln=null,ep=0,Oo=1/0,wi=null,Yc=!1,tp=null,Gi=null,Gc=!1,Xi=null,Xc=0,Kl=0,np=null,Jc=-1,Zc=0;function Sn(){return(Ke&6)!==0?Dt():Jc!==-1?Jc:Jc=Dt()}function Ji(l){return(l.mode&1)===0?1:(Ke&2)!==0&&ln!==0?ln&-ln:yT.transition!==null?(Zc===0&&(Zc=ty()),Zc):(l=tt,l!==0||(l=window.event,l=l===void 0?16:uy(l.type)),l)}function Mr(l,c,f,m){if(50<Kl)throw Kl=0,np=null,Error(t(185));yl(l,f,m),((Ke&2)===0||l!==Yt)&&(l===Yt&&((Ke&2)===0&&(Qc|=f),Vt===4&&Zi(l,ln)),Nn(l,m),f===1&&Ke===0&&(c.mode&1)===0&&(Oo=Dt()+500,Rc&&qi()))}function Nn(l,c){var f=l.callbackNode;yE(l,c);var m=ac(l,l===Yt?ln:0);if(m===0)f!==null&&J0(f),l.callbackNode=null,l.callbackPriority=0;else if(c=m&-m,l.callbackPriority!==c){if(f!=null&&J0(f),c===1)l.tag===0?gT(u1.bind(null,l)):Yy(u1.bind(null,l)),hT(function(){(Ke&6)===0&&qi()}),f=null;else{switch(ny(m)){case 1:f=Nh;break;case 4:f=Z0;break;case 16:f=ic;break;case 536870912:f=ey;break;default:f=ic}f=v1(f,c1.bind(null,l))}l.callbackPriority=c,l.callbackNode=f}}function c1(l,c){if(Jc=-1,Zc=0,(Ke&6)!==0)throw Error(t(327));var f=l.callbackNode;if(Po()&&l.callbackNode!==f)return null;var m=ac(l,l===Yt?ln:0);if(m===0)return null;if((m&30)!==0||(m&l.expiredLanes)!==0||c)c=eu(l,m);else{c=m;var y=Ke;Ke|=2;var w=h1();(Yt!==l||ln!==c)&&(wi=null,Oo=Dt()+500,Bs(l,c));do try{FT();break}catch(A){f1(l,A)}while(!0);wd(),Kc.current=w,Ke=y,_t!==null?c=0:(Yt=null,ln=0,c=Vt)}if(c!==0){if(c===2&&(y=Bh(l),y!==0&&(m=y,c=rp(l,y))),c===1)throw f=Ul,Bs(l,0),Zi(l,m),Nn(l,Dt()),f;if(c===6)Zi(l,m);else{if(y=l.current.alternate,(m&30)===0&&!NT(y)&&(c=eu(l,m),c===2&&(w=Bh(l),w!==0&&(m=w,c=rp(l,w))),c===1))throw f=Ul,Bs(l,0),Zi(l,m),Nn(l,Dt()),f;switch(l.finishedWork=y,l.finishedLanes=m,c){case 0:case 1:throw Error(t(345));case 2:Fs(l,Ln,wi);break;case 3:if(Zi(l,m),(m&130023424)===m&&(c=ep+500-Dt(),10<c)){if(ac(l,0)!==0)break;if(y=l.suspendedLanes,(y&m)!==m){Sn(),l.pingedLanes|=l.suspendedLanes&y;break}l.timeoutHandle=cd(Fs.bind(null,l,Ln,wi),c);break}Fs(l,Ln,wi);break;case 4:if(Zi(l,m),(m&4194240)===m)break;for(c=l.eventTimes,y=-1;0<m;){var T=31-Cr(m);w=1<<T,T=c[T],T>y&&(y=T),m&=~w}if(m=y,m=Dt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*LT(m/1960))-m,10<m){l.timeoutHandle=cd(Fs.bind(null,l,Ln,wi),m);break}Fs(l,Ln,wi);break;case 5:Fs(l,Ln,wi);break;default:throw Error(t(329))}}}return Nn(l,Dt()),l.callbackNode===f?c1.bind(null,l):null}function rp(l,c){var f=ql;return l.current.memoizedState.isDehydrated&&(Bs(l,c).flags|=256),l=eu(l,c),l!==2&&(c=Ln,Ln=f,c!==null&&ip(c)),l}function ip(l){Ln===null?Ln=l:Ln.push.apply(Ln,l)}function NT(l){for(var c=l;;){if(c.flags&16384){var f=c.updateQueue;if(f!==null&&(f=f.stores,f!==null))for(var m=0;m<f.length;m++){var y=f[m],w=y.getSnapshot;y=y.value;try{if(!Er(w(),y))return!1}catch{return!1}}}if(f=c.child,c.subtreeFlags&16384&&f!==null)f.return=c,c=f;else{if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Zi(l,c){for(c&=~Zd,c&=~Qc,l.suspendedLanes|=c,l.pingedLanes&=~c,l=l.expirationTimes;0<c;){var f=31-Cr(c),m=1<<f;l[f]=-1,c&=~m}}function u1(l){if((Ke&6)!==0)throw Error(t(327));Po();var c=ac(l,0);if((c&1)===0)return Nn(l,Dt()),null;var f=eu(l,c);if(l.tag!==0&&f===2){var m=Bh(l);m!==0&&(c=m,f=rp(l,m))}if(f===1)throw f=Ul,Bs(l,0),Zi(l,c),Nn(l,Dt()),f;if(f===6)throw Error(t(345));return l.finishedWork=l.current.alternate,l.finishedLanes=c,Fs(l,Ln,wi),Nn(l,Dt()),null}function sp(l,c){var f=Ke;Ke|=1;try{return l(c)}finally{Ke=f,Ke===0&&(Oo=Dt()+500,Rc&&qi())}}function Ns(l){Xi!==null&&Xi.tag===0&&(Ke&6)===0&&Po();var c=Ke;Ke|=1;var f=fr.transition,m=tt;try{if(fr.transition=null,tt=1,l)return l()}finally{tt=m,fr.transition=f,Ke=c,(Ke&6)===0&&qi()}}function op(){Gn=Ro.current,pt(Ro)}function Bs(l,c){l.finishedWork=null,l.finishedLanes=0;var f=l.timeoutHandle;if(f!==-1&&(l.timeoutHandle=-1,fT(f)),_t!==null)for(f=_t.return;f!==null;){var m=f;switch(md(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&Ec();break;case 3:Co(),pt(An),pt(fn),Od();break;case 5:Td(m);break;case 4:Co();break;case 13:pt(St);break;case 19:pt(St);break;case 10:bd(m.type._context);break;case 22:case 23:op()}f=f.return}if(Yt=l,_t=l=es(l.current,null),ln=Gn=c,Vt=0,Ul=null,Zd=Qc=Ls=0,Ln=ql=null,As!==null){for(c=0;c<As.length;c++)if(f=As[c],m=f.interleaved,m!==null){f.interleaved=null;var y=m.next,w=f.pending;if(w!==null){var T=w.next;w.next=y,m.next=T}f.pending=m}As=null}return l}function f1(l,c){do{var f=_t;try{if(wd(),Fc.current=Wc,_c){for(var m=kt.memoizedState;m!==null;){var y=m.queue;y!==null&&(y.pending=null),m=m.next}_c=!1}if(Is=0,Qt=Ht=kt=null,jl=!1,zl=0,Jd.current=null,f===null||f.return===null){Vt=1,Ul=c,_t=null;break}e:{var w=l,T=f.return,A=f,F=c;if(c=ln,A.flags|=32768,F!==null&&typeof F=="object"&&typeof F.then=="function"){var K=F,le=A,ae=le.tag;if((le.mode&1)===0&&(ae===0||ae===11||ae===15)){var ie=le.alternate;ie?(le.updateQueue=ie.updateQueue,le.memoizedState=ie.memoizedState,le.lanes=ie.lanes):(le.updateQueue=null,le.memoizedState=null)}var ve=Bv(T);if(ve!==null){ve.flags&=-257,Fv(ve,T,A,w,c),ve.mode&1&&Nv(w,K,c),c=ve,F=K;var be=c.updateQueue;if(be===null){var Se=new Set;Se.add(F),c.updateQueue=Se}else be.add(F);break e}else{if((c&1)===0){Nv(w,K,c),lp();break e}F=Error(t(426))}}else if(yt&&A.mode&1){var It=Bv(T);if(It!==null){(It.flags&65536)===0&&(It.flags|=256),Fv(It,T,A,w,c),vd(Eo(F,A));break e}}w=F=Eo(F,A),Vt!==4&&(Vt=2),ql===null?ql=[w]:ql.push(w),w=T;do{switch(w.tag){case 3:w.flags|=65536,c&=-c,w.lanes|=c;var H=Iv(w,F,c);ov(w,H);break e;case 1:A=F;var j=w.type,U=w.stateNode;if((w.flags&128)===0&&(typeof j.getDerivedStateFromError=="function"||U!==null&&typeof U.componentDidCatch=="function"&&(Gi===null||!Gi.has(U)))){w.flags|=65536,c&=-c,w.lanes|=c;var ue=Lv(w,A,c);ov(w,ue);break e}}w=w.return}while(w!==null)}p1(f)}catch(ke){c=ke,_t===f&&f!==null&&(_t=f=f.return);continue}break}while(!0)}function h1(){var l=Kc.current;return Kc.current=Wc,l===null?Wc:l}function lp(){(Vt===0||Vt===3||Vt===2)&&(Vt=4),Yt===null||(Ls&268435455)===0&&(Qc&268435455)===0||Zi(Yt,ln)}function eu(l,c){var f=Ke;Ke|=2;var m=h1();(Yt!==l||ln!==c)&&(wi=null,Bs(l,c));do try{BT();break}catch(y){f1(l,y)}while(!0);if(wd(),Ke=f,Kc.current=m,_t!==null)throw Error(t(261));return Yt=null,ln=0,Vt}function BT(){for(;_t!==null;)d1(_t)}function FT(){for(;_t!==null&&!aE();)d1(_t)}function d1(l){var c=y1(l.alternate,l,Gn);l.memoizedProps=l.pendingProps,c===null?p1(l):_t=c,Jd.current=null}function p1(l){var c=l;do{var f=c.alternate;if(l=c.return,(c.flags&32768)===0){if(f=PT(f,c,Gn),f!==null){_t=f;return}}else{if(f=MT(f,c),f!==null){f.flags&=32767,_t=f;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{Vt=6,_t=null;return}}if(c=c.sibling,c!==null){_t=c;return}_t=c=l}while(c!==null);Vt===0&&(Vt=5)}function Fs(l,c,f){var m=tt,y=fr.transition;try{fr.transition=null,tt=1,_T(l,c,f,m)}finally{fr.transition=y,tt=m}return null}function _T(l,c,f,m){do Po();while(Xi!==null);if((Ke&6)!==0)throw Error(t(327));f=l.finishedWork;var y=l.finishedLanes;if(f===null)return null;if(l.finishedWork=null,l.finishedLanes=0,f===l.current)throw Error(t(177));l.callbackNode=null,l.callbackPriority=0;var w=f.lanes|f.childLanes;if(vE(l,w),l===Yt&&(_t=Yt=null,ln=0),(f.subtreeFlags&2064)===0&&(f.flags&2064)===0||Gc||(Gc=!0,v1(ic,function(){return Po(),null})),w=(f.flags&15990)!==0,(f.subtreeFlags&15990)!==0||w){w=fr.transition,fr.transition=null;var T=tt;tt=1;var A=Ke;Ke|=4,Jd.current=null,DT(l,f),i1(f,l),iT(ld),fc=!!od,ld=od=null,l.current=f,IT(f),cE(),Ke=A,tt=T,fr.transition=w}else l.current=f;if(Gc&&(Gc=!1,Xi=l,Xc=y),w=l.pendingLanes,w===0&&(Gi=null),hE(f.stateNode),Nn(l,Dt()),c!==null)for(m=l.onRecoverableError,f=0;f<c.length;f++)y=c[f],m(y.value,{componentStack:y.stack,digest:y.digest});if(Yc)throw Yc=!1,l=tp,tp=null,l;return(Xc&1)!==0&&l.tag!==0&&Po(),w=l.pendingLanes,(w&1)!==0?l===np?Kl++:(Kl=0,np=l):Kl=0,qi(),null}function Po(){if(Xi!==null){var l=ny(Xc),c=fr.transition,f=tt;try{if(fr.transition=null,tt=16>l?16:l,Xi===null)var m=!1;else{if(l=Xi,Xi=null,Xc=0,(Ke&6)!==0)throw Error(t(331));var y=Ke;for(Ke|=4,we=l.current;we!==null;){var w=we,T=w.child;if((we.flags&16)!==0){var A=w.deletions;if(A!==null){for(var F=0;F<A.length;F++){var K=A[F];for(we=K;we!==null;){var le=we;switch(le.tag){case 0:case 11:case 15:$l(8,le,w)}var ae=le.child;if(ae!==null)ae.return=le,we=ae;else for(;we!==null;){le=we;var ie=le.sibling,ve=le.return;if(Zv(le),le===K){we=null;break}if(ie!==null){ie.return=ve,we=ie;break}we=ve}}}var be=w.alternate;if(be!==null){var Se=be.child;if(Se!==null){be.child=null;do{var It=Se.sibling;Se.sibling=null,Se=It}while(Se!==null)}}we=w}}if((w.subtreeFlags&2064)!==0&&T!==null)T.return=w,we=T;else e:for(;we!==null;){if(w=we,(w.flags&2048)!==0)switch(w.tag){case 0:case 11:case 15:$l(9,w,w.return)}var H=w.sibling;if(H!==null){H.return=w.return,we=H;break e}we=w.return}}var j=l.current;for(we=j;we!==null;){T=we;var U=T.child;if((T.subtreeFlags&2064)!==0&&U!==null)U.return=T,we=U;else e:for(T=j;we!==null;){if(A=we,(A.flags&2048)!==0)try{switch(A.tag){case 0:case 11:case 15:qc(9,A)}}catch(ke){Ct(A,A.return,ke)}if(A===T){we=null;break e}var ue=A.sibling;if(ue!==null){ue.return=A.return,we=ue;break e}we=A.return}}if(Ke=y,qi(),Hr&&typeof Hr.onPostCommitFiberRoot=="function")try{Hr.onPostCommitFiberRoot(sc,l)}catch{}m=!0}return m}finally{tt=f,fr.transition=c}}return!1}function m1(l,c,f){c=Eo(f,c),c=Iv(l,c,1),l=Qi(l,c,1),c=Sn(),l!==null&&(yl(l,1,c),Nn(l,c))}function Ct(l,c,f){if(l.tag===3)m1(l,l,f);else for(;c!==null;){if(c.tag===3){m1(c,l,f);break}else if(c.tag===1){var m=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Gi===null||!Gi.has(m))){l=Eo(f,l),l=Lv(c,l,1),c=Qi(c,l,1),l=Sn(),c!==null&&(yl(c,1,l),Nn(c,l));break}}c=c.return}}function jT(l,c,f){var m=l.pingCache;m!==null&&m.delete(c),c=Sn(),l.pingedLanes|=l.suspendedLanes&f,Yt===l&&(ln&f)===f&&(Vt===4||Vt===3&&(ln&130023424)===ln&&500>Dt()-ep?Bs(l,0):Zd|=f),Nn(l,c)}function g1(l,c){c===0&&((l.mode&1)===0?c=1:(c=lc,lc<<=1,(lc&130023424)===0&&(lc=4194304)));var f=Sn();l=yi(l,c),l!==null&&(yl(l,c,f),Nn(l,f))}function zT(l){var c=l.memoizedState,f=0;c!==null&&(f=c.retryLane),g1(l,f)}function WT(l,c){var f=0;switch(l.tag){case 13:var m=l.stateNode,y=l.memoizedState;y!==null&&(f=y.retryLane);break;case 19:m=l.stateNode;break;default:throw Error(t(314))}m!==null&&m.delete(c),g1(l,f)}var y1;y1=function(l,c,f){if(l!==null)if(l.memoizedProps!==c.pendingProps||An.current)In=!0;else{if((l.lanes&f)===0&&(c.flags&128)===0)return In=!1,OT(l,c,f);In=(l.flags&131072)!==0}else In=!1,yt&&(c.flags&1048576)!==0&&Gy(c,Pc,c.index);switch(c.lanes=0,c.tag){case 2:var m=c.type;$c(l,c),l=c.pendingProps;var y=yo(c,fn.current);ko(c,f),y=Ad(null,c,m,l,y,f);var w=Dd();return c.flags|=1,typeof y=="object"&&y!==null&&typeof y.render=="function"&&y.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Dn(m)?(w=!0,Tc(c)):w=!1,c.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,Cd(c),y.updater=Hc,c.stateNode=y,y._reactInternals=c,_d(c,m,l,f),c=Hd(null,c,m,!0,w,f)):(c.tag=0,yt&&w&&pd(c),bn(null,c,y,f),c=c.child),c;case 16:m=c.elementType;e:{switch($c(l,c),l=c.pendingProps,y=m._init,m=y(m._payload),c.type=m,y=c.tag=VT(m),l=Rr(m,l),y){case 0:c=Wd(null,c,m,l,f);break e;case 1:c=Vv(null,c,m,l,f);break e;case 11:c=_v(null,c,m,l,f);break e;case 14:c=jv(null,c,m,Rr(m.type,l),f);break e}throw Error(t(306,m,""))}return c;case 0:return m=c.type,y=c.pendingProps,y=c.elementType===m?y:Rr(m,y),Wd(l,c,m,y,f);case 1:return m=c.type,y=c.pendingProps,y=c.elementType===m?y:Rr(m,y),Vv(l,c,m,y,f);case 3:e:{if($v(c),l===null)throw Error(t(387));m=c.pendingProps,w=c.memoizedState,y=w.element,sv(l,c),Nc(c,m,null,f);var T=c.memoizedState;if(m=T.element,w.isDehydrated)if(w={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},c.updateQueue.baseState=w,c.memoizedState=w,c.flags&256){y=Eo(Error(t(423)),c),c=Uv(l,c,m,f,y);break e}else if(m!==y){y=Eo(Error(t(424)),c),c=Uv(l,c,m,f,y);break e}else for(Yn=Vi(c.stateNode.containerInfo.firstChild),Qn=c,yt=!0,Tr=null,f=rv(c,null,m,f),c.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(wo(),m===y){c=xi(l,c,f);break e}bn(l,c,m,f)}c=c.child}return c;case 5:return av(c),l===null&&yd(c),m=c.type,y=c.pendingProps,w=l!==null?l.memoizedProps:null,T=y.children,ad(m,y)?T=null:w!==null&&ad(m,w)&&(c.flags|=32),Hv(l,c),bn(l,c,T,f),c.child;case 6:return l===null&&yd(c),null;case 13:return qv(l,c,f);case 4:return Ed(c,c.stateNode.containerInfo),m=c.pendingProps,l===null?c.child=bo(c,null,m,f):bn(l,c,m,f),c.child;case 11:return m=c.type,y=c.pendingProps,y=c.elementType===m?y:Rr(m,y),_v(l,c,m,y,f);case 7:return bn(l,c,c.pendingProps,f),c.child;case 8:return bn(l,c,c.pendingProps.children,f),c.child;case 12:return bn(l,c,c.pendingProps.children,f),c.child;case 10:e:{if(m=c.type._context,y=c.pendingProps,w=c.memoizedProps,T=y.value,ut(Dc,m._currentValue),m._currentValue=T,w!==null)if(Er(w.value,T)){if(w.children===y.children&&!An.current){c=xi(l,c,f);break e}}else for(w=c.child,w!==null&&(w.return=c);w!==null;){var A=w.dependencies;if(A!==null){T=w.child;for(var F=A.firstContext;F!==null;){if(F.context===m){if(w.tag===1){F=vi(-1,f&-f),F.tag=2;var K=w.updateQueue;if(K!==null){K=K.shared;var le=K.pending;le===null?F.next=F:(F.next=le.next,le.next=F),K.pending=F}}w.lanes|=f,F=w.alternate,F!==null&&(F.lanes|=f),Sd(w.return,f,c),A.lanes|=f;break}F=F.next}}else if(w.tag===10)T=w.type===c.type?null:w.child;else if(w.tag===18){if(T=w.return,T===null)throw Error(t(341));T.lanes|=f,A=T.alternate,A!==null&&(A.lanes|=f),Sd(T,f,c),T=w.sibling}else T=w.child;if(T!==null)T.return=w;else for(T=w;T!==null;){if(T===c){T=null;break}if(w=T.sibling,w!==null){w.return=T.return,T=w;break}T=T.return}w=T}bn(l,c,y.children,f),c=c.child}return c;case 9:return y=c.type,m=c.pendingProps.children,ko(c,f),y=cr(y),m=m(y),c.flags|=1,bn(l,c,m,f),c.child;case 14:return m=c.type,y=Rr(m,c.pendingProps),y=Rr(m.type,y),jv(l,c,m,y,f);case 15:return zv(l,c,c.type,c.pendingProps,f);case 17:return m=c.type,y=c.pendingProps,y=c.elementType===m?y:Rr(m,y),$c(l,c),c.tag=1,Dn(m)?(l=!0,Tc(c)):l=!1,ko(c,f),Av(c,m,y),_d(c,m,y,f),Hd(null,c,m,!0,l,f);case 19:return Qv(l,c,f);case 22:return Wv(l,c,f)}throw Error(t(156,c.tag))};function v1(l,c){return X0(l,c)}function HT(l,c,f,m){this.tag=l,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hr(l,c,f,m){return new HT(l,c,f,m)}function ap(l){return l=l.prototype,!(!l||!l.isReactComponent)}function VT(l){if(typeof l=="function")return ap(l)?1:0;if(l!=null){if(l=l.$$typeof,l===W)return 11;if(l===$)return 14}return 2}function es(l,c){var f=l.alternate;return f===null?(f=hr(l.tag,c,l.key,l.mode),f.elementType=l.elementType,f.type=l.type,f.stateNode=l.stateNode,f.alternate=l,l.alternate=f):(f.pendingProps=c,f.type=l.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=l.flags&14680064,f.childLanes=l.childLanes,f.lanes=l.lanes,f.child=l.child,f.memoizedProps=l.memoizedProps,f.memoizedState=l.memoizedState,f.updateQueue=l.updateQueue,c=l.dependencies,f.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},f.sibling=l.sibling,f.index=l.index,f.ref=l.ref,f}function tu(l,c,f,m,y,w){var T=2;if(m=l,typeof l=="function")ap(l)&&(T=1);else if(typeof l=="string")T=5;else e:switch(l){case L:return _s(f.children,y,w,c);case z:T=8,y|=8;break;case Q:return l=hr(12,f,c,y|2),l.elementType=Q,l.lanes=w,l;case Y:return l=hr(13,f,c,y),l.elementType=Y,l.lanes=w,l;case J:return l=hr(19,f,c,y),l.elementType=J,l.lanes=w,l;case q:return nu(f,y,w,c);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case G:T=10;break e;case X:T=9;break e;case W:T=11;break e;case $:T=14;break e;case te:T=16,m=null;break e}throw Error(t(130,l==null?l:typeof l,""))}return c=hr(T,f,c,y),c.elementType=l,c.type=m,c.lanes=w,c}function _s(l,c,f,m){return l=hr(7,l,m,c),l.lanes=f,l}function nu(l,c,f,m){return l=hr(22,l,m,c),l.elementType=q,l.lanes=f,l.stateNode={isHidden:!1},l}function cp(l,c,f){return l=hr(6,l,null,c),l.lanes=f,l}function up(l,c,f){return c=hr(4,l.children!==null?l.children:[],l.key,c),c.lanes=f,c.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},c}function $T(l,c,f,m,y){this.tag=c,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fh(0),this.expirationTimes=Fh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fh(0),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function fp(l,c,f,m,y,w,T,A,F){return l=new $T(l,c,f,A,F),c===1?(c=1,w===!0&&(c|=8)):c=0,w=hr(3,null,null,c),l.current=w,w.stateNode=l,w.memoizedState={element:m,isDehydrated:f,cache:null,transitions:null,pendingSuspenseBoundaries:null},Cd(w),l}function UT(l,c,f){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:m==null?null:""+m,children:l,containerInfo:c,implementation:f}}function x1(l){if(!l)return Ui;l=l._reactInternals;e:{if(hi(l)!==l||l.tag!==1)throw Error(t(170));var c=l;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(Dn(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(t(171))}if(l.tag===1){var f=l.type;if(Dn(f))return Ky(l,f,c)}return c}function w1(l,c,f,m,y,w,T,A,F){return l=fp(f,m,!0,l,y,w,T,A,F),l.context=x1(null),f=l.current,m=Sn(),y=Ji(f),w=vi(m,y),w.callback=c??null,Qi(f,w,y),l.current.lanes=y,yl(l,y,m),Nn(l,m),l}function ru(l,c,f,m){var y=c.current,w=Sn(),T=Ji(y);return f=x1(f),c.context===null?c.context=f:c.pendingContext=f,c=vi(w,T),c.payload={element:l},m=m===void 0?null:m,m!==null&&(c.callback=m),l=Qi(y,c,T),l!==null&&(Mr(l,y,T,w),Lc(l,y,T)),T}function iu(l){if(l=l.current,!l.child)return null;switch(l.child.tag){case 5:return l.child.stateNode;default:return l.child.stateNode}}function b1(l,c){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var f=l.retryLane;l.retryLane=f!==0&&f<c?f:c}}function hp(l,c){b1(l,c),(l=l.alternate)&&b1(l,c)}function qT(){return null}var S1=typeof reportError=="function"?reportError:function(l){console.error(l)};function dp(l){this._internalRoot=l}su.prototype.render=dp.prototype.render=function(l){var c=this._internalRoot;if(c===null)throw Error(t(409));ru(l,c,null,null)},su.prototype.unmount=dp.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var c=l.containerInfo;Ns(function(){ru(null,l,null,null)}),c[di]=null}};function su(l){this._internalRoot=l}su.prototype.unstable_scheduleHydration=function(l){if(l){var c=sy();l={blockedOn:null,target:l,priority:c};for(var f=0;f<zi.length&&c!==0&&c<zi[f].priority;f++);zi.splice(f,0,l),f===0&&ay(l)}};function pp(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function ou(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11&&(l.nodeType!==8||l.nodeValue!==" react-mount-point-unstable "))}function k1(){}function KT(l,c,f,m,y){if(y){if(typeof m=="function"){var w=m;m=function(){var K=iu(T);w.call(K)}}var T=w1(c,m,l,0,null,!1,!1,"",k1);return l._reactRootContainer=T,l[di]=T.current,Al(l.nodeType===8?l.parentNode:l),Ns(),T}for(;y=l.lastChild;)l.removeChild(y);if(typeof m=="function"){var A=m;m=function(){var K=iu(F);A.call(K)}}var F=fp(l,0,!1,null,null,!1,!1,"",k1);return l._reactRootContainer=F,l[di]=F.current,Al(l.nodeType===8?l.parentNode:l),Ns(function(){ru(c,F,f,m)}),F}function lu(l,c,f,m,y){var w=f._reactRootContainer;if(w){var T=w;if(typeof y=="function"){var A=y;y=function(){var F=iu(T);A.call(F)}}ru(c,T,l,y)}else T=KT(f,c,l,y,m);return iu(T)}ry=function(l){switch(l.tag){case 3:var c=l.stateNode;if(c.current.memoizedState.isDehydrated){var f=gl(c.pendingLanes);f!==0&&(_h(c,f|1),Nn(c,Dt()),(Ke&6)===0&&(Oo=Dt()+500,qi()))}break;case 13:Ns(function(){var m=yi(l,1);if(m!==null){var y=Sn();Mr(m,l,1,y)}}),hp(l,1)}},jh=function(l){if(l.tag===13){var c=yi(l,134217728);if(c!==null){var f=Sn();Mr(c,l,134217728,f)}hp(l,134217728)}},iy=function(l){if(l.tag===13){var c=Ji(l),f=yi(l,c);if(f!==null){var m=Sn();Mr(f,l,c,m)}hp(l,c)}},sy=function(){return tt},oy=function(l,c){var f=tt;try{return tt=l,c()}finally{tt=f}},nn=function(l,c,f){switch(c){case"input":if(tn(l,f),c=f.name,f.type==="radio"&&c!=null){for(f=l;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<f.length;c++){var m=f[c];if(m!==l&&m.form===l.form){var y=Cc(m);if(!y)throw Error(t(90));Ee(m),tn(m,y)}}}break;case"textarea":or(l,f);break;case"select":c=f.value,c!=null&&Ft(l,!!f.multiple,c,!1)}},sn=sp,zr=Ns;var QT={usingClientEntryPoint:!1,Events:[Ll,mo,Cc,Wt,wn,sp]},Ql={findFiberByHostInstance:Rs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},YT={bundleType:Ql.bundleType,version:Ql.version,rendererPackageName:Ql.rendererPackageName,rendererConfig:Ql.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(l){return l=Y0(l),l===null?null:l.stateNode},findFiberByHostInstance:Ql.findFiberByHostInstance||qT,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 au=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!au.isDisabled&&au.supportsFiber)try{sc=au.inject(YT),Hr=au}catch{}}return Bn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=QT,Bn.createPortal=function(l,c){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!pp(c))throw Error(t(200));return UT(l,c,null,f)},Bn.createRoot=function(l,c){if(!pp(l))throw Error(t(299));var f=!1,m="",y=S1;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onRecoverableError!==void 0&&(y=c.onRecoverableError)),c=fp(l,1,!1,null,null,f,!1,m,y),l[di]=c.current,Al(l.nodeType===8?l.parentNode:l),new dp(c)},Bn.findDOMNode=function(l){if(l==null)return null;if(l.nodeType===1)return l;var c=l._reactInternals;if(c===void 0)throw typeof l.render=="function"?Error(t(188)):(l=Object.keys(l).join(","),Error(t(268,l)));return l=Y0(c),l=l===null?null:l.stateNode,l},Bn.flushSync=function(l){return Ns(l)},Bn.hydrate=function(l,c,f){if(!ou(c))throw Error(t(200));return lu(null,l,c,!0,f)},Bn.hydrateRoot=function(l,c,f){if(!pp(l))throw Error(t(405));var m=f!=null&&f.hydratedSources||null,y=!1,w="",T=S1;if(f!=null&&(f.unstable_strictMode===!0&&(y=!0),f.identifierPrefix!==void 0&&(w=f.identifierPrefix),f.onRecoverableError!==void 0&&(T=f.onRecoverableError)),c=w1(c,null,l,1,f??null,y,!1,w,T),l[di]=c.current,Al(l),m)for(l=0;l<m.length;l++)f=m[l],y=f._getVersion,y=y(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,y]:c.mutableSourceEagerHydrationData.push(f,y);return new su(c)},Bn.render=function(l,c,f){if(!ou(c))throw Error(t(200));return lu(null,l,c,!1,f)},Bn.unmountComponentAtNode=function(l){if(!ou(l))throw Error(t(40));return l._reactRootContainer?(Ns(function(){lu(null,null,l,!1,function(){l._reactRootContainer=null,l[di]=null})}),!0):!1},Bn.unstable_batchedUpdates=sp,Bn.unstable_renderSubtreeIntoContainer=function(l,c,f,m){if(!ou(f))throw Error(t(200));if(l==null||l._reactInternals===void 0)throw Error(t(38));return lu(l,c,f,!1,m)},Bn.version="18.3.1-next-f1338f8080-20240426",Bn}var A1;function P2(){if(A1)return yp.exports;A1=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),yp.exports=a4(),yp.exports}var D1;function c4(){if(D1)return cu;D1=1;var n=P2();return cu.createRoot=n.createRoot,cu.hydrateRoot=n.hydrateRoot,cu}var u4=c4();/**
|
|
41
|
-
* react-router v7.15.1
|
|
42
|
-
*
|
|
43
|
-
* Copyright (c) Remix Software Inc.
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the MIT license found in the
|
|
46
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
-
*
|
|
48
|
-
* @license MIT
|
|
49
|
-
*/var I1="popstate";function L1(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function f4(n={}){function e(r,i){var h;let s=(h=i.state)==null?void 0:h.masked,{pathname:o,search:a,hash:u}=s||r.location;return ym("",{pathname:o,search:a,hash:u},i.state&&i.state.usr||null,i.state&&i.state.key||"default",s?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function t(r,i){return typeof i=="string"?i:Sa(i)}return d4(e,t,null,n)}function xt(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function xr(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function h4(){return Math.random().toString(36).substring(2,10)}function N1(n,e){return{usr:n.state,key:n.key,idx:e,masked:n.mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function ym(n,e,t=null,r,i){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof e=="string"?il(e):e,state:t,key:e&&e.key||r||h4(),mask:i}}function Sa({pathname:n="/",search:e="",hash:t=""}){return e&&e!=="?"&&(n+=e.charAt(0)==="?"?e:"?"+e),t&&t!=="#"&&(n+=t.charAt(0)==="#"?t:"#"+t),n}function il(n){let e={};if(n){let t=n.indexOf("#");t>=0&&(e.hash=n.substring(t),n=n.substring(0,t));let r=n.indexOf("?");r>=0&&(e.search=n.substring(r),n=n.substring(0,r)),n&&(e.pathname=n)}return e}function d4(n,e,t,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a="POP",u=null,h=d();h==null&&(h=0,o.replaceState({...o.state,idx:h},""));function d(){return(o.state||{idx:null}).idx}function p(){a="POP";let S=d(),C=S==null?null:S-h;h=S,u&&u({action:a,location:b.location,delta:C})}function g(S,C){a="PUSH";let R=L1(S)?S:ym(b.location,S,C);h=d()+1;let O=N1(R,h),P=b.createHref(R.mask||R);try{o.pushState(O,"",P)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(P)}s&&u&&u({action:a,location:b.location,delta:1})}function v(S,C){a="REPLACE";let R=L1(S)?S:ym(b.location,S,C);h=d();let O=N1(R,h),P=b.createHref(R.mask||R);o.replaceState(O,"",P),s&&u&&u({action:a,location:b.location,delta:0})}function x(S){return p4(S)}let b={get action(){return a},get location(){return n(i,o)},listen(S){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(I1,p),u=S,()=>{i.removeEventListener(I1,p),u=null}},createHref(S){return e(i,S)},createURL:x,encodeLocation(S){let C=x(S);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:g,replace:v,go(S){return o.go(S)}};return b}function p4(n,e=!1){let t="http://localhost";typeof window<"u"&&(t=window.location.origin!=="null"?window.location.origin:window.location.href),xt(t,"No window.location.(origin|href) available to create URL");let r=typeof n=="string"?n:Sa(n);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=t+r),new URL(r,t)}function M2(n,e,t="/"){return m4(n,e,t,!1)}function m4(n,e,t,r,i){let s=typeof e=="string"?il(e):e,o=Ri(s.pathname||"/",t);if(o==null)return null;let a=g4(n),u=null,h=O4(o);for(let d=0;u==null&&d<a.length;++d)u=T4(a[d],h,r);return u}function g4(n){let e=A2(n);return y4(e),e}function A2(n,e=[],t=[],r="",i=!1){let s=(o,a,u=i,h)=>{let d={relativePath:h===void 0?o.path||"":h,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&u)return;xt(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let p=Nr([r,d.relativePath]),g=t.concat(d);o.children&&o.children.length>0&&(xt(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),A2(o.children,e,g,p,u)),!(o.path==null&&!o.index)&&e.push({path:p,score:C4(p,o.index),routesMeta:g})};return n.forEach((o,a)=>{var u;if(o.path===""||!((u=o.path)!=null&&u.includes("?")))s(o,a);else for(let h of D2(o.path))s(o,a,!0,h)}),e}function D2(n){let e=n.split("/");if(e.length===0)return[];let[t,...r]=e,i=t.endsWith("?"),s=t.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=D2(r.join("/")),a=[];return a.push(...o.map(u=>u===""?s:[s,u].join("/"))),i&&a.push(...o),a.map(u=>n.startsWith("/")&&u===""?"/":u)}function y4(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:E4(e.routesMeta.map(r=>r.childrenIndex),t.routesMeta.map(r=>r.childrenIndex)))}var v4=/^:[\w-]+$/,x4=3,w4=2,b4=1,S4=10,k4=-2,B1=n=>n==="*";function C4(n,e){let t=n.split("/"),r=t.length;return t.some(B1)&&(r+=k4),e&&(r+=w4),t.filter(i=>!B1(i)).reduce((i,s)=>i+(v4.test(s)?x4:s===""?b4:S4),r)}function E4(n,e){return n.length===e.length&&n.slice(0,-1).every((r,i)=>r===e[i])?n[n.length-1]-e[e.length-1]:0}function T4(n,e,t=!1){let{routesMeta:r}=n,i={},s="/",o=[];for(let a=0;a<r.length;++a){let u=r[a],h=a===r.length-1,d=s==="/"?e:e.slice(s.length)||"/",p=of({path:u.relativePath,caseSensitive:u.caseSensitive,end:h},d),g=u.route;if(!p&&h&&t&&!r[r.length-1].route.index&&(p=of({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},d)),!p)return null;Object.assign(i,p.params),o.push({params:i,pathname:Nr([s,p.pathname]),pathnameBase:D4(Nr([s,p.pathnameBase])),route:g}),p.pathnameBase!=="/"&&(s=Nr([s,p.pathnameBase]))}return o}function of(n,e){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[t,r]=R4(n.path,n.caseSensitive,n.end),i=e.match(t);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((h,{paramName:d,isOptional:p},g)=>{if(d==="*"){let x=a[g]||"";o=s.slice(0,s.length-x.length).replace(/(.)\/+$/,"$1")}const v=a[g];return p&&!v?h[d]=void 0:h[d]=(v||"").replace(/%2F/g,"/"),h},{}),pathname:s,pathnameBase:o,pattern:n}}function R4(n,e=!1,t=!0){xr(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let r=[],i="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,u,h,d)=>{if(r.push({paramName:a,isOptional:u!=null}),u){let p=d.charAt(h+o.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(r.push({paramName:"*"}),i+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?i+="\\/*$":n!==""&&n!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function O4(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return xr(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),n}}function Ri(n,e){if(e==="/")return n;if(!n.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,r=n.charAt(t);return r&&r!=="/"?null:n.slice(t)||"/"}var P4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function M4(n,e="/"){let{pathname:t,search:r="",hash:i=""}=typeof n=="string"?il(n):n,s;return t?(t=I2(t),t.startsWith("/")?s=F1(t.substring(1),"/"):s=F1(t,e)):s=e,{pathname:s,search:I4(r),hash:L4(i)}}function F1(n,e){let t=lf(e).split("/");return n.split("/").forEach(i=>{i===".."?t.length>1&&t.pop():i!=="."&&t.push(i)}),t.length>1?t.join("/"):"/"}function wp(n,e,t,r){return`Cannot include a '${n}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function A4(n){return n.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Cg(n){let e=A4(n);return e.map((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)}function Jf(n,e,t,r=!1){let i;typeof n=="string"?i=il(n):(i={...n},xt(!i.pathname||!i.pathname.includes("?"),wp("?","pathname","search",i)),xt(!i.pathname||!i.pathname.includes("#"),wp("#","pathname","hash",i)),xt(!i.search||!i.search.includes("#"),wp("#","search","hash",i)));let s=n===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=t;else{let p=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),p-=1;i.pathname=g.join("/")}a=p>=0?e[p]:"/"}let u=M4(i,a),h=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&t.endsWith("/");return!u.pathname.endsWith("/")&&(h||d)&&(u.pathname+="/"),u}var I2=n=>n.replace(/\/\/+/g,"/"),Nr=n=>I2(n.join("/")),lf=n=>n.replace(/\/+$/,""),D4=n=>lf(n).replace(/^\/*/,"/"),I4=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,L4=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,N4=class{constructor(n,e,t,r=!1){this.status=n,this.statusText=e||"",this.internal=r,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}};function B4(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function F4(n){let e=n.map(t=>t.route.path).filter(Boolean);return Nr(e)||"/"}var L2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function N2(n,e){let t=n;if(typeof t!="string"||!P4.test(t))return{absoluteURL:void 0,isExternal:!1,to:t};let r=t,i=!1;if(L2)try{let s=new URL(window.location.href),o=t.startsWith("//")?new URL(s.protocol+t):new URL(t),a=Ri(o.pathname,e);o.origin===s.origin&&a!=null?t=a+o.search+o.hash:i=!0}catch{xr(!1,`<Link to="${t}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:t}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var B2=["POST","PUT","PATCH","DELETE"];new Set(B2);var _4=["GET",...B2];new Set(_4);var sl=k.createContext(null);sl.displayName="DataRouter";var Zf=k.createContext(null);Zf.displayName="DataRouterState";var F2=k.createContext(!1);function j4(){return k.useContext(F2)}var _2=k.createContext({isTransitioning:!1});_2.displayName="ViewTransition";var z4=k.createContext(new Map);z4.displayName="Fetchers";var W4=k.createContext(null);W4.displayName="Await";var rr=k.createContext(null);rr.displayName="Navigation";var qa=k.createContext(null);qa.displayName="Location";var wr=k.createContext({outlet:null,matches:[],isDataRoute:!1});wr.displayName="Route";var Eg=k.createContext(null);Eg.displayName="RouteError";var j2="REACT_ROUTER_ERROR",H4="REDIRECT",V4="ROUTE_ERROR_RESPONSE";function $4(n){if(n.startsWith(`${j2}:${H4}:{`))try{let e=JSON.parse(n.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function U4(n){if(n.startsWith(`${j2}:${V4}:{`))try{let e=JSON.parse(n.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new N4(e.status,e.statusText,e.data)}catch{}}function q4(n,{relative:e}={}){xt(ol(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:r}=k.useContext(rr),{hash:i,pathname:s,search:o}=Ka(n,{relative:e}),a=s;return t!=="/"&&(a=s==="/"?t:Nr([t,s])),r.createHref({pathname:a,search:o,hash:i})}function ol(){return k.useContext(qa)!=null}function ir(){return xt(ol(),"useLocation() may be used only in the context of a <Router> component."),k.useContext(qa).location}var z2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function W2(n){k.useContext(rr).static||k.useLayoutEffect(n)}function eh(){let{isDataRoute:n}=k.useContext(wr);return n?lR():K4()}function K4(){xt(ol(),"useNavigate() may be used only in the context of a <Router> component.");let n=k.useContext(sl),{basename:e,navigator:t}=k.useContext(rr),{matches:r}=k.useContext(wr),{pathname:i}=ir(),s=JSON.stringify(Cg(r)),o=k.useRef(!1);return W2(()=>{o.current=!0}),k.useCallback((u,h={})=>{if(xr(o.current,z2),!o.current)return;if(typeof u=="number"){t.go(u);return}let d=Jf(u,JSON.parse(s),i,h.relative==="path");n==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Nr([e,d.pathname])),(h.replace?t.replace:t.push)(d,h.state,h)},[e,t,s,i,n])}var Q4=k.createContext(null);function Y4(n){let e=k.useContext(wr).outlet;return k.useMemo(()=>e&&k.createElement(Q4.Provider,{value:n},e),[e,n])}function th(){let{matches:n}=k.useContext(wr),e=n[n.length-1];return(e==null?void 0:e.params)??{}}function Ka(n,{relative:e}={}){let{matches:t}=k.useContext(wr),{pathname:r}=ir(),i=JSON.stringify(Cg(t));return k.useMemo(()=>Jf(n,JSON.parse(i),r,e==="path"),[n,i,r,e])}function G4(n,e){return H2(n,e)}function H2(n,e,t){var S;xt(ol(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=k.useContext(rr),{matches:i}=k.useContext(wr),s=i[i.length-1],o=s?s.params:{},a=s?s.pathname:"/",u=s?s.pathnameBase:"/",h=s&&s.route;{let C=h&&h.path||"";$2(a,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${a}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
50
|
-
|
|
51
|
-
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let d=ir(),p;if(e){let C=typeof e=="string"?il(e):e;xt(u==="/"||((S=C.pathname)==null?void 0:S.startsWith(u)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${C.pathname}" was given in the \`location\` prop.`),p=C}else p=d;let g=p.pathname||"/",v=g;if(u!=="/"){let C=u.replace(/^\//,"").split("/");v="/"+g.replace(/^\//,"").split("/").slice(C.length).join("/")}let x=t&&t.state.matches.length?t.state.matches.map(C=>Object.assign(C,{route:t.manifest[C.route.id]||C.route})):M2(n,{pathname:v});xr(h||x!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),xr(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let b=tR(x&&x.map(C=>Object.assign({},C,{params:Object.assign({},o,C.params),pathname:Nr([u,r.encodeLocation?r.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?u:Nr([u,r.encodeLocation?r.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),i,t);return e&&b?k.createElement(qa.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...p},navigationType:"POP"}},b):b}function X4(){let n=oR(),e=B4(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),t=n instanceof Error?n.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",n),o=k.createElement(k.Fragment,null,k.createElement("p",null,"💿 Hey developer 👋"),k.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",k.createElement("code",{style:s},"ErrorBoundary")," or"," ",k.createElement("code",{style:s},"errorElement")," prop on your route.")),k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},e),t?k.createElement("pre",{style:i},t):null,o)}var J4=k.createElement(X4,null),V2=class extends k.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,e){return e.location!==n.location||e.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:e.error,location:e.location,revalidation:n.revalidation||e.revalidation}}componentDidCatch(n,e){this.props.onError?this.props.onError(n,e):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const t=U4(n.digest);t&&(n=t)}let e=n!==void 0?k.createElement(wr.Provider,{value:this.props.routeContext},k.createElement(Eg.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?k.createElement(Z4,{error:n},e):e}};V2.contextType=F2;var bp=new WeakMap;function Z4({children:n,error:e}){let{basename:t}=k.useContext(rr);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=$4(e.digest);if(r){let i=bp.get(e);if(i)throw i;let s=N2(r.location,t);if(L2&&!bp.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw bp.set(e,o),o}return k.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return n}function eR({routeContext:n,match:e,children:t}){let r=k.useContext(sl);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),k.createElement(wr.Provider,{value:n},t)}function tR(n,e=[],t){let r=t==null?void 0:t.state;if(n==null){if(!r)return null;if(r.errors)n=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)n=r.matches;else return null}let i=n,s=r==null?void 0:r.errors;if(s!=null){let d=i.findIndex(p=>p.route.id&&(s==null?void 0:s[p.route.id])!==void 0);xt(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,d+1))}let o=!1,a=-1;if(t&&r){o=r.renderFallback;for(let d=0;d<i.length;d++){let p=i[d];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(a=d),p.route.id){let{loaderData:g,errors:v}=r,x=p.route.loader&&!g.hasOwnProperty(p.route.id)&&(!v||v[p.route.id]===void 0);if(p.route.lazy||x){t.isStatic&&(o=!0),a>=0?i=i.slice(0,a+1):i=[i[0]];break}}}}let u=t==null?void 0:t.onError,h=r&&u?(d,p)=>{var g,v;u(d,{location:r.location,params:((v=(g=r.matches)==null?void 0:g[0])==null?void 0:v.params)??{},pattern:F4(r.matches),errorInfo:p})}:void 0;return i.reduceRight((d,p,g)=>{let v,x=!1,b=null,S=null;r&&(v=s&&p.route.id?s[p.route.id]:void 0,b=p.route.errorElement||J4,o&&(a<0&&g===0?($2("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,S=null):a===g&&(x=!0,S=p.route.hydrateFallbackElement||null)));let C=e.concat(i.slice(0,g+1)),R=()=>{let O;return v?O=b:x?O=S:p.route.Component?O=k.createElement(p.route.Component,null):p.route.element?O=p.route.element:O=d,k.createElement(eR,{match:p,routeContext:{outlet:d,matches:C,isDataRoute:r!=null},children:O})};return r&&(p.route.ErrorBoundary||p.route.errorElement||g===0)?k.createElement(V2,{location:r.location,revalidation:r.revalidation,component:b,error:v,children:R(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):R()},null)}function Tg(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nR(n){let e=k.useContext(sl);return xt(e,Tg(n)),e}function rR(n){let e=k.useContext(Zf);return xt(e,Tg(n)),e}function iR(n){let e=k.useContext(wr);return xt(e,Tg(n)),e}function Rg(n){let e=iR(n),t=e.matches[e.matches.length-1];return xt(t.route.id,`${n} can only be used on routes that contain a unique "id"`),t.route.id}function sR(){return Rg("useRouteId")}function oR(){var r;let n=k.useContext(Eg),e=rR("useRouteError"),t=Rg("useRouteError");return n!==void 0?n:(r=e.errors)==null?void 0:r[t]}function lR(){let{router:n}=nR("useNavigate"),e=Rg("useNavigate"),t=k.useRef(!1);return W2(()=>{t.current=!0}),k.useCallback(async(i,s={})=>{xr(t.current,z2),t.current&&(typeof i=="number"?await n.navigate(i):await n.navigate(i,{fromRouteId:e,...s}))},[n,e])}var _1={};function $2(n,e,t){!e&&!_1[n]&&(_1[n]=!0,xr(!1,t))}k.memo(aR);function aR({routes:n,manifest:e,future:t,state:r,isStatic:i,onError:s}){return H2(n,void 0,{manifest:e,state:r,isStatic:i,onError:s})}function ha({to:n,replace:e,state:t,relative:r}){xt(ol(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=k.useContext(rr);xr(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=k.useContext(wr),{pathname:o}=ir(),a=eh(),u=Jf(n,Cg(s),o,r==="path"),h=JSON.stringify(u);return k.useEffect(()=>{a(JSON.parse(h),{replace:e,state:t,relative:r})},[a,h,r,e,t]),null}function cR(n){return Y4(n.context)}function Vs(n){xt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function uR({basename:n="/",children:e=null,location:t,navigationType:r="POP",navigator:i,static:s=!1,useTransitions:o}){xt(!ol(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=n.replace(/^\/*/,"/"),u=k.useMemo(()=>({basename:a,navigator:i,static:s,useTransitions:o,future:{}}),[a,i,s,o]);typeof t=="string"&&(t=il(t));let{pathname:h="/",search:d="",hash:p="",state:g=null,key:v="default",mask:x}=t,b=k.useMemo(()=>{let S=Ri(h,a);return S==null?null:{location:{pathname:S,search:d,hash:p,state:g,key:v,mask:x},navigationType:r}},[a,h,d,p,g,v,r,x]);return xr(b!=null,`<Router basename="${a}"> is not able to match the URL "${h}${d}${p}" because it does not start with the basename, so the <Router> won't render anything.`),b==null?null:k.createElement(rr.Provider,{value:u},k.createElement(qa.Provider,{children:e,value:b}))}function fR({children:n,location:e}){return G4(vm(n),e)}function vm(n,e=[]){let t=[];return k.Children.forEach(n,(r,i)=>{if(!k.isValidElement(r))return;let s=[...e,i];if(r.type===k.Fragment){t.push.apply(t,vm(r.props.children,s));return}xt(r.type===Vs,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),xt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=vm(r.props.children,s)),t.push(o)}),t}var $u="get",Uu="application/x-www-form-urlencoded";function nh(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function hR(n){return nh(n)&&n.tagName.toLowerCase()==="button"}function dR(n){return nh(n)&&n.tagName.toLowerCase()==="form"}function pR(n){return nh(n)&&n.tagName.toLowerCase()==="input"}function mR(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function gR(n,e){return n.button===0&&(!e||e==="_self")&&!mR(n)}function xm(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((e,t)=>{let r=n[t];return e.concat(Array.isArray(r)?r.map(i=>[t,i]):[[t,r]])},[]))}function yR(n,e){let t=xm(n);return e&&e.forEach((r,i)=>{t.has(i)||e.getAll(i).forEach(s=>{t.append(i,s)})}),t}var uu=null;function vR(){if(uu===null)try{new FormData(document.createElement("form"),0),uu=!1}catch{uu=!0}return uu}var xR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Sp(n){return n!=null&&!xR.has(n)?(xr(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Uu}"`),null):n}function wR(n,e){let t,r,i,s,o;if(dR(n)){let a=n.getAttribute("action");r=a?Ri(a,e):null,t=n.getAttribute("method")||$u,i=Sp(n.getAttribute("enctype"))||Uu,s=new FormData(n)}else if(hR(n)||pR(n)&&(n.type==="submit"||n.type==="image")){let a=n.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=n.getAttribute("formaction")||a.getAttribute("action");if(r=u?Ri(u,e):null,t=n.getAttribute("formmethod")||a.getAttribute("method")||$u,i=Sp(n.getAttribute("formenctype"))||Sp(a.getAttribute("enctype"))||Uu,s=new FormData(a,n),!vR()){let{name:h,type:d,value:p}=n;if(d==="image"){let g=h?`${h}.`:"";s.append(`${g}x`,"0"),s.append(`${g}y`,"0")}else h&&s.append(h,p)}}else{if(nh(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=$u,r=null,i=Uu,o=n}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:t.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Og(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function U2(n,e,t,r){let i=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return t?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:e&&Ri(i.pathname,e)==="/"?i.pathname=`${lf(e)}/_root.${r}`:i.pathname=`${lf(i.pathname)}.${r}`,i}async function bR(n,e){if(n.id in e)return e[n.id];try{let t=await import(n.module);return e[n.id]=t,t}catch(t){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function SR(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function kR(n,e,t){let r=await Promise.all(n.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await bR(s,t);return o.links?o.links():[]}return[]}));return RR(r.flat(1).filter(SR).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function j1(n,e,t,r,i,s){let o=(u,h)=>t[h]?u.route.id!==t[h].route.id:!0,a=(u,h)=>{var d;return t[h].pathname!==u.pathname||((d=t[h].route.path)==null?void 0:d.endsWith("*"))&&t[h].params["*"]!==u.params["*"]};return s==="assets"?e.filter((u,h)=>o(u,h)||a(u,h)):s==="data"?e.filter((u,h)=>{var p;let d=r.routes[u.route.id];if(!d||!d.hasLoader)return!1;if(o(u,h)||a(u,h))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((p=t[0])==null?void 0:p.params)||{},nextUrl:new URL(n,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function CR(n,e,{includeHydrateFallback:t}={}){return ER(n.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),t&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function ER(n){return[...new Set(n)]}function TR(n){let e={},t=Object.keys(n).sort();for(let r of t)e[r]=n[r];return e}function RR(n,e){let t=new Set;return new Set(e),n.reduce((r,i)=>{let s=JSON.stringify(TR(i));return t.has(s)||(t.add(s),r.push({key:s,link:i})),r},[])}function Pg(){let n=k.useContext(sl);return Og(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function OR(){let n=k.useContext(Zf);return Og(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Mg=k.createContext(void 0);Mg.displayName="FrameworkContext";function Ag(){let n=k.useContext(Mg);return Og(n,"You must render this element inside a <HydratedRouter> element"),n}function PR(n,e){let t=k.useContext(Mg),[r,i]=k.useState(!1),[s,o]=k.useState(!1),{onFocus:a,onBlur:u,onMouseEnter:h,onMouseLeave:d,onTouchStart:p}=e,g=k.useRef(null);k.useEffect(()=>{if(n==="render"&&o(!0),n==="viewport"){let b=C=>{C.forEach(R=>{o(R.isIntersecting)})},S=new IntersectionObserver(b,{threshold:.5});return g.current&&S.observe(g.current),()=>{S.disconnect()}}},[n]),k.useEffect(()=>{if(r){let b=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(b)}}},[r]);let v=()=>{i(!0)},x=()=>{i(!1),o(!1)};return t?n!=="intent"?[s,g,{}]:[s,g,{onFocus:Gl(a,v),onBlur:Gl(u,x),onMouseEnter:Gl(h,v),onMouseLeave:Gl(d,x),onTouchStart:Gl(p,v)}]:[!1,g,{}]}function Gl(n,e){return t=>{n&&n(t),t.defaultPrevented||e(t)}}function MR({page:n,...e}){let t=j4(),{router:r}=Pg(),i=k.useMemo(()=>M2(r.routes,n,r.basename),[r.routes,n,r.basename]);return i?t?k.createElement(DR,{page:n,matches:i,...e}):k.createElement(IR,{page:n,matches:i,...e}):null}function AR(n){let{manifest:e,routeModules:t}=Ag(),[r,i]=k.useState([]);return k.useEffect(()=>{let s=!1;return kR(n,e,t).then(o=>{s||i(o)}),()=>{s=!0}},[n,e,t]),r}function DR({page:n,matches:e,...t}){let r=ir(),{future:i}=Ag(),{basename:s}=Pg(),o=k.useMemo(()=>{if(n===r.pathname+r.search+r.hash)return[];let a=U2(n,s,i.unstable_trailingSlashAwareDataRequests,"rsc"),u=!1,h=[];for(let d of e)typeof d.route.shouldRevalidate=="function"?u=!0:h.push(d.route.id);return u&&h.length>0&&a.searchParams.set("_routes",h.join(",")),[a.pathname+a.search]},[s,i.unstable_trailingSlashAwareDataRequests,n,r,e]);return k.createElement(k.Fragment,null,o.map(a=>k.createElement("link",{key:a,rel:"prefetch",as:"fetch",href:a,...t})))}function IR({page:n,matches:e,...t}){let r=ir(),{future:i,manifest:s,routeModules:o}=Ag(),{basename:a}=Pg(),{loaderData:u,matches:h}=OR(),d=k.useMemo(()=>j1(n,e,h,s,r,"data"),[n,e,h,s,r]),p=k.useMemo(()=>j1(n,e,h,s,r,"assets"),[n,e,h,s,r]),g=k.useMemo(()=>{if(n===r.pathname+r.search+r.hash)return[];let b=new Set,S=!1;if(e.forEach(R=>{var P;let O=s.routes[R.route.id];!O||!O.hasLoader||(!d.some(D=>D.route.id===R.route.id)&&R.route.id in u&&((P=o[R.route.id])!=null&&P.shouldRevalidate)||O.hasClientLoader?S=!0:b.add(R.route.id))}),b.size===0)return[];let C=U2(n,a,i.unstable_trailingSlashAwareDataRequests,"data");return S&&b.size>0&&C.searchParams.set("_routes",e.filter(R=>b.has(R.route.id)).map(R=>R.route.id).join(",")),[C.pathname+C.search]},[a,i.unstable_trailingSlashAwareDataRequests,u,r,s,d,e,n,o]),v=k.useMemo(()=>CR(p,s),[p,s]),x=AR(p);return k.createElement(k.Fragment,null,g.map(b=>k.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...t})),v.map(b=>k.createElement("link",{key:b,rel:"modulepreload",href:b,...t})),x.map(({key:b,link:S})=>k.createElement("link",{key:b,nonce:t.nonce,...S,crossOrigin:S.crossOrigin??t.crossOrigin})))}function LR(...n){return e=>{n.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}var NR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{NR&&(window.__reactRouterVersion="7.15.1")}catch{}function BR({basename:n,children:e,useTransitions:t,window:r}){let i=k.useRef();i.current==null&&(i.current=f4({window:r,v5Compat:!0}));let s=i.current,[o,a]=k.useState({action:s.action,location:s.location}),u=k.useCallback(h=>{t===!1?a(h):k.startTransition(()=>a(h))},[t]);return k.useLayoutEffect(()=>s.listen(u),[s,u]),k.createElement(uR,{basename:n,children:e,location:o.location,navigationType:o.action,navigator:s,useTransitions:t})}var q2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Oi=k.forwardRef(function({onClick:e,discover:t="render",prefetch:r="none",relative:i,reloadDocument:s,replace:o,mask:a,state:u,target:h,to:d,preventScrollReset:p,viewTransition:g,defaultShouldRevalidate:v,...x},b){let{basename:S,navigator:C,useTransitions:R}=k.useContext(rr),O=typeof d=="string"&&q2.test(d),P=N2(d,S);d=P.to;let D=q4(d,{relative:i}),N=ir(),L=null;if(a){let $=Jf(a,[],N.mask?N.mask.pathname:"/",!0);S!=="/"&&($.pathname=$.pathname==="/"?S:Nr([S,$.pathname])),L=C.createHref($)}let[z,Q,G]=PR(r,x),X=zR(d,{replace:o,mask:a,state:u,target:h,preventScrollReset:p,relative:i,viewTransition:g,defaultShouldRevalidate:v,useTransitions:R});function W($){e&&e($),$.defaultPrevented||X($)}let Y=!(P.isExternal||s),J=k.createElement("a",{...x,...G,href:(Y?L:void 0)||P.absoluteURL||D,onClick:Y?W:e,ref:LR(b,Q),target:h,"data-discover":!O&&t==="render"?"true":void 0});return z&&!O?k.createElement(k.Fragment,null,J,k.createElement(MR,{page:D})):J});Oi.displayName="Link";var FR=k.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:u,...h},d){let p=Ka(o,{relative:h.relative}),g=ir(),v=k.useContext(Zf),{navigator:x,basename:b}=k.useContext(rr),S=v!=null&&qR(p)&&a===!0,C=x.encodeLocation?x.encodeLocation(p).pathname:p.pathname,R=g.pathname,O=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;t||(R=R.toLowerCase(),O=O?O.toLowerCase():null,C=C.toLowerCase()),O&&b&&(O=Ri(O,b)||O);const P=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let D=R===C||!i&&R.startsWith(C)&&R.charAt(P)==="/",N=O!=null&&(O===C||!i&&O.startsWith(C)&&O.charAt(C.length)==="/"),L={isActive:D,isPending:N,isTransitioning:S},z=D?e:void 0,Q;typeof r=="function"?Q=r(L):Q=[r,D?"active":null,N?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let G=typeof s=="function"?s(L):s;return k.createElement(Oi,{...h,"aria-current":z,className:Q,ref:d,style:G,to:o,viewTransition:a},typeof u=="function"?u(L):u)});FR.displayName="NavLink";var _R=k.forwardRef(({discover:n="render",fetcherKey:e,navigate:t,reloadDocument:r,replace:i,state:s,method:o=$u,action:a,onSubmit:u,relative:h,preventScrollReset:d,viewTransition:p,defaultShouldRevalidate:g,...v},x)=>{let{useTransitions:b}=k.useContext(rr),S=$R(),C=UR(a,{relative:h}),R=o.toLowerCase()==="get"?"get":"post",O=typeof a=="string"&&q2.test(a),P=D=>{if(u&&u(D),D.defaultPrevented)return;D.preventDefault();let N=D.nativeEvent.submitter,L=(N==null?void 0:N.getAttribute("formmethod"))||o,z=()=>S(N||D.currentTarget,{fetcherKey:e,method:L,navigate:t,replace:i,state:s,relative:h,preventScrollReset:d,viewTransition:p,defaultShouldRevalidate:g});b&&t!==!1?k.startTransition(()=>z()):z()};return k.createElement("form",{ref:x,method:R,action:C,onSubmit:r?u:P,...v,"data-discover":!O&&n==="render"?"true":void 0})});_R.displayName="Form";function jR(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function K2(n){let e=k.useContext(sl);return xt(e,jR(n)),e}function zR(n,{target:e,replace:t,mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,defaultShouldRevalidate:u,useTransitions:h}={}){let d=eh(),p=ir(),g=Ka(n,{relative:o});return k.useCallback(v=>{if(gR(v,e)){v.preventDefault();let x=t!==void 0?t:Sa(p)===Sa(g),b=()=>d(n,{replace:x,mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,defaultShouldRevalidate:u});h?k.startTransition(()=>b()):b()}},[p,d,g,t,r,i,e,n,s,o,a,u,h])}function WR(n){xr(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=k.useRef(xm(n)),t=k.useRef(!1),r=ir(),i=k.useMemo(()=>yR(r.search,t.current?null:e.current),[r.search]),s=eh(),o=k.useCallback((a,u)=>{const h=xm(typeof a=="function"?a(new URLSearchParams(i)):a);t.current=!0,s("?"+h,u)},[s,i]);return[i,o]}var HR=0,VR=()=>`__${String(++HR)}__`;function $R(){let{router:n}=K2("useSubmit"),{basename:e}=k.useContext(rr),t=sR(),r=n.fetch,i=n.navigate;return k.useCallback(async(s,o={})=>{let{action:a,method:u,encType:h,formData:d,body:p}=wR(s,e);if(o.navigate===!1){let g=o.fetcherKey||VR();await r(g,t,o.action||a,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:p,formMethod:o.method||u,formEncType:o.encType||h,flushSync:o.flushSync})}else await i(o.action||a,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:p,formMethod:o.method||u,formEncType:o.encType||h,replace:o.replace,state:o.state,fromRouteId:t,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,t])}function UR(n,{relative:e}={}){let{basename:t}=k.useContext(rr),r=k.useContext(wr);xt(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...Ka(n||".",{relative:e})},o=ir();if(n==null){s.search=o.search;let a=new URLSearchParams(s.search),u=a.getAll("index");if(u.some(d=>d==="")){a.delete("index"),u.filter(p=>p).forEach(p=>a.append("index",p));let d=a.toString();s.search=d?`?${d}`:""}}return(!n||n===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(s.pathname=s.pathname==="/"?t:Nr([t,s.pathname])),Sa(s)}function qR(n,{relative:e}={}){let t=k.useContext(_2);xt(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=K2("useViewTransitionState"),i=Ka(n,{relative:e});if(!t.isTransitioning)return!1;let s=Ri(t.currentLocation.pathname,r)||t.currentLocation.pathname,o=Ri(t.nextLocation.pathname,r)||t.nextLocation.pathname;return of(i.pathname,o)!=null||of(i.pathname,s)!=null}var Li=P2();const z1={};function br(n,e){const t=k.useRef(z1);return t.current===z1&&(t.current=n(e)),t}const wm=[];let bm;function KR(){return bm}function QR(n){wm.push(n)}function Q2(n){const e=(t,r)=>{const i=br(GR).current;let s;try{bm=i;for(const o of wm)o.before(i);s=n(t,r);for(const o of wm)o.after(i);i.didInitialize=!0}finally{bm=void 0}return s};return e.displayName=n.displayName||n.name,e}function YR(n){return k.forwardRef(Q2(n))}function GR(){return{didInitialize:!1}}function XR(n){const e=k.useRef(!0);e.current&&(e.current=!1,n())}const JR=()=>{},Pe=typeof document<"u"?k.useLayoutEffect:JR;function ZR(n,e){return function(r,...i){const s=new URL(n);return s.searchParams.set("code",r.toString()),i.forEach(o=>s.searchParams.append("args[]",o)),`${e} error #${r}; visit ${s} for the full message.`}}const sr=ZR("https://base-ui.com/production-error","Base UI"),Y2=k.createContext(void 0);function Qa(n){const e=k.useContext(Y2);if(e===void 0&&!n)throw new Error(sr(72));return e}const e3=[];function rh(n){k.useEffect(n,e3)}const Xl=0;class Br{constructor(){Je(this,"currentId",Xl);Je(this,"clear",()=>{this.currentId!==Xl&&(clearTimeout(this.currentId),this.currentId=Xl)});Je(this,"disposeEffect",()=>this.clear)}static create(){return new Br}start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Xl,t()},e)}isStarted(){return this.currentId!==Xl}}function eo(){const n=br(Br.create).current;return rh(n.disposeEffect),n}const Ya=typeof navigator<"u",kp=s3(),t3=l3(),n3=o3();typeof CSS>"u"||!CSS.supports||CSS.supports("-webkit-backdrop-filter:none");kp.platform==="MacIntel"&&kp.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(kp.platform);const G2=Ya&&/apple/i.test(navigator.vendor),r3=Ya&&t3.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,i3=n3.includes("jsdom/");function s3(){if(!Ya)return{platform:"",maxTouchPoints:-1};const n=navigator.userAgentData;return n!=null&&n.platform?{platform:n.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function o3(){if(!Ya)return"";const n=navigator.userAgentData;return n&&Array.isArray(n.brands)?n.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(" "):navigator.userAgent}function l3(){if(!Ya)return"";const n=navigator.userAgentData;return n!=null&&n.platform?n.platform:navigator.platform??""}function a3(n){return"nativeEvent"in n}function ka(n,e){const t=["mouse","pen"];return t.push("",void 0),t.includes(n)}function c3(n){const e=n.type;return e==="click"||e==="mousedown"||e==="keydown"||e==="keyup"}function ih(){return typeof window<"u"}function ll(n){return Dg(n)?(n.nodeName||"").toLowerCase():"#document"}function Ot(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function oi(n){var e;return(e=(Dg(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Dg(n){return ih()?n instanceof Node||n instanceof Ot(n).Node:!1}function _e(n){return ih()?n instanceof Element||n instanceof Ot(n).Element:!1}function qn(n){return ih()?n instanceof HTMLElement||n instanceof Ot(n).HTMLElement:!1}function af(n){return!ih()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Ot(n).ShadowRoot}function Ga(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=nr(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&i!=="inline"&&i!=="contents"}function u3(n){return/^(table|td|th)$/.test(ll(n))}function sh(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const f3=/transform|translate|scale|rotate|perspective|filter/,h3=/paint|layout|strict|content/,js=n=>!!n&&n!=="none";let Cp;function Ig(n){const e=_e(n)?nr(n):n;return js(e.transform)||js(e.translate)||js(e.scale)||js(e.rotate)||js(e.perspective)||!oh()&&(js(e.backdropFilter)||js(e.filter))||f3.test(e.willChange||"")||h3.test(e.contain||"")}function d3(n){let e=Pi(n);for(;qn(e)&&!Ei(e);){if(Ig(e))return e;if(sh(e))return null;e=Pi(e)}return null}function oh(){return Cp==null&&(Cp=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Cp}function Ei(n){return/^(html|body|#document)$/.test(ll(n))}function nr(n){return Ot(n).getComputedStyle(n)}function lh(n){return _e(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Pi(n){if(ll(n)==="html")return n;const e=n.assignedSlot||n.parentNode||af(n)&&n.host||oi(n);return af(e)?e.host:e}function X2(n){const e=Pi(n);return Ei(e)?n.ownerDocument?n.ownerDocument.body:n.body:qn(e)&&Ga(e)?e:X2(e)}function Ca(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=X2(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=Ot(i);if(s){const a=Sm(o);return e.concat(o,o.visualViewport||[],Ga(i)?i:[],a&&t?Ca(a):[])}else return e.concat(i,Ca(i,[],t))}function Sm(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}const p3="data-base-ui-focusable",J2="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function us(n){var t;let e=n.activeElement;for(;((t=e==null?void 0:e.shadowRoot)==null?void 0:t.activeElement)!=null;)e=e.shadowRoot.activeElement;return e}function lt(n,e){var r;if(!n||!e)return!1;const t=(r=e.getRootNode)==null?void 0:r.call(e);if(n.contains(e))return!0;if(t&&af(t)){let i=e;for(;i;){if(n===i)return!0;i=i.parentNode||i.host}}return!1}function En(n){return"composedPath"in n?n.composedPath()[0]:n.target}function cf(n,e){if(!_e(n))return!1;const t=n;if(e.hasElement(t))return!t.hasAttribute("data-trigger-disabled");for(const[,r]of e.entries())if(lt(r,t))return!r.hasAttribute("data-trigger-disabled");return!1}function Ep(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function m3(n){return n.matches("html,body")}function g3(n){return qn(n)&&n.matches(J2)}function y3(n){return(n==null?void 0:n.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${J2}`))!=null}function uf(n){if(!n||i3)return!0;try{return n.matches(":focus-visible")}catch{return!0}}function v3(n,e){return e!=null&&!ka(e)?0:typeof n=="function"?n():n}function ff(n,e,t){const r=v3(n,t);return typeof r=="number"?r:r==null?void 0:r[e]}function W1(n){return typeof n=="function"?n():n}function Z2(n,e){return e||n==="click"||n==="mousedown"}function x3(n){return(n==null?void 0:n.includes("mouse"))&&n!=="mousedown"}function Tt(){}const Jt=Object.freeze({}),ah="none",hf="trigger-press",Fn="trigger-hover",qu="trigger-focus",w3="outside-press",Lg="escape-key",b3="disabled",S3="imperative-action";function Rt(n,e,t,r){let i=!1,s=!1;const o=Jt;return{reason:n,event:e??new Event("base-ui"),cancel(){i=!0},allowPropagation(){s=!0},get isCanceled(){return i},get isPropagationAllowed(){return s},trigger:t,...o}}const eb=k.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Br,currentIdRef:{current:null},currentContextRef:{current:null}});function k3(n){const{children:e,delay:t,timeoutMs:r=0}=n,i=k.useRef(t),s=k.useRef(t),o=k.useRef(null),a=k.useRef(null),u=eo();return E.jsx(eb.Provider,{value:k.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:s,currentIdRef:o,timeoutMs:r,currentContextRef:a,timeout:u}),[r,u]),children:e})}function C3(n,e={open:!1}){const{open:t}=e,r="rootStore"in n?n.rootStore:n,i=r.useState("floatingId"),s=k.useContext(eb),{currentIdRef:o,delayRef:a,timeoutMs:u,initialDelayRef:h,currentContextRef:d,hasProvider:p,timeout:g}=s,[v,x]=k.useState(!1);return Pe(()=>{function b(){var S;x(!1),(S=d.current)==null||S.setIsInstantPhase(!1),o.current=null,d.current=null,a.current=h.current}if(o.current&&!t&&o.current===i){if(x(!1),u){const S=i;return g.start(u,()=>{r.select("open")||o.current&&o.current!==S||b()}),()=>{g.clear()}}b()}},[t,i,o,a,u,h,d,g,r]),Pe(()=>{if(!t)return;const b=d.current,S=o.current;g.clear(),d.current={onOpenChange:r.setOpen,setIsInstantPhase:x},o.current=i,a.current={open:0,close:ff(h.current,"close")},S!==null&&S!==i?(x(!0),b==null||b.setIsInstantPhase(!0),b==null||b.onOpenChange(!1,Rt(ah))):(x(!1),b==null||b.setIsInstantPhase(!1))},[t,i,r,o,a,h,d,g]),Pe(()=>()=>{d.current=null},[d]),k.useMemo(()=>({hasProvider:p,delayRef:a,isInstantPhase:v}),[p,a,v])}function et(n,e,t,r){return n.addEventListener(e,t,r),()=>{n.removeEventListener(e,t,r)}}function fs(...n){return()=>{for(let e=0;e<n.length;e+=1){const t=n[e];t&&t()}}}function km(n,e,t,r){const i=br(tb).current;return T3(i,n,e,t,r)&&nb(i,[n,e,t,r]),i.callback}function E3(n){const e=br(tb).current;return R3(e,n)&&nb(e,n),e.callback}function tb(){return{callback:null,cleanup:null,refs:[]}}function T3(n,e,t,r,i){return n.refs[0]!==e||n.refs[1]!==t||n.refs[2]!==r||n.refs[3]!==i}function R3(n,e){return n.refs.length!==e.length||n.refs.some((t,r)=>t!==e[r])}function nb(n,e){if(n.refs=e,e.every(t=>t==null)){n.callback=null;return}n.callback=t=>{if(n.cleanup&&(n.cleanup(),n.cleanup=null),t!=null){const r=Array(e.length).fill(null);for(let i=0;i<e.length;i+=1){const s=e[i];if(s!=null)switch(typeof s){case"function":{const o=s(t);typeof o=="function"&&(r[i]=o);break}case"object":{s.current=t;break}}}n.cleanup=()=>{for(let i=0;i<e.length;i+=1){const s=e[i];if(s!=null)switch(typeof s){case"function":{const o=r[i];typeof o=="function"?o():s(null);break}case"object":{s.current=null;break}}}}}}}function Ar(n){const e=br(O3,n).current;return e.next=n,Pe(e.effect),e}function O3(n){const e={current:n,next:n,effect:()=>{e.current=e.next}};return e}const Ng={...s4},Tp=Ng.useInsertionEffect,P3=Tp&&Tp!==Ng.useLayoutEffect?Tp:n=>n();function ze(n){const e=br(M3).current;return e.next=n,P3(e.effect),e.trampoline}function M3(){const n={next:void 0,callback:A3,trampoline:(...e)=>{var t;return(t=n.callback)==null?void 0:t.call(n,...e)},effect:()=>{n.callback=n.next}};return n}function A3(){}const fu=null;class D3{constructor(){Je(this,"callbacks",[]);Je(this,"callbacksCount",0);Je(this,"nextId",1);Je(this,"startId",1);Je(this,"isScheduled",!1);Je(this,"tick",e=>{var i;this.isScheduled=!1;const t=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<t.length;s+=1)(i=t[s])==null||i.call(t,e)})}request(e){const t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(e){const t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,this.callbacksCount-=1)}}const hu=new D3;class Si{constructor(){Je(this,"currentId",fu);Je(this,"cancel",()=>{this.currentId!==fu&&(hu.cancel(this.currentId),this.currentId=fu)});Je(this,"disposeEffect",()=>this.cancel)}static create(){return new Si}static request(e){return hu.request(e)}static cancel(e){return hu.cancel(e)}request(e){this.cancel(),this.currentId=hu.request(()=>{this.currentId=fu,e()})}}function Bg(){const n=br(Si.create).current;return rh(n.disposeEffect),n}function qt(n){return(n==null?void 0:n.ownerDocument)||document}const rb={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Fg={...rb,position:"fixed",top:0,left:0},I3={...rb,position:"absolute"},Rp=k.forwardRef(function(e,t){const[r,i]=k.useState();Pe(()=>{G2&&i("button")},[]);const s={tabIndex:0,role:r};return E.jsx("span",{...e,ref:t,style:Fg,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})}),L3=["top","right","bottom","left"],Qo=Math.min,er=Math.max,Yo=Math.round,du=Math.floor,ii=n=>({x:n,y:n}),N3={left:"right",right:"left",bottom:"top",top:"bottom"};function Cm(n,e,t){return er(n,Qo(e,t))}function Mi(n,e){return typeof n=="function"?n(e):n}function Vn(n){return n.split("-")[0]}function bs(n){return n.split("-")[1]}function _g(n){return n==="x"?"y":"x"}function jg(n){return n==="y"?"height":"width"}function pr(n){const e=n[0];return e==="t"||e==="b"?"y":"x"}function zg(n){return _g(pr(n))}function B3(n,e,t){t===void 0&&(t=!1);const r=bs(n),i=zg(n),s=jg(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=df(o)),[o,df(o)]}function F3(n){const e=df(n);return[Em(n),e,Em(e)]}function Em(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const H1=["left","right"],V1=["right","left"],_3=["top","bottom"],j3=["bottom","top"];function z3(n,e,t){switch(n){case"top":case"bottom":return t?e?V1:H1:e?H1:V1;case"left":case"right":return e?_3:j3;default:return[]}}function W3(n,e,t,r){const i=bs(n);let s=z3(Vn(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Em)))),s}function df(n){const e=Vn(n);return N3[e]+n.slice(e.length)}function H3(n){return{top:0,right:0,bottom:0,left:0,...n}}function ib(n){return typeof n!="number"?H3(n):{top:n,right:n,bottom:n,left:n}}function pf(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function Go(n,e,t=!0){return n.filter(i=>i.parentId===e).flatMap(i=>{var s;return[...!t||(s=i.context)!=null&&s.open?[i]:[],...Go(n,i.id,t)]})}function Wg(n){return`data-base-ui-${n}`}let $1=0;function V3(n,e="mui"){const[t,r]=k.useState(n),i=n||t;return k.useEffect(()=>{t==null&&($1+=1,r(`${e}-${$1}`))},[t,e]),i}const U1=Ng.useId;function al(n,e){if(U1!==void 0){const t=U1();return n??(e?`${e}-${t}`:t)}return V3(n,e)}const $3=parseInt(k.version,10);function Hg(n){return $3>=n}function q1(n){if(!k.isValidElement(n))return null;const e=n,t=e.props;return(Hg(19)?t==null?void 0:t.ref:e.ref)??null}function Tm(n,e){if(n&&!e)return n;if(!n&&e)return e;if(n||e)return{...n,...e}}function U3(n,e){const t={};for(const r in n){const i=n[r];if(e!=null&&e.hasOwnProperty(r)){const s=e[r](i);s!=null&&Object.assign(t,s);continue}i===!0?t[`data-${r.toLowerCase()}`]="":i&&(t[`data-${r.toLowerCase()}`]=i.toString())}return t}function q3(n,e){return typeof n=="function"?n(e):n}function K3(n,e){return typeof n=="function"?n(e):n}const Vg={};function hs(n,e,t,r,i){if(!t&&!r&&!n)return mf(e);let s=mf(n);return e&&(s=Ku(s,e)),t&&(s=Ku(s,t)),r&&(s=Ku(s,r)),s}function Q3(n){if(n.length===0)return Vg;if(n.length===1)return mf(n[0]);let e=mf(n[0]);for(let t=1;t<n.length;t+=1)e=Ku(e,n[t]);return e}function mf(n){return $g(n)?{...ob(n,Vg)}:Y3(n)}function Ku(n,e){return $g(e)?ob(e,n):G3(n,e)}function Y3(n){const e={...n};for(const t in e){const r=e[t];sb(t,r)&&(e[t]=lb(r))}return e}function G3(n,e){if(!e)return n;for(const t in e){const r=e[t];switch(t){case"style":{n[t]=Tm(n.style,r);break}case"className":{n[t]=ab(n.className,r);break}default:sb(t,r)?n[t]=X3(n[t],r):n[t]=r}}return n}function sb(n,e){const t=n.charCodeAt(0),r=n.charCodeAt(1),i=n.charCodeAt(2);return t===111&&r===110&&i>=65&&i<=90&&(typeof e=="function"||typeof e>"u")}function $g(n){return typeof n=="function"}function ob(n,e){return $g(n)?n(e):n??Vg}function X3(n,e){return e?n?(...t)=>{const r=t[0];if(cb(r)){const s=r;gf(s);const o=e(...t);return s.baseUIHandlerPrevented||n==null||n(...t),o}const i=e(...t);return n==null||n(...t),i}:lb(e):n}function lb(n){return n&&((...e)=>{const t=e[0];return cb(t)&&gf(t),n(...e)})}function gf(n){return n.preventBaseUIHandler=()=>{n.baseUIHandlerPrevented=!0},n}function ab(n,e){return e?n?e+" "+n:e:n}function cb(n){return n!=null&&typeof n=="object"&&"nativeEvent"in n}function On(n,e,t={}){const r=e.render,i=J3(e,t);if(t.enabled===!1)return null;const s=t.state??Jt;return tO(n,r,i,s)}function J3(n,e={}){const{className:t,style:r,render:i}=n,{state:s=Jt,ref:o,props:a,stateAttributesMapping:u,enabled:h=!0}=e,d=h?q3(t,s):void 0,p=h?K3(r,s):void 0,g=h?U3(s,u):Jt,v=h&&a?Z3(a):void 0,x=h?Tm(g,v)??{}:Jt;return typeof document<"u"&&(h?Array.isArray(o)?x.ref=E3([x.ref,q1(i),...o]):x.ref=km(x.ref,q1(i),o):km(null,null)),h?(d!==void 0&&(x.className=ab(x.className,d)),p!==void 0&&(x.style=Tm(x.style,p)),x):Jt}function Z3(n){return Array.isArray(n)?Q3(n):hs(void 0,n)}const eO=Symbol.for("react.lazy");function tO(n,e,t,r){if(e){if(typeof e=="function")return e(t,r);const i=hs(t,e.props);i.ref=t.ref;let s=e;return(s==null?void 0:s.$$typeof)===eO&&(s=k.Children.toArray(e)[0]),k.cloneElement(s,i)}if(n&&typeof n=="string")return nO(n,t);throw new Error(sr(8))}function nO(n,e){return n==="button"?k.createElement("button",{type:"button",...e,key:e.key}):n==="img"?k.createElement("img",{alt:"",...e,key:e.key}):k.createElement(n,e)}const rO={style:{transition:"none"}},iO="data-base-ui-swipe-ignore",sO="data-swipe-ignore",oO=`[${iO}]`,lO=`[${sO}]`,aO={fallbackAxisSide:"end"},cO=k.createContext(null),uO=()=>k.useContext(cO),fO=Wg("portal");function hO(n={}){const{ref:e,container:t,componentProps:r=Jt,elementProps:i}=n,s=al(),o=uO(),a=o==null?void 0:o.portalNode,[u,h]=k.useState(null),[d,p]=k.useState(null),g=ze(S=>{S!==null&&p(S)}),v=k.useRef(null);Pe(()=>{if(t===null){v.current&&(v.current=null,p(null),h(null));return}if(s==null)return;const S=(t&&(Dg(t)?t:t.current))??a??document.body;if(S==null){v.current&&(v.current=null,p(null),h(null));return}v.current!==S&&(v.current=S,p(null),h(S))},[t,a,s]);const x=On("div",r,{ref:[e,g],props:[{id:s,[fO]:""},i]});return{portalNode:d,portalSubtree:u&&x?Li.createPortal(x,u):null}}function dO(){const n=new Map;return{emit(e,t){var r;(r=n.get(e))==null||r.forEach(i=>i(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var r;(r=n.get(e))==null||r.delete(t)}}}const pO=k.createContext(null),mO=k.createContext(null),Ug=()=>{var n;return((n=k.useContext(pO))==null?void 0:n.id)||null},ch=n=>{const e=k.useContext(mO);return n??e};function gO(n){return n==null?n:"current"in n?n.current:n}function yO(n,e){let t=null,r=null,i=!1;return{contextElement:n||void 0,getBoundingClientRect(){var v;const s=(n==null?void 0:n.getBoundingClientRect())||{width:0,height:0,x:0,y:0},o=e.axis==="x"||e.axis==="both",a=e.axis==="y"||e.axis==="both",u=["mouseenter","mousemove"].includes(((v=e.dataRef.current.openEvent)==null?void 0:v.type)||"")&&e.pointerType!=="touch";let h=s.width,d=s.height,p=s.x,g=s.y;return t==null&&e.x&&o&&(t=s.x-e.x),r==null&&e.y&&a&&(r=s.y-e.y),p-=t||0,g-=r||0,h=0,d=0,!i||u?(h=e.axis==="y"?s.width:0,d=e.axis==="x"?s.height:0,p=o&&e.x!=null?e.x:p,g=a&&e.y!=null?e.y:g):i&&!u&&(d=e.axis==="x"?s.height:d,h=e.axis==="y"?s.width:h),i=!0,{width:h,height:d,x:p,y:g,top:g,right:p+h,bottom:g+d,left:p}}}}function K1(n){return n!=null&&n.clientX!=null}function vO(n,e={}){const{enabled:t=!0,axis:r="both"}=e,i="rootStore"in n?n.rootStore:n,s=i.useState("open"),o=i.useState("floatingElement"),a=i.useState("domReferenceElement"),u=i.context.dataRef,h=k.useRef(!1),d=k.useRef(null),[p,g]=k.useState(),[v,x]=k.useState([]),b=ze(P=>{i.set("positionReference",P)}),S=ze((P,D,N)=>{h.current||u.current.openEvent&&!K1(u.current.openEvent)||i.set("positionReference",yO(N??a,{x:P,y:D,axis:r,dataRef:u,pointerType:p}))}),C=ze(P=>{s?d.current||(S(P.clientX,P.clientY,P.currentTarget),x([])):S(P.clientX,P.clientY,P.currentTarget)}),R=ka(p)?o:s;k.useEffect(()=>{if(!t){b(a);return}if(!R)return;function P(){var L;(L=d.current)==null||L.call(d),d.current=null}const D=Ot(o);function N(L){const z=En(L);lt(o,z)?P():S(L.clientX,L.clientY)}return!u.current.openEvent||K1(u.current.openEvent)?d.current=et(D,"mousemove",N):b(a),P},[R,t,o,u,a,i,S,b,v]),k.useEffect(()=>()=>{i.set("positionReference",null)},[i]),k.useEffect(()=>{t&&!o&&(h.current=!1)},[t,o]),k.useEffect(()=>{!t&&s&&(h.current=!0)},[t,s]);const O=k.useMemo(()=>{function P(D){g(D.pointerType)}return{onPointerDown:P,onPointerEnter:P,onMouseMove:C,onMouseEnter:C}},[C]);return k.useMemo(()=>t?{reference:O,trigger:O}:{},[t,O])}const xO={intentional:"onClick",sloppy:"onPointerDown"};function wO(){return!1}function bO(n){return{escapeKey:typeof n=="boolean"?n:(n==null?void 0:n.escapeKey)??!1,outsidePress:typeof n=="boolean"?n:(n==null?void 0:n.outsidePress)??!0}}function SO(n,e={}){const{enabled:t=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:s="sloppy",referencePress:o=wO,referencePressEvent:a="sloppy",bubbles:u,externalTree:h}=e,d="rootStore"in n?n.rootStore:n,p=d.useState("open"),g=d.useState("floatingElement"),{dataRef:v}=d.context,x=ch(h),b=ze(typeof i=="function"?i:()=>!1),S=typeof i=="function"?b:i,C=S!==!1,R=ze(()=>s),{escapeKey:O,outsidePress:P}=bO(u),D=k.useRef(!1),N=k.useRef(!1),L=k.useRef(!1),z=k.useRef(!1),Q=k.useRef(""),G=k.useRef(null),X=eo(),W=eo(),Y=ze(()=>{W.clear(),v.current.insideReactTree=!1}),J=ze(ne=>{var se;const ee=(se=v.current.floatingContext)==null?void 0:se.nodeId;return(x?Go(x.nodesRef.current,ee):[]).some(me=>{var xe;return((xe=me.context)==null?void 0:xe.open)&&!me.context.dataRef.current[ne]})}),$=ze(ne=>Ep(ne,d.select("floatingElement"))||Ep(ne,d.select("domReferenceElement"))),te=ze(ne=>{o()&&d.setOpen(!1,Rt(hf,ne.nativeEvent))}),q=ze(ne=>{if(!p||!t||!r||ne.key!=="Escape"||z.current||!O&&J("__escapeKeyBubbles"))return;const ee=a3(ne)?ne.nativeEvent:ne,fe=Rt(Lg,ee);d.setOpen(!1,fe),fe.isCanceled||ne.preventDefault(),!O&&!fe.isPropagationAllowed&&ne.stopPropagation()}),I=ze(()=>{v.current.insideReactTree=!0,W.start(0,Y)}),_=ze(ne=>{if(!p||!t||ne.button!==0)return;const ee=En(ne.nativeEvent);lt(d.select("floatingElement"),ee)&&(D.current||(D.current=!0,N.current=!1))}),B=ze(ne=>{!p||!t||(ne.defaultPrevented||ne.nativeEvent.defaultPrevented)&&D.current&&(N.current=!0)});k.useEffect(()=>{if(!p||!t)return;v.current.__escapeKeyBubbles=O,v.current.__outsidePressBubbles=P;const ne=new Br,ee=new Br;function fe(){ne.clear(),z.current=!0}function se(){ne.start(oh()?5:0,()=>{z.current=!1})}function me(){L.current=!0,ee.start(0,()=>{L.current=!1})}function xe(){D.current=!1,N.current=!1}function ye(){const re=Q.current,oe=re==="pen"||!re?"mouse":re,Ce=R(),Le=typeof Ce=="function"?Ce():Ce;return typeof Le=="string"?Le:Le[oe]}function Ve(re){const oe=ye();return oe==="intentional"&&re.type!=="click"||oe==="sloppy"&&re.type==="click"}function it(re){var Le;const oe=(Le=v.current.floatingContext)==null?void 0:Le.nodeId,Ce=x&&Go(x.nodesRef.current,oe).some(Ue=>{var qe;return Ep(re,(qe=Ue.context)==null?void 0:qe.elements.floating)});return $(re)||Ce}function Ee(re){if(Ve(re)){re.type!=="click"&&!$(re)&&(ee.clear(),L.current=!1),Y();return}if(v.current.insideReactTree){Y();return}const oe=En(re),Ce=`[${Wg("inert")}]`,Le=_e(oe)?oe.getRootNode():null,Ue=Array.from((af(Le)?Le:qt(d.select("floatingElement"))).querySelectorAll(Ce)),qe=d.context.triggerElements;if(oe&&(qe.hasElement(oe)||qe.hasMatchingElement(st=>lt(st,oe))))return;let Be=_e(oe)?oe:null;for(;Be&&!Ei(Be);){const st=Pi(Be);if(Ei(st)||!_e(st))break;Be=st}if(!(Ue.length&&_e(oe)&&!m3(oe)&&!lt(oe,d.select("floatingElement"))&&Ue.every(st=>!lt(Be,st)))){if(qn(oe)&&!("touches"in re)){const st=Ei(oe),zt=nr(oe),bt=/auto|scroll/,xn=st||bt.test(zt.overflowX),Pn=st||bt.test(zt.overflowY),Mn=xn&&oe.clientWidth>0&&oe.scrollWidth>oe.clientWidth,De=Pn&&oe.clientHeight>0&&oe.scrollHeight>oe.clientHeight,gt=zt.direction==="rtl",nn=De&&(gt?re.offsetX<=oe.offsetWidth-oe.clientWidth:re.offsetX>oe.clientWidth),Me=Mn&&re.offsetY>oe.clientHeight;if(nn||Me)return}if(!it(re)){if(ye()==="intentional"&&L.current){ee.clear(),L.current=!1;return}typeof S=="function"&&!S(re)||J("__outsidePressBubbles")||(d.setOpen(!1,Rt(w3,re)),Y())}}}function Ye(re){ye()!=="sloppy"||re.pointerType==="touch"||!d.select("open")||!t||$(re)||Ee(re)}function Xe(re){if(ye()!=="sloppy"||!d.select("open")||!t||$(re))return;const oe=re.touches[0];oe&&(G.current={startTime:Date.now(),startX:oe.clientX,startY:oe.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},X.start(1e3,()=>{G.current&&(G.current.dismissOnTouchEnd=!1,G.current.dismissOnMouseDown=!1)}))}function wt(re,oe){const Ce=En(re);if(!Ce)return;const Le=et(Ce,re.type,()=>{oe(re),Le()})}function At(re){Q.current="touch",wt(re,Xe)}function tn(re){X.clear(),re.type==="pointerdown"&&(Q.current=re.pointerType),!(re.type==="mousedown"&&G.current&&!G.current.dismissOnMouseDown)&&wt(re,oe=>{oe.type==="pointerdown"?Ye(oe):Ee(oe)})}function ht(re){if(!D.current)return;const oe=N.current;if(xe(),ye()==="intentional"){if(re.type==="pointercancel"){oe&&me();return}if(!it(re)){if(oe){me();return}typeof S=="function"&&!S(re)||(ee.clear(),L.current=!0,Y())}}}function Bt(re){if(ye()!=="sloppy"||!G.current||$(re))return;const oe=re.touches[0];if(!oe)return;const Ce=Math.abs(oe.clientX-G.current.startX),Le=Math.abs(oe.clientY-G.current.startY),Ue=Math.sqrt(Ce*Ce+Le*Le);Ue>5&&(G.current.dismissOnTouchEnd=!0),Ue>10&&(Ee(re),X.clear(),G.current=null)}function vn(re){wt(re,Bt)}function Ft(re){ye()!=="sloppy"||!G.current||$(re)||(G.current.dismissOnTouchEnd&&Ee(re),X.clear(),G.current=null)}function jt(re){wt(re,Ft)}const ct=qt(g),or=fs(r&&fs(et(ct,"keydown",q),et(ct,"compositionstart",fe),et(ct,"compositionend",se)),C&&fs(et(ct,"click",tn,!0),et(ct,"pointerdown",tn,!0),et(ct,"pointerup",ht,!0),et(ct,"pointercancel",ht,!0),et(ct,"mousedown",tn,!0),et(ct,"mouseup",ht,!0),et(ct,"touchstart",At,!0),et(ct,"touchmove",vn,!0),et(ct,"touchend",jt,!0)));return()=>{or(),ne.clear(),ee.clear(),xe(),L.current=!1}},[v,g,r,C,S,p,t,O,P,q,Y,R,J,$,x,d,X]),k.useEffect(Y,[S,Y]);const M=k.useMemo(()=>({onKeyDown:q,[xO[a]]:te,...a!=="intentional"&&{onClick:te}}),[q,te,a]),V=k.useMemo(()=>({onKeyDown:q,onPointerDown:B,onMouseDown:B,onClickCapture:I,onMouseDownCapture(ne){I(),_(ne)},onPointerDownCapture(ne){I(),_(ne)},onMouseUpCapture:I,onTouchEndCapture:I,onTouchMoveCapture:I}),[q,I,_,B]);return k.useMemo(()=>t?{reference:M,floating:V,trigger:M}:{},[t,M,V])}function Q1(n,e,t){let{reference:r,floating:i}=n;const s=pr(e),o=zg(e),a=jg(o),u=Vn(e),h=s==="y",d=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,g=r[a]/2-i[a]/2;let v;switch(u){case"top":v={x:d,y:r.y-i.height};break;case"bottom":v={x:d,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:p};break;case"left":v={x:r.x-i.width,y:p};break;default:v={x:r.x,y:r.y}}switch(bs(e)){case"start":v[o]-=g*(t&&h?-1:1);break;case"end":v[o]+=g*(t&&h?-1:1);break}return v}async function kO(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:u}=n,{boundary:h="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:g=!1,padding:v=0}=Mi(e,n),x=ib(v),S=a[g?p==="floating"?"reference":"floating":p],C=pf(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(S)))==null||t?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:h,rootBoundary:d,strategy:u})),R=p==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),P=await(s.isElement==null?void 0:s.isElement(O))?await(s.getScale==null?void 0:s.getScale(O))||{x:1,y:1}:{x:1,y:1},D=pf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:R,offsetParent:O,strategy:u}):R);return{top:(C.top-D.top+x.top)/P.y,bottom:(D.bottom-C.bottom+x.bottom)/P.y,left:(C.left-D.left+x.left)/P.x,right:(D.right-C.right+x.right)/P.x}}const CO=50,EO=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=o.detectOverflow?o:{...o,detectOverflow:kO},u=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:p}=Q1(h,r,u),g=r,v=0;const x={};for(let b=0;b<s.length;b++){const S=s[b];if(!S)continue;const{name:C,fn:R}=S,{x:O,y:P,data:D,reset:N}=await R({x:d,y:p,initialPlacement:r,placement:g,strategy:i,middlewareData:x,rects:h,platform:a,elements:{reference:n,floating:e}});d=O??d,p=P??p,x[C]={...x[C],...D},N&&v<CO&&(v++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(h=N.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):N.rects),{x:d,y:p}=Q1(h,g,u)),b=-1)}return{x:d,y:p,placement:g,strategy:i,middlewareData:x}},TO=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:u,elements:h}=e,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:b=!0,...S}=Mi(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const C=Vn(i),R=pr(a),O=Vn(a)===a,P=await(u.isRTL==null?void 0:u.isRTL(h.floating)),D=g||(O||!b?[df(a)]:F3(a)),N=x!=="none";!g&&N&&D.push(...W3(a,b,x,P));const L=[a,...D],z=await u.detectOverflow(e,S),Q=[];let G=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&Q.push(z[C]),p){const J=B3(i,o,P);Q.push(z[J[0]],z[J[1]])}if(G=[...G,{placement:i,overflows:Q}],!Q.every(J=>J<=0)){var X,W;const J=(((X=s.flip)==null?void 0:X.index)||0)+1,$=L[J];if($&&(!(p==="alignment"?R!==pr($):!1)||G.every(I=>pr(I.placement)===R?I.overflows[0]>0:!0)))return{data:{index:J,overflows:G},reset:{placement:$}};let te=(W=G.filter(q=>q.overflows[0]<=0).sort((q,I)=>q.overflows[1]-I.overflows[1])[0])==null?void 0:W.placement;if(!te)switch(v){case"bestFit":{var Y;const q=(Y=G.filter(I=>{if(N){const _=pr(I.placement);return _===R||_==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(_=>_>0).reduce((_,B)=>_+B,0)]).sort((I,_)=>I[1]-_[1])[0])==null?void 0:Y[0];q&&(te=q);break}case"initialPlacement":te=a;break}if(i!==te)return{reset:{placement:te}}}return{}}}};function Y1(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function G1(n){return L3.some(e=>n[e]>=0)}const RO=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t,platform:r}=e,{strategy:i="referenceHidden",...s}=Mi(n,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=Y1(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:G1(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=Y1(o,t.floating);return{data:{escapedOffsets:a,escaped:G1(a)}}}default:return{}}}}},ub=new Set(["left","top"]);async function OO(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Vn(t),a=bs(t),u=pr(t)==="y",h=ub.has(o)?-1:1,d=s&&u?-1:1,p=Mi(e,n);let{mainAxis:g,crossAxis:v,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof x=="number"&&(v=a==="end"?x*-1:x),u?{x:v*d,y:g*h}:{x:g*h,y:v*d}}const PO=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:o,middlewareData:a}=e,u=await OO(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},MO=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:u={fn:C=>{let{x:R,y:O}=C;return{x:R,y:O}}},...h}=Mi(n,e),d={x:t,y:r},p=await s.detectOverflow(e,h),g=pr(Vn(i)),v=_g(g);let x=d[v],b=d[g];if(o){const C=v==="y"?"top":"left",R=v==="y"?"bottom":"right",O=x+p[C],P=x-p[R];x=Cm(O,x,P)}if(a){const C=g==="y"?"top":"left",R=g==="y"?"bottom":"right",O=b+p[C],P=b-p[R];b=Cm(O,b,P)}const S=u.fn({...e,[v]:x,[g]:b});return{...S,data:{x:S.x-t,y:S.y-r,enabled:{[v]:o,[g]:a}}}}}},AO=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:u=!0,crossAxis:h=!0}=Mi(n,e),d={x:t,y:r},p=pr(i),g=_g(p);let v=d[g],x=d[p];const b=Mi(a,e),S=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(u){const O=g==="y"?"height":"width",P=s.reference[g]-s.floating[O]+S.mainAxis,D=s.reference[g]+s.reference[O]-S.mainAxis;v<P?v=P:v>D&&(v=D)}if(h){var C,R;const O=g==="y"?"width":"height",P=ub.has(Vn(i)),D=s.reference[p]-s.floating[O]+(P&&((C=o.offset)==null?void 0:C[p])||0)+(P?0:S.crossAxis),N=s.reference[p]+s.reference[O]+(P?0:((R=o.offset)==null?void 0:R[p])||0)-(P?S.crossAxis:0);x<D?x=D:x>N&&(x=N)}return{[g]:v,[p]:x}}}},DO=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:u=()=>{},...h}=Mi(n,e),d=await o.detectOverflow(e,h),p=Vn(i),g=bs(i),v=pr(i)==="y",{width:x,height:b}=s.floating;let S,C;p==="top"||p==="bottom"?(S=p,C=g===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(C=p,S=g==="end"?"top":"bottom");const R=b-d.top-d.bottom,O=x-d.left-d.right,P=Qo(b-d[S],R),D=Qo(x-d[C],O),N=!e.middlewareData.shift;let L=P,z=D;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(z=O),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(L=R),N&&!g){const G=er(d.left,0),X=er(d.right,0),W=er(d.top,0),Y=er(d.bottom,0);v?z=x-2*(G!==0||X!==0?G+X:er(d.left,d.right)):L=b-2*(W!==0||Y!==0?W+Y:er(d.top,d.bottom))}await u({...e,availableWidth:z,availableHeight:L});const Q=await o.getDimensions(a.floating);return x!==Q.width||b!==Q.height?{reset:{rects:!0}}:{}}}};function fb(n){const e=nr(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=qn(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,a=Yo(t)!==s||Yo(r)!==o;return a&&(t=s,r=o),{width:t,height:r,$:a}}function qg(n){return _e(n)?n:n.contextElement}function jo(n){const e=qg(n);if(!qn(e))return ii(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=fb(e);let o=(s?Yo(t.width):t.width)/r,a=(s?Yo(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const IO=ii(0);function hb(n){const e=Ot(n);return!oh()||!e.visualViewport?IO:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function LO(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Ot(n)?!1:e}function to(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=qg(n);let o=ii(1);e&&(r?_e(r)&&(o=jo(r)):o=jo(n));const a=LO(s,t,r)?hb(s):ii(0);let u=(i.left+a.x)/o.x,h=(i.top+a.y)/o.y,d=i.width/o.x,p=i.height/o.y;if(s){const g=Ot(s),v=r&&_e(r)?Ot(r):r;let x=g,b=Sm(x);for(;b&&r&&v!==x;){const S=jo(b),C=b.getBoundingClientRect(),R=nr(b),O=C.left+(b.clientLeft+parseFloat(R.paddingLeft))*S.x,P=C.top+(b.clientTop+parseFloat(R.paddingTop))*S.y;u*=S.x,h*=S.y,d*=S.x,p*=S.y,u+=O,h+=P,x=Ot(b),b=Sm(x)}}return pf({width:d,height:p,x:u,y:h})}function uh(n,e){const t=lh(n).scrollLeft;return e?e.left+t:to(oi(n)).left+t}function db(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-uh(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function NO(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=oi(r),a=e?sh(e.floating):!1;if(r===o||a&&s)return t;let u={scrollLeft:0,scrollTop:0},h=ii(1);const d=ii(0),p=qn(r);if((p||!p&&!s)&&((ll(r)!=="body"||Ga(o))&&(u=lh(r)),p)){const v=to(r);h=jo(r),d.x=v.x+r.clientLeft,d.y=v.y+r.clientTop}const g=o&&!p&&!s?db(o,u):ii(0);return{width:t.width*h.x,height:t.height*h.y,x:t.x*h.x-u.scrollLeft*h.x+d.x+g.x,y:t.y*h.y-u.scrollTop*h.y+d.y+g.y}}function BO(n){return Array.from(n.getClientRects())}function FO(n){const e=oi(n),t=lh(n),r=n.ownerDocument.body,i=er(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=er(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+uh(n);const a=-t.scrollTop;return nr(r).direction==="rtl"&&(o+=er(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const X1=25;function _O(n,e){const t=Ot(n),r=oi(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,u=0;if(i){s=i.width,o=i.height;const d=oh();(!d||d&&e==="fixed")&&(a=i.offsetLeft,u=i.offsetTop)}const h=uh(r);if(h<=0){const d=r.ownerDocument,p=d.body,g=getComputedStyle(p),v=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(r.clientWidth-p.clientWidth-v);x<=X1&&(s-=x)}else h<=X1&&(s+=h);return{width:s,height:o,x:a,y:u}}function jO(n,e){const t=to(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=qn(n)?jo(n):ii(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,u=i*s.x,h=r*s.y;return{width:o,height:a,x:u,y:h}}function J1(n,e,t){let r;if(e==="viewport")r=_O(n,t);else if(e==="document")r=FO(oi(n));else if(_e(e))r=jO(e,t);else{const i=hb(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return pf(r)}function pb(n,e){const t=Pi(n);return t===e||!_e(t)||Ei(t)?!1:nr(t).position==="fixed"||pb(t,e)}function zO(n,e){const t=e.get(n);if(t)return t;let r=Ca(n,[],!1).filter(a=>_e(a)&&ll(a)!=="body"),i=null;const s=nr(n).position==="fixed";let o=s?Pi(n):n;for(;_e(o)&&!Ei(o);){const a=nr(o),u=Ig(o);!u&&a.position==="fixed"&&(i=null),(s?!u&&!i:!u&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Ga(o)&&!u&&pb(n,o))?r=r.filter(d=>d!==o):i=a,o=Pi(o)}return e.set(n,r),r}function WO(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?sh(e)?[]:zO(e,this._c):[].concat(t),r],a=J1(e,o[0],i);let u=a.top,h=a.right,d=a.bottom,p=a.left;for(let g=1;g<o.length;g++){const v=J1(e,o[g],i);u=er(v.top,u),h=Qo(v.right,h),d=Qo(v.bottom,d),p=er(v.left,p)}return{width:h-p,height:d-u,x:p,y:u}}function HO(n){const{width:e,height:t}=fb(n);return{width:e,height:t}}function VO(n,e,t){const r=qn(e),i=oi(e),s=t==="fixed",o=to(n,!0,s,e);let a={scrollLeft:0,scrollTop:0};const u=ii(0);function h(){u.x=uh(i)}if(r||!r&&!s)if((ll(e)!=="body"||Ga(i))&&(a=lh(e)),r){const v=to(e,!0,s,e);u.x=v.x+e.clientLeft,u.y=v.y+e.clientTop}else i&&h();s&&!r&&i&&h();const d=i&&!r&&!s?db(i,a):ii(0),p=o.left+a.scrollLeft-u.x-d.x,g=o.top+a.scrollTop-u.y-d.y;return{x:p,y:g,width:o.width,height:o.height}}function Op(n){return nr(n).position==="static"}function Z1(n,e){if(!qn(n)||nr(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return oi(n)===t&&(t=t.ownerDocument.body),t}function mb(n,e){const t=Ot(n);if(sh(n))return t;if(!qn(n)){let i=Pi(n);for(;i&&!Ei(i);){if(_e(i)&&!Op(i))return i;i=Pi(i)}return t}let r=Z1(n,e);for(;r&&u3(r)&&Op(r);)r=Z1(r,e);return r&&Ei(r)&&Op(r)&&!Ig(r)?t:r||d3(n)||t}const $O=async function(n){const e=this.getOffsetParent||mb,t=this.getDimensions,r=await t(n.floating);return{reference:VO(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function UO(n){return nr(n).direction==="rtl"}const qO={convertOffsetParentRelativeRectToViewportRelativeRect:NO,getDocumentElement:oi,getClippingRect:WO,getOffsetParent:mb,getElementRects:$O,getClientRects:BO,getDimensions:HO,getScale:jo,isElement:_e,isRTL:UO};function gb(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function KO(n,e){let t=null,r;const i=oi(n);function s(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),s();const h=n.getBoundingClientRect(),{left:d,top:p,width:g,height:v}=h;if(a||e(),!g||!v)return;const x=du(p),b=du(i.clientWidth-(d+g)),S=du(i.clientHeight-(p+v)),C=du(d),O={rootMargin:-x+"px "+-b+"px "+-S+"px "+-C+"px",threshold:er(0,Qo(1,u))||1};let P=!0;function D(N){const L=N[0].intersectionRatio;if(L!==u){if(!P)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!gb(h,n.getBoundingClientRect())&&o(),P=!1}try{t=new IntersectionObserver(D,{...O,root:i.ownerDocument})}catch{t=new IntersectionObserver(D,O)}t.observe(n)}return o(!0),s}function ex(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=qg(n),d=i||s?[...h?Ca(h):[],...e?Ca(e):[]]:[];d.forEach(C=>{i&&C.addEventListener("scroll",t,{passive:!0}),s&&C.addEventListener("resize",t)});const p=h&&a?KO(h,t):null;let g=-1,v=null;o&&(v=new ResizeObserver(C=>{let[R]=C;R&&R.target===h&&v&&e&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var O;(O=v)==null||O.observe(e)})),t()}),h&&!u&&v.observe(h),e&&v.observe(e));let x,b=u?to(n):null;u&&S();function S(){const C=to(n);b&&!gb(b,C)&&t(),b=C,x=requestAnimationFrame(S)}return t(),()=>{var C;d.forEach(R=>{i&&R.removeEventListener("scroll",t),s&&R.removeEventListener("resize",t)}),p==null||p(),(C=v)==null||C.disconnect(),v=null,u&&cancelAnimationFrame(x)}}const QO=PO,YO=MO,GO=TO,XO=DO,JO=RO,ZO=AO,eP=(n,e,t)=>{const r=new Map,i={platform:qO,...t},s={...i.platform,_c:r};return EO(n,e,{...i,platform:s})};var tP=typeof document<"u",nP=function(){},Qu=tP?k.useLayoutEffect:nP;function yf(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,i;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!yf(n[r],e[r]))return!1;return!0}if(i=Object.keys(n),t=i.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=t;r--!==0;){const s=i[r];if(!(s==="_owner"&&n.$$typeof)&&!yf(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function yb(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function tx(n,e){const t=yb(n);return Math.round(e*t)/t}function Pp(n){const e=k.useRef(n);return Qu(()=>{e.current=n}),e}function rP(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:u,open:h}=n,[d,p]=k.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[g,v]=k.useState(r);yf(g,r)||v(r);const[x,b]=k.useState(null),[S,C]=k.useState(null),R=k.useCallback(I=>{I!==N.current&&(N.current=I,b(I))},[]),O=k.useCallback(I=>{I!==L.current&&(L.current=I,C(I))},[]),P=s||x,D=o||S,N=k.useRef(null),L=k.useRef(null),z=k.useRef(d),Q=u!=null,G=Pp(u),X=Pp(i),W=Pp(h),Y=k.useCallback(()=>{if(!N.current||!L.current)return;const I={placement:e,strategy:t,middleware:g};X.current&&(I.platform=X.current),eP(N.current,L.current,I).then(_=>{const B={..._,isPositioned:W.current!==!1};J.current&&!yf(z.current,B)&&(z.current=B,Li.flushSync(()=>{p(B)}))})},[g,e,t,X,W]);Qu(()=>{h===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,p(I=>({...I,isPositioned:!1})))},[h]);const J=k.useRef(!1);Qu(()=>(J.current=!0,()=>{J.current=!1}),[]),Qu(()=>{if(P&&(N.current=P),D&&(L.current=D),P&&D){if(G.current)return G.current(P,D,Y);Y()}},[P,D,Y,G,Q]);const $=k.useMemo(()=>({reference:N,floating:L,setReference:R,setFloating:O}),[R,O]),te=k.useMemo(()=>({reference:P,floating:D}),[P,D]),q=k.useMemo(()=>{const I={position:t,left:0,top:0};if(!te.floating)return I;const _=tx(te.floating,d.x),B=tx(te.floating,d.y);return a?{...I,transform:"translate("+_+"px, "+B+"px)",...yb(te.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:_,top:B}},[t,a,te.floating,d.x,d.y]);return k.useMemo(()=>({...d,update:Y,refs:$,elements:te,floatingStyles:q}),[d,Y,$,te,q])}const iP=(n,e)=>{const t=QO(n);return{name:t.name,fn:t.fn,options:[n,e]}},sP=(n,e)=>{const t=YO(n);return{name:t.name,fn:t.fn,options:[n,e]}},oP=(n,e)=>({fn:ZO(n).fn,options:[n,e]}),lP=(n,e)=>{const t=GO(n);return{name:t.name,fn:t.fn,options:[n,e]}},aP=(n,e)=>{const t=XO(n);return{name:t.name,fn:t.fn,options:[n,e]}},cP=(n,e)=>{const t=JO(n);return{name:t.name,fn:t.fn,options:[n,e]}},Ie=(n,e,t,r,i,s,...o)=>{if(o.length>0)throw new Error(sr(1));let a;if(n&&e)a=(u,h,d,p)=>{const g=n(u,h,d,p);return e(g,h,d,p)};else if(n)a=n;else throw new Error("Missing arguments");return a};var Mp={exports:{}},Ap={};/**
|
|
52
|
-
* @license React
|
|
53
|
-
* use-sync-external-store-shim.production.js
|
|
54
|
-
*
|
|
55
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
56
|
-
*
|
|
57
|
-
* This source code is licensed under the MIT license found in the
|
|
58
|
-
* LICENSE file in the root directory of this source tree.
|
|
59
|
-
*/var nx;function uP(){if(nx)return Ap;nx=1;var n=Ua();function e(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,i=n.useEffect,s=n.useLayoutEffect,o=n.useDebugValue;function a(p,g){var v=g(),x=r({inst:{value:v,getSnapshot:g}}),b=x[0].inst,S=x[1];return s(function(){b.value=v,b.getSnapshot=g,u(b)&&S({inst:b})},[p,v,g]),i(function(){return u(b)&&S({inst:b}),p(function(){u(b)&&S({inst:b})})},[p]),o(v),v}function u(p){var g=p.getSnapshot;p=p.value;try{var v=g();return!t(p,v)}catch{return!0}}function h(p,g){return g()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:a;return Ap.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:d,Ap}var rx;function vb(){return rx||(rx=1,Mp.exports=uP()),Mp.exports}var xb=vb(),Dp={exports:{}},Ip={};/**
|
|
60
|
-
* @license React
|
|
61
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
62
|
-
*
|
|
63
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
64
|
-
*
|
|
65
|
-
* This source code is licensed under the MIT license found in the
|
|
66
|
-
* LICENSE file in the root directory of this source tree.
|
|
67
|
-
*/var ix;function fP(){if(ix)return Ip;ix=1;var n=Ua(),e=vb();function t(h,d){return h===d&&(h!==0||1/h===1/d)||h!==h&&d!==d}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,s=n.useRef,o=n.useEffect,a=n.useMemo,u=n.useDebugValue;return Ip.useSyncExternalStoreWithSelector=function(h,d,p,g,v){var x=s(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=a(function(){function C(N){if(!R){if(R=!0,O=N,N=g(N),v!==void 0&&b.hasValue){var L=b.value;if(v(L,N))return P=L}return P=N}if(L=P,r(O,N))return L;var z=g(N);return v!==void 0&&v(L,z)?(O=N,L):(O=N,P=z)}var R=!1,O,P,D=p===void 0?null:p;return[function(){return C(d())},D===null?void 0:function(){return C(D())}]},[d,p,g,v]);var S=i(h,x[0],x[1]);return o(function(){b.hasValue=!0,b.value=S},[S]),u(S),S},Ip}var sx;function hP(){return sx||(sx=1,Dp.exports=fP()),Dp.exports}var dP=hP();const pP=Hg(19),mP=pP?yP:vP;function wb(n,e,t,r,i){return mP(n,e,t,r,i)}function gP(n,e,t,r,i){const s=k.useCallback(()=>e(n.getSnapshot(),t,r,i),[n,e,t,r,i]);return xb.useSyncExternalStore(n.subscribe,s,s)}QR({before(n){n.syncIndex=0,n.didInitialize||(n.syncTick=1,n.syncHooks=[],n.didChangeStore=!0,n.getSnapshot=()=>{let e=!1;for(let t=0;t<n.syncHooks.length;t+=1){const r=n.syncHooks[t],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(e=!0,r.value=i,r.didChange=!1)}return e&&(n.syncTick+=1),n.syncTick})},after(n){n.syncHooks.length>0&&(n.didChangeStore&&(n.didChangeStore=!1,n.subscribe=e=>{const t=new Set;for(const i of n.syncHooks)t.add(i.store);const r=[];for(const i of t)r.push(i.subscribe(e));return()=>{for(const i of r)i()}}),xb.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot))}});function yP(n,e,t,r,i){const s=KR();if(!s)return gP(n,e,t,r,i);const o=s.syncIndex;s.syncIndex+=1;let a;return s.didInitialize?(a=s.syncHooks[o],(a.store!==n||a.selector!==e||!Object.is(a.a1,t)||!Object.is(a.a2,r)||!Object.is(a.a3,i))&&(a.store!==n&&(s.didChangeStore=!0),a.store=n,a.selector=e,a.a1=t,a.a2=r,a.a3=i,a.didChange=!0)):(a={store:n,selector:e,a1:t,a2:r,a3:i,value:e(n.getSnapshot(),t,r,i),didChange:!1},s.syncHooks.push(a)),a.value}function vP(n,e,t,r,i){return dP.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getSnapshot,s=>e(s,t,r,i))}class xP{constructor(e){Je(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Je(this,"getSnapshot",()=>this.state);this.state=e,this.listeners=new Set,this.updateTick=0}setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const t=this.updateTick;for(const r of this.listeners){if(t!==this.updateTick)return;r(e)}}update(e){for(const t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){const e={...this.state};this.setState(e)}use(e,t,r,i){return wb(this,e,t,r,i)}}class Kg extends xP{constructor(e,t={},r){super(e),this.context=t,this.selectors=r}useSyncedValue(e,t){k.useDebugValue(e);const r=this;Pe(()=>{r.state[e]!==t&&r.set(e,t)},[r,e,t])}useSyncedValueWithCleanup(e,t){const r=this;Pe(()=>(r.state[e]!==t&&r.set(e,t),()=>{r.set(e,void 0)}),[r,e,t])}useSyncedValues(e){const t=this,r=Object.values(e);Pe(()=>{t.update(e)},[t,...r])}useControlledProp(e,t){k.useDebugValue(e);const r=this,i=t!==void 0;Pe(()=>{i&&!Object.is(r.state[e],t)&&r.setState({...r.state,[e]:t})},[r,e,t,i])}select(e,t,r,i){const s=this.selectors[e];return s(this.state,t,r,i)}useState(e,t,r,i){return k.useDebugValue(e),wb(this,this.selectors[e],t,r,i)}useContextCallback(e,t){k.useDebugValue(e);const r=ze(t??Tt);this.context[e]=r}useStateSetter(e){const t=k.useRef(void 0);return t.current===void 0&&(t.current=r=>{this.set(e,r)}),t.current}observe(e,t){let r;typeof e=="function"?r=e:r=this.selectors[e];let i=r(this.state);return t(i,i,this),this.subscribe(s=>{const o=r(s);if(!Object.is(i,o)){const a=i;i=o,t(o,a,this)}})}}const wP={open:Ie(n=>n.open),transitionStatus:Ie(n=>n.transitionStatus),domReferenceElement:Ie(n=>n.domReferenceElement),referenceElement:Ie(n=>n.positionReference??n.referenceElement),floatingElement:Ie(n=>n.floatingElement),floatingId:Ie(n=>n.floatingId)};class fh extends Kg{constructor(t){const{syncOnly:r,nested:i,onOpenChange:s,triggerElements:o,...a}=t;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:dO(),nested:i,triggerElements:o},wP);Je(this,"syncOpenEvent",(t,r)=>{(!t||!this.state.open||r!=null&&c3(r))&&(this.context.dataRef.current.openEvent=t?r:void 0)});Je(this,"dispatchOpenChange",(t,r)=>{this.syncOpenEvent(t,r.event);const i={open:t,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",i)});Je(this,"setOpen",(t,r)=>{var i,s,o,a;if(this.syncOnly){(s=(i=this.context).onOpenChange)==null||s.call(i,t,r);return}this.dispatchOpenChange(t,r),(a=(o=this.context).onOpenChange)==null||a.call(o,t,r)});this.syncOnly=r}}function bP(n){const{popupStore:e,treatPopupAsFloatingElement:t=!1,floatingRootContext:r,floatingId:i,nested:s,onOpenChange:o}=n,a=e.useState("open"),u=e.useState("activeTriggerElement"),h=e.useState(t?"popupElement":"positionerElement"),d=e.context.triggerElements,p=o,g=k.useRef(null);r===void 0&&g.current===null&&(g.current=new fh({open:a,transitionStatus:void 0,referenceElement:u,floatingElement:h,triggerElements:d,onOpenChange:p,floatingId:i,syncOnly:!0,nested:s}));const v=r??g.current;return e.useSyncedValue("floatingId",i),Pe(()=>{const x={open:a,floatingId:i,referenceElement:u,floatingElement:h};_e(u)&&(x.domReferenceElement=u),v.state.positionReference===v.state.referenceElement&&(x.positionReference=u),v.update(x)},[a,i,u,h,v]),v.context.onOpenChange=p,v.context.nested=s,v}function bb(n,e=!1,t=!1){const[r,i]=k.useState(n&&e?"idle":void 0),[s,o]=k.useState(n);return n&&!s&&(o(!0),i("starting")),!n&&s&&r!=="ending"&&!t&&i("ending"),!n&&!s&&r==="ending"&&i(void 0),Pe(()=>{if(!n&&s&&r!=="ending"&&t){const a=Si.request(()=>{i("ending")});return()=>{Si.cancel(a)}}},[n,s,r,t]),Pe(()=>{if(!n||e)return;const a=Si.request(()=>{i(void 0)});return()=>{Si.cancel(a)}},[e,n]),Pe(()=>{if(!n||!e)return;n&&s&&r!=="idle"&&i("starting");const a=Si.request(()=>{i("idle")});return()=>{Si.cancel(a)}},[e,n,s,r]),{mounted:s,setMounted:o,transitionStatus:r}}let Ea=(function(n){return n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n})({});const SP={[Ea.startingStyle]:""},kP={[Ea.endingStyle]:""},Qg={transitionStatus(n){return n==="starting"?SP:n==="ending"?kP:null}};function Yg(n,e=!1,t=!0){const r=Bg();return ze((i,s=null)=>{r.cancel();const o=gO(n);if(o==null)return;const a=o,u=()=>{Li.flushSync(i)};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function h(){Promise.all(a.getAnimations().map(d=>d.finished)).then(()=>{s!=null&&s.aborted||u()}).catch(()=>{if(t){s!=null&&s.aborted||u();return}const d=a.getAnimations();!(s!=null&&s.aborted)&&d.length>0&&d.some(p=>p.pending||p.playState!=="finished")&&h()})}if(e){const d=Ea.startingStyle;if(!a.hasAttribute(d)){r.request(h);return}const p=new MutationObserver(()=>{a.hasAttribute(d)||(p.disconnect(),h())});p.observe(a,{attributes:!0,attributeFilter:[d]}),s==null||s.addEventListener("abort",()=>p.disconnect(),{once:!0});return}r.request(h)})}function hh(n){const{enabled:e=!0,open:t,ref:r,onComplete:i}=n,s=ze(i),o=Yg(r,t,!1);k.useEffect(()=>{if(!e)return;const a=new AbortController;return o(s,a.signal),()=>{a.abort()}},[e,t,s,o])}const CP={tabIndex:-1,[p3]:""};function EP(n,e,t=!1){const r=al(),i=Ug()!=null,s=k.useRef(null);n===void 0&&s.current===null&&(s.current=e(r,i));const o=n??s.current;return bP({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:o.setOpen}),{store:o,internalStore:s.current}}function TP(n,e){const t=k.useRef(null),r=k.useRef(null);return k.useCallback(i=>{if(n===void 0)return;let s=!1;if(t.current!==null){const o=t.current,a=r.current,u=e.context.triggerElements.getById(o);a&&u===a&&(e.context.triggerElements.delete(o),s=!0),t.current=null,r.current=null}if(i!==null&&(t.current=n,r.current=i,e.context.triggerElements.add(n,i),s=!0),s){const o=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==o&&e.set("triggerCount",o)}},[e,n])}function RP(n,e,t){const r=(t==null?void 0:t.id)??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t??null)}function OP(n,e,t,r){const i=t.useState("isMountedByTrigger",n),s=TP(n,t),o=ze(a=>{if(s(a),!a)return;const u=t.select("open"),h=t.select("activeTriggerId");if(h===n){t.update({activeTriggerElement:a,...u?r:null});return}h==null&&u&&t.update({activeTriggerId:n,activeTriggerElement:a,...r})});return Pe(()=>{i&&t.update({activeTriggerElement:e.current,...r})},[i,t,e,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function PP(n){const e=n.useState("open"),t=n.useState("triggerCount");Pe(()=>{if(!e){n.state.triggerCount!==0&&n.set("triggerCount",0);return}const r=n.context.triggerElements.size,i={};if(n.state.triggerCount!==r&&(i.triggerCount=r),!n.select("activeTriggerId")&&r===1){const s=n.context.triggerElements.entries().next();if(!s.done){const[o,a]=s.value;i.activeTriggerId=o,i.activeTriggerElement=a}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0)&&n.update(i)},[e,n,t])}function MP(n,e,t){const{mounted:r,setMounted:i,transitionStatus:s}=bb(n);e.useSyncedValues({mounted:r,transitionStatus:s});const o=ze(()=>{var u,h;i(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),(h=(u=e.context).onOpenChangeComplete)==null||h.call(u,!1)}),a=e.useState("preventUnmountingOnClose");return hh({enabled:r&&!n&&!a,open:n,ref:e.context.popupRef,onComplete(){n||o()}}),{forceUnmount:o,transitionStatus:s}}function AP(n,e){n.useSyncedValues(e),Pe(()=>()=>{n.update({activeTriggerProps:Jt,inactiveTriggerProps:Jt,popupProps:Jt})},[n])}class Gg{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){const r=this.idMap.get(e);r!==t&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){const t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(const t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function DP(){return new fh({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Gg,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function IP(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:DP(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Jt,inactiveTriggerProps:Jt,popupProps:Jt}}function LP(n,e,t=!1){return new fh({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:n,floatingId:e,syncOnly:!0,nested:t,onOpenChange:void 0})}const da=Ie(n=>n.triggerIdProp??n.activeTriggerId),Xg=Ie(n=>n.openProp??n.open),ox=Ie(n=>{var t;return(((t=n.popupElement)==null?void 0:t.id)??n.floatingId)||void 0});function Sb(n,e){return e!==void 0&&Xg(n)&&da(n)===e}function NP(n,e){return Sb(n,e)?!0:e!==void 0&&Xg(n)&&da(n)==null&&n.triggerCount===1}const BP={open:Xg,mounted:Ie(n=>n.mounted),transitionStatus:Ie(n=>n.transitionStatus),floatingRootContext:Ie(n=>n.floatingRootContext),triggerCount:Ie(n=>n.triggerCount),preventUnmountingOnClose:Ie(n=>n.preventUnmountingOnClose),payload:Ie(n=>n.payload),activeTriggerId:da,activeTriggerElement:Ie(n=>n.mounted?n.activeTriggerElement:null),popupId:ox,isTriggerActive:Ie((n,e)=>e!==void 0&&da(n)===e),isOpenedByTrigger:Ie((n,e)=>Sb(n,e)),isMountedByTrigger:Ie((n,e)=>e!==void 0&&da(n)===e&&n.mounted),triggerProps:Ie((n,e)=>e?n.activeTriggerProps:n.inactiveTriggerProps),triggerPopupId:Ie((n,e)=>NP(n,e)?ox(n):void 0),popupProps:Ie(n=>n.popupProps),popupElement:Ie(n=>n.popupElement),positionerElement:Ie(n=>n.positionerElement)};function FP(n){const{open:e=!1,onOpenChange:t,elements:r={}}=n,i=al(),s=Ug()!=null,o=br(()=>new fh({open:e,transitionStatus:void 0,onOpenChange:t,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Gg,floatingId:i,syncOnly:!1,nested:s})).current;return Pe(()=>{const a={open:e,floatingId:i};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=_e(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),o.update(a)},[e,i,r.reference,r.floating,o]),o.context.onOpenChange=t,o.context.nested=s,o}function _P(n={}){const{nodeId:e,externalTree:t}=n,r=FP(n),i=n.rootContext||r,s=i.useState("referenceElement"),o=i.useState("floatingElement"),a=i.useState("domReferenceElement"),u=i.useState("open"),h=i.useState("floatingId"),[d,p]=k.useState(null),[g,v]=k.useState(void 0),[x,b]=k.useState(void 0),S=k.useRef(null),C=ch(t),R=k.useMemo(()=>({reference:s,floating:o,domReference:a}),[s,o,a]),O=rP({...n,elements:{...R,...d&&{reference:d}}}),P=_e(g)?g:null,D=x===void 0?i.state.floatingElement:x;i.useSyncedValue("referenceElement",g??null),i.useSyncedValue("domReferenceElement",g===void 0?a:P),i.useSyncedValue("floatingElement",D);const N=k.useCallback(W=>{const Y=_e(W)?{getBoundingClientRect:()=>W.getBoundingClientRect(),getClientRects:()=>W.getClientRects(),contextElement:W}:W;p(Y),O.refs.setReference(Y)},[O.refs]),L=k.useCallback(W=>{(_e(W)||W===null)&&(S.current=W,v(W)),(_e(O.refs.reference.current)||O.refs.reference.current===null||W!==null&&!_e(W))&&O.refs.setReference(W)},[O.refs,v]),z=k.useCallback(W=>{b(W),O.refs.setFloating(W)},[O.refs]),Q=k.useMemo(()=>({...O.refs,setReference:L,setFloating:z,setPositionReference:N,domReference:S}),[O.refs,L,z,N]),G=k.useMemo(()=>({...O.elements,domReference:a}),[O.elements,a]),X=k.useMemo(()=>({...O,dataRef:i.context.dataRef,open:u,onOpenChange:i.setOpen,events:i.context.events,floatingId:h,refs:Q,elements:G,nodeId:e,rootStore:i}),[O,Q,G,e,i,u,h]);return Pe(()=>{a&&(S.current=a)},[a]),Pe(()=>{i.context.dataRef.current.floatingContext=X;const W=C==null?void 0:C.nodesRef.current.find(Y=>Y.id===e);W&&(W.context=X)}),k.useMemo(()=>({...O,context:X,refs:Q,elements:G,rootStore:i}),[O,Q,G,X,i])}const Lp=r3&&G2;function jP(n,e={}){const{enabled:t=!0,delay:r}=e,i="rootStore"in n?n.rootStore:n,{events:s,dataRef:o}=i.context,a=k.useRef(!1),u=k.useRef(null),h=k.useRef(!0),d=eo();k.useEffect(()=>{const g=i.select("domReferenceElement");if(!t)return;const v=Ot(g);function x(){const C=i.select("domReferenceElement");!i.select("open")&&qn(C)&&C===us(qt(C))&&(a.current=!0)}function b(){h.current=!0}function S(){h.current=!1}return fs(et(v,"blur",x),Lp&&et(v,"keydown",b,!0),Lp&&et(v,"pointerdown",S,!0))},[i,t]),k.useEffect(()=>{if(!t)return;function g(v){if(v.reason===hf||v.reason===Lg){const x=i.select("domReferenceElement");_e(x)&&(u.current=x,a.current=!0)}}return s.on("openchange",g),()=>{s.off("openchange",g)}},[s,t,i]);const p=k.useMemo(()=>{function g(){a.current=!1,u.current=null}return{onMouseLeave(){g()},onFocus(v){const x=v.currentTarget;if(a.current){if(u.current===x)return;g()}const b=En(v.nativeEvent);if(_e(b)){if(Lp&&!v.relatedTarget){if(!h.current&&!g3(b))return}else if(!uf(b))return}const S=cf(v.relatedTarget,i.context.triggerElements),{nativeEvent:C,currentTarget:R}=v,O=typeof r=="function"?r():r;if(i.select("open")&&S||O===0||O===void 0){i.setOpen(!0,Rt(qu,C,R));return}d.start(O,()=>{a.current||i.setOpen(!0,Rt(qu,C,R))})},onBlur(v){g();const x=v.relatedTarget,b=v.nativeEvent,S=_e(x)&&x.hasAttribute(Wg("focus-guard"))&&x.getAttribute("data-type")==="outside";d.start(0,()=>{var P;const C=i.select("domReferenceElement"),R=us(qt(C));!x&&R===C||lt((P=o.current.floatingContext)==null?void 0:P.refs.floating.current,R)||lt(C,R)||S||cf(x??R,i.context.triggerElements)||i.setOpen(!1,Rt(qu,b))})}}},[o,r,i,d]);return k.useMemo(()=>t?{reference:p,trigger:p}:{},[t,p])}class Jg{constructor(){Je(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});Je(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Br,this.restTimeout=new Br,this.handleCloseOptions=void 0}static create(){return new Jg}}const vf=new WeakMap;function xf(n){var t,r,i;if(!n.performedPointerEventsMutation)return;const e=n.pointerEventsScopeElement;e&&vf.get(e)===n&&((t=n.pointerEventsScopeElement)==null||t.style.removeProperty("pointer-events"),(r=n.pointerEventsReferenceElement)==null||r.style.removeProperty("pointer-events"),(i=n.pointerEventsFloatingElement)==null||i.style.removeProperty("pointer-events"),vf.delete(e)),n.performedPointerEventsMutation=!1,n.pointerEventsScopeElement=null,n.pointerEventsReferenceElement=null,n.pointerEventsFloatingElement=null}function kb(n,e){const{scopeElement:t,referenceElement:r,floatingElement:i}=e,s=vf.get(t);s&&s!==n&&xf(s),xf(n),n.performedPointerEventsMutation=!0,n.pointerEventsScopeElement=t,n.pointerEventsReferenceElement=r,n.pointerEventsFloatingElement=i,vf.set(t,n),t.style.pointerEvents="none",r.style.pointerEvents="auto",i.style.pointerEvents="auto"}function Zg(n){const e=n.context.dataRef.current,t=br(()=>e.hoverInteractionState??Jg.create()).current;return e.hoverInteractionState||(e.hoverInteractionState=t),rh(e.hoverInteractionState.disposeEffect),e.hoverInteractionState}function zP(n,e={}){const{enabled:t=!0,closeDelay:r=0,nodeId:i}=e,s="rootStore"in n?n.rootStore:n,o=s.useState("open"),a=s.useState("floatingElement"),u=s.useState("domReferenceElement"),{dataRef:h}=s.context,d=ch(),p=Ug(),g=Zg(s),v=eo(),x=ze(()=>{var C;return Z2((C=h.current.openEvent)==null?void 0:C.type,g.interactedInside)}),b=ze(()=>{var C;return x3((C=h.current.openEvent)==null?void 0:C.type)}),S=ze(()=>{xf(g)});Pe(()=>{o||(g.pointerType=void 0,g.restTimeoutPending=!1,g.interactedInside=!1,S())},[o,g,S]),k.useEffect(()=>S,[S]),Pe(()=>{var C,R,O,P,D;if(t&&o&&(C=g.handleCloseOptions)!=null&&C.blockPointerEvents&&b()&&_e(u)&&a){const N=u,L=a,z=qt(a),Q=(O=(R=d==null?void 0:d.nodesRef.current.find(Y=>Y.id===p))==null?void 0:R.context)==null?void 0:O.elements.floating;Q&&(Q.style.pointerEvents="");const G=g.pointerEventsScopeElement!==L?g.pointerEventsScopeElement:null,X=Q!==L?Q:null,W=((D=(P=g.handleCloseOptions)==null?void 0:P.getScope)==null?void 0:D.call(P))??G??X??N.closest("[data-rootownerid]")??z.body;return kb(g,{scopeElement:W,referenceElement:N,floatingElement:L}),()=>{S()}}},[t,o,u,a,g,b,d,p,S]),k.useEffect(()=>{if(!t)return;function C(){return!!(d&&p&&Go(d.nodesRef.current,p).length>0)}function R(z){const Q=ff(r,"close",g.pointerType),G=()=>{s.setOpen(!1,Rt(Fn,z)),d==null||d.events.emit("floating.closed",z)};Q?g.openChangeTimeout.start(Q,G):(g.openChangeTimeout.clear(),G())}function O(z){const Q=En(z);if(!y3(Q)){g.interactedInside=!1;return}g.interactedInside=(Q==null?void 0:Q.closest("[aria-haspopup]"))!=null}function P(){g.openChangeTimeout.clear(),v.clear(),d==null||d.events.off("floating.closed",N),S()}function D(z){var W;if(C()&&d){d.events.on("floating.closed",N);return}if(cf(z.relatedTarget,s.context.triggerElements))return;const Q=((W=h.current.floatingContext)==null?void 0:W.nodeId)??i,G=z.relatedTarget;if(!(d&&Q&&_e(G)&&Go(d.nodesRef.current,Q,!1).some(Y=>{var J;return lt((J=Y.context)==null?void 0:J.elements.floating,G)}))){if(g.handler){g.handler(z);return}S(),x()||R(z)}}function N(z){!d||!p||C()||v.start(0,()=>{d.events.off("floating.closed",N),s.setOpen(!1,Rt(Fn,z)),d.events.emit("floating.closed",z)})}const L=a;return fs(L&&et(L,"mouseenter",P),L&&et(L,"mouseleave",D),L&&et(L,"pointerdown",O,!0),()=>{d==null||d.events.off("floating.closed",N)})},[t,a,s,h,r,i,x,S,g,d,p,v])}const WP={current:null};function HP(n,e={}){var $;const{enabled:t=!0,delay:r=0,handleClose:i=null,mouseOnly:s=!1,restMs:o=0,move:a=!0,triggerElementRef:u=WP,externalTree:h,isActiveTrigger:d=!0,getHandleCloseContext:p,isClosing:g,shouldOpen:v}=e,x="rootStore"in n?n.rootStore:n,{dataRef:b,events:S}=x.context,C=ch(h),R=Zg(x),O=k.useRef(!1),P=Ar(i),D=Ar(r),N=Ar(o),L=Ar(t),z=Ar(v),Q=Ar(g),G=ze(()=>{var te;return Z2((te=b.current.openEvent)==null?void 0:te.type,R.interactedInside)}),X=ze(()=>{var te;return((te=z.current)==null?void 0:te.call(z))!==!1}),W=ze((te,q,I)=>{const _=x.context.triggerElements;if(_.hasElement(q))return!te||!lt(te,q);if(!_e(I))return!1;const B=I;return _.hasMatchingElement(M=>lt(M,B))&&(!te||!lt(te,B))}),Y=ze(()=>{if(!R.handler)return;qt(x.select("domReferenceElement")).removeEventListener("mousemove",R.handler),R.handler=void 0}),J=ze(()=>{xf(R)});return d&&(R.handleCloseOptions=($=P.current)==null?void 0:$.__options),k.useEffect(()=>Y,[Y]),k.useEffect(()=>{if(!t)return;function te(q){q.open?O.current=!1:(O.current=q.reason===Fn,Y(),R.openChangeTimeout.clear(),R.restTimeout.clear(),R.blockMouseMove=!0,R.restTimeoutPending=!1)}return S.on("openchange",te),()=>{S.off("openchange",te)}},[t,S,R,Y]),k.useEffect(()=>{if(!t)return;function te(B,M=!0){const V=ff(D.current,"close",R.pointerType);V?R.openChangeTimeout.start(V,()=>{x.setOpen(!1,Rt(Fn,B)),C==null||C.events.emit("floating.closed",B)}):M&&(R.openChangeTimeout.clear(),x.setOpen(!1,Rt(Fn,B)),C==null||C.events.emit("floating.closed",B))}const q=u.current??(d?x.select("domReferenceElement"):null);if(!_e(q))return;function I(B){var wt;if(R.openChangeTimeout.clear(),R.blockMouseMove=!1,s&&!ka(R.pointerType))return;const M=W1(N.current),V=ff(D.current,"open",R.pointerType),ne=En(B),ee=B.currentTarget??null,fe=x.select("domReferenceElement");let se=ee;if(_e(ne)&&!x.context.triggerElements.hasElement(ne)){for(const At of x.context.triggerElements.elements())if(lt(At,ne)){se=At;break}}_e(ee)&&_e(fe)&&!x.context.triggerElements.hasElement(ee)&<(ee,fe)&&(se=fe);const me=se==null?!1:W(fe,se,ne),xe=x.select("open"),ye=((wt=Q.current)==null?void 0:wt.call(Q))??x.select("transitionStatus")==="ending",Ve=!xe&&ye&&O.current,it=!me&&_e(se)&&_e(fe)&<(fe,se)&&Ve,Ee=M>0&&!V,Ye=me&&(xe||Ve)||it,Xe=!xe||me;if(Ye){X()&&x.setOpen(!0,Rt(Fn,B,se));return}Ee||(V?R.openChangeTimeout.start(V,()=>{Xe&&X()&&x.setOpen(!0,Rt(Fn,B,se))}):Xe&&X()&&x.setOpen(!0,Rt(Fn,B,se)))}function _(B){if(G()){J();return}Y();const M=x.select("domReferenceElement"),V=qt(M);R.restTimeout.clear(),R.restTimeoutPending=!1;const ne=b.current.floatingContext??(p==null?void 0:p());if(cf(B.relatedTarget,x.context.triggerElements))return;if(P.current&&ne){x.select("open")||R.openChangeTimeout.clear();const fe=u.current;R.handler=P.current({...ne,tree:C,x:B.clientX,y:B.clientY,onClose(){J(),Y(),L.current&&!G()&&fe===x.select("domReferenceElement")&&te(B,!0)}}),V.addEventListener("mousemove",R.handler),R.handler(B);return}(R.pointerType==="touch"?!lt(x.select("floatingElement"),B.relatedTarget):!0)&&te(B)}return a?fs(et(q,"mousemove",I,{once:!0}),et(q,"mouseenter",I),et(q,"mouseleave",_)):fs(et(q,"mouseenter",I),et(q,"mouseleave",_))},[Y,J,b,D,x,t,P,R,d,W,G,s,a,N,u,C,L,p,Q,X]),k.useMemo(()=>{if(!t)return;function te(q){R.pointerType=q.pointerType}return{onPointerDown:te,onPointerEnter:te,onMouseMove(q){var fe,se,me;const{nativeEvent:I}=q,_=q.currentTarget,B=x.select("domReferenceElement"),M=x.select("open"),V=W(B,_,q.target);if(s&&!ka(R.pointerType))return;if(M&&V&&((fe=R.handleCloseOptions)!=null&&fe.blockPointerEvents)){const xe=x.select("floatingElement");if(xe){const ye=((me=(se=R.handleCloseOptions)==null?void 0:se.getScope)==null?void 0:me.call(se))??_.ownerDocument.body;kb(R,{scopeElement:ye,referenceElement:_,floatingElement:xe})}}const ne=W1(N.current);if(M&&!V||ne===0||!V&&R.restTimeoutPending&&q.movementX**2+q.movementY**2<2)return;R.restTimeout.clear();function ee(){if(R.restTimeoutPending=!1,G())return;const xe=x.select("open");!R.blockMouseMove&&(!xe||V)&&X()&&x.setOpen(!0,Rt(Fn,I,_))}R.pointerType==="touch"?Li.flushSync(()=>{ee()}):V&&M?ee():(R.restTimeoutPending=!0,R.restTimeout.start(ne,ee))}}},[t,R,G,W,s,x,N,X])}const lx=.1,VP=lx*lx,nt=.5;function pu(n,e,t,r,i,s){return r>=e!=s>=e&&n<=(i-t)*(e-r)/(s-r)+t}function mu(n,e,t,r,i,s,o,a,u,h){let d=!1;return pu(n,e,t,r,i,s)&&(d=!d),pu(n,e,i,s,o,a)&&(d=!d),pu(n,e,o,a,u,h)&&(d=!d),pu(n,e,u,h,t,r)&&(d=!d),d}function $P(n,e,t){return n>=t.x&&n<=t.x+t.width&&e>=t.y&&e<=t.y+t.height}function gu(n,e,t,r,i,s){const o=Math.min(t,i),a=Math.max(t,i),u=Math.min(r,s),h=Math.max(r,s);return n>=o&&n<=a&&e>=u&&e<=h}function UP(n={}){const{blockPointerEvents:e=!1}=n,t=new Br,r=({x:i,y:s,placement:o,elements:a,onClose:u,nodeId:h,tree:d})=>{const p=o==null?void 0:o.split("-")[0];let g=!1,v=null,x=null,b=typeof performance<"u"?performance.now():0;function S(R,O){const P=performance.now(),D=P-b;if(v===null||x===null||D===0)return v=R,x=O,b=P,!1;const N=R-v,L=O-x,z=N*N+L*L,Q=D*D*VP;return v=R,x=O,b=P,z<Q}function C(){t.clear(),u()}return function(O){t.clear();const P=a.domReference,D=a.floating;if(!P||!D||p==null||i==null||s==null)return;const{clientX:N,clientY:L}=O,z=En(O),Q=O.type==="mouseleave",G=lt(D,z),X=lt(P,z);if(G&&(g=!0,!Q))return;if(X&&(g=!1,!Q)){g=!0;return}if(Q&&_e(O.relatedTarget)&<(D,O.relatedTarget))return;function W(){return!!(d&&Go(d.nodesRef.current,h).length>0)}function Y(){W()||C()}if(W())return;const J=P.getBoundingClientRect(),$=D.getBoundingClientRect(),te=i>$.right-$.width/2,q=s>$.bottom-$.height/2,I=$.width>J.width,_=$.height>J.height,B=(I?J:$).left,M=(I?J:$).right,V=(_?J:$).top,ne=(_?J:$).bottom;if(p==="top"&&s>=J.bottom-1||p==="bottom"&&s<=J.top+1||p==="left"&&i>=J.right-1||p==="right"&&i<=J.left+1){Y();return}let ee=!1;switch(p){case"top":ee=gu(N,L,B,J.top+1,M,$.bottom-1);break;case"bottom":ee=gu(N,L,B,$.top+1,M,J.bottom-1);break;case"left":ee=gu(N,L,$.right-1,ne,J.left+1,V);break;case"right":ee=gu(N,L,J.right-1,ne,$.left+1,V);break}if(ee)return;if(g&&!$P(N,L,J)){Y();return}if(!Q&&S(N,L)){Y();return}let fe=!1;switch(p){case"top":{const se=I?nt/2:nt*4,me=I||te?i+se:i-se,xe=I?i-se:te?i+se:i-se,ye=s+nt+1,Ve=te||I?$.bottom-nt:$.top,it=te?I?$.bottom-nt:$.top:$.bottom-nt;fe=mu(N,L,me,ye,xe,ye,$.left,Ve,$.right,it);break}case"bottom":{const se=I?nt/2:nt*4,me=I||te?i+se:i-se,xe=I?i-se:te?i+se:i-se,ye=s-nt,Ve=te||I?$.top+nt:$.bottom,it=te?I?$.top+nt:$.bottom:$.top+nt;fe=mu(N,L,me,ye,xe,ye,$.left,Ve,$.right,it);break}case"left":{const se=_?nt/2:nt*4,me=_||q?s+se:s-se,xe=_?s-se:q?s+se:s-se,ye=i+nt+1,Ve=q||_?$.right-nt:$.left,it=q?_?$.right-nt:$.left:$.right-nt;fe=mu(N,L,Ve,$.top,it,$.bottom,ye,me,ye,xe);break}case"right":{const se=_?nt/2:nt*4,me=_||q?s+se:s-se,xe=_?s-se:q?s+se:s-se,ye=i-nt,Ve=q||_?$.left+nt:$.right,it=q?_?$.left+nt:$.right:$.left+nt;fe=mu(N,L,ye,me,ye,xe,Ve,$.top,it,$.bottom);break}}fe?g||t.start(40,Y):Y()}};return r.__options={...n,blockPointerEvents:e},r}const qP={...BP,disabled:Ie(n=>n.disabled),instantType:Ie(n=>n.instantType),isInstantPhase:Ie(n=>n.isInstantPhase),trackCursorAxis:Ie(n=>n.trackCursorAxis),disableHoverablePopup:Ie(n=>n.disableHoverablePopup),lastOpenChangeReason:Ie(n=>n.openChangeReason),closeOnClick:Ie(n=>n.closeOnClick),closeDelay:Ie(n=>n.closeDelay),hasViewport:Ie(n=>n.hasViewport)};class e0 extends Kg{constructor(t,r,i=!1){const s=new Gg,o={...KP(),...t};o.floatingRootContext=LP(s,r,i);super(o,{popupRef:k.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:s},qP);Je(this,"setOpen",(t,r)=>{var h,d;const i=r.reason,s=i===Fn,o=t&&i===qu,a=!t&&(i===hf||i===Lg);if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},(d=(h=this.context).onOpenChange)==null||d.call(h,t,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,r);const u=()=>{const p={open:t,openChangeReason:i};o?p.instantType="focus":a?p.instantType="dismiss":i===Fn&&(p.instantType=void 0),RP(p,t,r.trigger),this.update(p)};s?Li.flushSync(u):u()})}cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,Rt(hf,t))}static useStore(t,r){return EP(t,(s,o)=>new e0(r,s,o)).store}}function KP(){return{...IP(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const QP=Q2(function(e){const{disabled:t=!1,defaultOpen:r=!1,open:i,disableHoverablePopup:s=!1,trackCursorAxis:o="none",actionsRef:a,onOpenChange:u,onOpenChangeComplete:h,handle:d,triggerId:p,defaultTriggerId:g=null,children:v}=e,x=e0.useStore(d==null?void 0:d.store,{open:r,openProp:i,activeTriggerId:g,triggerIdProp:p});XR(()=>{i===void 0&&x.state.open===!1&&r===!0&&x.update({open:!0,activeTriggerId:g})}),x.useControlledProp("openProp",i),x.useControlledProp("triggerIdProp",p),x.useContextCallback("onOpenChange",u),x.useContextCallback("onOpenChangeComplete",h);const b=x.useState("open"),S=!t&&b,C=x.useState("activeTriggerId"),R=x.useState("mounted"),O=x.useState("payload");x.useSyncedValues({trackCursorAxis:o,disableHoverablePopup:s}),x.useSyncedValue("disabled",t),PP(x);const{forceUnmount:P,transitionStatus:D}=MP(S,x),N=x.useState("isInstantPhase"),L=x.useState("instantType"),z=x.useState("lastOpenChangeReason"),Q=k.useRef(null);Pe(()=>{b&&t&&x.setOpen(!1,Rt(b3))},[b,t,x]),Pe(()=>{D==="ending"&&z===ah||D!=="ending"&&N?(L!=="delay"&&(Q.current=L),x.set("instantType","delay")):Q.current!==null&&(x.set("instantType",Q.current),Q.current=null)},[D,N,z,L,x]),Pe(()=>{S&&C==null&&x.set("payload",void 0)},[x,C,S]);const G=k.useCallback(()=>{x.setOpen(!1,Rt(S3))},[x]);k.useImperativeHandle(a,()=>({unmount:P,close:G}),[P,G]);const X=S||R||!t&&o!=="none";return E.jsxs(Y2.Provider,{value:x,children:[X&&E.jsx(YP,{store:x,disabled:t,trackCursorAxis:o}),typeof v=="function"?v({payload:O}):v]})});function YP({store:n,disabled:e,trackCursorAxis:t}){const r=n.useState("floatingRootContext"),i=SO(r,{enabled:!e,referencePress:()=>n.select("closeOnClick")}),s=vO(r,{enabled:!e&&t!=="none",axis:t==="none"?void 0:t}),o=k.useMemo(()=>hs(s.reference,i.reference),[s.reference,i.reference]),a=k.useMemo(()=>hs(s.trigger,i.trigger),[s.trigger,i.trigger]),u=k.useMemo(()=>hs(CP,s.floating,i.floating),[s.floating,i.floating]);return AP(n,{activeTriggerProps:o,inactiveTriggerProps:a,popupProps:u}),null}let t0=(function(n){return n.open="data-open",n.closed="data-closed",n[n.startingStyle=Ea.startingStyle]="startingStyle",n[n.endingStyle=Ea.endingStyle]="endingStyle",n.anchorHidden="data-anchor-hidden",n.side="data-side",n.align="data-align",n})({}),Cb=(function(n){return n.popupOpen="data-popup-open",n.pressed="data-pressed",n})({});const GP={[Cb.popupOpen]:""},XP={[t0.open]:""},JP={[t0.closed]:""},ZP={[t0.anchorHidden]:""},eM={open(n){return n?GP:null}},Eb={open(n){return n?XP:JP},anchorHidden(n){return n?ZP:null}};function Ta(n){return al(n,"base-ui")}const Tb=k.createContext(void 0);function tM(){return k.useContext(Tb)}let nM=(function(n){return n[n.popupOpen=Cb.popupOpen]="popupOpen",n.triggerDisabled="data-trigger-disabled",n})({});const rM=600,Rb="data-base-ui-tooltip-trigger";function ax(n){if("composedPath"in n){const t=n.composedPath();for(let r=0;r<t.length;r+=1){const i=t[r];if(_e(i))return i}}const e=n.target;return _e(e)?e:null}function iM(n){let e=n;for(;e;){if(e.hasAttribute(Rb))return e;const t=e.parentElement;if(t){e=t;continue}const r=e.getRootNode();e="host"in r&&_e(r.host)?r.host:null}return null}const sM=YR(function(e,t){const{render:r,className:i,style:s,handle:o,payload:a,disabled:u,delay:h,closeOnClick:d=!0,closeDelay:p,id:g,...v}=e,x=Qa(!0),b=(o==null?void 0:o.store)??x;if(!b)throw new Error(sr(82));const S=Ta(g),C=b.useState("isTriggerActive",S),R=b.useState("isOpenedByTrigger",S),O=b.useState("floatingRootContext"),P=k.useRef(null),D=h??rM,N=p??0,{registerTrigger:L,isMountedByThisTrigger:z}=OP(S,P,b,{payload:a,closeOnClick:d,closeDelay:N}),Q=tM(),{delayRef:G,isInstantPhase:X,hasProvider:W}=C3(O,{open:R}),Y=Zg(O);b.useSyncedValue("isInstantPhase",X);const J=b.useState("disabled"),$=u??J,te=Ar($),q=b.useState("trackCursorAxis"),I=b.useState("disableHoverablePopup"),_=k.useRef(!1),B=eo(),M=k.useRef(void 0);function V(){const Ee=Q==null?void 0:Q.delay,Ye=typeof G.current=="object"?G.current.open:void 0;let Xe=D;return W&&(Ye!==0?Xe=h??Ee??D:Xe=0),Xe}function ne(Ee){const Ye=P.current;if(!Ye||!Ee)return!1;const Xe=iM(Ee);return Xe!==null&&Xe!==Ye&<(Ye,Xe)}function ee(Ee){const Ye=ne(Ee);return _.current=Ye,Ye&&(Y.openChangeTimeout.clear(),Y.restTimeout.clear(),Y.restTimeoutPending=!1,B.clear()),Ye}const fe=HP(O,{enabled:!$,mouseOnly:!0,move:!1,handleClose:!I&&q!=="both"?UP():null,restMs:V,delay(){const Ee=typeof G.current=="object"?G.current.close:void 0;let Ye=N;return p==null&&W&&(Ye=Ee),{close:Ye}},triggerElementRef:P,isActiveTrigger:C,isClosing:()=>b.select("transitionStatus")==="ending",shouldOpen(){return!_.current}}),se=jP(O,{enabled:!$}).reference,me=Ee=>{const Ye=_.current,Xe=ax(Ee),wt=ee(Xe),At=P.current,tn=At&&Xe&<(At,Xe);if(wt&&b.select("open")&&b.select("lastOpenChangeReason")===Fn){b.setOpen(!1,Rt(Fn,Ee));return}if(Ye&&!wt&&tn&&!te.current&&!b.select("open")&&At&&ka(M.current)){const ht=()=>{!_.current&&!te.current&&!b.select("open")&&b.setOpen(!0,Rt(Fn,Ee,At))},Bt=V();Bt===0?(B.clear(),ht()):B.start(Bt,ht)}},xe=b.useState("triggerProps",z);return On("button",e,{state:{open:R},ref:[t,L,P],props:[fe,se,z||q!=="none"?xe:void 0,{onMouseOver(Ee){me(Ee.nativeEvent)},onFocus(Ee){ne(ax(Ee.nativeEvent))&&Ee.preventBaseUIHandler()},onMouseLeave(){_.current=!1,B.clear(),M.current=void 0},onPointerEnter(Ee){M.current=Ee.pointerType},onPointerDown(Ee){M.current=Ee.pointerType,b.set("closeOnClick",d),d&&!b.select("open")&&b.cancelPendingOpen(Ee.nativeEvent)},onClick(Ee){d&&!b.select("open")&&b.cancelPendingOpen(Ee.nativeEvent)},id:S,[nM.triggerDisabled]:$?"":void 0,[Rb]:$?void 0:""},v],stateAttributesMapping:eM})}),Ob=k.createContext(void 0);function oM(){const n=k.useContext(Ob);if(n===void 0)throw new Error(sr(70));return n}const Pb=k.forwardRef(function(e,t){const{children:r,container:i,className:s,render:o,style:a,...u}=e,{portalNode:h,portalSubtree:d}=hO({container:i,ref:t,componentProps:e,elementProps:u});return!d&&!h?null:E.jsxs(k.Fragment,{children:[d,h&&Li.createPortal(r,h)]})}),lM=k.forwardRef(function(e,t){const{keepMounted:r=!1,...i}=e;return Qa().useState("mounted")||r?E.jsx(Ob.Provider,{value:r,children:E.jsx(Pb,{ref:t,...i})}):null}),Mb=k.createContext(void 0);function Ab(){const n=k.useContext(Mb);if(n===void 0)throw new Error(sr(71));return n}const aM=k.createContext(void 0);function Db(){const n=k.useContext(aM);return(n==null?void 0:n.direction)??"ltr"}const cM=n=>({name:"arrow",options:n,async fn(e){var _,B;const{x:t,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:u}=e,{element:h,padding:d=0,offsetParent:p="real"}=Mi(n,e)||{};if(h==null)return{};const g=ib(d),v={x:t,y:r},x=zg(i),b=jg(x),S=await o.getDimensions(h),C=x==="y",R=C?"top":"left",O=C?"bottom":"right",P=C?"clientHeight":"clientWidth",D=s.reference[b]+s.reference[x]-v[x]-s.floating[b],N=v[x]-s.reference[x],L=p==="real"?await((_=o.getOffsetParent)==null?void 0:_.call(o,h)):a.floating;let z=a.floating[P]||s.floating[b];(!z||!await((B=o.isElement)==null?void 0:B.call(o,L)))&&(z=a.floating[P]||s.floating[b]);const Q=D/2-N/2,G=z/2-S[b]/2-1,X=Math.min(g[R],G),W=Math.min(g[O],G),Y=X,J=z-S[b]-W,$=z/2-S[b]/2+Q,te=Cm(Y,$,J),q=!u.arrow&&bs(i)!=null&&$!==te&&s.reference[b]/2-($<Y?X:W)-S[b]/2<0,I=q?$<Y?$-Y:$-J:0;return{[x]:v[x]+I,data:{[x]:te,centerOffset:$-te-I,...q&&{alignmentOffset:I}},reset:q}}}),uM=(n,e)=>({...cM(n),options:[n,e]}),fM={name:"hide",async fn(n){var a;const{width:e,height:t,x:r,y:i}=n.rects.reference,s=e===0&&t===0&&r===0&&i===0;return{data:{referenceHidden:((a=(await cP().fn(n)).data)==null?void 0:a.referenceHidden)||s}}}},Yu={sideX:"left",sideY:"top"},hM={name:"adaptiveOrigin",async fn(n){var R,O;const{x:e,y:t,rects:{floating:r},elements:{floating:i},platform:s,strategy:o,placement:a}=n,u=Ot(i),h=u.getComputedStyle(i);if(!(h.transitionDuration!=="0s"&&h.transitionDuration!==""))return{x:e,y:t,data:Yu};const p=await((R=s.getOffsetParent)==null?void 0:R.call(s,i));let g={width:0,height:0};if(o==="fixed"&&(u!=null&&u.visualViewport))g={width:u.visualViewport.width,height:u.visualViewport.height};else if(p===u){const P=qt(i);g={width:P.documentElement.clientWidth,height:P.documentElement.clientHeight}}else await((O=s.isElement)==null?void 0:O.call(s,p))&&(g=await s.getDimensions(p));const v=Vn(a);let x=e,b=t;v==="left"&&(x=g.width-(e+r.width)),v==="top"&&(b=g.height-(t+r.height));const S=v==="left"?"right":Yu.sideX,C=v==="top"?"bottom":Yu.sideY;return{x,y:b,data:{sideX:S,sideY:C}}}};function Ib(n,e,t){const r=n==="inline-start"||n==="inline-end";return{top:"top",right:r?t?"inline-start":"inline-end":"right",bottom:"bottom",left:r?t?"inline-end":"inline-start":"left"}[e]}function cx(n,e,t){const{rects:r,placement:i}=n;return{side:Ib(e,Vn(i),t),align:bs(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function dM(n){var gt,nn;const{anchor:e,positionMethod:t="absolute",side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,collisionBoundary:a,collisionPadding:u=5,sticky:h=!1,arrowPadding:d=5,disableAnchorTracking:p=!1,inline:g,keepMounted:v=!1,floatingRootContext:x,mounted:b,collisionAvoidance:S,shiftCrossAxis:C=!1,nodeId:R,adaptiveOrigin:O,lazyFlip:P=!1,externalTree:D}=n,[N,L]=k.useState(null);!b&&N!==null&&L(null);const z=S.side||"flip",Q=S.align||"flip",G=S.fallbackAxisSide||"end",X=typeof e=="function"?e:void 0,W=ze(X),Y=X?W:e,J=Ar(e),$=Ar(b),q=Db()==="rtl",I=N||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":q?"left":"right","inline-start":q?"right":"left"}[r],_=s==="center"?I:`${I}-${s}`;let B=u;const M=1,V=r==="bottom"?M:0,ne=r==="top"?M:0,ee=r==="right"?M:0,fe=r==="left"?M:0;typeof B=="number"?B={top:B+V,right:B+fe,bottom:B+ne,left:B+ee}:B&&(B={top:(B.top||0)+V,right:(B.right||0)+fe,bottom:(B.bottom||0)+ne,left:(B.left||0)+ee});const se={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:B},me=k.useRef(null),xe=Ar(i),ye=Ar(o),Ve=typeof i!="function"?i:0,it=typeof o!="function"?o:0,Ee=[];g&&Ee.push(g),Ee.push(iP(Me=>{const Ze=cx(Me,r,q),rn=typeof xe.current=="function"?xe.current(Ze):xe.current,Wt=typeof ye.current=="function"?ye.current(Ze):ye.current;return{mainAxis:rn,crossAxis:Wt,alignmentAxis:Wt}},[Ve,it,q,r]));const Ye=Q==="none"&&z!=="shift",Xe=!Ye&&(h||C||z==="shift"),wt=z==="none"?null:lP({...se,padding:{top:B.top+M,right:B.right+M,bottom:B.bottom+M,left:B.left+M},mainAxis:!C&&z==="flip",crossAxis:Q==="flip"?"alignment":!1,fallbackAxisSideDirection:G}),At=Ye?null:sP(Me=>{const Ze=qt(Me.elements.floating).documentElement;return{...se,rootBoundary:C?{x:0,y:0,width:Ze.clientWidth,height:Ze.clientHeight}:void 0,mainAxis:Q!=="none",crossAxis:Xe,limiter:h||C?void 0:oP(rn=>{if(!me.current)return{};const{width:Wt,height:wn}=me.current.getBoundingClientRect(),sn=pr(Vn(rn.placement)),zr=sn==="y"?Wt:wn,Wr=sn==="y"?B.left+B.right:B.top+B.bottom;return{offset:zr/2+Wr/2}})}},[se,h,C,B,Q]);z==="shift"||Q==="shift"||s==="center"?Ee.push(At,wt):Ee.push(wt,At),Ee.push(aP({...se,apply({elements:{floating:Me},availableWidth:Ze,availableHeight:rn,rects:Wt}){if(!$.current)return;const wn=Me.style;wn.setProperty("--available-width",`${Ze}px`),wn.setProperty("--available-height",`${rn}px`);const sn=Ot(Me).devicePixelRatio||1,{x:zr,y:Wr,width:kr,height:ci}=Wt.reference,Cs=(Math.round((zr+kr)*sn)-Math.round(zr*sn))/sn,ui=(Math.round((Wr+ci)*sn)-Math.round(Wr*sn))/sn;wn.setProperty("--anchor-width",`${Cs}px`),wn.setProperty("--anchor-height",`${ui}px`)}}),uM(Me=>({element:me.current||qt(Me.elements.floating).createElement("div"),padding:d,offsetParent:"floating"}),[d]),{name:"transformOrigin",fn(Me){var pl,ml,rc;const{elements:Ze,middlewareData:rn,placement:Wt,rects:wn,y:sn}=Me,zr=Vn(Wt),Wr=pr(zr),kr=me.current,ci=((pl=rn.arrow)==null?void 0:pl.x)||0,Cs=((ml=rn.arrow)==null?void 0:ml.y)||0,ui=(kr==null?void 0:kr.clientWidth)||0,Dh=(kr==null?void 0:kr.clientHeight)||0,fi=ci+ui/2,Es=Cs+Dh/2,oo=Math.abs(((rc=rn.shift)==null?void 0:rc.y)||0),dl=wn.reference.height/2,Ts=typeof i=="function"?i(cx(Me,r,q)):i,Ih=oo>Ts,Lh={top:`${fi}px calc(100% + ${Ts}px)`,bottom:`${fi}px ${-Ts}px`,left:`calc(100% + ${Ts}px) ${Es}px`,right:`${-Ts}px ${Es}px`}[zr],hi=`${fi}px ${wn.reference.y+dl-sn}px`;return Ze.floating.style.setProperty("--transform-origin",Xe&&Wr==="y"&&Ih?hi:Lh),{}}},fM,O),Pe(()=>{!b&&x&&x.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[b,x]);const tn=k.useMemo(()=>({elementResize:!p&&typeof ResizeObserver<"u",layoutShift:!p&&typeof IntersectionObserver<"u"}),[p]),{refs:ht,elements:Bt,x:vn,y:Ft,middlewareData:jt,update:ct,placement:or,context:re,isPositioned:oe,floatingStyles:Ce}=_P({rootContext:x,open:v?b:void 0,placement:_,middleware:Ee,strategy:t,whileElementsMounted:v?void 0:(...Me)=>ex(...Me,tn),nodeId:R,externalTree:D}),{sideX:Le,sideY:Ue}=jt.adaptiveOrigin||Yu,qe=oe?t:"fixed",Be=k.useMemo(()=>{const Me=O?{position:qe,[Le]:vn,[Ue]:Ft}:{position:qe,...Ce};return oe||(Me.opacity=0),Me},[O,qe,Le,vn,Ue,Ft,Ce,oe]),st=k.useRef(null);Pe(()=>{if(!b)return;const Me=J.current,Ze=typeof Me=="function"?Me():Me,Wt=(ux(Ze)?Ze.current:Ze)||null||null;Wt!==st.current&&(ht.setPositionReference(Wt),st.current=Wt)},[b,ht,Y,J]),k.useEffect(()=>{if(!b)return;const Me=J.current;typeof Me!="function"&&ux(Me)&&Me.current!==st.current&&(ht.setPositionReference(Me.current),st.current=Me.current)},[b,ht,Y,J]),k.useEffect(()=>{if(v&&b&&Bt.domReference&&Bt.floating)return ex(Bt.domReference,Bt.floating,ct,tn)},[v,b,Bt,ct,tn]);const zt=Vn(or),bt=Ib(r,zt,q),xn=bs(or)||"center",Pn=!!((gt=jt.hide)!=null&>.referenceHidden);Pe(()=>{P&&b&&oe&&L(zt)},[P,b,oe,zt]);const Mn=k.useMemo(()=>{var Me,Ze;return{position:"absolute",top:(Me=jt.arrow)==null?void 0:Me.y,left:(Ze=jt.arrow)==null?void 0:Ze.x}},[jt.arrow]),De=((nn=jt.arrow)==null?void 0:nn.centerOffset)!==0;return k.useMemo(()=>({positionerStyles:Be,arrowStyles:Mn,arrowRef:me,arrowUncentered:De,side:bt,align:xn,physicalSide:zt,anchorHidden:Pn,refs:ht,context:re,isPositioned:oe,update:ct}),[Be,Mn,me,De,bt,xn,zt,Pn,ht,re,oe,ct])}function ux(n){return n!=null&&"current"in n}function Lb(n){return n==="starting"?rO:Jt}function pM(n,e,{styles:t,transitionStatus:r,props:i,refs:s,hidden:o,inert:a=!1}){const u={...t};return a&&(u.pointerEvents="none"),On("div",n,{state:e,ref:s,props:[{role:"presentation",hidden:o,style:u},Lb(r),i],stateAttributesMapping:Eb})}const mM=k.forwardRef(function(e,t){const{render:r,className:i,anchor:s,positionMethod:o="absolute",side:a="top",align:u="center",sideOffset:h=0,alignOffset:d=0,collisionBoundary:p="clipping-ancestors",collisionPadding:g=5,arrowPadding:v=5,sticky:x=!1,disableAnchorTracking:b=!1,collisionAvoidance:S=aO,style:C,...R}=e,O=Qa(),P=oM(),D=O.useState("open"),N=O.useState("mounted"),L=O.useState("trackCursorAxis"),z=O.useState("disableHoverablePopup"),Q=O.useState("floatingRootContext"),G=O.useState("instantType"),X=O.useState("transitionStatus"),W=O.useState("hasViewport"),Y=dM({anchor:s,positionMethod:o,floatingRootContext:Q,mounted:N,side:a,sideOffset:h,align:u,alignOffset:d,collisionBoundary:p,collisionPadding:g,sticky:x,arrowPadding:v,disableAnchorTracking:b,keepMounted:P,collisionAvoidance:S,adaptiveOrigin:W?hM:void 0}),J=k.useMemo(()=>({open:D,side:Y.side,align:Y.align,anchorHidden:Y.anchorHidden,instant:L!=="none"?"tracking-cursor":G}),[D,Y.side,Y.align,Y.anchorHidden,L,G]),$=pM(e,J,{styles:Y.positionerStyles,transitionStatus:X,props:R,refs:[t,O.useStateSetter("positionerElement")],hidden:!N,inert:!D||L==="both"||z});return E.jsx(Mb.Provider,{value:Y,children:$})}),gM={...Eb,...Qg},yM=k.forwardRef(function(e,t){const{render:r,className:i,style:s,...o}=e,a=Qa(),{side:u,align:h}=Ab(),d=a.useState("open"),p=a.useState("instantType"),g=a.useState("transitionStatus"),v=a.useState("popupProps"),x=a.useState("floatingRootContext"),b=a.useState("disabled"),S=a.useState("closeDelay");hh({open:d,ref:a.context.popupRef,onComplete(){var P,D;d&&((D=(P=a.context).onOpenChangeComplete)==null||D.call(P,!0))}}),zP(x,{enabled:!b,closeDelay:S});const C=a.useStateSetter("popupElement");return On("div",e,{state:{open:d,side:u,align:h,instant:p,transitionStatus:g},ref:[t,a.context.popupRef,C],props:[v,Lb(g),o],stateAttributesMapping:gM})}),vM=function(e){const{delay:t,closeDelay:r,timeout:i=400}=e,s=k.useMemo(()=>({delay:t,closeDelay:r}),[t,r]),o=k.useMemo(()=>({open:t,close:r}),[t,r]);return E.jsx(Tb.Provider,{value:s,children:E.jsx(k3,{delay:o,timeoutMs:i,children:e.children})})};let xM=(function(n){return n.popupWidth="--popup-width",n.popupHeight="--popup-height",n})({});function Nb(n){return Hg(19)?n:n?"true":void 0}function wM(n){const[e,t]=k.useState({current:n,previous:null});return n!==e.current&&t({current:n,previous:e.current}),e.previous}function fx(n){const e=nr(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=qn(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r;return(Yo(t)!==s||Yo(r)!==o)&&(t=s,r=o),{width:t,height:r}}const bM=()=>!0;function SM(n){const{popupElement:e,positionerElement:t,content:r,mounted:i,enabled:s=bM,onMeasureLayout:o,onMeasureLayoutComplete:a,side:u,direction:h}=n,d=Yg(e,!0,!1),p=Bg(),g=k.useRef(null),v=k.useRef(null),x=k.useRef(!0),b=k.useRef(Tt),S=ze(o),C=ze(a),R=k.useMemo(()=>{let O=u==="top",P=u==="left";return h==="rtl"?(O=O||u==="inline-end",P=P||u==="inline-end"):(O=O||u==="inline-start",P=P||u==="inline-start"),O?{position:"absolute",[u==="top"?"bottom":"top"]:"0",[P?"right":"left"]:"0"}:Jt},[u,h]);Pe(()=>{if(!i||!s()||typeof ResizeObserver!="function"){b.current=Tt,x.current=!0,g.current=null,v.current=null;return}if(!e||!t)return;b.current=hx(e,R);const O=new ResizeObserver(Y=>{const J=Y[0];J&&(v.current={width:Math.ceil(J.borderBoxSize[0].inlineSize),height:Math.ceil(J.borderBoxSize[0].blockSize)})});O.observe(e),yu(e,"auto");const P=Gu(e,"position","static"),D=Gu(e,"transform","none"),N=Gu(e,"scale","1"),L=hx(t,{"--available-width":"max-content","--available-height":"max-content"});function z(){P(),D(),L()}function Q(){z(),N()}if(S==null||S(),x.current||g.current===null){Jl(t,"max-content");const Y=fx(e);return g.current=Y,Jl(t,Y),Q(),C==null||C(null,Y),x.current=!1,()=>{O.disconnect(),b.current(),b.current=Tt}}yu(e,"auto"),Jl(t,"max-content");const G=g.current??v.current,X=fx(e);if(g.current=X,!G)return Jl(t,X),Q(),C==null||C(null,X),()=>{O.disconnect(),p.cancel(),b.current(),b.current=Tt};yu(e,G),Q(),C==null||C(G,X),Jl(t,X);const W=new AbortController;return p.request(()=>{yu(e,X),d(()=>{e.style.setProperty("--popup-width","auto"),e.style.setProperty("--popup-height","auto")},W.signal)}),()=>{O.disconnect(),W.abort(),p.cancel(),b.current(),b.current=Tt}},[r,e,t,d,p,s,i,S,C,R])}function Gu(n,e,t){const r=n.style.getPropertyValue(e);return n.style.setProperty(e,t),()=>{n.style.setProperty(e,r)}}function hx(n,e){const t=[];for(const[r,i]of Object.entries(e))t.push(Gu(n,r,i));return t.length?()=>{t.forEach(r=>r())}:Tt}function yu(n,e){const t=e==="auto"?"auto":`${e.width}px`,r=e==="auto"?"auto":`${e.height}px`;n.style.setProperty("--popup-width",t),n.style.setProperty("--popup-height",r)}function Jl(n,e){const t=e==="max-content"?"max-content":`${e.width}px`,r=e==="max-content"?"max-content":`${e.height}px`;n.style.setProperty("--positioner-width",t),n.style.setProperty("--positioner-height",r)}function kM(n){const{store:e,side:t,cssVars:r,children:i}=n,s=Db(),o=e.useState("activeTriggerElement"),a=e.useState("activeTriggerId"),u=e.useState("open"),h=e.useState("payload"),d=e.useState("mounted"),p=e.useState("popupElement"),g=e.useState("positionerElement"),v=wM(u?o:null),x=TM(a,h),b=k.useRef(null),[S,C]=k.useState(null),[R,O]=k.useState(null),P=k.useRef(null),D=k.useRef(null),N=Yg(P,!0,!1),L=Bg(),[z,Q]=k.useState(null),[G,X]=k.useState(!1);Pe(()=>(e.set("hasViewport",!0),()=>{e.set("hasViewport",!1)}),[e]);const W=ze(()=>{var I,_,B;(I=P.current)==null||I.style.setProperty("animation","none"),(_=P.current)==null||_.style.setProperty("transition","none"),(B=D.current)==null||B.style.setProperty("display","none")}),Y=ze(I=>{var _,B,M;(_=P.current)==null||_.style.removeProperty("animation"),(B=P.current)==null||B.style.removeProperty("transition"),(M=D.current)==null||M.style.removeProperty("display"),I&&Q(I)}),J=k.useRef(null);Pe(()=>{if(o&&v&&o!==v&&J.current!==o&&b.current){C(b.current),X(!0);const I=EM(v,o);O(I),L.request(()=>{Li.flushSync(()=>{X(!1)}),N(()=>{C(null),Q(null),b.current=null})}),J.current=o}},[o,v,S,N,L]),Pe(()=>{const I=P.current;if(!I)return;const _=qt(I).createElement("div");for(const B of Array.from(I.childNodes))_.appendChild(B.cloneNode(!0));b.current=_});const $=S!=null;let te;$?te=E.jsxs(k.Fragment,{children:[E.jsx("div",{"data-previous":!0,inert:Nb(!0),ref:D,style:{...z?{[r.popupWidth]:`${z.width}px`,[r.popupHeight]:`${z.height}px`}:null,position:"absolute"},"data-ending-style":G?void 0:""},"previous"),E.jsx("div",{"data-current":!0,ref:P,"data-starting-style":G?"":void 0,children:i},x)]}):te=E.jsx("div",{"data-current":!0,ref:P,children:i},x),Pe(()=>{const I=D.current;!I||!S||I.replaceChildren(...Array.from(S.childNodes))},[S]),SM({popupElement:p,positionerElement:g,mounted:d,content:h,onMeasureLayout:W,onMeasureLayoutComplete:Y,side:t,direction:s});const q={activationDirection:CM(R),transitioning:$};return{children:te,state:q}}function CM(n){if(n)return`${dx(n.horizontal,5,"right","left")} ${dx(n.vertical,5,"down","up")}`}function dx(n,e,t,r){return n>e?t:n<-e?r:""}function EM(n,e){const t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i={x:t.left+t.width/2,y:t.top+t.height/2},s={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:s.x-i.x,vertical:s.y-i.y}}function TM(n,e){const[t,r]=k.useState(0),i=k.useRef(n),s=k.useRef(e),o=k.useRef(!1);return Pe(()=>{const a=i.current,u=s.current,h=n!==a,d=e!==u;h?(r(p=>p+1),o.current=!d):o.current&&d&&(r(p=>p+1),o.current=!1),i.current=n,s.current=e},[n,e]),`${n??"current"}-${t}`}const RM={activationDirection:n=>n?{"data-activation-direction":n}:null},OM=k.forwardRef(function(e,t){const{render:r,className:i,style:s,children:o,...a}=e,u=Qa(),h=Ab(),d=u.useState("instantType"),{children:p,state:g}=kM({store:u,side:h.side,cssVars:xM,children:o}),v={activationDirection:g.activationDirection,transitioning:g.transitioning,instant:d};return On("div",e,{state:v,ref:t,props:[a,{children:p}],stateAttributesMapping:RM})});function Bb(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=Bb(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Fb(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Bb(n))&&(r&&(r+=" "),r+=e);return r}const n0="-",PM=n=>{const e=AM(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{const a=o.split(n0);return a[0]===""&&a.length!==1&&a.shift(),_b(a,e)||MM(o)},getConflictingClassGroupIds:(o,a)=>{const u=t[o]||[];return a&&r[o]?[...u,...r[o]]:u}}},_b=(n,e)=>{var o;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?_b(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=n.join(n0);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},px=/^\[(.+)\]$/,MM=n=>{if(px.test(n)){const e=px.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},AM=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return IM(Object.entries(n.classGroups),t).forEach(([s,o])=>{Rm(o,r,s,e)}),r},Rm=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:mx(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(DM(i)){Rm(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{Rm(o,mx(e,s),t,r)})})},mx=(n,e)=>{let t=n;return e.split(n0).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},DM=n=>n.isThemeGetter,IM=(n,e)=>e?n.map(([t,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[t,i]}):n,LM=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(s,o)=>{t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}},jb="!",NM=n=>{const{separator:e,experimentalParseClassName:t}=n,r=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let h=0,d=0,p;for(let S=0;S<a.length;S++){let C=a[S];if(h===0){if(C===i&&(r||a.slice(S,S+s)===e)){u.push(a.slice(d,S)),d=S+s;continue}if(C==="/"){p=S;continue}}C==="["?h++:C==="]"&&h--}const g=u.length===0?a:a.substring(d),v=g.startsWith(jb),x=v?g.substring(1):g,b=p&&p>d?p-d:void 0;return{modifiers:u,hasImportantModifier:v,baseClassName:x,maybePostfixModifierPosition:b}};return t?a=>t({className:a,parseClassName:o}):o},BM=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e},FM=n=>({cache:LM(n.cacheSize),parseClassName:NM(n),...PM(n)}),_M=/\s+/,jM=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=n.trim().split(_M);let a="";for(let u=o.length-1;u>=0;u-=1){const h=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:v}=t(h);let x=!!v,b=r(x?g.substring(0,v):g);if(!b){if(!x){a=h+(a.length>0?" "+a:a);continue}if(b=r(g),!b){a=h+(a.length>0?" "+a:a);continue}x=!1}const S=BM(d).join(":"),C=p?S+jb:S,R=C+b;if(s.includes(R))continue;s.push(R);const O=i(b,x);for(let P=0;P<O.length;++P){const D=O[P];s.push(C+D)}a=h+(a.length>0?" "+a:a)}return a};function zM(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=zb(e))&&(r&&(r+=" "),r+=t);return r}const zb=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=zb(n[r]))&&(t&&(t+=" "),t+=e);return t};function WM(n,...e){let t,r,i,s=o;function o(u){const h=e.reduce((d,p)=>p(d),n());return t=FM(h),r=t.cache.get,i=t.cache.set,s=a,a(u)}function a(u){const h=r(u);if(h)return h;const d=jM(u,t);return i(u,d),d}return function(){return s(zM.apply(null,arguments))}}const mt=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},Wb=/^\[(?:([a-z-]+):)?(.+)\]$/i,HM=/^\d+\/\d+$/,VM=new Set(["px","full","screen"]),$M=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,UM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,KM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,QM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bi=n=>zo(n)||VM.has(n)||HM.test(n),ns=n=>cl(n,"length",nA),zo=n=>!!n&&!Number.isNaN(Number(n)),Np=n=>cl(n,"number",zo),Zl=n=>!!n&&Number.isInteger(Number(n)),YM=n=>n.endsWith("%")&&zo(n.slice(0,-1)),Fe=n=>Wb.test(n),rs=n=>$M.test(n),GM=new Set(["length","size","percentage"]),XM=n=>cl(n,GM,Hb),JM=n=>cl(n,"position",Hb),ZM=new Set(["image","url"]),eA=n=>cl(n,ZM,iA),tA=n=>cl(n,"",rA),ea=()=>!0,cl=(n,e,t)=>{const r=Wb.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},nA=n=>UM.test(n)&&!qM.test(n),Hb=()=>!1,rA=n=>KM.test(n),iA=n=>QM.test(n),sA=()=>{const n=mt("colors"),e=mt("spacing"),t=mt("blur"),r=mt("brightness"),i=mt("borderColor"),s=mt("borderRadius"),o=mt("borderSpacing"),a=mt("borderWidth"),u=mt("contrast"),h=mt("grayscale"),d=mt("hueRotate"),p=mt("invert"),g=mt("gap"),v=mt("gradientColorStops"),x=mt("gradientColorStopPositions"),b=mt("inset"),S=mt("margin"),C=mt("opacity"),R=mt("padding"),O=mt("saturate"),P=mt("scale"),D=mt("sepia"),N=mt("skew"),L=mt("space"),z=mt("translate"),Q=()=>["auto","contain","none"],G=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto",Fe,e],W=()=>[Fe,e],Y=()=>["",bi,ns],J=()=>["auto",zo,Fe],$=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],te=()=>["solid","dashed","dotted","double","none"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>["start","end","center","between","around","evenly","stretch"],_=()=>["","0",Fe],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[zo,Fe];return{cacheSize:500,separator:":",theme:{colors:[ea],spacing:[bi,ns],blur:["none","",rs,Fe],brightness:M(),borderColor:[n],borderRadius:["none","","full",rs,Fe],borderSpacing:W(),borderWidth:Y(),contrast:M(),grayscale:_(),hueRotate:M(),invert:_(),gap:W(),gradientColorStops:[n],gradientColorStopPositions:[YM,ns],inset:X(),margin:X(),opacity:M(),padding:W(),saturate:M(),scale:M(),sepia:_(),skew:M(),space:W(),translate:W()},classGroups:{aspect:[{aspect:["auto","square","video",Fe]}],container:["container"],columns:[{columns:[rs]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...$(),Fe]}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:Q()}],"overscroll-x":[{"overscroll-x":Q()}],"overscroll-y":[{"overscroll-y":Q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Zl,Fe]}],basis:[{basis:X()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Fe]}],grow:[{grow:_()}],shrink:[{shrink:_()}],order:[{order:["first","last","none",Zl,Fe]}],"grid-cols":[{"grid-cols":[ea]}],"col-start-end":[{col:["auto",{span:["full",Zl,Fe]},Fe]}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":[ea]}],"row-start-end":[{row:["auto",{span:[Zl,Fe]},Fe]}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Fe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Fe]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...I()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...I(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...I(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[R]}],px:[{px:[R]}],py:[{py:[R]}],ps:[{ps:[R]}],pe:[{pe:[R]}],pt:[{pt:[R]}],pr:[{pr:[R]}],pb:[{pb:[R]}],pl:[{pl:[R]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Fe,e]}],"min-w":[{"min-w":[Fe,e,"min","max","fit"]}],"max-w":[{"max-w":[Fe,e,"none","full","min","max","fit","prose",{screen:[rs]},rs]}],h:[{h:[Fe,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Fe,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Fe,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Fe,e,"auto","min","max","fit"]}],"font-size":[{text:["base",rs,ns]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Np]}],"font-family":[{font:[ea]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Fe]}],"line-clamp":[{"line-clamp":["none",zo,Np]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",bi,Fe]}],"list-image":[{"list-image":["none",Fe]}],"list-style-type":[{list:["none","disc","decimal",Fe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[C]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[C]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",bi,ns]}],"underline-offset":[{"underline-offset":["auto",bi,Fe]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:W()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[C]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...$(),JM]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",XM]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},eA]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[C]}],"border-style":[{border:[...te(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[C]}],"divide-style":[{divide:te()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...te()]}],"outline-offset":[{"outline-offset":[bi,Fe]}],"outline-w":[{outline:[bi,ns]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[C]}],"ring-offset-w":[{"ring-offset":[bi,ns]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",rs,tA]}],"shadow-color":[{shadow:[ea]}],opacity:[{opacity:[C]}],"mix-blend":[{"mix-blend":[...q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":q()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",rs,Fe]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[O]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[C]}],"backdrop-saturate":[{"backdrop-saturate":[O]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Fe]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",Fe]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",Fe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[Zl,Fe]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Fe]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Fe]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":W()}],"scroll-mx":[{"scroll-mx":W()}],"scroll-my":[{"scroll-my":W()}],"scroll-ms":[{"scroll-ms":W()}],"scroll-me":[{"scroll-me":W()}],"scroll-mt":[{"scroll-mt":W()}],"scroll-mr":[{"scroll-mr":W()}],"scroll-mb":[{"scroll-mb":W()}],"scroll-ml":[{"scroll-ml":W()}],"scroll-p":[{"scroll-p":W()}],"scroll-px":[{"scroll-px":W()}],"scroll-py":[{"scroll-py":W()}],"scroll-ps":[{"scroll-ps":W()}],"scroll-pe":[{"scroll-pe":W()}],"scroll-pt":[{"scroll-pt":W()}],"scroll-pr":[{"scroll-pr":W()}],"scroll-pb":[{"scroll-pb":W()}],"scroll-pl":[{"scroll-pl":W()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Fe]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[bi,ns,Np]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},oA=WM(sA);function Rn(...n){return oA(Fb(n))}const Vb=vM,dh=QP;function ph(n){return E.jsx(sM,{"data-slot":"tooltip-trigger",...n})}function mh({className:n,align:e="center",sideOffset:t=4,side:r="top",children:i,...s}){return E.jsx(lM,{children:E.jsx(mM,{align:e,className:"z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none","data-slot":"tooltip-positioner",side:r,sideOffset:t,children:E.jsx(yM,{className:Rn("relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) text-balance rounded-md border bg-popover bg-clip-padding text-popover-foreground text-xs shadow-black/5 shadow-md transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 data-instant:duration-0 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]",n),"data-slot":"tooltip-popup",...s,children:E.jsx(OM,{className:"relative size-full overflow-clip px-(--viewport-inline-padding) py-1 [--viewport-inline-padding:--spacing(2)] data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:truncate **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity","data-slot":"tooltip-viewport",children:i})})})})}function gx({icon:n,tooltip:e,to:t,href:r}){const i=ir(),s=t?i.pathname===t:!1,o=E.jsx("div",{className:Rn("w-full h-10 rounded-l-lg p-2 flex items-center justify-center transition-colors",s&&"bg-accent shadow"),children:n}),a=t?E.jsx(Oi,{to:t,"aria-label":e,children:o}):r?E.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer","aria-label":e,children:o}):o;return E.jsxs(dh,{children:[E.jsx(ph,{render:a}),E.jsx(mh,{side:"right",sideOffset:8,children:e})]})}const lA="/assets/postgres-BpcazhJg.svg",aA="data:image/svg+xml,%3csvg%20width='600'%20height='600'%20viewBox='0%200%20600%20600'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M548.194%20458.47C516.023%20457.594%20491.456%20460.589%20470.451%20469.444C464.484%20471.961%20454.959%20472.031%20453.984%20479.508C457.266%20482.944%20457.776%20488.081%20460.383%20492.309C465.398%20500.419%20473.864%20511.303%20481.42%20517.003C489.68%20523.237%20498.187%20529.898%20507.037%20535.294C522.778%20544.889%20540.352%20550.373%20555.506%20559.987C564.441%20565.659%20573.314%20572.798%20582.028%20579.192C586.341%20582.356%20589.233%20587.273%20594.834%20589.256V588.347C591.891%20584.597%20591.131%20579.45%20588.431%20575.536L576.539%20563.644C564.914%20548.213%20550.153%20534.656%20534.464%20523.402C521.953%20514.42%20493.955%20502.289%20488.737%20487.734L487.823%20486.82C496.692%20485.817%20507.075%20482.611%20515.264%20480.412C529.017%20476.728%20541.308%20477.68%20555.506%20474.014L574.711%20468.525V464.869C567.534%20457.505%20562.416%20447.755%20554.592%20441.089C534.108%20423.652%20511.758%20406.228%20488.742%20391.697C475.973%20383.644%20460.2%20378.408%20446.667%20371.578C442.116%20369.277%20434.119%20368.081%20431.114%20364.256C424.003%20355.2%20420.136%20343.716%20414.656%20333.164C403.177%20311.053%20391.903%20286.908%20381.731%20263.644C374.794%20247.781%20370.261%20232.144%20361.608%20217.912C320.076%20149.63%20275.376%20108.422%20206.128%2067.9125C191.391%2059.2969%20173.648%2055.8984%20154.898%2051.4453C144.844%2050.8406%20134.78%2050.2266%20124.72%2049.6125C118.575%2047.0531%20112.191%2039.5391%20106.43%2035.8922C83.489%2021.3984%2024.6421%20-10.125%207.65463%2031.3219C-3.07506%2057.4828%2023.6906%2083.0016%2033.2578%2096.2625C39.9796%20105.553%2048.5812%20115.983%2053.3812%20126.441C56.5406%20133.317%2057.0843%20140.212%2059.789%20147.483C66.4312%20165.398%2072.2203%20184.889%2080.8218%20201.441C85.1671%20209.822%2089.9578%20218.644%2095.4562%20226.134C98.8218%20230.733%20104.602%20232.758%20105.511%20239.855C99.8671%20247.758%2099.5437%20260.03%2096.3703%20270.042C82.0734%20315.113%2087.4687%20371.138%20108.262%20404.494C114.637%20414.741%20129.67%20436.702%20150.333%20428.273C168.408%20420.914%20164.372%20398.095%20169.542%20377.967C170.709%20373.406%20169.992%20370.05%20172.284%20366.994V367.908L188.751%20400.833C200.939%20420.459%20222.558%20440.967%20240.886%20454.805C250.387%20461.981%20257.869%20474.384%20270.155%20478.584V477.666H269.241C266.859%20473.958%20263.133%20472.42%20260.095%20469.439C252.937%20462.422%20244.978%20453.698%20239.062%20445.659C222.394%20423.033%20207.666%20398.269%20194.245%20372.492C187.833%20360.178%20182.259%20346.603%20176.859%20334.073C174.778%20329.245%20174.806%20321.938%20170.466%20319.439C164.545%20328.617%20155.831%20336.042%20151.256%20346.88C143.939%20364.205%20142.997%20385.336%20140.283%20407.245C138.68%20407.817%20139.392%20407.423%20138.45%20408.155C125.709%20405.084%20121.237%20391.973%20116.498%20380.719C104.527%20352.266%20102.3%20306.459%20112.837%20273.708C115.566%20265.228%20127.884%20238.547%20122.897%20230.714C120.516%20222.905%20112.659%20218.386%20108.267%20212.419C102.825%20205.041%2097.3968%20195.328%2093.6234%20186.806C83.8265%20164.63%2079.2515%20139.725%2068.9343%20117.3C63.9984%20106.58%2055.6593%2095.7281%2048.8109%2086.2031C41.2312%2075.6422%2032.7374%2067.8656%2026.8593%2055.1016C24.7687%2050.5641%2021.9328%2043.2984%2025.0265%2038.6344C26.0109%2035.4891%2027.4078%2034.1766%2030.5156%2033.15C35.8218%2029.0578%2050.5968%2034.5094%2056.1187%2036.8016C70.7859%2042.8953%2083.0296%2048.6984%2095.4562%2056.9297C101.414%2060.8859%20107.452%2068.5312%20114.661%2070.65H122.892C135.769%2073.6078%20150.192%2071.5641%20162.225%2075.2203C183.487%2081.6797%20202.542%2091.7344%20219.844%20102.661C272.559%20135.952%20315.666%20183.333%20345.15%20239.859C349.894%20248.962%20351.947%20257.644%20356.123%20267.3C364.552%20286.767%20375.169%20306.797%20383.555%20325.838C391.926%20344.831%20400.083%20363.998%20411.914%20379.805C418.134%20388.111%20442.153%20392.569%20453.075%20397.186C460.725%20400.416%20473.264%20403.791%20480.516%20408.155C494.358%20416.508%20507.773%20426.45%20520.762%20435.6C527.245%20440.17%20547.2%20450.206%20548.194%20458.47ZM139.355%20109.997C132.647%20109.87%20127.903%20110.728%20122.887%20111.82V112.734H123.802C127.003%20119.306%20132.652%20123.544%20136.603%20129.202C139.65%20135.609%20142.702%20142.008%20145.753%20148.406L146.662%20147.502C152.33%20143.503%20154.922%20137.123%20154.889%20127.373C152.62%20124.987%20152.287%20121.997%20150.319%20119.147C147.712%20115.345%20142.655%20113.184%20139.355%20109.997Z'%20fill='%2300618A'/%3e%3c/svg%3e",cA="data:image/svg+xml,%3csvg%20width='600'%20height='600'%20viewBox='0%200%20600%20600'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M597.196%20105.954C595.566%20104.609%20593.497%20103.916%20591.387%20104.008C585.598%20104.008%20578.111%20107.941%20574.081%20110.051L572.485%20110.87C565.726%20114.147%20558.367%20116.002%20550.863%20116.319C543.172%20116.565%20536.544%20117.016%20527.912%20117.917C476.771%20123.181%20453.963%20162.43%20431.993%20200.387C420.026%20221.035%20407.67%20242.482%20390.733%20258.87C387.228%20262.273%20383.504%20265.441%20379.584%20268.354C362.053%20281.403%20340.042%20290.723%20322.921%20297.319C306.433%20303.628%20288.432%20309.302%20271.044%20314.792C255.108%20319.811%20240.073%20324.563%20226.245%20329.705C220.006%20332.02%20214.708%20333.802%20210.023%20335.358C197.422%20339.455%20188.34%20342.589%20175.064%20351.746C169.888%20355.29%20164.692%20359.12%20161.174%20361.988C150.635%20370.408%20141.308%20380.245%20133.456%20391.219C126.703%20401.343%20118.9%20410.722%20110.177%20419.201C107.374%20421.946%20102.403%20423.298%2094.9574%20423.298C86.2431%20423.298%2075.6673%20421.495%2064.4777%20419.59C52.9405%20417.542%2041.0146%20415.596%2030.7865%20415.596C22.4813%20415.596%2016.1194%20416.948%2011.3736%20419.693C11.3736%20419.693%203.37526%20424.363%200%20430.406L3.3139%20431.901C8.45284%20434.691%2013.2107%20438.134%2017.4695%20442.143C21.913%20446.253%2026.8625%20449.778%2032.198%20452.631C33.9011%20453.257%2035.4499%20454.242%2036.7392%20455.52C35.3482%20457.568%2033.3026%20460.211%2031.1547%20463.038C19.3515%20478.503%2012.4578%20488.274%2016.4058%20493.6C18.2981%20494.584%2020.4115%20495.064%2022.5427%20494.993C48.2765%20494.993%2062.1048%20488.295%2079.5948%20479.814C84.668%20477.356%2089.8229%20474.837%2095.9597%20472.235C106.188%20467.79%20117.193%20460.702%20128.874%20453.205C144.154%20443.229%20160.131%20432.987%20175.636%20428.05C188.379%20424.159%20201.653%20422.293%20214.974%20422.519C231.338%20422.519%20248.563%20424.711%20265.173%20426.842C277.549%20428.439%20290.375%20430.078%20302.955%20430.836C307.844%20431.123%20312.365%20431.266%20316.763%20431.266C322.647%20431.284%20328.527%20430.976%20334.376%20430.344L335.787%20429.853C344.604%20424.424%20348.736%20412.769%20352.746%20401.502C355.323%20394.251%20357.491%20387.737%20360.928%20383.599C361.131%20383.397%20361.35%20383.212%20361.583%20383.046C361.744%20382.956%20361.93%20382.924%20362.112%20382.953C362.294%20382.983%20362.461%20383.074%20362.585%20383.21C362.585%20383.21%20362.585%20383.312%20362.585%20383.538C360.539%20427.6%20342.824%20455.581%20324.905%20480.449L312.938%20493.293C312.938%20493.293%20329.692%20493.293%20339.224%20489.606C374%20479.2%20400.245%20456.257%20419.351%20419.672C424.063%20410.281%20428.276%20400.646%20431.972%20390.81C432.3%20389.99%20435.307%20388.474%20435.02%20392.715C434.918%20393.964%20434.836%20395.357%20434.734%20396.812C434.734%20397.672%20434.734%20398.553%20434.57%20399.434C434.079%20405.579%20432.627%20418.566%20432.627%20418.566L443.366%20412.81C469.264%20396.422%20489.229%20363.361%20504.367%20311.924C510.667%20290.498%20515.29%20269.214%20519.361%20250.471C524.229%20227.939%20528.423%20208.622%20533.23%20201.124C540.778%20189.366%20552.295%20181.419%20563.444%20173.696C564.958%20172.651%20566.492%20171.647%20567.985%20170.541C581.998%20160.688%20595.928%20149.32%20598.997%20128.118V127.647C601.226%20111.833%20599.344%20107.798%20597.196%20105.954Z'%20fill='%23003545'/%3e%3c/svg%3e",uA="/assets/sqlserver-ByfFYYpV.svg",fA="data:image/svg+xml,%3csvg%20width='160'%20height='160'%20viewBox='0%200%20160%20160'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M121.632%208.03622H22.1255C15.4565%208.03622%2010%2013.4937%2010%2020.1625V129.899C10%20136.567%2015.4565%20142.024%2022.1255%20142.024H87.6628C86.9189%20109.415%2098.0545%2046.1304%20121.632%208.03622Z'%20fill='%230F80CC'/%3e%3cpath%20d='M118.016%2011.5737H22.1255C17.3901%2011.5737%2013.5366%2015.4262%2013.5366%2020.1625V121.893C35.2539%20113.558%2067.8488%20106.366%2090.3862%20106.692C94.9151%2083.0114%20108.226%2036.6019%20118.016%2011.5737Z'%20fill='url(%23paint0_linear_2795_134)'/%3e%3cpath%20d='M144.841%204.44498C138.026%20-1.63252%20129.775%200.808728%20121.631%208.03623C120.423%209.10998%20119.216%2010.3012%20118.016%2011.5737C104.085%2026.3525%2091.154%2053.7275%2087.1365%2074.6337C88.7015%2077.8075%2089.924%2081.8575%2090.729%2084.9512C90.9352%2085.745%2091.1215%2086.49%2091.2702%2087.1237C91.624%2088.6236%2091.814%2089.5962%2091.814%2089.5962C91.814%2089.5962%2091.689%2089.1236%2091.1765%2087.6375C91.079%2087.3525%2090.9702%2087.0412%2090.8415%2086.675C90.7865%2086.5237%2090.7102%2086.34%2090.6265%2086.1437C89.7177%2084.0312%2087.204%2079.5725%2086.0977%2077.6312C85.1515%2080.4225%2084.3152%2083.0337%2083.6152%2085.3962C86.809%2091.2397%2088.7552%20101.254%2088.7552%20101.254C88.7552%20101.254%2088.5865%20100.605%2087.784%2098.3399C87.0715%2096.3365%2083.5227%2090.1187%2082.6821%2088.6651C81.2441%2093.9736%2080.6727%2097.5576%2081.188%2098.4302C82.1884%20100.121%2083.1411%20103.039%2083.9777%20106.265C85.8677%20113.534%2087.1815%20122.382%2087.1815%20122.382C87.1815%20122.382%2087.224%20122.969%2087.2952%20123.871C87.0327%20129.975%2087.1902%20136.304%2087.6627%20142.024C88.289%20149.596%2089.4677%20156.101%2090.9702%20159.582L91.9902%20159.026C89.784%20152.167%2088.8877%20143.179%2089.2802%20132.812C89.874%20116.967%2093.5202%2097.8589%20100.258%2077.9425C111.64%2047.8775%20127.433%2023.755%20141.886%2012.235C128.713%2024.1325%20110.883%2062.6437%20105.545%2076.905C99.569%2092.875%2095.334%20107.861%2092.7815%20122.22C97.1852%20108.759%20111.424%20102.973%20111.424%20102.973C111.424%20102.973%20118.408%2094.3599%20126.569%2082.055C121.68%2083.17%20113.653%2085.0787%20110.964%2086.2087C106.998%2087.8725%20105.929%2088.44%20105.929%2088.44C105.929%2088.44%20118.776%2080.6162%20129.799%2077.0737C144.958%2053.1987%20161.473%2019.2812%20144.841%204.44498Z'%20fill='%23003B57'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_2795_134'%20x1='73.7814'%20y1='13.8313'%20x2='73.7814'%20y2='115.758'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2397D9F6'/%3e%3cstop%20offset='0.920245'%20stop-color='%230F80CC'/%3e%3cstop%20offset='1'%20stop-color='%230F80CC'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",hA="data:image/svg+xml,%3csvg%20t='1779777044661'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1836'%20width='200'%20height='200'%3e%3cpath%20d='M826.5728%20512c0%2087.38133333-69.90506667%20157.2864-157.2864%20157.2864H354.7136c-87.38133333%200-157.2864-69.90506667-157.2864-157.2864s69.90506667-157.2864%20157.2864-157.2864h314.5728c87.38133333%200%20157.2864%2069.90506667%20157.2864%20157.2864z'%20fill='%23d22227'%20p-id='1837'%3e%3c/path%3e%3cpath%20d='M-70.54222222-70.54222222v1165.08444444h1165.08444444V-70.54222222H-70.54222222z%20m926.24213333%20768.95573333c-49.51608889%2049.51608889-116.50844445%2075.73048889-186.41351111%2075.73048889H354.7136c-145.63555555%200-262.144-116.50844445-262.144-262.144s116.50844445-262.144%20262.144-262.144h314.5728c145.63555555%200%20262.144%20116.50844445%20262.144%20262.144%200%2069.90506667-26.2144%20136.89742222-75.73048889%20186.41351111z'%20fill='%23d22227'%20p-id='1838'%3e%3c/path%3e%3c/svg%3e",r0={postgres:lA,mysql:aA,mariadb:cA,sqlserver:uA,sqlite:fA,oracle:hA};function dA({source:n}){const{sourceId:e}=th(),t=e===n.id;return E.jsxs(dh,{children:[E.jsx(ph,{render:E.jsxs(Oi,{to:`/source/${n.id}`,"aria-label":n.id,className:Rn("w-full rounded-l-lg p-2 mt-1 flex flex-col items-center justify-center transition-colors",t&&"bg-accent shadow"),children:[E.jsx("img",{src:r0[n.type],alt:`${n.type} logo`,className:"w-7 h-7"}),E.jsx("span",{className:Rn("text-[10px] w-full text-center mt-1 leading-tight break-words line-clamp-2",t?"text-foreground":"text-muted-foreground"),children:n.id})]})}),E.jsx(mh,{side:"right",sideOffset:8,children:n.id})]})}function pA({className:n="w-5 h-5"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("polyline",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}function mA({className:n="w-5 h-5"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function gA({sources:n}){return E.jsx(Vb,{children:E.jsxs("aside",{className:"w-16 h-screen flex flex-col items-center bg-card pl-2 py-4 pt-6","aria-label":"Main navigation",children:[E.jsx("div",{className:"w-full flex-1 flex flex-col justify-start items-start overflow-auto",children:n.map(e=>E.jsx(dA,{source:e},e.id))}),E.jsxs("div",{className:"w-full flex flex-col gap-2 items-center",children:[E.jsx(gx,{icon:E.jsx(pA,{}),to:"/requests",tooltip:"Requests"}),E.jsx(gx,{icon:E.jsx(mA,{}),href:"https://dbhub.ai",tooltip:"Help"})]})]})})}function yA(){return E.jsx("div",{className:"px-6 py-4",children:E.jsx(Oi,{to:"/",className:"block hover:opacity-80 transition-opacity",children:E.jsx("img",{src:"/logo-full-light.svg",alt:"DBHub",className:"w-[200px] h-auto"})})})}function wf({className:n="w-4 h-4"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}function vA({sources:n,isLoading:e}){const{sourceId:t,toolName:r}=th(),i=n.find(s=>s.id===t);return E.jsxs("aside",{className:"w-[200px] sm:w-[220px] md:w-[240px] lg:w-[280px] border-r border-border bg-gray-100 dark:bg-zinc-700 flex flex-col","aria-label":"Data sources sidebar",children:[E.jsx(yA,{}),E.jsx("nav",{className:"flex-1 flex flex-col overflow-hidden","aria-label":"Data sources navigation",children:e?E.jsx("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Loading..."}):i?E.jsxs("div",{className:"flex flex-col overflow-hidden px-2 pt-2",children:[E.jsx(Oi,{to:`/source/${i.id}`,className:Rn("flex items-center gap-2 px-2 py-2 text-sm font-medium transition-colors rounded-md",r?"text-muted-foreground hover:text-foreground hover:bg-accent/50":"bg-accent text-accent-foreground"),children:E.jsx("span",{className:"truncate",children:i.id})}),E.jsx("div",{className:"flex-1 overflow-auto",children:i.tools.filter(s=>s.name!=="search_objects").map(s=>E.jsxs(Oi,{to:`/source/${i.id}/tool/${s.name}`,className:Rn("flex items-center gap-2 px-4 py-2 text-sm transition-colors rounded-md",r===s.name?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:[E.jsx("span",{className:"truncate font-mono text-xs",children:s.name}),s.readonly&&E.jsx(wf,{className:"w-3 h-3 ml-auto flex-shrink-0"})]},s.name))})]}):E.jsx("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Select a data source"})})]})}function xA({sources:n,isLoading:e}){const r=ir().pathname.startsWith("/source/");return E.jsxs("div",{className:"flex h-screen bg-background",children:[E.jsx(gA,{sources:n}),r&&E.jsx(vA,{sources:n,isLoading:e}),E.jsx("main",{className:"flex-1 overflow-auto","aria-label":"Main content",children:E.jsx(cR,{})})]})}class Ut extends Error{constructor(e,t,r){super(e),this.status=t,this.statusText=r,this.name="ApiError"}}const $b="/api";async function Ub(n){const e=n.headers.get("content-type");if(e&&e.includes("application/json"))return n.json();const t=await n.text();throw new Ut(t||n.statusText,n.status,n.statusText)}async function i0(){try{const n=await fetch(`${$b}/sources`);if(!n.ok){const e=await Ub(n).then(t=>t.error).catch(()=>n.statusText);throw new Ut(`Failed to fetch sources: ${e}`,n.status,n.statusText)}return n.json()}catch(n){throw n instanceof Ut?n:new Ut(n instanceof Error?n.message:"Network error",0)}}async function qb(n){try{if(!n||n.trim()==="")throw new Ut("Source ID cannot be empty",400);if(n.includes("/")||n.includes(".."))throw new Ut("Invalid source ID format",400);const e=await fetch(`${$b}/sources/${encodeURIComponent(n)}`);if(!e.ok){const t=await Ub(e).then(r=>r.error).catch(()=>e.statusText);throw new Ut(e.status===404?`Source not found: ${n}`:`Failed to fetch source: ${t}`,e.status,e.statusText)}return e.json()}catch(e){throw e instanceof Ut?e:new Ut(e instanceof Error?e.message:"Network error",0)}}function wA(){const n=eh();return k.useEffect(()=>{i0().then(e=>{e.length>0?n(`/source/${e[0].id}`,{replace:!0}):n("/requests",{replace:!0})}).catch(()=>{n("/requests",{replace:!0})})},[]),E.jsx("div",{className:"flex items-center justify-center h-full",children:E.jsx("div",{className:"text-muted-foreground",children:"Loading..."})})}const yx="/api";async function bA(n){try{const e=n?`${yx}/requests?source_id=${encodeURIComponent(n)}`:`${yx}/requests`,t=await fetch(e);if(!t.ok){const r=await t.json().then(i=>i.error).catch(()=>t.statusText);throw new Ut(`Failed to fetch requests: ${r}`,t.status,t.statusText)}return t.json()}catch(e){throw e instanceof Ut?e:new Ut(e instanceof Error?e.message:"Network error",0)}}function SA(n){return new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function kA(n){const e=new Date(n),t=new Date;return e.toDateString()===t.toDateString()?"Today":e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function CA(n){const e=n.match(/Edg(?:e|A|iOS)?\/(\d+)/);if(e)return`Edge ${e[1]}`;const t=n.match(/(?:OPR|Opera)\/(\d+)/);if(t)return`Opera ${t[1]}`;const r=n.match(/Chrome\/(\d+)/);if(r&&!n.includes("Edg")&&!n.includes("OPR"))return`Chrome ${r[1]}`;const i=n.match(/Version\/(\d+(?:\.\d+)?)\s+Safari/);if(i)return`Safari ${i[1]}`;const s=n.match(/Firefox\/(\d+)/);if(s)return`Firefox ${s[1]}`;if(n.includes("Claude"))return"Claude Desktop";if(n.includes("Electron"))return"Electron App";if(n.includes("Cursor"))return"Cursor";const o=n.match(/^(\w+)\/[\d.]+/);return o?o[1]:n.length>20?n.substring(0,20)+"...":n}function EA({sql:n,children:e}){return E.jsxs(dh,{children:[E.jsx(ph,{render:e}),E.jsx(mh,{className:"whitespace-pre-wrap break-all max-w-md",sideOffset:5,children:n})]})}function TA({error:n,children:e}){return E.jsxs(dh,{children:[E.jsx(ph,{render:e}),E.jsx(mh,{className:"whitespace-pre-wrap break-all max-w-md",sideOffset:5,side:"top",align:"end",children:n})]})}function RA({success:n,error:e}){if(n)return E.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-green-600 dark:text-green-400",children:E.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})});const t=E.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-red-600 dark:text-red-400 cursor-help",children:E.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})});return e?E.jsx(TA,{error:e,children:t}):t}function OA(){const[n,e]=k.useState([]),[t,r]=k.useState({}),[i,s]=k.useState({}),[o,a]=k.useState(!0),[u,h]=k.useState(null),[d,p]=k.useState(null);k.useEffect(()=>{Promise.all([bA(),i0()]).then(([x,b])=>{e(x.requests);const S={},C={};for(const R of b){S[R.id]=R.type;for(const O of R.tools)O.readonly&&(C[O.name]=!0)}r(S),s(C),a(!1)}).catch(x=>{console.error("Failed to fetch data:",x);const b=x instanceof Ut?x.message:"Failed to load data";h(b),a(!1)})},[]);const g=[...new Set(n.map(x=>x.sourceId))].sort(),v=d?n.filter(x=>x.sourceId===d):n;return o?E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}):u?E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[E.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Error"}),E.jsx("p",{className:"text-destructive/90",children:u})]})}):E.jsx(Vb,{children:E.jsx("div",{className:"container mx-auto px-8 py-12 max-w-6xl",children:E.jsxs("div",{className:"space-y-6",children:[E.jsxs("div",{children:[E.jsx("h1",{className:"text-3xl font-bold text-foreground mb-2",children:"Recent Requests"}),E.jsx("p",{className:"text-muted-foreground text-sm",children:"Up to 100 requests per source"})]}),n.length>0&&E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"flex flex-wrap gap-2",children:[E.jsxs("button",{onClick:()=>p(null),className:`px-3 py-1 text-sm font-medium rounded-full transition-colors ${d===null?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`,children:["All (",n.length,")"]}),g.map(x=>{const b=n.filter(C=>C.sourceId===x).length,S=t[x];return E.jsxs("button",{onClick:()=>p(x),className:`px-3 py-1 text-sm font-medium rounded-full transition-colors flex items-center gap-1.5 ${d===x?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`,children:[S&&E.jsx("img",{src:r0[S],alt:`${S} logo`,className:"w-4 h-4"}),x," (",b,")"]},x)})]}),E.jsx("div",{className:"bg-card border border-border rounded-lg overflow-x-auto",children:E.jsxs("table",{className:"w-full",children:[E.jsx("thead",{children:E.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[E.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Time"}),E.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Tool"}),E.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider w-full",children:"SQL"}),E.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Result"}),E.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Client"})]})}),E.jsx("tbody",{className:"divide-y divide-border",children:v.map(x=>E.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[E.jsxs("td",{className:"px-4 py-2 text-sm text-muted-foreground whitespace-nowrap",children:[kA(x.timestamp)," ",SA(x.timestamp)]}),E.jsx("td",{className:"px-4 py-2 text-sm whitespace-nowrap",children:E.jsxs(Oi,{to:`/source/${x.sourceId}`,className:"text-primary hover:underline inline-flex items-center gap-1",children:[x.toolName,i[x.toolName]&&E.jsx(wf,{className:"w-3 h-3 text-muted-foreground"})]})}),E.jsx("td",{className:"px-4 py-2 text-sm font-mono text-foreground max-w-0",children:E.jsx(EA,{sql:x.sql,children:E.jsx("span",{className:"block overflow-hidden text-ellipsis whitespace-nowrap cursor-help",children:x.sql})})}),E.jsx("td",{className:"px-4 py-2 text-sm",children:E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(RA,{success:x.success,error:x.error}),E.jsxs("span",{className:"text-muted-foreground",children:[x.durationMs,"ms"]})]})}),E.jsx("td",{className:"px-4 py-2 text-sm text-muted-foreground whitespace-nowrap",children:CA(x.client)})]},x.id))})]})})]}),n.length===0&&E.jsx("div",{className:"bg-card border border-border rounded-lg p-12 text-center",children:E.jsx("p",{className:"text-muted-foreground",children:"No requests have been made yet. Execute some SQL queries via the MCP endpoint to see them here."})})]})})})}/**
|
|
68
|
-
* @license lucide-react v0.562.0 - ISC
|
|
69
|
-
*
|
|
70
|
-
* This source code is licensed under the ISC license.
|
|
71
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
-
*/const PA=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),MA=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),vx=n=>{const e=MA(n);return e.charAt(0).toUpperCase()+e.slice(1)},Kb=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim(),AA=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
|
|
73
|
-
* @license lucide-react v0.562.0 - ISC
|
|
74
|
-
*
|
|
75
|
-
* This source code is licensed under the ISC license.
|
|
76
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
-
*/var DA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
78
|
-
* @license lucide-react v0.562.0 - ISC
|
|
79
|
-
*
|
|
80
|
-
* This source code is licensed under the ISC license.
|
|
81
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
-
*/const IA=k.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},u)=>k.createElement("svg",{ref:u,...DA,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:Kb("lucide",i),...!s&&!AA(a)&&{"aria-hidden":"true"},...a},[...o.map(([h,d])=>k.createElement(h,d)),...Array.isArray(s)?s:[s]]));/**
|
|
83
|
-
* @license lucide-react v0.562.0 - ISC
|
|
84
|
-
*
|
|
85
|
-
* This source code is licensed under the ISC license.
|
|
86
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
-
*/const Ni=(n,e)=>{const t=k.forwardRef(({className:r,...i},s)=>k.createElement(IA,{ref:s,iconNode:e,className:Kb(`lucide-${PA(vx(n))}`,`lucide-${n}`,r),...i}));return t.displayName=vx(n),t};/**
|
|
88
|
-
* @license lucide-react v0.562.0 - ISC
|
|
89
|
-
*
|
|
90
|
-
* This source code is licensed under the ISC license.
|
|
91
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
-
*/const LA=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],NA=Ni("chevron-left",LA);/**
|
|
93
|
-
* @license lucide-react v0.562.0 - ISC
|
|
94
|
-
*
|
|
95
|
-
* This source code is licensed under the ISC license.
|
|
96
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
-
*/const BA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],FA=Ni("chevron-right",BA);/**
|
|
98
|
-
* @license lucide-react v0.562.0 - ISC
|
|
99
|
-
*
|
|
100
|
-
* This source code is licensed under the ISC license.
|
|
101
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
-
*/const _A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],jA=Ni("circle-alert",_A);/**
|
|
103
|
-
* @license lucide-react v0.562.0 - ISC
|
|
104
|
-
*
|
|
105
|
-
* This source code is licensed under the ISC license.
|
|
106
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
-
*/const zA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],WA=Ni("circle-check",zA);/**
|
|
108
|
-
* @license lucide-react v0.562.0 - ISC
|
|
109
|
-
*
|
|
110
|
-
* This source code is licensed under the ISC license.
|
|
111
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
-
*/const HA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],VA=Ni("info",HA);/**
|
|
113
|
-
* @license lucide-react v0.562.0 - ISC
|
|
114
|
-
*
|
|
115
|
-
* This source code is licensed under the ISC license.
|
|
116
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
-
*/const $A=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Qb=Ni("loader-circle",$A);/**
|
|
118
|
-
* @license lucide-react v0.562.0 - ISC
|
|
119
|
-
*
|
|
120
|
-
* This source code is licensed under the ISC license.
|
|
121
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
-
*/const UA=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],qA=Ni("lock",UA);/**
|
|
123
|
-
* @license lucide-react v0.562.0 - ISC
|
|
124
|
-
*
|
|
125
|
-
* This source code is licensed under the ISC license.
|
|
126
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
-
*/const KA=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],QA=Ni("play",KA);/**
|
|
128
|
-
* @license lucide-react v0.562.0 - ISC
|
|
129
|
-
*
|
|
130
|
-
* This source code is licensed under the ISC license.
|
|
131
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
-
*/const YA=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],GA=Ni("triangle-alert",YA);function XA(){var a;const{sourceId:n}=th(),[e,t]=k.useState(null),[r,i]=k.useState(!0),[s,o]=k.useState(null);return k.useEffect(()=>{n&&(i(!0),o(null),qb(n).then(u=>{t(u),i(!1)}).catch(u=>{o(u),i(!1)}))},[n]),n?r?E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsx("div",{className:"text-muted-foreground",children:"Loading source details..."})}):s?s.status===404?E.jsx(ha,{to:"/404",replace:!0}):E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[E.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Error"}),E.jsx("p",{className:"text-destructive/90",children:s.message})]})}):e?E.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:E.jsxs("div",{className:"space-y-6",children:[E.jsxs("h1",{className:"flex items-center gap-3 text-3xl font-bold text-foreground",children:[E.jsx("img",{src:r0[e.type],alt:`${e.type} logo`,className:"w-8 h-8"}),e.id]}),E.jsxs("div",{className:"bg-card border border-border rounded-lg p-6",children:[E.jsx("h2",{className:"text-xl font-semibold text-foreground mb-4",children:"Connection Details"}),E.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Database Type"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.type})]}),e.host&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Host"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.host})]}),e.port&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Port"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.port})]}),e.database&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Database"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.database})]}),e.user&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"User"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.user})]}),E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Default Source"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground",children:e.is_default?E.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary",children:"Yes"}):E.jsx("span",{className:"text-muted-foreground",children:"No"})})]})]})]}),((a=e.ssh_tunnel)==null?void 0:a.enabled)&&E.jsxs("div",{className:"bg-card border border-border rounded-lg p-6",children:[E.jsx("h2",{className:"text-xl font-semibold text-foreground mb-4",children:"SSH Tunnel"}),E.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground",children:E.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-500/10 text-green-600 dark:text-green-400",children:"Enabled"})})]}),e.ssh_tunnel.ssh_host&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"SSH Host"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.ssh_tunnel.ssh_host})]}),e.ssh_tunnel.ssh_port&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"SSH Port"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.ssh_tunnel.ssh_port})]}),e.ssh_tunnel.ssh_user&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"SSH User"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.ssh_tunnel.ssh_user})]})]})]}),E.jsxs("div",{className:"bg-card border border-border rounded-lg p-6",children:[E.jsx("h2",{className:"text-xl font-semibold text-foreground mb-4",children:"Available Tools"}),e.tools.length>0?E.jsx("div",{className:"space-y-4",children:e.tools.map((u,h)=>E.jsxs("div",{children:[h>0&&E.jsx("div",{className:"border-t border-border mb-4"}),E.jsxs("div",{className:"bg-muted/30 rounded-lg p-4 space-y-3",children:[E.jsxs("div",{children:[E.jsxs("div",{className:"flex items-baseline gap-2",children:[E.jsxs("div",{className:"flex items-center gap-1.5",children:[E.jsx("div",{className:"text-sm font-semibold text-foreground font-mono",children:u.name}),u.readonly&&E.jsx(qA,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),E.jsxs("div",{className:"text-xs text-muted-foreground",children:["(",u.parameters.length," ",u.parameters.length===1?"parameter":"parameters",")"]})]}),E.jsx("div",{className:"mt-1.5 text-sm text-muted-foreground leading-relaxed",children:u.description})]}),u.parameters.length>0&&E.jsxs("div",{className:"pt-2 border-t border-border/50",children:[E.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2.5",children:"Parameters"}),E.jsx("ul",{className:"space-y-3",children:u.parameters.map(d=>E.jsxs("li",{className:"text-sm bg-background/50 rounded p-2.5",children:[E.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[E.jsx("span",{className:"font-mono text-foreground font-medium",children:d.name}),E.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-primary/10 text-primary",children:d.type}),d.required?E.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-destructive/10 text-destructive",children:"required"}):E.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-muted text-muted-foreground",children:"optional"})]}),d.description&&E.jsx("div",{className:"mt-2 text-xs text-muted-foreground leading-relaxed",children:d.description})]},d.name))})]})]})]},u.name))}):E.jsx("div",{className:"text-sm text-muted-foreground",children:"No tools available for this source"})]})]})}):E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsx("div",{className:"text-muted-foreground",children:"Source not found"})}):E.jsx(ha,{to:"/",replace:!0})}async function xx(n,e){var u,h,d;const t=await fetch("/mcp",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:JSON.stringify({jsonrpc:"2.0",id:crypto.randomUUID(),method:"tools/call",params:{name:n,arguments:e}})});if(!t.ok)throw new Ut(`HTTP error: ${t.status}`,t.status);const r=await t.json();if(r.error)throw new Ut(r.error.message,r.error.code);if(!((d=(h=(u=r.result)==null?void 0:u.content)==null?void 0:h[0])!=null&&d.text))throw new Ut("Invalid response format",500);const i=JSON.parse(r.result.content[0].text);if(!i.success||i.error)throw new Ut(i.error||"Tool execution failed",500);if(!i.data||!i.data.rows)return{columns:[],rows:[],rowCount:0};const s=i.data.rows;if(s.length===0)return{columns:[],rows:[],rowCount:i.data.count};const o=Object.keys(s[0]),a=s.map(p=>o.map(g=>p[g]));return{columns:o,rows:a,rowCount:i.data.count}}let Om=[],Yb=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?Yb:Om).push(t=t+n[e])})();function JA(n){if(n<768)return!1;for(let e=0,t=Om.length;;){let r=e+t>>1;if(n<Om[r])t=r;else if(n>=Yb[r])e=r+1;else return!0;if(e==t)return!1}}function wx(n){return n>=127462&&n<=127487}const bx=8205;function ZA(n,e,t=!0,r=!0){return(t?Gb:e5)(n,e,r)}function Gb(n,e,t){if(e==n.length)return e;e&&Xb(n.charCodeAt(e))&&Jb(n.charCodeAt(e-1))&&e--;let r=Bp(n,e);for(e+=Sx(r);e<n.length;){let i=Bp(n,e);if(r==bx||i==bx||t&&JA(i))e+=Sx(i),r=i;else if(wx(i)){let s=0,o=e-2;for(;o>=0&&wx(Bp(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function e5(n,e,t){for(;e>0;){let r=Gb(n,e-2,t);if(r<e)return r;e--}return 0}function Bp(n,e){let t=n.charCodeAt(e);if(!Jb(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return Xb(r)?(t-55296<<10)+(r-56320)+65536:t}function Xb(n){return n>=56320&&n<57344}function Jb(n){return n>=55296&&n<56320}function Sx(n){return n<65536?1:2}class Qe{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,t,r){[e,t]=Xo(this,e,t);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(t,this.length,i,1),Jr.from(i,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Xo(this,e,t);let r=[];return this.decompose(e,t,r,0),Jr.from(r,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new pa(this),s=new pa(e);for(let o=t,a=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new pa(this,e)}iterRange(e,t=this.length){return new Zb(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new eS(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]?Qe.empty:e.length<=32?new Lt(e):Jr.from(Lt.split(e,[]))}}class Lt extends Qe{constructor(e,t=t5(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((t?r:a)>=e)return new n5(i,a,r,o);i=a+1,r++}}decompose(e,t,r,i){let s=e<=0&&t>=this.length?this:new Lt(kx(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Xu(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new Lt(a,o.length+s.length));else{let u=a.length>>1;r.push(new Lt(a.slice(0,u)),new Lt(a.slice(u)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof Lt))return super.replace(e,t,r);[e,t]=Xo(this,e,t);let i=Xu(this.text,Xu(r.text,kx(this.text,0,e)),t),s=this.length+r.length-(t-e);return i.length<=32?new Lt(i,s):Jr.from(Lt.split(i,[]),s)}sliceString(e,t=this.length,r=`
|
|
133
|
-
`){[e,t]=Xo(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],u=s+a.length;s>e&&o&&(i+=r),e<u&&t>s&&(i+=a.slice(Math.max(0,e-s),t-s)),s=u+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(t.push(new Lt(r,i)),r=[],i=-1);return i>-1&&t.push(new Lt(r,i)),t}}class Jr extends Qe{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,u=r+o.lines-1;if((t?u:a)>=e)return o.lineInner(e,t,r,i);i=a+1,r=u+1}}decompose(e,t,r,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],u=o+a.length;if(e<=u&&t>=o){let h=i&((o<=e?1:0)|(u>=t?2:0));o>=e&&u<=t&&!h?r.push(a):a.decompose(e-o,t-o,r,h)}o=u+1}}replace(e,t,r){if([e,t]=Xo(this,e,t),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&t<=a){let u=o.replace(e-s,t-s,r),h=this.lines-o.lines+u.lines;if(u.lines<h>>4&&u.lines>h>>6){let d=this.children.slice();return d[i]=u,new Jr(d,this.length-(t-e)+r.length)}return super.replace(s,a,u)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
|
|
134
|
-
`){[e,t]=Xo(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],u=o+a.length;o>e&&s&&(i+=r),e<u&&t>o&&(i+=a.sliceString(e-o,t-o,r)),o=u+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Jr))return 0;let r=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return r;let u=this.children[i],h=e.children[s];if(u!=h)return r+u.scanIdentical(h,t);r+=u.length+1}}static from(e,t=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let v of e)r+=v.lines;if(r<32){let v=[];for(let x of e)x.flatten(v);return new Lt(v,t)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],u=0,h=-1,d=[];function p(v){let x;if(v.lines>s&&v instanceof Jr)for(let b of v.children)p(b);else v.lines>o&&(u>o||!u)?(g(),a.push(v)):v instanceof Lt&&u&&(x=d[d.length-1])instanceof Lt&&v.lines+x.lines<=32?(u+=v.lines,h+=v.length+1,d[d.length-1]=new Lt(x.text.concat(v.text),x.length+1+v.length)):(u+v.lines>i&&g(),u+=v.lines,h+=v.length+1,d.push(v))}function g(){u!=0&&(a.push(d.length==1?d[0]:Jr.from(d,h)),h=-1,u=d.length=0)}for(let v of e)p(v);return g(),a.length==1?a[0]:new Jr(a,t)}}Qe.empty=new Lt([""],0);function t5(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Xu(n,e,t=0,r=1e9){for(let i=0,s=0,o=!0;s<n.length&&i<=r;s++){let a=n[s],u=i+a.length;u>=t&&(u>r&&(a=a.slice(0,r-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=u+1}return e}function kx(n,e,t){return Xu(n,[""],e,t)}class pa{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Lt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof Lt?i.text.length:i.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
135
|
-
`,this;e--}else if(i instanceof Lt){let u=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,u.length>Math.max(0,e))return this.value=e==0?u:t>0?u.slice(e):u.slice(0,u.length-e),this;e-=u.length}else{let u=i.children[o+(t<0?-1:0)];e>u.length?(e-=u.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(u),this.offsets.push(t>0?1:(u instanceof Lt?u.text.length:u.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Zb{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new pa(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<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)*t,this.value=i.length<=r?i:t<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 eS{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(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"&&(Qe.prototype[Symbol.iterator]=function(){return this.iter()},pa.prototype[Symbol.iterator]=Zb.prototype[Symbol.iterator]=eS.prototype[Symbol.iterator]=function(){return this});class n5{constructor(e,t,r,i){this.from=e,this.to=t,this.number=r,this.text=i}get length(){return this.to-this.from}}function Xo(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Zt(n,e,t=!0,r=!0){return ZA(n,e,t,r)}function r5(n){return n>=56320&&n<57344}function i5(n){return n>=55296&&n<56320}function _n(n,e){let t=n.charCodeAt(e);if(!i5(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return r5(r)?(t-55296<<10)+(r-56320)+65536:t}function s0(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Zr(n){return n<65536?1:2}const Pm=/\r\n?|\n/;var Cn=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Cn||(Cn={}));class si{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,t=!1){Mm(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?e.push(r,i):e.push(i,r)}return new si(e)}composeDesc(e){return this.empty?e:e.empty?this:tS(this,e)}mapDesc(e,t=!1){return e.empty?this:Am(this,e,t)}mapPos(e,t=-1,r=Cn.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],u=this.sections[o++],h=i+a;if(u<0){if(h>e)return s+(e-i);s+=a}else{if(r!=Cn.Simple&&h>=e&&(r==Cn.TrackDel&&i<e&&h>e||r==Cn.TrackBefore&&i<e||r==Cn.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!a)return e==i||t<0?s:s+u;s+=u}i=h}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,i=0;r<this.sections.length&&i<=t;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new si(e)}static create(e){return new si(e)}}class $t extends si{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Mm(this,(t,r,i,s,o)=>e=e.replace(i,i+(r-t),o),!1),e}mapDesc(e,t=!1){return Am(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let u=i>>1;for(;r.length<u;)r.push(Qe.empty);r.push(o?e.slice(s,s+o):Qe.empty)}s+=o}return new $t(t,r)}compose(e){return this.empty?e:e.empty?this:tS(this,e,!0)}map(e,t=!1){return e.empty?this:Am(this,e,t,!0)}iterChanges(e,t=!1){Mm(this,e,t)}get desc(){return si.create(this.sections)}filter(e){let t=[],r=[],i=[],s=new Ra(this);e:for(let o=0,a=0;;){let u=o==e.length?1e9:e[o++];for(;a<u||a==u&&s.len==0;){if(s.done)break e;let d=Math.min(s.len,u-a);mn(i,d,-1);let p=s.ins==-1?-1:s.off==0?s.ins:0;mn(t,d,p),p>0&&as(r,t,s.text),s.forward(d),a+=d}let h=e[o++];for(;a<h;){if(s.done)break e;let d=Math.min(s.len,h-a);mn(t,d,-1),mn(i,d,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(d),a+=d}}return{changes:new $t(t,r),filtered:si.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],i=this.sections[t+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let i=[],s=[],o=0,a=null;function u(d=!1){if(!d&&!i.length)return;o<t&&mn(i,t-o,-1);let p=new $t(i,s);a=a?a.compose(p.map(a)):p,i=[],s=[],o=0}function h(d){if(Array.isArray(d))for(let p of d)h(p);else if(d instanceof $t){if(d.length!=t)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${t})`);u(),a=a?a.compose(d.map(a)):d}else{let{from:p,to:g=p,insert:v}=d;if(p>g||p<0||g>t)throw new RangeError(`Invalid change range ${p} to ${g} (in doc of length ${t})`);let x=v?typeof v=="string"?Qe.of(v.split(r||Pm)):v:Qe.empty,b=x.length;if(p==g&&b==0)return;p<o&&u(),p>o&&mn(i,p-o,-1),mn(i,g-p,b),as(s,i,x),o=g}}return h(e),u(!a),a}static empty(e){return new $t(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;r.length<i;)r.push(Qe.empty);r[i]=Qe.of(s.slice(1)),t.push(s[0],r[i].length)}}}return new $t(t,r)}static createSet(e,t){return new $t(e,t)}}function mn(n,e,t,r=!1){if(e==0&&t<=0)return;let i=n.length-2;i>=0&&t<=0&&t==n[i+1]?n[i]+=e:i>=0&&e==0&&n[i]==0?n[i+1]+=t:r?(n[i]+=e,n[i+1]+=t):n.push(e,t)}function as(n,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<r;)n.push(Qe.empty);n.push(t)}}function Mm(n,e,t){let r=n.inserted;for(let i=0,s=0,o=0;o<n.sections.length;){let a=n.sections[o++],u=n.sections[o++];if(u<0)i+=a,s+=a;else{let h=i,d=s,p=Qe.empty;for(;h+=a,d+=u,u&&r&&(p=p.append(r[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)a=n.sections[o++],u=n.sections[o++];e(i,h,s,d,p),i=h,s=d}}}function Am(n,e,t,r=!1){let i=[],s=r?[]:null,o=new Ra(n),a=new Ra(e);for(let u=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let h=Math.min(o.len,a.len);mn(i,h,-1),o.forward(h),a.forward(h)}else if(a.ins>=0&&(o.ins<0||u==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let h=a.len;for(mn(i,a.ins,-1);h;){let d=Math.min(o.len,h);o.ins>=0&&u<o.i&&o.len<=d&&(mn(i,0,o.ins),s&&as(s,i,o.text),u=o.i),o.forward(d),h-=d}a.next()}else if(o.ins>=0){let h=0,d=o.len;for(;d;)if(a.ins==-1){let p=Math.min(d,a.len);h+=p,d-=p,a.forward(p)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;mn(i,h,u<o.i?o.ins:0),s&&u<o.i&&as(s,i,o.text),u=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return s?$t.createSet(i,s):si.create(i);throw new Error("Mismatched change set lengths")}}}function tS(n,e,t=!1){let r=[],i=t?[]:null,s=new Ra(n),o=new Ra(e);for(let a=!1;;){if(s.done&&o.done)return i?$t.createSet(r,i):si.create(r);if(s.ins==0)mn(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)mn(r,0,o.ins,a),i&&as(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let u=Math.min(s.len2,o.len),h=r.length;if(s.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;mn(r,u,d,a),i&&d&&as(i,r,o.text)}else o.ins==-1?(mn(r,s.off?0:s.len,u,a),i&&as(i,r,s.textBit(u))):(mn(r,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&as(i,r,o.text));a=(s.ins>u||o.ins>=0&&o.len>u)&&(a||r.length>h),s.forward2(u),o.forward(u)}}}}class Ra{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,t=this.i-2>>1;return t>=e.length?Qe.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?Qe.empty:t[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 Qs{constructor(e,t,r){this.from=e,this.to=t,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new Qs(r,i,this.flags)}extend(e,t=e,r=0){if(e<=this.anchor&&t>=this.anchor)return Z.range(e,t,void 0,void 0,r);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Z.range(this.anchor,i,void 0,void 0,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!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 Z.range(e.anchor,e.head)}static create(e,t,r){return new Qs(e,t,r)}}class Z{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Z.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!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],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Z([this.main],0)}addRange(e,t=!0){return Z.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,Z.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 Z(e.ranges.map(t=>Qs.fromJSON(t)),e.main)}static single(e,t=e){return new Z([Z.range(e,t)],0)}static create(e,t=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 Z.normalized(e.slice(),t);r=s.to}return new Z(e,t)}static cursor(e,t=0,r,i){return Qs.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,t,r,i,s){let o=(r??16777215)<<6|(i==null?7:Math.min(6,i));return!s&&e!=t&&(s=t<e?1:-1),t<e?Qs.create(t,e,48|o):Qs.create(e,t,(s?s<0?8:16:0)|o)}static normalized(e,t=0){let r=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,u=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?Z.range(u,a):Z.range(a,u))}}return new Z(e,t)}}function nS(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let o0=0;class pe{constructor(e,t,r,i,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=i,this.id=o0++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new pe(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:l0),!!e.static,e.enables)}of(e){return new Ju([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ju(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ju(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}}function l0(n,e){return n==e||n.length==e.length&&n.every((t,r)=>t===e[r])}class Ju{constructor(e,t,r,i){this.dependencies=e,this.facet=t,this.type=r,this.value=i,this.id=o0++}dynamicSlot(e){var t;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,u=!1,h=!1,d=[];for(let p of this.dependencies)p=="doc"?u=!0:p=="selection"?h=!0:(((t=e[p.id])!==null&&t!==void 0?t:1)&1)==0&&d.push(e[p.id]);return{create(p){return p.values[o]=r(p),1},update(p,g){if(u&&g.docChanged||h&&(g.docChanged||g.selection)||Dm(p,d)){let v=r(p);if(a?!Cx(v,p.values[o],i):!i(v,p.values[o]))return p.values[o]=v,1}return 0},reconfigure:(p,g)=>{let v,x=g.config.address[s];if(x!=null){let b=Sf(g,x);if(this.dependencies.every(S=>S instanceof pe?g.facet(S)===p.facet(S):S instanceof gn?g.field(S,!1)==p.field(S,!1):!0)||(a?Cx(v=r(p),b,i):i(v=r(p),b)))return p.values[o]=b,0}else v=r(p);return p.values[o]=v,1}}}}function Cx(n,e,t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!t(n[r],e[r]))return!1;return!0}function Dm(n,e){let t=!1;for(let r of e)ma(n,r)&1&&(t=!0);return t}function s5(n,e,t){let r=t.map(u=>n[u.id]),i=t.map(u=>u.type),s=r.filter(u=>!(u&1)),o=n[e.id]>>1;function a(u){let h=[];for(let d=0;d<r.length;d++){let p=Sf(u,r[d]);if(i[d]==2)for(let g of p)h.push(g);else h.push(p)}return e.combine(h)}return{create(u){for(let h of r)ma(u,h);return u.values[o]=a(u),1},update(u,h){if(!Dm(u,s))return 0;let d=a(u);return e.compare(d,u.values[o])?0:(u.values[o]=d,1)},reconfigure(u,h){let d=Dm(u,r),p=h.config.facets[e.id],g=h.facet(e);if(p&&!d&&l0(t,p))return u.values[o]=g,0;let v=a(u);return e.compare(v,g)?(u.values[o]=g,0):(u.values[o]=v,1)}}}const vu=pe.define({static:!0});class gn{constructor(e,t,r,i,s){this.id=e,this.createF=t,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new gn(o0++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(vu).find(r=>r.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,i)=>{let s=r.values[t],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[t]=o,1)},reconfigure:(r,i)=>{let s=r.facet(vu),o=i.facet(vu),a;return(a=s.find(u=>u.field==this))&&a!=o.find(u=>u.field==this)?(r.values[t]=a.create(r),1):i.config.address[this.id]!=null?(r.values[t]=i.field(this),0):(r.values[t]=this.create(r),1)}}}init(e){return[this,vu.of({field:this,create:e})]}get extension(){return this}}const qs={lowest:4,low:3,default:2,high:1,highest:0};function ta(n){return e=>new rS(e,n)}const Ss={highest:ta(qs.highest),high:ta(qs.high),default:ta(qs.default),low:ta(qs.low),lowest:ta(qs.lowest)};class rS{constructor(e,t){this.inner=e,this.prec=t}}class gh{of(e){return new Im(this,e)}reconfigure(e){return gh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Im{constructor(e,t){this.compartment=e,this.inner=t}}class bf{constructor(e,t,r,i,s,o){for(this.base=e,this.compartments=t,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 t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,r){let i=[],s=Object.create(null),o=new Map;for(let g of o5(e,t,o))g instanceof gn?i.push(g):(s[g.facet.id]||(s[g.facet.id]=[])).push(g);let a=Object.create(null),u=[],h=[];for(let g of i)a[g.id]=h.length<<1,h.push(v=>g.slot(v));let d=r==null?void 0:r.config.facets;for(let g in s){let v=s[g],x=v[0].facet,b=d&&d[g]||[];if(v.every(S=>S.type==0))if(a[x.id]=u.length<<1|1,l0(b,v))u.push(r.facet(x));else{let S=x.combine(v.map(C=>C.value));u.push(r&&x.compare(S,r.facet(x))?r.facet(x):S)}else{for(let S of v)S.type==0?(a[S.id]=u.length<<1|1,u.push(S.value)):(a[S.id]=h.length<<1,h.push(C=>S.dynamicSlot(C)));a[x.id]=h.length<<1,h.push(S=>s5(S,x,v))}}let p=h.map(g=>g(a));return new bf(e,o,p,a,u,s)}}function o5(n,e,t){let r=[[],[],[],[],[]],i=new Map;function s(o,a){let u=i.get(o);if(u!=null){if(u<=a)return;let h=r[u].indexOf(o);h>-1&&r[u].splice(h,1),o instanceof Im&&t.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let h of o)s(h,a);else if(o instanceof Im){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,a)}else if(o instanceof rS)s(o.inner,o.prec);else if(o instanceof gn)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof Ju)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,qs.default);else{let h=o.extension;if(!h)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(h,a)}}return s(n,qs.default),r.reduce((o,a)=>o.concat(a))}function ma(n,e){if(e&1)return 2;let t=e>>1,r=n.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;n.status[t]=4;let i=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|i}function Sf(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const iS=pe.define(),Lm=pe.define({combine:n=>n.some(e=>e),static:!0}),sS=pe.define({combine:n=>n.length?n[0]:void 0,static:!0}),oS=pe.define(),lS=pe.define(),aS=pe.define(),cS=pe.define({combine:n=>n.length?n[0]:!1});class Bi{constructor(e,t){this.type=e,this.value=t}static define(){return new l5}}class l5{of(e){return new Bi(this,e)}}class a5{constructor(e){this.map=e}of(e){return new Ne(this,e)}}class Ne{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Ne(this.type,t)}is(e){return this.type==e}static define(e={}){return new a5(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(t);s&&r.push(s)}return r}}Ne.reconfigure=Ne.define();Ne.appendConfig=Ne.define();class Kt{constructor(e,t,r,i,s,o){this.startState=e,this.changes=t,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&nS(r,t.newLength),s.some(a=>a.type==Kt.time)||(this.annotations=s.concat(Kt.time.of(Date.now())))}static create(e,t,r,i,s,o){return new Kt(e,t,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 t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Kt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Kt.time=Bi.define();Kt.userEvent=Bi.define();Kt.addToHistory=Bi.define();Kt.remote=Bi.define();function c5(n,e){let t=[];for(let r=0,i=0;;){let s,o;if(r<n.length&&(i==e.length||e[i]>=n[r]))s=n[r++],o=n[r++];else if(i<e.length)s=e[i++],o=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function uS(n,e,t){var r;let i,s,o;return t?(i=e.changes,s=$t.empty(e.changes.length),o=n.changes.compose(e.changes)):(i=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=n.selection)===null||r===void 0?void 0:r.map(i),effects:Ne.mapEffects(n.effects,i).concat(Ne.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function Nm(n,e,t){let r=e.selection,i=Wo(e.annotations);return e.userEvent&&(i=i.concat(Kt.userEvent.of(e.userEvent))),{changes:e.changes instanceof $t?e.changes:$t.of(e.changes||[],t,n.facet(sS)),selection:r&&(r instanceof Z?r:Z.single(r.anchor,r.head)),effects:Wo(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function fS(n,e,t){let r=Nm(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;r=uS(r,Nm(n,e[s],o?r.changes.newLength:n.doc.length),o)}let i=Kt.create(n,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return f5(t?u5(i):i)}function u5(n){let e=n.startState,t=!0;for(let i of e.facet(oS)){let s=i(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:c5(t,s))}if(t!==!0){let i,s;if(t===!1)s=n.changes.invertedDesc,i=$t.empty(e.doc.length);else{let o=n.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=Kt.create(e,i,n.selection&&n.selection.map(s),Ne.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let r=e.facet(lS);for(let i=r.length-1;i>=0;i--){let s=r[i](n);s instanceof Kt?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Kt?n=s[0]:n=fS(e,Wo(s),!1)}return n}function f5(n){let e=n.startState,t=e.facet(aS),r=n;for(let i=t.length-1;i>=0;i--){let s=t[i](n);s&&Object.keys(s).length&&(r=uS(r,Nm(e,s,n.changes.newLength),!0))}return r==n?n:Kt.create(e,n.changes,n.selection,r.effects,r.annotations,r.scrollIntoView)}const h5=[];function Wo(n){return n==null?h5:Array.isArray(n)?n:[n]}var vt=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(vt||(vt={}));const d5=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Bm;try{Bm=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function p5(n){if(Bm)return Bm.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||d5.test(t)))return!0}return!1}function m5(n){return e=>{if(!/\S/.test(e))return vt.Space;if(p5(e))return vt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return vt.Word;return vt.Other}}class $e{constructor(e,t,r,i,s,o){this.config=e,this.doc=t,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)ma(this,a<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return ma(this,r),Sf(this,r)}update(...e){return fS(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:i}=t;for(let a of e.effects)a.is(gh.reconfigure)?(t&&(i=new Map,t.compartments.forEach((u,h)=>i.set(h,u)),t=null),i.set(a.value.compartment,a.value.extension)):a.is(Ne.reconfigure)?(t=null,r=a.value):a.is(Ne.appendConfig)&&(t=null,r=Wo(r).concat(a.value));let s;t?s=e.startState.values.slice():(t=bf.resolve(r,i,this),s=new $e(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(u,h)=>h.reconfigure(u,this),null).values);let o=e.startState.facet(Lm)?e.newSelection:e.newSelection.asSingle();new $e(t,e.newDoc,o,s,(a,u)=>u.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Z.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Wo(r.effects);for(let a=1;a<t.ranges.length;a++){let u=e(t.ranges[a]),h=this.changes(u.changes),d=h.map(i);for(let g=0;g<a;g++)s[g]=s[g].map(d);let p=i.mapDesc(h,!0);s.push(u.range.map(p)),i=i.compose(d),o=Ne.mapEffects(o,d).concat(Ne.mapEffects(Wo(u.effects),p))}return{changes:i,selection:Z.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof $t?e:$t.of(e,this.doc.length,this.facet($e.lineSeparator))}toText(e){return Qe.of(e.split(this.facet($e.lineSeparator)||Pm))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(ma(this,t),Sf(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof gn&&this.config.address[i.id]!=null&&(t[r]=i.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];i.push(o.init(u=>o.spec.fromJSON(a,u)))}}return $e.create({doc:e.doc,selection:Z.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=bf.resolve(e.extensions||[],new Map),r=e.doc instanceof Qe?e.doc:Qe.of((e.doc||"").split(t.staticFacet($e.lineSeparator)||Pm)),i=e.selection?e.selection instanceof Z?e.selection:Z.single(e.selection.anchor,e.selection.head):Z.single(0);return nS(i,r.length),t.staticFacet(Lm)||(i=i.asSingle()),new $e(t,r,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet($e.tabSize)}get lineBreak(){return this.facet($e.lineSeparator)||`
|
|
136
|
-
`}get readOnly(){return this.facet(cS)}phrase(e,...t){for(let r of this.facet($e.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let i=[];for(let s of this.facet(iS))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return m5(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let u=Zt(t,o,!1);if(s(t.slice(u,o))!=vt.Word)break;o=u}for(;a<i;){let u=Zt(t,a);if(s(t.slice(a,u))!=vt.Word)break;a=u}return o==a?null:Z.range(o+r,a+r)}}$e.allowMultipleSelections=Lm;$e.tabSize=pe.define({combine:n=>n.length?n[0]:4});$e.lineSeparator=sS;$e.readOnly=cS;$e.phrases=pe.define({compare(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length==r.length&&t.every(i=>n[i]==e[i])}});$e.languageData=iS;$e.changeFilter=oS;$e.transactionFilter=lS;$e.transactionExtender=aS;gh.reconfigure=Ne.define();function li(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class ps{eq(e){return this==e}range(e,t=e){return Fm.create(e,t,this)}}ps.prototype.startSide=ps.prototype.endSide=0;ps.prototype.point=!1;ps.prototype.mapMode=Cn.TrackDel;function a0(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let Fm=class hS{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new hS(e,t,r)}};function _m(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class c0{constructor(e,t,r,i){this.from=e,this.to=t,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let u=o+a>>1,h=s[u]-e||(r?this.value[u].endSide:this.value[u].startSide)-t;if(u==o)return h>=0?o:a;h>=0?a=u:o=u+1}}between(e,t,r,i){for(let s=this.findIndex(t,-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,t){let r=[],i=[],s=[],o=-1,a=-1;for(let u=0;u<this.value.length;u++){let h=this.value[u],d=this.from[u]+e,p=this.to[u]+e,g,v;if(d==p){let x=t.mapPos(d,h.startSide,h.mapMode);if(x==null||(g=v=x,h.startSide!=h.endSide&&(v=t.mapPos(d,h.endSide),v<g)))continue}else if(g=t.mapPos(d,h.startSide),v=t.mapPos(p,h.endSide),g>v||g==v&&h.startSide>0&&h.endSide<=0)continue;(v-g||h.endSide-h.startSide)<0||(o<0&&(o=g),h.point&&(a=Math.max(a,v-g)),r.push(h),i.push(g-o),s.push(v-o))}return{mapped:r.length?new c0(i,s,r,a):null,pos:o}}}class He{constructor(e,t,r,i){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=i}static create(e,t,r,i){return new He(e,t,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 t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(_m)),this.isEmpty)return t.length?He.of(t):this;let a=new dS(this,null,-1).goto(0),u=0,h=[],d=new Ai;for(;a.value||u<t.length;)if(u<t.length&&(a.from-t[u].from||a.startSide-t[u].value.startSide)>=0){let p=t[u++];d.addInner(p.from,p.to,p.value)||h.push(p)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(u==t.length||this.chunkEnd(a.chunkIndex)<t[u].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||h.push(Fm.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!h.length?He.empty:this.nextLayer.update({add:h,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],u=this.chunk[o],h=e.touchesRange(a,a+u.length);if(h===!1)i=Math.max(i,u.maxPoint),t.push(u),r.push(e.mapPos(a));else if(h===!0){let{mapped:d,pos:p}=u.map(a,e);d&&(i=Math.max(i,d.maxPoint),t.push(d),r.push(p))}}let s=this.nextLayer.map(e);return t.length==0?s:new He(r,t,s||He.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Oa.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Oa.from(e).goto(t)}static compare(e,t,r,i,s=-1){let o=e.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=s),a=t.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=s),u=Ex(o,a,r),h=new na(o,u,s),d=new na(a,u,s);r.iterGaps((p,g,v)=>Tx(h,p,d,g,v,i)),r.empty&&r.length==0&&Tx(h,0,d,0,0,i)}static eq(e,t,r=0,i){i==null&&(i=999999999);let s=e.filter(d=>!d.isEmpty&&t.indexOf(d)<0),o=t.filter(d=>!d.isEmpty&&e.indexOf(d)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=Ex(s,o),u=new na(s,a,0).goto(r),h=new na(o,a,0).goto(r);for(;;){if(u.to!=h.to||!jm(u.active,h.active)||u.point&&(!h.point||!a0(u.point,h.point)))return!1;if(u.to>i)return!0;u.next(),h.next()}}static spans(e,t,r,i,s=-1){let o=new na(e,null,s).goto(t),a=t,u=o.openStart;for(;;){let h=Math.min(o.to,r);if(o.point){let d=o.activeForPoint(o.to),p=o.pointFrom<t?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,u);i.point(a,h,o.point,d,p,o.pointRank),u=Math.min(o.openEnd(h),d.length)}else h>a&&(i.span(a,h,o.active,u),u=o.openEnd(h));if(o.to>r)return u+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,t=!1){let r=new Ai;for(let i of e instanceof Fm?[e]:t?g5(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return He.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=He.empty;i=i.nextLayer)t=new He(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}He.empty=new He([],[],null,-1);function g5(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let r=n[t];if(_m(e,r)>0)return n.slice().sort(_m);e=r}return n}He.empty.nextLayer=He.empty;class Ai{finishChunk(e){this.chunks.push(new c0(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,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new Ai)).add(e,t,r)}addInner(e,t,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(t-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(He.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=He.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Ex(n,e,t){let r=new Map;for(let s of n)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!(t!=null&&t.touchesRange(a,a+s.chunk[o].length))&&i.add(s.chunk[o])}return i}class dS{constructor(e,t,r,i=0){this.layer=e,this.skip=t,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,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,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],t,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!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],t=this.layer.chunk[this.chunkIndex],r=e+t.from[this.rangeIndex];if(this.from=r,this.to=e+t.to[this.rangeIndex],this.value=t.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 Oa{constructor(e){this.heap=e}static from(e,t=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 dS(o,t,r,s));return i.length==1?i[0]:new Oa(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)Fp(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)Fp(this.heap,r);(this.to-e||this.value.endSide-t)<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(),Fp(this.heap,0)}}}function Fp(n,e){for(let t=n[e];;){let r=(e<<1)+1;if(r>=n.length)break;let i=n[r];if(r+1<n.length&&i.compare(n[r+1])>=0&&(i=n[r+1],r++),t.compare(i)<0)break;n[r]=t,n[e]=i,e=r}}class na{constructor(e,t,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=Oa.from(e,t,r)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){xu(this.active,e),xu(this.activeTo,e),xu(this.activeRank,e),this.minActive=Rx(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||i-this.activeTo[t])>0;)t++;wu(this.active,t,r),wu(this.activeTo,t,i),wu(this.activeRank,t,s),e&&wu(e,t,this.cursor.from),this.minActive=Rx(this.active,this.activeTo)}next(){let e=this.to,t=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&&xu(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(t&&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 t=[];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)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}}function Tx(n,e,t,r,i,s){n.goto(e),t.goto(r);let o=r+i,a=r,u=r-e,h=!!s.boundChange;for(let d=!1;;){let p=n.to+u-t.to,g=p||n.endSide-t.endSide,v=g<0?n.to+u:t.to,x=Math.min(v,o);if(n.point||t.point?(n.point&&t.point&&a0(n.point,t.point)&&jm(n.activeForPoint(n.to),t.activeForPoint(t.to))||s.comparePoint(a,x,n.point,t.point),d=!1):(d&&s.boundChange(a),x>a&&!jm(n.active,t.active)&&s.compareRange(a,x,n.active,t.active),h&&x<o&&(p||n.openEnd(v)!=t.openEnd(v))&&(d=!0)),v>o)break;a=v,g<=0&&n.next(),g>=0&&t.next()}}function jm(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!a0(n[t],e[t]))return!1;return!0}function xu(n,e){for(let t=e,r=n.length-1;t<r;t++)n[t]=n[t+1];n.pop()}function wu(n,e,t){for(let r=n.length-1;r>=e;r--)n[r+1]=n[r];n[e]=t}function Rx(n,e){let t=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||n[i].endSide-n[t].endSide)<0&&(t=i,r=e[i]);return t}function ul(n,e,t=n.length){let r=0;for(let i=0;i<t&&i<n.length;)n.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=Zt(n,i));return r}function zm(n,e,t,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==n.length)break;s+=n.charCodeAt(i)==9?t-s%t:1,i=Zt(n,i)}return r===!0?-1:n.length}const Wm="ͼ",Ox=typeof Symbol>"u"?"__"+Wm:Symbol.for(Wm),Hm=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Px=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ms{constructor(e,t){this.rules=[];let{finish:r}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,u,h){let d=[],p=/^@(\w+)\b/.exec(o[0]),g=p&&p[1]=="keyframes";if(p&&a==null)return u.push(o[0]+";");for(let v in a){let x=a[v];if(/&/.test(v))s(v.split(/,\s*/).map(b=>o.map(S=>b.replace(/&/,S))).reduce((b,S)=>b.concat(S)),x,u);else if(x&&typeof x=="object"){if(!p)throw new RangeError("The value of a property ("+v+") should be a primitive value.");s(i(v),x,d,g)}else x!=null&&d.push(v.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+x+";")}(d.length||g)&&u.push((r&&!p&&!h?o.map(r):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
137
|
-
`)}static newName(){let e=Px[Ox]||1;return Px[Ox]=e+1,Wm+e.toString(36)}static mount(e,t,r){let i=e[Hm],s=r&&r.nonce;i?s&&i.setNonce(s):i=new y5(e,s),i.mount(Array.isArray(t)?t:[t],e)}}let Mx=new Map;class y5{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Mx.get(r);if(s)return e[Hm]=s;this.sheet=new i.CSSStyleSheet,Mx.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Hm]=this}mount(e,t){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],u=this.modules.indexOf(a);if(u<s&&u>-1&&(this.modules.splice(u,1),s--,u=-1),u==-1){if(this.modules.splice(s++,0,a),r)for(let h=0;h<a.rules.length;h++)r.insertRule(a.rules[h],i++)}else{for(;s<u;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let u=0;u<this.modules.length;u++)o+=this.modules[u].getRules()+`
|
|
138
|
-
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var gs={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:"'"},Pa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},v5=typeof navigator<"u"&&/Mac/.test(navigator.platform),x5=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var cn=0;cn<10;cn++)gs[48+cn]=gs[96+cn]=String(cn);for(var cn=1;cn<=24;cn++)gs[cn+111]="F"+cn;for(var cn=65;cn<=90;cn++)gs[cn]=String.fromCharCode(cn+32),Pa[cn]=String.fromCharCode(cn);for(var _p in gs)Pa.hasOwnProperty(_p)||(Pa[_p]=gs[_p]);function w5(n){var e=v5&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||x5&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Pa:gs)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function rt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];typeof i=="string"?n.setAttribute(r,i):i!=null&&(n[r]=i)}e++}for(;e<arguments.length;e++)pS(n,arguments[e]);return n}function pS(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)pS(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let kn=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Vm=typeof document<"u"?document:{documentElement:{style:{}}};const $m=/Edge\/(\d+)/.exec(kn.userAgent),mS=/MSIE \d/.test(kn.userAgent),Um=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(kn.userAgent),yh=!!(mS||Um||$m),Ax=!yh&&/gecko\/(\d+)/i.test(kn.userAgent),jp=!yh&&/Chrome\/(\d+)/.exec(kn.userAgent),Dx="webkitFontSmoothing"in Vm.documentElement.style,qm=!yh&&/Apple Computer/.test(kn.vendor),Ix=qm&&(/Mobile\/\w+/.test(kn.userAgent)||kn.maxTouchPoints>2);var ge={mac:Ix||/Mac/.test(kn.platform),windows:/Win/.test(kn.platform),linux:/Linux|X11/.test(kn.platform),ie:yh,ie_version:mS?Vm.documentMode||6:Um?+Um[1]:$m?+$m[1]:0,gecko:Ax,gecko_version:Ax?+(/Firefox\/(\d+)/.exec(kn.userAgent)||[0,0])[1]:0,chrome:!!jp,chrome_version:jp?+jp[1]:0,ios:Ix,android:/Android\b/.test(kn.userAgent),webkit:Dx,webkit_version:Dx?+(/\bAppleWebKit\/(\d+)/.exec(kn.userAgent)||[0,0])[1]:0,safari:qm,safari_version:qm?+(/\bVersion\/(\d+(\.\d+)?)/.exec(kn.userAgent)||[0,0])[1]:0,tabSize:Vm.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function u0(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const kf=Object.create(null);function f0(n,e,t){if(n==e)return!0;n||(n=kf),e||(e=kf);let r=Object.keys(n),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=t&&(i.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function b5(n,e){for(let t=n.attributes.length-1;t>=0;t--){let r=n.attributes[t].name;e[r]==null&&n.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?n.style.cssText=r:n.getAttribute(t)!=r&&n.setAttribute(t,r)}}function Lx(n,e,t){let r=!1;if(e)for(let i in e)t&&i in t||(r=!0,i=="style"?n.style.cssText="":n.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(r=!0,i=="style"?n.style.cssText=t[i]:n.setAttribute(i,t[i]));return r}function S5(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];e[r.name]=r.value}return e}class ai{eq(e){return!1}updateDOM(e,t,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,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var un=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(un||(un={}));class Te extends ps{constructor(e,t,r,i){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Xa(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new no(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=gS(e,t);r=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new no(e,r,i,t,e.widget||null,!0)}static line(e){return new Ja(e)}static set(e,t=!1){return He.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Te.none=He.empty;class Xa extends Te{constructor(e){let{start:t,end:r}=gS(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?u0(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||kf}eq(e){return this==e||e instanceof Xa&&this.tagName==e.tagName&&f0(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Xa.prototype.point=!1;class Ja extends Te{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ja&&this.spec.class==e.spec.class&&f0(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Ja.prototype.mapMode=Cn.TrackBefore;Ja.prototype.point=!0;class no extends Te{constructor(e,t,r,i,s,o){super(t,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?Cn.TrackBefore:Cn.TrackAfter:Cn.TrackDel}get type(){return this.startSide!=this.endSide?un.WidgetRange:this.startSide<=0?un.WidgetBefore:un.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof no&&k5(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}no.prototype.point=!0;function gS(n,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=n;return t==null&&(t=n.inclusive),r==null&&(r=n.inclusive),{start:t??e,end:r??e}}function k5(n,e){return n==e||!!(n&&e&&n.compare(e))}function Ho(n,e,t,r=0){let i=t.length-1;i>=0&&t[i]+r>=n?t[i]=Math.max(t[i],e):t.push(n,e)}class Ma extends ps{constructor(e,t,r){super(),this.tagName=e,this.attributes=t,this.rank=r}eq(e){return e==this||e instanceof Ma&&this.tagName==e.tagName&&f0(this.attributes,e.attributes)}static create(e){return new Ma(e.tagName,e.attributes||kf,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return He.of(e,t)}}Ma.prototype.startSide=Ma.prototype.endSide=-1;function Aa(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Km(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function ga(n,e){if(!e.anchorNode)return!1;try{return Km(n,e.anchorNode)}catch{return!1}}function ya(n){return n.nodeType==3?Ia(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function va(n,e,t,r){return t?Nx(n,e,t,r,-1)||Nx(n,e,t,r,1):!1}function ys(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function Cf(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function Nx(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Di(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=ys(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=i<0?Di(n):0}else return!1}}function Di(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Da(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function C5(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function yS(n,e){let t=e.width/n.offsetWidth,r=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-n.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function E5(n,e,t,r,i,s,o,a){let u=n.ownerDocument,h=u.defaultView||window;for(let d=n,p=!1;d&&!p;)if(d.nodeType==1){let g,v=d==u.body,x=1,b=1;if(v)g=C5(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(p=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let R=d.getBoundingClientRect();({scaleX:x,scaleY:b}=yS(d,R)),g={left:R.left,right:R.left+d.clientWidth*x,top:R.top,bottom:R.top+d.clientHeight*b}}let S=0,C=0;if(i=="nearest")e.top<g.top+o?(C=e.top-(g.top+o),t>0&&e.bottom>g.bottom+C&&(C=e.bottom-g.bottom+o)):e.bottom>g.bottom-o&&(C=e.bottom-g.bottom+o,t<0&&e.top-C<g.top&&(C=e.top-(g.top+o)));else{let R=e.bottom-e.top,O=g.bottom-g.top;C=(i=="center"&&R<=O?e.top+R/2-O/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-O+o)-g.top}if(r=="nearest"?e.left<g.left+s?(S=e.left-(g.left+s),t>0&&e.right>g.right+S&&(S=e.right-g.right+s)):e.right>g.right-s&&(S=e.right-g.right+s,t<0&&e.left<g.left+S&&(S=e.left-(g.left+s))):S=(r=="center"?e.left+(e.right-e.left)/2-(g.right-g.left)/2:r=="start"==a?e.left-s:e.right-(g.right-g.left)+s)-g.left,S||C)if(v)h.scrollBy(S,C);else{let R=0,O=0;if(C){let P=d.scrollTop;d.scrollTop+=C/b,O=(d.scrollTop-P)*b}if(S){let P=d.scrollLeft;d.scrollLeft+=S/x,R=(d.scrollLeft-P)*x}e={left:e.left-R,top:e.top-O,right:e.right-R,bottom:e.bottom-O},R&&Math.abs(R-S)<1&&(r="nearest"),O&&Math.abs(O-C)<1&&(i="nearest")}if(v)break;(e.top<g.top||e.bottom>g.bottom||e.left<g.left||e.right>g.right)&&(e={left:Math.max(e.left,g.left),right:Math.min(e.right,g.right),top:Math.max(e.top,g.top),bottom:Math.min(e.bottom,g.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function vS(n,e=!0){let t=n.ownerDocument,r=null,i=null;for(let s=n.parentNode;s&&!(s==t.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 T5{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:t,focusNode:r}=e;this.set(t,Math.min(e.anchorOffset,t?Di(t):0),r,Math.min(e.focusOffset,r?Di(r):0))}set(e,t,r,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=i}}let $s=null;ge.safari&&ge.safari_version>=26&&($s=!1);function xS(n){if(n.setActive)return n.setActive();if($s)return n.focus($s);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus($s==null?{get preventScroll(){return $s={preventScroll:!0},!0}}:void 0),!$s){$s=!1;for(let t=0;t<e.length;){let r=e[t++],i=e[t++],s=e[t++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let Bx;function Ia(n,e,t=e){let r=Bx||(Bx=document.createRange());return r.setEnd(n,t),r.setStart(n,e),r}function Vo(n,e,t,r){let i={key:e,code:e,keyCode:t,which:t,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,n.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,n.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function R5(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function O5(n,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,Di(t));;)if(r){if(t.nodeType!=1)return!1;let i=t.childNodes[r-1];i.contentEditable=="false"?r--:(t=i,r=Di(t))}else{if(t==n)return!0;r=ys(t),t=t.parentNode}}function wS(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function bS(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=Di(t)}else if(t.parentNode&&!Cf(t))r=ys(t),t=t.parentNode;else return null}}function SS(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!Cf(t))r=ys(t)+1,t=t.parentNode;else return null}}class Ir{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new Ir(e.parentNode,ys(e),t)}static after(e,t){return new Ir(e.parentNode,ys(e)+1,t)}}var at=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(at||(at={}));const ro=at.LTR,h0=at.RTL;function kS(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const P5=kS("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),M5=kS("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Qm=Object.create(null),Kr=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);Qm[e]=t,Qm[t]=-e}function CS(n){return n<=247?P5[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?M5[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const A5=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ti{get dir(){return this.level%2?h0:ro}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==r)return o;(s<0||(i!=0?i<0?a.from<t:a.to>t:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function ES(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],i=e[t];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!ES(r.inner,i.inner))return!1}return!0}const ot=[];function D5(n,e,t,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:t,u=s?256:i;for(let h=o,d=u,p=u;h<a;h++){let g=CS(n.charCodeAt(h));g==512?g=d:g==8&&p==4&&(g=16),ot[h]=g==4?2:g,g&7&&(p=g),d=g}for(let h=o,d=u,p=u;h<a;h++){let g=ot[h];if(g==128)h<a-1&&d==ot[h+1]&&d&24?g=ot[h]=d:ot[h]=256;else if(g==64){let v=h+1;for(;v<a&&ot[v]==64;)v++;let x=h&&d==8||v<t&&ot[v]==8?p==1?1:8:256;for(let b=h;b<v;b++)ot[b]=x;h=v-1}else g==8&&p==1&&(ot[h]=1);d=g,g&7&&(p=g)}}}function I5(n,e,t,r,i){let s=i==1?2:1;for(let o=0,a=0,u=0;o<=r.length;o++){let h=o?r[o-1].to:e,d=o<r.length?r[o].from:t;for(let p=h,g,v,x;p<d;p++)if(v=Qm[g=n.charCodeAt(p)])if(v<0){for(let b=a-3;b>=0;b-=3)if(Kr[b+1]==-v){let S=Kr[b+2],C=S&2?i:S&4?S&1?s:i:0;C&&(ot[p]=ot[Kr[b]]=C),a=b;break}}else{if(Kr.length==189)break;Kr[a++]=p,Kr[a++]=g,Kr[a++]=u}else if((x=ot[p])==2||x==1){let b=x==i;u=b?0:1;for(let S=a-3;S>=0;S-=3){let C=Kr[S+2];if(C&2)break;if(b)Kr[S+2]|=2;else{if(C&4)break;Kr[S+2]|=4}}}}}function L5(n,e,t,r){for(let i=0,s=r;i<=t.length;i++){let o=i?t[i-1].to:n,a=i<t.length?t[i].from:e;for(let u=o;u<a;){let h=ot[u];if(h==256){let d=u+1;for(;;)if(d==a){if(i==t.length)break;d=t[i++].to,a=i<t.length?t[i].from:e}else if(ot[d]==256)d++;else break;let p=s==1,g=(d<e?ot[d]:r)==1,v=p==g?p?1:2:r;for(let x=d,b=i,S=b?t[b-1].to:n;x>u;)x==S&&(x=t[--b].from,S=b?t[b-1].to:n),ot[--x]=v;u=d}else s=h,u++}}}function Ym(n,e,t,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let u=e,h=0;u<t;){let d=!0,p=!1;if(h==s.length||u<s[h].from){let b=ot[u];b!=a&&(d=!1,p=b==16)}let g=!d&&a==1?[]:null,v=d?r:r+1,x=u;e:for(;;)if(h<s.length&&x==s[h].from){if(p)break e;let b=s[h];if(!d)for(let S=b.to,C=h+1;;){if(S==t)break e;if(C<s.length&&s[C].from==S)S=s[C++].to;else{if(ot[S]==a)break e;break}}if(h++,g)g.push(b);else{b.from>u&&o.push(new ti(u,b.from,v));let S=b.direction==ro!=!(v%2);Gm(n,S?r+1:r,i,b.inner,b.from,b.to,o),u=b.to}x=b.to}else{if(x==t||(d?ot[x]!=a:ot[x]==a))break;x++}g?Ym(n,u,x,r+1,i,g,o):u<x&&o.push(new ti(u,x,v)),u=x}else for(let u=t,h=s.length;u>e;){let d=!0,p=!1;if(!h||u>s[h-1].to){let b=ot[u-1];b!=a&&(d=!1,p=b==16)}let g=!d&&a==1?[]:null,v=d?r:r+1,x=u;e:for(;;)if(h&&x==s[h-1].to){if(p)break e;let b=s[--h];if(!d)for(let S=b.from,C=h;;){if(S==e)break e;if(C&&s[C-1].to==S)S=s[--C].from;else{if(ot[S-1]==a)break e;break}}if(g)g.push(b);else{b.to<u&&o.push(new ti(b.to,u,v));let S=b.direction==ro!=!(v%2);Gm(n,S?r+1:r,i,b.inner,b.from,b.to,o),u=b.from}x=b.from}else{if(x==e||(d?ot[x-1]!=a:ot[x-1]==a))break;x--}g?Ym(n,x,u,r+1,i,g,o):x<u&&o.push(new ti(x,u,v)),u=x}}function Gm(n,e,t,r,i,s,o){let a=e%2?2:1;D5(n,i,s,r,a),I5(n,i,s,r,a),L5(i,s,r,a),Ym(n,i,s,e,t,r,o)}function N5(n,e,t){if(!n)return[new ti(0,0,e==h0?1:0)];if(e==ro&&!t.length&&!A5.test(n))return TS(n.length);if(t.length)for(;n.length>ot.length;)ot[ot.length]=256;let r=[],i=e==ro?0:1;return Gm(n,i,i,t,0,n.length,r),r}function TS(n){return[new ti(0,n,0)]}let RS="";function B5(n,e,t,r,i){var s;let o=r.head-n.from,a=ti.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),u=e[a],h=u.side(i,t);if(o==h){let g=a+=i?1:-1;if(g<0||g>=e.length)return null;u=e[a=g],o=u.side(!i,t),h=u.side(i,t)}let d=Zt(n.text,o,u.forward(i,t));(d<u.from||d>u.to)&&(d=h),RS=n.text.slice(Math.min(o,d),Math.max(o,d));let p=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return p&&d==h&&p.level+(i?0:1)<u.level?Z.cursor(p.side(!i,t)+n.from,p.forward(i,t)?1:-1,p.level):Z.cursor(d+n.from,u.forward(i,t)?-1:1,u.level)}function F5(n,e,t){for(let r=e;r<t;r++){let i=CS(n.charCodeAt(r));if(i==1)return ro;if(i==2||i==4)return h0}return ro}const OS=pe.define(),PS=pe.define(),MS=pe.define(),AS=pe.define(),Xm=pe.define(),DS=pe.define(),IS=pe.define(),d0=pe.define(),p0=pe.define(),LS=pe.define({combine:n=>n.some(e=>e)}),NS=pe.define({combine:n=>n.some(e=>e)}),BS=pe.define();class $o{constructor(e,t,r,i,s,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new $o(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 $o(Z.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const bu=Ne.define({map:(n,e)=>n.map(e)}),FS=Ne.define();function Wn(n,e,t){let r=n.facet(AS);r.length?r[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Ci=pe.define({combine:n=>n.length?n[0]:!0});let _5=0;const No=pe.define({combine(n){return n.filter((e,t)=>{for(let r=0;r<t;r++)if(n[r].plugin==e.plugin)return!1;return!0})}});class Mt{constructor(e,t,r,i,s){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(No.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(No.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=t||{};return new Mt(_5++,e,r,i,a=>{let u=[];return o&&u.push(vh.of(h=>{let d=h.plugin(a);return d?o(d):Te.none})),s&&u.push(s(a)),u})}static fromClass(e,t){return Mt.define((r,i)=>new e(r,i),t)}}class zp{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 t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(Wn(t.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(t){Wn(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(r){Wn(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const _S=pe.define(),m0=pe.define(),vh=pe.define(),jS=pe.define(),g0=pe.define(),Za=pe.define(),zS=pe.define();function Fx(n,e){let t=n.state.facet(zS);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(n):s),i=[];return He.spans(r,e.from,e.to,{point(){},span(s,o,a,u){let h=s-e.from,d=o-e.from,p=i;for(let g=a.length-1;g>=0;g--,u--){let v=a[g].spec.bidiIsolate,x;if(v==null&&(v=F5(e.text,h,d)),u>0&&p.length&&(x=p[p.length-1]).to==h&&x.direction==v)x.to=d,p=x.inner;else{let b={from:h,to:d,direction:v,inner:[]};p.push(b),p=b.inner}}}}),i}const WS=pe.define();function y0(n){let e=0,t=0,r=0,i=0;for(let s of n.state.facet(WS)){let o=s(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:t,top:r,bottom:i}}const aa=pe.define();class mr{constructor(e,t,r,i){this.fromA=e,this.toA=t,this.fromB=r,this.toB=i}join(e){return new mr(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 t=e.length,r=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let i=0,s=0,o=0;;){let a=i<e.length?e[i].fromB:1e9,u=s<t.length?t[s]:1e9,h=Math.min(a,u);if(h==1e9)break;let d=h+o,p=h,g=d;for(;;)if(s<t.length&&t[s]<=p){let v=t[s+1];s+=2,p=Math.max(p,v);for(let x=i;x<e.length&&e[x].fromB<=p;x++)o=e[x].toA-e[x].toB;g=Math.max(g,v+o)}else if(i<e.length&&e[i].fromB<=p){let v=e[i++];p=Math.max(p,v.toB),g=Math.max(g,v.toA),o=v.toA-v.toB}else break;r.push(new mr(d,g,h,p))}return r}}class Ef{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=$t.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,u)=>i.push(new mr(s,o,a,u))),this.changedRanges=i}static create(e,t,r){return new Ef(e,t,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 j5=[];class Pt{constructor(e,t,r=0){this.dom=e,this.length=t,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return j5}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 t=this.domAttrs;t&&b5(this.dom,t)}}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,t=this.posAtStart){let r=t;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,t){return null}domPosFor(e,t){let r=ys(this.dom),i=this.length?e>0:t>0;return new Ir(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 wh)return e;return null}static get(e){return e.cmTile}}class xh extends Pt{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 t=this.dom,r=null,i,s=(e==null?void 0:e.node)==t?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,i=r?r.nextSibling:t.firstChild,s&&i!=a.dom&&(s.written=!0),a.dom.parentNode==t)for(;i&&i!=a.dom;)i=_x(i);else t.insertBefore(a.dom,i);r=a.dom}for(i=r?r.nextSibling:t.firstChild,s&&i&&(s.written=!0);i;)i=_x(i);this.length=o}}function _x(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class wh extends xh{constructor(e,t){super(t),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 t=Pt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!t.length)return;r=r.parent,r.breakAfter&&s++,i=t.pop()}else{let o=r.children[i++];if(o instanceof Ti)t.push(i),r=o,i=0;else{let a=s+o.length,u=e(o,s);if(u!==void 0)return u;s=a+o.breakAfter}}}resolveBlock(e,t){let r,i=-1,s,o=-1;if(this.blockTiles((a,u)=>{let h=u+a.length;if(e>=u&&e<=h){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(u<e||e==h&&(t<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,i=e-u),(h>e||e==u&&(t>1?a.length:a.covers(-1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,o=e-u)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&t<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class Ti extends xh{constructor(e,t){super(e),this.wrapper=t}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,t){let r=new Ti(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class Jo extends xh{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,r){let i=new Jo(t||document.createElement("div"),e);return(!t||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,r){let i=null,s=-1,o=null,a=-1;function u(d,p){for(let g=0,v=0;g<d.children.length&&v<=p;g++){let x=d.children[g],b=v+x.length;b>=p&&(x.isComposite()?u(x,p-v):(!o||o.isHidden&&(t>0||r&&W5(o,x)))&&(b>p||x.flags&32)?(o=x,a=p-v):(v<p||x.flags&16&&!x.isHidden)&&(i=x,s=p-v)),v=b}}u(this,e);let h=(t<0?i:o)||i||o;return h?{tile:h,offset:h==i?s:a}:null}coordsIn(e,t){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t):z5(this)}domIn(e,t){let r=this.resolveInline(e,t);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new Ir(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:t);let o=r.tile.parent,a=!1;for(let u of o.children){if(a)return new Ir(u.dom,0);u==r.tile&&(a=!0)}}return new Ir(this.dom,0)}}function z5(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=ya(e);return t[t.length-1]||null}function W5(n,e){let t=n.coordsIn(0,1),r=e.coordsIn(0,1);return t&&r&&r.top<t.bottom}class zn extends xh{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let r=new zn(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class Ys extends Pt{constructor(e,t){super(e,t.length),this.text=t}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,t){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&t<0||e==r&&t>=0?ge.chrome||ge.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):t<0?i--:s<r&&s++;let a=Ia(this.dom,i,s).getClientRects();if(!a.length)return null;let u=a[(o?o<0:t>=0)?0:a.length-1];return ge.safari&&!o&&u.width==0&&(u=Array.prototype.find.call(a,h=>h.width)||u),o?Da(u,o<0):u||null}static of(e,t){let r=new Ys(t||document.createTextNode(e),e);return t||(r.flags|=2),r}}class io extends Pt{constructor(e,t,r,i){super(e,t,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,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,r){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(r)return Da(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let u=a?s.length-1:0;o=s[u],!(e>0?u==0:u==s.length-1||o.top<o.bottom);u+=a?-1:1);return Da(o,!a)}}get overrideDOMText(){if(!this.length)return Qe.empty;let{root:e}=this;if(!e)return Qe.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,r,i,s){return s||(s=e.toDOM(t),e.editable||(s.contentEditable="false")),new io(s,r,e,i)}}class Tf extends Pt{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return Qe.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class H5{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,r){let{tile:i,index:s,beforeBreak:o,parents:a}=this;for(;e||t>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!a.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++}else{let u=i.children[s],h=u.breakAfter;(t>0?u.length<=e:u.length<e)&&(!r||r.skip(u,0,u.length)!==!1||!u.isComposite)?(o=!!h,s++,e-=u.length):(a.push({tile:i,index:s}),i=u,s=0,r&&u.isComposite()&&r.enter(u))}else if(s==i.length)o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++;else if(e){let u=Math.min(e,i.length-s);r&&r.skip(i,s,s+u),e-=u,s+=u}else 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 V5{constructor(e,t,r,i){this.from=e,this.to=t,this.wrapper=r,this.rank=i}}class $5{constructor(e,t,r){this.cache=e,this.root=t,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,r,i){var s;this.flushBuffer();let o=this.ensureMarks(t,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let u=o.children[o.children.length-1]=new Ys(a.dom,a.text+e);u.parent=o}else o.append(i||Ys.of(e,(s=this.cache.find(Ys))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let r=this.curLine;r.dom!=t.line.dom&&(r.setDOM(this.cache.reused.has(t.line)?Wp(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=r;for(let a=t.marks.length-1;a>=0;a--){let u=t.marks[a],h=i.lastChild;if(h instanceof zn&&h.mark.eq(u.mark))h.dom!=u.dom&&h.setDOM(Wp(u.dom)),i=h;else{if(this.cache.reused.get(u)){let p=Pt.get(u.dom);p&&p.setDOM(Wp(u.dom))}let d=zn.of(u.mark,u.dom);i.append(d),i=d}this.cache.reused.set(u,2)}let s=Pt.get(e.text);s&&this.cache.reused.set(s,2);let o=new Ys(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,t,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(t,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,r){this.flushBuffer(),this.ensureMarks(t,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 t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var r;e||(e=HS);let i=Jo.start(e,t||((r=this.cache.find(Jo))===null||r===void 0?void 0:r.dom),!!t);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,t){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(t>0&&(a=i.lastChild)&&a instanceof zn&&a.mark.eq(o))i=a,t--;else{let u=zn.of(o,(r=this.cache.find(zn,h=>h.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(u),i=u,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!jx(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(ge.ios&&jx(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Hp,0,32)||new io(Hp.toDOM(),0,Hp,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 t=e.rank*102+e.value.rank,r=new V5(e.from,e.to,e.value,t),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 t=this.root;for(let r of this.wrappers){let i=t.lastChild;if(r.from<this.pos&&i instanceof Ti&&i.wrapper.eq(r.wrapper))t=i;else{let s=Ti.of(r.wrapper,(e=this.cache.find(Ti,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),r=this.cache.find(Tf,void 0,1);return r&&(r.flags=t),r||new Tf(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class U5{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 a=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,t);return this.textOff=t,r}}const Rf=[io,Jo,Ys,zn,Tf,Ti,wh];for(let n=0;n<Rf.length;n++)Rf[n].bucket=n;class q5{constructor(e){this.view=e,this.buckets=Rf.map(()=>[]),this.index=Rf.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,r=this.buckets[t];r.length<6?r.push(e):r[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let a=s.length-1;a>=0;a--){let u=(a+o)%s.length,h=s[u];if((!t||t(h))&&!this.reused.has(h))return s.splice(u,1),u<o&&this.index[i]--,this.reused.set(h,r),h}return null}findWidget(e,t,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 a=i[s];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view,a.widget)))return i.splice(s,1),s<this.index[0]&&this.index[0]--,a.widget==e&&a.length==t&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new io(a.dom,t,e,a.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class K5{constructor(e,t,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new q5(e),this.text=new U5(e.state.doc),this.builder=new $5(this.cache,new wh(e,e.contentDOM),He.iter(r)),this.cache.reused.set(t,2),this.old=new H5(t),this.reuseWalker={skip:(o,a,u)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let r=t&&this.getCompositionContext(t.text);for(let i=0,s=0,o=0;;){let a=o<e.length?e[o++]:null,u=a?a.fromA:this.old.root.length;if(u>i){let h=u-i;this.preserve(h,!o,!a),i=u,s+=h}if(!a)break;t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA?(this.forward(a.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(s,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,r),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,a.toA),this.emit(t.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(s,a.toB)),s=a.toB,i=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,r){let i=G5(this.old),s=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,u)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(u-a);else{let h=u>0||a<o.length?io.of(o.widget,this.view,u-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);h.flags&256?(h.flags&=-2,this.builder.addBlockWidget(h)):(this.builder.ensureLine(null),this.builder.addInlineWidget(h,i,s),s=i.length)}else if(o.isText())this.builder.ensureLine(null),!a&&u==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(a,u),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 Tf)this.cache.add(o);else if(o instanceof zn)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 zn&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof zn&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let r=null,i=this.builder,s=0,o=He.spans(this.decorations,e,t,{point:(a,u,h,d,p,g)=>{if(h instanceof no){if(this.disallowBlockEffectsFor[g]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(u>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=d.length,p>d.length)i.continueWidget(u-a);else{let v=h.widget||(h.block?Zo.block:Zo.inline),x=Q5(h),b=this.cache.findWidget(v,u-a,x)||io.of(v,this.view,u-a,x);h.block?(h.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(b)):(i.ensureLine(r),i.addInlineWidget(b,d,p))}r=null}else r=Y5(r,h);u>a&&this.text.skip(u-a)},span:(a,u,h,d)=>{for(let p=a;p<u;){let g=this.text.next(Math.min(512,u-p));g==null?(i.addLineStartIfNotCovered(r),i.addBreak(),p++):(i.ensureLine(r),i.addText(g,h,p==a?d:h.length),p+=g.length),r=null}}});i.addLineStartIfNotCovered(r),this.openWidget=o>s,this.openMarks=o}forward(e,t,r=1){t-e<=10?this.old.advance(t-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let t=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=Pt.get(i);if(i==this.view.contentDOM)break;s instanceof zn?t.push(s):s!=null&&s.isLine()?r=s:s instanceof Ti||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new Jo(i,HS):r||t.push(zn.of(new Xa({tagName:i.nodeName.toLowerCase(),attributes:S5(i)}),i)))}return{line:r,marks:t}}}function jx(n,e){let t=r=>{for(let i of r.children)if((e?i.isText():i.length)||t(i))return!0;return!1};return t(n)}function Q5(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const HS={class:"cm-line"};function Y5(n,e){let t=e.spec.attributes,r=e.spec.class;return!t&&!r||(n||(n={class:"cm-line"}),t&&u0(t,n),r&&(n.class+=" "+r)),n}function G5(n){let e=[];for(let t=n.parents.length;t>1;t--){let r=t==n.parents.length?n.tile:n.parents[t].tile;r instanceof zn&&e.push(r.mark)}return e}function Wp(n){let e=Pt.get(n);return e&&e.setDOM(n.cloneNode()),n}class Zo extends ai{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}}Zo.inline=new Zo("span");Zo.block=new Zo("div");const Hp=new class extends ai{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class zx{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Te.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 wh(e,e.contentDOM),this.updateInner([new mr(0,0,0,e.state.doc.length)],null)}update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:d,toA:p})=>p<this.minWidthFrom||d>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&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?i=this.domChanged.newSel.head:!s8(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?J5(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:p}=this.hasComposition;r=new mr(d,p,e.changes.mapPos(d,-1),e.changes.mapPos(p,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,a=this.blockWrappers;this.updateDeco();let u=t8(o,this.decorations,e.changes);u.length&&(r=mr.extendWithRanges(r,u));let h=r8(a,this.blockWrappers,e.changes);return h.length&&(r=mr.extendWithRanges(r,h)),s&&!r.some(d=>d.fromA<=s.range.fromA&&d.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,t){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(t||e.length){let o=this.tile,a=new K5(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Pt.get(t.text)&&a.cache.reused.set(Pt.get(t.text),2),this.tile=a.run(e,t),Jm(o,a.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 Vp&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(FS)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,t=!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(Ci)||r.tabIndex>-1)&&ga(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||t||o))return;let a=this.forceSelection;this.forceSelection=!1;let u=this.view.state.selection.main,h,d;if(u.empty?d=h=this.inlineDOMNearPos(u.anchor,u.assoc||1):(d=this.inlineDOMNearPos(u.head,u.head==u.from?1:-1),h=this.inlineDOMNearPos(u.anchor,u.anchor==u.from?1:-1)),ge.gecko&&u.empty&&!this.hasComposition&&X5(h)){let g=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(g,h.node.childNodes[h.offset]||null)),h=d=new Ir(g,0),a=!0}let p=this.view.observer.selectionRange;(a||!p.focusNode||(!va(h.node,h.offset,p.anchorNode,p.anchorOffset)||!va(d.node,d.offset,p.focusNode,p.focusOffset))&&!this.suppressWidgetCursorChange(p,u))&&(this.view.observer.ignore(()=>{ge.android&&ge.chrome&&r.contains(p.focusNode)&&i8(p.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let g=Aa(this.view.root);if(g)if(u.empty){if(ge.gecko){let v=Z5(h.node,h.offset);if(v&&v!=3){let x=(v==1?bS:SS)(h.node,h.offset);x&&(h=new Ir(x.node,x.offset))}}g.collapse(h.node,h.offset),u.bidiLevel!=null&&g.caretBidiLevel!==void 0&&(g.caretBidiLevel=u.bidiLevel)}else if(g.extend){g.collapse(h.node,h.offset);try{g.extend(d.node,d.offset)}catch{}}else{let v=document.createRange();u.anchor>u.head&&([h,d]=[d,h]),v.setEnd(d.node,d.offset),v.setStart(h.node,h.offset),g.removeAllRanges(),g.addRange(v)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(h,d)),this.impreciseAnchor=h.precise?null:new Ir(p.anchorNode,p.anchorOffset),this.impreciseHead=d.precise?null:new Ir(p.focusNode,p.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&va(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=Aa(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let u=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!u||!h||u.bottom>h.top)return;let d=this.domAtPos(t.head+t.assoc,t.assoc);r.collapse(d.node,d.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let p=e.observer.selectionRange;e.docView.posFromDOM(p.anchorNode,p.anchorOffset)!=t.from&&r.collapse(i,s)}posFromDOM(e,t){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[t];else{let o=Di(e)==0?0:t==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!Pt.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,a=i;;o++){let u=r.children[o];if(u.dom==s)return a;a+=u.length+u.breakAfter}}else return r.isText()?e==r.dom?i+t:i+(t?r.length:0):i}domAtPos(e,t){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.domPosFor(e,t):r.domIn(i,t)}inlineDOMNearPos(e,t){let r,i=-1,s=!1,o,a=-1,u=!1;return this.tile.blockTiles((h,d)=>{if(h.isWidget()){if(h.flags&32&&d>=e)return!0;h.flags&16&&(s=!0)}else{let p=d+h.length;if(d<=e&&(r=h,i=e-d,s=p<e),p>=e&&!o&&(o=h,a=e-d,u=d>e),d>e&&o)return!0}}),!r&&!o?this.domAtPos(e,t):(s&&o?r=null:u&&r&&(o=null),r&&t<0||!o?r.domIn(i,t):o.domIn(a,t))}coordsAt(e,t){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof Vp?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t)}lineAt(e,t){let{tile:r}=this.tile.resolveBlock(e,t);return r.isLine()?r:null}coordsForChar(e){let{tile:t,offset:r}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function i(s,o){if(s.isComposite())for(let a of s.children){if(a.length>=o){let u=i(a,o);if(u)return u}if(o-=a.length,o<0)break}else if(s.isText()&&o<s.length){let a=Zt(s.text,o);if(a==o)return null;let u=Ia(s.dom,o,a).getClientRects();for(let h=0;h<u.length;h++){let d=u[h];if(h==u.length-1||d.top<d.bottom&&d.left<d.right)return d}}return null}return i(t,r)}measureVisibleLineHeights(e){let t=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,u=this.view.textDirection==at.LTR,h=0,d=(p,g,v)=>{for(let x=0;x<p.children.length&&!(g>i);x++){let b=p.children[x],S=g+b.length,C=b.dom.getBoundingClientRect(),{height:R}=C;if(v&&!x&&(h+=C.top-v.top),b instanceof Ti)S>r&&d(b,g,C);else if(g>=r&&(h>0&&t.push(-h),t.push(R+h),h=0,o)){let O=b.dom.lastChild,P=O?ya(O):[];if(P.length){let D=P[P.length-1],N=u?D.right-C.left:C.right-D.left;N>a&&(a=N,this.minWidth=s,this.minWidthFrom=g,this.minWidthTo=S)}}v&&x==p.children.length-1&&(h+=v.bottom-C.bottom),g=S+b.breakAfter}};return d(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?at.RTL:at.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,u;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let d=ya(h.dom);if(d.length!=1)return;a+=d[0].width,u=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:u}}});if(e)return e;let t=document.createElement("div"),r,i,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=ya(t.firstChild)[0];r=t.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,t.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(Te.replace({widget:new Vp(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return Te.set(e)}updateDeco(){let e=1,t=this.view.state.facet(vh).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(g0).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,t.push(He.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(jS).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){var t;if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(BS))try{if(d(this.view,e.range,e))return!0}catch(p){Wn(this.view.state,p,"scroll handler")}let{range:r}=e,i=this.coordsAt(r.head,(t=r.assoc)!==null&&t!==void 0?t:r.empty?0:r.head>r.anchor?-1:1),s;if(!i)return;!r.empty&&(s=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let o=y0(this.view),a={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:u,offsetHeight:h}=this.view.scrollDOM;if(E5(this.view.scrollDOM,a,r.head<r.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,u),-u),Math.max(Math.min(e.yMargin,h),-h),this.view.textDirection==at.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(r.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=r=>r.isWidget()||r.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Jm(this.tile)}}function Jm(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let r of n.children)Jm(r,e)}}function X5(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function VS(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let r=bS(t.focusNode,t.focusOffset),i=SS(t.focusNode,t.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let a=Pt.get(i.node);if(!a||a.isText()&&a.text!=i.node.nodeValue)s=i;else if(n.docView.lastCompositionAfterCursor){let u=Pt.get(r.node);!u||u.isText()&&u.text!=r.node.nodeValue||(s=i)}}if(n.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 J5(n,e,t){let r=VS(n,t);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||n.state.doc.sliceString(r.from,r.to)!=a)return null;let u=e.invertedDesc;return{range:new mr(u.mapPos(s),u.mapPos(o),s,o),text:i}}function Z5(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let e8=class{constructor(){this.changes=[]}compareRange(e,t){Ho(e,t,this.changes)}comparePoint(e,t){Ho(e,t,this.changes)}boundChange(e){Ho(e,e,this.changes)}};function t8(n,e,t){let r=new e8;return He.compare(n,e,t,r),r.changes}class n8{constructor(){this.changes=[]}compareRange(e,t){Ho(e,t,this.changes)}comparePoint(){}boundChange(e){Ho(e,e,this.changes)}}function r8(n,e,t){let r=new n8;return He.compare(n,e,t,r),r.changes}function i8(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function s8(n,e){let t=!1;return e&&n.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(t=!0)}),t}class Vp extends ai{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 o8(n,e,t=1){let r=n.charCategorizer(e),i=n.doc.lineAt(e),s=e-i.from;if(i.length==0)return Z.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,a=s;t<0?o=Zt(i.text,s,!1):a=Zt(i.text,s);let u=r(i.text.slice(o,a));for(;o>0;){let h=Zt(i.text,o,!1);if(r(i.text.slice(h,o))!=u)break;o=h}for(;a<i.length;){let h=Zt(i.text,a);if(r(i.text.slice(a,h))!=u)break;a=h}return Z.range(o+i.from,a+i.from)}function l8(n,e,t,r,i){let s=Math.round((r-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let a=n.viewState.heightOracle.textHeight,u=Math.floor((i-t.top-(n.defaultLineHeight-a)*.5)/a);s+=u*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+zm(o,s,n.state.tabSize)}function Zm(n,e,t){let r=n.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==un.Text&&(i.type!=s.type||(t<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function a8(n,e,t,r){let i=Zm(n,e.head,e.assoc||-1),s=!r||i.type!=un.Text||!(n.lineWrapping||i.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=n.dom.getBoundingClientRect(),a=n.textDirectionAt(i.from),u=n.posAtCoords({x:t==(a==at.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(u!=null)return Z.cursor(u,t?-1:1)}return Z.cursor(t?i.to:i.from,t?-1:1)}function Wx(n,e,t,r){let i=n.state.doc.lineAt(e.head),s=n.bidiSpans(i),o=n.textDirectionAt(i.from);for(let a=e,u=null;;){let h=B5(i,s,o,a,t),d=RS;if(!h){if(i.number==(t?n.state.doc.lines:1))return a;d=`
|
|
139
|
-
`,i=n.state.doc.line(i.number+(t?1:-1)),s=n.bidiSpans(i),h=n.visualLineSide(i,!t)}if(u){if(!u(d))return a}else{if(!r)return h;u=r(d)}a=h}}function c8(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let o=r(s);return i==vt.Space&&(i=o),i==o}}function u8(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return Z.cursor(i,e.assoc);let o=e.goalColumn,a,u=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(i,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),d=n.documentTop;if(h)o==null&&(o=h.left-u.left),a=s<0?h.top:h.bottom;else{let x=n.viewState.lineBlockAt(i);o==null&&(o=Math.min(u.right-u.left,n.defaultCharacterWidth*(i-x.from))),a=(s<0?x.top:x.bottom)+d}let p=u.left+o,g=n.viewState.heightOracle.textHeight>>1,v=r??g;for(let x=0;;x+=g){let b=a+(v+x)*s,S=eg(n,{x:p,y:b},!1,s);if(t?b>u.bottom:b<u.top)return Z.cursor(S.pos,S.assoc);let C=n.coordsAtPos(S.pos,S.assoc),R=C?(C.top+C.bottom)/2:0;if(!C||(t?R>a:R<a))return Z.cursor(S.pos,S.assoc,void 0,o)}}function xa(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let u=r||t||(e-s<o-e?-1:1);e=u<0?s:o,r=u}});if(!r)return e}}function $S(n,e){let t=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=xa(n,i.from,0);o!=i.from&&(s=Z.cursor(o,-1))}else{let o=xa(n,i.from,-1),a=xa(n,i.to,1);(o!=i.from||a!=i.to)&&(s=Z.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?Z.create(t,e.mainIndex):e}function $p(n,e,t){let r=xa(n.state.facet(Za).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:Z.cursor(r,r<t.from?1:-1)}class ei{constructor(e,t){this.pos=e,this.assoc=t}}function eg(n,e,t,r){let i=n.contentDOM.getBoundingClientRect(),s=i.top+n.viewState.paddingTop,{x:o,y:a}=e,u=a-s,h;for(;;){if(u<0)return new ei(0,1);if(u>n.viewState.docHeight)return new ei(n.state.doc.length,-1);if(h=n.elementAtHeight(u),r==null)break;if(h.type==un.Text){if(r<0?h.to<n.viewport.from:h.from>n.viewport.to)break;let g=n.docView.coordsAt(r<0?h.from:h.to,r>0?-1:1);if(g&&(r<0?g.top<=u+s:g.bottom>=u+s))break}let p=n.viewState.heightOracle.textHeight/2;u=r>0?h.bottom+p:h.top-p}if(n.viewport.from>=h.to||n.viewport.to<=h.from){if(t)return null;if(h.type==un.Text){let p=l8(n,i,h,o,a);return new ei(p,p==h.from?1:-1)}}if(h.type!=un.Text)return u<(h.top+h.bottom)/2?new ei(h.from,1):new ei(h.to,-1);let d=n.docView.lineAt(h.from,2);return(!d||d.length!=h.length)&&(d=n.docView.lineAt(h.from,-2)),new f8(n,o,a,n.textDirectionAt(h.from)).scanTile(d,h.from)}class f8{constructor(e,t,r,i){this.view=e,this.x=t,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,t){let{line:r,spans:i}=this.bidiSpansAt(e);return i[ti.find(i,e-r.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:r,spans:i}=this.bidiSpansAt(e);return i[ti.find(i,e-r.from,-1,t)].dir}bidiIn(e,t){let{spans:r,line:i}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from<t)}scan(e,t,r=!1){let i=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),u,h,d=-1,p=1e9,g;e:for(;i<s;){let x=s-i,b=i+s>>1;t:if(o.has(b)){let C=i+Math.floor(Math.random()*x);for(let R=0;R<x;R++){if(!o.has(C)){b=C;break t}C++,C==s&&(C=i)}break e}o.add(b);let S=t(b);if(S)for(let C=0;C<S.length;C++){let R=S[C],O=0;if(!(R.width==0&&S.length>1)){if(R.bottom<this.y)(!u||u.bottom<R.bottom)&&(u=R),O=1;else if(R.top>this.y)(!h||h.top>R.top)&&(h=R),O=-1;else{let P=R.left>this.x?this.x-R.left:R.right<this.x?this.x-R.right:0,D=Math.abs(P);D<p&&(d=b,p=D,g=R),P&&(O=P<0==(this.baseDir==at.LTR)?-1:1)}O==-1&&(!a||this.baseDirAt(e[b],1))?s=b:O==1&&(!a||this.baseDirAt(e[b+1],-1))&&(i=b+1)}}}if(!g){let x=u&&(!h||this.y-u.bottom<h.top-this.y)?u:h;return this.y=(x.top+x.bottom)/2,this.scan(e,t,!0)}if(p&&!r){let{top:x,bottom:b}=g;if(u&&u.bottom>(x+x+b)/3)return this.y=u.bottom-1,this.scan(e,t,!0);if(h&&h.top<(x+b+b)/3)return this.y=h.top+1,this.scan(e,t,!0)}let v=(a?this.dirAt(e[d],1):this.baseDir)==at.LTR;return{i:d,after:this.x>(g.left+g.right)/2==v}}scanText(e,t){let r=[];for(let s=0;s<e.length;s=Zt(e.text,s))r.push(t+s);r.push(t+e.length);let i=this.scan(r,s=>{let o=r[s]-t,a=r[s+1]-t;return Ia(e.dom,o,a).getClientRects()});return i.after?new ei(r[i.i+1],-1):new ei(r[i.i],1)}scanTile(e,t){if(!e.length)return new ei(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let r=[t];for(let a=0,u=t;a<e.children.length;a++)r.push(u+=e.children[a].length);let i=this.scan(r,a=>{let u=e.children[a];return u.flags&48?null:(u.dom.nodeType==1?u.dom:Ia(u.dom,0,u.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 ei(r[i.i+1],-1):new ei(o,1)}}const Do="";class h8{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet($e.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Do}readRange(e,t){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=Pt.get(i),a=i.nextSibling;if(a==t){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let u=Pt.get(a);(o&&u?o.breakAfter:(o?o.breakAfter:Cf(i))||Cf(a)&&(i.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!p8(a,t)&&this.lineBreak(),i=a}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(r,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let u of this.points)u.node==e&&u.pos>this.text.length&&(u.pos-=o-1);r=s+o}}readNode(e){let t=Pt.get(e),r=t&&t.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,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(d8(e,r.node,r.offset)?t:0))}}function d8(n,e,t){for(;;){if(!e||t<Di(e))return!1;if(e==n)return!0;t=ys(e)+1,e=e.parentNode}}function p8(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let r=Pt.get(n);if(!(r!=null&&r.isWidget()))return!1;r&&(t||(t=[])).push(r)}if(t)for(let r of t){let i=r.overrideDOMText;if(i!=null&&i.length)return!1}return!0}class Hx{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class m8{constructor(e,t,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,a=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=US(e.docView.tile,t,r,0))){let u=s||o?[]:y8(e),h=new h8(u,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=v8(u,this.bounds.from)}else{let u=e.observer.selectionRange,h=s&&s.node==u.focusNode&&s.offset==u.focusOffset||!Km(e.contentDOM,u.focusNode)?a.main.head:e.docView.posFromDOM(u.focusNode,u.focusOffset),d=o&&o.node==u.anchorNode&&o.offset==u.anchorOffset||!Km(e.contentDOM,u.anchorNode)?a.main.anchor:e.docView.posFromDOM(u.anchorNode,u.anchorOffset),p=e.viewport;if((ge.ios||ge.chrome)&&a.main.empty&&h!=d&&(p.from>0||p.to<e.state.doc.length)){let g=Math.min(h,d),v=Math.max(h,d),x=p.from-g,b=p.to-v;(x==0||x==1||g==0)&&(b==0||b==-1||v==e.state.doc.length)&&(h=0,d=e.state.doc.length)}if(e.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(Z.range(d,h));else if(e.lineWrapping&&d==h&&!(a.main.empty&&a.main.head==h)&&e.inputState.lastTouchTime>Date.now()-100){let g=e.coordsAtPos(h,-1),v=0;g&&(v=e.inputState.lastTouchY<=g.bottom?-1:1),this.newSel=Z.create([Z.cursor(h,v)])}else this.newSel=Z.single(d,h)}}}function US(n,e,t,r){if(n.isComposite()){let i=-1,s=-1,o=-1,a=-1;for(let u=0,h=r,d=r;u<n.children.length;u++){let p=n.children[u],g=h+p.length;if(h<e&&g>t)return US(p,e,t,h);if(g>=e&&i==-1&&(i=u,s=h),h>t&&p.dom.parentNode==n.dom){o=u,a=d;break}d=g,h=g+p.breakAfter}return{from:s,to:a<0?r+n.length:a,startDOM:(i?n.children[i-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o<n.children.length&&o>=0?n.children[o].dom:null}}else return n.isText()?{from:r,to:r+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function qS(n,e){let t,{newSel:r}=e,{state:i}=n,s=i.selection.main,o=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:u}=e.bounds,h=s.from,d=null;(o===8||ge.android&&e.text.length<u-a)&&(h=s.to,d="end");let p=i.doc.sliceString(a,u,Do),g,v;!s.empty&&s.from>=a&&s.to<=u&&(e.typeOver||p!=e.text)&&p.slice(0,s.from-a)==e.text.slice(0,s.from-a)&&p.slice(s.to-a)==e.text.slice(g=e.text.length-(p.length-(s.to-a)))?t={from:s.from,to:s.to,insert:Qe.of(e.text.slice(s.from-a,g).split(Do))}:(v=KS(p,e.text,h-a,d))&&(ge.chrome&&o==13&&v.toB==v.from+2&&e.text.slice(v.from,v.toB)==Do+Do&&v.toB--,t={from:a+v.from,to:a+v.toA,insert:Qe.of(e.text.slice(v.from,v.toB).split(Do))})}else r&&(!n.hasFocus&&i.facet(Ci)||Of(r,s))&&(r=null);if(!t&&!r)return!1;if((ge.mac||ge.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=Z.single(r.main.anchor-1,r.main.head-1)),t={from:t.from,to:t.to,insert:Qe.of([t.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).to<s.to&&n.docView.lineHasWidget(s.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:s.from,to:s.to,insert:i.toText(n.inputState.insertingText)}:ge.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==`
|
|
140
|
-
`&&n.lineWrapping&&(r&&(r=Z.single(r.main.anchor-1,r.main.head-1)),t={from:s.from,to:s.to,insert:Qe.of([" "])}),t)return v0(n,t,r,o);if(r&&!Of(r,s)){let a=!1,u="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(a=!0),u=n.inputState.lastSelectionOrigin,u=="select.pointer"&&(r=$S(i.facet(Za).map(h=>h(n)),r))),n.dispatch({selection:r,scrollIntoView:a,userEvent:u}),!0}else return!1}function v0(n,e,t,r=-1){if(ge.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(ge.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&n.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Vo(n.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)&&Vo(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Vo(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,a=()=>o||(o=g8(n,e,t));return n.state.facet(DS).some(u=>u(n,e.from,e.to,s,a))||n.dispatch(a()),!0}function g8(n,e,t){let r,i=n.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let u=e.from<s.from?-1:1,h=u<0?s.from:s.to,d=xa(i.facet(Za).map(p=>p(n)),h,u);e.from==d&&(o=d)}if(o>-1)r={changes:e,selection:Z.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&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let u=s.from<e.from?i.sliceDoc(s.from,e.from):"",h=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(n.state.toText(u+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let u=i.changes(e),h=t&&t.main.to<=u.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=n.state.sliceDoc(e.from,e.to),p,g=t&&VS(n,t.main.head);if(g){let x=e.insert.length-(e.to-e.from);p={from:g.from,to:g.to-x}}else p=n.state.doc.lineAt(s.head);let v=s.to-e.to;r=i.changeByRange(x=>{if(x.from==s.from&&x.to==s.to)return{changes:u,range:h||x.map(u)};let b=x.to-v,S=b-d.length;if(n.state.sliceDoc(S,b)!=d||b>=p.from&&S<=p.to)return{range:x};let C=i.changes({from:S,to:b,insert:e.insert}),R=x.to-s.to;return{changes:C,range:h?Z.range(Math.max(0,h.anchor+R),Math.max(0,h.head+R)):x.map(C)}})}else r={changes:u,selection:h&&i.selection.replaceRange(h)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function KS(n,e,t,r){let i=Math.min(n.length,e.length),s=0;for(;s<i&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&n.length==e.length)return null;let o=n.length,a=e.length;for(;o>0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let u=Math.max(0,s-Math.min(o,a));t-=o+u-s}if(o<s&&n.length<e.length){let u=t<=s&&t>=o?s-t:0;s-=u,a=s+(a-o),o=s}else if(a<s){let u=t<=s&&t>=a?s-t:0;s-=u,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function y8(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new Hx(t,r)),(i!=t||s!=r)&&e.push(new Hx(i,s))),e}function v8(n,e){if(n.length==0)return null;let t=n[0].pos,r=n.length==2?n[1].pos:t;return t>-1&&r>-1?Z.single(t+e,r+e):null}function Of(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class x8{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,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.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&&L8(e.contentDOM.ownerDocument)}handleEvent(e){!R8(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,t){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,t);for(let i of r.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=w8(e),r=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!t[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=t}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&&YS.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;let t;return ge.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((t=QS.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||b8.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Vo(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}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 Vx(n,e){return(t,r)=>{try{return e.call(n,r,t)}catch(i){Wn(t.state,i)}}}function w8(n){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of n){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let a in s){let u=s[a];u&&t(a).handlers.push(Vx(r.value,u))}if(o)for(let a in o){let u=o[a];u&&t(a).observers.push(Vx(r.value,u))}}for(let r in Fr)t(r).handlers.push(Fr[r]);for(let r in $n)t(r).observers.push($n[r]);return e}const QS=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],b8="dthko",YS=[16,17,18,20,91,92,224,225],Su=6;function ku(n){return Math.max(0,n)*.7+8}function S8(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class k8{constructor(e,t,r,i){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=vS(e.contentDOM),this.atoms=e.state.facet(Za).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=t.shiftKey,this.multiple=e.state.facet($e.allowMultipleSelections)&&C8(e,t),this.dragging=T8(e,t)&&JS(t)==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&&S8(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,r=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let u=y0(this.view);e.clientX-u.left<=i+Su?t=-ku(i-e.clientX):e.clientX+u.right>=o-Su&&(t=ku(e.clientX-o)),e.clientY-u.top<=s+Su?r=-ku(s-e.clientY):e.clientY+u.bottom>=a-Su&&(r=ku(e.clientY-a)),this.setScrollSpeed(t,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,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,r=$S(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function C8(n,e){let t=n.state.facet(OS);return t.length?t[0](e):ge.mac?e.metaKey:e.ctrlKey}function E8(n,e){let t=n.state.facet(PS);return t.length?t[0](e):ge.mac?!e.altKey:!e.ctrlKey}function T8(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let r=Aa(n.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 R8(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=Pt.get(t))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const Fr=Object.create(null),$n=Object.create(null),GS=ge.ie&&ge.ie_version<15||ge.ios&&ge.webkit_version<604;function O8(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),XS(n,t.value)},50)}function bh(n,e,t){for(let r of n.facet(e))t=r(t,n);return t}function XS(n,e){e=bh(n.state,d0,e);let{state:t}=n,r,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(tg!=null&&t.selection.ranges.every(u=>u.empty)&&tg==s.toString()){let u=-1;r=t.changeByRange(h=>{let d=t.doc.lineAt(h.from);if(d.from==u)return{range:h};u=d.from;let p=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:d.from,insert:p},range:Z.cursor(h.from+p.length)}})}else o?r=t.changeByRange(u=>{let h=s.line(i++);return{changes:{from:u.from,to:u.to,insert:h.text},range:Z.cursor(u.from+h.length)}}):r=t.replaceSelection(s);n.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}$n.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};$n.wheel=$n.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};Fr.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);$n.touchstart=(n,e)=>{let t=n.inputState,r=e.targetTouches[0];t.lastTouchTime=Date.now(),r&&(t.lastTouchX=r.clientX,t.lastTouchY=r.clientY),t.setSelectionOrigin("select.pointer")};$n.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Fr.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of n.state.facet(MS))if(t=r(n,e),t)break;if(!t&&e.button==0&&(t=M8(n,e)),t){let r=!n.hasFocus;n.inputState.startMouseSelection(new k8(n,e,t,r)),r&&n.observer.ignore(()=>{xS(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let i=n.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function $x(n,e,t,r){if(r==1)return Z.cursor(e,t);if(r==2)return o8(n.state,e,t);{let i=n.docView.lineAt(e,t),s=n.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<n.state.doc.length&&a==s.to&&a++,Z.range(o,a)}}const P8=ge.ie&&ge.ie_version<=11;let Ux=null,qx=0,Kx=0;function JS(n){if(!P8)return n.detail;let e=Ux,t=Kx;return Ux=n,Kx=Date.now(),qx=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(qx+1)%3:1}function M8(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=JS(e),i=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,o,a){let u=n.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),h,d=$x(n,u.pos,u.assoc,r);if(t.pos!=u.pos&&!o){let p=$x(n,t.pos,t.assoc,r),g=Math.min(p.from,d.from),v=Math.max(p.to,d.to);d=g<d.from?Z.range(g,v,d.assoc):Z.range(v,g,d.assoc)}return o?i.replaceRange(i.main.extend(d.from,d.to,d.assoc)):a&&r==1&&i.ranges.length>1&&(h=A8(i,u.pos))?h:a?i.addRange(d):Z.create([d])}}}function A8(n,e){for(let t=0;t<n.ranges.length;t++){let{from:r,to:i}=n.ranges[t];if(r<=e&&i>=e)return Z.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Fr.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let i=n.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=t.to||o<=t.from)&&(t=Z.range(s,o))}}let{inputState:r}=n;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",bh(n.state,p0,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Fr.dragend=n=>(n.inputState.draggedContent=null,!1);function Qx(n,e,t,r){if(t=bh(n.state,d0,t),!t)return;let i=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=r&&s&&E8(n,e)?{from:s.from,to:s.to}:null,a={from:i,insert:t},u=n.state.changes(o?[o,a]:a);n.focus(),n.dispatch({changes:u,selection:{anchor:u.mapPos(i,-1),head:u.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Fr.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),i=0,s=()=>{++i==t.length&&Qx(n,e,r.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Qx(n,e,r,!0),!0}return!1};Fr.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=GS?null:e.clipboardData;return t?(XS(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(O8(n),!1)};function D8(n,e){let t=n.dom.parentNode;if(!t)return;let r=t.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(),n.focus()},50)}function I8(n){let e=[],t=[],r=!1;for(let i of n.selection.ranges)i.empty||(e.push(n.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>i&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),i=o.number}r=!0}return{text:bh(n,p0,e.join(n.lineBreak)),ranges:t,linewise:r}}let tg=null;Fr.copy=Fr.cut=(n,e)=>{if(!ga(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:r,linewise:i}=I8(n.state);if(!t&&!i)return!1;tg=i?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=GS?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(D8(n,t),!1)};const ZS=Bi.define();function ek(n,e){let t=[];for(let r of n.facet(IS)){let i=r(n,e);i&&t.push(i)}return t.length?n.update({effects:t,annotations:ZS.of(!0)}):null}function tk(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=ek(n.state,e);t?n.dispatch(t):n.update([])}},10)}$n.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),tk(n)};$n.blur=n=>{n.observer.clearSelectionRange(),tk(n)};$n.compositionstart=$n.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};$n.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,ge.chrome&&ge.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};$n.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Fr.beforeinput=(n,e)=>{var t,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],u=n.posAtDOM(a.startContainer,a.startOffset),h=n.posAtDOM(a.endContainer,a.endOffset);return v0(n,{from:u,to:h,insert:n.state.toText(s)},null),!0}}let i;if(ge.chrome&&ge.android&&(i=QS.find(s=>s.inputType==e.inputType))&&(n.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&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return ge.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),ge.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>$n.compositionend(n,e),20),!1};const Yx=new Set;function L8(n){Yx.has(n)||(Yx.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const Gx=["pre-wrap","normal","pre-line","break-spaces"];let el=!1;function Xx(){el=!1}class N8{constructor(e){this.lineWrapping=e,this.doc=Qe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-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 Gx.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,r,i,s,o){let a=Gx.indexOf(e)>-1,u=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=r,this.textHeight=i,this.lineLength=s,u){this.heightSamples={};for(let h=0;h<o.length;h++){let d=o[h];d<0?h++:this.heightSamples[Math.floor(d*10)]=!0}}return u}}class B8{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Dr{constructor(e,t,r,i,s){this.from=e,this.length=t,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?un.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 no?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Dr(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var ft=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(ft||(ft={}));const Zu=.001;class Tn{constructor(e,t,r=2){this.length=e,this.height=t,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)>Zu&&(el=!0),this.height=e)}replace(e,t,r){return Tn.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,i){let s=this,o=r.doc;for(let a=i.length-1;a>=0;a--){let{fromA:u,toA:h,fromB:d,toB:p}=i[a],g=s.lineAt(u,ft.ByPosNoHeight,r.setDoc(t),0,0),v=g.to>=h?g:s.lineAt(h,ft.ByPosNoHeight,r,0,0);for(p+=v.to-h,h=v.to;a>0&&g.from<=i[a-1].toA;)u=i[a-1].fromA,d=i[a-1].fromB,a--,u<g.from&&(g=s.lineAt(u,ft.ByPosNoHeight,r,0,0));d+=g.from-u,u=g.from;let x=x0.build(r.setDoc(o),e,d,p);s=Pf(s,s.replace(u,h,x))}return s.updateHeight(r,0)}static empty(){return new Zn(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,i=0,s=0;for(;;)if(t==r)if(i>s*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(s>i*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[t++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,r++),new _8(Tn.of(e.slice(0,t)),o,Tn.of(e.slice(r)))}}function Pf(n,e){return n==e?n:(n.constructor!=e.constructor&&(el=!0),e)}Tn.prototype.size=1;const F8=Te.replace({});class nk extends Tn{constructor(e,t,r){super(e,t),this.deco=r,this.spaceAbove=0}mainBlock(e,t){return new Dr(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new Dr(i,0,r,this.spaceAbove,F8):this.mainBlock(r,i)}lineAt(e,t,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,t,r,i,s,o){e<=s+this.length&&t>=s&&o(this.lineAt(0,ft.ByPos,r,i,s))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Zn extends nk{constructor(e,t,r){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,t){return new Dr(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,r){let i=r[0];return r.length==1&&(i instanceof Zn||i instanceof an&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof an?i=new Zn(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Tn.of(r)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&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 an extends Tn{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,s=i-r+1,o,a=0;if(e.lineWrapping){let u=Math.min(this.height,e.lineHeight*s);o=u/s,this.length>s+1&&(a=(this.height-u)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:a}}blockAt(e,t,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:u}=this.heightMetrics(t,i);if(t.lineWrapping){let h=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),d=t.doc.lineAt(h),p=a+d.length*u,g=Math.max(r,e-p/2);return new Dr(d.from,d.length,g,p,0)}else{let h=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:d,length:p}=t.doc.line(s+h);return new Dr(d,p,r+a*h,a,0)}}lineAt(e,t,r,i,s){if(t==ft.ByHeight)return this.blockAt(e,r,i,s);if(t==ft.ByPosNoHeight){let{from:v,to:x}=r.doc.lineAt(e);return new Dr(v,x-v,0,0,0)}let{firstLine:o,perLine:a,perChar:u}=this.heightMetrics(r,s),h=r.doc.lineAt(e),d=a+h.length*u,p=h.number-o,g=i+a*p+u*(h.from-s-p);return new Dr(h.from,h.length,Math.max(i,Math.min(g,i+this.height-d)),d,0)}forEachLine(e,t,r,i,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:u,perChar:h}=this.heightMetrics(r,s);for(let d=e,p=i;d<=t;){let g=r.doc.lineAt(d);if(d==e){let x=g.number-a;p+=u*x+h*(e-s-x)}let v=u+h*g.length;o(new Dr(g.from,g.length,p,v,0)),p+=v,d=g.to+1}}replace(e,t,r){let i=this.length-t;if(i>0){let s=r[r.length-1];s instanceof an?r[r.length-1]=new an(s.length+i):r.push(null,new an(i-1))}if(e>0){let s=r[0];s instanceof an?r[0]=new an(e+s.length):r.unshift(new an(e-1),null)}return Tn.of(r)}decomposeLeft(e,t){t.push(new an(e-1),null)}decomposeRight(e,t){t.push(null,new an(this.length-e-1))}updateHeight(e,t=0,r=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],a=Math.max(t,i.from),u=-1;for(i.from>t&&o.push(new an(i.from-t-1).updateHeight(e,t));a<=s&&i.more;){let d=e.doc.lineAt(a).length;o.length&&o.push(null);let p=i.heights[i.index++],g=0;p<0&&(g=-p,p=i.heights[i.index++]),u==-1?u=p:Math.abs(p-u)>=Zu&&(u=-2);let v=new Zn(d,p,g);v.outdated=!1,o.push(v),a+=d+1}a<=s&&o.push(null,new an(s-a).updateHeight(e,a));let h=Tn.of(o);return(u<0||Math.abs(h.height-this.height)>=Zu||Math.abs(u-this.heightMetrics(e,t).perLine)>=Zu)&&(el=!0),Pf(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class _8 extends Tn{constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(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,t,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,t,r,i):this.right.blockAt(e,t,s,i+this.left.length+this.break)}lineAt(e,t,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,u=t==ft.ByHeight?e<o:e<a,h=u?this.left.lineAt(e,t,r,i,s):this.right.lineAt(e,t,r,o,a);if(this.break||(u?h.to<a:h.from>a))return h;let d=t==ft.ByPosNoHeight?ft.ByPosNoHeight:ft.ByPos;return u?h.join(this.right.lineAt(a,d,r,o,a)):this.left.lineAt(a,d,r,i,s).join(h)}forEachLine(e,t,r,i,s,o){let a=i+this.left.height,u=s+this.left.length+this.break;if(this.break)e<u&&this.left.forEachLine(e,t,r,i,s,o),t>=u&&this.right.forEachLine(e,t,r,a,u,o);else{let h=this.lineAt(u,ft.ByPos,r,i,s);e<h.from&&this.left.forEachLine(e,h.from-1,r,i,s,o),h.to>=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,r,a,u,o)}}replace(e,t,r){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&Jx(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),Jx(s,a)}return Tn.of(s)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Tn.of(this.break?[e,null,t]:[e,t]):(this.left=Pf(this.left,e),this.right=Pf(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,r=!1,i){let{left:s,right:o}=this,a=t+s.length+this.break,u=null;return i&&i.from<=t+s.length&&i.more?u=s=s.updateHeight(e,t,r,i):s.updateHeight(e,t,r),i&&i.from<=a+o.length&&i.more?u=o=o.updateHeight(e,a,r,i):o.updateHeight(e,a,r),u?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 Jx(n,e){let t,r;n[e]==null&&(t=n[e-1])instanceof an&&(r=n[e+1])instanceof an&&n.splice(e-1,3,new an(t.length+1+r.length))}const j8=5;class x0{constructor(e,t){this.pos=e,this.oracle=t,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,t){if(this.lineStart>-1){let r=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Zn?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Zn(r-this.pos,-1,0)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||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=t-e;r.block?this.addBlock(new nk(o,i,r)):(o||s||i>=j8)&&this.addLineDeco(i,s,o)}else t>e&&this.span(e,t);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:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,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 Zn(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let r=new an(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Zn)return e;let t=new Zn(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Zn)&&!this.isCovered?this.nodes.push(new Zn(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof Zn&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,t,r,i){let s=new x0(r,e);return He.spans(t,r,i,s,0),s.finish(r)}}function z8(n,e,t){let r=new W8;return He.compare(n,e,t,r,0),r.changes}class W8{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,i){(e<t||r&&r.heightRelevant||i&&i.heightRelevant)&&Ho(e,t,this.changes,5)}}function H8(n,e){let t=n.getBoundingClientRect(),r=n.ownerDocument,i=r.defaultView||window,s=Math.max(0,t.left),o=Math.min(i.innerWidth,t.right),a=Math.max(0,t.top),u=Math.min(i.innerHeight,t.bottom);for(let h=n.parentNode;h&&h!=r.body;)if(h.nodeType==1){let d=h,p=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&p.overflow!="visible"){let g=d.getBoundingClientRect();s=Math.max(s,g.left),o=Math.min(o,g.right),a=Math.max(a,g.top),u=Math.min(h==n.parentNode?i.innerHeight:u,g.bottom)}h=p.position=="absolute"||p.position=="fixed"?d.offsetParent:d.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,u)-(t.top+e)}}function V8(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function $8(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Up{constructor(e,t,r,i){this.from=e,this.to=t,this.size=r,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=t[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,t){return Te.replace({widget:new U8(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class U8 extends ai{constructor(e,t){super(),this.size=e,this.vertical=t}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 Zx{constructor(e,t){this.view=e,this.state=t,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=ew,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=at.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=t.facet(m0).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new N8(r),this.stateDeco=tw(t),this.heightMap=Tn.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle.setDoc(t.doc),[new mr(0,0,0,t.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=Te.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let i=r?t.head:t.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new Cu(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?ew:new w0(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(ca(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=tw(this.state);let i=e.changedRanges,s=mr.extendWithRanges(i,z8(r,this.stateDeco,e?e.changes:$t.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Xx(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||el)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let u=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<u.from||t.range.head>u.to)||!this.viewportIsAppropriate(u))&&(u=this.getViewport(0,t));let h=u.from!=this.viewport.from||u.to!=this.viewport.to;this.viewport=u,e.flags|=this.updateForViewport(),(h||!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),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(NS)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,r=window.getComputedStyle(t),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?at.RTL:at.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",a=t.getBoundingClientRect(),u=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,d=0;if(a.width&&a.height){let{scaleX:D,scaleY:N}=yS(t,a);(D>.005&&Math.abs(this.scaleX-D)>.005||N>.005&&Math.abs(this.scaleY-N)>.005)&&(this.scaleX=D,this.scaleY=N,h|=16,o=u=!0)}let p=(parseInt(r.paddingTop)||0)*this.scaleY,g=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=g)&&(this.paddingTop=p,this.paddingBottom=g,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(u=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let v=vS(this.view.contentDOM,!1).y;v!=this.scrollParent&&(this.scrollParent=v,this.scrollAnchorHeight=-1,this.scrollOffset=0);let x=this.getScrollOffset();this.scrollOffset!=x&&(this.scrollAnchorHeight=-1,this.scrollOffset=x),this.scrolledToBottom=wS(this.scrollParent||e.win);let b=(this.printing?$8:H8)(t,this.paddingTop),S=b.top-this.pixelViewport.top,C=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let R=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(R!=this.inView&&(this.inView=R,R&&(u=!0)),!this.inView&&!this.scrollTarget&&!V8(e.dom))return 0;let O=a.width;if((this.contentDOMWidth!=O||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),u){let D=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(D)&&(o=!0),o||i.lineWrapping&&Math.abs(O-this.contentDOMWidth)>i.charWidth){let{lineHeight:N,charWidth:L,textHeight:z}=e.docView.measureTextSize();o=N>0&&i.refresh(s,N,L,z,Math.max(5,O/L),D),o&&(e.docView.minWidth=0,h|=16)}S>0&&C>0?d=Math.max(S,C):S<0&&C<0&&(d=Math.min(S,C)),Xx();for(let N of this.viewports){let L=N.from==this.viewport.from?D:e.docView.measureVisibleLineHeights(N);this.heightMap=(o?Tn.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle,[new mr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new B8(N.from,L))}el&&(h|=2)}let P=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return P&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),h|=this.updateForViewport()),(h&2||P)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,u=new Cu(i.lineAt(o-r*1e3,ft.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,ft.ByHeight,s,0,0).to);if(t){let{head:h}=t.range;if(h<u.from||h>u.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=i.lineAt(h,ft.ByPos,s,0,0),g;t.y=="center"?g=(p.top+p.bottom)/2-d/2:t.y=="start"||t.y=="nearest"&&h<u.from?g=p.top:g=p.bottom-d,u=new Cu(i.lineAt(g-1e3/2,ft.ByHeight,s,0,0).from,i.lineAt(g+d+1e3/2,ft.ByHeight,s,0,0).to)}}return u}mapViewport(e,t){let r=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Cu(this.heightMap.lineAt(r,ft.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,ft.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,ft.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,ft.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let i of e)t.touchesRange(i.from,i.to)||r.push(new Up(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=at.LTR&&!r)return[];let a=[],u=(d,p,g,v)=>{if(p-d<s)return;let x=this.state.selection.main,b=[x.from];x.empty||b.push(x.to);for(let C of b)if(C>d&&C<p){u(d,C-10,g,v),u(C+10,p,g,v);return}let S=K8(e,C=>C.from>=g.from&&C.to<=g.to&&Math.abs(C.from-d)<s&&Math.abs(C.to-p)<s&&!b.some(R=>C.from<R&&C.to>R));if(!S){if(p<g.to&&t&&r&&t.visibleRanges.some(O=>O.from<=p&&O.to>=p)){let O=t.moveToLineBoundary(Z.cursor(p),!1,!0).head;O>d&&(p=O)}let C=this.gapSize(g,d,p,v),R=r||C<2e6?C:2e6;S=new Up(d,p,C,R)}a.push(S)},h=d=>{if(d.length<o||d.type!=un.Text)return;let p=q8(d.from,d.to,this.stateDeco);if(p.total<o)return;let g=this.scrollTarget?this.scrollTarget.range.head:null,v,x;if(r){let b=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,S,C;if(g!=null){let R=Tu(p,g),O=((this.visibleBottom-this.visibleTop)/2+b)/d.height;S=R-O,C=R+O}else S=(this.visibleTop-d.top-b)/d.height,C=(this.visibleBottom-d.top+b)/d.height;v=Eu(p,S),x=Eu(p,C)}else{let b=p.total*this.heightOracle.charWidth,S=i*this.heightOracle.charWidth,C=0;if(b>2e6)for(let N of e)N.from>=d.from&&N.from<d.to&&N.size!=N.displaySize&&N.from*this.heightOracle.charWidth+C<this.pixelViewport.left&&(C=N.size-N.displaySize);let R=this.pixelViewport.left+C,O=this.pixelViewport.right+C,P,D;if(g!=null){let N=Tu(p,g),L=((O-R)/2+S)/b;P=N-L,D=N+L}else P=(R-S)/b,D=(O+S)/b;v=Eu(p,P),x=Eu(p,D)}v>d.from&&u(d.from,v,d,p),x<d.to&&u(x,d.to,d,p)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(h):h(d);return a}gapSize(e,t,r,i){let s=Tu(i,r)-Tu(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){Up.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Te.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let r=[];He.spans(t,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],a=r[s];(o.from!=a.from||o.to!=a.to)&&(i|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ca(this.heightMap.lineAt(e,ft.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(t=>t.top<=e&&t.bottom>=e)||ca(this.heightMap.lineAt(this.scaler.fromDOM(e),ft.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 t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return ca(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Cu{constructor(e,t){this.from=e,this.to=t}}function q8(n,e,t){let r=[],i=n,s=0;return He.spans(t,n,e,{span(){},point(o,a){o>i&&(r.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function Eu({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(n*t);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function Tu(n,e){let t=0;for(let{from:r,to:i}of n.ranges){if(e<=i){t+=e-r;break}t+=i-r}return t/n.total}function K8(n,e){for(let t of n)if(e(t))return t}const ew={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function tw(n){let e=n.facet(vh).filter(r=>typeof r!="function"),t=n.facet(g0).filter(r=>typeof r!="function");return t.length&&e.push(He.join(t)),e}class w0{constructor(e,t,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:u})=>{let h=t.lineAt(a,ft.ByPos,e,0,0).top,d=t.lineAt(u,ft.ByPos,e,0,0).bottom;return i+=d-h,{from:a,to:u,top:h,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]: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 t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]: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 w0?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}}function ca(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),r=e.toDOM(n.bottom);return new Dr(n.from,n.length,t,r-t,Array.isArray(n._content)?n._content.map(i=>ca(i,e)):n._content)}const Ru=pe.define({combine:n=>n.join(" ")}),ng=pe.define({combine:n=>n.indexOf(!0)>-1}),rg=ms.newName(),rk=ms.newName(),ik=ms.newName(),sk={"&light":"."+rk,"&dark":"."+ik};function ig(n,e,t){return new ms(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return n;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):n+" "+r}})}const Q8=ig("."+rg,{"&":{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":{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"},"&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"}},sk),Y8={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},qp=ge.ie&&ge.ie_version<=11;class G8{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new T5,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(t=>{for(let r of t)this.queue.push(r);(ge.ie&&ge.ie_version<=11||ge.ios&&e.composing)&&t.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 J8(e),e.state.facet(Ci)&&(e.contentDOM.editContext=this.editContext.editContext)),qp&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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 t;((t=this.view.docView)===null||t===void 0?void 0:t.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(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.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((t,r)=>t!=e[r]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(Ci)?r.root.activeElement!=this.dom:!ga(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ge.ie&&ge.ie_version<=11||ge.android&&ge.chrome)&&!r.state.selection.main.empty&&i.focusNode&&va(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Aa(e.root);if(!t)return!1;let r=ge.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&X8(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let i=ga(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&O5(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)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,Y8),qp&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),qp&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){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&&Vo(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,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 t=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:i}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),i=this.selectionChanged&&ga(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 m8(this.view,e,t,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 t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,i=qS(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!Of(this.view.state.selection,t.newSel.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let r=nw(t,e.previousSibling||e.target.previousSibling,-1),i=nw(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.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(Ci)!=e.state.facet(Ci)&&(e.view.contentDOM.editContext=e.state.facet(Ci)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.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 nw(n,e,t){for(;e;){let r=Pt.get(e);if(r&&r.parent==n)return r;let i=e.parentNode;e=i!=n.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function rw(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return va(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function X8(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return rw(n,i)}let t=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",r,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",r,!0),t?rw(n,t):null}class J8{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=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,a=this.toEditorPos(r.updateRangeStart),u=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let h=u-a>r.text.length;a==this.from&&s<this.from?a=s:u==this.to&&s>this.to&&(u=s);let d=KS(e.state.sliceDoc(a,u),r.text,(h?i.from:i.to)-a,h?"end":null);if(!d){let g=Z.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));Of(g,i)||e.dispatch({selection:g,userEvent:"select"});return}let p={from:d.from+a,to:d.toA+a,insert:Qe.of(r.text.slice(d.from,d.toB).split(`
|
|
141
|
-
`))};if((ge.mac||ge.android)&&p.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:a,to:u,insert:Qe.of([r.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let g=this.to-this.from+(p.to-p.from+p.insert.length);v0(e,p,Z.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from<p.to&&!p.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let u=e.coordsForChar(o);s=u&&new DOMRect(u.left,u.top,u.right-u.left,u.bottom-u.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let u=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(u<h){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(Te.mark({attributes:{style:d}}).range(u,h))}}}e.dispatch({effects:FS.of(Te.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)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=Aa(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,u,h)=>{if(r)return;let d=h.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(h)){i=this.pendingContextChange=null,t+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=d,this.to+=d;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=d}t+=d}),i&&!r&&this.revertPending(e.state),!r}update(e){let t=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||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+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 t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class de{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 t;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||R5(e.parent)||document,this.viewState=new Zx(this,e.state||$e.create(e)),e.scrollTo&&e.scrollTo.is(bu)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(No).map(i=>new zp(i));for(let i of this.plugins)i.update(this);this.observer=new G8(this),this.inputState=new x8(this),this.inputState.ensureHandlers(this.plugins),this.docView=new zx(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Kt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,i,s=this.state;for(let g of e){if(g.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=g.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,u=null;e.some(g=>g.annotation(ZS))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,u=ek(s,o),u||(a=1));let h=this.observer.delayedAndroidKey,d=null;if(h?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(d=null)):this.observer.clear(),s.facet($e.phrases)!=this.state.facet($e.phrases))return this.setState(s);i=Ef.create(this,s,e),i.flags|=a;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(p&&(p=p.map(g.changes)),g.scrollIntoView){let{main:v}=g.state.selection,{x,y:b}=this.state.facet(de.cursorScrollMargin);p=new $o(v.empty?v:Z.cursor(v.head,v.head>v.anchor?-1:1),"nearest","nearest",b,x)}for(let v of g.effects)v.is(bu)&&(p=v.value.clip(this.state))}this.viewState.update(i,p),this.bidiCache=Mf.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(aa)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Ru)!=i.state.facet(Ru)&&(this.viewState.mustMeasureContent=!0),(t||r||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let g of this.state.facet(Xm))try{g(i)}catch(v){Wn(this.state,v,"update listener")}(u||d)&&Promise.resolve().then(()=>{u&&this.state==u.startState&&this.dispatch(u),d&&!qS(this,d)&&h.force&&Vo(this.contentDOM,h.key,h.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 t=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Zx(this,e),this.plugins=e.facet(No).map(r=>new zp(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new zx(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(No),r=e.state.facet(No);if(t!=r){let i=[];for(let s of r){let o=t.indexOf(s);if(o<0)i.push(new zp(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(r){Wn(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 t=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 a=0;;a++){if(o<0)if(wS(r||this.win))s=-1,o=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(i);s=v.from,o=v.top}this.updateState=1;let u=this.viewState.measure();if(!u&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];u&4||([this.measureRequests,h]=[h,this.measureRequests]);let d=h.map(v=>{try{return v.read(this)}catch(x){return Wn(this.state,x),iw}}),p=Ef.create(this,this.state,[]),g=!1;p.flags|=u,t?t.flags|=u:t=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),g=this.docView.update(p),g&&this.docViewUpdate());for(let v=0;v<h.length;v++)if(d[v]!=iw)try{let x=h[v];x.write&&x.write(d[v],this)}catch(x){Wn(this.state,x)}if(g&&this.docView.updateSelection(!0),!p.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 x=((s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o)/this.scaleY;if((x>1||x<-1)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+x,r?r.scrollTop+=x:this.win.scrollBy(0,x),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(Xm))a(t)}get themeClasses(){return rg+" "+(this.state.facet(ng)?ik:rk)+" "+this.state.facet(Ru)}updateAttrs(){let e=sw(this,_S,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ci)?"true":"false",class:"cm-content",style:`${ge.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),sw(this,m0,t);let r=this.observer.ignore(()=>{let i=Lx(this.contentDOM,this.contentAttrs,t),s=Lx(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let i of r.effects)if(i.is(de.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(aa);let e=this.state.facet(de.cspNonce);ms.mount(this.root,this.styleModules.concat(Q8).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 t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(r=>r.plugin==e)||null),t&&t.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,t,r){return $p(this,e,Wx(this,e,t,r))}moveByGroup(e,t){return $p(this,e,Wx(this,e,t,r=>c8(this,e.head,r)))}visualLineSide(e,t){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[t?r.length-1:0];return Z.cursor(s.side(t,i)+e.from,s.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,r=!0){return a8(this,e,t,r)}moveVertically(e,t,r){return $p(this,e,u8(this,e,t,r))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let r=eg(this,e,t);return r&&r.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),eg(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[ti.find(s,e-i.from,-1,t)];return Da(r,o.dir==at.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(LS)||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>Z8)return TS(e.length);let t=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||ES(s.isolates,r=Fx(this,e))))return s.order;r||(r=Fx(this,e));let i=N5(e.text,t,r);return this.bidiCache.push(new Mf(e.from,e.to,t,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(()=>{xS(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,t={}){var r,i,s,o;return bu.of(new $o(typeof e=="number"?Z.cursor(e):e,(r=t.y)!==null&&r!==void 0?r:"nearest",(i=t.x)!==null&&i!==void 0?i:"nearest",(s=t.yMargin)!==null&&s!==void 0?s:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return bu.of(new $o(Z.cursor(r.from),"start","start",r.top-e,t,!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 Mt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Mt.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=ms.newName(),i=[Ru.of(r),aa.of(ig(`.${r}`,e))];return t&&t.dark&&i.push(ng.of(!0)),i}static baseTheme(e){return Ss.lowest(aa.of(ig("."+rg,e,sk)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),i=r&&Pt.get(r)||Pt.get(e);return((t=i==null?void 0:i.root)===null||t===void 0?void 0:t.view)||null}}de.styleModule=aa;de.inputHandler=DS;de.clipboardInputFilter=d0;de.clipboardOutputFilter=p0;de.scrollHandler=BS;de.focusChangeEffect=IS;de.perLineTextDirection=LS;de.exceptionSink=AS;de.updateListener=Xm;de.editable=Ci;de.mouseSelectionStyle=MS;de.dragMovesSelection=PS;de.clickAddsSelectionRange=OS;de.decorations=vh;de.blockWrappers=jS;de.outerDecorations=g0;de.atomicRanges=Za;de.bidiIsolatedRanges=zS;de.cursorScrollMargin=pe.define({combine:n=>{let e=5,t=5;for(let r of n)typeof r=="number"?e=t=r:{x:e,y:t}=r;return{x:e,y:t}}});de.scrollMargins=WS;de.darkTheme=ng;de.cspNonce=pe.define({combine:n=>n.length?n[0]:""});de.contentAttributes=m0;de.editorAttributes=_S;de.lineWrapping=de.contentAttributes.of({class:"cm-lineWrapping"});de.announce=Ne.define();const Z8=4096,iw={};class Mf{constructor(e,t,r,i,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,t){if(t.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&&!t.touchesRange(o.from,o.to)&&r.push(new Mf(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function sw(n,e,t){for(let r=n.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(n):s;o&&u0(o,t)}return t}const eD=ge.mac?"mac":ge.windows?"win":ge.linux?"linux":"key";function tD(n,e){const t=n.split(/-(?!$)/);let r=t[t.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let u=0;u<t.length-1;++u){const h=t[u];if(/^(cmd|meta|m)$/i.test(h))a=!0;else if(/^a(lt)?$/i.test(h))i=!0;else if(/^(c|ctrl|control)$/i.test(h))s=!0;else if(/^s(hift)?$/i.test(h))o=!0;else if(/^mod$/i.test(h))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+h)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Ou(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const nD=Ss.default(de.domEventHandlers({keydown(n,e){return lk(ok(e.state),n,e,"editor")}})),La=pe.define({enables:nD}),ow=new WeakMap;function ok(n){let e=n.facet(La),t=ow.get(e);return t||ow.set(e,t=sD(e.reduce((r,i)=>r.concat(i),[]))),t}function rD(n,e,t){return lk(ok(n.state),e,n,t)}let ls=null;const iD=4e3;function sD(n,e=eD){let t=Object.create(null),r=Object.create(null),i=(o,a)=>{let u=r[o];if(u==null)r[o]=a;else if(u!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,u,h,d)=>{var p,g;let v=t[o]||(t[o]=Object.create(null)),x=a.split(/ (?!$)/).map(C=>tD(C,e));for(let C=1;C<x.length;C++){let R=x.slice(0,C).join(" ");i(R,!0),v[R]||(v[R]={preventDefault:!0,stopPropagation:!1,run:[O=>{let P=ls={view:O,prefix:R,scope:o};return setTimeout(()=>{ls==P&&(ls=null)},iD),!0}]})}let b=x.join(" ");i(b,!1);let S=v[b]||(v[b]={preventDefault:!1,stopPropagation:!1,run:((g=(p=v._any)===null||p===void 0?void 0:p.run)===null||g===void 0?void 0:g.slice())||[]});u&&S.run.push(u),h&&(S.preventDefault=!0),d&&(S.stopPropagation=!0)};for(let o of n){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of a){let d=t[h]||(t[h]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=o;for(let g in d)d[g].run.push(v=>p(v,sg))}let u=o[e]||o.key;if(u)for(let h of a)s(h,u,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(h,"Shift-"+u,o.shift,o.preventDefault,o.stopPropagation)}return t}let sg=null;function lk(n,e,t,r){sg=e;let i=w5(e),s=_n(i,0),o=Zr(s)==i.length&&i!=" ",a="",u=!1,h=!1,d=!1;ls&&ls.view==t&&ls.scope==r&&(a=ls.prefix+" ",YS.indexOf(e.keyCode)<0&&(h=!0,ls=null));let p=new Set,g=S=>{if(S){for(let C of S.run)if(!p.has(C)&&(p.add(C),C(t)))return S.stopPropagation&&(d=!0),!0;S.preventDefault&&(S.stopPropagation&&(d=!0),h=!0)}return!1},v=n[r],x,b;return v&&(g(v[a+Ou(i,e,!o)])?u=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ge.windows&&e.ctrlKey&&e.altKey)&&!(ge.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(x=gs[e.keyCode])&&x!=i?(g(v[a+Ou(x,e,!0)])||e.shiftKey&&(b=Pa[e.keyCode])!=i&&b!=x&&g(v[a+Ou(b,e,!1)]))&&(u=!0):o&&e.shiftKey&&g(v[a+Ou(i,e,!0)])&&(u=!0),!u&&g(v._any)&&(u=!0)),h&&(u=!0),u&&d&&e.stopPropagation(),sg=null,u}class Xs{constructor(e,t,r,i,s){this.className=e,this.left=t,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,t){return t.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,t,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=ak(e);return[new Xs(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return oD(e,t,r)}}function ak(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==at.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function lw(n,e,t,r){let i=n.coordsAtPos(e,t*2);if(!i)return r;let s=n.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=n.posAtCoords({x:s.left+1,y:o}),u=n.posAtCoords({x:s.right-1,y:o});return a==null||u==null?r:{from:Math.max(r.from,Math.min(a,u)),to:Math.min(r.to,Math.max(a,u))}}function oD(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let r=Math.max(t.from,n.viewport.from),i=Math.min(t.to,n.viewport.to),s=n.textDirection==at.LTR,o=n.contentDOM,a=o.getBoundingClientRect(),u=ak(n),h=o.querySelector(".cm-line"),d=h&&window.getComputedStyle(h),p=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),g=a.right-(d?parseInt(d.paddingRight):0),v=Zm(n,r,1),x=Zm(n,i,-1),b=v.type==un.Text?v:null,S=x.type==un.Text?x:null;if(b&&(n.lineWrapping||v.widgetLineBreaks)&&(b=lw(n,r,1,b)),S&&(n.lineWrapping||x.widgetLineBreaks)&&(S=lw(n,i,-1,S)),b&&S&&b.from==S.from&&b.to==S.to)return R(O(t.from,t.to,b));{let D=b?O(t.from,null,b):P(v,!1),N=S?O(null,t.to,S):P(x,!0),L=[];return(b||v).to<(S||x).from-(b&&S?1:0)||v.widgetLineBreaks>1&&D.bottom+n.defaultLineHeight/2<N.top?L.push(C(p,D.bottom,g,N.top)):D.bottom<N.top&&n.elementAtHeight((D.bottom+N.top)/2).type==un.Text&&(D.bottom=N.top=(D.bottom+N.top)/2),R(D).concat(L).concat(R(N))}function C(D,N,L,z){return new Xs(e,D-u.left,N-u.top,Math.max(0,L-D),z-N)}function R({top:D,bottom:N,horizontal:L}){let z=[];for(let Q=0;Q<L.length;Q+=2)z.push(C(L[Q],D,L[Q+1],N));return z}function O(D,N,L){let z=1e9,Q=-1e9,G=[];function X(J,$,te,q,I){let _=n.coordsAtPos(J,J==L.to?-2:2),B=n.coordsAtPos(te,te==L.from?2:-2);!_||!B||(z=Math.min(_.top,B.top,z),Q=Math.max(_.bottom,B.bottom,Q),I==at.LTR?G.push(s&&$?p:_.left,s&&q?g:B.right):G.push(!s&&q?p:B.left,!s&&$?g:_.right))}let W=D??L.from,Y=N??L.to;for(let J of n.visibleRanges)if(J.to>W&&J.from<Y)for(let $=Math.max(J.from,W),te=Math.min(J.to,Y);;){let q=n.state.doc.lineAt($);for(let I of n.bidiSpans(q)){let _=I.from+q.from,B=I.to+q.from;if(_>=te)break;B>$&&X(Math.max(_,$),D==null&&_<=W,Math.min(B,te),N==null&&B>=Y,I.dir)}if($=q.to+1,$>=te)break}return G.length==0&&X(W,D==null,Y,N==null,n.textDirection),{top:z,bottom:Q,horizontal:G}}function P(D,N){let L=a.top+(N?D.top:D.bottom);return{top:L,bottom:L,horizontal:[]}}}function lD(n,e){return n.constructor==e.constructor&&n.eq(e)}class aD{constructor(e,t){this.view=e,this.layer=t,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"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(ef)!=e.state.facet(ef)&&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 t=0,r=e.facet(ef);for(;t<r.length&&r[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,r)=>!lD(t,this.drawn[r]))){let t=this.dom.firstChild,r=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[r].constructor&&i.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=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 ef=pe.define();function ck(n){return[Mt.define(e=>new aD(e,n)),ef.of(n)]}const tl=pe.define({combine(n){return li(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function cD(n={}){return[tl.of(n),uD,fD,hD,NS.of(!0)]}function uk(n){return n.startState.facet(tl)!=n.state.facet(tl)}const uD=ck({above:!0,markers(n){let{state:e}=n,t=e.facet(tl),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||t.drawRangeCursor&&!(s&&ge.ios&&t.iosSelectionHandles)){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:Z.cursor(i.head,i.assoc);for(let u of Xs.forRange(n,o,a))r.push(u)}}return r},update(n,e){n.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=uk(n);return t&&aw(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){aw(e.state,n)},class:"cm-cursorLayer"});function aw(n,e){e.style.animationDuration=n.facet(tl).cursorBlinkRate+"ms"}const fD=ck({above:!1,markers(n){let e=[],{main:t,ranges:r}=n.state.selection;for(let i of r)if(!i.empty)for(let s of Xs.forRange(n,"cm-selectionBackground",i))e.push(s);if(ge.ios&&!t.empty&&n.state.facet(tl).iosSelectionHandles){for(let i of Xs.forRange(n,"cm-selectionHandle cm-selectionHandle-start",Z.cursor(t.from,1)))e.push(i);for(let i of Xs.forRange(n,"cm-selectionHandle cm-selectionHandle-end",Z.cursor(t.to,1)))e.push(i)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||uk(n)},class:"cm-selectionLayer"}),hD=Ss.highest(de.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),fk=Ne.define({map(n,e){return n==null?null:e.mapPos(n)}}),ua=gn.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,r)=>r.is(fk)?r.value:t,n)}}),dD=Mt.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(ua);t==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"),(n.startState.field(ua)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(ua),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let r=n.scrollDOM.getBoundingClientRect();return{left:t.left-r.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-r.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(ua)!=n&&this.view.dispatch({effects:fk.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function pD(){return[ua,dD]}function cw(n,e,t,r,i){e.lastIndex=0;for(let s=n.iterRange(t,r),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function mD(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let r=[];for(let{from:i,to:s}of t)i=Math.max(n.state.doc.lineAt(i).from,i-e),s=Math.min(n.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 gD{constructor(e){const{regexp:t,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(a,u,h,d)=>i(d,h,h+a[0].length,a,u);else if(typeof r=="function")this.addMatch=(a,u,h,d)=>{let p=r(a,u,h);p&&d(h,h+a[0].length,p)};else if(r)this.addMatch=(a,u,h,d)=>d(h,h+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new Ai,r=t.add.bind(t);for(let{from:i,to:s}of mD(e,this.maxLength))cw(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,u)=>{u>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(u,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),r,i):t}updateRange(e,t,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,i);if(a>=o){let u=e.state.doc.lineAt(o),h=u.to<a?e.state.doc.lineAt(a):u,d=Math.max(s.from,u.from),p=Math.min(s.to,h.to);if(this.boundary){for(;o>u.from;o--)if(this.boundary.test(u.text[o-1-u.from])){d=o;break}for(;a<h.to;a++)if(this.boundary.test(h.text[a-h.from])){p=a;break}}let g=[],v,x=(b,S,C)=>g.push(C.range(b,S));if(u==h)for(this.regexp.lastIndex=d-u.from;(v=this.regexp.exec(u.text))&&v.index<p-u.from;)this.addMatch(v,e,v.index+u.from,x);else cw(e.state.doc,this.regexp,d,p,(b,S)=>this.addMatch(S,e,b,x));t=t.update({filterFrom:d,filterTo:p,filter:(b,S)=>b<d||S>p,add:g})}}return t}}const og=/x/.unicode!=null?"gu":"g",yD=new RegExp(`[\0-\b
|
|
142
|
-
--\u2028\u2029\uFEFF-]`,og),vD={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 Kp=null;function xD(){var n;if(Kp==null&&typeof document<"u"&&document.body){let e=document.body.style;Kp=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Kp||!1}const tf=pe.define({combine(n){let e=li(n,{render:null,specialChars:yD,addSpecialChars:null});return(e.replaceTabs=!xD())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,og)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,og)),e}});function wD(n={}){return[tf.of(n),bD()]}let uw=null;function bD(){return uw||(uw=Mt.fromClass(class{constructor(n){this.view=n,this.decorations=Te.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(tf)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new gD({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=_n(e[0],0);if(s==9){let o=i.lineAt(r),a=t.state.tabSize,u=ul(o.text,a,r-o.from);return Te.replace({widget:new ED((a-u%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Te.replace({widget:new CD(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(tf);n.startState.facet(tf)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const SD="•";function kD(n){return n>=32?SD:n==10?"":String.fromCharCode(9216+n)}class CD extends ai{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=kD(this.code),r=e.state.phrase("Control character")+" "+(vD[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class ED extends ai{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 TD(){return OD}const RD=Te.line({class:"cm-activeLine"}),OD=Mt.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let r of n.state.selection.ranges){let i=n.lineBlockAt(r.head);i.from>e&&(t.push(RD.range(i.from)),e=i.from)}return Te.set(t)}},{decorations:n=>n.decorations});class PD extends ai{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?ya(e.firstChild):[];if(!t.length)return null;let r=window.getComputedStyle(e.parentNode),i=Da(t[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 MD(n){let e=Mt.fromClass(class{constructor(t){this.view=t,this.placeholder=n?Te.set([Te.widget({widget:new PD(n),side:1}).range(0)]):Te.none}get decorations(){return this.view.state.doc.length?Te.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,de.contentAttributes.of({"aria-placeholder":n})]:e}const lg=2e3;function AD(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>lg||t.off>lg||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let u=r;u<=i;u++){let h=n.doc.line(u);h.length<=a&&s.push(Z.range(h.from+o,h.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let u=r;u<=i;u++){let h=n.doc.line(u),d=zm(h.text,o,n.tabSize,!0);if(d<0)s.push(Z.cursor(h.to));else{let p=zm(h.text,a,n.tabSize);s.push(Z.range(h.from+d,h.from+p))}}}return s}function DD(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function fw(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),r=n.state.doc.lineAt(t),i=t-r.from,s=i>lg?-1:i==r.length?DD(n,e.clientX):ul(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function ID(n,e){let t=fw(n,e),r=n.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=fw(n,i);if(!a)return r;let u=AD(n.state,t,a);return u.length?o?Z.create(u.concat(r.ranges)):Z.create(u):r}}:null}function LD(n){let e=(t=>t.altKey&&t.button==0);return de.mouseSelectionStyle.of((t,r)=>e(r)?ID(t,r):null)}const ND={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},BD={style:"cursor: crosshair"};function FD(n={}){let[e,t]=ND[n.key||"Alt"],r=Mt.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||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});return[r,de.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?BD:null})]}const Pu="-10000px";class hk{constructor(e,t,r,i){this.facet=t,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,t){var r;let i=e.state.facet(this.facet),s=i.filter(u=>u);if(i===this.input){for(let u of this.tooltipViews)u.update&&u.update(e);return!1}let o=[],a=t?[]:null;for(let u=0;u<s.length;u++){let h=s[u],d=-1;if(h){for(let p=0;p<this.tooltips.length;p++){let g=this.tooltips[p];g&&g.create==h.create&&(d=p)}if(d<0)o[u]=this.createTooltipView(h,u?o[u-1]:null),a&&(a[u]=!!h.above);else{let p=o[u]=this.tooltipViews[d];a&&(a[u]=t[d]),p.update&&p.update(e)}}}for(let u of this.tooltipViews)o.indexOf(u)<0&&(this.removeTooltipView(u),(r=u.destroy)===null||r===void 0||r.call(u));return t&&(a.forEach((u,h)=>t[h]=u),t.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function _D(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Qp=pe.define({combine:n=>{var e,t,r;return{position:ge.ios?"absolute":((e=n.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((r=n.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||_D}}}),hw=new WeakMap,b0=Mt.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(Qp);this.position=e.position,this.parent=e.parent,this.classes=n.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 hk(n,S0,(t,r)=>this.createTooltip(t,r),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.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 n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,r=n.state.facet(Qp);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!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);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),r=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",t.dom.appendChild(i)}return t.dom.style.position=this.position,t.dom.style.top=Pu,t.dom.style.left="0px",this.container.insertBefore(t.dom,r),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(n=r.destroy)===null||n===void 0||n.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(ge.safari){let o=s.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=y0(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 a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(Qp).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:t,space:r,scaleX:i,scaleY:s}=n,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let u=this.manager.tooltips[a],h=this.manager.tooltipViews[a],{dom:d}=h,p=n.pos[a],g=n.size[a];if(!p||u.clip!==!1&&(p.bottom<=Math.max(t.top,r.top)||p.top>=Math.min(t.bottom,r.bottom)||p.right<Math.max(t.left,r.left)-.1||p.left>Math.min(t.right,r.right)+.1)){d.style.top=Pu;continue}let v=u.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,x=v?7:0,b=g.right-g.left,S=(e=hw.get(h))!==null&&e!==void 0?e:g.bottom-g.top,C=h.offset||zD,R=this.view.textDirection==at.LTR,O=g.width>r.right-r.left?R?r.left:r.right-g.width:R?Math.max(r.left,Math.min(p.left-(v?14:0)+C.x,r.right-b)):Math.min(Math.max(r.left,p.left-b+(v?14:0)-C.x),r.right-b),P=this.above[a];!u.strictSide&&(P?p.top-S-x-C.y<r.top:p.bottom+S+x+C.y>r.bottom)&&P==r.bottom-p.bottom>p.top-r.top&&(P=this.above[a]=!P);let D=(P?p.top-r.top:r.bottom-p.bottom)-x;if(D<S&&h.resize!==!1){if(D<this.view.defaultLineHeight){d.style.top=Pu;continue}hw.set(h,S),d.style.height=(S=D)/s+"px"}else d.style.height&&(d.style.height="");let N=P?p.top-S-x-C.y:p.bottom+x+C.y,L=O+b;if(h.overlap!==!0)for(let z of o)z.left<L&&z.right>O&&z.top<N+S&&z.bottom>N&&(N=P?z.top-S-2-x:z.bottom+x+2);if(this.position=="absolute"?(d.style.top=(N-n.parent.top)/s+"px",dw(d,(O-n.parent.left)/i)):(d.style.top=N/s+"px",dw(d,O/i)),v){let z=p.left+(R?C.x:-C.x)-(O+14-7);v.style.left=z/i+"px"}h.overlap!==!0&&o.push({left:O,top:N,right:L,bottom:N+S}),d.classList.toggle("cm-tooltip-above",P),d.classList.toggle("cm-tooltip-below",!P),h.positioned&&h.positioned(n.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 n of this.manager.tooltipViews)n.dom.style.top=Pu}},{eventObservers:{scroll(){this.maybeMeasure()}}});function dw(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const jD=de.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:"14px",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"}}}),zD={x:0,y:0},S0=pe.define({enables:[b0,jD]}),Af=pe.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Sh{static create(e){return new Sh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new hk(e,Af,(t,r)=>this.createHostedView(t,r),t=>t.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(t===void 0)t=i;else if(t!==i)return}}return t}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 WD=S0.compute([Af],n=>{let e=n.facet(Af);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var r;return(r=t.end)!==null&&r!==void 0?r:t.pos})),create:Sh.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),dk=pe.define();class HD{constructor(e,t,r,i,s,o){this.view=e,this.source=t,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:t}=this,r=e.docView.tile.nearest(t.target);if(!r)return;let i,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let o=e.coordsAtPos(i);if(!o||t.y<o.top||t.y>o.bottom||t.x<o.left-e.defaultCharacterWidth||t.x>o.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(h=>h.from<=i&&h.to>=i),u=a&&a.dir==at.RTL?-1:1;s=t.x<o.left?-u:u}this.activateHover(e,i,s)}activateHover(e,t,r,i){let s=this.source(e,t,r),o=a=>{if(a&&!(Array.isArray(a)&&!a.length)){let u=Array.isArray(a)?a:[a];i&&this.locked.set(u,i),e.dispatch({effects:this.setHover.of(u)})}};if(s&&"then"in s){let a=this.pending={pos:t};s.then(u=>{this.pending==a&&(this.pending=null,o(u))},u=>Wn(e.state,u,"hover tooltip"))}else o(s)}get tooltip(){let e=this.view.plugin(b0),t=e?e.manager.tooltips.findIndex(r=>r.create==Sh.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,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&&!VD(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(t=i[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!$D(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=r=>{e.removeEventListener("mouseleave",t);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",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Mu=4;function VD(n,e){let{left:t,right:r,top:i,bottom:s}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=t-Mu&&e.clientX<=r+Mu&&e.clientY>=i-Mu&&e.clientY<=s+Mu}function $D(n,e,t,r,i,s){let o=n.scrollDOM.getBoundingClientRect(),a=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let u=n.posAtCoords({x:r,y:i},!1);return u>=e&&u<=t}function UD(n,e={}){let t=Ne.define(),r=new WeakMap,i=gn.define({create(){return[]},update(o,a){let u=r.get(o);if(o.length&&(e.hideOnChange&&(a.docChanged||a.selection)?o=[]:u&&u(a)?o=[]:e.hideOn&&(o=o.filter(h=>!e.hideOn(a,h)))),a.docChanged&&o.length){let h=[];for(let d of o){let p=a.changes.mapPos(d.pos,-1,Cn.TrackDel);if(p!=null){let g=Object.assign(Object.create(null),d);g.pos=p,g.end!=null&&(g.end=a.changes.mapPos(g.end)),h.push(g)}}o=h}for(let h of a.effects)h.is(t)&&(o=h.value,u=void 0),(h.is(KD)&&!h.value||h.value==i)&&(o=[]);return o.length&&u&&r.set(o,u),o},provide:o=>Af.from(o)});const s=Mt.define(o=>new HD(o,n,i,r,t,e.hoverTime||300));return{active:i,extension:[i,s,dk.of(s),WD]}}function qD(n,e,t,r={}){var i;let s=n.state.facet(dk).map(o=>n.plugin(o)).filter(o=>!!o);if(r.tooltip&&r.tooltip.active){let o=s.find(a=>a.field==r.tooltip.active);o&&(s=[o])}for(let o of s)o.activateHover(n,e,t,(i=r.until)!==null&&i!==void 0?i:(()=>!1))}function pk(n,e){let t=n.plugin(b0);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}const KD=Ne.define(),pw=pe.define({combine(n){let e,t;for(let r of n)e=e||r.topContainer,t=t||r.bottomContainer;return{topContainer:e,bottomContainer:t}}});function k0(n,e){let t=n.plugin(mk),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}const mk=Mt.fromClass(class{constructor(n){this.input=n.state.facet(Na),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(pw);this.top=new Au(n,!0,e.topContainer),this.bottom=new Au(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(pw);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Au(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Au(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Na);if(t!=this.input){let r=t.filter(u=>u),i=[],s=[],o=[],a=[];for(let u of r){let h=this.specs.indexOf(u),d;h<0?(d=u(n.view),a.push(d)):(d=this.panels[h],d.update&&d.update(n)),i.push(d),(d.top?s:o).push(d)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let u of a)u.dom.classList.add("cm-panel"),u.mount&&u.mount()}else for(let r of this.panels)r.update&&r.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>de.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Au{constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=mw(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=mw(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 mw(n){let e=n.nextSibling;return n.remove(),e}const Na=pe.define({enables:mk});function QD(n,e){let t,r=new Promise(o=>t=o),i=o=>YD(o,e,t);n.state.field(Yp,!1)?n.dispatch({effects:gk.of(i)}):n.dispatch({effects:Ne.appendConfig.of(Yp.init(()=>[i]))});let s=yk.of(i);return{close:s,result:r.then(o=>((n.win.queueMicrotask||(u=>n.win.setTimeout(u,10)))(()=>{n.state.field(Yp).indexOf(i)>-1&&n.dispatch({effects:s})}),o))}}const Yp=gn.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(gk)?n=[t.value].concat(n):t.is(yk)&&(n=n.filter(r=>r!=t.value));return n},provide:n=>Na.computeN([n],e=>e.field(n))}),gk=Ne.define(),yk=Ne.define();function YD(n,e,t){let r=e.content?e.content(n,()=>o(null)):null;if(!r){if(r=rt("form"),e.input){let a=rt("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(rt("label",(e.label||"")+": ",a))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(rt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let i=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let a=0;a<i.length;a++){let u=i[a];u.addEventListener("keydown",h=>{h.keyCode==27?(h.preventDefault(),o(null)):h.keyCode==13&&(h.preventDefault(),o(u))}),u.addEventListener("submit",h=>{h.preventDefault(),o(u)})}let s=rt("div",r,rt("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(s.className=e.class),s.classList.add("cm-dialog");function o(a){s.contains(s.ownerDocument.activeElement)&&n.focus(),t(a)}return{dom:s,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=r.querySelector(e.focus):a=r.querySelector("input")||r.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class Ii extends ps{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ii.prototype.elementClass="";Ii.prototype.toDOM=void 0;Ii.prototype.mapMode=Cn.TrackBefore;Ii.prototype.startSide=Ii.prototype.endSide=-1;Ii.prototype.point=!0;const nf=pe.define(),GD=pe.define(),XD={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>He.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},wa=pe.define();function JD(n){return[vk(),wa.of({...XD,...n})]}const gw=pe.define({combine:n=>n.some(e=>e)});function vk(n){return[ZD]}const ZD=Mt.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.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=n.state.facet(wa).map(e=>new vw(n,e)),this.fixed=!n.state.facet(gw);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),n.scrollDOM.insertBefore(this.dom,n.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(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}if(n.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(gw)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=He.iter(this.view.state.facet(nf),this.view.viewport.from),r=[],i=this.gutters.map(s=>new eI(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==un.Text&&o){ag(t,r,a.from);for(let u of i)u.line(this.view,a,r);o=!1}else if(a.widget)for(let u of i)u.widget(this.view,a)}else if(s.type==un.Text){ag(t,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();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(wa),t=n.state.facet(wa),r=n.docChanged||n.heightChanged||n.viewportChanged||!He.eq(n.startState.facet(nf),n.state.facet(nf),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(n)&&(r=!0);else{r=!0;let i=[];for(let s of t){let o=e.indexOf(s);o<0?i.push(new vw(this.view,s)):(this.gutters[o].update(n),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 n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>de.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let r=t.dom.offsetWidth*e.scaleX,i=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==at.LTR?{left:r,right:i}:{right:r,left:i}})});function yw(n){return Array.isArray(n)?n:[n]}function ag(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class eI{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=He.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let a=new xk(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=t.bottom,this.i++}line(e,t,r){let i=[];ag(this.cursor,i,t.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),i=r?[r]:null;for(let s of e.state.facet(GD)){let o=s(e,t.widget,t);o&&(i||(i=[])).push(o)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class vw{constructor(e,t){this.view=e,this.config=t,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 t.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 u=s.getBoundingClientRect();o=(u.top+u.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=yw(t.markers(e)),t.initialSpacer&&(this.spacer=new xk(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=yw(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!He.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class xk{constructor(e,t,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,i)}update(e,t,r,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),tI(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,u=s<t.length?t[s++]:null,h=!1;if(u){let d=u.elementClass;d&&(r+=" "+d);for(let p=o;p<this.markers.length;p++)if(this.markers[p].compare(u)){a=p,h=!0;break}}else a=this.markers.length;for(;o<a;){let d=this.markers[o++];if(d.toDOM){d.destroy(i);let p=i.nextSibling;i.remove(),i=p}}if(!u)break;u.toDOM&&(h?i=i.nextSibling:this.dom.insertBefore(u.toDOM(e),i)),h&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}}function tI(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const nI=pe.define(),rI=pe.define(),Bo=pe.define({combine(n){return li(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let i in t){let s=r[i],o=t[i];r[i]=s?(a,u,h)=>s(a,u,h)||o(a,u,h):o}return r}})}});class Gp extends Ii{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Xp(n,e){return n.state.facet(Bo).formatNumber(e,n.state)}const iI=wa.compute([Bo],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(nI)},lineMarker(e,t,r){return r.some(i=>i.toDOM)?null:new Gp(Xp(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,r)=>{for(let i of e.state.facet(rI)){let s=i(e,t,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Bo)!=e.state.facet(Bo),initialSpacer(e){return new Gp(Xp(e,xw(e.state.doc.lines)))},updateSpacer(e,t){let r=Xp(t.view,xw(t.view.state.doc.lines));return r==e.number?e:new Gp(r)},domEventHandlers:n.facet(Bo).domEventHandlers,side:"before"}));function sI(n={}){return[Bo.of(n),vk(),iI]}function xw(n){let e=9;for(;e<n;)e=e*10+9;return e}const oI=new class extends Ii{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},lI=nf.compute(["selection"],n=>{let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head).from;i>t&&(t=i,e.push(oI.range(i)))}return He.of(e)});function aI(){return lI}const wk=1024;let cI=0;class Jp{constructor(e,t){this.from=e,this.to=t}}class We{constructor(e={}){this.id=cI++,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=Un.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}We.closedBy=new We({deserialize:n=>n.split(" ")});We.openedBy=new We({deserialize:n=>n.split(" ")});We.group=new We({deserialize:n=>n.split(" ")});We.isolate=new We({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});We.contextHash=new We({perNode:!0});We.lookAhead=new We({perNode:!0});We.mounted=new We({perNode:!0});class ba{constructor(e,t,r,i=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[We.mounted.id]}}const uI=Object.create(null);class Un{constructor(e,t,r,i=0){this.name=e,this.props=t,this.id=r,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):uI,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Un(e.name||"",t,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");t[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 t=this.prop(We.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let i of r.split(" "))t[i]=e[r];return r=>{for(let i=r.prop(We.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?r.name:i[s]];if(o)return o}}}}Un.none=new Un("",Object.create(null),0,8);class C0{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];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 a=o[1],u=o[0];u.combine&&u.id in i&&(a=u.combine(i[u.id],a)),i[u.id]=a}}t.push(i?new Un(r.name,i,r.id,r.flags):r)}return new C0(t)}}const Du=new WeakMap,ww=new WeakMap;var Et;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(Et||(Et={}));class Nt{constructor(e,t,r,i,s){if(this.type=e,this.children=t,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=ba.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let i=r.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new ug(this.topNode,e)}cursorAt(e,t=0,r=0){let i=Du.get(this)||this.topNode,s=new ug(i);return s.moveTo(e,t),Du.set(this,s._tree),s}get topNode(){return new vr(this,0,0,null)}resolve(e,t=0){let r=Ba(Du.get(this)||this.topNode,e,t,!1);return Du.set(this,r),r}resolveInner(e,t=0){let r=Ba(ww.get(this)||this.topNode,e,t,!0);return ww.set(this,r),r}resolveStack(e,t=0){return dI(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&Et.IncludeAnonymous)>0;for(let u=this.cursor(o|Et.IncludeAnonymous);;){let h=!1;if(u.from<=s&&u.to>=i&&(!a&&u.type.isAnonymous||t(u)!==!1)){if(u.firstChild())continue;h=!0}for(;h&&r&&(a||!u.type.isAnonymous)&&r(u),!u.nextSibling();){if(!u.parent())return;h=!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 t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:R0(Un.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new Nt(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new Nt(Un.none,t,r,i)))}static build(e){return pI(e)}}Nt.empty=new Nt(Un.none,[],[],0);class E0{constructor(e,t){this.buffer=e,this.index=t}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 E0(this.buffer,this.index)}}class vs{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return Un.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],i=this.set.types[t],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,t,r,i,s){let{buffer:o}=this,a=-1;for(let u=e;u!=t&&!(bk(s,i,o[u+1],o[u+2])&&(a=u,r>0));u=o[u+3]);return a}slice(e,t,r){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,u=0;a<t;){s[u++]=i[a++],s[u++]=i[a++]-r;let h=s[u++]=i[a++]-r;s[u++]=i[a++]-e,o=Math.max(o,h)}return new vs(s,o,this.set)}}function bk(n,e,t,r){switch(n){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ba(n,e,t,r){for(var i;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!r&&n instanceof vr&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=r?0:Et.IgnoreOverlays;if(r)for(let o=n,a=o.parent;a;o=a,a=o.parent)o instanceof vr&&o.index<0&&((i=a.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(n=a);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class Sk{cursor(e=0){return new ug(this,e)}getChild(e,t=null,r=null){let i=bw(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return bw(this,e,t,r)}resolve(e,t=0){return Ba(this,e,t,!1)}resolveInner(e,t=0){return Ba(this,e,t,!0)}matchContext(e){return cg(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(r=t,t=i.prevSibling):t=i}return r}get node(){return this}get next(){return this.parent}}class vr extends Sk{constructor(e,t,r,i){super(),this._tree=e,this.from=t,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,t,r,i,s=0){for(let o=this;;){for(let{children:a,positions:u}=o._tree,h=t>0?a.length:-1;e!=h;e+=t){let d=a[e],p=u[e]+o.from,g;if(!(!(s&Et.EnterBracketed&&d instanceof Nt&&(g=ba.get(d))&&!g.overlay&&g.bracketed&&r>=p&&r<=p+d.length)&&!bk(i,r,p,p+d.length))){if(d instanceof vs){if(s&Et.ExcludeBuffers)continue;let v=d.findChild(0,d.buffer.length,t,r-p,i);if(v>-1)return new cs(new fI(o,d,e,p),null,v)}else if(s&Et.IncludeAnonymous||!d.type.isAnonymous||T0(d)){let v;if(!(s&Et.IgnoreMounts)&&(v=ba.get(d))&&!v.overlay)return new vr(v.tree,p,e,o);let x=new vr(d,p,e,o);return s&Et.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(t<0?d.children.length-1:0,t,r,i,s)}}}if(s&Et.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<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,t,r=0){let i;if(!(r&Et.IgnoreOverlays)&&(i=ba.get(this._tree))&&i.overlay){let s=e-this.from,o=r&Et.EnterBracketed&&i.bracketed;for(let{from:a,to:u}of i.overlay)if((t>0||o?a<=s:a<s)&&(t<0||o?u>=s:u>s))return new vr(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,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 bw(n,e,t,r){let i=n.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!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 cg(n,e,t=e.length-1){for(let r=n;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class fI{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class cs extends Sk{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,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,r);return s<0?null:new cs(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,t,r=0){if(r&Et.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new cs(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,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new cs(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new cs(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{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)),t.push(0)}return new Nt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function kk(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let r=t instanceof vr&&t.index<0?null:t.parent,i=n.slice();return r?i[e]=r:i.splice(e,1),new hI(i,t)}class hI{constructor(e,t){this.heads=e,this.node=t}get next(){return kk(this.heads)}}function dI(n,e,t){let r=n.resolveInner(e,t),i=null;for(let s=r instanceof vr?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,t)),s=o}else{let o=ba.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new vr(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Ba(a,e,t,!1))}}return i?kk(i):r}class ug{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Et.EnterBracketed,e instanceof vr)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,t){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=t||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 vr?(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,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-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,t,r=this.mode){return this.buffer?r&Et.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Et.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Et.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:t}=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(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(r<0?t.buffer.length:t.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 t,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:t,parent:r}=i)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let s=t+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&Et.IncludeAnonymous||a instanceof vs||!a.type.isAnonymous||T0(a))return!1}return!0}move(e,t){if(t&&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,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=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;t=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)t=new cs(this.buffer,t,this.stack[i]);return this.bufferNode=new cs(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){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&&t&&t(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return cg(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return cg(this._tree,e,i);let o=r[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function T0(n){return n.children.some(e=>e instanceof vs||!e.type.isAnonymous||T0(e))}function pI(n){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=wk,reused:s=[],minRepeatType:o=r.types.length}=n,a=Array.isArray(t)?new E0(t,t.length):t,u=r.types,h=0,d=0;function p(D,N,L,z,Q,G){let{id:X,start:W,end:Y,size:J}=a,$=d,te=h;if(J<0)if(a.next(),J==-1){let M=s[X];L.push(M),z.push(W-D);return}else if(J==-3){h=X;return}else if(J==-4){d=X;return}else throw new RangeError(`Unrecognized record size: ${J}`);let q=u[X],I,_,B=W-D;if(Y-W<=i&&(_=S(a.pos-N,Q))){let M=new Uint16Array(_.size-_.skip),V=a.pos-_.size,ne=M.length;for(;a.pos>V;)ne=C(_.start,M,ne);I=new vs(M,Y-_.start,r),B=_.start-D}else{let M=a.pos-J;a.next();let V=[],ne=[],ee=X>=o?X:-1,fe=0,se=Y;for(;a.pos>M;)ee>=0&&a.id==ee&&a.size>=0?(a.end<=se-i&&(x(V,ne,W,fe,a.end,se,ee,$,te),fe=V.length,se=a.end),a.next()):G>2500?g(W,M,V,ne):p(W,M,V,ne,ee,G+1);if(ee>=0&&fe>0&&fe<V.length&&x(V,ne,W,fe,W,se,ee,$,te),V.reverse(),ne.reverse(),ee>-1&&fe>0){let me=v(q,te);I=R0(q,V,ne,0,V.length,0,Y-W,me,me)}else I=b(q,V,ne,Y-W,$-Y,te)}L.push(I),z.push(B)}function g(D,N,L,z){let Q=[],G=0,X=-1;for(;a.pos>N;){let{id:W,start:Y,end:J,size:$}=a;if($>4)a.next();else{if(X>-1&&Y<X)break;X<0&&(X=J-i),Q.push(W,Y,J),G++,a.next()}}if(G){let W=new Uint16Array(G*4),Y=Q[Q.length-2];for(let J=Q.length-3,$=0;J>=0;J-=3)W[$++]=Q[J],W[$++]=Q[J+1]-Y,W[$++]=Q[J+2]-Y,W[$++]=$;L.push(new vs(W,Q[2]-Y,r)),z.push(Y-D)}}function v(D,N){return(L,z,Q)=>{let G=0,X=L.length-1,W,Y;if(X>=0&&(W=L[X])instanceof Nt){if(!X&&W.type==D&&W.length==Q)return W;(Y=W.prop(We.lookAhead))&&(G=z[X]+W.length+Y)}return b(D,L,z,Q,G,N)}}function x(D,N,L,z,Q,G,X,W,Y){let J=[],$=[];for(;D.length>z;)J.push(D.pop()),$.push(N.pop()+L-Q);D.push(b(r.types[X],J,$,G-Q,W-G,Y)),N.push(Q-L)}function b(D,N,L,z,Q,G,X){if(G){let W=[We.contextHash,G];X=X?[W].concat(X):[W]}if(Q>25){let W=[We.lookAhead,Q];X=X?[W].concat(X):[W]}return new Nt(D,N,L,z,X)}function S(D,N){let L=a.fork(),z=0,Q=0,G=0,X=L.end-i,W={size:0,start:0,skip:0};e:for(let Y=L.pos-D;L.pos>Y;){let J=L.size;if(L.id==N&&J>=0){W.size=z,W.start=Q,W.skip=G,G+=4,z+=4,L.next();continue}let $=L.pos-J;if(J<0||$<Y||L.start<X)break;let te=L.id>=o?4:0,q=L.start;for(L.next();L.pos>$;){if(L.size<0)if(L.size==-3||L.size==-4)te+=4;else break e;else L.id>=o&&(te+=4);L.next()}Q=q,z+=J,G+=te}return(N<0||z==D)&&(W.size=z,W.start=Q,W.skip=G),W.size>4?W:void 0}function C(D,N,L){let{id:z,start:Q,end:G,size:X}=a;if(a.next(),X>=0&&z<o){let W=L;if(X>4){let Y=a.pos-(X-4);for(;a.pos>Y;)L=C(D,N,L)}N[--L]=W,N[--L]=G-D,N[--L]=Q-D,N[--L]=z}else X==-3?h=z:X==-4&&(d=z);return L}let R=[],O=[];for(;a.pos>0;)p(n.start||0,n.bufferStart||0,R,O,-1,0);let P=(e=n.length)!==null&&e!==void 0?e:R.length?O[0]+R[0].length:0;return new Nt(u[n.topID],R.reverse(),O.reverse(),P)}const Sw=new WeakMap;function rf(n,e){if(!n.isAnonymous||e instanceof vs||e.type!=n)return 1;let t=Sw.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=n||!(r instanceof Nt)){t=1;break}t+=rf(n,r)}Sw.set(e,t)}return t}function R0(n,e,t,r,i,s,o,a,u){let h=0;for(let x=r;x<i;x++)h+=rf(n,e[x]);let d=Math.ceil(h*1.5/8),p=[],g=[];function v(x,b,S,C,R){for(let O=S;O<C;){let P=O,D=b[O],N=rf(n,x[O]);for(O++;O<C;O++){let L=rf(n,x[O]);if(N+L>=d)break;N+=L}if(O==P+1){if(N>d){let L=x[P];v(L.children,L.positions,0,L.children.length,b[P]+R);continue}p.push(x[P])}else{let L=b[O-1]+x[O-1].length-D;p.push(R0(n,x,b,P,O,D,L,null,u))}g.push(D+R-s)}}return v(e,t,r,i,0),(a||u)(p,g,o)}class Js{constructor(e,t,r,i,s=!1,o=!1){this.from=e,this.to=t,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,t=[],r=!1){let i=[new Js(0,e.length,e,0,!1,r)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,r=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,u=0,h=0;;a++){let d=a<t.length?t[a]:null,p=d?d.fromA:1e9;if(p-u>=r)for(;o&&o.from<p;){let g=o;if(u>=g.from||p<=g.to||h){let v=Math.max(g.from,u)-h,x=Math.min(g.to,p)-h;g=v>=x?null:new Js(v,x,g.tree,g.offset+h,a>0,!!d)}if(g&&i.push(g),o.to>p)break;o=s<e.length?e[s++]:null}if(!d)break;u=d.toA,h=d.toA-d.toB}return i}}class Ck{startParse(e,t,r){return typeof e=="string"&&(e=new mI(e)),r=r?r.length?r.map(i=>new Jp(i.from,i.to)):[new Jp(0,0)]:[new Jp(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let i=this.startParse(e,t,r);for(;;){let s=i.advance();if(s)return s}}}class mI{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new We({perNode:!0});let gI=0;class dr{constructor(e,t,r,i){this.name=e,this.set=t,this.base=r,this.modified=i,this.id=gI++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof dr&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let i=new dr(r,[],null,[]);if(i.set.push(i),t)for(let s of t.set)i.set.push(s);return i}static defineModifier(e){let t=new Df(e);return r=>r.modified.indexOf(t)>-1?r:Df.get(r.base||r,r.modified.concat(t).sort((i,s)=>i.id-s.id))}}let yI=0;class Df{constructor(e){this.name=e,this.instances=[],this.id=yI++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(a=>a.base==e&&vI(t,a.modified));if(r)return r;let i=[],s=new dr(e.name,i,e,t);for(let a of t)a.instances.push(s);let o=xI(t);for(let a of e.set)if(!a.modified.length)for(let u of o)i.push(Df.get(a,u));return s}}function vI(n,e){return n.length==e.length&&n.every((t,r)=>t==e[r])}function xI(n){let e=[[]];for(let t=0;t<n.length;t++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(n[t]));return e.sort((t,r)=>r.length-t.length)}function Ek(n){let e=Object.create(null);for(let t in n){let r=n[t];Array.isArray(r)||(r=[r]);for(let i of t.split(" "))if(i){let s=[],o=2,a=i;for(let p=0;;){if(a=="..."&&p>0&&p+3==i.length){o=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!g)throw new RangeError("Invalid path: "+i);if(s.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),p+=g[0].length,p==i.length)break;let v=i[p++];if(p==i.length&&v=="!"){o=0;break}if(v!="/")throw new RangeError("Invalid path: "+i);a=i.slice(p)}let u=s.length-1,h=s[u];if(!h)throw new RangeError("Invalid path: "+i);let d=new Fa(r,o,u>0?s.slice(0,u):null);e[h]=d.sort(e[h])}}return Tk.add(e)}const Tk=new We({combine(n,e){let t,r,i;for(;n||e;){if(!n||e&&n.depth>=e.depth?(i=e,e=e.next):(i=n,n=n.next),t&&t.mode==i.mode&&!i.context&&!t.context)continue;let s=new Fa(i.tags,i.mode,i.context);t?t.next=s:r=s,t=s}return r}});class Fa{constructor(e,t,r,i){this.tags=e,this.mode=t,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}}Fa.empty=new Fa([],2,null);function Rk(n,e){let t=Object.create(null);for(let s of n)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let u of a.set){let h=t[u.id];if(h){o=o?o+" "+h:h;break}}return o},scope:r}}function wI(n,e){let t=null;for(let r of n){let i=r.style(e);i&&(t=t?t+" "+i:i)}return t}function bI(n,e,t,r=0,i=n.length){let s=new SI(r,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),r,i,"",s.highlighters),s.flush(i)}class SI{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,r,i,s){let{type:o,from:a,to:u}=e;if(a>=r||u<=t)return;o.isTop&&(s=this.highlighters.filter(v=>!v.scope||v.scope(o)));let h=i,d=kI(e)||Fa.empty,p=wI(s,d.tags);if(p&&(h&&(h+=" "),h+=p,d.mode==1&&(i+=(i?" ":"")+p)),this.startSpan(Math.max(t,a),h),d.opaque)return;let g=e.tree&&e.tree.prop(We.mounted);if(g&&g.overlay){let v=e.node.enter(g.overlay[0].from+a,1),x=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),b=e.firstChild();for(let S=0,C=a;;S++){let R=S<g.overlay.length?g.overlay[S]:null,O=R?R.from+a:u,P=Math.max(t,C),D=Math.min(r,O);if(P<D&&b)for(;e.from<D&&(this.highlightRange(e,P,D,i,s),this.startSpan(Math.min(D,e.to),h),!(e.to>=O||!e.nextSibling())););if(!R||O>r)break;C=R.to+a,C>t&&(this.highlightRange(v.cursor(),Math.max(t,R.from+a),Math.min(r,C),"",x),this.startSpan(Math.min(r,C),h))}b&&e.parent()}else if(e.firstChild()){g&&(i="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,i,s),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function kI(n){let e=n.type.prop(Tk);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const he=dr.define,Iu=he(),ss=he(),kw=he(ss),Cw=he(ss),os=he(),Lu=he(os),Zp=he(os),Xr=he(),zs=he(Xr),Qr=he(),Yr=he(),fg=he(),ra=he(fg),Nu=he(),ce={comment:Iu,lineComment:he(Iu),blockComment:he(Iu),docComment:he(Iu),name:ss,variableName:he(ss),typeName:kw,tagName:he(kw),propertyName:Cw,attributeName:he(Cw),className:he(ss),labelName:he(ss),namespace:he(ss),macroName:he(ss),literal:os,string:Lu,docString:he(Lu),character:he(Lu),attributeValue:he(Lu),number:Zp,integer:he(Zp),float:he(Zp),bool:he(os),regexp:he(os),escape:he(os),color:he(os),url:he(os),keyword:Qr,self:he(Qr),null:he(Qr),atom:he(Qr),unit:he(Qr),modifier:he(Qr),operatorKeyword:he(Qr),controlKeyword:he(Qr),definitionKeyword:he(Qr),moduleKeyword:he(Qr),operator:Yr,derefOperator:he(Yr),arithmeticOperator:he(Yr),logicOperator:he(Yr),bitwiseOperator:he(Yr),compareOperator:he(Yr),updateOperator:he(Yr),definitionOperator:he(Yr),typeOperator:he(Yr),controlOperator:he(Yr),punctuation:fg,separator:he(fg),bracket:ra,angleBracket:he(ra),squareBracket:he(ra),paren:he(ra),brace:he(ra),content:Xr,heading:zs,heading1:he(zs),heading2:he(zs),heading3:he(zs),heading4:he(zs),heading5:he(zs),heading6:he(zs),contentSeparator:he(Xr),list:he(Xr),quote:he(Xr),emphasis:he(Xr),strong:he(Xr),link:he(Xr),monospace:he(Xr),strikethrough:he(Xr),inserted:he(),deleted:he(),changed:he(),invalid:he(),meta:Nu,documentMeta:he(Nu),annotation:he(Nu),processingInstruction:he(Nu),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 n in ce){let e=ce[n];e instanceof dr&&(e.name=n)}Rk([{tag:ce.link,class:"tok-link"},{tag:ce.heading,class:"tok-heading"},{tag:ce.emphasis,class:"tok-emphasis"},{tag:ce.strong,class:"tok-strong"},{tag:ce.keyword,class:"tok-keyword"},{tag:ce.atom,class:"tok-atom"},{tag:ce.bool,class:"tok-bool"},{tag:ce.url,class:"tok-url"},{tag:ce.labelName,class:"tok-labelName"},{tag:ce.inserted,class:"tok-inserted"},{tag:ce.deleted,class:"tok-deleted"},{tag:ce.literal,class:"tok-literal"},{tag:ce.string,class:"tok-string"},{tag:ce.number,class:"tok-number"},{tag:[ce.regexp,ce.escape,ce.special(ce.string)],class:"tok-string2"},{tag:ce.variableName,class:"tok-variableName"},{tag:ce.local(ce.variableName),class:"tok-variableName tok-local"},{tag:ce.definition(ce.variableName),class:"tok-variableName tok-definition"},{tag:ce.special(ce.variableName),class:"tok-variableName2"},{tag:ce.definition(ce.propertyName),class:"tok-propertyName tok-definition"},{tag:ce.typeName,class:"tok-typeName"},{tag:ce.namespace,class:"tok-namespace"},{tag:ce.className,class:"tok-className"},{tag:ce.macroName,class:"tok-macroName"},{tag:ce.propertyName,class:"tok-propertyName"},{tag:ce.operator,class:"tok-operator"},{tag:ce.comment,class:"tok-comment"},{tag:ce.meta,class:"tok-meta"},{tag:ce.invalid,class:"tok-invalid"},{tag:ce.punctuation,class:"tok-punctuation"}]);var em;const Fo=new We;function CI(n){return pe.define({combine:n?e=>e.concat(n):void 0})}const EI=new We;class Lr{constructor(e,t,r=[],i=""){this.data=e,this.name=i,$e.prototype.hasOwnProperty("tree")||Object.defineProperty($e.prototype,"tree",{get(){return en(this)}}),this.parser=t,this.extension=[xs.of(this),$e.languageData.of((s,o,a)=>{let u=Ew(s,o,a),h=u.type.prop(Fo);if(!h)return[];let d=s.facet(h),p=u.type.prop(EI);if(p){let g=u.resolve(o-u.from,a);for(let v of p)if(v.test(g,s)){let x=s.facet(v.facet);return v.type=="replace"?x:x.concat(d)}}return d})].concat(r)}isActiveAt(e,t,r=-1){return Ew(e,t,r).type.prop(Fo)==this.data}findRegions(e){let t=e.facet(xs);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Fo)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(We.mounted);if(a){if(a.tree.prop(Fo)==this.data){if(a.overlay)for(let u of a.overlay)r.push({from:u.from+o,to:u.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let u=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>u)return}}for(let u=0;u<s.children.length;u++){let h=s.children[u];h instanceof Nt&&i(h,s.positions[u]+o)}};return i(en(e),0),r}get allowsNesting(){return!0}}Lr.setState=Ne.define();function Ew(n,e,t){let r=n.facet(xs),i=en(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,Et.ExcludeBuffers|Et.EnterBracketed))s.type.isTop&&(i=s);return i}class If extends Lr{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=CI(e.languageData);return new If(t,e.parser.configure({props:[Fo.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new If(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function en(n){let e=n.field(Lr.state,!1);return e?e.tree:Nt.empty}class TI{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,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let ia=null;class Lf{constructor(e,t,r=[],i,s,o,a,u){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=u,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new Lf(e,t,[],Nt.empty,0,r,[],null)}startParse(){return this.parser.startParse(new TI(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Nt.empty&&this.isDone(t??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()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Js.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<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Js.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ia;ia=this;try{return e()}finally{ia=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Tw(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let u=[];if(e.iterChangedRanges((h,d,p,g)=>u.push({fromA:h,toA:d,fromB:p,toB:g})),r=Js.applyChanges(r,u),i=Nt.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let h of this.skipped){let d=e.mapPos(h.from,1),p=e.mapPos(h.to,-1);d<p&&a.push({from:d,to:p})}}}return new Lf(this.parser,t,r,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=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=Tw(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Ck{createParse(t,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let u=ia;if(u){for(let h of i)u.tempSkipped.push(h);e&&(u.scheduleOn=u.scheduleOn?Promise.all([u.scheduleOn,e]):e)}return this.parsedPos=o,new Nt(Un.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return ia}}function Tw(n,e,t){return Js.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class nl{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=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),t.viewport.to);return t.work(20,r)||t.takeTree(),new nl(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=Lf.create(e.facet(xs).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new nl(r)}}Lr.state=gn.define({create:nl.init,update(n,e){for(let t of e.effects)if(t.is(Lr.setState))return t.value;return e.startState.facet(xs)!=e.state.facet(xs)?nl.init(e.state):n.apply(e)}});let Ok=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Ok=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const tm=typeof navigator<"u"&&(!((em=navigator.scheduling)===null||em===void 0)&&em.isInputPending)?()=>navigator.scheduling.isInputPending():null,RI=Mt.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 t=this.view.state.field(Lr.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Lr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Ok(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(Lr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!tm?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,u=s.context.work(()=>tm&&tm()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(u||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Lr.setState.of(new nl(s.context))})),this.chunkBudget>0&&!(u&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Wn(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),xs=pe.define({combine(n){return n.length?n[0]:null},enables:n=>[Lr.state,RI,de.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class OI{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const PI=pe.define(),O0=pe.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Nf(n){let e=n.facet(O0);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function _a(n,e){let t="",r=n.tabSize,i=n.facet(O0)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function P0(n,e){n instanceof $e&&(n=new kh(n));for(let r of n.state.facet(PI)){let i=r(n,e);if(i!==void 0)return i}let t=en(n.state);return t.length>=e?MI(n,t,e):null}class kh{constructor(e,t={}){this.state=e,this.options=t,this.unit=Nf(e)}lineAt(e,t=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}:(t<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,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,t);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,t=1){let{text:r,from:i}=this.lineAt(e,t),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,t=e.length){return ul(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:i}=this.lineAt(e,t),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 Pk=new We;function MI(n,e,t){let r=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);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 Mk(r,n,t)}function Mk(n,e,t){for(let r=n;r;r=r.next){let i=DI(r.node);if(i)return i(M0.create(e,t,r))}return 0}function AI(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function DI(n){let e=n.type.prop(Pk);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(We.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>BI(o,!0,1,void 0,s&&!AI(o)?i.from:void 0)}return n.parent==null?II:null}function II(){return 0}class M0 extends kh{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new M0(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(LI(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return Mk(this.context.next,this.base,this.pos)}}function LI(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function NI(n){let e=n.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=t.to;;){let u=e.childAfter(a);if(!u||u==r)return null;if(!u.type.isSkipped){if(u.from>=o)return null;let h=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+h}}a=u.to}}function BI(n,e,t,r,i){let s=n.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==n.pos+o,u=NI(n);return u?a?n.column(u.from):n.column(u.to):n.baseIndent+(a?0:n.unit*t)}function FI({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const _I=200;function jI(){return $e.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:r}=n.newSelection.main,i=t.lineAt(r);if(r>i.from+_I)return n;let s=t.sliceString(i.from,r);if(!e.some(h=>h.test(s)))return n;let{state:o}=n,a=-1,u=[];for(let{head:h}of o.selection.ranges){let d=o.doc.lineAt(h);if(d.from==a)continue;a=d.from;let p=P0(o,d.from);if(p==null)continue;let g=/^\s*/.exec(d.text)[0],v=_a(o,p);g!=v&&u.push({from:d.from,to:d.from+g.length,insert:v})}return u.length?[n,{changes:u,sequential:!0}]:n})}const zI=pe.define(),Ak=new We;function WI(n,e,t){let r=en(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(s&&a.from<e)break;let u=a.type.prop(Ak);if(u&&(a.to<r.length-50||r.length==n.doc.length||!HI(a))){let h=u(a,n);h&&h.from<=t&&h.from>=e&&h.to>t&&(s=h)}}return s}function HI(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Bf(n,e,t){for(let r of n.facet(zI)){let i=r(n,e,t);if(i)return i}return WI(n,e,t)}function Dk(n,e){let t=e.mapPos(n.from,1),r=e.mapPos(n.to,-1);return t>=r?void 0:{from:t,to:r}}const Ch=Ne.define({map:Dk}),ec=Ne.define({map:Dk});function Ik(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(n.lineBlockAt(t));return e}const so=gn.define({create(){return Te.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,r)=>n=Rw(n,t,r)),n=n.map(e.changes);for(let t of e.effects)if(t.is(Ch)&&!VI(n,t.value.from,t.value.to)){let{preparePlaceholder:r}=e.state.facet(Bk),i=r?Te.replace({widget:new GI(r(e.state,t.value))}):Ow;n=n.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(ec)&&(n=n.update({filter:(r,i)=>t.value.from!=r||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=Rw(n,e.selection.main.head)),n},provide:n=>de.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(r,i)=>{t.push(r,i)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let r=n[t++],i=n[t++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(Ow.range(r,i))}return Te.set(e,!0)}});function Rw(n,e,t=e){let r=!1;return n.between(e,t,(i,s)=>{i<t&&s>e&&(r=!0)}),r?n.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):n}function Ff(n,e,t){var r;let i=null;return(r=n.field(so,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function VI(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function Lk(n,e){return n.field(so,!1)?e:e.concat(Ne.appendConfig.of(Fk()))}const $I=n=>{for(let e of Ik(n)){let t=Bf(n.state,e.from,e.to);if(t)return n.dispatch({effects:Lk(n.state,[Ch.of(t),Nk(n,t)])}),!0}return!1},UI=n=>{if(!n.state.field(so,!1))return!1;let e=[];for(let t of Ik(n)){let r=Ff(n.state,t.from,t.to);r&&e.push(ec.of(r),Nk(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function Nk(n,e,t=!0){let r=n.state.doc.lineAt(e.from).number,i=n.state.doc.lineAt(e.to).number;return de.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`)}const qI=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=Bf(e,i.from,i.to);s&&t.push(Ch.of(s)),r=(s?n.lineBlockAt(s.to):i).to+1}return t.length&&n.dispatch({effects:Lk(n.state,t)}),!!t.length},KI=n=>{let e=n.state.field(so,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(ec.of({from:r,to:i}))}),n.dispatch({effects:t}),!0},QI=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:$I},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:UI},{key:"Ctrl-Alt-[",run:qI},{key:"Ctrl-Alt-]",run:KI}],YI={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Bk=pe.define({combine(n){return li(n,YI)}});function Fk(n){return[so,ZI]}function _k(n,e){let{state:t}=n,r=t.facet(Bk),i=o=>{let a=n.lineBlockAt(n.posAtDOM(o.target)),u=Ff(n.state,a.from,a.to);u&&n.dispatch({effects:ec.of(u)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(n,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const Ow=Te.replace({widget:new class extends ai{toDOM(n){return _k(n,null)}}});class GI extends ai{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return _k(e,this.value)}}const XI={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class nm extends Ii{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function JI(n={}){let e={...XI,...n},t=new nm(e,!0),r=new nm(e,!1),i=Mt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(xs)!=o.state.facet(xs)||o.startState.field(so,!1)!=o.state.field(so,!1)||en(o.startState)!=en(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Ai;for(let u of o.viewportLineBlocks){let h=Ff(o.state,u.from,u.to)?r:Bf(o.state,u.from,u.to)?t:null;h&&a.add(u.from,u.from,h)}return a.finish()}}),{domEventHandlers:s}=e;return[i,JD({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||He.empty},initialSpacer(){return new nm(e,!1)},domEventHandlers:{...s,click:(o,a,u)=>{if(s.click&&s.click(o,a,u))return!0;let h=Ff(o.state,a.from,a.to);if(h)return o.dispatch({effects:ec.of(h)}),!0;let d=Bf(o.state,a.from,a.to);return d?(o.dispatch({effects:Ch.of(d)}),!0):!1}}}),Fk()]}const ZI=de.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 Eh{constructor(e,t){this.specs=e;let r;function i(a){let u=ms.newName();return(r||(r=Object.create(null)))["."+u]=a,u}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof Lr?a=>a.prop(Fo)==o.data:o?a=>a==o:void 0,this.style=Rk(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new ms(r):null,this.themeType=t.themeType}static define(e,t){return new Eh(e,t||{})}}const hg=pe.define(),jk=pe.define({combine(n){return n.length?[n[0]]:null}});function rm(n){let e=n.facet(hg);return e.length?e:n.facet(jk)}function eL(n,e){let t=[nL],r;return n instanceof Eh&&(n.module&&t.push(de.styleModule.of(n.module)),r=n.themeType),e!=null&&e.fallback?t.push(jk.of(n)):r?t.push(hg.computeN([de.darkTheme],i=>i.facet(de.darkTheme)==(r=="dark")?[n]:[])):t.push(hg.of(n)),t}class tL{constructor(e){this.markCache=Object.create(null),this.tree=en(e.state),this.decorations=this.buildDeco(e,rm(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=en(e.state),r=rm(e.state),i=r!=rm(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return Te.none;let r=new Ai;for(let{from:i,to:s}of e.visibleRanges)bI(this.tree,t,(o,a,u)=>{r.add(o,a,this.markCache[u]||(this.markCache[u]=Te.mark({class:u})))},i,s);return r.finish()}}const nL=Ss.high(Mt.fromClass(tL,{decorations:n=>n.decorations})),rL=Eh.define([{tag:ce.meta,color:"#404740"},{tag:ce.link,textDecoration:"underline"},{tag:ce.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ce.emphasis,fontStyle:"italic"},{tag:ce.strong,fontWeight:"bold"},{tag:ce.strikethrough,textDecoration:"line-through"},{tag:ce.keyword,color:"#708"},{tag:[ce.atom,ce.bool,ce.url,ce.contentSeparator,ce.labelName],color:"#219"},{tag:[ce.literal,ce.inserted],color:"#164"},{tag:[ce.string,ce.deleted],color:"#a11"},{tag:[ce.regexp,ce.escape,ce.special(ce.string)],color:"#e40"},{tag:ce.definition(ce.variableName),color:"#00f"},{tag:ce.local(ce.variableName),color:"#30a"},{tag:[ce.typeName,ce.namespace],color:"#085"},{tag:ce.className,color:"#167"},{tag:[ce.special(ce.variableName),ce.macroName],color:"#256"},{tag:ce.definition(ce.propertyName),color:"#00c"},{tag:ce.comment,color:"#940"},{tag:ce.invalid,color:"#f00"}]),iL=de.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),zk=1e4,Wk="()[]{}",Hk=pe.define({combine(n){return li(n,{afterCursor:!0,brackets:Wk,maxScanDistance:zk,renderMatch:lL})}}),sL=Te.mark({class:"cm-matchingBracket"}),oL=Te.mark({class:"cm-nonmatchingBracket"});function lL(n){let e=[],t=n.matched?sL:oL;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function Pw(n){let e=[],t=n.facet(Hk);for(let r of n.selection.ranges){if(!r.empty)continue;let i=ni(n,r.head,-1,t)||r.head>0&&ni(n,r.head-1,1,t)||t.afterCursor&&(ni(n,r.head,1,t)||r.head<n.doc.length&&ni(n,r.head+1,-1,t));i&&(e=e.concat(t.renderMatch(i,n)))}return Te.set(e,!0)}const aL=Mt.fromClass(class{constructor(n){this.paused=!1,this.decorations=Pw(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=Pw(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),cL=[aL,iL];function uL(n={}){return[Hk.of(n),cL]}const fL=new We;function dg(n,e,t){let r=n.prop(e<0?We.openedBy:We.closedBy);if(r)return r;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function pg(n){let e=n.type.prop(fL);return e?e(n.node):n}function ni(n,e,t,r={}){let i=r.maxScanDistance||zk,s=r.brackets||Wk,o=en(n),a=o.resolveInner(e,t);for(let u=a;u;u=u.parent){let h=dg(u.type,t,s);if(h&&u.from<u.to){let d=pg(u);if(d&&(t>0?e>=d.from&&e<d.to:e>d.from&&e<=d.to))return hL(n,e,t,u,d,h,s)}}return dL(n,e,t,o,a.type,i,s)}function hL(n,e,t,r,i,s,o){let a=r.parent,u={from:i.from,to:i.to},h=0,d=a==null?void 0:a.cursor();if(d&&(t<0?d.childBefore(r.from):d.childAfter(r.to)))do if(t<0?d.to<=r.from:d.from>=r.to){if(h==0&&s.indexOf(d.type.name)>-1&&d.from<d.to){let p=pg(d);return{start:u,end:p?{from:p.from,to:p.to}:void 0,matched:!0}}else if(dg(d.type,t,o))h++;else if(dg(d.type,-t,o)){if(h==0){let p=pg(d);return{start:u,end:p&&p.from<p.to?{from:p.from,to:p.to}:void 0,matched:!1}}h--}}while(t<0?d.prevSibling():d.nextSibling());return{start:u,matched:!1}}function dL(n,e,t,r,i,s,o){if(t<0?!e:e==n.doc.length)return null;let a=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),u=o.indexOf(a);if(u<0||u%2==0!=t>0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},d=n.doc.iterRange(e,t>0?n.doc.length:0),p=0;for(let g=0;!d.next().done&&g<=s;){let v=d.value;t<0&&(g+=v.length);let x=e+g*t;for(let b=t>0?0:v.length-1,S=t>0?v.length:-1;b!=S;b+=t){let C=o.indexOf(v[b]);if(!(C<0||r.resolveInner(x+b,1).type!=i))if(C%2==0==t>0)p++;else{if(p==1)return{start:h,end:{from:x+b,to:x+b+1},matched:C>>1==u>>1};p--}}t>0&&(g+=v.length)}return d.done?{start:h,matched:!1}:null}const pL=Object.create(null),Mw=[Un.none],Aw=[],Dw=Object.create(null),mL=Object.create(null);for(let[n,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"]])mL[n]=gL(pL,e);function im(n,e){Aw.indexOf(n)>-1||(Aw.push(n),console.warn(e))}function gL(n,e){let t=[];for(let a of e.split(" ")){let u=[];for(let h of a.split(".")){let d=n[h]||ce[h];d?typeof d=="function"?u.length?u=u.map(d):im(h,`Modifier ${h} used at start of tag`):u.length?im(h,`Tag ${h} used as modifier`):u=Array.isArray(d)?d:[d]:im(h,`Unknown highlighting tag ${h}`)}for(let h of u)t.push(h)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(a=>a.id),s=Dw[i];if(s)return s.id;let o=Dw[i]=Un.define({id:Mw.length,name:r,props:[Ek({[r]:t})]});return Mw.push(o),o.id}at.RTL,at.LTR;var Iw={};class _f{constructor(e,t,r,i,s,o,a,u,h,d=0,p){this.p=e,this.stack=t,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=u,this.curContext=h,this.lookAhead=d,this.parent=p}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let i=e.parser.context;return new _f(e,[],t,r,r,0,[],0,i?new Lw(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=s.dynamicPrecedence(i);if(a&&(this.score+=a),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 u=this.stack.length-(r-1)*3-(e&262144?6:0),h=u?this.stack[u-2]:this.p.ranges[0].from;i<s.minRepeatTerm&&h==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let d=this.reducePos-h;d>=2e3&&!(!((t=this.p.parser.nodeSet.types[i])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=d));let p=u?this.stack[u-1]:0,g=this.bufferBase+this.buffer.length-p;if(i<s.minRepeatTerm||e&131072){let v=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,h,v,g+4,!0)}if(e&262144)this.state=this.stack[u];else{let v=this.stack[u-3];this.state=s.getGoto(v,i,!0)}for(;this.stack.length>u;)this.stack.pop();this.reduceContext(i,h)}storeNode(e,t,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(t==r)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,t,r,i);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let u=o;u>0&&this.buffer[u-2]>r;u-=4)if(this.buffer[u-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,t,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;this.pos=i;let a=o.stateFlag(s,1);!a&&(i>r||t<=o.maxNode)&&(this.reducePos=i),this.pushState(s,a?r:Math.min(r,this.reducePos)),this.shiftContext(t,r),t<=o.maxNode&&this.buffer.push(t,r,i,4)}else this.pos=i,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,i,4)}apply(e,t,r,i){e&65536?this.reduce(e):this.shift(e,t,r,i)}useNode(e,t){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(t,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,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new _f(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new yL(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(r==0)return!1;if((r&65536)==0)return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(t[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<t.length;s+=2){let o=t[s+1];i.some((a,u)=>u&1&&a==o)||i.push(t[s],o)}t=i}let r=[];for(let i=0;i<t.length&&r.length<4;i+=2){let s=t[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(t[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let r=t>>19,i=t&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;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],r=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let u=o&65535,h=this.stack.length-a*3;if(h>=0&&e.getGoto(this.stack[h],u,!1)>=0)return a<<19|65536|u}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}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 t=new Lw(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}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 Lw{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class yL{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=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],t,!0);this.state=i}}class jf{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new jf(e,t,t-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 jf(this.stack,this.pos,this.index)}}function Bu(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let r=0,i=0;r<n.length;){let s=0;for(;;){let o=n.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let u=o-32;if(u>=46&&(u-=46,a=!0),s+=u,a)break;s*=46}t?t[i++]=s:t=new e(s)}return t}class sf{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Nw=new sf;class vL{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Nw,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){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(;t<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 t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,r,i;if(t>=0&&t<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-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,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>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,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Nw,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,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let r="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return r}}class Uo{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;wL(this.data,e,t,this.id,r.data,r.tokenPrecTable)}}Uo.prototype.contextual=Uo.prototype.fallback=Uo.prototype.extend=!1;Uo.prototype.fallback=Uo.prototype.extend=!1;class xL{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function wL(n,e,t,r,i,s){let o=0,a=1<<r,{dialect:u}=t.p.parser;e:for(;(a&n[o])!=0;){let h=n[o+1];for(let v=o+3;v<h;v+=2)if((n[v+1]&a)>0){let x=n[v];if(u.allows(x)&&(e.token.value==-1||e.token.value==x||bL(x,e.token.value,i,s))){e.acceptToken(x);break}}let d=e.next,p=0,g=n[o+2];if(e.next<0&&g>p&&n[h+g*3-3]==65535){o=n[h+g*3-1];continue e}for(;p<g;){let v=p+g>>1,x=h+v+(v<<1),b=n[x],S=n[x+1]||65536;if(d<b)g=v;else if(d>=S)p=v+1;else{o=n[x+2],e.advance();continue e}}break}}function Bw(n,e,t){for(let r=e,i;(i=n[r])!=65535;r++)if(i==t)return r-e;return-1}function bL(n,e,t,r){let i=Bw(t,r,e);return i<0||Bw(t,r,n)<i}const Xn=typeof process<"u"&&Iw&&/\bparse\b/.test(Iw.LOG);let sm=null;function Fw(n,e,t){let r=n.cursor(Et.IncludeAnonymous);for(r.moveTo(e);;)if(!(t<0?r.childBefore(e):r.childAfter(e)))for(;;){if((t<0?r.to<e:r.from>e)&&!r.type.isError)return t<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(n.length,Math.max(r.from+1,e+25));if(t<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return t<0?0:n.length}}class SL{constructor(e,t){this.fragments=e,this.nodeSet=t,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?Fw(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Fw(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 t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],i=this.index[t];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[t]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof Nt){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let u=s.prop(We.lookAhead);if(!u||a+u<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class kL{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new sf)}getActions(e){let t=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,u=0;for(let h=0;h<s.length;h++){if((1<<h&o)==0)continue;let d=s[h],p=this.tokens[h];if(!(r&&!d.fallback)&&((d.contextual||p.start!=e.pos||p.mask!=o||p.context!=a)&&(this.updateCachedToken(p,d,e),p.mask=o,p.context=a),p.lookAhead>p.end+25&&(u=Math.max(p.lookAhead,u)),p.value!=0)){let g=t;if(p.extended>-1&&(t=this.addActions(e,p.extended,p.end,t)),t=this.addActions(e,p.value,p.end,t),!d.extend&&(r=p,t>g))break}}for(;this.actions.length>t;)this.actions.pop();return u&&e.setLookAhead(u),!r&&e.pos==this.stream.end&&(r=new sf,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new sf,{pos:r,p:i}=e;return t.start=r,t.end=Math.min(r+1,i.stream.end),t.value=r==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,r){let i=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,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++]=t,this.actions[i++]=r,i}addActions(e,t,r,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let u=0;u<2;u++)for(let h=o.stateSlot(s,u?2:1);;h+=3){if(a[h]==65535)if(a[h+1]==1)h=ki(a,h+2);else{i==0&&a[h+1]==2&&(i=this.putAction(ki(a,h+2),t,r,i));break}a[h]==t&&(i=this.putAction(ki(a,h+1),t,r,i))}return i}}class CL{constructor(e,t,r,i){this.parser=e,this.input=t,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 vL(t,i),this.tokens=new kL(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[_f.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new SL(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>t)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let u=this.tokens.getMainToken(a);s.push(u.value,u.end)}}break}}if(!r.length){let o=i&&TL(i);if(o)return Xn&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Xn&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);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 Xn&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,u)=>u.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>t)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let u=o+1;u<r.length;u++){let h=r[u];if(a.sameState(h)||a.buffer.length>500&&h.buffer.length>500)if((a.score-h.score||a.buffer.length-h.buffer.length)>0)r.splice(u--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.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,t,r){let i=e.pos,{parser:s}=this,o=Xn?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,d=h?e.curContext.hash:0;for(let p=this.fragments.nodeAt(i);p;){let g=this.parser.nodeSet.types[p.type.id]==p.type?s.getGoto(e.state,p.type.id):-1;if(g>-1&&p.length&&(!h||(p.prop(We.contextHash)||0)==d))return e.useNode(p,g),Xn&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(p.type.id)})`),!0;if(!(p instanceof Nt)||p.children.length==0||p.positions[0]>0)break;let v=p.children[0];if(v instanceof Nt&&p.positions[0]==0)p=v;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),Xn&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let u=this.tokens.getActions(e);for(let h=0;h<u.length;){let d=u[h++],p=u[h++],g=u[h++],v=h==u.length||!r,x=v?e:e.split(),b=this.tokens.mainToken;if(x.apply(d,p,b?b.start:x.pos,g),Xn&&console.log(o+this.stackID(x)+` (via ${(d&65536)==0?"shift":`reduce of ${s.getName(d&65535)}`} for ${s.getName(p)} @ ${i}${x==e?"":", split"})`),v)return!0;x.pos>i?t.push(x):r.push(x)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return _w(e,t),!0}}runRecovery(e,t,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],u=t[o<<1],h=t[(o<<1)+1],d=Xn?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),Xn&&console.log(d+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let p=a.split(),g=d;for(let v=0;v<10&&p.forceReduce()&&(Xn&&console.log(g+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,r));v++)Xn&&(g=this.stackID(p)+" -> ");for(let v of a.recoverByInsert(u))Xn&&console.log(d+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>a.pos?(h==a.pos&&(h++,u=0),a.recoverByDelete(u,h),Xn&&console.log(d+this.stackID(a)+` (via recover-delete ${this.parser.getName(u)})`),_w(a,r)):(!i||i.score<p.score)&&(i=p)}return i}stackToTree(e){return e.close(),Nt.build({buffer:jf.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 t=(sm||(sm=new WeakMap)).get(e);return t||sm.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function _w(n,e){for(let t=0;t<e.length;t++){let r=e[t];if(r.pos==n.pos&&r.sameState(n)){e[t].score<n.score&&(e[t]=n);return}}e.push(n)}class EL{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class zf extends Ck{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<t.length;a++)i.push([]);function s(a,u,h){i[a].push([u,u.deserialize(String(h))])}if(e.nodeProps)for(let a of e.nodeProps){let u=a[0];typeof u=="string"&&(u=We[u]);for(let h=1;h<a.length;){let d=a[h++];if(d>=0)s(d,u,a[h++]);else{let p=a[h+-d];for(let g=-d;g>0;g--)s(a[h++],u,p);h++}}}this.nodeSet=new C0(t.map((a,u)=>Un.define({name:u>=this.minRepeatTerm?void 0:a,id:u,props:i[u],top:r.indexOf(u)>-1,error:u==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(u)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=wk;let o=Bu(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(jw),this.states=Bu(e.states,Uint32Array),this.data=Bu(e.stateData),this.goto=Bu(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Uo(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,r){let i=new CL(this,e,t,r);for(let s of this.wrappers)i=s(i,e,t,r);return i}getGoto(e,t,r=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let o=i[s++],a=o&1,u=i[s++];if(a&&r)return u;for(let h=s+(o>>1);s<h;s++)if(i[s]==e)return u;if(a)return-1}}hasAction(e,t){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=ki(r,s+2)];else{if(r[s+1]==2)return ki(r,s+2);break}if(o==t||o==0)return ki(r,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,r=>r==t?!0:null)}allActions(e,t){let r=this.stateSlot(e,4),i=r?t(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=ki(this.data,s+2);else break;i=t(ki(this.data,s+1))}return i}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=ki(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];t.some((s,o)=>o&1&&s==i)||t.push(this.data[r],i)}}return t}configure(e){let t=Object.assign(Object.create(zf.prototype),this);if(e.props&&(t.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}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return t.specializers[i]=jw(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}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 t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),r=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<t.length;s++)if(!r[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new EL(e,r,i)}static deserialize(e){return new zf(e)}}function ki(n,e){return n[e]|n[e+1]<<16}function TL(n){let e=null;for(let t of n){let r=t.p.stoppedAt;(t.pos==t.p.stream.end||r!=null&&t.pos>r)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function jw(n){if(n.external){let e=n.extend?1:0;return(t,r)=>n.external(t,r)<<1|e}return n.get}class Vk{constructor(e,t,r,i){this.state=e,this.pos=t,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=en(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),i=t.text.slice(r-t.from,this.pos-t.from),s=i.search(Uk(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function zw(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function RL(n){let e=Object.create(null),t=Object.create(null);for(let{label:i}of n){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let r=zw(e)+zw(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function $k(n){let e=n.map(i=>typeof i=="string"?{label:i}:i),[t,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:RL(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function OL(n,e){return t=>{for(let r=en(t.state).resolveInner(t.pos,-1);r;r=r.parent){if(n.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(t)}}class Ww{constructor(e,t,r,i){this.completion=e,this.source=t,this.match=r,this.score=i}}function Zs(n){return n.selection.main.from}function Uk(n,e){var t;let{source:r}=n,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?n:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const qk=Bi.define();function PL(n,e,t,r){let{main:i}=n.selection,s=t-i.from,o=r-i.from;return{...n.changeByRange(a=>{if(a!=i&&t!=r&&n.sliceDoc(a.from+s,a.from+o)!=n.sliceDoc(t,r))return{range:a};let u=n.toText(e);return{changes:{from:a.from+s,to:r==i.from?a.to:a.from+o,insert:u},range:Z.cursor(a.from+s+u.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Hw=new WeakMap;function ML(n){if(!Array.isArray(n))return n;let e=Hw.get(n);return e||Hw.set(n,e=$k(n)),e}const Wf=Ne.define(),ja=Ne.define();class AL{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=_n(e,t),i=Zr(r);this.chars.push(r);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(_n(o==s?s.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:i,precise:s,byWord:o}=this;if(t.length==1){let R=_n(e,0),O=Zr(R),P=O==e.length?0:-100;if(R!=t[0])if(R==r[0])P+=-200;else return null;return this.ret(P,[0,O])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let u=t.length,h=0;if(a<0){for(let R=0,O=Math.min(e.length,200);R<O&&h<u;){let P=_n(e,R);(P==t[h]||P==r[h])&&(i[h++]=R),R+=Zr(P)}if(h<u)return null}let d=0,p=0,g=!1,v=0,x=-1,b=-1,S=/[a-z]/.test(e),C=!0;for(let R=0,O=Math.min(e.length,200),P=0;R<O&&p<u;){let D=_n(e,R);a<0&&(d<u&&D==t[d]&&(s[d++]=R),v<u&&(D==t[v]||D==r[v]?(v==0&&(x=R),b=R+1,v++):v=0));let N,L=D<255?D>=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(N=s0(D))!=N.toLowerCase()?1:N!=N.toUpperCase()?2:0;(!R||L==1&&S||P==0&&L!=0)&&(t[p]==D||r[p]==D&&(g=!0)?o[p++]=R:o.length&&(C=!1)),P=L,R+=Zr(D)}return p==u&&o[0]==0&&C?this.result(-100+(g?-200:0),o,e):v==u&&x==0?this.ret(-200-e.length+(b==e.length?0:-100),[0,b]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):v==u?this.ret(-900-e.length,[x,b]):p==u?this.result(-100+(g?-200:0)+-700+(C?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],s=0;for(let o of t){let a=o+(this.astral?Zr(_n(r,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-r.length,i)}}class DL{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 t=e.slice(0,this.pattern.length),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const Xt=pe.define({combine(n){return li(n,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:IL,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>Vw(e(r),t(r)),optionClass:(e,t)=>r=>Vw(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Vw(n,e){return n?e?n+" "+e:n:e}function IL(n,e,t,r,i,s){let o=n.textDirection==at.RTL,a=o,u=!1,h="top",d,p,g=e.left-i.left,v=i.right-e.right,x=r.right-r.left,b=r.bottom-r.top;if(a&&g<Math.min(x,v)?a=!1:!a&&v<Math.min(x,g)&&(a=!0),x<=(a?g:v))d=Math.max(i.top,Math.min(t.top,i.bottom-b))-e.top,p=Math.min(400,a?g:v);else{u=!0,p=Math.min(400,(o?e.right:i.right-e.left)-30);let R=i.bottom-e.bottom;R>=b||R>e.top?d=t.bottom-e.top:(h="bottom",d=e.bottom-t.top)}let S=(e.bottom-e.top)/s.offsetHeight,C=(e.right-e.left)/s.offsetWidth;return{style:`${h}: ${d/S}px; max-width: ${p/C}px`,class:"cm-completionInfo-"+(u?o?"left-narrow":"right-narrow":a?"left":"right")}}const A0=Ne.define();function LL(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),t.type&&r.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(t,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,u=0;for(let h=0;h<s.length;){let d=s[h++],p=s[h++];d>u&&o.appendChild(document.createTextNode(a.slice(u,d)));let g=o.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(a.slice(d,p))),g.className="cm-completionMatchedText",u=p}return u<a.length&&o.appendChild(document.createTextNode(a.slice(u))),o},position:50},{render(t){if(!t.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=t.detail,r},position:80}),e.sort((t,r)=>t.position-r.position).map(t=>t.render)}function om(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let r=Math.ceil((n-e)/t);return{from:n-r*t,to:n-(r-1)*t}}class NL{constructor(e,t,r){this.view=e,this.stateField=t,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:u=>this.placeInfo(u),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:o}=i.open,a=e.state.facet(Xt);this.optionContent=LL(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=om(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",u=>{let{options:h}=e.state.field(t).open;for(let d=u.target,p;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(p=/-(\d+)$/.exec(d.id))&&+p[1]<h.length){this.applyCompletion(e,h[+p[1]]),u.preventDefault();return}if(u.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&u.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&u.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(e.dispatch({effects:A0.of(d)}),u.preventDefault())}}),this.dom.addEventListener("focusout",u=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Xt).closeOnBlur&&u.relatedTarget!=e.contentDOM&&e.dispatch({effects:ja.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:a}=r.open;(!i.open||i.open.options!=s)&&(this.range=om(s.length,o,e.state.facet(Xt).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of t.split(" "))r&&this.dom.classList.add(r);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=om(t.options.length,t.selected,this.view.state.facet(Xt).maxRenderedOptions),this.showOptions(t.options,e.id));let r=this.updateSelectedOption(t.selected);if(r){this.destroyInfo();let{completion:i}=t.options[t.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(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,i)}).catch(a=>Wn(this.view.state,a,"completion info")):(this.addInfoPane(o,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){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 t=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"),t=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return t&&FL(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=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,t.bottom)-10||i.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(Xt).positionInfo(this.view,t,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,t,r){const i=document.createElement("ul");i.id=t,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:a,match:u}=e[o],{section:h}=a;if(h){let g=typeof h=="string"?h:h.name;if(g!=s&&(o>r.from||r.from==0))if(s=g,typeof h!="string"&&h.header)i.appendChild(h.header(h));else{let v=i.appendChild(document.createElement("completion-section"));v.textContent=g}}const d=i.appendChild(document.createElement("li"));d.id=t+"-"+o,d.setAttribute("role","option");let p=this.optionClass(a);p&&(d.className=p);for(let g of this.optionContent){let v=g(a,this.view.state,this.view,u);v&&d.appendChild(v)}}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 BL(n,e){return t=>new NL(t,n,e)}function FL(n,e){let t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=t.height/n.offsetHeight;r.top<t.top?n.scrollTop-=(t.top-r.top)/i:r.bottom>t.bottom&&(n.scrollTop+=(r.bottom-t.bottom)/i)}function $w(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function _L(n,e){let t=[],r=null,i=null,s=d=>{t.push(d);let{section:p}=d.completion;if(p){r||(r=[]);let g=typeof p=="string"?p:p.name;r.some(v=>v.name==g)||r.push(typeof p=="string"?{name:g}:p)}},o=e.facet(Xt);for(let d of n)if(d.hasResult()){let p=d.result.getMatch;if(d.result.filter===!1)for(let g of d.result.options)s(new Ww(g,d.source,p?p(g):[],1e9-t.length));else{let g=e.sliceDoc(d.from,d.to),v,x=o.filterStrict?new DL(g):new AL(g);for(let b of d.result.options)if(v=x.match(b.label)){let S=b.displayLabel?p?p(b,v.matched):[]:v.matched,C=v.score+(b.boost||0);if(s(new Ww(b,d.source,S,C)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:R}=b.section;i||(i=Object.create(null)),i[R]=Math.max(C,i[R]||-1e9)}}}}if(r){let d=Object.create(null),p=0,g=(v,x)=>(v.rank==="dynamic"&&x.rank==="dynamic"?i[x.name]-i[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof x.rank=="number"?x.rank:1e9)||(v.name<x.name?-1:1);for(let v of r.sort(g))p-=1e5,d[v.name]=p;for(let v of t){let{section:x}=v.completion;x&&(v.score+=d[typeof x=="string"?x:x.name])}}let a=[],u=null,h=o.compareCompletions;for(let d of t.sort((p,g)=>g.score-p.score||h(p.completion,g.completion))){let p=d.completion;!u||u.label!=p.label||u.detail!=p.detail||u.type!=null&&p.type!=null&&u.type!=p.type||u.apply!=p.apply||u.boost!=p.boost?a.push(d):$w(d.completion)>$w(u)&&(a[a.length-1]=d),u=d.completion}return a}class _o{constructor(e,t,r,i,s,o){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new _o(this.options,Uw(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,i,s,o){if(i&&!o&&e.some(h=>h.isPending))return i.setDisabled();let a=_L(e,t);if(!a.length)return i&&e.some(h=>h.isPending)?i.setDisabled():null;let u=t.facet(Xt).selectOnOpen?0:-1;if(i&&i.selected!=u&&i.selected!=-1){let h=i.options[i.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==h){u=d;break}}return new _o(a,Uw(r,u),{pos:e.reduce((h,d)=>d.hasResult()?Math.min(h,d.from):h,1e8),create:$L,above:s.aboveCursor},i?i.timestamp:Date.now(),u,!1)}map(e){return new _o(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new _o(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Hf{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new Hf(HL,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(Xt),s=(r.override||t.languageDataAt("autocomplete",Zs(t)).map(ML)).map(u=>(this.active.find(d=>d.source==u)||new gr(u,this.active.some(d=>d.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((u,h)=>u==this.active[h])&&(s=this.active);let o=this.open,a=e.effects.some(u=>u.is(D0));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(u=>u.hasResult()&&e.changes.touchesRange(u.from,u.to))||!jL(s,this.active)||a?o=_o.build(s,t,this.id,o,r,a):o&&o.disabled&&!s.some(u=>u.isPending)&&(o=null),!o&&s.every(u=>!u.isPending)&&s.some(u=>u.hasResult())&&(s=s.map(u=>u.hasResult()?new gr(u.source,0):u));for(let u of e.effects)u.is(A0)&&(o=o&&o.setSelected(u.value,this.id));return s==this.active&&o==this.open?this:new Hf(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?zL:WL}}function jL(n,e){if(n==e)return!0;for(let t=0,r=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;r<e.length&&!e[r].hasResult();)r++;let i=t==n.length,s=r==e.length;if(i||s)return i==s;if(n[t++].result!=e[r++].result)return!1}}const zL={"aria-autocomplete":"list"},WL={};function Uw(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const HL=[];function Kk(n,e){if(n.isUserEvent("input.complete")){let r=n.annotation(qk);if(r&&e.activateOnCompletion(r))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class gr{constructor(e,t,r=!1){this.source=e,this.state=t,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let r=Kk(e,t),i=this;(r&8||r&16&&this.touches(e))&&(i=new gr(i.source,0)),r&4&&i.state==0&&(i=new gr(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(Wf))i=new gr(i.source,1,s.value);else if(s.is(ja))i=new gr(i.source,0);else if(s.is(D0))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Zs(e.state))}}class qo extends gr{constructor(e,t,r,i,s,o){super(e,3,t),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,t){var r;if(!(t&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=Zs(e.state);if(a>o||!i||t&2&&(Zs(e.startState)==this.from||a<this.limit))return new gr(this.source,t&4?1:0);let u=e.changes.mapPos(this.limit);return VL(i.validFor,e.state,s,o)?new qo(this.source,this.explicit,u,i,s,o):i.update&&(i=i.update(i,s,o,new Vk(e.state,a,!1)))?new qo(this.source,this.explicit,u,i,i.from,(r=i.to)!==null&&r!==void 0?r:Zs(e.state)):new gr(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new qo(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new gr(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function VL(n,e,t,r){if(!n)return!1;let i=e.sliceDoc(t,r);return typeof n=="function"?n(i,t,r,e):Uk(n,!0).test(i)}const D0=Ne.define({map(n,e){return n.map(t=>t.map(e))}}),jn=gn.define({create(){return Hf.start()},update(n,e){return n.update(e)},provide:n=>[S0.from(n,e=>e.tooltip),de.contentAttributes.from(n,e=>e.attrs)]});function I0(n,e){const t=e.completion.apply||e.completion.label;let r=n.state.field(jn).active.find(i=>i.source==e.source);return r instanceof qo?(typeof t=="string"?n.dispatch({...PL(n.state,t,r.from,r.to),annotations:qk.of(e.completion)}):t(n,e.completion,r.from,r.to),!0):!1}const $L=BL(jn,I0);function Fu(n,e="option"){return t=>{let r=t.state.field(jn,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(Xt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=pk(t,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+i*(n?1:-1):n?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:A0.of(a)}),!0}}const UL=n=>{let e=n.state.field(jn,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(Xt).interactionDelay?!1:I0(n,e.open.options[e.open.selected])},lm=n=>n.state.field(jn,!1)?(n.dispatch({effects:Wf.of(!0)}),!0):!1,qL=n=>{let e=n.state.field(jn,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:ja.of(null)}),!0)};class KL{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const QL=50,YL=1e3,GL=Mt.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(jn).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(jn),t=n.state.facet(Xt);if(!n.selectionSet&&!n.docChanged&&n.startState.field(jn)==e)return;let r=n.transactions.some(s=>{let o=Kk(s,t);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&&n.docChanged||o.updates.length+n.transactions.length>QL&&Date.now()-o.time>YL){for(let a of o.context.abortListeners)try{a()}catch(u){Wn(this.view.state,u)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(s=>s.effects.some(o=>o.is(Wf)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.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 n.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:n}=this.view,e=n.field(jn);for(let t of e.active)t.isPending&&!this.running.some(r=>r.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Xt).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Zs(e),r=new Vk(e,t,n.explicit,this.view),i=new KL(n,r);this.running.push(i),Promise.resolve(n.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:ja.of(null)}),Wn(this.view.state,s)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Xt).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Xt),r=this.view.state.field(jn);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 a=Zs(s.updates.length?s.updates[0].startState:this.view.state),u=Math.min(a,s.done.from+(s.active.explicit?0:1)),h=new qo(s.active.source,s.active.explicit,u,s.done,s.done.from,(n=s.done.to)!==null&&n!==void 0?n:a);for(let d of s.updates)h=h.update(d,t);if(h.hasResult()){e.push(h);continue}}let o=r.active.find(a=>a.source==s.active.source);if(o&&o.isPending)if(s.done==null){let a=new gr(s.active.source,0);for(let u of s.updates)a=a.update(u,t);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:D0.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(jn,!1);if(e&&e.tooltip&&this.view.state.facet(Xt).closeOnBlur){let t=e.open&&pk(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ja.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Wf.of(!1)}),20),this.composing=0}}}),XL=typeof navigator=="object"&&/Win/.test(navigator.platform),JL=Ss.highest(de.domEventHandlers({keydown(n,e){let t=e.state.field(jn,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(XL&&n.altKey)||n.metaKey)return!1;let r=t.open.options[t.open.selected],i=t.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(n.key)>-1&&I0(e,r),!1}})),ZL=de.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"}}}),za={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Gs=Ne.define({map(n,e){let t=e.mapPos(n,-1,Cn.TrackAfter);return t??void 0}}),L0=new class extends ps{};L0.startSide=1;L0.endSide=-1;const Qk=gn.define({create(){return He.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:r=>r>=t.from&&r<=t.to})}for(let t of e.effects)t.is(Gs)&&(n=n.update({add:[L0.range(t.value,t.value+1)]}));return n}});function eN(){return[nN,Qk]}const am="()[]{}<>«»»«[]{}";function Yk(n){for(let e=0;e<am.length;e+=2)if(am.charCodeAt(e)==n)return am.charAt(e+1);return s0(n<128?n:n+1)}function Gk(n,e){return n.languageDataAt("closeBrackets",e)[0]||za}const tN=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),nN=de.inputHandler.of((n,e,t,r)=>{if((tN?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let i=n.state.selection.main;if(r.length>2||r.length==2&&Zr(_n(r,0))==1||e!=i.from||t!=i.to)return!1;let s=sN(n.state,r);return s?(n.dispatch(s),!0):!1}),rN=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let r=Gk(n,n.selection.main.head).brackets||za.brackets,i=null,s=n.changeByRange(o=>{if(o.empty){let a=oN(n.doc,o.head);for(let u of r)if(u==a&&Th(n.doc,o.head)==Yk(_n(u,0)))return{changes:{from:o.head-u.length,to:o.head+u.length},range:Z.cursor(o.head-u.length)}}return{range:i=o}});return i||e(n.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},iN=[{key:"Backspace",run:rN}];function sN(n,e){let t=Gk(n,n.selection.main.head),r=t.brackets||za.brackets;for(let i of r){let s=Yk(_n(i,0));if(e==i)return s==i?cN(n,i,r.indexOf(i+i+i)>-1,t):lN(n,i,s,t.before||za.before);if(e==s&&Xk(n,n.selection.main.from))return aN(n,i,s)}return null}function Xk(n,e){let t=!1;return n.field(Qk).between(0,n.doc.length,r=>{r==e&&(t=!0)}),t}function Th(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Zr(_n(t,0)))}function oN(n,e){let t=n.sliceString(e-2,e);return Zr(_n(t,0))==t.length?t:t.slice(1)}function lN(n,e,t,r){let i=null,s=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Gs.of(o.to+e.length),range:Z.range(o.anchor+e.length,o.head+e.length)};let a=Th(n.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:Gs.of(o.head+e.length),range:Z.cursor(o.head+e.length)}:{range:i=o}});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function aN(n,e,t){let r=null,i=n.changeByRange(s=>s.empty&&Th(n.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:Z.cursor(s.head+t.length)}:r={range:s});return r?null:n.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function cN(n,e,t,r){let i=r.stringPrefixes||za.stringPrefixes,s=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Gs.of(a.to+e.length),range:Z.range(a.anchor+e.length,a.head+e.length)};let u=a.head,h=Th(n.doc,u),d;if(h==e){if(qw(n,u))return{changes:{insert:e+e,from:u},effects:Gs.of(u+e.length),range:Z.cursor(u+e.length)};if(Xk(n,u)){let g=t&&n.sliceDoc(u,u+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:u,to:u+g.length,insert:g},range:Z.cursor(u+g.length)}}}else{if(t&&n.sliceDoc(u-2*e.length,u)==e+e&&(d=Kw(n,u-2*e.length,i))>-1&&qw(n,d))return{changes:{insert:e+e+e+e,from:u},effects:Gs.of(u+e.length),range:Z.cursor(u+e.length)};if(n.charCategorizer(u)(h)!=vt.Word&&Kw(n,u,i)>-1&&!uN(n,u,e,i))return{changes:{insert:e+e,from:u},effects:Gs.of(u+e.length),range:Z.cursor(u+e.length)}}return{range:s=a}});return s?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function qw(n,e){let t=en(n).resolveInner(e+1);return t.parent&&t.from==e}function uN(n,e,t,r){let i=en(n).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=n.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),u=a.indexOf(t);if(!u||u>-1&&r.indexOf(a.slice(0,u))>-1){let d=i.firstChild;for(;d&&d.from==i.from&&d.to-d.from>t.length+u;){if(n.sliceDoc(d.to-t.length,d.to)==t)return!1;d=d.firstChild}return!0}let h=i.to==e&&i.parent;if(!h)break;i=h}return!1}function Kw(n,e,t){let r=n.charCategorizer(e);if(r(n.sliceDoc(e-1,e))!=vt.Word)return e;for(let i of t){let s=e-i.length;if(n.sliceDoc(s,e)==i&&r(n.sliceDoc(s-1,s))!=vt.Word)return s}return-1}function fN(n={}){return[JL,jn,Xt.of(n),GL,hN,ZL]}const Jk=[{key:"Ctrl-Space",run:lm},{mac:"Alt-`",run:lm},{mac:"Alt-i",run:lm},{key:"Escape",run:qL},{key:"ArrowDown",run:Fu(!0)},{key:"ArrowUp",run:Fu(!1)},{key:"PageDown",run:Fu(!0,"page")},{key:"PageUp",run:Fu(!1,"page")},{key:"Enter",run:UL}],hN=Ss.highest(La.computeN([Xt],n=>n.facet(Xt).defaultKeymap?[Jk]:[])),dN=36,Qw=1,pN=2,Mo=3,cm=4,mN=5,gN=6,yN=7,vN=8,xN=9,wN=10,bN=11,SN=12,kN=13,CN=14,EN=15,TN=16,RN=17,Yw=18,ON=19,Zk=20,eC=21,Gw=22,PN=23,MN=24;function mg(n){return n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57}function AN(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function Us(n,e,t){for(let r=!1;;){if(n.next<0)return;if(n.next==e&&!r){n.advance();return}r=t&&!r&&n.next==92,n.advance()}}function DN(n,e){e:for(;;){if(n.next<0)return;if(n.next==36){n.advance();for(let t=0;t<e.length;t++){if(n.next!=e.charCodeAt(t))continue e;n.advance()}if(n.next==36){n.advance();return}}else n.advance()}}function IN(n,e){let t="[{<(".indexOf(String.fromCharCode(e)),r=t<0?e:"]}>)".charCodeAt(t);for(;;){if(n.next<0)return;if(n.next==r&&n.peek(1)==39){n.advance(2);return}n.advance()}}function gg(n,e){for(;!(n.next!=95&&!mg(n.next));)e!=null&&(e+=String.fromCharCode(n.next)),n.advance();return e}function LN(n){if(n.next==39||n.next==34||n.next==96){let e=n.next;n.advance(),Us(n,e,!1)}else gg(n)}function Xw(n,e){for(;n.next==48||n.next==49;)n.advance();e&&n.next==e&&n.advance()}function Jw(n,e){for(;;){if(n.next==46){if(e)break;e=!0}else if(n.next<48||n.next>57)break;n.advance()}if(n.next==69||n.next==101)for(n.advance(),(n.next==43||n.next==45)&&n.advance();n.next>=48&&n.next<=57;)n.advance()}function Zw(n){for(;!(n.next<0||n.next==10);)n.advance()}function Ws(n,e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)==n)return!0;return!1}const um=` \r
|
|
143
|
-
`;function tC(n,e,t){let r=Object.create(null);r.true=r.false=mN,r.null=r.unknown=gN;for(let i of n.split(" "))i&&(r[i]=Zk);for(let i of e.split(" "))i&&(r[i]=eC);for(let i of(t||"").split(" "))i&&(r[i]=MN);return r}const NN="array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ",BN="absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ",yg={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:"*+-%<>!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:tC(BN,NN)};function FN(n,e,t,r){let i={};for(let s in yg)i[s]=(n.hasOwnProperty(s)?n:yg)[s];return e&&(i.words=tC(e,t||"",r)),i}function nC(n){return new xL(e=>{var t;let{next:r}=e;if(e.advance(),Ws(r,um)){for(;Ws(e.next,um);)e.advance();e.acceptToken(dN)}else if(r==36&&n.doubleDollarQuotedStrings){let i=gg(e,"");e.next==36&&(e.advance(),DN(e,i),e.acceptToken(Mo))}else if(r==39||r==34&&n.doubleQuotedStrings)Us(e,r,n.backslashEscapes),e.acceptToken(Mo);else if(r==35&&n.hashComments||r==47&&e.next==47&&n.slashComments)Zw(e),e.acceptToken(Qw);else if(r==45&&e.next==45&&(!n.spaceAfterDashes||e.peek(1)==32))Zw(e),e.acceptToken(Qw);else if(r==47&&e.next==42){e.advance();for(let i=1;;){let s=e.next;if(e.next<0)break;if(e.advance(),s==42&&e.next==47){if(i--,e.advance(),!i)break}else s==47&&e.next==42&&(i++,e.advance())}e.acceptToken(pN)}else if((r==101||r==69)&&e.next==39)e.advance(),Us(e,39,!0),e.acceptToken(Mo);else if((r==110||r==78)&&e.next==39&&n.charSetCasts)e.advance(),Us(e,39,n.backslashEscapes),e.acceptToken(Mo);else if(r==95&&n.charSetCasts)for(let i=0;;i++){if(e.next==39&&i>1){e.advance(),Us(e,39,n.backslashEscapes),e.acceptToken(Mo);break}if(!mg(e.next))break;e.advance()}else if(n.plsqlQuotingMechanism&&(r==113||r==81)&&e.next==39&&e.peek(1)>0&&!Ws(e.peek(1),um)){let i=e.peek(1);e.advance(2),IN(e,i),e.acceptToken(Mo)}else if(Ws(r,n.identifierQuotes)){const i=r==91?93:r;Us(e,i,!1),e.acceptToken(ON)}else if(r==40)e.acceptToken(yN);else if(r==41)e.acceptToken(vN);else if(r==123)e.acceptToken(xN);else if(r==125)e.acceptToken(wN);else if(r==91)e.acceptToken(bN);else if(r==93)e.acceptToken(SN);else if(r==59)e.acceptToken(kN);else if(n.unquotedBitLiterals&&r==48&&e.next==98)e.advance(),Xw(e),e.acceptToken(Gw);else if((r==98||r==66)&&(e.next==39||e.next==34)){const i=e.next;e.advance(),n.treatBitsAsBytes?(Us(e,i,n.backslashEscapes),e.acceptToken(PN)):(Xw(e,i),e.acceptToken(Gw))}else if(r==48&&(e.next==120||e.next==88)||(r==120||r==88)&&e.next==39){let i=e.next==39;for(e.advance();AN(e.next);)e.advance();i&&e.next==39&&e.advance(),e.acceptToken(cm)}else if(r==46&&e.next>=48&&e.next<=57)Jw(e,!0),e.acceptToken(cm);else if(r==46)e.acceptToken(CN);else if(r>=48&&r<=57)Jw(e,!1),e.acceptToken(cm);else if(Ws(r,n.operatorChars)){for(;Ws(e.next,n.operatorChars);)e.advance();e.acceptToken(EN)}else if(Ws(r,n.specialVar))e.next==r&&e.advance(),LN(e),e.acceptToken(RN);else if(r==58||r==44)e.acceptToken(TN);else if(mg(r)){let i=gg(e,String.fromCharCode(r));e.acceptToken(e.next==46||e.peek(-i.length-1)==46?Yw:(t=n.words[i.toLowerCase()])!==null&&t!==void 0?t:Yw)}})}const rC=nC(yg),_N=zf.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,rC],topRules:{Script:[0,25]},tokenPrec:0});function vg(n){let e=n.cursor().moveTo(n.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function Wa(n,e){let t=n.sliceString(e.from,e.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(t);return r?r[2]:t}function Vf(n){return n&&(n.name=="Identifier"||n.name=="QuotedIdentifier")}function jN(n,e){if(e.name=="CompositeIdentifier"){let t=[];for(let r=e.firstChild;r;r=r.nextSibling)Vf(r)&&t.push(Wa(n,r));return t}return[Wa(n,e)]}function e2(n,e){for(let t=[];;){if(!e||e.name!=".")return t;let r=vg(e);if(!Vf(r))return t;t.unshift(Wa(n,r)),e=vg(r)}}function zN(n,e){let t=en(n).resolveInner(e,-1),r=HN(n.doc,t);return t.name=="Identifier"||t.name=="QuotedIdentifier"||t.name=="Keyword"?{from:t.from,quoted:t.name=="QuotedIdentifier"?n.doc.sliceString(t.from,t.from+1):null,parents:e2(n.doc,vg(t)),aliases:r}:t.name=="."?{from:e,quoted:null,parents:e2(n.doc,t),aliases:r}:{from:e,quoted:null,parents:[],empty:!0,aliases:r}}const WN=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function HN(n,e){let t;for(let i=e;!t;i=i.parent){if(!i)return null;i.name=="Statement"&&(t=i)}let r=null;for(let i=t.firstChild,s=!1,o=null;i;i=i.nextSibling){let a=i.name=="Keyword"?n.sliceString(i.from,i.to).toLowerCase():null,u=null;if(!s)s=a=="from";else if(a=="as"&&o&&Vf(i.nextSibling))u=Wa(n,i.nextSibling);else{if(a&&WN.has(a))break;o&&Vf(i)&&(u=Wa(n,i))}u&&(r||(r=Object.create(null)),r[u]=jN(n,o)),o=/Identifier$/.test(i.name)?i:null}return r}function VN(n,e,t){return t.map(r=>({...r,label:r.label[0]==n?r.label:n+r.label+e,apply:void 0}))}const $N=/^\w*$/,UN=/^[`'"\[]?\w*[`'"\]]?$/;function t2(n){return n.self&&typeof n.self.label=="string"}class N0{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(e){let t=this.children||(this.children=Object.create(null)),r=t[e];return r||(e&&!this.list.some(i=>i.label==e)&&this.list.push(n2(e,"type",this.idQuote,this.idCaseInsensitive)),t[e]=new N0(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(r=>r.label==e.label);t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion(typeof t=="string"?n2(t,"property",this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):t2(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let r=e[t],i=null,s=t.replace(/\\?\./g,a=>a=="."?"\0":a).split("\0"),o=this;t2(r)&&(i=r.self,r=r.children);for(let a=0;a<s.length;a++)i&&a==s.length-1&&o.addCompletion(i),o=o.child(s[a].replace(/\\\./g,"."));o.addNamespace(r)}}}function n2(n,e,t,r){return new RegExp("^[a-z_][a-z_\\d]*$",r?"i":"").test(n)?{label:n,type:e}:{label:n,type:e,apply:t+n+iC(t)}}function iC(n){return n==="["?"]":n}function qN(n,e,t,r,i,s){var o;let a=((o=s==null?void 0:s.spec.identifierQuotes)===null||o===void 0?void 0:o[0])||'"',u=new N0(a,!!(s!=null&&s.spec.caseInsensitiveIdentifiers)),h=i?u.child(i):null;return u.addNamespace(n),e&&(h||u).addCompletions(e),t&&u.addCompletions(t),h&&u.addCompletions(h.list),r&&u.addCompletions((h||u).child(r).list),d=>{let{parents:p,from:g,quoted:v,empty:x,aliases:b}=zN(d.state,d.pos);if(x&&!d.explicit)return null;b&&p.length==1&&(p=b[p[0]]||p);let S=u;for(let R of p){for(;!S.children||!S.children[R];)if(S==u&&h)S=h;else if(S==h&&r)S=S.child(r);else return null;let O=S.maybeChild(R);if(!O)return null;S=O}let C=S.list;if(S==u&&b&&(C=C.concat(Object.keys(b).map(R=>({label:R,type:"constant"})))),v){let R=v[0],O=iC(R),P=d.state.sliceDoc(d.pos,d.pos+1)==O;return{from:g,to:P?d.pos+1:void 0,options:VN(R,O,C),validFor:UN}}else return{from:g,options:C,validFor:$N}}}function KN(n){return n==eC?"type":n==Zk?"keyword":"variable"}function QN(n,e,t){let r=Object.keys(n).map(i=>t(e?i.toUpperCase():i,KN(n[i])));return OL(["QuotedIdentifier","String","LineComment","BlockComment","."],$k(r))}let YN=_N.configure({props:[Pk.add({Statement:FI()}),Ak.add({Statement(n,e){return{from:Math.min(n.from+100,e.doc.lineAt(n.from).to),to:n.to}},BlockComment(n){return{from:n.from+2,to:n.to-2}}}),Ek({Keyword:ce.keyword,Type:ce.typeName,Builtin:ce.standard(ce.name),Bits:ce.number,Bytes:ce.string,Bool:ce.bool,Null:ce.null,Number:ce.number,String:ce.string,Identifier:ce.name,QuotedIdentifier:ce.special(ce.string),SpecialVar:ce.special(ce.name),LineComment:ce.lineComment,BlockComment:ce.blockComment,Operator:ce.operator,"Semi Punctuation":ce.punctuation,"( )":ce.paren,"{ }":ce.brace,"[ ]":ce.squareBracket})]});class $f{constructor(e,t,r){this.dialect=e,this.language=t,this.spec=r}get extension(){return this.language.extension}configureLanguage(e,t){return new $f(this.dialect,this.language.configure(e,t),this.spec)}static define(e){let t=FN(e,e.keywords,e.types,e.builtin),r=If.define({name:"sql",parser:YN.configure({tokenizers:[{from:rC,to:nC(t)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new $f(t,r,e)}}function GN(n,e){return{label:n,type:e,boost:-1}}function XN(n,e=!1,t){return QN(n.dialect.words,e,t||GN)}function JN(n){return n.schema?qN(n.schema,n.tables,n.schemas,n.defaultTable,n.defaultSchema,n.dialect||B0):()=>null}function ZN(n){return n.schema?(n.dialect||B0).language.data.of({autocomplete:JN(n)}):[]}function e6(n={}){let e=n.dialect||B0;return new OI(e.language,[ZN(n),e.language.data.of({autocomplete:XN(e,n.upperCaseKeywords,n.keywordCompletion)})])}const B0=$f.define({}),t6=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),r=_0(n.state,t.from);return r.line?n6(n):r.block?i6(n):!1};function F0(n,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=n(e,t);return i?(r(t.update(i)),!0):!1}}const n6=F0(l6,0),r6=F0(sC,0),i6=F0((n,e)=>sC(n,e,o6(e)),0);function _0(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const sa=50;function s6(n,{open:e,close:t},r,i){let s=n.sliceDoc(r-sa,r),o=n.sliceDoc(i,i+sa),a=/\s*$/.exec(s)[0].length,u=/^\s*/.exec(o)[0].length,h=s.length-a;if(s.slice(h-e.length,h)==e&&o.slice(u,u+t.length)==t)return{open:{pos:r-a,margin:a&&1},close:{pos:i+u,margin:u&&1}};let d,p;i-r<=2*sa?d=p=n.sliceDoc(r,i):(d=n.sliceDoc(r,r+sa),p=n.sliceDoc(i-sa,i));let g=/^\s*/.exec(d)[0].length,v=/\s*$/.exec(p)[0].length,x=p.length-v-t.length;return d.slice(g,g+e.length)==e&&p.slice(x,x+t.length)==t?{open:{pos:r+g+e.length,margin:/\s/.test(d.charAt(g+e.length))?1:0},close:{pos:i-v-t.length,margin:/\s/.test(p.charAt(x-1))?1:0}}:null}function o6(n){let e=[];for(let t of n.selection.ranges){let r=n.doc.lineAt(t.from),i=t.to<=r.to?r:n.doc.lineAt(t.to);i.from>r.from&&i.from==t.to&&(i=t.to==r.to+1?r:n.doc.lineAt(t.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 sC(n,e,t=e.selection.ranges){let r=t.map(s=>_0(e,s.from).block);if(!r.every(s=>s))return null;let i=t.map((s,o)=>s6(e,r[o],s.from,s.to));if(n!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(n!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let u=r[o],{open:h,close:d}=a;s.push({from:h.pos-u.open.length,to:h.pos+h.margin},{from:d.pos-d.margin,to:d.pos+u.close.length})}return{changes:s}}return null}function l6(n,e,t=e.selection.ranges){let r=[],i=-1;e:for(let{from:s,to:o}of t){let a=r.length,u=1e9,h;for(let d=s;d<=o;){let p=e.doc.lineAt(d);if(h==null&&(h=_0(e,p.from).line,!h))continue e;if(p.from>i&&(s==o||o>p.from)){i=p.from;let g=/^\s*/.exec(p.text)[0].length,v=g==p.length,x=p.text.slice(g,g+h.length)==h?g:-1;g<p.text.length&&g<u&&(u=g),r.push({line:p,comment:x,token:h,indent:g,empty:v,single:!1})}d=p.to+1}if(u<1e9)for(let d=a;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=u);r.length==a+1&&(r[a].single=!0)}if(n!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:u,indent:h,empty:d,single:p}of r)(p||!d)&&s.push({from:a.from+h,insert:u+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:u}of r)if(a>=0){let h=o.from+a,d=h+u.length;o.text[d-o.from]==" "&&d++,s.push({from:h,to:d})}return{changes:s}}return null}const xg=Bi.define(),a6=Bi.define(),c6=pe.define(),oC=pe.define({combine(n){return li(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,i)=>e(r,i)||t(r,i)})}}),lC=gn.define({create(){return ri.empty},update(n,e){let t=e.state.facet(oC),r=e.annotation(xg);if(r){let u=Hn.fromTransaction(e,r.selection),h=r.side,d=h==0?n.undone:n.done;return u?d=Uf(d,d.length,t.minDepth,u):d=uC(d,e.startState.selection),new ri(h==0?r.rest:d,h==0?d:r.rest)}let i=e.annotation(a6);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(Kt.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=Hn.fromTransaction(e),o=e.annotation(Kt.time),a=e.annotation(Kt.userEvent);return s?n=n.addChanges(s,o,a,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new ri(n.done.map(Hn.fromJSON),n.undone.map(Hn.fromJSON))}});function u6(n={}){return[lC,oC.of(n),de.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?aC:e.inputType=="historyRedo"?wg:null;return r?(e.preventDefault(),r(t)):!1}})]}function Rh(n,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let i=t.field(lC,!1);if(!i)return!1;let s=i.pop(n,t,e);return s?(r(s),!0):!1}}const aC=Rh(0,!1),wg=Rh(1,!1),f6=Rh(0,!0),h6=Rh(1,!0);class Hn{constructor(e,t,r,i,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new Hn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.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 Hn(e.changes&&$t.fromJSON(e.changes),[],e.mapped&&si.fromJSON(e.mapped),e.startSelection&&Z.fromJSON(e.startSelection),e.selectionsAfter.map(Z.fromJSON))}static fromTransaction(e,t){let r=yr;for(let i of e.startState.facet(c6)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new Hn(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,yr)}static selection(e){return new Hn(void 0,yr,void 0,void 0,e)}}function Uf(n,e,t,r){let i=e+1>t+20?e-t-1:0,s=n.slice(i,e);return s.push(r),s}function d6(n,e){let t=[],r=!1;return n.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let u=0;u<t.length;){let h=t[u++],d=t[u++];a>=h&&o<=d&&(r=!0)}}),r}function p6(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function cC(n,e){return n.length?e.length?n.concat(e):n:e}const yr=[],m6=200;function uC(n,e){if(n.length){let t=n[n.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-m6));return r.length&&r[r.length-1].eq(e)?n:(r.push(e),Uf(n,n.length-1,1e9,t.setSelAfter(r)))}else return[Hn.selection([e])]}function g6(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function fm(n,e){if(!n.length)return n;let t=n.length,r=yr;for(;t;){let i=y6(n[t-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=n.slice(0,t);return s[t-1]=i,s}else e=i.mapped,t--,r=i.selectionsAfter}return r.length?[Hn.selection(r)]:yr}function y6(n,e,t){let r=cC(n.selectionsAfter.length?n.selectionsAfter.map(a=>a.map(e)):yr,t);if(!n.changes)return Hn.selection(r);let i=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new Hn(i,Ne.mapEffects(n.effects,e),o,n.startSelection.map(s),r)}const v6=/^(input\.type|delete)($|\.)/;class ri{constructor(e,t,r=0,i=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new ri(this.done,this.undone):this}addChanges(e,t,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||v6.test(r))&&(!a.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,d6(a.changes,e.changes))||r=="input.type.compose")?o=Uf(o,o.length-1,i.minDepth,new Hn(e.changes.compose(a.changes),cC(Ne.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,yr)):o=Uf(o,o.length,i.minDepth,e),new ri(o,yr,t,r)}addSelection(e,t,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:yr;return s.length>0&&t-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&p6(s[s.length-1],e)?this:new ri(uC(this.done,e),this.undone,t,r)}addMapping(e){return new ri(fm(this.done,e),fm(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,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):t.selection);if(r&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:xg.of({side:e,rest:g6(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?yr:i.slice(0,i.length-1);return s.mapped&&(a=fm(a,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:xg.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}ri.empty=new ri(yr,yr);const x6=[{key:"Mod-z",run:aC,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:wg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:wg,preventDefault:!0},{key:"Mod-u",run:f6,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:h6,preventDefault:!0}];function fl(n,e){return Z.create(n.ranges.map(e),n.mainIndex)}function _r(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function jr({state:n,dispatch:e},t){let r=fl(n.selection,t);return r.eq(n.selection,!0)?!1:(e(_r(n,r)),!0)}function Oh(n,e){return Z.cursor(e?n.to:n.from)}function fC(n,e){return jr(n,t=>t.empty?n.moveByChar(t,e):Oh(t,e))}function yn(n){return n.textDirectionAt(n.state.selection.main.head)==at.LTR}const hC=n=>fC(n,!yn(n)),dC=n=>fC(n,yn(n));function pC(n,e){return jr(n,t=>t.empty?n.moveByGroup(t,e):Oh(t,e))}const w6=n=>pC(n,!yn(n)),b6=n=>pC(n,yn(n));function S6(n,e,t){if(e.type.prop(t))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Ph(n,e,t){let r=en(n).resolveInner(e.head),i=t?We.closedBy:We.openedBy;for(let u=e.head;;){let h=t?r.childAfter(u):r.childBefore(u);if(!h)break;S6(n,h,i)?r=h:u=t?h.to:h.from}let s=r.type.prop(i),o,a;return s&&(o=t?ni(n,r.from,1):ni(n,r.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?r.to:r.from,Z.cursor(a,t?-1:1)}const k6=n=>jr(n,e=>Ph(n.state,e,!yn(n))),C6=n=>jr(n,e=>Ph(n.state,e,yn(n)));function mC(n,e){return jr(n,t=>{if(!t.empty)return Oh(t,e);let r=n.moveVertically(t,e);return r.head!=t.head?r:n.moveToLineBoundary(t,e)})}const gC=n=>mC(n,!1),yC=n=>mC(n,!0);function vC(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,r=0,i;if(e){for(let s of n.state.facet(de.scrollMargins)){let o=s(n);o!=null&&o.top&&(t=Math.max(o==null?void 0:o.top,t)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}i=n.scrollDOM.clientHeight-t-r}else i=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:r,selfScroll:e,height:Math.max(n.defaultLineHeight,i-5)}}function xC(n,e){let t=vC(n),{state:r}=n,i=fl(r.selection,o=>o.empty?n.moveVertically(o,e,t.height):Oh(o,e));if(i.eq(r.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(r.selection.main.head),a=n.scrollDOM.getBoundingClientRect(),u=a.top+t.marginTop,h=a.bottom-t.marginBottom;o&&o.top>u&&o.bottom<h&&(s=de.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-u}))}return n.dispatch(_r(r,i),{effects:s}),!0}const r2=n=>xC(n,!1),bg=n=>xC(n,!0);function ks(n,e,t){let r=n.lineBlockAt(e.head),i=n.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?r.to:r.from)&&(i=n.moveToLineBoundary(e,t,!1)),!t&&i.head==r.from&&r.length){let s=/^\s*/.exec(n.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=Z.cursor(r.from+s))}return i}const E6=n=>jr(n,e=>ks(n,e,!0)),T6=n=>jr(n,e=>ks(n,e,!1)),R6=n=>jr(n,e=>ks(n,e,!yn(n))),O6=n=>jr(n,e=>ks(n,e,yn(n))),P6=n=>jr(n,e=>Z.cursor(n.lineBlockAt(e.head).from,1)),M6=n=>jr(n,e=>Z.cursor(n.lineBlockAt(e.head).to,-1));function A6(n,e,t){let r=!1,i=fl(n.selection,s=>{let o=ni(n,s.head,-1)||ni(n,s.head,1)||s.head>0&&ni(n,s.head-1,1)||s.head<n.doc.length&&ni(n,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return Z.cursor(a)});return r?(e(_r(n,i)),!0):!1}const D6=({state:n,dispatch:e})=>A6(n,e);function Sr(n,e){let t=fl(n.state.selection,r=>{let i=e(r);return Z.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return t.eq(n.state.selection)?!1:(n.dispatch(_r(n.state,t)),!0)}function wC(n,e){return Sr(n,t=>n.moveByChar(t,e))}const bC=n=>wC(n,!yn(n)),SC=n=>wC(n,yn(n));function kC(n,e){return Sr(n,t=>n.moveByGroup(t,e))}const I6=n=>kC(n,!yn(n)),L6=n=>kC(n,yn(n)),N6=n=>Sr(n,e=>Ph(n.state,e,!yn(n))),B6=n=>Sr(n,e=>Ph(n.state,e,yn(n)));function CC(n,e){return Sr(n,t=>n.moveVertically(t,e))}const EC=n=>CC(n,!1),TC=n=>CC(n,!0);function RC(n,e){return Sr(n,t=>n.moveVertically(t,e,vC(n).height))}const i2=n=>RC(n,!1),s2=n=>RC(n,!0),F6=n=>Sr(n,e=>ks(n,e,!0)),_6=n=>Sr(n,e=>ks(n,e,!1)),j6=n=>Sr(n,e=>ks(n,e,!yn(n))),z6=n=>Sr(n,e=>ks(n,e,yn(n))),W6=n=>Sr(n,e=>Z.cursor(n.lineBlockAt(e.head).from)),H6=n=>Sr(n,e=>Z.cursor(n.lineBlockAt(e.head).to)),o2=({state:n,dispatch:e})=>(e(_r(n,{anchor:0})),!0),l2=({state:n,dispatch:e})=>(e(_r(n,{anchor:n.doc.length})),!0),a2=({state:n,dispatch:e})=>(e(_r(n,{anchor:n.selection.main.anchor,head:0})),!0),c2=({state:n,dispatch:e})=>(e(_r(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),V6=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),$6=({state:n,dispatch:e})=>{let t=Mh(n).map(({from:r,to:i})=>Z.range(r,Math.min(i+1,n.doc.length)));return e(n.update({selection:Z.create(t),userEvent:"select"})),!0},U6=({state:n,dispatch:e})=>{let t=fl(n.selection,r=>{let i=en(n),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:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return Z.range(a.to,a.from)}return r});return t.eq(n.selection)?!1:(e(_r(n,t)),!0)};function OC(n,e){let{state:t}=n,r=t.selection,i=t.selection.ranges.slice();for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head);if(e?o.to<n.state.doc.length:o.from>0)for(let a=s;;){let u=n.moveVertically(a,e);if(u.head<o.from||u.head>o.to){i.some(h=>h.head==u.head)||i.push(u);break}else{if(u.head==a.head)break;a=u}}}return i.length==r.ranges.length?!1:(n.dispatch(_r(t,Z.create(i,i.length-1))),!0)}const q6=n=>OC(n,!1),K6=n=>OC(n,!0),Q6=({state:n,dispatch:e})=>{let t=n.selection,r=null;return t.ranges.length>1?r=Z.create([t.main]):t.main.empty||(r=Z.create([Z.cursor(t.main.head)])),r?(e(_r(n,r)),!0):!1};function tc(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:r}=n,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let u=e(s);u<o?(t="delete.backward",u=_u(n,u,!1)):u>o&&(t="delete.forward",u=_u(n,u,!0)),o=Math.min(o,u),a=Math.max(a,u)}else o=_u(n,o,!1),a=_u(n,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:Z.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(n.dispatch(r.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?de.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function _u(n,e,t){if(n instanceof de)for(let r of n.state.facet(de.atomicRanges).map(i=>i(n)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const PC=(n,e,t)=>tc(n,r=>{let i=r.from,{state:s}=n,o=s.doc.lineAt(i),a,u;if(t&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if(a[a.length-1]==" ")return i-1;let h=ul(a,s.tabSize),d=h%Nf(s)||Nf(s);for(let p=0;p<d&&a[a.length-1-p]==" ";p++)i--;u=i}else u=Zt(o.text,i-o.from,e,e)+o.from,u==i&&o.number!=(e?s.doc.lines:1)?u+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(u-o.from,i-o.from))&&(u=Zt(o.text,u-o.from,!1,!1)+o.from);return u}),Sg=n=>PC(n,!1,!0),MC=n=>PC(n,!0,!1),AC=(n,e)=>tc(n,t=>{let r=t.head,{state:i}=n,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==t.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let u=Zt(s.text,r-s.from,e)+s.from,h=s.text.slice(Math.min(r,u)-s.from,Math.max(r,u)-s.from),d=o(h);if(a!=null&&d!=a)break;(h!=" "||r!=t.head)&&(a=d),r=u}return r}),DC=n=>AC(n,!1),Y6=n=>AC(n,!0),G6=n=>tc(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),X6=n=>tc(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),J6=n=>tc(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),Z6=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Qe.of(["",""])},range:Z.cursor(r.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},e9=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,s=n.doc.lineAt(i),o=i==s.from?i-1:Zt(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Zt(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:n.doc.slice(i,a).append(n.doc.slice(o,i))},range:Z.cursor(a)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Mh(n){let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.from),s=n.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=n.doc.lineAt(r.to-1)),t>=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]});t=s.number+1}return e}function IC(n,e,t){if(n.readOnly)return!1;let r=[],i=[];for(let s of Mh(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),a=o.length+1;if(t){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let u of s.ranges)i.push(Z.range(Math.min(n.doc.length,u.anchor+a),Math.min(n.doc.length,u.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let u of s.ranges)i.push(Z.range(u.anchor-a,u.head-a))}}return r.length?(e(n.update({changes:r,scrollIntoView:!0,selection:Z.create(i,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const t9=({state:n,dispatch:e})=>IC(n,e,!1),n9=({state:n,dispatch:e})=>IC(n,e,!0);function LC(n,e,t){if(n.readOnly)return!1;let r=[];for(let s of Mh(n))t?r.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):r.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});let i=n.changes(r);return e(n.update({changes:i,selection:n.selection.map(i,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const r9=({state:n,dispatch:e})=>LC(n,e,!1),i9=({state:n,dispatch:e})=>LC(n,e,!0),s9=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Mh(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=fl(e.selection,i=>{let s;if(n.lineWrapping){let o=n.lineBlockAt(i.head),a=n.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+n.documentTop-a.bottom+n.defaultLineHeight/2)}return n.moveVertically(i,!0,s)}).map(t);return n.dispatch({changes:t,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function o9(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=en(n).resolveInner(e),r=t.childBefore(e),i=t.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(We.closedBy))&&s.indexOf(i.name)>-1&&n.doc.lineAt(r.to).from==n.doc.lineAt(i.from).from&&!/\S/.test(n.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const u2=NC(!1),l9=NC(!0);function NC(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),u=!n&&s==o&&o9(e,s);n&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let h=new kh(e,{simulateBreak:s,simulateDoubleBreak:!!u}),d=P0(h,s);for(d==null&&(d=ul(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;u?{from:s,to:o}=u:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let p=["",_a(e,d)];return u&&p.push(_a(e,h.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Qe.of(p)},range:Z.cursor(s+1+p[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function j0(n,e){let t=-1;return n.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=n.doc.lineAt(o);a.number>t&&(r.empty||r.to>a.from)&&(e(a,i,r),t=a.number),o=a.to+1}let s=n.changes(i);return{changes:i,range:Z.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const a9=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),r=new kh(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=j0(n,(s,o,a)=>{let u=P0(r,s.from);if(u==null)return;/\S/.test(s.text)||(u=0);let h=/^\s*/.exec(s.text)[0],d=_a(n,u);(h!=d||a.from<s.from+h.length)&&(t[s.from]=u,o.push({from:s.from,to:s.from+h.length,insert:d}))});return i.changes.empty||e(n.update(i,{userEvent:"indent"})),!0},c9=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(j0(n,(t,r)=>{r.push({from:t.from,insert:n.facet(O0)})}),{userEvent:"input.indent"})),!0),u9=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(j0(n,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=ul(i,n.tabSize),o=0,a=_a(n,Math.max(0,s-Nf(n)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),f9=n=>(n.setTabFocusMode(),!0),h9=[{key:"Ctrl-b",run:hC,shift:bC,preventDefault:!0},{key:"Ctrl-f",run:dC,shift:SC},{key:"Ctrl-p",run:gC,shift:EC},{key:"Ctrl-n",run:yC,shift:TC},{key:"Ctrl-a",run:P6,shift:W6},{key:"Ctrl-e",run:M6,shift:H6},{key:"Ctrl-d",run:MC},{key:"Ctrl-h",run:Sg},{key:"Ctrl-k",run:G6},{key:"Ctrl-Alt-h",run:DC},{key:"Ctrl-o",run:Z6},{key:"Ctrl-t",run:e9},{key:"Ctrl-v",run:bg}],d9=[{key:"ArrowLeft",run:hC,shift:bC,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:w6,shift:I6,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:R6,shift:j6,preventDefault:!0},{key:"ArrowRight",run:dC,shift:SC,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:b6,shift:L6,preventDefault:!0},{mac:"Cmd-ArrowRight",run:O6,shift:z6,preventDefault:!0},{key:"ArrowUp",run:gC,shift:EC,preventDefault:!0},{mac:"Cmd-ArrowUp",run:o2,shift:a2},{mac:"Ctrl-ArrowUp",run:r2,shift:i2},{key:"ArrowDown",run:yC,shift:TC,preventDefault:!0},{mac:"Cmd-ArrowDown",run:l2,shift:c2},{mac:"Ctrl-ArrowDown",run:bg,shift:s2},{key:"PageUp",run:r2,shift:i2},{key:"PageDown",run:bg,shift:s2},{key:"Home",run:T6,shift:_6,preventDefault:!0},{key:"Mod-Home",run:o2,shift:a2},{key:"End",run:E6,shift:F6,preventDefault:!0},{key:"Mod-End",run:l2,shift:c2},{key:"Enter",run:u2,shift:u2},{key:"Mod-a",run:V6},{key:"Backspace",run:Sg,shift:Sg,preventDefault:!0},{key:"Delete",run:MC,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:DC,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Y6,preventDefault:!0},{mac:"Mod-Backspace",run:X6,preventDefault:!0},{mac:"Mod-Delete",run:J6,preventDefault:!0}].concat(h9.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),BC=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:k6,shift:N6},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:C6,shift:B6},{key:"Alt-ArrowUp",run:t9},{key:"Shift-Alt-ArrowUp",run:r9},{key:"Alt-ArrowDown",run:n9},{key:"Shift-Alt-ArrowDown",run:i9},{key:"Mod-Alt-ArrowUp",run:q6},{key:"Mod-Alt-ArrowDown",run:K6},{key:"Escape",run:Q6},{key:"Mod-Enter",run:l9},{key:"Alt-l",mac:"Ctrl-l",run:$6},{key:"Mod-i",run:U6,preventDefault:!0},{key:"Mod-[",run:u9},{key:"Mod-]",run:c9},{key:"Mod-Alt-\\",run:a9},{key:"Shift-Mod-k",run:s9},{key:"Shift-Mod-\\",run:D6},{key:"Mod-/",run:t6},{key:"Alt-A",run:r6},{key:"Ctrl-m",mac:"Shift-Alt-m",run:f9}].concat(d9),f2=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class rl{constructor(e,t,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?a=>s(f2(a)):f2,this.query=this.normalize(t)}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 _n(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 t=s0(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Zr(e);let i=this.normalize(t);if(i.length)for(let s=0,o=r,a=!0;;s++){let u=i.charCodeAt(s),h=this.match(u,o,a,this.bufferPos+this.bufferStart,s==i.length-1);if(h)return this.value=h,this;if(s==i.length-1)break;a&&s<t.length&&t.charCodeAt(s)==u?o++:a=!1}}}match(e,t,r,i,s){let o=null;for(let a=0;a<this.matches.length;){let u=this.matches[a],h=!1;this.query.charCodeAt(u.index)==e&&(u.index==this.query.length-1?o={from:u.from,to:i,precise:s&&u.precise}:(u.index++,h=!0)),h?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:i,precise:r&&s}:this.matches.push({from:t,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(rl.prototype[Symbol.iterator]=function(){return this});const FC={from:-1,to:-1,match:/.*/.exec(""),precise:!0},z0="gm"+(/x/.unicode==null?"":"u");class _C{constructor(e,t,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=FC,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new jC(e,t,r,i,s);this.re=new RegExp(t,z0+(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=qf(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 t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,i=r+t[0].length;if(this.matchPos=qf(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,t)))return this.value={from:r,to:i,precise:!0,match:t},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 hm=new WeakMap;class Ko{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let i=hm.get(e);if(!i||i.from>=r||i.to<=t){let a=new Ko(t,e.sliceString(t,r));return hm.set(e,a),a}if(i.from==t&&i.to==r)return i;let{text:s,from:o}=i;return o>t&&(s=e.sliceString(t,o)+s,o=t),i.to<r&&(s+=e.sliceString(i.to,r)),hm.set(e,new Ko(o,s)),new Ko(t,s.slice(t-o,r-o))}}class jC{constructor(e,t,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=FC,this.matchPos=qf(e,i),this.re=new RegExp(t,z0+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=Ko.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,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let r=this.flat.from+t.index,i=r+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,precise:!0,match:t},this.matchPos=qf(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ko.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(_C.prototype[Symbol.iterator]=jC.prototype[Symbol.iterator]=function(){return this});function p9(n){try{return new RegExp(n,z0),!0}catch{return!1}}function qf(n,e){if(e>=n.length)return e;let t=n.lineAt(e),r;for(;e<t.to&&(r=t.text.charCodeAt(e-t.from))>=56320&&r<57344;)e++;return e}const m9=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:r,result:i}=QD(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return i.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){n.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,u,h,d,p]=o,g=d?+d.slice(1):0,v=h?+h:a.number;if(h&&p){let S=v/100;u&&(S=S*(u=="-"?-1:1)+a.number/e.doc.lines),v=Math.round(e.doc.lines*S)}else h&&u&&(v=v*(u=="-"?-1:1)+a.number);let x=e.doc.line(Math.max(1,Math.min(e.doc.lines,v))),b=Z.cursor(x.from+Math.max(0,Math.min(g,x.length)));n.dispatch({effects:[r,de.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},g9={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},y9=pe.define({combine(n){return li(n,g9,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function v9(n){return[k9,S9]}const x9=Te.mark({class:"cm-selectionMatch"}),w9=Te.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function h2(n,e,t,r){return(t==0||n(e.sliceDoc(t-1,t))!=vt.Word)&&(r==e.doc.length||n(e.sliceDoc(r,r+1))!=vt.Word)}function b9(n,e,t,r){return n(e.sliceDoc(t,t+1))==vt.Word&&n(e.sliceDoc(r-1,r))==vt.Word}const S9=Mt.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(y9),{state:t}=n,r=t.selection;if(r.ranges.length>1)return Te.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return Te.none;let u=t.wordAt(i.head);if(!u)return Te.none;o=t.charCategorizer(i.head),s=t.sliceDoc(u.from,u.to)}else{let u=i.to-i.from;if(u<e.minSelectionLength||u>200)return Te.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(h2(o,t,i.from,i.to)&&b9(o,t,i.from,i.to)))return Te.none}else if(s=t.sliceDoc(i.from,i.to),!s)return Te.none}let a=[];for(let u of n.visibleRanges){let h=new rl(t.doc,s,u.from,u.to);for(;!h.next().done;){let{from:d,to:p}=h.value;if((!o||h2(o,t,d,p))&&(i.empty&&d<=i.from&&p>=i.to?a.push(w9.range(d,p)):(d>=i.to||p<=i.from)&&a.push(x9.range(d,p)),a.length>e.maxMatches))return Te.none}}return Te.set(a)}},{decorations:n=>n.decorations}),k9=de.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),C9=({state:n,dispatch:e})=>{let{selection:t}=n,r=Z.create(t.ranges.map(i=>n.wordAt(i.head)||Z.cursor(i.head)),t.mainIndex);return r.eq(t)?!1:(e(n.update({selection:r})),!0)};function E9(n,e){let{main:t,ranges:r}=n.selection,i=n.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let o=!1,a=new rl(n.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new rl(n.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(u=>u.from==a.value.from))continue;if(s){let u=n.wordAt(a.value.from);if(!u||u.from!=a.value.from||u.to!=a.value.to)continue}return a.value}}const T9=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return C9({state:n,dispatch:e});let r=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(s=>n.sliceDoc(s.from,s.to)!=r))return!1;let i=E9(n,r);return i?(e(n.update({selection:n.selection.addRange(Z.range(i.from,i.to),!1),effects:de.scrollIntoView(i.to)})),!0):!1},hl=pe.define({combine(n){return li(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new z9(e),scrollToMatch:e=>de.scrollIntoView(e)})}});class zC{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||p9(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,(t,r)=>r=="n"?`
|
|
144
|
-
`: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 D9(this):new P9(this)}getCursor(e,t=0,r){let i=e.doc?e:$e.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?Lo(this,i,t,r):Io(this,i,t,r)}}class WC{constructor(e){this.spec=e}}function R9(n,e,t){return(r,i,s,o)=>{if(t&&!t(r,i,s,o))return!1;let a=r>=o&&i<=o+s.length?s.slice(r-o,i-o):e.doc.sliceString(r,i);return n(a,e,r,i)}}function Io(n,e,t,r){let i;return n.wholeWord&&(i=O9(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(i=R9(n.test,e,i)),new rl(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:s=>s.toLowerCase(),i)}function O9(n,e){return(t,r,i,s)=>((s>t||s+i.length<r)&&(s=Math.max(0,t-2),i=n.sliceString(s,Math.min(n.length,r+2))),(e(Kf(i,t-s))!=vt.Word||e(Qf(i,t-s))!=vt.Word)&&(e(Qf(i,r-s))!=vt.Word||e(Kf(i,r-s))!=vt.Word))}class P9 extends WC{constructor(e){super(e)}nextMatch(e,t,r){let i=Io(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=Io(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=Io(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=Io(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=Io(this.spec,e,Math.max(0,t-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 M9(n,e,t){return(r,i,s)=>(!t||t(r,i,s))&&n(s[0],e,r,i)}function Lo(n,e,t,r){let i;return n.wholeWord&&(i=A9(e.charCategorizer(e.selection.main.head))),n.test&&(i=M9(n.test,e,i)),new _C(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:i},t,r)}function Kf(n,e){return n.slice(Zt(n,e,!1),e)}function Qf(n,e){return n.slice(e,Zt(n,e))}function A9(n){return(e,t,r)=>!r[0].length||(n(Kf(r.input,r.index))!=vt.Word||n(Qf(r.input,r.index))!=vt.Word)&&(n(Qf(r.input,r.index+r[0].length))!=vt.Word||n(Kf(r.input,r.index+r[0].length))!=vt.Word)}class D9 extends WC{nextMatch(e,t,r){let i=Lo(this.spec,e,r,e.doc.length).next();return i.done&&(i=Lo(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let s=Math.max(t,r-i*1e4),o=Lo(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,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 t})}matchAll(e,t){let r=Lo(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=Lo(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Ha=Ne.define(),W0=Ne.define(),ds=gn.define({create(n){return new dm(kg(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Ha)?n=new dm(t.value.create(),n.panel):t.is(W0)&&(n=new dm(n.query,t.value?H0:null));return n},provide:n=>Na.from(n,e=>e.panel)});class dm{constructor(e,t){this.query=e,this.panel=t}}const I9=Te.mark({class:"cm-searchMatch"}),L9=Te.mark({class:"cm-searchMatch cm-searchMatch-selected"}),N9=Mt.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(ds))}update(n){let e=n.state.field(ds);(e!=n.startState.field(ds)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Te.none;let{view:t}=this,r=new Ai;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:u}=s[i];for(;i<o-1&&u>s[i+1].from-500;)u=s[++i].to;n.highlight(t.state,a,u,(h,d)=>{let p=t.state.selection.ranges.some(g=>g.from==h&&g.to==d);r.add(h,d,p?L9:I9)})}return r.finish()}},{decorations:n=>n.decorations});function nc(n){return e=>{let t=e.state.field(ds,!1);return t&&t.query.spec.valid?n(e,t):$C(e)}}const Yf=nc((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=Z.single(r.from,r.to),s=n.state.facet(hl);return n.dispatch({selection:i,effects:[V0(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),VC(n),!0}),Gf=nc((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i)return!1;let s=Z.single(i.from,i.to),o=n.state.facet(hl);return n.dispatch({selection:s,effects:[V0(n,i),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),VC(n),!0}),B9=nc((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:Z.create(t.map(r=>Z.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),F9=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:r,to:i}=t.main,s=[],o=0;for(let a=new rl(n.doc,n.sliceDoc(r,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(Z.range(a.value.from,a.value.to))}return e(n.update({selection:Z.create(s,o),userEvent:"select.search.matches"})),!0},d2=nc((n,{query:e})=>{let{state:t}=n,{from:r,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,r,r);if(!s)return!1;let o=s,a=[],u,h,d=[];o.precise?o.from==r&&o.to==i&&(h=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:h}),d.push(de.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+"."))):o=e.nextMatch(t,o.from,o.to);let p=n.state.changes(a);return o&&(u=Z.single(o.from,o.to).map(p),d.push(V0(n,o)),d.push(t.facet(hl).scrollToMatch(u.main,n))),n.dispatch({changes:p,selection:u,effects:d,userEvent:"input.replace"}),!0}),_9=nc((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let i of e.matchAll(n.state,1e9)){let{from:s,to:o,precise:a}=i;a&&t.push({from:s,to:o,insert:e.getReplacement(i)})}if(!t.length)return!1;let r=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:de.announce.of(r),userEvent:"input.replace.all"}),!0});function H0(n){return n.state.facet(hl).createPanel(n)}function kg(n,e){var t,r,i,s,o;let a=n.selection.main,u=a.empty||a.to>a.from+100?"":n.sliceDoc(a.from,a.to);if(e&&!u)return e;let h=n.facet(hl);return new zC({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:h.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:h.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function HC(n){let e=k0(n,H0);return e&&e.dom.querySelector("[main-field]")}function VC(n){let e=HC(n);e&&e==n.root.activeElement&&e.select()}const $C=n=>{let e=n.state.field(ds,!1);if(e&&e.panel){let t=HC(n);if(t&&t!=n.root.activeElement){let r=kg(n.state,e.query.spec);r.valid&&n.dispatch({effects:Ha.of(r)}),t.focus(),t.select()}}else n.dispatch({effects:[W0.of(!0),e?Ha.of(kg(n.state,e.query.spec)):Ne.appendConfig.of(H9)]});return!0},UC=n=>{let e=n.state.field(ds,!1);if(!e||!e.panel)return!1;let t=k0(n,H0);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:W0.of(!1)}),!0},j9=[{key:"Mod-f",run:$C,scope:"editor search-panel"},{key:"F3",run:Yf,shift:Gf,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Yf,shift:Gf,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:UC,scope:"editor search-panel"},{key:"Mod-Shift-l",run:F9},{key:"Mod-Alt-g",run:m9},{key:"Mod-d",run:T9,preventDefault:!0}];class z9{constructor(e){this.view=e;let t=this.query=e.state.field(ds).query.spec;this.commit=this.commit.bind(this),this.searchField=rt("input",{value:t.search,placeholder:Jn(e,"Find"),"aria-label":Jn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=rt("input",{value:t.replace,placeholder:Jn(e,"Replace"),"aria-label":Jn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=rt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=rt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=rt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function r(i,s,o){return rt("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=rt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>Yf(e),[Jn(e,"next")]),r("prev",()=>Gf(e),[Jn(e,"previous")]),r("select",()=>B9(e),[Jn(e,"all")]),rt("label",null,[this.caseField,Jn(e,"match case")]),rt("label",null,[this.reField,Jn(e,"regexp")]),rt("label",null,[this.wordField,Jn(e,"by word")]),...e.state.readOnly?[]:[rt("br"),this.replaceField,r("replace",()=>d2(e),[Jn(e,"replace")]),r("replaceAll",()=>_9(e),[Jn(e,"replace all")])],rt("button",{name:"close",onclick:()=>UC(e),"aria-label":Jn(e,"close"),type:"button"},["×"])])}commit(){let e=new zC({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:Ha.of(e)}))}keydown(e){rD(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Gf:Yf)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),d2(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(Ha)&&!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(hl).top}}function Jn(n,e){return n.state.phrase(e)}const ju=30,zu=/[\s\.,:;?!]/;function V0(n,{from:e,to:t}){let r=n.state.doc.lineAt(e),i=n.state.doc.lineAt(t).to,s=Math.max(r.from,e-ju),o=Math.min(i,t+ju),a=n.state.sliceDoc(s,o);if(s!=r.from){for(let u=0;u<ju;u++)if(!zu.test(a[u+1])&&zu.test(a[u])){a=a.slice(u);break}}if(o!=i){for(let u=a.length-1;u>a.length-ju;u--)if(!zu.test(a[u-1])&&zu.test(a[u])){a=a.slice(0,u);break}}return de.announce.of(`${n.state.phrase("current match")}. ${a} ${n.state.phrase("on line")} ${r.number}.`)}const W9=de.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"}}),H9=[ds,Ss.low(N9),W9];class p2{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class Ks{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let i=r.facet(Va).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((v,x)=>v.from-x.from||v.to-x.to),o=new Ai,a=[],u=0,h=r.doc.iter(),d=0,p=r.doc.length;for(let v=0;;){let x=v==s.length?null:s[v];if(!x&&!a.length)break;let b,S;if(a.length)b=u,S=a.reduce((O,P)=>Math.min(O,P.to),x&&x.from>b?x.from:1e8);else{if(b=x.from,b>p)break;S=x.to,a.push(x),v++}for(;v<s.length;){let O=s[v];if(O.from==b&&(O.to>O.from||O.to==b))a.push(O),v++,S=Math.min(O.to,S);else{S=Math.min(O.from,S);break}}S=Math.min(S,p);let C=!1;if(a.some(O=>O.from==b&&(O.to==S||S==p))&&(C=b==S,!C&&S-b<10)){let O=b-(d+h.value.length);O>0&&(h.next(O),d=b);for(let P=b;;){if(P>=S){C=!0;break}if(!h.lineBreak&&d+h.value.length>P)break;P=d+h.value.length,d+=h.value.length,h.next()}}let R=t7(a);if(C)o.add(b,b,Te.widget({widget:new X9(R),diagnostics:a.slice()}));else{let O=a.reduce((P,D)=>D.markClass?P+" "+D.markClass:P,"");o.add(b,S,Te.mark({class:"cm-lintRange cm-lintRange-"+R+O,diagnostics:a.slice(),inclusiveEnd:a.some(P=>P.to>S)}))}if(u=S,u==p)break;for(let O=0;O<a.length;O++)a[O].to<=u&&a.splice(O--,1)}let g=o.finish();return new Ks(g,t,ws(g))}}function ws(n,e=null,t=0){let r=null;return n.between(t,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new p2(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new p2(r.from,s,r.diagnostic)}}),r}function V9(n,e){let t=e.pos,r=e.end||t,i=n.state.facet(Va).hideOn(n,t,r);if(i!=null)return i;let s=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(qC))||n.changes.touchesRange(s.from,Math.max(s.to,r)))}function $9(n,e){return n.field(tr,!1)?e:e.concat(Ne.appendConfig.of(n7))}const qC=Ne.define(),$0=Ne.define(),KC=Ne.define(),tr=gn.define({create(){return new Ks(Te.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),r=null,i=n.panel;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);r=ws(t,n.selected.diagnostic,s)||ws(t,null,s)}!t.size&&i&&e.state.facet(Va).autoPanel&&(i=null),n=new Ks(t,i,r)}for(let t of e.effects)if(t.is(qC)){let r=e.state.facet(Va).autoPanel?t.value.length?$a.open:null:n.panel;n=Ks.init(t.value,r,e.state)}else t.is($0)?n=new Ks(n.diagnostics,t.value?$a.open:null,n.selected):t.is(KC)&&(n=new Ks(n.diagnostics,n.panel,t.value));return n},provide:n=>[Na.from(n,e=>e.panel),de.decorations.from(n,e=>e.diagnostics)]}),U9=Te.mark({class:"cm-lintRange cm-lintRange-active"});function q9(n,e,t){let{diagnostics:r}=n.state.field(tr),i,s=-1,o=-1;r.between(e-(t<0?1:0),e+(t>0?1:0),(u,h,{spec:d})=>{if(e>=u&&e<=h&&(u==h||(e>u||t>0)&&(e<h||t<0)))return i=d.diagnostics,s=u,o=h,!1});let a=n.state.facet(Va).tooltipFilter;return i&&a&&(i=a(i,n.state)),i?{pos:s,end:o,above:n.state.doc.lineAt(s).to<o,create(){return{dom:K9(n,i)}}}:null}function K9(n,e){return rt("ul",{class:"cm-tooltip-lint"},e.map(t=>YC(n,t,!1)))}const Q9=n=>{let e=n.state.field(tr,!1);(!e||!e.panel)&&n.dispatch({effects:$9(n.state,[$0.of(!0)])});let t=k0(n,$a.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},m2=n=>{let e=n.state.field(tr,!1);return!e||!e.panel?!1:(n.dispatch({effects:$0.of(!1)}),!0)},Y9=n=>{let e=n.state.field(tr,!1);if(!e)return!1;let t=n.state.selection.main,r=ws(e.diagnostics,null,t.to+1);return!r&&(r=ws(e.diagnostics,null,0),!r||r.from==t.from&&r.to==t.to)?!1:(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),qD(n,r.from,1,{tooltip:GC,until:i=>i.docChanged||i.newSelection.main.head<r.from||i.newSelection.main.head>r.to}),!0)},G9=[{key:"Mod-Shift-m",run:Q9,preventDefault:!0},{key:"F8",run:Y9}],Va=pe.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...li(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:g2,tooltipFilter:g2,needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t,hideOn:(e,t)=>e?t?(r,i,s)=>e(r,i,s)||t(r,i,s):e:t,autoPanel:(e,t)=>e||t})}}});function g2(n,e){return n?e?(t,r)=>e(n(t,r),r):n:e}function QC(n){let e=[];if(n)e:for(let{name:t}of n){for(let r=0;r<t.length;r++){let i=t[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function YC(n,e,t){var r;let i=t?QC(e.actions):[];return rt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},rt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,u=v=>{if(v.preventDefault(),a)return;a=!0;let x=ws(n.state.field(tr).diagnostics,e);x&&s.apply(n,x.from,x.to)},{name:h}=s,d=i[o]?h.indexOf(i[o]):-1,p=d<0?h:[h.slice(0,d),rt("u",h.slice(d,d+1)),h.slice(d+1)],g=s.markClass?" "+s.markClass:"";return rt("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:u,onmousedown:u,"aria-label":` Action: ${h}${d<0?"":` (access key "${i[o]})"`}.`},p)}),e.source&&rt("div",{class:"cm-diagnosticSource"},e.source))}class X9 extends ai{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return rt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class y2{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=YC(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class $a{constructor(e){this.view=e,this.items=[];let t=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)m2(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=QC(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let u=ws(this.view.state.field(tr).diagnostics,s);u&&s.actions[a].apply(e,u.from,u.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=rt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=rt("div",{class:"cm-panel-lint"},this.list,rt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>m2(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(tr).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(tr),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,u,{spec:h})=>{for(let d of h.diagnostics){if(o.has(d))continue;o.add(d);let p=-1,g;for(let v=r;v<this.items.length;v++)if(this.items[v].diagnostic==d){p=v;break}p<0?(g=new y2(this.view,d),this.items.splice(r,0,g),i=!0):(g=this.items[p],p>r&&(this.items.splice(r,p-r),i=!0)),t&&g.diagnostic==t.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),s=g):g.dom.hasAttribute("aria-selected")&&g.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 y2(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:a,panel:u})=>{let h=u.height/this.list.offsetHeight;a.top<u.top?this.list.scrollTop-=(u.top-a.top)/h:a.bottom>u.bottom&&(this.list.scrollTop+=(a.bottom-u.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(tr),r=ws(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:KC.of(r)})}static open(e){return new $a(e)}}function J9(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function Wu(n){return J9(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Z9=de.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:Wu("#f11")},".cm-lintRange-warning":{backgroundImage:Wu("orange")},".cm-lintRange-info":{backgroundImage:Wu("#999")},".cm-lintRange-hint":{backgroundImage:Wu("#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 e7(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function t7(n){let e="hint",t=1;for(let r of n){let i=e7(r.severity);i>t&&(t=i,e=r.severity)}return e}const GC=UD(q9,{hideOn:V9}),n7=[tr,de.decorations.compute([tr],n=>{let{selected:e,panel:t}=n.field(tr);return!e||!t||e.from==e.to?Te.none:Te.set([U9.range(e.from,e.to)])}),GC,Z9],r7=[sI(),aI(),wD(),u6(),JI(),cD(),pD(),$e.allowMultipleSelections.of(!0),jI(),eL(rL,{fallback:!0}),uL(),eN(),fN(),LD(),FD(),TD(),v9(),La.of([...iN,...BC,...j9,...x6,...QI,...Jk,...G9])],i7=k.forwardRef(function({value:e,onChange:t,onRunShortcut:r,disabled:i=!1,readOnly:s=!1,placeholder:o="Enter SQL statement..."},a){const u=k.useRef(null),h=k.useRef(null),d=k.useRef(r),p=k.useRef(i);return k.useEffect(()=>{d.current=r,p.current=i},[r,i]),k.useImperativeHandle(a,()=>({getSelectedSql:()=>{const g=h.current;if(!g)return"";const{from:v,to:x}=g.state.selection.main;return v!==x?g.state.sliceDoc(v,x):g.state.doc.toString()}}),[]),k.useEffect(()=>{if(!u.current)return;const g=Ss.highest(La.of([{key:"Mod-Enter",run:()=>(!p.current&&d.current&&d.current(),!0)}])),v=[r7,e6(),La.of(BC),MD(o),g,de.theme({"&":{fontSize:"14px",fontFamily:"ui-monospace, monospace"},".cm-content":{padding:"12px",minHeight:"120px"},".cm-focused":{outline:"none"},".cm-scroller":{overflow:"auto"}})];s?(v.push($e.readOnly.of(!0)),v.push(de.editable.of(!1))):t&&v.push(de.updateListener.of(S=>{S.docChanged&&t(S.state.doc.toString())}));const x=$e.create({doc:e,extensions:v}),b=new de({state:x,parent:u.current});return h.current=b,()=>{b.destroy(),h.current=null}},[s,o,t]),k.useEffect(()=>{const g=h.current;if(!g)return;const v=g.state.doc.toString();v!==e&&g.dispatch({changes:{from:0,to:v.length,insert:e}})},[e]),E.jsx("div",{ref:u,className:"border border-border rounded-lg bg-background overflow-hidden"})});let v2=(function(n){return n.disabled="data-disabled",n.valid="data-valid",n.invalid="data-invalid",n.touched="data-touched",n.dirty="data-dirty",n.filled="data-filled",n.focused="data-focused",n})({});const s7={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},fa={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},o7={disabled:!1,...fa},U0={valid(n){return n===null?null:n?{[v2.valid]:""}:{[v2.invalid]:""}}},l7={invalid:void 0,name:void 0,validityData:{state:s7,errors:[],error:"",value:"",initialValue:null},setValidityData:Tt,disabled:void 0,touched:fa.touched,setTouched:Tt,dirty:fa.dirty,setDirty:Tt,filled:fa.filled,setFilled:Tt,focused:fa.focused,setFocused:Tt,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:o7,markedDirtyRef:{current:!1},registerFieldControl:Tt,validation:{getValidationProps:(n=Jt)=>n,getInputValidationProps:(n=Jt)=>n,inputRef:{current:null},commit:async()=>{}}},a7=k.createContext(l7);function q0(n=!0){const e=k.useContext(a7);if(e.setValidityData===Tt&&!n)throw new Error(sr(28));return e}const c7=k.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Tt,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function u7(){return k.useContext(c7)}const f7=k.createContext({controlId:void 0,registerControlId:Tt,labelId:void 0,setLabelId:Tt,messageIds:[],setMessageIds:Tt,getDescriptionProps:n=>n});function K0(){return k.useContext(f7)}function h7(n,e,t,r=!0,i){const[s,o]=k.useState(),a=Ta(i?`${i}-label`:void 0),u=n??e??s;return Pe(()=>{const h=n||e||!r?void 0:d7(t.current,a);s!==h&&o(h)}),u}function d7(n,e){const t=p7(n);if(t)return!t.id&&e&&(t.id=e),t.id||void 0}function p7(n){if(!n)return;const e=n.parentElement;if(e&&e.tagName==="LABEL")return e;const t=n.id;if(t){const i=n.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=n.labels;return r&&r[0]}function m7(n={}){const{id:e,implicit:t=!1,controlRef:r}=n,{controlId:i,registerControlId:s}=K0(),o=Ta(e),a=t?i:void 0,u=br(()=>Symbol("labelable-control")),h=k.useRef(!1),d=k.useRef(e!=null),p=ze(()=>{!h.current||s===Tt||(h.current=!1,s(u.current,void 0))});return Pe(()=>{if(s===Tt)return;let g;if(t){const v=r==null?void 0:r.current;_e(v)&&v.closest("label")!=null?g=e??null:g=a??o}else if(e!=null)d.current=!0,g=e;else if(d.current)g=o;else{p();return}if(g===void 0){p();return}h.current=!0,s(u.current,g)},[e,r,a,s,t,o,u,p]),k.useEffect(()=>p,[p]),i??o}function XC({controlled:n,default:e,name:t,state:r="value"}){const{current:i}=k.useRef(n!==void 0),[s,o]=k.useState(e),a=i?n:s,u=k.useCallback(h=>{i||o(h)},[]);return[a,u]}function JC(n,e,t,r,i=!0){const{registerFieldControl:s}=q0(),o=k.useRef(null);o.current||(o.current=Symbol()),Pe(()=>{const a=o.current;return!a||!i?void 0:(s(a,{controlRef:n,getValue:r,id:e,value:t}),()=>{s(a,void 0)})},[n,i,r,e,s,t])}const g7=k.forwardRef(function(e,t){const{render:r,className:i,id:s,name:o,value:a,disabled:u=!1,onValueChange:h,defaultValue:d,autoFocus:p=!1,style:g,...v}=e,{state:x,name:b,disabled:S,setTouched:C,setDirty:R,validityData:O,setFocused:P,setFilled:D,validationMode:N,validation:L}=q0(),z=S||u,Q=b??o,G={...x,disabled:z},{labelId:X}=K0(),W=m7({id:s});Pe(()=>{var B;const _=a!=null;(B=L.inputRef.current)!=null&&B.value||_&&a!==""?D(!0):_&&a===""&&D(!1)},[L.inputRef,D,a]);const Y=k.useRef(null);Pe(()=>{p&&Y.current===us(qt(Y.current))&&P(!0)},[p,P]);const[J]=XC({controlled:a,default:d,name:"FieldControl",state:"value"}),$=a!==void 0,te=$?J:void 0,q=ze(()=>{var _;return(_=L.inputRef.current)==null?void 0:_.value});return JC(L.inputRef,W,te,q),On("input",e,{ref:[t,Y],state:G,props:[{id:W,disabled:z,name:Q,ref:L.inputRef,"aria-labelledby":X,autoFocus:p,...$?{value:te}:{defaultValue:d},onChange(_){const B=_.currentTarget.value;h==null||h(B,Rt(ah,_.nativeEvent)),R(B!==O.initialValue),D(B!=="")},onFocus(){P(!0)},onBlur(_){C(!0),P(!1),N==="onBlur"&&L.commit(_.currentTarget.value)},onKeyDown(_){_.currentTarget.tagName==="INPUT"&&_.key==="Enter"&&(C(!0),L.commit(_.currentTarget.value))}},L.getInputValidationProps(),v],stateAttributesMapping:U0})}),y7=k.createContext({disabled:!1});function v7(){return k.useContext(y7)}const x7=k.createContext(void 0);function w7(n=!0){const e=k.useContext(x7);if(e===void 0&&!n)throw new Error(sr(3));return e}const b7=k.forwardRef(function(e,t){return E.jsx(g7,{ref:t,...e})});function Hu({className:n,size:e="default",unstyled:t=!1,...r}){return E.jsx("span",{className:Rn(!t&&"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base shadow-xs ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)]",n)||void 0,"data-size":e,"data-slot":"input-control",children:E.jsx(b7,{className:Rn("h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5",e==="sm"&&"h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5",e==="lg"&&"h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5",r.type==="search"&&"[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",r.type==="file"&&"text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm"),"data-slot":"input",size:typeof e=="number"?e:void 0,...r})})}function S7(n){if(!n)return null;for(const e of n.elements){const t=e.tagName;if(t==="BUTTON"||t==="INPUT"){const r=e;if(r.type==="submit")return r}}return null}let x2=(function(n){return n.checked="data-checked",n.unchecked="data-unchecked",n.indeterminate="data-indeterminate",n.disabled="data-disabled",n.readonly="data-readonly",n.required="data-required",n.valid="data-valid",n.invalid="data-invalid",n.touched="data-touched",n.dirty="data-dirty",n.filled="data-filled",n.focused="data-focused",n})({});function ZC(n){return k.useMemo(()=>({checked(e){return n.indeterminate?{}:e?{[x2.checked]:""}:{[x2.unchecked]:""}},...U0}),[n.indeterminate])}const k7=k.createContext(void 0);function C7(n=!1){const e=k.useContext(k7);if(e===void 0&&!n)throw new Error(sr(16));return e}function E7(n){const{focusableWhenDisabled:e,disabled:t,composite:r=!1,tabIndex:i=0,isNativeButton:s}=n,o=r&&e!==!1,a=r&&e===!1;return{props:k.useMemo(()=>{const h={onKeyDown(d){t&&e&&d.key!=="Tab"&&d.preventDefault()}};return r||(h.tabIndex=i,!s&&t&&(h.tabIndex=e?i:-1)),(s&&(e||o)||!s&&t)&&(h["aria-disabled"]=t),s&&(!e||a)&&(h.disabled=t),h},[r,t,e,o,a,s,i])}}function eE(n={}){const{disabled:e=!1,focusableWhenDisabled:t,tabIndex:r=0,native:i=!0,composite:s}=n,o=k.useRef(null),a=C7(!0),u=s??a!==void 0,{props:h}=E7({focusableWhenDisabled:t,disabled:e,composite:u,tabIndex:r,isNativeButton:i}),d=k.useCallback(()=>{const v=o.current;pm(v)&&u&&e&&h.disabled===void 0&&v.disabled&&(v.disabled=!1)},[e,h.disabled,u]);Pe(d,[d]);const p=k.useCallback((v={})=>{const{onClick:x,onMouseDown:b,onKeyUp:S,onKeyDown:C,onPointerDown:R,...O}=v;return hs({onClick(P){if(e){P.preventDefault();return}x==null||x(P)},onMouseDown(P){e||b==null||b(P)},onKeyDown(P){if(e||(gf(P),C==null||C(P),P.baseUIHandlerPrevented))return;const D=P.target===P.currentTarget,N=P.currentTarget,L=pm(N),z=!i&&T7(N),Q=D&&(i?L:!z),G=P.key==="Enter",X=P.key===" ",W=N.getAttribute("role"),Y=(W==null?void 0:W.startsWith("menuitem"))||W==="option"||W==="gridcell";if(D&&u&&X){if(P.defaultPrevented&&Y)return;P.preventDefault(),z||i&&L?(N.click(),P.preventBaseUIHandler()):Q&&(x==null||x(P),P.preventBaseUIHandler());return}Q&&(!i&&(X||G)&&P.preventDefault(),!i&&G&&(x==null||x(P)))},onKeyUp(P){if(!e){if(gf(P),S==null||S(P),P.target===P.currentTarget&&i&&u&&pm(P.currentTarget)&&P.key===" "){P.preventDefault();return}P.baseUIHandlerPrevented||P.target===P.currentTarget&&!i&&!u&&P.key===" "&&(x==null||x(P))}},onPointerDown(P){if(e){P.preventDefault();return}R==null||R(P)}},i?{type:"button"}:{role:"button"},h,O)},[e,h,u,i]),g=ze(v=>{o.current=v,d()});return{getButtonProps:p,buttonRef:g}}function pm(n){return qn(n)&&n.tagName==="BUTTON"}function T7(n){return!!((n==null?void 0:n.tagName)==="A"&&(n!=null&&n.href))}const tE=k.createContext(void 0);function R7(){const n=k.useContext(tE);if(n===void 0)throw new Error(sr(14));return n}function O7(n,e){const t=k.useRef(n),r=ze(e);Pe(()=>{t.current!==n&&r(t.current)},[n,r]),Pe(()=>{t.current=n},[n])}const P7="data-parent",M7=k.forwardRef(function(e,t){const{checked:r,className:i,defaultChecked:s=!1,"aria-labelledby":o,disabled:a=!1,form:u,id:h,indeterminate:d=!1,inputRef:p,name:g,onCheckedChange:v,parent:x=!1,readOnly:b=!1,render:S,required:C=!1,uncheckedValue:R,value:O,nativeButton:P=!1,style:D,...N}=e,{clearErrors:L}=u7(),{disabled:z,name:Q,setDirty:G,setFilled:X,setFocused:W,setTouched:Y,state:J,validationMode:$,validityData:te,shouldValidateOnChange:q,validation:I}=q0(),_=v7(),{labelId:B,controlId:M,registerControlId:V,getDescriptionProps:ne}=K0(),ee=w7(),fe=ee==null?void 0:ee.parent,se=fe&&ee.allValues,me=z||_.disabled||(ee==null?void 0:ee.disabled)||a,xe=Q??g,ye=O??xe,Ve=Ta(),it=Ta();let Ee=M;se?Ee=x?it:`${fe.id}-${ye}`:h&&(Ee=h);let Ye={};se&&(x?Ye=ee.parent.getParentProps():ye&&(Ye=ee.parent.getChildProps(ye)));const{checked:Xe=r,indeterminate:wt=d,onCheckedChange:At,...tn}=Ye,ht=ee==null?void 0:ee.value,Bt=ee==null?void 0:ee.setValue,vn=ee==null?void 0:ee.defaultValue,Ft=k.useRef(null),jt=br(()=>Symbol("checkbox-control")),ct=k.useRef(!1),{getButtonProps:or,buttonRef:re}=eE({disabled:me,native:P}),oe=(ee==null?void 0:ee.validation)??I,[Ce,Le]=XC({controlled:ye&&ht&&!x?ht.includes(ye):Xe,default:ye&&vn&&!x?vn.includes(ye):s,name:"Checkbox",state:"checked"});Pe(()=>{V!==Tt&&(ct.current=!0,V(jt.current,Ee))},[Ee,V,jt]),k.useEffect(()=>{const De=jt.current;return()=>{!ct.current||V===Tt||(ct.current=!1,V(De,void 0))}},[V,jt]),JC(Ft,Ve,Ce,void 0,!ee);const Ue=k.useRef(null),qe=km(p,Ue,oe.inputRef),Be=h7(o,B,Ue,!P,Ee??void 0);Pe(()=>{Ue.current&&(Ue.current.indeterminate=wt,Ce&&X(!0))},[Ce,wt,X]),O7(Ce,()=>{ee&&!x||(L(xe),X(Ce),G(Ce!==te.initialValue),q()?oe.commit(Ce):oe.commit(Ce,!0))});const st=hs({checked:Ce,disabled:me,form:u,name:x?void 0:xe,id:P?void 0:Ee??void 0,required:C,ref:qe,style:xe?I3:Fg,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(De){if(De.nativeEvent.defaultPrevented)return;if(b){De.preventDefault();return}const gt=De.currentTarget.checked,nn=Rt(ah,De.nativeEvent);if(At==null||At(gt,nn),v==null||v(gt,nn),!nn.isCanceled&&(Le(gt),ye&&ht&&Bt&&!x&&!se)){const Me=gt?[...ht,ye]:ht.filter(Ze=>Ze!==ye);Bt(Me,nn)}},onFocus(){var De;(De=Ft.current)==null||De.focus()}},O!==void 0?{value:(ee?Ce&&O:O)||""}:Jt,ne,ee?oe.getValidationProps:oe.getInputValidationProps),zt=se?!!Xe:Ce,bt=se&&wt||d;k.useEffect(()=>{if(!fe||!ye)return;const De=fe.disabledStatesRef.current;return De.set(ye,me),()=>{De.delete(ye)}},[fe,me,ye]);const xn=k.useMemo(()=>({...J,checked:zt,disabled:me,readOnly:b,required:C,indeterminate:bt}),[J,zt,me,b,C,bt]),Pn=ZC(xn),Mn=On("span",e,{state:xn,ref:[re,Ft,t,ee==null?void 0:ee.registerControlRef],props:[{id:P?Ee??void 0:Ve,role:"checkbox","aria-checked":wt?"mixed":Ce,"aria-readonly":b||void 0,"aria-required":C||void 0,"aria-labelledby":Be,[P7]:x?"":void 0,onFocus(){W(!0)},onBlur(){const De=Ue.current;De&&(Y(!0),W(!1),$==="onBlur"&&oe.commit(ee?ht:De.checked))},onKeyDown(De){var wn;if(De.key!=="Enter"||(De.preventBaseUIHandler(),De.defaultPrevented))return;const gt=((wn=Ue.current)==null?void 0:wn.form)??null,nn=De.currentTarget,Me=De.nativeEvent,Ze=De.preventDefault,rn=Me.preventDefault;let Wt=!1;De.preventDefault=()=>{Wt=!0,Ze.call(De)},Me.preventDefault=()=>{Wt=!0,rn.call(Me)},rn.call(Me),Ot(nn).queueMicrotask(()=>{var sn;De.preventDefault=Ze,Me.preventDefault=rn,Wt||(sn=S7(gt))==null||sn.click()})},onClick(De){if(b||me)return;De.preventDefault();const gt=Ue.current;gt&>.dispatchEvent(new(Ot(gt)).PointerEvent("click",{bubbles:!0,shiftKey:De.shiftKey,ctrlKey:De.ctrlKey,altKey:De.altKey,metaKey:De.metaKey}))}},ne,oe.getValidationProps,N,tn,or],stateAttributesMapping:Pn});return E.jsxs(tE.Provider,{value:xn,children:[Mn,!Ce&&!ee&&xe&&!x&&R!==void 0&&E.jsx("input",{type:"hidden",form:u,name:xe,value:R}),E.jsx("input",{...st,suppressHydrationWarning:!0})]})}),A7=k.forwardRef(function(e,t){const{render:r,className:i,style:s,keepMounted:o=!1,...a}=e,u=R7(),h=u.checked||u.indeterminate,{mounted:d,transitionStatus:p,setMounted:g}=bb(h),v=k.useRef(null),x={...u,transitionStatus:p};hh({open:h,ref:v,onComplete(){h||g(!1)}});const S={...ZC(u),...Qg,...U0},C=o||d,R=On("span",e,{ref:[t,v],state:x,stateAttributesMapping:S,props:a});return C?R:null});function D7({className:n,...e}){return E.jsx(M7,{className:Rn("peer flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:aria-invalid:ring-destructive/40",n),"data-slot":"checkbox",...e,children:E.jsx(A7,{className:"grid place-content-center text-current","data-slot":"checkbox-indicator",children:e.checked==="indeterminate"?E.jsx("svg",{fill:"currentcolor",height:"9",viewBox:"0 0 9 9",width:"9",children:E.jsx("path",{d:"M0.75 4.5C0.75 4.08579 1.08579 3.75 1.5 3.75H7.5C7.91421 3.75 8.25 4.08579 8.25 4.5C8.25 4.91421 7.91421 5.25 7.5 5.25H1.5C1.08579 5.25 0.75 4.91421 0.75 4.5Z"})}):E.jsx("svg",{fill:"currentcolor",height:"9",viewBox:"0 0 9 9",width:"9",children:E.jsx("path",{d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})})})})}function I7({parameters:n,values:e,onChange:t}){const r=(i,s)=>{t({...e,[i]:s})};return E.jsx("div",{className:"space-y-4",children:n.map(i=>E.jsxs("div",{className:"space-y-1.5",children:[E.jsxs("label",{className:"text-sm font-medium text-foreground",children:[i.name,i.required?E.jsx("span",{className:"text-destructive ml-0.5",children:"*"}):E.jsx("span",{className:"text-muted-foreground ml-1.5 font-normal",children:"(optional)"})]}),E.jsx(L7,{parameter:i,value:e[i.name],onChange:s=>r(i.name,s)}),i.description&&E.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]},i.name))})}function L7({parameter:n,value:e,onChange:t}){const{type:r,name:i}=n;if(r==="boolean"){const[s,o]=k.useState(e===!0||e==="true");return k.useEffect(()=>{o(e===!0||e==="true")},[e]),E.jsx("div",{className:"flex items-center h-10",children:E.jsx(D7,{checked:s,onCheckedChange:a=>{o(a),t(a)}})})}return r==="integer"?E.jsx(Hu,{type:"number",step:1,value:e??"",onChange:s=>{const o=s.target.value;t(o===""?void 0:parseInt(o,10))},placeholder:`Enter ${i}`}):r==="float"||r==="number"?E.jsx(Hu,{type:"number",step:"any",value:e??"",onChange:s=>{const o=s.target.value;t(o===""?void 0:parseFloat(o))},placeholder:`Enter ${i}`}):r==="array"?E.jsx(Hu,{type:"text",value:Array.isArray(e)?e.join(", "):"",onChange:s=>{const o=s.target.value;t(o?o.split(",").map(a=>a.trim()):void 0)},placeholder:"Enter comma-separated values"}):E.jsx(Hu,{type:"text",value:e??"",onChange:s=>t(s.target.value||void 0),placeholder:`Enter ${i}`})}function N7(n){return On(n.defaultTagName??"div",n,n)}const w2=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,b2=Fb,B7=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return b2(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(h=>{const d=t==null?void 0:t[h],p=s==null?void 0:s[h];if(d===null)return null;const g=w2(d)||w2(p);return i[h][g]}),a=t&&Object.entries(t).reduce((h,d)=>{let[p,g]=d;return g===void 0||(h[p]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,d)=>{let{class:p,className:g,...v}=d;return Object.entries(v).every(x=>{let[b,S]=x;return Array.isArray(S)?S.includes({...s,...a}[b]):{...s,...a}[b]===S})?[...h,p,g]:h},[]);return b2(n,o,u,t==null?void 0:t.class,t==null?void 0:t.className)},nE=B7("[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",{defaultVariants:{size:"default",variant:"default"},variants:{size:{default:"h-9 px-[calc(--spacing(3)-1px)] sm:h-8",icon:"size-9 sm:size-8","icon-lg":"size-10 sm:size-9","icon-sm":"size-8 sm:size-7","icon-xl":"size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5","icon-xs":"size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5",lg:"h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9",sm:"h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7",xl:"h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5",xs:"h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5"},variant:{default:"not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",destructive:"not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none","destructive-outline":"border-border bg-transparent bg-clip-padding text-destructive-foreground shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/32 [:hover,[data-pressed]]:bg-destructive/4",ghost:"border-transparent hover:bg-accent data-pressed:bg-accent",link:"border-transparent underline-offset-4 hover:underline",outline:"border-border bg-background bg-clip-padding shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 [:active,[data-pressed]]:bg-secondary/80"}}});function F7({className:n,variant:e,size:t,render:r,...i}){const s=r?void 0:"button",o={className:Rn(nE({className:n,size:t,variant:e})),"data-slot":"button",type:s};return N7({defaultTagName:"button",props:hs(o,i),render:r})}function _7({className:n,...e}){return E.jsx(Qb,{"aria-label":"Loading",className:Rn("animate-spin",n),role:"status",...e})}function j7({onClick:n,disabled:e=!1,loading:t=!1}){const r=k.useRef(n),i=k.useRef(e),s=k.useRef(t);k.useEffect(()=>{r.current=n,i.current=e,s.current=t},[n,e,t]),k.useEffect(()=>{const u=h=>{(h.metaKey||h.ctrlKey)&&h.key==="Enter"&&!(h.target.closest(".cm-editor")!==null)&&!i.current&&!s.current&&(h.preventDefault(),r.current())};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[]);const a=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?"⌘":"Ctrl";return E.jsx(F7,{onClick:n,disabled:e||t,children:t?E.jsxs(E.Fragment,{children:[E.jsx(_7,{className:"size-4"}),"Running..."]}):E.jsxs(E.Fragment,{children:[E.jsx(QA,{className:"size-4"}),"Run",E.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:[a,"+Enter"]})]})})}function z7(n,e,t){const r=new Array(n);return new Proxy(r,{get(i,s,o){if(typeof s=="string"){const a=s.charCodeAt(0);if(a>=48&&a<=57){const u=+s;if(Number.isInteger(u)&&u>=0&&u<n){let h=i[u];if(!h){const d=e[u*2];h=i[u]={index:u,key:t(u),start:d,size:e[u*2+1],end:d+e[u*2+1],lane:0}}return h}}if(s==="length")return n}return Reflect.get(i,s,o)}})}function Ao(n,e,t){let r=t.initialDeps??[],i,s=!0;function o(){const a=n();return(a.length!==r.length||a.some((h,d)=>r[d]!==h))&&(r=a,i=e(...a),t!=null&&t.onChange&&!(s&&t.skipInitialOnChange)&&t.onChange(i),s=!1),i}return o.updateDeps=a=>{r=a},o}function S2(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const W7=(n,e)=>Math.abs(n-e)<1.01,H7=(n,e,t)=>{let r;return function(...i){n.clearTimeout(r),r=n.setTimeout(()=>e.apply(this,i),t)}};let oa;const k2=()=>{if(oa!==void 0)return oa;if(typeof navigator>"u")return oa=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return oa=!0;const n=navigator.maxTouchPoints;return oa=navigator.platform==="MacIntel"&&n!==void 0&&n>0},C2=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},V7=n=>n,$7=n=>{const e=Math.max(n.startIndex-n.overscan,0),r=Math.min(n.endIndex+n.overscan,n.count-1)-e+1,i=new Array(r);for(let s=0;s<r;s++)i[s]=e+s;return i},U7=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;const i=o=>{const{width:a,height:u}=o;e({width:Math.round(a),height:Math.round(u)})};if(i(C2(t)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(o=>{const a=()=>{const u=o[0];if(u!=null&&u.borderBoxSize){const h=u.borderBoxSize[0];if(h){i({width:h.inlineSize,height:h.blockSize});return}}i(C2(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(t,{box:"border-box"}),()=>{s.unobserve(t)}},Xf={passive:!0},q7=typeof window>"u"?!0:"onscrollend"in window,K7=(n,e,t)=>{const r=n.scrollElement;if(!r)return;const i=n.targetWindow;if(!i)return;const s=n.options.useScrollendEvent&&q7;let o=0;const a=s?null:H7(i,()=>e(o,!1),n.options.isScrollingResetDelay),u=p=>()=>{o=t(r),a==null||a(),e(o,p)},h=u(!0),d=u(!1);return r.addEventListener("scroll",h,Xf),s&&r.addEventListener("scrollend",d,Xf),()=>{r.removeEventListener("scroll",h),s&&r.removeEventListener("scrollend",d)}},Q7=(n,e)=>K7(n,e,t=>{const{horizontal:r,isRtl:i}=n.options;return r?t.scrollLeft*(i&&-1||1):t.scrollTop}),Y7=(n,e,t)=>{if(e!=null&&e.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},G7=(n,{adjustments:e=0,behavior:t},r)=>{var i,s;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:n+e,behavior:t})},X7=G7;class J7{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,r,i;return((i=(r=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const o=()=>{const a=s.target,u=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[h,d]of this.elementsCache)if(d===a){this.elementsCache.delete(h);break}return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(a,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),t=null},observe:i=>{var s;return(s=r())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=r())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=t=>{const r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:V7,rangeExtractor:$7,onChange:()=>{},measureElement:Y7,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const i in t){const s=t[i];s!==void 0&&(r[i]=s)}this.options=r},this.notify=t=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,t)},this.maybeNotify=Ao(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,s)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=s,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,s=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},o=()=>{this._iosTouching=!1,!(!k2()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",s,Xf),i.addEventListener("touchend",o,Xf),this.unsubs.push(()=>{i.removeEventListener("touchstart",s),i.removeEventListener("touchend",o),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),r=this.getMaxScrollOffset();if(t<0||t>r)return;const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{const i=new Map,s=new Map;for(let o=r-1;o>=0;o--){const a=t[o];if(i.has(a.lane))continue;const u=s.get(a.lane);if(u==null||a.end>u.end?s.set(a.lane,a):a.end<u.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=Ao(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,r,i,s,o,a,u)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:t,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:u}),{key:!1}),this.getMeasurements=Ao(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:u},h)=>{const d=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const x of this.laneAssignments.keys())x>=t&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const p=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),a===1){const x=this.options.gap,b=t*2;let S=this._flatMeasurements;if(!S||S.length<b){const O=new Float64Array(b);S&&p>0&&O.set(S.subarray(0,p*2)),S=O,this._flatMeasurements=S}let C;if(p===0)C=r+i;else{const O=p-1;C=S[O*2]+S[O*2+1]+x}for(let O=p;O<t;O++){const P=s(O),D=d.get(P),N=typeof D=="number"?D:this.options.estimateSize(O);S[O*2]=C,S[O*2+1]=N,C+=N+x}const R=z7(t,S,s);return this.measurementsCache=R,R}const g=this.measurementsCache.slice(0,p),v=new Array(a).fill(void 0);for(let x=0;x<p;x++){const b=g[x];b&&(v[b.lane]=x)}for(let x=p;x<t;x++){const b=s(x),S=this.laneAssignments.get(x);let C,R;const O=u==="estimate"||d.has(b);if(S!==void 0&&this.options.lanes>1){C=S;const L=v[C],z=L!==void 0?g[L]:void 0;R=z?z.end+this.options.gap:r+i}else{const L=this.options.lanes===1?g[x-1]:this.getFurthestMeasurement(g,x);R=L?L.end+this.options.gap:r+i,C=L?L.lane:x%this.options.lanes,this.options.lanes>1&&O&&this.laneAssignments.set(x,C)}const P=d.get(b),D=typeof P=="number"?P:this.options.estimateSize(x),N=R+D;g[x]={index:x,start:R,size:D,end:N,key:b,lane:C},v[C]=x}return this.measurementsCache=g,g},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ao(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,i,s)=>this.range=t.length>0&&r>0?Z7({measurements:t,outerSize:r,scrollOffset:i,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ao(()=>{let t=null,r=null;const i=this.calculateRange();return i&&(t=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,i,s,o)=>s===null||o===null?[]:t({startIndex:s,endIndex:o,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,i=t.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(i!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-s),a=Math.min(this.options.count-1,i+s);return t>=o&&t<=a}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const r=this.indexFromElement(t),i=this.options.getItemKey(r),s=this.elementsCache.get(i);s!==t&&(s&&this.observer.unobserve(s),this.observer.observe(t),this.elementsCache.set(i,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,r)=>{var i;if(t<0||t>=this.options.count)return;let s,o,a;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)a=this.options.getItemKey(t),o=u[t*2],s=u[t*2+1];else{const p=this.measurementsCache[t];if(!p)return;a=p.key,o=p.start,s=p.size}const h=this.itemSizeCache.get(a)??s,d=r-h;d!==0&&(((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:a,start:o,size:s,end:o+s,lane:0},d,this):o<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward")&&(k2()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=d:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=d,behavior:void 0})),(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(a,r),this.itemSizeCacheVersion++,this.notify(!1))},this.getVirtualItems=Ao(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const i=[];for(let s=0,o=t.length;s<o;s++){const a=t[s],u=r[a];i.push(u)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length===0)return;const i=this._flatMeasurements,s=this.options.lanes===1&&i!=null,o=rE(0,r.length-1,s?a=>i[a*2]:a=>S2(r[a]).start,t);return S2(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,r,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=t>=o+s?"end":"start"),r==="center"?t+=(i-s)/2:r==="end"&&(t-=s);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),o=this.measurementsCache[t];if(!o)return;if(r==="auto")if(o.end>=s+i-this.options.scrollPaddingEnd)r="end";else if(o.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,o.size),r]},this.scrollToOffset=(t,{align:r="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(t,r),o=this.now();this.scrollState={index:null,align:r,behavior:i,startedAt:o,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:r="auto",behavior:i="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getOffsetForIndex(t,r);if(!s)return;const[o,a]=s,u=this.now();this.scrollState={index:t,align:a,behavior:i,startedAt:u,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:r="auto"}={})=>{const i=this.getScrollOffset()+t,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,o=this._flatMeasurements;o!=null?i=o[s*2]+o[s*2+1]:i=((t=r[s])==null?void 0:t.end)??0}else{const s=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&s.some(a=>a===null);){const a=r[o];s[a.lane]===null&&(s[a.lane]=a.end),o--}i=Math.max(...s.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const r=this.getMeasurements();for(const i of r)i&&this.itemSizeCache.has(i.key)&&t.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return t},this._scrollToOffset=(t,{adjustments:r,behavior:i})=>{this._intendedScrollOffset=t+(r??0),this.options.scrollToFn(t,{behavior:i,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=r?r[0]:this.scrollState.lastTargetOffset,s=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&W7(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,u=Math.abs(i-this.getScrollOffset()),h=this.scrollState.behavior==="smooth"&&u>a;this.scrollState.lastTargetOffset=i,h||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:h?"smooth":"auto"})}this.scheduleScrollReconcile()}}const rE=(n,e,t,r)=>{for(;n<=e;){const i=(n+e)/2|0,s=t(i);if(s<r)n=i+1;else if(s>r)e=i-1;else return i}return n>0?n-1:0};function Z7({measurements:n,outerSize:e,scrollOffset:t,lanes:r,flat:i}){const s=n.length-1,o=i?d=>i[d*2]:d=>n[d].start,a=i?d=>i[d*2]+i[d*2+1]:d=>n[d].end;if(n.length<=r)return{startIndex:0,endIndex:s};let u=rE(0,s,o,t),h=u;if(r===1)for(;h<s&&a(h)<t+e;)h++;else if(r>1){const d=Array(r).fill(0);for(;h<s&&d.some(g=>g<t+e);){const g=n[h];d[g.lane]=g.end,h++}const p=Array(r).fill(t+e);for(;u>=0&&p.some(g=>g>=t);){const g=n[u];p[g.lane]=g.start,u--}u=Math.max(0,u-u%r),h=Math.min(s,h+(r-1-h%r))}return{startIndex:u,endIndex:h}}const E2=typeof document<"u"?k.useLayoutEffect:k.useEffect;function eB({useFlushSync:n=!0,...e}){const t=k.useReducer(s=>s+1,0)[1],r={...e,onChange:(s,o)=>{var a;n&&o?Li.flushSync(t):t(),(a=e.onChange)==null||a.call(e,s,o)}},[i]=k.useState(()=>new J7(r));return i.setOptions(r),E2(()=>i._didMount(),[]),E2(()=>i._willUpdate()),i}function tB(n){return eB({observeElementRect:U7,observeElementOffset:Q7,scrollToFn:X7,...n})}const T2=36;function nB(n){return n<1e3?`${Math.round(n)} ms`:`${(n/1e3).toFixed(2)} s`}function rB(n,e){if(!e.trim())return n;const t=n.toLowerCase(),r=e.toLowerCase(),i=[];let s=0,o=t.indexOf(r);for(;o!==-1;)o>s&&i.push(n.substring(s,o)),i.push(E.jsx("mark",{className:"bg-amber-200/50 text-foreground",children:n.substring(o,o+r.length)},o)),s=o+r.length,o=t.indexOf(r,s);return s<n.length&&i.push(n.substring(s)),i}function iB({result:n,error:e,isLoading:t,executedSql:r,executionTimeMs:i}){const s=k.useRef(null),[o,a]=k.useState(""),u=k.useMemo(()=>{if(!n||!o.trim())return(n==null?void 0:n.rows)??[];const d=o.toLowerCase();return n.rows.filter(p=>p.some(g=>g===null?!1:String(g).toLowerCase().includes(d)))},[n,o]),h=tB({count:u.length,getScrollElement:()=>s.current,estimateSize:()=>T2,overscan:10});return t?E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("div",{className:"text-muted-foreground",children:"Running query..."})}):e?E.jsx("div",{className:"border border-destructive/20 rounded-lg bg-destructive/10 p-4",children:E.jsx("p",{className:"text-destructive text-sm",children:e})}):n?n.rows.length===0?E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("p",{className:"text-muted-foreground text-sm",children:n.rowCount>0?`${n.rowCount} row${n.rowCount!==1?"s":""} affected`:"No results returned"})}):E.jsxs("div",{className:"space-y-2",children:[E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsx("input",{type:"text",placeholder:"Filter results...","aria-label":"Filter table results",value:o,onChange:d=>a(d.target.value),className:"text-sm px-3 py-1 border border-border rounded bg-card text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring w-64"}),E.jsx("div",{className:"text-sm text-muted-foreground",children:o.trim()&&u.length!==n.rowCount?`${u.length} of ${n.rowCount} row${n.rowCount!==1?"s":""}`:`${n.rowCount} row${n.rowCount!==1?"s":""}`})]}),E.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[E.jsxs("div",{className:"flex bg-muted/50 border-b border-border",children:[E.jsx("div",{className:"w-16 px-3 py-2 text-sm font-medium text-foreground flex-shrink-0"}),n.columns.map(d=>E.jsx("div",{className:"flex-1 min-w-[120px] px-3 py-2 text-sm font-medium text-foreground truncate",children:d},d))]}),E.jsx("div",{ref:s,className:"max-h-[400px] overflow-auto bg-card",children:E.jsx("div",{style:{height:`${h.getTotalSize()}px`,width:"100%",position:"relative"},children:h.getVirtualItems().map(d=>{const p=u[d.index];return E.jsxs("div",{className:"flex absolute w-full border-b border-border/50 last:border-b-0",style:{height:`${T2}px`,transform:`translateY(${d.start}px)`},children:[E.jsx("div",{className:"w-16 px-3 py-2 text-sm text-muted-foreground flex-shrink-0",children:d.index+1}),p.map((g,v)=>E.jsx("div",{className:"flex-1 min-w-[120px] px-3 py-2 text-sm text-foreground truncate font-mono",title:String(g??""),children:g===null?E.jsx("span",{className:"text-muted-foreground italic",children:"NULL"}):rB(String(g),o)},v))]},d.index)})})})]}),r&&i!==void 0&&E.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[E.jsx("span",{children:r}),E.jsxs("span",{children:["Executed in ",nB(i)]})]})]}):E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("p",{className:"text-muted-foreground text-sm",children:"Run a query to see results"})})}function sB({className:n="w-4 h-4"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function oB(n){return n.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function lB({tabs:n,activeTabId:e,onTabSelect:t,onTabClose:r,isLoading:i}){const s=k.useRef(null),[o,a]=k.useState(!1),[u,h]=k.useState(!1),d=k.useMemo(()=>n.find(v=>v.id===e),[n,e]),p=k.useCallback(()=>{const v=s.current;if(!v)return;const{scrollLeft:x,scrollWidth:b,clientWidth:S}=v;a(x>0),h(x+S<b-1)},[]);k.useEffect(()=>(p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)),[p,n]);const g=v=>{const x=s.current;if(!x)return;const b=150;x.scrollBy({left:v==="left"?-b:b,behavior:"smooth"})};return i&&n.length===0?E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("div",{className:"text-muted-foreground",children:"Running query..."})}):n.length===0?E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("p",{className:"text-muted-foreground text-sm",children:"Run a query to see results"})}):E.jsxs("div",{className:"space-y-2",children:[E.jsxs("div",{className:"relative flex items-center border-b border-border",children:[o&&E.jsx("button",{type:"button",onClick:()=>g("left"),className:"absolute left-0 z-10 flex items-center justify-center w-6 h-full bg-background hover:bg-muted cursor-pointer","aria-label":"Scroll tabs left",children:E.jsx(NA,{className:"w-4 h-4 text-muted-foreground"})}),E.jsx("div",{ref:s,onScroll:p,className:Rn("flex items-center gap-1 overflow-hidden",o&&"pl-6",u&&"pr-6"),children:n.map(v=>E.jsxs("button",{type:"button",onClick:()=>t(v.id),className:Rn("group flex items-center gap-1.5 px-3 py-1.5 text-sm whitespace-nowrap","border-b-2 -mb-px transition-colors cursor-pointer",v.id===e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:[E.jsx("span",{children:oB(v.timestamp)}),v.error&&E.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-destructive","aria-label":"Error"}),E.jsx("span",{role:"button",tabIndex:0,"aria-label":"Close tab",onClick:x=>{x.stopPropagation(),r(v.id)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.stopPropagation(),r(v.id))},className:"opacity-0 group-hover:opacity-100 hover:bg-muted rounded p-0.5 transition-opacity",children:E.jsx(sB,{className:"w-3 h-3"})})]},v.id))}),u&&E.jsx("button",{type:"button",onClick:()=>g("right"),className:"absolute right-0 z-10 flex items-center justify-center w-6 h-full bg-background hover:bg-muted cursor-pointer","aria-label":"Scroll tabs right",children:E.jsx(FA,{className:"w-4 h-4 text-muted-foreground"})})]}),d&&E.jsx(iB,{result:d.result,error:d.error,isLoading:i,executedSql:d.executedSql,executionTimeMs:d.executionTimeMs})]})}function aB({className:n="w-4 h-4"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}function cB({className:n="w-4 h-4"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function uB(){const{sourceId:n,toolName:e}=th(),[t,r]=WR(),[i,s]=k.useState(null),[o,a]=k.useState(!0),[u,h]=k.useState(null),d=k.useRef(null),[p,g]=k.useState(()=>t.get("sql")||""),[v,x]=k.useState({}),[b,S]=k.useState([]),[C,R]=k.useState(null),[O,P]=k.useState(!1),[D,N]=k.useState(!1);k.useEffect(()=>{!n||!e||(a(!0),h(null),S([]),R(null),qb(n).then(q=>{const I=q.tools.find(_=>_.name===e);s(I||null),a(!1)}).catch(q=>{h(q),a(!1)}))},[n,e]);const z=k.useCallback(()=>i?i.name.startsWith("execute_sql")?"execute_sql":i.name.startsWith("search_objects")?"search_objects":"custom":"custom",[i])(),Q=k.useCallback((q,I)=>{if(!i)return q;const _=i.parameters.find(B=>B.name===I);if(_){if(_.type==="number"||_.type==="integer"||_.type==="float"){const B=Number(q);return isNaN(B)?void 0:B}return _.type==="boolean"?q==="true":q}},[i]);k.useEffect(()=>{if(!i||z!=="custom")return;const q={};t.forEach((I,_)=>{if(_!=="sql"){const B=Q(String(I),_);B!==void 0&&(q[_]=B)}}),Object.keys(q).length>0&&x(q)},[i,z,t,Q]),k.useEffect(()=>{if(z!=="execute_sql")return;const q=setTimeout(()=>{r(I=>{const _=new URLSearchParams(I);return p.trim()?_.set("sql",p):_.delete("sql"),_},{replace:!0})},300);return()=>clearTimeout(q)},[p,z,r]),k.useEffect(()=>{if(z!=="custom")return;const q=setTimeout(()=>{r(I=>{const _=new URLSearchParams(I);return Array.from(_.keys()).forEach(B=>{B!=="sql"&&_.delete(B)}),Object.entries(v).forEach(([B,M])=>{M!=null&&M!==""&&_.set(B,String(M))}),_},{replace:!0})},300);return()=>clearTimeout(q)},[v,z,r]);const G=k.useCallback(()=>{if(!(i!=null&&i.statement))return"";let q=i.statement,I=0;return q=q.replace(/\$(\d+)|\?/g,(_,B)=>{let M;return B?M=i.parameters[parseInt(B,10)-1]:(M=i.parameters[I],I++),M?`:${M.name}`:":?"}),q},[i]),X=k.useCallback(()=>{let q=G();return Object.entries(v).forEach(([I,_])=>{if(_!==void 0&&_!==""){const B=typeof _=="string"?`'${_.replace(/'/g,"''")}'`:String(_);q=q.replace(new RegExp(`:${I}\\b`,"g"),B)}}),q},[G,v]),W=k.useCallback(()=>i?i.parameters.filter(q=>q.required).every(q=>v[q.name]!==void 0&&v[q.name]!==""):!1,[i,v]),Y=k.useCallback(async()=>{var I;if(!i||!e)return;P(!0);const q=performance.now();try{let _,B;z==="execute_sql"?(B=((I=d.current)==null?void 0:I.getSelectedSql())??p,_=await xx(e,{sql:B})):(B=X(),_=await xx(e,v));const V=performance.now()-q,ne={id:crypto.randomUUID(),timestamp:new Date,result:_,error:null,executedSql:B,executionTimeMs:V};S(ee=>[ne,...ee]),R(ne.id)}catch(_){const B={id:crypto.randomUUID(),timestamp:new Date,result:null,error:_ instanceof Error?_.message:"Query failed",executedSql:z==="execute_sql"?p:X(),executionTimeMs:0};S(M=>[B,...M]),R(B.id)}finally{P(!1)}},[i,e,z,p,v,X]),J=z==="execute_sql"?!p.trim():!W(),$=k.useCallback(async()=>{const q=z==="execute_sql"?p:X();await navigator.clipboard.writeText(q),N(!0),setTimeout(()=>N(!1),2e3)},[z,p,X]),te=k.useCallback(q=>{S(I=>{const _=I.findIndex(M=>M.id===q),B=I.filter(M=>M.id!==q);if(q===C&&B.length>0){const M=Math.min(_,B.length-1);R(B[M].id)}else B.length===0&&R(null);return B})},[C]);return!n||!e?E.jsx(ha,{to:"/",replace:!0}):o?E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsx("div",{className:"text-muted-foreground",children:"Loading tool details..."})}):u?u.status===404?E.jsx(ha,{to:"/404",replace:!0}):E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[E.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Error"}),E.jsx("p",{className:"text-destructive/90",children:u.message})]})}):i?z==="search_objects"?E.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:E.jsxs("div",{className:"space-y-4",children:[E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsx("h1",{className:"text-3xl font-bold text-foreground font-mono",children:i.name}),i.readonly&&E.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[E.jsx(wf,{className:"w-3 h-3"}),"Read-Only"]})]}),E.jsx("p",{className:"text-muted-foreground leading-relaxed",children:i.description}),E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("p",{className:"text-muted-foreground",children:"Interactive UI for this tool is coming soon."})})]})}):E.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:E.jsxs("div",{className:"space-y-6",children:[E.jsxs("div",{className:"space-y-2",children:[E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsx("h1",{className:"text-3xl font-bold text-foreground font-mono",children:i.name}),i.readonly&&E.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[E.jsx(wf,{className:"w-3 h-3"}),"Read-Only"]})]}),E.jsx("p",{className:"text-muted-foreground leading-relaxed",children:i.description})]}),z==="custom"&&i.parameters.length>0&&E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{className:"text-sm font-medium text-foreground",children:"Parameters"}),E.jsx("div",{className:"border border-border rounded-lg bg-card p-4",children:E.jsx(I7,{parameters:i.parameters,values:v,onChange:x})})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsxs("div",{className:"flex items-center justify-between",children:[E.jsx("label",{className:"text-sm font-medium text-foreground",children:"SQL Statement"}),E.jsx("button",{onClick:$,className:"inline-flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted rounded cursor-pointer transition-colors",title:"Copy SQL",children:D?E.jsxs(E.Fragment,{children:[E.jsx(cB,{className:"w-3.5 h-3.5"}),"Copied"]}):E.jsxs(E.Fragment,{children:[E.jsx(aB,{className:"w-3.5 h-3.5"}),"Copy"]})})]}),E.jsx(i7,{ref:d,value:z==="execute_sql"?p:X(),onChange:z==="execute_sql"?g:void 0,onRunShortcut:Y,disabled:J||O,readOnly:z!=="execute_sql",placeholder:z==="execute_sql"?"SELECT * FROM table_name LIMIT 10;":void 0})]}),E.jsx(j7,{onClick:Y,disabled:J,loading:O}),E.jsx(lB,{tabs:b,activeTabId:C,onTabSelect:R,onTabClose:te,isLoading:O})]})}):E.jsx(ha,{to:"/404",replace:!0})}function fB(){return E.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:E.jsxs("div",{className:"space-y-6",children:[E.jsxs("div",{children:[E.jsx("h1",{className:"text-4xl font-bold text-foreground mb-4",children:"404 - Page Not Found"}),E.jsx("p",{className:"text-xl text-muted-foreground",children:"The page you're looking for doesn't exist."})]}),E.jsxs("div",{className:"bg-muted rounded-lg p-6",children:[E.jsx("p",{className:"text-muted-foreground mb-4",children:"The URL you entered could not be found. This might be because:"}),E.jsxs("ul",{className:"space-y-2 text-muted-foreground list-disc list-inside",children:[E.jsx("li",{children:"The page was moved or deleted"}),E.jsx("li",{children:"You typed the URL incorrectly"}),E.jsx("li",{children:"The resource ID is invalid"})]})]}),E.jsx("div",{children:E.jsx(Oi,{to:"/",className:"inline-flex items-center px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",children:"Go to Data Sources"})})]})})}const Q0=k.createContext(void 0);function iE(){const n=k.useContext(Q0);if(!n)throw new Error(sr(73));return n}let R2=0;function sE(n){return R2+=1,`${n}-${Math.random().toString(36).slice(2,6)}-${R2}`}function mm(n,e){if(typeof n=="string")return{description:n};if(typeof n=="function"){const t=n(e);return typeof t=="string"?{description:t}:t}return n}function gm(n){const e=new Map;let t=0,r=0;return n.forEach((i,s)=>{const o=i.transitionStatus==="ending";e.set(i.id,{value:i,domIndex:s,visibleIndex:o?-1:t,offsetY:r}),r+=i.height||0,o||(t+=1)}),e}const Vu=n=>n.toastMetadata,Gr={toasts:Ie(n=>n.toasts),isEmpty:Ie(n=>n.toasts.length===0),toast:Ie(Vu,(n,e)=>{var t;return(t=n.get(e))==null?void 0:t.value}),toastIndex:Ie(Vu,(n,e)=>{var t;return((t=n.get(e))==null?void 0:t.domIndex)??-1}),toastOffsetY:Ie(Vu,(n,e)=>{var t;return((t=n.get(e))==null?void 0:t.offsetY)??0}),toastVisibleIndex:Ie(Vu,(n,e)=>{var t;return((t=n.get(e))==null?void 0:t.visibleIndex)??-1}),hovering:Ie(n=>n.hovering),focused:Ie(n=>n.focused),expanded:Ie(n=>n.hovering||n.focused),expandedOrOutOfFocus:Ie(n=>n.hovering||n.focused||!n.isWindowFocused),prevFocusElement:Ie(n=>n.prevFocusElement)};class hB extends Kg{constructor(t){super({...t,toastMetadata:gm(t.toasts)},{},Gr);Je(this,"timers",new Map);Je(this,"areTimersPaused",!1);Je(this,"setViewport",t=>{this.set("viewport",t)});Je(this,"disposeEffect",()=>()=>{this.timers.forEach(t=>{var r;(r=t.timeout)==null||r.clear()}),this.timers.clear()});Je(this,"addToast",t=>{const{timeout:r,limit:i}=this.state,s=t.id||sE("toast");if(t.id){const d=Gr.toast(this.state,t.id);if(d)if(d.transitionStatus==="ending")this.removeToast(t.id,{skipOnRemove:!0});else{const{id:p,transitionStatus:g,...v}=t;return this.updateToastInternal(t.id,v,{resetTimer:!0,markUpdated:!0}),t.id}}const o={...t,id:s,updateKey:0,transitionStatus:"starting"},a=[o,...this.state.toasts],u=a.filter(d=>d.transitionStatus!=="ending");if(u.length>i){const d=u.length-i,p=u.slice(-d),g=new Set(p.map(v=>v.id));this.setToasts(a.map(v=>{const x=g.has(v.id);return v.limited!==x?{...v,limited:x}:v}))}else this.setToasts(a.map(d=>d.limited?{...d,limited:!1}:d));const h=o.timeout??r;return o.type!=="loading"&&h>0&&this.scheduleTimer(s,h,()=>this.closeToast(s)),Gr.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),s});Je(this,"updateToast",(t,r)=>{this.updateToastInternal(t,r,{markUpdated:!0})});Je(this,"updateToastInternal",(t,r,i={})=>{var S,C;const{timeout:s,toasts:o}=this.state,a=Gr.toast(this.state,t)??null;if(!a||a.transitionStatus==="ending")return;const u={...a,...r,...i.markUpdated&&{updateKey:(a.updateKey??0)+1}};this.setToasts(o.map(R=>R.id===t?u:R));const h=u.timeout??s,d=(a==null?void 0:a.timeout)??s,p=Object.hasOwn(r,"timeout"),g=u.transitionStatus!=="ending"&&u.type!=="loading"&&h>0,v=this.timers.has(t),x=d!==h,b=(a==null?void 0:a.type)==="loading";if(!g&&v){const R=this.timers.get(t);(S=R==null?void 0:R.timeout)==null||S.clear(),this.timers.delete(t);return}if(g&&(!v||x||p||b||i.resetTimer)){const R=this.timers.get(t);R&&((C=R.timeout)==null||C.clear(),this.timers.delete(t)),this.scheduleTimer(t,h,()=>this.closeToast(t)),Gr.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}});Je(this,"closeToast",t=>{const r=t===void 0,{limit:i,toasts:s}=this.state;let o;if(r)o=s,this.timers.forEach(d=>{var p;(p=d.timeout)==null||p.clear()}),this.timers.clear();else{const d=Gr.toast(this.state,t);if(!d)return;o=[d];const p=this.timers.get(t);p!=null&&p.timeout&&(p.timeout.clear(),this.timers.delete(t))}let a=0;const u=s.map(d=>{if(r||d.id===t)return{...d,transitionStatus:"ending",height:0};if(d.transitionStatus==="ending")return d;const p=a>=i;return a+=1,d.limited!==p?{...d,limited:p}:d}),h={toasts:u,toastMetadata:gm(u)};(r||s.length===1)&&(h.hovering=!1,h.focused=!1),this.update(h),o.forEach(d=>{var p;d.transitionStatus!=="ending"&&((p=d.onClose)==null||p.call(d))}),this.handleFocusManagement(t)});Je(this,"promiseToast",(t,r)=>{const i=mm(r.loading),s=this.addToast({...i,type:"loading"}),o=t.then(a=>{const u=mm(r.success,a);return this.updateToast(s,{...u,type:"success",timeout:u.timeout}),a}).catch(a=>{const u=mm(r.error,a);return this.updateToast(s,{...u,type:"error",timeout:u.timeout}),Promise.reject(a)});return{}.hasOwnProperty.call(r,"setPromise")&&r.setPromise(o),o});Je(this,"handleDocumentPointerDown",t=>{if(t.pointerType!=="touch")return;const r=En(t);lt(this.state.viewport,r)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))})}setFocused(t){this.set("focused",t)}setHovering(t){this.set("hovering",t)}setIsWindowFocused(t){this.set("isWindowFocused",t)}setPrevFocusElement(t){this.set("prevFocusElement",t)}removeToast(t,r={}){var a;const i=Gr.toastIndex(this.state,t);if(i===-1)return;const s=this.state.toasts[i];r.skipOnRemove||(a=s==null?void 0:s.onRemove)==null||a.call(s);const o=[...this.state.toasts];o.splice(i,1),this.setToasts(o)}pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(t=>{if(t.timeout){t.timeout.clear();const r=Date.now()-t.start,i=t.delay-r;t.remaining=i>0?i:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((t,r)=>{t.remaining=t.remaining>0?t.remaining:t.delay,t.timeout??(t.timeout=Br.create()),t.timeout.start(t.remaining,()=>{this.timers.delete(r),t.callback()}),t.start=Date.now()}))}restoreFocusToPrevElement(){var t;(t=this.state.prevFocusElement)==null||t.focus({preventScroll:!0})}scheduleTimer(t,r,i){const s=Date.now(),o=!Gr.expandedOrOutOfFocus(this.state),a=o?Br.create():void 0;a==null||a.start(r,()=>{this.timers.delete(t),i()}),this.timers.set(t,{timeout:a,start:o?s:0,delay:r,remaining:r,callback:i})}setToasts(t){const r={toasts:t,toastMetadata:gm(t)};t.length===0&&(r.hovering=!1,r.focused=!1),this.update(r)}handleFocusManagement(t){var u,h;const r=us(qt(this.state.viewport));if(!this.state.viewport||!lt(this.state.viewport,r)||!uf(r))return;if(t===void 0){this.restoreFocusToPrevElement();return}const i=Gr.toasts(this.state),s=Gr.toastIndex(this.state,t);let o=null,a=s+1;for(;a<i.length;){if(i[a].transitionStatus!=="ending"){o=i[a];break}a+=1}if(!o)for(a=s-1;a>=0;){if(i[a].transitionStatus!=="ending"){o=i[a];break}a-=1}o?(h=(u=o.ref)==null?void 0:u.current)==null||h.focus():this.restoreFocusToPrevElement()}}const dB=function(e){const{children:t,timeout:r=5e3,limit:i=3,toastManager:s}=e,o=br(()=>new hB({timeout:r,limit:i,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return rh(o.disposeEffect),k.useEffect(function(){return s?s[" subscribe"](({action:h,options:d})=>{const p=d.id;h==="promise"&&d.promise?o.promiseToast(d.promise,d):h==="update"&&p?o.updateToast(p,d):h==="close"?o.closeToast(p):o.addToast(d)}):void 0},[o,s]),o.useSyncedValues({timeout:r,limit:i}),E.jsx(Q0.Provider,{value:o,children:t})};let pB=(function(n){return n.frontmostHeight="--toast-frontmost-height",n})({});const mB=k.forwardRef(function(e,t){var q;const{render:r,className:i,style:s,children:o,...a}=e,u=iE(),h=eo(),d=k.useRef(!1),p=k.useRef(!1),g=k.useRef(!1),v=u.useState("isEmpty"),x=u.useState("toasts"),b=u.useState("focused"),S=u.useState("expanded"),C=u.useState("prevFocusElement"),R=((q=x[0])==null?void 0:q.height)??0,O=k.useMemo(()=>x.some(I=>I.transitionStatus==="ending"),[x]),P=k.useMemo(()=>x.filter(I=>I.priority==="high"),[x]);k.useEffect(()=>{const I=u.state.viewport;if(!I)return;function _(M){v||M.key==="F6"&&En(M)!==I&&(M.preventDefault(),u.setPrevFocusElement(us(qt(I))),I==null||I.focus({preventScroll:!0}),u.pauseTimers(),u.setFocused(!0))}const B=Ot(I);return et(B,"keydown",_)},[u,v]),k.useEffect(()=>{const I=u.state.viewport;if(!I||v)return;const _=Ot(I);function B(V){En(V)===_&&(u.setIsWindowFocused(!1),u.pauseTimers())}function M(V){if(V.relatedTarget)return;const ne=En(V),ee=us(qt(I));(ne===_||!lt(I,ne)||!uf(ee))&&u.resumeTimers(),h.start(0,()=>u.setIsWindowFocused(!0))}return fs(et(_,"blur",B,!0),et(_,"focus",M,!0))},[u,h,v]),k.useEffect(()=>{const I=u.state.viewport;if(!I||v)return;const _=qt(I);return et(_,"pointerdown",u.handleDocumentPointerDown,!0)},[v,u]);function D(I){var B,M,V;const _=u.state.viewport;_&&(d.current=!0,I.relatedTarget===_?(V=(M=(B=x[0])==null?void 0:B.ref)==null?void 0:M.current)==null||V.focus():u.restoreFocusToPrevElement())}function N(I){I.key==="Tab"&&I.shiftKey&&En(I.nativeEvent)===u.state.viewport&&(I.preventDefault(),u.restoreFocusToPrevElement(),u.resumeTimers())}function L(){const I=u.state.toasts.some(_=>_.transitionStatus==="ending");!u.state.isWindowFocused||I||g.current||!p.current||(u.resumeTimers(),u.setHovering(!1),p.current=!1)}k.useEffect(L,[O,u]);function z(){u.pauseTimers(),u.setHovering(!0),p.current=!1}function Q(){O||g.current?p.current=!0:(u.resumeTimers(),u.setHovering(!1))}function G(I){I.pointerType==="touch"&&(g.current=!0)}function X(I){I.pointerType==="touch"&&(g.current=!1,L())}function W(){if(d.current){d.current=!1;return}b||uf(us(qt(u.state.viewport)))&&(u.setFocused(!0),u.pauseTimers())}function Y(I){!b||lt(u.state.viewport,I.relatedTarget)||(u.setFocused(!1),u.resumeTimers())}const J={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:z,onMouseMove:z,onMouseLeave:Q,onFocus:W,onBlur:Y,onKeyDown:N,onClick:W,onPointerDown:G,onPointerUp:X,onPointerCancel:X},$={expanded:S},te=On("div",e,{ref:[t,u.setViewport],state:$,props:[J,{style:{[pB.frontmostHeight]:R?`${R}px`:void 0}},a,{children:E.jsxs(k.Fragment,{children:[!v&&C&&E.jsx(Rp,{onFocus:D}),o,!v&&C&&E.jsx(Rp,{onFocus:D})]})}]});return E.jsxs(k.Fragment,{children:[!v&&C&&E.jsx(Rp,{onFocus:D}),te,!b&&P.length>0&&E.jsx("div",{style:Fg,children:P.map(I=>E.jsxs("div",{role:"alert","aria-atomic":!0,children:[E.jsx("div",{children:I.title}),E.jsx("div",{children:I.description})]},I.id))})]})}),oE=k.createContext(void 0);function Ah(){const n=k.useContext(oE);if(!n)throw new Error(sr(66));return n}let Hs=(function(n){return n.index="--toast-index",n.offsetY="--toast-offset-y",n.height="--toast-height",n.swipeMovementX="--toast-swipe-movement-x",n.swipeMovementY="--toast-swipe-movement-y",n})({});function O2(n,e,t){switch(n){case"up":return-t;case"down":return t;case"left":return-e;case"right":return e;default:return 0}}function gB(n){const t=Ot(n).getComputedStyle(n).transform;let r=0,i=0,s=1;if(t&&t!=="none"){const o=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(o){const a=o[1].split(", ").map(parseFloat);a.length===6?(r=a[4],i=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],i=a[13],s=a[0])}}return{x:r,y:i,scale:s}}const yB={...Qg,swipeDirection(n){return n?{"data-swipe-direction":n}:null}},la=40,vB=10,is=.5,xB=1,wB=`${oO},${lO}`,bB=k.forwardRef(function(e,t){var or;const{toast:r,render:i,className:s,swipeDirection:o=["down","right"],style:a,...u}=e,h=((or=r.positionerProps)==null?void 0:or.anchor)!==void 0;let d=[];h||(d=Array.isArray(o)?o:[o]);const p=d.length>0,g=iE(),[v,x]=k.useState(void 0),[b,S]=k.useState(!1),[C,R]=k.useState(!1),[O,P]=k.useState(!1),[D,N]=k.useState({x:0,y:0}),[L,z]=k.useState({x:0,y:0,scale:1}),[Q,G]=k.useState(),[X,W]=k.useState(),[Y,J]=k.useState(null),$=k.useRef(null),te=k.useRef({x:0,y:0}),q=k.useRef({x:0,y:0,scale:1}),I=k.useRef(void 0),_=k.useRef(0),B=k.useRef(!1),M=k.useRef({x:0,y:0}),V=k.useRef(!1),ne=k.useRef({x:0,y:0}),ee=k.useRef(null),fe=k.useRef(null),se=g.useState("toastIndex",r.id),me=g.useState("toastVisibleIndex",r.id),xe=g.useState("toastOffsetY",r.id),ye=g.useState("focused"),Ve=g.useState("expanded");hh({open:r.transitionStatus!=="ending",ref:$,onComplete(){r.transitionStatus==="ending"&&g.removeToast(r.id)}});const it=ze((re=!1)=>{const oe=$.current;if(!oe)return;const Ce=oe.style.height;oe.style.height="auto";const Le=oe.offsetHeight;oe.style.height=Ce;function Ue(){g.updateToastInternal(r.id,{ref:$,height:Le,...r.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}re?Li.flushSync(Ue):Ue()});Pe(it,[it]);function Ee(re){ne.current=re,N(re)}Pe(()=>()=>{var re;(re=fe.current)==null||re.abort()},[]);function Ye(re,oe){let Ce=re,Le=oe;return!d.includes("left")&&!d.includes("right")?Ce=re>0?re**is:-(Math.abs(re)**is):(!d.includes("right")&&re>0&&(Ce=re**is),!d.includes("left")&&re<0&&(Ce=-(Math.abs(re)**is))),!d.includes("up")&&!d.includes("down")?Le=oe>0?oe**is:-(Math.abs(oe)**is):(!d.includes("down")&&oe>0&&(Le=oe**is),!d.includes("up")&&oe<0&&(Le=-(Math.abs(oe)**is))),{x:Ce,y:Le}}const Xe=ze(re=>{var st;if(re.pointerId!==ee.current)return;ee.current=null,(st=fe.current)==null||st.abort(),fe.current=null,S(!1),R(!1),J(null);const oe=q.current;if(re.type==="pointercancel"||B.current){Ee({x:oe.x,y:oe.y}),x(void 0);return}let Ce=!1;const Le=ne.current,Ue=Le.x-oe.x,qe=Le.y-oe.y;let Be;for(const zt of d){switch(zt){case"right":Ue>la&&(Ce=!0,Be="right");break;case"left":Ue<-la&&(Ce=!0,Be="left");break;case"down":qe>la&&(Ce=!0,Be="down");break;case"up":qe<-la&&(Ce=!0,Be="up");break}if(Ce)break}Ce?(x(Be),P(!0),g.closeToast(r.id)):(Ee({x:oe.x,y:oe.y}),x(void 0))});function wt(re){var Ue,qe;if(re.button!==0)return;re.pointerType==="touch"&&g.pauseTimers();const oe=En(re.nativeEvent);if(oe?oe.closest(`button,a,input,textarea,[role="button"],${wB}`):!1)return;if(B.current=!1,I.current=void 0,_.current=0,ee.current=re.pointerId,te.current={x:re.clientX,y:re.clientY},M.current=te.current,$.current){const Be=gB($.current);q.current=Be,z(Be),Ee({x:Be.x,y:Be.y})}g.setHovering(!0),S(!0),R(!1),J(null),V.current=!0;const Le=$.current;if(Le){(Ue=fe.current)==null||Ue.abort();const Be=new AbortController;fe.current=Be;const st=qt(Le);st.addEventListener("pointerup",Xe,{signal:Be.signal}),st.addEventListener("pointercancel",Xe,{signal:Be.signal}),(qe=Le.setPointerCapture)==null||qe.call(Le,re.pointerId)}}function At(re){if(re.pointerId!==ee.current)return;re.preventDefault(),V.current&&(te.current={x:re.clientX,y:re.clientY},V.current=!1);const{clientY:oe,clientX:Ce,movementX:Le,movementY:Ue}=re;(Ue<0&&oe>M.current.y||Ue>0&&oe<M.current.y)&&(M.current={x:M.current.x,y:oe}),(Le<0&&Ce>M.current.x||Le>0&&Ce<M.current.x)&&(M.current={x:Ce,y:M.current.y});const qe=Ce-te.current.x,Be=oe-te.current.y,st=oe-M.current.y,zt=Ce-M.current.x;if(!C&&Math.sqrt(qe*qe+Be*Be)>=xB&&(R(!0),Y===null)){const gt=d.includes("left")||d.includes("right"),nn=d.includes("up")||d.includes("down");if(gt&&nn){const Me=Math.abs(qe),Ze=Math.abs(Be);J(Me>Ze?"horizontal":"vertical")}}let bt;if(!I.current)Y==="vertical"?Be>0?bt="down":Be<0&&(bt="up"):Y==="horizontal"?qe>0?bt="right":qe<0&&(bt="left"):Math.abs(qe)>=Math.abs(Be)?bt=qe>0?"right":"left":bt=Be>0?"down":"up",bt&&d.includes(bt)&&(I.current=bt,_.current=O2(bt,qe,Be),x(bt));else{const De=I.current,gt=O2(De,zt,st);gt>la?(B.current=!1,x(De)):!(d.includes("left")&&d.includes("right"))&&!(d.includes("up")&&d.includes("down"))&&_.current-gt>=vB&&(B.current=!0)}const xn=Ye(qe,Be);let Pn=q.current.x,Mn=q.current.y;Y==="horizontal"?(d.includes("left")||d.includes("right"))&&(Pn+=xn.x):(Y==="vertical"||(d.includes("left")||d.includes("right"))&&(Pn+=xn.x),(d.includes("up")||d.includes("down"))&&(Mn+=xn.y)),Ee({x:Pn,y:Mn})}function tn(re){if(re.key==="Escape"){if(!$.current||!lt($.current,us(qt($.current))))return;g.closeToast(r.id)}}k.useEffect(()=>{if(!p)return;const re=$.current;if(!re)return;function oe(Ce){lt(re,En(Ce))&&Ce.preventDefault()}return et(re,"touchmove",oe,{passive:!1})},[p]);function ht(){if(!b&&D.x===L.x&&D.y===L.y&&!O)return{[Hs.swipeMovementX]:"0px",[Hs.swipeMovementY]:"0px"};const re=D.x-L.x,oe=D.y-L.y;return{transition:b?"none":void 0,transform:b?`translateX(${D.x}px) translateY(${D.y}px) scale(${L.scale})`:void 0,[Hs.swipeMovementX]:`${re}px`,[Hs.swipeMovementY]:`${oe}px`}}const Bt=r.priority==="high",vn={role:Bt?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":Q,"aria-describedby":X,"aria-hidden":Bt&&!ye?!0:void 0,onPointerDown:p?wt:void 0,onPointerMove:p?At:void 0,onPointerUp:p?Xe:void 0,onPointerCancel:p?Xe:void 0,onKeyDown:tn,inert:Nb(r.limited),style:{...ht(),[Hs.index]:r.transitionStatus==="ending"?se:me,[Hs.offsetY]:`${xe}px`,[Hs.height]:r.height?`${r.height}px`:void 0}},Ft=k.useMemo(()=>({rootRef:$,toast:r,titleId:Q,setTitleId:G,descriptionId:X,setDescriptionId:W,swiping:b,swipeDirection:v,recalculateHeight:it,index:se,visibleIndex:me,expanded:Ve}),[r,Q,X,b,v,it,se,me,Ve]),jt={transitionStatus:r.transitionStatus,expanded:Ve,limited:r.limited||!1,type:r.type,swiping:Ft.swiping,swipeDirection:Ft.swipeDirection},ct=On("div",e,{ref:[t,Ft.rootRef],state:jt,stateAttributesMapping:yB,props:[vn,u]});return E.jsx(oE.Provider,{value:Ft,children:ct})}),SB=k.forwardRef(function(e,t){const{render:r,className:i,style:s,...o}=e,{visibleIndex:a,expanded:u,recalculateHeight:h}=Ah(),d=k.useRef(null);Pe(()=>{const x=d.current;if(!x||(h(),typeof ResizeObserver!="function"||typeof MutationObserver!="function"))return;const b=new ResizeObserver(()=>h(!0)),S=new MutationObserver(()=>h(!0));return b.observe(x),S.observe(x,{childList:!0,subtree:!0,characterData:!0}),()=>{b.disconnect(),S.disconnect()}},[h]);const p=a>0;return On("div",e,{ref:[t,d],state:{expanded:u,behind:p},props:o})}),kB=k.forwardRef(function(e,t){const{render:r,className:i,style:s,id:o,children:a,...u}=e,{toast:h,setDescriptionId:d}=Ah(),p=a??h.description,g=!!p,v=al(o);Pe(()=>{if(g)return d(v),()=>{d(void 0)}},[g,v,d]);const x={type:h.type},b=On("p",e,{ref:t,state:x,props:{...u,id:v,children:p}});return g?b:null}),CB=k.forwardRef(function(e,t){const{render:r,className:i,style:s,id:o,children:a,...u}=e,{toast:h,setTitleId:d}=Ah(),p=a??h.title,g=!!p,v=al(o);Pe(()=>{if(g)return d(v),()=>{d(void 0)}},[g,v,d]);const x={type:h.type},b=On("h2",e,{ref:t,state:x,props:{...u,id:v,children:p}});return g?b:null}),EB=k.forwardRef(function(e,t){var S;const{render:r,className:i,style:s,disabled:o,nativeButton:a=!0,...u}=e,{toast:h}=Ah(),d=((S=h.actionProps)==null?void 0:S.children)??u.children,p=!!d,{getButtonProps:g,buttonRef:v}=eE({disabled:o,native:a}),x={type:h.type},b=On("button",e,{ref:[t,v],state:x,props:[u,h.actionProps,g,{children:d}]});return p?b:null}),TB=Pb;function RB(){const n=k.useContext(Q0);if(!n)throw new Error(sr(73));const e=n.useState("toasts");return k.useMemo(()=>({toasts:e,add:n.addToast,close:n.closeToast,update:n.updateToast,promise:n.promiseToast}),[e,n])}function OB(){const n=new Set;function e(t){n.forEach(r=>r(t))}return{" subscribe":function(r){return n.add(r),()=>{n.delete(r)}},add(t){const r=t.id||sE("toast"),i={...t,id:r,transitionStatus:"starting"};return e({action:"add",options:i}),r},close(t){e({action:"close",options:{id:t}})},update(t,r){e({action:"update",options:{...r,id:t}})},promise(t,r){let i=t;return e({action:"promise",options:{...r,promise:t,setPromise(s){i=s}}}),i}}}const lE=OB(),PB={error:jA,info:VA,loading:Qb,success:WA,warning:GA};function MB({children:n,position:e="bottom-right",...t}){return E.jsxs(dB,{toastManager:lE,...t,children:[n,E.jsx(AB,{position:e})]})}function AB({position:n="bottom-right"}){const{toasts:e}=RB(),t=n.startsWith("top");return E.jsx(TB,{"data-slot":"toast-portal",children:E.jsx(mB,{className:Rn("fixed z-50 mx-auto flex w-[calc(100%-var(--toast-inset)*2)] max-w-90 [--toast-inset:--spacing(4)] sm:[--toast-inset:--spacing(8)]","data-[position*=top]:top-(--toast-inset)","data-[position*=bottom]:bottom-(--toast-inset)","data-[position*=left]:left-(--toast-inset)","data-[position*=right]:right-(--toast-inset)","data-[position*=center]:-translate-x-1/2 data-[position*=center]:left-1/2"),"data-position":n,"data-slot":"toast-viewport",children:e.map(r=>{const i=r.type?PB[r.type]:null;return E.jsx(bB,{className:Rn("absolute z-[calc(9999-var(--toast-index))] h-(--toast-calc-height) w-full select-none rounded-lg border bg-popover bg-clip-padding text-popover-foreground shadow-lg [transition:transform_.5s_cubic-bezier(.22,1,.36,1),opacity_.5s,height_.15s] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]","data-[position*=right]:right-0 data-[position*=right]:left-auto","data-[position*=left]:right-auto data-[position*=left]:left-0","data-[position*=center]:right-0 data-[position*=center]:left-0","data-[position*=top]:top-0 data-[position*=top]:bottom-auto data-[position*=top]:origin-top","data-[position*=bottom]:top-auto data-[position*=bottom]:bottom-0 data-[position*=bottom]:origin-bottom","after:absolute after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full","data-[position*=top]:after:top-full","data-[position*=bottom]:after:bottom-full","[--toast-calc-height:var(--toast-frontmost-height,var(--toast-height))] [--toast-gap:--spacing(3)] [--toast-peek:--spacing(3)] [--toast-scale:calc(max(0,1-(var(--toast-index)*.1)))] [--toast-shrink:calc(1-var(--toast-scale))]","data-[position*=top]:[--toast-calc-offset-y:calc(var(--toast-offset-y)+var(--toast-index)*var(--toast-gap)+var(--toast-swipe-movement-y))]","data-[position*=bottom]:[--toast-calc-offset-y:calc(var(--toast-offset-y)*-1+var(--toast-index)*var(--toast-gap)*-1+var(--toast-swipe-movement-y))]","data-[position*=top]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--toast-peek))+(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]","data-[position*=bottom]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--toast-peek))-(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]","data-limited:opacity-0","data-expanded:h-(--toast-height)","data-position:data-expanded:transform-[translateX(var(--toast-swipe-movement-x))_translateY(var(--toast-calc-offset-y))]","data-[position*=top]:data-starting-style:transform-[translateY(calc(-100%-var(--toast-inset)))]","data-[position*=bottom]:data-starting-style:transform-[translateY(calc(100%+var(--toast-inset)))]","data-ending-style:opacity-0","data-ending-style:not-data-limited:not-data-swipe-direction:transform-[translateY(calc(100%+var(--toast-inset)))]","data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]","data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]","data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]","data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]","data-expanded:data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]","data-expanded:data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]","data-expanded:data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]","data-expanded:data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]"),"data-position":n,swipeDirection:n.includes("center")?[t?"up":"down"]:n.includes("left")?["left",t?"up":"down"]:["right",t?"up":"down"],toast:r,children:E.jsxs(SB,{className:"pointer-events-auto flex items-center justify-between gap-1.5 overflow-hidden px-3.5 py-3 text-sm transition-opacity duration-250 data-behind:pointer-events-none data-behind:opacity-0 data-expanded:opacity-100",children:[E.jsxs("div",{className:"flex gap-2",children:[i&&E.jsx("div",{className:"[&>svg]:h-lh [&>svg]:w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","data-slot":"toast-icon",children:E.jsx(i,{className:"in-data-[type=loading]:animate-spin in-data-[type=error]:text-destructive in-data-[type=info]:text-info in-data-[type=success]:text-success in-data-[type=warning]:text-warning in-data-[type=loading]:opacity-80"})}),E.jsxs("div",{className:"flex flex-col gap-0.5",children:[E.jsx(CB,{className:"font-medium","data-slot":"toast-title"}),E.jsx(kB,{className:"text-muted-foreground","data-slot":"toast-description"})]})]}),r.actionProps&&E.jsx(EB,{className:nE({size:"xs"}),"data-slot":"toast-action",children:r.actionProps.children})]})},r.id)})})})}class DB extends k.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("Uncaught error:",e,t)}render(){if(this.state.error){const e=this.state.error,t=e instanceof Ut;return E.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:E.jsx("div",{className:"max-w-md w-full",children:E.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[E.jsx("h1",{className:"text-2xl font-bold text-destructive mb-4",children:"Something went wrong"}),E.jsx("p",{className:"text-destructive/90 mb-4",children:e.message}),t&&E.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Error code: ",e.status]}),E.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",children:"Reload page"})]})})})}return this.props.children}}function IB(){const[n,e]=k.useState([]),[t,r]=k.useState(!0);return k.useEffect(()=>{i0().then(i=>{e(i),r(!1)}).catch(i=>{console.error("Failed to fetch sources:",i);const s=i instanceof Ut?i.message:"Failed to load data sources";lE.add({title:s,type:"error"}),r(!1)})},[]),E.jsx(DB,{children:E.jsx(MB,{children:E.jsx(BR,{children:E.jsx(fR,{children:E.jsxs(Vs,{path:"/",element:E.jsx(xA,{sources:n,isLoading:t}),children:[E.jsx(Vs,{index:!0,element:E.jsx(wA,{})}),E.jsx(Vs,{path:"requests",element:E.jsx(OA,{})}),E.jsx(Vs,{path:"source/:sourceId",element:E.jsx(XA,{})}),E.jsx(Vs,{path:"source/:sourceId/tool/:toolName",element:E.jsx(uB,{})}),E.jsx(Vs,{path:"*",element:E.jsx(fB,{})})]})})})})})}u4.createRoot(document.getElementById("root")).render(E.jsx(k.StrictMode,{children:E.jsx(IB,{})}));
|