@teckedd-code2save/datafy 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/chunk-PQOTKZVK.js +2188 -0
- package/dist/demo/employee-sqlite/employee.sql +117 -0
- package/dist/demo/employee-sqlite/load_department.sql +10 -0
- package/dist/demo/employee-sqlite/load_dept_emp.sql +1103 -0
- package/dist/demo/employee-sqlite/load_dept_manager.sql +17 -0
- package/dist/demo/employee-sqlite/load_employee.sql +1000 -0
- package/dist/demo/employee-sqlite/load_salary1.sql +9488 -0
- package/dist/demo/employee-sqlite/load_title.sql +1470 -0
- package/dist/demo-loader-PSMTLZ2T.js +46 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4777 -0
- package/dist/public/assets/index-BJ-1UrcV.css +1 -0
- package/dist/public/assets/index-DBYlgGks.js +147 -0
- package/dist/public/assets/postgres-BpcazhJg.svg +22 -0
- package/dist/public/assets/sqlserver-ByfFYYpV.svg +11 -0
- package/dist/public/favicon.svg +57 -0
- package/dist/public/index.html +14 -0
- package/dist/public/logo-full-light.svg +58 -0
- package/dist/registry-U5HSB2VB.js +10 -0
- package/package.json +90 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
var f4=Object.defineProperty;var h4=(n,e,t)=>e in n?f4(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Pt=(n,e,t)=>h4(n,typeof e!="symbol"?e+"":e,t);function d4(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 l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).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 p4(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Jd={exports:{}},_l={},Zd={exports:{}},Be={};/**
|
|
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 Yv;function m4(){if(Yv)return Be;Yv=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"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),m=Symbol.iterator;function g(M){return M===null||typeof M!="object"?null:(M=m&&M[m]||M["@@iterator"],typeof M=="function"?M:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,b={};function k(M,V,oe){this.props=M,this.context=V,this.refs=b,this.updater=oe||y}k.prototype.isReactComponent={},k.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")},k.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function R(){}R.prototype=k.prototype;function T(M,V,oe){this.props=M,this.context=V,this.refs=b,this.updater=oe||y}var O=T.prototype=new R;O.constructor=T,x(O,k.prototype),O.isPureReactComponent=!0;var P=Array.isArray,N=Object.prototype.hasOwnProperty,I={current:null},B={key:!0,ref:!0,__self:!0,__source:!0};function W(M,V,oe){var ce,he={},se=null,fe=null;if(V!=null)for(ce in V.ref!==void 0&&(fe=V.ref),V.key!==void 0&&(se=""+V.key),V)N.call(V,ce)&&!B.hasOwnProperty(ce)&&(he[ce]=V[ce]);var ke=arguments.length-2;if(ke===1)he.children=oe;else if(1<ke){for(var Oe=Array(ke),Fe=0;Fe<ke;Fe++)Oe[Fe]=arguments[Fe+2];he.children=Oe}if(M&&M.defaultProps)for(ce in ke=M.defaultProps,ke)he[ce]===void 0&&(he[ce]=ke[ce]);return{$$typeof:n,type:M,key:se,ref:fe,props:he,_owner:I.current}}function Z(M,V){return{$$typeof:n,type:M.type,key:V,ref:M.ref,props:M.props,_owner:M._owner}}function X(M){return typeof M=="object"&&M!==null&&M.$$typeof===n}function Q(M){var V={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(oe){return V[oe]})}var U=/\/+/g;function j(M,V){return typeof M=="object"&&M!==null&&M.key!=null?Q(""+M.key):V.toString(36)}function Y(M,V,oe,ce,he){var se=typeof M;(se==="undefined"||se==="boolean")&&(M=null);var fe=!1;if(M===null)fe=!0;else switch(se){case"string":case"number":fe=!0;break;case"object":switch(M.$$typeof){case n:case e:fe=!0}}if(fe)return fe=M,he=he(fe),M=ce===""?"."+j(fe,0):ce,P(he)?(oe="",M!=null&&(oe=M.replace(U,"$&/")+"/"),Y(he,V,oe,"",function(Fe){return Fe})):he!=null&&(X(he)&&(he=Z(he,oe+(!he.key||fe&&fe.key===he.key?"":(""+he.key).replace(U,"$&/")+"/")+M)),V.push(he)),1;if(fe=0,ce=ce===""?".":ce+":",P(M))for(var ke=0;ke<M.length;ke++){se=M[ke];var Oe=ce+j(se,ke);fe+=Y(se,V,oe,Oe,he)}else if(Oe=g(M),typeof Oe=="function")for(M=Oe.call(M),ke=0;!(se=M.next()).done;)se=se.value,Oe=ce+j(se,ke++),fe+=Y(se,V,oe,Oe,he);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 fe}function J(M,V,oe){if(M==null)return M;var ce=[],he=0;return Y(M,ce,"","",function(se){return V.call(oe,se,he++)}),ce}function q(M){if(M._status===-1){var V=M._result;V=V(),V.then(function(oe){(M._status===0||M._status===-1)&&(M._status=1,M._result=oe)},function(oe){(M._status===0||M._status===-1)&&(M._status=2,M._result=oe)}),M._status===-1&&(M._status=0,M._result=V)}if(M._status===1)return M._result.default;throw M._result}var H={current:null},A={transition:null},D={ReactCurrentDispatcher:H,ReactCurrentBatchConfig:A,ReactCurrentOwner:I};function z(){throw Error("act(...) is not supported in production builds of React.")}return Be.Children={map:J,forEach:function(M,V,oe){J(M,function(){V.apply(this,arguments)},oe)},count:function(M){var V=0;return J(M,function(){V++}),V},toArray:function(M){return J(M,function(V){return V})||[]},only:function(M){if(!X(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},Be.Component=k,Be.Fragment=t,Be.Profiler=i,Be.PureComponent=T,Be.StrictMode=r,Be.Suspense=u,Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=D,Be.act=z,Be.cloneElement=function(M,V,oe){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var ce=x({},M.props),he=M.key,se=M.ref,fe=M._owner;if(V!=null){if(V.ref!==void 0&&(se=V.ref,fe=I.current),V.key!==void 0&&(he=""+V.key),M.type&&M.type.defaultProps)var ke=M.type.defaultProps;for(Oe in V)N.call(V,Oe)&&!B.hasOwnProperty(Oe)&&(ce[Oe]=V[Oe]===void 0&&ke!==void 0?ke[Oe]:V[Oe])}var Oe=arguments.length-2;if(Oe===1)ce.children=oe;else if(1<Oe){ke=Array(Oe);for(var Fe=0;Fe<Oe;Fe++)ke[Fe]=arguments[Fe+2];ce.children=ke}return{$$typeof:n,type:M.type,key:he,ref:se,props:ce,_owner:fe}},Be.createContext=function(M){return M={$$typeof:l,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:s,_context:M},M.Consumer=M},Be.createElement=W,Be.createFactory=function(M){var V=W.bind(null,M);return V.type=M,V},Be.createRef=function(){return{current:null}},Be.forwardRef=function(M){return{$$typeof:c,render:M}},Be.isValidElement=X,Be.lazy=function(M){return{$$typeof:d,_payload:{_status:-1,_result:M},_init:q}},Be.memo=function(M,V){return{$$typeof:h,type:M,compare:V===void 0?null:V}},Be.startTransition=function(M){var V=A.transition;A.transition={};try{M()}finally{A.transition=V}},Be.unstable_act=z,Be.useCallback=function(M,V){return H.current.useCallback(M,V)},Be.useContext=function(M){return H.current.useContext(M)},Be.useDebugValue=function(){},Be.useDeferredValue=function(M){return H.current.useDeferredValue(M)},Be.useEffect=function(M,V){return H.current.useEffect(M,V)},Be.useId=function(){return H.current.useId()},Be.useImperativeHandle=function(M,V,oe){return H.current.useImperativeHandle(M,V,oe)},Be.useInsertionEffect=function(M,V){return H.current.useInsertionEffect(M,V)},Be.useLayoutEffect=function(M,V){return H.current.useLayoutEffect(M,V)},Be.useMemo=function(M,V){return H.current.useMemo(M,V)},Be.useReducer=function(M,V,oe){return H.current.useReducer(M,V,oe)},Be.useRef=function(M){return H.current.useRef(M)},Be.useState=function(M){return H.current.useState(M)},Be.useSyncExternalStore=function(M,V,oe){return H.current.useSyncExternalStore(M,V,oe)},Be.useTransition=function(){return H.current.useTransition()},Be.version="18.3.1",Be}var Gv;function Fa(){return Gv||(Gv=1,Zd.exports=m4()),Zd.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 Xv;function g4(){if(Xv)return _l;Xv=1;var n=Fa(),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 l(c,u,h){var d,m={},g=null,y=null;h!==void 0&&(g=""+h),u.key!==void 0&&(g=""+u.key),u.ref!==void 0&&(y=u.ref);for(d in u)r.call(u,d)&&!s.hasOwnProperty(d)&&(m[d]=u[d]);if(c&&c.defaultProps)for(d in u=c.defaultProps,u)m[d]===void 0&&(m[d]=u[d]);return{$$typeof:e,type:c,key:g,ref:y,props:m,_owner:i.current}}return _l.Fragment=t,_l.jsx=l,_l.jsxs=l,_l}var Jv;function y4(){return Jv||(Jv=1,Jd.exports=g4()),Jd.exports}var C=y4(),S=Fa();const v4=p4(S),Jw=d4({__proto__:null,default:v4},[S]);var ou={},ep={exports:{}},En={},tp={exports:{}},np={};/**
|
|
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 Zv;function x4(){return Zv||(Zv=1,function(n){function e(A,D){var z=A.length;A.push(D);e:for(;0<z;){var M=z-1>>>1,V=A[M];if(0<i(V,D))A[M]=D,A[z]=V,z=M;else break e}}function t(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var D=A[0],z=A.pop();if(z!==D){A[0]=z;e:for(var M=0,V=A.length,oe=V>>>1;M<oe;){var ce=2*(M+1)-1,he=A[ce],se=ce+1,fe=A[se];if(0>i(he,z))se<V&&0>i(fe,he)?(A[M]=fe,A[se]=z,M=se):(A[M]=he,A[ce]=z,M=ce);else if(se<V&&0>i(fe,z))A[M]=fe,A[se]=z,M=se;else break e}}return D}function i(A,D){var z=A.sortIndex-D.sortIndex;return z!==0?z:A.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();n.unstable_now=function(){return l.now()-c}}var u=[],h=[],d=1,m=null,g=3,y=!1,x=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,T=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(A){for(var D=t(h);D!==null;){if(D.callback===null)r(h);else if(D.startTime<=A)r(h),D.sortIndex=D.expirationTime,e(u,D);else break;D=t(h)}}function P(A){if(b=!1,O(A),!x)if(t(u)!==null)x=!0,q(N);else{var D=t(h);D!==null&&H(P,D.startTime-A)}}function N(A,D){x=!1,b&&(b=!1,R(W),W=-1),y=!0;var z=g;try{for(O(D),m=t(u);m!==null&&(!(m.expirationTime>D)||A&&!Q());){var M=m.callback;if(typeof M=="function"){m.callback=null,g=m.priorityLevel;var V=M(m.expirationTime<=D);D=n.unstable_now(),typeof V=="function"?m.callback=V:m===t(u)&&r(u),O(D)}else r(u);m=t(u)}if(m!==null)var oe=!0;else{var ce=t(h);ce!==null&&H(P,ce.startTime-D),oe=!1}return oe}finally{m=null,g=z,y=!1}}var I=!1,B=null,W=-1,Z=5,X=-1;function Q(){return!(n.unstable_now()-X<Z)}function U(){if(B!==null){var A=n.unstable_now();X=A;var D=!0;try{D=B(!0,A)}finally{D?j():(I=!1,B=null)}}else I=!1}var j;if(typeof T=="function")j=function(){T(U)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,J=Y.port2;Y.port1.onmessage=U,j=function(){J.postMessage(null)}}else j=function(){k(U,0)};function q(A){B=A,I||(I=!0,j())}function H(A,D){W=k(function(){A(n.unstable_now())},D)}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(A){A.callback=null},n.unstable_continueExecution=function(){x||y||(x=!0,q(N))},n.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<A?Math.floor(1e3/A):5},n.unstable_getCurrentPriorityLevel=function(){return g},n.unstable_getFirstCallbackNode=function(){return t(u)},n.unstable_next=function(A){switch(g){case 1:case 2:case 3:var D=3;break;default:D=g}var z=g;g=D;try{return A()}finally{g=z}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(A,D){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var z=g;g=A;try{return D()}finally{g=z}},n.unstable_scheduleCallback=function(A,D,z){var M=n.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?M+z:M):z=M,A){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=z+V,A={id:d++,callback:D,priorityLevel:A,startTime:z,expirationTime:V,sortIndex:-1},z>M?(A.sortIndex=z,e(h,A),t(u)===null&&A===t(h)&&(b?(R(W),W=-1):b=!0,H(P,z-M))):(A.sortIndex=V,e(u,A),x||y||(x=!0,q(N))),A},n.unstable_shouldYield=Q,n.unstable_wrapCallback=function(A){var D=g;return function(){var z=g;g=D;try{return A.apply(this,arguments)}finally{g=z}}}}(np)),np}var ex;function w4(){return ex||(ex=1,tp.exports=x4()),tp.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 tx;function b4(){if(tx)return En;tx=1;var n=Fa(),e=w4();function t(o){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+o,f=1;f<arguments.length;f++)a+="&args[]="+encodeURIComponent(arguments[f]);return"Minified React error #"+o+"; visit "+a+" 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(o,a){l(o,a),l(o+"Capture",a)}function l(o,a){for(i[o]=a,o=0;o<a.length;o++)r.add(a[o])}var c=!(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={},m={};function g(o){return u.call(m,o)?!0:u.call(d,o)?!1:h.test(o)?m[o]=!0:(d[o]=!0,!1)}function y(o,a,f,p){if(f!==null&&f.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return p?!1:f!==null?!f.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function x(o,a,f,p){if(a===null||typeof a>"u"||y(o,a,f,p))return!0;if(p)return!1;if(f!==null)switch(f.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function b(o,a,f,p,v,w,E){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=p,this.attributeNamespace=v,this.mustUseProperty=f,this.propertyName=o,this.type=a,this.sanitizeURL=w,this.removeEmptyString=E}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){k[o]=new b(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var a=o[0];k[a]=new b(a,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){k[o]=new b(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){k[o]=new b(o,2,!1,o,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(o){k[o]=new b(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){k[o]=new b(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){k[o]=new b(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){k[o]=new b(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){k[o]=new b(o,5,!1,o.toLowerCase(),null,!1,!1)});var R=/[\-:]([a-z])/g;function T(o){return o[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(o){var a=o.replace(R,T);k[a]=new b(a,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var a=o.replace(R,T);k[a]=new b(a,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var a=o.replace(R,T);k[a]=new b(a,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){k[o]=new b(o,1,!1,o.toLowerCase(),null,!1,!1)}),k.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){k[o]=new b(o,1,!1,o.toLowerCase(),null,!0,!0)});function O(o,a,f,p){var v=k.hasOwnProperty(a)?k[a]:null;(v!==null?v.type!==0:p||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(x(a,f,v,p)&&(f=null),p||v===null?g(a)&&(f===null?o.removeAttribute(a):o.setAttribute(a,""+f)):v.mustUseProperty?o[v.propertyName]=f===null?v.type===3?!1:"":f:(a=v.attributeName,p=v.attributeNamespace,f===null?o.removeAttribute(a):(v=v.type,f=v===3||v===4&&f===!0?"":""+f,p?o.setAttributeNS(p,a,f):o.setAttribute(a,f))))}var P=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,N=Symbol.for("react.element"),I=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),X=Symbol.for("react.provider"),Q=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),H=Symbol.for("react.offscreen"),A=Symbol.iterator;function D(o){return o===null||typeof o!="object"?null:(o=A&&o[A]||o["@@iterator"],typeof o=="function"?o:null)}var z=Object.assign,M;function V(o){if(M===void 0)try{throw Error()}catch(f){var a=f.stack.trim().match(/\n( *(at )?)/);M=a&&a[1]||""}return`
|
|
34
|
+
`+M+o}var oe=!1;function ce(o,a){if(!o||oe)return"";oe=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(G){var p=G}Reflect.construct(o,[],a)}else{try{a.call()}catch(G){p=G}o.call(a.prototype)}else{try{throw Error()}catch(G){p=G}o()}}catch(G){if(G&&p&&typeof G.stack=="string"){for(var v=G.stack.split(`
|
|
35
|
+
`),w=p.stack.split(`
|
|
36
|
+
`),E=v.length-1,L=w.length-1;1<=E&&0<=L&&v[E]!==w[L];)L--;for(;1<=E&&0<=L;E--,L--)if(v[E]!==w[L]){if(E!==1||L!==1)do if(E--,L--,0>L||v[E]!==w[L]){var F=`
|
|
37
|
+
`+v[E].replace(" at new "," at ");return o.displayName&&F.includes("<anonymous>")&&(F=F.replace("<anonymous>",o.displayName)),F}while(1<=E&&0<=L);break}}}finally{oe=!1,Error.prepareStackTrace=f}return(o=o?o.displayName||o.name:"")?V(o):""}function he(o){switch(o.tag){case 5:return V(o.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return o=ce(o.type,!1),o;case 11:return o=ce(o.type.render,!1),o;case 1:return o=ce(o.type,!0),o;default:return""}}function se(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case B:return"Fragment";case I:return"Portal";case Z:return"Profiler";case W:return"StrictMode";case j:return"Suspense";case Y:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case Q:return(o.displayName||"Context")+".Consumer";case X:return(o._context.displayName||"Context")+".Provider";case U:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case J:return a=o.displayName||null,a!==null?a:se(o.type)||"Memo";case q:a=o._payload,o=o._init;try{return se(o(a))}catch{}}return null}function fe(o){var a=o.type;switch(o.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=a.render,o=o.displayName||o.name||"",a.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return se(a);case 8:return a===W?"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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function ke(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Oe(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Fe(o){var a=Oe(o)?"checked":"value",f=Object.getOwnPropertyDescriptor(o.constructor.prototype,a),p=""+o[a];if(!o.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var v=f.get,w=f.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return v.call(this)},set:function(E){p=""+E,w.call(this,E)}}),Object.defineProperty(o,a,{enumerable:f.enumerable}),{getValue:function(){return p},setValue:function(E){p=""+E},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function le(o){o._valueTracker||(o._valueTracker=Fe(o))}function Se(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var f=a.getValue(),p="";return o&&(p=Oe(o)?o.checked?"true":"false":o.value),o=p,o!==f?(a.setValue(o),!0):!1}function ve(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function at(o,a){var f=a.checked;return z({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:f??o._wrapperState.initialChecked})}function De(o,a){var f=a.defaultValue==null?"":a.defaultValue,p=a.checked!=null?a.checked:a.defaultChecked;f=ke(a.value!=null?a.value:f),o._wrapperState={initialChecked:p,initialValue:f,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function _e(o,a){a=a.checked,a!=null&&O(o,"checked",a,!1)}function Qe(o,a){_e(o,a);var f=ke(a.value),p=a.type;if(f!=null)p==="number"?(f===0&&o.value===""||o.value!=f)&&(o.value=""+f):o.value!==""+f&&(o.value=""+f);else if(p==="submit"||p==="reset"){o.removeAttribute("value");return}a.hasOwnProperty("value")?$t(o,a.type,f):a.hasOwnProperty("defaultValue")&&$t(o,a.type,ke(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(o.defaultChecked=!!a.defaultChecked)}function At(o,a,f){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var p=a.type;if(!(p!=="submit"&&p!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+o._wrapperState.initialValue,f||a===o.value||(o.value=a),o.defaultValue=a}f=o.name,f!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,f!==""&&(o.name=f)}function $t(o,a,f){(a!=="number"||ve(o.ownerDocument)!==o)&&(f==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+f&&(o.defaultValue=""+f))}var Lt=Array.isArray;function gt(o,a,f,p){if(o=o.options,a){a={};for(var v=0;v<f.length;v++)a["$"+f[v]]=!0;for(f=0;f<o.length;f++)v=a.hasOwnProperty("$"+o[f].value),o[f].selected!==v&&(o[f].selected=v),v&&p&&(o[f].defaultSelected=!0)}else{for(f=""+ke(f),a=null,v=0;v<o.length;v++){if(o[v].value===f){o[v].selected=!0,p&&(o[v].defaultSelected=!0);return}a!==null||o[v].disabled||(a=o[v])}a!==null&&(a.selected=!0)}}function Ve(o,a){if(a.dangerouslySetInnerHTML!=null)throw Error(t(91));return z({},a,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function $e(o,a){var f=a.value;if(f==null){if(f=a.children,a=a.defaultValue,f!=null){if(a!=null)throw Error(t(92));if(Lt(f)){if(1<f.length)throw Error(t(93));f=f[0]}a=f}a==null&&(a=""),f=a}o._wrapperState={initialValue:ke(f)}}function Dt(o,a){var f=ke(a.value),p=ke(a.defaultValue);f!=null&&(f=""+f,f!==o.value&&(o.value=f),a.defaultValue==null&&o.defaultValue!==f&&(o.defaultValue=f)),p!=null&&(o.defaultValue=""+p)}function Me(o){var a=o.textContent;a===o._wrapperState.initialValue&&a!==""&&a!==null&&(o.value=a)}function Pe(o){switch(o){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 Xe(o,a){return o==null||o==="http://www.w3.org/1999/xhtml"?Pe(a):o==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var Ze,tt=function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,f,p,v){MSApp.execUnsafeLocalFunction(function(){return o(a,f,p,v)})}:o}(function(o,a){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=a;else{for(Ze=Ze||document.createElement("div"),Ze.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=Ze.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;a.firstChild;)o.appendChild(a.firstChild)}});function Ye(o,a){if(a){var f=o.firstChild;if(f&&f===o.lastChild&&f.nodeType===3){f.nodeValue=a;return}}o.textContent=a}var Ge={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},Ei=["Webkit","ms","Moz","O"];Object.keys(Ge).forEach(function(o){Ei.forEach(function(a){a=a+o.charAt(0).toUpperCase()+o.substring(1),Ge[a]=Ge[o]})});function Nt(o,a,f){return a==null||typeof a=="boolean"||a===""?"":f||typeof a!="number"||a===0||Ge.hasOwnProperty(o)&&Ge[o]?(""+a).trim():a+"px"}function ct(o,a){o=o.style;for(var f in a)if(a.hasOwnProperty(f)){var p=f.indexOf("--")===0,v=Nt(f,a[f],p);f==="float"&&(f="cssFloat"),p?o.setProperty(f,v):o[f]=v}}var xn=z({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 qn(o,a){if(a){if(xn[o]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(t(137,o));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(t(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(t(61))}if(a.style!=null&&typeof a.style!="object")throw Error(t(62))}}function Kn(o,a){if(o.indexOf("-")===-1)return typeof a.is=="string";switch(o){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 Rr=null;function Ue(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var yt=null,It=null,St=null;function Yr(o){if(o=El(o)){if(typeof yt!="function")throw Error(t(280));var a=o.stateNode;a&&(a=bc(a),yt(o.stateNode,o.type,a))}}function Gr(o){It?St?St.push(o):St=[o]:It=o}function ds(){if(It){var o=It,a=St;if(St=It=null,Yr(o),a)for(o=0;o<a.length;o++)Yr(a[o])}}function Ks(o,a){return o(a)}function Xr(){}var rl=!1;function Ja(o,a,f){if(rl)return o(a,f);rl=!0;try{return Ks(o,a,f)}finally{rl=!1,(It!==null||St!==null)&&(Xr(),ds())}}function ps(o,a){var f=o.stateNode;if(f===null)return null;var p=bc(f);if(p===null)return null;f=p[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(o=o.type,p=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!p;break e;default:o=!1}if(o)return null;if(f&&typeof f!="function")throw Error(t(231,a,typeof f));return f}var il=!1;if(c)try{var Jr={};Object.defineProperty(Jr,"passive",{get:function(){il=!0}}),window.addEventListener("test",Jr,Jr),window.removeEventListener("test",Jr,Jr)}catch{il=!1}function Za(o,a,f,p,v,w,E,L,F){var G=Array.prototype.slice.call(arguments,3);try{a.apply(f,G)}catch(ne){this.onError(ne)}}var ms=!1,Qs=null,Tr=!1,sl=null,gh={onError:function(o){ms=!0,Qs=o}};function yh(o,a,f,p,v,w,E,L,F){ms=!1,Qs=null,Za.apply(gh,arguments)}function ec(o,a,f,p,v,w,E,L,F){if(yh.apply(this,arguments),ms){if(ms){var G=Qs;ms=!1,Qs=null}else throw Error(t(198));Tr||(Tr=!0,sl=G)}}function Mr(o){var a=o,f=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(f=a.return),o=a.return;while(o)}return a.tag===3?f:null}function ol(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function x0(o){if(Mr(o)!==o)throw Error(t(188))}function bC(o){var a=o.alternate;if(!a){if(a=Mr(o),a===null)throw Error(t(188));return a!==o?null:o}for(var f=o,p=a;;){var v=f.return;if(v===null)break;var w=v.alternate;if(w===null){if(p=v.return,p!==null){f=p;continue}break}if(v.child===w.child){for(w=v.child;w;){if(w===f)return x0(v),o;if(w===p)return x0(v),a;w=w.sibling}throw Error(t(188))}if(f.return!==p.return)f=v,p=w;else{for(var E=!1,L=v.child;L;){if(L===f){E=!0,f=v,p=w;break}if(L===p){E=!0,p=v,f=w;break}L=L.sibling}if(!E){for(L=w.child;L;){if(L===f){E=!0,f=w,p=v;break}if(L===p){E=!0,p=w,f=v;break}L=L.sibling}if(!E)throw Error(t(189))}}if(f.alternate!==p)throw Error(t(190))}if(f.tag!==3)throw Error(t(188));return f.stateNode.current===f?o:a}function w0(o){return o=bC(o),o!==null?b0(o):null}function b0(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var a=b0(o);if(a!==null)return a;o=o.sibling}return null}var S0=e.unstable_scheduleCallback,k0=e.unstable_cancelCallback,SC=e.unstable_shouldYield,kC=e.unstable_requestPaint,kt=e.unstable_now,CC=e.unstable_getCurrentPriorityLevel,vh=e.unstable_ImmediatePriority,C0=e.unstable_UserBlockingPriority,tc=e.unstable_NormalPriority,EC=e.unstable_LowPriority,E0=e.unstable_IdlePriority,nc=null,Or=null;function RC(o){if(Or&&typeof Or.onCommitFiberRoot=="function")try{Or.onCommitFiberRoot(nc,o,void 0,(o.current.flags&128)===128)}catch{}}var ur=Math.clz32?Math.clz32:OC,TC=Math.log,MC=Math.LN2;function OC(o){return o>>>=0,o===0?32:31-(TC(o)/MC|0)|0}var rc=64,ic=4194304;function ll(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function sc(o,a){var f=o.pendingLanes;if(f===0)return 0;var p=0,v=o.suspendedLanes,w=o.pingedLanes,E=f&268435455;if(E!==0){var L=E&~v;L!==0?p=ll(L):(w&=E,w!==0&&(p=ll(w)))}else E=f&~v,E!==0?p=ll(E):w!==0&&(p=ll(w));if(p===0)return 0;if(a!==0&&a!==p&&(a&v)===0&&(v=p&-p,w=a&-a,v>=w||v===16&&(w&4194240)!==0))return a;if((p&4)!==0&&(p|=f&16),a=o.entangledLanes,a!==0)for(o=o.entanglements,a&=p;0<a;)f=31-ur(a),v=1<<f,p|=o[f],a&=~v;return p}function PC(o,a){switch(o){case 1:case 2:case 4:return a+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 a+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 AC(o,a){for(var f=o.suspendedLanes,p=o.pingedLanes,v=o.expirationTimes,w=o.pendingLanes;0<w;){var E=31-ur(w),L=1<<E,F=v[E];F===-1?((L&f)===0||(L&p)!==0)&&(v[E]=PC(L,a)):F<=a&&(o.expiredLanes|=L),w&=~L}}function xh(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function R0(){var o=rc;return rc<<=1,(rc&4194240)===0&&(rc=64),o}function wh(o){for(var a=[],f=0;31>f;f++)a.push(o);return a}function al(o,a,f){o.pendingLanes|=a,a!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,a=31-ur(a),o[a]=f}function LC(o,a){var f=o.pendingLanes&~a;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=a,o.mutableReadLanes&=a,o.entangledLanes&=a,a=o.entanglements;var p=o.eventTimes;for(o=o.expirationTimes;0<f;){var v=31-ur(f),w=1<<v;a[v]=0,p[v]=-1,o[v]=-1,f&=~w}}function bh(o,a){var f=o.entangledLanes|=a;for(o=o.entanglements;f;){var p=31-ur(f),v=1<<p;v&a|o[p]&a&&(o[p]|=a),f&=~v}}var et=0;function T0(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var M0,Sh,O0,P0,A0,kh=!1,oc=[],Ri=null,Ti=null,Mi=null,cl=new Map,ul=new Map,Oi=[],DC="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 L0(o,a){switch(o){case"focusin":case"focusout":Ri=null;break;case"dragenter":case"dragleave":Ti=null;break;case"mouseover":case"mouseout":Mi=null;break;case"pointerover":case"pointerout":cl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ul.delete(a.pointerId)}}function fl(o,a,f,p,v,w){return o===null||o.nativeEvent!==w?(o={blockedOn:a,domEventName:f,eventSystemFlags:p,nativeEvent:w,targetContainers:[v]},a!==null&&(a=El(a),a!==null&&Sh(a)),o):(o.eventSystemFlags|=p,a=o.targetContainers,v!==null&&a.indexOf(v)===-1&&a.push(v),o)}function NC(o,a,f,p,v){switch(a){case"focusin":return Ri=fl(Ri,o,a,f,p,v),!0;case"dragenter":return Ti=fl(Ti,o,a,f,p,v),!0;case"mouseover":return Mi=fl(Mi,o,a,f,p,v),!0;case"pointerover":var w=v.pointerId;return cl.set(w,fl(cl.get(w)||null,o,a,f,p,v)),!0;case"gotpointercapture":return w=v.pointerId,ul.set(w,fl(ul.get(w)||null,o,a,f,p,v)),!0}return!1}function D0(o){var a=gs(o.target);if(a!==null){var f=Mr(a);if(f!==null){if(a=f.tag,a===13){if(a=ol(f),a!==null){o.blockedOn=a,A0(o.priority,function(){O0(f)});return}}else if(a===3&&f.stateNode.current.memoizedState.isDehydrated){o.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}o.blockedOn=null}function lc(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var f=Eh(o.domEventName,o.eventSystemFlags,a[0],o.nativeEvent);if(f===null){f=o.nativeEvent;var p=new f.constructor(f.type,f);Rr=p,f.target.dispatchEvent(p),Rr=null}else return a=El(f),a!==null&&Sh(a),o.blockedOn=f,!1;a.shift()}return!0}function N0(o,a,f){lc(o)&&f.delete(a)}function IC(){kh=!1,Ri!==null&&lc(Ri)&&(Ri=null),Ti!==null&&lc(Ti)&&(Ti=null),Mi!==null&&lc(Mi)&&(Mi=null),cl.forEach(N0),ul.forEach(N0)}function hl(o,a){o.blockedOn===a&&(o.blockedOn=null,kh||(kh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,IC)))}function dl(o){function a(v){return hl(v,o)}if(0<oc.length){hl(oc[0],o);for(var f=1;f<oc.length;f++){var p=oc[f];p.blockedOn===o&&(p.blockedOn=null)}}for(Ri!==null&&hl(Ri,o),Ti!==null&&hl(Ti,o),Mi!==null&&hl(Mi,o),cl.forEach(a),ul.forEach(a),f=0;f<Oi.length;f++)p=Oi[f],p.blockedOn===o&&(p.blockedOn=null);for(;0<Oi.length&&(f=Oi[0],f.blockedOn===null);)D0(f),f.blockedOn===null&&Oi.shift()}var Ys=P.ReactCurrentBatchConfig,ac=!0;function BC(o,a,f,p){var v=et,w=Ys.transition;Ys.transition=null;try{et=1,Ch(o,a,f,p)}finally{et=v,Ys.transition=w}}function jC(o,a,f,p){var v=et,w=Ys.transition;Ys.transition=null;try{et=4,Ch(o,a,f,p)}finally{et=v,Ys.transition=w}}function Ch(o,a,f,p){if(ac){var v=Eh(o,a,f,p);if(v===null)Vh(o,a,p,cc,f),L0(o,p);else if(NC(v,o,a,f,p))p.stopPropagation();else if(L0(o,p),a&4&&-1<DC.indexOf(o)){for(;v!==null;){var w=El(v);if(w!==null&&M0(w),w=Eh(o,a,f,p),w===null&&Vh(o,a,p,cc,f),w===v)break;v=w}v!==null&&p.stopPropagation()}else Vh(o,a,p,null,f)}}var cc=null;function Eh(o,a,f,p){if(cc=null,o=Ue(p),o=gs(o),o!==null)if(a=Mr(o),a===null)o=null;else if(f=a.tag,f===13){if(o=ol(a),o!==null)return o;o=null}else if(f===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null);return cc=o,null}function I0(o){switch(o){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(CC()){case vh:return 1;case C0:return 4;case tc:case EC:return 16;case E0:return 536870912;default:return 16}default:return 16}}var Pi=null,Rh=null,uc=null;function B0(){if(uc)return uc;var o,a=Rh,f=a.length,p,v="value"in Pi?Pi.value:Pi.textContent,w=v.length;for(o=0;o<f&&a[o]===v[o];o++);var E=f-o;for(p=1;p<=E&&a[f-p]===v[w-p];p++);return uc=v.slice(o,1<p?1-p:void 0)}function fc(o){var a=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&a===13&&(o=13)):o=a,o===10&&(o=13),32<=o||o===13?o:0}function hc(){return!0}function j0(){return!1}function Dn(o){function a(f,p,v,w,E){this._reactName=f,this._targetInst=v,this.type=p,this.nativeEvent=w,this.target=E,this.currentTarget=null;for(var L in o)o.hasOwnProperty(L)&&(f=o[L],this[L]=f?f(w):w[L]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?hc:j0,this.isPropagationStopped=j0,this}return z(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=hc)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=hc)},persist:function(){},isPersistent:hc}),a}var Gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Th=Dn(Gs),pl=z({},Gs,{view:0,detail:0}),FC=Dn(pl),Mh,Oh,ml,dc=z({},pl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ah,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==ml&&(ml&&o.type==="mousemove"?(Mh=o.screenX-ml.screenX,Oh=o.screenY-ml.screenY):Oh=Mh=0,ml=o),Mh)},movementY:function(o){return"movementY"in o?o.movementY:Oh}}),F0=Dn(dc),zC=z({},dc,{dataTransfer:0}),_C=Dn(zC),WC=z({},pl,{relatedTarget:0}),Ph=Dn(WC),VC=z({},Gs,{animationName:0,elapsedTime:0,pseudoElement:0}),HC=Dn(VC),$C=z({},Gs,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),UC=Dn($C),qC=z({},Gs,{data:0}),z0=Dn(qC),KC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},QC={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"},YC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function GC(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=YC[o])?!!a[o]:!1}function Ah(){return GC}var XC=z({},pl,{key:function(o){if(o.key){var a=KC[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=fc(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?QC[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ah,charCode:function(o){return o.type==="keypress"?fc(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?fc(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),JC=Dn(XC),ZC=z({},dc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_0=Dn(ZC),eE=z({},pl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ah}),tE=Dn(eE),nE=z({},Gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),rE=Dn(nE),iE=z({},dc,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),sE=Dn(iE),oE=[9,13,27,32],Lh=c&&"CompositionEvent"in window,gl=null;c&&"documentMode"in document&&(gl=document.documentMode);var lE=c&&"TextEvent"in window&&!gl,W0=c&&(!Lh||gl&&8<gl&&11>=gl),V0=" ",H0=!1;function $0(o,a){switch(o){case"keyup":return oE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function U0(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Xs=!1;function aE(o,a){switch(o){case"compositionend":return U0(a);case"keypress":return a.which!==32?null:(H0=!0,V0);case"textInput":return o=a.data,o===V0&&H0?null:o;default:return null}}function cE(o,a){if(Xs)return o==="compositionend"||!Lh&&$0(o,a)?(o=B0(),uc=Rh=Pi=null,Xs=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return W0&&a.locale!=="ko"?null:a.data;default:return null}}var uE={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 q0(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!uE[o.type]:a==="textarea"}function K0(o,a,f,p){Gr(p),a=vc(a,"onChange"),0<a.length&&(f=new Th("onChange","change",null,f,p),o.push({event:f,listeners:a}))}var yl=null,vl=null;function fE(o){fy(o,0)}function pc(o){var a=no(o);if(Se(a))return o}function hE(o,a){if(o==="change")return a}var Q0=!1;if(c){var Dh;if(c){var Nh="oninput"in document;if(!Nh){var Y0=document.createElement("div");Y0.setAttribute("oninput","return;"),Nh=typeof Y0.oninput=="function"}Dh=Nh}else Dh=!1;Q0=Dh&&(!document.documentMode||9<document.documentMode)}function G0(){yl&&(yl.detachEvent("onpropertychange",X0),vl=yl=null)}function X0(o){if(o.propertyName==="value"&&pc(vl)){var a=[];K0(a,vl,o,Ue(o)),Ja(fE,a)}}function dE(o,a,f){o==="focusin"?(G0(),yl=a,vl=f,yl.attachEvent("onpropertychange",X0)):o==="focusout"&&G0()}function pE(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return pc(vl)}function mE(o,a){if(o==="click")return pc(a)}function gE(o,a){if(o==="input"||o==="change")return pc(a)}function yE(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var fr=typeof Object.is=="function"?Object.is:yE;function xl(o,a){if(fr(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var f=Object.keys(o),p=Object.keys(a);if(f.length!==p.length)return!1;for(p=0;p<f.length;p++){var v=f[p];if(!u.call(a,v)||!fr(o[v],a[v]))return!1}return!0}function J0(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Z0(o,a){var f=J0(o);o=0;for(var p;f;){if(f.nodeType===3){if(p=o+f.textContent.length,o<=a&&p>=a)return{node:f,offset:a-o};o=p}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=J0(f)}}function ey(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?ey(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function ty(){for(var o=window,a=ve();a instanceof o.HTMLIFrameElement;){try{var f=typeof a.contentWindow.location.href=="string"}catch{f=!1}if(f)o=a.contentWindow;else break;a=ve(o.document)}return a}function Ih(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a&&(a==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||a==="textarea"||o.contentEditable==="true")}function vE(o){var a=ty(),f=o.focusedElem,p=o.selectionRange;if(a!==f&&f&&f.ownerDocument&&ey(f.ownerDocument.documentElement,f)){if(p!==null&&Ih(f)){if(a=p.start,o=p.end,o===void 0&&(o=a),"selectionStart"in f)f.selectionStart=a,f.selectionEnd=Math.min(o,f.value.length);else if(o=(a=f.ownerDocument||document)&&a.defaultView||window,o.getSelection){o=o.getSelection();var v=f.textContent.length,w=Math.min(p.start,v);p=p.end===void 0?w:Math.min(p.end,v),!o.extend&&w>p&&(v=p,p=w,w=v),v=Z0(f,w);var E=Z0(f,p);v&&E&&(o.rangeCount!==1||o.anchorNode!==v.node||o.anchorOffset!==v.offset||o.focusNode!==E.node||o.focusOffset!==E.offset)&&(a=a.createRange(),a.setStart(v.node,v.offset),o.removeAllRanges(),w>p?(o.addRange(a),o.extend(E.node,E.offset)):(a.setEnd(E.node,E.offset),o.addRange(a)))}}for(a=[],o=f;o=o.parentNode;)o.nodeType===1&&a.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;f<a.length;f++)o=a[f],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var xE=c&&"documentMode"in document&&11>=document.documentMode,Js=null,Bh=null,wl=null,jh=!1;function ny(o,a,f){var p=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;jh||Js==null||Js!==ve(p)||(p=Js,"selectionStart"in p&&Ih(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),wl&&xl(wl,p)||(wl=p,p=vc(Bh,"onSelect"),0<p.length&&(a=new Th("onSelect","select",null,a,f),o.push({event:a,listeners:p}),a.target=Js)))}function mc(o,a){var f={};return f[o.toLowerCase()]=a.toLowerCase(),f["Webkit"+o]="webkit"+a,f["Moz"+o]="moz"+a,f}var Zs={animationend:mc("Animation","AnimationEnd"),animationiteration:mc("Animation","AnimationIteration"),animationstart:mc("Animation","AnimationStart"),transitionend:mc("Transition","TransitionEnd")},Fh={},ry={};c&&(ry=document.createElement("div").style,"AnimationEvent"in window||(delete Zs.animationend.animation,delete Zs.animationiteration.animation,delete Zs.animationstart.animation),"TransitionEvent"in window||delete Zs.transitionend.transition);function gc(o){if(Fh[o])return Fh[o];if(!Zs[o])return o;var a=Zs[o],f;for(f in a)if(a.hasOwnProperty(f)&&f in ry)return Fh[o]=a[f];return o}var iy=gc("animationend"),sy=gc("animationiteration"),oy=gc("animationstart"),ly=gc("transitionend"),ay=new Map,cy="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 Ai(o,a){ay.set(o,a),s(a,[o])}for(var zh=0;zh<cy.length;zh++){var _h=cy[zh],wE=_h.toLowerCase(),bE=_h[0].toUpperCase()+_h.slice(1);Ai(wE,"on"+bE)}Ai(iy,"onAnimationEnd"),Ai(sy,"onAnimationIteration"),Ai(oy,"onAnimationStart"),Ai("dblclick","onDoubleClick"),Ai("focusin","onFocus"),Ai("focusout","onBlur"),Ai(ly,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("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 bl="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(" "),SE=new Set("cancel close invalid load scroll toggle".split(" ").concat(bl));function uy(o,a,f){var p=o.type||"unknown-event";o.currentTarget=f,ec(p,a,void 0,o),o.currentTarget=null}function fy(o,a){a=(a&4)!==0;for(var f=0;f<o.length;f++){var p=o[f],v=p.event;p=p.listeners;e:{var w=void 0;if(a)for(var E=p.length-1;0<=E;E--){var L=p[E],F=L.instance,G=L.currentTarget;if(L=L.listener,F!==w&&v.isPropagationStopped())break e;uy(v,L,G),w=F}else for(E=0;E<p.length;E++){if(L=p[E],F=L.instance,G=L.currentTarget,L=L.listener,F!==w&&v.isPropagationStopped())break e;uy(v,L,G),w=F}}}if(Tr)throw o=sl,Tr=!1,sl=null,o}function ut(o,a){var f=a[Qh];f===void 0&&(f=a[Qh]=new Set);var p=o+"__bubble";f.has(p)||(hy(a,o,2,!1),f.add(p))}function Wh(o,a,f){var p=0;a&&(p|=4),hy(f,o,p,a)}var yc="_reactListening"+Math.random().toString(36).slice(2);function Sl(o){if(!o[yc]){o[yc]=!0,r.forEach(function(f){f!=="selectionchange"&&(SE.has(f)||Wh(f,!1,o),Wh(f,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[yc]||(a[yc]=!0,Wh("selectionchange",!1,a))}}function hy(o,a,f,p){switch(I0(a)){case 1:var v=BC;break;case 4:v=jC;break;default:v=Ch}f=v.bind(null,a,f,o),v=void 0,!il||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(v=!0),p?v!==void 0?o.addEventListener(a,f,{capture:!0,passive:v}):o.addEventListener(a,f,!0):v!==void 0?o.addEventListener(a,f,{passive:v}):o.addEventListener(a,f,!1)}function Vh(o,a,f,p,v){var w=p;if((a&1)===0&&(a&2)===0&&p!==null)e:for(;;){if(p===null)return;var E=p.tag;if(E===3||E===4){var L=p.stateNode.containerInfo;if(L===v||L.nodeType===8&&L.parentNode===v)break;if(E===4)for(E=p.return;E!==null;){var F=E.tag;if((F===3||F===4)&&(F=E.stateNode.containerInfo,F===v||F.nodeType===8&&F.parentNode===v))return;E=E.return}for(;L!==null;){if(E=gs(L),E===null)return;if(F=E.tag,F===5||F===6){p=w=E;continue e}L=L.parentNode}}p=p.return}Ja(function(){var G=w,ne=Ue(f),re=[];e:{var te=ay.get(o);if(te!==void 0){var pe=Th,xe=o;switch(o){case"keypress":if(fc(f)===0)break e;case"keydown":case"keyup":pe=JC;break;case"focusin":xe="focus",pe=Ph;break;case"focusout":xe="blur",pe=Ph;break;case"beforeblur":case"afterblur":pe=Ph;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":pe=F0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=_C;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=tE;break;case iy:case sy:case oy:pe=HC;break;case ly:pe=rE;break;case"scroll":pe=FC;break;case"wheel":pe=sE;break;case"copy":case"cut":case"paste":pe=UC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=_0}var we=(a&4)!==0,Ct=!we&&o==="scroll",$=we?te!==null?te+"Capture":null:te;we=[];for(var _=G,K;_!==null;){K=_;var ae=K.stateNode;if(K.tag===5&&ae!==null&&(K=ae,$!==null&&(ae=ps(_,$),ae!=null&&we.push(kl(_,ae,K)))),Ct)break;_=_.return}0<we.length&&(te=new pe(te,xe,null,f,ne),re.push({event:te,listeners:we}))}}if((a&7)===0){e:{if(te=o==="mouseover"||o==="pointerover",pe=o==="mouseout"||o==="pointerout",te&&f!==Rr&&(xe=f.relatedTarget||f.fromElement)&&(gs(xe)||xe[Zr]))break e;if((pe||te)&&(te=ne.window===ne?ne:(te=ne.ownerDocument)?te.defaultView||te.parentWindow:window,pe?(xe=f.relatedTarget||f.toElement,pe=G,xe=xe?gs(xe):null,xe!==null&&(Ct=Mr(xe),xe!==Ct||xe.tag!==5&&xe.tag!==6)&&(xe=null)):(pe=null,xe=G),pe!==xe)){if(we=F0,ae="onMouseLeave",$="onMouseEnter",_="mouse",(o==="pointerout"||o==="pointerover")&&(we=_0,ae="onPointerLeave",$="onPointerEnter",_="pointer"),Ct=pe==null?te:no(pe),K=xe==null?te:no(xe),te=new we(ae,_+"leave",pe,f,ne),te.target=Ct,te.relatedTarget=K,ae=null,gs(ne)===G&&(we=new we($,_+"enter",xe,f,ne),we.target=K,we.relatedTarget=Ct,ae=we),Ct=ae,pe&&xe)t:{for(we=pe,$=xe,_=0,K=we;K;K=eo(K))_++;for(K=0,ae=$;ae;ae=eo(ae))K++;for(;0<_-K;)we=eo(we),_--;for(;0<K-_;)$=eo($),K--;for(;_--;){if(we===$||$!==null&&we===$.alternate)break t;we=eo(we),$=eo($)}we=null}else we=null;pe!==null&&dy(re,te,pe,we,!1),xe!==null&&Ct!==null&&dy(re,Ct,xe,we,!0)}}e:{if(te=G?no(G):window,pe=te.nodeName&&te.nodeName.toLowerCase(),pe==="select"||pe==="input"&&te.type==="file")var be=hE;else if(q0(te))if(Q0)be=gE;else{be=pE;var Re=dE}else(pe=te.nodeName)&&pe.toLowerCase()==="input"&&(te.type==="checkbox"||te.type==="radio")&&(be=mE);if(be&&(be=be(o,G))){K0(re,be,f,ne);break e}Re&&Re(o,te,G),o==="focusout"&&(Re=te._wrapperState)&&Re.controlled&&te.type==="number"&&$t(te,"number",te.value)}switch(Re=G?no(G):window,o){case"focusin":(q0(Re)||Re.contentEditable==="true")&&(Js=Re,Bh=G,wl=null);break;case"focusout":wl=Bh=Js=null;break;case"mousedown":jh=!0;break;case"contextmenu":case"mouseup":case"dragend":jh=!1,ny(re,f,ne);break;case"selectionchange":if(xE)break;case"keydown":case"keyup":ny(re,f,ne)}var Te;if(Lh)e:{switch(o){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else Xs?$0(o,f)&&(Ae="onCompositionEnd"):o==="keydown"&&f.keyCode===229&&(Ae="onCompositionStart");Ae&&(W0&&f.locale!=="ko"&&(Xs||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&Xs&&(Te=B0()):(Pi=ne,Rh="value"in Pi?Pi.value:Pi.textContent,Xs=!0)),Re=vc(G,Ae),0<Re.length&&(Ae=new z0(Ae,o,null,f,ne),re.push({event:Ae,listeners:Re}),Te?Ae.data=Te:(Te=U0(f),Te!==null&&(Ae.data=Te)))),(Te=lE?aE(o,f):cE(o,f))&&(G=vc(G,"onBeforeInput"),0<G.length&&(ne=new z0("onBeforeInput","beforeinput",null,f,ne),re.push({event:ne,listeners:G}),ne.data=Te))}fy(re,a)})}function kl(o,a,f){return{instance:o,listener:a,currentTarget:f}}function vc(o,a){for(var f=a+"Capture",p=[];o!==null;){var v=o,w=v.stateNode;v.tag===5&&w!==null&&(v=w,w=ps(o,f),w!=null&&p.unshift(kl(o,w,v)),w=ps(o,a),w!=null&&p.push(kl(o,w,v))),o=o.return}return p}function eo(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function dy(o,a,f,p,v){for(var w=a._reactName,E=[];f!==null&&f!==p;){var L=f,F=L.alternate,G=L.stateNode;if(F!==null&&F===p)break;L.tag===5&&G!==null&&(L=G,v?(F=ps(f,w),F!=null&&E.unshift(kl(f,F,L))):v||(F=ps(f,w),F!=null&&E.push(kl(f,F,L)))),f=f.return}E.length!==0&&o.push({event:a,listeners:E})}var kE=/\r\n?/g,CE=/\u0000|\uFFFD/g;function py(o){return(typeof o=="string"?o:""+o).replace(kE,`
|
|
38
|
+
`).replace(CE,"")}function xc(o,a,f){if(a=py(a),py(o)!==a&&f)throw Error(t(425))}function wc(){}var Hh=null,$h=null;function Uh(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var qh=typeof setTimeout=="function"?setTimeout:void 0,EE=typeof clearTimeout=="function"?clearTimeout:void 0,my=typeof Promise=="function"?Promise:void 0,RE=typeof queueMicrotask=="function"?queueMicrotask:typeof my<"u"?function(o){return my.resolve(null).then(o).catch(TE)}:qh;function TE(o){setTimeout(function(){throw o})}function Kh(o,a){var f=a,p=0;do{var v=f.nextSibling;if(o.removeChild(f),v&&v.nodeType===8)if(f=v.data,f==="/$"){if(p===0){o.removeChild(v),dl(a);return}p--}else f!=="$"&&f!=="$?"&&f!=="$!"||p++;f=v}while(f);dl(a)}function Li(o){for(;o!=null;o=o.nextSibling){var a=o.nodeType;if(a===1||a===3)break;if(a===8){if(a=o.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return o}function gy(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var f=o.data;if(f==="$"||f==="$!"||f==="$?"){if(a===0)return o;a--}else f==="/$"&&a++}o=o.previousSibling}return null}var to=Math.random().toString(36).slice(2),Pr="__reactFiber$"+to,Cl="__reactProps$"+to,Zr="__reactContainer$"+to,Qh="__reactEvents$"+to,ME="__reactListeners$"+to,OE="__reactHandles$"+to;function gs(o){var a=o[Pr];if(a)return a;for(var f=o.parentNode;f;){if(a=f[Zr]||f[Pr]){if(f=a.alternate,a.child!==null||f!==null&&f.child!==null)for(o=gy(o);o!==null;){if(f=o[Pr])return f;o=gy(o)}return a}o=f,f=o.parentNode}return null}function El(o){return o=o[Pr]||o[Zr],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function no(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(t(33))}function bc(o){return o[Cl]||null}var Yh=[],ro=-1;function Di(o){return{current:o}}function ft(o){0>ro||(o.current=Yh[ro],Yh[ro]=null,ro--)}function ot(o,a){ro++,Yh[ro]=o.current,o.current=a}var Ni={},rn=Di(Ni),wn=Di(!1),ys=Ni;function io(o,a){var f=o.type.contextTypes;if(!f)return Ni;var p=o.stateNode;if(p&&p.__reactInternalMemoizedUnmaskedChildContext===a)return p.__reactInternalMemoizedMaskedChildContext;var v={},w;for(w in f)v[w]=a[w];return p&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=a,o.__reactInternalMemoizedMaskedChildContext=v),v}function bn(o){return o=o.childContextTypes,o!=null}function Sc(){ft(wn),ft(rn)}function yy(o,a,f){if(rn.current!==Ni)throw Error(t(168));ot(rn,a),ot(wn,f)}function vy(o,a,f){var p=o.stateNode;if(a=a.childContextTypes,typeof p.getChildContext!="function")return f;p=p.getChildContext();for(var v in p)if(!(v in a))throw Error(t(108,fe(o)||"Unknown",v));return z({},f,p)}function kc(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Ni,ys=rn.current,ot(rn,o),ot(wn,wn.current),!0}function xy(o,a,f){var p=o.stateNode;if(!p)throw Error(t(169));f?(o=vy(o,a,ys),p.__reactInternalMemoizedMergedChildContext=o,ft(wn),ft(rn),ot(rn,o)):ft(wn),ot(wn,f)}var ei=null,Cc=!1,Gh=!1;function wy(o){ei===null?ei=[o]:ei.push(o)}function PE(o){Cc=!0,wy(o)}function Ii(){if(!Gh&&ei!==null){Gh=!0;var o=0,a=et;try{var f=ei;for(et=1;o<f.length;o++){var p=f[o];do p=p(!0);while(p!==null)}ei=null,Cc=!1}catch(v){throw ei!==null&&(ei=ei.slice(o+1)),S0(vh,Ii),v}finally{et=a,Gh=!1}}return null}var so=[],oo=0,Ec=null,Rc=0,Qn=[],Yn=0,vs=null,ti=1,ni="";function xs(o,a){so[oo++]=Rc,so[oo++]=Ec,Ec=o,Rc=a}function by(o,a,f){Qn[Yn++]=ti,Qn[Yn++]=ni,Qn[Yn++]=vs,vs=o;var p=ti;o=ni;var v=32-ur(p)-1;p&=~(1<<v),f+=1;var w=32-ur(a)+v;if(30<w){var E=v-v%5;w=(p&(1<<E)-1).toString(32),p>>=E,v-=E,ti=1<<32-ur(a)+v|f<<v|p,ni=w+o}else ti=1<<w|f<<v|p,ni=o}function Xh(o){o.return!==null&&(xs(o,1),by(o,1,0))}function Jh(o){for(;o===Ec;)Ec=so[--oo],so[oo]=null,Rc=so[--oo],so[oo]=null;for(;o===vs;)vs=Qn[--Yn],Qn[Yn]=null,ni=Qn[--Yn],Qn[Yn]=null,ti=Qn[--Yn],Qn[Yn]=null}var Nn=null,In=null,dt=!1,hr=null;function Sy(o,a){var f=Zn(5,null,null,0);f.elementType="DELETED",f.stateNode=a,f.return=o,a=o.deletions,a===null?(o.deletions=[f],o.flags|=16):a.push(f)}function ky(o,a){switch(o.tag){case 5:var f=o.type;return a=a.nodeType!==1||f.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(o.stateNode=a,Nn=o,In=Li(a.firstChild),!0):!1;case 6:return a=o.pendingProps===""||a.nodeType!==3?null:a,a!==null?(o.stateNode=a,Nn=o,In=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(f=vs!==null?{id:ti,overflow:ni}:null,o.memoizedState={dehydrated:a,treeContext:f,retryLane:1073741824},f=Zn(18,null,null,0),f.stateNode=a,f.return=o,o.child=f,Nn=o,In=null,!0):!1;default:return!1}}function Zh(o){return(o.mode&1)!==0&&(o.flags&128)===0}function ed(o){if(dt){var a=In;if(a){var f=a;if(!ky(o,a)){if(Zh(o))throw Error(t(418));a=Li(f.nextSibling);var p=Nn;a&&ky(o,a)?Sy(p,f):(o.flags=o.flags&-4097|2,dt=!1,Nn=o)}}else{if(Zh(o))throw Error(t(418));o.flags=o.flags&-4097|2,dt=!1,Nn=o}}}function Cy(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;Nn=o}function Tc(o){if(o!==Nn)return!1;if(!dt)return Cy(o),dt=!0,!1;var a;if((a=o.tag!==3)&&!(a=o.tag!==5)&&(a=o.type,a=a!=="head"&&a!=="body"&&!Uh(o.type,o.memoizedProps)),a&&(a=In)){if(Zh(o))throw Ey(),Error(t(418));for(;a;)Sy(o,a),a=Li(a.nextSibling)}if(Cy(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(t(317));e:{for(o=o.nextSibling,a=0;o;){if(o.nodeType===8){var f=o.data;if(f==="/$"){if(a===0){In=Li(o.nextSibling);break e}a--}else f!=="$"&&f!=="$!"&&f!=="$?"||a++}o=o.nextSibling}In=null}}else In=Nn?Li(o.stateNode.nextSibling):null;return!0}function Ey(){for(var o=In;o;)o=Li(o.nextSibling)}function lo(){In=Nn=null,dt=!1}function td(o){hr===null?hr=[o]:hr.push(o)}var AE=P.ReactCurrentBatchConfig;function Rl(o,a,f){if(o=f.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(f._owner){if(f=f._owner,f){if(f.tag!==1)throw Error(t(309));var p=f.stateNode}if(!p)throw Error(t(147,o));var v=p,w=""+o;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===w?a.ref:(a=function(E){var L=v.refs;E===null?delete L[w]:L[w]=E},a._stringRef=w,a)}if(typeof o!="string")throw Error(t(284));if(!f._owner)throw Error(t(290,o))}return o}function Mc(o,a){throw o=Object.prototype.toString.call(a),Error(t(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o))}function Ry(o){var a=o._init;return a(o._payload)}function Ty(o){function a($,_){if(o){var K=$.deletions;K===null?($.deletions=[_],$.flags|=16):K.push(_)}}function f($,_){if(!o)return null;for(;_!==null;)a($,_),_=_.sibling;return null}function p($,_){for($=new Map;_!==null;)_.key!==null?$.set(_.key,_):$.set(_.index,_),_=_.sibling;return $}function v($,_){return $=Hi($,_),$.index=0,$.sibling=null,$}function w($,_,K){return $.index=K,o?(K=$.alternate,K!==null?(K=K.index,K<_?($.flags|=2,_):K):($.flags|=2,_)):($.flags|=1048576,_)}function E($){return o&&$.alternate===null&&($.flags|=2),$}function L($,_,K,ae){return _===null||_.tag!==6?(_=qd(K,$.mode,ae),_.return=$,_):(_=v(_,K),_.return=$,_)}function F($,_,K,ae){var be=K.type;return be===B?ne($,_,K.props.children,ae,K.key):_!==null&&(_.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===q&&Ry(be)===_.type)?(ae=v(_,K.props),ae.ref=Rl($,_,K),ae.return=$,ae):(ae=Jc(K.type,K.key,K.props,null,$.mode,ae),ae.ref=Rl($,_,K),ae.return=$,ae)}function G($,_,K,ae){return _===null||_.tag!==4||_.stateNode.containerInfo!==K.containerInfo||_.stateNode.implementation!==K.implementation?(_=Kd(K,$.mode,ae),_.return=$,_):(_=v(_,K.children||[]),_.return=$,_)}function ne($,_,K,ae,be){return _===null||_.tag!==7?(_=Ts(K,$.mode,ae,be),_.return=$,_):(_=v(_,K),_.return=$,_)}function re($,_,K){if(typeof _=="string"&&_!==""||typeof _=="number")return _=qd(""+_,$.mode,K),_.return=$,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case N:return K=Jc(_.type,_.key,_.props,null,$.mode,K),K.ref=Rl($,null,_),K.return=$,K;case I:return _=Kd(_,$.mode,K),_.return=$,_;case q:var ae=_._init;return re($,ae(_._payload),K)}if(Lt(_)||D(_))return _=Ts(_,$.mode,K,null),_.return=$,_;Mc($,_)}return null}function te($,_,K,ae){var be=_!==null?_.key:null;if(typeof K=="string"&&K!==""||typeof K=="number")return be!==null?null:L($,_,""+K,ae);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case N:return K.key===be?F($,_,K,ae):null;case I:return K.key===be?G($,_,K,ae):null;case q:return be=K._init,te($,_,be(K._payload),ae)}if(Lt(K)||D(K))return be!==null?null:ne($,_,K,ae,null);Mc($,K)}return null}function pe($,_,K,ae,be){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return $=$.get(K)||null,L(_,$,""+ae,be);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case N:return $=$.get(ae.key===null?K:ae.key)||null,F(_,$,ae,be);case I:return $=$.get(ae.key===null?K:ae.key)||null,G(_,$,ae,be);case q:var Re=ae._init;return pe($,_,K,Re(ae._payload),be)}if(Lt(ae)||D(ae))return $=$.get(K)||null,ne(_,$,ae,be,null);Mc(_,ae)}return null}function xe($,_,K,ae){for(var be=null,Re=null,Te=_,Ae=_=0,Kt=null;Te!==null&&Ae<K.length;Ae++){Te.index>Ae?(Kt=Te,Te=null):Kt=Te.sibling;var qe=te($,Te,K[Ae],ae);if(qe===null){Te===null&&(Te=Kt);break}o&&Te&&qe.alternate===null&&a($,Te),_=w(qe,_,Ae),Re===null?be=qe:Re.sibling=qe,Re=qe,Te=Kt}if(Ae===K.length)return f($,Te),dt&&xs($,Ae),be;if(Te===null){for(;Ae<K.length;Ae++)Te=re($,K[Ae],ae),Te!==null&&(_=w(Te,_,Ae),Re===null?be=Te:Re.sibling=Te,Re=Te);return dt&&xs($,Ae),be}for(Te=p($,Te);Ae<K.length;Ae++)Kt=pe(Te,$,Ae,K[Ae],ae),Kt!==null&&(o&&Kt.alternate!==null&&Te.delete(Kt.key===null?Ae:Kt.key),_=w(Kt,_,Ae),Re===null?be=Kt:Re.sibling=Kt,Re=Kt);return o&&Te.forEach(function($i){return a($,$i)}),dt&&xs($,Ae),be}function we($,_,K,ae){var be=D(K);if(typeof be!="function")throw Error(t(150));if(K=be.call(K),K==null)throw Error(t(151));for(var Re=be=null,Te=_,Ae=_=0,Kt=null,qe=K.next();Te!==null&&!qe.done;Ae++,qe=K.next()){Te.index>Ae?(Kt=Te,Te=null):Kt=Te.sibling;var $i=te($,Te,qe.value,ae);if($i===null){Te===null&&(Te=Kt);break}o&&Te&&$i.alternate===null&&a($,Te),_=w($i,_,Ae),Re===null?be=$i:Re.sibling=$i,Re=$i,Te=Kt}if(qe.done)return f($,Te),dt&&xs($,Ae),be;if(Te===null){for(;!qe.done;Ae++,qe=K.next())qe=re($,qe.value,ae),qe!==null&&(_=w(qe,_,Ae),Re===null?be=qe:Re.sibling=qe,Re=qe);return dt&&xs($,Ae),be}for(Te=p($,Te);!qe.done;Ae++,qe=K.next())qe=pe(Te,$,Ae,qe.value,ae),qe!==null&&(o&&qe.alternate!==null&&Te.delete(qe.key===null?Ae:qe.key),_=w(qe,_,Ae),Re===null?be=qe:Re.sibling=qe,Re=qe);return o&&Te.forEach(function(u4){return a($,u4)}),dt&&xs($,Ae),be}function Ct($,_,K,ae){if(typeof K=="object"&&K!==null&&K.type===B&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case N:e:{for(var be=K.key,Re=_;Re!==null;){if(Re.key===be){if(be=K.type,be===B){if(Re.tag===7){f($,Re.sibling),_=v(Re,K.props.children),_.return=$,$=_;break e}}else if(Re.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===q&&Ry(be)===Re.type){f($,Re.sibling),_=v(Re,K.props),_.ref=Rl($,Re,K),_.return=$,$=_;break e}f($,Re);break}else a($,Re);Re=Re.sibling}K.type===B?(_=Ts(K.props.children,$.mode,ae,K.key),_.return=$,$=_):(ae=Jc(K.type,K.key,K.props,null,$.mode,ae),ae.ref=Rl($,_,K),ae.return=$,$=ae)}return E($);case I:e:{for(Re=K.key;_!==null;){if(_.key===Re)if(_.tag===4&&_.stateNode.containerInfo===K.containerInfo&&_.stateNode.implementation===K.implementation){f($,_.sibling),_=v(_,K.children||[]),_.return=$,$=_;break e}else{f($,_);break}else a($,_);_=_.sibling}_=Kd(K,$.mode,ae),_.return=$,$=_}return E($);case q:return Re=K._init,Ct($,_,Re(K._payload),ae)}if(Lt(K))return xe($,_,K,ae);if(D(K))return we($,_,K,ae);Mc($,K)}return typeof K=="string"&&K!==""||typeof K=="number"?(K=""+K,_!==null&&_.tag===6?(f($,_.sibling),_=v(_,K),_.return=$,$=_):(f($,_),_=qd(K,$.mode,ae),_.return=$,$=_),E($)):f($,_)}return Ct}var ao=Ty(!0),My=Ty(!1),Oc=Di(null),Pc=null,co=null,nd=null;function rd(){nd=co=Pc=null}function id(o){var a=Oc.current;ft(Oc),o._currentValue=a}function sd(o,a,f){for(;o!==null;){var p=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,p!==null&&(p.childLanes|=a)):p!==null&&(p.childLanes&a)!==a&&(p.childLanes|=a),o===f)break;o=o.return}}function uo(o,a){Pc=o,nd=co=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&a)!==0&&(Sn=!0),o.firstContext=null)}function Gn(o){var a=o._currentValue;if(nd!==o)if(o={context:o,memoizedValue:a,next:null},co===null){if(Pc===null)throw Error(t(308));co=o,Pc.dependencies={lanes:0,firstContext:o}}else co=co.next=o;return a}var ws=null;function od(o){ws===null?ws=[o]:ws.push(o)}function Oy(o,a,f,p){var v=a.interleaved;return v===null?(f.next=f,od(a)):(f.next=v.next,v.next=f),a.interleaved=f,ri(o,p)}function ri(o,a){o.lanes|=a;var f=o.alternate;for(f!==null&&(f.lanes|=a),f=o,o=o.return;o!==null;)o.childLanes|=a,f=o.alternate,f!==null&&(f.childLanes|=a),f=o,o=o.return;return f.tag===3?f.stateNode:null}var Bi=!1;function ld(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Py(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function ii(o,a){return{eventTime:o,lane:a,tag:0,payload:null,callback:null,next:null}}function ji(o,a,f){var p=o.updateQueue;if(p===null)return null;if(p=p.shared,(He&2)!==0){var v=p.pending;return v===null?a.next=a:(a.next=v.next,v.next=a),p.pending=a,ri(o,f)}return v=p.interleaved,v===null?(a.next=a,od(p)):(a.next=v.next,v.next=a),p.interleaved=a,ri(o,f)}function Ac(o,a,f){if(a=a.updateQueue,a!==null&&(a=a.shared,(f&4194240)!==0)){var p=a.lanes;p&=o.pendingLanes,f|=p,a.lanes=f,bh(o,f)}}function Ay(o,a){var f=o.updateQueue,p=o.alternate;if(p!==null&&(p=p.updateQueue,f===p)){var v=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var E={eventTime:f.eventTime,lane:f.lane,tag:f.tag,payload:f.payload,callback:f.callback,next:null};w===null?v=w=E:w=w.next=E,f=f.next}while(f!==null);w===null?v=w=a:w=w.next=a}else v=w=a;f={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:w,shared:p.shared,effects:p.effects},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=a:o.next=a,f.lastBaseUpdate=a}function Lc(o,a,f,p){var v=o.updateQueue;Bi=!1;var w=v.firstBaseUpdate,E=v.lastBaseUpdate,L=v.shared.pending;if(L!==null){v.shared.pending=null;var F=L,G=F.next;F.next=null,E===null?w=G:E.next=G,E=F;var ne=o.alternate;ne!==null&&(ne=ne.updateQueue,L=ne.lastBaseUpdate,L!==E&&(L===null?ne.firstBaseUpdate=G:L.next=G,ne.lastBaseUpdate=F))}if(w!==null){var re=v.baseState;E=0,ne=G=F=null,L=w;do{var te=L.lane,pe=L.eventTime;if((p&te)===te){ne!==null&&(ne=ne.next={eventTime:pe,lane:0,tag:L.tag,payload:L.payload,callback:L.callback,next:null});e:{var xe=o,we=L;switch(te=a,pe=f,we.tag){case 1:if(xe=we.payload,typeof xe=="function"){re=xe.call(pe,re,te);break e}re=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=we.payload,te=typeof xe=="function"?xe.call(pe,re,te):xe,te==null)break e;re=z({},re,te);break e;case 2:Bi=!0}}L.callback!==null&&L.lane!==0&&(o.flags|=64,te=v.effects,te===null?v.effects=[L]:te.push(L))}else pe={eventTime:pe,lane:te,tag:L.tag,payload:L.payload,callback:L.callback,next:null},ne===null?(G=ne=pe,F=re):ne=ne.next=pe,E|=te;if(L=L.next,L===null){if(L=v.shared.pending,L===null)break;te=L,L=te.next,te.next=null,v.lastBaseUpdate=te,v.shared.pending=null}}while(!0);if(ne===null&&(F=re),v.baseState=F,v.firstBaseUpdate=G,v.lastBaseUpdate=ne,a=v.shared.interleaved,a!==null){v=a;do E|=v.lane,v=v.next;while(v!==a)}else w===null&&(v.shared.lanes=0);ks|=E,o.lanes=E,o.memoizedState=re}}function Ly(o,a,f){if(o=a.effects,a.effects=null,o!==null)for(a=0;a<o.length;a++){var p=o[a],v=p.callback;if(v!==null){if(p.callback=null,p=f,typeof v!="function")throw Error(t(191,v));v.call(p)}}}var Tl={},Ar=Di(Tl),Ml=Di(Tl),Ol=Di(Tl);function bs(o){if(o===Tl)throw Error(t(174));return o}function ad(o,a){switch(ot(Ol,a),ot(Ml,o),ot(Ar,Tl),o=a.nodeType,o){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:Xe(null,"");break;default:o=o===8?a.parentNode:a,a=o.namespaceURI||null,o=o.tagName,a=Xe(a,o)}ft(Ar),ot(Ar,a)}function fo(){ft(Ar),ft(Ml),ft(Ol)}function Dy(o){bs(Ol.current);var a=bs(Ar.current),f=Xe(a,o.type);a!==f&&(ot(Ml,o),ot(Ar,f))}function cd(o){Ml.current===o&&(ft(Ar),ft(Ml))}var vt=Di(0);function Dc(o){for(var a=o;a!==null;){if(a.tag===13){var f=a.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||f.data==="$?"||f.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var ud=[];function fd(){for(var o=0;o<ud.length;o++)ud[o]._workInProgressVersionPrimary=null;ud.length=0}var Nc=P.ReactCurrentDispatcher,hd=P.ReactCurrentBatchConfig,Ss=0,xt=null,Bt=null,Ut=null,Ic=!1,Pl=!1,Al=0,LE=0;function sn(){throw Error(t(321))}function dd(o,a){if(a===null)return!1;for(var f=0;f<a.length&&f<o.length;f++)if(!fr(o[f],a[f]))return!1;return!0}function pd(o,a,f,p,v,w){if(Ss=w,xt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,Nc.current=o===null||o.memoizedState===null?BE:jE,o=f(p,v),Pl){w=0;do{if(Pl=!1,Al=0,25<=w)throw Error(t(301));w+=1,Ut=Bt=null,a.updateQueue=null,Nc.current=FE,o=f(p,v)}while(Pl)}if(Nc.current=Fc,a=Bt!==null&&Bt.next!==null,Ss=0,Ut=Bt=xt=null,Ic=!1,a)throw Error(t(300));return o}function md(){var o=Al!==0;return Al=0,o}function Lr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ut===null?xt.memoizedState=Ut=o:Ut=Ut.next=o,Ut}function Xn(){if(Bt===null){var o=xt.alternate;o=o!==null?o.memoizedState:null}else o=Bt.next;var a=Ut===null?xt.memoizedState:Ut.next;if(a!==null)Ut=a,Bt=o;else{if(o===null)throw Error(t(310));Bt=o,o={memoizedState:Bt.memoizedState,baseState:Bt.baseState,baseQueue:Bt.baseQueue,queue:Bt.queue,next:null},Ut===null?xt.memoizedState=Ut=o:Ut=Ut.next=o}return Ut}function Ll(o,a){return typeof a=="function"?a(o):a}function gd(o){var a=Xn(),f=a.queue;if(f===null)throw Error(t(311));f.lastRenderedReducer=o;var p=Bt,v=p.baseQueue,w=f.pending;if(w!==null){if(v!==null){var E=v.next;v.next=w.next,w.next=E}p.baseQueue=v=w,f.pending=null}if(v!==null){w=v.next,p=p.baseState;var L=E=null,F=null,G=w;do{var ne=G.lane;if((Ss&ne)===ne)F!==null&&(F=F.next={lane:0,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),p=G.hasEagerState?G.eagerState:o(p,G.action);else{var re={lane:ne,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null};F===null?(L=F=re,E=p):F=F.next=re,xt.lanes|=ne,ks|=ne}G=G.next}while(G!==null&&G!==w);F===null?E=p:F.next=L,fr(p,a.memoizedState)||(Sn=!0),a.memoizedState=p,a.baseState=E,a.baseQueue=F,f.lastRenderedState=p}if(o=f.interleaved,o!==null){v=o;do w=v.lane,xt.lanes|=w,ks|=w,v=v.next;while(v!==o)}else v===null&&(f.lanes=0);return[a.memoizedState,f.dispatch]}function yd(o){var a=Xn(),f=a.queue;if(f===null)throw Error(t(311));f.lastRenderedReducer=o;var p=f.dispatch,v=f.pending,w=a.memoizedState;if(v!==null){f.pending=null;var E=v=v.next;do w=o(w,E.action),E=E.next;while(E!==v);fr(w,a.memoizedState)||(Sn=!0),a.memoizedState=w,a.baseQueue===null&&(a.baseState=w),f.lastRenderedState=w}return[w,p]}function Ny(){}function Iy(o,a){var f=xt,p=Xn(),v=a(),w=!fr(p.memoizedState,v);if(w&&(p.memoizedState=v,Sn=!0),p=p.queue,vd(Fy.bind(null,f,p,o),[o]),p.getSnapshot!==a||w||Ut!==null&&Ut.memoizedState.tag&1){if(f.flags|=2048,Dl(9,jy.bind(null,f,p,v,a),void 0,null),qt===null)throw Error(t(349));(Ss&30)!==0||By(f,a,v)}return v}function By(o,a,f){o.flags|=16384,o={getSnapshot:a,value:f},a=xt.updateQueue,a===null?(a={lastEffect:null,stores:null},xt.updateQueue=a,a.stores=[o]):(f=a.stores,f===null?a.stores=[o]:f.push(o))}function jy(o,a,f,p){a.value=f,a.getSnapshot=p,zy(a)&&_y(o)}function Fy(o,a,f){return f(function(){zy(a)&&_y(o)})}function zy(o){var a=o.getSnapshot;o=o.value;try{var f=a();return!fr(o,f)}catch{return!0}}function _y(o){var a=ri(o,1);a!==null&&gr(a,o,1,-1)}function Wy(o){var a=Lr();return typeof o=="function"&&(o=o()),a.memoizedState=a.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ll,lastRenderedState:o},a.queue=o,o=o.dispatch=IE.bind(null,xt,o),[a.memoizedState,o]}function Dl(o,a,f,p){return o={tag:o,create:a,destroy:f,deps:p,next:null},a=xt.updateQueue,a===null?(a={lastEffect:null,stores:null},xt.updateQueue=a,a.lastEffect=o.next=o):(f=a.lastEffect,f===null?a.lastEffect=o.next=o:(p=f.next,f.next=o,o.next=p,a.lastEffect=o)),o}function Vy(){return Xn().memoizedState}function Bc(o,a,f,p){var v=Lr();xt.flags|=o,v.memoizedState=Dl(1|a,f,void 0,p===void 0?null:p)}function jc(o,a,f,p){var v=Xn();p=p===void 0?null:p;var w=void 0;if(Bt!==null){var E=Bt.memoizedState;if(w=E.destroy,p!==null&&dd(p,E.deps)){v.memoizedState=Dl(a,f,w,p);return}}xt.flags|=o,v.memoizedState=Dl(1|a,f,w,p)}function Hy(o,a){return Bc(8390656,8,o,a)}function vd(o,a){return jc(2048,8,o,a)}function $y(o,a){return jc(4,2,o,a)}function Uy(o,a){return jc(4,4,o,a)}function qy(o,a){if(typeof a=="function")return o=o(),a(o),function(){a(null)};if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function Ky(o,a,f){return f=f!=null?f.concat([o]):null,jc(4,4,qy.bind(null,a,o),f)}function xd(){}function Qy(o,a){var f=Xn();a=a===void 0?null:a;var p=f.memoizedState;return p!==null&&a!==null&&dd(a,p[1])?p[0]:(f.memoizedState=[o,a],o)}function Yy(o,a){var f=Xn();a=a===void 0?null:a;var p=f.memoizedState;return p!==null&&a!==null&&dd(a,p[1])?p[0]:(o=o(),f.memoizedState=[o,a],o)}function Gy(o,a,f){return(Ss&21)===0?(o.baseState&&(o.baseState=!1,Sn=!0),o.memoizedState=f):(fr(f,a)||(f=R0(),xt.lanes|=f,ks|=f,o.baseState=!0),a)}function DE(o,a){var f=et;et=f!==0&&4>f?f:4,o(!0);var p=hd.transition;hd.transition={};try{o(!1),a()}finally{et=f,hd.transition=p}}function Xy(){return Xn().memoizedState}function NE(o,a,f){var p=Wi(o);if(f={lane:p,action:f,hasEagerState:!1,eagerState:null,next:null},Jy(o))Zy(a,f);else if(f=Oy(o,a,f,p),f!==null){var v=hn();gr(f,o,p,v),ev(f,a,p)}}function IE(o,a,f){var p=Wi(o),v={lane:p,action:f,hasEagerState:!1,eagerState:null,next:null};if(Jy(o))Zy(a,v);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=a.lastRenderedReducer,w!==null))try{var E=a.lastRenderedState,L=w(E,f);if(v.hasEagerState=!0,v.eagerState=L,fr(L,E)){var F=a.interleaved;F===null?(v.next=v,od(a)):(v.next=F.next,F.next=v),a.interleaved=v;return}}catch{}finally{}f=Oy(o,a,v,p),f!==null&&(v=hn(),gr(f,o,p,v),ev(f,a,p))}}function Jy(o){var a=o.alternate;return o===xt||a!==null&&a===xt}function Zy(o,a){Pl=Ic=!0;var f=o.pending;f===null?a.next=a:(a.next=f.next,f.next=a),o.pending=a}function ev(o,a,f){if((f&4194240)!==0){var p=a.lanes;p&=o.pendingLanes,f|=p,a.lanes=f,bh(o,f)}}var Fc={readContext:Gn,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useInsertionEffect:sn,useLayoutEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useMutableSource:sn,useSyncExternalStore:sn,useId:sn,unstable_isNewReconciler:!1},BE={readContext:Gn,useCallback:function(o,a){return Lr().memoizedState=[o,a===void 0?null:a],o},useContext:Gn,useEffect:Hy,useImperativeHandle:function(o,a,f){return f=f!=null?f.concat([o]):null,Bc(4194308,4,qy.bind(null,a,o),f)},useLayoutEffect:function(o,a){return Bc(4194308,4,o,a)},useInsertionEffect:function(o,a){return Bc(4,2,o,a)},useMemo:function(o,a){var f=Lr();return a=a===void 0?null:a,o=o(),f.memoizedState=[o,a],o},useReducer:function(o,a,f){var p=Lr();return a=f!==void 0?f(a):a,p.memoizedState=p.baseState=a,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:a},p.queue=o,o=o.dispatch=NE.bind(null,xt,o),[p.memoizedState,o]},useRef:function(o){var a=Lr();return o={current:o},a.memoizedState=o},useState:Wy,useDebugValue:xd,useDeferredValue:function(o){return Lr().memoizedState=o},useTransition:function(){var o=Wy(!1),a=o[0];return o=DE.bind(null,o[1]),Lr().memoizedState=o,[a,o]},useMutableSource:function(){},useSyncExternalStore:function(o,a,f){var p=xt,v=Lr();if(dt){if(f===void 0)throw Error(t(407));f=f()}else{if(f=a(),qt===null)throw Error(t(349));(Ss&30)!==0||By(p,a,f)}v.memoizedState=f;var w={value:f,getSnapshot:a};return v.queue=w,Hy(Fy.bind(null,p,w,o),[o]),p.flags|=2048,Dl(9,jy.bind(null,p,w,f,a),void 0,null),f},useId:function(){var o=Lr(),a=qt.identifierPrefix;if(dt){var f=ni,p=ti;f=(p&~(1<<32-ur(p)-1)).toString(32)+f,a=":"+a+"R"+f,f=Al++,0<f&&(a+="H"+f.toString(32)),a+=":"}else f=LE++,a=":"+a+"r"+f.toString(32)+":";return o.memoizedState=a},unstable_isNewReconciler:!1},jE={readContext:Gn,useCallback:Qy,useContext:Gn,useEffect:vd,useImperativeHandle:Ky,useInsertionEffect:$y,useLayoutEffect:Uy,useMemo:Yy,useReducer:gd,useRef:Vy,useState:function(){return gd(Ll)},useDebugValue:xd,useDeferredValue:function(o){var a=Xn();return Gy(a,Bt.memoizedState,o)},useTransition:function(){var o=gd(Ll)[0],a=Xn().memoizedState;return[o,a]},useMutableSource:Ny,useSyncExternalStore:Iy,useId:Xy,unstable_isNewReconciler:!1},FE={readContext:Gn,useCallback:Qy,useContext:Gn,useEffect:vd,useImperativeHandle:Ky,useInsertionEffect:$y,useLayoutEffect:Uy,useMemo:Yy,useReducer:yd,useRef:Vy,useState:function(){return yd(Ll)},useDebugValue:xd,useDeferredValue:function(o){var a=Xn();return Bt===null?a.memoizedState=o:Gy(a,Bt.memoizedState,o)},useTransition:function(){var o=yd(Ll)[0],a=Xn().memoizedState;return[o,a]},useMutableSource:Ny,useSyncExternalStore:Iy,useId:Xy,unstable_isNewReconciler:!1};function dr(o,a){if(o&&o.defaultProps){a=z({},a),o=o.defaultProps;for(var f in o)a[f]===void 0&&(a[f]=o[f]);return a}return a}function wd(o,a,f,p){a=o.memoizedState,f=f(p,a),f=f==null?a:z({},a,f),o.memoizedState=f,o.lanes===0&&(o.updateQueue.baseState=f)}var zc={isMounted:function(o){return(o=o._reactInternals)?Mr(o)===o:!1},enqueueSetState:function(o,a,f){o=o._reactInternals;var p=hn(),v=Wi(o),w=ii(p,v);w.payload=a,f!=null&&(w.callback=f),a=ji(o,w,v),a!==null&&(gr(a,o,v,p),Ac(a,o,v))},enqueueReplaceState:function(o,a,f){o=o._reactInternals;var p=hn(),v=Wi(o),w=ii(p,v);w.tag=1,w.payload=a,f!=null&&(w.callback=f),a=ji(o,w,v),a!==null&&(gr(a,o,v,p),Ac(a,o,v))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var f=hn(),p=Wi(o),v=ii(f,p);v.tag=2,a!=null&&(v.callback=a),a=ji(o,v,p),a!==null&&(gr(a,o,p,f),Ac(a,o,p))}};function tv(o,a,f,p,v,w,E){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(p,w,E):a.prototype&&a.prototype.isPureReactComponent?!xl(f,p)||!xl(v,w):!0}function nv(o,a,f){var p=!1,v=Ni,w=a.contextType;return typeof w=="object"&&w!==null?w=Gn(w):(v=bn(a)?ys:rn.current,p=a.contextTypes,w=(p=p!=null)?io(o,v):Ni),a=new a(f,w),o.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=zc,o.stateNode=a,a._reactInternals=o,p&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=v,o.__reactInternalMemoizedMaskedChildContext=w),a}function rv(o,a,f,p){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(f,p),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(f,p),a.state!==o&&zc.enqueueReplaceState(a,a.state,null)}function bd(o,a,f,p){var v=o.stateNode;v.props=f,v.state=o.memoizedState,v.refs={},ld(o);var w=a.contextType;typeof w=="object"&&w!==null?v.context=Gn(w):(w=bn(a)?ys:rn.current,v.context=io(o,w)),v.state=o.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(wd(o,a,w,f),v.state=o.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(a=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),a!==v.state&&zc.enqueueReplaceState(v,v.state,null),Lc(o,f,v,p),v.state=o.memoizedState),typeof v.componentDidMount=="function"&&(o.flags|=4194308)}function ho(o,a){try{var f="",p=a;do f+=he(p),p=p.return;while(p);var v=f}catch(w){v=`
|
|
39
|
+
Error generating stack: `+w.message+`
|
|
40
|
+
`+w.stack}return{value:o,source:a,stack:v,digest:null}}function Sd(o,a,f){return{value:o,source:null,stack:f??null,digest:a??null}}function kd(o,a){try{console.error(a.value)}catch(f){setTimeout(function(){throw f})}}var zE=typeof WeakMap=="function"?WeakMap:Map;function iv(o,a,f){f=ii(-1,f),f.tag=3,f.payload={element:null};var p=a.value;return f.callback=function(){qc||(qc=!0,Fd=p),kd(o,a)},f}function sv(o,a,f){f=ii(-1,f),f.tag=3;var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var v=a.value;f.payload=function(){return p(v)},f.callback=function(){kd(o,a)}}var w=o.stateNode;return w!==null&&typeof w.componentDidCatch=="function"&&(f.callback=function(){kd(o,a),typeof p!="function"&&(zi===null?zi=new Set([this]):zi.add(this));var E=a.stack;this.componentDidCatch(a.value,{componentStack:E!==null?E:""})}),f}function ov(o,a,f){var p=o.pingCache;if(p===null){p=o.pingCache=new zE;var v=new Set;p.set(a,v)}else v=p.get(a),v===void 0&&(v=new Set,p.set(a,v));v.has(f)||(v.add(f),o=ZE.bind(null,o,a,f),a.then(o,o))}function lv(o){do{var a;if((a=o.tag===13)&&(a=o.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return o;o=o.return}while(o!==null);return null}function av(o,a,f,p,v){return(o.mode&1)===0?(o===a?o.flags|=65536:(o.flags|=128,f.flags|=131072,f.flags&=-52805,f.tag===1&&(f.alternate===null?f.tag=17:(a=ii(-1,1),a.tag=2,ji(f,a,1))),f.lanes|=1),o):(o.flags|=65536,o.lanes=v,o)}var _E=P.ReactCurrentOwner,Sn=!1;function fn(o,a,f,p){a.child=o===null?My(a,null,f,p):ao(a,o.child,f,p)}function cv(o,a,f,p,v){f=f.render;var w=a.ref;return uo(a,v),p=pd(o,a,f,p,w,v),f=md(),o!==null&&!Sn?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~v,si(o,a,v)):(dt&&f&&Xh(a),a.flags|=1,fn(o,a,p,v),a.child)}function uv(o,a,f,p,v){if(o===null){var w=f.type;return typeof w=="function"&&!Ud(w)&&w.defaultProps===void 0&&f.compare===null&&f.defaultProps===void 0?(a.tag=15,a.type=w,fv(o,a,w,p,v)):(o=Jc(f.type,null,p,a,a.mode,v),o.ref=a.ref,o.return=a,a.child=o)}if(w=o.child,(o.lanes&v)===0){var E=w.memoizedProps;if(f=f.compare,f=f!==null?f:xl,f(E,p)&&o.ref===a.ref)return si(o,a,v)}return a.flags|=1,o=Hi(w,p),o.ref=a.ref,o.return=a,a.child=o}function fv(o,a,f,p,v){if(o!==null){var w=o.memoizedProps;if(xl(w,p)&&o.ref===a.ref)if(Sn=!1,a.pendingProps=p=w,(o.lanes&v)!==0)(o.flags&131072)!==0&&(Sn=!0);else return a.lanes=o.lanes,si(o,a,v)}return Cd(o,a,f,p,v)}function hv(o,a,f){var p=a.pendingProps,v=p.children,w=o!==null?o.memoizedState:null;if(p.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},ot(mo,Bn),Bn|=f;else{if((f&1073741824)===0)return o=w!==null?w.baseLanes|f:f,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:o,cachePool:null,transitions:null},a.updateQueue=null,ot(mo,Bn),Bn|=o,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},p=w!==null?w.baseLanes:f,ot(mo,Bn),Bn|=p}else w!==null?(p=w.baseLanes|f,a.memoizedState=null):p=f,ot(mo,Bn),Bn|=p;return fn(o,a,v,f),a.child}function dv(o,a){var f=a.ref;(o===null&&f!==null||o!==null&&o.ref!==f)&&(a.flags|=512,a.flags|=2097152)}function Cd(o,a,f,p,v){var w=bn(f)?ys:rn.current;return w=io(a,w),uo(a,v),f=pd(o,a,f,p,w,v),p=md(),o!==null&&!Sn?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~v,si(o,a,v)):(dt&&p&&Xh(a),a.flags|=1,fn(o,a,f,v),a.child)}function pv(o,a,f,p,v){if(bn(f)){var w=!0;kc(a)}else w=!1;if(uo(a,v),a.stateNode===null)Wc(o,a),nv(a,f,p),bd(a,f,p,v),p=!0;else if(o===null){var E=a.stateNode,L=a.memoizedProps;E.props=L;var F=E.context,G=f.contextType;typeof G=="object"&&G!==null?G=Gn(G):(G=bn(f)?ys:rn.current,G=io(a,G));var ne=f.getDerivedStateFromProps,re=typeof ne=="function"||typeof E.getSnapshotBeforeUpdate=="function";re||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(L!==p||F!==G)&&rv(a,E,p,G),Bi=!1;var te=a.memoizedState;E.state=te,Lc(a,p,E,v),F=a.memoizedState,L!==p||te!==F||wn.current||Bi?(typeof ne=="function"&&(wd(a,f,ne,p),F=a.memoizedState),(L=Bi||tv(a,f,L,p,te,F,G))?(re||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(a.flags|=4194308)):(typeof E.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=p,a.memoizedState=F),E.props=p,E.state=F,E.context=G,p=L):(typeof E.componentDidMount=="function"&&(a.flags|=4194308),p=!1)}else{E=a.stateNode,Py(o,a),L=a.memoizedProps,G=a.type===a.elementType?L:dr(a.type,L),E.props=G,re=a.pendingProps,te=E.context,F=f.contextType,typeof F=="object"&&F!==null?F=Gn(F):(F=bn(f)?ys:rn.current,F=io(a,F));var pe=f.getDerivedStateFromProps;(ne=typeof pe=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(L!==re||te!==F)&&rv(a,E,p,F),Bi=!1,te=a.memoizedState,E.state=te,Lc(a,p,E,v);var xe=a.memoizedState;L!==re||te!==xe||wn.current||Bi?(typeof pe=="function"&&(wd(a,f,pe,p),xe=a.memoizedState),(G=Bi||tv(a,f,G,p,te,xe,F)||!1)?(ne||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(p,xe,F),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(p,xe,F)),typeof E.componentDidUpdate=="function"&&(a.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof E.componentDidUpdate!="function"||L===o.memoizedProps&&te===o.memoizedState||(a.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||L===o.memoizedProps&&te===o.memoizedState||(a.flags|=1024),a.memoizedProps=p,a.memoizedState=xe),E.props=p,E.state=xe,E.context=F,p=G):(typeof E.componentDidUpdate!="function"||L===o.memoizedProps&&te===o.memoizedState||(a.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||L===o.memoizedProps&&te===o.memoizedState||(a.flags|=1024),p=!1)}return Ed(o,a,f,p,w,v)}function Ed(o,a,f,p,v,w){dv(o,a);var E=(a.flags&128)!==0;if(!p&&!E)return v&&xy(a,f,!1),si(o,a,w);p=a.stateNode,_E.current=a;var L=E&&typeof f.getDerivedStateFromError!="function"?null:p.render();return a.flags|=1,o!==null&&E?(a.child=ao(a,o.child,null,w),a.child=ao(a,null,L,w)):fn(o,a,L,w),a.memoizedState=p.state,v&&xy(a,f,!0),a.child}function mv(o){var a=o.stateNode;a.pendingContext?yy(o,a.pendingContext,a.pendingContext!==a.context):a.context&&yy(o,a.context,!1),ad(o,a.containerInfo)}function gv(o,a,f,p,v){return lo(),td(v),a.flags|=256,fn(o,a,f,p),a.child}var Rd={dehydrated:null,treeContext:null,retryLane:0};function Td(o){return{baseLanes:o,cachePool:null,transitions:null}}function yv(o,a,f){var p=a.pendingProps,v=vt.current,w=!1,E=(a.flags&128)!==0,L;if((L=E)||(L=o!==null&&o.memoizedState===null?!1:(v&2)!==0),L?(w=!0,a.flags&=-129):(o===null||o.memoizedState!==null)&&(v|=1),ot(vt,v&1),o===null)return ed(a),o=a.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((a.mode&1)===0?a.lanes=1:o.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(E=p.children,o=p.fallback,w?(p=a.mode,w=a.child,E={mode:"hidden",children:E},(p&1)===0&&w!==null?(w.childLanes=0,w.pendingProps=E):w=Zc(E,p,0,null),o=Ts(o,p,f,null),w.return=a,o.return=a,w.sibling=o,a.child=w,a.child.memoizedState=Td(f),a.memoizedState=Rd,o):Md(a,E));if(v=o.memoizedState,v!==null&&(L=v.dehydrated,L!==null))return WE(o,a,E,p,L,v,f);if(w){w=p.fallback,E=a.mode,v=o.child,L=v.sibling;var F={mode:"hidden",children:p.children};return(E&1)===0&&a.child!==v?(p=a.child,p.childLanes=0,p.pendingProps=F,a.deletions=null):(p=Hi(v,F),p.subtreeFlags=v.subtreeFlags&14680064),L!==null?w=Hi(L,w):(w=Ts(w,E,f,null),w.flags|=2),w.return=a,p.return=a,p.sibling=w,a.child=p,p=w,w=a.child,E=o.child.memoizedState,E=E===null?Td(f):{baseLanes:E.baseLanes|f,cachePool:null,transitions:E.transitions},w.memoizedState=E,w.childLanes=o.childLanes&~f,a.memoizedState=Rd,p}return w=o.child,o=w.sibling,p=Hi(w,{mode:"visible",children:p.children}),(a.mode&1)===0&&(p.lanes=f),p.return=a,p.sibling=null,o!==null&&(f=a.deletions,f===null?(a.deletions=[o],a.flags|=16):f.push(o)),a.child=p,a.memoizedState=null,p}function Md(o,a){return a=Zc({mode:"visible",children:a},o.mode,0,null),a.return=o,o.child=a}function _c(o,a,f,p){return p!==null&&td(p),ao(a,o.child,null,f),o=Md(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function WE(o,a,f,p,v,w,E){if(f)return a.flags&256?(a.flags&=-257,p=Sd(Error(t(422))),_c(o,a,E,p)):a.memoizedState!==null?(a.child=o.child,a.flags|=128,null):(w=p.fallback,v=a.mode,p=Zc({mode:"visible",children:p.children},v,0,null),w=Ts(w,v,E,null),w.flags|=2,p.return=a,w.return=a,p.sibling=w,a.child=p,(a.mode&1)!==0&&ao(a,o.child,null,E),a.child.memoizedState=Td(E),a.memoizedState=Rd,w);if((a.mode&1)===0)return _c(o,a,E,null);if(v.data==="$!"){if(p=v.nextSibling&&v.nextSibling.dataset,p)var L=p.dgst;return p=L,w=Error(t(419)),p=Sd(w,p,void 0),_c(o,a,E,p)}if(L=(E&o.childLanes)!==0,Sn||L){if(p=qt,p!==null){switch(E&-E){case 4:v=2;break;case 16:v=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:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(p.suspendedLanes|E))!==0?0:v,v!==0&&v!==w.retryLane&&(w.retryLane=v,ri(o,v),gr(p,o,v,-1))}return $d(),p=Sd(Error(t(421))),_c(o,a,E,p)}return v.data==="$?"?(a.flags|=128,a.child=o.child,a=e4.bind(null,o),v._reactRetry=a,null):(o=w.treeContext,In=Li(v.nextSibling),Nn=a,dt=!0,hr=null,o!==null&&(Qn[Yn++]=ti,Qn[Yn++]=ni,Qn[Yn++]=vs,ti=o.id,ni=o.overflow,vs=a),a=Md(a,p.children),a.flags|=4096,a)}function vv(o,a,f){o.lanes|=a;var p=o.alternate;p!==null&&(p.lanes|=a),sd(o.return,a,f)}function Od(o,a,f,p,v){var w=o.memoizedState;w===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:p,tail:f,tailMode:v}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=p,w.tail=f,w.tailMode=v)}function xv(o,a,f){var p=a.pendingProps,v=p.revealOrder,w=p.tail;if(fn(o,a,p.children,f),p=vt.current,(p&2)!==0)p=p&1|2,a.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&vv(o,f,a);else if(o.tag===19)vv(o,f,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}p&=1}if(ot(vt,p),(a.mode&1)===0)a.memoizedState=null;else switch(v){case"forwards":for(f=a.child,v=null;f!==null;)o=f.alternate,o!==null&&Dc(o)===null&&(v=f),f=f.sibling;f=v,f===null?(v=a.child,a.child=null):(v=f.sibling,f.sibling=null),Od(a,!1,v,f,w);break;case"backwards":for(f=null,v=a.child,a.child=null;v!==null;){if(o=v.alternate,o!==null&&Dc(o)===null){a.child=v;break}o=v.sibling,v.sibling=f,f=v,v=o}Od(a,!0,f,null,w);break;case"together":Od(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Wc(o,a){(a.mode&1)===0&&o!==null&&(o.alternate=null,a.alternate=null,a.flags|=2)}function si(o,a,f){if(o!==null&&(a.dependencies=o.dependencies),ks|=a.lanes,(f&a.childLanes)===0)return null;if(o!==null&&a.child!==o.child)throw Error(t(153));if(a.child!==null){for(o=a.child,f=Hi(o,o.pendingProps),a.child=f,f.return=a;o.sibling!==null;)o=o.sibling,f=f.sibling=Hi(o,o.pendingProps),f.return=a;f.sibling=null}return a.child}function VE(o,a,f){switch(a.tag){case 3:mv(a),lo();break;case 5:Dy(a);break;case 1:bn(a.type)&&kc(a);break;case 4:ad(a,a.stateNode.containerInfo);break;case 10:var p=a.type._context,v=a.memoizedProps.value;ot(Oc,p._currentValue),p._currentValue=v;break;case 13:if(p=a.memoizedState,p!==null)return p.dehydrated!==null?(ot(vt,vt.current&1),a.flags|=128,null):(f&a.child.childLanes)!==0?yv(o,a,f):(ot(vt,vt.current&1),o=si(o,a,f),o!==null?o.sibling:null);ot(vt,vt.current&1);break;case 19:if(p=(f&a.childLanes)!==0,(o.flags&128)!==0){if(p)return xv(o,a,f);a.flags|=128}if(v=a.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),ot(vt,vt.current),p)break;return null;case 22:case 23:return a.lanes=0,hv(o,a,f)}return si(o,a,f)}var wv,Pd,bv,Sv;wv=function(o,a){for(var f=a.child;f!==null;){if(f.tag===5||f.tag===6)o.appendChild(f.stateNode);else if(f.tag!==4&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===a)break;for(;f.sibling===null;){if(f.return===null||f.return===a)return;f=f.return}f.sibling.return=f.return,f=f.sibling}},Pd=function(){},bv=function(o,a,f,p){var v=o.memoizedProps;if(v!==p){o=a.stateNode,bs(Ar.current);var w=null;switch(f){case"input":v=at(o,v),p=at(o,p),w=[];break;case"select":v=z({},v,{value:void 0}),p=z({},p,{value:void 0}),w=[];break;case"textarea":v=Ve(o,v),p=Ve(o,p),w=[];break;default:typeof v.onClick!="function"&&typeof p.onClick=="function"&&(o.onclick=wc)}qn(f,p);var E;f=null;for(G in v)if(!p.hasOwnProperty(G)&&v.hasOwnProperty(G)&&v[G]!=null)if(G==="style"){var L=v[G];for(E in L)L.hasOwnProperty(E)&&(f||(f={}),f[E]="")}else G!=="dangerouslySetInnerHTML"&&G!=="children"&&G!=="suppressContentEditableWarning"&&G!=="suppressHydrationWarning"&&G!=="autoFocus"&&(i.hasOwnProperty(G)?w||(w=[]):(w=w||[]).push(G,null));for(G in p){var F=p[G];if(L=v!=null?v[G]:void 0,p.hasOwnProperty(G)&&F!==L&&(F!=null||L!=null))if(G==="style")if(L){for(E in L)!L.hasOwnProperty(E)||F&&F.hasOwnProperty(E)||(f||(f={}),f[E]="");for(E in F)F.hasOwnProperty(E)&&L[E]!==F[E]&&(f||(f={}),f[E]=F[E])}else f||(w||(w=[]),w.push(G,f)),f=F;else G==="dangerouslySetInnerHTML"?(F=F?F.__html:void 0,L=L?L.__html:void 0,F!=null&&L!==F&&(w=w||[]).push(G,F)):G==="children"?typeof F!="string"&&typeof F!="number"||(w=w||[]).push(G,""+F):G!=="suppressContentEditableWarning"&&G!=="suppressHydrationWarning"&&(i.hasOwnProperty(G)?(F!=null&&G==="onScroll"&&ut("scroll",o),w||L===F||(w=[])):(w=w||[]).push(G,F))}f&&(w=w||[]).push("style",f);var G=w;(a.updateQueue=G)&&(a.flags|=4)}},Sv=function(o,a,f,p){f!==p&&(a.flags|=4)};function Nl(o,a){if(!dt)switch(o.tailMode){case"hidden":a=o.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?o.tail=null:f.sibling=null;break;case"collapsed":f=o.tail;for(var p=null;f!==null;)f.alternate!==null&&(p=f),f=f.sibling;p===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:p.sibling=null}}function on(o){var a=o.alternate!==null&&o.alternate.child===o.child,f=0,p=0;if(a)for(var v=o.child;v!==null;)f|=v.lanes|v.childLanes,p|=v.subtreeFlags&14680064,p|=v.flags&14680064,v.return=o,v=v.sibling;else for(v=o.child;v!==null;)f|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=o,v=v.sibling;return o.subtreeFlags|=p,o.childLanes=f,a}function HE(o,a,f){var p=a.pendingProps;switch(Jh(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return on(a),null;case 1:return bn(a.type)&&Sc(),on(a),null;case 3:return p=a.stateNode,fo(),ft(wn),ft(rn),fd(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(o===null||o.child===null)&&(Tc(a)?a.flags|=4:o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,hr!==null&&(Wd(hr),hr=null))),Pd(o,a),on(a),null;case 5:cd(a);var v=bs(Ol.current);if(f=a.type,o!==null&&a.stateNode!=null)bv(o,a,f,p,v),o.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!p){if(a.stateNode===null)throw Error(t(166));return on(a),null}if(o=bs(Ar.current),Tc(a)){p=a.stateNode,f=a.type;var w=a.memoizedProps;switch(p[Pr]=a,p[Cl]=w,o=(a.mode&1)!==0,f){case"dialog":ut("cancel",p),ut("close",p);break;case"iframe":case"object":case"embed":ut("load",p);break;case"video":case"audio":for(v=0;v<bl.length;v++)ut(bl[v],p);break;case"source":ut("error",p);break;case"img":case"image":case"link":ut("error",p),ut("load",p);break;case"details":ut("toggle",p);break;case"input":De(p,w),ut("invalid",p);break;case"select":p._wrapperState={wasMultiple:!!w.multiple},ut("invalid",p);break;case"textarea":$e(p,w),ut("invalid",p)}qn(f,w),v=null;for(var E in w)if(w.hasOwnProperty(E)){var L=w[E];E==="children"?typeof L=="string"?p.textContent!==L&&(w.suppressHydrationWarning!==!0&&xc(p.textContent,L,o),v=["children",L]):typeof L=="number"&&p.textContent!==""+L&&(w.suppressHydrationWarning!==!0&&xc(p.textContent,L,o),v=["children",""+L]):i.hasOwnProperty(E)&&L!=null&&E==="onScroll"&&ut("scroll",p)}switch(f){case"input":le(p),At(p,w,!0);break;case"textarea":le(p),Me(p);break;case"select":case"option":break;default:typeof w.onClick=="function"&&(p.onclick=wc)}p=v,a.updateQueue=p,p!==null&&(a.flags|=4)}else{E=v.nodeType===9?v:v.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=Pe(f)),o==="http://www.w3.org/1999/xhtml"?f==="script"?(o=E.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof p.is=="string"?o=E.createElement(f,{is:p.is}):(o=E.createElement(f),f==="select"&&(E=o,p.multiple?E.multiple=!0:p.size&&(E.size=p.size))):o=E.createElementNS(o,f),o[Pr]=a,o[Cl]=p,wv(o,a,!1,!1),a.stateNode=o;e:{switch(E=Kn(f,p),f){case"dialog":ut("cancel",o),ut("close",o),v=p;break;case"iframe":case"object":case"embed":ut("load",o),v=p;break;case"video":case"audio":for(v=0;v<bl.length;v++)ut(bl[v],o);v=p;break;case"source":ut("error",o),v=p;break;case"img":case"image":case"link":ut("error",o),ut("load",o),v=p;break;case"details":ut("toggle",o),v=p;break;case"input":De(o,p),v=at(o,p),ut("invalid",o);break;case"option":v=p;break;case"select":o._wrapperState={wasMultiple:!!p.multiple},v=z({},p,{value:void 0}),ut("invalid",o);break;case"textarea":$e(o,p),v=Ve(o,p),ut("invalid",o);break;default:v=p}qn(f,v),L=v;for(w in L)if(L.hasOwnProperty(w)){var F=L[w];w==="style"?ct(o,F):w==="dangerouslySetInnerHTML"?(F=F?F.__html:void 0,F!=null&&tt(o,F)):w==="children"?typeof F=="string"?(f!=="textarea"||F!=="")&&Ye(o,F):typeof F=="number"&&Ye(o,""+F):w!=="suppressContentEditableWarning"&&w!=="suppressHydrationWarning"&&w!=="autoFocus"&&(i.hasOwnProperty(w)?F!=null&&w==="onScroll"&&ut("scroll",o):F!=null&&O(o,w,F,E))}switch(f){case"input":le(o),At(o,p,!1);break;case"textarea":le(o),Me(o);break;case"option":p.value!=null&&o.setAttribute("value",""+ke(p.value));break;case"select":o.multiple=!!p.multiple,w=p.value,w!=null?gt(o,!!p.multiple,w,!1):p.defaultValue!=null&>(o,!!p.multiple,p.defaultValue,!0);break;default:typeof v.onClick=="function"&&(o.onclick=wc)}switch(f){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}}p&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return on(a),null;case 6:if(o&&a.stateNode!=null)Sv(o,a,o.memoizedProps,p);else{if(typeof p!="string"&&a.stateNode===null)throw Error(t(166));if(f=bs(Ol.current),bs(Ar.current),Tc(a)){if(p=a.stateNode,f=a.memoizedProps,p[Pr]=a,(w=p.nodeValue!==f)&&(o=Nn,o!==null))switch(o.tag){case 3:xc(p.nodeValue,f,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&xc(p.nodeValue,f,(o.mode&1)!==0)}w&&(a.flags|=4)}else p=(f.nodeType===9?f:f.ownerDocument).createTextNode(p),p[Pr]=a,a.stateNode=p}return on(a),null;case 13:if(ft(vt),p=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(dt&&In!==null&&(a.mode&1)!==0&&(a.flags&128)===0)Ey(),lo(),a.flags|=98560,w=!1;else if(w=Tc(a),p!==null&&p.dehydrated!==null){if(o===null){if(!w)throw Error(t(318));if(w=a.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(t(317));w[Pr]=a}else lo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;on(a),w=!1}else hr!==null&&(Wd(hr),hr=null),w=!0;if(!w)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=f,a):(p=p!==null,p!==(o!==null&&o.memoizedState!==null)&&p&&(a.child.flags|=8192,(a.mode&1)!==0&&(o===null||(vt.current&1)!==0?jt===0&&(jt=3):$d())),a.updateQueue!==null&&(a.flags|=4),on(a),null);case 4:return fo(),Pd(o,a),o===null&&Sl(a.stateNode.containerInfo),on(a),null;case 10:return id(a.type._context),on(a),null;case 17:return bn(a.type)&&Sc(),on(a),null;case 19:if(ft(vt),w=a.memoizedState,w===null)return on(a),null;if(p=(a.flags&128)!==0,E=w.rendering,E===null)if(p)Nl(w,!1);else{if(jt!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(E=Dc(o),E!==null){for(a.flags|=128,Nl(w,!1),p=E.updateQueue,p!==null&&(a.updateQueue=p,a.flags|=4),a.subtreeFlags=0,p=f,f=a.child;f!==null;)w=f,o=p,w.flags&=14680066,E=w.alternate,E===null?(w.childLanes=0,w.lanes=o,w.child=null,w.subtreeFlags=0,w.memoizedProps=null,w.memoizedState=null,w.updateQueue=null,w.dependencies=null,w.stateNode=null):(w.childLanes=E.childLanes,w.lanes=E.lanes,w.child=E.child,w.subtreeFlags=0,w.deletions=null,w.memoizedProps=E.memoizedProps,w.memoizedState=E.memoizedState,w.updateQueue=E.updateQueue,w.type=E.type,o=E.dependencies,w.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),f=f.sibling;return ot(vt,vt.current&1|2),a.child}o=o.sibling}w.tail!==null&&kt()>go&&(a.flags|=128,p=!0,Nl(w,!1),a.lanes=4194304)}else{if(!p)if(o=Dc(E),o!==null){if(a.flags|=128,p=!0,f=o.updateQueue,f!==null&&(a.updateQueue=f,a.flags|=4),Nl(w,!0),w.tail===null&&w.tailMode==="hidden"&&!E.alternate&&!dt)return on(a),null}else 2*kt()-w.renderingStartTime>go&&f!==1073741824&&(a.flags|=128,p=!0,Nl(w,!1),a.lanes=4194304);w.isBackwards?(E.sibling=a.child,a.child=E):(f=w.last,f!==null?f.sibling=E:a.child=E,w.last=E)}return w.tail!==null?(a=w.tail,w.rendering=a,w.tail=a.sibling,w.renderingStartTime=kt(),a.sibling=null,f=vt.current,ot(vt,p?f&1|2:f&1),a):(on(a),null);case 22:case 23:return Hd(),p=a.memoizedState!==null,o!==null&&o.memoizedState!==null!==p&&(a.flags|=8192),p&&(a.mode&1)!==0?(Bn&1073741824)!==0&&(on(a),a.subtreeFlags&6&&(a.flags|=8192)):on(a),null;case 24:return null;case 25:return null}throw Error(t(156,a.tag))}function $E(o,a){switch(Jh(a),a.tag){case 1:return bn(a.type)&&Sc(),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return fo(),ft(wn),ft(rn),fd(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 5:return cd(a),null;case 13:if(ft(vt),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(t(340));lo()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return ft(vt),null;case 4:return fo(),null;case 10:return id(a.type._context),null;case 22:case 23:return Hd(),null;case 24:return null;default:return null}}var Vc=!1,ln=!1,UE=typeof WeakSet=="function"?WeakSet:Set,ye=null;function po(o,a){var f=o.ref;if(f!==null)if(typeof f=="function")try{f(null)}catch(p){wt(o,a,p)}else f.current=null}function Ad(o,a,f){try{f()}catch(p){wt(o,a,p)}}var kv=!1;function qE(o,a){if(Hh=ac,o=ty(),Ih(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var p=f.getSelection&&f.getSelection();if(p&&p.rangeCount!==0){f=p.anchorNode;var v=p.anchorOffset,w=p.focusNode;p=p.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var E=0,L=-1,F=-1,G=0,ne=0,re=o,te=null;t:for(;;){for(var pe;re!==f||v!==0&&re.nodeType!==3||(L=E+v),re!==w||p!==0&&re.nodeType!==3||(F=E+p),re.nodeType===3&&(E+=re.nodeValue.length),(pe=re.firstChild)!==null;)te=re,re=pe;for(;;){if(re===o)break t;if(te===f&&++G===v&&(L=E),te===w&&++ne===p&&(F=E),(pe=re.nextSibling)!==null)break;re=te,te=re.parentNode}re=pe}f=L===-1||F===-1?null:{start:L,end:F}}else f=null}f=f||{start:0,end:0}}else f=null;for($h={focusedElem:o,selectionRange:f},ac=!1,ye=a;ye!==null;)if(a=ye,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,ye=o;else for(;ye!==null;){a=ye;try{var xe=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var we=xe.memoizedProps,Ct=xe.memoizedState,$=a.stateNode,_=$.getSnapshotBeforeUpdate(a.elementType===a.type?we:dr(a.type,we),Ct);$.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var K=a.stateNode.containerInfo;K.nodeType===1?K.textContent="":K.nodeType===9&&K.documentElement&&K.removeChild(K.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(t(163))}}catch(ae){wt(a,a.return,ae)}if(o=a.sibling,o!==null){o.return=a.return,ye=o;break}ye=a.return}return xe=kv,kv=!1,xe}function Il(o,a,f){var p=a.updateQueue;if(p=p!==null?p.lastEffect:null,p!==null){var v=p=p.next;do{if((v.tag&o)===o){var w=v.destroy;v.destroy=void 0,w!==void 0&&Ad(a,f,w)}v=v.next}while(v!==p)}}function Hc(o,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var f=a=a.next;do{if((f.tag&o)===o){var p=f.create;f.destroy=p()}f=f.next}while(f!==a)}}function Ld(o){var a=o.ref;if(a!==null){var f=o.stateNode;switch(o.tag){case 5:o=f;break;default:o=f}typeof a=="function"?a(o):a.current=o}}function Cv(o){var a=o.alternate;a!==null&&(o.alternate=null,Cv(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&(delete a[Pr],delete a[Cl],delete a[Qh],delete a[ME],delete a[OE])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Ev(o){return o.tag===5||o.tag===3||o.tag===4}function Rv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Ev(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Dd(o,a,f){var p=o.tag;if(p===5||p===6)o=o.stateNode,a?f.nodeType===8?f.parentNode.insertBefore(o,a):f.insertBefore(o,a):(f.nodeType===8?(a=f.parentNode,a.insertBefore(o,f)):(a=f,a.appendChild(o)),f=f._reactRootContainer,f!=null||a.onclick!==null||(a.onclick=wc));else if(p!==4&&(o=o.child,o!==null))for(Dd(o,a,f),o=o.sibling;o!==null;)Dd(o,a,f),o=o.sibling}function Nd(o,a,f){var p=o.tag;if(p===5||p===6)o=o.stateNode,a?f.insertBefore(o,a):f.appendChild(o);else if(p!==4&&(o=o.child,o!==null))for(Nd(o,a,f),o=o.sibling;o!==null;)Nd(o,a,f),o=o.sibling}var Xt=null,pr=!1;function Fi(o,a,f){for(f=f.child;f!==null;)Tv(o,a,f),f=f.sibling}function Tv(o,a,f){if(Or&&typeof Or.onCommitFiberUnmount=="function")try{Or.onCommitFiberUnmount(nc,f)}catch{}switch(f.tag){case 5:ln||po(f,a);case 6:var p=Xt,v=pr;Xt=null,Fi(o,a,f),Xt=p,pr=v,Xt!==null&&(pr?(o=Xt,f=f.stateNode,o.nodeType===8?o.parentNode.removeChild(f):o.removeChild(f)):Xt.removeChild(f.stateNode));break;case 18:Xt!==null&&(pr?(o=Xt,f=f.stateNode,o.nodeType===8?Kh(o.parentNode,f):o.nodeType===1&&Kh(o,f),dl(o)):Kh(Xt,f.stateNode));break;case 4:p=Xt,v=pr,Xt=f.stateNode.containerInfo,pr=!0,Fi(o,a,f),Xt=p,pr=v;break;case 0:case 11:case 14:case 15:if(!ln&&(p=f.updateQueue,p!==null&&(p=p.lastEffect,p!==null))){v=p=p.next;do{var w=v,E=w.destroy;w=w.tag,E!==void 0&&((w&2)!==0||(w&4)!==0)&&Ad(f,a,E),v=v.next}while(v!==p)}Fi(o,a,f);break;case 1:if(!ln&&(po(f,a),p=f.stateNode,typeof p.componentWillUnmount=="function"))try{p.props=f.memoizedProps,p.state=f.memoizedState,p.componentWillUnmount()}catch(L){wt(f,a,L)}Fi(o,a,f);break;case 21:Fi(o,a,f);break;case 22:f.mode&1?(ln=(p=ln)||f.memoizedState!==null,Fi(o,a,f),ln=p):Fi(o,a,f);break;default:Fi(o,a,f)}}function Mv(o){var a=o.updateQueue;if(a!==null){o.updateQueue=null;var f=o.stateNode;f===null&&(f=o.stateNode=new UE),a.forEach(function(p){var v=t4.bind(null,o,p);f.has(p)||(f.add(p),p.then(v,v))})}}function mr(o,a){var f=a.deletions;if(f!==null)for(var p=0;p<f.length;p++){var v=f[p];try{var w=o,E=a,L=E;e:for(;L!==null;){switch(L.tag){case 5:Xt=L.stateNode,pr=!1;break e;case 3:Xt=L.stateNode.containerInfo,pr=!0;break e;case 4:Xt=L.stateNode.containerInfo,pr=!0;break e}L=L.return}if(Xt===null)throw Error(t(160));Tv(w,E,v),Xt=null,pr=!1;var F=v.alternate;F!==null&&(F.return=null),v.return=null}catch(G){wt(v,a,G)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)Ov(a,o),a=a.sibling}function Ov(o,a){var f=o.alternate,p=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(mr(a,o),Dr(o),p&4){try{Il(3,o,o.return),Hc(3,o)}catch(we){wt(o,o.return,we)}try{Il(5,o,o.return)}catch(we){wt(o,o.return,we)}}break;case 1:mr(a,o),Dr(o),p&512&&f!==null&&po(f,f.return);break;case 5:if(mr(a,o),Dr(o),p&512&&f!==null&&po(f,f.return),o.flags&32){var v=o.stateNode;try{Ye(v,"")}catch(we){wt(o,o.return,we)}}if(p&4&&(v=o.stateNode,v!=null)){var w=o.memoizedProps,E=f!==null?f.memoizedProps:w,L=o.type,F=o.updateQueue;if(o.updateQueue=null,F!==null)try{L==="input"&&w.type==="radio"&&w.name!=null&&_e(v,w),Kn(L,E);var G=Kn(L,w);for(E=0;E<F.length;E+=2){var ne=F[E],re=F[E+1];ne==="style"?ct(v,re):ne==="dangerouslySetInnerHTML"?tt(v,re):ne==="children"?Ye(v,re):O(v,ne,re,G)}switch(L){case"input":Qe(v,w);break;case"textarea":Dt(v,w);break;case"select":var te=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!w.multiple;var pe=w.value;pe!=null?gt(v,!!w.multiple,pe,!1):te!==!!w.multiple&&(w.defaultValue!=null?gt(v,!!w.multiple,w.defaultValue,!0):gt(v,!!w.multiple,w.multiple?[]:"",!1))}v[Cl]=w}catch(we){wt(o,o.return,we)}}break;case 6:if(mr(a,o),Dr(o),p&4){if(o.stateNode===null)throw Error(t(162));v=o.stateNode,w=o.memoizedProps;try{v.nodeValue=w}catch(we){wt(o,o.return,we)}}break;case 3:if(mr(a,o),Dr(o),p&4&&f!==null&&f.memoizedState.isDehydrated)try{dl(a.containerInfo)}catch(we){wt(o,o.return,we)}break;case 4:mr(a,o),Dr(o);break;case 13:mr(a,o),Dr(o),v=o.child,v.flags&8192&&(w=v.memoizedState!==null,v.stateNode.isHidden=w,!w||v.alternate!==null&&v.alternate.memoizedState!==null||(jd=kt())),p&4&&Mv(o);break;case 22:if(ne=f!==null&&f.memoizedState!==null,o.mode&1?(ln=(G=ln)||ne,mr(a,o),ln=G):mr(a,o),Dr(o),p&8192){if(G=o.memoizedState!==null,(o.stateNode.isHidden=G)&&!ne&&(o.mode&1)!==0)for(ye=o,ne=o.child;ne!==null;){for(re=ye=ne;ye!==null;){switch(te=ye,pe=te.child,te.tag){case 0:case 11:case 14:case 15:Il(4,te,te.return);break;case 1:po(te,te.return);var xe=te.stateNode;if(typeof xe.componentWillUnmount=="function"){p=te,f=te.return;try{a=p,xe.props=a.memoizedProps,xe.state=a.memoizedState,xe.componentWillUnmount()}catch(we){wt(p,f,we)}}break;case 5:po(te,te.return);break;case 22:if(te.memoizedState!==null){Lv(re);continue}}pe!==null?(pe.return=te,ye=pe):Lv(re)}ne=ne.sibling}e:for(ne=null,re=o;;){if(re.tag===5){if(ne===null){ne=re;try{v=re.stateNode,G?(w=v.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none"):(L=re.stateNode,F=re.memoizedProps.style,E=F!=null&&F.hasOwnProperty("display")?F.display:null,L.style.display=Nt("display",E))}catch(we){wt(o,o.return,we)}}}else if(re.tag===6){if(ne===null)try{re.stateNode.nodeValue=G?"":re.memoizedProps}catch(we){wt(o,o.return,we)}}else if((re.tag!==22&&re.tag!==23||re.memoizedState===null||re===o)&&re.child!==null){re.child.return=re,re=re.child;continue}if(re===o)break e;for(;re.sibling===null;){if(re.return===null||re.return===o)break e;ne===re&&(ne=null),re=re.return}ne===re&&(ne=null),re.sibling.return=re.return,re=re.sibling}}break;case 19:mr(a,o),Dr(o),p&4&&Mv(o);break;case 21:break;default:mr(a,o),Dr(o)}}function Dr(o){var a=o.flags;if(a&2){try{e:{for(var f=o.return;f!==null;){if(Ev(f)){var p=f;break e}f=f.return}throw Error(t(160))}switch(p.tag){case 5:var v=p.stateNode;p.flags&32&&(Ye(v,""),p.flags&=-33);var w=Rv(o);Nd(o,w,v);break;case 3:case 4:var E=p.stateNode.containerInfo,L=Rv(o);Dd(o,L,E);break;default:throw Error(t(161))}}catch(F){wt(o,o.return,F)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function KE(o,a,f){ye=o,Pv(o)}function Pv(o,a,f){for(var p=(o.mode&1)!==0;ye!==null;){var v=ye,w=v.child;if(v.tag===22&&p){var E=v.memoizedState!==null||Vc;if(!E){var L=v.alternate,F=L!==null&&L.memoizedState!==null||ln;L=Vc;var G=ln;if(Vc=E,(ln=F)&&!G)for(ye=v;ye!==null;)E=ye,F=E.child,E.tag===22&&E.memoizedState!==null?Dv(v):F!==null?(F.return=E,ye=F):Dv(v);for(;w!==null;)ye=w,Pv(w),w=w.sibling;ye=v,Vc=L,ln=G}Av(o)}else(v.subtreeFlags&8772)!==0&&w!==null?(w.return=v,ye=w):Av(o)}}function Av(o){for(;ye!==null;){var a=ye;if((a.flags&8772)!==0){var f=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:ln||Hc(5,a);break;case 1:var p=a.stateNode;if(a.flags&4&&!ln)if(f===null)p.componentDidMount();else{var v=a.elementType===a.type?f.memoizedProps:dr(a.type,f.memoizedProps);p.componentDidUpdate(v,f.memoizedState,p.__reactInternalSnapshotBeforeUpdate)}var w=a.updateQueue;w!==null&&Ly(a,w,p);break;case 3:var E=a.updateQueue;if(E!==null){if(f=null,a.child!==null)switch(a.child.tag){case 5:f=a.child.stateNode;break;case 1:f=a.child.stateNode}Ly(a,E,f)}break;case 5:var L=a.stateNode;if(f===null&&a.flags&4){f=L;var F=a.memoizedProps;switch(a.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(a.memoizedState===null){var G=a.alternate;if(G!==null){var ne=G.memoizedState;if(ne!==null){var re=ne.dehydrated;re!==null&&dl(re)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(t(163))}ln||a.flags&512&&Ld(a)}catch(te){wt(a,a.return,te)}}if(a===o){ye=null;break}if(f=a.sibling,f!==null){f.return=a.return,ye=f;break}ye=a.return}}function Lv(o){for(;ye!==null;){var a=ye;if(a===o){ye=null;break}var f=a.sibling;if(f!==null){f.return=a.return,ye=f;break}ye=a.return}}function Dv(o){for(;ye!==null;){var a=ye;try{switch(a.tag){case 0:case 11:case 15:var f=a.return;try{Hc(4,a)}catch(F){wt(a,f,F)}break;case 1:var p=a.stateNode;if(typeof p.componentDidMount=="function"){var v=a.return;try{p.componentDidMount()}catch(F){wt(a,v,F)}}var w=a.return;try{Ld(a)}catch(F){wt(a,w,F)}break;case 5:var E=a.return;try{Ld(a)}catch(F){wt(a,E,F)}}}catch(F){wt(a,a.return,F)}if(a===o){ye=null;break}var L=a.sibling;if(L!==null){L.return=a.return,ye=L;break}ye=a.return}}var QE=Math.ceil,$c=P.ReactCurrentDispatcher,Id=P.ReactCurrentOwner,Jn=P.ReactCurrentBatchConfig,He=0,qt=null,Ot=null,Jt=0,Bn=0,mo=Di(0),jt=0,Bl=null,ks=0,Uc=0,Bd=0,jl=null,kn=null,jd=0,go=1/0,oi=null,qc=!1,Fd=null,zi=null,Kc=!1,_i=null,Qc=0,Fl=0,zd=null,Yc=-1,Gc=0;function hn(){return(He&6)!==0?kt():Yc!==-1?Yc:Yc=kt()}function Wi(o){return(o.mode&1)===0?1:(He&2)!==0&&Jt!==0?Jt&-Jt:AE.transition!==null?(Gc===0&&(Gc=R0()),Gc):(o=et,o!==0||(o=window.event,o=o===void 0?16:I0(o.type)),o)}function gr(o,a,f,p){if(50<Fl)throw Fl=0,zd=null,Error(t(185));al(o,f,p),((He&2)===0||o!==qt)&&(o===qt&&((He&2)===0&&(Uc|=f),jt===4&&Vi(o,Jt)),Cn(o,p),f===1&&He===0&&(a.mode&1)===0&&(go=kt()+500,Cc&&Ii()))}function Cn(o,a){var f=o.callbackNode;AC(o,a);var p=sc(o,o===qt?Jt:0);if(p===0)f!==null&&k0(f),o.callbackNode=null,o.callbackPriority=0;else if(a=p&-p,o.callbackPriority!==a){if(f!=null&&k0(f),a===1)o.tag===0?PE(Iv.bind(null,o)):wy(Iv.bind(null,o)),RE(function(){(He&6)===0&&Ii()}),f=null;else{switch(T0(p)){case 1:f=vh;break;case 4:f=C0;break;case 16:f=tc;break;case 536870912:f=E0;break;default:f=tc}f=Hv(f,Nv.bind(null,o))}o.callbackPriority=a,o.callbackNode=f}}function Nv(o,a){if(Yc=-1,Gc=0,(He&6)!==0)throw Error(t(327));var f=o.callbackNode;if(yo()&&o.callbackNode!==f)return null;var p=sc(o,o===qt?Jt:0);if(p===0)return null;if((p&30)!==0||(p&o.expiredLanes)!==0||a)a=Xc(o,p);else{a=p;var v=He;He|=2;var w=jv();(qt!==o||Jt!==a)&&(oi=null,go=kt()+500,Es(o,a));do try{XE();break}catch(L){Bv(o,L)}while(!0);rd(),$c.current=w,He=v,Ot!==null?a=0:(qt=null,Jt=0,a=jt)}if(a!==0){if(a===2&&(v=xh(o),v!==0&&(p=v,a=_d(o,v))),a===1)throw f=Bl,Es(o,0),Vi(o,p),Cn(o,kt()),f;if(a===6)Vi(o,p);else{if(v=o.current.alternate,(p&30)===0&&!YE(v)&&(a=Xc(o,p),a===2&&(w=xh(o),w!==0&&(p=w,a=_d(o,w))),a===1))throw f=Bl,Es(o,0),Vi(o,p),Cn(o,kt()),f;switch(o.finishedWork=v,o.finishedLanes=p,a){case 0:case 1:throw Error(t(345));case 2:Rs(o,kn,oi);break;case 3:if(Vi(o,p),(p&130023424)===p&&(a=jd+500-kt(),10<a)){if(sc(o,0)!==0)break;if(v=o.suspendedLanes,(v&p)!==p){hn(),o.pingedLanes|=o.suspendedLanes&v;break}o.timeoutHandle=qh(Rs.bind(null,o,kn,oi),a);break}Rs(o,kn,oi);break;case 4:if(Vi(o,p),(p&4194240)===p)break;for(a=o.eventTimes,v=-1;0<p;){var E=31-ur(p);w=1<<E,E=a[E],E>v&&(v=E),p&=~w}if(p=v,p=kt()-p,p=(120>p?120:480>p?480:1080>p?1080:1920>p?1920:3e3>p?3e3:4320>p?4320:1960*QE(p/1960))-p,10<p){o.timeoutHandle=qh(Rs.bind(null,o,kn,oi),p);break}Rs(o,kn,oi);break;case 5:Rs(o,kn,oi);break;default:throw Error(t(329))}}}return Cn(o,kt()),o.callbackNode===f?Nv.bind(null,o):null}function _d(o,a){var f=jl;return o.current.memoizedState.isDehydrated&&(Es(o,a).flags|=256),o=Xc(o,a),o!==2&&(a=kn,kn=f,a!==null&&Wd(a)),o}function Wd(o){kn===null?kn=o:kn.push.apply(kn,o)}function YE(o){for(var a=o;;){if(a.flags&16384){var f=a.updateQueue;if(f!==null&&(f=f.stores,f!==null))for(var p=0;p<f.length;p++){var v=f[p],w=v.getSnapshot;v=v.value;try{if(!fr(w(),v))return!1}catch{return!1}}}if(f=a.child,a.subtreeFlags&16384&&f!==null)f.return=a,a=f;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Vi(o,a){for(a&=~Bd,a&=~Uc,o.suspendedLanes|=a,o.pingedLanes&=~a,o=o.expirationTimes;0<a;){var f=31-ur(a),p=1<<f;o[f]=-1,a&=~p}}function Iv(o){if((He&6)!==0)throw Error(t(327));yo();var a=sc(o,0);if((a&1)===0)return Cn(o,kt()),null;var f=Xc(o,a);if(o.tag!==0&&f===2){var p=xh(o);p!==0&&(a=p,f=_d(o,p))}if(f===1)throw f=Bl,Es(o,0),Vi(o,a),Cn(o,kt()),f;if(f===6)throw Error(t(345));return o.finishedWork=o.current.alternate,o.finishedLanes=a,Rs(o,kn,oi),Cn(o,kt()),null}function Vd(o,a){var f=He;He|=1;try{return o(a)}finally{He=f,He===0&&(go=kt()+500,Cc&&Ii())}}function Cs(o){_i!==null&&_i.tag===0&&(He&6)===0&&yo();var a=He;He|=1;var f=Jn.transition,p=et;try{if(Jn.transition=null,et=1,o)return o()}finally{et=p,Jn.transition=f,He=a,(He&6)===0&&Ii()}}function Hd(){Bn=mo.current,ft(mo)}function Es(o,a){o.finishedWork=null,o.finishedLanes=0;var f=o.timeoutHandle;if(f!==-1&&(o.timeoutHandle=-1,EE(f)),Ot!==null)for(f=Ot.return;f!==null;){var p=f;switch(Jh(p),p.tag){case 1:p=p.type.childContextTypes,p!=null&&Sc();break;case 3:fo(),ft(wn),ft(rn),fd();break;case 5:cd(p);break;case 4:fo();break;case 13:ft(vt);break;case 19:ft(vt);break;case 10:id(p.type._context);break;case 22:case 23:Hd()}f=f.return}if(qt=o,Ot=o=Hi(o.current,null),Jt=Bn=a,jt=0,Bl=null,Bd=Uc=ks=0,kn=jl=null,ws!==null){for(a=0;a<ws.length;a++)if(f=ws[a],p=f.interleaved,p!==null){f.interleaved=null;var v=p.next,w=f.pending;if(w!==null){var E=w.next;w.next=v,p.next=E}f.pending=p}ws=null}return o}function Bv(o,a){do{var f=Ot;try{if(rd(),Nc.current=Fc,Ic){for(var p=xt.memoizedState;p!==null;){var v=p.queue;v!==null&&(v.pending=null),p=p.next}Ic=!1}if(Ss=0,Ut=Bt=xt=null,Pl=!1,Al=0,Id.current=null,f===null||f.return===null){jt=1,Bl=a,Ot=null;break}e:{var w=o,E=f.return,L=f,F=a;if(a=Jt,L.flags|=32768,F!==null&&typeof F=="object"&&typeof F.then=="function"){var G=F,ne=L,re=ne.tag;if((ne.mode&1)===0&&(re===0||re===11||re===15)){var te=ne.alternate;te?(ne.updateQueue=te.updateQueue,ne.memoizedState=te.memoizedState,ne.lanes=te.lanes):(ne.updateQueue=null,ne.memoizedState=null)}var pe=lv(E);if(pe!==null){pe.flags&=-257,av(pe,E,L,w,a),pe.mode&1&&ov(w,G,a),a=pe,F=G;var xe=a.updateQueue;if(xe===null){var we=new Set;we.add(F),a.updateQueue=we}else xe.add(F);break e}else{if((a&1)===0){ov(w,G,a),$d();break e}F=Error(t(426))}}else if(dt&&L.mode&1){var Ct=lv(E);if(Ct!==null){(Ct.flags&65536)===0&&(Ct.flags|=256),av(Ct,E,L,w,a),td(ho(F,L));break e}}w=F=ho(F,L),jt!==4&&(jt=2),jl===null?jl=[w]:jl.push(w),w=E;do{switch(w.tag){case 3:w.flags|=65536,a&=-a,w.lanes|=a;var $=iv(w,F,a);Ay(w,$);break e;case 1:L=F;var _=w.type,K=w.stateNode;if((w.flags&128)===0&&(typeof _.getDerivedStateFromError=="function"||K!==null&&typeof K.componentDidCatch=="function"&&(zi===null||!zi.has(K)))){w.flags|=65536,a&=-a,w.lanes|=a;var ae=sv(w,L,a);Ay(w,ae);break e}}w=w.return}while(w!==null)}zv(f)}catch(be){a=be,Ot===f&&f!==null&&(Ot=f=f.return);continue}break}while(!0)}function jv(){var o=$c.current;return $c.current=Fc,o===null?Fc:o}function $d(){(jt===0||jt===3||jt===2)&&(jt=4),qt===null||(ks&268435455)===0&&(Uc&268435455)===0||Vi(qt,Jt)}function Xc(o,a){var f=He;He|=2;var p=jv();(qt!==o||Jt!==a)&&(oi=null,Es(o,a));do try{GE();break}catch(v){Bv(o,v)}while(!0);if(rd(),He=f,$c.current=p,Ot!==null)throw Error(t(261));return qt=null,Jt=0,jt}function GE(){for(;Ot!==null;)Fv(Ot)}function XE(){for(;Ot!==null&&!SC();)Fv(Ot)}function Fv(o){var a=Vv(o.alternate,o,Bn);o.memoizedProps=o.pendingProps,a===null?zv(o):Ot=a,Id.current=null}function zv(o){var a=o;do{var f=a.alternate;if(o=a.return,(a.flags&32768)===0){if(f=HE(f,a,Bn),f!==null){Ot=f;return}}else{if(f=$E(f,a),f!==null){f.flags&=32767,Ot=f;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{jt=6,Ot=null;return}}if(a=a.sibling,a!==null){Ot=a;return}Ot=a=o}while(a!==null);jt===0&&(jt=5)}function Rs(o,a,f){var p=et,v=Jn.transition;try{Jn.transition=null,et=1,JE(o,a,f,p)}finally{Jn.transition=v,et=p}return null}function JE(o,a,f,p){do yo();while(_i!==null);if((He&6)!==0)throw Error(t(327));f=o.finishedWork;var v=o.finishedLanes;if(f===null)return null;if(o.finishedWork=null,o.finishedLanes=0,f===o.current)throw Error(t(177));o.callbackNode=null,o.callbackPriority=0;var w=f.lanes|f.childLanes;if(LC(o,w),o===qt&&(Ot=qt=null,Jt=0),(f.subtreeFlags&2064)===0&&(f.flags&2064)===0||Kc||(Kc=!0,Hv(tc,function(){return yo(),null})),w=(f.flags&15990)!==0,(f.subtreeFlags&15990)!==0||w){w=Jn.transition,Jn.transition=null;var E=et;et=1;var L=He;He|=4,Id.current=null,qE(o,f),Ov(f,o),vE($h),ac=!!Hh,$h=Hh=null,o.current=f,KE(f),kC(),He=L,et=E,Jn.transition=w}else o.current=f;if(Kc&&(Kc=!1,_i=o,Qc=v),w=o.pendingLanes,w===0&&(zi=null),RC(f.stateNode),Cn(o,kt()),a!==null)for(p=o.onRecoverableError,f=0;f<a.length;f++)v=a[f],p(v.value,{componentStack:v.stack,digest:v.digest});if(qc)throw qc=!1,o=Fd,Fd=null,o;return(Qc&1)!==0&&o.tag!==0&&yo(),w=o.pendingLanes,(w&1)!==0?o===zd?Fl++:(Fl=0,zd=o):Fl=0,Ii(),null}function yo(){if(_i!==null){var o=T0(Qc),a=Jn.transition,f=et;try{if(Jn.transition=null,et=16>o?16:o,_i===null)var p=!1;else{if(o=_i,_i=null,Qc=0,(He&6)!==0)throw Error(t(331));var v=He;for(He|=4,ye=o.current;ye!==null;){var w=ye,E=w.child;if((ye.flags&16)!==0){var L=w.deletions;if(L!==null){for(var F=0;F<L.length;F++){var G=L[F];for(ye=G;ye!==null;){var ne=ye;switch(ne.tag){case 0:case 11:case 15:Il(8,ne,w)}var re=ne.child;if(re!==null)re.return=ne,ye=re;else for(;ye!==null;){ne=ye;var te=ne.sibling,pe=ne.return;if(Cv(ne),ne===G){ye=null;break}if(te!==null){te.return=pe,ye=te;break}ye=pe}}}var xe=w.alternate;if(xe!==null){var we=xe.child;if(we!==null){xe.child=null;do{var Ct=we.sibling;we.sibling=null,we=Ct}while(we!==null)}}ye=w}}if((w.subtreeFlags&2064)!==0&&E!==null)E.return=w,ye=E;else e:for(;ye!==null;){if(w=ye,(w.flags&2048)!==0)switch(w.tag){case 0:case 11:case 15:Il(9,w,w.return)}var $=w.sibling;if($!==null){$.return=w.return,ye=$;break e}ye=w.return}}var _=o.current;for(ye=_;ye!==null;){E=ye;var K=E.child;if((E.subtreeFlags&2064)!==0&&K!==null)K.return=E,ye=K;else e:for(E=_;ye!==null;){if(L=ye,(L.flags&2048)!==0)try{switch(L.tag){case 0:case 11:case 15:Hc(9,L)}}catch(be){wt(L,L.return,be)}if(L===E){ye=null;break e}var ae=L.sibling;if(ae!==null){ae.return=L.return,ye=ae;break e}ye=L.return}}if(He=v,Ii(),Or&&typeof Or.onPostCommitFiberRoot=="function")try{Or.onPostCommitFiberRoot(nc,o)}catch{}p=!0}return p}finally{et=f,Jn.transition=a}}return!1}function _v(o,a,f){a=ho(f,a),a=iv(o,a,1),o=ji(o,a,1),a=hn(),o!==null&&(al(o,1,a),Cn(o,a))}function wt(o,a,f){if(o.tag===3)_v(o,o,f);else for(;a!==null;){if(a.tag===3){_v(a,o,f);break}else if(a.tag===1){var p=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(zi===null||!zi.has(p))){o=ho(f,o),o=sv(a,o,1),a=ji(a,o,1),o=hn(),a!==null&&(al(a,1,o),Cn(a,o));break}}a=a.return}}function ZE(o,a,f){var p=o.pingCache;p!==null&&p.delete(a),a=hn(),o.pingedLanes|=o.suspendedLanes&f,qt===o&&(Jt&f)===f&&(jt===4||jt===3&&(Jt&130023424)===Jt&&500>kt()-jd?Es(o,0):Bd|=f),Cn(o,a)}function Wv(o,a){a===0&&((o.mode&1)===0?a=1:(a=ic,ic<<=1,(ic&130023424)===0&&(ic=4194304)));var f=hn();o=ri(o,a),o!==null&&(al(o,a,f),Cn(o,f))}function e4(o){var a=o.memoizedState,f=0;a!==null&&(f=a.retryLane),Wv(o,f)}function t4(o,a){var f=0;switch(o.tag){case 13:var p=o.stateNode,v=o.memoizedState;v!==null&&(f=v.retryLane);break;case 19:p=o.stateNode;break;default:throw Error(t(314))}p!==null&&p.delete(a),Wv(o,f)}var Vv;Vv=function(o,a,f){if(o!==null)if(o.memoizedProps!==a.pendingProps||wn.current)Sn=!0;else{if((o.lanes&f)===0&&(a.flags&128)===0)return Sn=!1,VE(o,a,f);Sn=(o.flags&131072)!==0}else Sn=!1,dt&&(a.flags&1048576)!==0&&by(a,Rc,a.index);switch(a.lanes=0,a.tag){case 2:var p=a.type;Wc(o,a),o=a.pendingProps;var v=io(a,rn.current);uo(a,f),v=pd(null,a,p,o,v,f);var w=md();return a.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,bn(p)?(w=!0,kc(a)):w=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,ld(a),v.updater=zc,a.stateNode=v,v._reactInternals=a,bd(a,p,o,f),a=Ed(null,a,p,!0,w,f)):(a.tag=0,dt&&w&&Xh(a),fn(null,a,v,f),a=a.child),a;case 16:p=a.elementType;e:{switch(Wc(o,a),o=a.pendingProps,v=p._init,p=v(p._payload),a.type=p,v=a.tag=r4(p),o=dr(p,o),v){case 0:a=Cd(null,a,p,o,f);break e;case 1:a=pv(null,a,p,o,f);break e;case 11:a=cv(null,a,p,o,f);break e;case 14:a=uv(null,a,p,dr(p.type,o),f);break e}throw Error(t(306,p,""))}return a;case 0:return p=a.type,v=a.pendingProps,v=a.elementType===p?v:dr(p,v),Cd(o,a,p,v,f);case 1:return p=a.type,v=a.pendingProps,v=a.elementType===p?v:dr(p,v),pv(o,a,p,v,f);case 3:e:{if(mv(a),o===null)throw Error(t(387));p=a.pendingProps,w=a.memoizedState,v=w.element,Py(o,a),Lc(a,p,null,f);var E=a.memoizedState;if(p=E.element,w.isDehydrated)if(w={element:p,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},a.updateQueue.baseState=w,a.memoizedState=w,a.flags&256){v=ho(Error(t(423)),a),a=gv(o,a,p,f,v);break e}else if(p!==v){v=ho(Error(t(424)),a),a=gv(o,a,p,f,v);break e}else for(In=Li(a.stateNode.containerInfo.firstChild),Nn=a,dt=!0,hr=null,f=My(a,null,p,f),a.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(lo(),p===v){a=si(o,a,f);break e}fn(o,a,p,f)}a=a.child}return a;case 5:return Dy(a),o===null&&ed(a),p=a.type,v=a.pendingProps,w=o!==null?o.memoizedProps:null,E=v.children,Uh(p,v)?E=null:w!==null&&Uh(p,w)&&(a.flags|=32),dv(o,a),fn(o,a,E,f),a.child;case 6:return o===null&&ed(a),null;case 13:return yv(o,a,f);case 4:return ad(a,a.stateNode.containerInfo),p=a.pendingProps,o===null?a.child=ao(a,null,p,f):fn(o,a,p,f),a.child;case 11:return p=a.type,v=a.pendingProps,v=a.elementType===p?v:dr(p,v),cv(o,a,p,v,f);case 7:return fn(o,a,a.pendingProps,f),a.child;case 8:return fn(o,a,a.pendingProps.children,f),a.child;case 12:return fn(o,a,a.pendingProps.children,f),a.child;case 10:e:{if(p=a.type._context,v=a.pendingProps,w=a.memoizedProps,E=v.value,ot(Oc,p._currentValue),p._currentValue=E,w!==null)if(fr(w.value,E)){if(w.children===v.children&&!wn.current){a=si(o,a,f);break e}}else for(w=a.child,w!==null&&(w.return=a);w!==null;){var L=w.dependencies;if(L!==null){E=w.child;for(var F=L.firstContext;F!==null;){if(F.context===p){if(w.tag===1){F=ii(-1,f&-f),F.tag=2;var G=w.updateQueue;if(G!==null){G=G.shared;var ne=G.pending;ne===null?F.next=F:(F.next=ne.next,ne.next=F),G.pending=F}}w.lanes|=f,F=w.alternate,F!==null&&(F.lanes|=f),sd(w.return,f,a),L.lanes|=f;break}F=F.next}}else if(w.tag===10)E=w.type===a.type?null:w.child;else if(w.tag===18){if(E=w.return,E===null)throw Error(t(341));E.lanes|=f,L=E.alternate,L!==null&&(L.lanes|=f),sd(E,f,a),E=w.sibling}else E=w.child;if(E!==null)E.return=w;else for(E=w;E!==null;){if(E===a){E=null;break}if(w=E.sibling,w!==null){w.return=E.return,E=w;break}E=E.return}w=E}fn(o,a,v.children,f),a=a.child}return a;case 9:return v=a.type,p=a.pendingProps.children,uo(a,f),v=Gn(v),p=p(v),a.flags|=1,fn(o,a,p,f),a.child;case 14:return p=a.type,v=dr(p,a.pendingProps),v=dr(p.type,v),uv(o,a,p,v,f);case 15:return fv(o,a,a.type,a.pendingProps,f);case 17:return p=a.type,v=a.pendingProps,v=a.elementType===p?v:dr(p,v),Wc(o,a),a.tag=1,bn(p)?(o=!0,kc(a)):o=!1,uo(a,f),nv(a,p,v),bd(a,p,v,f),Ed(null,a,p,!0,o,f);case 19:return xv(o,a,f);case 22:return hv(o,a,f)}throw Error(t(156,a.tag))};function Hv(o,a){return S0(o,a)}function n4(o,a,f,p){this.tag=o,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zn(o,a,f,p){return new n4(o,a,f,p)}function Ud(o){return o=o.prototype,!(!o||!o.isReactComponent)}function r4(o){if(typeof o=="function")return Ud(o)?1:0;if(o!=null){if(o=o.$$typeof,o===U)return 11;if(o===J)return 14}return 2}function Hi(o,a){var f=o.alternate;return f===null?(f=Zn(o.tag,a,o.key,o.mode),f.elementType=o.elementType,f.type=o.type,f.stateNode=o.stateNode,f.alternate=o,o.alternate=f):(f.pendingProps=a,f.type=o.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=o.flags&14680064,f.childLanes=o.childLanes,f.lanes=o.lanes,f.child=o.child,f.memoizedProps=o.memoizedProps,f.memoizedState=o.memoizedState,f.updateQueue=o.updateQueue,a=o.dependencies,f.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},f.sibling=o.sibling,f.index=o.index,f.ref=o.ref,f}function Jc(o,a,f,p,v,w){var E=2;if(p=o,typeof o=="function")Ud(o)&&(E=1);else if(typeof o=="string")E=5;else e:switch(o){case B:return Ts(f.children,v,w,a);case W:E=8,v|=8;break;case Z:return o=Zn(12,f,a,v|2),o.elementType=Z,o.lanes=w,o;case j:return o=Zn(13,f,a,v),o.elementType=j,o.lanes=w,o;case Y:return o=Zn(19,f,a,v),o.elementType=Y,o.lanes=w,o;case H:return Zc(f,v,w,a);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case X:E=10;break e;case Q:E=9;break e;case U:E=11;break e;case J:E=14;break e;case q:E=16,p=null;break e}throw Error(t(130,o==null?o:typeof o,""))}return a=Zn(E,f,a,v),a.elementType=o,a.type=p,a.lanes=w,a}function Ts(o,a,f,p){return o=Zn(7,o,p,a),o.lanes=f,o}function Zc(o,a,f,p){return o=Zn(22,o,p,a),o.elementType=H,o.lanes=f,o.stateNode={isHidden:!1},o}function qd(o,a,f){return o=Zn(6,o,null,a),o.lanes=f,o}function Kd(o,a,f){return a=Zn(4,o.children!==null?o.children:[],o.key,a),a.lanes=f,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function i4(o,a,f,p,v){this.tag=a,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=wh(0),this.expirationTimes=wh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wh(0),this.identifierPrefix=p,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Qd(o,a,f,p,v,w,E,L,F){return o=new i4(o,a,f,L,F),a===1?(a=1,w===!0&&(a|=8)):a=0,w=Zn(3,null,null,a),o.current=w,w.stateNode=o,w.memoizedState={element:p,isDehydrated:f,cache:null,transitions:null,pendingSuspenseBoundaries:null},ld(w),o}function s4(o,a,f){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:p==null?null:""+p,children:o,containerInfo:a,implementation:f}}function $v(o){if(!o)return Ni;o=o._reactInternals;e:{if(Mr(o)!==o||o.tag!==1)throw Error(t(170));var a=o;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(bn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(t(171))}if(o.tag===1){var f=o.type;if(bn(f))return vy(o,f,a)}return a}function Uv(o,a,f,p,v,w,E,L,F){return o=Qd(f,p,!0,o,v,w,E,L,F),o.context=$v(null),f=o.current,p=hn(),v=Wi(f),w=ii(p,v),w.callback=a??null,ji(f,w,v),o.current.lanes=v,al(o,v,p),Cn(o,p),o}function eu(o,a,f,p){var v=a.current,w=hn(),E=Wi(v);return f=$v(f),a.context===null?a.context=f:a.pendingContext=f,a=ii(w,E),a.payload={element:o},p=p===void 0?null:p,p!==null&&(a.callback=p),o=ji(v,a,E),o!==null&&(gr(o,v,E,w),Ac(o,v,E)),E}function tu(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function qv(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var f=o.retryLane;o.retryLane=f!==0&&f<a?f:a}}function Yd(o,a){qv(o,a),(o=o.alternate)&&qv(o,a)}function o4(){return null}var Kv=typeof reportError=="function"?reportError:function(o){console.error(o)};function Gd(o){this._internalRoot=o}nu.prototype.render=Gd.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(t(409));eu(o,a,null,null)},nu.prototype.unmount=Gd.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;Cs(function(){eu(null,o,null,null)}),a[Zr]=null}};function nu(o){this._internalRoot=o}nu.prototype.unstable_scheduleHydration=function(o){if(o){var a=P0();o={blockedOn:null,target:o,priority:a};for(var f=0;f<Oi.length&&a!==0&&a<Oi[f].priority;f++);Oi.splice(f,0,o),f===0&&D0(o)}};function Xd(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function ru(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function Qv(){}function l4(o,a,f,p,v){if(v){if(typeof p=="function"){var w=p;p=function(){var G=tu(E);w.call(G)}}var E=Uv(a,p,o,0,null,!1,!1,"",Qv);return o._reactRootContainer=E,o[Zr]=E.current,Sl(o.nodeType===8?o.parentNode:o),Cs(),E}for(;v=o.lastChild;)o.removeChild(v);if(typeof p=="function"){var L=p;p=function(){var G=tu(F);L.call(G)}}var F=Qd(o,0,!1,null,null,!1,!1,"",Qv);return o._reactRootContainer=F,o[Zr]=F.current,Sl(o.nodeType===8?o.parentNode:o),Cs(function(){eu(a,F,f,p)}),F}function iu(o,a,f,p,v){var w=f._reactRootContainer;if(w){var E=w;if(typeof v=="function"){var L=v;v=function(){var F=tu(E);L.call(F)}}eu(a,E,o,v)}else E=l4(f,a,o,v,p);return tu(E)}M0=function(o){switch(o.tag){case 3:var a=o.stateNode;if(a.current.memoizedState.isDehydrated){var f=ll(a.pendingLanes);f!==0&&(bh(a,f|1),Cn(a,kt()),(He&6)===0&&(go=kt()+500,Ii()))}break;case 13:Cs(function(){var p=ri(o,1);if(p!==null){var v=hn();gr(p,o,1,v)}}),Yd(o,1)}},Sh=function(o){if(o.tag===13){var a=ri(o,134217728);if(a!==null){var f=hn();gr(a,o,134217728,f)}Yd(o,134217728)}},O0=function(o){if(o.tag===13){var a=Wi(o),f=ri(o,a);if(f!==null){var p=hn();gr(f,o,a,p)}Yd(o,a)}},P0=function(){return et},A0=function(o,a){var f=et;try{return et=o,a()}finally{et=f}},yt=function(o,a,f){switch(a){case"input":if(Qe(o,f),a=f.name,f.type==="radio"&&a!=null){for(f=o;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<f.length;a++){var p=f[a];if(p!==o&&p.form===o.form){var v=bc(p);if(!v)throw Error(t(90));Se(p),Qe(p,v)}}}break;case"textarea":Dt(o,f);break;case"select":a=f.value,a!=null&>(o,!!f.multiple,a,!1)}},Ks=Vd,Xr=Cs;var a4={usingClientEntryPoint:!1,Events:[El,no,bc,Gr,ds,Vd]},zl={findFiberByHostInstance:gs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},c4={bundleType:zl.bundleType,version:zl.version,rendererPackageName:zl.rendererPackageName,rendererConfig:zl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=w0(o),o===null?null:o.stateNode},findFiberByHostInstance:zl.findFiberByHostInstance||o4,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 su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!su.isDisabled&&su.supportsFiber)try{nc=su.inject(c4),Or=su}catch{}}return En.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=a4,En.createPortal=function(o,a){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Xd(a))throw Error(t(200));return s4(o,a,null,f)},En.createRoot=function(o,a){if(!Xd(o))throw Error(t(299));var f=!1,p="",v=Kv;return a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(p=a.identifierPrefix),a.onRecoverableError!==void 0&&(v=a.onRecoverableError)),a=Qd(o,1,!1,null,null,f,!1,p,v),o[Zr]=a.current,Sl(o.nodeType===8?o.parentNode:o),new Gd(a)},En.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(t(188)):(o=Object.keys(o).join(","),Error(t(268,o)));return o=w0(a),o=o===null?null:o.stateNode,o},En.flushSync=function(o){return Cs(o)},En.hydrate=function(o,a,f){if(!ru(a))throw Error(t(200));return iu(null,o,a,!0,f)},En.hydrateRoot=function(o,a,f){if(!Xd(o))throw Error(t(405));var p=f!=null&&f.hydratedSources||null,v=!1,w="",E=Kv;if(f!=null&&(f.unstable_strictMode===!0&&(v=!0),f.identifierPrefix!==void 0&&(w=f.identifierPrefix),f.onRecoverableError!==void 0&&(E=f.onRecoverableError)),a=Uv(a,null,o,1,f??null,v,!1,w,E),o[Zr]=a.current,Sl(o),p)for(o=0;o<p.length;o++)f=p[o],v=f._getVersion,v=v(f._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[f,v]:a.mutableSourceEagerHydrationData.push(f,v);return new nu(a)},En.render=function(o,a,f){if(!ru(a))throw Error(t(200));return iu(null,o,a,!1,f)},En.unmountComponentAtNode=function(o){if(!ru(o))throw Error(t(40));return o._reactRootContainer?(Cs(function(){iu(null,null,o,!1,function(){o._reactRootContainer=null,o[Zr]=null})}),!0):!1},En.unstable_batchedUpdates=Vd,En.unstable_renderSubtreeIntoContainer=function(o,a,f,p){if(!ru(f))throw Error(t(200));if(o==null||o._reactInternals===void 0)throw Error(t(38));return iu(o,a,f,!1,p)},En.version="18.3.1-next-f1338f8080-20240426",En}var nx;function Zw(){if(nx)return ep.exports;nx=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(),ep.exports=b4(),ep.exports}var rx;function S4(){if(rx)return ou;rx=1;var n=Zw();return ou.createRoot=n.createRoot,ou.hydrateRoot=n.hydrateRoot,ou}var k4=S4();/**
|
|
41
|
+
* react-router v7.9.5
|
|
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 ix="popstate";function C4(n={}){function e(r,i){let{pathname:s,search:l,hash:c}=r.location;return Yp("",{pathname:s,search:l,hash:c},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function t(r,i){return typeof i=="string"?i:pa(i)}return R4(e,t,null,n)}function mt(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function or(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function E4(){return Math.random().toString(36).substring(2,10)}function sx(n,e){return{usr:n.state,key:n.key,idx:e}}function Yp(n,e,t=null,r){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof e=="string"?Qo(e):e,state:t,key:e&&e.key||r||E4()}}function pa({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 Qo(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 R4(n,e,t,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,l=i.history,c="POP",u=null,h=d();h==null&&(h=0,l.replaceState({...l.state,idx:h},""));function d(){return(l.state||{idx:null}).idx}function m(){c="POP";let k=d(),R=k==null?null:k-h;h=k,u&&u({action:c,location:b.location,delta:R})}function g(k,R){c="PUSH";let T=Yp(b.location,k,R);h=d()+1;let O=sx(T,h),P=b.createHref(T);try{l.pushState(O,"",P)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;i.location.assign(P)}s&&u&&u({action:c,location:b.location,delta:1})}function y(k,R){c="REPLACE";let T=Yp(b.location,k,R);h=d();let O=sx(T,h),P=b.createHref(T);l.replaceState(O,"",P),s&&u&&u({action:c,location:b.location,delta:0})}function x(k){return T4(k)}let b={get action(){return c},get location(){return n(i,l)},listen(k){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(ix,m),u=k,()=>{i.removeEventListener(ix,m),u=null}},createHref(k){return e(i,k)},createURL:x,encodeLocation(k){let R=x(k);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:g,replace:y,go(k){return l.go(k)}};return b}function T4(n,e=!1){let t="http://localhost";typeof window<"u"&&(t=window.location.origin!=="null"?window.location.origin:window.location.href),mt(t,"No window.location.(origin|href) available to create URL");let r=typeof n=="string"?n:pa(n);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=t+r),new URL(r,t)}function e2(n,e,t="/"){return M4(n,e,t,!1)}function M4(n,e,t,r){let i=typeof e=="string"?Qo(e):e,s=mi(i.pathname||"/",t);if(s==null)return null;let l=t2(n);O4(l);let c=null;for(let u=0;c==null&&u<l.length;++u){let h=_4(s);c=F4(l[u],h,r)}return c}function t2(n,e=[],t=[],r="",i=!1){let s=(l,c,u=i,h)=>{let d={relativePath:h===void 0?l.path||"":h,caseSensitive:l.caseSensitive===!0,childrenIndex:c,route:l};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&u)return;mt(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 m=di([r,d.relativePath]),g=t.concat(d);l.children&&l.children.length>0&&(mt(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),t2(l.children,e,g,m,u)),!(l.path==null&&!l.index)&&e.push({path:m,score:B4(m,l.index),routesMeta:g})};return n.forEach((l,c)=>{var u;if(l.path===""||!((u=l.path)!=null&&u.includes("?")))s(l,c);else for(let h of n2(l.path))s(l,c,!0,h)}),e}function n2(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 l=n2(r.join("/")),c=[];return c.push(...l.map(u=>u===""?s:[s,u].join("/"))),i&&c.push(...l),c.map(u=>n.startsWith("/")&&u===""?"/":u)}function O4(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:j4(e.routesMeta.map(r=>r.childrenIndex),t.routesMeta.map(r=>r.childrenIndex)))}var P4=/^:[\w-]+$/,A4=3,L4=2,D4=1,N4=10,I4=-2,ox=n=>n==="*";function B4(n,e){let t=n.split("/"),r=t.length;return t.some(ox)&&(r+=I4),e&&(r+=L4),t.filter(i=>!ox(i)).reduce((i,s)=>i+(P4.test(s)?A4:s===""?D4:N4),r)}function j4(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 F4(n,e,t=!1){let{routesMeta:r}=n,i={},s="/",l=[];for(let c=0;c<r.length;++c){let u=r[c],h=c===r.length-1,d=s==="/"?e:e.slice(s.length)||"/",m=Zu({path:u.relativePath,caseSensitive:u.caseSensitive,end:h},d),g=u.route;if(!m&&h&&t&&!r[r.length-1].route.index&&(m=Zu({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},d)),!m)return null;Object.assign(i,m.params),l.push({params:i,pathname:di([s,m.pathname]),pathnameBase:$4(di([s,m.pathnameBase])),route:g}),m.pathnameBase!=="/"&&(s=di([s,m.pathnameBase]))}return l}function Zu(n,e){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[t,r]=z4(n.path,n.caseSensitive,n.end),i=e.match(t);if(!i)return null;let s=i[0],l=s.replace(/(.)\/+$/,"$1"),c=i.slice(1);return{params:r.reduce((h,{paramName:d,isOptional:m},g)=>{if(d==="*"){let x=c[g]||"";l=s.slice(0,s.length-x.length).replace(/(.)\/+$/,"$1")}const y=c[g];return m&&!y?h[d]=void 0:h[d]=(y||"").replace(/%2F/g,"/"),h},{}),pathname:s,pathnameBase:l,pattern:n}}function z4(n,e=!1,t=!0){or(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,(l,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).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 _4(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return or(!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 mi(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)||"/"}function W4(n,e="/"){let{pathname:t,search:r="",hash:i=""}=typeof n=="string"?Qo(n):n;return{pathname:t?t.startsWith("/")?t:V4(t,e):e,search:U4(r),hash:q4(i)}}function V4(n,e){let t=e.replace(/\/+$/,"").split("/");return n.split("/").forEach(i=>{i===".."?t.length>1&&t.pop():i!=="."&&t.push(i)}),t.length>1?t.join("/"):"/"}function rp(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 H4(n){return n.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function og(n){let e=H4(n);return e.map((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)}function lg(n,e,t,r=!1){let i;typeof n=="string"?i=Qo(n):(i={...n},mt(!i.pathname||!i.pathname.includes("?"),rp("?","pathname","search",i)),mt(!i.pathname||!i.pathname.includes("#"),rp("#","pathname","hash",i)),mt(!i.search||!i.search.includes("#"),rp("#","search","hash",i)));let s=n===""||i.pathname==="",l=s?"/":i.pathname,c;if(l==null)c=t;else{let m=e.length-1;if(!r&&l.startsWith("..")){let g=l.split("/");for(;g[0]==="..";)g.shift(),m-=1;i.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=W4(i,c),h=l&&l!=="/"&&l.endsWith("/"),d=(s||l===".")&&t.endsWith("/");return!u.pathname.endsWith("/")&&(h||d)&&(u.pathname+="/"),u}var di=n=>n.join("/").replace(/\/\/+/g,"/"),$4=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),U4=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,q4=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n;function K4(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var r2=["POST","PUT","PATCH","DELETE"];new Set(r2);var Q4=["GET",...r2];new Set(Q4);var Yo=S.createContext(null);Yo.displayName="DataRouter";var _f=S.createContext(null);_f.displayName="DataRouterState";S.createContext(!1);var i2=S.createContext({isTransitioning:!1});i2.displayName="ViewTransition";var Y4=S.createContext(new Map);Y4.displayName="Fetchers";var G4=S.createContext(null);G4.displayName="Await";var Sr=S.createContext(null);Sr.displayName="Navigation";var za=S.createContext(null);za.displayName="Location";var ar=S.createContext({outlet:null,matches:[],isDataRoute:!1});ar.displayName="Route";var ag=S.createContext(null);ag.displayName="RouteError";function X4(n,{relative:e}={}){mt(Go(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:r}=S.useContext(Sr),{hash:i,pathname:s,search:l}=_a(n,{relative:e}),c=s;return t!=="/"&&(c=s==="/"?t:di([t,s])),r.createHref({pathname:c,search:l,hash:i})}function Go(){return S.useContext(za)!=null}function kr(){return mt(Go(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(za).location}var s2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function o2(n){S.useContext(Sr).static||S.useLayoutEffect(n)}function Wf(){let{isDataRoute:n}=S.useContext(ar);return n?h3():J4()}function J4(){mt(Go(),"useNavigate() may be used only in the context of a <Router> component.");let n=S.useContext(Yo),{basename:e,navigator:t}=S.useContext(Sr),{matches:r}=S.useContext(ar),{pathname:i}=kr(),s=JSON.stringify(og(r)),l=S.useRef(!1);return o2(()=>{l.current=!0}),S.useCallback((u,h={})=>{if(or(l.current,s2),!l.current)return;if(typeof u=="number"){t.go(u);return}let d=lg(u,JSON.parse(s),i,h.relative==="path");n==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:di([e,d.pathname])),(h.replace?t.replace:t.push)(d,h.state,h)},[e,t,s,i,n])}var Z4=S.createContext(null);function e3(n){let e=S.useContext(ar).outlet;return S.useMemo(()=>e&&S.createElement(Z4.Provider,{value:n},e),[e,n])}function Vf(){let{matches:n}=S.useContext(ar),e=n[n.length-1];return e?e.params:{}}function _a(n,{relative:e}={}){let{matches:t}=S.useContext(ar),{pathname:r}=kr(),i=JSON.stringify(og(t));return S.useMemo(()=>lg(n,JSON.parse(i),r,e==="path"),[n,i,r,e])}function t3(n,e){return l2(n,e)}function l2(n,e,t,r,i){var T;mt(Go(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=S.useContext(Sr),{matches:l}=S.useContext(ar),c=l[l.length-1],u=c?c.params:{},h=c?c.pathname:"/",d=c?c.pathnameBase:"/",m=c&&c.route;{let O=m&&m.path||"";a2(h,!m||O.endsWith("*")||O.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${O}">) 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="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let g=kr(),y;if(e){let O=typeof e=="string"?Qo(e):e;mt(d==="/"||((T=O.pathname)==null?void 0:T.startsWith(d)),`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 "${d}" but pathname "${O.pathname}" was given in the \`location\` prop.`),y=O}else y=g;let x=y.pathname||"/",b=x;if(d!=="/"){let O=d.replace(/^\//,"").split("/");b="/"+x.replace(/^\//,"").split("/").slice(O.length).join("/")}let k=e2(n,{pathname:b});or(m||k!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),or(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.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 R=o3(k&&k.map(O=>Object.assign({},O,{params:Object.assign({},u,O.params),pathname:di([d,s.encodeLocation?s.encodeLocation(O.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?d:di([d,s.encodeLocation?s.encodeLocation(O.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathnameBase])})),l,t,r,i);return e&&R?S.createElement(za.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...y},navigationType:"POP"}},R):R}function n3(){let n=f3(),e=K4(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},l=null;return console.error("Error handled by React Router default ErrorBoundary:",n),l=S.createElement(S.Fragment,null,S.createElement("p",null,"💿 Hey developer 👋"),S.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",S.createElement("code",{style:s},"ErrorBoundary")," or"," ",S.createElement("code",{style:s},"errorElement")," prop on your route.")),S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},e),t?S.createElement("pre",{style:i},t):null,l)}var r3=S.createElement(n3,null),i3=class extends S.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.unstable_onError?this.props.unstable_onError(n,e):console.error("React Router caught the following error during render",n)}render(){return this.state.error!==void 0?S.createElement(ar.Provider,{value:this.props.routeContext},S.createElement(ag.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function s3({routeContext:n,match:e,children:t}){let r=S.useContext(Yo);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),S.createElement(ar.Provider,{value:n},t)}function o3(n,e=[],t=null,r=null,i=null){if(n==null){if(!t)return null;if(t.errors)n=t.matches;else if(e.length===0&&!t.initialized&&t.matches.length>0)n=t.matches;else return null}let s=n,l=t==null?void 0:t.errors;if(l!=null){let h=s.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id])!==void 0);mt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),s=s.slice(0,Math.min(s.length,h+1))}let c=!1,u=-1;if(t)for(let h=0;h<s.length;h++){let d=s[h];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(u=h),d.route.id){let{loaderData:m,errors:g}=t,y=d.route.loader&&!m.hasOwnProperty(d.route.id)&&(!g||g[d.route.id]===void 0);if(d.route.lazy||y){c=!0,u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((h,d,m)=>{let g,y=!1,x=null,b=null;t&&(g=l&&d.route.id?l[d.route.id]:void 0,x=d.route.errorElement||r3,c&&(u<0&&m===0?(a2("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,b=null):u===m&&(y=!0,b=d.route.hydrateFallbackElement||null)));let k=e.concat(s.slice(0,m+1)),R=()=>{let T;return g?T=x:y?T=b:d.route.Component?T=S.createElement(d.route.Component,null):d.route.element?T=d.route.element:T=h,S.createElement(s3,{match:d,routeContext:{outlet:h,matches:k,isDataRoute:t!=null},children:T})};return t&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?S.createElement(i3,{location:t.location,revalidation:t.revalidation,component:x,error:g,children:R(),routeContext:{outlet:null,matches:k,isDataRoute:!0},unstable_onError:r}):R()},null)}function cg(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function l3(n){let e=S.useContext(Yo);return mt(e,cg(n)),e}function a3(n){let e=S.useContext(_f);return mt(e,cg(n)),e}function c3(n){let e=S.useContext(ar);return mt(e,cg(n)),e}function ug(n){let e=c3(n),t=e.matches[e.matches.length-1];return mt(t.route.id,`${n} can only be used on routes that contain a unique "id"`),t.route.id}function u3(){return ug("useRouteId")}function f3(){var r;let n=S.useContext(ag),e=a3("useRouteError"),t=ug("useRouteError");return n!==void 0?n:(r=e.errors)==null?void 0:r[t]}function h3(){let{router:n}=l3("useNavigate"),e=ug("useNavigate"),t=S.useRef(!1);return o2(()=>{t.current=!0}),S.useCallback(async(i,s={})=>{or(t.current,s2),t.current&&(typeof i=="number"?n.navigate(i):await n.navigate(i,{fromRouteId:e,...s}))},[n,e])}var lx={};function a2(n,e,t){!e&&!lx[n]&&(lx[n]=!0,or(!1,t))}S.memo(d3);function d3({routes:n,future:e,state:t,unstable_onError:r}){return l2(n,void 0,t,r,e)}function na({to:n,replace:e,state:t,relative:r}){mt(Go(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=S.useContext(Sr);or(!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}=S.useContext(ar),{pathname:l}=kr(),c=Wf(),u=lg(n,og(s),l,r==="path"),h=JSON.stringify(u);return S.useEffect(()=>{c(JSON.parse(h),{replace:e,state:t,relative:r})},[c,h,r,e,t]),null}function p3(n){return e3(n.context)}function As(n){mt(!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 m3({basename:n="/",children:e=null,location:t,navigationType:r="POP",navigator:i,static:s=!1}){mt(!Go(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=n.replace(/^\/*/,"/"),c=S.useMemo(()=>({basename:l,navigator:i,static:s,future:{}}),[l,i,s]);typeof t=="string"&&(t=Qo(t));let{pathname:u="/",search:h="",hash:d="",state:m=null,key:g="default"}=t,y=S.useMemo(()=>{let x=mi(u,l);return x==null?null:{location:{pathname:x,search:h,hash:d,state:m,key:g},navigationType:r}},[l,u,h,d,m,g,r]);return or(y!=null,`<Router basename="${l}"> is not able to match the URL "${u}${h}${d}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:S.createElement(Sr.Provider,{value:c},S.createElement(za.Provider,{children:e,value:y}))}function g3({children:n,location:e}){return t3(Gp(n),e)}function Gp(n,e=[]){let t=[];return S.Children.forEach(n,(r,i)=>{if(!S.isValidElement(r))return;let s=[...e,i];if(r.type===S.Fragment){t.push.apply(t,Gp(r.props.children,s));return}mt(r.type===As,`[${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>`),mt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={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&&(l.children=Gp(r.props.children,s)),t.push(l)}),t}var Fu="get",zu="application/x-www-form-urlencoded";function Hf(n){return n!=null&&typeof n.tagName=="string"}function y3(n){return Hf(n)&&n.tagName.toLowerCase()==="button"}function v3(n){return Hf(n)&&n.tagName.toLowerCase()==="form"}function x3(n){return Hf(n)&&n.tagName.toLowerCase()==="input"}function w3(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function b3(n,e){return n.button===0&&(!e||e==="_self")&&!w3(n)}function Xp(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 S3(n,e){let t=Xp(n);return e&&e.forEach((r,i)=>{t.has(i)||e.getAll(i).forEach(s=>{t.append(i,s)})}),t}var lu=null;function k3(){if(lu===null)try{new FormData(document.createElement("form"),0),lu=!1}catch{lu=!0}return lu}var C3=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ip(n){return n!=null&&!C3.has(n)?(or(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zu}"`),null):n}function E3(n,e){let t,r,i,s,l;if(v3(n)){let c=n.getAttribute("action");r=c?mi(c,e):null,t=n.getAttribute("method")||Fu,i=ip(n.getAttribute("enctype"))||zu,s=new FormData(n)}else if(y3(n)||x3(n)&&(n.type==="submit"||n.type==="image")){let c=n.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=n.getAttribute("formaction")||c.getAttribute("action");if(r=u?mi(u,e):null,t=n.getAttribute("formmethod")||c.getAttribute("method")||Fu,i=ip(n.getAttribute("formenctype"))||ip(c.getAttribute("enctype"))||zu,s=new FormData(c,n),!k3()){let{name:h,type:d,value:m}=n;if(d==="image"){let g=h?`${h}.`:"";s.append(`${g}x`,"0"),s.append(`${g}y`,"0")}else h&&s.append(h,m)}}else{if(Hf(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=Fu,r=null,i=zu,l=n}return s&&i==="text/plain"&&(l=s,s=void 0),{action:r,method:t.toLowerCase(),encType:i,formData:s,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function fg(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function R3(n,e,t){let r=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return r.pathname==="/"?r.pathname=`_root.${t}`:e&&mi(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${t}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${t}`,r}async function T3(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 M3(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 O3(n,e,t){let r=await Promise.all(n.map(async i=>{let s=e.routes[i.route.id];if(s){let l=await T3(s,t);return l.links?l.links():[]}return[]}));return D3(r.flat(1).filter(M3).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function ax(n,e,t,r,i,s){let l=(u,h)=>t[h]?u.route.id!==t[h].route.id:!0,c=(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)=>l(u,h)||c(u,h)):s==="data"?e.filter((u,h)=>{var m;let d=r.routes[u.route.id];if(!d||!d.hasLoader)return!1;if(l(u,h)||c(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:((m=t[0])==null?void 0:m.params)||{},nextUrl:new URL(n,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function P3(n,e,{includeHydrateFallback:t}={}){return A3(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 A3(n){return[...new Set(n)]}function L3(n){let e={},t=Object.keys(n).sort();for(let r of t)e[r]=n[r];return e}function D3(n,e){let t=new Set;return new Set(e),n.reduce((r,i)=>{let s=JSON.stringify(L3(i));return t.has(s)||(t.add(s),r.push({key:s,link:i})),r},[])}function c2(){let n=S.useContext(Yo);return fg(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function N3(){let n=S.useContext(_f);return fg(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var hg=S.createContext(void 0);hg.displayName="FrameworkContext";function u2(){let n=S.useContext(hg);return fg(n,"You must render this element inside a <HydratedRouter> element"),n}function I3(n,e){let t=S.useContext(hg),[r,i]=S.useState(!1),[s,l]=S.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:h,onMouseLeave:d,onTouchStart:m}=e,g=S.useRef(null);S.useEffect(()=>{if(n==="render"&&l(!0),n==="viewport"){let b=R=>{R.forEach(T=>{l(T.isIntersecting)})},k=new IntersectionObserver(b,{threshold:.5});return g.current&&k.observe(g.current),()=>{k.disconnect()}}},[n]),S.useEffect(()=>{if(r){let b=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(b)}}},[r]);let y=()=>{i(!0)},x=()=>{i(!1),l(!1)};return t?n!=="intent"?[s,g,{}]:[s,g,{onFocus:Wl(c,y),onBlur:Wl(u,x),onMouseEnter:Wl(h,y),onMouseLeave:Wl(d,x),onTouchStart:Wl(m,y)}]:[!1,g,{}]}function Wl(n,e){return t=>{n&&n(t),t.defaultPrevented||e(t)}}function B3({page:n,...e}){let{router:t}=c2(),r=S.useMemo(()=>e2(t.routes,n,t.basename),[t.routes,n,t.basename]);return r?S.createElement(F3,{page:n,matches:r,...e}):null}function j3(n){let{manifest:e,routeModules:t}=u2(),[r,i]=S.useState([]);return S.useEffect(()=>{let s=!1;return O3(n,e,t).then(l=>{s||i(l)}),()=>{s=!0}},[n,e,t]),r}function F3({page:n,matches:e,...t}){let r=kr(),{manifest:i,routeModules:s}=u2(),{basename:l}=c2(),{loaderData:c,matches:u}=N3(),h=S.useMemo(()=>ax(n,e,u,i,r,"data"),[n,e,u,i,r]),d=S.useMemo(()=>ax(n,e,u,i,r,"assets"),[n,e,u,i,r]),m=S.useMemo(()=>{if(n===r.pathname+r.search+r.hash)return[];let x=new Set,b=!1;if(e.forEach(R=>{var O;let T=i.routes[R.route.id];!T||!T.hasLoader||(!h.some(P=>P.route.id===R.route.id)&&R.route.id in c&&((O=s[R.route.id])!=null&&O.shouldRevalidate)||T.hasClientLoader?b=!0:x.add(R.route.id))}),x.size===0)return[];let k=R3(n,l,"data");return b&&x.size>0&&k.searchParams.set("_routes",e.filter(R=>x.has(R.route.id)).map(R=>R.route.id).join(",")),[k.pathname+k.search]},[l,c,r,i,h,e,n,s]),g=S.useMemo(()=>P3(d,i),[d,i]),y=j3(d);return S.createElement(S.Fragment,null,m.map(x=>S.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...t})),g.map(x=>S.createElement("link",{key:x,rel:"modulepreload",href:x,...t})),y.map(({key:x,link:b})=>S.createElement("link",{key:x,nonce:t.nonce,...b})))}function z3(...n){return e=>{n.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}var f2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{f2&&(window.__reactRouterVersion="7.9.5")}catch{}function _3({basename:n,children:e,window:t}){let r=S.useRef();r.current==null&&(r.current=C4({window:t,v5Compat:!0}));let i=r.current,[s,l]=S.useState({action:i.action,location:i.location}),c=S.useCallback(u=>{S.startTransition(()=>l(u))},[l]);return S.useLayoutEffect(()=>i.listen(c),[i,c]),S.createElement(m3,{basename:n,children:e,location:s.location,navigationType:s.action,navigator:i})}var h2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,gi=S.forwardRef(function({onClick:e,discover:t="render",prefetch:r="none",relative:i,reloadDocument:s,replace:l,state:c,target:u,to:h,preventScrollReset:d,viewTransition:m,...g},y){let{basename:x}=S.useContext(Sr),b=typeof h=="string"&&h2.test(h),k,R=!1;if(typeof h=="string"&&b&&(k=h,f2))try{let Z=new URL(window.location.href),X=h.startsWith("//")?new URL(Z.protocol+h):new URL(h),Q=mi(X.pathname,x);X.origin===Z.origin&&Q!=null?h=Q+X.search+X.hash:R=!0}catch{or(!1,`<Link to="${h}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let T=X4(h,{relative:i}),[O,P,N]=I3(r,g),I=$3(h,{replace:l,state:c,target:u,preventScrollReset:d,relative:i,viewTransition:m});function B(Z){e&&e(Z),Z.defaultPrevented||I(Z)}let W=S.createElement("a",{...g,...N,href:k||T,onClick:R||s?e:B,ref:z3(y,P),target:u,"data-discover":!b&&t==="render"?"true":void 0});return O&&!b?S.createElement(S.Fragment,null,W,S.createElement(B3,{page:T})):W});gi.displayName="Link";var W3=S.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:i=!1,style:s,to:l,viewTransition:c,children:u,...h},d){let m=_a(l,{relative:h.relative}),g=kr(),y=S.useContext(_f),{navigator:x,basename:b}=S.useContext(Sr),k=y!=null&&G3(m)&&c===!0,R=x.encodeLocation?x.encodeLocation(m).pathname:m.pathname,T=g.pathname,O=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;t||(T=T.toLowerCase(),O=O?O.toLowerCase():null,R=R.toLowerCase()),O&&b&&(O=mi(O,b)||O);const P=R!=="/"&&R.endsWith("/")?R.length-1:R.length;let N=T===R||!i&&T.startsWith(R)&&T.charAt(P)==="/",I=O!=null&&(O===R||!i&&O.startsWith(R)&&O.charAt(R.length)==="/"),B={isActive:N,isPending:I,isTransitioning:k},W=N?e:void 0,Z;typeof r=="function"?Z=r(B):Z=[r,N?"active":null,I?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let X=typeof s=="function"?s(B):s;return S.createElement(gi,{...h,"aria-current":W,className:Z,ref:d,style:X,to:l,viewTransition:c},typeof u=="function"?u(B):u)});W3.displayName="NavLink";var V3=S.forwardRef(({discover:n="render",fetcherKey:e,navigate:t,reloadDocument:r,replace:i,state:s,method:l=Fu,action:c,onSubmit:u,relative:h,preventScrollReset:d,viewTransition:m,...g},y)=>{let x=Q3(),b=Y3(c,{relative:h}),k=l.toLowerCase()==="get"?"get":"post",R=typeof c=="string"&&h2.test(c),T=O=>{if(u&&u(O),O.defaultPrevented)return;O.preventDefault();let P=O.nativeEvent.submitter,N=(P==null?void 0:P.getAttribute("formmethod"))||l;x(P||O.currentTarget,{fetcherKey:e,method:N,navigate:t,replace:i,state:s,relative:h,preventScrollReset:d,viewTransition:m})};return S.createElement("form",{ref:y,method:k,action:b,onSubmit:r?u:T,...g,"data-discover":!R&&n==="render"?"true":void 0})});V3.displayName="Form";function H3(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function d2(n){let e=S.useContext(Yo);return mt(e,H3(n)),e}function $3(n,{target:e,replace:t,state:r,preventScrollReset:i,relative:s,viewTransition:l}={}){let c=Wf(),u=kr(),h=_a(n,{relative:s});return S.useCallback(d=>{if(b3(d,e)){d.preventDefault();let m=t!==void 0?t:pa(u)===pa(h);c(n,{replace:m,state:r,preventScrollReset:i,relative:s,viewTransition:l})}},[u,c,h,t,r,e,n,i,s,l])}function U3(n){or(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=S.useRef(Xp(n)),t=S.useRef(!1),r=kr(),i=S.useMemo(()=>S3(r.search,t.current?null:e.current),[r.search]),s=Wf(),l=S.useCallback((c,u)=>{const h=Xp(typeof c=="function"?c(new URLSearchParams(i)):c);t.current=!0,s("?"+h,u)},[s,i]);return[i,l]}var q3=0,K3=()=>`__${String(++q3)}__`;function Q3(){let{router:n}=d2("useSubmit"),{basename:e}=S.useContext(Sr),t=u3();return S.useCallback(async(r,i={})=>{let{action:s,method:l,encType:c,formData:u,body:h}=E3(r,e);if(i.navigate===!1){let d=i.fetcherKey||K3();await n.fetch(d,t,i.action||s,{preventScrollReset:i.preventScrollReset,formData:u,body:h,formMethod:i.method||l,formEncType:i.encType||c,flushSync:i.flushSync})}else await n.navigate(i.action||s,{preventScrollReset:i.preventScrollReset,formData:u,body:h,formMethod:i.method||l,formEncType:i.encType||c,replace:i.replace,state:i.state,fromRouteId:t,flushSync:i.flushSync,viewTransition:i.viewTransition})},[n,e,t])}function Y3(n,{relative:e}={}){let{basename:t}=S.useContext(Sr),r=S.useContext(ar);mt(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={..._a(n||".",{relative:e})},l=kr();if(n==null){s.search=l.search;let c=new URLSearchParams(s.search),u=c.getAll("index");if(u.some(d=>d==="")){c.delete("index"),u.filter(m=>m).forEach(m=>c.append("index",m));let d=c.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:di([t,s.pathname])),pa(s)}function G3(n,{relative:e}={}){let t=S.useContext(i2);mt(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=d2("useViewTransitionState"),i=_a(n,{relative:e});if(!t.isTransitioning)return!1;let s=mi(t.currentLocation.pathname,r)||t.currentLocation.pathname,l=mi(t.nextLocation.pathname,r)||t.nextLocation.pathname;return Zu(i.pathname,l)!=null||Zu(i.pathname,s)!=null}var Ur=Zw();const X3=()=>{},Le=typeof document<"u"?S.useLayoutEffect:X3;function Un(n,...e){const t=new URL(`https://base-ui.com/production-error/${n}`);return e.forEach(r=>t.searchParams.append("args[]",r)),`Base UI error #${n}; visit ${t} for the full message.`}const p2=S.createContext(void 0);function Wa(n){const e=S.useContext(p2);if(e===void 0&&!n)throw new Error(Un(72));return e}const cx={};function Si(n,e){const t=S.useRef(cx);return t.current===cx&&(t.current=n(e)),t}const J3=[];function m2(n){S.useEffect(n,J3)}const Vl=0;class rs{constructor(){Pt(this,"currentId",Vl);Pt(this,"clear",()=>{this.currentId!==Vl&&(clearTimeout(this.currentId),this.currentId=Vl)});Pt(this,"disposeEffect",()=>this.clear)}static create(){return new rs}start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Vl,t()},e)}isStarted(){return this.currentId!==Vl}}function Io(){const n=Si(rs.create).current;return m2(n.disposeEffect),n}function $f(){return typeof window<"u"}function Xo(n){return dg(n)?(n.nodeName||"").toLowerCase():"#document"}function Yt(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function qr(n){var e;return(e=(dg(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function dg(n){return $f()?n instanceof Node||n instanceof Yt(n).Node:!1}function Je(n){return $f()?n instanceof Element||n instanceof Yt(n).Element:!1}function gn(n){return $f()?n instanceof HTMLElement||n instanceof Yt(n).HTMLElement:!1}function Jp(n){return!$f()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Yt(n).ShadowRoot}const Z3=new Set(["inline","contents"]);function Va(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=$n(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!Z3.has(i)}const eR=new Set(["table","td","th"]);function tR(n){return eR.has(Xo(n))}const nR=[":popover-open",":modal"];function Uf(n){return nR.some(e=>{try{return n.matches(e)}catch{return!1}})}const rR=["transform","translate","scale","rotate","perspective"],iR=["transform","translate","scale","rotate","perspective","filter"],sR=["paint","layout","strict","content"];function pg(n){const e=qf(),t=Je(n)?$n(n):n;return rR.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||iR.some(r=>(t.willChange||"").includes(r))||sR.some(r=>(t.contain||"").includes(r))}function oR(n){let e=yi(n);for(;gn(e)&&!pi(e);){if(pg(e))return e;if(Uf(e))return null;e=yi(e)}return null}function qf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const lR=new Set(["html","body","#document"]);function pi(n){return lR.has(Xo(n))}function $n(n){return Yt(n).getComputedStyle(n)}function Kf(n){return Je(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function yi(n){if(Xo(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Jp(n)&&n.host||qr(n);return Jp(e)?e.host:e}function g2(n){const e=yi(n);return pi(e)?n.ownerDocument?n.ownerDocument.body:n.body:gn(e)&&Va(e)?e:g2(e)}function es(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=g2(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),l=Yt(i);if(s){const c=Zp(l);return e.concat(l,l.visualViewport||[],Va(i)?i:[],c&&t?es(c):[])}return e.concat(i,es(i,[],t))}function Zp(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function zs(n){const e=Si(aR,n).current;return e.next=n,Le(e.effect),e}function aR(n){const e={current:n,next:n,effect:()=>{e.current=e.next}};return e}const sp=Jw[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],cR=sp&&sp!==S.useLayoutEffect?sp:n=>n();function Ee(n){const e=Si(uR).current;return e.next=n,cR(e.effect),e.trampoline}function uR(){const n={next:void 0,callback:fR,trampoline:(...e)=>{var t;return(t=n.callback)==null?void 0:t.call(n,...e)},effect:()=>{n.callback=n.next}};return n}function fR(){}const Ha=typeof navigator<"u",op=gR(),hR=vR(),dR=yR();typeof CSS>"u"||!CSS.supports||CSS.supports("-webkit-backdrop-filter:none");op.platform==="MacIntel"&&op.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(op.platform);const y2=Ha&&/apple/i.test(navigator.vendor),pR=Ha&&hR.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,mR=dR.includes("jsdom/");function gR(){if(!Ha)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 yR(){if(!Ha)return"";const n=navigator.userAgentData;return n&&Array.isArray(n.brands)?n.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(" "):navigator.userAgent}function vR(){if(!Ha)return"";const n=navigator.userAgentData;return n!=null&&n.platform?n.platform:navigator.platform??""}const xR="data-base-ui-focusable",v2="active",x2="selected",w2="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Bo(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 Rt(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&&Jp(t)){let i=e;for(;i;){if(n===i)return!0;i=i.parentNode||i.host}}return!1}function _n(n){return"composedPath"in n?n.composedPath()[0]:n.target}function yr(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 wR(n){return n.matches("html,body")}function Vs(n){return(n==null?void 0:n.ownerDocument)||document}function bR(n){return gn(n)&&n.matches(w2)}function ef(n){if(!n||mR)return!0;try{return n.matches(":focus-visible")}catch{return!0}}function ra(n,e,t=!0){return n.filter(i=>{var s;return i.parentId===e&&(!t||((s=i.context)==null?void 0:s.open))}).flatMap(i=>[i,...ra(n,i.id,t)])}function SR(n){return"nativeEvent"in n}function ma(n,e){const t=["mouse","pen"];return t.push("",void 0),t.includes(n)}function kR(n){const e=n.type;return e==="click"||e==="mousedown"||e==="keydown"||e==="keyup"}const CR=["top","right","bottom","left"],jo=Math.min,Wn=Math.max,Fo=Math.round,au=Math.floor,Hr=n=>({x:n,y:n}),ER={left:"right",right:"left",bottom:"top",top:"bottom"},RR={start:"end",end:"start"};function em(n,e,t){return Wn(n,jo(e,t))}function vi(n,e){return typeof n=="function"?n(e):n}function An(n){return n.split("-")[0]}function us(n){return n.split("-")[1]}function mg(n){return n==="x"?"y":"x"}function gg(n){return n==="y"?"height":"width"}const TR=new Set(["top","bottom"]);function tr(n){return TR.has(An(n))?"y":"x"}function yg(n){return mg(tr(n))}function MR(n,e,t){t===void 0&&(t=!1);const r=us(n),i=yg(n),s=gg(i);let l=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(l=tf(l)),[l,tf(l)]}function OR(n){const e=tf(n);return[tm(n),e,tm(e)]}function tm(n){return n.replace(/start|end/g,e=>RR[e])}const ux=["left","right"],fx=["right","left"],PR=["top","bottom"],AR=["bottom","top"];function LR(n,e,t){switch(n){case"top":case"bottom":return t?e?fx:ux:e?ux:fx;case"left":case"right":return e?PR:AR;default:return[]}}function DR(n,e,t,r){const i=us(n);let s=LR(An(n),t==="start",r);return i&&(s=s.map(l=>l+"-"+i),e&&(s=s.concat(s.map(tm)))),s}function tf(n){return n.replace(/left|right|bottom|top/g,e=>ER[e])}function NR(n){return{top:0,right:0,bottom:0,left:0,...n}}function b2(n){return typeof n!="number"?NR(n):{top:n,right:n,bottom:n,left:n}}function nf(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}}const IR={...Jw};let hx=0;function BR(n,e="mui"){const[t,r]=S.useState(n),i=n||t;return S.useEffect(()=>{t==null&&(hx+=1,r(`${e}-${hx}`))},[t,e]),i}const dx=IR.useId;function Jo(n,e){if(dx!==void 0){const t=dx();return n??(e?`${e}-${t}`:t)}return BR(n,e)}function jR(){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 FR=S.createContext(null),zR=S.createContext(null),vg=()=>{var n;return((n=S.useContext(FR))==null?void 0:n.id)||null},Qf=n=>{const e=S.useContext(zR);return n??e};function Vn(){}const cn=Object.freeze({}),_R={style:{transition:"none"}},WR={fallbackAxisSide:"end"},$a="none",rf="trigger-press",ui="trigger-hover",nm="trigger-focus",VR="outside-press",xg="escape-key",HR="disabled",$R="imperative-action";function zt(n,e,t,r){let i=!1,s=!1;const l=cn;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,...l}}function Yf(n){return`data-base-ui-${n}`}function _u(n,e,t){if(t&&!ma(t))return 0;if(typeof n=="number")return n;if(typeof n=="function"){const r=n();return typeof r=="number"?r:r==null?void 0:r[e]}return n==null?void 0:n[e]}const S2=S.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new rs,currentIdRef:{current:null},currentContextRef:{current:null}});function UR(n){const{children:e,delay:t,timeoutMs:r=0}=n,i=S.useRef(t),s=S.useRef(t),l=S.useRef(null),c=S.useRef(null),u=Io();return C.jsx(S2.Provider,{value:S.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:s,currentIdRef:l,timeoutMs:r,currentContextRef:c,timeout:u}),[r,u]),children:e})}function qR(n,e={open:!1}){const t="rootStore"in n?n.rootStore:n,r=t.useState("floatingId"),{enabled:i=!0,open:s}=e,l=S.useContext(S2),{currentIdRef:c,delayRef:u,timeoutMs:h,initialDelayRef:d,currentContextRef:m,hasProvider:g,timeout:y}=l,[x,b]=S.useState(!1);return Le(()=>{function k(){var R;b(!1),(R=m.current)==null||R.setIsInstantPhase(!1),c.current=null,m.current=null,u.current=d.current}if(i&&c.current&&!s&&c.current===r){if(b(!1),h){const R=r;return y.start(h,()=>{t.select("open")||c.current&&c.current!==R||k()}),()=>{y.clear()}}k()}},[i,s,r,c,u,h,d,m,y,t]),Le(()=>{if(!i||!s)return;const k=m.current,R=c.current;y.clear(),m.current={onOpenChange:t.setOpen,setIsInstantPhase:b},c.current=r,u.current={open:0,close:_u(d.current,"close")},R!==null&&R!==r?(b(!0),k==null||k.setIsInstantPhase(!0),k==null||k.onOpenChange(!1,zt($a))):(b(!1),k==null||k.setIsInstantPhase(!1))},[i,s,r,t,c,u,h,d,m,y]),Le(()=>()=>{m.current=null},[m]),S.useMemo(()=>({hasProvider:g,delayRef:u,isInstantPhase:x}),[g,u,x])}function rm(n,e,t,r){const i=Si(k2).current;return QR(i,n,e,t,r)&&C2(i,[n,e,t,r]),i.callback}function KR(n){const e=Si(k2).current;return YR(e,n)&&C2(e,n),e.callback}function k2(){return{callback:null,cleanup:null,refs:[]}}function QR(n,e,t,r,i){return n.refs[0]!==e||n.refs[1]!==t||n.refs[2]!==r||n.refs[3]!==i}function YR(n,e){return n.refs.length!==e.length||n.refs.some((t,r)=>t!==e[r])}function C2(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 l=s(t);typeof l=="function"&&(r[i]=l);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 l=r[i];typeof l=="function"?l():s(null);break}case"object":{s.current=null;break}}}}}}}const wg={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},cu=null;class GR{constructor(){Pt(this,"callbacks",[]);Pt(this,"callbacksCount",0);Pt(this,"nextId",1);Pt(this,"startId",1);Pt(this,"isScheduled",!1);Pt(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 uu=new GR;class ai{constructor(){Pt(this,"currentId",cu);Pt(this,"cancel",()=>{this.currentId!==cu&&(uu.cancel(this.currentId),this.currentId=cu)});Pt(this,"disposeEffect",()=>this.cancel)}static create(){return new ai}static request(e){return uu.request(e)}static cancel(e){return uu.cancel(e)}request(e){this.cancel(),this.currentId=uu.request(()=>{this.currentId=cu,e()})}}function bg(){const n=Si(ai.create).current;return m2(n.disposeEffect),n}function Xi(n){return(n==null?void 0:n.ownerDocument)||document}const lp=S.forwardRef(function(e,t){const[r,i]=S.useState();Le(()=>{y2&&i("button")},[]);const s={tabIndex:0,role:r};return C.jsx("span",{...e,ref:t,style:wg,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})}),XR=parseInt(S.version,10);function Sg(n){return XR>=n}function px(n){if(!S.isValidElement(n))return null;const e=n,t=e.props;return(Sg(19)?t==null?void 0:t.ref:e.ref)??null}function im(n,e){if(n&&!e)return n;if(!n&&e)return e;if(n||e)return{...n,...e}}function JR(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 ZR(n,e){return typeof n=="function"?n(e):n}function eT(n,e){return typeof n=="function"?n(e):n}const ia={};function Gf(n,e,t,r,i){let s={...sm(n,ia)};return e&&(s=Wu(s,e)),t&&(s=Wu(s,t)),r&&(s=Wu(s,r)),s}function tT(n){if(n.length===0)return ia;if(n.length===1)return sm(n[0],ia);let e={...sm(n[0],ia)};for(let t=1;t<n.length;t+=1)e=Wu(e,n[t]);return e}function Wu(n,e){return E2(e)?e(n):nT(n,e)}function nT(n,e){if(!e)return n;for(const t in e){const r=e[t];switch(t){case"style":{n[t]=im(n.style,r);break}case"className":{n[t]=R2(n.className,r);break}default:rT(t,r)?n[t]=iT(n[t],r):n[t]=r}}return n}function rT(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 E2(n){return typeof n=="function"}function sm(n,e){return E2(n)?n(e):n??ia}function iT(n,e){return e?n?t=>{if(sT(t)){const i=t;om(i);const s=e(i);return i.baseUIHandlerPrevented||n==null||n(i),s}const r=e(t);return n==null||n(t),r}:e:n}function om(n){return n.preventBaseUIHandler=()=>{n.baseUIHandlerPrevented=!0},n}function R2(n,e){return e?n?e+" "+n:e:n}function sT(n){return n!=null&&typeof n=="object"&&"nativeEvent"in n}function vn(n,e,t={}){const r=e.render,i=oT(e,t);if(t.enabled===!1)return null;const s=t.state??cn;return lT(n,r,i,s)}function oT(n,e={}){const{className:t,style:r,render:i}=n,{state:s=cn,ref:l,props:c,stateAttributesMapping:u,enabled:h=!0}=e,d=h?ZR(t,s):void 0,m=h?eT(r,s):void 0,g=h?JR(s,u):cn,y=h?im(g,Array.isArray(c)?tT(c):c)??cn:cn;return typeof document<"u"&&(h?Array.isArray(l)?y.ref=KR([y.ref,px(i),...l]):y.ref=rm(y.ref,px(i),l):rm(null,null)),h?(d!==void 0&&(y.className=R2(y.className,d)),m!==void 0&&(y.style=im(y.style,m)),y):cn}function lT(n,e,t,r){if(e){if(typeof e=="function")return e(t,r);const i=Gf(t,e.props);return i.ref=t.ref,S.cloneElement(e,i)}if(n&&typeof n=="string")return aT(n,t);throw new Error(Un(8))}function aT(n,e){return n==="button"?S.createElement("button",{type:"button",...e,key:e.key}):n==="img"?S.createElement("img",{alt:"",...e,key:e.key}):S.createElement(n,e)}const cT=S.createContext(null),uT=()=>S.useContext(cT),fT=Yf("portal");function hT(n={}){const{ref:e,container:t,componentProps:r=cn,elementProps:i,elementState:s}=n,l=Jo(),c=uT(),u=c==null?void 0:c.portalNode,[h,d]=S.useState(null),[m,g]=S.useState(null),y=S.useRef(null);Le(()=>{if(t===null){y.current&&(y.current=null,g(null),d(null));return}if(l==null)return;const k=(t&&(dg(t)?t:t.current))??u??document.body;if(k==null){y.current&&(y.current=null,g(null),d(null));return}y.current!==k&&(y.current=k,g(null),d(k))},[t,u,l]);const x=vn("div",r,{ref:[e,g],state:s,props:[{id:l,[fT]:""},i]});return{portalNode:m,portalSubtree:h&&x?Ur.createPortal(x,h):null}}function dT(n){return n==null?n:"current"in n?n.current:n}function pT(n,e){let t=null,r=null,i=!1;return{contextElement:n||void 0,getBoundingClientRect(){var y;const s=(n==null?void 0:n.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l=e.axis==="x"||e.axis==="both",c=e.axis==="y"||e.axis==="both",u=["mouseenter","mousemove"].includes(((y=e.dataRef.current.openEvent)==null?void 0:y.type)||"")&&e.pointerType!=="touch";let h=s.width,d=s.height,m=s.x,g=s.y;return t==null&&e.x&&l&&(t=s.x-e.x),r==null&&e.y&&c&&(r=s.y-e.y),m-=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,m=l&&e.x!=null?e.x:m,g=c&&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:m,y:g,top:g,right:m+h,bottom:g+d,left:m}}}}function mx(n){return n!=null&&n.clientX!=null}function mT(n,e={}){const t="rootStore"in n?n.rootStore:n,r=t.useState("open"),i=t.useState("floatingElement"),s=t.useState("domReferenceElement"),l=t.context.dataRef,{enabled:c=!0,axis:u="both",x:h=null,y:d=null}=e,m=S.useRef(!1),g=S.useRef(null),[y,x]=S.useState(),[b,k]=S.useState([]),R=Ee((I,B)=>{m.current||l.current.openEvent&&!mx(l.current.openEvent)||t.set("positionReference",pT(s,{x:I,y:B,axis:u,dataRef:l,pointerType:y}))}),T=Ee(I=>{h!=null||d!=null||(r?g.current||k([]):R(I.clientX,I.clientY))}),O=ma(y)?i:r,P=S.useCallback(()=>{if(!O||!c||h!=null||d!=null)return;const I=Yt(i);function B(W){const Z=_n(W);Rt(i,Z)?(I.removeEventListener("mousemove",B),g.current=null):R(W.clientX,W.clientY)}if(!l.current.openEvent||mx(l.current.openEvent)){I.addEventListener("mousemove",B);const W=()=>{I.removeEventListener("mousemove",B),g.current=null};return g.current=W,W}t.set("positionReference",s)},[O,c,h,d,i,l,s,t,R]);S.useEffect(()=>P(),[P,b]),S.useEffect(()=>{c&&!i&&(m.current=!1)},[c,i]),S.useEffect(()=>{!c&&r&&(m.current=!0)},[c,r]),Le(()=>{c&&(h!=null||d!=null)&&(m.current=!1,R(h,d))},[c,h,d,R]);const N=S.useMemo(()=>{function I(B){x(B.pointerType)}return{onPointerDown:I,onPointerEnter:I,onMouseMove:T,onMouseEnter:T}},[T]);return S.useMemo(()=>c?{reference:N}:{},[c,N])}function gx(n,e,t){let{reference:r,floating:i}=n;const s=tr(e),l=yg(e),c=gg(l),u=An(e),h=s==="y",d=r.x+r.width/2-i.width/2,m=r.y+r.height/2-i.height/2,g=r[c]/2-i[c]/2;let y;switch(u){case"top":y={x:d,y:r.y-i.height};break;case"bottom":y={x:d,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-i.width,y:m};break;default:y={x:r.x,y:r.y}}switch(us(e)){case"start":y[l]-=g*(t&&h?-1:1);break;case"end":y[l]+=g*(t&&h?-1:1);break}return y}const gT=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:l}=t,c=s.filter(Boolean),u=await(l.isRTL==null?void 0:l.isRTL(e));let h=await l.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:m}=gx(h,r,u),g=r,y={},x=0;for(let b=0;b<c.length;b++){const{name:k,fn:R}=c[b],{x:T,y:O,data:P,reset:N}=await R({x:d,y:m,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:h,platform:l,elements:{reference:n,floating:e}});d=T??d,m=O??m,y={...y,[k]:{...y[k],...P}},N&&x<=50&&(x++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(h=N.rects===!0?await l.getElementRects({reference:n,floating:e,strategy:i}):N.rects),{x:d,y:m}=gx(h,g,u)),b=-1)}return{x:d,y:m,placement:g,strategy:i,middlewareData:y}};async function ga(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:l,elements:c,strategy:u}=n,{boundary:h="clippingAncestors",rootBoundary:d="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=vi(e,n),x=b2(y),k=c[g?m==="floating"?"reference":"floating":m],R=nf(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(k)))==null||t?k:k.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:h,rootBoundary:d,strategy:u})),T=m==="floating"?{x:r,y:i,width:l.floating.width,height:l.floating.height}:l.reference,O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.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},N=nf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:O,strategy:u}):T);return{top:(R.top-N.top+x.top)/P.y,bottom:(N.bottom-R.bottom+x.bottom)/P.y,left:(R.left-N.left+x.left)/P.x,right:(N.right-R.right+x.right)/P.x}}const yT=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:s,rects:l,initialPlacement:c,platform:u,elements:h}=e,{mainAxis:d=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:b=!0,...k}=vi(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const R=An(i),T=tr(c),O=An(c)===c,P=await(u.isRTL==null?void 0:u.isRTL(h.floating)),N=g||(O||!b?[tf(c)]:OR(c)),I=x!=="none";!g&&I&&N.push(...DR(c,b,x,P));const B=[c,...N],W=await ga(e,k),Z=[];let X=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&Z.push(W[R]),m){const Y=MR(i,l,P);Z.push(W[Y[0]],W[Y[1]])}if(X=[...X,{placement:i,overflows:Z}],!Z.every(Y=>Y<=0)){var Q,U;const Y=(((Q=s.flip)==null?void 0:Q.index)||0)+1,J=B[Y];if(J&&(!(m==="alignment"?T!==tr(J):!1)||X.every(A=>tr(A.placement)===T?A.overflows[0]>0:!0)))return{data:{index:Y,overflows:X},reset:{placement:J}};let q=(U=X.filter(H=>H.overflows[0]<=0).sort((H,A)=>H.overflows[1]-A.overflows[1])[0])==null?void 0:U.placement;if(!q)switch(y){case"bestFit":{var j;const H=(j=X.filter(A=>{if(I){const D=tr(A.placement);return D===T||D==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(D=>D>0).reduce((D,z)=>D+z,0)]).sort((A,D)=>A[1]-D[1])[0])==null?void 0:j[0];H&&(q=H);break}case"initialPlacement":q=c;break}if(i!==q)return{reset:{placement:q}}}return{}}}};function yx(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function vx(n){return CR.some(e=>n[e]>=0)}const vT=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=vi(n,e);switch(r){case"referenceHidden":{const s=await ga(e,{...i,elementContext:"reference"}),l=yx(s,t.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:vx(l)}}}case"escaped":{const s=await ga(e,{...i,altBoundary:!0}),l=yx(s,t.floating);return{data:{escapedOffsets:l,escaped:vx(l)}}}default:return{}}}}},T2=new Set(["left","top"]);async function xT(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),l=An(t),c=us(t),u=tr(t)==="y",h=T2.has(l)?-1:1,d=s&&u?-1:1,m=vi(e,n);let{mainAxis:g,crossAxis:y,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof x=="number"&&(y=c==="end"?x*-1:x),u?{x:y*d,y:g*h}:{x:g*h,y:y*d}}const wT=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:l,middlewareData:c}=e,u=await xT(e,n);return l===((t=c.offset)==null?void 0:t.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:l}}}}},bT=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:k=>{let{x:R,y:T}=k;return{x:R,y:T}}},...u}=vi(n,e),h={x:t,y:r},d=await ga(e,u),m=tr(An(i)),g=mg(m);let y=h[g],x=h[m];if(s){const k=g==="y"?"top":"left",R=g==="y"?"bottom":"right",T=y+d[k],O=y-d[R];y=em(T,y,O)}if(l){const k=m==="y"?"top":"left",R=m==="y"?"bottom":"right",T=x+d[k],O=x-d[R];x=em(T,x,O)}const b=c.fn({...e,[g]:y,[m]:x});return{...b,data:{x:b.x-t,y:b.y-r,enabled:{[g]:s,[m]:l}}}}}},ST=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:i,rects:s,middlewareData:l}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=vi(n,e),d={x:t,y:r},m=tr(i),g=mg(m);let y=d[g],x=d[m];const b=vi(c,e),k=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]+k.mainAxis,N=s.reference[g]+s.reference[O]-k.mainAxis;y<P?y=P:y>N&&(y=N)}if(h){var R,T;const O=g==="y"?"width":"height",P=T2.has(An(i)),N=s.reference[m]-s.floating[O]+(P&&((R=l.offset)==null?void 0:R[m])||0)+(P?0:k.crossAxis),I=s.reference[m]+s.reference[O]+(P?0:((T=l.offset)==null?void 0:T[m])||0)-(P?k.crossAxis:0);x<N?x=N:x>I&&(x=I)}return{[g]:y,[m]:x}}}},kT=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:s,platform:l,elements:c}=e,{apply:u=()=>{},...h}=vi(n,e),d=await ga(e,h),m=An(i),g=us(i),y=tr(i)==="y",{width:x,height:b}=s.floating;let k,R;m==="top"||m==="bottom"?(k=m,R=g===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(R=m,k=g==="end"?"top":"bottom");const T=b-d.top-d.bottom,O=x-d.left-d.right,P=jo(b-d[k],T),N=jo(x-d[R],O),I=!e.middlewareData.shift;let B=P,W=N;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(W=O),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(B=T),I&&!g){const X=Wn(d.left,0),Q=Wn(d.right,0),U=Wn(d.top,0),j=Wn(d.bottom,0);y?W=x-2*(X!==0||Q!==0?X+Q:Wn(d.left,d.right)):B=b-2*(U!==0||j!==0?U+j:Wn(d.top,d.bottom))}await u({...e,availableWidth:W,availableHeight:B});const Z=await l.getDimensions(c.floating);return x!==Z.width||b!==Z.height?{reset:{rects:!0}}:{}}}};function M2(n){const e=$n(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=gn(n),s=i?n.offsetWidth:t,l=i?n.offsetHeight:r,c=Fo(t)!==s||Fo(r)!==l;return c&&(t=s,r=l),{width:t,height:r,$:c}}function kg(n){return Je(n)?n:n.contextElement}function Ro(n){const e=kg(n);if(!gn(e))return Hr(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=M2(e);let l=(s?Fo(t.width):t.width)/r,c=(s?Fo(t.height):t.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const CT=Hr(0);function O2(n){const e=Yt(n);return!qf()||!e.visualViewport?CT:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ET(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Yt(n)?!1:e}function Hs(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=kg(n);let l=Hr(1);e&&(r?Je(r)&&(l=Ro(r)):l=Ro(n));const c=ET(s,t,r)?O2(s):Hr(0);let u=(i.left+c.x)/l.x,h=(i.top+c.y)/l.y,d=i.width/l.x,m=i.height/l.y;if(s){const g=Yt(s),y=r&&Je(r)?Yt(r):r;let x=g,b=Zp(x);for(;b&&r&&y!==x;){const k=Ro(b),R=b.getBoundingClientRect(),T=$n(b),O=R.left+(b.clientLeft+parseFloat(T.paddingLeft))*k.x,P=R.top+(b.clientTop+parseFloat(T.paddingTop))*k.y;u*=k.x,h*=k.y,d*=k.x,m*=k.y,u+=O,h+=P,x=Yt(b),b=Zp(x)}}return nf({width:d,height:m,x:u,y:h})}function Xf(n,e){const t=Kf(n).scrollLeft;return e?e.left+t:Hs(qr(n)).left+t}function P2(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-Xf(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function RT(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",l=qr(r),c=e?Uf(e.floating):!1;if(r===l||c&&s)return t;let u={scrollLeft:0,scrollTop:0},h=Hr(1);const d=Hr(0),m=gn(r);if((m||!m&&!s)&&((Xo(r)!=="body"||Va(l))&&(u=Kf(r)),gn(r))){const y=Hs(r);h=Ro(r),d.x=y.x+r.clientLeft,d.y=y.y+r.clientTop}const g=l&&!m&&!s?P2(l,u):Hr(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 TT(n){return Array.from(n.getClientRects())}function MT(n){const e=qr(n),t=Kf(n),r=n.ownerDocument.body,i=Wn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Wn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-t.scrollLeft+Xf(n);const c=-t.scrollTop;return $n(r).direction==="rtl"&&(l+=Wn(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:l,y:c}}const xx=25;function OT(n,e){const t=Yt(n),r=qr(n),i=t.visualViewport;let s=r.clientWidth,l=r.clientHeight,c=0,u=0;if(i){s=i.width,l=i.height;const d=qf();(!d||d&&e==="fixed")&&(c=i.offsetLeft,u=i.offsetTop)}const h=Xf(r);if(h<=0){const d=r.ownerDocument,m=d.body,g=getComputedStyle(m),y=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(r.clientWidth-m.clientWidth-y);x<=xx&&(s-=x)}else h<=xx&&(s+=h);return{width:s,height:l,x:c,y:u}}const PT=new Set(["absolute","fixed"]);function AT(n,e){const t=Hs(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=gn(n)?Ro(n):Hr(1),l=n.clientWidth*s.x,c=n.clientHeight*s.y,u=i*s.x,h=r*s.y;return{width:l,height:c,x:u,y:h}}function wx(n,e,t){let r;if(e==="viewport")r=OT(n,t);else if(e==="document")r=MT(qr(n));else if(Je(e))r=AT(e,t);else{const i=O2(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return nf(r)}function A2(n,e){const t=yi(n);return t===e||!Je(t)||pi(t)?!1:$n(t).position==="fixed"||A2(t,e)}function LT(n,e){const t=e.get(n);if(t)return t;let r=es(n,[],!1).filter(c=>Je(c)&&Xo(c)!=="body"),i=null;const s=$n(n).position==="fixed";let l=s?yi(n):n;for(;Je(l)&&!pi(l);){const c=$n(l),u=pg(l);!u&&c.position==="fixed"&&(i=null),(s?!u&&!i:!u&&c.position==="static"&&!!i&&PT.has(i.position)||Va(l)&&!u&&A2(n,l))?r=r.filter(d=>d!==l):i=c,l=yi(l)}return e.set(n,r),r}function DT(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const l=[...t==="clippingAncestors"?Uf(e)?[]:LT(e,this._c):[].concat(t),r],c=l[0],u=l.reduce((h,d)=>{const m=wx(e,d,i);return h.top=Wn(m.top,h.top),h.right=jo(m.right,h.right),h.bottom=jo(m.bottom,h.bottom),h.left=Wn(m.left,h.left),h},wx(e,c,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function NT(n){const{width:e,height:t}=M2(n);return{width:e,height:t}}function IT(n,e,t){const r=gn(e),i=qr(e),s=t==="fixed",l=Hs(n,!0,s,e);let c={scrollLeft:0,scrollTop:0};const u=Hr(0);function h(){u.x=Xf(i)}if(r||!r&&!s)if((Xo(e)!=="body"||Va(i))&&(c=Kf(e)),r){const y=Hs(e,!0,s,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else i&&h();s&&!r&&i&&h();const d=i&&!r&&!s?P2(i,c):Hr(0),m=l.left+c.scrollLeft-u.x-d.x,g=l.top+c.scrollTop-u.y-d.y;return{x:m,y:g,width:l.width,height:l.height}}function ap(n){return $n(n).position==="static"}function bx(n,e){if(!gn(n)||$n(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return qr(n)===t&&(t=t.ownerDocument.body),t}function L2(n,e){const t=Yt(n);if(Uf(n))return t;if(!gn(n)){let i=yi(n);for(;i&&!pi(i);){if(Je(i)&&!ap(i))return i;i=yi(i)}return t}let r=bx(n,e);for(;r&&tR(r)&&ap(r);)r=bx(r,e);return r&&pi(r)&&ap(r)&&!pg(r)?t:r||oR(n)||t}const BT=async function(n){const e=this.getOffsetParent||L2,t=this.getDimensions,r=await t(n.floating);return{reference:IT(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function jT(n){return $n(n).direction==="rtl"}const FT={convertOffsetParentRelativeRectToViewportRelativeRect:RT,getDocumentElement:qr,getClippingRect:DT,getOffsetParent:L2,getElementRects:BT,getClientRects:TT,getDimensions:NT,getScale:Ro,isElement:Je,isRTL:jT};function D2(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function zT(n,e){let t=null,r;const i=qr(n);function s(){var c;clearTimeout(r),(c=t)==null||c.disconnect(),t=null}function l(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),s();const h=n.getBoundingClientRect(),{left:d,top:m,width:g,height:y}=h;if(c||e(),!g||!y)return;const x=au(m),b=au(i.clientWidth-(d+g)),k=au(i.clientHeight-(m+y)),R=au(d),O={rootMargin:-x+"px "+-b+"px "+-k+"px "+-R+"px",threshold:Wn(0,jo(1,u))||1};let P=!0;function N(I){const B=I[0].intersectionRatio;if(B!==u){if(!P)return l();B?l(!1,B):r=setTimeout(()=>{l(!1,1e-7)},1e3)}B===1&&!D2(h,n.getBoundingClientRect())&&l(),P=!1}try{t=new IntersectionObserver(N,{...O,root:i.ownerDocument})}catch{t=new IntersectionObserver(N,O)}t.observe(n)}return l(!0),s}function Sx(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=kg(n),d=i||s?[...h?es(h):[],...es(e)]:[];d.forEach(R=>{i&&R.addEventListener("scroll",t,{passive:!0}),s&&R.addEventListener("resize",t)});const m=h&&c?zT(h,t):null;let g=-1,y=null;l&&(y=new ResizeObserver(R=>{let[T]=R;T&&T.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var O;(O=y)==null||O.observe(e)})),t()}),h&&!u&&y.observe(h),y.observe(e));let x,b=u?Hs(n):null;u&&k();function k(){const R=Hs(n);b&&!D2(b,R)&&t(),b=R,x=requestAnimationFrame(k)}return t(),()=>{var R;d.forEach(T=>{i&&T.removeEventListener("scroll",t),s&&T.removeEventListener("resize",t)}),m==null||m(),(R=y)==null||R.disconnect(),y=null,u&&cancelAnimationFrame(x)}}const _T=wT,WT=bT,VT=yT,HT=kT,$T=vT,UT=ST,qT=(n,e,t)=>{const r=new Map,i={platform:FT,...t},s={...i.platform,_c:r};return gT(n,e,{...i,platform:s})};var KT=typeof document<"u",QT=function(){},Vu=KT?S.useLayoutEffect:QT;function sf(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(!sf(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)&&!sf(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function N2(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function kx(n,e){const t=N2(n);return Math.round(e*t)/t}function cp(n){const e=S.useRef(n);return Vu(()=>{e.current=n}),e}function YT(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:u,open:h}=n,[d,m]=S.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=S.useState(r);sf(g,r)||y(r);const[x,b]=S.useState(null),[k,R]=S.useState(null),T=S.useCallback(A=>{A!==I.current&&(I.current=A,b(A))},[]),O=S.useCallback(A=>{A!==B.current&&(B.current=A,R(A))},[]),P=s||x,N=l||k,I=S.useRef(null),B=S.useRef(null),W=S.useRef(d),Z=u!=null,X=cp(u),Q=cp(i),U=cp(h),j=S.useCallback(()=>{if(!I.current||!B.current)return;const A={placement:e,strategy:t,middleware:g};Q.current&&(A.platform=Q.current),qT(I.current,B.current,A).then(D=>{const z={...D,isPositioned:U.current!==!1};Y.current&&!sf(W.current,z)&&(W.current=z,Ur.flushSync(()=>{m(z)}))})},[g,e,t,Q,U]);Vu(()=>{h===!1&&W.current.isPositioned&&(W.current.isPositioned=!1,m(A=>({...A,isPositioned:!1})))},[h]);const Y=S.useRef(!1);Vu(()=>(Y.current=!0,()=>{Y.current=!1}),[]),Vu(()=>{if(P&&(I.current=P),N&&(B.current=N),P&&N){if(X.current)return X.current(P,N,j);j()}},[P,N,j,X,Z]);const J=S.useMemo(()=>({reference:I,floating:B,setReference:T,setFloating:O}),[T,O]),q=S.useMemo(()=>({reference:P,floating:N}),[P,N]),H=S.useMemo(()=>{const A={position:t,left:0,top:0};if(!q.floating)return A;const D=kx(q.floating,d.x),z=kx(q.floating,d.y);return c?{...A,transform:"translate("+D+"px, "+z+"px)",...N2(q.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:D,top:z}},[t,c,q.floating,d.x,d.y]);return S.useMemo(()=>({...d,update:j,refs:J,elements:q,floatingStyles:H}),[d,j,J,q,H])}const GT=(n,e)=>({..._T(n),options:[n,e]}),XT=(n,e)=>({...WT(n),options:[n,e]}),JT=(n,e)=>({...UT(n),options:[n,e]}),ZT=(n,e)=>({...VT(n),options:[n,e]}),eM=(n,e)=>({...HT(n),options:[n,e]}),tM=(n,e)=>({...$T(n),options:[n,e]}),nM={intentional:"onClick",sloppy:"onPointerDown"};function rM(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 iM(n,e={}){const t="rootStore"in n?n.rootStore:n,r=t.useState("open"),i=t.useState("floatingElement"),s=t.useState("referenceElement"),l=t.useState("domReferenceElement"),{onOpenChange:c,dataRef:u}=t.context,{enabled:h=!0,escapeKey:d=!0,outsidePress:m=!0,outsidePressEvent:g="sloppy",referencePress:y=!1,referencePressEvent:x="sloppy",ancestorScroll:b=!1,bubbles:k,externalTree:R}=e,T=Qf(R),O=Ee(typeof m=="function"?m:()=>!1),P=typeof m=="function"?O:m,N=S.useRef(!1),{escapeKey:I,outsidePress:B}=rM(k),W=S.useRef(null),Z=Io(),X=Io(),Q=Ee(()=>{X.clear(),u.current.insideReactTree=!1}),U=S.useRef(!1),j=S.useRef(""),Y=Ee(le=>{j.current=le.pointerType}),J=Ee(()=>{const le=j.current,Se=le==="pen"||!le?"mouse":le,ve=typeof g=="function"?g():g;return typeof ve=="string"?ve:ve[Se]}),q=Ee(le=>{var _e;if(!r||!h||!d||le.key!=="Escape"||U.current)return;const Se=(_e=u.current.floatingContext)==null?void 0:_e.nodeId,ve=T?ra(T.nodesRef.current,Se):[];if(!I&&ve.length>0){let Qe=!0;if(ve.forEach(At=>{var $t;($t=At.context)!=null&&$t.open&&!At.context.dataRef.current.__escapeKeyBubbles&&(Qe=!1)}),!Qe)return}const at=SR(le)?le.nativeEvent:le,De=zt(xg,at);t.setOpen(!1,De),!I&&!De.isPropagationAllowed&&le.stopPropagation()}),H=Ee(le=>{const Se=J();return Se==="intentional"&&le.type!=="click"||Se==="sloppy"&&le.type==="click"}),A=Ee(()=>{u.current.insideReactTree=!0,X.start(0,Q)}),D=Ee((le,Se=!1)=>{var gt;if(H(le)){Q();return}if(u.current.insideReactTree){Q();return}if(J()==="intentional"&&Se||typeof P=="function"&&!P(le))return;const ve=_n(le),at=`[${Yf("inert")}]`,De=Vs(t.select("floatingElement")).querySelectorAll(at),_e=t.context.triggerElements;if(ve&&(_e.hasElement(ve)||_e.hasMatchingElement(Ve=>Rt(Ve,ve))))return;let Qe=Je(ve)?ve:null;for(;Qe&&!pi(Qe);){const Ve=yi(Qe);if(pi(Ve)||!Je(Ve))break;Qe=Ve}if(De.length&&Je(ve)&&!wR(ve)&&!Rt(ve,t.select("floatingElement"))&&Array.from(De).every(Ve=>!Rt(Qe,Ve)))return;if(gn(ve)&&!("touches"in le)){const Ve=pi(ve),$e=$n(ve),Dt=/auto|scroll/,Me=Ve||Dt.test($e.overflowX),Pe=Ve||Dt.test($e.overflowY),Xe=Me&&ve.clientWidth>0&&ve.scrollWidth>ve.clientWidth,Ze=Pe&&ve.clientHeight>0&&ve.scrollHeight>ve.clientHeight,tt=$e.direction==="rtl",Ye=Ze&&(tt?le.offsetX<=ve.offsetWidth-ve.clientWidth:le.offsetX>ve.clientWidth),Ge=Xe&&le.offsetY>ve.clientHeight;if(Ye||Ge)return}const At=(gt=u.current.floatingContext)==null?void 0:gt.nodeId,$t=T&&ra(T.nodesRef.current,At).some(Ve=>{var $e;return yr(le,($e=Ve.context)==null?void 0:$e.elements.floating)});if(yr(le,t.select("floatingElement"))||yr(le,t.select("domReferenceElement"))||$t)return;const Lt=T?ra(T.nodesRef.current,At):[];if(Lt.length>0){let Ve=!0;if(Lt.forEach($e=>{var Dt;(Dt=$e.context)!=null&&Dt.open&&!$e.context.dataRef.current.__outsidePressBubbles&&(Ve=!1)}),!Ve)return}t.setOpen(!1,zt(VR,le)),Q()}),z=Ee(le=>{J()!=="sloppy"||le.pointerType==="touch"||!t.select("open")||!h||yr(le,t.select("floatingElement"))||yr(le,t.select("domReferenceElement"))||D(le)}),M=Ee(le=>{if(J()!=="sloppy"||!t.select("open")||!h||yr(le,t.select("floatingElement"))||yr(le,t.select("domReferenceElement")))return;const Se=le.touches[0];Se&&(W.current={startTime:Date.now(),startX:Se.clientX,startY:Se.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},Z.start(1e3,()=>{W.current&&(W.current.dismissOnTouchEnd=!1,W.current.dismissOnMouseDown=!1)}))}),V=Ee(le=>{const Se=_n(le);function ve(){M(le),Se==null||Se.removeEventListener(le.type,ve)}Se==null||Se.addEventListener(le.type,ve)}),oe=Ee(le=>{const Se=N.current;if(N.current=!1,Z.clear(),le.type==="mousedown"&&W.current&&!W.current.dismissOnMouseDown)return;const ve=_n(le);function at(){le.type==="pointerdown"?z(le):D(le,Se),ve==null||ve.removeEventListener(le.type,at)}ve==null||ve.addEventListener(le.type,at)}),ce=Ee(le=>{if(J()!=="sloppy"||!W.current||yr(le,t.select("floatingElement"))||yr(le,t.select("domReferenceElement")))return;const Se=le.touches[0];if(!Se)return;const ve=Math.abs(Se.clientX-W.current.startX),at=Math.abs(Se.clientY-W.current.startY),De=Math.sqrt(ve*ve+at*at);De>5&&(W.current.dismissOnTouchEnd=!0),De>10&&(D(le),Z.clear(),W.current=null)}),he=Ee(le=>{const Se=_n(le);function ve(){ce(le),Se==null||Se.removeEventListener(le.type,ve)}Se==null||Se.addEventListener(le.type,ve)}),se=Ee(le=>{J()!=="sloppy"||!W.current||yr(le,t.select("floatingElement"))||yr(le,t.select("domReferenceElement"))||(W.current.dismissOnTouchEnd&&D(le),Z.clear(),W.current=null)}),fe=Ee(le=>{const Se=_n(le);function ve(){se(le),Se==null||Se.removeEventListener(le.type,ve)}Se==null||Se.addEventListener(le.type,ve)});S.useEffect(()=>{if(!r||!h)return;u.current.__escapeKeyBubbles=I,u.current.__outsidePressBubbles=B;const le=new rs;function Se(Qe){t.setOpen(!1,zt($a,Qe))}function ve(){le.clear(),U.current=!0}function at(){le.start(qf()?5:0,()=>{U.current=!1})}const De=Vs(i);De.addEventListener("pointerdown",Y,!0),d&&(De.addEventListener("keydown",q),De.addEventListener("compositionstart",ve),De.addEventListener("compositionend",at)),P&&(De.addEventListener("click",oe,!0),De.addEventListener("pointerdown",oe,!0),De.addEventListener("touchstart",V,!0),De.addEventListener("touchmove",he,!0),De.addEventListener("touchend",fe,!0),De.addEventListener("mousedown",oe,!0));let _e=[];return b&&(Je(l)&&(_e=es(l)),Je(i)&&(_e=_e.concat(es(i))),!Je(s)&&s&&s.contextElement&&(_e=_e.concat(es(s.contextElement)))),_e=_e.filter(Qe=>{var At;return Qe!==((At=De.defaultView)==null?void 0:At.visualViewport)}),_e.forEach(Qe=>{Qe.addEventListener("scroll",Se,{passive:!0})}),()=>{De.removeEventListener("pointerdown",Y,!0),d&&(De.removeEventListener("keydown",q),De.removeEventListener("compositionstart",ve),De.removeEventListener("compositionend",at)),P&&(De.removeEventListener("click",oe,!0),De.removeEventListener("pointerdown",oe,!0),De.removeEventListener("touchstart",V,!0),De.removeEventListener("touchmove",he,!0),De.removeEventListener("touchend",fe,!0),De.removeEventListener("mousedown",oe,!0)),_e.forEach(Qe=>{Qe.removeEventListener("scroll",Se)}),le.clear()}},[u,i,s,l,d,P,r,c,b,h,I,B,q,D,oe,z,V,he,fe,Y,t]),S.useEffect(Q,[P,Q]);const ke=S.useMemo(()=>({onKeyDown:q,...y&&{[nM[x]]:le=>{t.setOpen(!1,zt(rf,le.nativeEvent))},...x!=="intentional"&&{onClick(le){t.setOpen(!1,zt(rf,le.nativeEvent))}}}}),[q,t,y,x]),Oe=Ee(le=>{const Se=_n(le.nativeEvent);!Rt(t.select("floatingElement"),Se)||le.button!==0||(N.current=!0)}),Fe=S.useMemo(()=>({onKeyDown:q,onPointerDown:Oe,onMouseDown:Oe,onMouseUp:Oe,onClickCapture:A,onMouseDownCapture:A,onPointerDownCapture:A,onMouseUpCapture:A,onTouchEndCapture:A,onTouchMoveCapture:A}),[q,Oe,A]);return S.useMemo(()=>h?{reference:ke,floating:Fe,trigger:ke}:{},[h,ke,Fe])}var of=Symbol("NOT_FOUND");function sM(n,e=`expected a function, instead received ${typeof n}`){if(typeof n!="function")throw new TypeError(e)}function oM(n,e=`expected an object, instead received ${typeof n}`){if(typeof n!="object")throw new TypeError(e)}function lM(n,e="expected all items to be functions, instead received the following types: "){if(!n.every(t=>typeof t=="function")){const t=n.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${t}]`)}}var Cx=n=>Array.isArray(n)?n:[n];function aM(n){const e=Array.isArray(n[0])?n[0]:n;return lM(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function cM(n,e){const t=[],{length:r}=n;for(let i=0;i<r;i++)t.push(n[i].apply(null,e));return t}function uM(n){let e;return{get(t){return e&&n(e.key,t)?e.value:of},put(t,r){e={key:t,value:r}},getEntries(){return e?[e]:[]},clear(){e=void 0}}}function fM(n,e){let t=[];function r(c){const u=t.findIndex(h=>e(c,h.key));if(u>-1){const h=t[u];return u>0&&(t.splice(u,1),t.unshift(h)),h.value}return of}function i(c,u){r(c)===of&&(t.unshift({key:c,value:u}),t.length>n&&t.pop())}function s(){return t}function l(){t=[]}return{get:r,put:i,getEntries:s,clear:l}}var hM=(n,e)=>n===e;function dM(n){return function(t,r){if(t===null||r===null||t.length!==r.length)return!1;const{length:i}=t;for(let s=0;s<i;s++)if(!n(t[s],r[s]))return!1;return!0}}function pM(n,e){const t=typeof e=="object"?e:{equalityCheck:e},{equalityCheck:r=hM,maxSize:i=1,resultEqualityCheck:s}=t,l=dM(r);let c=0;const u=i<=1?uM(l):fM(i,l);function h(){let d=u.get(arguments);if(d===of){if(d=n.apply(null,arguments),c++,s){const g=u.getEntries().find(y=>s(y.value,d));g&&(d=g.value,c!==0&&c--)}u.put(arguments,d)}return d}return h.clearCache=()=>{u.clear(),h.resetResultsCount()},h.resultsCount=()=>c,h.resetResultsCount=()=>{c=0},h}var mM=class{constructor(n){this.value=n}deref(){return this.value}},gM=typeof WeakRef<"u"?WeakRef:mM,yM=0,Ex=1;function fu(){return{s:yM,v:void 0,o:null,p:null}}function I2(n,e={}){let t=fu();const{resultEqualityCheck:r}=e;let i,s=0;function l(){var m;let c=t;const{length:u}=arguments;for(let g=0,y=u;g<y;g++){const x=arguments[g];if(typeof x=="function"||typeof x=="object"&&x!==null){let b=c.o;b===null&&(c.o=b=new WeakMap);const k=b.get(x);k===void 0?(c=fu(),b.set(x,c)):c=k}else{let b=c.p;b===null&&(c.p=b=new Map);const k=b.get(x);k===void 0?(c=fu(),b.set(x,c)):c=k}}const h=c;let d;if(c.s===Ex)d=c.v;else if(d=n.apply(null,arguments),s++,r){const g=((m=i==null?void 0:i.deref)==null?void 0:m.call(i))??i;g!=null&&r(g,d)&&(d=g,s!==0&&s--),i=typeof d=="object"&&d!==null||typeof d=="function"?new gM(d):d}return h.s=Ex,h.v=d,d}return l.clearCache=()=>{t=fu(),l.resetResultsCount()},l.resultsCount=()=>s,l.resetResultsCount=()=>{s=0},l}function B2(n,...e){const t=typeof n=="function"?{memoize:n,memoizeOptions:e}:n,r=(...i)=>{let s=0,l=0,c,u={},h=i.pop();typeof h=="object"&&(u=h,h=i.pop()),sM(h,`createSelector expects an output function after the inputs, but received: [${typeof h}]`);const d={...t,...u},{memoize:m,memoizeOptions:g=[],argsMemoize:y=I2,argsMemoizeOptions:x=[]}=d,b=Cx(g),k=Cx(x),R=aM(i),T=m(function(){return s++,h.apply(null,arguments)},...b),O=y(function(){l++;const N=cM(R,arguments);return c=T.apply(null,N),c},...k);return Object.assign(O,{resultFunc:h,memoizedResultFunc:T,dependencies:R,dependencyRecomputations:()=>l,resetDependencyRecomputations:()=>{l=0},lastResult:()=>c,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:m,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var vM=B2(I2),xM=Object.assign((n,e=vM)=>{oM(n,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof n}`);const t=Object.keys(n),r=t.map(s=>n[s]);return e(r,(...s)=>s.reduce((l,c,u)=>(l[t[u]]=c,l),{}))},{withTypes:()=>xM});B2({memoize:pM,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const nt=(n,e,t,r,i,s,...l)=>{if(l.length>0)throw new Error(Un(1));let c;if(n)c=n;else throw new Error("Missing arguments");return c};var up={exports:{}},fp={};/**
|
|
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 Rx;function wM(){if(Rx)return fp;Rx=1;var n=Fa();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,i=n.useEffect,s=n.useLayoutEffect,l=n.useDebugValue;function c(m,g){var y=g(),x=r({inst:{value:y,getSnapshot:g}}),b=x[0].inst,k=x[1];return s(function(){b.value=y,b.getSnapshot=g,u(b)&&k({inst:b})},[m,y,g]),i(function(){return u(b)&&k({inst:b}),m(function(){u(b)&&k({inst:b})})},[m]),l(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!t(m,y)}catch{return!0}}function h(m,g){return g()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return fp.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:d,fp}var Tx;function j2(){return Tx||(Tx=1,up.exports=wM()),up.exports}var bM=j2(),hp={exports:{}},dp={};/**
|
|
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 Mx;function SM(){if(Mx)return dp;Mx=1;var n=Fa(),e=j2();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,l=n.useEffect,c=n.useMemo,u=n.useDebugValue;return dp.useSyncExternalStoreWithSelector=function(h,d,m,g,y){var x=s(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=c(function(){function R(I){if(!T){if(T=!0,O=I,I=g(I),y!==void 0&&b.hasValue){var B=b.value;if(y(B,I))return P=B}return P=I}if(B=P,r(O,I))return B;var W=g(I);return y!==void 0&&y(B,W)?(O=I,B):(O=I,P=W)}var T=!1,O,P,N=m===void 0?null:m;return[function(){return R(d())},N===null?void 0:function(){return R(N())}]},[d,m,g,y]);var k=i(h,x[0],x[1]);return l(function(){b.hasValue=!0,b.value=k},[k]),u(k),k},dp}var Ox;function kM(){return Ox||(Ox=1,hp.exports=SM()),hp.exports}var CM=kM();const EM=Sg(19),RM=EM?MM:OM;function TM(n,e,t,r,i){return RM(n,e,t,r,i)}function MM(n,e,t,r,i){const s=S.useCallback(()=>e(n.getSnapshot(),t,r,i),[n,e,t,r,i]);return bM.useSyncExternalStore(n.subscribe,s,s)}function OM(n,e,t,r,i){return CM.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getSnapshot,s=>e(s,t,r,i))}class sa{constructor(e){Pt(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Pt(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])){sa.prototype.setState.call(this,{...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||sa.prototype.setState.call(this,{...this.state,[e]:t})}notifyAll(){const e={...this.state};sa.prototype.setState.call(this,e)}}class F2 extends sa{constructor(t,r={},i){super(t);Pt(this,"controlledValues",new Map);Pt(this,"select",(t,r,i,s)=>{const l=this.selectors[t];return l(this.state,r,i,s)});Pt(this,"useState",(t,r,i,s)=>{S.useDebugValue(t);const l=this.selectors[t];return TM(this,l,r,i,s)});this.context=r,this.selectors=i}useSyncedValue(t,r){S.useDebugValue(t),Le(()=>{this.state[t]!==r&&this.set(t,r)},[t,r])}useSyncedValueWithCleanup(t,r){Le(()=>(this.state[t]!==r&&this.set(t,r),()=>{this.set(t,void 0)}),[t,r])}useSyncedValues(t){const r=Object.values(t);Le(()=>{this.update(t)},r)}useControlledProp(t,r,i){S.useDebugValue(t);const s=r!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,s),!s&&!Object.is(this.state[t],i)&&super.setState({...this.state,[t]:i})),Le(()=>{s&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})},[t,r,i,s])}set(t,r){this.controlledValues.get(t)!==!0&&super.set(t,r)}update(t){const r={...t};for(const i in r)if(Object.hasOwn(r,i)&&this.controlledValues.get(i)===!0){delete r[i];continue}super.update(r)}setState(t){const r={...t};for(const i in r)if(Object.hasOwn(r,i)&&this.controlledValues.get(i)===!0){delete r[i];continue}super.setState({...this.state,...r})}useContextCallback(t,r){S.useDebugValue(t);const i=Ee(r??Vn);this.context[t]=i}useStateSetter(t){const r=S.useRef(void 0);return r.current===void 0&&(r.current=i=>{this.set(t,i)}),r.current}observe(t,r){let i;typeof t=="function"?i=t:i=this.selectors[t];let s=i(this.state);return r(s,s,this),this.subscribe(l=>{const c=i(l);if(!Object.is(s,c)){const u=s;s=c,r(c,u,this)}})}}const PM={open:nt(n=>n.open),domReferenceElement:nt(n=>n.domReferenceElement),referenceElement:nt(n=>n.positionReference??n.referenceElement),floatingElement:nt(n=>n.floatingElement),floatingId:nt(n=>n.floatingId)};class Cg extends F2{constructor(t){const{nested:r,noEmit:i,onOpenChange:s,triggerElements:l,...c}=t;super({...c,positionReference:c.referenceElement,domReferenceElement:c.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:jR(),nested:r,noEmit:i,triggerElements:l},PM);Pt(this,"setOpen",(t,r)=>{var i,s;if((!t||!this.state.open||kR(r.event))&&(this.context.dataRef.current.openEvent=t?r.event:void 0),!this.context.noEmit){const l={open:t,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",l)}(s=(i=this.context).onOpenChange)==null||s.call(i,t,r)})}}function z2(n,e=!1,t=!1){const[r,i]=S.useState(n&&e?"idle":void 0),[s,l]=S.useState(n);return n&&!s&&(l(!0),i("starting")),!n&&s&&r!=="ending"&&!t&&i("ending"),!n&&!s&&r==="ending"&&i(void 0),Le(()=>{if(!n&&s&&r!=="ending"&&t){const c=ai.request(()=>{i("ending")});return()=>{ai.cancel(c)}}},[n,s,r,t]),Le(()=>{if(!n||e)return;const c=ai.request(()=>{i(void 0)});return()=>{ai.cancel(c)}},[e,n]),Le(()=>{if(!n||!e)return;n&&s&&r!=="idle"&&i("starting");const c=ai.request(()=>{i("idle")});return()=>{ai.cancel(c)}},[e,n,s,i,r]),S.useMemo(()=>({mounted:s,setMounted:l,transitionStatus:r}),[s,r])}function Eg(n,e=!1,t=!0){const r=bg();return Ee((i,s=null)=>{r.cancel();const l=dT(n);l!=null&&(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?i():r.request(()=>{function c(){l&&Promise.all(l.getAnimations().map(u=>u.finished)).then(()=>{s!=null&&s.aborted||Ur.flushSync(i)}).catch(()=>{if(t){if(s!=null&&s.aborted)return;Ur.flushSync(i)}else l.getAnimations().length>0&&l.getAnimations().some(u=>u.pending||u.playState!=="finished")&&c()})}e?r.request(c):c()}))})}function Jf(n){const{enabled:e=!0,open:t,ref:r,onComplete:i}=n,s=zs(t),l=Ee(i),c=Eg(r,t);S.useEffect(()=>{e&&c(()=>{t===s.current&&l()})},[e,t,l,c,s])}function AM(n,e){const t=S.useRef(null);return S.useCallback(r=>{n!==void 0&&(t.current!==null&&(e.context.triggerElements.delete(t.current),t.current=null),r!==null&&(t.current=n,e.context.triggerElements.add(n,r)))},[e,n])}function LM(n,e,t,r){const i=t.useState("isMountedByTrigger",n),s=AM(n,t),l=Ee(c=>{s(c),c!==null&&t.select("open")&&t.select("activeTriggerId")==null&&t.update({activeTriggerId:n,activeTriggerElement:c,...r})});return Le(()=>{i&&t.update({activeTriggerElement:e.current,...r})},[i,t,e,...Object.values(r)]),{registerTrigger:l,isMountedByThisTrigger:i}}function DM(n){const e=n.useState("open");Le(()=>{if(e&&!n.select("activeTriggerId")&&n.context.triggerElements.size===1){const t=n.context.triggerElements.entries().next();if(!t.done){const[r,i]=t.value;n.update({activeTriggerId:r,activeTriggerElement:i})}}},[e,n])}function NM(n,e,t){const{mounted:r,setMounted:i,transitionStatus:s}=z2(n);e.useSyncedValues({mounted:r,transitionStatus:s});const l=Ee(()=>{var u,h;i(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),(h=(u=e.context).onOpenChangeComplete)==null||h.call(u,!1)}),c=e.useState("preventUnmountingOnClose");return Jf({enabled:!c,open:n,ref:e.context.popupRef,onComplete(){n||l()}}),{forceUnmount:l,transitionStatus:s}}class Rg{constructor(){this.elements=new Set,this.idMap=new Map}add(e,t){const r=this.idMap.get(e);r!==t&&(r!==void 0&&this.elements.delete(r),this.elements.add(t),this.idMap.set(e,t))}delete(e){const t=this.idMap.get(e);t&&(this.elements.delete(t),this.idMap.delete(e))}hasElement(e){return this.elements.has(e)}hasMatchingElement(e){for(const t of this.elements)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function IM(){return new Cg({open:!1,floatingElement:null,referenceElement:null,triggerElements:new Rg,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function BM(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:IM(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:cn,inactiveTriggerProps:cn,popupProps:cn}}const jM={open:nt(n=>n.open),mounted:nt(n=>n.mounted),transitionStatus:nt(n=>n.transitionStatus),floatingRootContext:nt(n=>n.floatingRootContext),preventUnmountingOnClose:nt(n=>n.preventUnmountingOnClose),payload:nt(n=>n.payload),activeTriggerId:nt(n=>n.activeTriggerId),activeTriggerElement:nt(n=>n.mounted?n.activeTriggerElement:null),isTriggerActive:nt((n,e)=>e!==void 0&&n.activeTriggerId===e),isOpenedByTrigger:nt((n,e)=>e!==void 0&&n.activeTriggerId===e&&n.open),isMountedByTrigger:nt((n,e)=>e!==void 0&&n.activeTriggerId===e&&n.mounted),triggerProps:nt((n,e)=>e?n.activeTriggerProps:n.inactiveTriggerProps),popupProps:nt(n=>n.popupProps),popupElement:nt(n=>n.popupElement),positionerElement:nt(n=>n.positionerElement)};function FM(n){const{open:e=!1,onOpenChange:t,elements:r={}}=n,i=Jo(),s=vg()!=null,l=Si(()=>new Cg({open:e,onOpenChange:t,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new Rg,floatingId:i,nested:s,noEmit:n.noEmit||!1})).current;return Le(()=>{const c={open:e,floatingId:i};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Je(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),l.update(c)},[e,i,r.reference,r.floating,l]),l.context.onOpenChange=t,l.context.nested=s,l.context.noEmit=n.noEmit||!1,l}function zM(n={}){const{nodeId:e,externalTree:t}=n,r=FM(n),i=n.rootContext||r,s={reference:i.useState("referenceElement"),floating:i.useState("floatingElement"),domReference:i.useState("domReferenceElement")},[l,c]=S.useState(null),u=S.useRef(null),h=Qf(t);Le(()=>{s.domReference&&(u.current=s.domReference)},[s.domReference]);const d=YT({...n,elements:{...s,...l&&{reference:l}}}),m=S.useCallback(B=>{const W=Je(B)?{getBoundingClientRect:()=>B.getBoundingClientRect(),getClientRects:()=>B.getClientRects(),contextElement:B}:B;c(W),d.refs.setReference(W)},[d.refs]),[g,y]=S.useState(null),[x,b]=S.useState(null);i.useSyncedValue("referenceElement",g),i.useSyncedValue("domReferenceElement",Je(g)?g:null),i.useSyncedValue("floatingElement",x);const k=S.useCallback(B=>{(Je(B)||B===null)&&(u.current=B,y(B)),(Je(d.refs.reference.current)||d.refs.reference.current===null||B!==null&&!Je(B))&&d.refs.setReference(B)},[d.refs,y]),R=S.useCallback(B=>{b(B),d.refs.setFloating(B)},[d.refs]),T=S.useMemo(()=>({...d.refs,setReference:k,setFloating:R,setPositionReference:m,domReference:u}),[d.refs,k,R,m]),O=S.useMemo(()=>({...d.elements,domReference:s.domReference}),[d.elements,s.domReference]),P=i.useState("open"),N=i.useState("floatingId"),I=S.useMemo(()=>({...d,dataRef:i.context.dataRef,open:P,onOpenChange:i.setOpen,events:i.context.events,floatingId:N,refs:T,elements:O,nodeId:e,rootStore:i}),[d,T,O,e,i,P,N]);return Le(()=>{i.context.dataRef.current.floatingContext=I;const B=h==null?void 0:h.nodesRef.current.find(W=>W.id===e);B&&(B.context=I)}),S.useMemo(()=>({...d,context:I,refs:T,elements:O,rootStore:i}),[d,T,O,I,i])}function _M(n){const{popupStore:e,noEmit:t=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=n,s=Jo(),l=vg()!=null,c=e.useState("open"),u=e.useState("activeTriggerElement"),h=e.useState(r?"popupElement":"positionerElement"),d=e.context.triggerElements,m=Si(()=>new Cg({open:c,referenceElement:u,floatingElement:h,triggerElements:d,onOpenChange:i,floatingId:s,nested:l,noEmit:t})).current;return Le(()=>{const g={open:c,floatingId:s,referenceElement:u,floatingElement:h};Je(u)&&(g.domReferenceElement=u),m.update(g)},[c,s,u,h,m]),m.context.onOpenChange=i,m.context.nested=l,m.context.noEmit=t,m}const pp=pR&&y2;function WM(n,e={}){const t="rootStore"in n?n.rootStore:n,{events:r,dataRef:i}=t.context,{enabled:s=!0,visibleOnly:l=!0}=e,c=S.useRef(!1),u=Io(),h=S.useRef(!0);S.useEffect(()=>{const m=t.select("domReferenceElement");if(!s)return;const g=Yt(m);function y(){!t.select("open")&&gn(m)&&m===Bo(Vs(m))&&(c.current=!0)}function x(){h.current=!0}function b(){h.current=!1}return g.addEventListener("blur",y),pp&&(g.addEventListener("keydown",x,!0),g.addEventListener("pointerdown",b,!0)),()=>{g.removeEventListener("blur",y),pp&&(g.removeEventListener("keydown",x,!0),g.removeEventListener("pointerdown",b,!0))}},[t,s]),S.useEffect(()=>{if(!s)return;function m(g){(g.reason===rf||g.reason===xg)&&(c.current=!0)}return r.on("openchange",m),()=>{r.off("openchange",m)}},[r,s]);const d=S.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(m){if(c.current)return;const g=_n(m.nativeEvent);if(l&&Je(g)){if(pp&&!m.relatedTarget){if(!h.current&&!bR(g))return}else if(!ef(g))return}t.setOpen(!0,zt(nm,m.nativeEvent,m.currentTarget))},onBlur(m){c.current=!1;const g=m.relatedTarget,y=m.nativeEvent,x=Je(g)&&g.hasAttribute(Yf("focus-guard"))&&g.getAttribute("data-type")==="outside";u.start(0,()=>{var R;const b=t.select("domReferenceElement"),k=Bo(b?b.ownerDocument:document);!g&&k===b||Rt((R=i.current.floatingContext)==null?void 0:R.refs.floating.current,k)||Rt(b,k)||x||t.context.triggerElements.hasElement(m.relatedTarget)||t.setOpen(!1,zt(nm,y))})}}),[i,t,l,u]);return S.useMemo(()=>s?{reference:d,trigger:d}:{},[s,d])}const lm=Yf("safe-polygon"),VM=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${w2}`;function HM(n){return n?!!n.closest(VM):!1}function _2(n){const e=S.useRef(void 0),t=S.useRef(!1),r=S.useRef(void 0),i=S.useRef(!0),s=S.useRef(!1),l=S.useRef(()=>{}),c=S.useRef(!1),u=Io(),h=Io(),d=S.useRef(void 0);return S.useMemo(()=>{const m=n.context.dataRef.current;return m.hoverInteractionState||(m.hoverInteractionState={pointerTypeRef:e,interactedInsideRef:t,handlerRef:r,blockMouseMoveRef:i,performedPointerEventsMutationRef:s,unbindMouseMoveRef:l,restTimeoutPendingRef:c,openChangeTimeout:u,restTimeout:h,handleCloseOptionsRef:d}),m.hoverInteractionState},[n,e,t,r,i,s,l,c,u,h,d])}const $M=new Set(["click","mousedown"]);function UM(n,e={}){const t="rootStore"in n?n.rootStore:n,r=t.useState("open"),i=t.useState("floatingElement"),s=t.useState("domReferenceElement"),{dataRef:l}=t.context,{enabled:c=!0,closeDelay:u=0,externalTree:h}=e,{pointerTypeRef:d,interactedInsideRef:m,handlerRef:g,performedPointerEventsMutationRef:y,unbindMouseMoveRef:x,restTimeoutPendingRef:b,openChangeTimeout:k,handleCloseOptionsRef:R}=_2(t),T=Qf(h),O=vg(),P=Ee(()=>m.current?!0:l.current.openEvent?$M.has(l.current.openEvent.type):!1),N=Ee(()=>{var Q;const X=(Q=l.current.openEvent)==null?void 0:Q.type;return(X==null?void 0:X.includes("mouse"))&&X!=="mousedown"}),I=S.useCallback((X,Q=!0)=>{const U=qM(u,d.current);U&&!g.current?k.start(U,()=>t.setOpen(!1,zt(ui,X))):Q&&(k.clear(),t.setOpen(!1,zt(ui,X)))},[u,g,t,d,k]),B=Ee(()=>{x.current(),g.current=void 0}),W=Ee(()=>{if(y.current){const X=Vs(i).body;X.style.pointerEvents="",X.removeAttribute(lm),y.current=!1}}),Z=Ee(X=>{const Q=_n(X);if(!HM(Q)){m.current=!1;return}m.current=!0});Le(()=>{r||(d.current=void 0,b.current=!1,m.current=!1,B(),W())},[r,d,b,m,B,W]),S.useEffect(()=>()=>{B()},[B]),S.useEffect(()=>W,[W]),Le(()=>{var X,Q,U;if(c&&r&&(X=R.current)!=null&&X.blockPointerEvents&&N()&&Je(s)&&i){y.current=!0;const j=Vs(i).body;j.setAttribute(lm,"");const Y=s,J=i,q=(U=(Q=T==null?void 0:T.nodesRef.current.find(H=>H.id===O))==null?void 0:Q.context)==null?void 0:U.elements.floating;return q&&(q.style.pointerEvents=""),j.style.pointerEvents="none",Y.style.pointerEvents="auto",J.style.pointerEvents="auto",()=>{j.style.pointerEvents="",Y.style.pointerEvents="",J.style.pointerEvents=""}}},[c,r,s,i,R,N,T,O,y]),S.useEffect(()=>{if(!c)return;function X(Y){if(P()||!l.current.floatingContext||!t.select("open"))return;const J=t.context.triggerElements;Y.relatedTarget&&J.hasElement(Y.relatedTarget)||(W(),B(),P()||I(Y))}function Q(Y){var J;k.clear(),W(),(J=g.current)==null||J.call(g,Y),B()}function U(Y){P()||I(Y,!1)}const j=i;return j&&(j.addEventListener("mouseleave",X),j.addEventListener("mouseenter",Q),j.addEventListener("mouseleave",U),j.addEventListener("pointerdown",Z,!0)),()=>{j&&(j.removeEventListener("mouseleave",X),j.removeEventListener("mouseenter",Q),j.removeEventListener("mouseleave",U),j.removeEventListener("pointerdown",Z,!0))}})}function qM(n,e){return e&&!ma(e)?0:typeof n=="function"?n():n}function mp(n){return typeof n=="function"?n():n}const KM={current:null};function QM(n,e={}){var H;const t="rootStore"in n?n.rootStore:n,{dataRef:r,events:i}=t.context,{enabled:s=!0,delay:l=0,handleClose:c=null,mouseOnly:u=!1,restMs:h=0,move:d=!0,triggerElementRef:m=KM,externalTree:g,isActiveTrigger:y=!0}=e,x=Qf(g),{pointerTypeRef:b,interactedInsideRef:k,handlerRef:R,blockMouseMoveRef:T,performedPointerEventsMutationRef:O,unbindMouseMoveRef:P,restTimeoutPendingRef:N,openChangeTimeout:I,restTimeout:B,handleCloseOptionsRef:W}=_2(t),Z=zs(c),X=zs(l),Q=zs(h);y&&(W.current=(H=Z.current)==null?void 0:H.__options);const U=Ee(()=>k.current?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),j=S.useCallback((A,D=!0)=>{const z=_u(X.current,"close",b.current);z&&!R.current?I.start(z,()=>t.setOpen(!1,zt(ui,A))):D&&(I.clear(),t.setOpen(!1,zt(ui,A)))},[X,R,t,b,I]),Y=Ee(()=>{P.current(),R.current=void 0}),J=Ee(()=>{if(O.current){const A=Vs(t.select("domReferenceElement")).body;A.style.pointerEvents="",A.removeAttribute(lm),O.current=!1}});S.useEffect(()=>{if(!s)return;function A(D){D.open||(I.clear(),B.clear(),T.current=!0,N.current=!1)}return i.on("openchange",A),()=>{i.off("openchange",A)}},[s,i,I,B,T,N]);const q=Ee(A=>{var M;if(U()||!r.current.floatingContext)return;const D=t.context.triggerElements;if(A.relatedTarget&&D.hasElement(A.relatedTarget))return;const z=m.current;(M=Z.current)==null||M.call(Z,{...r.current.floatingContext,tree:x,x:A.clientX,y:A.clientY,onClose(){J(),Y(),!U()&&z===t.select("domReferenceElement")&&j(A)}})(A)});return S.useEffect(()=>{if(!s)return;const A=m.current??(y?t.select("domReferenceElement"):null);if(!Je(A))return;function D(V){if(I.clear(),T.current=!1,u&&!ma(b.current)||mp(Q.current)>0&&!_u(X.current,"open"))return;const oe=_u(X.current,"open",b.current),ce=t.select("domReferenceElement"),he=t.context.triggerElements,se=(he.hasElement(V.target)||he.hasMatchingElement(Oe=>Rt(Oe,V.target)))&&(!ce||!Rt(ce,V.target)),fe=V.currentTarget??null,ke=!t.select("open")||se;oe?I.start(oe,()=>{ke&&t.setOpen(!0,zt(ui,V,fe))}):ke&&t.setOpen(!0,zt(ui,V,fe))}function z(V){if(U()){J();return}P.current();const oe=t.select("domReferenceElement"),ce=Vs(oe);B.clear(),N.current=!1;const he=t.context.triggerElements;if(V.relatedTarget&&he.hasElement(V.relatedTarget))return;if(Z.current&&r.current.floatingContext){t.select("open")||I.clear();const fe=m.current;R.current=Z.current({...r.current.floatingContext,tree:x,x:V.clientX,y:V.clientY,onClose(){J(),Y(),!U()&&fe===t.select("domReferenceElement")&&j(V,!0)}});const ke=R.current;ke(V),ce.addEventListener("mousemove",ke),P.current=()=>{ce.removeEventListener("mousemove",ke)};return}(b.current==="touch"?!Rt(t.select("floatingElement"),V.relatedTarget):!0)&&j(V)}function M(V){q(V)}return t.select("open")&&A.addEventListener("mouseleave",M),d&&A.addEventListener("mousemove",D,{once:!0}),A.addEventListener("mouseenter",D),A.addEventListener("mouseleave",z),()=>{A.removeEventListener("mouseleave",M),d&&A.removeEventListener("mousemove",D),A.removeEventListener("mouseenter",D),A.removeEventListener("mouseleave",z)}},[Y,J,T,r,X,j,t,s,Z,q,y,U,u,d,b,Q,B,N,I,m,x,P,R]),S.useMemo(()=>{function A(D){b.current=D.pointerType}return{onPointerDown:A,onPointerEnter:A,onMouseMove(D){const{nativeEvent:z}=D,M=D.currentTarget,V=t.select("domReferenceElement"),oe=t.context.triggerElements,ce=t.select("open"),he=(oe.hasElement(D.target)||oe.hasMatchingElement(fe=>Rt(fe,D.target)))&&(!V||!Rt(V,D.target));if(u&&!ma(b.current)||ce&&!he||mp(Q.current)===0||!he&&N.current&&D.movementX**2+D.movementY**2<2)return;B.clear();function se(){!T.current&&(!ce||he)&&t.setOpen(!0,zt(ui,z,M))}b.current==="touch"?Ur.flushSync(()=>{se()}):he&&ce?se():(N.current=!0,B.start(mp(Q.current),se))}}},[T,u,t,b,Q,B,N])}function YM(n=[]){const e=n.map(h=>h==null?void 0:h.reference),t=n.map(h=>h==null?void 0:h.floating),r=n.map(h=>h==null?void 0:h.item),i=n.map(h=>h==null?void 0:h.trigger),s=S.useCallback(h=>hu(h,n,"reference"),e),l=S.useCallback(h=>hu(h,n,"floating"),t),c=S.useCallback(h=>hu(h,n,"item"),r),u=S.useCallback(h=>hu(h,n,"trigger"),i);return S.useMemo(()=>({getReferenceProps:s,getFloatingProps:l,getItemProps:c,getTriggerProps:u}),[s,l,c,u])}function hu(n,e,t){var l;const r=new Map,i=t==="item",s={};t==="floating"&&(s.tabIndex=-1,s[xR]="");for(const c in n)i&&n&&(c===v2||c===x2)||(s[c]=n[c]);for(let c=0;c<e.length;c+=1){let u;const h=(l=e[c])==null?void 0:l[t];typeof h=="function"?u=n?h(n):null:u=h,u&&Px(s,u,i,r)}return Px(s,n,i,r),s}function Px(n,e,t,r){var i;for(const s in e){const l=e[s];t&&(s===v2||s===x2)||(s.startsWith("on")?(r.has(s)||r.set(s,[]),typeof l=="function"&&((i=r.get(s))==null||i.push(l),n[s]=(...c)=>{var u;return(u=r.get(s))==null?void 0:u.map(h=>h(...c)).find(h=>h!==void 0)})):n[s]=l)}}function Ax(n,e){const[t,r]=n;let i=!1;const s=e.length;for(let l=0,c=s-1;l<s;c=l++){const[u,h]=e[l]||[0,0],[d,m]=e[c]||[0,0];h>=r!=m>=r&&t<=(d-u)*(r-h)/(m-h)+u&&(i=!i)}return i}function GM(n,e){return n[0]>=e.x&&n[0]<=e.x+e.width&&n[1]>=e.y&&n[1]<=e.y+e.height}function XM(n={}){const{buffer:e=.5,blockPointerEvents:t=!1,requireIntent:r=!0}=n,i=new rs;let s=!1,l=null,c=null,u=typeof performance<"u"?performance.now():0;function h(m,g){const y=performance.now(),x=y-u;if(l===null||c===null||x===0)return l=m,c=g,u=y,null;const b=m-l,k=g-c,T=Math.sqrt(b*b+k*k)/x;return l=m,c=g,u=y,T}const d=({x:m,y:g,placement:y,elements:x,onClose:b,nodeId:k,tree:R})=>function(O){function P(){i.clear(),b()}if(i.clear(),!x.domReference||!x.floating||y==null||m==null||g==null)return;const{clientX:N,clientY:I}=O,B=[N,I],W=_n(O),Z=O.type==="mouseleave",X=Rt(x.floating,W),Q=Rt(x.domReference,W),U=x.domReference.getBoundingClientRect(),j=x.floating.getBoundingClientRect(),Y=y.split("-")[0],J=m>j.right-j.width/2,q=g>j.bottom-j.height/2,H=GM(B,U),A=j.width>U.width,D=j.height>U.height,z=(A?U:j).left,M=(A?U:j).right,V=(D?U:j).top,oe=(D?U:j).bottom;if(X&&(s=!0,!Z))return;if(Q&&(s=!1),Q&&!Z){s=!0;return}if(Z&&Je(O.relatedTarget)&&Rt(x.floating,O.relatedTarget)||R&&ra(R.nodesRef.current,k).some(({context:se})=>se==null?void 0:se.open))return;if(Y==="top"&&g>=U.bottom-1||Y==="bottom"&&g<=U.top+1||Y==="left"&&m>=U.right-1||Y==="right"&&m<=U.left+1)return P();let ce=[];switch(Y){case"top":ce=[[z,U.top+1],[z,j.bottom-1],[M,j.bottom-1],[M,U.top+1]];break;case"bottom":ce=[[z,j.top+1],[z,U.bottom-1],[M,U.bottom-1],[M,j.top+1]];break;case"left":ce=[[j.right-1,oe],[j.right-1,V],[U.left+1,V],[U.left+1,oe]];break;case"right":ce=[[U.right-1,oe],[U.right-1,V],[j.left+1,V],[j.left+1,oe]];break}function he([se,fe]){switch(Y){case"top":{const ke=[A?se+e/2:J?se+e*4:se-e*4,fe+e+1],Oe=[A?se-e/2:J?se+e*4:se-e*4,fe+e+1],Fe=[[j.left,J||A?j.bottom-e:j.top],[j.right,J?A?j.bottom-e:j.top:j.bottom-e]];return[ke,Oe,...Fe]}case"bottom":{const ke=[A?se+e/2:J?se+e*4:se-e*4,fe-e],Oe=[A?se-e/2:J?se+e*4:se-e*4,fe-e],Fe=[[j.left,J||A?j.top+e:j.bottom],[j.right,J?A?j.top+e:j.bottom:j.top+e]];return[ke,Oe,...Fe]}case"left":{const ke=[se+e+1,D?fe+e/2:q?fe+e*4:fe-e*4],Oe=[se+e+1,D?fe-e/2:q?fe+e*4:fe-e*4];return[...[[q||D?j.right-e:j.left,j.top],[q?D?j.right-e:j.left:j.right-e,j.bottom]],ke,Oe]}case"right":{const ke=[se-e,D?fe+e/2:q?fe+e*4:fe-e*4],Oe=[se-e,D?fe-e/2:q?fe+e*4:fe-e*4],Fe=[[q||D?j.left+e:j.right,j.top],[q?D?j.left+e:j.right:j.left+e,j.bottom]];return[ke,Oe,...Fe]}default:return[]}}if(!Ax([N,I],ce)){if(s&&!H)return P();if(!Z&&r){const se=h(O.clientX,O.clientY);if(se!==null&&se<.1)return P()}Ax([N,I],he([m,g]))?!s&&r&&i.start(40,P):P()}};return d.__options={blockPointerEvents:t},d}const JM={...jM,disabled:nt(n=>n.disabled),instantType:nt(n=>n.instantType),isInstantPhase:nt(n=>n.isInstantPhase),trackCursorAxis:nt(n=>n.trackCursorAxis),disableHoverablePopup:nt(n=>n.disableHoverablePopup),lastOpenChangeReason:nt(n=>n.openChangeReason),closeDelay:nt(n=>n.closeDelay)};class Tg extends F2{constructor(t){super({...ZM(),...t},{popupRef:S.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Rg},JM);Pt(this,"setOpen",(t,r)=>{var h,d;const i=r.reason,s=i===ui,l=t&&i===nm,c=!t&&(i===rf||i===xg);if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},(d=(h=this.context).onOpenChange)==null||d.call(h,t,r),r.isCanceled)return;const u=()=>{var y;const m={open:t,openChangeReason:i};l?m.instantType="focus":c?m.instantType="dismiss":i===ui&&(m.instantType=void 0);const g=((y=r.trigger)==null?void 0:y.id)??null;(g||t)&&(m.activeTriggerId=g,m.activeTriggerElement=r.trigger??null),this.update(m)};s?Ur.flushSync(u):u()})}static useStore(t,r){const i=Si(()=>t??new Tg(r)).current,s=_M({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=s,i}}function ZM(){return{...BM(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function eO(n){const{disabled:e=!1,defaultOpen:t=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:s="none",actionsRef:l,onOpenChange:c,onOpenChangeComplete:u,handle:h,triggerId:d,defaultTriggerId:m=null,children:g}=n,y=Tg.useStore(h==null?void 0:h.store,{open:r??t,activeTriggerId:d!==void 0?d:m});y.useControlledProp("open",r,t),y.useControlledProp("activeTriggerId",d,m),y.useContextCallback("onOpenChange",c),y.useContextCallback("onOpenChangeComplete",u);const x=y.useState("open"),b=y.useState("activeTriggerId"),k=y.useState("payload");y.useSyncedValues({trackCursorAxis:s,disableHoverablePopup:i});const R=!e&&x;Le(()=>{x&&e&&y.setOpen(!1,zt(HR))},[x,e,y]),y.useSyncedValue("disabled",e),DM(y);const{forceUnmount:T,transitionStatus:O}=NM(R,y),P=y.useState("isInstantPhase"),N=y.useState("instantType"),I=y.useState("lastOpenChangeReason"),B=S.useRef(null);Le(()=>{O==="ending"&&I===$a||O!=="ending"&&P?(N!=="delay"&&(B.current=N),y.set("instantType","delay")):B.current!==null&&(y.set("instantType",B.current),B.current=null)},[O,P,I,N,y]),Le(()=>{R&&b==null&&y.set("payload",void 0)},[y,b,R]);const W=S.useCallback(()=>{y.setOpen(!1,tO(y,$R))},[y]);S.useImperativeHandle(l,()=>({unmount:T,close:W}),[T,W]);const Z=y.useState("floatingRootContext"),X=WM(Z,{enabled:!e}),Q=iM(Z,{enabled:!e,referencePress:!0}),U=mT(Z,{enabled:!e&&s!=="none",axis:s==="none"?void 0:s}),{getReferenceProps:j,getFloatingProps:Y,getTriggerProps:J}=YM([X,Q,U]),q=S.useMemo(()=>j(),[j]),H=S.useMemo(()=>J(),[J]),A=S.useMemo(()=>Y(),[Y]);return y.useSyncedValues({floatingRootContext:Z,activeTriggerProps:q,inactiveTriggerProps:H,popupProps:A}),C.jsx(p2.Provider,{value:y,children:typeof g=="function"?g({payload:k}):g})}function tO(n,e){const t=zt(e);return t.preventUnmountOnClose=()=>{n.set("preventUnmountingOnClose",!0)},t}let lf=function(n){return n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n}({});const nO={[lf.startingStyle]:""},rO={[lf.endingStyle]:""},Mg={transitionStatus(n){return n==="starting"?nO:n==="ending"?rO:null}};let Og=function(n){return n.open="data-open",n.closed="data-closed",n[n.startingStyle=lf.startingStyle]="startingStyle",n[n.endingStyle=lf.endingStyle]="endingStyle",n.anchorHidden="data-anchor-hidden",n}({}),iO=function(n){return n.popupOpen="data-popup-open",n.pressed="data-pressed",n}({});const sO={[iO.popupOpen]:""},oO={[Og.open]:""},lO={[Og.closed]:""},aO={[Og.anchorHidden]:""},cO={open(n){return n?sO:null}},W2={open(n){return n?oO:lO},anchorHidden(n){return n?aO:null}};function af(n){return Jo(n,"base-ui")}const V2=S.createContext(void 0);function uO(){return S.useContext(V2)}const fO=600,hO=S.forwardRef(function(e,t){const{className:r,render:i,handle:s,payload:l,disabled:c,delay:u,closeDelay:h,id:d,...m}=e,g=Wa(!0),y=(s==null?void 0:s.store)??g;if(!y)throw new Error(Un(82));const x=af(d),b=y.useState("isTriggerActive",x),k=y.useState("floatingRootContext"),R=y.useState("isOpenedByTrigger",x),T=S.useRef(null),O=u??fO,P=h??0,{registerTrigger:N,isMountedByThisTrigger:I}=LM(x,T,y,{payload:l,closeDelay:P}),B=uO(),{delayRef:W,isInstantPhase:Z,hasProvider:X}=qR(k,{open:R});y.useSyncedValue("isInstantPhase",Z);const Q=y.useState("disabled"),U=c??Q,j=y.useState("trackCursorAxis"),Y=y.useState("disableHoverablePopup"),J=QM(k,{enabled:!U,mouseOnly:!0,move:!1,handleClose:!Y&&j!=="both"?XM():null,restMs(){const D=B==null?void 0:B.delay,z=typeof W.current=="object"?W.current.open:void 0;let M=O;return X&&(z!==0?M=u??D??O:M=0),M},delay(){const D=typeof W.current=="object"?W.current.close:void 0;let z=P;return h==null&&X&&(z=D),{close:z}},triggerElementRef:T,isActiveTrigger:b}),q=S.useMemo(()=>({open:R}),[R]),H=y.useState("triggerProps",I);return vn("button",e,{state:q,ref:[t,N,T],props:[J,H,{id:x},m],stateAttributesMapping:cO})}),H2=S.createContext(void 0);function dO(){const n=S.useContext(H2);if(n===void 0)throw new Error(Un(70));return n}const $2=S.forwardRef(function(e,t){const{children:r,container:i,className:s,render:l,...c}=e,{portalNode:u,portalSubtree:h}=hT({container:i,ref:t,componentProps:e,elementProps:c});return!h&&!u?null:C.jsxs(S.Fragment,{children:[h,u&&Ur.createPortal(r,u)]})}),pO=S.forwardRef(function(e,t){const{keepMounted:r=!1,...i}=e;return Wa().useState("mounted")||r?C.jsx(H2.Provider,{value:r,children:C.jsx($2,{ref:t,...i})}):null}),U2=S.createContext(void 0);function mO(){const n=S.useContext(U2);if(n===void 0)throw new Error(Un(71));return n}const gO=S.createContext(void 0);function q2(){const n=S.useContext(gO);return(n==null?void 0:n.direction)??"ltr"}const yO=n=>({name:"arrow",options:n,async fn(e){var D,z;const{x:t,y:r,placement:i,rects:s,platform:l,elements:c,middlewareData:u}=e,{element:h,padding:d=0,offsetParent:m="real"}=vi(n,e)||{};if(h==null)return{};const g=b2(d),y={x:t,y:r},x=yg(i),b=gg(x),k=await l.getDimensions(h),R=x==="y",T=R?"top":"left",O=R?"bottom":"right",P=R?"clientHeight":"clientWidth",N=s.reference[b]+s.reference[x]-y[x]-s.floating[b],I=y[x]-s.reference[x],B=m==="real"?await((D=l.getOffsetParent)==null?void 0:D.call(l,h)):c.floating;let W=c.floating[P]||s.floating[b];(!W||!await((z=l.isElement)==null?void 0:z.call(l,B)))&&(W=c.floating[P]||s.floating[b]);const Z=N/2-I/2,X=W/2-k[b]/2-1,Q=Math.min(g[T],X),U=Math.min(g[O],X),j=Q,Y=W-k[b]-U,J=W/2-k[b]/2+Z,q=em(j,J,Y),H=!u.arrow&&us(i)!=null&&J!==q&&s.reference[b]/2-(J<j?Q:U)-k[b]/2<0,A=H?J<j?J-j:J-Y:0;return{[x]:y[x]+A,data:{[x]:q,centerOffset:J-q-A,...H&&{alignmentOffset:A}},reset:H}}}),vO=(n,e)=>({...yO(n),options:[n,e]}),xO={name:"hide",async fn(n){var c;const{width:e,height:t,x:r,y:i}=n.rects.reference,s=e===0&&t===0&&r===0&&i===0;return{data:{referenceHidden:((c=(await tM().fn(n)).data)==null?void 0:c.referenceHidden)||s}}}},Hu={sideX:"left",sideY:"top"},wO={name:"adaptiveOrigin",async fn(n){var T,O;const{x:e,y:t,rects:{floating:r},elements:{floating:i},platform:s,strategy:l,placement:c}=n,u=Yt(i),h=u.getComputedStyle(i);if(!(h.transitionDuration!=="0s"&&h.transitionDuration!==""))return{x:e,y:t,data:Hu};const m=await((T=s.getOffsetParent)==null?void 0:T.call(s,i));let g={width:0,height:0};if(l==="fixed"&&(u!=null&&u.visualViewport))g={width:u.visualViewport.width,height:u.visualViewport.height};else if(m===u){const P=Xi(i);g={width:P.documentElement.clientWidth,height:P.documentElement.clientHeight}}else await((O=s.isElement)==null?void 0:O.call(s,m))&&(g=await s.getDimensions(m));const y=An(c);let x=e,b=t;y==="left"&&(x=g.width-(e+r.width)),y==="top"&&(b=g.height-(t+r.height));const k=y==="left"?"right":Hu.sideX,R=y==="top"?"bottom":Hu.sideY;return{x,y:b,data:{sideX:k,sideY:R}}}};function K2(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 Lx(n,e,t){const{rects:r,placement:i}=n;return{side:K2(e,An(i),t),align:us(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function bO(n){var Kn,Rr;const{anchor:e,positionMethod:t="absolute",side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:l=0,collisionBoundary:c,collisionPadding:u=5,sticky:h=!1,arrowPadding:d=5,disableAnchorTracking:m=!1,keepMounted:g=!1,floatingRootContext:y,mounted:x,collisionAvoidance:b,shiftCrossAxis:k=!1,nodeId:R,adaptiveOrigin:T,lazyFlip:O=!1,externalTree:P}=n,[N,I]=S.useState(null);!x&&N!==null&&I(null);const B=b.side||"flip",W=b.align||"flip",Z=b.fallbackAxisSide||"end",X=typeof e=="function"?e:void 0,Q=Ee(X),U=X?Q:e,j=zs(e),J=q2()==="rtl",q=N||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":J?"left":"right","inline-start":J?"right":"left"}[r],H=s==="center"?q:`${q}-${s}`;let A=u;const D=1,z=r==="bottom"?D:0,M=r==="top"?D:0,V=r==="right"?D:0,oe=r==="left"?D:0;typeof A=="number"?A={top:A+z,right:A+oe,bottom:A+M,left:A+V}:A&&(A={top:(A.top||0)+z,right:(A.right||0)+oe,bottom:(A.bottom||0)+M,left:(A.left||0)+V});const ce={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:A},he=S.useRef(null),se=zs(i),fe=zs(l),Fe=[GT(Ue=>{const yt=Lx(Ue,r,J),It=typeof se.current=="function"?se.current(yt):se.current,St=typeof fe.current=="function"?fe.current(yt):fe.current;return{mainAxis:It,crossAxis:St,alignmentAxis:St}},[typeof i!="function"?i:0,typeof l!="function"?l:0,J,r])],le=W==="none"&&B!=="shift",Se=!le&&(h||k||B==="shift"),ve=B==="none"?null:ZT({...ce,padding:{top:A.top+D,right:A.right+D,bottom:A.bottom+D,left:A.left+D},mainAxis:!k&&B==="flip",crossAxis:W==="flip"?"alignment":!1,fallbackAxisSideDirection:Z}),at=le?null:XT(Ue=>{const yt=Xi(Ue.elements.floating).documentElement;return{...ce,rootBoundary:k?{x:0,y:0,width:yt.clientWidth,height:yt.clientHeight}:void 0,mainAxis:W!=="none",crossAxis:Se,limiter:h||k?void 0:JT(It=>{if(!he.current)return{};const{width:St,height:Yr}=he.current.getBoundingClientRect(),Gr=tr(An(It.placement)),ds=Gr==="y"?St:Yr,Ks=Gr==="y"?A.left+A.right:A.top+A.bottom;return{offset:ds/2+Ks/2}})}},[ce,h,k,A,W]);B==="shift"||W==="shift"||s==="center"?Fe.push(at,ve):Fe.push(ve,at),Fe.push(eM({...ce,apply({elements:{floating:Ue},rects:{reference:yt},availableWidth:It,availableHeight:St}){Object.entries({"--available-width":`${It}px`,"--available-height":`${St}px`,"--anchor-width":`${yt.width}px`,"--anchor-height":`${yt.height}px`}).forEach(([Yr,Gr])=>{Ue.style.setProperty(Yr,Gr)})}}),vO(()=>({element:he.current||document.createElement("div"),padding:d,offsetParent:"floating"}),[d]),{name:"transformOrigin",fn(Ue){var ec,Mr,ol;const{elements:yt,middlewareData:It,placement:St,rects:Yr,y:Gr}=Ue,ds=An(St),Ks=tr(ds),Xr=he.current,rl=((ec=It.arrow)==null?void 0:ec.x)||0,Ja=((Mr=It.arrow)==null?void 0:Mr.y)||0,ps=(Xr==null?void 0:Xr.clientWidth)||0,il=(Xr==null?void 0:Xr.clientHeight)||0,Jr=rl+ps/2,Za=Ja+il/2,ms=Math.abs(((ol=It.shift)==null?void 0:ol.y)||0),Qs=Yr.reference.height/2,Tr=typeof i=="function"?i(Lx(Ue,r,J)):i,sl=ms>Tr,gh={top:`${Jr}px calc(100% + ${Tr}px)`,bottom:`${Jr}px ${-Tr}px`,left:`calc(100% + ${Tr}px) ${Za}px`,right:`${-Tr}px ${Za}px`}[ds],yh=`${Jr}px ${Yr.reference.y+Qs-Gr}px`;return yt.floating.style.setProperty("--transform-origin",Se&&Ks==="y"&&sl?yh:gh),{}}},xO,T),Le(()=>{!x&&y&&y.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[x,y]);const De=S.useMemo(()=>({elementResize:!m&&typeof ResizeObserver<"u",layoutShift:!m&&typeof IntersectionObserver<"u"}),[m]),{refs:_e,elements:Qe,x:At,y:$t,middlewareData:Lt,update:gt,placement:Ve,context:$e,isPositioned:Dt,floatingStyles:Me}=zM({rootContext:y,placement:H,middleware:Fe,strategy:t,whileElementsMounted:g?void 0:(...Ue)=>Sx(...Ue,De),nodeId:R,externalTree:P}),{sideX:Pe,sideY:Xe}=Lt.adaptiveOrigin||Hu,Ze=Dt?t:"fixed",tt=S.useMemo(()=>T?{position:Ze,[Pe]:At,[Xe]:$t}:{position:Ze,...Me},[T,Ze,Pe,At,Xe,$t,Me]),Ye=S.useRef(null);Le(()=>{if(!x)return;const Ue=j.current,yt=typeof Ue=="function"?Ue():Ue,St=(Dx(yt)?yt.current:yt)||null||null;St!==Ye.current&&(_e.setPositionReference(St),Ye.current=St)},[x,_e,U,j]),S.useEffect(()=>{if(!x)return;const Ue=j.current;typeof Ue!="function"&&Dx(Ue)&&Ue.current!==Ye.current&&(_e.setPositionReference(Ue.current),Ye.current=Ue.current)},[x,_e,U,j]),S.useEffect(()=>{if(g&&x&&Qe.domReference&&Qe.floating)return Sx(Qe.domReference,Qe.floating,gt,De)},[g,x,Qe,gt,De]);const Ge=An(Ve),Ei=K2(r,Ge,J),Nt=us(Ve)||"center",ct=!!((Kn=Lt.hide)!=null&&Kn.referenceHidden);Le(()=>{O&&x&&Dt&&I(Ge)},[O,x,Dt,Ge]);const xn=S.useMemo(()=>{var Ue,yt;return{position:"absolute",top:(Ue=Lt.arrow)==null?void 0:Ue.y,left:(yt=Lt.arrow)==null?void 0:yt.x}},[Lt.arrow]),qn=((Rr=Lt.arrow)==null?void 0:Rr.centerOffset)!==0;return S.useMemo(()=>({positionerStyles:tt,arrowStyles:xn,arrowRef:he,arrowUncentered:qn,side:Ei,align:Nt,physicalSide:Ge,anchorHidden:ct,refs:_e,context:$e,isPositioned:Dt,update:gt}),[tt,xn,he,qn,Ei,Nt,Ge,ct,_e,$e,Dt,gt])}function Dx(n){return n!=null&&"current"in n}function Q2(n){return n==="starting"?_R:cn}const SO=S.forwardRef(function(e,t){const{render:r,className:i,anchor:s,positionMethod:l="absolute",side:c="top",align:u="center",sideOffset:h=0,alignOffset:d=0,collisionBoundary:m="clipping-ancestors",collisionPadding:g=5,arrowPadding:y=5,sticky:x=!1,disableAnchorTracking:b=!1,collisionAvoidance:k=WR,...R}=e,T=Wa(),O=dO(),P=T.useState("open"),N=T.useState("mounted"),I=T.useState("trackCursorAxis"),B=T.useState("disableHoverablePopup"),W=T.useState("floatingRootContext"),Z=T.useState("instantType"),X=T.useState("transitionStatus"),Q=bO({anchor:s,positionMethod:l,floatingRootContext:W,mounted:N,side:c,sideOffset:h,align:u,alignOffset:d,collisionBoundary:m,collisionPadding:g,sticky:x,arrowPadding:y,disableAnchorTracking:b,keepMounted:O,collisionAvoidance:k,adaptiveOrigin:wO}),U=S.useMemo(()=>{const q={};return(!P||I==="both"||B)&&(q.pointerEvents="none"),{role:"presentation",hidden:!N,style:{...Q.positionerStyles,...q}}},[P,I,B,N,Q.positionerStyles]),j=S.useMemo(()=>({open:P,side:Q.side,align:Q.align,anchorHidden:Q.anchorHidden,instant:I!=="none"?"tracking-cursor":Z}),[P,Q.side,Q.align,Q.anchorHidden,I,Z]),Y=S.useMemo(()=>({...j,arrowRef:Q.arrowRef,arrowStyles:Q.arrowStyles,arrowUncentered:Q.arrowUncentered}),[j,Q.arrowRef,Q.arrowStyles,Q.arrowUncentered]),J=vn("div",e,{state:j,props:[U,Q2(X),R],ref:[t,T.useStateSetter("positionerElement")],stateAttributesMapping:W2});return C.jsx(U2.Provider,{value:Y,children:J})});function Nx(n){const e=$n(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=gn(n),s=i?n.offsetWidth:t,l=i?n.offsetHeight:r;return(Fo(t)!==s||Fo(r)!==l)&&(t=s,r=l),{width:t,height:r}}const kO=typeof ResizeObserver<"u",CO=()=>!0;function EO(n){const{popupElement:e,positionerElement:t,content:r,mounted:i,enabled:s=CO,onMeasureLayout:l,onMeasureLayoutComplete:c,side:u,direction:h}=n,d=S.useRef(!0),m=Eg(e,!0,!1),g=bg(),y=S.useRef(null),x=Ee(l),b=Ee(c),k=S.useMemo(()=>{let R=u==="top",T=u==="left";return h==="rtl"?(R=R||u==="inline-end",T=T||u==="inline-end"):(R=R||u==="inline-start",T=T||u==="inline-start"),R?{position:"absolute",[u==="top"?"bottom":"top"]:"0",[T?"right":"left"]:"0"}:cn},[u,h]);Le(()=>{if(!i||!s()||!kO){d.current=!0,y.current=null;return}if(!e||!t)return;Object.entries(k).forEach(([Z,X])=>{e.style.setProperty(Z,X)});const R=new ResizeObserver(Z=>{const X=Z[0];X&&(y.current===null?y.current={width:Math.ceil(X.borderBoxSize[0].inlineSize),height:Math.ceil(X.borderBoxSize[0].blockSize)}:(y.current.width=Math.ceil(X.borderBoxSize[0].inlineSize),y.current.height=Math.ceil(X.borderBoxSize[0].blockSize)))});R.observe(e),e.style.setProperty("--popup-width","auto"),e.style.setProperty("--popup-height","auto");const T=Hl(e,"position","static"),O=Hl(e,"transform","none"),P=Hl(e,"scale","1"),N=Hl(t,"--available-width","max-content"),I=Hl(t,"--available-height","max-content");if(x==null||x(),d.current||y.current===null){t.style.setProperty("--positioner-width","max-content"),t.style.setProperty("--positioner-height","max-content");const Z=Nx(e);return t.style.setProperty("--positioner-width",`${Z.width}px`),t.style.setProperty("--positioner-height",`${Z.height}px`),T(),O(),P(),N(),I(),b==null||b(null,Z),d.current=!1,()=>{R.disconnect()}}e.style.setProperty("--popup-width","auto"),e.style.setProperty("--popup-height","auto"),t.style.setProperty("--positioner-width","max-content"),t.style.setProperty("--positioner-height","max-content");const B=Nx(e);e.style.setProperty("--popup-width",`${y.current.width}px`),e.style.setProperty("--popup-height",`${y.current.height}px`),T(),O(),N(),I(),b==null||b(y.current,B),t.style.setProperty("--positioner-width",`${B.width}px`),t.style.setProperty("--positioner-height",`${B.height}px`);const W=new AbortController;return g.request(()=>{e.style.setProperty("--popup-width",`${B.width}px`),e.style.setProperty("--popup-height",`${B.height}px`),m(()=>{e.style.setProperty("--popup-width","auto"),e.style.setProperty("--popup-height","auto")},W.signal)}),()=>{R.disconnect(),W.abort(),g.cancel()}},[r,e,t,m,g,s,i,x,b,k])}function Hl(n,e,t){const r=n.style.getPropertyValue(e);return n.style.setProperty(e,t),()=>{n.style.setProperty(e,r)}}const RO={...W2,...Mg},TO=S.forwardRef(function(e,t){const{className:r,render:i,...s}=e,l=Wa(),{side:c,align:u}=mO(),h=l.useState("open"),d=l.useState("mounted"),m=l.useState("instantType"),g=l.useState("transitionStatus"),y=l.useState("popupProps"),x=l.useState("payload"),b=l.useState("popupElement"),k=l.useState("positionerElement"),R=l.useState("floatingRootContext"),T=q2();Jf({open:h,ref:l.context.popupRef,onComplete(){var X,Q;h&&((Q=(X=l.context).onOpenChangeComplete)==null||Q.call(X,!0))}});function O(){R.context.events.emit("measure-layout")}function P(X,Q){R.context.events.emit("measure-layout-complete",{previousDimensions:X,nextDimensions:Q})}const N=S.useCallback(()=>l.context.triggerElements.size>1,[l]);EO({popupElement:b,positionerElement:k,mounted:d,content:x,enabled:N,onMeasureLayout:O,onMeasureLayoutComplete:P,side:c,direction:T});const I=l.useState("disabled"),B=l.useState("closeDelay");UM(R,{enabled:!I,closeDelay:B});const W=S.useMemo(()=>({open:h,side:c,align:u,instant:m,transitionStatus:g}),[h,c,u,m,g]);return vn("div",e,{state:W,ref:[t,l.context.popupRef,l.useStateSetter("popupElement")],props:[y,Q2(g),s],stateAttributesMapping:RO})}),MO=function(e){const{delay:t,closeDelay:r,timeout:i=400}=e,s=S.useMemo(()=>({delay:t,closeDelay:r}),[t,r]),l=S.useMemo(()=>({open:t,close:r}),[t,r]);return C.jsx(V2.Provider,{value:s,children:C.jsx(UR,{delay:l,timeoutMs:i,children:e.children})})};function Y2(n){return Sg(19)?n:n?"true":void 0}function OO(n){const[e,t]=S.useState({current:n,previous:null});return n!==e.current&&t({current:n,previous:e.current}),e.previous}let Ix=function(n){return n.popupWidth="--popup-width",n.popupHeight="--popup-height",n}({});const PO={activationDirection:n=>n?{"data-activation-direction":n}:null},AO=S.forwardRef(function(e,t){const{render:r,className:i,children:s,...l}=e,c=Wa(),u=c.useState("activeTriggerElement"),h=c.useState("open"),d=c.useState("floatingRootContext"),m=c.useState("instantType"),g=OO(h?u:null),y=S.useRef(null),[x,b]=S.useState(null),[k,R]=S.useState(null),T=S.useRef(null),O=S.useRef(null),P=Eg(T,!0,!1),N=bg(),[I,B]=S.useState(null),[W,Z]=S.useState(!1),X=Ee(()=>{var q,H,A;(q=T.current)==null||q.style.setProperty("animation","none"),(H=T.current)==null||H.style.setProperty("transition","none"),(A=O.current)==null||A.style.setProperty("display","none")}),Q=Ee(q=>{var H,A,D;(H=T.current)==null||H.style.removeProperty("animation"),(A=T.current)==null||A.style.removeProperty("transition"),(D=O.current)==null||D.style.removeProperty("display"),I||B(q.previousDimensions)});S.useEffect(()=>(d.context.events.on("measure-layout",X),d.context.events.on("measure-layout-complete",Q),()=>{d.context.events.off("measure-layout",X),d.context.events.off("measure-layout-complete",Q)}),[d,X,Q]);const U=S.useRef(null);Le(()=>{if(u&&g&&u!==g&&U.current!==u&&y.current){b(y.current),Z(!0);const q=DO(g,u);R(q),N.request(()=>{N.request(()=>{Z(!1),P(()=>{b(null),B(null),y.current=null})})}),U.current=u}},[u,g,x,P,N]),Le(()=>{const q=T.current;if(!q)return;const H=document.createElement("div");for(const A of Array.from(q.childNodes))H.appendChild(A.cloneNode(!0));y.current=H});const j=x!=null;let Y;j?Y=C.jsxs(S.Fragment,{children:[C.jsx("div",{"data-previous":!0,inert:Y2(!0),ref:O,style:{[Ix.popupWidth]:`${I==null?void 0:I.width}px`,[Ix.popupHeight]:`${I==null?void 0:I.height}px`,position:"absolute"},"data-ending-style":W?void 0:""},"previous"),C.jsx("div",{"data-current":!0,ref:T,"data-starting-style":W?"":void 0,children:s},"current")]}):Y=C.jsx("div",{"data-current":!0,ref:T,children:s},"current"),Le(()=>{const q=O.current;!q||!x||q.replaceChildren(...Array.from(x.childNodes))},[x]);const J=S.useMemo(()=>({activationDirection:LO(k),transitioning:j,instant:m}),[k,j,m]);return vn("div",e,{state:J,ref:t,props:[l,{children:Y}],stateAttributesMapping:PO})});function LO(n){if(n)return`${Bx(n.horizontal,5,"right","left")} ${Bx(n.vertical,5,"down","up")}`}function Bx(n,e,t,r){return n>e?t:n<-e?r:""}function DO(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 G2(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=G2(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function X2(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=G2(n))&&(r&&(r+=" "),r+=e);return r}const Pg="-",NO=n=>{const e=BO(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:l=>{const c=l.split(Pg);return c[0]===""&&c.length!==1&&c.shift(),J2(c,e)||IO(l)},getConflictingClassGroupIds:(l,c)=>{const u=t[l]||[];return c&&r[l]?[...u,...r[l]]:u}}},J2=(n,e)=>{var l;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?J2(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=n.join(Pg);return(l=e.validators.find(({validator:c})=>c(s)))==null?void 0:l.classGroupId},jx=/^\[(.+)\]$/,IO=n=>{if(jx.test(n)){const e=jx.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},BO=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return FO(Object.entries(n.classGroups),t).forEach(([s,l])=>{am(l,r,s,e)}),r},am=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:Fx(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(jO(i)){am(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,l])=>{am(l,Fx(e,s),t,r)})})},Fx=(n,e)=>{let t=n;return e.split(Pg).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},jO=n=>n.isThemeGetter,FO=(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(([l,c])=>[e+l,c])):s);return[t,i]}):n,zO=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(s,l)=>{t.set(s,l),e++,e>n&&(e=0,r=t,t=new Map)};return{get(s){let l=t.get(s);if(l!==void 0)return l;if((l=r.get(s))!==void 0)return i(s,l),l},set(s,l){t.has(s)?t.set(s,l):i(s,l)}}},Z2="!",_O=n=>{const{separator:e,experimentalParseClassName:t}=n,r=e.length===1,i=e[0],s=e.length,l=c=>{const u=[];let h=0,d=0,m;for(let k=0;k<c.length;k++){let R=c[k];if(h===0){if(R===i&&(r||c.slice(k,k+s)===e)){u.push(c.slice(d,k)),d=k+s;continue}if(R==="/"){m=k;continue}}R==="["?h++:R==="]"&&h--}const g=u.length===0?c:c.substring(d),y=g.startsWith(Z2),x=y?g.substring(1):g,b=m&&m>d?m-d:void 0;return{modifiers:u,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:b}};return t?c=>t({className:c,parseClassName:l}):l},WO=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},VO=n=>({cache:zO(n.cacheSize),parseClassName:_O(n),...NO(n)}),HO=/\s+/,$O=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],l=n.trim().split(HO);let c="";for(let u=l.length-1;u>=0;u-=1){const h=l[u],{modifiers:d,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:y}=t(h);let x=!!y,b=r(x?g.substring(0,y):g);if(!b){if(!x){c=h+(c.length>0?" "+c:c);continue}if(b=r(g),!b){c=h+(c.length>0?" "+c:c);continue}x=!1}const k=WO(d).join(":"),R=m?k+Z2:k,T=R+b;if(s.includes(T))continue;s.push(T);const O=i(b,x);for(let P=0;P<O.length;++P){const N=O[P];s.push(R+N)}c=h+(c.length>0?" "+c:c)}return c};function UO(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=eb(e))&&(r&&(r+=" "),r+=t);return r}const eb=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=eb(n[r]))&&(t&&(t+=" "),t+=e);return t};function qO(n,...e){let t,r,i,s=l;function l(u){const h=e.reduce((d,m)=>m(d),n());return t=VO(h),r=t.cache.get,i=t.cache.set,s=c,c(u)}function c(u){const h=r(u);if(h)return h;const d=$O(u,t);return i(u,d),d}return function(){return s(UO.apply(null,arguments))}}const ht=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},tb=/^\[(?:([a-z-]+):)?(.+)\]$/i,KO=/^\d+\/\d+$/,QO=new Set(["px","full","screen"]),YO=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,GO=/\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$/,XO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,JO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,li=n=>To(n)||QO.has(n)||KO.test(n),Ui=n=>Zo(n,"length",lP),To=n=>!!n&&!Number.isNaN(Number(n)),gp=n=>Zo(n,"number",To),$l=n=>!!n&&Number.isInteger(Number(n)),eP=n=>n.endsWith("%")&&To(n.slice(0,-1)),Ne=n=>tb.test(n),qi=n=>YO.test(n),tP=new Set(["length","size","percentage"]),nP=n=>Zo(n,tP,nb),rP=n=>Zo(n,"position",nb),iP=new Set(["image","url"]),sP=n=>Zo(n,iP,cP),oP=n=>Zo(n,"",aP),Ul=()=>!0,Zo=(n,e,t)=>{const r=tb.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},lP=n=>GO.test(n)&&!XO.test(n),nb=()=>!1,aP=n=>JO.test(n),cP=n=>ZO.test(n),uP=()=>{const n=ht("colors"),e=ht("spacing"),t=ht("blur"),r=ht("brightness"),i=ht("borderColor"),s=ht("borderRadius"),l=ht("borderSpacing"),c=ht("borderWidth"),u=ht("contrast"),h=ht("grayscale"),d=ht("hueRotate"),m=ht("invert"),g=ht("gap"),y=ht("gradientColorStops"),x=ht("gradientColorStopPositions"),b=ht("inset"),k=ht("margin"),R=ht("opacity"),T=ht("padding"),O=ht("saturate"),P=ht("scale"),N=ht("sepia"),I=ht("skew"),B=ht("space"),W=ht("translate"),Z=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],Q=()=>["auto",Ne,e],U=()=>[Ne,e],j=()=>["",li,Ui],Y=()=>["auto",To,Ne],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],A=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",Ne],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[To,Ne];return{cacheSize:500,separator:":",theme:{colors:[Ul],spacing:[li,Ui],blur:["none","",qi,Ne],brightness:M(),borderColor:[n],borderRadius:["none","","full",qi,Ne],borderSpacing:U(),borderWidth:j(),contrast:M(),grayscale:D(),hueRotate:M(),invert:D(),gap:U(),gradientColorStops:[n],gradientColorStopPositions:[eP,Ui],inset:Q(),margin:Q(),opacity:M(),padding:U(),saturate:M(),scale:M(),sepia:D(),skew:M(),space:U(),translate:U()},classGroups:{aspect:[{aspect:["auto","square","video",Ne]}],container:["container"],columns:[{columns:[qi]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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:[...J(),Ne]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:Z()}],"overscroll-x":[{"overscroll-x":Z()}],"overscroll-y":[{"overscroll-y":Z()}],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",$l,Ne]}],basis:[{basis:Q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ne]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",$l,Ne]}],"grid-cols":[{"grid-cols":[Ul]}],"col-start-end":[{col:["auto",{span:["full",$l,Ne]},Ne]}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":[Ul]}],"row-start-end":[{row:["auto",{span:[$l,Ne]},Ne]}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ne]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ne]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...A()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...A(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...A(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[B]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[B]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ne,e]}],"min-w":[{"min-w":[Ne,e,"min","max","fit"]}],"max-w":[{"max-w":[Ne,e,"none","full","min","max","fit","prose",{screen:[qi]},qi]}],h:[{h:[Ne,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ne,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ne,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ne,e,"auto","min","max","fit"]}],"font-size":[{text:["base",qi,Ui]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",gp]}],"font-family":[{font:[Ul]}],"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",Ne]}],"line-clamp":[{"line-clamp":["none",To,gp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",li,Ne]}],"list-image":[{"list-image":["none",Ne]}],"list-style-type":[{list:["none","disc","decimal",Ne]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[R]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[R]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",li,Ui]}],"underline-offset":[{"underline-offset":["auto",li,Ne]}],"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:U()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ne]}],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",Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[R]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),rP]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",nP]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},sP]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],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:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[R]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[R]}],"divide-style":[{divide:q()}],"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:["",...q()]}],"outline-offset":[{"outline-offset":[li,Ne]}],"outline-w":[{outline:[li,Ui]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:j()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[R]}],"ring-offset-w":[{"ring-offset":[li,Ui]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",qi,oP]}],"shadow-color":[{shadow:[Ul]}],opacity:[{opacity:[R]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",qi,Ne]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[m]}],saturate:[{saturate:[O]}],sepia:[{sepia:[N]}],"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":[m]}],"backdrop-opacity":[{"backdrop-opacity":[R]}],"backdrop-saturate":[{"backdrop-saturate":[O]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ne]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",Ne]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ne]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[$l,Ne]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ne]}],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",Ne]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"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",Ne]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[li,Ui,gp]}],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"]}}},fP=qO(uP);function yn(...n){return fP(X2(n))}const rb=MO,Zf=eO;function eh(n){return C.jsx(hO,{"data-slot":"tooltip-trigger",...n})}function th({className:n,align:e="center",sideOffset:t=4,side:r="top",children:i,...s}){return C.jsx(pO,{children:C.jsx(SO,{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:C.jsx(TO,{className:yn("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:C.jsx(AO,{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 zx({icon:n,tooltip:e,to:t,href:r}){const i=kr(),s=t?i.pathname===t:!1,l=C.jsx("div",{className:yn("w-full h-10 rounded-l-lg p-2 flex items-center justify-center transition-colors",s&&"bg-accent shadow"),children:n}),c=t?C.jsx(gi,{to:t,"aria-label":e,children:l}):r?C.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer","aria-label":e,children:l}):l;return C.jsxs(Zf,{children:[C.jsx(eh,{render:c}),C.jsx(th,{side:"right",sideOffset:8,children:e})]})}const hP="/assets/postgres-BpcazhJg.svg",dP="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",pP="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",mP="/assets/sqlserver-ByfFYYpV.svg",gP="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",Ag={postgres:hP,mysql:dP,mariadb:pP,sqlserver:mP,sqlite:gP};function yP({source:n}){const{sourceId:e}=Vf(),t=e===n.id;return C.jsxs(Zf,{children:[C.jsx(eh,{render:C.jsxs(gi,{to:`/source/${n.id}`,"aria-label":n.id,className:yn("w-full rounded-l-lg p-2 mt-1 flex flex-col items-center justify-center transition-colors",t&&"bg-accent shadow"),children:[C.jsx("img",{src:Ag[n.type],alt:`${n.type} logo`,className:"w-7 h-7"}),C.jsx("span",{className:yn("text-[10px] w-full text-center mt-1 leading-tight break-words line-clamp-2",t?"text-foreground":"text-muted-foreground"),children:n.id})]})}),C.jsx(th,{side:"right",sideOffset:8,children:n.id})]})}function vP({className:n="w-5 h-5"}){return C.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:C.jsx("polyline",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}function xP({className:n="w-5 h-5"}){return C.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:C.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 wP({sources:n}){return C.jsx(rb,{children:C.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:[C.jsx("div",{className:"w-full flex-1 flex flex-col justify-start items-start overflow-auto",children:n.map(e=>C.jsx(yP,{source:e},e.id))}),C.jsxs("div",{className:"w-full flex flex-col gap-2 items-center",children:[C.jsx(zx,{icon:C.jsx(vP,{}),to:"/requests",tooltip:"Requests"}),C.jsx(zx,{icon:C.jsx(xP,{}),href:"https://dbhub.ai",tooltip:"Help"})]})]})})}function bP(){return C.jsx("div",{className:"px-6 py-4",children:C.jsx(gi,{to:"/",className:"block hover:opacity-80 transition-opacity",children:C.jsx("img",{src:"/logo-full-light.svg",alt:"DBHub",className:"w-[200px] h-auto"})})})}function cf({className:n="w-4 h-4"}){return C.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:C.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 SP({sources:n,isLoading:e}){const{sourceId:t,toolName:r}=Vf(),i=n.find(s=>s.id===t);return C.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:[C.jsx(bP,{}),C.jsx("nav",{className:"flex-1 flex flex-col overflow-hidden","aria-label":"Data sources navigation",children:e?C.jsx("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Loading..."}):i?C.jsxs("div",{className:"flex flex-col overflow-hidden px-2 pt-2",children:[C.jsx(gi,{to:`/source/${i.id}`,className:yn("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:C.jsx("span",{className:"truncate",children:i.id})}),C.jsx("div",{className:"flex-1 overflow-auto",children:i.tools.filter(s=>s.name!=="search_objects").map(s=>C.jsxs(gi,{to:`/source/${i.id}/tool/${s.name}`,className:yn("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:[C.jsx("span",{className:"truncate font-mono text-xs",children:s.name}),s.readonly&&C.jsx(cf,{className:"w-3 h-3 ml-auto flex-shrink-0"})]},s.name))})]}):C.jsx("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Select a data source"})})]})}function kP({sources:n,isLoading:e}){const r=kr().pathname.startsWith("/source/");return C.jsxs("div",{className:"flex h-screen bg-background",children:[C.jsx(wP,{sources:n}),r&&C.jsx(SP,{sources:n,isLoading:e}),C.jsx("main",{className:"flex-1 overflow-auto","aria-label":"Main content",children:C.jsx(p3,{})})]})}class _t extends Error{constructor(e,t,r){super(e),this.status=t,this.statusText=r,this.name="ApiError"}}const ib="/api";async function sb(n){const e=n.headers.get("content-type");if(e&&e.includes("application/json"))return n.json();const t=await n.text();throw new _t(t||n.statusText,n.status,n.statusText)}async function Lg(){try{const n=await fetch(`${ib}/sources`);if(!n.ok){const e=await sb(n).then(t=>t.error).catch(()=>n.statusText);throw new _t(`Failed to fetch sources: ${e}`,n.status,n.statusText)}return n.json()}catch(n){throw n instanceof _t?n:new _t(n instanceof Error?n.message:"Network error",0)}}async function ob(n){try{if(!n||n.trim()==="")throw new _t("Source ID cannot be empty",400);if(n.includes("/")||n.includes(".."))throw new _t("Invalid source ID format",400);const e=await fetch(`${ib}/sources/${encodeURIComponent(n)}`);if(!e.ok){const t=await sb(e).then(r=>r.error).catch(()=>e.statusText);throw new _t(e.status===404?`Source not found: ${n}`:`Failed to fetch source: ${t}`,e.status,e.statusText)}return e.json()}catch(e){throw e instanceof _t?e:new _t(e instanceof Error?e.message:"Network error",0)}}function CP(){const n=Wf();return S.useEffect(()=>{Lg().then(e=>{e.length>0?n(`/source/${e[0].id}`,{replace:!0}):n("/requests",{replace:!0})}).catch(()=>{n("/requests",{replace:!0})})},[]),C.jsx("div",{className:"flex items-center justify-center h-full",children:C.jsx("div",{className:"text-muted-foreground",children:"Loading..."})})}const _x="/api";async function EP(n){try{const e=n?`${_x}/requests?source_id=${encodeURIComponent(n)}`:`${_x}/requests`,t=await fetch(e);if(!t.ok){const r=await t.json().then(i=>i.error).catch(()=>t.statusText);throw new _t(`Failed to fetch requests: ${r}`,t.status,t.statusText)}return t.json()}catch(e){throw e instanceof _t?e:new _t(e instanceof Error?e.message:"Network error",0)}}function RP(n){return new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function TP(n){const e=new Date(n),t=new Date;return e.toDateString()===t.toDateString()?"Today":e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function MP(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 l=n.match(/^(\w+)\/[\d.]+/);return l?l[1]:n.length>20?n.substring(0,20)+"...":n}function OP({sql:n,children:e}){return C.jsxs(Zf,{children:[C.jsx(eh,{render:e}),C.jsx(th,{className:"whitespace-pre-wrap break-all max-w-md",sideOffset:5,children:n})]})}function PP({error:n,children:e}){return C.jsxs(Zf,{children:[C.jsx(eh,{render:e}),C.jsx(th,{className:"whitespace-pre-wrap break-all max-w-md",sideOffset:5,side:"top",align:"end",children:n})]})}function AP({success:n,error:e}){if(n)return C.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-green-600 dark:text-green-400",children:C.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})});const t=C.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-red-600 dark:text-red-400 cursor-help",children:C.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})});return e?C.jsx(PP,{error:e,children:t}):t}function LP(){const[n,e]=S.useState([]),[t,r]=S.useState({}),[i,s]=S.useState({}),[l,c]=S.useState(!0),[u,h]=S.useState(null),[d,m]=S.useState(null);S.useEffect(()=>{Promise.all([EP(),Lg()]).then(([x,b])=>{e(x.requests);const k={},R={};for(const T of b){k[T.id]=T.type;for(const O of T.tools)O.readonly&&(R[O.name]=!0)}r(k),s(R),c(!1)}).catch(x=>{console.error("Failed to fetch data:",x);const b=x instanceof _t?x.message:"Failed to load data";h(b),c(!1)})},[]);const g=[...new Set(n.map(x=>x.sourceId))].sort(),y=d?n.filter(x=>x.sourceId===d):n;return l?C.jsx("div",{className:"container mx-auto px-8 py-12",children:C.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}):u?C.jsx("div",{className:"container mx-auto px-8 py-12",children:C.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[C.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Error"}),C.jsx("p",{className:"text-destructive/90",children:u})]})}):C.jsx(rb,{children:C.jsx("div",{className:"container mx-auto px-8 py-12 max-w-6xl",children:C.jsxs("div",{className:"space-y-6",children:[C.jsxs("div",{children:[C.jsx("h1",{className:"text-3xl font-bold text-foreground mb-2",children:"Recent Requests"}),C.jsx("p",{className:"text-muted-foreground text-sm",children:"Up to 100 requests per source"})]}),n.length>0&&C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"flex flex-wrap gap-2",children:[C.jsxs("button",{onClick:()=>m(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(R=>R.sourceId===x).length,k=t[x];return C.jsxs("button",{onClick:()=>m(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:[k&&C.jsx("img",{src:Ag[k],alt:`${k} logo`,className:"w-4 h-4"}),x," (",b,")"]},x)})]}),C.jsx("div",{className:"bg-card border border-border rounded-lg overflow-x-auto",children:C.jsxs("table",{className:"w-full",children:[C.jsx("thead",{children:C.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[C.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Time"}),C.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Tool"}),C.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider w-full",children:"SQL"}),C.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Result"}),C.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Client"})]})}),C.jsx("tbody",{className:"divide-y divide-border",children:y.map(x=>C.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[C.jsxs("td",{className:"px-4 py-2 text-sm text-muted-foreground whitespace-nowrap",children:[TP(x.timestamp)," ",RP(x.timestamp)]}),C.jsx("td",{className:"px-4 py-2 text-sm whitespace-nowrap",children:C.jsxs(gi,{to:`/source/${x.sourceId}`,className:"text-primary hover:underline inline-flex items-center gap-1",children:[x.toolName,i[x.toolName]&&C.jsx(cf,{className:"w-3 h-3 text-muted-foreground"})]})}),C.jsx("td",{className:"px-4 py-2 text-sm font-mono text-foreground max-w-0",children:C.jsx(OP,{sql:x.sql,children:C.jsx("span",{className:"block overflow-hidden text-ellipsis whitespace-nowrap cursor-help",children:x.sql})})}),C.jsx("td",{className:"px-4 py-2 text-sm",children:C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(AP,{success:x.success,error:x.error}),C.jsxs("span",{className:"text-muted-foreground",children:[x.durationMs,"ms"]})]})}),C.jsx("td",{className:"px-4 py-2 text-sm text-muted-foreground whitespace-nowrap",children:MP(x.client)})]},x.id))})]})})]}),n.length===0&&C.jsx("div",{className:"bg-card border border-border rounded-lg p-12 text-center",children:C.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 DP=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),NP=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),Wx=n=>{const e=NP(n);return e.charAt(0).toUpperCase()+e.slice(1)},lb=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim(),IP=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 BP={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 jP=S.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:l,...c},u)=>S.createElement("svg",{ref:u,...BP,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:lb("lucide",i),...!s&&!IP(c)&&{"aria-hidden":"true"},...c},[...l.map(([h,d])=>S.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 ki=(n,e)=>{const t=S.forwardRef(({className:r,...i},s)=>S.createElement(jP,{ref:s,iconNode:e,className:lb(`lucide-${DP(Wx(n))}`,`lucide-${n}`,r),...i}));return t.displayName=Wx(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 FP=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],zP=ki("chevron-left",FP);/**
|
|
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 _P=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],WP=ki("chevron-right",_P);/**
|
|
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 VP=[["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"}]],HP=ki("circle-alert",VP);/**
|
|
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 $P=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],UP=ki("circle-check",$P);/**
|
|
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 qP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],KP=ki("info",qP);/**
|
|
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 QP=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ab=ki("loader-circle",QP);/**
|
|
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 YP=[["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"}]],GP=ki("lock",YP);/**
|
|
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 XP=[["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"}]],JP=ki("play",XP);/**
|
|
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 ZP=[["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"}]],eA=ki("triangle-alert",ZP);function tA(){var c;const{sourceId:n}=Vf(),[e,t]=S.useState(null),[r,i]=S.useState(!0),[s,l]=S.useState(null);return S.useEffect(()=>{n&&(i(!0),l(null),ob(n).then(u=>{t(u),i(!1)}).catch(u=>{l(u),i(!1)}))},[n]),n?r?C.jsx("div",{className:"container mx-auto px-8 py-12",children:C.jsx("div",{className:"text-muted-foreground",children:"Loading source details..."})}):s?s.status===404?C.jsx(na,{to:"/404",replace:!0}):C.jsx("div",{className:"container mx-auto px-8 py-12",children:C.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[C.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Error"}),C.jsx("p",{className:"text-destructive/90",children:s.message})]})}):e?C.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:C.jsxs("div",{className:"space-y-6",children:[C.jsxs("h1",{className:"flex items-center gap-3 text-3xl font-bold text-foreground",children:[C.jsx("img",{src:Ag[e.type],alt:`${e.type} logo`,className:"w-8 h-8"}),e.id]}),C.jsxs("div",{className:"bg-card border border-border rounded-lg p-6",children:[C.jsx("h2",{className:"text-xl font-semibold text-foreground mb-4",children:"Connection Details"}),C.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[C.jsxs("div",{children:[C.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Database Type"}),C.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.type})]}),e.host&&C.jsxs("div",{children:[C.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Host"}),C.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.host})]}),e.port&&C.jsxs("div",{children:[C.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Port"}),C.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.port})]}),e.database&&C.jsxs("div",{children:[C.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Database"}),C.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.database})]}),e.user&&C.jsxs("div",{children:[C.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"User"}),C.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.user})]}),C.jsxs("div",{children:[C.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Default Source"}),C.jsx("dd",{className:"mt-1 text-sm text-foreground",children:e.is_default?C.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"}):C.jsx("span",{className:"text-muted-foreground",children:"No"})})]})]})]}),((c=e.ssh_tunnel)==null?void 0:c.enabled)&&C.jsxs("div",{className:"bg-card border border-border rounded-lg p-6",children:[C.jsx("h2",{className:"text-xl font-semibold text-foreground mb-4",children:"SSH Tunnel"}),C.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[C.jsxs("div",{children:[C.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),C.jsx("dd",{className:"mt-1 text-sm text-foreground",children:C.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&&C.jsxs("div",{children:[C.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"SSH Host"}),C.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.ssh_tunnel.ssh_host})]}),e.ssh_tunnel.ssh_port&&C.jsxs("div",{children:[C.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"SSH Port"}),C.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.ssh_tunnel.ssh_port})]}),e.ssh_tunnel.ssh_user&&C.jsxs("div",{children:[C.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"SSH User"}),C.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.ssh_tunnel.ssh_user})]})]})]}),C.jsxs("div",{className:"bg-card border border-border rounded-lg p-6",children:[C.jsx("h2",{className:"text-xl font-semibold text-foreground mb-4",children:"Available Tools"}),e.tools.length>0?C.jsx("div",{className:"space-y-4",children:e.tools.map((u,h)=>C.jsxs("div",{children:[h>0&&C.jsx("div",{className:"border-t border-border mb-4"}),C.jsxs("div",{className:"bg-muted/30 rounded-lg p-4 space-y-3",children:[C.jsxs("div",{children:[C.jsxs("div",{className:"flex items-baseline gap-2",children:[C.jsxs("div",{className:"flex items-center gap-1.5",children:[C.jsx("div",{className:"text-sm font-semibold text-foreground font-mono",children:u.name}),u.readonly&&C.jsx(GP,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),C.jsxs("div",{className:"text-xs text-muted-foreground",children:["(",u.parameters.length," ",u.parameters.length===1?"parameter":"parameters",")"]})]}),C.jsx("div",{className:"mt-1.5 text-sm text-muted-foreground leading-relaxed",children:u.description})]}),u.parameters.length>0&&C.jsxs("div",{className:"pt-2 border-t border-border/50",children:[C.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2.5",children:"Parameters"}),C.jsx("ul",{className:"space-y-3",children:u.parameters.map(d=>C.jsxs("li",{className:"text-sm bg-background/50 rounded p-2.5",children:[C.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[C.jsx("span",{className:"font-mono text-foreground font-medium",children:d.name}),C.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?C.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-destructive/10 text-destructive",children:"required"}):C.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&&C.jsx("div",{className:"mt-2 text-xs text-muted-foreground leading-relaxed",children:d.description})]},d.name))})]})]})]},u.name))}):C.jsx("div",{className:"text-sm text-muted-foreground",children:"No tools available for this source"})]})]})}):C.jsx("div",{className:"container mx-auto px-8 py-12",children:C.jsx("div",{className:"text-muted-foreground",children:"Source not found"})}):C.jsx(na,{to:"/",replace:!0})}async function Vx(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 _t(`HTTP error: ${t.status}`,t.status);const r=await t.json();if(r.error)throw new _t(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 _t("Invalid response format",500);const i=JSON.parse(r.result.content[0].text);if(!i.success||i.error)throw new _t(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 l=Object.keys(s[0]),c=s.map(m=>l.map(g=>m[g]));return{columns:l,rows:c,rowCount:i.data.count}}let cm=[],cb=[];(()=>{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?cb:cm).push(t=t+n[e])})();function nA(n){if(n<768)return!1;for(let e=0,t=cm.length;;){let r=e+t>>1;if(n<cm[r])t=r;else if(n>=cb[r])e=r+1;else return!0;if(e==t)return!1}}function Hx(n){return n>=127462&&n<=127487}const $x=8205;function rA(n,e,t=!0,r=!0){return(t?ub:iA)(n,e,r)}function ub(n,e,t){if(e==n.length)return e;e&&fb(n.charCodeAt(e))&&hb(n.charCodeAt(e-1))&&e--;let r=yp(n,e);for(e+=Ux(r);e<n.length;){let i=yp(n,e);if(r==$x||i==$x||t&&nA(i))e+=Ux(i),r=i;else if(Hx(i)){let s=0,l=e-2;for(;l>=0&&Hx(yp(n,l));)s++,l-=2;if(s%2==0)break;e+=2}else break}return e}function iA(n,e,t){for(;e>0;){let r=ub(n,e-2,t);if(r<e)return r;e--}return 0}function yp(n,e){let t=n.charCodeAt(e);if(!hb(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return fb(r)?(t-55296<<10)+(r-56320)+65536:t}function fb(n){return n>=56320&&n<57344}function hb(n){return n>=55296&&n<56320}function Ux(n){return n<65536?1:2}class Ke{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]=zo(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),Fr.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]=zo(this,e,t);let r=[];return this.decompose(e,t,r,0),Fr.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 oa(this),s=new oa(e);for(let l=t,c=t;;){if(i.next(l),s.next(l),l=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(c+=i.value.length,i.done||c>=r)return!0}}iter(e=1){return new oa(this,e)}iterRange(e,t=this.length){return new db(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 pb(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]?Ke.empty:e.length<=32?new Et(e):Fr.from(Et.split(e,[]))}}class Et extends Ke{constructor(e,t=sA(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 l=this.text[s],c=i+l.length;if((t?r:c)>=e)return new oA(i,c,r,l);i=c+1,r++}}decompose(e,t,r,i){let s=e<=0&&t>=this.length?this:new Et(qx(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let l=r.pop(),c=$u(s.text,l.text.slice(),0,s.length);if(c.length<=32)r.push(new Et(c,l.length+s.length));else{let u=c.length>>1;r.push(new Et(c.slice(0,u)),new Et(c.slice(u)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof Et))return super.replace(e,t,r);[e,t]=zo(this,e,t);let i=$u(this.text,$u(r.text,qx(this.text,0,e)),t),s=this.length+r.length-(t-e);return i.length<=32?new Et(i,s):Fr.from(Et.split(i,[]),s)}sliceString(e,t=this.length,r=`
|
|
133
|
+
`){[e,t]=zo(this,e,t);let i="";for(let s=0,l=0;s<=t&&l<this.text.length;l++){let c=this.text[l],u=s+c.length;s>e&&l&&(i+=r),e<u&&t>s&&(i+=c.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 Et(r,i)),r=[],i=-1);return i>-1&&t.push(new Et(r,i)),t}}class Fr extends Ke{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 l=this.children[s],c=i+l.length,u=r+l.lines-1;if((t?u:c)>=e)return l.lineInner(e,t,r,i);i=c+1,r=u+1}}decompose(e,t,r,i){for(let s=0,l=0;l<=t&&s<this.children.length;s++){let c=this.children[s],u=l+c.length;if(e<=u&&t>=l){let h=i&((l<=e?1:0)|(u>=t?2:0));l>=e&&u<=t&&!h?r.push(c):c.decompose(e-l,t-l,r,h)}l=u+1}}replace(e,t,r){if([e,t]=zo(this,e,t),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let l=this.children[i],c=s+l.length;if(e>=s&&t<=c){let u=l.replace(e-s,t-s,r),h=this.lines-l.lines+u.lines;if(u.lines<h>>4&&u.lines>h>>6){let d=this.children.slice();return d[i]=u,new Fr(d,this.length-(t-e)+r.length)}return super.replace(s,c,u)}s=c+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
|
|
134
|
+
`){[e,t]=zo(this,e,t);let i="";for(let s=0,l=0;s<this.children.length&&l<=t;s++){let c=this.children[s],u=l+c.length;l>e&&s&&(i+=r),e<u&&t>l&&(i+=c.sliceString(e-l,t-l,r)),l=u+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Fr))return 0;let r=0,[i,s,l,c]=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==l||s==c)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 y of e)r+=y.lines;if(r<32){let y=[];for(let x of e)x.flatten(y);return new Et(y,t)}let i=Math.max(32,r>>5),s=i<<1,l=i>>1,c=[],u=0,h=-1,d=[];function m(y){let x;if(y.lines>s&&y instanceof Fr)for(let b of y.children)m(b);else y.lines>l&&(u>l||!u)?(g(),c.push(y)):y instanceof Et&&u&&(x=d[d.length-1])instanceof Et&&y.lines+x.lines<=32?(u+=y.lines,h+=y.length+1,d[d.length-1]=new Et(x.text.concat(y.text),x.length+1+y.length)):(u+y.lines>i&&g(),u+=y.lines,h+=y.length+1,d.push(y))}function g(){u!=0&&(c.push(d.length==1?d[0]:Fr.from(d,h)),h=-1,u=d.length=0)}for(let y of e)m(y);return g(),c.length==1?c[0]:new Fr(c,t)}}Ke.empty=new Et([""],0);function sA(n){let e=-1;for(let t of n)e+=t.length+1;return e}function $u(n,e,t=0,r=1e9){for(let i=0,s=0,l=!0;s<n.length&&i<=r;s++){let c=n[s],u=i+c.length;u>=t&&(u>r&&(c=c.slice(0,r-i)),i<t&&(c=c.slice(t-i)),l?(e[e.length-1]+=c,l=!1):e.push(c)),i=u+1}return e}function qx(n,e,t){return $u(n,[""],e,t)}class oa{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 Et?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],l=s>>1,c=i instanceof Et?i.text.length:i.children.length;if(l==(t>0?c: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 Et){let u=i.text[l+(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[l+(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 Et?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 db{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new oa(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 pb{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"&&(Ke.prototype[Symbol.iterator]=function(){return this.iter()},oa.prototype[Symbol.iterator]=db.prototype[Symbol.iterator]=pb.prototype[Symbol.iterator]=function(){return this});class oA{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 zo(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Wt(n,e,t=!0,r=!0){return rA(n,e,t,r)}function lA(n){return n>=56320&&n<57344}function aA(n){return n>=55296&&n<56320}function Rn(n,e){let t=n.charCodeAt(e);if(!aA(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return lA(r)?(t-55296<<10)+(r-56320)+65536:t}function Dg(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 um=/\r\n?|\n/;var pn=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(pn||(pn={}));class $r{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++],l=this.sections[t++];l<0?(e(r,i,s),i+=s):i+=l,r+=s}}iterChangedRanges(e,t=!1){fm(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 $r(e)}composeDesc(e){return this.empty?e:e.empty?this:mb(this,e)}mapDesc(e,t=!1){return e.empty?this:hm(this,e,t)}mapPos(e,t=-1,r=pn.Simple){let i=0,s=0;for(let l=0;l<this.sections.length;){let c=this.sections[l++],u=this.sections[l++],h=i+c;if(u<0){if(h>e)return s+(e-i);s+=c}else{if(r!=pn.Simple&&h>=e&&(r==pn.TrackDel&&i<e&&h>e||r==pn.TrackBefore&&i<e||r==pn.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!c)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++],l=this.sections[r++],c=i+s;if(l>=0&&i<=t&&c>=e)return i<e&&c>t?"cover":!0;i=c}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 $r(e)}static create(e){return new $r(e)}}class Ft extends $r{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 fm(this,(t,r,i,s,l)=>e=e.replace(i,i+(r-t),l),!1),e}mapDesc(e,t=!1){return hm(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let l=t[i],c=t[i+1];if(c>=0){t[i]=c,t[i+1]=l;let u=i>>1;for(;r.length<u;)r.push(Ke.empty);r.push(l?e.slice(s,s+l):Ke.empty)}s+=l}return new Ft(t,r)}compose(e){return this.empty?e:e.empty?this:mb(this,e,!0)}map(e,t=!1){return e.empty?this:hm(this,e,t,!0)}iterChanges(e,t=!1){fm(this,e,t)}get desc(){return $r.create(this.sections)}filter(e){let t=[],r=[],i=[],s=new ya(this);e:for(let l=0,c=0;;){let u=l==e.length?1e9:e[l++];for(;c<u||c==u&&s.len==0;){if(s.done)break e;let d=Math.min(s.len,u-c);an(i,d,-1);let m=s.ins==-1?-1:s.off==0?s.ins:0;an(t,d,m),m>0&&Ji(r,t,s.text),s.forward(d),c+=d}let h=e[l++];for(;c<h;){if(s.done)break e;let d=Math.min(s.len,h-c);an(t,d,-1),an(i,d,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(d),c+=d}}return{changes:new Ft(t,r),filtered:$r.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=[],l=0,c=null;function u(d=!1){if(!d&&!i.length)return;l<t&&an(i,t-l,-1);let m=new Ft(i,s);c=c?c.compose(m.map(c)):m,i=[],s=[],l=0}function h(d){if(Array.isArray(d))for(let m of d)h(m);else if(d instanceof Ft){if(d.length!=t)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${t})`);u(),c=c?c.compose(d.map(c)):d}else{let{from:m,to:g=m,insert:y}=d;if(m>g||m<0||g>t)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${t})`);let x=y?typeof y=="string"?Ke.of(y.split(r||um)):y:Ke.empty,b=x.length;if(m==g&&b==0)return;m<l&&u(),m>l&&an(i,m-l,-1),an(i,g-m,b),Ji(s,i,x),l=g}}return h(e),u(!c),c}static empty(e){return new Ft(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((l,c)=>c&&typeof l!="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(Ke.empty);r[i]=Ke.of(s.slice(1)),t.push(s[0],r[i].length)}}}return new Ft(t,r)}static createSet(e,t){return new Ft(e,t)}}function an(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 Ji(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(Ke.empty);n.push(t)}}function fm(n,e,t){let r=n.inserted;for(let i=0,s=0,l=0;l<n.sections.length;){let c=n.sections[l++],u=n.sections[l++];if(u<0)i+=c,s+=c;else{let h=i,d=s,m=Ke.empty;for(;h+=c,d+=u,u&&r&&(m=m.append(r[l-2>>1])),!(t||l==n.sections.length||n.sections[l+1]<0);)c=n.sections[l++],u=n.sections[l++];e(i,h,s,d,m),i=h,s=d}}}function hm(n,e,t,r=!1){let i=[],s=r?[]:null,l=new ya(n),c=new ya(e);for(let u=-1;;){if(l.done&&c.len||c.done&&l.len)throw new Error("Mismatched change set lengths");if(l.ins==-1&&c.ins==-1){let h=Math.min(l.len,c.len);an(i,h,-1),l.forward(h),c.forward(h)}else if(c.ins>=0&&(l.ins<0||u==l.i||l.off==0&&(c.len<l.len||c.len==l.len&&!t))){let h=c.len;for(an(i,c.ins,-1);h;){let d=Math.min(l.len,h);l.ins>=0&&u<l.i&&l.len<=d&&(an(i,0,l.ins),s&&Ji(s,i,l.text),u=l.i),l.forward(d),h-=d}c.next()}else if(l.ins>=0){let h=0,d=l.len;for(;d;)if(c.ins==-1){let m=Math.min(d,c.len);h+=m,d-=m,c.forward(m)}else if(c.ins==0&&c.len<d)d-=c.len,c.next();else break;an(i,h,u<l.i?l.ins:0),s&&u<l.i&&Ji(s,i,l.text),u=l.i,l.forward(l.len-d)}else{if(l.done&&c.done)return s?Ft.createSet(i,s):$r.create(i);throw new Error("Mismatched change set lengths")}}}function mb(n,e,t=!1){let r=[],i=t?[]:null,s=new ya(n),l=new ya(e);for(let c=!1;;){if(s.done&&l.done)return i?Ft.createSet(r,i):$r.create(r);if(s.ins==0)an(r,s.len,0,c),s.next();else if(l.len==0&&!l.done)an(r,0,l.ins,c),i&&Ji(i,r,l.text),l.next();else{if(s.done||l.done)throw new Error("Mismatched change set lengths");{let u=Math.min(s.len2,l.len),h=r.length;if(s.ins==-1){let d=l.ins==-1?-1:l.off?0:l.ins;an(r,u,d,c),i&&d&&Ji(i,r,l.text)}else l.ins==-1?(an(r,s.off?0:s.len,u,c),i&&Ji(i,r,s.textBit(u))):(an(r,s.off?0:s.len,l.off?0:l.ins,c),i&&!l.off&&Ji(i,r,l.text));c=(s.ins>u||l.ins>=0&&l.len>u)&&(c||r.length>h),s.forward2(u),l.forward(u)}}}}class ya{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?Ke.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?Ke.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 Bs{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 Bs(r,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return ee.range(e,t);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ee.range(this.anchor,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!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 ee.range(e.anchor,e.head)}static create(e,t,r){return new Bs(e,t,r)}}class ee{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:ee.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 ee([this.main],0)}addRange(e,t=!0){return ee.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,ee.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 ee(e.ranges.map(t=>Bs.fromJSON(t)),e.main)}static single(e,t=e){return new ee([ee.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 ee.normalized(e.slice(),t);r=s.to}return new ee(e,t)}static cursor(e,t=0,r,i){return Bs.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){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return t<e?Bs.create(t,e,48|s):Bs.create(e,t,(t>e?8:0)|s)}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],l=e[i-1];if(s.empty?s.from<=l.to:s.from<l.to){let c=l.from,u=Math.max(s.to,l.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?ee.range(u,c):ee.range(c,u))}}return new ee(e,t)}}function gb(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ng=0;class ge{constructor(e,t,r,i,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=i,this.id=Ng++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new ge(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:Ig),!!e.static,e.enables)}of(e){return new Uu([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Uu(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Uu(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}}function Ig(n,e){return n==e||n.length==e.length&&n.every((t,r)=>t===e[r])}class Uu{constructor(e,t,r,i){this.dependencies=e,this.facet=t,this.type=r,this.value=i,this.id=Ng++}dynamicSlot(e){var t;let r=this.value,i=this.facet.compareInput,s=this.id,l=e[s]>>1,c=this.type==2,u=!1,h=!1,d=[];for(let m of this.dependencies)m=="doc"?u=!0:m=="selection"?h=!0:(((t=e[m.id])!==null&&t!==void 0?t:1)&1)==0&&d.push(e[m.id]);return{create(m){return m.values[l]=r(m),1},update(m,g){if(u&&g.docChanged||h&&(g.docChanged||g.selection)||dm(m,d)){let y=r(m);if(c?!Kx(y,m.values[l],i):!i(y,m.values[l]))return m.values[l]=y,1}return 0},reconfigure:(m,g)=>{let y,x=g.config.address[s];if(x!=null){let b=ff(g,x);if(this.dependencies.every(k=>k instanceof ge?g.facet(k)===m.facet(k):k instanceof nn?g.field(k,!1)==m.field(k,!1):!0)||(c?Kx(y=r(m),b,i):i(y=r(m),b)))return m.values[l]=b,0}else y=r(m);return m.values[l]=y,1}}}}function Kx(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)la(n,r)&1&&(t=!0);return t}function cA(n,e,t){let r=t.map(u=>n[u.id]),i=t.map(u=>u.type),s=r.filter(u=>!(u&1)),l=n[e.id]>>1;function c(u){let h=[];for(let d=0;d<r.length;d++){let m=ff(u,r[d]);if(i[d]==2)for(let g of m)h.push(g);else h.push(m)}return e.combine(h)}return{create(u){for(let h of r)la(u,h);return u.values[l]=c(u),1},update(u,h){if(!dm(u,s))return 0;let d=c(u);return e.compare(d,u.values[l])?0:(u.values[l]=d,1)},reconfigure(u,h){let d=dm(u,r),m=h.config.facets[e.id],g=h.facet(e);if(m&&!d&&Ig(t,m))return u.values[l]=g,0;let y=c(u);return e.compare(y,g)?(u.values[l]=g,0):(u.values[l]=y,1)}}}const du=ge.define({static:!0});class nn{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 nn(Ng++,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(du).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],l=this.updateF(s,i);return this.compareF(s,l)?0:(r.values[t]=l,1)},reconfigure:(r,i)=>{let s=r.facet(du),l=i.facet(du),c;return(c=s.find(u=>u.field==this))&&c!=l.find(u=>u.field==this)?(r.values[t]=c.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,du.of({field:this,create:e})]}get extension(){return this}}const Ns={lowest:4,low:3,default:2,high:1,highest:0};function ql(n){return e=>new yb(e,n)}const fs={highest:ql(Ns.highest),high:ql(Ns.high),default:ql(Ns.default),low:ql(Ns.low),lowest:ql(Ns.lowest)};class yb{constructor(e,t){this.inner=e,this.prec=t}}class nh{of(e){return new pm(this,e)}reconfigure(e){return nh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class pm{constructor(e,t){this.compartment=e,this.inner=t}}class uf{constructor(e,t,r,i,s,l){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=l,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),l=new Map;for(let g of uA(e,t,l))g instanceof nn?i.push(g):(s[g.facet.id]||(s[g.facet.id]=[])).push(g);let c=Object.create(null),u=[],h=[];for(let g of i)c[g.id]=h.length<<1,h.push(y=>g.slot(y));let d=r==null?void 0:r.config.facets;for(let g in s){let y=s[g],x=y[0].facet,b=d&&d[g]||[];if(y.every(k=>k.type==0))if(c[x.id]=u.length<<1|1,Ig(b,y))u.push(r.facet(x));else{let k=x.combine(y.map(R=>R.value));u.push(r&&x.compare(k,r.facet(x))?r.facet(x):k)}else{for(let k of y)k.type==0?(c[k.id]=u.length<<1|1,u.push(k.value)):(c[k.id]=h.length<<1,h.push(R=>k.dynamicSlot(R)));c[x.id]=h.length<<1,h.push(k=>cA(k,x,y))}}let m=h.map(g=>g(c));return new uf(e,l,m,c,u,s)}}function uA(n,e,t){let r=[[],[],[],[],[]],i=new Map;function s(l,c){let u=i.get(l);if(u!=null){if(u<=c)return;let h=r[u].indexOf(l);h>-1&&r[u].splice(h,1),l instanceof pm&&t.delete(l.compartment)}if(i.set(l,c),Array.isArray(l))for(let h of l)s(h,c);else if(l instanceof pm){if(t.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(l.compartment)||l.inner;t.set(l.compartment,h),s(h,c)}else if(l instanceof yb)s(l.inner,l.prec);else if(l instanceof nn)r[c].push(l),l.provides&&s(l.provides,c);else if(l instanceof Uu)r[c].push(l),l.facet.extensions&&s(l.facet.extensions,Ns.default);else{let h=l.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,c)}}return s(n,Ns.default),r.reduce((l,c)=>l.concat(c))}function la(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 ff(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const vb=ge.define(),mm=ge.define({combine:n=>n.some(e=>e),static:!0}),xb=ge.define({combine:n=>n.length?n[0]:void 0,static:!0}),wb=ge.define(),bb=ge.define(),Sb=ge.define(),kb=ge.define({combine:n=>n.length?n[0]:!1});class Ci{constructor(e,t){this.type=e,this.value=t}static define(){return new fA}}class fA{of(e){return new Ci(this,e)}}class hA{constructor(e){this.map=e}of(e){return new Ie(this,e)}}class Ie{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 Ie(this.type,t)}is(e){return this.type==e}static define(e={}){return new hA(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}}Ie.reconfigure=Ie.define();Ie.appendConfig=Ie.define();class Vt{constructor(e,t,r,i,s,l){this.startState=e,this.changes=t,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=l,this._doc=null,this._state=null,r&&gb(r,t.newLength),s.some(c=>c.type==Vt.time)||(this.annotations=s.concat(Vt.time.of(Date.now())))}static create(e,t,r,i,s,l){return new Vt(e,t,r,i,s,l)}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(Vt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Vt.time=Ci.define();Vt.userEvent=Ci.define();Vt.addToHistory=Ci.define();Vt.remote=Ci.define();function dA(n,e){let t=[];for(let r=0,i=0;;){let s,l;if(r<n.length&&(i==e.length||e[i]>=n[r]))s=n[r++],l=n[r++];else if(i<e.length)s=e[i++],l=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,l):t[t.length-1]<l&&(t[t.length-1]=l)}}function Cb(n,e,t){var r;let i,s,l;return t?(i=e.changes,s=Ft.empty(e.changes.length),l=n.changes.compose(e.changes)):(i=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),l=n.changes.compose(i)),{changes:l,selection:e.selection?e.selection.map(s):(r=n.selection)===null||r===void 0?void 0:r.map(i),effects:Ie.mapEffects(n.effects,i).concat(Ie.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function gm(n,e,t){let r=e.selection,i=Mo(e.annotations);return e.userEvent&&(i=i.concat(Vt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ft?e.changes:Ft.of(e.changes||[],t,n.facet(xb)),selection:r&&(r instanceof ee?r:ee.single(r.anchor,r.head)),effects:Mo(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function Eb(n,e,t){let r=gm(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 l=!!e[s].sequential;r=Cb(r,gm(n,e[s],l?r.changes.newLength:n.doc.length),l)}let i=Vt.create(n,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return mA(t?pA(i):i)}function pA(n){let e=n.startState,t=!0;for(let i of e.facet(wb)){let s=i(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:dA(t,s))}if(t!==!0){let i,s;if(t===!1)s=n.changes.invertedDesc,i=Ft.empty(e.doc.length);else{let l=n.changes.filter(t);i=l.changes,s=l.filtered.mapDesc(l.changes).invertedDesc}n=Vt.create(e,i,n.selection&&n.selection.map(s),Ie.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let r=e.facet(bb);for(let i=r.length-1;i>=0;i--){let s=r[i](n);s instanceof Vt?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Vt?n=s[0]:n=Eb(e,Mo(s),!1)}return n}function mA(n){let e=n.startState,t=e.facet(Sb),r=n;for(let i=t.length-1;i>=0;i--){let s=t[i](n);s&&Object.keys(s).length&&(r=Cb(r,gm(e,s,n.changes.newLength),!0))}return r==n?n:Vt.create(e,n.changes,n.selection,r.effects,r.annotations,r.scrollIntoView)}const gA=[];function Mo(n){return n==null?gA:Array.isArray(n)?n:[n]}var pt=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(pt||(pt={}));const yA=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ym;try{ym=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function vA(n){if(ym)return ym.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||yA.test(t)))return!0}return!1}function xA(n){return e=>{if(!/\S/.test(e))return pt.Space;if(vA(e))return pt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return pt.Word;return pt.Other}}class We{constructor(e,t,r,i,s,l){this.config=e,this.doc=t,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,l&&(l._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)la(this,c<<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 la(this,r),ff(this,r)}update(...e){return Eb(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:i}=t;for(let c of e.effects)c.is(nh.reconfigure)?(t&&(i=new Map,t.compartments.forEach((u,h)=>i.set(h,u)),t=null),i.set(c.value.compartment,c.value.extension)):c.is(Ie.reconfigure)?(t=null,r=c.value):c.is(Ie.appendConfig)&&(t=null,r=Mo(r).concat(c.value));let s;t?s=e.startState.values.slice():(t=uf.resolve(r,i,this),s=new We(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(u,h)=>h.reconfigure(u,this),null).values);let l=e.startState.facet(mm)?e.newSelection:e.newSelection.asSingle();new We(t,e.newDoc,l,s,(c,u)=>u.update(c,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:ee.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),i=this.changes(r.changes),s=[r.range],l=Mo(r.effects);for(let c=1;c<t.ranges.length;c++){let u=e(t.ranges[c]),h=this.changes(u.changes),d=h.map(i);for(let g=0;g<c;g++)s[g]=s[g].map(d);let m=i.mapDesc(h,!0);s.push(u.range.map(m)),i=i.compose(d),l=Ie.mapEffects(l,d).concat(Ie.mapEffects(Mo(u.effects),m))}return{changes:i,selection:ee.create(s,t.mainIndex),effects:l}}changes(e=[]){return e instanceof Ft?e:Ft.of(e,this.doc.length,this.facet(We.lineSeparator))}toText(e){return Ke.of(e.split(this.facet(We.lineSeparator)||um))}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:(la(this,t),ff(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 nn&&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 l=r[s],c=e[s];i.push(l.init(u=>l.spec.fromJSON(c,u)))}}return We.create({doc:e.doc,selection:ee.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=uf.resolve(e.extensions||[],new Map),r=e.doc instanceof Ke?e.doc:Ke.of((e.doc||"").split(t.staticFacet(We.lineSeparator)||um)),i=e.selection?e.selection instanceof ee?e.selection:ee.single(e.selection.anchor,e.selection.head):ee.single(0);return gb(i,r.length),t.staticFacet(mm)||(i=i.asSingle()),new We(t,r,i,t.dynamicSlots.map(()=>null),(s,l)=>l.create(s),null)}get tabSize(){return this.facet(We.tabSize)}get lineBreak(){return this.facet(We.lineSeparator)||`
|
|
136
|
+
`}get readOnly(){return this.facet(kb)}phrase(e,...t){for(let r of this.facet(We.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(vb))for(let l of s(this,t,r))Object.prototype.hasOwnProperty.call(l,e)&&i.push(l[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return xA(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),l=e-r,c=e-r;for(;l>0;){let u=Wt(t,l,!1);if(s(t.slice(u,l))!=pt.Word)break;l=u}for(;c<i;){let u=Wt(t,c);if(s(t.slice(c,u))!=pt.Word)break;c=u}return l==c?null:ee.range(l+r,c+r)}}We.allowMultipleSelections=mm;We.tabSize=ge.define({combine:n=>n.length?n[0]:4});We.lineSeparator=xb;We.readOnly=kb;We.phrases=ge.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])}});We.languageData=vb;We.changeFilter=wb;We.transactionFilter=bb;We.transactionExtender=Sb;nh.reconfigure=Ie.define();function Kr(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let l=i[s],c=r[s];if(c===void 0)r[s]=l;else if(!(c===l||l===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](c,l);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 is{eq(e){return this==e}range(e,t=e){return vm.create(e,t,this)}}is.prototype.startSide=is.prototype.endSide=0;is.prototype.point=!1;is.prototype.mapMode=pn.TrackDel;function Bg(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let vm=class Rb{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new Rb(e,t,r)}};function xm(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class jg{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 l=i,c=s.length;;){if(l==c)return l;let u=l+c>>1,h=s[u]-e||(r?this.value[u].endSide:this.value[u].startSide)-t;if(u==l)return h>=0?l:c;h>=0?c=u:l=u+1}}between(e,t,r,i){for(let s=this.findIndex(t,-1e9,!0),l=this.findIndex(r,1e9,!1,s);s<l;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],i=[],s=[],l=-1,c=-1;for(let u=0;u<this.value.length;u++){let h=this.value[u],d=this.from[u]+e,m=this.to[u]+e,g,y;if(d==m){let x=t.mapPos(d,h.startSide,h.mapMode);if(x==null||(g=y=x,h.startSide!=h.endSide&&(y=t.mapPos(d,h.endSide),y<g)))continue}else if(g=t.mapPos(d,h.startSide),y=t.mapPos(m,h.endSide),g>y||g==y&&h.startSide>0&&h.endSide<=0)continue;(y-g||h.endSide-h.startSide)<0||(l<0&&(l=g),h.point&&(c=Math.max(c,y-g)),r.push(h),i.push(g-l),s.push(y-l))}return{mapped:r.length?new jg(i,s,r,c):null,pos:l}}}class ze{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 ze(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,l=e.filter;if(t.length==0&&!l)return this;if(r&&(t=t.slice().sort(xm)),this.isEmpty)return t.length?ze.of(t):this;let c=new Tb(this,null,-1).goto(0),u=0,h=[],d=new xi;for(;c.value||u<t.length;)if(u<t.length&&(c.from-t[u].from||c.startSide-t[u].value.startSide)>=0){let m=t[u++];d.addInner(m.from,m.to,m.value)||h.push(m)}else c.rangeIndex==1&&c.chunkIndex<this.chunk.length&&(u==t.length||this.chunkEnd(c.chunkIndex)<t[u].from)&&(!l||i>this.chunkEnd(c.chunkIndex)||s<this.chunkPos[c.chunkIndex])&&d.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!l||i>c.to||s<c.from||l(c.from,c.to,c.value))&&(d.addInner(c.from,c.to,c.value)||h.push(vm.create(c.from,c.to,c.value))),c.next());return d.finishInner(this.nextLayer.isEmpty&&!h.length?ze.empty:this.nextLayer.update({add:h,filter:l,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let l=0;l<this.chunk.length;l++){let c=this.chunkPos[l],u=this.chunk[l],h=e.touchesRange(c,c+u.length);if(h===!1)i=Math.max(i,u.maxPoint),t.push(u),r.push(e.mapPos(c));else if(h===!0){let{mapped:d,pos:m}=u.map(c,e);d&&(i=Math.max(i,d.maxPoint),t.push(d),r.push(m))}}let s=this.nextLayer.map(e);return t.length==0?s:new ze(r,t,s||ze.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],l=this.chunk[i];if(t>=s&&e<=s+l.length&&l.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return va.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return va.from(e).goto(t)}static compare(e,t,r,i,s=-1){let l=e.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=s),c=t.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=s),u=Qx(l,c,r),h=new Kl(l,u,s),d=new Kl(c,u,s);r.iterGaps((m,g,y)=>Yx(h,m,d,g,y,i)),r.empty&&r.length==0&&Yx(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),l=t.filter(d=>!d.isEmpty&&e.indexOf(d)<0);if(s.length!=l.length)return!1;if(!s.length)return!0;let c=Qx(s,l),u=new Kl(s,c,0).goto(r),h=new Kl(l,c,0).goto(r);for(;;){if(u.to!=h.to||!wm(u.active,h.active)||u.point&&(!h.point||!Bg(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 l=new Kl(e,null,s).goto(t),c=t,u=l.openStart;for(;;){let h=Math.min(l.to,r);if(l.point){let d=l.activeForPoint(l.to),m=l.pointFrom<t?d.length+1:l.point.startSide<0?d.length:Math.min(d.length,u);i.point(c,h,l.point,d,m,l.pointRank),u=Math.min(l.openEnd(h),d.length)}else h>c&&(i.span(c,h,l.active,u),u=l.openEnd(h));if(l.to>r)return u+(l.point&&l.to>r?1:0);c=l.to,l.next()}}static of(e,t=!1){let r=new xi;for(let i of e instanceof vm?[e]:t?wA(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return ze.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=ze.empty;i=i.nextLayer)t=new ze(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}ze.empty=new ze([],[],null,-1);function wA(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let r=n[t];if(xm(e,r)>0)return n.slice().sort(xm);e=r}return n}ze.empty.nextLayer=ze.empty;class xi{finishChunk(e){this.chunks.push(new jg(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 xi)).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(ze.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=ze.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Qx(n,e,t){let r=new Map;for(let s of n)for(let l=0;l<s.chunk.length;l++)s.chunk[l].maxPoint<=0&&r.set(s.chunk[l],s.chunkPos[l]);let i=new Set;for(let s of e)for(let l=0;l<s.chunk.length;l++){let c=r.get(s.chunk[l]);c!=null&&(t?t.mapPos(c):c)==s.chunkPos[l]&&!(t!=null&&t.touchesRange(c,c+s.chunk[l].length))&&i.add(s.chunk[l])}return i}class Tb{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 va{constructor(e){this.heap=e}static from(e,t=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let l=e[s];!l.isEmpty;l=l.nextLayer)l.maxPoint>=r&&i.push(new Tb(l,t,r,s));return i.length==1?i[0]:new va(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--)vp(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--)vp(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(),vp(this.heap,0)}}}function vp(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 Kl{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=va.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){pu(this.active,e),pu(this.activeTo,e),pu(this.activeRank,e),this.minActive=Gx(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++;mu(this.active,t,r),mu(this.activeTo,t,i),mu(this.activeRank,t,s),e&&mu(e,t,this.cursor.from),this.minActive=Gx(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&&pu(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 Yx(n,e,t,r,i,s){n.goto(e),t.goto(r);let l=r+i,c=r,u=r-e,h=!!s.boundChange;for(let d=!1;;){let m=n.to+u-t.to,g=m||n.endSide-t.endSide,y=g<0?n.to+u:t.to,x=Math.min(y,l);if(n.point||t.point?(n.point&&t.point&&Bg(n.point,t.point)&&wm(n.activeForPoint(n.to),t.activeForPoint(t.to))||s.comparePoint(c,x,n.point,t.point),d=!1):(d&&s.boundChange(c),x>c&&!wm(n.active,t.active)&&s.compareRange(c,x,n.active,t.active),h&&x<l&&(m||n.openEnd(y)!=t.openEnd(y))&&(d=!0)),y>l)break;c=y,g<=0&&n.next(),g>=0&&t.next()}}function wm(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!Bg(n[t],e[t]))return!1;return!0}function pu(n,e){for(let t=e,r=n.length-1;t<r;t++)n[t]=n[t+1];n.pop()}function mu(n,e,t){for(let r=n.length-1;r>=e;r--)n[r+1]=n[r];n[e]=t}function Gx(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 el(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=Wt(n,i));return r}function bm(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=Wt(n,i)}return r===!0?-1:n.length}const Sm="ͼ",Xx=typeof Symbol>"u"?"__"+Sm:Symbol.for(Sm),km=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Jx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ss{constructor(e,t){this.rules=[];let{finish:r}=t||{};function i(l){return/^@/.test(l)?[l]:l.split(/,\s*/)}function s(l,c,u,h){let d=[],m=/^@(\w+)\b/.exec(l[0]),g=m&&m[1]=="keyframes";if(m&&c==null)return u.push(l[0]+";");for(let y in c){let x=c[y];if(/&/.test(y))s(y.split(/,\s*/).map(b=>l.map(k=>b.replace(/&/,k))).reduce((b,k)=>b.concat(k)),x,u);else if(x&&typeof x=="object"){if(!m)throw new RangeError("The value of a property ("+y+") should be a primitive value.");s(i(y),x,d,g)}else x!=null&&d.push(y.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+x+";")}(d.length||g)&&u.push((r&&!m&&!h?l.map(r):l).join(", ")+" {"+d.join(" ")+"}")}for(let l in e)s(i(l),e[l],this.rules)}getRules(){return this.rules.join(`
|
|
137
|
+
`)}static newName(){let e=Jx[Xx]||1;return Jx[Xx]=e+1,Sm+e.toString(36)}static mount(e,t,r){let i=e[km],s=r&&r.nonce;i?s&&i.setNonce(s):i=new bA(e,s),i.mount(Array.isArray(t)?t:[t],e)}}let Zx=new Map;class bA{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Zx.get(r);if(s)return e[km]=s;this.sheet=new i.CSSStyleSheet,Zx.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[km]=this}mount(e,t){let r=this.sheet,i=0,s=0;for(let l=0;l<e.length;l++){let c=e[l],u=this.modules.indexOf(c);if(u<s&&u>-1&&(this.modules.splice(u,1),s--,u=-1),u==-1){if(this.modules.splice(s++,0,c),r)for(let h=0;h<c.rules.length;h++)r.insertRule(c.rules[h],i++)}else{for(;s<u;)i+=this.modules[s++].rules.length;i+=c.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let l="";for(let u=0;u<this.modules.length;u++)l+=this.modules[u].getRules()+`
|
|
138
|
+
`;this.styleTag.textContent=l;let c=t.head||t;this.styleTag.parentNode!=c&&c.insertBefore(this.styleTag,c.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var os={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:"'"},xa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},SA=typeof navigator<"u"&&/Mac/.test(navigator.platform),kA=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var en=0;en<10;en++)os[48+en]=os[96+en]=String(en);for(var en=1;en<=24;en++)os[en+111]="F"+en;for(var en=65;en<=90;en++)os[en]=String.fromCharCode(en+32),xa[en]=String.fromCharCode(en);for(var xp in os)xa.hasOwnProperty(xp)||(xa[xp]=os[xp]);function CA(n){var e=SA&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||kA&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?xa:os)[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++)Mb(n,arguments[e]);return n}function Mb(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++)Mb(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let dn=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Cm=typeof document<"u"?document:{documentElement:{style:{}}};const Em=/Edge\/(\d+)/.exec(dn.userAgent),Ob=/MSIE \d/.test(dn.userAgent),Rm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dn.userAgent),rh=!!(Ob||Rm||Em),e1=!rh&&/gecko\/(\d+)/i.test(dn.userAgent),wp=!rh&&/Chrome\/(\d+)/.exec(dn.userAgent),EA="webkitFontSmoothing"in Cm.documentElement.style,Tm=!rh&&/Apple Computer/.test(dn.vendor),t1=Tm&&(/Mobile\/\w+/.test(dn.userAgent)||dn.maxTouchPoints>2);var me={mac:t1||/Mac/.test(dn.platform),windows:/Win/.test(dn.platform),linux:/Linux|X11/.test(dn.platform),ie:rh,ie_version:Ob?Cm.documentMode||6:Rm?+Rm[1]:Em?+Em[1]:0,gecko:e1,gecko_version:e1?+(/Firefox\/(\d+)/.exec(dn.userAgent)||[0,0])[1]:0,chrome:!!wp,chrome_version:wp?+wp[1]:0,ios:t1,android:/Android\b/.test(dn.userAgent),webkit_version:EA?+(/\bAppleWebKit\/(\d+)/.exec(dn.userAgent)||[0,0])[1]:0,safari:Tm,safari_version:Tm?+(/\bVersion\/(\d+(\.\d+)?)/.exec(dn.userAgent)||[0,0])[1]:0,tabSize:Cm.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Fg(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 hf=Object.create(null);function zg(n,e,t){if(n==e)return!0;n||(n=hf),e||(e=hf);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 RA(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 n1(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 TA(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 Qr{eq(e){return!1}updateDOM(e,t){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 tn=function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n}(tn||(tn={}));class Ce extends is{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 Ua(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 $s(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:l}=Pb(e,t);r=(s?t?-3e8:-1:5e8)-1,i=(l?t?2e8:1:-6e8)+1}return new $s(e,r,i,t,e.widget||null,!0)}static line(e){return new qa(e)}static set(e,t=!1){return ze.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ce.none=ze.empty;class Ua extends Ce{constructor(e){let{start:t,end:r}=Pb(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Fg(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||hf}eq(e){return this==e||e instanceof Ua&&this.tagName==e.tagName&&zg(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)}}Ua.prototype.point=!1;class qa extends Ce{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof qa&&this.spec.class==e.spec.class&&zg(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)}}qa.prototype.mapMode=pn.TrackBefore;qa.prototype.point=!0;class $s extends Ce{constructor(e,t,r,i,s,l){super(t,r,s,e),this.block=i,this.isReplace=l,this.mapMode=i?t<=0?pn.TrackBefore:pn.TrackAfter:pn.TrackDel}get type(){return this.startSide!=this.endSide?tn.WidgetRange:this.startSide<=0?tn.WidgetBefore:tn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof $s&&MA(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)}}$s.prototype.point=!0;function Pb(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 MA(n,e){return n==e||!!(n&&e&&n.compare(e))}function Oo(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 wa extends is{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof wa&&this.tagName==e.tagName&&zg(this.attributes,e.attributes)}static create(e){return new wa(e.tagName,e.attributes||hf)}static set(e,t=!1){return ze.of(e,t)}}wa.prototype.startSide=wa.prototype.endSide=-1;function ba(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Mm(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function qu(n,e){if(!e.anchorNode)return!1;try{return Mm(n,e.anchorNode)}catch{return!1}}function aa(n){return n.nodeType==3?ka(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function ca(n,e,t,r){return t?r1(n,e,t,r,-1)||r1(n,e,t,r,1):!1}function ls(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function df(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function r1(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:wi(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=ls(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?wi(n):0}else return!1}}function wi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Sa(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function OA(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 Ab(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 PA(n,e,t,r,i,s,l,c){let u=n.ownerDocument,h=u.defaultView||window;for(let d=n,m=!1;d&&!m;)if(d.nodeType==1){let g,y=d==u.body,x=1,b=1;if(y)g=OA(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(m=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let T=d.getBoundingClientRect();({scaleX:x,scaleY:b}=Ab(d,T)),g={left:T.left,right:T.left+d.clientWidth*x,top:T.top,bottom:T.top+d.clientHeight*b}}let k=0,R=0;if(i=="nearest")e.top<g.top?(R=e.top-(g.top+l),t>0&&e.bottom>g.bottom+R&&(R=e.bottom-g.bottom+l)):e.bottom>g.bottom&&(R=e.bottom-g.bottom+l,t<0&&e.top-R<g.top&&(R=e.top-(g.top+l)));else{let T=e.bottom-e.top,O=g.bottom-g.top;R=(i=="center"&&T<=O?e.top+T/2-O/2:i=="start"||i=="center"&&t<0?e.top-l:e.bottom-O+l)-g.top}if(r=="nearest"?e.left<g.left?(k=e.left-(g.left+s),t>0&&e.right>g.right+k&&(k=e.right-g.right+s)):e.right>g.right&&(k=e.right-g.right+s,t<0&&e.left<g.left+k&&(k=e.left-(g.left+s))):k=(r=="center"?e.left+(e.right-e.left)/2-(g.right-g.left)/2:r=="start"==c?e.left-s:e.right-(g.right-g.left)+s)-g.left,k||R)if(y)h.scrollBy(k,R);else{let T=0,O=0;if(R){let P=d.scrollTop;d.scrollTop+=R/b,O=(d.scrollTop-P)*b}if(k){let P=d.scrollLeft;d.scrollLeft+=k/x,T=(d.scrollLeft-P)*x}e={left:e.left-T,top:e.top-O,right:e.right-T,bottom:e.bottom-O},T&&Math.abs(T-k)<1&&(r="nearest"),O&&Math.abs(O-R)<1&&(i="nearest")}if(y)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 AA(n){let e=n.ownerDocument,t,r;for(let i=n.parentNode;i&&!(i==e.body||t&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!t&&i.scrollWidth>i.clientWidth&&(t=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:t,y:r}}class LA{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?wi(t):0),r,Math.min(e.focusOffset,r?wi(r):0))}set(e,t,r,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=i}}let Ls=null;me.safari&&me.safari_version>=26&&(Ls=!1);function Lb(n){if(n.setActive)return n.setActive();if(Ls)return n.focus(Ls);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Ls==null?{get preventScroll(){return Ls={preventScroll:!0},!0}}:void 0),!Ls){Ls=!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 i1;function ka(n,e,t=e){let r=i1||(i1=document.createRange());return r.setEnd(n,t),r.setStart(n,e),r}function Po(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 l=new KeyboardEvent("keyup",i);return l.synthetic=!0,n.dispatchEvent(l),s.defaultPrevented||l.defaultPrevented}function DA(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function NA(n,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,wi(t));;)if(r){if(t.nodeType!=1)return!1;let i=t.childNodes[r-1];i.contentEditable=="false"?r--:(t=i,r=wi(t))}else{if(t==n)return!0;r=ls(t),t=t.parentNode}}function Db(n){return n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function Nb(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=wi(t)}else if(t.parentNode&&!df(t))r=ls(t),t=t.parentNode;else return null}}function Ib(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&&!df(t))r=ls(t)+1,t=t.parentNode;else return null}}class xr{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new xr(e.parentNode,ls(e),t)}static after(e,t){return new xr(e.parentNode,ls(e)+1,t)}}var st=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(st||(st={}));const Us=st.LTR,_g=st.RTL;function Bb(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const IA=Bb("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),BA=Bb("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Om=Object.create(null),Nr=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);Om[e]=t,Om[t]=-e}function jb(n){return n<=247?IA[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?BA[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const jA=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class hi{get dir(){return this.level%2?_g:Us}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 l=0;l<e.length;l++){let c=e[l];if(c.from<=t&&c.to>=t){if(c.level==r)return l;(s<0||(i!=0?i<0?c.from<t:c.to>t:e[s].level>c.level))&&(s=l)}}if(s<0)throw new RangeError("Index out of range");return s}}function Fb(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||!Fb(r.inner,i.inner))return!1}return!0}const it=[];function FA(n,e,t,r,i){for(let s=0;s<=r.length;s++){let l=s?r[s-1].to:e,c=s<r.length?r[s].from:t,u=s?256:i;for(let h=l,d=u,m=u;h<c;h++){let g=jb(n.charCodeAt(h));g==512?g=d:g==8&&m==4&&(g=16),it[h]=g==4?2:g,g&7&&(m=g),d=g}for(let h=l,d=u,m=u;h<c;h++){let g=it[h];if(g==128)h<c-1&&d==it[h+1]&&d&24?g=it[h]=d:it[h]=256;else if(g==64){let y=h+1;for(;y<c&&it[y]==64;)y++;let x=h&&d==8||y<t&&it[y]==8?m==1?1:8:256;for(let b=h;b<y;b++)it[b]=x;h=y-1}else g==8&&m==1&&(it[h]=1);d=g,g&7&&(m=g)}}}function zA(n,e,t,r,i){let s=i==1?2:1;for(let l=0,c=0,u=0;l<=r.length;l++){let h=l?r[l-1].to:e,d=l<r.length?r[l].from:t;for(let m=h,g,y,x;m<d;m++)if(y=Om[g=n.charCodeAt(m)])if(y<0){for(let b=c-3;b>=0;b-=3)if(Nr[b+1]==-y){let k=Nr[b+2],R=k&2?i:k&4?k&1?s:i:0;R&&(it[m]=it[Nr[b]]=R),c=b;break}}else{if(Nr.length==189)break;Nr[c++]=m,Nr[c++]=g,Nr[c++]=u}else if((x=it[m])==2||x==1){let b=x==i;u=b?0:1;for(let k=c-3;k>=0;k-=3){let R=Nr[k+2];if(R&2)break;if(b)Nr[k+2]|=2;else{if(R&4)break;Nr[k+2]|=4}}}}}function _A(n,e,t,r){for(let i=0,s=r;i<=t.length;i++){let l=i?t[i-1].to:n,c=i<t.length?t[i].from:e;for(let u=l;u<c;){let h=it[u];if(h==256){let d=u+1;for(;;)if(d==c){if(i==t.length)break;d=t[i++].to,c=i<t.length?t[i].from:e}else if(it[d]==256)d++;else break;let m=s==1,g=(d<e?it[d]:r)==1,y=m==g?m?1:2:r;for(let x=d,b=i,k=b?t[b-1].to:n;x>u;)x==k&&(x=t[--b].from,k=b?t[b-1].to:n),it[--x]=y;u=d}else s=h,u++}}}function Pm(n,e,t,r,i,s,l){let c=r%2?2:1;if(r%2==i%2)for(let u=e,h=0;u<t;){let d=!0,m=!1;if(h==s.length||u<s[h].from){let b=it[u];b!=c&&(d=!1,m=b==16)}let g=!d&&c==1?[]:null,y=d?r:r+1,x=u;e:for(;;)if(h<s.length&&x==s[h].from){if(m)break e;let b=s[h];if(!d)for(let k=b.to,R=h+1;;){if(k==t)break e;if(R<s.length&&s[R].from==k)k=s[R++].to;else{if(it[k]==c)break e;break}}if(h++,g)g.push(b);else{b.from>u&&l.push(new hi(u,b.from,y));let k=b.direction==Us!=!(y%2);Am(n,k?r+1:r,i,b.inner,b.from,b.to,l),u=b.to}x=b.to}else{if(x==t||(d?it[x]!=c:it[x]==c))break;x++}g?Pm(n,u,x,r+1,i,g,l):u<x&&l.push(new hi(u,x,y)),u=x}else for(let u=t,h=s.length;u>e;){let d=!0,m=!1;if(!h||u>s[h-1].to){let b=it[u-1];b!=c&&(d=!1,m=b==16)}let g=!d&&c==1?[]:null,y=d?r:r+1,x=u;e:for(;;)if(h&&x==s[h-1].to){if(m)break e;let b=s[--h];if(!d)for(let k=b.from,R=h;;){if(k==e)break e;if(R&&s[R-1].to==k)k=s[--R].from;else{if(it[k-1]==c)break e;break}}if(g)g.push(b);else{b.to<u&&l.push(new hi(b.to,u,y));let k=b.direction==Us!=!(y%2);Am(n,k?r+1:r,i,b.inner,b.from,b.to,l),u=b.from}x=b.from}else{if(x==e||(d?it[x-1]!=c:it[x-1]==c))break;x--}g?Pm(n,x,u,r+1,i,g,l):x<u&&l.push(new hi(x,u,y)),u=x}}function Am(n,e,t,r,i,s,l){let c=e%2?2:1;FA(n,i,s,r,c),zA(n,i,s,r,c),_A(i,s,r,c),Pm(n,i,s,e,t,r,l)}function WA(n,e,t){if(!n)return[new hi(0,0,e==_g?1:0)];if(e==Us&&!t.length&&!jA.test(n))return zb(n.length);if(t.length)for(;n.length>it.length;)it[it.length]=256;let r=[],i=e==Us?0:1;return Am(n,i,i,t,0,n.length,r),r}function zb(n){return[new hi(0,n,0)]}let _b="";function VA(n,e,t,r,i){var s;let l=r.head-n.from,c=hi.find(e,l,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),u=e[c],h=u.side(i,t);if(l==h){let g=c+=i?1:-1;if(g<0||g>=e.length)return null;u=e[c=g],l=u.side(!i,t),h=u.side(i,t)}let d=Wt(n.text,l,u.forward(i,t));(d<u.from||d>u.to)&&(d=h),_b=n.text.slice(Math.min(l,d),Math.max(l,d));let m=c==(i?e.length-1:0)?null:e[c+(i?1:-1)];return m&&d==h&&m.level+(i?0:1)<u.level?ee.cursor(m.side(!i,t)+n.from,m.forward(i,t)?1:-1,m.level):ee.cursor(d+n.from,u.forward(i,t)?-1:1,u.level)}function HA(n,e,t){for(let r=e;r<t;r++){let i=jb(n.charCodeAt(r));if(i==1)return Us;if(i==2||i==4)return _g}return Us}const Wb=ge.define(),Vb=ge.define(),Hb=ge.define(),$b=ge.define(),Lm=ge.define(),Ub=ge.define(),qb=ge.define(),Wg=ge.define(),Vg=ge.define(),Kb=ge.define({combine:n=>n.some(e=>e)}),Qb=ge.define({combine:n=>n.some(e=>e)}),Yb=ge.define();class Ao{constructor(e,t="nearest",r="nearest",i=5,s=5,l=!1){this.range=e,this.y=t,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=l}map(e){return e.empty?this:new Ao(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 Ao(ee.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const gu=Ie.define({map:(n,e)=>n.map(e)}),Gb=Ie.define();function On(n,e,t){let r=n.facet($b);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 fi=ge.define({combine:n=>n.length?n[0]:!0});let $A=0;const So=ge.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(So.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(So.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:r,eventObservers:i,provide:s,decorations:l}=t||{};return new Mt($A++,e,r,i,c=>{let u=[];return l&&u.push(Ca.of(h=>{let d=h.plugin(c);return d?l(d):Ce.none})),s&&u.push(s(c)),u})}static fromClass(e,t){return Mt.define((r,i)=>new e(r,i),t)}}class bp{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(On(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){On(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){On(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Xb=ge.define(),Hg=ge.define(),Ca=ge.define(),Jb=ge.define(),Zb=ge.define(),Ka=ge.define(),eS=ge.define();function s1(n,e){let t=n.state.facet(eS);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(n):s),i=[];return ze.spans(r,e.from,e.to,{point(){},span(s,l,c,u){let h=s-e.from,d=l-e.from,m=i;for(let g=c.length-1;g>=0;g--,u--){let y=c[g].spec.bidiIsolate,x;if(y==null&&(y=HA(e.text,h,d)),u>0&&m.length&&(x=m[m.length-1]).to==h&&x.direction==y)x.to=d,m=x.inner;else{let b={from:h,to:d,direction:y,inner:[]};m.push(b),m=b.inner}}}}),i}const tS=ge.define();function $g(n){let e=0,t=0,r=0,i=0;for(let s of n.state.facet(tS)){let l=s(n);l&&(l.left!=null&&(e=Math.max(e,l.left)),l.right!=null&&(t=Math.max(t,l.right)),l.top!=null&&(r=Math.max(r,l.top)),l.bottom!=null&&(i=Math.max(i,l.bottom)))}return{left:e,right:t,top:r,bottom:i}}const Jl=ge.define();class nr{constructor(e,t,r,i){this.fromA=e,this.toA=t,this.fromB=r,this.toB=i}join(e){return new nr(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,l=0;;){let c=i<e.length?e[i].fromB:1e9,u=s<t.length?t[s]:1e9,h=Math.min(c,u);if(h==1e9)break;let d=h+l,m=h,g=d;for(;;)if(s<t.length&&t[s]<=m){let y=t[s+1];s+=2,m=Math.max(m,y);for(let x=i;x<e.length&&e[x].fromB<=m;x++)l=e[x].toA-e[x].toB;g=Math.max(g,y+l)}else if(i<e.length&&e[i].fromB<=m){let y=e[i++];m=Math.max(m,y.toB),g=Math.max(g,y.toA),l=y.toA-y.toB}else break;r.push(new nr(d,g,h,m))}return r}}class pf{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Ft.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,l,c,u)=>i.push(new nr(s,l,c,u))),this.changedRanges=i}static create(e,t,r){return new pf(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 UA=[];class Ht{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 UA}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&&RA(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=ls(this.dom),i=this.length?e>0:t>0;return new xr(this.parent.dom,r+(i?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof sh)return e;return null}static get(e){return e.cmTile}}class ih extends Ht{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,l=0;for(let c of this.children){if(c.sync(e),l+=c.length+c.breakAfter,i=r?r.nextSibling:t.firstChild,s&&i!=c.dom&&(s.written=!0),c.dom.parentNode==t)for(;i&&i!=c.dom;)i=o1(i);else t.insertBefore(c.dom,i);r=c.dom}for(i=r?r.nextSibling:t.firstChild,s&&i&&(s.written=!0);i;)i=o1(i);this.length=l}}function o1(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class sh extends ih{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=Ht.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 l=r.children[i++];if(l instanceof ts)t.push(i),r=l,i=0;else{let c=s+l.length,u=e(l,s);if(u!==void 0)return u;s=c+l.breakAfter}}}resolveBlock(e,t){let r,i=-1,s,l=-1;if(this.blockTiles((c,u)=>{let h=u+c.length;if(e>=u&&e<=h){if(c.isWidget()&&t>=-1&&t<=1){if(c.flags&32)return!0;c.flags&16&&(r=void 0)}(u<e||e==h&&(t<-1?c.length:c.covers(1)))&&(!r||!c.isWidget()&&r.isWidget())&&(r=c,i=e-u),(h>e||e==u&&(t>1?c.length:c.covers(-1)))&&(!s||!c.isWidget()&&s.isWidget())&&(s=c,l=e-u)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&t<0||!s?{tile:r,offset:i}:{tile:s,offset:l}}}class ts extends ih{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 ts(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class _o extends ih{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,r){let i=new _o(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,l=null,c=-1;function u(d,m){for(let g=0,y=0;g<d.children.length&&y<=m;g++){let x=d.children[g],b=y+x.length;b>=m&&(x.isComposite()?u(x,m-y):(!l||l.isHidden&&(t>0||r&&KA(l,x)))&&(b>m||x.flags&32)?(l=x,c=m-y):(y<m||x.flags&16&&!x.isHidden)&&(i=x,s=m-y)),y=b}}u(this,e);let h=(t<0?i:l)||i||l;return h?{tile:h,offset:h==i?s:c}:null}coordsIn(e,t){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t):qA(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 xr(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:t);let l=r.tile.parent,c=!1;for(let u of l.children){if(c)return new xr(u.dom,0);u==r.tile&&(c=!0)}}return new xr(this.dom,0)}}function qA(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=aa(e);return t[t.length-1]||null}function KA(n,e){let t=n.coordsIn(0,1),r=e.coordsIn(0,1);return t&&r&&r.top<t.bottom}class Mn extends ih{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let r=new Mn(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class js extends Ht{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,l=0;e==0&&t<0||e==r&&t>=0?me.chrome||me.gecko||(e?(i--,l=1):s<r&&(s++,l=-1)):t<0?i--:s<r&&s++;let c=ka(this.dom,i,s).getClientRects();if(!c.length)return null;let u=c[(l?l<0:t>=0)?0:c.length-1];return me.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(c,h=>h.width)||u),l?Sa(u,l<0):u||null}static of(e,t){let r=new js(t||document.createTextNode(e),e);return t||(r.flags|=2),r}}class Wo extends Ht{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 Sa(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),l=null;if(!s.length)return null;let c=this.flags&16?!0:this.flags&32?!1:e>0;for(let u=c?s.length-1:0;l=s[u],!(e>0?u==0:u==s.length-1||l.top<l.bottom);u+=c?-1:1);return Sa(l,!c)}}get overrideDOMText(){if(!this.length)return Ke.empty;let{root:e}=this;if(!e)return Ke.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 Wo(s,r,e,i)}}class mf extends Ht{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!1}get overrideDOMText(){return Ke.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class QA{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,r){let{tile:i,index:s,beforeBreak:l,parents:c}=this;for(;e||t>0;)if(i.isComposite())if(l){if(!e)break;r&&r.break(),e--,l=!1}else if(s==i.children.length){if(!e&&!c.length)break;r&&r.leave(i),l=!!i.breakAfter,{tile:i,index:s}=c.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)?(l=!!h,s++,e-=u.length):(c.push({tile:i,index:s}),i=u,s=0,r&&u.isComposite()&&r.enter(u))}else if(s==i.length)l=!!i.breakAfter,{tile:i,index:s}=c.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=l,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class YA{constructor(e,t,r,i){this.from=e,this.to=t,this.wrapper=r,this.rank=i}}class GA{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 l=this.ensureMarks(t,r),c=l.lastChild;if(c&&c.isText()&&!(c.flags&8)){this.cache.reused.set(c,2);let u=l.children[l.children.length-1]=new js(c.dom,c.text+e);u.parent=l}else l.append(i||js.of(e,(s=this.cache.find(js))===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)?Sp(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=r;for(let l=t.marks.length-1;l>=0;l--){let c=t.marks[l],u=i.lastChild;if(u instanceof Mn&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(Sp(c.dom)),i=u;else{if(this.cache.reused.get(c)){let d=Ht.get(c.dom);d&&d.setDOM(Sp(c.dom))}let h=Mn.of(c.mark,c.dom);i.append(h),i=h}this.cache.reused.set(c,2)}let s=new js(e.text,e.text.nodeValue);s.flags|=8,i.append(s)}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=nS);let i=_o.start(e,t||((r=this.cache.find(_o))===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 l=e[s],c;if(t>0&&(c=i.lastChild)&&c instanceof Mn&&c.mark.eq(l))i=c,t--;else{let u=Mn.of(l,(r=this.cache.find(Mn,h=>h.mark.eq(l)))===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||!l1(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(me.ios&&l1(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(kp,0,32)||new Wo(kp.toDOM(),0,kp,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=new YA(e.from,e.to,e.value,e.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-t.rank||this.wrappers[r-1].to-t.to)<0;)r--;this.wrappers.splice(r,0,t)}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 ts&&i.wrapper.eq(r.wrapper))t=i;else{let s=ts.of(r.wrapper,(e=this.cache.find(ts,l=>l.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(mf,void 0,1);return r&&(r.flags=t),r||new mf(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class XA{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:l}=this.cursor.next(this.skipCount);if(this.skipCount=0,l)throw new Error("Ran out of text content when drawing inline views");this.text=i;let c=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,c)}let t=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,t);return this.textOff=t,r}}const gf=[Wo,_o,js,Mn,mf,ts,sh];for(let n=0;n<gf.length;n++)gf[n].bucket=n;class JA{constructor(e){this.view=e,this.buckets=gf.map(()=>[]),this.index=gf.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],l=this.index[i];for(let c=s.length-1;c>=0;c--){let u=(c+l)%s.length,h=s[u];if((!t||t(h))&&!this.reused.has(h))return s.splice(u,1),u<l&&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,l=0;;s++){if(s==i.length){if(l)return null;l=1,s=0}let c=i[s];if(!this.reused.has(c)&&(l==0?c.widget.compare(e):c.widget.constructor==e.constructor&&e.updateDOM(c.dom,this.view)))return i.splice(s,1),s<this.index[0]&&this.index[0]--,this.reused.set(c,1),c.length=t,c.flags=c.flags&-498|r,c}}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}}class ZA{constructor(e,t,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new JA(e),this.text=new XA(e.state.doc),this.builder=new GA(this.cache,new sh(e,e.contentDOM),ze.iter(r)),this.cache.reused.set(t,2),this.old=new QA(t),this.reuseWalker={skip:(l,c,u)=>{if(this.cache.add(l),l.isComposite())return!1},enter:l=>this.cache.add(l),leave:()=>{},break:()=>{}}}run(e,t){let r=t&&this.getCompositionContext(t.text);for(let i=0,s=0,l=0;;){let c=l<e.length?e[l++]:null,u=c?c.fromA:this.old.root.length;if(u>i){let h=u-i;this.preserve(h,!l,!c),i=u,s+=h}if(!c)break;this.forward(c.fromA,c.toA),t&&c.fromA<=t.range.fromA&&c.toA>=t.range.toA?(this.emit(s,t.range.fromB),this.builder.addComposition(t,r),this.emit(t.range.toB,c.toB)):this.emit(s,c.toB),s=c.toB,i=c.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,r){let i=n5(this.old),s=this.openMarks;this.old.advance(e,r?1:-1,{skip:(l,c,u)=>{if(l.isWidget())if(this.openWidget)this.builder.continueWidget(u-c);else{let h=u>0||c<l.length?Wo.of(l.widget,this.view,u-c,l.flags&496,this.cache.maybeReuse(l)):this.cache.reuse(l);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(l.isText())this.builder.ensureLine(null),!c&&u==l.length?this.builder.addText(l.text,i,s,this.cache.reuse(l)):(this.cache.add(l),this.builder.addText(l.text.slice(c,u),i,s)),s=i.length;else if(l.isLine())l.flags&=-2,this.cache.reused.set(l,1),this.builder.addLine(l);else if(l instanceof mf)this.cache.add(l);else if(l instanceof Mn)this.builder.ensureLine(null),this.builder.addMark(l,i,s),this.cache.reused.set(l,1),s=i.length;else return!1;this.openWidget=!1},enter:l=>{l.isLine()?this.builder.addLineStart(l.attrs,this.cache.maybeReuse(l)):(this.cache.add(l),l instanceof Mn&&i.unshift(l.mark)),this.openWidget=!1},leave:l=>{l.isLine()?i.length&&(i.length=s=0):l instanceof Mn&&(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,l=ze.spans(this.decorations,e,t,{point:(c,u,h,d,m,g)=>{if(h instanceof $s){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(c).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=d.length,m>d.length)i.continueWidget(u-c);else{let y=h.widget||(h.block?Vo.block:Vo.inline),x=e5(h),b=this.cache.findWidget(y,u-c,x)||Wo.of(y,this.view,u-c,x);h.block?(h.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(b)):(i.ensureLine(r),i.addInlineWidget(b,d,m))}r=null}else r=t5(r,h);u>c&&this.text.skip(u-c)},span:(c,u,h,d)=>{for(let m=c;m<u;){let g=this.text.next(Math.min(512,u-m));g==null?(i.addLineStartIfNotCovered(r),i.addBreak(),m++):(i.ensureLine(r),i.addText(g,h,d),m+=g.length),r=null}}});i.addLineStartIfNotCovered(r),this.openWidget=l>s,this.openMarks=l}forward(e,t){t-e<=10?this.old.advance(t-e,1,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,1,this.reuseWalker))}getCompositionContext(e){let t=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=Ht.get(i);if(i==this.view.contentDOM)break;s instanceof Mn?t.push(s):s!=null&&s.isLine()?r=s:i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new _o(i,nS):t.push(Mn.of(new Ua({tagName:i.nodeName.toLowerCase(),attributes:TA(i)}),i))}return{line:r,marks:t}}}function l1(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 e5(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 nS={class:"cm-line"};function t5(n,e){let t=e.spec.attributes,r=e.spec.class;return!t&&!r||(n||(n={class:"cm-line"}),t&&Fg(t,n),r&&(n.class+=" "+r)),n}function n5(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 Mn&&e.push(r.mark)}return e}function Sp(n){let e=Ht.get(n);return e&&e.setDOM(n.cloneNode()),n}class Vo extends Qr{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}}Vo.inline=new Vo("span");Vo.block=new Vo("div");const kp=new class extends Qr{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class a1{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Ce.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 sh(e,e.contentDOM),this.updateInner([new nr(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:m})=>m<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:!f5(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?i5(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:m}=this.hasComposition;r=new nr(d,m,e.changes.mapPos(d,-1),e.changes.mapPos(m,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(me.ie||me.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let l=this.decorations,c=this.blockWrappers;this.updateDeco();let u=l5(l,this.decorations,e.changes);u.length&&(r=nr.extendWithRanges(r,u));let h=c5(c,this.blockWrappers,e.changes);return h.length&&(r=nr.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 l=this.tile,c=new ZA(this.view,l,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=c.run(e,t),Dm(l,c.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=me.chrome||me.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 Cp&&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(Gb)&&(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,l=!s&&!(this.view.state.facet(fi)||r.tabIndex>-1)&&qu(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||t||l))return;let c=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)),me.gecko&&u.empty&&!this.hasComposition&&r5(h)){let g=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(g,h.node.childNodes[h.offset]||null)),h=d=new xr(g,0),c=!0}let m=this.view.observer.selectionRange;(c||!m.focusNode||(!ca(h.node,h.offset,m.anchorNode,m.anchorOffset)||!ca(d.node,d.offset,m.focusNode,m.focusOffset))&&!this.suppressWidgetCursorChange(m,u))&&(this.view.observer.ignore(()=>{me.android&&me.chrome&&r.contains(m.focusNode)&&u5(m.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let g=ba(this.view.root);if(g)if(u.empty){if(me.gecko){let y=s5(h.node,h.offset);if(y&&y!=3){let x=(y==1?Nb:Ib)(h.node,h.offset);x&&(h=new xr(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 y=document.createRange();u.anchor>u.head&&([h,d]=[d,h]),y.setEnd(d.node,d.offset),y.setStart(h.node,h.offset),g.removeAllRanges(),g.addRange(y)}l&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(h,d)),this.impreciseAnchor=h.precise?null:new xr(m.anchorNode,m.anchorOffset),this.impreciseHead=d.precise?null:new xr(m.focusNode,m.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ca(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=ba(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let l=this.lineAt(t.head,t.assoc);if(!l)return;let c=l.posAtStart;if(t.head==c||t.head==c+l.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 m=e.observer.selectionRange;e.docView.posFromDOM(m.anchorNode,m.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 l=wi(e)==0?0:t==0?-1:1;for(;;){let c=e.parentNode;if(c==r.dom)break;l==0&&c.firstChild!=c.lastChild&&(e==c.firstChild?l=-1:l=1),e=c}l<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!Ht.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let l=0,c=i;;l++){let u=r.children[l];if(u.dom==s)return c;c+=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,l,c=-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 m=d+h.length;if(d<=e&&(r=h,i=e-d,s=m<e),m>=e&&!l&&(l=h,c=e-d,u=d>e),d>e&&l)return!0}}),!r&&!l?this.domAtPos(e,t):(s&&l?r=null:u&&r&&(l=null),r&&t<0||!l?r.domIn(i,t):l.domIn(c,t))}coordsAt(e,t){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof Cp?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,l){if(s.isComposite())for(let c of s.children){if(c.length>=l){let u=i(c,l);if(u)return u}if(l-=c.length,l<0)break}else if(s.isText()&&l<s.length){let c=Wt(s.text,l);if(c==l)return null;let u=ka(s.dom,l,c).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,l=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,u=this.view.textDirection==st.LTR,h=0,d=(m,g,y)=>{for(let x=0;x<m.children.length&&!(g>i);x++){let b=m.children[x],k=g+b.length,R=b.dom.getBoundingClientRect(),{height:T}=R;if(y&&!x&&(h+=R.top-y.top),b instanceof ts)k>r&&d(b,g,R);else if(g>=r&&(h>0&&t.push(-h),t.push(T+h),h=0,l)){let O=b.dom.lastChild,P=O?aa(O):[];if(P.length){let N=P[P.length-1],I=u?N.right-R.left:R.right-N.left;I>c&&(c=I,this.minWidth=s,this.minWidthFrom=g,this.minWidthTo=k)}}y&&x==m.children.length-1&&(h+=y.bottom-R.bottom),g=k+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"?st.RTL:st.LTR}measureTextSize(){let e=this.tile.blockTiles(l=>{if(l.isLine()&&l.children.length&&l.length<=20){let c=0,u;for(let h of l.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let d=aa(h.dom);if(d.length!=1)return;c+=d[0].width,u=d[0].height}if(c)return{lineHeight:l.dom.getBoundingClientRect().height,charWidth:c/l.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 l=aa(t.firstChild)[0];r=t.getBoundingClientRect().height,i=l&&l.width?l.width/27:7,s=l&&l.height?l.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],l=s?s.from-1:this.view.state.doc.length;if(l>r){let c=(t.lineBlockAt(l).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(Ce.replace({widget:new Cp(c),block:!0,inclusive:!0,isBlockGap:!0}).range(r,l))}if(!s)break;r=s.to+1}return Ce.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Ca).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Zb).map((s,l)=>{let c=typeof s=="function";return c&&(r=!0),c?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,t.push(ze.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(Jb).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(Yb))try{if(h(this.view,e.range,e))return!0}catch(d){On(this.view.state,d,"scroll handler")}let{range:t}=e,r=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),i;if(!r)return;!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=$g(this.view),l={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:c,offsetHeight:u}=this.view.scrollDOM;PA(this.view.scrollDOM,l,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,c),-c),Math.max(Math.min(e.yMargin,u),-u),this.view.textDirection==st.LTR)}lineHasWidget(e){let t=r=>r.isWidget()||r.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Dm(this.tile)}}function Dm(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let r of n.children)Dm(r,e)}}function r5(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 rS(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let r=Nb(t.focusNode,t.focusOffset),i=Ib(t.focusNode,t.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let c=Ht.get(i.node);if(!c||c.isText()&&c.text!=i.node.nodeValue)s=i;else if(n.docView.lastCompositionAfterCursor){let u=Ht.get(r.node);!u||u.isText()&&u.text!=r.node.nodeValue||(s=i)}}if(n.docView.lastCompositionAfterCursor=s!=r,!s)return null;let l=e-s.offset;return{from:l,to:l+s.node.nodeValue.length,node:s.node}}function i5(n,e,t){let r=rS(n,t);if(!r)return null;let{node:i,from:s,to:l}=r,c=i.nodeValue;if(/[\n\r]/.test(c)||n.state.doc.sliceString(r.from,r.to)!=c)return null;let u=e.invertedDesc;return{range:new nr(u.mapPos(s),u.mapPos(l),s,l),text:i}}function s5(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 o5=class{constructor(){this.changes=[]}compareRange(e,t){Oo(e,t,this.changes)}comparePoint(e,t){Oo(e,t,this.changes)}boundChange(e){Oo(e,e,this.changes)}};function l5(n,e,t){let r=new o5;return ze.compare(n,e,t,r),r.changes}class a5{constructor(){this.changes=[]}compareRange(e,t){Oo(e,t,this.changes)}comparePoint(){}boundChange(e){Oo(e,e,this.changes)}}function c5(n,e,t){let r=new a5;return ze.compare(n,e,t,r),r.changes}function u5(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 f5(n,e){let t=!1;return e&&n.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(t=!0)}),t}class Cp extends Qr{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 h5(n,e,t=1){let r=n.charCategorizer(e),i=n.doc.lineAt(e),s=e-i.from;if(i.length==0)return ee.cursor(e);s==0?t=1:s==i.length&&(t=-1);let l=s,c=s;t<0?l=Wt(i.text,s,!1):c=Wt(i.text,s);let u=r(i.text.slice(l,c));for(;l>0;){let h=Wt(i.text,l,!1);if(r(i.text.slice(h,l))!=u)break;l=h}for(;c<i.length;){let h=Wt(i.text,c);if(r(i.text.slice(c,h))!=u)break;c=h}return ee.range(l+i.from,c+i.from)}function d5(n,e,t,r,i){let s=Math.round((r-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let c=n.viewState.heightOracle.textHeight,u=Math.floor((i-t.top-(n.defaultLineHeight-c)*.5)/c);s+=u*n.viewState.heightOracle.lineLength}let l=n.state.sliceDoc(t.from,t.to);return t.from+bm(l,s,n.state.tabSize)}function Nm(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==tn.Text&&(i.type!=s.type||(t<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function p5(n,e,t,r){let i=Nm(n,e.head,e.assoc||-1),s=!r||i.type!=tn.Text||!(n.lineWrapping||i.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let l=n.dom.getBoundingClientRect(),c=n.textDirectionAt(i.from),u=n.posAtCoords({x:t==(c==st.LTR)?l.right-1:l.left+1,y:(s.top+s.bottom)/2});if(u!=null)return ee.cursor(u,t?-1:1)}return ee.cursor(t?i.to:i.from,t?-1:1)}function c1(n,e,t,r){let i=n.state.doc.lineAt(e.head),s=n.bidiSpans(i),l=n.textDirectionAt(i.from);for(let c=e,u=null;;){let h=VA(i,s,l,c,t),d=_b;if(!h){if(i.number==(t?n.state.doc.lines:1))return c;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 c}else{if(!r)return h;u=r(d)}c=h}}function m5(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let l=r(s);return i==pt.Space&&(i=l),i==l}}function g5(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return ee.cursor(i,e.assoc);let l=e.goalColumn,c,u=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(i,e.assoc||-1),d=n.documentTop;if(h)l==null&&(l=h.left-u.left),c=s<0?h.top:h.bottom;else{let y=n.viewState.lineBlockAt(i);l==null&&(l=Math.min(u.right-u.left,n.defaultCharacterWidth*(i-y.from))),c=(s<0?y.top:y.bottom)+d}let m=u.left+l,g=r??n.viewState.heightOracle.textHeight>>1;for(let y=0;;y+=10){let x=c+(g+y)*s,b=Im(n,{x:m,y:x},!1,s);return ee.cursor(b.pos,b.assoc,void 0,l)}}function ua(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,l,c)=>{if(e>s&&e<l){let u=r||t||(e-s<l-e?-1:1);e=u<0?s:l,r=u}});if(!r)return e}}function iS(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 l=ua(n,i.from,0);l!=i.from&&(s=ee.cursor(l,-1))}else{let l=ua(n,i.from,-1),c=ua(n,i.to,1);(l!=i.from||c!=i.to)&&(s=ee.range(i.from==i.anchor?l:c,i.from==i.head?l:c))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?ee.create(t,e.mainIndex):e}function Ep(n,e,t){let r=ua(n.state.facet(Ka).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:ee.cursor(r,r<t.from?1:-1)}class _r{constructor(e,t){this.pos=e,this.assoc=t}}function Im(n,e,t,r){let i=n.contentDOM.getBoundingClientRect(),s=i.top+n.viewState.paddingTop,{x:l,y:c}=e,u=c-s,h;for(;;){if(u<0)return new _r(0,1);if(u>n.viewState.docHeight)return new _r(n.state.doc.length,-1);if(h=n.elementAtHeight(u),r==null)break;if(h.type==tn.Text){let g=n.docView.coordsAt(r<0?h.from:h.to,r);if(g&&(r<0?g.top<=u+s:g.bottom>=u+s))break}let m=n.viewState.heightOracle.textHeight/2;u=r>0?h.bottom+m:h.top-m}if(n.viewport.from>=h.to||n.viewport.to<=h.from){if(t)return null;if(h.type==tn.Text){let m=d5(n,i,h,l,c);return new _r(m,m==h.from?1:-1)}}if(h.type!=tn.Text)return u<(h.top+h.bottom)/2?new _r(h.from,1):new _r(h.to,-1);let d=n.docView.lineAt(h.from,2);return(!d||d.length!=h.length)&&(d=n.docView.lineAt(h.from,-2)),sS(n,d,h.from,l,c)}function sS(n,e,t,r,i){let s=-1,l=null,c=1e9,u=1e9,h=i,d=i,m=(g,y)=>{for(let x=0;x<g.length;x++){let b=g[x];if(b.top==b.bottom)continue;let k=b.left>r?b.left-r:b.right<r?r-b.right:0,R=b.top>i?b.top-i:b.bottom<i?i-b.bottom:0;b.top<=d&&b.bottom>=h&&(h=Math.min(b.top,h),d=Math.max(b.bottom,d),R=0),(s<0||(R-u||k-c)<0)&&(s>=0&&u&&c<k&&l.top<=d-2&&l.bottom>=h+2?u=0:(s=y,c=k,u=R,l=b))}};if(e.isText()){for(let y=0;y<e.length;){let x=Wt(e.text,y);if(m(ka(e.dom,y,x).getClientRects(),y),!c&&!u)break;y=x}return r>(l.left+l.right)/2==(u1(n,s+t)==st.LTR)?new _r(t+Wt(e.text,s),-1):new _r(t+s,1)}else{if(!e.length)return new _r(t,1);for(let b=0;b<e.children.length;b++){let k=e.children[b];if(k.flags&48)continue;let R=(k.dom.nodeType==1?k.dom:ka(k.dom,0,k.length)).getClientRects();if(m(R,b),!c&&!u)break}let g=e.children[s],y=e.posBefore(g,t);return g.isComposite()||g.isText()?sS(n,g,y,Math.max(l.left,Math.min(l.right,r)),i):r>(l.left+l.right)/2==(u1(n,s+t)==st.LTR)?new _r(y+g.length,-1):new _r(y,1)}}function u1(n,e){let t=n.state.doc.lineAt(e);return n.bidiSpans(t)[hi.find(n.bidiSpans(t),e-t.from,-1,1)].dir}const Zl="";class y5{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(We.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Zl}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 l=Ht.get(i),c=i.nextSibling;if(c==t){l!=null&&l.breakAfter&&!c&&r!=this.view.contentDOM&&this.lineBreak();break}let u=Ht.get(c);(l&&u?l.breakAfter:(l?l.breakAfter:df(i))||df(c)&&(i.nodeName!="BR"||l!=null&&l.isWidget())&&this.text.length>s)&&!x5(c,t)&&this.lineBreak(),i=c}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,l=1,c;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),l=this.lineSeparator.length):(c=i.exec(t))&&(s=c.index,l=c[0].length),this.append(t.slice(r,s<0?t.length:s)),s<0)break;if(this.lineBreak(),l>1)for(let u of this.points)u.node==e&&u.pos>this.text.length&&(u.pos-=l-1);r=s+l}}readNode(e){let t=Ht.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+(v5(e,r.node,r.offset)?t:0))}}function v5(n,e,t){for(;;){if(!e||t<wi(e))return!1;if(e==n)return!0;t=ls(e)+1,e=e.parentNode}}function x5(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let r=Ht.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 f1{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class w5{constructor(e,t,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:l}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=oS(e.docView.tile,t,r,0))){let c=s||l?[]:S5(e),u=new y5(c,e);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=k5(c,this.bounds.from)}else{let c=e.observer.selectionRange,u=s&&s.node==c.focusNode&&s.offset==c.focusOffset||!Mm(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),h=l&&l.node==c.anchorNode&&l.offset==c.anchorOffset||!Mm(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),d=e.viewport;if((me.ios||me.chrome)&&e.state.selection.main.empty&&u!=h&&(d.from>0||d.to<e.state.doc.length)){let m=Math.min(u,h),g=Math.max(u,h),y=d.from-m,x=d.to-g;(y==0||y==1||m==0)&&(x==0||x==-1||g==e.state.doc.length)&&(u=0,h=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(ee.range(h,u)):this.newSel=ee.single(h,u)}}}function oS(n,e,t,r){if(n.isComposite()){let i=-1,s=-1,l=-1,c=-1;for(let u=0,h=r,d=r;u<n.children.length;u++){let m=n.children[u],g=h+m.length;if(h<e&&g>t)return oS(m,e,t,h);if(g>=e&&i==-1&&(i=u,s=h),h>t&&m.dom.parentNode==n.dom){l=u,c=d;break}d=g,h=g+m.breakAfter}return{from:s,to:c<0?r+n.length:c,startDOM:(i?n.children[i-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:l<n.children.length&&l>=0?n.children[l].dom:null}}else return n.isText()?{from:r,to:r+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function lS(n,e){let t,{newSel:r}=e,i=n.state.selection.main,s=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:c}=e.bounds,u=i.from,h=null;(s===8||me.android&&e.text.length<c-l)&&(u=i.to,h="end");let d=aS(n.state.doc.sliceString(l,c,Zl),e.text,u-l,h);d&&(me.chrome&&s==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==Zl+Zl&&d.toB--,t={from:l+d.from,to:l+d.toA,insert:Ke.of(e.text.slice(d.from,d.toB).split(Zl))})}else r&&(!n.hasFocus&&n.state.facet(fi)||r.main.eq(i))&&(r=null);if(!t&&!r)return!1;if(!t&&e.typeOver&&!i.empty&&r&&r.main.empty?t={from:i.from,to:i.to,insert:n.state.doc.slice(i.from,i.to)}:(me.mac||me.android)&&t&&t.from==t.to&&t.from==i.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=ee.single(r.main.anchor-1,r.main.head-1)),t={from:t.from,to:t.to,insert:Ke.of([t.insert.toString().replace("."," ")])}):t&&t.from>=i.from&&t.to<=i.to&&(t.from!=i.from||t.to!=i.to)&&i.to-i.from-(t.to-t.from)<=4?t={from:i.from,to:i.to,insert:n.state.doc.slice(i.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,i.to))}:n.state.doc.lineAt(i.from).to<i.to&&n.docView.lineHasWidget(i.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:i.from,to:i.to,insert:n.state.toText(n.inputState.insertingText)}:me.chrome&&t&&t.from==t.to&&t.from==i.head&&t.insert.toString()==`
|
|
140
|
+
`&&n.lineWrapping&&(r&&(r=ee.single(r.main.anchor-1,r.main.head-1)),t={from:i.from,to:i.to,insert:Ke.of([" "])}),t)return Ug(n,t,r,s);if(r&&!r.main.eq(i)){let l=!1,c="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),c=n.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=iS(n.state.facet(Ka).map(u=>u(n)),r))),n.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function Ug(n,e,t,r=-1){if(me.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(me.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&&Po(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)&&Po(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Po(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let l,c=()=>l||(l=b5(n,e,t));return n.state.facet(Ub).some(u=>u(n,e.from,e.to,s,c))||n.dispatch(c()),!0}function b5(n,e,t){let r,i=n.state,s=i.selection.main,l=-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=ua(i.facet(Ka).map(m=>m(n)),h,u);e.from==d&&(l=d)}if(l>-1)r={changes:e,selection:ee.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),m,g=t&&rS(n,t.main.head);if(g){let x=e.insert.length-(e.to-e.from);m={from:g.from,to:g.to-x}}else m=n.state.doc.lineAt(s.head);let y=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-y,k=b-d.length;if(n.state.sliceDoc(k,b)!=d||b>=m.from&&k<=m.to)return{range:x};let R=i.changes({from:k,to:b,insert:e.insert}),T=x.to-s.to;return{changes:R,range:h?ee.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T)):x.map(R)}})}else r={changes:u,selection:h&&i.selection.replaceRange(h)}}let c="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,c+=".compose",n.inputState.compositionFirstChange&&(c+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:c,scrollIntoView:!0})}function aS(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 l=n.length,c=e.length;for(;l>0&&c>0&&n.charCodeAt(l-1)==e.charCodeAt(c-1);)l--,c--;if(r=="end"){let u=Math.max(0,s-Math.min(l,c));t-=l+u-s}if(l<s&&n.length<e.length){let u=t<=s&&t>=l?s-t:0;s-=u,c=s+(c-l),l=s}else if(c<s){let u=t<=s&&t>=c?s-t:0;s-=u,l=s+(l-c),c=s}return{from:s,toA:l,toB:c}}function S5(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 f1(t,r)),(i!=t||s!=r)&&e.push(new f1(i,s))),e}function k5(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?ee.single(t+e,r+e):null}class C5{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,me.safari&&e.contentDOM.addEventListener("input",()=>null),me.gecko&&z5(e.contentDOM.ownerDocument)}handleEvent(e){!L5(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=E5(e),r=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let l=!t[s].handlers.length,c=r[s];c&&l!=!c.handlers.length&&(i.removeEventListener(s,this.handleEvent),c=null),c||i.addEventListener(s,this.handleEvent,{passive:l})}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&&uS.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),me.android&&me.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return me.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=cS.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||R5.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(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,Po(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:me.safari&&!me.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 h1(n,e){return(t,r)=>{try{return e.call(n,r,t)}catch(i){On(t.state,i)}}}function E5(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,l=i&&i.plugin.domEventObservers;if(s)for(let c in s){let u=s[c];u&&t(c).handlers.push(h1(r.value,u))}if(l)for(let c in l){let u=l[c];u&&t(c).observers.push(h1(r.value,u))}}for(let r in br)t(r).handlers.push(br[r]);for(let r in lr)t(r).observers.push(lr[r]);return e}const cS=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],R5="dthko",uS=[16,17,18,20,91,92,224,225],yu=6;function vu(n){return Math.max(0,n)*.7+8}function T5(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class M5{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=AA(e.contentDOM),this.atoms=e.state.facet(Ka).map(l=>l(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(We.allowMultipleSelections)&&O5(e,t),this.dragging=A5(e,t)&&dS(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&&T5(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,r=0,i=0,s=0,l=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:c}=this.scrollParents.y.getBoundingClientRect());let u=$g(this.view);e.clientX-u.left<=i+yu?t=-vu(i-e.clientX):e.clientX+u.right>=l-yu&&(t=vu(e.clientX-l)),e.clientY-u.top<=s+yu?r=-vu(s-e.clientY):e.clientY+u.bottom>=c-yu&&(r=vu(e.clientY-c)),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=iS(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 O5(n,e){let t=n.state.facet(Wb);return t.length?t[0](e):me.mac?e.metaKey:e.ctrlKey}function P5(n,e){let t=n.state.facet(Vb);return t.length?t[0](e):me.mac?!e.altKey:!e.ctrlKey}function A5(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let r=ba(n.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let l=i[s];if(l.left<=e.clientX&&l.right>=e.clientX&&l.top<=e.clientY&&l.bottom>=e.clientY)return!0}return!1}function L5(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=Ht.get(t))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const br=Object.create(null),lr=Object.create(null),fS=me.ie&&me.ie_version<15||me.ios&&me.webkit_version<604;function D5(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(),hS(n,t.value)},50)}function oh(n,e,t){for(let r of n.facet(e))t=r(t,n);return t}function hS(n,e){e=oh(n.state,Wg,e);let{state:t}=n,r,i=1,s=t.toText(e),l=s.lines==t.selection.ranges.length;if(Bm!=null&&t.selection.ranges.every(u=>u.empty)&&Bm==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 m=t.toText((l?s.line(i++).text:e)+t.lineBreak);return{changes:{from:d.from,insert:m},range:ee.cursor(h.from+m.length)}})}else l?r=t.changeByRange(u=>{let h=s.line(i++);return{changes:{from:u.from,to:u.to,insert:h.text},range:ee.cursor(u.from+h.length)}}):r=t.replaceSelection(s);n.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}lr.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};br.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);lr.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};lr.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};br.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(Hb))if(t=r(n,e),t)break;if(!t&&e.button==0&&(t=I5(n,e)),t){let r=!n.hasFocus;n.inputState.startMouseSelection(new M5(n,e,t,r)),r&&n.observer.ignore(()=>{Lb(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 d1(n,e,t,r){if(r==1)return ee.cursor(e,t);if(r==2)return h5(n.state,e,t);{let i=n.docView.lineAt(e,t),s=n.state.doc.lineAt(i?i.posAtEnd:e),l=i?i.posAtStart:s.from,c=i?i.posAtEnd:s.to;return c<n.state.doc.length&&c==s.to&&c++,ee.range(l,c)}}const N5=me.ie&&me.ie_version<=11;let p1=null,m1=0,g1=0;function dS(n){if(!N5)return n.detail;let e=p1,t=g1;return p1=n,g1=Date.now(),m1=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(m1+1)%3:1}function I5(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=dS(e),i=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,l,c){let u=n.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),h,d=d1(n,u.pos,u.assoc,r);if(t.pos!=u.pos&&!l){let m=d1(n,t.pos,t.assoc,r),g=Math.min(m.from,d.from),y=Math.max(m.to,d.to);d=g<d.from?ee.range(g,y):ee.range(y,g)}return l?i.replaceRange(i.main.extend(d.from,d.to)):c&&r==1&&i.ranges.length>1&&(h=B5(i,u.pos))?h:c?i.addRange(d):ee.create([d])}}}function B5(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 ee.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}br.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,l=s+i.length;(s>=t.to||l<=t.from)&&(t=ee.range(s,l))}}let{inputState:r}=n;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",oh(n.state,Vg,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};br.dragend=n=>(n.inputState.draggedContent=null,!1);function y1(n,e,t,r){if(t=oh(n.state,Wg,t),!t)return;let i=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,l=r&&s&&P5(n,e)?{from:s.from,to:s.to}:null,c={from:i,insert:t},u=n.state.changes(l?[l,c]:c);n.focus(),n.dispatch({changes:u,selection:{anchor:u.mapPos(i,-1),head:u.mapPos(i,1)},userEvent:l?"move.drop":"input.drop"}),n.inputState.draggedContent=null}br.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&&y1(n,e,r.filter(l=>l!=null).join(n.state.lineBreak),!1)};for(let l=0;l<t.length;l++){let c=new FileReader;c.onerror=s,c.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(r[l]=c.result),s()},c.readAsText(t[l])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return y1(n,e,r,!0),!0}return!1};br.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=fS?null:e.clipboardData;return t?(hS(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(D5(n),!1)};function j5(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 F5(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 l=n.doc.lineAt(s);l.number>i&&(e.push(l.text),t.push({from:l.from,to:Math.min(n.doc.length,l.to+1)})),i=l.number}r=!0}return{text:oh(n,Vg,e.join(n.lineBreak)),ranges:t,linewise:r}}let Bm=null;br.copy=br.cut=(n,e)=>{let{text:t,ranges:r,linewise:i}=F5(n.state);if(!t&&!i)return!1;Bm=i?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=fS?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(j5(n,t),!1)};const pS=Ci.define();function mS(n,e){let t=[];for(let r of n.facet(qb)){let i=r(n,e);i&&t.push(i)}return t.length?n.update({effects:t,annotations:pS.of(!0)}):null}function gS(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=mS(n.state,e);t?n.dispatch(t):n.update([])}},10)}lr.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),gS(n)};lr.blur=n=>{n.observer.clearSelectionRange(),gS(n)};lr.compositionstart=lr.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};lr.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,me.chrome&&me.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};lr.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};br.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"),l=e.getTargetRanges();if(s&&l.length){let c=l[0],u=n.posAtDOM(c.startContainer,c.startOffset),h=n.posAtDOM(c.endContainer,c.endOffset);return Ug(n,{from:u,to:h,insert:n.state.toText(s)},null),!0}}let i;if(me.chrome&&me.android&&(i=cS.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 l;(((l=window.visualViewport)===null||l===void 0?void 0:l.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return me.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),me.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>lr.compositionend(n,e),20),!1};const v1=new Set;function z5(n){v1.has(n)||(v1.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const x1=["pre-wrap","normal","pre-line","break-spaces"];let Ho=!1;function w1(){Ho=!1}class _5{constructor(e){this.lineWrapping=e,this.doc=Ke.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 x1.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,l){let c=x1.indexOf(e)>-1,u=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=t,this.charWidth=r,this.textHeight=i,this.lineLength=s,u){this.heightSamples={};for(let h=0;h<l.length;h++){let d=l[h];d<0?h++:this.heightSamples[Math.floor(d*10)]=!0}}return u}}class W5{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class vr{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"?tn.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 $s?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 vr(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var lt=function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n}(lt||(lt={}));const Ku=.001;class mn{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)>Ku&&(Ho=!0),this.height=e)}replace(e,t,r){return mn.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,i){let s=this,l=r.doc;for(let c=i.length-1;c>=0;c--){let{fromA:u,toA:h,fromB:d,toB:m}=i[c],g=s.lineAt(u,lt.ByPosNoHeight,r.setDoc(t),0,0),y=g.to>=h?g:s.lineAt(h,lt.ByPosNoHeight,r,0,0);for(m+=y.to-h,h=y.to;c>0&&g.from<=i[c-1].toA;)u=i[c-1].fromA,d=i[c-1].fromB,c--,u<g.from&&(g=s.lineAt(u,lt.ByPosNoHeight,r,0,0));d+=g.from-u,u=g.from;let x=qg.build(r.setDoc(l),e,d,m);s=yf(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 c=e[t-1];c.break?e.splice(--t,1,c.left,null,c.right):e.splice(--t,1,c.left,c.right),r+=1+c.break,i-=c.size}else if(s>i*2){let c=e[r];c.break?e.splice(r,1,c.left,null,c.right):e.splice(r,1,c.left,c.right),r+=2+c.break,s-=c.size}else break;else if(i<s){let c=e[t++];c&&(i+=c.size)}else{let c=e[--r];c&&(s+=c.size)}let l=0;return e[t-1]==null?(l=1,t--):e[t]==null&&(l=1,r++),new H5(mn.of(e.slice(0,t)),l,mn.of(e.slice(r)))}}function yf(n,e){return n==e?n:(n.constructor!=e.constructor&&(Ho=!0),e)}mn.prototype.size=1;const V5=Ce.replace({});class yS extends mn{constructor(e,t,r){super(e,t),this.deco=r,this.spaceAbove=0}mainBlock(e,t){return new vr(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 vr(i,0,r,this.spaceAbove,V5):this.mainBlock(r,i)}lineAt(e,t,r,i,s){let l=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(l):l}forEachLine(e,t,r,i,s,l){e<=s+this.length&&t>=s&&l(this.lineAt(0,lt.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 yS{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 vr(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 Zt&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Zt?i=new zn(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):mn.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 Zt extends mn{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,l,c=0;if(e.lineWrapping){let u=Math.min(this.height,e.lineHeight*s);l=u/s,this.length>s+1&&(c=(this.height-u)/(this.length-s-1))}else l=this.height/s;return{firstLine:r,lastLine:i,perLine:l,perChar:c}}blockAt(e,t,r,i){let{firstLine:s,lastLine:l,perLine:c,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),m=c+d.length*u,g=Math.max(r,e-m/2);return new vr(d.from,d.length,g,m,0)}else{let h=Math.max(0,Math.min(l-s,Math.floor((e-r)/c))),{from:d,length:m}=t.doc.line(s+h);return new vr(d,m,r+c*h,c,0)}}lineAt(e,t,r,i,s){if(t==lt.ByHeight)return this.blockAt(e,r,i,s);if(t==lt.ByPosNoHeight){let{from:y,to:x}=r.doc.lineAt(e);return new vr(y,x-y,0,0,0)}let{firstLine:l,perLine:c,perChar:u}=this.heightMetrics(r,s),h=r.doc.lineAt(e),d=c+h.length*u,m=h.number-l,g=i+c*m+u*(h.from-s-m);return new vr(h.from,h.length,Math.max(i,Math.min(g,i+this.height-d)),d,0)}forEachLine(e,t,r,i,s,l){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:c,perLine:u,perChar:h}=this.heightMetrics(r,s);for(let d=e,m=i;d<=t;){let g=r.doc.lineAt(d);if(d==e){let x=g.number-c;m+=u*x+h*(e-s-x)}let y=u+h*g.length;l(new vr(g.from,g.length,m,y,0)),m+=y,d=g.to+1}}replace(e,t,r){let i=this.length-t;if(i>0){let s=r[r.length-1];s instanceof Zt?r[r.length-1]=new Zt(s.length+i):r.push(null,new Zt(i-1))}if(e>0){let s=r[0];s instanceof Zt?r[0]=new Zt(e+s.length):r.unshift(new Zt(e-1),null)}return mn.of(r)}decomposeLeft(e,t){t.push(new Zt(e-1),null)}decomposeRight(e,t){t.push(null,new Zt(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 l=[],c=Math.max(t,i.from),u=-1;for(i.from>t&&l.push(new Zt(i.from-t-1).updateHeight(e,t));c<=s&&i.more;){let d=e.doc.lineAt(c).length;l.length&&l.push(null);let m=i.heights[i.index++],g=0;m<0&&(g=-m,m=i.heights[i.index++]),u==-1?u=m:Math.abs(m-u)>=Ku&&(u=-2);let y=new zn(d,m,g);y.outdated=!1,l.push(y),c+=d+1}c<=s&&l.push(null,new Zt(s-c).updateHeight(e,c));let h=mn.of(l);return(u<0||Math.abs(h.height-this.height)>=Ku||Math.abs(u-this.heightMetrics(e,t).perLine)>=Ku)&&(Ho=!0),yf(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 H5 extends mn{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 l=i+this.left.height,c=s+this.left.length+this.break,u=t==lt.ByHeight?e<l:e<c,h=u?this.left.lineAt(e,t,r,i,s):this.right.lineAt(e,t,r,l,c);if(this.break||(u?h.to<c:h.from>c))return h;let d=t==lt.ByPosNoHeight?lt.ByPosNoHeight:lt.ByPos;return u?h.join(this.right.lineAt(c,d,r,l,c)):this.left.lineAt(c,d,r,i,s).join(h)}forEachLine(e,t,r,i,s,l){let c=i+this.left.height,u=s+this.left.length+this.break;if(this.break)e<u&&this.left.forEachLine(e,t,r,i,s,l),t>=u&&this.right.forEachLine(e,t,r,c,u,l);else{let h=this.lineAt(u,lt.ByPos,r,i,s);e<h.from&&this.left.forEachLine(e,h.from-1,r,i,s,l),h.to>=e&&h.from<=t&&l(h),t>h.to&&this.right.forEachLine(h.to+1,t,r,c,u,l)}}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 l=s.length;for(let c of r)s.push(c);if(e>0&&b1(s,l-1),t<this.length){let c=s.length;this.decomposeRight(t,s),b1(s,c)}return mn.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?mn.of(this.break?[e,null,t]:[e,t]):(this.left=yf(this.left,e),this.right=yf(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:l}=this,c=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<=c+l.length&&i.more?u=l=l.updateHeight(e,c,r,i):l.updateHeight(e,c,r),u?this.balanced(s,l):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function b1(n,e){let t,r;n[e]==null&&(t=n[e-1])instanceof Zt&&(r=n[e+1])instanceof Zt&&n.splice(e-1,3,new Zt(t.length+1+r.length))}const $5=5;class qg{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 l=t-e;r.block?this.addBlock(new yS(l,i,r)):(l||s||i>=$5)&&this.addLineDeco(i,s,l)}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 Zt(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 qg(r,e);return ze.spans(t,r,i,s,0),s.finish(r)}}function U5(n,e,t){let r=new q5;return ze.compare(n,e,t,r,0),r.changes}class q5{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,i){(e<t||r&&r.heightRelevant||i&&i.heightRelevant)&&Oo(e,t,this.changes,5)}}function K5(n,e){let t=n.getBoundingClientRect(),r=n.ownerDocument,i=r.defaultView||window,s=Math.max(0,t.left),l=Math.min(i.innerWidth,t.right),c=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,m=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&m.overflow!="visible"){let g=d.getBoundingClientRect();s=Math.max(s,g.left),l=Math.min(l,g.right),c=Math.max(c,g.top),u=Math.min(h==n.parentNode?i.innerHeight:u,g.bottom)}h=m.position=="absolute"||m.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,l)-t.left,top:c-(t.top+e),bottom:Math.max(c,u)-(t.top+e)}}function Q5(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 Y5(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Rp{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 Ce.replace({widget:new G5(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class G5 extends Qr{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 S1{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=k1,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=st.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Hg).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new _5(t),this.stateDeco=e.facet(Ca).filter(r=>typeof r!="function"),this.heightMap=mn.empty().applyChanges(this.stateDeco,Ke.empty,this.heightOracle.setDoc(e.doc),[new nr(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ce.set(this.lineGaps.map(r=>r.draw(this,!1))),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:l})=>i>=s&&i<=l)){let{from:s,to:l}=this.lineBlockAt(i);e.push(new xu(s,l))}}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?k1:new Kg(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(ea(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Ca).filter(d=>typeof d!="function");let i=e.changedRanges,s=nr.extendWithRanges(i,U5(r,this.stateDeco,e?e.changes:Ft.empty(this.state.doc.length))),l=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);w1(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=l||Ho)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);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.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Qb)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,r=window.getComputedStyle(t),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?st.RTL:st.LTR;let l=this.heightOracle.mustRefreshForWrapping(s),c=t.getBoundingClientRect(),u=l||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,d=0;if(c.width&&c.height){let{scaleX:P,scaleY:N}=Ab(t,c);(P>.005&&Math.abs(this.scaleX-P)>.005||N>.005&&Math.abs(this.scaleY-N)>.005)&&(this.scaleX=P,this.scaleY=N,h|=16,l=u=!0)}let m=(parseInt(r.paddingTop)||0)*this.scaleY,g=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=m||this.paddingBottom!=g)&&(this.paddingTop=m,this.paddingBottom=g,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(u=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let y=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=y&&(this.scrollAnchorHeight=-1,this.scrollTop=y),this.scrolledToBottom=Db(e.scrollDOM);let x=(this.printing?Y5:K5)(t,this.paddingTop),b=x.top-this.pixelViewport.top,k=x.bottom-this.pixelViewport.bottom;this.pixelViewport=x;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&&!Q5(e.dom))return 0;let T=c.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),u){let P=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(P)&&(l=!0),l||i.lineWrapping&&Math.abs(T-this.contentDOMWidth)>i.charWidth){let{lineHeight:N,charWidth:I,textHeight:B}=e.docView.measureTextSize();l=N>0&&i.refresh(s,N,I,B,Math.max(5,T/I),P),l&&(e.docView.minWidth=0,h|=16)}b>0&&k>0?d=Math.max(b,k):b<0&&k<0&&(d=Math.min(b,k)),w1();for(let N of this.viewports){let I=N.from==this.viewport.from?P:e.docView.measureVisibleLineHeights(N);this.heightMap=(l?mn.empty().applyChanges(this.stateDeco,Ke.empty,this.heightOracle,[new nr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,l,new W5(N.from,I))}Ho&&(h|=2)}let O=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return O&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),h|=this.updateForViewport()),(h&2||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]: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:l,visibleBottom:c}=this,u=new xu(i.lineAt(l-r*1e3,lt.ByHeight,s,0,0).from,i.lineAt(c+(1-r)*1e3,lt.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),m=i.lineAt(h,lt.ByPos,s,0,0),g;t.y=="center"?g=(m.top+m.bottom)/2-d/2:t.y=="start"||t.y=="nearest"&&h<u.from?g=m.top:g=m.bottom-d,u=new xu(i.lineAt(g-1e3/2,lt.ByHeight,s,0,0).from,i.lineAt(g+d+1e3/2,lt.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 xu(this.heightMap.lineAt(r,lt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,lt.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,lt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,lt.ByPos,this.heightOracle,0,0),{visibleTop:l,visibleBottom:c}=this;return(e==0||i<=l-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=c+Math.max(10,Math.min(r,250)))&&i>l-2*1e3&&s<c+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 Rp(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,l=i<<1;if(this.defaultTextDirection!=st.LTR&&!r)return[];let c=[],u=(d,m,g,y)=>{if(m-d<s)return;let x=this.state.selection.main,b=[x.from];x.empty||b.push(x.to);for(let R of b)if(R>d&&R<m){u(d,R-10,g,y),u(R+10,m,g,y);return}let k=J5(e,R=>R.from>=g.from&&R.to<=g.to&&Math.abs(R.from-d)<s&&Math.abs(R.to-m)<s&&!b.some(T=>R.from<T&&R.to>T));if(!k){if(m<g.to&&t&&r&&t.visibleRanges.some(O=>O.from<=m&&O.to>=m)){let O=t.moveToLineBoundary(ee.cursor(m),!1,!0).head;O>d&&(m=O)}let R=this.gapSize(g,d,m,y),T=r||R<2e6?R:2e6;k=new Rp(d,m,R,T)}c.push(k)},h=d=>{if(d.length<l||d.type!=tn.Text)return;let m=X5(d.from,d.to,this.stateDeco);if(m.total<l)return;let g=this.scrollTarget?this.scrollTarget.range.head:null,y,x;if(r){let b=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,k,R;if(g!=null){let T=bu(m,g),O=((this.visibleBottom-this.visibleTop)/2+b)/d.height;k=T-O,R=T+O}else k=(this.visibleTop-d.top-b)/d.height,R=(this.visibleBottom-d.top+b)/d.height;y=wu(m,k),x=wu(m,R)}else{let b=m.total*this.heightOracle.charWidth,k=i*this.heightOracle.charWidth,R=0;if(b>2e6)for(let I of e)I.from>=d.from&&I.from<d.to&&I.size!=I.displaySize&&I.from*this.heightOracle.charWidth+R<this.pixelViewport.left&&(R=I.size-I.displaySize);let T=this.pixelViewport.left+R,O=this.pixelViewport.right+R,P,N;if(g!=null){let I=bu(m,g),B=((O-T)/2+k)/b;P=I-B,N=I+B}else P=(T-k)/b,N=(O+k)/b;y=wu(m,P),x=wu(m,N)}y>d.from&&u(d.from,y,d,m),x<d.to&&u(x,d.to,d,m)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(h):h(d);return c}gapSize(e,t,r,i){let s=bu(i,r)-bu(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){Rp.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ce.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=[];ze.spans(t,this.viewport.from,this.viewport.to,{span(s,l){r.push({from:s,to:l})},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 l=this.visibleRanges[s],c=r[s];(l.from!=c.from||l.to!=c.to)&&(i|=4,e&&e.mapPos(l.from,-1)==c.from&&e.mapPos(l.to,1)==c.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)||ea(this.heightMap.lineAt(e,lt.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)||ea(this.heightMap.lineAt(this.scaler.fromDOM(e),lt.ByHeight,this.heightOracle,0,0),this.scaler)}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 ea(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 xu{constructor(e,t){this.from=e,this.to=t}}function X5(n,e,t){let r=[],i=n,s=0;return ze.spans(t,n,e,{span(){},point(l,c){l>i&&(r.push({from:i,to:l}),s+=l-i),i=c}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function wu({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:l}=e[i],c=l-s;if(r<=c)return s+r;r-=c}}function bu(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 J5(n,e){for(let t of n)if(e(t))return t}const k1={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};class Kg{constructor(e,t,r){let i=0,s=0,l=0;this.viewports=r.map(({from:c,to:u})=>{let h=t.lineAt(c,lt.ByPos,e,0,0).top,d=t.lineAt(u,lt.ByPos,e,0,0).bottom;return i+=d-h,{from:c,to:u,top:h,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let c of this.viewports)c.domTop=l+(c.top-s)*this.scale,l=c.domBottom=c.domTop+(c.bottom-c.top),s=c.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 Kg?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 ea(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),r=e.toDOM(n.bottom);return new vr(n.from,n.length,t,r-t,Array.isArray(n._content)?n._content.map(i=>ea(i,e)):n._content)}const Su=ge.define({combine:n=>n.join(" ")}),jm=ge.define({combine:n=>n.indexOf(!0)>-1}),Fm=ss.newName(),vS=ss.newName(),xS=ss.newName(),wS={"&light":"."+vS,"&dark":"."+xS};function zm(n,e,t){return new ss(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 Z5=zm("."+Fm,{"&":{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-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"}},wS),e8={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Tp=me.ie&&me.ie_version<=11;class t8{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new LA,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);(me.ie&&me.ie_version<=11||me.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&&me.android&&e.constructor.EDIT_CONTEXT!==!1&&!(me.chrome&&me.chrome_version<126)&&(this.editContext=new r8(e),e.state.facet(fi)&&(e.contentDOM.editContext=this.editContext.editContext)),Tp&&(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(fi)?r.root.activeElement!=this.dom:!qu(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}(me.ie&&me.ie_version<=11||me.android&&me.chrome)&&!r.state.selection.main.empty&&i.focusNode&&ca(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ba(e.root);if(!t)return!1;let r=me.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&n8(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let i=qu(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&NA(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,e8),Tp&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Tp&&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&&Po(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 l=this.readMutation(s);l&&(l.typeOver&&(i=!0),t==-1?{from:t,to:r}=l:(t=Math.min(l.from,t),r=Math.max(l.to,r)))}return{from:t,to:r,typeOver:i}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),i=this.selectionChanged&&qu(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 w5(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=lS(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.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=C1(t,e.previousSibling||e.target.previousSibling,-1),i=C1(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(fi)!=e.state.facet(fi)&&(e.view.contentDOM.editContext=e.state.facet(fi)?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 C1(n,e,t){for(;e;){let r=Ht.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 E1(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,l=n.docView.domAtPos(n.state.selection.main.anchor,1);return ca(l.node,l.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function n8(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return E1(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?E1(n,t):null}class r8{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:l}=i,c=this.toEditorPos(r.updateRangeStart),u=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:c,drifted:!1});let h=u-c>r.text.length;c==this.from&&s<this.from?c=s:u==this.to&&s>this.to&&(u=s);let d=aS(e.state.sliceDoc(c,u),r.text,(h?i.from:i.to)-c,h?"end":null);if(!d){let g=ee.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));g.main.eq(i)||e.dispatch({selection:g,userEvent:"select"});return}let m={from:d.from+c,to:d.toA+c,insert:Ke.of(r.text.slice(d.from,d.toB).split(`
|
|
141
|
+
`))};if((me.mac||me.android)&&m.from==l-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(m={from:c,to:u,insert:Ke.of([r.text.replace("."," ")])}),this.pendingContextChange=m,!e.state.readOnly){let g=this.to-this.from+(m.to-m.from+m.insert.length);Ug(e,m,ee.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),m.from<m.to&&!m.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 l=this.toEditorPos(r.rangeStart),c=this.toEditorPos(r.rangeEnd);l<c;l++){let u=e.coordsForChar(l);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 l=s.underlineStyle,c=s.underlineThickness;if(!/none/i.test(l)&&!/none/i.test(c)){let u=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(u<h){let d=`text-decoration: underline ${/^[a-z]/.test(l)?l+" ":l=="Dashed"?"dashed ":l=="Squiggle"?"wavy ":""}${/thin/i.test(c)?1:2}px`;i.push(Ce.mark({attributes:{style:d}}).range(u,h))}}}e.dispatch({effects:Gb.of(Ce.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=ba(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,l,c,u,h)=>{if(r)return;let d=h.length-(l-s);if(i&&l>=i.to)if(i.from==s&&i.to==l&&i.insert.eq(h)){i=this.pendingContextChange=null,t+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=t,l+=t,l<=this.from)this.from+=d,this.to+=d;else if(s<this.to){if(s<this.from||l>this.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(l),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||DA(e.parent)||document,this.viewState=new S1(e.state||We.create(e)),e.scrollTo&&e.scrollTo.is(gu)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(So).map(i=>new bp(i));for(let i of this.plugins)i.update(this);this.observer=new t8(this),this.inputState=new C5(this),this.inputState.ensureHandlers(this.plugins),this.docView=new a1(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof Vt?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 l=this.hasFocus,c=0,u=null;e.some(g=>g.annotation(pS))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,u=mS(s,l),u||(c=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(We.phrases)!=this.state.facet(We.phrases))return this.setState(s);i=pf.create(this,s,e),i.flags|=c;let m=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(m&&(m=m.map(g.changes)),g.scrollIntoView){let{main:y}=g.state.selection;m=new Ao(y.empty?y:ee.cursor(y.head,y.head>y.anchor?-1:1))}for(let y of g.effects)y.is(gu)&&(m=y.value.clip(this.state))}this.viewState.update(i,m),this.bidiCache=vf.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(Jl)!=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(Su)!=i.state.facet(Su)&&(this.viewState.mustMeasureContent=!0),(t||r||m||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let g of this.state.facet(Lm))try{g(i)}catch(y){On(this.state,y,"update listener")}(u||d)&&Promise.resolve().then(()=>{u&&this.state==u.startState&&this.dispatch(u),d&&!lS(this,d)&&h.force&&Po(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 S1(e),this.plugins=e.facet(So).map(r=>new bp(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new a1(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(So),r=e.state.facet(So);if(t!=r){let i=[];for(let s of r){let l=t.indexOf(s);if(l<0)i.push(new bp(s));else{let c=this.plugins[l];c.mustUpdate=e,i.push(c)}}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){On(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.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:l}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(l<0)if(Db(r))s=-1,l=this.viewState.heightMap.height;else{let y=this.viewState.scrollAnchorAt(i);s=y.from,l=y.top}this.updateState=1;let u=this.viewState.measure(this);if(!u&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>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(y=>{try{return y.read(this)}catch(x){return On(this.state,x),R1}}),m=pf.create(this,this.state,[]),g=!1;m.flags|=u,t?t.flags|=u:t=m,this.updateState=2,m.empty||(this.updatePlugins(m),this.inputState.update(m),this.updateAttrs(),g=this.docView.update(m),g&&this.docViewUpdate());for(let y=0;y<h.length;y++)if(d[y]!=R1)try{let x=h[y];x.write&&x.write(d[y],this)}catch(x){On(this.state,x)}if(g&&this.docView.updateSelection(!0),!m.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,l=-1;continue}else{let x=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-l;if(x>1||x<-1){i=i+x,r.scrollTop=i/this.scaleY,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let c of this.state.facet(Lm))c(t)}get themeClasses(){return Fm+" "+(this.state.facet(jm)?xS:vS)+" "+this.state.facet(Su)}updateAttrs(){let e=T1(this,Xb,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(fi)?"true":"false",class:"cm-content",style:`${me.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),T1(this,Hg,t);let r=this.observer.ignore(()=>{let i=n1(this.contentDOM,this.contentAttrs,t),s=n1(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(Jl);let e=this.state.facet(de.cspNonce);ss.mount(this.root,this.styleModules.concat(Z5).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 Ep(this,e,c1(this,e,t,r))}moveByGroup(e,t){return Ep(this,e,c1(this,e,t,r=>m5(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 ee.cursor(s.side(t,i)+e.from,s.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,r=!0){return p5(this,e,t,r)}moveVertically(e,t,r){return Ep(this,e,g5(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=Im(this,e,t);return r&&r.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Im(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),l=s[hi.find(s,e-i.from,-1,t)];return Sa(r,l.dir==st.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(Kb)||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>i8)return zb(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||Fb(s.isolates,r=s1(this,e))))return s.order;r||(r=s1(this,e));let i=WA(e.text,t,r);return this.bidiCache.push(new vf(e.from,e.to,t,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||me.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Lb(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={}){return gu.of(new Ao(typeof e=="number"?ee.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return gu.of(new Ao(ee.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=ss.newName(),i=[Su.of(r),Jl.of(zm(`.${r}`,e))];return t&&t.dark&&i.push(jm.of(!0)),i}static baseTheme(e){return fs.lowest(Jl.of(zm("."+Fm,e,wS)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),i=r&&Ht.get(r)||Ht.get(e);return((t=i==null?void 0:i.root)===null||t===void 0?void 0:t.view)||null}}de.styleModule=Jl;de.inputHandler=Ub;de.clipboardInputFilter=Wg;de.clipboardOutputFilter=Vg;de.scrollHandler=Yb;de.focusChangeEffect=qb;de.perLineTextDirection=Kb;de.exceptionSink=$b;de.updateListener=Lm;de.editable=fi;de.mouseSelectionStyle=Hb;de.dragMovesSelection=Vb;de.clickAddsSelectionRange=Wb;de.decorations=Ca;de.blockWrappers=Jb;de.outerDecorations=Zb;de.atomicRanges=Ka;de.bidiIsolatedRanges=eS;de.scrollMargins=tS;de.darkTheme=jm;de.cspNonce=ge.define({combine:n=>n.length?n[0]:""});de.contentAttributes=Hg;de.editorAttributes=Xb;de.lineWrapping=de.contentAttributes.of({class:"cm-lineWrapping"});de.announce=Ie.define();const i8=4096,R1={};class vf{constructor(e,t,r,i,s,l){this.from=e,this.to=t,this.dir=r,this.isolates=i,this.fresh=s,this.order=l}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:st.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let l=e[s];l.dir==i&&!t.touchesRange(l.from,l.to)&&r.push(new vf(t.mapPos(l.from,1),t.mapPos(l.to,-1),l.dir,l.isolates,!1,l.order))}return r}}function T1(n,e,t){for(let r=n.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],l=typeof s=="function"?s(n):s;l&&Fg(l,t)}return t}const s8=me.mac?"mac":me.windows?"win":me.linux?"linux":"key";function o8(n,e){const t=n.split(/-(?!$)/);let r=t[t.length-1];r=="Space"&&(r=" ");let i,s,l,c;for(let u=0;u<t.length-1;++u){const h=t[u];if(/^(cmd|meta|m)$/i.test(h))c=!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))l=!0;else if(/^mod$/i.test(h))e=="mac"?c=!0:s=!0;else throw new Error("Unrecognized modifier name: "+h)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),c&&(r="Meta-"+r),l&&(r="Shift-"+r),r}function ku(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 l8=fs.default(de.domEventHandlers({keydown(n,e){return SS(bS(e.state),n,e,"editor")}})),Ea=ge.define({enables:l8}),M1=new WeakMap;function bS(n){let e=n.facet(Ea),t=M1.get(e);return t||M1.set(e,t=u8(e.reduce((r,i)=>r.concat(i),[]))),t}function a8(n,e,t){return SS(bS(n.state),e,n,t)}let Gi=null;const c8=4e3;function u8(n,e=s8){let t=Object.create(null),r=Object.create(null),i=(l,c)=>{let u=r[l];if(u==null)r[l]=c;else if(u!=c)throw new Error("Key binding "+l+" is used both as a regular binding and as a multi-stroke prefix")},s=(l,c,u,h,d)=>{var m,g;let y=t[l]||(t[l]=Object.create(null)),x=c.split(/ (?!$)/).map(R=>o8(R,e));for(let R=1;R<x.length;R++){let T=x.slice(0,R).join(" ");i(T,!0),y[T]||(y[T]={preventDefault:!0,stopPropagation:!1,run:[O=>{let P=Gi={view:O,prefix:T,scope:l};return setTimeout(()=>{Gi==P&&(Gi=null)},c8),!0}]})}let b=x.join(" ");i(b,!1);let k=y[b]||(y[b]={preventDefault:!1,stopPropagation:!1,run:((g=(m=y._any)===null||m===void 0?void 0:m.run)===null||g===void 0?void 0:g.slice())||[]});u&&k.run.push(u),h&&(k.preventDefault=!0),d&&(k.stopPropagation=!0)};for(let l of n){let c=l.scope?l.scope.split(" "):["editor"];if(l.any)for(let h of c){let d=t[h]||(t[h]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:m}=l;for(let g in d)d[g].run.push(y=>m(y,_m))}let u=l[e]||l.key;if(u)for(let h of c)s(h,u,l.run,l.preventDefault,l.stopPropagation),l.shift&&s(h,"Shift-"+u,l.shift,l.preventDefault,l.stopPropagation)}return t}let _m=null;function SS(n,e,t,r){_m=e;let i=CA(e),s=Rn(i,0),l=zr(s)==i.length&&i!=" ",c="",u=!1,h=!1,d=!1;Gi&&Gi.view==t&&Gi.scope==r&&(c=Gi.prefix+" ",uS.indexOf(e.keyCode)<0&&(h=!0,Gi=null));let m=new Set,g=k=>{if(k){for(let R of k.run)if(!m.has(R)&&(m.add(R),R(t)))return k.stopPropagation&&(d=!0),!0;k.preventDefault&&(k.stopPropagation&&(d=!0),h=!0)}return!1},y=n[r],x,b;return y&&(g(y[c+ku(i,e,!l)])?u=!0:l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(me.windows&&e.ctrlKey&&e.altKey)&&!(me.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(x=os[e.keyCode])&&x!=i?(g(y[c+ku(x,e,!0)])||e.shiftKey&&(b=xa[e.keyCode])!=i&&b!=x&&g(y[c+ku(b,e,!1)]))&&(u=!0):l&&e.shiftKey&&g(y[c+ku(i,e,!0)])&&(u=!0),!u&&g(y._any)&&(u=!0)),h&&(u=!0),u&&d&&e.stopPropagation(),_m=null,u}class Qa{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=kS(e);return[new Qa(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return f8(e,t,r)}}function kS(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==st.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function O1(n,e,t,r){let i=n.coordsAtPos(e,t*2);if(!i)return r;let s=n.dom.getBoundingClientRect(),l=(i.top+i.bottom)/2,c=n.posAtCoords({x:s.left+1,y:l}),u=n.posAtCoords({x:s.right-1,y:l});return c==null||u==null?r:{from:Math.max(r.from,Math.min(c,u)),to:Math.min(r.to,Math.max(c,u))}}function f8(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==st.LTR,l=n.contentDOM,c=l.getBoundingClientRect(),u=kS(n),h=l.querySelector(".cm-line"),d=h&&window.getComputedStyle(h),m=c.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),g=c.right-(d?parseInt(d.paddingRight):0),y=Nm(n,r,1),x=Nm(n,i,-1),b=y.type==tn.Text?y:null,k=x.type==tn.Text?x:null;if(b&&(n.lineWrapping||y.widgetLineBreaks)&&(b=O1(n,r,1,b)),k&&(n.lineWrapping||x.widgetLineBreaks)&&(k=O1(n,i,-1,k)),b&&k&&b.from==k.from&&b.to==k.to)return T(O(t.from,t.to,b));{let N=b?O(t.from,null,b):P(y,!1),I=k?O(null,t.to,k):P(x,!0),B=[];return(b||y).to<(k||x).from-(b&&k?1:0)||y.widgetLineBreaks>1&&N.bottom+n.defaultLineHeight/2<I.top?B.push(R(m,N.bottom,g,I.top)):N.bottom<I.top&&n.elementAtHeight((N.bottom+I.top)/2).type==tn.Text&&(N.bottom=I.top=(N.bottom+I.top)/2),T(N).concat(B).concat(T(I))}function R(N,I,B,W){return new Qa(e,N-u.left,I-u.top,B-N,W-I)}function T({top:N,bottom:I,horizontal:B}){let W=[];for(let Z=0;Z<B.length;Z+=2)W.push(R(B[Z],N,B[Z+1],I));return W}function O(N,I,B){let W=1e9,Z=-1e9,X=[];function Q(Y,J,q,H,A){let D=n.coordsAtPos(Y,Y==B.to?-2:2),z=n.coordsAtPos(q,q==B.from?2:-2);!D||!z||(W=Math.min(D.top,z.top,W),Z=Math.max(D.bottom,z.bottom,Z),A==st.LTR?X.push(s&&J?m:D.left,s&&H?g:z.right):X.push(!s&&H?m:z.left,!s&&J?g:D.right))}let U=N??B.from,j=I??B.to;for(let Y of n.visibleRanges)if(Y.to>U&&Y.from<j)for(let J=Math.max(Y.from,U),q=Math.min(Y.to,j);;){let H=n.state.doc.lineAt(J);for(let A of n.bidiSpans(H)){let D=A.from+H.from,z=A.to+H.from;if(D>=q)break;z>J&&Q(Math.max(D,J),N==null&&D<=U,Math.min(z,q),I==null&&z>=j,A.dir)}if(J=H.to+1,J>=q)break}return X.length==0&&Q(U,N==null,j,I==null,n.textDirection),{top:W,bottom:Z,horizontal:X}}function P(N,I){let B=c.top+(I?N.top:N.bottom);return{top:B,bottom:B,horizontal:[]}}}function h8(n,e){return n.constructor==e.constructor&&n.eq(e)}class d8{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(Qu)!=e.state.facet(Qu)&&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(Qu);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)=>!h8(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,me.safari&&me.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Qu=ge.define();function CS(n){return[Mt.define(e=>new d8(e,n)),Qu.of(n)]}const Ra=ge.define({combine(n){return Kr(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function p8(n={}){return[Ra.of(n),m8,g8,y8,Qb.of(!0)]}function ES(n){return n.startState.facet(Ra)!=n.state.facet(Ra)}const m8=CS({above:!0,markers(n){let{state:e}=n,t=e.facet(Ra),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||t.drawRangeCursor){let l=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=i.empty?i:ee.cursor(i.head,i.head>i.anchor?-1:1);for(let u of Qa.forRange(n,l,c))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=ES(n);return t&&P1(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){P1(e.state,n)},class:"cm-cursorLayer"});function P1(n,e){e.style.animationDuration=n.facet(Ra).cursorBlinkRate+"ms"}const g8=CS({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:Qa.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||ES(n)},class:"cm-selectionLayer"}),y8=fs.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"}}}})),RS=Ie.define({map(n,e){return n==null?null:e.mapPos(n)}}),ta=nn.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,r)=>r.is(RS)?r.value:t,n)}}),v8=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(ta);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(ta)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(ta),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(ta)!=n&&this.view.dispatch({effects:RS.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 x8(){return[ta,v8]}function A1(n,e,t,r,i){e.lastIndex=0;for(let s=n.iterRange(t,r),l=t,c;!s.next().done;l+=s.value.length)if(!s.lineBreak)for(;c=e.exec(s.value);)i(l+c.index,c)}function w8(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 b8{constructor(e){const{regexp:t,decoration:r,decorate:i,boundary:s,maxLength:l=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=(c,u,h,d)=>i(d,h,h+c[0].length,c,u);else if(typeof r=="function")this.addMatch=(c,u,h,d)=>{let m=r(c,u,h);m&&d(h,h+c[0].length,m)};else if(r)this.addMatch=(c,u,h,d)=>d(h,h+c[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=l}createDeco(e){let t=new xi,r=t.add.bind(t);for(let{from:i,to:s}of w8(e,this.maxLength))A1(e.state.doc,this.regexp,i,s,(l,c)=>this.addMatch(c,e,l,r));return t.finish()}updateDeco(e,t){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,l,c,u)=>{u>=e.view.viewport.from&&c<=e.view.viewport.to&&(r=Math.min(c,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 l=Math.max(s.from,r),c=Math.min(s.to,i);if(c>=l){let u=e.state.doc.lineAt(l),h=u.to<c?e.state.doc.lineAt(c):u,d=Math.max(s.from,u.from),m=Math.min(s.to,h.to);if(this.boundary){for(;l>u.from;l--)if(this.boundary.test(u.text[l-1-u.from])){d=l;break}for(;c<h.to;c++)if(this.boundary.test(h.text[c-h.from])){m=c;break}}let g=[],y,x=(b,k,R)=>g.push(R.range(b,k));if(u==h)for(this.regexp.lastIndex=d-u.from;(y=this.regexp.exec(u.text))&&y.index<m-u.from;)this.addMatch(y,e,y.index+u.from,x);else A1(e.state.doc,this.regexp,d,m,(b,k)=>this.addMatch(k,e,b,x));t=t.update({filterFrom:d,filterTo:m,filter:(b,k)=>b<d||k>m,add:g})}}return t}}const Wm=/x/.unicode!=null?"gu":"g",S8=new RegExp(`[\0-\b
|
|
142
|
+
--\u2028\u2029\uFEFF-]`,Wm),k8={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 Mp=null;function C8(){var n;if(Mp==null&&typeof document<"u"&&document.body){let e=document.body.style;Mp=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Mp||!1}const Yu=ge.define({combine(n){let e=Kr(n,{render:null,specialChars:S8,addSpecialChars:null});return(e.replaceTabs=!C8())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Wm)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Wm)),e}});function E8(n={}){return[Yu.of(n),R8()]}let L1=null;function R8(){return L1||(L1=Mt.fromClass(class{constructor(n){this.view=n,this.decorations=Ce.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Yu)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new b8({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=Rn(e[0],0);if(s==9){let l=i.lineAt(r),c=t.state.tabSize,u=el(l.text,c,r-l.from);return Ce.replace({widget:new P8((c-u%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Ce.replace({widget:new O8(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Yu);n.startState.facet(Yu)!=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 T8="•";function M8(n){return n>=32?T8:n==10?"":String.fromCharCode(9216+n)}class O8 extends Qr{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=M8(this.code),r=e.state.phrase("Control character")+" "+(k8[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 P8 extends Qr{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 A8(){return D8}const L8=Ce.line({class:"cm-activeLine"}),D8=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(L8.range(i.from)),e=i.from)}return Ce.set(t)}},{decorations:n=>n.decorations});class N8 extends Qr{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?aa(e.firstChild):[];if(!t.length)return null;let r=window.getComputedStyle(e.parentNode),i=Sa(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 I8(n){let e=Mt.fromClass(class{constructor(t){this.view=t,this.placeholder=n?Ce.set([Ce.widget({widget:new N8(n),side:1}).range(0)]):Ce.none}get decorations(){return this.view.state.doc.length?Ce.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,de.contentAttributes.of({"aria-placeholder":n})]:e}const Vm=2e3;function B8(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>Vm||t.off>Vm||e.col<0||t.col<0){let l=Math.min(e.off,t.off),c=Math.max(e.off,t.off);for(let u=r;u<=i;u++){let h=n.doc.line(u);h.length<=c&&s.push(ee.range(h.from+l,h.to+c))}}else{let l=Math.min(e.col,t.col),c=Math.max(e.col,t.col);for(let u=r;u<=i;u++){let h=n.doc.line(u),d=bm(h.text,l,n.tabSize,!0);if(d<0)s.push(ee.cursor(h.to));else{let m=bm(h.text,c,n.tabSize);s.push(ee.range(h.from+d,h.from+m))}}}return s}function j8(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function D1(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>Vm?-1:i==r.length?j8(n,e.clientX):el(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function F8(n,e){let t=D1(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),l=i.state.doc.lineAt(s);t={line:l.number,col:t.col,off:Math.min(t.off,l.length)},r=r.map(i.changes)}},get(i,s,l){let c=D1(n,i);if(!c)return r;let u=B8(n.state,t,c);return u.length?l?ee.create(u.concat(r.ranges)):ee.create(u):r}}:null}function z8(n){let e=t=>t.altKey&&t.button==0;return de.mouseSelectionStyle.of((t,r)=>e(r)?F8(t,r):null)}const _8={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},W8={style:"cursor: crosshair"};function V8(n={}){let[e,t]=_8[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?W8:null})]}const Cu="-10000px";class TS{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(l=>l);let s=null;this.tooltipViews=this.tooltips.map(l=>s=r(l,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 l=[],c=t?[]:null;for(let u=0;u<s.length;u++){let h=s[u],d=-1;if(h){for(let m=0;m<this.tooltips.length;m++){let g=this.tooltips[m];g&&g.create==h.create&&(d=m)}if(d<0)l[u]=this.createTooltipView(h,u?l[u-1]:null),c&&(c[u]=!!h.above);else{let m=l[u]=this.tooltipViews[d];c&&(c[u]=t[d]),m.update&&m.update(e)}}}for(let u of this.tooltipViews)l.indexOf(u)<0&&(this.removeTooltipView(u),(r=u.destroy)===null||r===void 0||r.call(u));return t&&(c.forEach((u,h)=>t[h]=u),t.length=c.length),this.input=i,this.tooltips=s,this.tooltipViews=l,!0}}function H8(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Op=ge.define({combine:n=>{var e,t,r;return{position:me.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)||H8}}}),N1=new WeakMap,Qg=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(Op);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 TS(n,Yg,(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(Op);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=Cu,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(me.safari){let l=s.getBoundingClientRect();t=Math.abs(l.top+1e4)>1||Math.abs(l.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=$g(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,l)=>{let c=this.manager.tooltipViews[l];return c.getCoords?c.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(Op).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:t,space:r,scaleX:i,scaleY:s}=n,l=[];for(let c=0;c<this.manager.tooltips.length;c++){let u=this.manager.tooltips[c],h=this.manager.tooltipViews[c],{dom:d}=h,m=n.pos[c],g=n.size[c];if(!m||u.clip!==!1&&(m.bottom<=Math.max(t.top,r.top)||m.top>=Math.min(t.bottom,r.bottom)||m.right<Math.max(t.left,r.left)-.1||m.left>Math.min(t.right,r.right)+.1)){d.style.top=Cu;continue}let y=u.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,x=y?7:0,b=g.right-g.left,k=(e=N1.get(h))!==null&&e!==void 0?e:g.bottom-g.top,R=h.offset||U8,T=this.view.textDirection==st.LTR,O=g.width>r.right-r.left?T?r.left:r.right-g.width:T?Math.max(r.left,Math.min(m.left-(y?14:0)+R.x,r.right-b)):Math.min(Math.max(r.left,m.left-b+(y?14:0)-R.x),r.right-b),P=this.above[c];!u.strictSide&&(P?m.top-k-x-R.y<r.top:m.bottom+k+x+R.y>r.bottom)&&P==r.bottom-m.bottom>m.top-r.top&&(P=this.above[c]=!P);let N=(P?m.top-r.top:r.bottom-m.bottom)-x;if(N<k&&h.resize!==!1){if(N<this.view.defaultLineHeight){d.style.top=Cu;continue}N1.set(h,k),d.style.height=(k=N)/s+"px"}else d.style.height&&(d.style.height="");let I=P?m.top-k-x-R.y:m.bottom+x+R.y,B=O+b;if(h.overlap!==!0)for(let W of l)W.left<B&&W.right>O&&W.top<I+k&&W.bottom>I&&(I=P?W.top-k-2-x:W.bottom+x+2);if(this.position=="absolute"?(d.style.top=(I-n.parent.top)/s+"px",I1(d,(O-n.parent.left)/i)):(d.style.top=I/s+"px",I1(d,O/i)),y){let W=m.left+(T?R.x:-R.x)-(O+14-7);y.style.left=W/i+"px"}h.overlap!==!0&&l.push({left:O,top:I,right:B,bottom:I+k}),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=Cu}},{eventObservers:{scroll(){this.maybeMeasure()}}});function I1(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const $8=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:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),U8={x:0,y:0},Yg=ge.define({enables:[Qg,$8]}),xf=ge.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class lh{static create(e){return new lh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new TS(e,xf,(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 q8=Yg.compute([xf],n=>{let e=n.facet(xf);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:lh.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class K8{constructor(e,t,r,i,s){this.view=e,this.source=t,this.field=r,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove: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 c=e.coordsAtPos(i);if(!c||t.y<c.top||t.y>c.bottom||t.x<c.left-e.defaultCharacterWidth||t.x>c.right+e.defaultCharacterWidth)return;let u=e.bidiSpans(e.state.doc.lineAt(i)).find(d=>d.from<=i&&d.to>=i),h=u&&u.dir==st.RTL?-1:1;s=t.x<c.left?-h:h}let l=this.source(e,i,s);if(l!=null&&l.then){let c=this.pending={pos:i};l.then(u=>{this.pending==c&&(this.pending=null,u&&!(Array.isArray(u)&&!u.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(u)?u:[u])}))},u=>On(e.state,u,"hover tooltip"))}else l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])})}get tooltip(){let e=this.view.plugin(Qg),t=e?e.manager.tooltips.findIndex(r=>r.create==lh.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&&s&&!Q8(s.dom,e)||this.pending){let{pos:l}=i[0]||this.pending,c=(r=(t=i[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:l;(l==c?this.view.posAtCoords(this.lastMove)!=l:!Y8(this.view,l,c,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){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),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Eu=4;function Q8(n,e){let{left:t,right:r,top:i,bottom:s}=n.getBoundingClientRect(),l;if(l=n.querySelector(".cm-tooltip-arrow")){let c=l.getBoundingClientRect();i=Math.min(c.top,i),s=Math.max(c.bottom,s)}return e.clientX>=t-Eu&&e.clientX<=r+Eu&&e.clientY>=i-Eu&&e.clientY<=s+Eu}function Y8(n,e,t,r,i,s){let l=n.scrollDOM.getBoundingClientRect(),c=n.documentTop+n.documentPadding.top+n.contentHeight;if(l.left>r||l.right<r||l.top>i||Math.min(l.bottom,c)<i)return!1;let u=n.posAtCoords({x:r,y:i},!1);return u>=e&&u<=t}function G8(n,e={}){let t=Ie.define(),r=nn.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(l=>!e.hideOn(s,l))),s.docChanged)){let l=[];for(let c of i){let u=s.changes.mapPos(c.pos,-1,pn.TrackDel);if(u!=null){let h=Object.assign(Object.create(null),c);h.pos=u,h.end!=null&&(h.end=s.changes.mapPos(h.end)),l.push(h)}}i=l}for(let l of s.effects)l.is(t)&&(i=l.value),l.is(X8)&&(i=[]);return i},provide:i=>xf.from(i)});return{active:r,extension:[r,Mt.define(i=>new K8(i,n,r,t,e.hoverTime||300)),q8]}}function MS(n,e){let t=n.plugin(Qg);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}const X8=Ie.define(),B1=ge.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 Ta(n,e){let t=n.plugin(OS),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}const OS=Mt.fromClass(class{constructor(n){this.input=n.state.facet(Ma),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(B1);this.top=new Ru(n,!0,e.topContainer),this.bottom=new Ru(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(B1);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ru(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ru(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Ma);if(t!=this.input){let r=t.filter(u=>u),i=[],s=[],l=[],c=[];for(let u of r){let h=this.specs.indexOf(u),d;h<0?(d=u(n.view),c.push(d)):(d=this.panels[h],d.update&&d.update(n)),i.push(d),(d.top?s:l).push(d)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(l);for(let u of c)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 Ru{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=j1(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=j1(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 j1(n){let e=n.nextSibling;return n.remove(),e}const Ma=ge.define({enables:OS});class bi extends is{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}bi.prototype.elementClass="";bi.prototype.toDOM=void 0;bi.prototype.mapMode=pn.TrackBefore;bi.prototype.startSide=bi.prototype.endSide=-1;bi.prototype.point=!0;const Gu=ge.define(),J8=ge.define(),Z8={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ze.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},fa=ge.define();function eL(n){return[PS(),fa.of({...Z8,...n})]}const F1=ge.define({combine:n=>n.some(e=>e)});function PS(n){return[tL]}const tL=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(fa).map(e=>new _1(n,e)),this.fixed=!n.state.facet(F1);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(F1)!=!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=ze.iter(this.view.state.facet(Gu),this.view.viewport.from),r=[],i=this.gutters.map(s=>new nL(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let l=!0;for(let c of s.type)if(c.type==tn.Text&&l){Hm(t,r,c.from);for(let u of i)u.line(this.view,c,r);l=!1}else if(c.widget)for(let u of i)u.widget(this.view,c)}else if(s.type==tn.Text){Hm(t,r,s.from);for(let l of i)l.line(this.view,s,r)}else if(s.widget)for(let l of i)l.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(fa),t=n.state.facet(fa),r=n.docChanged||n.heightChanged||n.viewportChanged||!ze.eq(n.startState.facet(Gu),n.state.facet(Gu),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 l=e.indexOf(s);l<0?i.push(new _1(this.view,s)):(this.gutters[l].update(n),i.push(this.gutters[l]))}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==st.LTR?{left:r,right:i}:{right:r,left:i}})});function z1(n){return Array.isArray(n)?n:[n]}function Hm(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class nL{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=ze.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,l=t.height/e.scaleY;if(this.i==i.elements.length){let c=new AS(e,l,s,r);i.elements.push(c),i.dom.appendChild(c.dom)}else i.elements[this.i].update(e,l,s,r);this.height=t.bottom,this.i++}line(e,t,r){let i=[];Hm(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 l=this.gutter;i.length==0&&!l.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(J8)){let l=s(e,t.widget,t);l&&(i||(i=[])).push(l)}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 _1{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,l;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let u=s.getBoundingClientRect();l=(u.top+u.bottom)/2}else l=i.clientY;let c=e.lineBlockAtHeight(l-e.documentTop);t.domEventHandlers[r](e,c,i)&&i.preventDefault()});this.markers=z1(t.markers(e)),t.initialSpacer&&(this.spacer=new AS(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=z1(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!ze.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 AS{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":""),rL(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,l=0;;){let c=l,u=s<t.length?t[s++]:null,h=!1;if(u){let d=u.elementClass;d&&(r+=" "+d);for(let m=l;m<this.markers.length;m++)if(this.markers[m].compare(u)){c=m,h=!0;break}}else c=this.markers.length;for(;l<c;){let d=this.markers[l++];if(d.toDOM){d.destroy(i);let m=i.nextSibling;i.remove(),i=m}}if(!u)break;u.toDOM&&(h?i=i.nextSibling:this.dom.insertBefore(u.toDOM(e),i)),h&&l++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}}function rL(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 iL=ge.define(),sL=ge.define(),ko=ge.define({combine(n){return Kr(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let i in t){let s=r[i],l=t[i];r[i]=s?(c,u,h)=>s(c,u,h)||l(c,u,h):l}return r}})}});class Pp extends bi{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ap(n,e){return n.state.facet(ko).formatNumber(e,n.state)}const oL=fa.compute([ko],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(iL)},lineMarker(e,t,r){return r.some(i=>i.toDOM)?null:new Pp(Ap(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,r)=>{for(let i of e.state.facet(sL)){let s=i(e,t,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(ko)!=e.state.facet(ko),initialSpacer(e){return new Pp(Ap(e,W1(e.state.doc.lines)))},updateSpacer(e,t){let r=Ap(t.view,W1(t.view.state.doc.lines));return r==e.number?e:new Pp(r)},domEventHandlers:n.facet(ko).domEventHandlers,side:"before"}));function lL(n={}){return[ko.of(n),PS(),oL]}function W1(n){let e=9;for(;e<n;)e=e*10+9;return e}const aL=new class extends bi{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},cL=Gu.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(aL.range(i)))}return ze.of(e)});function uL(){return cL}const LS=1024;let fL=0;class Lp{constructor(e,t){this.from=e,this.to=t}}class je{constructor(e={}){this.id=fL++,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=Ln.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}je.closedBy=new je({deserialize:n=>n.split(" ")});je.openedBy=new je({deserialize:n=>n.split(" ")});je.group=new je({deserialize:n=>n.split(" ")});je.isolate=new je({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});je.contextHash=new je({perNode:!0});je.lookAhead=new je({perNode:!0});je.mounted=new je({perNode:!0});class ha{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[je.mounted.id]}}const hL=Object.create(null);class Ln{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):hL,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Ln(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(je.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(je.group),s=-1;s<(i?i.length:0);s++){let l=t[s<0?r.name:i[s]];if(l)return l}}}}Ln.none=new Ln("",Object.create(null),0,8);class Gg{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 l=s(r);if(l){i||(i=Object.assign({},r.props));let c=l[1],u=l[0];u.combine&&u.id in i&&(c=u.combine(i[u.id],c)),i[u.id]=c}}t.push(i?new Ln(r.name,i,r.id,r.flags):r)}return new Gg(t)}}const Tu=new WeakMap,V1=new WeakMap;var bt;(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"})(bt||(bt={}));class Tt{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[l,c]of s)this.props[typeof l=="number"?l:l.id]=c}}toString(){let e=ha.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 Um(this.topNode,e)}cursorAt(e,t=0,r=0){let i=Tu.get(this)||this.topNode,s=new Um(i);return s.moveTo(e,t),Tu.set(this,s._tree),s}get topNode(){return new sr(this,0,0,null)}resolve(e,t=0){let r=Oa(Tu.get(this)||this.topNode,e,t,!1);return Tu.set(this,r),r}resolveInner(e,t=0){let r=Oa(V1.get(this)||this.topNode,e,t,!0);return V1.set(this,r),r}resolveStack(e,t=0){return mL(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:s=this.length}=e,l=e.mode||0,c=(l&bt.IncludeAnonymous)>0;for(let u=this.cursor(l|bt.IncludeAnonymous);;){let h=!1;if(u.from<=s&&u.to>=i&&(!c&&u.type.isAnonymous||t(u)!==!1)){if(u.firstChild())continue;h=!0}for(;h&&r&&(c||!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:Zg(Ln.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new Tt(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new Tt(Ln.none,t,r,i)))}static build(e){return gL(e)}}Tt.empty=new Tt(Ln.none,[],[],0);class Xg{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 Xg(this.buffer,this.index)}}class as{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return Ln.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 l=[];for(;e<r;)l.push(this.childString(e)),e=this.buffer[e+3];return s+"("+l.join(",")+")"}findChild(e,t,r,i,s){let{buffer:l}=this,c=-1;for(let u=e;u!=t&&!(DS(s,i,l[u+1],l[u+2])&&(c=u,r>0));u=l[u+3]);return c}slice(e,t,r){let i=this.buffer,s=new Uint16Array(t-e),l=0;for(let c=e,u=0;c<t;){s[u++]=i[c++],s[u++]=i[c++]-r;let h=s[u++]=i[c++]-r;s[u++]=i[c++]-e,l=Math.max(l,h)}return new as(s,l,this.set)}}function DS(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 Oa(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 l=!r&&n instanceof sr&&n.index<0?null:n.parent;if(!l)return n;n=l}let s=r?0:bt.IgnoreOverlays;if(r)for(let l=n,c=l.parent;c;l=c,c=l.parent)l instanceof sr&&l.index<0&&((i=c.enter(e,t,s))===null||i===void 0?void 0:i.from)!=l.from&&(n=c);for(;;){let l=n.enter(e,t,s);if(!l)return n;n=l}}class NS{cursor(e=0){return new Um(this,e)}getChild(e,t=null,r=null){let i=H1(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return H1(this,e,t,r)}resolve(e,t=0){return Oa(this,e,t,!1)}resolveInner(e,t=0){return Oa(this,e,t,!0)}matchContext(e){return $m(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 sr extends NS{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){var l;for(let c=this;;){for(let{children:u,positions:h}=c._tree,d=t>0?u.length:-1;e!=d;e+=t){let m=u[e],g=h[e]+c.from;if(!(!(s&bt.EnterBracketed&&m instanceof Tt&&((l=ha.get(m))===null||l===void 0?void 0:l.overlay)===null&&(g>=r||g+m.length<=r))&&!DS(i,r,g,g+m.length))){if(m instanceof as){if(s&bt.ExcludeBuffers)continue;let y=m.findChild(0,m.buffer.length,t,r-g,i);if(y>-1)return new Zi(new dL(c,m,e,g),null,y)}else if(s&bt.IncludeAnonymous||!m.type.isAnonymous||Jg(m)){let y;if(!(s&bt.IgnoreMounts)&&(y=ha.get(m))&&!y.overlay)return new sr(y.tree,g,e,c);let x=new sr(m,g,e,c);return s&bt.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(t<0?m.children.length-1:0,t,r,i,s)}}}if(s&bt.IncludeAnonymous||!c.type.isAnonymous||(c.index>=0?e=c.index+t:e=t<0?-1:c._parent._tree.children.length,c=c._parent,!c))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&bt.IgnoreOverlays)&&(i=ha.get(this._tree))&&i.overlay){let s=e-this.from,l=r&bt.EnterBracketed&&i.bracketed;for(let{from:c,to:u}of i.overlay)if((t>0||l?c<=s:c<s)&&(t<0||l?u>=s:u>s))return new sr(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 H1(n,e,t,r){let i=n.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let l=!1;!l;)if(l=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 $m(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 dL{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class Zi extends NS{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 Zi(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&bt.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 Zi(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 Zi(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 Zi(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 l=r.buffer[this.index+1];e.push(r.slice(i,s,l)),t.push(0)}return new Tt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function IS(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let l=n[s];(l.from>t.from||l.to<t.to)&&(t=l,e=s)}let r=t instanceof sr&&t.index<0?null:t.parent,i=n.slice();return r?i[e]=r:i.splice(e,1),new pL(i,t)}class pL{constructor(e,t){this.heads=e,this.node=t}get next(){return IS(this.heads)}}function mL(n,e,t){let r=n.resolveInner(e,t),i=null;for(let s=r instanceof sr?r:r.context.parent;s;s=s.parent)if(s.index<0){let l=s.parent;(i||(i=[r])).push(l.resolve(e,t)),s=l}else{let l=ha.get(s.tree);if(l&&l.overlay&&l.overlay[0].from<=e&&l.overlay[l.overlay.length-1].to>=e){let c=new sr(l.tree,l.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Oa(c,e,t,!1))}}return i?IS(i):r}class Um{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&~bt.EnterBracketed,e instanceof sr)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 sr?(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&bt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&bt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&bt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer: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,l=e<0?-1:r._tree.children.length;s!=l;s+=e){let c=r._tree.children[s];if(this.mode&bt.IncludeAnonymous||c instanceof as||!c.type.isAnonymous||Jg(c))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 l=e;l;l=l._parent)if(l.index==i){if(i==this.index)return l;t=l,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)t=new Zi(this.buffer,t,this.stack[i]);return this.bufferNode=new Zi(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 $m(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 $m(this._tree,e,i);let l=r[t.buffer[this.stack[s]]];if(!l.isAnonymous){if(e[i]&&e[i]!=l.name)return!1;i--}}return!0}}function Jg(n){return n.children.some(e=>e instanceof as||!e.type.isAnonymous||Jg(e))}function gL(n){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=LS,reused:s=[],minRepeatType:l=r.types.length}=n,c=Array.isArray(t)?new Xg(t,t.length):t,u=r.types,h=0,d=0;function m(N,I,B,W,Z,X){let{id:Q,start:U,end:j,size:Y}=c,J=d,q=h;if(Y<0)if(c.next(),Y==-1){let M=s[Q];B.push(M),W.push(U-N);return}else if(Y==-3){h=Q;return}else if(Y==-4){d=Q;return}else throw new RangeError(`Unrecognized record size: ${Y}`);let H=u[Q],A,D,z=U-N;if(j-U<=i&&(D=k(c.pos-I,Z))){let M=new Uint16Array(D.size-D.skip),V=c.pos-D.size,oe=M.length;for(;c.pos>V;)oe=R(D.start,M,oe);A=new as(M,j-D.start,r),z=D.start-N}else{let M=c.pos-Y;c.next();let V=[],oe=[],ce=Q>=l?Q:-1,he=0,se=j;for(;c.pos>M;)ce>=0&&c.id==ce&&c.size>=0?(c.end<=se-i&&(x(V,oe,U,he,c.end,se,ce,J,q),he=V.length,se=c.end),c.next()):X>2500?g(U,M,V,oe):m(U,M,V,oe,ce,X+1);if(ce>=0&&he>0&&he<V.length&&x(V,oe,U,he,U,se,ce,J,q),V.reverse(),oe.reverse(),ce>-1&&he>0){let fe=y(H,q);A=Zg(H,V,oe,0,V.length,0,j-U,fe,fe)}else A=b(H,V,oe,j-U,J-j,q)}B.push(A),W.push(z)}function g(N,I,B,W){let Z=[],X=0,Q=-1;for(;c.pos>I;){let{id:U,start:j,end:Y,size:J}=c;if(J>4)c.next();else{if(Q>-1&&j<Q)break;Q<0&&(Q=Y-i),Z.push(U,j,Y),X++,c.next()}}if(X){let U=new Uint16Array(X*4),j=Z[Z.length-2];for(let Y=Z.length-3,J=0;Y>=0;Y-=3)U[J++]=Z[Y],U[J++]=Z[Y+1]-j,U[J++]=Z[Y+2]-j,U[J++]=J;B.push(new as(U,Z[2]-j,r)),W.push(j-N)}}function y(N,I){return(B,W,Z)=>{let X=0,Q=B.length-1,U,j;if(Q>=0&&(U=B[Q])instanceof Tt){if(!Q&&U.type==N&&U.length==Z)return U;(j=U.prop(je.lookAhead))&&(X=W[Q]+U.length+j)}return b(N,B,W,Z,X,I)}}function x(N,I,B,W,Z,X,Q,U,j){let Y=[],J=[];for(;N.length>W;)Y.push(N.pop()),J.push(I.pop()+B-Z);N.push(b(r.types[Q],Y,J,X-Z,U-X,j)),I.push(Z-B)}function b(N,I,B,W,Z,X,Q){if(X){let U=[je.contextHash,X];Q=Q?[U].concat(Q):[U]}if(Z>25){let U=[je.lookAhead,Z];Q=Q?[U].concat(Q):[U]}return new Tt(N,I,B,W,Q)}function k(N,I){let B=c.fork(),W=0,Z=0,X=0,Q=B.end-i,U={size:0,start:0,skip:0};e:for(let j=B.pos-N;B.pos>j;){let Y=B.size;if(B.id==I&&Y>=0){U.size=W,U.start=Z,U.skip=X,X+=4,W+=4,B.next();continue}let J=B.pos-Y;if(Y<0||J<j||B.start<Q)break;let q=B.id>=l?4:0,H=B.start;for(B.next();B.pos>J;){if(B.size<0)if(B.size==-3||B.size==-4)q+=4;else break e;else B.id>=l&&(q+=4);B.next()}Z=H,W+=Y,X+=q}return(I<0||W==N)&&(U.size=W,U.start=Z,U.skip=X),U.size>4?U:void 0}function R(N,I,B){let{id:W,start:Z,end:X,size:Q}=c;if(c.next(),Q>=0&&W<l){let U=B;if(Q>4){let j=c.pos-(Q-4);for(;c.pos>j;)B=R(N,I,B)}I[--B]=U,I[--B]=X-N,I[--B]=Z-N,I[--B]=W}else Q==-3?h=W:Q==-4&&(d=W);return B}let T=[],O=[];for(;c.pos>0;)m(n.start||0,n.bufferStart||0,T,O,-1,0);let P=(e=n.length)!==null&&e!==void 0?e:T.length?O[0]+T[0].length:0;return new Tt(u[n.topID],T.reverse(),O.reverse(),P)}const $1=new WeakMap;function Xu(n,e){if(!n.isAnonymous||e instanceof as||e.type!=n)return 1;let t=$1.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=n||!(r instanceof Tt)){t=1;break}t+=Xu(n,r)}$1.set(e,t)}return t}function Zg(n,e,t,r,i,s,l,c,u){let h=0;for(let x=r;x<i;x++)h+=Xu(n,e[x]);let d=Math.ceil(h*1.5/8),m=[],g=[];function y(x,b,k,R,T){for(let O=k;O<R;){let P=O,N=b[O],I=Xu(n,x[O]);for(O++;O<R;O++){let B=Xu(n,x[O]);if(I+B>=d)break;I+=B}if(O==P+1){if(I>d){let B=x[P];y(B.children,B.positions,0,B.children.length,b[P]+T);continue}m.push(x[P])}else{let B=b[O-1]+x[O-1].length-N;m.push(Zg(n,x,b,P,O,N,B,null,u))}g.push(N+T-s)}}return y(e,t,r,i,0),(c||u)(m,g,l)}class _s{constructor(e,t,r,i,s=!1,l=!1){this.from=e,this.to=t,this.tree=r,this.offset=i,this.open=(s?1:0)|(l?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 _s(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,l=e.length?e[0]:null;for(let c=0,u=0,h=0;;c++){let d=c<t.length?t[c]:null,m=d?d.fromA:1e9;if(m-u>=r)for(;l&&l.from<m;){let g=l;if(u>=g.from||m<=g.to||h){let y=Math.max(g.from,u)-h,x=Math.min(g.to,m)-h;g=y>=x?null:new _s(y,x,g.tree,g.offset+h,c>0,!!d)}if(g&&i.push(g),l.to>m)break;l=s<e.length?e[s++]:null}if(!d)break;u=d.toA,h=d.toA-d.toB}return i}}class BS{startParse(e,t,r){return typeof e=="string"&&(e=new yL(e)),r=r?r.length?r.map(i=>new Lp(i.from,i.to)):[new Lp(0,0)]:[new Lp(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 yL{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 je({perNode:!0});let vL=0;class er{constructor(e,t,r,i){this.name=e,this.set=t,this.base=r,this.modified=i,this.id=vL++}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 er&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let i=new er(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 wf(e);return r=>r.modified.indexOf(t)>-1?r:wf.get(r.base||r,r.modified.concat(t).sort((i,s)=>i.id-s.id))}}let xL=0;class wf{constructor(e){this.name=e,this.instances=[],this.id=xL++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(c=>c.base==e&&wL(t,c.modified));if(r)return r;let i=[],s=new er(e.name,i,e,t);for(let c of t)c.instances.push(s);let l=bL(t);for(let c of e.set)if(!c.modified.length)for(let u of l)i.push(wf.get(c,u));return s}}function wL(n,e){return n.length==e.length&&n.every((t,r)=>t==e[r])}function bL(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 jS(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=[],l=2,c=i;for(let m=0;;){if(c=="..."&&m>0&&m+3==i.length){l=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!g)throw new RangeError("Invalid path: "+i);if(s.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),m+=g[0].length,m==i.length)break;let y=i[m++];if(m==i.length&&y=="!"){l=0;break}if(y!="/")throw new RangeError("Invalid path: "+i);c=i.slice(m)}let u=s.length-1,h=s[u];if(!h)throw new RangeError("Invalid path: "+i);let d=new Pa(r,l,u>0?s.slice(0,u):null);e[h]=d.sort(e[h])}}return FS.add(e)}const FS=new je({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 Pa(i.tags,i.mode,i.context);t?t.next=s:r=s,t=s}return r}});class Pa{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}}Pa.empty=new Pa([],2,null);function zS(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 l of s.tag)t[l.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let l=i;for(let c of s)for(let u of c.set){let h=t[u.id];if(h){l=l?l+" "+h:h;break}}return l},scope:r}}function SL(n,e){let t=null;for(let r of n){let i=r.style(e);i&&(t=t?t+" "+i:i)}return t}function kL(n,e,t,r=0,i=n.length){let s=new CL(r,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),r,i,"",s.highlighters),s.flush(i)}class CL{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:l,from:c,to:u}=e;if(c>=r||u<=t)return;l.isTop&&(s=this.highlighters.filter(y=>!y.scope||y.scope(l)));let h=i,d=EL(e)||Pa.empty,m=SL(s,d.tags);if(m&&(h&&(h+=" "),h+=m,d.mode==1&&(i+=(i?" ":"")+m)),this.startSpan(Math.max(t,c),h),d.opaque)return;let g=e.tree&&e.tree.prop(je.mounted);if(g&&g.overlay){let y=e.node.enter(g.overlay[0].from+c,1),x=this.highlighters.filter(k=>!k.scope||k.scope(g.tree.type)),b=e.firstChild();for(let k=0,R=c;;k++){let T=k<g.overlay.length?g.overlay[k]:null,O=T?T.from+c:u,P=Math.max(t,R),N=Math.min(r,O);if(P<N&&b)for(;e.from<N&&(this.highlightRange(e,P,N,i,s),this.startSpan(Math.min(N,e.to),h),!(e.to>=O||!e.nextSibling())););if(!T||O>r)break;R=T.to+c,R>t&&(this.highlightRange(y.cursor(),Math.max(t,T.from+c),Math.min(r,R),"",x),this.startSpan(Math.min(r,R),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 EL(n){let e=n.type.prop(FS);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const ue=er.define,Mu=ue(),Qi=ue(),U1=ue(Qi),q1=ue(Qi),Yi=ue(),Ou=ue(Yi),Dp=ue(Yi),jr=ue(),Ms=ue(jr),Ir=ue(),Br=ue(),qm=ue(),Ql=ue(qm),Pu=ue(),ie={comment:Mu,lineComment:ue(Mu),blockComment:ue(Mu),docComment:ue(Mu),name:Qi,variableName:ue(Qi),typeName:U1,tagName:ue(U1),propertyName:q1,attributeName:ue(q1),className:ue(Qi),labelName:ue(Qi),namespace:ue(Qi),macroName:ue(Qi),literal:Yi,string:Ou,docString:ue(Ou),character:ue(Ou),attributeValue:ue(Ou),number:Dp,integer:ue(Dp),float:ue(Dp),bool:ue(Yi),regexp:ue(Yi),escape:ue(Yi),color:ue(Yi),url:ue(Yi),keyword:Ir,self:ue(Ir),null:ue(Ir),atom:ue(Ir),unit:ue(Ir),modifier:ue(Ir),operatorKeyword:ue(Ir),controlKeyword:ue(Ir),definitionKeyword:ue(Ir),moduleKeyword:ue(Ir),operator:Br,derefOperator:ue(Br),arithmeticOperator:ue(Br),logicOperator:ue(Br),bitwiseOperator:ue(Br),compareOperator:ue(Br),updateOperator:ue(Br),definitionOperator:ue(Br),typeOperator:ue(Br),controlOperator:ue(Br),punctuation:qm,separator:ue(qm),bracket:Ql,angleBracket:ue(Ql),squareBracket:ue(Ql),paren:ue(Ql),brace:ue(Ql),content:jr,heading:Ms,heading1:ue(Ms),heading2:ue(Ms),heading3:ue(Ms),heading4:ue(Ms),heading5:ue(Ms),heading6:ue(Ms),contentSeparator:ue(jr),list:ue(jr),quote:ue(jr),emphasis:ue(jr),strong:ue(jr),link:ue(jr),monospace:ue(jr),strikethrough:ue(jr),inserted:ue(),deleted:ue(),changed:ue(),invalid:ue(),meta:Pu,documentMeta:ue(Pu),annotation:ue(Pu),processingInstruction:ue(Pu),definition:er.defineModifier("definition"),constant:er.defineModifier("constant"),function:er.defineModifier("function"),standard:er.defineModifier("standard"),local:er.defineModifier("local"),special:er.defineModifier("special")};for(let n in ie){let e=ie[n];e instanceof er&&(e.name=n)}zS([{tag:ie.link,class:"tok-link"},{tag:ie.heading,class:"tok-heading"},{tag:ie.emphasis,class:"tok-emphasis"},{tag:ie.strong,class:"tok-strong"},{tag:ie.keyword,class:"tok-keyword"},{tag:ie.atom,class:"tok-atom"},{tag:ie.bool,class:"tok-bool"},{tag:ie.url,class:"tok-url"},{tag:ie.labelName,class:"tok-labelName"},{tag:ie.inserted,class:"tok-inserted"},{tag:ie.deleted,class:"tok-deleted"},{tag:ie.literal,class:"tok-literal"},{tag:ie.string,class:"tok-string"},{tag:ie.number,class:"tok-number"},{tag:[ie.regexp,ie.escape,ie.special(ie.string)],class:"tok-string2"},{tag:ie.variableName,class:"tok-variableName"},{tag:ie.local(ie.variableName),class:"tok-variableName tok-local"},{tag:ie.definition(ie.variableName),class:"tok-variableName tok-definition"},{tag:ie.special(ie.variableName),class:"tok-variableName2"},{tag:ie.definition(ie.propertyName),class:"tok-propertyName tok-definition"},{tag:ie.typeName,class:"tok-typeName"},{tag:ie.namespace,class:"tok-namespace"},{tag:ie.className,class:"tok-className"},{tag:ie.macroName,class:"tok-macroName"},{tag:ie.propertyName,class:"tok-propertyName"},{tag:ie.operator,class:"tok-operator"},{tag:ie.comment,class:"tok-comment"},{tag:ie.meta,class:"tok-meta"},{tag:ie.invalid,class:"tok-invalid"},{tag:ie.punctuation,class:"tok-punctuation"}]);var Np;const Co=new je;function RL(n){return ge.define({combine:n?e=>e.concat(n):void 0})}const TL=new je;class wr{constructor(e,t,r=[],i=""){this.data=e,this.name=i,We.prototype.hasOwnProperty("tree")||Object.defineProperty(We.prototype,"tree",{get(){return Gt(this)}}),this.parser=t,this.extension=[cs.of(this),We.languageData.of((s,l,c)=>{let u=K1(s,l,c),h=u.type.prop(Co);if(!h)return[];let d=s.facet(h),m=u.type.prop(TL);if(m){let g=u.resolve(l-u.from,c);for(let y of m)if(y.test(g,s)){let x=s.facet(y.facet);return y.type=="replace"?x:x.concat(d)}}return d})].concat(r)}isActiveAt(e,t,r=-1){return K1(e,t,r).type.prop(Co)==this.data}findRegions(e){let t=e.facet(cs);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,l)=>{if(s.prop(Co)==this.data){r.push({from:l,to:l+s.length});return}let c=s.prop(je.mounted);if(c){if(c.tree.prop(Co)==this.data){if(c.overlay)for(let u of c.overlay)r.push({from:u.from+l,to:u.to+l});else r.push({from:l,to:l+s.length});return}else if(c.overlay){let u=r.length;if(i(c.tree,c.overlay[0].from+l),r.length>u)return}}for(let u=0;u<s.children.length;u++){let h=s.children[u];h instanceof Tt&&i(h,s.positions[u]+l)}};return i(Gt(e),0),r}get allowsNesting(){return!0}}wr.setState=Ie.define();function K1(n,e,t){let r=n.facet(cs),i=Gt(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,bt.ExcludeBuffers|bt.EnterBracketed))s.type.isTop&&(i=s);return i}class bf extends wr{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=RL(e.languageData);return new bf(t,e.parser.configure({props:[Co.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new bf(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Gt(n){let e=n.field(wr.state,!1);return e?e.tree:Tt.empty}class ML{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 Yl=null;class Sf{constructor(e,t,r=[],i,s,l,c,u){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=l,this.skipped=c,this.scheduleOn=u,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new Sf(e,t,[],Tt.empty,0,r,[],null)}startParse(){return this.parser.startParse(new ML(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Tt.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(_s.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(_s.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Yl;Yl=this;try{return e()}finally{Yl=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Q1(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:l,skipped:c}=this;if(this.takeTree(),!e.empty){let u=[];if(e.iterChangedRanges((h,d,m,g)=>u.push({fromA:h,toA:d,fromB:m,toB:g})),r=_s.applyChanges(r,u),i=Tt.empty,s=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){c=[];for(let h of this.skipped){let d=e.mapPos(h.from,1),m=e.mapPos(h.to,-1);d<m&&c.push({from:d,to:m})}}}return new Sf(this.parser,t,r,i,s,l,c,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=Q1(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 BS{createParse(t,r,i){let s=i[0].from,l=i[i.length-1].to;return{parsedPos:s,advance(){let u=Yl;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=l,new Tt(Ln.none,[],[],l-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 Yl}}function Q1(n,e,t){return _s.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class $o{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 $o(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=Sf.create(e.facet(cs).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new $o(r)}}wr.state=nn.define({create:$o.init,update(n,e){for(let t of e.effects)if(t.is(wr.setState))return t.value;return e.startState.facet(cs)!=e.state.facet(cs)?$o.init(e.state):n.apply(e)}});let _S=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(_S=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Ip=typeof navigator<"u"&&(!((Np=navigator.scheduling)===null||Np===void 0)&&Np.isInputPending)?()=>navigator.scheduling.isInputPending():null,OL=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(wr.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(wr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=_S(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(wr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let l=Date.now()+Math.min(this.chunkBudget,100,e&&!Ip?Math.max(25,e.timeRemaining()-5):1e9),c=s.context.treeLen<i&&r.doc.length>i+1e3,u=s.context.work(()=>Ip&&Ip()||Date.now()>l,i+(c?0:1e5));this.chunkBudget-=Date.now()-t,(u||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:wr.setState.of(new $o(s.context))})),this.chunkBudget>0&&!(u&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>On(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()}}}),cs=ge.define({combine(n){return n.length?n[0]:null},enables:n=>[wr.state,OL,de.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class PL{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const AL=ge.define(),e0=ge.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 kf(n){let e=n.facet(e0);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Aa(n,e){let t="",r=n.tabSize,i=n.facet(e0)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function t0(n,e){n instanceof We&&(n=new ah(n));for(let r of n.state.facet(AL)){let i=r(n,e);if(i!==void 0)return i}let t=Gt(n.state);return t.length>=e?LL(n,t,e):null}class ah{constructor(e,t={}){this.state=e,this.options=t,this.unit=kf(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),l=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return l>-1&&(s+=l-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return el(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 l=s(i);if(l>-1)return l}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const WS=new je;function LL(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 l=i;l&&!(l.from<r.node.from||l.to>r.node.to||l.from==r.node.from&&l.type==r.node.type);l=l.parent)s.push(l);for(let l=s.length-1;l>=0;l--)r={node:s[l],next:r}}return VS(r,n,t)}function VS(n,e,t){for(let r=n;r;r=r.next){let i=NL(r.node);if(i)return i(n0.create(e,t,r))}return 0}function DL(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function NL(n){let e=n.type.prop(WS);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(je.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return l=>FL(l,!0,1,void 0,s&&!DL(l)?i.from:void 0)}return n.parent==null?IL:null}function IL(){return 0}class n0 extends ah{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 n0(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(BL(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return VS(this.context.next,this.base,this.pos)}}function BL(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function jL(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),l=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let c=t.to;;){let u=e.childAfter(c);if(!u||u==r)return null;if(!u.type.isSkipped){if(u.from>=l)return null;let h=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+h}}c=u.to}}function FL(n,e,t,r,i){let s=n.textAfter,l=s.match(/^\s*/)[0].length,c=r&&s.slice(l,l+r.length)==r||i==n.pos+l,u=jL(n);return u?c?n.column(u.from):n.column(u.to):n.baseIndent+(c?0:n.unit*t)}function zL({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const _L=200;function WL(){return We.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+_L)return n;let s=t.sliceString(i.from,r);if(!e.some(h=>h.test(s)))return n;let{state:l}=n,c=-1,u=[];for(let{head:h}of l.selection.ranges){let d=l.doc.lineAt(h);if(d.from==c)continue;c=d.from;let m=t0(l,d.from);if(m==null)continue;let g=/^\s*/.exec(d.text)[0],y=Aa(l,m);g!=y&&u.push({from:d.from,to:d.from+g.length,insert:y})}return u.length?[n,{changes:u,sequential:!0}]:n})}const VL=ge.define(),HS=new je;function HL(n,e,t){let r=Gt(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let l=i;l;l=l.next){let c=l.node;if(c.to<=t||c.from>t)continue;if(s&&c.from<e)break;let u=c.type.prop(HS);if(u&&(c.to<r.length-50||r.length==n.doc.length||!$L(c))){let h=u(c,n);h&&h.from<=t&&h.from>=e&&h.to>t&&(s=h)}}return s}function $L(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Cf(n,e,t){for(let r of n.facet(VL)){let i=r(n,e,t);if(i)return i}return HL(n,e,t)}function $S(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=Ie.define({map:$S}),Ya=Ie.define({map:$S});function US(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 qs=nn.define({create(){return Ce.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,r)=>n=Y1(n,t,r)),n=n.map(e.changes);for(let t of e.effects)if(t.is(ch)&&!UL(n,t.value.from,t.value.to)){let{preparePlaceholder:r}=e.state.facet(QS),i=r?Ce.replace({widget:new JL(r(e.state,t.value))}):G1;n=n.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(Ya)&&(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=Y1(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(G1.range(r,i))}return Ce.set(e,!0)}});function Y1(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 Ef(n,e,t){var r;let i=null;return(r=n.field(qs,!1))===null||r===void 0||r.between(e,t,(s,l)=>{(!i||i.from>s)&&(i={from:s,to:l})}),i}function UL(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function qS(n,e){return n.field(qs,!1)?e:e.concat(Ie.appendConfig.of(YS()))}const qL=n=>{for(let e of US(n)){let t=Cf(n.state,e.from,e.to);if(t)return n.dispatch({effects:qS(n.state,[ch.of(t),KS(n,t)])}),!0}return!1},KL=n=>{if(!n.state.field(qs,!1))return!1;let e=[];for(let t of US(n)){let r=Ef(n.state,t.from,t.to);r&&e.push(Ya.of(r),KS(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function KS(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 QL=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=Cf(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:qS(n.state,t)}),!!t.length},YL=n=>{let e=n.state.field(qs,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(Ya.of({from:r,to:i}))}),n.dispatch({effects:t}),!0},GL=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:qL},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:KL},{key:"Ctrl-Alt-[",run:QL},{key:"Ctrl-Alt-]",run:YL}],XL={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},QS=ge.define({combine(n){return Kr(n,XL)}});function YS(n){return[qs,tD]}function GS(n,e){let{state:t}=n,r=t.facet(QS),i=l=>{let c=n.lineBlockAt(n.posAtDOM(l.target)),u=Ef(n.state,c.from,c.to);u&&n.dispatch({effects:Ya.of(u)}),l.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 G1=Ce.replace({widget:new class extends Qr{toDOM(n){return GS(n,null)}}});class JL extends Qr{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return GS(e,this.value)}}const ZL={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Bp extends bi{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 eD(n={}){let e={...ZL,...n},t=new Bp(e,!0),r=new Bp(e,!1),i=Mt.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l)}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(cs)!=l.state.facet(cs)||l.startState.field(qs,!1)!=l.state.field(qs,!1)||Gt(l.startState)!=Gt(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view))}buildMarkers(l){let c=new xi;for(let u of l.viewportLineBlocks){let h=Ef(l.state,u.from,u.to)?r:Cf(l.state,u.from,u.to)?t:null;h&&c.add(u.from,u.from,h)}return c.finish()}}),{domEventHandlers:s}=e;return[i,eL({class:"cm-foldGutter",markers(l){var c;return((c=l.plugin(i))===null||c===void 0?void 0:c.markers)||ze.empty},initialSpacer(){return new Bp(e,!1)},domEventHandlers:{...s,click:(l,c,u)=>{if(s.click&&s.click(l,c,u))return!0;let h=Ef(l.state,c.from,c.to);if(h)return l.dispatch({effects:Ya.of(h)}),!0;let d=Cf(l.state,c.from,c.to);return d?(l.dispatch({effects:ch.of(d)}),!0):!1}}}),YS()]}const tD=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 uh{constructor(e,t){this.specs=e;let r;function i(c){let u=ss.newName();return(r||(r=Object.create(null)))["."+u]=c,u}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,l=t.scope;this.scope=l instanceof wr?c=>c.prop(Co)==l.data:l?c=>c==l:void 0,this.style=zS(e.map(c=>({tag:c.tag,class:c.class||i(Object.assign({},c,{tag:null}))})),{all:s}).style,this.module=r?new ss(r):null,this.themeType=t.themeType}static define(e,t){return new uh(e,t||{})}}const Km=ge.define(),XS=ge.define({combine(n){return n.length?[n[0]]:null}});function jp(n){let e=n.facet(Km);return e.length?e:n.facet(XS)}function nD(n,e){let t=[iD],r;return n instanceof uh&&(n.module&&t.push(de.styleModule.of(n.module)),r=n.themeType),e!=null&&e.fallback?t.push(XS.of(n)):r?t.push(Km.computeN([de.darkTheme],i=>i.facet(de.darkTheme)==(r=="dark")?[n]:[])):t.push(Km.of(n)),t}class rD{constructor(e){this.markCache=Object.create(null),this.tree=Gt(e.state),this.decorations=this.buildDeco(e,jp(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Gt(e.state),r=jp(e.state),i=r!=jp(e.startState),{viewport:s}=e.view,l=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&l>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(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 Ce.none;let r=new xi;for(let{from:i,to:s}of e.visibleRanges)kL(this.tree,t,(l,c,u)=>{r.add(l,c,this.markCache[u]||(this.markCache[u]=Ce.mark({class:u})))},i,s);return r.finish()}}const iD=fs.high(Mt.fromClass(rD,{decorations:n=>n.decorations})),sD=uh.define([{tag:ie.meta,color:"#404740"},{tag:ie.link,textDecoration:"underline"},{tag:ie.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ie.emphasis,fontStyle:"italic"},{tag:ie.strong,fontWeight:"bold"},{tag:ie.strikethrough,textDecoration:"line-through"},{tag:ie.keyword,color:"#708"},{tag:[ie.atom,ie.bool,ie.url,ie.contentSeparator,ie.labelName],color:"#219"},{tag:[ie.literal,ie.inserted],color:"#164"},{tag:[ie.string,ie.deleted],color:"#a11"},{tag:[ie.regexp,ie.escape,ie.special(ie.string)],color:"#e40"},{tag:ie.definition(ie.variableName),color:"#00f"},{tag:ie.local(ie.variableName),color:"#30a"},{tag:[ie.typeName,ie.namespace],color:"#085"},{tag:ie.className,color:"#167"},{tag:[ie.special(ie.variableName),ie.macroName],color:"#256"},{tag:ie.definition(ie.propertyName),color:"#00c"},{tag:ie.comment,color:"#940"},{tag:ie.invalid,color:"#f00"}]),oD=de.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),JS=1e4,ZS="()[]{}",ek=ge.define({combine(n){return Kr(n,{afterCursor:!0,brackets:ZS,maxScanDistance:JS,renderMatch:cD})}}),lD=Ce.mark({class:"cm-matchingBracket"}),aD=Ce.mark({class:"cm-nonmatchingBracket"});function cD(n){let e=[],t=n.matched?lD:aD;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const uD=nn.define({create(){return Ce.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],r=e.state.facet(ek);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=Wr(e.state,i.head,-1,r)||i.head>0&&Wr(e.state,i.head-1,1,r)||r.afterCursor&&(Wr(e.state,i.head,1,r)||i.head<e.state.doc.length&&Wr(e.state,i.head+1,-1,r));s&&(t=t.concat(r.renderMatch(s,e.state)))}return Ce.set(t,!0)},provide:n=>de.decorations.from(n)}),fD=[uD,oD];function hD(n={}){return[ek.of(n),fD]}const dD=new je;function Qm(n,e,t){let r=n.prop(e<0?je.openedBy:je.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 Ym(n){let e=n.type.prop(dD);return e?e(n.node):n}function Wr(n,e,t,r={}){let i=r.maxScanDistance||JS,s=r.brackets||ZS,l=Gt(n),c=l.resolveInner(e,t);for(let u=c;u;u=u.parent){let h=Qm(u.type,t,s);if(h&&u.from<u.to){let d=Ym(u);if(d&&(t>0?e>=d.from&&e<d.to:e>d.from&&e<=d.to))return pD(n,e,t,u,d,h,s)}}return mD(n,e,t,l,c.type,i,s)}function pD(n,e,t,r,i,s,l){let c=r.parent,u={from:i.from,to:i.to},h=0,d=c==null?void 0:c.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 m=Ym(d);return{start:u,end:m?{from:m.from,to:m.to}:void 0,matched:!0}}else if(Qm(d.type,t,l))h++;else if(Qm(d.type,-t,l)){if(h==0){let m=Ym(d);return{start:u,end:m&&m.from<m.to?{from:m.from,to:m.to}:void 0,matched:!1}}h--}}while(t<0?d.prevSibling():d.nextSibling());return{start:u,matched:!1}}function mD(n,e,t,r,i,s,l){let c=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),u=l.indexOf(c);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),m=0;for(let g=0;!d.next().done&&g<=s;){let y=d.value;t<0&&(g+=y.length);let x=e+g*t;for(let b=t>0?0:y.length-1,k=t>0?y.length:-1;b!=k;b+=t){let R=l.indexOf(y[b]);if(!(R<0||r.resolveInner(x+b,1).type!=i))if(R%2==0==t>0)m++;else{if(m==1)return{start:h,end:{from:x+b,to:x+b+1},matched:R>>1==u>>1};m--}}t>0&&(g+=y.length)}return d.done?{start:h,matched:!1}:null}const gD=Object.create(null),X1=[Ln.none],J1=[],Z1=Object.create(null),yD=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"]])yD[n]=vD(gD,e);function Fp(n,e){J1.indexOf(n)>-1||(J1.push(n),console.warn(e))}function vD(n,e){let t=[];for(let c of e.split(" ")){let u=[];for(let h of c.split(".")){let d=n[h]||ie[h];d?typeof d=="function"?u.length?u=u.map(d):Fp(h,`Modifier ${h} used at start of tag`):u.length?Fp(h,`Tag ${h} used as modifier`):u=Array.isArray(d)?d:[d]:Fp(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(c=>c.id),s=Z1[i];if(s)return s.id;let l=Z1[i]=Ln.define({id:X1.length,name:r,props:[jS({[r]:t})]});return X1.push(l),l.id}st.RTL,st.LTR;var ew={};class Rf{constructor(e,t,r,i,s,l,c,u,h,d=0,m){this.p=e,this.stack=t,this.state=r,this.reducePos=i,this.pos=s,this.score=l,this.buffer=c,this.bufferBase=u,this.curContext=h,this.lookAhead=d,this.parent=m}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 Rf(e,[],t,r,r,0,[],0,i?new tw(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,l=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),c=s.dynamicPrecedence(i);if(c&&(this.score+=c),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,l?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,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 m=u?this.stack[u-1]:0,g=this.bufferBase+this.buffer.length-m;if(i<s.minRepeatTerm||e&131072){let y=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,h,y,g+4,!0)}if(e&262144)this.state=this.stack[u];else{let y=this.stack[u-3];this.state=s.getGoto(y,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 l=this,c=this.buffer.length;if(c==0&&l.parent&&(c=l.bufferBase-l.parent.bufferBase,l=l.parent),c>0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(t==r)return;if(l.buffer[c-2]>=t){l.buffer[c-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,t,r,i);else{let l=this.buffer.length;if(l>0&&(this.buffer[l-4]!=0||this.buffer[l-1]<0)){let c=!1;for(let u=l;u>0&&this.buffer[u-2]>r;u-=4)if(this.buffer[u-1]>=0){c=!0;break}if(c)for(;l>0&&this.buffer[l-2]>r;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,i>4&&(i-=4)}this.buffer[l]=e,this.buffer[l+1]=t,this.buffer[l+2]=r,this.buffer[l+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:l}=this.p;(i>this.pos||t<=l.maxNode)&&(this.pos=i,l.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(t,r),t<=l.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>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 Rf(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 xD(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,l;s<t.length;s+=2)(l=t[s+1])!=this.state&&this.p.parser.hasAction(l,e)&&i.push(t[s],l);if(this.stack.length<120)for(let s=0;i.length<8&&s<t.length;s+=2){let l=t[s+1];i.some((c,u)=>u&1&&c==l)||i.push(t[s],l)}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 l=this.split();l.pushState(s,this.pos),l.storeNode(0,l.pos,l.pos,4,!0),l.shiftContext(t[i],this.pos),l.reducePos=this.pos,l.score-=200,r.push(l)}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 l=this.findForcedReduction();if(l==null)return!1;t=l}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,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-s;if(c>1){let u=l&65535,h=this.stack.length-c*3;if(h>=0&&e.getGoto(this.stack[h],u,!1)>=0)return c<<19|65536|u}}else{let c=r(l,s+1);if(c!=null)return c}})};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 tw(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 tw{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class xD{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 Tf{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 Tf(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 Tf(this.stack,this.pos,this.index)}}function Au(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 l=n.charCodeAt(r++),c=!1;if(l==126){s=65535;break}l>=92&&l--,l>=34&&l--;let u=l-32;if(u>=46&&(u-=46,c=!0),s+=u,c)break;s*=46}t?t[i++]=s:t=new e(s)}return t}class Ju{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 Ju;class wD{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 l=this.ranges[--i];s-=r.from-l.to,r=l}for(;t<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let l=this.ranges[++i];s+=l.from-r.to,r=l}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 l=this.rangeIndex,c=this.range;for(;c.to<=r;)c=this.ranges[++l];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>c.to&&(this.chunk2=this.chunk2.slice(0,c.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 Lo{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;SD(this.data,e,t,this.id,r.data,r.tokenPrecTable)}}Lo.prototype.contextual=Lo.prototype.fallback=Lo.prototype.extend=!1;Lo.prototype.fallback=Lo.prototype.extend=!1;class bD{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function SD(n,e,t,r,i,s){let l=0,c=1<<r,{dialect:u}=t.p.parser;e:for(;(c&n[l])!=0;){let h=n[l+1];for(let y=l+3;y<h;y+=2)if((n[y+1]&c)>0){let x=n[y];if(u.allows(x)&&(e.token.value==-1||e.token.value==x||kD(x,e.token.value,i,s))){e.acceptToken(x);break}}let d=e.next,m=0,g=n[l+2];if(e.next<0&&g>m&&n[h+g*3-3]==65535){l=n[h+g*3-1];continue e}for(;m<g;){let y=m+g>>1,x=h+y+(y<<1),b=n[x],k=n[x+1]||65536;if(d<b)g=y;else if(d>=k)m=y+1;else{l=n[x+2],e.advance();continue e}}break}}function rw(n,e,t){for(let r=e,i;(i=n[r])!=65535;r++)if(i==t)return r-e;return-1}function kD(n,e,t,r){let i=rw(t,r,e);return i<0||rw(t,r,n)<i}const jn=typeof process<"u"&&ew&&/\bparse\b/.test(ew.LOG);let zp=null;function iw(n,e,t){let r=n.cursor(bt.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 CD{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?iw(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?iw(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],l=this.start[t]+r.positions[i];if(l>e)return this.nextStart=l,null;if(s instanceof Tt){if(l==e){if(l<this.safeFrom)return null;let c=l+s.length;if(c<=this.safeTo){let u=s.prop(je.lookAhead);if(!u||c+u<this.fragment.to)return s}}this.index[t]++,l+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(l),this.index.push(0))}else this.index[t]++,this.nextStart=l+s.length}}}class ED{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Ju)}getActions(e){let t=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,l=i.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,u=0;for(let h=0;h<s.length;h++){if((1<<h&l)==0)continue;let d=s[h],m=this.tokens[h];if(!(r&&!d.fallback)&&((d.contextual||m.start!=e.pos||m.mask!=l||m.context!=c)&&(this.updateCachedToken(m,d,e),m.mask=l,m.context=c),m.lookAhead>m.end+25&&(u=Math.max(m.lookAhead,u)),m.value!=0)){let g=t;if(m.extended>-1&&(t=this.addActions(e,m.extended,m.end,t)),t=this.addActions(e,m.value,m.end,t),!d.extend&&(r=m,t>g))break}}for(;this.actions.length>t;)this.actions.pop();return u&&e.setLookAhead(u),!r&&e.pos==this.stream.end&&(r=new Ju,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 Ju,{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 l=0;l<s.specialized.length;l++)if(s.specialized[l]==e.value){let c=s.specializers[l](this.stream.read(e.start,e.end),r);if(c>=0&&r.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>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:l}=e.p,{data:c}=l;for(let u=0;u<2;u++)for(let h=l.stateSlot(s,u?2:1);;h+=3){if(c[h]==65535)if(c[h+1]==1)h=ci(c,h+2);else{i==0&&c[h+1]==2&&(i=this.putAction(ci(c,h+2),t,r,i));break}c[h]==t&&(i=this.putAction(ci(c,h+1),t,r,i))}return i}}class RD{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 wD(t,i),this.tokens=new ED(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[Rf.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new CD(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[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;l<e.length;l++){let c=e[l];for(;;){if(this.tokens.mainToken=null,c.pos>t)r.push(c);else{if(this.advanceStack(c,r,e))continue;{i||(i=[],s=[]),i.push(c);let u=this.tokens.getMainToken(c);s.push(u.value,u.end)}}break}}if(!r.length){let l=i&&MD(i);if(l)return jn&&console.log("Finish with "+this.stackID(l)),this.stackToTree(l);if(this.parser.strict)throw jn&&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 l=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(l)return jn&&console.log("Force-finish "+this.stackID(l)),this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(r.length>l)for(r.sort((c,u)=>u.score-c.score);r.length>l;)r.pop();r.some(c=>c.reducePos>t)&&this.recovering--}else if(r.length>1){e:for(let l=0;l<r.length-1;l++){let c=r[l];for(let u=l+1;u<r.length;u++){let h=r[u];if(c.sameState(h)||c.buffer.length>500&&h.buffer.length>500)if((c.score-h.score||c.buffer.length-h.buffer.length)>0)r.splice(u--,1);else{r.splice(l--,1);continue e}}}r.length>12&&(r.sort((l,c)=>c.score-l.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let l=1;l<r.length;l++)r[l].pos<this.minStackPos&&(this.minStackPos=r[l].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,l=jn?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 m=this.fragments.nodeAt(i);m;){let g=this.parser.nodeSet.types[m.type.id]==m.type?s.getGoto(e.state,m.type.id):-1;if(g>-1&&m.length&&(!h||(m.prop(je.contextHash)||0)==d))return e.useNode(m,g),jn&&console.log(l+this.stackID(e)+` (via reuse of ${s.getName(m.type.id)})`),!0;if(!(m instanceof Tt)||m.children.length==0||m.positions[0]>0)break;let y=m.children[0];if(y instanceof Tt&&m.positions[0]==0)m=y;else break}}let c=s.stateSlot(e.state,4);if(c>0)return e.reduce(c),jn&&console.log(l+this.stackID(e)+` (via always-reduce ${s.getName(c&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++],m=u[h++],g=u[h++],y=h==u.length||!r,x=y?e:e.split(),b=this.tokens.mainToken;if(x.apply(d,m,b?b.start:x.pos,g),jn&&console.log(l+this.stackID(x)+` (via ${(d&65536)==0?"shift":`reduce of ${s.getName(d&65535)}`} for ${s.getName(m)} @ ${i}${x==e?"":", split"})`),y)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 sw(e,t),!0}}runRecovery(e,t,r){let i=null,s=!1;for(let l=0;l<e.length;l++){let c=e[l],u=t[l<<1],h=t[(l<<1)+1],d=jn?this.stackID(c)+" -> ":"";if(c.deadEnd&&(s||(s=!0,c.restart(),jn&&console.log(d+this.stackID(c)+" (restarted)"),this.advanceFully(c,r))))continue;let m=c.split(),g=d;for(let y=0;y<10&&m.forceReduce()&&(jn&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,r));y++)jn&&(g=this.stackID(m)+" -> ");for(let y of c.recoverByInsert(u))jn&&console.log(d+this.stackID(y)+" (via recover-insert)"),this.advanceFully(y,r);this.stream.end>c.pos?(h==c.pos&&(h++,u=0),c.recoverByDelete(u,h),jn&&console.log(d+this.stackID(c)+` (via recover-delete ${this.parser.getName(u)})`),sw(c,r)):(!i||i.score<c.score)&&(i=c)}return i}stackToTree(e){return e.close(),Tt.build({buffer:Tf.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=(zp||(zp=new WeakMap)).get(e);return t||zp.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function sw(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 TD{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class Mf extends BS{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 c=0;c<e.repeatNodeCount;c++)t.push("");let r=Object.keys(e.topRules).map(c=>e.topRules[c][1]),i=[];for(let c=0;c<t.length;c++)i.push([]);function s(c,u,h){i[c].push([u,u.deserialize(String(h))])}if(e.nodeProps)for(let c of e.nodeProps){let u=c[0];typeof u=="string"&&(u=je[u]);for(let h=1;h<c.length;){let d=c[h++];if(d>=0)s(d,u,c[h++]);else{let m=c[h+-d];for(let g=-d;g>0;g--)s(c[h++],u,m);h++}}}this.nodeSet=new Gg(t.map((c,u)=>Ln.define({name:u>=this.minRepeatTerm?void 0:c,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=LS;let l=Au(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;c<this.specializerSpecs.length;c++)this.specialized[c]=this.specializerSpecs[c].term;this.specializers=this.specializerSpecs.map(ow),this.states=Au(e.states,Uint32Array),this.data=Au(e.stateData),this.goto=Au(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(c=>typeof c=="number"?new Lo(l,c):c),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 RD(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 l=i[s++],c=l&1,u=i[s++];if(c&&r)return u;for(let h=s+(l>>1);s<h;s++)if(i[s]==e)return u;if(c)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),l;;s+=3){if((l=r[s])==65535)if(r[s+1]==1)l=r[s=ci(r,s+2)];else{if(r[s+1]==2)return ci(r,s+2);break}if(l==t||l==0)return ci(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=ci(this.data,s+2);else break;i=t(ci(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=ci(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];t.some((s,l)=>l&1&&s==i)||t.push(this.data[r],i)}}return t}configure(e){let t=Object.assign(Object.create(Mf.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(c=>c.from==r.external);if(!s)return r;let l=Object.assign(Object.assign({},r),{external:s.to});return t.specializers[i]=ow(l),l})),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 l=t.indexOf(s);l>=0&&(r[l]=!0)}let i=null;for(let s=0;s<t.length;s++)if(!r[s])for(let l=this.dialects[t[s]],c;(c=this.data[l++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[c]=1;return new TD(e,r,i)}static deserialize(e){return new Mf(e)}}function ci(n,e){return n[e]|n[e+1]<<16}function MD(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 ow(n){if(n.external){let e=n.extend?1:0;return(t,r)=>n.external(t,r)<<1|e}return n.get}class tk{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=Gt(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(rk(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 lw(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 OD(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=lw(e)+lw(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function nk(n){let e=n.map(i=>typeof i=="string"?{label:i}:i),[t,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:OD(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function PD(n,e){return t=>{for(let r=Gt(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 aw{constructor(e,t,r,i){this.completion=e,this.source=t,this.match=r,this.score=i}}function Ws(n){return n.selection.main.from}function rk(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 ik=Ci.define();function AD(n,e,t,r){let{main:i}=n.selection,s=t-i.from,l=r-i.from;return{...n.changeByRange(c=>{if(c!=i&&t!=r&&n.sliceDoc(c.from+s,c.from+l)!=n.sliceDoc(t,r))return{range:c};let u=n.toText(e);return{changes:{from:c.from+s,to:r==i.from?c.to:c.from+l,insert:u},range:ee.cursor(c.from+s+u.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const cw=new WeakMap;function LD(n){if(!Array.isArray(n))return n;let e=cw.get(n);return e||cw.set(n,e=nk(n)),e}const Of=Ie.define(),La=Ie.define();class DD{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=Rn(e,t),i=zr(r);this.chars.push(r);let s=e.slice(t,t+i),l=s.toUpperCase();this.folded.push(Rn(l==s?s.toLowerCase():l,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:l}=this;if(t.length==1){let T=Rn(e,0),O=zr(T),P=O==e.length?0:-100;if(T!=t[0])if(T==r[0])P+=-200;else return null;return this.ret(P,[0,O])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let u=t.length,h=0;if(c<0){for(let T=0,O=Math.min(e.length,200);T<O&&h<u;){let P=Rn(e,T);(P==t[h]||P==r[h])&&(i[h++]=T),T+=zr(P)}if(h<u)return null}let d=0,m=0,g=!1,y=0,x=-1,b=-1,k=/[a-z]/.test(e),R=!0;for(let T=0,O=Math.min(e.length,200),P=0;T<O&&m<u;){let N=Rn(e,T);c<0&&(d<u&&N==t[d]&&(s[d++]=T),y<u&&(N==t[y]||N==r[y]?(y==0&&(x=T),b=T+1,y++):y=0));let I,B=N<255?N>=48&&N<=57||N>=97&&N<=122?2:N>=65&&N<=90?1:0:(I=Dg(N))!=I.toLowerCase()?1:I!=I.toUpperCase()?2:0;(!T||B==1&&k||P==0&&B!=0)&&(t[m]==N||r[m]==N&&(g=!0)?l[m++]=T:l.length&&(R=!1)),P=B,T+=zr(N)}return m==u&&l[0]==0&&R?this.result(-100+(g?-200:0),l,e):y==u&&x==0?this.ret(-200-e.length+(b==e.length?0:-100),[0,b]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):y==u?this.ret(-900-e.length,[x,b]):m==u?this.result(-100+(g?-200:0)+-700+(R?0:-1100),l,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 l of t){let c=l+(this.astral?zr(Rn(r,l)):1);s&&i[s-1]==l?i[s-1]=c:(i[s++]=l,i[s++]=c)}return this.ret(e-r.length,i)}}class ND{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 Qt=ge.define({combine(n){return Kr(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:ID,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=>uw(e(r),t(r)),optionClass:(e,t)=>r=>uw(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function uw(n,e){return n?e?n+" "+e:n:e}function ID(n,e,t,r,i,s){let l=n.textDirection==st.RTL,c=l,u=!1,h="top",d,m,g=e.left-i.left,y=i.right-e.right,x=r.right-r.left,b=r.bottom-r.top;if(c&&g<Math.min(x,y)?c=!1:!c&&y<Math.min(x,g)&&(c=!0),x<=(c?g:y))d=Math.max(i.top,Math.min(t.top,i.bottom-b))-e.top,m=Math.min(400,c?g:y);else{u=!0,m=Math.min(400,(l?e.right:i.right-e.left)-30);let T=i.bottom-e.bottom;T>=b||T>e.top?d=t.bottom-e.top:(h="bottom",d=e.bottom-t.top)}let k=(e.bottom-e.top)/s.offsetHeight,R=(e.right-e.left)/s.offsetWidth;return{style:`${h}: ${d/k}px; max-width: ${m/R}px`,class:"cm-completionInfo-"+(u?l?"left-narrow":"right-narrow":c?"left":"right")}}function BD(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 l=document.createElement("span");l.className="cm-completionLabel";let c=t.displayLabel||t.label,u=0;for(let h=0;h<s.length;){let d=s[h++],m=s[h++];d>u&&l.appendChild(document.createTextNode(c.slice(u,d)));let g=l.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(c.slice(d,m))),g.className="cm-completionMatchedText",u=m}return u<c.length&&l.appendChild(document.createTextNode(c.slice(u))),l},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 _p(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.floor((n-e)/t);return{from:n-(r+1)*t,to:n-r*t}}class jD{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:l}=i.open,c=e.state.facet(Qt);this.optionContent=BD(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=_p(s.length,l,c.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,m;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(m=/-(\d+)$/.exec(d.id))&&+m[1]<h.length){this.applyCompletion(e,h[+m[1]]),u.preventDefault();return}}),this.dom.addEventListener("focusout",u=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Qt).closeOnBlur&&u.relatedTarget!=e.contentDOM&&e.dispatch({effects:La.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:l,disabled:c}=r.open;(!i.open||i.open.options!=s)&&(this.range=_p(s.length,l,e.state.facet(Qt).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),c!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}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=_p(t.options.length,t.selected,this.view.state.facet(Qt).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 l=typeof s=="string"?document.createTextNode(s):s(i);if(!l)return;"then"in l?l.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,i)}).catch(c=>On(this.view.state,c,"completion info")):(this.addInfoPane(l,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&&zD(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 l=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:l.clientWidth,bottom:l.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(Qt).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",l=>{l.target==i&&l.preventDefault()});let s=null;for(let l=r.from;l<r.to;l++){let{completion:c,match:u}=e[l],{section:h}=c;if(h){let g=typeof h=="string"?h:h.name;if(g!=s&&(l>r.from||r.from==0))if(s=g,typeof h!="string"&&h.header)i.appendChild(h.header(h));else{let y=i.appendChild(document.createElement("completion-section"));y.textContent=g}}const d=i.appendChild(document.createElement("li"));d.id=t+"-"+l,d.setAttribute("role","option");let m=this.optionClass(c);m&&(d.className=m);for(let g of this.optionContent){let y=g(c,this.view.state,this.view,u);y&&d.appendChild(y)}}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 FD(n,e){return t=>new jD(t,n,e)}function zD(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 fw(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function _D(n,e){let t=[],r=null,i=null,s=d=>{t.push(d);let{section:m}=d.completion;if(m){r||(r=[]);let g=typeof m=="string"?m:m.name;r.some(y=>y.name==g)||r.push(typeof m=="string"?{name:g}:m)}},l=e.facet(Qt);for(let d of n)if(d.hasResult()){let m=d.result.getMatch;if(d.result.filter===!1)for(let g of d.result.options)s(new aw(g,d.source,m?m(g):[],1e9-t.length));else{let g=e.sliceDoc(d.from,d.to),y,x=l.filterStrict?new ND(g):new DD(g);for(let b of d.result.options)if(y=x.match(b.label)){let k=b.displayLabel?m?m(b,y.matched):[]:y.matched,R=y.score+(b.boost||0);if(s(new aw(b,d.source,k,R)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:T}=b.section;i||(i=Object.create(null)),i[T]=Math.max(R,i[T]||-1e9)}}}}if(r){let d=Object.create(null),m=0,g=(y,x)=>(y.rank==="dynamic"&&x.rank==="dynamic"?i[x.name]-i[y.name]:0)||(typeof y.rank=="number"?y.rank:1e9)-(typeof x.rank=="number"?x.rank:1e9)||(y.name<x.name?-1:1);for(let y of r.sort(g))m-=1e5,d[y.name]=m;for(let y of t){let{section:x}=y.completion;x&&(y.score+=d[typeof x=="string"?x:x.name])}}let c=[],u=null,h=l.compareCompletions;for(let d of t.sort((m,g)=>g.score-m.score||h(m.completion,g.completion))){let m=d.completion;!u||u.label!=m.label||u.detail!=m.detail||u.type!=null&&m.type!=null&&u.type!=m.type||u.apply!=m.apply||u.boost!=m.boost?c.push(d):fw(d.completion)>fw(u)&&(c[c.length-1]=d),u=d.completion}return c}class Eo{constructor(e,t,r,i,s,l){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=l}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Eo(this.options,hw(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,i,s,l){if(i&&!l&&e.some(h=>h.isPending))return i.setDisabled();let c=_D(e,t);if(!c.length)return i&&e.some(h=>h.isPending)?i.setDisabled():null;let u=t.facet(Qt).selectOnOpen?0:-1;if(i&&i.selected!=u&&i.selected!=-1){let h=i.options[i.selected].completion;for(let d=0;d<c.length;d++)if(c[d].completion==h){u=d;break}}return new Eo(c,hw(r,u),{pos:e.reduce((h,d)=>d.hasResult()?Math.min(h,d.from):h,1e8),create:qD,above:s.aboveCursor},i?i.timestamp:Date.now(),u,!1)}map(e){return new Eo(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Eo(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Pf{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new Pf($D,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(Qt),s=(r.override||t.languageDataAt("autocomplete",Ws(t)).map(LD)).map(u=>(this.active.find(d=>d.source==u)||new rr(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 l=this.open,c=e.effects.some(u=>u.is(r0));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||s.some(u=>u.hasResult()&&e.changes.touchesRange(u.from,u.to))||!WD(s,this.active)||c?l=Eo.build(s,t,this.id,l,r,c):l&&l.disabled&&!s.some(u=>u.isPending)&&(l=null),!l&&s.every(u=>!u.isPending)&&s.some(u=>u.hasResult())&&(s=s.map(u=>u.hasResult()?new rr(u.source,0):u));for(let u of e.effects)u.is(ok)&&(l=l&&l.setSelected(u.value,this.id));return s==this.active&&l==this.open?this:new Pf(s,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?VD:HD}}function WD(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 VD={"aria-autocomplete":"list"},HD={};function hw(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const $D=[];function sk(n,e){if(n.isUserEvent("input.complete")){let r=n.annotation(ik);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 rr{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=sk(e,t),i=this;(r&8||r&16&&this.touches(e))&&(i=new rr(i.source,0)),r&4&&i.state==0&&(i=new rr(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(Of))i=new rr(i.source,1,s.value);else if(s.is(La))i=new rr(i.source,0);else if(s.is(r0))for(let l of s.value)l.source==i.source&&(i=l);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Ws(e.state))}}class Do extends rr{constructor(e,t,r,i,s,l){super(e,3,t),this.limit=r,this.result=i,this.from=s,this.to=l}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),l=e.changes.mapPos(this.to,1),c=Ws(e.state);if(c>l||!i||t&2&&(Ws(e.startState)==this.from||c<this.limit))return new rr(this.source,t&4?1:0);let u=e.changes.mapPos(this.limit);return UD(i.validFor,e.state,s,l)?new Do(this.source,this.explicit,u,i,s,l):i.update&&(i=i.update(i,s,l,new tk(e.state,c,!1)))?new Do(this.source,this.explicit,u,i,i.from,(r=i.to)!==null&&r!==void 0?r:Ws(e.state)):new rr(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Do(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new rr(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function UD(n,e,t,r){if(!n)return!1;let i=e.sliceDoc(t,r);return typeof n=="function"?n(i,t,r,e):rk(n,!0).test(i)}const r0=Ie.define({map(n,e){return n.map(t=>t.map(e))}}),ok=Ie.define(),Tn=nn.define({create(){return Pf.start()},update(n,e){return n.update(e)},provide:n=>[Yg.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(Tn).active.find(i=>i.source==e.source);return r instanceof Do?(typeof t=="string"?n.dispatch({...AD(n.state,t,r.from,r.to),annotations:ik.of(e.completion)}):t(n,e.completion,r.from,r.to),!0):!1}const qD=FD(Tn,i0);function Lu(n,e="option"){return t=>{let r=t.state.field(Tn,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(Qt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=MS(t,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:l}=r.open.options,c=r.open.selected>-1?r.open.selected+i*(n?1:-1):n?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),t.dispatch({effects:ok.of(c)}),!0}}const KD=n=>{let e=n.state.field(Tn,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(Qt).interactionDelay?!1:i0(n,e.open.options[e.open.selected])},Wp=n=>n.state.field(Tn,!1)?(n.dispatch({effects:Of.of(!0)}),!0):!1,QD=n=>{let e=n.state.field(Tn,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:La.of(null)}),!0)};class YD{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const GD=50,XD=1e3,JD=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(Tn).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Tn),t=n.state.facet(Qt);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Tn)==e)return;let r=n.transactions.some(s=>{let l=sk(s,t);return l&8||(s.selection||s.docChanged)&&!(l&3)});for(let s=0;s<this.running.length;s++){let l=this.running[s];if(r||l.context.abortOnDocChange&&n.docChanged||l.updates.length+n.transactions.length>GD&&Date.now()-l.time>XD){for(let c of l.context.abortListeners)try{c()}catch(u){On(this.view.state,u)}l.context.abortListeners=null,this.running.splice(s--,1)}else l.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(s=>s.effects.some(l=>l.is(Of)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(l=>l.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(Tn);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(Qt).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Ws(e),r=new tk(e,t,n.explicit,this.view),i=new YD(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:La.of(null)}),On(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(Qt).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Qt),r=this.view.state.field(Tn);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 c=Ws(s.updates.length?s.updates[0].startState:this.view.state),u=Math.min(c,s.done.from+(s.active.explicit?0:1)),h=new Do(s.active.source,s.active.explicit,u,s.done,s.done.from,(n=s.done.to)!==null&&n!==void 0?n:c);for(let d of s.updates)h=h.update(d,t);if(h.hasResult()){e.push(h);continue}}let l=r.active.find(c=>c.source==s.active.source);if(l&&l.isPending)if(s.done==null){let c=new rr(s.active.source,0);for(let u of s.updates)c=c.update(u,t);c.isPending||e.push(c)}else this.startQuery(l)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:r0.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Tn,!1);if(e&&e.tooltip&&this.view.state.facet(Qt).closeOnBlur){let t=e.open&&MS(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:La.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Of.of(!1)}),20),this.composing=0}}}),ZD=typeof navigator=="object"&&/Win/.test(navigator.platform),eN=fs.highest(de.domEventHandlers({keydown(n,e){let t=e.state.field(Tn,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(ZD&&n.altKey)||n.metaKey)return!1;let r=t.open.options[t.open.selected],i=t.active.find(l=>l.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(n.key)>-1&&i0(e,r),!1}})),tN=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"},".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"}}}),Da={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Fs=Ie.define({map(n,e){let t=e.mapPos(n,-1,pn.TrackAfter);return t??void 0}}),s0=new class extends is{};s0.startSide=1;s0.endSide=-1;const lk=nn.define({create(){return ze.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(Fs)&&(n=n.update({add:[s0.range(t.value,t.value+1)]}));return n}});function nN(){return[iN,lk]}const Vp="()[]{}<>«»»«[]{}";function ak(n){for(let e=0;e<Vp.length;e+=2)if(Vp.charCodeAt(e)==n)return Vp.charAt(e+1);return Dg(n<128?n:n+1)}function ck(n,e){return n.languageDataAt("closeBrackets",e)[0]||Da}const rN=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),iN=de.inputHandler.of((n,e,t,r)=>{if((rN?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let i=n.state.selection.main;if(r.length>2||r.length==2&&zr(Rn(r,0))==1||e!=i.from||t!=i.to)return!1;let s=lN(n.state,r);return s?(n.dispatch(s),!0):!1}),sN=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let r=ck(n,n.selection.main.head).brackets||Da.brackets,i=null,s=n.changeByRange(l=>{if(l.empty){let c=aN(n.doc,l.head);for(let u of r)if(u==c&&fh(n.doc,l.head)==ak(Rn(u,0)))return{changes:{from:l.head-u.length,to:l.head+u.length},range:ee.cursor(l.head-u.length)}}return{range:i=l}});return i||e(n.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},oN=[{key:"Backspace",run:sN}];function lN(n,e){let t=ck(n,n.selection.main.head),r=t.brackets||Da.brackets;for(let i of r){let s=ak(Rn(i,0));if(e==i)return s==i?fN(n,i,r.indexOf(i+i+i)>-1,t):cN(n,i,s,t.before||Da.before);if(e==s&&uk(n,n.selection.main.from))return uN(n,i,s)}return null}function uk(n,e){let t=!1;return n.field(lk).between(0,n.doc.length,r=>{r==e&&(t=!0)}),t}function fh(n,e){let t=n.sliceString(e,e+2);return t.slice(0,zr(Rn(t,0)))}function aN(n,e){let t=n.sliceString(e-2,e);return zr(Rn(t,0))==t.length?t:t.slice(1)}function cN(n,e,t,r){let i=null,s=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:t,from:l.to}],effects:Fs.of(l.to+e.length),range:ee.range(l.anchor+e.length,l.head+e.length)};let c=fh(n.doc,l.head);return!c||/\s/.test(c)||r.indexOf(c)>-1?{changes:{insert:e+t,from:l.head},effects:Fs.of(l.head+e.length),range:ee.cursor(l.head+e.length)}:{range:i=l}});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function uN(n,e,t){let r=null,i=n.changeByRange(s=>s.empty&&fh(n.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:ee.cursor(s.head+t.length)}:r={range:s});return r?null:n.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function fN(n,e,t,r){let i=r.stringPrefixes||Da.stringPrefixes,s=null,l=n.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:Fs.of(c.to+e.length),range:ee.range(c.anchor+e.length,c.head+e.length)};let u=c.head,h=fh(n.doc,u),d;if(h==e){if(dw(n,u))return{changes:{insert:e+e,from:u},effects:Fs.of(u+e.length),range:ee.cursor(u+e.length)};if(uk(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:ee.cursor(u+g.length)}}}else{if(t&&n.sliceDoc(u-2*e.length,u)==e+e&&(d=pw(n,u-2*e.length,i))>-1&&dw(n,d))return{changes:{insert:e+e+e+e,from:u},effects:Fs.of(u+e.length),range:ee.cursor(u+e.length)};if(n.charCategorizer(u)(h)!=pt.Word&&pw(n,u,i)>-1&&!hN(n,u,e,i))return{changes:{insert:e+e,from:u},effects:Fs.of(u+e.length),range:ee.cursor(u+e.length)}}return{range:s=c}});return s?null:n.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function dw(n,e){let t=Gt(n).resolveInner(e+1);return t.parent&&t.from==e}function hN(n,e,t,r){let i=Gt(n).resolveInner(e,-1),s=r.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=n.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),u=c.indexOf(t);if(!u||u>-1&&r.indexOf(c.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 pw(n,e,t){let r=n.charCategorizer(e);if(r(n.sliceDoc(e-1,e))!=pt.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))!=pt.Word)return s}return-1}function dN(n={}){return[eN,Tn,Qt.of(n),JD,pN,tN]}const fk=[{key:"Ctrl-Space",run:Wp},{mac:"Alt-`",run:Wp},{mac:"Alt-i",run:Wp},{key:"Escape",run:QD},{key:"ArrowDown",run:Lu(!0)},{key:"ArrowUp",run:Lu(!1)},{key:"PageDown",run:Lu(!0,"page")},{key:"PageUp",run:Lu(!1,"page")},{key:"Enter",run:KD}],pN=fs.highest(Ea.computeN([Qt],n=>n.facet(Qt).defaultKeymap?[fk]:[])),mN=36,mw=1,gN=2,vo=3,Hp=4,yN=5,vN=6,xN=7,wN=8,bN=9,SN=10,kN=11,CN=12,EN=13,RN=14,TN=15,MN=16,ON=17,gw=18,PN=19,hk=20,dk=21,yw=22,AN=23,LN=24;function Gm(n){return n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57}function DN(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function Ds(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 NN(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 Xm(n,e){for(;!(n.next!=95&&!Gm(n.next));)e!=null&&(e+=String.fromCharCode(n.next)),n.advance();return e}function BN(n){if(n.next==39||n.next==34||n.next==96){let e=n.next;n.advance(),Ds(n,e,!1)}else Xm(n)}function vw(n,e){for(;n.next==48||n.next==49;)n.advance();e&&n.next==e&&n.advance()}function xw(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 ww(n){for(;!(n.next<0||n.next==10);)n.advance()}function Os(n,e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)==n)return!0;return!1}const $p=` \r
|
|
143
|
+
`;function pk(n,e,t){let r=Object.create(null);r.true=r.false=yN,r.null=r.unknown=vN;for(let i of n.split(" "))i&&(r[i]=hk);for(let i of e.split(" "))i&&(r[i]=dk);for(let i of(t||"").split(" "))i&&(r[i]=LN);return r}const jN="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 ",FN="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 ",Jm={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:pk(FN,jN)};function zN(n,e,t,r){let i={};for(let s in Jm)i[s]=(n.hasOwnProperty(s)?n:Jm)[s];return e&&(i.words=pk(e,t||"",r)),i}function mk(n){return new bD(e=>{var t;let{next:r}=e;if(e.advance(),Os(r,$p)){for(;Os(e.next,$p);)e.advance();e.acceptToken(mN)}else if(r==36&&n.doubleDollarQuotedStrings){let i=Xm(e,"");e.next==36&&(e.advance(),NN(e,i),e.acceptToken(vo))}else if(r==39||r==34&&n.doubleQuotedStrings)Ds(e,r,n.backslashEscapes),e.acceptToken(vo);else if(r==35&&n.hashComments||r==47&&e.next==47&&n.slashComments)ww(e),e.acceptToken(mw);else if(r==45&&e.next==45&&(!n.spaceAfterDashes||e.peek(1)==32))ww(e),e.acceptToken(mw);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(gN)}else if((r==101||r==69)&&e.next==39)e.advance(),Ds(e,39,!0),e.acceptToken(vo);else if((r==110||r==78)&&e.next==39&&n.charSetCasts)e.advance(),Ds(e,39,n.backslashEscapes),e.acceptToken(vo);else if(r==95&&n.charSetCasts)for(let i=0;;i++){if(e.next==39&&i>1){e.advance(),Ds(e,39,n.backslashEscapes),e.acceptToken(vo);break}if(!Gm(e.next))break;e.advance()}else if(n.plsqlQuotingMechanism&&(r==113||r==81)&&e.next==39&&e.peek(1)>0&&!Os(e.peek(1),$p)){let i=e.peek(1);e.advance(2),IN(e,i),e.acceptToken(vo)}else if(Os(r,n.identifierQuotes)){const i=r==91?93:r;Ds(e,i,!1),e.acceptToken(PN)}else if(r==40)e.acceptToken(xN);else if(r==41)e.acceptToken(wN);else if(r==123)e.acceptToken(bN);else if(r==125)e.acceptToken(SN);else if(r==91)e.acceptToken(kN);else if(r==93)e.acceptToken(CN);else if(r==59)e.acceptToken(EN);else if(n.unquotedBitLiterals&&r==48&&e.next==98)e.advance(),vw(e),e.acceptToken(yw);else if((r==98||r==66)&&(e.next==39||e.next==34)){const i=e.next;e.advance(),n.treatBitsAsBytes?(Ds(e,i,n.backslashEscapes),e.acceptToken(AN)):(vw(e,i),e.acceptToken(yw))}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();DN(e.next);)e.advance();i&&e.next==39&&e.advance(),e.acceptToken(Hp)}else if(r==46&&e.next>=48&&e.next<=57)xw(e,!0),e.acceptToken(Hp);else if(r==46)e.acceptToken(RN);else if(r>=48&&r<=57)xw(e,!1),e.acceptToken(Hp);else if(Os(r,n.operatorChars)){for(;Os(e.next,n.operatorChars);)e.advance();e.acceptToken(TN)}else if(Os(r,n.specialVar))e.next==r&&e.advance(),BN(e),e.acceptToken(ON);else if(r==58||r==44)e.acceptToken(MN);else if(Gm(r)){let i=Xm(e,String.fromCharCode(r));e.acceptToken(e.next==46||e.peek(-i.length-1)==46?gw:(t=n.words[i.toLowerCase()])!==null&&t!==void 0?t:gw)}})}const gk=mk(Jm),_N=Mf.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,gk],topRules:{Script:[0,25]},tokenPrec:0});function Zm(n){let e=n.cursor().moveTo(n.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function Na(n,e){let t=n.sliceString(e.from,e.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(t);return r?r[2]:t}function Af(n){return n&&(n.name=="Identifier"||n.name=="QuotedIdentifier")}function WN(n,e){if(e.name=="CompositeIdentifier"){let t=[];for(let r=e.firstChild;r;r=r.nextSibling)Af(r)&&t.push(Na(n,r));return t}return[Na(n,e)]}function bw(n,e){for(let t=[];;){if(!e||e.name!=".")return t;let r=Zm(e);if(!Af(r))return t;t.unshift(Na(n,r)),e=Zm(r)}}function VN(n,e){let t=Gt(n).resolveInner(e,-1),r=$N(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:bw(n.doc,Zm(t)),aliases:r}:t.name=="."?{from:e,quoted:null,parents:bw(n.doc,t),aliases:r}:{from:e,quoted:null,parents:[],empty:!0,aliases:r}}const HN=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function $N(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,l=null;i;i=i.nextSibling){let c=i.name=="Keyword"?n.sliceString(i.from,i.to).toLowerCase():null,u=null;if(!s)s=c=="from";else if(c=="as"&&l&&Af(i.nextSibling))u=Na(n,i.nextSibling);else{if(c&&HN.has(c))break;l&&Af(i)&&(u=Na(n,i))}u&&(r||(r=Object.create(null)),r[u]=WN(n,l)),l=/Identifier$/.test(i.name)?i:null}return r}function UN(n,e,t){return t.map(r=>({...r,label:r.label[0]==n?r.label:n+r.label+e,apply:void 0}))}const qN=/^\w*$/,KN=/^[`'"\[]?\w*[`'"\]]?$/;function Sw(n){return n.self&&typeof n.self.label=="string"}class o0{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(kw(e,"type",this.idQuote,this.idCaseInsensitive)),t[e]=new o0(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"?kw(t,"property",this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):Sw(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,c=>c=="."?"\0":c).split("\0"),l=this;Sw(r)&&(i=r.self,r=r.children);for(let c=0;c<s.length;c++)i&&c==s.length-1&&l.addCompletion(i),l=l.child(s[c].replace(/\\\./g,"."));l.addNamespace(r)}}}function kw(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+yk(t)}}function yk(n){return n==="["?"]":n}function QN(n,e,t,r,i,s){var l;let c=((l=s==null?void 0:s.spec.identifierQuotes)===null||l===void 0?void 0:l[0])||'"',u=new o0(c,!!(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:m,from:g,quoted:y,empty:x,aliases:b}=VN(d.state,d.pos);if(x&&!d.explicit)return null;b&&m.length==1&&(m=b[m[0]]||m);let k=u;for(let T of m){for(;!k.children||!k.children[T];)if(k==u&&h)k=h;else if(k==h&&r)k=k.child(r);else return null;let O=k.maybeChild(T);if(!O)return null;k=O}let R=k.list;if(k==u&&b&&(R=R.concat(Object.keys(b).map(T=>({label:T,type:"constant"})))),y){let T=y[0],O=yk(T),P=d.state.sliceDoc(d.pos,d.pos+1)==O;return{from:g,to:P?d.pos+1:void 0,options:UN(T,O,R),validFor:KN}}else return{from:g,options:R,validFor:qN}}}function YN(n){return n==dk?"type":n==hk?"keyword":"variable"}function GN(n,e,t){let r=Object.keys(n).map(i=>t(e?i.toUpperCase():i,YN(n[i])));return PD(["QuotedIdentifier","String","LineComment","BlockComment","."],nk(r))}let XN=_N.configure({props:[WS.add({Statement:zL()}),HS.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}}}),jS({Keyword:ie.keyword,Type:ie.typeName,Builtin:ie.standard(ie.name),Bits:ie.number,Bytes:ie.string,Bool:ie.bool,Null:ie.null,Number:ie.number,String:ie.string,Identifier:ie.name,QuotedIdentifier:ie.special(ie.string),SpecialVar:ie.special(ie.name),LineComment:ie.lineComment,BlockComment:ie.blockComment,Operator:ie.operator,"Semi Punctuation":ie.punctuation,"( )":ie.paren,"{ }":ie.brace,"[ ]":ie.squareBracket})]});class Lf{constructor(e,t,r){this.dialect=e,this.language=t,this.spec=r}get extension(){return this.language.extension}configureLanguage(e,t){return new Lf(this.dialect,this.language.configure(e,t),this.spec)}static define(e){let t=zN(e,e.keywords,e.types,e.builtin),r=bf.define({name:"sql",parser:XN.configure({tokenizers:[{from:gk,to:mk(t)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new Lf(t,r,e)}}function JN(n,e){return{label:n,type:e,boost:-1}}function ZN(n,e=!1,t){return GN(n.dialect.words,e,t||JN)}function e6(n){return n.schema?QN(n.schema,n.tables,n.schemas,n.defaultTable,n.defaultSchema,n.dialect||l0):()=>null}function t6(n){return n.schema?(n.dialect||l0).language.data.of({autocomplete:e6(n)}):[]}function n6(n={}){let e=n.dialect||l0;return new PL(e.language,[t6(n),e.language.data.of({autocomplete:ZN(e,n.upperCaseKeywords,n.keywordCompletion)})])}const l0=Lf.define({}),r6=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),r=c0(n.state,t.from);return r.line?i6(n):r.block?o6(n):!1};function a0(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 i6=a0(c6,0),s6=a0(vk,0),o6=a0((n,e)=>vk(n,e,a6(e)),0);function c0(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Gl=50;function l6(n,{open:e,close:t},r,i){let s=n.sliceDoc(r-Gl,r),l=n.sliceDoc(i,i+Gl),c=/\s*$/.exec(s)[0].length,u=/^\s*/.exec(l)[0].length,h=s.length-c;if(s.slice(h-e.length,h)==e&&l.slice(u,u+t.length)==t)return{open:{pos:r-c,margin:c&&1},close:{pos:i+u,margin:u&&1}};let d,m;i-r<=2*Gl?d=m=n.sliceDoc(r,i):(d=n.sliceDoc(r,r+Gl),m=n.sliceDoc(i-Gl,i));let g=/^\s*/.exec(d)[0].length,y=/\s*$/.exec(m)[0].length,x=m.length-y-t.length;return d.slice(g,g+e.length)==e&&m.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-y-t.length,margin:/\s/.test(m.charAt(x-1))?1:0}}:null}function a6(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 vk(n,e,t=e.selection.ranges){let r=t.map(s=>c0(e,s.from).block);if(!r.every(s=>s))return null;let i=t.map((s,l)=>l6(e,r[l],s.from,s.to));if(n!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,l)=>i[l]?[]:[{from:s.from,insert:r[l].open+" "},{from:s.to,insert:" "+r[l].close}]))};if(n!=1&&i.some(s=>s)){let s=[];for(let l=0,c;l<i.length;l++)if(c=i[l]){let u=r[l],{open:h,close:d}=c;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 c6(n,e,t=e.selection.ranges){let r=[],i=-1;for(let{from:s,to:l}of t){let c=r.length,u=1e9,h=c0(e,s).line;if(h){for(let d=s;d<=l;){let m=e.doc.lineAt(d);if(m.from>i&&(s==l||l>m.from)){i=m.from;let g=/^\s*/.exec(m.text)[0].length,y=g==m.length,x=m.text.slice(g,g+h.length)==h?g:-1;g<m.text.length&&g<u&&(u=g),r.push({line:m,comment:x,token:h,indent:g,empty:y,single:!1})}d=m.to+1}if(u<1e9)for(let d=c;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=u);r.length==c+1&&(r[c].single=!0)}}if(n!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:c,token:u,indent:h,empty:d,single:m}of r)(m||!d)&&s.push({from:c.from+h,insert:u+" "});let l=e.changes(s);return{changes:l,selection:e.selection.map(l,1)}}else if(n!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:l,comment:c,token:u}of r)if(c>=0){let h=l.from+c,d=h+u.length;l.text[d-l.from]==" "&&d++,s.push({from:h,to:d})}return{changes:s}}return null}const eg=Ci.define(),u6=Ci.define(),f6=ge.define(),xk=ge.define({combine(n){return Kr(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)})}}),wk=nn.define({create(){return Vr.empty},update(n,e){let t=e.state.facet(xk),r=e.annotation(eg);if(r){let u=Pn.fromTransaction(e,r.selection),h=r.side,d=h==0?n.undone:n.done;return u?d=Df(d,d.length,t.minDepth,u):d=kk(d,e.startState.selection),new Vr(h==0?r.rest:d,h==0?d:r.rest)}let i=e.annotation(u6);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(Vt.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=Pn.fromTransaction(e),l=e.annotation(Vt.time),c=e.annotation(Vt.userEvent);return s?n=n.addChanges(s,l,c,t,e):e.selection&&(n=n.addSelection(e.startState.selection,l,c,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 Vr(n.done.map(Pn.fromJSON),n.undone.map(Pn.fromJSON))}});function h6(n={}){return[wk,xk.of(n),de.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?bk:e.inputType=="historyRedo"?tg:null;return r?(e.preventDefault(),r(t)):!1}})]}function hh(n,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let i=t.field(wk,!1);if(!i)return!1;let s=i.pop(n,t,e);return s?(r(s),!0):!1}}const bk=hh(0,!1),tg=hh(1,!1),d6=hh(0,!0),p6=hh(1,!0);class Pn{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 Pn(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 Pn(e.changes&&Ft.fromJSON(e.changes),[],e.mapped&&$r.fromJSON(e.mapped),e.startSelection&&ee.fromJSON(e.startSelection),e.selectionsAfter.map(ee.fromJSON))}static fromTransaction(e,t){let r=ir;for(let i of e.startState.facet(f6)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new Pn(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,ir)}static selection(e){return new Pn(void 0,ir,void 0,void 0,e)}}function Df(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 m6(n,e){let t=[],r=!1;return n.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,l,c)=>{for(let u=0;u<t.length;){let h=t[u++],d=t[u++];c>=h&&l<=d&&(r=!0)}}),r}function g6(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function Sk(n,e){return n.length?e.length?n.concat(e):n:e}const ir=[],y6=200;function kk(n,e){if(n.length){let t=n[n.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-y6));return r.length&&r[r.length-1].eq(e)?n:(r.push(e),Df(n,n.length-1,1e9,t.setSelAfter(r)))}else return[Pn.selection([e])]}function v6(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 Up(n,e){if(!n.length)return n;let t=n.length,r=ir;for(;t;){let i=x6(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?[Pn.selection(r)]:ir}function x6(n,e,t){let r=Sk(n.selectionsAfter.length?n.selectionsAfter.map(c=>c.map(e)):ir,t);if(!n.changes)return Pn.selection(r);let i=n.changes.map(e),s=e.mapDesc(n.changes,!0),l=n.mapped?n.mapped.composeDesc(s):s;return new Pn(i,Ie.mapEffects(n.effects,e),l,n.startSelection.map(s),r)}const w6=/^(input\.type|delete)($|\.)/;class Vr{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 Vr(this.done,this.undone):this}addChanges(e,t,r,i,s){let l=this.done,c=l[l.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!r||w6.test(r))&&(!c.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,m6(c.changes,e.changes))||r=="input.type.compose")?l=Df(l,l.length-1,i.minDepth,new Pn(e.changes.compose(c.changes),Sk(Ie.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,ir)):l=Df(l,l.length,i.minDepth,e),new Vr(l,ir,t,r)}addSelection(e,t,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:ir;return s.length>0&&t-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&g6(s[s.length-1],e)?this:new Vr(kk(this.done,e),this.undone,t,r)}addMapping(e){return new Vr(Up(this.done,e),Up(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],l=s.selectionsAfter[0]||t.selection;if(r&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:eg.of({side:e,rest:v6(i),selection:l}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let c=i.length==1?ir:i.slice(0,i.length-1);return s.mapped&&(c=Up(c,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:eg.of({side:e,rest:c,selection:l}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Vr.empty=new Vr(ir,ir);const b6=[{key:"Mod-z",run:bk,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:tg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:tg,preventDefault:!0},{key:"Mod-u",run:d6,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:p6,preventDefault:!0}];function tl(n,e){return ee.create(n.ranges.map(e),n.mainIndex)}function Cr(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Er({state:n,dispatch:e},t){let r=tl(n.selection,t);return r.eq(n.selection,!0)?!1:(e(Cr(n,r)),!0)}function dh(n,e){return ee.cursor(e?n.to:n.from)}function Ck(n,e){return Er(n,t=>t.empty?n.moveByChar(t,e):dh(t,e))}function un(n){return n.textDirectionAt(n.state.selection.main.head)==st.LTR}const Ek=n=>Ck(n,!un(n)),Rk=n=>Ck(n,un(n));function Tk(n,e){return Er(n,t=>t.empty?n.moveByGroup(t,e):dh(t,e))}const S6=n=>Tk(n,!un(n)),k6=n=>Tk(n,un(n));function C6(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=Gt(n).resolveInner(e.head),i=t?je.closedBy:je.openedBy;for(let u=e.head;;){let h=t?r.childAfter(u):r.childBefore(u);if(!h)break;C6(n,h,i)?r=h:u=t?h.to:h.from}let s=r.type.prop(i),l,c;return s&&(l=t?Wr(n,r.from,1):Wr(n,r.to,-1))&&l.matched?c=t?l.end.to:l.end.from:c=t?r.to:r.from,ee.cursor(c,t?-1:1)}const E6=n=>Er(n,e=>ph(n.state,e,!un(n))),R6=n=>Er(n,e=>ph(n.state,e,un(n)));function Mk(n,e){return Er(n,t=>{if(!t.empty)return dh(t,e);let r=n.moveVertically(t,e);return r.head!=t.head?r:n.moveToLineBoundary(t,e)})}const Ok=n=>Mk(n,!1),Pk=n=>Mk(n,!0);function Ak(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 l=s(n);l!=null&&l.top&&(t=Math.max(l==null?void 0:l.top,t)),l!=null&&l.bottom&&(r=Math.max(l==null?void 0:l.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 Lk(n,e){let t=Ak(n),{state:r}=n,i=tl(r.selection,l=>l.empty?n.moveVertically(l,e,t.height):dh(l,e));if(i.eq(r.selection))return!1;let s;if(t.selfScroll){let l=n.coordsAtPos(r.selection.main.head),c=n.scrollDOM.getBoundingClientRect(),u=c.top+t.marginTop,h=c.bottom-t.marginBottom;l&&l.top>u&&l.bottom<h&&(s=de.scrollIntoView(i.main.head,{y:"start",yMargin:l.top-u}))}return n.dispatch(Cr(r,i),{effects:s}),!0}const Cw=n=>Lk(n,!1),ng=n=>Lk(n,!0);function hs(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=ee.cursor(r.from+s))}return i}const T6=n=>Er(n,e=>hs(n,e,!0)),M6=n=>Er(n,e=>hs(n,e,!1)),O6=n=>Er(n,e=>hs(n,e,!un(n))),P6=n=>Er(n,e=>hs(n,e,un(n))),A6=n=>Er(n,e=>ee.cursor(n.lineBlockAt(e.head).from,1)),L6=n=>Er(n,e=>ee.cursor(n.lineBlockAt(e.head).to,-1));function D6(n,e,t){let r=!1,i=tl(n.selection,s=>{let l=Wr(n,s.head,-1)||Wr(n,s.head,1)||s.head>0&&Wr(n,s.head-1,1)||s.head<n.doc.length&&Wr(n,s.head+1,-1);if(!l||!l.end)return s;r=!0;let c=l.start.from==s.head?l.end.to:l.end.from;return ee.cursor(c)});return r?(e(Cr(n,i)),!0):!1}const N6=({state:n,dispatch:e})=>D6(n,e);function cr(n,e){let t=tl(n.state.selection,r=>{let i=e(r);return ee.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Cr(n.state,t)),!0)}function Dk(n,e){return cr(n,t=>n.moveByChar(t,e))}const Nk=n=>Dk(n,!un(n)),Ik=n=>Dk(n,un(n));function Bk(n,e){return cr(n,t=>n.moveByGroup(t,e))}const I6=n=>Bk(n,!un(n)),B6=n=>Bk(n,un(n)),j6=n=>cr(n,e=>ph(n.state,e,!un(n))),F6=n=>cr(n,e=>ph(n.state,e,un(n)));function jk(n,e){return cr(n,t=>n.moveVertically(t,e))}const Fk=n=>jk(n,!1),zk=n=>jk(n,!0);function _k(n,e){return cr(n,t=>n.moveVertically(t,e,Ak(n).height))}const Ew=n=>_k(n,!1),Rw=n=>_k(n,!0),z6=n=>cr(n,e=>hs(n,e,!0)),_6=n=>cr(n,e=>hs(n,e,!1)),W6=n=>cr(n,e=>hs(n,e,!un(n))),V6=n=>cr(n,e=>hs(n,e,un(n))),H6=n=>cr(n,e=>ee.cursor(n.lineBlockAt(e.head).from)),$6=n=>cr(n,e=>ee.cursor(n.lineBlockAt(e.head).to)),Tw=({state:n,dispatch:e})=>(e(Cr(n,{anchor:0})),!0),Mw=({state:n,dispatch:e})=>(e(Cr(n,{anchor:n.doc.length})),!0),Ow=({state:n,dispatch:e})=>(e(Cr(n,{anchor:n.selection.main.anchor,head:0})),!0),Pw=({state:n,dispatch:e})=>(e(Cr(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),U6=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),q6=({state:n,dispatch:e})=>{let t=mh(n).map(({from:r,to:i})=>ee.range(r,Math.min(i+1,n.doc.length)));return e(n.update({selection:ee.create(t),userEvent:"select"})),!0},K6=({state:n,dispatch:e})=>{let t=tl(n.selection,r=>{let i=Gt(n),s=i.resolveStack(r.from,1);if(r.empty){let l=i.resolveStack(r.from,-1);l.node.from>=s.node.from&&l.node.to<=s.node.to&&(s=l)}for(let l=s;l;l=l.next){let{node:c}=l;if((c.from<r.from&&c.to>=r.to||c.to>r.to&&c.from<=r.from)&&l.next)return ee.range(c.to,c.from)}return r});return t.eq(n.selection)?!1:(e(Cr(n,t)),!0)};function Wk(n,e){let{state:t}=n,r=t.selection,i=t.selection.ranges.slice();for(let s of t.selection.ranges){let l=t.doc.lineAt(s.head);if(e?l.to<n.state.doc.length:l.from>0)for(let c=s;;){let u=n.moveVertically(c,e);if(u.head<l.from||u.head>l.to){i.some(h=>h.head==u.head)||i.push(u);break}else{if(u.head==c.head)break;c=u}}}return i.length==r.ranges.length?!1:(n.dispatch(Cr(t,ee.create(i,i.length-1))),!0)}const Q6=n=>Wk(n,!1),Y6=n=>Wk(n,!0),G6=({state:n,dispatch:e})=>{let t=n.selection,r=null;return t.ranges.length>1?r=ee.create([t.main]):t.main.empty||(r=ee.create([ee.cursor(t.main.head)])),r?(e(Cr(n,r)),!0):!1};function Ga(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:r}=n,i=r.changeByRange(s=>{let{from:l,to:c}=s;if(l==c){let u=e(s);u<l?(t="delete.backward",u=Du(n,u,!1)):u>l&&(t="delete.forward",u=Du(n,u,!0)),l=Math.min(l,u),c=Math.max(c,u)}else l=Du(n,l,!1),c=Du(n,c,!0);return l==c?{range:s}:{changes:{from:l,to:c},range:ee.cursor(l,l<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 Du(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 Vk=(n,e,t)=>Ga(n,r=>{let i=r.from,{state:s}=n,l=s.doc.lineAt(i),c,u;if(t&&!e&&i>l.from&&i<l.from+200&&!/[^ \t]/.test(c=l.text.slice(0,i-l.from))){if(c[c.length-1]==" ")return i-1;let h=el(c,s.tabSize),d=h%kf(s)||kf(s);for(let m=0;m<d&&c[c.length-1-m]==" ";m++)i--;u=i}else u=Wt(l.text,i-l.from,e,e)+l.from,u==i&&l.number!=(e?s.doc.lines:1)?u+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(l.text.slice(u-l.from,i-l.from))&&(u=Wt(l.text,u-l.from,!1,!1)+l.from);return u}),rg=n=>Vk(n,!1,!0),Hk=n=>Vk(n,!0,!1),$k=(n,e)=>Ga(n,t=>{let r=t.head,{state:i}=n,s=i.doc.lineAt(r),l=i.charCategorizer(r);for(let c=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=Wt(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=l(h);if(c!=null&&d!=c)break;(h!=" "||r!=t.head)&&(c=d),r=u}return r}),Uk=n=>$k(n,!1),X6=n=>$k(n,!0),J6=n=>Ga(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),Z6=n=>Ga(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),eI=n=>Ga(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),tI=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Ke.of(["",""])},range:ee.cursor(r.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},nI=({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),l=i==s.from?i-1:Wt(s.text,i-s.from,!1)+s.from,c=i==s.to?i+1:Wt(s.text,i-s.from,!0)+s.from;return{changes:{from:l,to:c,insert:n.doc.slice(i,c).append(n.doc.slice(l,i))},range:ee.cursor(c)}});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 l=e[e.length-1];l.to=s.to,l.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});t=s.number+1}return e}function qk(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 l=n.doc.lineAt(t?s.to+1:s.from-1),c=l.length+1;if(t){r.push({from:s.to,to:l.to},{from:s.from,insert:l.text+n.lineBreak});for(let u of s.ranges)i.push(ee.range(Math.min(n.doc.length,u.anchor+c),Math.min(n.doc.length,u.head+c)))}else{r.push({from:l.from,to:s.from},{from:s.to,insert:n.lineBreak+l.text});for(let u of s.ranges)i.push(ee.range(u.anchor-c,u.head-c))}}return r.length?(e(n.update({changes:r,scrollIntoView:!0,selection:ee.create(i,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rI=({state:n,dispatch:e})=>qk(n,e,!1),iI=({state:n,dispatch:e})=>qk(n,e,!0);function Kk(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 sI=({state:n,dispatch:e})=>Kk(n,e,!1),oI=({state:n,dispatch:e})=>Kk(n,e,!0),lI=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=tl(e.selection,i=>{let s;if(n.lineWrapping){let l=n.lineBlockAt(i.head),c=n.coordsAtPos(i.head,i.assoc||1);c&&(s=l.bottom+n.documentTop-c.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 aI(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Gt(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(je.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 Aw=Qk(!1),cI=Qk(!0);function Qk(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:l}=i,c=e.doc.lineAt(s),u=!n&&s==l&&aI(e,s);n&&(s=l=(l<=c.to?c:e.doc.lineAt(l)).to);let h=new ah(e,{simulateBreak:s,simulateDoubleBreak:!!u}),d=t0(h,s);for(d==null&&(d=el(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));l<c.to&&/\s/.test(c.text[l-c.from]);)l++;u?{from:s,to:l}=u:s>c.from&&s<c.from+100&&!/\S/.test(c.text.slice(0,s))&&(s=c.from);let m=["",Aa(e,d)];return u&&m.push(Aa(e,h.lineIndent(c.from,-1))),{changes:{from:s,to:l,insert:Ke.of(m)},range:ee.cursor(s+1+m[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function u0(n,e){let t=-1;return n.changeByRange(r=>{let i=[];for(let l=r.from;l<=r.to;){let c=n.doc.lineAt(l);c.number>t&&(r.empty||r.to>c.from)&&(e(c,i,r),t=c.number),l=c.to+1}let s=n.changes(i);return{changes:i,range:ee.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const uI=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),r=new ah(n,{overrideIndentation:s=>{let l=t[s];return l??-1}}),i=u0(n,(s,l,c)=>{let u=t0(r,s.from);if(u==null)return;/\S/.test(s.text)||(u=0);let h=/^\s*/.exec(s.text)[0],d=Aa(n,u);(h!=d||c.from<s.from+h.length)&&(t[s.from]=u,l.push({from:s.from,to:s.from+h.length,insert:d}))});return i.changes.empty||e(n.update(i,{userEvent:"indent"})),!0},fI=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(u0(n,(t,r)=>{r.push({from:t.from,insert:n.facet(e0)})}),{userEvent:"input.indent"})),!0),hI=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(u0(n,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=el(i,n.tabSize),l=0,c=Aa(n,Math.max(0,s-kf(n)));for(;l<i.length&&l<c.length&&i.charCodeAt(l)==c.charCodeAt(l);)l++;r.push({from:t.from+l,to:t.from+i.length,insert:c.slice(l)})}),{userEvent:"delete.dedent"})),!0),dI=n=>(n.setTabFocusMode(),!0),pI=[{key:"Ctrl-b",run:Ek,shift:Nk,preventDefault:!0},{key:"Ctrl-f",run:Rk,shift:Ik},{key:"Ctrl-p",run:Ok,shift:Fk},{key:"Ctrl-n",run:Pk,shift:zk},{key:"Ctrl-a",run:A6,shift:H6},{key:"Ctrl-e",run:L6,shift:$6},{key:"Ctrl-d",run:Hk},{key:"Ctrl-h",run:rg},{key:"Ctrl-k",run:J6},{key:"Ctrl-Alt-h",run:Uk},{key:"Ctrl-o",run:tI},{key:"Ctrl-t",run:nI},{key:"Ctrl-v",run:ng}],mI=[{key:"ArrowLeft",run:Ek,shift:Nk,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:S6,shift:I6,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:O6,shift:W6,preventDefault:!0},{key:"ArrowRight",run:Rk,shift:Ik,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:k6,shift:B6,preventDefault:!0},{mac:"Cmd-ArrowRight",run:P6,shift:V6,preventDefault:!0},{key:"ArrowUp",run:Ok,shift:Fk,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Tw,shift:Ow},{mac:"Ctrl-ArrowUp",run:Cw,shift:Ew},{key:"ArrowDown",run:Pk,shift:zk,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Mw,shift:Pw},{mac:"Ctrl-ArrowDown",run:ng,shift:Rw},{key:"PageUp",run:Cw,shift:Ew},{key:"PageDown",run:ng,shift:Rw},{key:"Home",run:M6,shift:_6,preventDefault:!0},{key:"Mod-Home",run:Tw,shift:Ow},{key:"End",run:T6,shift:z6,preventDefault:!0},{key:"Mod-End",run:Mw,shift:Pw},{key:"Enter",run:Aw,shift:Aw},{key:"Mod-a",run:U6},{key:"Backspace",run:rg,shift:rg,preventDefault:!0},{key:"Delete",run:Hk,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Uk,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:X6,preventDefault:!0},{mac:"Mod-Backspace",run:Z6,preventDefault:!0},{mac:"Mod-Delete",run:eI,preventDefault:!0}].concat(pI.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),Yk=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:E6,shift:j6},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:R6,shift:F6},{key:"Alt-ArrowUp",run:rI},{key:"Shift-Alt-ArrowUp",run:sI},{key:"Alt-ArrowDown",run:iI},{key:"Shift-Alt-ArrowDown",run:oI},{key:"Mod-Alt-ArrowUp",run:Q6},{key:"Mod-Alt-ArrowDown",run:Y6},{key:"Escape",run:G6},{key:"Mod-Enter",run:cI},{key:"Alt-l",mac:"Ctrl-l",run:q6},{key:"Mod-i",run:K6,preventDefault:!0},{key:"Mod-[",run:hI},{key:"Mod-]",run:fI},{key:"Mod-Alt-\\",run:uI},{key:"Shift-Mod-k",run:lI},{key:"Shift-Mod-\\",run:N6},{key:"Mod-/",run:r6},{key:"Alt-A",run:s6},{key:"Ctrl-m",mac:"Shift-Alt-m",run:dI}].concat(mI),Lw=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class Uo{constructor(e,t,r=0,i=e.length,s,l){this.test=l,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?c=>s(Lw(c)):Lw,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 Rn(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=Dg(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=zr(e);let i=this.normalize(t);if(i.length)for(let s=0,l=r;;s++){let c=i.charCodeAt(s),u=this.match(c,l,this.bufferPos+this.bufferStart);if(s==i.length-1){if(u)return this.value=u,this;break}l==r&&s<t.length&&t.charCodeAt(s)==c&&l++}}}match(e,t,r){let i=null;for(let s=0;s<this.matches.length;s+=2){let l=this.matches[s],c=!1;this.query.charCodeAt(l)==e&&(l==this.query.length-1?i={from:this.matches[s+1],to:r}:(this.matches[s]++,c=!0)),c||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:t,to:r}:this.matches.push(1,t)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(Uo.prototype[Symbol.iterator]=function(){return this});const Gk={from:-1,to:-1,match:/.*/.exec("")},f0="gm"+(/x/.unicode==null?"":"u");class Xk{constructor(e,t,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=Gk,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Jk(e,t,r,i,s);this.re=new RegExp(t,f0+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let l=e.lineAt(i);this.curLineStart=l.from,this.matchPos=Nf(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=Nf(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,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 qp=new WeakMap;class No{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let i=qp.get(e);if(!i||i.from>=r||i.to<=t){let c=new No(t,e.sliceString(t,r));return qp.set(e,c),c}if(i.from==t&&i.to==r)return i;let{text:s,from:l}=i;return l>t&&(s=e.sliceString(t,l)+s,l=t),i.to<r&&(s+=e.sliceString(i.to,r)),qp.set(e,new No(l,s)),new No(t,s.slice(t-l,r-l))}}class Jk{constructor(e,t,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=Gk,this.matchPos=Nf(e,i),this.re=new RegExp(t,f0+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=No.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,match:t},this.matchPos=Nf(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=No.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Xk.prototype[Symbol.iterator]=Jk.prototype[Symbol.iterator]=function(){return this});function gI(n){try{return new RegExp(n,f0),!0}catch{return!1}}function Nf(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}function ig(n){let e=String(n.state.doc.lineAt(n.state.selection.main.head).number),t=rt("input",{class:"cm-textfield",name:"line",value:e}),r=rt("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:da.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},rt("label",n.state.phrase("Go to line"),": ",t)," ",rt("button",{class:"cm-button",type:"submit"},n.state.phrase("go")),rt("button",{name:"close",onclick:()=>{n.dispatch({effects:da.of(!1)}),n.focus()},"aria-label":n.state.phrase("close"),type:"button"},["×"]));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:l}=n,c=l.doc.lineAt(l.selection.main.head),[,u,h,d,m]=s,g=d?+d.slice(1):0,y=h?+h:c.number;if(h&&m){let k=y/100;u&&(k=k*(u=="-"?-1:1)+c.number/l.doc.lines),y=Math.round(l.doc.lines*k)}else h&&u&&(y=y*(u=="-"?-1:1)+c.number);let x=l.doc.line(Math.max(1,Math.min(l.doc.lines,y))),b=ee.cursor(x.from+Math.max(0,Math.min(g,x.length)));n.dispatch({effects:[da.of(!1),de.scrollIntoView(b.from,{y:"center"})],selection:b}),n.focus()}return{dom:r}}const da=Ie.define(),Dw=nn.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(da)&&(n=t.value);return n},provide:n=>Ma.from(n,e=>e?ig:null)}),yI=n=>{let e=Ta(n,ig);if(!e){let t=[da.of(!0)];n.state.field(Dw,!1)==null&&t.push(Ie.appendConfig.of([Dw,vI])),n.dispatch({effects:t}),e=Ta(n,ig)}return e&&e.dom.querySelector("input").select(),!0},vI=de.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),xI={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},wI=ge.define({combine(n){return Kr(n,xI,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function bI(n){return[RI,EI]}const SI=Ce.mark({class:"cm-selectionMatch"}),kI=Ce.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Nw(n,e,t,r){return(t==0||n(e.sliceDoc(t-1,t))!=pt.Word)&&(r==e.doc.length||n(e.sliceDoc(r,r+1))!=pt.Word)}function CI(n,e,t,r){return n(e.sliceDoc(t,t+1))==pt.Word&&n(e.sliceDoc(r-1,r))==pt.Word}const EI=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(wI),{state:t}=n,r=t.selection;if(r.ranges.length>1)return Ce.none;let i=r.main,s,l=null;if(i.empty){if(!e.highlightWordAroundCursor)return Ce.none;let u=t.wordAt(i.head);if(!u)return Ce.none;l=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 Ce.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),l=t.charCategorizer(i.head),!(Nw(l,t,i.from,i.to)&&CI(l,t,i.from,i.to)))return Ce.none}else if(s=t.sliceDoc(i.from,i.to),!s)return Ce.none}let c=[];for(let u of n.visibleRanges){let h=new Uo(t.doc,s,u.from,u.to);for(;!h.next().done;){let{from:d,to:m}=h.value;if((!l||Nw(l,t,d,m))&&(i.empty&&d<=i.from&&m>=i.to?c.push(kI.range(d,m)):(d>=i.to||m<=i.from)&&c.push(SI.range(d,m)),c.length>e.maxMatches))return Ce.none}}return Ce.set(c)}},{decorations:n=>n.decorations}),RI=de.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),TI=({state:n,dispatch:e})=>{let{selection:t}=n,r=ee.create(t.ranges.map(i=>n.wordAt(i.head)||ee.cursor(i.head)),t.mainIndex);return r.eq(t)?!1:(e(n.update({selection:r})),!0)};function MI(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 l=!1,c=new Uo(n.doc,e,r[r.length-1].to);;)if(c.next(),c.done){if(l)return null;c=new Uo(n.doc,e,0,Math.max(0,r[r.length-1].from-1)),l=!0}else{if(l&&r.some(u=>u.from==c.value.from))continue;if(s){let u=n.wordAt(c.value.from);if(!u||u.from!=c.value.from||u.to!=c.value.to)continue}return c.value}}const OI=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return TI({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=MI(n,r);return i?(e(n.update({selection:n.selection.addRange(ee.range(i.from,i.to),!1),effects:de.scrollIntoView(i.to)})),!0):!1},nl=ge.define({combine(n){return Kr(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new WI(e),scrollToMatch:e=>de.scrollIntoView(e)})}});class Zk{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||gI(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}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}create(){return this.regexp?new DI(this):new AI(this)}getCursor(e,t=0,r){let i=e.doc?e:We.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?bo(this,i,t,r):wo(this,i,t,r)}}class eC{constructor(e){this.spec=e}}function wo(n,e,t,r){return new Uo(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:i=>i.toLowerCase(),n.wholeWord?PI(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function PI(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(If(i,t-s))!=pt.Word||e(Bf(i,t-s))!=pt.Word)&&(e(Bf(i,r-s))!=pt.Word||e(If(i,r-s))!=pt.Word))}class AI extends eC{constructor(e){super(e)}nextMatch(e,t,r){let i=wo(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=wo(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),l=wo(this.spec,e,s,i),c=null;for(;!l.nextOverlapping().done;)c=l.value;if(c)return c;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=wo(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=wo(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 bo(n,e,t,r){return new Xk(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?LI(e.charCategorizer(e.selection.main.head)):void 0},t,r)}function If(n,e){return n.slice(Wt(n,e,!1),e)}function Bf(n,e){return n.slice(e,Wt(n,e))}function LI(n){return(e,t,r)=>!r[0].length||(n(If(r.input,r.index))!=pt.Word||n(Bf(r.input,r.index))!=pt.Word)&&(n(Bf(r.input,r.index+r[0].length))!=pt.Word||n(If(r.input,r.index+r[0].length))!=pt.Word)}class DI extends eC{nextMatch(e,t,r){let i=bo(this.spec,e,r,e.doc.length).next();return i.done&&(i=bo(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),l=bo(this.spec,e,s,r),c=null;for(;!l.next().done;)c=l.value;if(c&&(s==t||c.from>s+10))return c;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=bo(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=bo(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 Ia=Ie.define(),h0=Ie.define(),ns=nn.define({create(n){return new Kp(sg(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Ia)?n=new Kp(t.value.create(),n.panel):t.is(h0)&&(n=new Kp(n.query,t.value?d0:null));return n},provide:n=>Ma.from(n,e=>e.panel)});class Kp{constructor(e,t){this.query=e,this.panel=t}}const NI=Ce.mark({class:"cm-searchMatch"}),II=Ce.mark({class:"cm-searchMatch cm-searchMatch-selected"}),BI=Mt.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(ns))}update(n){let e=n.state.field(ns);(e!=n.startState.field(ns)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Ce.none;let{view:t}=this,r=new xi;for(let i=0,s=t.visibleRanges,l=s.length;i<l;i++){let{from:c,to:u}=s[i];for(;i<l-1&&u>s[i+1].from-2*250;)u=s[++i].to;n.highlight(t.state,c,u,(h,d)=>{let m=t.state.selection.ranges.some(g=>g.from==h&&g.to==d);r.add(h,d,m?II:NI)})}return r.finish()}},{decorations:n=>n.decorations});function Xa(n){return e=>{let t=e.state.field(ns,!1);return t&&t.query.spec.valid?n(e,t):rC(e)}}const jf=Xa((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=ee.single(r.from,r.to),s=n.state.facet(nl);return n.dispatch({selection:i,effects:[p0(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),nC(n),!0}),Ff=Xa((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i)return!1;let s=ee.single(i.from,i.to),l=n.state.facet(nl);return n.dispatch({selection:s,effects:[p0(n,i),l.scrollToMatch(s.main,n)],userEvent:"select.search"}),nC(n),!0}),jI=Xa((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:ee.create(t.map(r=>ee.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),FI=({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=[],l=0;for(let c=new Uo(n.doc,n.sliceDoc(r,i));!c.next().done;){if(s.length>1e3)return!1;c.value.from==r&&(l=s.length),s.push(ee.range(c.value.from,c.value.to))}return e(n.update({selection:ee.create(s,l),userEvent:"select.search.matches"})),!0},Iw=Xa((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 l=s,c=[],u,h,d=[];l.from==r&&l.to==i&&(h=t.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:h}),l=e.nextMatch(t,l.from,l.to),d.push(de.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+".")));let m=n.state.changes(c);return l&&(u=ee.single(l.from,l.to).map(m),d.push(p0(n,l)),d.push(t.facet(nl).scrollToMatch(u.main,n))),n.dispatch({changes:m,selection:u,effects:d,userEvent:"input.replace"}),!0}),zI=Xa((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(i=>{let{from:s,to:l}=i;return{from:s,to:l,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 d0(n){return n.state.facet(nl).createPanel(n)}function sg(n,e){var t,r,i,s,l;let c=n.selection.main,u=c.empty||c.to>c.from+100?"":n.sliceDoc(c.from,c.to);if(e&&!u)return e;let h=n.facet(nl);return new Zk({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:(l=e==null?void 0:e.wholeWord)!==null&&l!==void 0?l:h.wholeWord})}function tC(n){let e=Ta(n,d0);return e&&e.dom.querySelector("[main-field]")}function nC(n){let e=tC(n);e&&e==n.root.activeElement&&e.select()}const rC=n=>{let e=n.state.field(ns,!1);if(e&&e.panel){let t=tC(n);if(t&&t!=n.root.activeElement){let r=sg(n.state,e.query.spec);r.valid&&n.dispatch({effects:Ia.of(r)}),t.focus(),t.select()}}else n.dispatch({effects:[h0.of(!0),e?Ia.of(sg(n.state,e.query.spec)):Ie.appendConfig.of(HI)]});return!0},iC=n=>{let e=n.state.field(ns,!1);if(!e||!e.panel)return!1;let t=Ta(n,d0);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:h0.of(!1)}),!0},_I=[{key:"Mod-f",run:rC,scope:"editor search-panel"},{key:"F3",run:jf,shift:Ff,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:jf,shift:Ff,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:iC,scope:"editor search-panel"},{key:"Mod-Shift-l",run:FI},{key:"Mod-Alt-g",run:yI},{key:"Mod-d",run:OI,preventDefault:!0}];class WI{constructor(e){this.view=e;let t=this.query=e.state.field(ns).query.spec;this.commit=this.commit.bind(this),this.searchField=rt("input",{value:t.search,placeholder:Fn(e,"Find"),"aria-label":Fn(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:Fn(e,"Replace"),"aria-label":Fn(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,l){return rt("button",{class:"cm-button",name:i,onclick:s,type:"button"},l)}this.dom=rt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>jf(e),[Fn(e,"next")]),r("prev",()=>Ff(e),[Fn(e,"previous")]),r("select",()=>jI(e),[Fn(e,"all")]),rt("label",null,[this.caseField,Fn(e,"match case")]),rt("label",null,[this.reField,Fn(e,"regexp")]),rt("label",null,[this.wordField,Fn(e,"by word")]),...e.state.readOnly?[]:[rt("br"),this.replaceField,r("replace",()=>Iw(e),[Fn(e,"replace")]),r("replaceAll",()=>zI(e),[Fn(e,"replace all")])],rt("button",{name:"close",onclick:()=>iC(e),"aria-label":Fn(e,"close"),type:"button"},["×"])])}commit(){let e=new Zk({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:Ia.of(e)}))}keydown(e){a8(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ff:jf)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Iw(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(Ia)&&!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(nl).top}}function Fn(n,e){return n.state.phrase(e)}const Nu=30,Iu=/[\s\.,:;?!]/;function p0(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-Nu),l=Math.min(i,t+Nu),c=n.state.sliceDoc(s,l);if(s!=r.from){for(let u=0;u<Nu;u++)if(!Iu.test(c[u+1])&&Iu.test(c[u])){c=c.slice(u);break}}if(l!=i){for(let u=c.length-1;u>c.length-Nu;u--)if(!Iu.test(c[u-1])&&Iu.test(c[u])){c=c.slice(0,u);break}}return de.announce.of(`${n.state.phrase("current match")}. ${c} ${n.state.phrase("on line")} ${r.number}.`)}const VI=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"}}),HI=[ns,fs.low(BI),VI];class Bw{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class Is{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let i=r.facet(Ba).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((y,x)=>y.from-x.from||y.to-x.to),l=new xi,c=[],u=0,h=r.doc.iter(),d=0,m=r.doc.length;for(let y=0;;){let x=y==s.length?null:s[y];if(!x&&!c.length)break;let b,k;if(c.length)b=u,k=c.reduce((O,P)=>Math.min(O,P.to),x&&x.from>b?x.from:1e8);else{if(b=x.from,b>m)break;k=x.to,c.push(x),y++}for(;y<s.length;){let O=s[y];if(O.from==b&&(O.to>O.from||O.to==b))c.push(O),y++,k=Math.min(O.to,k);else{k=Math.min(O.from,k);break}}k=Math.min(k,m);let R=!1;if(c.some(O=>O.from==b&&(O.to==k||k==m))&&(R=b==k,!R&&k-b<10)){let O=b-(d+h.value.length);O>0&&(h.next(O),d=b);for(let P=b;;){if(P>=k){R=!0;break}if(!h.lineBreak&&d+h.value.length>P)break;P=d+h.value.length,d+=h.value.length,h.next()}}let T=n9(c);if(R)l.add(b,b,Ce.widget({widget:new JI(T),diagnostics:c.slice()}));else{let O=c.reduce((P,N)=>N.markClass?P+" "+N.markClass:P,"");l.add(b,k,Ce.mark({class:"cm-lintRange cm-lintRange-"+T+O,diagnostics:c.slice(),inclusiveEnd:c.some(P=>P.to>k)}))}if(u=k,u==m)break;for(let O=0;O<c.length;O++)c[O].to<=u&&c.splice(O--,1)}let g=l.finish();return new Is(g,t,qo(g))}}function qo(n,e=null,t=0){let r=null;return n.between(t,1e9,(i,s,{spec:l})=>{if(!(e&&l.diagnostics.indexOf(e)<0))if(!r)r=new Bw(i,s,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Bw(r.from,s,r.diagnostic)}}),r}function $I(n,e){let t=e.pos,r=e.end||t,i=n.state.facet(Ba).hideOn(n,t,r);if(i!=null)return i;let s=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(l=>l.is(sC))||n.changes.touchesRange(s.from,Math.max(s.to,r)))}function UI(n,e){return n.field(Hn,!1)?e:e.concat(Ie.appendConfig.of(r9))}const sC=Ie.define(),m0=Ie.define(),oC=Ie.define(),Hn=nn.define({create(){return new Is(Ce.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=qo(t,n.selected.diagnostic,s)||qo(t,null,s)}!t.size&&i&&e.state.facet(Ba).autoPanel&&(i=null),n=new Is(t,i,r)}for(let t of e.effects)if(t.is(sC)){let r=e.state.facet(Ba).autoPanel?t.value.length?ja.open:null:n.panel;n=Is.init(t.value,r,e.state)}else t.is(m0)?n=new Is(n.diagnostics,t.value?ja.open:null,n.selected):t.is(oC)&&(n=new Is(n.diagnostics,n.panel,t.value));return n},provide:n=>[Ma.from(n,e=>e.panel),de.decorations.from(n,e=>e.diagnostics)]}),qI=Ce.mark({class:"cm-lintRange cm-lintRange-active"});function KI(n,e,t){let{diagnostics:r}=n.state.field(Hn),i,s=-1,l=-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,l=h,!1});let c=n.state.facet(Ba).tooltipFilter;return i&&c&&(i=c(i,n.state)),i?{pos:s,end:l,above:n.state.doc.lineAt(s).to<l,create(){return{dom:QI(n,i)}}}:null}function QI(n,e){return rt("ul",{class:"cm-tooltip-lint"},e.map(t=>aC(n,t,!1)))}const YI=n=>{let e=n.state.field(Hn,!1);(!e||!e.panel)&&n.dispatch({effects:UI(n.state,[m0.of(!0)])});let t=Ta(n,ja.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},jw=n=>{let e=n.state.field(Hn,!1);return!e||!e.panel?!1:(n.dispatch({effects:m0.of(!1)}),!0)},GI=n=>{let e=n.state.field(Hn,!1);if(!e)return!1;let t=n.state.selection.main,r=e.diagnostics.iter(t.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==t.from&&r.to==t.to)?!1:(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},XI=[{key:"Mod-Shift-m",run:YI,preventDefault:!0},{key:"F8",run:GI}],Ba=ge.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...Kr(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Fw,tooltipFilter:Fw,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 Fw(n,e){return n?e?(t,r)=>e(n(t,r),r):n:e}function lC(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 aC(n,e,t){var r;let i=t?lC(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,l)=>{let c=!1,u=y=>{if(y.preventDefault(),c)return;c=!0;let x=qo(n.state.field(Hn).diagnostics,e);x&&s.apply(n,x.from,x.to)},{name:h}=s,d=i[l]?h.indexOf(i[l]):-1,m=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[l]})"`}.`},m)}),e.source&&rt("div",{class:"cm-diagnosticSource"},e.source))}class JI extends Qr{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 zw{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=aC(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ja{constructor(e){this.view=e,this.items=[];let t=i=>{if(i.keyCode==27)jw(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],l=lC(s.actions);for(let c=0;c<l.length;c++)if(l[c].toUpperCase().charCodeAt(0)==i.keyCode){let u=qo(this.view.state.field(Hn).diagnostics,s);u&&s.actions[c].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:()=>jw(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Hn).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(Hn),r=0,i=!1,s=null,l=new Set;for(e.between(0,this.view.state.doc.length,(c,u,{spec:h})=>{for(let d of h.diagnostics){if(l.has(d))continue;l.add(d);let m=-1,g;for(let y=r;y<this.items.length;y++)if(this.items[y].diagnostic==d){m=y;break}m<0?(g=new zw(this.view,d),this.items.splice(r,0,g),i=!0):(g=this.items[m],m>r&&(this.items.splice(r,m-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 zw(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:c,panel:u})=>{let h=u.height/this.list.offsetHeight;c.top<u.top?this.list.scrollTop-=(u.top-c.top)/h:c.bottom>u.bottom&&(this.list.scrollTop+=(c.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(Hn),r=qo(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:oC.of(r)})}static open(e){return new ja(e)}}function ZI(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 Bu(n){return ZI(`<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 e9=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:Bu("#d11")},".cm-lintRange-warning":{backgroundImage:Bu("orange")},".cm-lintRange-info":{backgroundImage:Bu("#999")},".cm-lintRange-hint":{backgroundImage:Bu("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function t9(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function n9(n){let e="hint",t=1;for(let r of n){let i=t9(r.severity);i>t&&(t=i,e=r.severity)}return e}const r9=[Hn,de.decorations.compute([Hn],n=>{let{selected:e,panel:t}=n.field(Hn);return!e||!t||e.from==e.to?Ce.none:Ce.set([qI.range(e.from,e.to)])}),G8(KI,{hideOn:$I}),e9],i9=[lL(),uL(),E8(),h6(),eD(),p8(),x8(),We.allowMultipleSelections.of(!0),WL(),nD(sD,{fallback:!0}),hD(),nN(),dN(),z8(),V8(),A8(),bI(),Ea.of([...oN,...Yk,..._I,...b6,...GL,...fk,...XI])],s9=S.forwardRef(function({value:e,onChange:t,onRunShortcut:r,disabled:i=!1,readOnly:s=!1,placeholder:l="Enter SQL statement..."},c){const u=S.useRef(null),h=S.useRef(null),d=S.useRef(r),m=S.useRef(i);return S.useEffect(()=>{d.current=r,m.current=i},[r,i]),S.useImperativeHandle(c,()=>({getSelectedSql:()=>{const g=h.current;if(!g)return"";const{from:y,to:x}=g.state.selection.main;return y!==x?g.state.sliceDoc(y,x):g.state.doc.toString()}}),[]),S.useEffect(()=>{if(!u.current)return;const g=fs.highest(Ea.of([{key:"Mod-Enter",run:()=>(!m.current&&d.current&&d.current(),!0)}])),y=[i9,n6(),Ea.of(Yk),I8(l),g,de.theme({"&":{fontSize:"14px",fontFamily:"ui-monospace, monospace"},".cm-content":{padding:"12px",minHeight:"120px"},".cm-focused":{outline:"none"},".cm-scroller":{overflow:"auto"}})];s?(y.push(We.readOnly.of(!0)),y.push(de.editable.of(!1))):t&&y.push(de.updateListener.of(k=>{k.docChanged&&t(k.state.doc.toString())}));const x=We.create({doc:e,extensions:y}),b=new de({state:x,parent:u.current});return h.current=b,()=>{b.destroy(),h.current=null}},[s,l,t]),S.useEffect(()=>{const g=h.current;if(!g)return;const y=g.state.doc.toString();y!==e&&g.dispatch({changes:{from:0,to:y.length,insert:e}})},[e]),C.jsx("div",{ref:u,className:"border border-border rounded-lg bg-background overflow-hidden"})});let _w=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 o9={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},g0={valid(n){return n===null?null:n?{[_w.valid]:""}:{[_w.invalid]:""}}},l9=S.createContext({invalid:void 0,name:void 0,validityData:{state:o9,errors:[],error:"",value:"",initialValue:null},setValidityData:Vn,disabled:void 0,touched:!1,setTouched:Vn,dirty:!1,setDirty:Vn,filled:!1,setFilled:Vn,focused:!1,setFocused:Vn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(n=cn)=>n,getInputValidationProps:(n=cn)=>n,inputRef:{current:null},commit:async()=>{}}});function zf(n=!0){const e=S.useContext(l9);if(e.setValidityData===Vn&&!n)throw new Error(Un(28));return e}const a9=S.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Vn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function cC(){return S.useContext(a9)}const c9=S.createContext({controlId:void 0,setControlId:Vn,labelId:void 0,setLabelId:Vn,messageIds:[],setMessageIds:Vn,getDescriptionProps:n=>n});function y0(){return S.useContext(c9)}function u9(n,e){return{...n,state:{...n.state,valid:!e&&n.state.valid}}}function uC({controlled:n,default:e,name:t,state:r="value"}){const{current:i}=S.useRef(n!==void 0),[s,l]=S.useState(e),c=i?n:s,u=S.useCallback(h=>{i||l(h)},[]);return[c,u]}function f9(n={}){const{id:e,implicit:t=!1,controlRef:r}=n,{controlId:i,setControlId:s}=y0(),l=af(e);return Le(()=>{if(!(!t&&!e||s===Vn)){if(t){const c=r==null?void 0:r.current;Je(c)&&c.closest("label")!=null?s(e??null):s(i??l)}else e&&s(e);return()=>{e&&s(void 0)}}},[e,r,i,s,t,l]),i??l}function fC(n){const{enabled:e=!0,value:t,id:r,name:i,controlRef:s,commit:l}=n,{formRef:c}=cC(),{invalid:u,markedDirtyRef:h,validityData:d,setValidityData:m}=zf(),g=Ee(n.getValue);Le(()=>{if(!e)return;let y=t;y===void 0&&(y=g()),d.initialValue===null&&y!==null&&m(x=>({...x,initialValue:y}))},[e,m,t,d.initialValue,g]),Le(()=>{!e||!r||c.current.fields.set(r,{getValue:g,name:i,controlRef:s,validityData:u9(d,u),validate(){let y=t;y===void 0&&(y=g()),h.current=!0,Ur.flushSync(()=>l(y))}})},[l,s,e,c,g,r,u,h,i,d,t]),Le(()=>{const y=c.current.fields;return()=>{r&&y.delete(r)}},[c,r])}const h9=S.forwardRef(function(e,t){const{render:r,className:i,id:s,name:l,value:c,disabled:u=!1,onValueChange:h,defaultValue:d,...m}=e,{state:g,name:y,disabled:x}=zf(),b=x||u,k=y??l,R=S.useMemo(()=>({...g,disabled:b}),[g,b]),{setTouched:T,setDirty:O,validityData:P,setFocused:N,setFilled:I,validationMode:B,validation:W}=zf(),{labelId:Z}=y0(),X=f9({id:s});Le(()=>{var H;const q=c!=null;(H=W.inputRef.current)!=null&&H.value||q&&c!==""?I(!0):q&&c===""&&I(!1)},[W.inputRef,I,c]);const[Q,U]=uC({controlled:c,default:d,name:"FieldControl",state:"value"}),j=c!==void 0,Y=Ee((q,H)=>{h==null||h(q,H),!H.isCanceled&&U(q)});return fC({id:X,name:k,commit:W.commit,value:Q,getValue:()=>{var q;return(q=W.inputRef.current)==null?void 0:q.value},controlRef:W.inputRef}),vn("input",e,{ref:t,state:R,props:[{id:X,disabled:b,name:k,ref:W.inputRef,"aria-labelledby":Z,...j?{value:Q}:{defaultValue:d},onChange(q){const H=q.currentTarget.value;Y(H,zt($a,q.nativeEvent)),O(H!==P.initialValue),I(H!=="")},onFocus(){N(!0)},onBlur(q){T(!0),N(!1),B==="onBlur"&&W.commit(q.currentTarget.value)},onKeyDown(q){q.currentTarget.tagName==="INPUT"&&q.key==="Enter"&&(T(!0),W.commit(q.currentTarget.value))}},W.getInputValidationProps(),m],stateAttributesMapping:g0})}),d9=S.createContext({disabled:!1});function p9(){return S.useContext(d9)}const m9=S.createContext(void 0);function g9(n=!0){const e=S.useContext(m9);if(e===void 0&&!n)throw new Error(Un(3));return e}const y9=S.forwardRef(function(e,t){return C.jsx(h9,{ref:t,...e})});function ju({className:n,size:e="default",unstyled:t=!1,...r}){return C.jsx("span",{className:yn(!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:C.jsx(y9,{className:yn("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})})}let Ww=function(n){return n.checked="data-checked",n.unchecked="data-unchecked",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 hC(n){return S.useMemo(()=>({checked(e){return n.indeterminate?{}:e?{[Ww.checked]:""}:{[Ww.unchecked]:""}},...g0}),[n.indeterminate])}const v9=S.createContext(void 0);function x9(n=!1){const e=S.useContext(v9);if(e===void 0&&!n)throw new Error(Un(16));return e}function w9(n){const{focusableWhenDisabled:e,disabled:t,composite:r=!1,tabIndex:i=0,isNativeButton:s}=n,l=r&&e!==!1,c=r&&e===!1;return{props:S.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||l)||!s&&t)&&(h["aria-disabled"]=t),s&&(!e||c)&&(h.disabled=t),h},[r,t,e,l,c,s,i])}}function dC(n={}){const{disabled:e=!1,focusableWhenDisabled:t,tabIndex:r=0,native:i=!0}=n,s=S.useRef(null),l=x9(!0)!==void 0,c=Ee(()=>{const g=s.current;return!!((g==null?void 0:g.tagName)==="A"&&(g!=null&&g.href))}),{props:u}=w9({focusableWhenDisabled:t,disabled:e,composite:l,tabIndex:r,isNativeButton:i}),h=S.useCallback(()=>{const g=s.current;b9(g)&&l&&e&&u.disabled===void 0&&g.disabled&&(g.disabled=!1)},[e,u.disabled,l]);Le(h,[h]);const d=S.useCallback((g={})=>{const{onClick:y,onMouseDown:x,onKeyUp:b,onKeyDown:k,onPointerDown:R,...T}=g;return Gf({type:i?"button":void 0,onClick(P){if(e){P.preventDefault();return}y==null||y(P)},onMouseDown(P){e||x==null||x(P)},onKeyDown(P){if(e||(om(P),k==null||k(P)),P.baseUIHandlerPrevented)return;const N=P.target===P.currentTarget&&!i&&!c()&&!e,I=P.key==="Enter",B=P.key===" ";N&&((B||I)&&P.preventDefault(),I&&(y==null||y(P)))},onKeyUp(P){e||(om(P),b==null||b(P)),!P.baseUIHandlerPrevented&&P.target===P.currentTarget&&!i&&!e&&P.key===" "&&(y==null||y(P))},onPointerDown(P){if(e){P.preventDefault();return}R==null||R(P)}},i?void 0:{role:"button"},u,T)},[e,u,i,c]),m=Ee(g=>{s.current=g,h()});return{getButtonProps:d,buttonRef:m}}function b9(n){return gn(n)&&n.tagName==="BUTTON"}const pC=S.createContext(void 0);function S9(){const n=S.useContext(pC);if(n===void 0)throw new Error(Un(14));return n}function k9(n,e){const t=S.useRef(n),r=Ee(e);Le(()=>{t.current!==n&&r(t.current)},[n,r]),Le(()=>{t.current=n},[n])}const C9="data-parent",E9=S.forwardRef(function(e,t){const{checked:r,className:i,defaultChecked:s=!1,disabled:l=!1,id:c,indeterminate:u=!1,inputRef:h,name:d,onCheckedChange:m,parent:g=!1,readOnly:y=!1,render:x,required:b=!1,uncheckedValue:k,value:R,nativeButton:T=!1,...O}=e,{clearErrors:P}=cC(),{disabled:N,name:I,setDirty:B,setFilled:W,setFocused:Z,setTouched:X,state:Q,validationMode:U,validityData:j,shouldValidateOnChange:Y,validation:J}=zf(),q=p9(),{labelId:H,controlId:A,setControlId:D,getDescriptionProps:z}=y0(),M=g9(),V=M==null?void 0:M.parent,oe=V&&M.allValues,ce=N||q.disabled||(M==null?void 0:M.disabled)||l,he=I??d,se=R??he,fe=af(),ke=af();let Oe=A;oe?Oe=g?ke:`${V.id}-${se}`:c&&(Oe=c);let Fe={};oe&&(g?Fe=M.parent.getParentProps():se&&(Fe=M.parent.getChildProps(se)));const le=Ee(m),{checked:Se=r,indeterminate:ve=u,onCheckedChange:at,...De}=Fe,_e=M==null?void 0:M.value,Qe=M==null?void 0:M.setValue,At=M==null?void 0:M.defaultValue,$t=S.useRef(null),{getButtonProps:Lt,buttonRef:gt}=dC({disabled:ce,native:T}),Ve=(M==null?void 0:M.validation)??J,[$e,Dt]=uC({controlled:se&&_e&&!g?_e.includes(se):Se,default:se&&At&&!g?At.includes(se):s,name:"Checkbox",state:"checked"});Le(()=>{if(D!==Vn)return D(Oe),()=>{D(void 0)}},[Oe,M,D,g]),fC({enabled:!M,id:fe,commit:Ve.commit,value:$e,controlRef:$t,name:he,getValue:()=>$e});const Me=S.useRef(null),Pe=rm(h,Me,Ve.inputRef);Le(()=>{Me.current&&(Me.current.indeterminate=ve,$e&&W(!0))},[$e,ve,W]),k9($e,()=>{M&&!g||(P(he),W($e),B($e!==j.initialValue),Y()?Ve.commit($e):Ve.commit($e,!0))});const Xe=Gf({checked:$e,disabled:ce,name:g?void 0:he,id:Oe??void 0,required:b,ref:Pe,style:wg,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Nt){if(Nt.nativeEvent.defaultPrevented)return;const ct=Nt.target.checked,xn=zt($a,Nt.nativeEvent);if(at==null||at(ct,xn),le(ct,xn),!xn.isCanceled&&(Dt(ct),se&&_e&&Qe&&!g)){const qn=ct?[..._e,se]:_e.filter(Kn=>Kn!==se);Qe(qn,xn)}},onFocus(){var Nt;(Nt=$t.current)==null||Nt.focus()}},R!==void 0?{value:(M?$e&&R:R)||""}:cn,z,M?Ve.getValidationProps:Ve.getInputValidationProps),Ze=oe?!!Se:$e,tt=oe&&ve||u;S.useEffect(()=>{V&&se&&V.disabledStatesRef.current.set(se,ce)},[V,ce,se]);const Ye=S.useMemo(()=>({...Q,checked:Ze,disabled:ce,readOnly:y,required:b,indeterminate:tt}),[Q,Ze,ce,y,b,tt]),Ge=hC(Ye),Ei=vn("span",e,{state:Ye,ref:[gt,$t,t,M==null?void 0:M.registerControlRef],props:[{id:fe,role:"checkbox","aria-checked":ve?"mixed":$e,"aria-readonly":y||void 0,"aria-required":b||void 0,"aria-labelledby":H,[C9]:g?"":void 0,onFocus(){Z(!0)},onBlur(){const Nt=Me.current;Nt&&(X(!0),Z(!1),U==="onBlur"&&Ve.commit(M?_e:Nt.checked))},onClick(Nt){var ct;y||ce||(Nt.preventDefault(),(ct=Me.current)==null||ct.click())}},z,Ve.getValidationProps,O,De,Lt],stateAttributesMapping:Ge});return C.jsxs(pC.Provider,{value:Ye,children:[Ei,!$e&&!M&&he&&!g&&k!==void 0&&C.jsx("input",{type:"hidden",name:he,value:k}),C.jsx("input",{...Xe})]})}),R9=S.forwardRef(function(e,t){const{render:r,className:i,keepMounted:s=!1,...l}=e,c=S9(),u=c.checked||c.indeterminate,{transitionStatus:h,setMounted:d}=z2(u),m=S.useRef(null),g=S.useMemo(()=>({...c,transitionStatus:h}),[c,h]);Jf({open:u,ref:m,onComplete(){u||d(!1)}});const y=hC(c),x=S.useMemo(()=>({...y,...Mg,...g0}),[y]),b=s||u,k=vn("span",e,{enabled:b,ref:[t,m],state:g,stateAttributesMapping:x,props:l});return b?k:null});function T9({className:n,...e}){return C.jsx(E9,{className:yn("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:C.jsx(R9,{className:"grid place-content-center text-current","data-slot":"checkbox-indicator",children:e.checked==="indeterminate"?C.jsx("svg",{fill:"currentcolor",height:"9",viewBox:"0 0 9 9",width:"9",children:C.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"})}):C.jsx("svg",{fill:"currentcolor",height:"9",viewBox:"0 0 9 9",width:"9",children:C.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 M9({parameters:n,values:e,onChange:t}){const r=(i,s)=>{t({...e,[i]:s})};return C.jsx("div",{className:"space-y-4",children:n.map(i=>C.jsxs("div",{className:"space-y-1.5",children:[C.jsxs("label",{className:"text-sm font-medium text-foreground",children:[i.name,i.required?C.jsx("span",{className:"text-destructive ml-0.5",children:"*"}):C.jsx("span",{className:"text-muted-foreground ml-1.5 font-normal",children:"(optional)"})]}),C.jsx(O9,{parameter:i,value:e[i.name],onChange:s=>r(i.name,s)}),i.description&&C.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]},i.name))})}function O9({parameter:n,value:e,onChange:t}){const{type:r,name:i}=n;if(r==="boolean"){const[s,l]=S.useState(e===!0||e==="true");return S.useEffect(()=>{l(e===!0||e==="true")},[e]),C.jsx("div",{className:"flex items-center h-10",children:C.jsx(T9,{checked:s,onCheckedChange:c=>{l(c),t(c)}})})}return r==="integer"?C.jsx(ju,{type:"number",step:1,value:e??"",onChange:s=>{const l=s.target.value;t(l===""?void 0:parseInt(l,10))},placeholder:`Enter ${i}`}):r==="float"||r==="number"?C.jsx(ju,{type:"number",step:"any",value:e??"",onChange:s=>{const l=s.target.value;t(l===""?void 0:parseFloat(l))},placeholder:`Enter ${i}`}):r==="array"?C.jsx(ju,{type:"text",value:Array.isArray(e)?e.join(", "):"",onChange:s=>{const l=s.target.value;t(l?l.split(",").map(c=>c.trim()):void 0)},placeholder:"Enter comma-separated values"}):C.jsx(ju,{type:"text",value:e??"",onChange:s=>t(s.target.value||void 0),placeholder:`Enter ${i}`})}function P9(n){return vn(n.defaultTagName??"div",n,n)}const Vw=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Hw=X2,A9=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return Hw(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:i,defaultVariants:s}=e,l=Object.keys(i).map(h=>{const d=t==null?void 0:t[h],m=s==null?void 0:s[h];if(d===null)return null;const g=Vw(d)||Vw(m);return i[h][g]}),c=t&&Object.entries(t).reduce((h,d)=>{let[m,g]=d;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,d)=>{let{class:m,className:g,...y}=d;return Object.entries(y).every(x=>{let[b,k]=x;return Array.isArray(k)?k.includes({...s,...c}[b]):{...s,...c}[b]===k})?[...h,m,g]:h},[]);return Hw(n,l,u,t==null?void 0:t.class,t==null?void 0:t.className)},mC=A9("[&_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 L9({className:n,variant:e,size:t,render:r,...i}){const s=r?void 0:"button",l={className:yn(mC({className:n,size:t,variant:e})),"data-slot":"button",type:s};return P9({defaultTagName:"button",props:Gf(l,i),render:r})}function D9({className:n,...e}){return C.jsx(ab,{"aria-label":"Loading",className:yn("animate-spin",n),role:"status",...e})}function N9({onClick:n,disabled:e=!1,loading:t=!1}){const r=S.useRef(n),i=S.useRef(e),s=S.useRef(t);S.useEffect(()=>{r.current=n,i.current=e,s.current=t},[n,e,t]),S.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 c=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?"⌘":"Ctrl";return C.jsx(L9,{onClick:n,disabled:e||t,children:t?C.jsxs(C.Fragment,{children:[C.jsx(D9,{className:"size-4"}),"Running..."]}):C.jsxs(C.Fragment,{children:[C.jsx(JP,{className:"size-4"}),"Run",C.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:[c,"+Enter"]})]})})}function xo(n,e,t){let r=t.initialDeps??[],i,s=!0;function l(){var c,u,h;let d;t.key&&((c=t.debug)!=null&&c.call(t))&&(d=Date.now());const m=n();if(!(m.length!==r.length||m.some((x,b)=>r[b]!==x)))return i;r=m;let y;if(t.key&&((u=t.debug)!=null&&u.call(t))&&(y=Date.now()),i=e(...m),t.key&&((h=t.debug)!=null&&h.call(t))){const x=Math.round((Date.now()-d)*100)/100,b=Math.round((Date.now()-y)*100)/100,k=b/16,R=(T,O)=>{for(T=String(T);T.length<O;)T=" "+T;return T};console.info(`%c⏱ ${R(b,5)} /${R(x,5)} ms`,`
|
|
145
|
+
font-size: .6rem;
|
|
146
|
+
font-weight: bold;
|
|
147
|
+
color: hsl(${Math.max(0,Math.min(120-120*k,120))}deg 100% 31%);`,t==null?void 0:t.key)}return t!=null&&t.onChange&&!(s&&t.skipInitialOnChange)&&t.onChange(i),s=!1,i}return l.updateDeps=c=>{r=c},l}function $w(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const I9=(n,e)=>Math.abs(n-e)<1.01,B9=(n,e,t)=>{let r;return function(...i){n.clearTimeout(r),r=n.setTimeout(()=>e.apply(this,i),t)}},Uw=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},j9=n=>n,F9=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),r=[];for(let i=e;i<=t;i++)r.push(i);return r},z9=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;const i=l=>{const{width:c,height:u}=l;e({width:Math.round(c),height:Math.round(u)})};if(i(Uw(t)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(l=>{const c=()=>{const u=l[0];if(u!=null&&u.borderBoxSize){const h=u.borderBoxSize[0];if(h){i({width:h.inlineSize,height:h.blockSize});return}}i(Uw(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return s.observe(t,{box:"border-box"}),()=>{s.unobserve(t)}},qw={passive:!0},Kw=typeof window>"u"?!0:"onscrollend"in window,_9=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;let i=0;const s=n.options.useScrollendEvent&&Kw?()=>{}:B9(r,()=>{e(i,!1)},n.options.isScrollingResetDelay),l=d=>()=>{const{horizontal:m,isRtl:g}=n.options;i=m?t.scrollLeft*(g&&-1||1):t.scrollTop,s(),e(i,d)},c=l(!0),u=l(!1);u(),t.addEventListener("scroll",c,qw);const h=n.options.useScrollendEvent&&Kw;return h&&t.addEventListener("scrollend",u,qw),()=>{t.removeEventListener("scroll",c),h&&t.removeEventListener("scrollend",u)}},W9=(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"]},V9=(n,{adjustments:e=0,behavior:t},r)=>{var i,s;const l=n+e;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:l,behavior:t})};class H9{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const l=()=>{this._measureElement(s.target,s)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));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=>{Object.entries(t).forEach(([r,i])=>{typeof i>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:j9,rangeExtractor:F9,onChange:()=>{},measureElement:W9,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,...t}},this.notify=t=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,t)},this.maybeNotify=xo(()=>(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.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}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._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=s,this.maybeNotify()}))}},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 l=r-1;l>=0;l--){const c=t[l];if(i.has(c.lane))continue;const u=s.get(c.lane);if(u==null||c.end>u.end?s.set(c.lane,c):c.end<u.end&&i.set(c.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((l,c)=>l.end===c.end?l.index-c.index:l.end-c.end)[0]:void 0},this.getMeasurementOptions=xo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(t,r,i,s,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:l,lanes:c}),{key:!1,skipInitialOnChange:!0,onChange:()=>{this.notify(this.isScrolling)}}),this.getMeasurements=xo(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:l,lanes:c},u)=>{if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const g of this.laneAssignments.keys())g>=t&&this.laneAssignments.delete(g);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(g=>{this.itemSizeCache.set(g.key,g.size)}));const h=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,h),m=new Array(c).fill(void 0);for(let g=0;g<h;g++){const y=d[g];y&&(m[y.lane]=g)}for(let g=h;g<t;g++){const y=s(g),x=this.laneAssignments.get(g);let b,k;if(x!==void 0&&this.options.lanes>1){b=x;const P=m[b],N=P!==void 0?d[P]:void 0;k=N?N.end+this.options.gap:r+i}else{const P=this.options.lanes===1?d[g-1]:this.getFurthestMeasurement(d,g);k=P?P.end+this.options.gap:r+i,b=P?P.lane:g%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(g,b)}const R=u.get(y),T=typeof R=="number"?R:this.options.estimateSize(g),O=k+T;d[g]={index:g,start:k,size:T,end:O,key:y,lane:b},m[b]=g}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=xo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,i,s)=>this.range=t.length>0&&r>0?$9({measurements:t,outerSize:r,scrollOffset:i,lanes:s}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=xo(()=>{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,l)=>s===null||l===null?[]:t({startIndex:s,endIndex:l,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._measureElement=(t,r)=>{const i=this.indexFromElement(t),s=this.measurementsCache[i];if(!s)return;const l=s.key,c=this.elementsCache.get(l);c!==t&&(c&&this.observer.unobserve(c),this.observer.observe(t),this.elementsCache.set(l,t)),t.isConnected&&this.resizeItem(i,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{const i=this.measurementsCache[t];if(!i)return;const s=this.itemSizeCache.get(i.key)??i.size,l=r-s;l!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,l,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,r)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,i)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(i))});return}this._measureElement(t,void 0)},this.getVirtualItems=xo(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const i=[];for(let s=0,l=t.length;s<l;s++){const c=t[s],u=r[c];i.push(u)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length!==0)return $w(r[gC(0,r.length-1,i=>$w(r[i]).start,t)])},this.getOffsetForAlignment=(t,r,i=0)=>{const s=this.getSize(),l=this.getScrollOffset();r==="auto"&&(r=t>=l+s?"end":"start"),r==="center"?t+=(i-s)/2:r==="end"&&(t-=s);const c=this.getTotalSize()+this.options.scrollMargin-s;return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.measurementsCache[t];if(!i)return;const s=this.getSize(),l=this.getScrollOffset();if(r==="auto")if(i.end>=l+s-this.options.scrollPaddingEnd)r="end";else if(i.start<=l+this.options.scrollPaddingStart)r="start";else return[l,r];const c=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,r,i.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:r="start",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:i})},this.scrollToIndex=(t,{align:r="auto",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1));let s=0;const l=10,c=h=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(t,h);if(!d){console.warn("Failed to get offset for index:",t);return}const[m,g]=d;this._scrollToOffset(m,{adjustments:void 0,behavior:i}),this.targetWindow.requestAnimationFrame(()=>{const y=this.getScrollOffset(),x=this.getOffsetForIndex(t,g);if(!x){console.warn("Failed to get offset for index:",t);return}I9(x[0],y)||u(g)})},u=h=>{this.targetWindow&&(s++,s<l?this.targetWindow.requestAnimationFrame(()=>c(h)):console.warn(`Failed to scroll to index ${t} after ${l} attempts.`))};c(r)},this.scrollBy=(t,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((t=r[r.length-1])==null?void 0:t.end)??0;else{const s=Array(this.options.lanes).fill(null);let l=r.length-1;for(;l>=0&&s.some(c=>c===null);){const c=r[l];s[c.lane]===null&&(s[c.lane]=c.end),l--}i=Math.max(...s.filter(c=>c!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:r,behavior:i})=>{this.options.scrollToFn(t,{behavior:i,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}}const gC=(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 $9({measurements:n,outerSize:e,scrollOffset:t,lanes:r}){const i=n.length-1,s=u=>n[u].start;if(n.length<=r)return{startIndex:0,endIndex:i};let l=gC(0,i,s,t),c=l;if(r===1)for(;c<i&&n[c].end<t+e;)c++;else if(r>1){const u=Array(r).fill(0);for(;c<i&&u.some(d=>d<t+e);){const d=n[c];u[d.lane]=d.end,c++}const h=Array(r).fill(t+e);for(;l>=0&&h.some(d=>d>=t);){const d=n[l];h[d.lane]=d.start,l--}l=Math.max(0,l-l%r),c=Math.min(i,c+(r-1-c%r))}return{startIndex:l,endIndex:c}}const Qw=typeof document<"u"?S.useLayoutEffect:S.useEffect;function U9(n){const e=S.useReducer(()=>({}),{})[1],t={...n,onChange:(i,s)=>{var l;s?Ur.flushSync(e):e(),(l=n.onChange)==null||l.call(n,i,s)}},[r]=S.useState(()=>new H9(t));return r.setOptions(t),Qw(()=>r._didMount(),[]),Qw(()=>r._willUpdate()),r}function q9(n){return U9({observeElementRect:z9,observeElementOffset:_9,scrollToFn:V9,...n})}const Yw=36;function K9(n){return n<1e3?`${Math.round(n)} ms`:`${(n/1e3).toFixed(2)} s`}function Q9(n,e){if(!e.trim())return n;const t=n.toLowerCase(),r=e.toLowerCase(),i=[];let s=0,l=t.indexOf(r);for(;l!==-1;)l>s&&i.push(n.substring(s,l)),i.push(C.jsx("mark",{className:"bg-amber-200/50 text-foreground",children:n.substring(l,l+r.length)},l)),s=l+r.length,l=t.indexOf(r,s);return s<n.length&&i.push(n.substring(s)),i}function Y9({result:n,error:e,isLoading:t,executedSql:r,executionTimeMs:i}){const s=S.useRef(null),[l,c]=S.useState(""),u=S.useMemo(()=>{if(!n||!l.trim())return(n==null?void 0:n.rows)??[];const d=l.toLowerCase();return n.rows.filter(m=>m.some(g=>g===null?!1:String(g).toLowerCase().includes(d)))},[n,l]),h=q9({count:u.length,getScrollElement:()=>s.current,estimateSize:()=>Yw,overscan:10});return t?C.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:C.jsx("div",{className:"text-muted-foreground",children:"Running query..."})}):e?C.jsx("div",{className:"border border-destructive/20 rounded-lg bg-destructive/10 p-4",children:C.jsx("p",{className:"text-destructive text-sm",children:e})}):n?n.rows.length===0?C.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:C.jsx("p",{className:"text-muted-foreground text-sm",children:n.rowCount>0?`${n.rowCount} row${n.rowCount!==1?"s":""} affected`:"No results returned"})}):C.jsxs("div",{className:"space-y-2",children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("input",{type:"text",placeholder:"Filter results...","aria-label":"Filter table results",value:l,onChange:d=>c(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"}),C.jsx("div",{className:"text-sm text-muted-foreground",children:l.trim()&&u.length!==n.rowCount?`${u.length} of ${n.rowCount} row${n.rowCount!==1?"s":""}`:`${n.rowCount} row${n.rowCount!==1?"s":""}`})]}),C.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[C.jsxs("div",{className:"flex bg-muted/50 border-b border-border",children:[C.jsx("div",{className:"w-16 px-3 py-2 text-sm font-medium text-foreground flex-shrink-0"}),n.columns.map(d=>C.jsx("div",{className:"flex-1 min-w-[120px] px-3 py-2 text-sm font-medium text-foreground truncate",children:d},d))]}),C.jsx("div",{ref:s,className:"max-h-[400px] overflow-auto bg-card",children:C.jsx("div",{style:{height:`${h.getTotalSize()}px`,width:"100%",position:"relative"},children:h.getVirtualItems().map(d=>{const m=u[d.index];return C.jsxs("div",{className:"flex absolute w-full border-b border-border/50 last:border-b-0",style:{height:`${Yw}px`,transform:`translateY(${d.start}px)`},children:[C.jsx("div",{className:"w-16 px-3 py-2 text-sm text-muted-foreground flex-shrink-0",children:d.index+1}),m.map((g,y)=>C.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?C.jsx("span",{className:"text-muted-foreground italic",children:"NULL"}):Q9(String(g),l)},y))]},d.index)})})})]}),r&&i!==void 0&&C.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[C.jsx("span",{children:r}),C.jsxs("span",{children:["Executed in ",K9(i)]})]})]}):C.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:C.jsx("p",{className:"text-muted-foreground text-sm",children:"Run a query to see results"})})}function G9({className:n="w-4 h-4"}){return C.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function X9(n){return n.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function J9({tabs:n,activeTabId:e,onTabSelect:t,onTabClose:r,isLoading:i}){const s=S.useRef(null),[l,c]=S.useState(!1),[u,h]=S.useState(!1),d=S.useMemo(()=>n.find(y=>y.id===e),[n,e]),m=S.useCallback(()=>{const y=s.current;if(!y)return;const{scrollLeft:x,scrollWidth:b,clientWidth:k}=y;c(x>0),h(x+k<b-1)},[]);S.useEffect(()=>(m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)),[m,n]);const g=y=>{const x=s.current;if(!x)return;const b=150;x.scrollBy({left:y==="left"?-b:b,behavior:"smooth"})};return i&&n.length===0?C.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:C.jsx("div",{className:"text-muted-foreground",children:"Running query..."})}):n.length===0?C.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:C.jsx("p",{className:"text-muted-foreground text-sm",children:"Run a query to see results"})}):C.jsxs("div",{className:"space-y-2",children:[C.jsxs("div",{className:"relative flex items-center border-b border-border",children:[l&&C.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:C.jsx(zP,{className:"w-4 h-4 text-muted-foreground"})}),C.jsx("div",{ref:s,onScroll:m,className:yn("flex items-center gap-1 overflow-hidden",l&&"pl-6",u&&"pr-6"),children:n.map(y=>C.jsxs("button",{type:"button",onClick:()=>t(y.id),className:yn("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",y.id===e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:[C.jsx("span",{children:X9(y.timestamp)}),y.error&&C.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-destructive","aria-label":"Error"}),C.jsx("span",{role:"button",tabIndex:0,"aria-label":"Close tab",onClick:x=>{x.stopPropagation(),r(y.id)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.stopPropagation(),r(y.id))},className:"opacity-0 group-hover:opacity-100 hover:bg-muted rounded p-0.5 transition-opacity",children:C.jsx(G9,{className:"w-3 h-3"})})]},y.id))}),u&&C.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:C.jsx(WP,{className:"w-4 h-4 text-muted-foreground"})})]}),d&&C.jsx(Y9,{result:d.result,error:d.error,isLoading:i,executedSql:d.executedSql,executionTimeMs:d.executionTimeMs})]})}function Z9({className:n="w-4 h-4"}){return C.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:C.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 eB({className:n="w-4 h-4"}){return C.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function tB(){const{sourceId:n,toolName:e}=Vf(),[t,r]=U3(),[i,s]=S.useState(null),[l,c]=S.useState(!0),[u,h]=S.useState(null),d=S.useRef(null),[m,g]=S.useState(()=>t.get("sql")||""),[y,x]=S.useState({}),[b,k]=S.useState([]),[R,T]=S.useState(null),[O,P]=S.useState(!1),[N,I]=S.useState(!1);S.useEffect(()=>{!n||!e||(c(!0),h(null),k([]),T(null),ob(n).then(H=>{const A=H.tools.find(D=>D.name===e);s(A||null),c(!1)}).catch(H=>{h(H),c(!1)}))},[n,e]);const W=S.useCallback(()=>i?i.name.startsWith("execute_sql")?"execute_sql":i.name.startsWith("search_objects")?"search_objects":"custom":"custom",[i])(),Z=S.useCallback((H,A)=>{if(!i)return H;const D=i.parameters.find(z=>z.name===A);if(D){if(D.type==="number"||D.type==="integer"||D.type==="float"){const z=Number(H);return isNaN(z)?void 0:z}return D.type==="boolean"?H==="true":H}},[i]);S.useEffect(()=>{if(!i||W!=="custom")return;const H={};t.forEach((A,D)=>{if(D!=="sql"){const z=Z(String(A),D);z!==void 0&&(H[D]=z)}}),Object.keys(H).length>0&&x(H)},[i,W,t,Z]),S.useEffect(()=>{if(W!=="execute_sql")return;const H=setTimeout(()=>{r(A=>{const D=new URLSearchParams(A);return m.trim()?D.set("sql",m):D.delete("sql"),D},{replace:!0})},300);return()=>clearTimeout(H)},[m,W,r]),S.useEffect(()=>{if(W!=="custom")return;const H=setTimeout(()=>{r(A=>{const D=new URLSearchParams(A);return Array.from(D.keys()).forEach(z=>{z!=="sql"&&D.delete(z)}),Object.entries(y).forEach(([z,M])=>{M!=null&&M!==""&&D.set(z,String(M))}),D},{replace:!0})},300);return()=>clearTimeout(H)},[y,W,r]);const X=S.useCallback(()=>{if(!(i!=null&&i.statement))return"";let H=i.statement,A=0;return H=H.replace(/\$(\d+)|\?/g,(D,z)=>{let M;return z?M=i.parameters[parseInt(z,10)-1]:(M=i.parameters[A],A++),M?`:${M.name}`:":?"}),H},[i]),Q=S.useCallback(()=>{let H=X();return Object.entries(y).forEach(([A,D])=>{if(D!==void 0&&D!==""){const z=typeof D=="string"?`'${D.replace(/'/g,"''")}'`:String(D);H=H.replace(new RegExp(`:${A}\\b`,"g"),z)}}),H},[X,y]),U=S.useCallback(()=>i?i.parameters.filter(H=>H.required).every(H=>y[H.name]!==void 0&&y[H.name]!==""):!1,[i,y]),j=S.useCallback(async()=>{var A;if(!i||!e)return;P(!0);const H=performance.now();try{let D,z;W==="execute_sql"?(z=((A=d.current)==null?void 0:A.getSelectedSql())??m,D=await Vx(e,{sql:z})):(z=Q(),D=await Vx(e,y));const V=performance.now()-H,oe={id:crypto.randomUUID(),timestamp:new Date,result:D,error:null,executedSql:z,executionTimeMs:V};k(ce=>[oe,...ce]),T(oe.id)}catch(D){const z={id:crypto.randomUUID(),timestamp:new Date,result:null,error:D instanceof Error?D.message:"Query failed",executedSql:W==="execute_sql"?m:Q(),executionTimeMs:0};k(M=>[z,...M]),T(z.id)}finally{P(!1)}},[i,e,W,m,y,Q]),Y=W==="execute_sql"?!m.trim():!U(),J=S.useCallback(async()=>{const H=W==="execute_sql"?m:Q();await navigator.clipboard.writeText(H),I(!0),setTimeout(()=>I(!1),2e3)},[W,m,Q]),q=S.useCallback(H=>{k(A=>{const D=A.findIndex(M=>M.id===H),z=A.filter(M=>M.id!==H);if(H===R&&z.length>0){const M=Math.min(D,z.length-1);T(z[M].id)}else z.length===0&&T(null);return z})},[R]);return!n||!e?C.jsx(na,{to:"/",replace:!0}):l?C.jsx("div",{className:"container mx-auto px-8 py-12",children:C.jsx("div",{className:"text-muted-foreground",children:"Loading tool details..."})}):u?u.status===404?C.jsx(na,{to:"/404",replace:!0}):C.jsx("div",{className:"container mx-auto px-8 py-12",children:C.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[C.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Error"}),C.jsx("p",{className:"text-destructive/90",children:u.message})]})}):i?W==="search_objects"?C.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:C.jsxs("div",{className:"space-y-4",children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("h1",{className:"text-3xl font-bold text-foreground font-mono",children:i.name}),i.readonly&&C.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:[C.jsx(cf,{className:"w-3 h-3"}),"Read-Only"]})]}),C.jsx("p",{className:"text-muted-foreground leading-relaxed",children:i.description}),C.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:C.jsx("p",{className:"text-muted-foreground",children:"Interactive UI for this tool is coming soon."})})]})}):C.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:C.jsxs("div",{className:"space-y-6",children:[C.jsxs("div",{className:"space-y-2",children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("h1",{className:"text-3xl font-bold text-foreground font-mono",children:i.name}),i.readonly&&C.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:[C.jsx(cf,{className:"w-3 h-3"}),"Read-Only"]})]}),C.jsx("p",{className:"text-muted-foreground leading-relaxed",children:i.description})]}),W==="custom"&&i.parameters.length>0&&C.jsxs("div",{className:"space-y-2",children:[C.jsx("label",{className:"text-sm font-medium text-foreground",children:"Parameters"}),C.jsx("div",{className:"border border-border rounded-lg bg-card p-4",children:C.jsx(M9,{parameters:i.parameters,values:y,onChange:x})})]}),C.jsxs("div",{className:"space-y-2",children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsx("label",{className:"text-sm font-medium text-foreground",children:"SQL Statement"}),C.jsx("button",{onClick:J,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:N?C.jsxs(C.Fragment,{children:[C.jsx(eB,{className:"w-3.5 h-3.5"}),"Copied"]}):C.jsxs(C.Fragment,{children:[C.jsx(Z9,{className:"w-3.5 h-3.5"}),"Copy"]})})]}),C.jsx(s9,{ref:d,value:W==="execute_sql"?m:Q(),onChange:W==="execute_sql"?g:void 0,onRunShortcut:j,disabled:Y||O,readOnly:W!=="execute_sql",placeholder:W==="execute_sql"?"SELECT * FROM table_name LIMIT 10;":void 0})]}),C.jsx(N9,{onClick:j,disabled:Y,loading:O}),C.jsx(J9,{tabs:b,activeTabId:R,onTabSelect:T,onTabClose:q,isLoading:O})]})}):C.jsx(na,{to:"/404",replace:!0})}function nB(){return C.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:C.jsxs("div",{className:"space-y-6",children:[C.jsxs("div",{children:[C.jsx("h1",{className:"text-4xl font-bold text-foreground mb-4",children:"404 - Page Not Found"}),C.jsx("p",{className:"text-xl text-muted-foreground",children:"The page you're looking for doesn't exist."})]}),C.jsxs("div",{className:"bg-muted rounded-lg p-6",children:[C.jsx("p",{className:"text-muted-foreground mb-4",children:"The URL you entered could not be found. This might be because:"}),C.jsxs("ul",{className:"space-y-2 text-muted-foreground list-disc list-inside",children:[C.jsx("li",{children:"The page was moved or deleted"}),C.jsx("li",{children:"You typed the URL incorrectly"}),C.jsx("li",{children:"The resource ID is invalid"})]})]}),C.jsx("div",{children:C.jsx(gi,{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"})})]})})}let Gw=0;function yC(n){return Gw+=1,`${n}-${Math.random().toString(36).slice(2,6)}-${Gw}`}const v0=S.createContext(void 0);function vC(){const n=S.useContext(v0);if(!n)throw new Error(Un(73));return n}function Qp(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}const rB=function(e){const{children:t,timeout:r=5e3,limit:i=3,toastManager:s}=e,[l,c]=S.useState([]),[u,h]=S.useState(!1),[d,m]=S.useState(!1),[g,y]=S.useState(null);l.length===0&&(u&&h(!1),d&&m(!1));const x=u||d,b=S.useRef(new Map),k=S.useRef(null),R=S.useRef(!0),T=S.useRef(!1);function O(j){var A,D;const Y=Bo(Xi(k.current));if(!k.current||!Rt(k.current,Y)||!ef(Y))return;const J=l.findIndex(z=>z.id===j);let q=null,H=J+1;for(;H<l.length;){if(l[H].transitionStatus!=="ending"){q=l[H];break}H+=1}if(!q)for(H=J-1;H>=0;){if(l[H].transitionStatus!=="ending"){q=l[H];break}H-=1}q?(D=(A=q.ref)==null?void 0:A.current)==null||D.focus():g==null||g.focus({preventScroll:!0})}const P=Ee(()=>{T.current||(T.current=!0,b.current.forEach(j=>{if(j.timeout){j.timeout.clear();const Y=Date.now()-j.start,J=j.delay-Y;j.remaining=J>0?J:0}}))}),N=Ee(()=>{T.current&&(T.current=!1,b.current.forEach((j,Y)=>{j.remaining=j.remaining>0?j.remaining:j.delay,j.timeout??(j.timeout=rs.create()),j.timeout.start(j.remaining,()=>{b.current.delete(Y),j.callback()}),j.start=Date.now()}))}),I=Ee(j=>{var q;c(H=>{const A=H.map(z=>z.id===j?{...z,transitionStatus:"ending",height:0}:z),D=A.filter(z=>z.transitionStatus!=="ending");return A.map(z=>{if(z.transitionStatus==="ending")return z;const M=D.indexOf(z)>=i;return{...z,limited:M}})});const Y=b.current.get(j);Y&&Y.timeout&&(Y.timeout.clear(),b.current.delete(j));const J=l.find(H=>H.id===j);(q=J==null?void 0:J.onClose)==null||q.call(J),O(j),l.length===1&&(h(!1),m(!1))}),B=Ee(j=>{var J;c(q=>q.filter(H=>H.id!==j));const Y=l.find(q=>q.id===j);(J=Y==null?void 0:Y.onRemove)==null||J.call(Y)}),W=Ee((j,Y,J)=>{const q=Date.now(),H=R.current&&!u&&!d,A=H?rs.create():void 0;A==null||A.start(Y,()=>{b.current.delete(j),J()}),b.current.set(j,{timeout:A,start:H?q:0,delay:Y,remaining:Y,callback:J})}),Z=Ee(j=>{const Y=j.id||yC("toast"),J={...j,id:Y,transitionStatus:"starting"};c(H=>{const A=[J,...H],D=A.filter(z=>z.transitionStatus!=="ending");if(D.length>i){const z=D.length-i,M=D.slice(-z);return A.map(V=>M.some(oe=>oe.id===V.id)?{...V,limited:!0}:{...V,limited:!1})}return A.map(z=>({...z,limited:!1}))});const q=J.timeout??r;return J.type!=="loading"&&q>0&&W(Y,q,()=>I(Y)),(u||d||!R.current)&&P(),Y}),X=Ee((j,Y)=>{c(J=>J.map(q=>q.id===j?{...q,...Y}:q))}),Q=Ee((j,Y)=>{const J=Qp(Y.loading),q=Z({...J,type:"loading"}),H=j.then(A=>{const D=Qp(Y.success,A);X(q,{...D,type:"success"});const z=D.timeout??r;return z>0&&W(q,z,()=>I(q)),(u||d||!R.current)&&P(),A}).catch(A=>{const D=Qp(Y.error,A);X(q,{...D,type:"error"});const z=D.timeout??r;return z>0&&W(q,z,()=>I(q)),(u||d||!R.current)&&P(),Promise.reject(A)});return{}.hasOwnProperty.call(Y,"setPromise")&&Y.setPromise(H),H});S.useEffect(function(){return s?s[" subscribe"](({action:J,options:q})=>{const H=q.id;J==="promise"&&q.promise?Q(q.promise,q):J==="update"&&H?X(H,q):J==="close"&&H?I(H):Z(q)}):void 0},[Z,X,W,r,s,Q,I]);const U=S.useMemo(()=>({toasts:l,setToasts:c,hovering:u,setHovering:h,focused:d,setFocused:m,expanded:x,add:Z,close:I,remove:B,update:X,promise:Q,pauseTimers:P,resumeTimers:N,prevFocusElement:g,setPrevFocusElement:y,viewportRef:k,scheduleTimer:W,windowFocusedRef:R}),[Z,I,d,u,x,P,g,Q,B,N,W,l,X]);return C.jsx(v0.Provider,{value:U,children:t})},iB=S.createContext(void 0);let sB=function(n){return n.frontmostHeight="--toast-frontmost-height",n}({});const oB=S.forwardRef(function(e,t){var A;const{render:r,className:i,children:s,...l}=e,{toasts:c,pauseTimers:u,resumeTimers:h,setHovering:d,setFocused:m,viewportRef:g,windowFocusedRef:y,prevFocusElement:x,setPrevFocusElement:b,expanded:k,focused:R}=vC(),T=S.useRef(!1),O=S.useRef(!1),P=c.length,N=((A=c[0])==null?void 0:A.height)??0,I=S.useMemo(()=>c.some(D=>D.transitionStatus==="ending"),[c]);S.useEffect(()=>{if(!g.current)return;function D(M){var V;P!==0&&M.key==="F6"&&M.target!==g.current&&(M.preventDefault(),b(Bo(Xi(g.current))),(V=g.current)==null||V.focus({preventScroll:!0}),u(),m(!0))}const z=Yt(g.current);return z.addEventListener("keydown",D),()=>{z.removeEventListener("keydown",D)}},[u,m,b,P,g]),S.useEffect(()=>{if(!g.current||!P)return;const D=Yt(g.current);function z(V){V.target===D&&(y.current=!1,u())}function M(V){if(V.relatedTarget||V.target===D)return;const oe=_n(V),ce=Bo(Xi(g.current));(!Rt(g.current,oe)||!ef(ce))&&h(),setTimeout(()=>{y.current=!0})}return D.addEventListener("blur",z,!0),D.addEventListener("focus",M,!0),()=>{D.removeEventListener("blur",z,!0),D.removeEventListener("focus",M,!0)}},[u,h,g,y,m,P]),S.useEffect(()=>{const D=g.current;if(!D||P===0)return;const z=Xi(D);function M(V){if(V.pointerType!=="touch")return;const oe=_n(V);Rt(D,oe)||(h(),d(!1),m(!1))}return z.addEventListener("pointerdown",M,!0),()=>{z.removeEventListener("pointerdown",M,!0)}},[P,h,m,d,g]);function B(D){var z,M,V;g.current&&(T.current=!0,D.relatedTarget===g.current?(V=(M=(z=c[0])==null?void 0:z.ref)==null?void 0:M.current)==null||V.focus():x==null||x.focus({preventScroll:!0}))}function W(D){D.key==="Tab"&&D.shiftKey&&D.target===g.current&&(D.preventDefault(),x==null||x.focus({preventScroll:!0}),h())}S.useEffect(()=>{!y.current||I||!O.current||(h(),d(!1),O.current=!1)},[I,h,d,y]);function Z(){u(),d(!0),O.current=!1}function X(){c.some(D=>D.transitionStatus==="ending")?O.current=!0:(h(),d(!1))}function Q(){if(T.current){T.current=!1;return}R||ef(Xi(g.current).activeElement)&&(m(!0),u())}function U(D){!R||Rt(g.current,D.relatedTarget)||(m(!1),h())}const j={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:Z,onMouseMove:Z,onMouseLeave:X,onFocus:Q,onBlur:U,onKeyDown:W,onClick:Q},Y=S.useMemo(()=>({expanded:k}),[k]),J=vn("div",e,{ref:[t,g],state:Y,props:[j,{style:{[sB.frontmostHeight]:N?`${N}px`:void 0}},l,{children:C.jsxs(S.Fragment,{children:[P>0&&x&&C.jsx(lp,{onFocus:B}),s,P>0&&x&&C.jsx(lp,{onFocus:B})]})}]}),q=S.useMemo(()=>({viewportRef:g}),[g]),H=S.useMemo(()=>c.filter(D=>D.priority==="high"),[c]);return C.jsxs(iB.Provider,{value:q,children:[P>0&&x&&C.jsx(lp,{onFocus:B}),J,!R&&H.length>0&&C.jsx("div",{style:wg,children:H.map(D=>C.jsxs("div",{role:"alert","aria-atomic":!0,children:[C.jsx("div",{children:D.title}),C.jsx("div",{children:D.description})]},D.id))})]})}),xC=S.createContext(void 0);function Ko(){const n=S.useContext(xC);if(!n)throw new Error(Un(66));return n}let Ps=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}({});const lB={...Mg,swipeDirection(n){return n?{"data-swipe-direction":n}:null}},Xl=40,aB=10,Ki=.5,cB=1;function Xw(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 uB(n){const t=window.getComputedStyle(n).transform;let r=0,i=0,s=1;if(t&&t!=="none"){const l=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(l){const c=l[1].split(", ").map(parseFloat);c.length===6?(r=c[4],i=c[5],s=Math.sqrt(c[0]*c[0]+c[1]*c[1])):c.length===16&&(r=c[12],i=c[13],s=c[0])}}return{x:r,y:i,scale:s}}const fB=S.forwardRef(function(e,t){var Dt;const{toast:r,render:i,className:s,swipeDirection:l=["down","right"],...c}=e,u=((Dt=r.positionerProps)==null?void 0:Dt.anchor)!==void 0;let h=[];u||(h=Array.isArray(l)?l:[l]);const d=h.length>0,{toasts:m,focused:g,close:y,remove:x,setToasts:b,pauseTimers:k,expanded:R,setHovering:T}=vC(),[O,P]=S.useState(void 0),[N,I]=S.useState(!1),[B,W]=S.useState(!1),[Z,X]=S.useState(!1),[Q,U]=S.useState({x:0,y:0}),[j,Y]=S.useState({x:0,y:0,scale:1}),[J,q]=S.useState(),[H,A]=S.useState(),[D,z]=S.useState(null),M=S.useRef(null),V=S.useRef({x:0,y:0}),oe=S.useRef({x:0,y:0,scale:1}),ce=S.useRef(void 0),he=S.useRef(0),se=S.useRef(!1),fe=S.useRef({x:0,y:0}),ke=S.useRef(!1),Oe=S.useMemo(()=>m.indexOf(r),[r,m]),Fe=S.useMemo(()=>m.filter(Me=>Me.transitionStatus!=="ending").indexOf(r),[r,m]),le=S.useMemo(()=>m.slice(0,m.indexOf(r)).reduce((Me,Pe)=>Me+(Pe.height||0),0),[m,r]);Jf({open:r.transitionStatus!=="ending",ref:M,onComplete(){r.transitionStatus==="ending"&&x(r.id)}});const Se=Ee((Me=!1)=>{const Pe=M.current;if(!Pe)return;const Xe=Pe.style.height;Pe.style.height="auto";const Ze=Pe.offsetHeight;Pe.style.height=Xe;function tt(){b(Ye=>Ye.map(Ge=>Ge.id===r.id?{...Ge,ref:M,height:Ze,transitionStatus:void 0}:Ge))}Me?Ur.flushSync(tt):tt()});Le(Se,[Se]);function ve(Me,Pe){let Xe=Me,Ze=Pe;return!h.includes("left")&&!h.includes("right")?Xe=Me>0?Me**Ki:-(Math.abs(Me)**Ki):(!h.includes("right")&&Me>0&&(Xe=Me**Ki),!h.includes("left")&&Me<0&&(Xe=-(Math.abs(Me)**Ki))),!h.includes("up")&&!h.includes("down")?Ze=Pe>0?Pe**Ki:-(Math.abs(Pe)**Ki):(!h.includes("down")&&Pe>0&&(Ze=Pe**Ki),!h.includes("up")&&Pe<0&&(Ze=-(Math.abs(Pe)**Ki))),{x:Xe,y:Ze}}function at(Me){var Ze;if(Me.button!==0)return;Me.pointerType==="touch"&&k();const Pe=_n(Me.nativeEvent);if(!(Pe&&Pe.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(se.current=!1,ce.current=void 0,he.current=0,V.current={x:Me.clientX,y:Me.clientY},fe.current=V.current,M.current){const tt=uB(M.current);oe.current=tt,Y(tt),U({x:tt.x,y:tt.y})}T(!0),I(!0),W(!1),z(null),ke.current=!0,(Ze=M.current)==null||Ze.setPointerCapture(Me.pointerId)}}function De(Me){if(!N)return;Me.preventDefault(),ke.current&&(V.current={x:Me.clientX,y:Me.clientY},ke.current=!1);const{clientY:Pe,clientX:Xe,movementX:Ze,movementY:tt}=Me;(tt<0&&Pe>fe.current.y||tt>0&&Pe<fe.current.y)&&(fe.current={x:fe.current.x,y:Pe}),(Ze<0&&Xe>fe.current.x||Ze>0&&Xe<fe.current.x)&&(fe.current={x:Xe,y:fe.current.y});const Ye=Xe-V.current.x,Ge=Pe-V.current.y,Ei=Pe-fe.current.y,Nt=Xe-fe.current.x;if(!B&&Math.sqrt(Ye*Ye+Ge*Ge)>=cB&&(W(!0),D===null)){const Ue=h.includes("left")||h.includes("right"),yt=h.includes("up")||h.includes("down");if(Ue&&yt){const It=Math.abs(Ye),St=Math.abs(Ge);z(It>St?"horizontal":"vertical")}}let ct;if(!ce.current)D==="vertical"?Ge>0?ct="down":Ge<0&&(ct="up"):D==="horizontal"?Ye>0?ct="right":Ye<0&&(ct="left"):Math.abs(Ye)>=Math.abs(Ge)?ct=Ye>0?"right":"left":ct=Ge>0?"down":"up",ct&&h.includes(ct)&&(ce.current=ct,he.current=Xw(ct,Ye,Ge),P(ct));else{const Rr=ce.current,Ue=Xw(Rr,Nt,Ei);Ue>Xl?(se.current=!1,P(Rr)):!(h.includes("left")&&h.includes("right"))&&!(h.includes("up")&&h.includes("down"))&&he.current-Ue>=aB&&(se.current=!0)}const xn=ve(Ye,Ge);let qn=oe.current.x,Kn=oe.current.y;D==="horizontal"?(h.includes("left")||h.includes("right"))&&(qn+=xn.x):(D==="vertical"||(h.includes("left")||h.includes("right"))&&(qn+=xn.x),(h.includes("up")||h.includes("down"))&&(Kn+=xn.y)),U({x:qn,y:Kn})}function _e(Me){var Ye;if(!N)return;if(I(!1),W(!1),z(null),(Ye=M.current)==null||Ye.releasePointerCapture(Me.pointerId),se.current){U({x:j.x,y:j.y}),P(void 0);return}let Pe=!1;const Xe=Q.x-j.x,Ze=Q.y-j.y;let tt;for(const Ge of h){switch(Ge){case"right":Xe>Xl&&(Pe=!0,tt="right");break;case"left":Xe<-Xl&&(Pe=!0,tt="left");break;case"down":Ze>Xl&&(Pe=!0,tt="down");break;case"up":Ze<-Xl&&(Pe=!0,tt="up");break}if(Pe)break}Pe?(P(tt),X(!0),y(r.id)):(U({x:j.x,y:j.y}),P(void 0))}function Qe(Me){if(Me.key==="Escape"){if(!M.current||!Rt(M.current,Bo(Xi(M.current))))return;y(r.id)}}S.useEffect(()=>{if(!d)return;const Me=M.current;if(!Me)return;function Pe(Xe){Rt(Me,Xe.target)&&Xe.preventDefault()}return Me.addEventListener("touchmove",Pe,{passive:!1}),()=>{Me.removeEventListener("touchmove",Pe)}},[d]);function At(){if(!N&&Q.x===j.x&&Q.y===j.y&&!Z)return{[Ps.swipeMovementX]:"0px",[Ps.swipeMovementY]:"0px"};const Me=Q.x-j.x,Pe=Q.y-j.y;return{transition:N?"none":void 0,transform:N?`translateX(${Q.x}px) translateY(${Q.y}px) scale(${j.scale})`:void 0,[Ps.swipeMovementX]:`${Me}px`,[Ps.swipeMovementY]:`${Pe}px`}}const $t=r.priority==="high",Lt={role:$t?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":J,"aria-describedby":H,"aria-hidden":$t&&!g?!0:void 0,onPointerDown:d?at:void 0,onPointerMove:d?De:void 0,onPointerUp:d?_e:void 0,onKeyDown:Qe,inert:Y2(r.limited),style:{...At(),[Ps.index]:r.transitionStatus==="ending"?Oe:Fe,[Ps.offsetY]:`${le}px`,[Ps.height]:r.height?`${r.height}px`:void 0}},gt=S.useMemo(()=>({rootRef:M,toast:r,titleId:J,setTitleId:q,descriptionId:H,setDescriptionId:A,swiping:N,swipeDirection:O,recalculateHeight:Se,index:Oe,visibleIndex:Fe,expanded:R}),[r,J,H,N,O,Se,Oe,Fe,R]),Ve=S.useMemo(()=>({transitionStatus:r.transitionStatus,expanded:R,limited:r.limited||!1,type:r.type,swiping:gt.swiping,swipeDirection:gt.swipeDirection}),[R,r.transitionStatus,r.limited,r.type,gt.swiping,gt.swipeDirection]),$e=vn("div",e,{ref:[t,gt.rootRef],state:Ve,stateAttributesMapping:lB,props:[Lt,c]});return C.jsx(xC.Provider,{value:gt,children:$e})}),hB=S.forwardRef(function(e,t){const{render:r,className:i,...s}=e,{visibleIndex:l,expanded:c,recalculateHeight:u}=Ko(),h=S.useRef(null);Le(()=>{const y=h.current;if(!y||(u(),typeof ResizeObserver!="function"||typeof MutationObserver!="function"))return;const x=new ResizeObserver(()=>u(!0)),b=new MutationObserver(()=>u(!0));return x.observe(y),b.observe(y,{childList:!0,subtree:!0,characterData:!0}),()=>{x.disconnect(),b.disconnect()}},[u]);const d=l>0,m=S.useMemo(()=>({expanded:c,behind:d}),[c,d]);return vn("div",e,{ref:[t,h],state:m,props:s})}),dB=S.forwardRef(function(e,t){const{render:r,className:i,id:s,children:l,...c}=e,{toast:u}=Ko(),h=l??u.description,d=!!h,m=Jo(s),{setDescriptionId:g}=Ko();Le(()=>{if(d)return g(m),()=>{g(void 0)}},[d,m,g]);const y=S.useMemo(()=>({type:u.type}),[u.type]),x=vn("p",e,{ref:t,state:y,props:{...c,id:m,children:h}});return d?x:null}),pB=S.forwardRef(function(e,t){const{render:r,className:i,id:s,children:l,...c}=e,{toast:u}=Ko(),h=l??u.title,d=!!h,m=Jo(s),{setTitleId:g}=Ko();Le(()=>{if(d)return g(m),()=>{g(void 0)}},[d,m,g]);const y=S.useMemo(()=>({type:u.type}),[u.type]),x=vn("h2",e,{ref:t,state:y,props:{...c,id:m,children:h}});return d?x:null}),mB=S.forwardRef(function(e,t){var b;const{render:r,className:i,disabled:s,nativeButton:l=!0,...c}=e,{toast:u}=Ko(),h=((b=u.actionProps)==null?void 0:b.children)??c.children,d=!!h,{getButtonProps:m,buttonRef:g}=dC({disabled:s,native:l}),y=S.useMemo(()=>({type:u.type}),[u.type]),x=vn("button",e,{ref:[t,g],state:y,props:[c,u.actionProps,m,{children:h}]});return d?x:null}),gB=$2;function yB(){const n=S.useContext(v0);if(!n)throw new Error(Un(73));const{toasts:e,add:t,close:r,update:i,promise:s}=n;return S.useMemo(()=>({toasts:e,add:t,close:r,update:i,promise:s}),[e,t,r,i,s])}function vB(){const n=[];function e(t){n.forEach(r=>r(t))}return{" subscribe":function(r){return n.push(r),()=>{const i=n.indexOf(r);i!==-1&&n.splice(i,1)}},add(t){const r=t.id||yC("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 wC=vB(),xB={error:HP,info:KP,loading:ab,success:UP,warning:eA};function wB({children:n,position:e="bottom-right",...t}){return C.jsxs(rB,{toastManager:wC,...t,children:[n,C.jsx(bB,{position:e})]})}function bB({position:n="bottom-right"}){const{toasts:e}=yB(),t=n.startsWith("top");return C.jsx(gB,{"data-slot":"toast-portal",children:C.jsx(oB,{className:yn("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?xB[r.type]:null;return C.jsx(fB,{className:yn("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:C.jsxs(hB,{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:[C.jsxs("div",{className:"flex gap-2",children:[i&&C.jsx("div",{className:"[&>svg]:h-lh [&>svg]:w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","data-slot":"toast-icon",children:C.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"})}),C.jsxs("div",{className:"flex flex-col gap-0.5",children:[C.jsx(pB,{className:"font-medium","data-slot":"toast-title"}),C.jsx(dB,{className:"text-muted-foreground","data-slot":"toast-description"})]})]}),r.actionProps&&C.jsx(mB,{className:mC({size:"xs"}),"data-slot":"toast-action",children:r.actionProps.children})]})},r.id)})})})}class SB extends S.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 _t;return C.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:C.jsx("div",{className:"max-w-md w-full",children:C.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[C.jsx("h1",{className:"text-2xl font-bold text-destructive mb-4",children:"Something went wrong"}),C.jsx("p",{className:"text-destructive/90 mb-4",children:e.message}),t&&C.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Error code: ",e.status]}),C.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 kB(){const[n,e]=S.useState([]),[t,r]=S.useState(!0);return S.useEffect(()=>{Lg().then(i=>{e(i),r(!1)}).catch(i=>{console.error("Failed to fetch sources:",i);const s=i instanceof _t?i.message:"Failed to load data sources";wC.add({title:s,type:"error"}),r(!1)})},[]),C.jsx(SB,{children:C.jsx(wB,{children:C.jsx(_3,{children:C.jsx(g3,{children:C.jsxs(As,{path:"/",element:C.jsx(kP,{sources:n,isLoading:t}),children:[C.jsx(As,{index:!0,element:C.jsx(CP,{})}),C.jsx(As,{path:"requests",element:C.jsx(LP,{})}),C.jsx(As,{path:"source/:sourceId",element:C.jsx(tA,{})}),C.jsx(As,{path:"source/:sourceId/tool/:toolName",element:C.jsx(tB,{})}),C.jsx(As,{path:"*",element:C.jsx(nB,{})})]})})})})})}k4.createRoot(document.getElementById("root")).render(C.jsx(S.StrictMode,{children:C.jsx(kB,{})}));
|