@i14ks/ccv 0.1.0 → 0.2.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.
@@ -1,133 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-D8swzi0v.js","./index-C-HuAiCn.js","./index-4x6fBcbV.js","./index-e0Ev4udb.js","./index-BBL1LP-l.js","./index-D0qAiokq.js","./index-BVHAVdqc.js","./index-Dw1tTDZW.js","./index-CtQ2lLVm.js","./index-CYyCCyf_.js","./index-CPBnfhi2.js","./index-CG3BWhrU.js","./index-DSNRlHPG.js","./index-DJN3PaCw.js","./index-BQbBSCN3.js"])))=>i.map(i=>d[i]);
2
- var c2=Object.defineProperty;var pv=n=>{throw TypeError(n)};var u2=(n,e,t)=>e in n?c2(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Mt=(n,e,t)=>u2(n,typeof e!="symbol"?e+"":e,t),ig=(n,e,t)=>e.has(n)||pv("Cannot "+t);var Ue=(n,e,t)=>(ig(n,e,"read from private field"),t?t.call(n):e.get(n)),$t=(n,e,t)=>e.has(n)?pv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),bt=(n,e,t,i)=>(ig(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),fn=(n,e,t)=>(ig(n,e,"access private method"),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(l){if(l.ep)return;l.ep=!0;const a=t(l);fetch(l.href,a)}})();var sg={exports:{}},iu={};/**
3
- * @license React
4
- * react-jsx-runtime.production.js
5
- *
6
- * Copyright (c) Meta Platforms, Inc. and affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var mv;function f2(){if(mv)return iu;mv=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,l,a){var o=null;if(a!==void 0&&(o=""+a),l.key!==void 0&&(o=""+l.key),"key"in l){a={};for(var u in l)u!=="key"&&(a[u]=l[u])}else a=l;return l=a.ref,{$$typeof:n,type:i,key:o,ref:l!==void 0?l:null,props:a}}return iu.Fragment=e,iu.jsx=t,iu.jsxs=t,iu}var gv;function h2(){return gv||(gv=1,sg.exports=f2()),sg.exports}var y=h2(),lg={exports:{}},Ye={};/**
11
- * @license React
12
- * react.production.js
13
- *
14
- * Copyright (c) Meta Platforms, Inc. and affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var yv;function d2(){if(yv)return Ye;yv=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),x=Symbol.iterator;function S(N){return N===null||typeof N!="object"?null:(N=x&&N[x]||N["@@iterator"],typeof N=="function"?N:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,C={};function E(N,F,J){this.props=N,this.context=F,this.refs=C,this.updater=J||w}E.prototype.isReactComponent={},E.prototype.setState=function(N,F){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,F,"setState")},E.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function O(){}O.prototype=E.prototype;function B(N,F,J){this.props=N,this.context=F,this.refs=C,this.updater=J||w}var q=B.prototype=new O;q.constructor=B,T(q,E.prototype),q.isPureReactComponent=!0;var H=Array.isArray;function L(){}var j={H:null,A:null,T:null,S:null},se=Object.prototype.hasOwnProperty;function he(N,F,J){var oe=J.ref;return{$$typeof:n,type:N,key:F,ref:oe!==void 0?oe:null,props:J}}function Me(N,F){return he(N.type,F,N.props)}function ue(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function le(N){var F={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(J){return F[J]})}var Ee=/\/+/g;function ve(N,F){return typeof N=="object"&&N!==null&&N.key!=null?le(""+N.key):F.toString(36)}function ke(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(L,L):(N.status="pending",N.then(function(F){N.status==="pending"&&(N.status="fulfilled",N.value=F)},function(F){N.status==="pending"&&(N.status="rejected",N.reason=F)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function I(N,F,J,oe,de){var Se=typeof N;(Se==="undefined"||Se==="boolean")&&(N=null);var Ie=!1;if(N===null)Ie=!0;else switch(Se){case"bigint":case"string":case"number":Ie=!0;break;case"object":switch(N.$$typeof){case n:case e:Ie=!0;break;case p:return Ie=N._init,I(Ie(N._payload),F,J,oe,de)}}if(Ie)return de=de(N),Ie=oe===""?"."+ve(N,0):oe,H(de)?(J="",Ie!=null&&(J=Ie.replace(Ee,"$&/")+"/"),I(de,F,J,"",function(It){return It})):de!=null&&(ue(de)&&(de=Me(de,J+(de.key==null||N&&N.key===de.key?"":(""+de.key).replace(Ee,"$&/")+"/")+Ie)),F.push(de)),1;Ie=0;var pt=oe===""?".":oe+":";if(H(N))for(var $e=0;$e<N.length;$e++)oe=N[$e],Se=pt+ve(oe,$e),Ie+=I(oe,F,J,Se,de);else if($e=S(N),typeof $e=="function")for(N=$e.call(N),$e=0;!(oe=N.next()).done;)oe=oe.value,Se=pt+ve(oe,$e++),Ie+=I(oe,F,J,Se,de);else if(Se==="object"){if(typeof N.then=="function")return I(ke(N),F,J,oe,de);throw F=String(N),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return Ie}function Z(N,F,J){if(N==null)return N;var oe=[],de=0;return I(N,oe,"","",function(Se){return F.call(J,Se,de++)}),oe}function ee(N){if(N._status===-1){var F=N._result;F=F(),F.then(function(J){(N._status===0||N._status===-1)&&(N._status=1,N._result=J)},function(J){(N._status===0||N._status===-1)&&(N._status=2,N._result=J)}),N._status===-1&&(N._status=0,N._result=F)}if(N._status===1)return N._result.default;throw N._result}var Ne=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},_e={map:Z,forEach:function(N,F,J){Z(N,function(){F.apply(this,arguments)},J)},count:function(N){var F=0;return Z(N,function(){F++}),F},toArray:function(N){return Z(N,function(F){return F})||[]},only:function(N){if(!ue(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return Ye.Activity=b,Ye.Children=_e,Ye.Component=E,Ye.Fragment=t,Ye.Profiler=l,Ye.PureComponent=B,Ye.StrictMode=i,Ye.Suspense=f,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(N){return j.H.useMemoCache(N)}},Ye.cache=function(N){return function(){return N.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(N,F,J){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var oe=T({},N.props),de=N.key;if(F!=null)for(Se in F.key!==void 0&&(de=""+F.key),F)!se.call(F,Se)||Se==="key"||Se==="__self"||Se==="__source"||Se==="ref"&&F.ref===void 0||(oe[Se]=F[Se]);var Se=arguments.length-2;if(Se===1)oe.children=J;else if(1<Se){for(var Ie=Array(Se),pt=0;pt<Se;pt++)Ie[pt]=arguments[pt+2];oe.children=Ie}return he(N.type,de,oe)},Ye.createContext=function(N){return N={$$typeof:o,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:a,_context:N},N},Ye.createElement=function(N,F,J){var oe,de={},Se=null;if(F!=null)for(oe in F.key!==void 0&&(Se=""+F.key),F)se.call(F,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(de[oe]=F[oe]);var Ie=arguments.length-2;if(Ie===1)de.children=J;else if(1<Ie){for(var pt=Array(Ie),$e=0;$e<Ie;$e++)pt[$e]=arguments[$e+2];de.children=pt}if(N&&N.defaultProps)for(oe in Ie=N.defaultProps,Ie)de[oe]===void 0&&(de[oe]=Ie[oe]);return he(N,Se,de)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(N){return{$$typeof:u,render:N}},Ye.isValidElement=ue,Ye.lazy=function(N){return{$$typeof:p,_payload:{_status:-1,_result:N},_init:ee}},Ye.memo=function(N,F){return{$$typeof:d,type:N,compare:F===void 0?null:F}},Ye.startTransition=function(N){var F=j.T,J={};j.T=J;try{var oe=N(),de=j.S;de!==null&&de(J,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(L,Ne)}catch(Se){Ne(Se)}finally{F!==null&&J.types!==null&&(F.types=J.types),j.T=F}},Ye.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Ye.use=function(N){return j.H.use(N)},Ye.useActionState=function(N,F,J){return j.H.useActionState(N,F,J)},Ye.useCallback=function(N,F){return j.H.useCallback(N,F)},Ye.useContext=function(N){return j.H.useContext(N)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(N,F){return j.H.useDeferredValue(N,F)},Ye.useEffect=function(N,F){return j.H.useEffect(N,F)},Ye.useEffectEvent=function(N){return j.H.useEffectEvent(N)},Ye.useId=function(){return j.H.useId()},Ye.useImperativeHandle=function(N,F,J){return j.H.useImperativeHandle(N,F,J)},Ye.useInsertionEffect=function(N,F){return j.H.useInsertionEffect(N,F)},Ye.useLayoutEffect=function(N,F){return j.H.useLayoutEffect(N,F)},Ye.useMemo=function(N,F){return j.H.useMemo(N,F)},Ye.useOptimistic=function(N,F){return j.H.useOptimistic(N,F)},Ye.useReducer=function(N,F,J){return j.H.useReducer(N,F,J)},Ye.useRef=function(N){return j.H.useRef(N)},Ye.useState=function(N){return j.H.useState(N)},Ye.useSyncExternalStore=function(N,F,J){return j.H.useSyncExternalStore(N,F,J)},Ye.useTransition=function(){return j.H.useTransition()},Ye.version="19.2.8",Ye}var bv;function Z0(){return bv||(bv=1,lg.exports=d2()),lg.exports}var M=Z0(),rg={exports:{}},su={},ag={exports:{}},og={};/**
19
- * @license React
20
- * scheduler.production.js
21
- *
22
- * Copyright (c) Meta Platforms, Inc. and affiliates.
23
- *
24
- * This source code is licensed under the MIT license found in the
25
- * LICENSE file in the root directory of this source tree.
26
- */var xv;function p2(){return xv||(xv=1,(function(n){function e(I,Z){var ee=I.length;I.push(Z);e:for(;0<ee;){var Ne=ee-1>>>1,_e=I[Ne];if(0<l(_e,Z))I[Ne]=Z,I[ee]=_e,ee=Ne;else break e}}function t(I){return I.length===0?null:I[0]}function i(I){if(I.length===0)return null;var Z=I[0],ee=I.pop();if(ee!==Z){I[0]=ee;e:for(var Ne=0,_e=I.length,N=_e>>>1;Ne<N;){var F=2*(Ne+1)-1,J=I[F],oe=F+1,de=I[oe];if(0>l(J,ee))oe<_e&&0>l(de,J)?(I[Ne]=de,I[oe]=ee,Ne=oe):(I[Ne]=J,I[F]=ee,Ne=F);else if(oe<_e&&0>l(de,ee))I[Ne]=de,I[oe]=ee,Ne=oe;else break e}}return Z}function l(I,Z){var ee=I.sortIndex-Z.sortIndex;return ee!==0?ee:I.id-Z.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;n.unstable_now=function(){return a.now()}}else{var o=Date,u=o.now();n.unstable_now=function(){return o.now()-u}}var f=[],d=[],p=1,b=null,x=3,S=!1,w=!1,T=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function q(I){for(var Z=t(d);Z!==null;){if(Z.callback===null)i(d);else if(Z.startTime<=I)i(d),Z.sortIndex=Z.expirationTime,e(f,Z);else break;Z=t(d)}}function H(I){if(T=!1,q(I),!w)if(t(f)!==null)w=!0,L||(L=!0,le());else{var Z=t(d);Z!==null&&ke(H,Z.startTime-I)}}var L=!1,j=-1,se=5,he=-1;function Me(){return C?!0:!(n.unstable_now()-he<se)}function ue(){if(C=!1,L){var I=n.unstable_now();he=I;var Z=!0;try{e:{w=!1,T&&(T=!1,O(j),j=-1),S=!0;var ee=x;try{t:{for(q(I),b=t(f);b!==null&&!(b.expirationTime>I&&Me());){var Ne=b.callback;if(typeof Ne=="function"){b.callback=null,x=b.priorityLevel;var _e=Ne(b.expirationTime<=I);if(I=n.unstable_now(),typeof _e=="function"){b.callback=_e,q(I),Z=!0;break t}b===t(f)&&i(f),q(I)}else i(f);b=t(f)}if(b!==null)Z=!0;else{var N=t(d);N!==null&&ke(H,N.startTime-I),Z=!1}}break e}finally{b=null,x=ee,S=!1}Z=void 0}}finally{Z?le():L=!1}}}var le;if(typeof B=="function")le=function(){B(ue)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,ve=Ee.port2;Ee.port1.onmessage=ue,le=function(){ve.postMessage(null)}}else le=function(){E(ue,0)};function ke(I,Z){j=E(function(){I(n.unstable_now())},Z)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(I){I.callback=null},n.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):se=0<I?Math.floor(1e3/I):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(I){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var ee=x;x=Z;try{return I()}finally{x=ee}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(I,Z){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var ee=x;x=I;try{return Z()}finally{x=ee}},n.unstable_scheduleCallback=function(I,Z,ee){var Ne=n.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?Ne+ee:Ne):ee=Ne,I){case 1:var _e=-1;break;case 2:_e=250;break;case 5:_e=1073741823;break;case 4:_e=1e4;break;default:_e=5e3}return _e=ee+_e,I={id:p++,callback:Z,priorityLevel:I,startTime:ee,expirationTime:_e,sortIndex:-1},ee>Ne?(I.sortIndex=ee,e(d,I),t(f)===null&&I===t(d)&&(T?(O(j),j=-1):T=!0,ke(H,ee-Ne))):(I.sortIndex=_e,e(f,I),w||S||(w=!0,L||(L=!0,le()))),I},n.unstable_shouldYield=Me,n.unstable_wrapCallback=function(I){var Z=x;return function(){var ee=x;x=Z;try{return I.apply(this,arguments)}finally{x=ee}}}})(og)),og}var vv;function m2(){return vv||(vv=1,ag.exports=p2()),ag.exports}var cg={exports:{}},Jn={};/**
27
- * @license React
28
- * react-dom.production.js
29
- *
30
- * Copyright (c) Meta Platforms, Inc. and affiliates.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE file in the root directory of this source tree.
34
- */var Sv;function g2(){if(Sv)return Jn;Sv=1;var n=Z0();function e(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var i={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},l=Symbol.for("react.portal");function a(f,d,p){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:b==null?null:""+b,children:f,containerInfo:d,implementation:p}}var o=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Jn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Jn.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return a(f,d,null,p)},Jn.flushSync=function(f){var d=o.T,p=i.p;try{if(o.T=null,i.p=2,f)return f()}finally{o.T=d,i.p=p,i.d.f()}},Jn.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(f,d))},Jn.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},Jn.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,b=u(p,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,S=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?i.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:b,integrity:x,fetchPriority:S}):p==="script"&&i.d.X(f,{crossOrigin:b,integrity:x,fetchPriority:S,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Jn.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=u(d.as,d.crossOrigin);i.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(f)},Jn.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,b=u(p,d.crossOrigin);i.d.L(f,p,{crossOrigin:b,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Jn.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=u(d.as,d.crossOrigin);i.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(f)},Jn.requestFormReset=function(f){i.d.r(f)},Jn.unstable_batchedUpdates=function(f,d){return f(d)},Jn.useFormState=function(f,d,p){return o.H.useFormState(f,d,p)},Jn.useFormStatus=function(){return o.H.useHostTransitionStatus()},Jn.version="19.2.8",Jn}var wv;function y2(){if(wv)return cg.exports;wv=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(),cg.exports=g2(),cg.exports}/**
35
- * @license React
36
- * react-dom-client.production.js
37
- *
38
- * Copyright (c) Meta Platforms, Inc. and affiliates.
39
- *
40
- * This source code is licensed under the MIT license found in the
41
- * LICENSE file in the root directory of this source tree.
42
- */var kv;function b2(){if(kv)return su;kv=1;var n=m2(),e=Z0(),t=y2();function i(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)r+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function a(s){var r=s,c=s;if(s.alternate)for(;r.return;)r=r.return;else{s=r;do r=s,(r.flags&4098)!==0&&(c=r.return),s=r.return;while(s)}return r.tag===3?c:null}function o(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function u(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function f(s){if(a(s)!==s)throw Error(i(188))}function d(s){var r=s.alternate;if(!r){if(r=a(s),r===null)throw Error(i(188));return r!==s?null:s}for(var c=s,h=r;;){var m=c.return;if(m===null)break;var g=m.alternate;if(g===null){if(h=m.return,h!==null){c=h;continue}break}if(m.child===g.child){for(g=m.child;g;){if(g===c)return f(m),s;if(g===h)return f(m),r;g=g.sibling}throw Error(i(188))}if(c.return!==h.return)c=m,h=g;else{for(var v=!1,A=m.child;A;){if(A===c){v=!0,c=m,h=g;break}if(A===h){v=!0,h=m,c=g;break}A=A.sibling}if(!v){for(A=g.child;A;){if(A===c){v=!0,c=g,h=m;break}if(A===h){v=!0,h=g,c=m;break}A=A.sibling}if(!v)throw Error(i(189))}}if(c.alternate!==h)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?s:r}function p(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=p(s),r!==null)return r;s=s.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),B=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),se=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),Me=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function le(s){return s===null||typeof s!="object"?null:(s=ue&&s[ue]||s["@@iterator"],typeof s=="function"?s:null)}var Ee=Symbol.for("react.client.reference");function ve(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Ee?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case T:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case H:return"Suspense";case L:return"SuspenseList";case he:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case B:return s.displayName||"Context";case O:return(s._context.displayName||"Context")+".Consumer";case q:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case j:return r=s.displayName||null,r!==null?r:ve(s.type)||"Memo";case se:r=s._payload,s=s._init;try{return ve(s(r))}catch{}}return null}var ke=Array.isArray,I=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},Ne=[],_e=-1;function N(s){return{current:s}}function F(s){0>_e||(s.current=Ne[_e],Ne[_e]=null,_e--)}function J(s,r){_e++,Ne[_e]=s.current,s.current=r}var oe=N(null),de=N(null),Se=N(null),Ie=N(null);function pt(s,r){switch(J(Se,r),J(de,s),J(oe,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?z1(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=z1(r),s=H1(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}F(oe),J(oe,s)}function $e(){F(oe),F(de),F(Se)}function It(s){s.memoizedState!==null&&J(Ie,s);var r=oe.current,c=H1(r,s.type);r!==c&&(J(de,s),J(oe,c))}function Ze(s){de.current===s&&(F(oe),F(de)),Ie.current===s&&(F(Ie),Jc._currentValue=ee)}var Kt,at;function we(s){if(Kt===void 0)try{throw Error()}catch(c){var r=c.stack.trim().match(/\n( *(at )?)/);Kt=r&&r[1]||"",at=-1<c.stack.indexOf(`
43
- at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+Kt+s+at}var xe=!1;function Ft(s,r){if(!s||xe)return"";xe=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(r){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(W){var P=W}Reflect.construct(s,[],te)}else{try{te.call()}catch(W){P=W}s.call(te.prototype)}}else{try{throw Error()}catch(W){P=W}(te=s())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(W){if(W&&P&&typeof W.stack=="string")return[W.stack,P.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=h.DetermineComponentFrameRoot(),v=g[0],A=g[1];if(v&&A){var D=v.split(`
45
- `),G=A.split(`
46
- `);for(m=h=0;h<D.length&&!D[h].includes("DetermineComponentFrameRoot");)h++;for(;m<G.length&&!G[m].includes("DetermineComponentFrameRoot");)m++;if(h===D.length||m===G.length)for(h=D.length-1,m=G.length-1;1<=h&&0<=m&&D[h]!==G[m];)m--;for(;1<=h&&0<=m;h--,m--)if(D[h]!==G[m]){if(h!==1||m!==1)do if(h--,m--,0>m||D[h]!==G[m]){var K=`
47
- `+D[h].replace(" at new "," at ");return s.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",s.displayName)),K}while(1<=h&&0<=m);break}}}finally{xe=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?we(c):""}function xn(s,r){switch(s.tag){case 26:case 27:case 5:return we(s.type);case 16:return we("Lazy");case 13:return s.child!==r&&r!==null?we("Suspense Fallback"):we("Suspense");case 19:return we("SuspenseList");case 0:case 15:return Ft(s.type,!1);case 11:return Ft(s.type.render,!1);case 1:return Ft(s.type,!0);case 31:return we("Activity");default:return""}}function Ve(s){try{var r="",c=null;do r+=xn(s,c),c=s,s=s.return;while(s);return r}catch(h){return`
48
- Error generating stack: `+h.message+`
49
- `+h.stack}}var Rn=Object.prototype.hasOwnProperty,si=n.unstable_scheduleCallback,ce=n.unstable_cancelCallback,qe=n.unstable_shouldYield,St=n.unstable_requestPaint,Fe=n.unstable_now,$=n.unstable_getCurrentPriorityLevel,fe=n.unstable_ImmediatePriority,ze=n.unstable_UserBlockingPriority,Je=n.unstable_NormalPriority,vn=n.unstable_LowPriority,$n=n.unstable_IdlePriority,Wl=n.log,$l=n.unstable_setDisableYieldValue,hs=null,Sn=null;function Ei(s){if(typeof Wl=="function"&&$l(s),Sn&&typeof Sn.setStrictMode=="function")try{Sn.setStrictMode(hs,s)}catch{}}var mn=Math.clz32?Math.clz32:wn,Hs=Math.log,Kn=Math.LN2;function wn(s){return s>>>=0,s===0?32:31-(Hs(s)/Kn|0)|0}var Xt=256,Is=262144,ds=4194304;function Xn(s){var r=s&42;if(r!==0)return r;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ml(s,r,c){var h=s.pendingLanes;if(h===0)return 0;var m=0,g=s.suspendedLanes,v=s.pingedLanes;s=s.warmLanes;var A=h&134217727;return A!==0?(h=A&~g,h!==0?m=Xn(h):(v&=A,v!==0?m=Xn(v):c||(c=A&~s,c!==0&&(m=Xn(c))))):(A=h&~g,A!==0?m=Xn(A):v!==0?m=Xn(v):c||(c=h&~s,c!==0&&(m=Xn(c)))),m===0?0:r!==0&&r!==m&&(r&g)===0&&(g=m&-m,c=r&-r,g>=c||g===32&&(c&4194048)!==0)?r:m}function li(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function Kl(s,r){switch(s){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jn(){var s=ds;return ds<<=1,(ds&62914560)===0&&(ds=4194304),s}function ri(s){for(var r=[],c=0;31>c;c++)r.push(s);return r}function mi(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Ln(s,r,c,h,m,g){var v=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var A=s.entanglements,D=s.expirationTimes,G=s.hiddenUpdates;for(c=v&~c;0<c;){var K=31-mn(c),te=1<<K;A[K]=0,D[K]=-1;var P=G[K];if(P!==null)for(G[K]=null,K=0;K<P.length;K++){var W=P[K];W!==null&&(W.lane&=-536870913)}c&=~te}h!==0&&Us(s,h,0),g!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=g&~(v&~r))}function Us(s,r,c){s.pendingLanes|=r,s.suspendedLanes&=~r;var h=31-mn(r);s.entangledLanes|=r,s.entanglements[h]=s.entanglements[h]|1073741824|c&261930}function Ni(s,r){var c=s.entangledLanes|=r;for(s=s.entanglements;c;){var h=31-mn(c),m=1<<h;m&r|s[h]&r&&(s[h]|=r),c&=~m}}function $i(s,r){var c=r&-r;return c=(c&42)!==0?1:ps(c),(c&(s.suspendedLanes|r))!==0?0:c}function ps(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Ki(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Vs(){var s=Z.p;return s!==0?s:(s=window.event,s===void 0?32:av(s.type))}function kn(s,r){var c=Z.p;try{return Z.p=s,r()}finally{Z.p=c}}var ai=Math.random().toString(36).slice(2),Nt="__reactFiber$"+ai,Xe="__reactProps$"+ai,en="__reactContainer$"+ai,ms="__reactEvents$"+ai,gl="__reactListeners$"+ai,gs="__reactHandles$"+ai,qs="__reactResources$"+ai,Gs="__reactMarker$"+ai;function yl(s){delete s[Nt],delete s[Xe],delete s[ms],delete s[gl],delete s[gs]}function Di(s){var r=s[Nt];if(r)return r;for(var c=s.parentNode;c;){if(r=c[en]||c[Nt]){if(c=r.alternate,r.child!==null||c!==null&&c.child!==null)for(s=Y1(s);s!==null;){if(c=s[Nt])return c;s=Y1(s)}return r}s=c,c=s.parentNode}return null}function ys(s){if(s=s[Nt]||s[en]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function Xi(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(i(33))}function An(s){var r=s[qs];return r||(r=s[qs]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function wt(s){s[Gs]=!0}var Qn=new Set,Ha={};function oi(s,r){Oi(s,r),Oi(s+"Capture",r)}function Oi(s,r){for(Ha[s]=r,s=0;s<r.length;s++)Qn.add(r[s])}var Xl=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ql={},Qi={};function bs(s){return Rn.call(Qi,s)?!0:Rn.call(Ql,s)?!1:Xl.test(s)?Qi[s]=!0:(Ql[s]=!0,!1)}function Ri(s,r,c){if(bs(r))if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var h=r.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,""+c)}}function gi(s,r,c){if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,""+c)}}function rn(s,r,c,h){if(h===null)s.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(r,c,""+h)}}function Bt(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function bl(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function ji(s,r,c){var h=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var m=h.get,g=h.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return m.call(this)},set:function(v){c=""+v,g.call(this,v)}}),Object.defineProperty(s,r,{enumerable:h.enumerable}),{getValue:function(){return c},setValue:function(v){c=""+v},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function xs(s){if(!s._valueTracker){var r=bl(s)?"checked":"value";s._valueTracker=ji(s,r,""+s[r])}}function vs(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var c=r.getValue(),h="";return s&&(h=bl(s)?s.checked?"true":"false":s.value),s=h,s!==c?(r.setValue(s),!0):!1}function yi(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Ps=/[\n"\\]/g;function Dt(s){return s.replace(Ps,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Cn(s,r,c,h,m,g,v,A){s.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?s.type=v:s.removeAttribute("type"),r!=null?v==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+Bt(r)):s.value!==""+Bt(r)&&(s.value=""+Bt(r)):v!=="submit"&&v!=="reset"||s.removeAttribute("value"),r!=null?Tn(s,v,Bt(r)):c!=null?Tn(s,v,Bt(c)):h!=null&&s.removeAttribute("value"),m==null&&g!=null&&(s.defaultChecked=!!g),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?s.name=""+Bt(A):s.removeAttribute("name")}function Zl(s,r,c,h,m,g,v,A){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(s.type=g),r!=null||c!=null){if(!(g!=="submit"&&g!=="reset"||r!=null)){xs(s);return}c=c!=null?""+Bt(c):"",r=r!=null?""+Bt(r):c,A||r===s.value||(s.value=r),s.defaultValue=r}h=h??m,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=A?s.checked:!!h,s.defaultChecked=!!h,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.name=v),xs(s)}function Tn(s,r,c){r==="number"&&yi(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function Li(s,r,c,h){if(s=s.options,r){r={};for(var m=0;m<c.length;m++)r["$"+c[m]]=!0;for(c=0;c<s.length;c++)m=r.hasOwnProperty("$"+s[c].value),s[c].selected!==m&&(s[c].selected=m),m&&h&&(s[c].defaultSelected=!0)}else{for(c=""+Bt(c),r=null,m=0;m<s.length;m++){if(s[m].value===c){s[m].selected=!0,h&&(s[m].defaultSelected=!0);return}r!==null||s[m].disabled||(r=s[m])}r!==null&&(r.selected=!0)}}function ae(s,r,c){if(r!=null&&(r=""+Bt(r),r!==s.value&&(s.value=r),c==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=c!=null?""+Bt(c):""}function _(s,r,c,h){if(r==null){if(h!=null){if(c!=null)throw Error(i(92));if(ke(h)){if(1<h.length)throw Error(i(93));h=h[0]}c=h}c==null&&(c=""),r=c}c=Bt(r),s.defaultValue=c,h=s.textContent,h===c&&h!==""&&h!==null&&(s.value=h),xs(s)}function U(s,r){if(r){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=r;return}}s.textContent=r}var ie=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ae(s,r,c){var h=r.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?h?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":h?s.setProperty(r,c):typeof c!="number"||c===0||ie.has(r)?r==="float"?s.cssFloat=c:s[r]=(""+c).trim():s[r]=c+"px"}function Oe(s,r,c){if(r!=null&&typeof r!="object")throw Error(i(62));if(s=s.style,c!=null){for(var h in c)!c.hasOwnProperty(h)||r!=null&&r.hasOwnProperty(h)||(h.indexOf("--")===0?s.setProperty(h,""):h==="float"?s.cssFloat="":s[h]="");for(var m in r)h=r[m],r.hasOwnProperty(m)&&c[m]!==h&&Ae(s,m,h)}else for(var g in r)r.hasOwnProperty(g)&&Ae(s,g,r[g])}function je(s){if(s.indexOf("-")===-1)return!1;switch(s){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 xt=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Gt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function gn(s){return Gt.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function zt(){}var re=null;function pe(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Jl=null,er=null;function sf(s){var r=ys(s);if(r&&(s=r.stateNode)){var c=s[Xe]||null;e:switch(s=r.stateNode,r.type){case"input":if(Cn(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),r=c.name,c.type==="radio"&&r!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Dt(""+r)+'"][type="radio"]'),r=0;r<c.length;r++){var h=c[r];if(h!==s&&h.form===s.form){var m=h[Xe]||null;if(!m)throw Error(i(90));Cn(h,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(r=0;r<c.length;r++)h=c[r],h.form===s.form&&vs(h)}break e;case"textarea":ae(s,c.value,c.defaultValue);break e;case"select":r=c.value,r!=null&&Li(s,!!c.multiple,r,!1)}}}var cc=!1;function lf(s,r,c){if(cc)return s(r,c);cc=!0;try{var h=s(r);return h}finally{if(cc=!1,(Jl!==null||er!==null)&&(Zf(),Jl&&(r=Jl,s=er,er=Jl=null,sf(r),s)))for(r=0;r<s.length;r++)sf(s[r])}}function Ss(s,r){var c=s.stateNode;if(c===null)return null;var h=c[Xe]||null;if(h===null)return null;c=h[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(i(231,r,typeof c));return c}var ws=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uc=!1;if(ws)try{var Fr={};Object.defineProperty(Fr,"passive",{get:function(){uc=!0}}),window.addEventListener("test",Fr,Fr),window.removeEventListener("test",Fr,Fr)}catch{uc=!1}var Ys=null,Ia=null,Wr=null;function rf(){if(Wr)return Wr;var s,r=Ia,c=r.length,h,m="value"in Ys?Ys.value:Ys.textContent,g=m.length;for(s=0;s<c&&r[s]===m[s];s++);var v=c-s;for(h=1;h<=v&&r[c-h]===m[g-h];h++);return Wr=m.slice(s,1<h?1-h:void 0)}function $r(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function tr(){return!0}function af(){return!1}function Zn(s){function r(c,h,m,g,v){this._reactName=c,this._targetInst=m,this.type=h,this.nativeEvent=g,this.target=v,this.currentTarget=null;for(var A in s)s.hasOwnProperty(A)&&(c=s[A],this[A]=c?c(g):g[A]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?tr:af,this.isPropagationStopped=af,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=tr)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=tr)},persist:function(){},isPersistent:tr}),r}var xl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ua=Zn(xl),ks=b({},xl,{view:0,detail:0}),of=Zn(ks),fc,Va,Kr,qa=b({},ks,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gc,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Kr&&(Kr&&s.type==="mousemove"?(fc=s.screenX-Kr.screenX,Va=s.screenY-Kr.screenY):Va=fc=0,Kr=s),fc)},movementY:function(s){return"movementY"in s?s.movementY:Va}}),cf=Zn(qa),ep=b({},qa,{dataTransfer:0}),uf=Zn(ep),tp=b({},ks,{relatedTarget:0}),hc=Zn(tp),np=b({},xl,{animationName:0,elapsedTime:0,pseudoElement:0}),ip=Zn(np),dc=b({},xl,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),pc=Zn(dc),mc=b({},xl,{data:0}),ff=Zn(mc),sp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},lp={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"},rp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ap(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=rp[s])?!!r[s]:!1}function gc(){return ap}var op=b({},ks,{key:function(s){if(s.key){var r=sp[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=$r(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?lp[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gc,charCode:function(s){return s.type==="keypress"?$r(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?$r(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),hf=Zn(op),df=b({},qa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xr=Zn(df),As=b({},ks,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),pf=Zn(As),yc=b({},xl,{propertyName:0,elapsedTime:0,pseudoElement:0}),mf=Zn(yc),Ga=b({},qa,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),gf=Zn(Ga),cp=b({},xl,{newState:0,oldState:0}),Qr=Zn(cp),yf=[9,13,27,32],bc=ws&&"CompositionEvent"in window,vl=null;ws&&"documentMode"in document&&(vl=document.documentMode);var up=ws&&"TextEvent"in window&&!vl,nr=ws&&(!bc||vl&&8<vl&&11>=vl),xc=" ",vc=!1;function Sc(s,r){switch(s){case"keyup":return yf.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pa(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Sl=!1;function k(s,r){switch(s){case"compositionend":return Pa(r);case"keypress":return r.which!==32?null:(vc=!0,xc);case"textInput":return s=r.data,s===xc&&vc?null:s;default:return null}}function ne(s,r){if(Sl)return s==="compositionend"||!bc&&Sc(s,r)?(s=rf(),Wr=Ia=Ys=null,Sl=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return nr&&r.locale!=="ko"?null:r.data;default:return null}}var Te={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 Qe(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!Te[s.type]:r==="textarea"}function _n(s,r,c,h){Jl?er?er.push(h):er=[h]:Jl=h,r=lh(r,"onChange"),0<r.length&&(c=new Ua("onChange","change",null,c,h),s.push({event:c,listeners:r}))}var Be=null,Pe=null;function et(s){D1(s,0)}function Wt(s){var r=Xi(s);if(vs(r))return s}function ci(s,r){if(s==="change")return r}var Zr=!1;if(ws){var wc;if(ws){var fp="oninput"in document;if(!fp){var Zy=document.createElement("div");Zy.setAttribute("oninput","return;"),fp=typeof Zy.oninput=="function"}wc=fp}else wc=!1;Zr=wc&&(!document.documentMode||9<document.documentMode)}function Jy(){Be&&(Be.detachEvent("onpropertychange",eb),Pe=Be=null)}function eb(s){if(s.propertyName==="value"&&Wt(Pe)){var r=[];_n(r,Pe,s,pe(s)),lf(et,r)}}function zT(s,r,c){s==="focusin"?(Jy(),Be=r,Pe=c,Be.attachEvent("onpropertychange",eb)):s==="focusout"&&Jy()}function HT(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Wt(Pe)}function IT(s,r){if(s==="click")return Wt(r)}function UT(s,r){if(s==="input"||s==="change")return Wt(r)}function VT(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var Bi=typeof Object.is=="function"?Object.is:VT;function kc(s,r){if(Bi(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var c=Object.keys(s),h=Object.keys(r);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var m=c[h];if(!Rn.call(r,m)||!Bi(s[m],r[m]))return!1}return!0}function tb(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function nb(s,r){var c=tb(s);s=0;for(var h;c;){if(c.nodeType===3){if(h=s+c.textContent.length,s<=r&&h>=r)return{node:c,offset:r-s};s=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=tb(c)}}function ib(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?ib(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function sb(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=yi(s.document);r instanceof s.HTMLIFrameElement;){try{var c=typeof r.contentWindow.location.href=="string"}catch{c=!1}if(c)s=r.contentWindow;else break;r=yi(s.document)}return r}function hp(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r&&(r==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||r==="textarea"||s.contentEditable==="true")}var qT=ws&&"documentMode"in document&&11>=document.documentMode,Ya=null,dp=null,Ac=null,pp=!1;function lb(s,r,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;pp||Ya==null||Ya!==yi(h)||(h=Ya,"selectionStart"in h&&hp(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Ac&&kc(Ac,h)||(Ac=h,h=lh(dp,"onSelect"),0<h.length&&(r=new Ua("onSelect","select",null,r,c),s.push({event:r,listeners:h}),r.target=Ya)))}function Jr(s,r){var c={};return c[s.toLowerCase()]=r.toLowerCase(),c["Webkit"+s]="webkit"+r,c["Moz"+s]="moz"+r,c}var Fa={animationend:Jr("Animation","AnimationEnd"),animationiteration:Jr("Animation","AnimationIteration"),animationstart:Jr("Animation","AnimationStart"),transitionrun:Jr("Transition","TransitionRun"),transitionstart:Jr("Transition","TransitionStart"),transitioncancel:Jr("Transition","TransitionCancel"),transitionend:Jr("Transition","TransitionEnd")},mp={},rb={};ws&&(rb=document.createElement("div").style,"AnimationEvent"in window||(delete Fa.animationend.animation,delete Fa.animationiteration.animation,delete Fa.animationstart.animation),"TransitionEvent"in window||delete Fa.transitionend.transition);function ea(s){if(mp[s])return mp[s];if(!Fa[s])return s;var r=Fa[s],c;for(c in r)if(r.hasOwnProperty(c)&&c in rb)return mp[s]=r[c];return s}var ab=ea("animationend"),ob=ea("animationiteration"),cb=ea("animationstart"),GT=ea("transitionrun"),PT=ea("transitionstart"),YT=ea("transitioncancel"),ub=ea("transitionend"),fb=new Map,gp="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");gp.push("scrollEnd");function Cs(s,r){fb.set(s,r),oi(r,[s])}var bf=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Zi=[],Wa=0,yp=0;function xf(){for(var s=Wa,r=yp=Wa=0;r<s;){var c=Zi[r];Zi[r++]=null;var h=Zi[r];Zi[r++]=null;var m=Zi[r];Zi[r++]=null;var g=Zi[r];if(Zi[r++]=null,h!==null&&m!==null){var v=h.pending;v===null?m.next=m:(m.next=v.next,v.next=m),h.pending=m}g!==0&&hb(c,m,g)}}function vf(s,r,c,h){Zi[Wa++]=s,Zi[Wa++]=r,Zi[Wa++]=c,Zi[Wa++]=h,yp|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function bp(s,r,c,h){return vf(s,r,c,h),Sf(s)}function ta(s,r){return vf(s,null,null,r),Sf(s)}function hb(s,r,c){s.lanes|=c;var h=s.alternate;h!==null&&(h.lanes|=c);for(var m=!1,g=s.return;g!==null;)g.childLanes|=c,h=g.alternate,h!==null&&(h.childLanes|=c),g.tag===22&&(s=g.stateNode,s===null||s._visibility&1||(m=!0)),s=g,g=g.return;return s.tag===3?(g=s.stateNode,m&&r!==null&&(m=31-mn(c),s=g.hiddenUpdates,h=s[m],h===null?s[m]=[r]:h.push(r),r.lane=c|536870912),g):null}function Sf(s){if(50<Fc)throw Fc=0,_m=null,Error(i(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var $a={};function FT(s,r,c,h){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zi(s,r,c,h){return new FT(s,r,c,h)}function xp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function wl(s,r){var c=s.alternate;return c===null?(c=zi(s.tag,r,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=r,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,r=s.dependencies,c.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function db(s,r){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,r=c.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function wf(s,r,c,h,m,g){var v=0;if(h=s,typeof s=="function")xp(s)&&(v=1);else if(typeof s=="string")v=Q_(s,c,oe.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case he:return s=zi(31,c,r,m),s.elementType=he,s.lanes=g,s;case T:return na(c.children,m,g,r);case C:v=8,m|=24;break;case E:return s=zi(12,c,r,m|2),s.elementType=E,s.lanes=g,s;case H:return s=zi(13,c,r,m),s.elementType=H,s.lanes=g,s;case L:return s=zi(19,c,r,m),s.elementType=L,s.lanes=g,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case B:v=10;break e;case O:v=9;break e;case q:v=11;break e;case j:v=14;break e;case se:v=16,h=null;break e}v=29,c=Error(i(130,s===null?"null":typeof s,"")),h=null}return r=zi(v,c,r,m),r.elementType=s,r.type=h,r.lanes=g,r}function na(s,r,c,h){return s=zi(7,s,h,r),s.lanes=c,s}function vp(s,r,c){return s=zi(6,s,null,r),s.lanes=c,s}function pb(s){var r=zi(18,null,null,0);return r.stateNode=s,r}function Sp(s,r,c){return r=zi(4,s.children!==null?s.children:[],s.key,r),r.lanes=c,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var mb=new WeakMap;function Ji(s,r){if(typeof s=="object"&&s!==null){var c=mb.get(s);return c!==void 0?c:(r={value:s,source:r,stack:Ve(r)},mb.set(s,r),r)}return{value:s,source:r,stack:Ve(r)}}var Ka=[],Xa=0,kf=null,Cc=0,es=[],ts=0,ir=null,Fs=1,Ws="";function kl(s,r){Ka[Xa++]=Cc,Ka[Xa++]=kf,kf=s,Cc=r}function gb(s,r,c){es[ts++]=Fs,es[ts++]=Ws,es[ts++]=ir,ir=s;var h=Fs;s=Ws;var m=32-mn(h)-1;h&=~(1<<m),c+=1;var g=32-mn(r)+m;if(30<g){var v=m-m%5;g=(h&(1<<v)-1).toString(32),h>>=v,m-=v,Fs=1<<32-mn(r)+m|c<<m|h,Ws=g+s}else Fs=1<<g|c<<m|h,Ws=s}function wp(s){s.return!==null&&(kl(s,1),gb(s,1,0))}function kp(s){for(;s===kf;)kf=Ka[--Xa],Ka[Xa]=null,Cc=Ka[--Xa],Ka[Xa]=null;for(;s===ir;)ir=es[--ts],es[ts]=null,Ws=es[--ts],es[ts]=null,Fs=es[--ts],es[ts]=null}function yb(s,r){es[ts++]=Fs,es[ts++]=Ws,es[ts++]=ir,Fs=r.id,Ws=r.overflow,ir=s}var Bn=null,Ut=null,ot=!1,sr=null,ns=!1,Ap=Error(i(519));function lr(s){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Tc(Ji(r,s)),Ap}function bb(s){var r=s.stateNode,c=s.type,h=s.memoizedProps;switch(r[Nt]=s,r[Xe]=h,c){case"dialog":nt("cancel",r),nt("close",r);break;case"iframe":case"object":case"embed":nt("load",r);break;case"video":case"audio":for(c=0;c<$c.length;c++)nt($c[c],r);break;case"source":nt("error",r);break;case"img":case"image":case"link":nt("error",r),nt("load",r);break;case"details":nt("toggle",r);break;case"input":nt("invalid",r),Zl(r,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":nt("invalid",r);break;case"textarea":nt("invalid",r),_(r,h.value,h.defaultValue,h.children)}c=h.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||r.textContent===""+c||h.suppressHydrationWarning===!0||L1(r.textContent,c)?(h.popover!=null&&(nt("beforetoggle",r),nt("toggle",r)),h.onScroll!=null&&nt("scroll",r),h.onScrollEnd!=null&&nt("scrollend",r),h.onClick!=null&&(r.onclick=zt),r=!0):r=!1,r||lr(s,!0)}function xb(s){for(Bn=s.return;Bn;)switch(Bn.tag){case 5:case 31:case 13:ns=!1;return;case 27:case 3:ns=!0;return;default:Bn=Bn.return}}function Qa(s){if(s!==Bn)return!1;if(!ot)return xb(s),ot=!0,!1;var r=s.tag,c;if((c=r!==3&&r!==27)&&((c=r===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||qm(s.type,s.memoizedProps)),c=!c),c&&Ut&&lr(s),xb(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ut=P1(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ut=P1(s)}else r===27?(r=Ut,xr(s.type)?(s=Wm,Wm=null,Ut=s):Ut=r):Ut=Bn?ss(s.stateNode.nextSibling):null;return!0}function ia(){Ut=Bn=null,ot=!1}function Cp(){var s=sr;return s!==null&&(Si===null?Si=s:Si.push.apply(Si,s),sr=null),s}function Tc(s){sr===null?sr=[s]:sr.push(s)}var Tp=N(null),sa=null,Al=null;function rr(s,r,c){J(Tp,r._currentValue),r._currentValue=c}function Cl(s){s._currentValue=Tp.current,F(Tp)}function _p(s,r,c){for(;s!==null;){var h=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,h!==null&&(h.childLanes|=r)):h!==null&&(h.childLanes&r)!==r&&(h.childLanes|=r),s===c)break;s=s.return}}function Mp(s,r,c,h){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var g=m.dependencies;if(g!==null){var v=m.child;g=g.firstContext;e:for(;g!==null;){var A=g;g=m;for(var D=0;D<r.length;D++)if(A.context===r[D]){g.lanes|=c,A=g.alternate,A!==null&&(A.lanes|=c),_p(g.return,c,s),h||(v=null);break e}g=A.next}}else if(m.tag===18){if(v=m.return,v===null)throw Error(i(341));v.lanes|=c,g=v.alternate,g!==null&&(g.lanes|=c),_p(v,c,s),v=null}else v=m.child;if(v!==null)v.return=m;else for(v=m;v!==null;){if(v===s){v=null;break}if(m=v.sibling,m!==null){m.return=v.return,v=m;break}v=v.return}m=v}}function Za(s,r,c,h){s=null;for(var m=r,g=!1;m!==null;){if(!g){if((m.flags&524288)!==0)g=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var v=m.alternate;if(v===null)throw Error(i(387));if(v=v.memoizedProps,v!==null){var A=m.type;Bi(m.pendingProps.value,v.value)||(s!==null?s.push(A):s=[A])}}else if(m===Ie.current){if(v=m.alternate,v===null)throw Error(i(387));v.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Jc):s=[Jc])}m=m.return}s!==null&&Mp(r,s,c,h),r.flags|=262144}function Af(s){for(s=s.firstContext;s!==null;){if(!Bi(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function la(s){sa=s,Al=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function zn(s){return vb(sa,s)}function Cf(s,r){return sa===null&&la(s),vb(s,r)}function vb(s,r){var c=r._currentValue;if(r={context:r,memoizedValue:c,next:null},Al===null){if(s===null)throw Error(i(308));Al=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else Al=Al.next=r;return c}var WT=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(c,h){s.push(h)}};this.abort=function(){r.aborted=!0,s.forEach(function(c){return c()})}},$T=n.unstable_scheduleCallback,KT=n.unstable_NormalPriority,an={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ep(){return{controller:new WT,data:new Map,refCount:0}}function _c(s){s.refCount--,s.refCount===0&&$T(KT,function(){s.controller.abort()})}var Mc=null,Np=0,Ja=0,eo=null;function XT(s,r){if(Mc===null){var c=Mc=[];Np=0,Ja=Rm(),eo={status:"pending",value:void 0,then:function(h){c.push(h)}}}return Np++,r.then(Sb,Sb),r}function Sb(){if(--Np===0&&Mc!==null){eo!==null&&(eo.status="fulfilled");var s=Mc;Mc=null,Ja=0,eo=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function QT(s,r){var c=[],h={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return s.then(function(){h.status="fulfilled",h.value=r;for(var m=0;m<c.length;m++)(0,c[m])(r)},function(m){for(h.status="rejected",h.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),h}var wb=I.S;I.S=function(s,r){l1=Fe(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&XT(s,r),wb!==null&&wb(s,r)};var ra=N(null);function Dp(){var s=ra.current;return s!==null?s:Ot.pooledCache}function Tf(s,r){r===null?J(ra,ra.current):J(ra,r.pool)}function kb(){var s=Dp();return s===null?null:{parent:an._currentValue,pool:s}}var to=Error(i(460)),Op=Error(i(474)),_f=Error(i(542)),Mf={then:function(){}};function Ab(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Cb(s,r,c){switch(c=s[c],c===void 0?s.push(r):c!==r&&(r.then(zt,zt),r=c),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,_b(s),s;default:if(typeof r.status=="string")r.then(zt,zt);else{if(s=Ot,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=r,s.status="pending",s.then(function(h){if(r.status==="pending"){var m=r;m.status="fulfilled",m.value=h}},function(h){if(r.status==="pending"){var m=r;m.status="rejected",m.reason=h}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,_b(s),s}throw oa=r,to}}function aa(s){try{var r=s._init;return r(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(oa=c,to):c}}var oa=null;function Tb(){if(oa===null)throw Error(i(459));var s=oa;return oa=null,s}function _b(s){if(s===to||s===_f)throw Error(i(483))}var no=null,Ec=0;function Ef(s){var r=Ec;return Ec+=1,no===null&&(no=[]),Cb(no,s,r)}function Nc(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function Nf(s,r){throw r.$$typeof===x?Error(i(525)):(s=Object.prototype.toString.call(r),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function Mb(s){function r(z,R){if(s){var V=z.deletions;V===null?(z.deletions=[R],z.flags|=16):V.push(R)}}function c(z,R){if(!s)return null;for(;R!==null;)r(z,R),R=R.sibling;return null}function h(z){for(var R=new Map;z!==null;)z.key!==null?R.set(z.key,z):R.set(z.index,z),z=z.sibling;return R}function m(z,R){return z=wl(z,R),z.index=0,z.sibling=null,z}function g(z,R,V){return z.index=V,s?(V=z.alternate,V!==null?(V=V.index,V<R?(z.flags|=67108866,R):V):(z.flags|=67108866,R)):(z.flags|=1048576,R)}function v(z){return s&&z.alternate===null&&(z.flags|=67108866),z}function A(z,R,V,Q){return R===null||R.tag!==6?(R=vp(V,z.mode,Q),R.return=z,R):(R=m(R,V),R.return=z,R)}function D(z,R,V,Q){var Re=V.type;return Re===T?K(z,R,V.props.children,Q,V.key):R!==null&&(R.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===se&&aa(Re)===R.type)?(R=m(R,V.props),Nc(R,V),R.return=z,R):(R=wf(V.type,V.key,V.props,null,z.mode,Q),Nc(R,V),R.return=z,R)}function G(z,R,V,Q){return R===null||R.tag!==4||R.stateNode.containerInfo!==V.containerInfo||R.stateNode.implementation!==V.implementation?(R=Sp(V,z.mode,Q),R.return=z,R):(R=m(R,V.children||[]),R.return=z,R)}function K(z,R,V,Q,Re){return R===null||R.tag!==7?(R=na(V,z.mode,Q,Re),R.return=z,R):(R=m(R,V),R.return=z,R)}function te(z,R,V){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=vp(""+R,z.mode,V),R.return=z,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case S:return V=wf(R.type,R.key,R.props,null,z.mode,V),Nc(V,R),V.return=z,V;case w:return R=Sp(R,z.mode,V),R.return=z,R;case se:return R=aa(R),te(z,R,V)}if(ke(R)||le(R))return R=na(R,z.mode,V,null),R.return=z,R;if(typeof R.then=="function")return te(z,Ef(R),V);if(R.$$typeof===B)return te(z,Cf(z,R),V);Nf(z,R)}return null}function P(z,R,V,Q){var Re=R!==null?R.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Re!==null?null:A(z,R,""+V,Q);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return V.key===Re?D(z,R,V,Q):null;case w:return V.key===Re?G(z,R,V,Q):null;case se:return V=aa(V),P(z,R,V,Q)}if(ke(V)||le(V))return Re!==null?null:K(z,R,V,Q,null);if(typeof V.then=="function")return P(z,R,Ef(V),Q);if(V.$$typeof===B)return P(z,R,Cf(z,V),Q);Nf(z,V)}return null}function W(z,R,V,Q,Re){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return z=z.get(V)||null,A(R,z,""+Q,Re);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case S:return z=z.get(Q.key===null?V:Q.key)||null,D(R,z,Q,Re);case w:return z=z.get(Q.key===null?V:Q.key)||null,G(R,z,Q,Re);case se:return Q=aa(Q),W(z,R,V,Q,Re)}if(ke(Q)||le(Q))return z=z.get(V)||null,K(R,z,Q,Re,null);if(typeof Q.then=="function")return W(z,R,V,Ef(Q),Re);if(Q.$$typeof===B)return W(z,R,V,Cf(R,Q),Re);Nf(R,Q)}return null}function Ce(z,R,V,Q){for(var Re=null,mt=null,De=R,Ke=R=0,rt=null;De!==null&&Ke<V.length;Ke++){De.index>Ke?(rt=De,De=null):rt=De.sibling;var gt=P(z,De,V[Ke],Q);if(gt===null){De===null&&(De=rt);break}s&&De&&gt.alternate===null&&r(z,De),R=g(gt,R,Ke),mt===null?Re=gt:mt.sibling=gt,mt=gt,De=rt}if(Ke===V.length)return c(z,De),ot&&kl(z,Ke),Re;if(De===null){for(;Ke<V.length;Ke++)De=te(z,V[Ke],Q),De!==null&&(R=g(De,R,Ke),mt===null?Re=De:mt.sibling=De,mt=De);return ot&&kl(z,Ke),Re}for(De=h(De);Ke<V.length;Ke++)rt=W(De,z,Ke,V[Ke],Q),rt!==null&&(s&&rt.alternate!==null&&De.delete(rt.key===null?Ke:rt.key),R=g(rt,R,Ke),mt===null?Re=rt:mt.sibling=rt,mt=rt);return s&&De.forEach(function(Ar){return r(z,Ar)}),ot&&kl(z,Ke),Re}function He(z,R,V,Q){if(V==null)throw Error(i(151));for(var Re=null,mt=null,De=R,Ke=R=0,rt=null,gt=V.next();De!==null&&!gt.done;Ke++,gt=V.next()){De.index>Ke?(rt=De,De=null):rt=De.sibling;var Ar=P(z,De,gt.value,Q);if(Ar===null){De===null&&(De=rt);break}s&&De&&Ar.alternate===null&&r(z,De),R=g(Ar,R,Ke),mt===null?Re=Ar:mt.sibling=Ar,mt=Ar,De=rt}if(gt.done)return c(z,De),ot&&kl(z,Ke),Re;if(De===null){for(;!gt.done;Ke++,gt=V.next())gt=te(z,gt.value,Q),gt!==null&&(R=g(gt,R,Ke),mt===null?Re=gt:mt.sibling=gt,mt=gt);return ot&&kl(z,Ke),Re}for(De=h(De);!gt.done;Ke++,gt=V.next())gt=W(De,z,Ke,gt.value,Q),gt!==null&&(s&&gt.alternate!==null&&De.delete(gt.key===null?Ke:gt.key),R=g(gt,R,Ke),mt===null?Re=gt:mt.sibling=gt,mt=gt);return s&&De.forEach(function(o2){return r(z,o2)}),ot&&kl(z,Ke),Re}function _t(z,R,V,Q){if(typeof V=="object"&&V!==null&&V.type===T&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case S:e:{for(var Re=V.key;R!==null;){if(R.key===Re){if(Re=V.type,Re===T){if(R.tag===7){c(z,R.sibling),Q=m(R,V.props.children),Q.return=z,z=Q;break e}}else if(R.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===se&&aa(Re)===R.type){c(z,R.sibling),Q=m(R,V.props),Nc(Q,V),Q.return=z,z=Q;break e}c(z,R);break}else r(z,R);R=R.sibling}V.type===T?(Q=na(V.props.children,z.mode,Q,V.key),Q.return=z,z=Q):(Q=wf(V.type,V.key,V.props,null,z.mode,Q),Nc(Q,V),Q.return=z,z=Q)}return v(z);case w:e:{for(Re=V.key;R!==null;){if(R.key===Re)if(R.tag===4&&R.stateNode.containerInfo===V.containerInfo&&R.stateNode.implementation===V.implementation){c(z,R.sibling),Q=m(R,V.children||[]),Q.return=z,z=Q;break e}else{c(z,R);break}else r(z,R);R=R.sibling}Q=Sp(V,z.mode,Q),Q.return=z,z=Q}return v(z);case se:return V=aa(V),_t(z,R,V,Q)}if(ke(V))return Ce(z,R,V,Q);if(le(V)){if(Re=le(V),typeof Re!="function")throw Error(i(150));return V=Re.call(V),He(z,R,V,Q)}if(typeof V.then=="function")return _t(z,R,Ef(V),Q);if(V.$$typeof===B)return _t(z,R,Cf(z,V),Q);Nf(z,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,R!==null&&R.tag===6?(c(z,R.sibling),Q=m(R,V),Q.return=z,z=Q):(c(z,R),Q=vp(V,z.mode,Q),Q.return=z,z=Q),v(z)):c(z,R)}return function(z,R,V,Q){try{Ec=0;var Re=_t(z,R,V,Q);return no=null,Re}catch(De){if(De===to||De===_f)throw De;var mt=zi(29,De,null,z.mode);return mt.lanes=Q,mt.return=z,mt}finally{}}}var ca=Mb(!0),Eb=Mb(!1),ar=!1;function Rp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jp(s,r){s=s.updateQueue,r.updateQueue===s&&(r.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function or(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function cr(s,r,c){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(yt&2)!==0){var m=h.pending;return m===null?r.next=r:(r.next=m.next,m.next=r),h.pending=r,r=Sf(s),hb(s,null,c),r}return vf(s,h,r,c),Sf(s)}function Dc(s,r,c){if(r=r.updateQueue,r!==null&&(r=r.shared,(c&4194048)!==0)){var h=r.lanes;h&=s.pendingLanes,c|=h,r.lanes=c,Ni(s,c)}}function Lp(s,r){var c=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var m=null,g=null;if(c=c.firstBaseUpdate,c!==null){do{var v={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};g===null?m=g=v:g=g.next=v,c=c.next}while(c!==null);g===null?m=g=r:g=g.next=r}else m=g=r;c={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:g,shared:h.shared,callbacks:h.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=r:s.next=r,c.lastBaseUpdate=r}var Bp=!1;function Oc(){if(Bp){var s=eo;if(s!==null)throw s}}function Rc(s,r,c,h){Bp=!1;var m=s.updateQueue;ar=!1;var g=m.firstBaseUpdate,v=m.lastBaseUpdate,A=m.shared.pending;if(A!==null){m.shared.pending=null;var D=A,G=D.next;D.next=null,v===null?g=G:v.next=G,v=D;var K=s.alternate;K!==null&&(K=K.updateQueue,A=K.lastBaseUpdate,A!==v&&(A===null?K.firstBaseUpdate=G:A.next=G,K.lastBaseUpdate=D))}if(g!==null){var te=m.baseState;v=0,K=G=D=null,A=g;do{var P=A.lane&-536870913,W=P!==A.lane;if(W?(lt&P)===P:(h&P)===P){P!==0&&P===Ja&&(Bp=!0),K!==null&&(K=K.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Ce=s,He=A;P=r;var _t=c;switch(He.tag){case 1:if(Ce=He.payload,typeof Ce=="function"){te=Ce.call(_t,te,P);break e}te=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=He.payload,P=typeof Ce=="function"?Ce.call(_t,te,P):Ce,P==null)break e;te=b({},te,P);break e;case 2:ar=!0}}P=A.callback,P!==null&&(s.flags|=64,W&&(s.flags|=8192),W=m.callbacks,W===null?m.callbacks=[P]:W.push(P))}else W={lane:P,tag:A.tag,payload:A.payload,callback:A.callback,next:null},K===null?(G=K=W,D=te):K=K.next=W,v|=P;if(A=A.next,A===null){if(A=m.shared.pending,A===null)break;W=A,A=W.next,W.next=null,m.lastBaseUpdate=W,m.shared.pending=null}}while(!0);K===null&&(D=te),m.baseState=D,m.firstBaseUpdate=G,m.lastBaseUpdate=K,g===null&&(m.shared.lanes=0),pr|=v,s.lanes=v,s.memoizedState=te}}function Nb(s,r){if(typeof s!="function")throw Error(i(191,s));s.call(r)}function Db(s,r){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)Nb(c[s],r)}var io=N(null),Df=N(0);function Ob(s,r){s=jl,J(Df,s),J(io,r),jl=s|r.baseLanes}function zp(){J(Df,jl),J(io,io.current)}function Hp(){jl=Df.current,F(io),F(Df)}var Hi=N(null),is=null;function ur(s){var r=s.alternate;J(tn,tn.current&1),J(Hi,s),is===null&&(r===null||io.current!==null||r.memoizedState!==null)&&(is=s)}function Ip(s){J(tn,tn.current),J(Hi,s),is===null&&(is=s)}function Rb(s){s.tag===22?(J(tn,tn.current),J(Hi,s),is===null&&(is=s)):fr()}function fr(){J(tn,tn.current),J(Hi,Hi.current)}function Ii(s){F(Hi),is===s&&(is=null),F(tn)}var tn=N(0);function Of(s){for(var r=s;r!==null;){if(r.tag===13){var c=r.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Ym(c)||Fm(c)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Tl=0,We=null,Ct=null,on=null,Rf=!1,so=!1,ua=!1,jf=0,jc=0,lo=null,ZT=0;function Qt(){throw Error(i(321))}function Up(s,r){if(r===null)return!1;for(var c=0;c<r.length&&c<s.length;c++)if(!Bi(s[c],r[c]))return!1;return!0}function Vp(s,r,c,h,m,g){return Tl=g,We=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,I.H=s===null||s.memoizedState===null?gx:nm,ua=!1,g=c(h,m),ua=!1,so&&(g=Lb(r,c,h,m)),jb(s),g}function jb(s){I.H=zc;var r=Ct!==null&&Ct.next!==null;if(Tl=0,on=Ct=We=null,Rf=!1,jc=0,lo=null,r)throw Error(i(300));s===null||cn||(s=s.dependencies,s!==null&&Af(s)&&(cn=!0))}function Lb(s,r,c,h){We=s;var m=0;do{if(so&&(lo=null),jc=0,so=!1,25<=m)throw Error(i(301));if(m+=1,on=Ct=null,s.updateQueue!=null){var g=s.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}I.H=yx,g=r(c,h)}while(so);return g}function JT(){var s=I.H,r=s.useState()[0];return r=typeof r.then=="function"?Lc(r):r,s=s.useState()[0],(Ct!==null?Ct.memoizedState:null)!==s&&(We.flags|=1024),r}function qp(){var s=jf!==0;return jf=0,s}function Gp(s,r,c){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~c}function Pp(s){if(Rf){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}Rf=!1}Tl=0,on=Ct=We=null,so=!1,jc=jf=0,lo=null}function ui(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return on===null?We.memoizedState=on=s:on=on.next=s,on}function nn(){if(Ct===null){var s=We.alternate;s=s!==null?s.memoizedState:null}else s=Ct.next;var r=on===null?We.memoizedState:on.next;if(r!==null)on=r,Ct=s;else{if(s===null)throw We.alternate===null?Error(i(467)):Error(i(310));Ct=s,s={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},on===null?We.memoizedState=on=s:on=on.next=s}return on}function Lf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Lc(s){var r=jc;return jc+=1,lo===null&&(lo=[]),s=Cb(lo,s,r),r=We,(on===null?r.memoizedState:on.next)===null&&(r=r.alternate,I.H=r===null||r.memoizedState===null?gx:nm),s}function Bf(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Lc(s);if(s.$$typeof===B)return zn(s)}throw Error(i(438,String(s)))}function Yp(s){var r=null,c=We.updateQueue;if(c!==null&&(r=c.memoCache),r==null){var h=We.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(r={data:h.data.map(function(m){return m.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),c===null&&(c=Lf(),We.updateQueue=c),c.memoCache=r,c=r.data[r.index],c===void 0)for(c=r.data[r.index]=Array(s),h=0;h<s;h++)c[h]=Me;return r.index++,c}function _l(s,r){return typeof r=="function"?r(s):r}function zf(s){var r=nn();return Fp(r,Ct,s)}function Fp(s,r,c){var h=s.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=c;var m=s.baseQueue,g=h.pending;if(g!==null){if(m!==null){var v=m.next;m.next=g.next,g.next=v}r.baseQueue=m=g,h.pending=null}if(g=s.baseState,m===null)s.memoizedState=g;else{r=m.next;var A=v=null,D=null,G=r,K=!1;do{var te=G.lane&-536870913;if(te!==G.lane?(lt&te)===te:(Tl&te)===te){var P=G.revertLane;if(P===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),te===Ja&&(K=!0);else if((Tl&P)===P){G=G.next,P===Ja&&(K=!0);continue}else te={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},D===null?(A=D=te,v=g):D=D.next=te,We.lanes|=P,pr|=P;te=G.action,ua&&c(g,te),g=G.hasEagerState?G.eagerState:c(g,te)}else P={lane:te,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},D===null?(A=D=P,v=g):D=D.next=P,We.lanes|=te,pr|=te;G=G.next}while(G!==null&&G!==r);if(D===null?v=g:D.next=A,!Bi(g,s.memoizedState)&&(cn=!0,K&&(c=eo,c!==null)))throw c;s.memoizedState=g,s.baseState=v,s.baseQueue=D,h.lastRenderedState=g}return m===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function Wp(s){var r=nn(),c=r.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var h=c.dispatch,m=c.pending,g=r.memoizedState;if(m!==null){c.pending=null;var v=m=m.next;do g=s(g,v.action),v=v.next;while(v!==m);Bi(g,r.memoizedState)||(cn=!0),r.memoizedState=g,r.baseQueue===null&&(r.baseState=g),c.lastRenderedState=g}return[g,h]}function Bb(s,r,c){var h=We,m=nn(),g=ot;if(g){if(c===void 0)throw Error(i(407));c=c()}else c=r();var v=!Bi((Ct||m).memoizedState,c);if(v&&(m.memoizedState=c,cn=!0),m=m.queue,Xp(Ib.bind(null,h,m,s),[s]),m.getSnapshot!==r||v||on!==null&&on.memoizedState.tag&1){if(h.flags|=2048,ro(9,{destroy:void 0},Hb.bind(null,h,m,c,r),null),Ot===null)throw Error(i(349));g||(Tl&127)!==0||zb(h,r,c)}return c}function zb(s,r,c){s.flags|=16384,s={getSnapshot:r,value:c},r=We.updateQueue,r===null?(r=Lf(),We.updateQueue=r,r.stores=[s]):(c=r.stores,c===null?r.stores=[s]:c.push(s))}function Hb(s,r,c,h){r.value=c,r.getSnapshot=h,Ub(r)&&Vb(s)}function Ib(s,r,c){return c(function(){Ub(r)&&Vb(s)})}function Ub(s){var r=s.getSnapshot;s=s.value;try{var c=r();return!Bi(s,c)}catch{return!0}}function Vb(s){var r=ta(s,2);r!==null&&wi(r,s,2)}function $p(s){var r=ui();if(typeof s=="function"){var c=s;if(s=c(),ua){Ei(!0);try{c()}finally{Ei(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_l,lastRenderedState:s},r}function qb(s,r,c,h){return s.baseState=c,Fp(s,Ct,typeof h=="function"?h:_l)}function e_(s,r,c,h,m){if(Uf(s))throw Error(i(485));if(s=r.action,s!==null){var g={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){g.listeners.push(v)}};I.T!==null?c(!0):g.isTransition=!1,h(g),c=r.pending,c===null?(g.next=r.pending=g,Gb(r,g)):(g.next=c.next,r.pending=c.next=g)}}function Gb(s,r){var c=r.action,h=r.payload,m=s.state;if(r.isTransition){var g=I.T,v={};I.T=v;try{var A=c(m,h),D=I.S;D!==null&&D(v,A),Pb(s,r,A)}catch(G){Kp(s,r,G)}finally{g!==null&&v.types!==null&&(g.types=v.types),I.T=g}}else try{g=c(m,h),Pb(s,r,g)}catch(G){Kp(s,r,G)}}function Pb(s,r,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){Yb(s,r,h)},function(h){return Kp(s,r,h)}):Yb(s,r,c)}function Yb(s,r,c){r.status="fulfilled",r.value=c,Fb(r),s.state=c,r=s.pending,r!==null&&(c=r.next,c===r?s.pending=null:(c=c.next,r.next=c,Gb(s,c)))}function Kp(s,r,c){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do r.status="rejected",r.reason=c,Fb(r),r=r.next;while(r!==h)}s.action=null}function Fb(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function Wb(s,r){return r}function $b(s,r){if(ot){var c=Ot.formState;if(c!==null){e:{var h=We;if(ot){if(Ut){t:{for(var m=Ut,g=ns;m.nodeType!==8;){if(!g){m=null;break t}if(m=ss(m.nextSibling),m===null){m=null;break t}}g=m.data,m=g==="F!"||g==="F"?m:null}if(m){Ut=ss(m.nextSibling),h=m.data==="F!";break e}}lr(h)}h=!1}h&&(r=c[0])}}return c=ui(),c.memoizedState=c.baseState=r,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wb,lastRenderedState:r},c.queue=h,c=dx.bind(null,We,h),h.dispatch=c,h=$p(!1),g=tm.bind(null,We,!1,h.queue),h=ui(),m={state:r,dispatch:null,action:s,pending:null},h.queue=m,c=e_.bind(null,We,m,g,c),m.dispatch=c,h.memoizedState=s,[r,c,!1]}function Kb(s){var r=nn();return Xb(r,Ct,s)}function Xb(s,r,c){if(r=Fp(s,r,Wb)[0],s=zf(_l)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var h=Lc(r)}catch(v){throw v===to?_f:v}else h=r;r=nn();var m=r.queue,g=m.dispatch;return c!==r.memoizedState&&(We.flags|=2048,ro(9,{destroy:void 0},t_.bind(null,m,c),null)),[h,g,s]}function t_(s,r){s.action=r}function Qb(s){var r=nn(),c=Ct;if(c!==null)return Xb(r,c,s);nn(),r=r.memoizedState,c=nn();var h=c.queue.dispatch;return c.memoizedState=s,[r,h,!1]}function ro(s,r,c,h){return s={tag:s,create:c,deps:h,inst:r,next:null},r=We.updateQueue,r===null&&(r=Lf(),We.updateQueue=r),c=r.lastEffect,c===null?r.lastEffect=s.next=s:(h=c.next,c.next=s,s.next=h,r.lastEffect=s),s}function Zb(){return nn().memoizedState}function Hf(s,r,c,h){var m=ui();We.flags|=s,m.memoizedState=ro(1|r,{destroy:void 0},c,h===void 0?null:h)}function If(s,r,c,h){var m=nn();h=h===void 0?null:h;var g=m.memoizedState.inst;Ct!==null&&h!==null&&Up(h,Ct.memoizedState.deps)?m.memoizedState=ro(r,g,c,h):(We.flags|=s,m.memoizedState=ro(1|r,g,c,h))}function Jb(s,r){Hf(8390656,8,s,r)}function Xp(s,r){If(2048,8,s,r)}function n_(s){We.flags|=4;var r=We.updateQueue;if(r===null)r=Lf(),We.updateQueue=r,r.events=[s];else{var c=r.events;c===null?r.events=[s]:c.push(s)}}function ex(s){var r=nn().memoizedState;return n_({ref:r,nextImpl:s}),function(){if((yt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function tx(s,r){return If(4,2,s,r)}function nx(s,r){return If(4,4,s,r)}function ix(s,r){if(typeof r=="function"){s=s();var c=r(s);return function(){typeof c=="function"?c():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function sx(s,r,c){c=c!=null?c.concat([s]):null,If(4,4,ix.bind(null,r,s),c)}function Qp(){}function lx(s,r){var c=nn();r=r===void 0?null:r;var h=c.memoizedState;return r!==null&&Up(r,h[1])?h[0]:(c.memoizedState=[s,r],s)}function rx(s,r){var c=nn();r=r===void 0?null:r;var h=c.memoizedState;if(r!==null&&Up(r,h[1]))return h[0];if(h=s(),ua){Ei(!0);try{s()}finally{Ei(!1)}}return c.memoizedState=[h,r],h}function Zp(s,r,c){return c===void 0||(Tl&1073741824)!==0&&(lt&261930)===0?s.memoizedState=r:(s.memoizedState=c,s=a1(),We.lanes|=s,pr|=s,c)}function ax(s,r,c,h){return Bi(c,r)?c:io.current!==null?(s=Zp(s,c,h),Bi(s,r)||(cn=!0),s):(Tl&42)===0||(Tl&1073741824)!==0&&(lt&261930)===0?(cn=!0,s.memoizedState=c):(s=a1(),We.lanes|=s,pr|=s,r)}function ox(s,r,c,h,m){var g=Z.p;Z.p=g!==0&&8>g?g:8;var v=I.T,A={};I.T=A,tm(s,!1,r,c);try{var D=m(),G=I.S;if(G!==null&&G(A,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var K=QT(D,h);Bc(s,r,K,qi(s))}else Bc(s,r,h,qi(s))}catch(te){Bc(s,r,{then:function(){},status:"rejected",reason:te},qi())}finally{Z.p=g,v!==null&&A.types!==null&&(v.types=A.types),I.T=v}}function i_(){}function Jp(s,r,c,h){if(s.tag!==5)throw Error(i(476));var m=cx(s).queue;ox(s,m,r,ee,c===null?i_:function(){return ux(s),c(h)})}function cx(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_l,lastRenderedState:ee},next:null};var c={};return r.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_l,lastRenderedState:c},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function ux(s){var r=cx(s);r.next===null&&(r=s.alternate.memoizedState),Bc(s,r.next.queue,{},qi())}function em(){return zn(Jc)}function fx(){return nn().memoizedState}function hx(){return nn().memoizedState}function s_(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var c=qi();s=or(c);var h=cr(r,s,c);h!==null&&(wi(h,r,c),Dc(h,r,c)),r={cache:Ep()},s.payload=r;return}r=r.return}}function l_(s,r,c){var h=qi();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Uf(s)?px(r,c):(c=bp(s,r,c,h),c!==null&&(wi(c,s,h),mx(c,r,h)))}function dx(s,r,c){var h=qi();Bc(s,r,c,h)}function Bc(s,r,c,h){var m={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Uf(s))px(r,m);else{var g=s.alternate;if(s.lanes===0&&(g===null||g.lanes===0)&&(g=r.lastRenderedReducer,g!==null))try{var v=r.lastRenderedState,A=g(v,c);if(m.hasEagerState=!0,m.eagerState=A,Bi(A,v))return vf(s,r,m,0),Ot===null&&xf(),!1}catch{}finally{}if(c=bp(s,r,m,h),c!==null)return wi(c,s,h),mx(c,r,h),!0}return!1}function tm(s,r,c,h){if(h={lane:2,revertLane:Rm(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Uf(s)){if(r)throw Error(i(479))}else r=bp(s,c,h,2),r!==null&&wi(r,s,2)}function Uf(s){var r=s.alternate;return s===We||r!==null&&r===We}function px(s,r){so=Rf=!0;var c=s.pending;c===null?r.next=r:(r.next=c.next,c.next=r),s.pending=r}function mx(s,r,c){if((c&4194048)!==0){var h=r.lanes;h&=s.pendingLanes,c|=h,r.lanes=c,Ni(s,c)}}var zc={readContext:zn,use:Bf,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useLayoutEffect:Qt,useInsertionEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useSyncExternalStore:Qt,useId:Qt,useHostTransitionStatus:Qt,useFormState:Qt,useActionState:Qt,useOptimistic:Qt,useMemoCache:Qt,useCacheRefresh:Qt};zc.useEffectEvent=Qt;var gx={readContext:zn,use:Bf,useCallback:function(s,r){return ui().memoizedState=[s,r===void 0?null:r],s},useContext:zn,useEffect:Jb,useImperativeHandle:function(s,r,c){c=c!=null?c.concat([s]):null,Hf(4194308,4,ix.bind(null,r,s),c)},useLayoutEffect:function(s,r){return Hf(4194308,4,s,r)},useInsertionEffect:function(s,r){Hf(4,2,s,r)},useMemo:function(s,r){var c=ui();r=r===void 0?null:r;var h=s();if(ua){Ei(!0);try{s()}finally{Ei(!1)}}return c.memoizedState=[h,r],h},useReducer:function(s,r,c){var h=ui();if(c!==void 0){var m=c(r);if(ua){Ei(!0);try{c(r)}finally{Ei(!1)}}}else m=r;return h.memoizedState=h.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},h.queue=s,s=s.dispatch=l_.bind(null,We,s),[h.memoizedState,s]},useRef:function(s){var r=ui();return s={current:s},r.memoizedState=s},useState:function(s){s=$p(s);var r=s.queue,c=dx.bind(null,We,r);return r.dispatch=c,[s.memoizedState,c]},useDebugValue:Qp,useDeferredValue:function(s,r){var c=ui();return Zp(c,s,r)},useTransition:function(){var s=$p(!1);return s=ox.bind(null,We,s.queue,!0,!1),ui().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,c){var h=We,m=ui();if(ot){if(c===void 0)throw Error(i(407));c=c()}else{if(c=r(),Ot===null)throw Error(i(349));(lt&127)!==0||zb(h,r,c)}m.memoizedState=c;var g={value:c,getSnapshot:r};return m.queue=g,Jb(Ib.bind(null,h,g,s),[s]),h.flags|=2048,ro(9,{destroy:void 0},Hb.bind(null,h,g,c,r),null),c},useId:function(){var s=ui(),r=Ot.identifierPrefix;if(ot){var c=Ws,h=Fs;c=(h&~(1<<32-mn(h)-1)).toString(32)+c,r="_"+r+"R_"+c,c=jf++,0<c&&(r+="H"+c.toString(32)),r+="_"}else c=ZT++,r="_"+r+"r_"+c.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:em,useFormState:$b,useActionState:$b,useOptimistic:function(s){var r=ui();r.memoizedState=r.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=c,r=tm.bind(null,We,!0,c),c.dispatch=r,[s,r]},useMemoCache:Yp,useCacheRefresh:function(){return ui().memoizedState=s_.bind(null,We)},useEffectEvent:function(s){var r=ui(),c={impl:s};return r.memoizedState=c,function(){if((yt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},nm={readContext:zn,use:Bf,useCallback:lx,useContext:zn,useEffect:Xp,useImperativeHandle:sx,useInsertionEffect:tx,useLayoutEffect:nx,useMemo:rx,useReducer:zf,useRef:Zb,useState:function(){return zf(_l)},useDebugValue:Qp,useDeferredValue:function(s,r){var c=nn();return ax(c,Ct.memoizedState,s,r)},useTransition:function(){var s=zf(_l)[0],r=nn().memoizedState;return[typeof s=="boolean"?s:Lc(s),r]},useSyncExternalStore:Bb,useId:fx,useHostTransitionStatus:em,useFormState:Kb,useActionState:Kb,useOptimistic:function(s,r){var c=nn();return qb(c,Ct,s,r)},useMemoCache:Yp,useCacheRefresh:hx};nm.useEffectEvent=ex;var yx={readContext:zn,use:Bf,useCallback:lx,useContext:zn,useEffect:Xp,useImperativeHandle:sx,useInsertionEffect:tx,useLayoutEffect:nx,useMemo:rx,useReducer:Wp,useRef:Zb,useState:function(){return Wp(_l)},useDebugValue:Qp,useDeferredValue:function(s,r){var c=nn();return Ct===null?Zp(c,s,r):ax(c,Ct.memoizedState,s,r)},useTransition:function(){var s=Wp(_l)[0],r=nn().memoizedState;return[typeof s=="boolean"?s:Lc(s),r]},useSyncExternalStore:Bb,useId:fx,useHostTransitionStatus:em,useFormState:Qb,useActionState:Qb,useOptimistic:function(s,r){var c=nn();return Ct!==null?qb(c,Ct,s,r):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:Yp,useCacheRefresh:hx};yx.useEffectEvent=ex;function im(s,r,c,h){r=s.memoizedState,c=c(h,r),c=c==null?r:b({},r,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var sm={enqueueSetState:function(s,r,c){s=s._reactInternals;var h=qi(),m=or(h);m.payload=r,c!=null&&(m.callback=c),r=cr(s,m,h),r!==null&&(wi(r,s,h),Dc(r,s,h))},enqueueReplaceState:function(s,r,c){s=s._reactInternals;var h=qi(),m=or(h);m.tag=1,m.payload=r,c!=null&&(m.callback=c),r=cr(s,m,h),r!==null&&(wi(r,s,h),Dc(r,s,h))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var c=qi(),h=or(c);h.tag=2,r!=null&&(h.callback=r),r=cr(s,h,c),r!==null&&(wi(r,s,c),Dc(r,s,c))}};function bx(s,r,c,h,m,g,v){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,g,v):r.prototype&&r.prototype.isPureReactComponent?!kc(c,h)||!kc(m,g):!0}function xx(s,r,c,h){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(c,h),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(c,h),r.state!==s&&sm.enqueueReplaceState(r,r.state,null)}function fa(s,r){var c=r;if("ref"in r){c={};for(var h in r)h!=="ref"&&(c[h]=r[h])}if(s=s.defaultProps){c===r&&(c=b({},c));for(var m in s)c[m]===void 0&&(c[m]=s[m])}return c}function vx(s){bf(s)}function Sx(s){console.error(s)}function wx(s){bf(s)}function Vf(s,r){try{var c=s.onUncaughtError;c(r.value,{componentStack:r.stack})}catch(h){setTimeout(function(){throw h})}}function kx(s,r,c){try{var h=s.onCaughtError;h(c.value,{componentStack:c.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function lm(s,r,c){return c=or(c),c.tag=3,c.payload={element:null},c.callback=function(){Vf(s,r)},c}function Ax(s){return s=or(s),s.tag=3,s}function Cx(s,r,c,h){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var g=h.value;s.payload=function(){return m(g)},s.callback=function(){kx(r,c,h)}}var v=c.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(s.callback=function(){kx(r,c,h),typeof m!="function"&&(mr===null?mr=new Set([this]):mr.add(this));var A=h.stack;this.componentDidCatch(h.value,{componentStack:A!==null?A:""})})}function r_(s,r,c,h,m){if(c.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(r=c.alternate,r!==null&&Za(r,c,m,!0),c=Hi.current,c!==null){switch(c.tag){case 31:case 13:return is===null?Jf():c.alternate===null&&Zt===0&&(Zt=3),c.flags&=-257,c.flags|=65536,c.lanes=m,h===Mf?c.flags|=16384:(r=c.updateQueue,r===null?c.updateQueue=new Set([h]):r.add(h),Nm(s,h,m)),!1;case 22:return c.flags|=65536,h===Mf?c.flags|=16384:(r=c.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([h])},c.updateQueue=r):(c=r.retryQueue,c===null?r.retryQueue=new Set([h]):c.add(h)),Nm(s,h,m)),!1}throw Error(i(435,c.tag))}return Nm(s,h,m),Jf(),!1}if(ot)return r=Hi.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=m,h!==Ap&&(s=Error(i(422),{cause:h}),Tc(Ji(s,c)))):(h!==Ap&&(r=Error(i(423),{cause:h}),Tc(Ji(r,c))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,h=Ji(h,c),m=lm(s.stateNode,h,m),Lp(s,m),Zt!==4&&(Zt=2)),!1;var g=Error(i(520),{cause:h});if(g=Ji(g,c),Yc===null?Yc=[g]:Yc.push(g),Zt!==4&&(Zt=2),r===null)return!0;h=Ji(h,c),c=r;do{switch(c.tag){case 3:return c.flags|=65536,s=m&-m,c.lanes|=s,s=lm(c.stateNode,h,s),Lp(c,s),!1;case 1:if(r=c.type,g=c.stateNode,(c.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(mr===null||!mr.has(g))))return c.flags|=65536,m&=-m,c.lanes|=m,m=Ax(m),Cx(m,s,c,h),Lp(c,m),!1}c=c.return}while(c!==null);return!1}var rm=Error(i(461)),cn=!1;function Hn(s,r,c,h){r.child=s===null?Eb(r,null,c,h):ca(r,s.child,c,h)}function Tx(s,r,c,h,m){c=c.render;var g=r.ref;if("ref"in h){var v={};for(var A in h)A!=="ref"&&(v[A]=h[A])}else v=h;return la(r),h=Vp(s,r,c,v,g,m),A=qp(),s!==null&&!cn?(Gp(s,r,m),Ml(s,r,m)):(ot&&A&&wp(r),r.flags|=1,Hn(s,r,h,m),r.child)}function _x(s,r,c,h,m){if(s===null){var g=c.type;return typeof g=="function"&&!xp(g)&&g.defaultProps===void 0&&c.compare===null?(r.tag=15,r.type=g,Mx(s,r,g,h,m)):(s=wf(c.type,null,h,r,r.mode,m),s.ref=r.ref,s.return=r,r.child=s)}if(g=s.child,!pm(s,m)){var v=g.memoizedProps;if(c=c.compare,c=c!==null?c:kc,c(v,h)&&s.ref===r.ref)return Ml(s,r,m)}return r.flags|=1,s=wl(g,h),s.ref=r.ref,s.return=r,r.child=s}function Mx(s,r,c,h,m){if(s!==null){var g=s.memoizedProps;if(kc(g,h)&&s.ref===r.ref)if(cn=!1,r.pendingProps=h=g,pm(s,m))(s.flags&131072)!==0&&(cn=!0);else return r.lanes=s.lanes,Ml(s,r,m)}return am(s,r,c,h,m)}function Ex(s,r,c,h){var m=h.children,g=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((r.flags&128)!==0){if(g=g!==null?g.baseLanes|c:c,s!==null){for(h=r.child=s.child,m=0;h!==null;)m=m|h.lanes|h.childLanes,h=h.sibling;h=m&~g}else h=0,r.child=null;return Nx(s,r,g,c,h)}if((c&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&Tf(r,g!==null?g.cachePool:null),g!==null?Ob(r,g):zp(),Rb(r);else return h=r.lanes=536870912,Nx(s,r,g!==null?g.baseLanes|c:c,c,h)}else g!==null?(Tf(r,g.cachePool),Ob(r,g),fr(),r.memoizedState=null):(s!==null&&Tf(r,null),zp(),fr());return Hn(s,r,m,c),r.child}function Hc(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Nx(s,r,c,h,m){var g=Dp();return g=g===null?null:{parent:an._currentValue,pool:g},r.memoizedState={baseLanes:c,cachePool:g},s!==null&&Tf(r,null),zp(),Rb(r),s!==null&&Za(s,r,h,!0),r.childLanes=m,null}function qf(s,r){return r=Pf({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function Dx(s,r,c){return ca(r,s.child,null,c),s=qf(r,r.pendingProps),s.flags|=2,Ii(r),r.memoizedState=null,s}function a_(s,r,c){var h=r.pendingProps,m=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(ot){if(h.mode==="hidden")return s=qf(r,h),r.lanes=536870912,Hc(null,s);if(Ip(r),(s=Ut)?(s=G1(s,ns),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:ir!==null?{id:Fs,overflow:Ws}:null,retryLane:536870912,hydrationErrors:null},c=pb(s),c.return=r,r.child=c,Bn=r,Ut=null)):s=null,s===null)throw lr(r);return r.lanes=536870912,null}return qf(r,h)}var g=s.memoizedState;if(g!==null){var v=g.dehydrated;if(Ip(r),m)if(r.flags&256)r.flags&=-257,r=Dx(s,r,c);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(i(558));else if(cn||Za(s,r,c,!1),m=(c&s.childLanes)!==0,cn||m){if(h=Ot,h!==null&&(v=$i(h,c),v!==0&&v!==g.retryLane))throw g.retryLane=v,ta(s,v),wi(h,s,v),rm;Jf(),r=Dx(s,r,c)}else s=g.treeContext,Ut=ss(v.nextSibling),Bn=r,ot=!0,sr=null,ns=!1,s!==null&&yb(r,s),r=qf(r,h),r.flags|=4096;return r}return s=wl(s.child,{mode:h.mode,children:h.children}),s.ref=r.ref,r.child=s,s.return=r,s}function Gf(s,r){var c=r.ref;if(c===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(s===null||s.ref!==c)&&(r.flags|=4194816)}}function am(s,r,c,h,m){return la(r),c=Vp(s,r,c,h,void 0,m),h=qp(),s!==null&&!cn?(Gp(s,r,m),Ml(s,r,m)):(ot&&h&&wp(r),r.flags|=1,Hn(s,r,c,m),r.child)}function Ox(s,r,c,h,m,g){return la(r),r.updateQueue=null,c=Lb(r,h,c,m),jb(s),h=qp(),s!==null&&!cn?(Gp(s,r,g),Ml(s,r,g)):(ot&&h&&wp(r),r.flags|=1,Hn(s,r,c,g),r.child)}function Rx(s,r,c,h,m){if(la(r),r.stateNode===null){var g=$a,v=c.contextType;typeof v=="object"&&v!==null&&(g=zn(v)),g=new c(h,g),r.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=sm,r.stateNode=g,g._reactInternals=r,g=r.stateNode,g.props=h,g.state=r.memoizedState,g.refs={},Rp(r),v=c.contextType,g.context=typeof v=="object"&&v!==null?zn(v):$a,g.state=r.memoizedState,v=c.getDerivedStateFromProps,typeof v=="function"&&(im(r,c,v,h),g.state=r.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(v=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),v!==g.state&&sm.enqueueReplaceState(g,g.state,null),Rc(r,h,g,m),Oc(),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308),h=!0}else if(s===null){g=r.stateNode;var A=r.memoizedProps,D=fa(c,A);g.props=D;var G=g.context,K=c.contextType;v=$a,typeof K=="object"&&K!==null&&(v=zn(K));var te=c.getDerivedStateFromProps;K=typeof te=="function"||typeof g.getSnapshotBeforeUpdate=="function",A=r.pendingProps!==A,K||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(A||G!==v)&&xx(r,g,h,v),ar=!1;var P=r.memoizedState;g.state=P,Rc(r,h,g,m),Oc(),G=r.memoizedState,A||P!==G||ar?(typeof te=="function"&&(im(r,c,te,h),G=r.memoizedState),(D=ar||bx(r,c,D,h,P,G,v))?(K||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(r.flags|=4194308)):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=h,r.memoizedState=G),g.props=h,g.state=G,g.context=v,h=D):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),h=!1)}else{g=r.stateNode,jp(s,r),v=r.memoizedProps,K=fa(c,v),g.props=K,te=r.pendingProps,P=g.context,G=c.contextType,D=$a,typeof G=="object"&&G!==null&&(D=zn(G)),A=c.getDerivedStateFromProps,(G=typeof A=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(v!==te||P!==D)&&xx(r,g,h,D),ar=!1,P=r.memoizedState,g.state=P,Rc(r,h,g,m),Oc();var W=r.memoizedState;v!==te||P!==W||ar||s!==null&&s.dependencies!==null&&Af(s.dependencies)?(typeof A=="function"&&(im(r,c,A,h),W=r.memoizedState),(K=ar||bx(r,c,K,h,P,W,D)||s!==null&&s.dependencies!==null&&Af(s.dependencies))?(G||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(h,W,D),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(h,W,D)),typeof g.componentDidUpdate=="function"&&(r.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof g.componentDidUpdate!="function"||v===s.memoizedProps&&P===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||v===s.memoizedProps&&P===s.memoizedState||(r.flags|=1024),r.memoizedProps=h,r.memoizedState=W),g.props=h,g.state=W,g.context=D,h=K):(typeof g.componentDidUpdate!="function"||v===s.memoizedProps&&P===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||v===s.memoizedProps&&P===s.memoizedState||(r.flags|=1024),h=!1)}return g=h,Gf(s,r),h=(r.flags&128)!==0,g||h?(g=r.stateNode,c=h&&typeof c.getDerivedStateFromError!="function"?null:g.render(),r.flags|=1,s!==null&&h?(r.child=ca(r,s.child,null,m),r.child=ca(r,null,c,m)):Hn(s,r,c,m),r.memoizedState=g.state,s=r.child):s=Ml(s,r,m),s}function jx(s,r,c,h){return ia(),r.flags|=256,Hn(s,r,c,h),r.child}var om={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function cm(s){return{baseLanes:s,cachePool:kb()}}function um(s,r,c){return s=s!==null?s.childLanes&~c:0,r&&(s|=Vi),s}function Lx(s,r,c){var h=r.pendingProps,m=!1,g=(r.flags&128)!==0,v;if((v=g)||(v=s!==null&&s.memoizedState===null?!1:(tn.current&2)!==0),v&&(m=!0,r.flags&=-129),v=(r.flags&32)!==0,r.flags&=-33,s===null){if(ot){if(m?ur(r):fr(),(s=Ut)?(s=G1(s,ns),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:ir!==null?{id:Fs,overflow:Ws}:null,retryLane:536870912,hydrationErrors:null},c=pb(s),c.return=r,r.child=c,Bn=r,Ut=null)):s=null,s===null)throw lr(r);return Fm(s)?r.lanes=32:r.lanes=536870912,null}var A=h.children;return h=h.fallback,m?(fr(),m=r.mode,A=Pf({mode:"hidden",children:A},m),h=na(h,m,c,null),A.return=r,h.return=r,A.sibling=h,r.child=A,h=r.child,h.memoizedState=cm(c),h.childLanes=um(s,v,c),r.memoizedState=om,Hc(null,h)):(ur(r),fm(r,A))}var D=s.memoizedState;if(D!==null&&(A=D.dehydrated,A!==null)){if(g)r.flags&256?(ur(r),r.flags&=-257,r=hm(s,r,c)):r.memoizedState!==null?(fr(),r.child=s.child,r.flags|=128,r=null):(fr(),A=h.fallback,m=r.mode,h=Pf({mode:"visible",children:h.children},m),A=na(A,m,c,null),A.flags|=2,h.return=r,A.return=r,h.sibling=A,r.child=h,ca(r,s.child,null,c),h=r.child,h.memoizedState=cm(c),h.childLanes=um(s,v,c),r.memoizedState=om,r=Hc(null,h));else if(ur(r),Fm(A)){if(v=A.nextSibling&&A.nextSibling.dataset,v)var G=v.dgst;v=G,h=Error(i(419)),h.stack="",h.digest=v,Tc({value:h,source:null,stack:null}),r=hm(s,r,c)}else if(cn||Za(s,r,c,!1),v=(c&s.childLanes)!==0,cn||v){if(v=Ot,v!==null&&(h=$i(v,c),h!==0&&h!==D.retryLane))throw D.retryLane=h,ta(s,h),wi(v,s,h),rm;Ym(A)||Jf(),r=hm(s,r,c)}else Ym(A)?(r.flags|=192,r.child=s.child,r=null):(s=D.treeContext,Ut=ss(A.nextSibling),Bn=r,ot=!0,sr=null,ns=!1,s!==null&&yb(r,s),r=fm(r,h.children),r.flags|=4096);return r}return m?(fr(),A=h.fallback,m=r.mode,D=s.child,G=D.sibling,h=wl(D,{mode:"hidden",children:h.children}),h.subtreeFlags=D.subtreeFlags&65011712,G!==null?A=wl(G,A):(A=na(A,m,c,null),A.flags|=2),A.return=r,h.return=r,h.sibling=A,r.child=h,Hc(null,h),h=r.child,A=s.child.memoizedState,A===null?A=cm(c):(m=A.cachePool,m!==null?(D=an._currentValue,m=m.parent!==D?{parent:D,pool:D}:m):m=kb(),A={baseLanes:A.baseLanes|c,cachePool:m}),h.memoizedState=A,h.childLanes=um(s,v,c),r.memoizedState=om,Hc(s.child,h)):(ur(r),c=s.child,s=c.sibling,c=wl(c,{mode:"visible",children:h.children}),c.return=r,c.sibling=null,s!==null&&(v=r.deletions,v===null?(r.deletions=[s],r.flags|=16):v.push(s)),r.child=c,r.memoizedState=null,c)}function fm(s,r){return r=Pf({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function Pf(s,r){return s=zi(22,s,null,r),s.lanes=0,s}function hm(s,r,c){return ca(r,s.child,null,c),s=fm(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function Bx(s,r,c){s.lanes|=r;var h=s.alternate;h!==null&&(h.lanes|=r),_p(s.return,r,c)}function dm(s,r,c,h,m,g){var v=s.memoizedState;v===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:m,treeForkCount:g}:(v.isBackwards=r,v.rendering=null,v.renderingStartTime=0,v.last=h,v.tail=c,v.tailMode=m,v.treeForkCount=g)}function zx(s,r,c){var h=r.pendingProps,m=h.revealOrder,g=h.tail;h=h.children;var v=tn.current,A=(v&2)!==0;if(A?(v=v&1|2,r.flags|=128):v&=1,J(tn,v),Hn(s,r,h,c),h=ot?Cc:0,!A&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Bx(s,c,r);else if(s.tag===19)Bx(s,c,r);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"forwards":for(c=r.child,m=null;c!==null;)s=c.alternate,s!==null&&Of(s)===null&&(m=c),c=c.sibling;c=m,c===null?(m=r.child,r.child=null):(m=c.sibling,c.sibling=null),dm(r,!1,m,c,g,h);break;case"backwards":case"unstable_legacy-backwards":for(c=null,m=r.child,r.child=null;m!==null;){if(s=m.alternate,s!==null&&Of(s)===null){r.child=m;break}s=m.sibling,m.sibling=c,c=m,m=s}dm(r,!0,c,null,g,h);break;case"together":dm(r,!1,null,null,void 0,h);break;default:r.memoizedState=null}return r.child}function Ml(s,r,c){if(s!==null&&(r.dependencies=s.dependencies),pr|=r.lanes,(c&r.childLanes)===0)if(s!==null){if(Za(s,r,c,!1),(c&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(i(153));if(r.child!==null){for(s=r.child,c=wl(s,s.pendingProps),r.child=c,c.return=r;s.sibling!==null;)s=s.sibling,c=c.sibling=wl(s,s.pendingProps),c.return=r;c.sibling=null}return r.child}function pm(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&Af(s)))}function o_(s,r,c){switch(r.tag){case 3:pt(r,r.stateNode.containerInfo),rr(r,an,s.memoizedState.cache),ia();break;case 27:case 5:It(r);break;case 4:pt(r,r.stateNode.containerInfo);break;case 10:rr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Ip(r),null;break;case 13:var h=r.memoizedState;if(h!==null)return h.dehydrated!==null?(ur(r),r.flags|=128,null):(c&r.child.childLanes)!==0?Lx(s,r,c):(ur(r),s=Ml(s,r,c),s!==null?s.sibling:null);ur(r);break;case 19:var m=(s.flags&128)!==0;if(h=(c&r.childLanes)!==0,h||(Za(s,r,c,!1),h=(c&r.childLanes)!==0),m){if(h)return zx(s,r,c);r.flags|=128}if(m=r.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),J(tn,tn.current),h)break;return null;case 22:return r.lanes=0,Ex(s,r,c,r.pendingProps);case 24:rr(r,an,s.memoizedState.cache)}return Ml(s,r,c)}function Hx(s,r,c){if(s!==null)if(s.memoizedProps!==r.pendingProps)cn=!0;else{if(!pm(s,c)&&(r.flags&128)===0)return cn=!1,o_(s,r,c);cn=(s.flags&131072)!==0}else cn=!1,ot&&(r.flags&1048576)!==0&&gb(r,Cc,r.index);switch(r.lanes=0,r.tag){case 16:e:{var h=r.pendingProps;if(s=aa(r.elementType),r.type=s,typeof s=="function")xp(s)?(h=fa(s,h),r.tag=1,r=Rx(null,r,s,h,c)):(r.tag=0,r=am(null,r,s,h,c));else{if(s!=null){var m=s.$$typeof;if(m===q){r.tag=11,r=Tx(null,r,s,h,c);break e}else if(m===j){r.tag=14,r=_x(null,r,s,h,c);break e}}throw r=ve(s)||s,Error(i(306,r,""))}}return r;case 0:return am(s,r,r.type,r.pendingProps,c);case 1:return h=r.type,m=fa(h,r.pendingProps),Rx(s,r,h,m,c);case 3:e:{if(pt(r,r.stateNode.containerInfo),s===null)throw Error(i(387));h=r.pendingProps;var g=r.memoizedState;m=g.element,jp(s,r),Rc(r,h,null,c);var v=r.memoizedState;if(h=v.cache,rr(r,an,h),h!==g.cache&&Mp(r,[an],c,!0),Oc(),h=v.element,g.isDehydrated)if(g={element:h,isDehydrated:!1,cache:v.cache},r.updateQueue.baseState=g,r.memoizedState=g,r.flags&256){r=jx(s,r,h,c);break e}else if(h!==m){m=Ji(Error(i(424)),r),Tc(m),r=jx(s,r,h,c);break e}else{switch(s=r.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Ut=ss(s.firstChild),Bn=r,ot=!0,sr=null,ns=!0,c=Eb(r,null,h,c),r.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(ia(),h===m){r=Ml(s,r,c);break e}Hn(s,r,h,c)}r=r.child}return r;case 26:return Gf(s,r),s===null?(c=K1(r.type,null,r.pendingProps,null))?r.memoizedState=c:ot||(c=r.type,s=r.pendingProps,h=rh(Se.current).createElement(c),h[Nt]=r,h[Xe]=s,In(h,c,s),wt(h),r.stateNode=h):r.memoizedState=K1(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return It(r),s===null&&ot&&(h=r.stateNode=F1(r.type,r.pendingProps,Se.current),Bn=r,ns=!0,m=Ut,xr(r.type)?(Wm=m,Ut=ss(h.firstChild)):Ut=m),Hn(s,r,r.pendingProps.children,c),Gf(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&&ot&&((m=h=Ut)&&(h=H_(h,r.type,r.pendingProps,ns),h!==null?(r.stateNode=h,Bn=r,Ut=ss(h.firstChild),ns=!1,m=!0):m=!1),m||lr(r)),It(r),m=r.type,g=r.pendingProps,v=s!==null?s.memoizedProps:null,h=g.children,qm(m,g)?h=null:v!==null&&qm(m,v)&&(r.flags|=32),r.memoizedState!==null&&(m=Vp(s,r,JT,null,null,c),Jc._currentValue=m),Gf(s,r),Hn(s,r,h,c),r.child;case 6:return s===null&&ot&&((s=c=Ut)&&(c=I_(c,r.pendingProps,ns),c!==null?(r.stateNode=c,Bn=r,Ut=null,s=!0):s=!1),s||lr(r)),null;case 13:return Lx(s,r,c);case 4:return pt(r,r.stateNode.containerInfo),h=r.pendingProps,s===null?r.child=ca(r,null,h,c):Hn(s,r,h,c),r.child;case 11:return Tx(s,r,r.type,r.pendingProps,c);case 7:return Hn(s,r,r.pendingProps,c),r.child;case 8:return Hn(s,r,r.pendingProps.children,c),r.child;case 12:return Hn(s,r,r.pendingProps.children,c),r.child;case 10:return h=r.pendingProps,rr(r,r.type,h.value),Hn(s,r,h.children,c),r.child;case 9:return m=r.type._context,h=r.pendingProps.children,la(r),m=zn(m),h=h(m),r.flags|=1,Hn(s,r,h,c),r.child;case 14:return _x(s,r,r.type,r.pendingProps,c);case 15:return Mx(s,r,r.type,r.pendingProps,c);case 19:return zx(s,r,c);case 31:return a_(s,r,c);case 22:return Ex(s,r,c,r.pendingProps);case 24:return la(r),h=zn(an),s===null?(m=Dp(),m===null&&(m=Ot,g=Ep(),m.pooledCache=g,g.refCount++,g!==null&&(m.pooledCacheLanes|=c),m=g),r.memoizedState={parent:h,cache:m},Rp(r),rr(r,an,m)):((s.lanes&c)!==0&&(jp(s,r),Rc(r,null,null,c),Oc()),m=s.memoizedState,g=r.memoizedState,m.parent!==h?(m={parent:h,cache:h},r.memoizedState=m,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=m),rr(r,an,h)):(h=g.cache,rr(r,an,h),h!==m.cache&&Mp(r,[an],c,!0))),Hn(s,r,r.pendingProps.children,c),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function El(s){s.flags|=4}function mm(s,r,c,h,m){if((r=(s.mode&32)!==0)&&(r=!1),r){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(f1())s.flags|=8192;else throw oa=Mf,Op}else s.flags&=-16777217}function Ix(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!ev(r))if(f1())s.flags|=8192;else throw oa=Mf,Op}function Yf(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?jn():536870912,s.lanes|=r,uo|=r)}function Ic(s,r){if(!ot)switch(s.tailMode){case"hidden":r=s.tail;for(var c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:h.sibling=null}}function Vt(s){var r=s.alternate!==null&&s.alternate.child===s.child,c=0,h=0;if(r)for(var m=s.child;m!==null;)c|=m.lanes|m.childLanes,h|=m.subtreeFlags&65011712,h|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)c|=m.lanes|m.childLanes,h|=m.subtreeFlags,h|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=h,s.childLanes=c,r}function c_(s,r,c){var h=r.pendingProps;switch(kp(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(r),null;case 1:return Vt(r),null;case 3:return c=r.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),r.memoizedState.cache!==h&&(r.flags|=2048),Cl(an),$e(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(Qa(r)?El(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Cp())),Vt(r),null;case 26:var m=r.type,g=r.memoizedState;return s===null?(El(r),g!==null?(Vt(r),Ix(r,g)):(Vt(r),mm(r,m,null,h,c))):g?g!==s.memoizedState?(El(r),Vt(r),Ix(r,g)):(Vt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==h&&El(r),Vt(r),mm(r,m,s,h,c)),null;case 27:if(Ze(r),c=Se.current,m=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==h&&El(r);else{if(!h){if(r.stateNode===null)throw Error(i(166));return Vt(r),null}s=oe.current,Qa(r)?bb(r):(s=F1(m,h,c),r.stateNode=s,El(r))}return Vt(r),null;case 5:if(Ze(r),m=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==h&&El(r);else{if(!h){if(r.stateNode===null)throw Error(i(166));return Vt(r),null}if(g=oe.current,Qa(r))bb(r);else{var v=rh(Se.current);switch(g){case 1:g=v.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:g=v.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":g=v.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":g=v.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":g=v.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof h.is=="string"?v.createElement("select",{is:h.is}):v.createElement("select"),h.multiple?g.multiple=!0:h.size&&(g.size=h.size);break;default:g=typeof h.is=="string"?v.createElement(m,{is:h.is}):v.createElement(m)}}g[Nt]=r,g[Xe]=h;e:for(v=r.child;v!==null;){if(v.tag===5||v.tag===6)g.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===r)break e;for(;v.sibling===null;){if(v.return===null||v.return===r)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}r.stateNode=g;e:switch(In(g,m,h),m){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&El(r)}}return Vt(r),mm(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,c),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==h&&El(r);else{if(typeof h!="string"&&r.stateNode===null)throw Error(i(166));if(s=Se.current,Qa(r)){if(s=r.stateNode,c=r.memoizedProps,h=null,m=Bn,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}s[Nt]=r,s=!!(s.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||L1(s.nodeValue,c)),s||lr(r,!0)}else s=rh(s).createTextNode(h),s[Nt]=r,r.stateNode=s}return Vt(r),null;case 31:if(c=r.memoizedState,s===null||s.memoizedState!==null){if(h=Qa(r),c!==null){if(s===null){if(!h)throw Error(i(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[Nt]=r}else ia(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Vt(r),s=!1}else c=Cp(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return r.flags&256?(Ii(r),r):(Ii(r),null);if((r.flags&128)!==0)throw Error(i(558))}return Vt(r),null;case 13:if(h=r.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=Qa(r),h!==null&&h.dehydrated!==null){if(s===null){if(!m)throw Error(i(318));if(m=r.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Nt]=r}else ia(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Vt(r),m=!1}else m=Cp(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return r.flags&256?(Ii(r),r):(Ii(r),null)}return Ii(r),(r.flags&128)!==0?(r.lanes=c,r):(c=h!==null,s=s!==null&&s.memoizedState!==null,c&&(h=r.child,m=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(m=h.alternate.memoizedState.cachePool.pool),g=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(g=h.memoizedState.cachePool.pool),g!==m&&(h.flags|=2048)),c!==s&&c&&(r.child.flags|=8192),Yf(r,r.updateQueue),Vt(r),null);case 4:return $e(),s===null&&zm(r.stateNode.containerInfo),Vt(r),null;case 10:return Cl(r.type),Vt(r),null;case 19:if(F(tn),h=r.memoizedState,h===null)return Vt(r),null;if(m=(r.flags&128)!==0,g=h.rendering,g===null)if(m)Ic(h,!1);else{if(Zt!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(g=Of(s),g!==null){for(r.flags|=128,Ic(h,!1),s=g.updateQueue,r.updateQueue=s,Yf(r,s),r.subtreeFlags=0,s=c,c=r.child;c!==null;)db(c,s),c=c.sibling;return J(tn,tn.current&1|2),ot&&kl(r,h.treeForkCount),r.child}s=s.sibling}h.tail!==null&&Fe()>Xf&&(r.flags|=128,m=!0,Ic(h,!1),r.lanes=4194304)}else{if(!m)if(s=Of(g),s!==null){if(r.flags|=128,m=!0,s=s.updateQueue,r.updateQueue=s,Yf(r,s),Ic(h,!0),h.tail===null&&h.tailMode==="hidden"&&!g.alternate&&!ot)return Vt(r),null}else 2*Fe()-h.renderingStartTime>Xf&&c!==536870912&&(r.flags|=128,m=!0,Ic(h,!1),r.lanes=4194304);h.isBackwards?(g.sibling=r.child,r.child=g):(s=h.last,s!==null?s.sibling=g:r.child=g,h.last=g)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=Fe(),s.sibling=null,c=tn.current,J(tn,m?c&1|2:c&1),ot&&kl(r,h.treeForkCount),s):(Vt(r),null);case 22:case 23:return Ii(r),Hp(),h=r.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(r.flags|=8192):h&&(r.flags|=8192),h?(c&536870912)!==0&&(r.flags&128)===0&&(Vt(r),r.subtreeFlags&6&&(r.flags|=8192)):Vt(r),c=r.updateQueue,c!==null&&Yf(r,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),h=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(h=r.memoizedState.cachePool.pool),h!==c&&(r.flags|=2048),s!==null&&F(ra),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),Cl(an),Vt(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function u_(s,r){switch(kp(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return Cl(an),$e(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return Ze(r),null;case 31:if(r.memoizedState!==null){if(Ii(r),r.alternate===null)throw Error(i(340));ia()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(Ii(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(i(340));ia()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return F(tn),null;case 4:return $e(),null;case 10:return Cl(r.type),null;case 22:case 23:return Ii(r),Hp(),s!==null&&F(ra),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return Cl(an),null;case 25:return null;default:return null}}function Ux(s,r){switch(kp(r),r.tag){case 3:Cl(an),$e();break;case 26:case 27:case 5:Ze(r);break;case 4:$e();break;case 31:r.memoizedState!==null&&Ii(r);break;case 13:Ii(r);break;case 19:F(tn);break;case 10:Cl(r.type);break;case 22:case 23:Ii(r),Hp(),s!==null&&F(ra);break;case 24:Cl(an)}}function Uc(s,r){try{var c=r.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var m=h.next;c=m;do{if((c.tag&s)===s){h=void 0;var g=c.create,v=c.inst;h=g(),v.destroy=h}c=c.next}while(c!==m)}}catch(A){At(r,r.return,A)}}function hr(s,r,c){try{var h=r.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var g=m.next;h=g;do{if((h.tag&s)===s){var v=h.inst,A=v.destroy;if(A!==void 0){v.destroy=void 0,m=r;var D=c,G=A;try{G()}catch(K){At(m,D,K)}}}h=h.next}while(h!==g)}}catch(K){At(r,r.return,K)}}function Vx(s){var r=s.updateQueue;if(r!==null){var c=s.stateNode;try{Db(r,c)}catch(h){At(s,s.return,h)}}}function qx(s,r,c){c.props=fa(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(h){At(s,r,h)}}function Vc(s,r){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof c=="function"?s.refCleanup=c(h):c.current=h}}catch(m){At(s,r,m)}}function $s(s,r){var c=s.ref,h=s.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(m){At(s,r,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){At(s,r,m)}else c.current=null}function Gx(s){var r=s.type,c=s.memoizedProps,h=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":c.autoFocus&&h.focus();break e;case"img":c.src?h.src=c.src:c.srcSet&&(h.srcset=c.srcSet)}}catch(m){At(s,s.return,m)}}function gm(s,r,c){try{var h=s.stateNode;O_(h,s.type,c,r),h[Xe]=r}catch(m){At(s,s.return,m)}}function Px(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&xr(s.type)||s.tag===4}function ym(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Px(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&xr(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function bm(s,r,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,r?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,r):(r=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,r.appendChild(s),c=c._reactRootContainer,c!=null||r.onclick!==null||(r.onclick=zt));else if(h!==4&&(h===27&&xr(s.type)&&(c=s.stateNode,r=null),s=s.child,s!==null))for(bm(s,r,c),s=s.sibling;s!==null;)bm(s,r,c),s=s.sibling}function Ff(s,r,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,r?c.insertBefore(s,r):c.appendChild(s);else if(h!==4&&(h===27&&xr(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(Ff(s,r,c),s=s.sibling;s!==null;)Ff(s,r,c),s=s.sibling}function Yx(s){var r=s.stateNode,c=s.memoizedProps;try{for(var h=s.type,m=r.attributes;m.length;)r.removeAttributeNode(m[0]);In(r,h,c),r[Nt]=s,r[Xe]=c}catch(g){At(s,s.return,g)}}var Nl=!1,un=!1,xm=!1,Fx=typeof WeakSet=="function"?WeakSet:Set,Mn=null;function f_(s,r){if(s=s.containerInfo,Um=dh,s=sb(s),hp(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var h=c.getSelection&&c.getSelection();if(h&&h.rangeCount!==0){c=h.anchorNode;var m=h.anchorOffset,g=h.focusNode;h=h.focusOffset;try{c.nodeType,g.nodeType}catch{c=null;break e}var v=0,A=-1,D=-1,G=0,K=0,te=s,P=null;t:for(;;){for(var W;te!==c||m!==0&&te.nodeType!==3||(A=v+m),te!==g||h!==0&&te.nodeType!==3||(D=v+h),te.nodeType===3&&(v+=te.nodeValue.length),(W=te.firstChild)!==null;)P=te,te=W;for(;;){if(te===s)break t;if(P===c&&++G===m&&(A=v),P===g&&++K===h&&(D=v),(W=te.nextSibling)!==null)break;te=P,P=te.parentNode}te=W}c=A===-1||D===-1?null:{start:A,end:D}}else c=null}c=c||{start:0,end:0}}else c=null;for(Vm={focusedElem:s,selectionRange:c},dh=!1,Mn=r;Mn!==null;)if(r=Mn,s=r.child,(r.subtreeFlags&1028)!==0&&s!==null)s.return=r,Mn=s;else for(;Mn!==null;){switch(r=Mn,g=r.alternate,s=r.flags,r.tag){case 0:if((s&4)!==0&&(s=r.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)m=s[c],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&g!==null){s=void 0,c=r,m=g.memoizedProps,g=g.memoizedState,h=c.stateNode;try{var Ce=fa(c.type,m);s=h.getSnapshotBeforeUpdate(Ce,g),h.__reactInternalSnapshotBeforeUpdate=s}catch(He){At(c,c.return,He)}}break;case 3:if((s&1024)!==0){if(s=r.stateNode.containerInfo,c=s.nodeType,c===9)Pm(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Pm(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=r.sibling,s!==null){s.return=r.return,Mn=s;break}Mn=r.return}}function Wx(s,r,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:Ol(s,c),h&4&&Uc(5,c);break;case 1:if(Ol(s,c),h&4)if(s=c.stateNode,r===null)try{s.componentDidMount()}catch(v){At(c,c.return,v)}else{var m=fa(c.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(m,r,s.__reactInternalSnapshotBeforeUpdate)}catch(v){At(c,c.return,v)}}h&64&&Vx(c),h&512&&Vc(c,c.return);break;case 3:if(Ol(s,c),h&64&&(s=c.updateQueue,s!==null)){if(r=null,c.child!==null)switch(c.child.tag){case 27:case 5:r=c.child.stateNode;break;case 1:r=c.child.stateNode}try{Db(s,r)}catch(v){At(c,c.return,v)}}break;case 27:r===null&&h&4&&Yx(c);case 26:case 5:Ol(s,c),r===null&&h&4&&Gx(c),h&512&&Vc(c,c.return);break;case 12:Ol(s,c);break;case 31:Ol(s,c),h&4&&Xx(s,c);break;case 13:Ol(s,c),h&4&&Qx(s,c),h&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=v_.bind(null,c),U_(s,c))));break;case 22:if(h=c.memoizedState!==null||Nl,!h){r=r!==null&&r.memoizedState!==null||un,m=Nl;var g=un;Nl=h,(un=r)&&!g?Rl(s,c,(c.subtreeFlags&8772)!==0):Ol(s,c),Nl=m,un=g}break;case 30:break;default:Ol(s,c)}}function $x(s){var r=s.alternate;r!==null&&(s.alternate=null,$x(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&yl(r)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Pt=null,bi=!1;function Dl(s,r,c){for(c=c.child;c!==null;)Kx(s,r,c),c=c.sibling}function Kx(s,r,c){if(Sn&&typeof Sn.onCommitFiberUnmount=="function")try{Sn.onCommitFiberUnmount(hs,c)}catch{}switch(c.tag){case 26:un||$s(c,r),Dl(s,r,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:un||$s(c,r);var h=Pt,m=bi;xr(c.type)&&(Pt=c.stateNode,bi=!1),Dl(s,r,c),Xc(c.stateNode),Pt=h,bi=m;break;case 5:un||$s(c,r);case 6:if(h=Pt,m=bi,Pt=null,Dl(s,r,c),Pt=h,bi=m,Pt!==null)if(bi)try{(Pt.nodeType===9?Pt.body:Pt.nodeName==="HTML"?Pt.ownerDocument.body:Pt).removeChild(c.stateNode)}catch(g){At(c,r,g)}else try{Pt.removeChild(c.stateNode)}catch(g){At(c,r,g)}break;case 18:Pt!==null&&(bi?(s=Pt,V1(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),xo(s)):V1(Pt,c.stateNode));break;case 4:h=Pt,m=bi,Pt=c.stateNode.containerInfo,bi=!0,Dl(s,r,c),Pt=h,bi=m;break;case 0:case 11:case 14:case 15:hr(2,c,r),un||hr(4,c,r),Dl(s,r,c);break;case 1:un||($s(c,r),h=c.stateNode,typeof h.componentWillUnmount=="function"&&qx(c,r,h)),Dl(s,r,c);break;case 21:Dl(s,r,c);break;case 22:un=(h=un)||c.memoizedState!==null,Dl(s,r,c),un=h;break;default:Dl(s,r,c)}}function Xx(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{xo(s)}catch(c){At(r,r.return,c)}}}function Qx(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{xo(s)}catch(c){At(r,r.return,c)}}function h_(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new Fx),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new Fx),r;default:throw Error(i(435,s.tag))}}function Wf(s,r){var c=h_(s);r.forEach(function(h){if(!c.has(h)){c.add(h);var m=S_.bind(null,s,h);h.then(m,m)}})}function xi(s,r){var c=r.deletions;if(c!==null)for(var h=0;h<c.length;h++){var m=c[h],g=s,v=r,A=v;e:for(;A!==null;){switch(A.tag){case 27:if(xr(A.type)){Pt=A.stateNode,bi=!1;break e}break;case 5:Pt=A.stateNode,bi=!1;break e;case 3:case 4:Pt=A.stateNode.containerInfo,bi=!0;break e}A=A.return}if(Pt===null)throw Error(i(160));Kx(g,v,m),Pt=null,bi=!1,g=m.alternate,g!==null&&(g.return=null),m.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Zx(r,s),r=r.sibling}var Ts=null;function Zx(s,r){var c=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:xi(r,s),vi(s),h&4&&(hr(3,s,s.return),Uc(3,s),hr(5,s,s.return));break;case 1:xi(r,s),vi(s),h&512&&(un||c===null||$s(c,c.return)),h&64&&Nl&&(s=s.updateQueue,s!==null&&(h=s.callbacks,h!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?h:c.concat(h))));break;case 26:var m=Ts;if(xi(r,s),vi(s),h&512&&(un||c===null||$s(c,c.return)),h&4){var g=c!==null?c.memoizedState:null;if(h=s.memoizedState,c===null)if(h===null)if(s.stateNode===null){e:{h=s.type,c=s.memoizedProps,m=m.ownerDocument||m;t:switch(h){case"title":g=m.getElementsByTagName("title")[0],(!g||g[Gs]||g[Nt]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=m.createElement(h),m.head.insertBefore(g,m.querySelector("head > title"))),In(g,h,c),g[Nt]=s,wt(g),h=g;break e;case"link":var v=Z1("link","href",m).get(h+(c.href||""));if(v){for(var A=0;A<v.length;A++)if(g=v[A],g.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&g.getAttribute("rel")===(c.rel==null?null:c.rel)&&g.getAttribute("title")===(c.title==null?null:c.title)&&g.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){v.splice(A,1);break t}}g=m.createElement(h),In(g,h,c),m.head.appendChild(g);break;case"meta":if(v=Z1("meta","content",m).get(h+(c.content||""))){for(A=0;A<v.length;A++)if(g=v[A],g.getAttribute("content")===(c.content==null?null:""+c.content)&&g.getAttribute("name")===(c.name==null?null:c.name)&&g.getAttribute("property")===(c.property==null?null:c.property)&&g.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&g.getAttribute("charset")===(c.charSet==null?null:c.charSet)){v.splice(A,1);break t}}g=m.createElement(h),In(g,h,c),m.head.appendChild(g);break;default:throw Error(i(468,h))}g[Nt]=s,wt(g),h=g}s.stateNode=h}else J1(m,s.type,s.stateNode);else s.stateNode=Q1(m,h,s.memoizedProps);else g!==h?(g===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):g.count--,h===null?J1(m,s.type,s.stateNode):Q1(m,h,s.memoizedProps)):h===null&&s.stateNode!==null&&gm(s,s.memoizedProps,c.memoizedProps)}break;case 27:xi(r,s),vi(s),h&512&&(un||c===null||$s(c,c.return)),c!==null&&h&4&&gm(s,s.memoizedProps,c.memoizedProps);break;case 5:if(xi(r,s),vi(s),h&512&&(un||c===null||$s(c,c.return)),s.flags&32){m=s.stateNode;try{U(m,"")}catch(Ce){At(s,s.return,Ce)}}h&4&&s.stateNode!=null&&(m=s.memoizedProps,gm(s,m,c!==null?c.memoizedProps:m)),h&1024&&(xm=!0);break;case 6:if(xi(r,s),vi(s),h&4){if(s.stateNode===null)throw Error(i(162));h=s.memoizedProps,c=s.stateNode;try{c.nodeValue=h}catch(Ce){At(s,s.return,Ce)}}break;case 3:if(ch=null,m=Ts,Ts=ah(r.containerInfo),xi(r,s),Ts=m,vi(s),h&4&&c!==null&&c.memoizedState.isDehydrated)try{xo(r.containerInfo)}catch(Ce){At(s,s.return,Ce)}xm&&(xm=!1,Jx(s));break;case 4:h=Ts,Ts=ah(s.stateNode.containerInfo),xi(r,s),vi(s),Ts=h;break;case 12:xi(r,s),vi(s);break;case 31:xi(r,s),vi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Wf(s,h)));break;case 13:xi(r,s),vi(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Kf=Fe()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Wf(s,h)));break;case 22:m=s.memoizedState!==null;var D=c!==null&&c.memoizedState!==null,G=Nl,K=un;if(Nl=G||m,un=K||D,xi(r,s),un=K,Nl=G,vi(s),h&8192)e:for(r=s.stateNode,r._visibility=m?r._visibility&-2:r._visibility|1,m&&(c===null||D||Nl||un||ha(s)),c=null,r=s;;){if(r.tag===5||r.tag===26){if(c===null){D=c=r;try{if(g=D.stateNode,m)v=g.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{A=D.stateNode;var te=D.memoizedProps.style,P=te!=null&&te.hasOwnProperty("display")?te.display:null;A.style.display=P==null||typeof P=="boolean"?"":(""+P).trim()}}catch(Ce){At(D,D.return,Ce)}}}else if(r.tag===6){if(c===null){D=r;try{D.stateNode.nodeValue=m?"":D.memoizedProps}catch(Ce){At(D,D.return,Ce)}}}else if(r.tag===18){if(c===null){D=r;try{var W=D.stateNode;m?q1(W,!0):q1(D.stateNode,!1)}catch(Ce){At(D,D.return,Ce)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===s)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;c===r&&(c=null),r=r.return}c===r&&(c=null),r.sibling.return=r.return,r=r.sibling}h&4&&(h=s.updateQueue,h!==null&&(c=h.retryQueue,c!==null&&(h.retryQueue=null,Wf(s,c))));break;case 19:xi(r,s),vi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Wf(s,h)));break;case 30:break;case 21:break;default:xi(r,s),vi(s)}}function vi(s){var r=s.flags;if(r&2){try{for(var c,h=s.return;h!==null;){if(Px(h)){c=h;break}h=h.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var m=c.stateNode,g=ym(s);Ff(s,g,m);break;case 5:var v=c.stateNode;c.flags&32&&(U(v,""),c.flags&=-33);var A=ym(s);Ff(s,A,v);break;case 3:case 4:var D=c.stateNode.containerInfo,G=ym(s);bm(s,G,D);break;default:throw Error(i(161))}}catch(K){At(s,s.return,K)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function Jx(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;Jx(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),s=s.sibling}}function Ol(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)Wx(s,r.alternate,r),r=r.sibling}function ha(s){for(s=s.child;s!==null;){var r=s;switch(r.tag){case 0:case 11:case 14:case 15:hr(4,r,r.return),ha(r);break;case 1:$s(r,r.return);var c=r.stateNode;typeof c.componentWillUnmount=="function"&&qx(r,r.return,c),ha(r);break;case 27:Xc(r.stateNode);case 26:case 5:$s(r,r.return),ha(r);break;case 22:r.memoizedState===null&&ha(r);break;case 30:ha(r);break;default:ha(r)}s=s.sibling}}function Rl(s,r,c){for(c=c&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var h=r.alternate,m=s,g=r,v=g.flags;switch(g.tag){case 0:case 11:case 15:Rl(m,g,c),Uc(4,g);break;case 1:if(Rl(m,g,c),h=g,m=h.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(G){At(h,h.return,G)}if(h=g,m=h.updateQueue,m!==null){var A=h.stateNode;try{var D=m.shared.hiddenCallbacks;if(D!==null)for(m.shared.hiddenCallbacks=null,m=0;m<D.length;m++)Nb(D[m],A)}catch(G){At(h,h.return,G)}}c&&v&64&&Vx(g),Vc(g,g.return);break;case 27:Yx(g);case 26:case 5:Rl(m,g,c),c&&h===null&&v&4&&Gx(g),Vc(g,g.return);break;case 12:Rl(m,g,c);break;case 31:Rl(m,g,c),c&&v&4&&Xx(m,g);break;case 13:Rl(m,g,c),c&&v&4&&Qx(m,g);break;case 22:g.memoizedState===null&&Rl(m,g,c),Vc(g,g.return);break;case 30:break;default:Rl(m,g,c)}r=r.sibling}}function vm(s,r){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&_c(c))}function Sm(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&_c(s))}function _s(s,r,c,h){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)e1(s,r,c,h),r=r.sibling}function e1(s,r,c,h){var m=r.flags;switch(r.tag){case 0:case 11:case 15:_s(s,r,c,h),m&2048&&Uc(9,r);break;case 1:_s(s,r,c,h);break;case 3:_s(s,r,c,h),m&2048&&(s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&_c(s)));break;case 12:if(m&2048){_s(s,r,c,h),s=r.stateNode;try{var g=r.memoizedProps,v=g.id,A=g.onPostCommit;typeof A=="function"&&A(v,r.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(D){At(r,r.return,D)}}else _s(s,r,c,h);break;case 31:_s(s,r,c,h);break;case 13:_s(s,r,c,h);break;case 23:break;case 22:g=r.stateNode,v=r.alternate,r.memoizedState!==null?g._visibility&2?_s(s,r,c,h):qc(s,r):g._visibility&2?_s(s,r,c,h):(g._visibility|=2,ao(s,r,c,h,(r.subtreeFlags&10256)!==0||!1)),m&2048&&vm(v,r);break;case 24:_s(s,r,c,h),m&2048&&Sm(r.alternate,r);break;default:_s(s,r,c,h)}}function ao(s,r,c,h,m){for(m=m&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var g=s,v=r,A=c,D=h,G=v.flags;switch(v.tag){case 0:case 11:case 15:ao(g,v,A,D,m),Uc(8,v);break;case 23:break;case 22:var K=v.stateNode;v.memoizedState!==null?K._visibility&2?ao(g,v,A,D,m):qc(g,v):(K._visibility|=2,ao(g,v,A,D,m)),m&&G&2048&&vm(v.alternate,v);break;case 24:ao(g,v,A,D,m),m&&G&2048&&Sm(v.alternate,v);break;default:ao(g,v,A,D,m)}r=r.sibling}}function qc(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var c=s,h=r,m=h.flags;switch(h.tag){case 22:qc(c,h),m&2048&&vm(h.alternate,h);break;case 24:qc(c,h),m&2048&&Sm(h.alternate,h);break;default:qc(c,h)}r=r.sibling}}var Gc=8192;function oo(s,r,c){if(s.subtreeFlags&Gc)for(s=s.child;s!==null;)t1(s,r,c),s=s.sibling}function t1(s,r,c){switch(s.tag){case 26:oo(s,r,c),s.flags&Gc&&s.memoizedState!==null&&Z_(c,Ts,s.memoizedState,s.memoizedProps);break;case 5:oo(s,r,c);break;case 3:case 4:var h=Ts;Ts=ah(s.stateNode.containerInfo),oo(s,r,c),Ts=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=Gc,Gc=16777216,oo(s,r,c),Gc=h):oo(s,r,c));break;default:oo(s,r,c)}}function n1(s){var r=s.alternate;if(r!==null&&(s=r.child,s!==null)){r.child=null;do r=s.sibling,s.sibling=null,s=r;while(s!==null)}}function Pc(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var h=r[c];Mn=h,s1(h,s)}n1(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)i1(s),s=s.sibling}function i1(s){switch(s.tag){case 0:case 11:case 15:Pc(s),s.flags&2048&&hr(9,s,s.return);break;case 3:Pc(s);break;case 12:Pc(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,$f(s)):Pc(s);break;default:Pc(s)}}function $f(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var h=r[c];Mn=h,s1(h,s)}n1(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:hr(8,r,r.return),$f(r);break;case 22:c=r.stateNode,c._visibility&2&&(c._visibility&=-3,$f(r));break;default:$f(r)}s=s.sibling}}function s1(s,r){for(;Mn!==null;){var c=Mn;switch(c.tag){case 0:case 11:case 15:hr(8,c,r);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var h=c.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:_c(c.memoizedState.cache)}if(h=c.child,h!==null)h.return=c,Mn=h;else e:for(c=s;Mn!==null;){h=Mn;var m=h.sibling,g=h.return;if($x(h),h===c){Mn=null;break e}if(m!==null){m.return=g,Mn=m;break e}Mn=g}}}var d_={getCacheForType:function(s){var r=zn(an),c=r.data.get(s);return c===void 0&&(c=s(),r.data.set(s,c)),c},cacheSignal:function(){return zn(an).controller.signal}},p_=typeof WeakMap=="function"?WeakMap:Map,yt=0,Ot=null,tt=null,lt=0,kt=0,Ui=null,dr=!1,co=!1,wm=!1,jl=0,Zt=0,pr=0,da=0,km=0,Vi=0,uo=0,Yc=null,Si=null,Am=!1,Kf=0,l1=0,Xf=1/0,Qf=null,mr=null,yn=0,gr=null,fo=null,Ll=0,Cm=0,Tm=null,r1=null,Fc=0,_m=null;function qi(){return(yt&2)!==0&&lt!==0?lt&-lt:I.T!==null?Rm():Vs()}function a1(){if(Vi===0)if((lt&536870912)===0||ot){var s=Is;Is<<=1,(Is&3932160)===0&&(Is=262144),Vi=s}else Vi=536870912;return s=Hi.current,s!==null&&(s.flags|=32),Vi}function wi(s,r,c){(s===Ot&&(kt===2||kt===9)||s.cancelPendingCommit!==null)&&(ho(s,0),yr(s,lt,Vi,!1)),mi(s,c),((yt&2)===0||s!==Ot)&&(s===Ot&&((yt&2)===0&&(da|=c),Zt===4&&yr(s,lt,Vi,!1)),Ks(s))}function o1(s,r,c){if((yt&6)!==0)throw Error(i(327));var h=!c&&(r&127)===0&&(r&s.expiredLanes)===0||li(s,r),m=h?y_(s,r):Em(s,r,!0),g=h;do{if(m===0){co&&!h&&yr(s,r,0,!1);break}else{if(c=s.current.alternate,g&&!m_(c)){m=Em(s,r,!1),g=!1;continue}if(m===2){if(g=r,s.errorRecoveryDisabledLanes&g)var v=0;else v=s.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){r=v;e:{var A=s;m=Yc;var D=A.current.memoizedState.isDehydrated;if(D&&(ho(A,v).flags|=256),v=Em(A,v,!1),v!==2){if(wm&&!D){A.errorRecoveryDisabledLanes|=g,da|=g,m=4;break e}g=Si,Si=m,g!==null&&(Si===null?Si=g:Si.push.apply(Si,g))}m=v}if(g=!1,m!==2)continue}}if(m===1){ho(s,0),yr(s,r,0,!0);break}e:{switch(h=s,g=m,g){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:yr(h,r,Vi,!dr);break e;case 2:Si=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(m=Kf+300-Fe(),10<m)){if(yr(h,r,Vi,!dr),ml(h,0,!0)!==0)break e;Ll=r,h.timeoutHandle=I1(c1.bind(null,h,c,Si,Qf,Am,r,Vi,da,uo,dr,g,"Throttled",-0,0),m);break e}c1(h,c,Si,Qf,Am,r,Vi,da,uo,dr,g,null,-0,0)}}break}while(!0);Ks(s)}function c1(s,r,c,h,m,g,v,A,D,G,K,te,P,W){if(s.timeoutHandle=-1,te=r.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zt},t1(r,g,te);var Ce=(g&62914560)===g?Kf-Fe():(g&4194048)===g?l1-Fe():0;if(Ce=J_(te,Ce),Ce!==null){Ll=g,s.cancelPendingCommit=Ce(y1.bind(null,s,r,g,c,h,m,v,A,D,K,te,null,P,W)),yr(s,g,v,!G);return}}y1(s,r,g,c,h,m,v,A,D)}function m_(s){for(var r=s;;){var c=r.tag;if((c===0||c===11||c===15)&&r.flags&16384&&(c=r.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var h=0;h<c.length;h++){var m=c[h],g=m.getSnapshot;m=m.value;try{if(!Bi(g(),m))return!1}catch{return!1}}if(c=r.child,r.subtreeFlags&16384&&c!==null)c.return=r,r=c;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function yr(s,r,c,h){r&=~km,r&=~da,s.suspendedLanes|=r,s.pingedLanes&=~r,h&&(s.warmLanes|=r),h=s.expirationTimes;for(var m=r;0<m;){var g=31-mn(m),v=1<<g;h[g]=-1,m&=~v}c!==0&&Us(s,c,r)}function Zf(){return(yt&6)===0?(Wc(0),!1):!0}function Mm(){if(tt!==null){if(kt===0)var s=tt.return;else s=tt,Al=sa=null,Pp(s),no=null,Ec=0,s=tt;for(;s!==null;)Ux(s.alternate,s),s=s.return;tt=null}}function ho(s,r){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,L_(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Ll=0,Mm(),Ot=s,tt=c=wl(s.current,null),lt=r,kt=0,Ui=null,dr=!1,co=li(s,r),wm=!1,uo=Vi=km=da=pr=Zt=0,Si=Yc=null,Am=!1,(r&8)!==0&&(r|=r&32);var h=s.entangledLanes;if(h!==0)for(s=s.entanglements,h&=r;0<h;){var m=31-mn(h),g=1<<m;r|=s[m],h&=~g}return jl=r,xf(),c}function u1(s,r){We=null,I.H=zc,r===to||r===_f?(r=Tb(),kt=3):r===Op?(r=Tb(),kt=4):kt=r===rm?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ui=r,tt===null&&(Zt=1,Vf(s,Ji(r,s.current)))}function f1(){var s=Hi.current;return s===null?!0:(lt&4194048)===lt?is===null:(lt&62914560)===lt||(lt&536870912)!==0?s===is:!1}function h1(){var s=I.H;return I.H=zc,s===null?zc:s}function d1(){var s=I.A;return I.A=d_,s}function Jf(){Zt=4,dr||(lt&4194048)!==lt&&Hi.current!==null||(co=!0),(pr&134217727)===0&&(da&134217727)===0||Ot===null||yr(Ot,lt,Vi,!1)}function Em(s,r,c){var h=yt;yt|=2;var m=h1(),g=d1();(Ot!==s||lt!==r)&&(Qf=null,ho(s,r)),r=!1;var v=Zt;e:do try{if(kt!==0&&tt!==null){var A=tt,D=Ui;switch(kt){case 8:Mm(),v=6;break e;case 3:case 2:case 9:case 6:Hi.current===null&&(r=!0);var G=kt;if(kt=0,Ui=null,po(s,A,D,G),c&&co){v=0;break e}break;default:G=kt,kt=0,Ui=null,po(s,A,D,G)}}g_(),v=Zt;break}catch(K){u1(s,K)}while(!0);return r&&s.shellSuspendCounter++,Al=sa=null,yt=h,I.H=m,I.A=g,tt===null&&(Ot=null,lt=0,xf()),v}function g_(){for(;tt!==null;)p1(tt)}function y_(s,r){var c=yt;yt|=2;var h=h1(),m=d1();Ot!==s||lt!==r?(Qf=null,Xf=Fe()+500,ho(s,r)):co=li(s,r);e:do try{if(kt!==0&&tt!==null){r=tt;var g=Ui;t:switch(kt){case 1:kt=0,Ui=null,po(s,r,g,1);break;case 2:case 9:if(Ab(g)){kt=0,Ui=null,m1(r);break}r=function(){kt!==2&&kt!==9||Ot!==s||(kt=7),Ks(s)},g.then(r,r);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:Ab(g)?(kt=0,Ui=null,m1(r)):(kt=0,Ui=null,po(s,r,g,7));break;case 5:var v=null;switch(tt.tag){case 26:v=tt.memoizedState;case 5:case 27:var A=tt;if(v?ev(v):A.stateNode.complete){kt=0,Ui=null;var D=A.sibling;if(D!==null)tt=D;else{var G=A.return;G!==null?(tt=G,eh(G)):tt=null}break t}}kt=0,Ui=null,po(s,r,g,5);break;case 6:kt=0,Ui=null,po(s,r,g,6);break;case 8:Mm(),Zt=6;break e;default:throw Error(i(462))}}b_();break}catch(K){u1(s,K)}while(!0);return Al=sa=null,I.H=h,I.A=m,yt=c,tt!==null?0:(Ot=null,lt=0,xf(),Zt)}function b_(){for(;tt!==null&&!qe();)p1(tt)}function p1(s){var r=Hx(s.alternate,s,jl);s.memoizedProps=s.pendingProps,r===null?eh(s):tt=r}function m1(s){var r=s,c=r.alternate;switch(r.tag){case 15:case 0:r=Ox(c,r,r.pendingProps,r.type,void 0,lt);break;case 11:r=Ox(c,r,r.pendingProps,r.type.render,r.ref,lt);break;case 5:Pp(r);default:Ux(c,r),r=tt=db(r,jl),r=Hx(c,r,jl)}s.memoizedProps=s.pendingProps,r===null?eh(s):tt=r}function po(s,r,c,h){Al=sa=null,Pp(r),no=null,Ec=0;var m=r.return;try{if(r_(s,m,r,c,lt)){Zt=1,Vf(s,Ji(c,s.current)),tt=null;return}}catch(g){if(m!==null)throw tt=m,g;Zt=1,Vf(s,Ji(c,s.current)),tt=null;return}r.flags&32768?(ot||h===1?s=!0:co||(lt&536870912)!==0?s=!1:(dr=s=!0,(h===2||h===9||h===3||h===6)&&(h=Hi.current,h!==null&&h.tag===13&&(h.flags|=16384))),g1(r,s)):eh(r)}function eh(s){var r=s;do{if((r.flags&32768)!==0){g1(r,dr);return}s=r.return;var c=c_(r.alternate,r,jl);if(c!==null){tt=c;return}if(r=r.sibling,r!==null){tt=r;return}tt=r=s}while(r!==null);Zt===0&&(Zt=5)}function g1(s,r){do{var c=u_(s.alternate,s);if(c!==null){c.flags&=32767,tt=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!r&&(s=s.sibling,s!==null)){tt=s;return}tt=s=c}while(s!==null);Zt=6,tt=null}function y1(s,r,c,h,m,g,v,A,D){s.cancelPendingCommit=null;do th();while(yn!==0);if((yt&6)!==0)throw Error(i(327));if(r!==null){if(r===s.current)throw Error(i(177));if(g=r.lanes|r.childLanes,g|=yp,Ln(s,c,g,v,A,D),s===Ot&&(tt=Ot=null,lt=0),fo=r,gr=s,Ll=c,Cm=g,Tm=m,r1=h,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,w_(Je,function(){return w1(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||h){h=I.T,I.T=null,m=Z.p,Z.p=2,v=yt,yt|=4;try{f_(s,r,c)}finally{yt=v,Z.p=m,I.T=h}}yn=1,b1(),x1(),v1()}}function b1(){if(yn===1){yn=0;var s=gr,r=fo,c=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||c){c=I.T,I.T=null;var h=Z.p;Z.p=2;var m=yt;yt|=4;try{Zx(r,s);var g=Vm,v=sb(s.containerInfo),A=g.focusedElem,D=g.selectionRange;if(v!==A&&A&&A.ownerDocument&&ib(A.ownerDocument.documentElement,A)){if(D!==null&&hp(A)){var G=D.start,K=D.end;if(K===void 0&&(K=G),"selectionStart"in A)A.selectionStart=G,A.selectionEnd=Math.min(K,A.value.length);else{var te=A.ownerDocument||document,P=te&&te.defaultView||window;if(P.getSelection){var W=P.getSelection(),Ce=A.textContent.length,He=Math.min(D.start,Ce),_t=D.end===void 0?He:Math.min(D.end,Ce);!W.extend&&He>_t&&(v=_t,_t=He,He=v);var z=nb(A,He),R=nb(A,_t);if(z&&R&&(W.rangeCount!==1||W.anchorNode!==z.node||W.anchorOffset!==z.offset||W.focusNode!==R.node||W.focusOffset!==R.offset)){var V=te.createRange();V.setStart(z.node,z.offset),W.removeAllRanges(),He>_t?(W.addRange(V),W.extend(R.node,R.offset)):(V.setEnd(R.node,R.offset),W.addRange(V))}}}}for(te=[],W=A;W=W.parentNode;)W.nodeType===1&&te.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<te.length;A++){var Q=te[A];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}dh=!!Um,Vm=Um=null}finally{yt=m,Z.p=h,I.T=c}}s.current=r,yn=2}}function x1(){if(yn===2){yn=0;var s=gr,r=fo,c=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||c){c=I.T,I.T=null;var h=Z.p;Z.p=2;var m=yt;yt|=4;try{Wx(s,r.alternate,r)}finally{yt=m,Z.p=h,I.T=c}}yn=3}}function v1(){if(yn===4||yn===3){yn=0,St();var s=gr,r=fo,c=Ll,h=r1;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?yn=5:(yn=0,fo=gr=null,S1(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(mr=null),Ki(c),r=r.stateNode,Sn&&typeof Sn.onCommitFiberRoot=="function")try{Sn.onCommitFiberRoot(hs,r,void 0,(r.current.flags&128)===128)}catch{}if(h!==null){r=I.T,m=Z.p,Z.p=2,I.T=null;try{for(var g=s.onRecoverableError,v=0;v<h.length;v++){var A=h[v];g(A.value,{componentStack:A.stack})}}finally{I.T=r,Z.p=m}}(Ll&3)!==0&&th(),Ks(s),m=s.pendingLanes,(c&261930)!==0&&(m&42)!==0?s===_m?Fc++:(Fc=0,_m=s):Fc=0,Wc(0)}}function S1(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,_c(r)))}function th(){return b1(),x1(),v1(),w1()}function w1(){if(yn!==5)return!1;var s=gr,r=Cm;Cm=0;var c=Ki(Ll),h=I.T,m=Z.p;try{Z.p=32>c?32:c,I.T=null,c=Tm,Tm=null;var g=gr,v=Ll;if(yn=0,fo=gr=null,Ll=0,(yt&6)!==0)throw Error(i(331));var A=yt;if(yt|=4,i1(g.current),e1(g,g.current,v,c),yt=A,Wc(0,!1),Sn&&typeof Sn.onPostCommitFiberRoot=="function")try{Sn.onPostCommitFiberRoot(hs,g)}catch{}return!0}finally{Z.p=m,I.T=h,S1(s,r)}}function k1(s,r,c){r=Ji(c,r),r=lm(s.stateNode,r,2),s=cr(s,r,2),s!==null&&(mi(s,2),Ks(s))}function At(s,r,c){if(s.tag===3)k1(s,s,c);else for(;r!==null;){if(r.tag===3){k1(r,s,c);break}else if(r.tag===1){var h=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(mr===null||!mr.has(h))){s=Ji(c,s),c=Ax(2),h=cr(r,c,2),h!==null&&(Cx(c,h,r,s),mi(h,2),Ks(h));break}}r=r.return}}function Nm(s,r,c){var h=s.pingCache;if(h===null){h=s.pingCache=new p_;var m=new Set;h.set(r,m)}else m=h.get(r),m===void 0&&(m=new Set,h.set(r,m));m.has(c)||(wm=!0,m.add(c),s=x_.bind(null,s,r,c),r.then(s,s))}function x_(s,r,c){var h=s.pingCache;h!==null&&h.delete(r),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Ot===s&&(lt&c)===c&&(Zt===4||Zt===3&&(lt&62914560)===lt&&300>Fe()-Kf?(yt&2)===0&&ho(s,0):km|=c,uo===lt&&(uo=0)),Ks(s)}function A1(s,r){r===0&&(r=jn()),s=ta(s,r),s!==null&&(mi(s,r),Ks(s))}function v_(s){var r=s.memoizedState,c=0;r!==null&&(c=r.retryLane),A1(s,c)}function S_(s,r){var c=0;switch(s.tag){case 31:case 13:var h=s.stateNode,m=s.memoizedState;m!==null&&(c=m.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(r),A1(s,c)}function w_(s,r){return si(s,r)}var nh=null,mo=null,Dm=!1,ih=!1,Om=!1,br=0;function Ks(s){s!==mo&&s.next===null&&(mo===null?nh=mo=s:mo=mo.next=s),ih=!0,Dm||(Dm=!0,A_())}function Wc(s,r){if(!Om&&ih){Om=!0;do for(var c=!1,h=nh;h!==null;){if(s!==0){var m=h.pendingLanes;if(m===0)var g=0;else{var v=h.suspendedLanes,A=h.pingedLanes;g=(1<<31-mn(42|s)+1)-1,g&=m&~(v&~A),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(c=!0,M1(h,g))}else g=lt,g=ml(h,h===Ot?g:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(g&3)===0||li(h,g)||(c=!0,M1(h,g));h=h.next}while(c);Om=!1}}function k_(){C1()}function C1(){ih=Dm=!1;var s=0;br!==0&&j_()&&(s=br);for(var r=Fe(),c=null,h=nh;h!==null;){var m=h.next,g=T1(h,r);g===0?(h.next=null,c===null?nh=m:c.next=m,m===null&&(mo=c)):(c=h,(s!==0||(g&3)!==0)&&(ih=!0)),h=m}yn!==0&&yn!==5||Wc(s),br!==0&&(br=0)}function T1(s,r){for(var c=s.suspendedLanes,h=s.pingedLanes,m=s.expirationTimes,g=s.pendingLanes&-62914561;0<g;){var v=31-mn(g),A=1<<v,D=m[v];D===-1?((A&c)===0||(A&h)!==0)&&(m[v]=Kl(A,r)):D<=r&&(s.expiredLanes|=A),g&=~A}if(r=Ot,c=lt,c=ml(s,s===r?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,c===0||s===r&&(kt===2||kt===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&ce(h),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||li(s,c)){if(r=c&-c,r===s.callbackPriority)return r;switch(h!==null&&ce(h),Ki(c)){case 2:case 8:c=ze;break;case 32:c=Je;break;case 268435456:c=$n;break;default:c=Je}return h=_1.bind(null,s),c=si(c,h),s.callbackPriority=r,s.callbackNode=c,r}return h!==null&&h!==null&&ce(h),s.callbackPriority=2,s.callbackNode=null,2}function _1(s,r){if(yn!==0&&yn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(th()&&s.callbackNode!==c)return null;var h=lt;return h=ml(s,s===Ot?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(o1(s,h,r),T1(s,Fe()),s.callbackNode!=null&&s.callbackNode===c?_1.bind(null,s):null)}function M1(s,r){if(th())return null;o1(s,r,!0)}function A_(){B_(function(){(yt&6)!==0?si(fe,k_):C1()})}function Rm(){if(br===0){var s=Ja;s===0&&(s=Xt,Xt<<=1,(Xt&261888)===0&&(Xt=256)),br=s}return br}function E1(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:gn(""+s)}function N1(s,r){var c=r.ownerDocument.createElement("input");return c.name=r.name,c.value=r.value,s.id&&c.setAttribute("form",s.id),r.parentNode.insertBefore(c,r),s=new FormData(s),c.parentNode.removeChild(c),s}function C_(s,r,c,h,m){if(r==="submit"&&c&&c.stateNode===m){var g=E1((m[Xe]||null).action),v=h.submitter;v&&(r=(r=v[Xe]||null)?E1(r.formAction):v.getAttribute("formAction"),r!==null&&(g=r,v=null));var A=new Ua("action","action",null,h,m);s.push({event:A,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(br!==0){var D=v?N1(m,v):new FormData(m);Jp(c,{pending:!0,data:D,method:m.method,action:g},null,D)}}else typeof g=="function"&&(A.preventDefault(),D=v?N1(m,v):new FormData(m),Jp(c,{pending:!0,data:D,method:m.method,action:g},g,D))},currentTarget:m}]})}}for(var jm=0;jm<gp.length;jm++){var Lm=gp[jm],T_=Lm.toLowerCase(),__=Lm[0].toUpperCase()+Lm.slice(1);Cs(T_,"on"+__)}Cs(ab,"onAnimationEnd"),Cs(ob,"onAnimationIteration"),Cs(cb,"onAnimationStart"),Cs("dblclick","onDoubleClick"),Cs("focusin","onFocus"),Cs("focusout","onBlur"),Cs(GT,"onTransitionRun"),Cs(PT,"onTransitionStart"),Cs(YT,"onTransitionCancel"),Cs(ub,"onTransitionEnd"),Oi("onMouseEnter",["mouseout","mouseover"]),Oi("onMouseLeave",["mouseout","mouseover"]),Oi("onPointerEnter",["pointerout","pointerover"]),Oi("onPointerLeave",["pointerout","pointerover"]),oi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),oi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),oi("onBeforeInput",["compositionend","keypress","textInput","paste"]),oi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),oi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),oi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $c="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(" "),M_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat($c));function D1(s,r){r=(r&4)!==0;for(var c=0;c<s.length;c++){var h=s[c],m=h.event;h=h.listeners;e:{var g=void 0;if(r)for(var v=h.length-1;0<=v;v--){var A=h[v],D=A.instance,G=A.currentTarget;if(A=A.listener,D!==g&&m.isPropagationStopped())break e;g=A,m.currentTarget=G;try{g(m)}catch(K){bf(K)}m.currentTarget=null,g=D}else for(v=0;v<h.length;v++){if(A=h[v],D=A.instance,G=A.currentTarget,A=A.listener,D!==g&&m.isPropagationStopped())break e;g=A,m.currentTarget=G;try{g(m)}catch(K){bf(K)}m.currentTarget=null,g=D}}}}function nt(s,r){var c=r[ms];c===void 0&&(c=r[ms]=new Set);var h=s+"__bubble";c.has(h)||(O1(r,s,2,!1),c.add(h))}function Bm(s,r,c){var h=0;r&&(h|=4),O1(c,s,h,r)}var sh="_reactListening"+Math.random().toString(36).slice(2);function zm(s){if(!s[sh]){s[sh]=!0,Qn.forEach(function(c){c!=="selectionchange"&&(M_.has(c)||Bm(c,!1,s),Bm(c,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[sh]||(r[sh]=!0,Bm("selectionchange",!1,r))}}function O1(s,r,c,h){switch(av(r)){case 2:var m=n2;break;case 8:m=i2;break;default:m=Zm}c=m.bind(null,r,c,s),m=void 0,!uc||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(m=!0),h?m!==void 0?s.addEventListener(r,c,{capture:!0,passive:m}):s.addEventListener(r,c,!0):m!==void 0?s.addEventListener(r,c,{passive:m}):s.addEventListener(r,c,!1)}function Hm(s,r,c,h,m){var g=h;if((r&1)===0&&(r&2)===0&&h!==null)e:for(;;){if(h===null)return;var v=h.tag;if(v===3||v===4){var A=h.stateNode.containerInfo;if(A===m)break;if(v===4)for(v=h.return;v!==null;){var D=v.tag;if((D===3||D===4)&&v.stateNode.containerInfo===m)return;v=v.return}for(;A!==null;){if(v=Di(A),v===null)return;if(D=v.tag,D===5||D===6||D===26||D===27){h=g=v;continue e}A=A.parentNode}}h=h.return}lf(function(){var G=g,K=pe(c),te=[];e:{var P=fb.get(s);if(P!==void 0){var W=Ua,Ce=s;switch(s){case"keypress":if($r(c)===0)break e;case"keydown":case"keyup":W=hf;break;case"focusin":Ce="focus",W=hc;break;case"focusout":Ce="blur",W=hc;break;case"beforeblur":case"afterblur":W=hc;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=cf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=uf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=pf;break;case ab:case ob:case cb:W=ip;break;case ub:W=mf;break;case"scroll":case"scrollend":W=of;break;case"wheel":W=gf;break;case"copy":case"cut":case"paste":W=pc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=Xr;break;case"toggle":case"beforetoggle":W=Qr}var He=(r&4)!==0,_t=!He&&(s==="scroll"||s==="scrollend"),z=He?P!==null?P+"Capture":null:P;He=[];for(var R=G,V;R!==null;){var Q=R;if(V=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||V===null||z===null||(Q=Ss(R,z),Q!=null&&He.push(Kc(R,Q,V))),_t)break;R=R.return}0<He.length&&(P=new W(P,Ce,null,c,K),te.push({event:P,listeners:He}))}}if((r&7)===0){e:{if(P=s==="mouseover"||s==="pointerover",W=s==="mouseout"||s==="pointerout",P&&c!==re&&(Ce=c.relatedTarget||c.fromElement)&&(Di(Ce)||Ce[en]))break e;if((W||P)&&(P=K.window===K?K:(P=K.ownerDocument)?P.defaultView||P.parentWindow:window,W?(Ce=c.relatedTarget||c.toElement,W=G,Ce=Ce?Di(Ce):null,Ce!==null&&(_t=a(Ce),He=Ce.tag,Ce!==_t||He!==5&&He!==27&&He!==6)&&(Ce=null)):(W=null,Ce=G),W!==Ce)){if(He=cf,Q="onMouseLeave",z="onMouseEnter",R="mouse",(s==="pointerout"||s==="pointerover")&&(He=Xr,Q="onPointerLeave",z="onPointerEnter",R="pointer"),_t=W==null?P:Xi(W),V=Ce==null?P:Xi(Ce),P=new He(Q,R+"leave",W,c,K),P.target=_t,P.relatedTarget=V,Q=null,Di(K)===G&&(He=new He(z,R+"enter",Ce,c,K),He.target=V,He.relatedTarget=_t,Q=He),_t=Q,W&&Ce)t:{for(He=E_,z=W,R=Ce,V=0,Q=z;Q;Q=He(Q))V++;Q=0;for(var Re=R;Re;Re=He(Re))Q++;for(;0<V-Q;)z=He(z),V--;for(;0<Q-V;)R=He(R),Q--;for(;V--;){if(z===R||R!==null&&z===R.alternate){He=z;break t}z=He(z),R=He(R)}He=null}else He=null;W!==null&&R1(te,P,W,He,!1),Ce!==null&&_t!==null&&R1(te,_t,Ce,He,!0)}}e:{if(P=G?Xi(G):window,W=P.nodeName&&P.nodeName.toLowerCase(),W==="select"||W==="input"&&P.type==="file")var mt=ci;else if(Qe(P))if(Zr)mt=UT;else{mt=HT;var De=zT}else W=P.nodeName,!W||W.toLowerCase()!=="input"||P.type!=="checkbox"&&P.type!=="radio"?G&&je(G.elementType)&&(mt=ci):mt=IT;if(mt&&(mt=mt(s,G))){_n(te,mt,c,K);break e}De&&De(s,P,G),s==="focusout"&&G&&P.type==="number"&&G.memoizedProps.value!=null&&Tn(P,"number",P.value)}switch(De=G?Xi(G):window,s){case"focusin":(Qe(De)||De.contentEditable==="true")&&(Ya=De,dp=G,Ac=null);break;case"focusout":Ac=dp=Ya=null;break;case"mousedown":pp=!0;break;case"contextmenu":case"mouseup":case"dragend":pp=!1,lb(te,c,K);break;case"selectionchange":if(qT)break;case"keydown":case"keyup":lb(te,c,K)}var Ke;if(bc)e:{switch(s){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else Sl?Sc(s,c)&&(rt="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(rt="onCompositionStart");rt&&(nr&&c.locale!=="ko"&&(Sl||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&Sl&&(Ke=rf()):(Ys=K,Ia="value"in Ys?Ys.value:Ys.textContent,Sl=!0)),De=lh(G,rt),0<De.length&&(rt=new ff(rt,s,null,c,K),te.push({event:rt,listeners:De}),Ke?rt.data=Ke:(Ke=Pa(c),Ke!==null&&(rt.data=Ke)))),(Ke=up?k(s,c):ne(s,c))&&(rt=lh(G,"onBeforeInput"),0<rt.length&&(De=new ff("onBeforeInput","beforeinput",null,c,K),te.push({event:De,listeners:rt}),De.data=Ke)),C_(te,s,G,c,K)}D1(te,r)})}function Kc(s,r,c){return{instance:s,listener:r,currentTarget:c}}function lh(s,r){for(var c=r+"Capture",h=[];s!==null;){var m=s,g=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||g===null||(m=Ss(s,c),m!=null&&h.unshift(Kc(s,m,g)),m=Ss(s,r),m!=null&&h.push(Kc(s,m,g))),s.tag===3)return h;s=s.return}return[]}function E_(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function R1(s,r,c,h,m){for(var g=r._reactName,v=[];c!==null&&c!==h;){var A=c,D=A.alternate,G=A.stateNode;if(A=A.tag,D!==null&&D===h)break;A!==5&&A!==26&&A!==27||G===null||(D=G,m?(G=Ss(c,g),G!=null&&v.unshift(Kc(c,G,D))):m||(G=Ss(c,g),G!=null&&v.push(Kc(c,G,D)))),c=c.return}v.length!==0&&s.push({event:r,listeners:v})}var N_=/\r\n?/g,D_=/\u0000|\uFFFD/g;function j1(s){return(typeof s=="string"?s:""+s).replace(N_,`
50
- `).replace(D_,"")}function L1(s,r){return r=j1(r),j1(s)===r}function Tt(s,r,c,h,m,g){switch(c){case"children":typeof h=="string"?r==="body"||r==="textarea"&&h===""||U(s,h):(typeof h=="number"||typeof h=="bigint")&&r!=="body"&&U(s,""+h);break;case"className":gi(s,"class",h);break;case"tabIndex":gi(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":gi(s,c,h);break;case"style":Oe(s,h,g);break;case"data":if(r!=="object"){gi(s,"data",h);break}case"src":case"href":if(h===""&&(r!=="a"||c!=="href")){s.removeAttribute(c);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=gn(""+h),s.setAttribute(c,h);break;case"action":case"formAction":if(typeof h=="function"){s.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(c==="formAction"?(r!=="input"&&Tt(s,r,"name",m.name,m,null),Tt(s,r,"formEncType",m.formEncType,m,null),Tt(s,r,"formMethod",m.formMethod,m,null),Tt(s,r,"formTarget",m.formTarget,m,null)):(Tt(s,r,"encType",m.encType,m,null),Tt(s,r,"method",m.method,m,null),Tt(s,r,"target",m.target,m,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=gn(""+h),s.setAttribute(c,h);break;case"onClick":h!=null&&(s.onclick=zt);break;case"onScroll":h!=null&&nt("scroll",s);break;case"onScrollEnd":h!=null&&nt("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"multiple":s.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":s.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){s.removeAttribute("xlink:href");break}c=gn(""+h),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""+h):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":h===!0?s.setAttribute(c,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,h):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?s.setAttribute(c,h):s.removeAttribute(c);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?s.removeAttribute(c):s.setAttribute(c,h);break;case"popover":nt("beforetoggle",s),nt("toggle",s),Ri(s,"popover",h);break;case"xlinkActuate":rn(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":rn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":rn(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":rn(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":rn(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":rn(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":rn(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":rn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":rn(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Ri(s,"is",h);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=xt.get(c)||c,Ri(s,c,h))}}function Im(s,r,c,h,m,g){switch(c){case"style":Oe(s,h,g);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"children":typeof h=="string"?U(s,h):(typeof h=="number"||typeof h=="bigint")&&U(s,""+h);break;case"onScroll":h!=null&&nt("scroll",s);break;case"onScrollEnd":h!=null&&nt("scrollend",s);break;case"onClick":h!=null&&(s.onclick=zt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ha.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),r=c.slice(2,m?c.length-7:void 0),g=s[Xe]||null,g=g!=null?g[c]:null,typeof g=="function"&&s.removeEventListener(r,g,m),typeof h=="function")){typeof g!="function"&&g!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(r,h,m);break e}c in s?s[c]=h:h===!0?s.setAttribute(c,""):Ri(s,c,h)}}}function In(s,r,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nt("error",s),nt("load",s);var h=!1,m=!1,g;for(g in c)if(c.hasOwnProperty(g)){var v=c[g];if(v!=null)switch(g){case"src":h=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Tt(s,r,g,v,c,null)}}m&&Tt(s,r,"srcSet",c.srcSet,c,null),h&&Tt(s,r,"src",c.src,c,null);return;case"input":nt("invalid",s);var A=g=v=m=null,D=null,G=null;for(h in c)if(c.hasOwnProperty(h)){var K=c[h];if(K!=null)switch(h){case"name":m=K;break;case"type":v=K;break;case"checked":D=K;break;case"defaultChecked":G=K;break;case"value":g=K;break;case"defaultValue":A=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(i(137,r));break;default:Tt(s,r,h,K,c,null)}}Zl(s,g,A,D,G,v,m,!1);return;case"select":nt("invalid",s),h=v=g=null;for(m in c)if(c.hasOwnProperty(m)&&(A=c[m],A!=null))switch(m){case"value":g=A;break;case"defaultValue":v=A;break;case"multiple":h=A;default:Tt(s,r,m,A,c,null)}r=g,c=v,s.multiple=!!h,r!=null?Li(s,!!h,r,!1):c!=null&&Li(s,!!h,c,!0);return;case"textarea":nt("invalid",s),g=m=h=null;for(v in c)if(c.hasOwnProperty(v)&&(A=c[v],A!=null))switch(v){case"value":h=A;break;case"defaultValue":m=A;break;case"children":g=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(i(91));break;default:Tt(s,r,v,A,c,null)}_(s,h,m,g);return;case"option":for(D in c)if(c.hasOwnProperty(D)&&(h=c[D],h!=null))switch(D){case"selected":s.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:Tt(s,r,D,h,c,null)}return;case"dialog":nt("beforetoggle",s),nt("toggle",s),nt("cancel",s),nt("close",s);break;case"iframe":case"object":nt("load",s);break;case"video":case"audio":for(h=0;h<$c.length;h++)nt($c[h],s);break;case"image":nt("error",s),nt("load",s);break;case"details":nt("toggle",s);break;case"embed":case"source":case"link":nt("error",s),nt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in c)if(c.hasOwnProperty(G)&&(h=c[G],h!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Tt(s,r,G,h,c,null)}return;default:if(je(r)){for(K in c)c.hasOwnProperty(K)&&(h=c[K],h!==void 0&&Im(s,r,K,h,c,void 0));return}}for(A in c)c.hasOwnProperty(A)&&(h=c[A],h!=null&&Tt(s,r,A,h,c,null))}function O_(s,r,c,h){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,g=null,v=null,A=null,D=null,G=null,K=null;for(W in c){var te=c[W];if(c.hasOwnProperty(W)&&te!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":D=te;default:h.hasOwnProperty(W)||Tt(s,r,W,null,h,te)}}for(var P in h){var W=h[P];if(te=c[P],h.hasOwnProperty(P)&&(W!=null||te!=null))switch(P){case"type":g=W;break;case"name":m=W;break;case"checked":G=W;break;case"defaultChecked":K=W;break;case"value":v=W;break;case"defaultValue":A=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(i(137,r));break;default:W!==te&&Tt(s,r,P,W,h,te)}}Cn(s,v,A,D,G,K,g,m);return;case"select":W=v=A=P=null;for(g in c)if(D=c[g],c.hasOwnProperty(g)&&D!=null)switch(g){case"value":break;case"multiple":W=D;default:h.hasOwnProperty(g)||Tt(s,r,g,null,h,D)}for(m in h)if(g=h[m],D=c[m],h.hasOwnProperty(m)&&(g!=null||D!=null))switch(m){case"value":P=g;break;case"defaultValue":A=g;break;case"multiple":v=g;default:g!==D&&Tt(s,r,m,g,h,D)}r=A,c=v,h=W,P!=null?Li(s,!!c,P,!1):!!h!=!!c&&(r!=null?Li(s,!!c,r,!0):Li(s,!!c,c?[]:"",!1));return;case"textarea":W=P=null;for(A in c)if(m=c[A],c.hasOwnProperty(A)&&m!=null&&!h.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Tt(s,r,A,null,h,m)}for(v in h)if(m=h[v],g=c[v],h.hasOwnProperty(v)&&(m!=null||g!=null))switch(v){case"value":P=m;break;case"defaultValue":W=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==g&&Tt(s,r,v,m,h,g)}ae(s,P,W);return;case"option":for(var Ce in c)if(P=c[Ce],c.hasOwnProperty(Ce)&&P!=null&&!h.hasOwnProperty(Ce))switch(Ce){case"selected":s.selected=!1;break;default:Tt(s,r,Ce,null,h,P)}for(D in h)if(P=h[D],W=c[D],h.hasOwnProperty(D)&&P!==W&&(P!=null||W!=null))switch(D){case"selected":s.selected=P&&typeof P!="function"&&typeof P!="symbol";break;default:Tt(s,r,D,P,h,W)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var He in c)P=c[He],c.hasOwnProperty(He)&&P!=null&&!h.hasOwnProperty(He)&&Tt(s,r,He,null,h,P);for(G in h)if(P=h[G],W=c[G],h.hasOwnProperty(G)&&P!==W&&(P!=null||W!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(137,r));break;default:Tt(s,r,G,P,h,W)}return;default:if(je(r)){for(var _t in c)P=c[_t],c.hasOwnProperty(_t)&&P!==void 0&&!h.hasOwnProperty(_t)&&Im(s,r,_t,void 0,h,P);for(K in h)P=h[K],W=c[K],!h.hasOwnProperty(K)||P===W||P===void 0&&W===void 0||Im(s,r,K,P,h,W);return}}for(var z in c)P=c[z],c.hasOwnProperty(z)&&P!=null&&!h.hasOwnProperty(z)&&Tt(s,r,z,null,h,P);for(te in h)P=h[te],W=c[te],!h.hasOwnProperty(te)||P===W||P==null&&W==null||Tt(s,r,te,P,h,W)}function B1(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function R_(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,c=performance.getEntriesByType("resource"),h=0;h<c.length;h++){var m=c[h],g=m.transferSize,v=m.initiatorType,A=m.duration;if(g&&A&&B1(v)){for(v=0,A=m.responseEnd,h+=1;h<c.length;h++){var D=c[h],G=D.startTime;if(G>A)break;var K=D.transferSize,te=D.initiatorType;K&&B1(te)&&(D=D.responseEnd,v+=K*(D<A?1:(A-G)/(D-G)))}if(--h,r+=8*(g+v)/(m.duration/1e3),s++,10<s)break}}if(0<s)return r/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Um=null,Vm=null;function rh(s){return s.nodeType===9?s:s.ownerDocument}function z1(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function H1(s,r){if(s===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&r==="foreignObject"?0:s}function qm(s,r){return s==="textarea"||s==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Gm=null;function j_(){var s=window.event;return s&&s.type==="popstate"?s===Gm?!1:(Gm=s,!0):(Gm=null,!1)}var I1=typeof setTimeout=="function"?setTimeout:void 0,L_=typeof clearTimeout=="function"?clearTimeout:void 0,U1=typeof Promise=="function"?Promise:void 0,B_=typeof queueMicrotask=="function"?queueMicrotask:typeof U1<"u"?function(s){return U1.resolve(null).then(s).catch(z_)}:I1;function z_(s){setTimeout(function(){throw s})}function xr(s){return s==="head"}function V1(s,r){var c=r,h=0;do{var m=c.nextSibling;if(s.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(h===0){s.removeChild(m),xo(r);return}h--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")h++;else if(c==="html")Xc(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Xc(c);for(var g=c.firstChild;g;){var v=g.nextSibling,A=g.nodeName;g[Gs]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&g.rel.toLowerCase()==="stylesheet"||c.removeChild(g),g=v}}else c==="body"&&Xc(s.ownerDocument.body);c=m}while(c);xo(r)}function q1(s,r){var c=s;s=0;do{var h=c.nextSibling;if(c.nodeType===1?r?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(r?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),h&&h.nodeType===8)if(c=h.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=h}while(c)}function Pm(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var c=r;switch(r=r.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Pm(c),yl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function H_(s,r,c,h){for(;s.nodeType===1;){var m=c;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!h&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(h){if(!s[Gs])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(g=s.getAttribute("rel"),g==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(g!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(g=s.getAttribute("src"),(g!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&g&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var g=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===g)return s}else return s;if(s=ss(s.nextSibling),s===null)break}return null}function I_(s,r,c){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=ss(s.nextSibling),s===null))return null;return s}function G1(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=ss(s.nextSibling),s===null))return null;return s}function Ym(s){return s.data==="$?"||s.data==="$~"}function Fm(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function U_(s,r){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||c.readyState!=="loading")r();else{var h=function(){r(),c.removeEventListener("DOMContentLoaded",h)};c.addEventListener("DOMContentLoaded",h),s._reactRetry=h}}function ss(s){for(;s!=null;s=s.nextSibling){var r=s.nodeType;if(r===1||r===3)break;if(r===8){if(r=s.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return s}var Wm=null;function P1(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(r===0)return ss(s.nextSibling);r--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||r++}s=s.nextSibling}return null}function Y1(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(r===0)return s;r--}else c!=="/$"&&c!=="/&"||r++}s=s.previousSibling}return null}function F1(s,r,c){switch(r=rh(c),s){case"html":if(s=r.documentElement,!s)throw Error(i(452));return s;case"head":if(s=r.head,!s)throw Error(i(453));return s;case"body":if(s=r.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Xc(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);yl(s)}var ls=new Map,W1=new Set;function ah(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Bl=Z.d;Z.d={f:V_,r:q_,D:G_,C:P_,L:Y_,m:F_,X:$_,S:W_,M:K_};function V_(){var s=Bl.f(),r=Zf();return s||r}function q_(s){var r=ys(s);r!==null&&r.tag===5&&r.type==="form"?ux(r):Bl.r(s)}var go=typeof document>"u"?null:document;function $1(s,r,c){var h=go;if(h&&typeof r=="string"&&r){var m=Dt(r);m='link[rel="'+s+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),W1.has(m)||(W1.add(m),s={rel:s,crossOrigin:c,href:r},h.querySelector(m)===null&&(r=h.createElement("link"),In(r,"link",s),wt(r),h.head.appendChild(r)))}}function G_(s){Bl.D(s),$1("dns-prefetch",s,null)}function P_(s,r){Bl.C(s,r),$1("preconnect",s,r)}function Y_(s,r,c){Bl.L(s,r,c);var h=go;if(h&&s&&r){var m='link[rel="preload"][as="'+Dt(r)+'"]';r==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+Dt(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+Dt(c.imageSizes)+'"]')):m+='[href="'+Dt(s)+'"]';var g=m;switch(r){case"style":g=yo(s);break;case"script":g=bo(s)}ls.has(g)||(s=b({rel:"preload",href:r==="image"&&c&&c.imageSrcSet?void 0:s,as:r},c),ls.set(g,s),h.querySelector(m)!==null||r==="style"&&h.querySelector(Qc(g))||r==="script"&&h.querySelector(Zc(g))||(r=h.createElement("link"),In(r,"link",s),wt(r),h.head.appendChild(r)))}}function F_(s,r){Bl.m(s,r);var c=go;if(c&&s){var h=r&&typeof r.as=="string"?r.as:"script",m='link[rel="modulepreload"][as="'+Dt(h)+'"][href="'+Dt(s)+'"]',g=m;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=bo(s)}if(!ls.has(g)&&(s=b({rel:"modulepreload",href:s},r),ls.set(g,s),c.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Zc(g)))return}h=c.createElement("link"),In(h,"link",s),wt(h),c.head.appendChild(h)}}}function W_(s,r,c){Bl.S(s,r,c);var h=go;if(h&&s){var m=An(h).hoistableStyles,g=yo(s);r=r||"default";var v=m.get(g);if(!v){var A={loading:0,preload:null};if(v=h.querySelector(Qc(g)))A.loading=5;else{s=b({rel:"stylesheet",href:s,"data-precedence":r},c),(c=ls.get(g))&&$m(s,c);var D=v=h.createElement("link");wt(D),In(D,"link",s),D._p=new Promise(function(G,K){D.onload=G,D.onerror=K}),D.addEventListener("load",function(){A.loading|=1}),D.addEventListener("error",function(){A.loading|=2}),A.loading|=4,oh(v,r,h)}v={type:"stylesheet",instance:v,count:1,state:A},m.set(g,v)}}}function $_(s,r){Bl.X(s,r);var c=go;if(c&&s){var h=An(c).hoistableScripts,m=bo(s),g=h.get(m);g||(g=c.querySelector(Zc(m)),g||(s=b({src:s,async:!0},r),(r=ls.get(m))&&Km(s,r),g=c.createElement("script"),wt(g),In(g,"link",s),c.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},h.set(m,g))}}function K_(s,r){Bl.M(s,r);var c=go;if(c&&s){var h=An(c).hoistableScripts,m=bo(s),g=h.get(m);g||(g=c.querySelector(Zc(m)),g||(s=b({src:s,async:!0,type:"module"},r),(r=ls.get(m))&&Km(s,r),g=c.createElement("script"),wt(g),In(g,"link",s),c.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},h.set(m,g))}}function K1(s,r,c,h){var m=(m=Se.current)?ah(m):null;if(!m)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(r=yo(c.href),c=An(m).hoistableStyles,h=c.get(r),h||(h={type:"style",instance:null,count:0,state:null},c.set(r,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=yo(c.href);var g=An(m).hoistableStyles,v=g.get(s);if(v||(m=m.ownerDocument||m,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(s,v),(g=m.querySelector(Qc(s)))&&!g._p&&(v.instance=g,v.state.loading=5),ls.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},ls.set(s,c),g||X_(m,s,c,v.state))),r&&h===null)throw Error(i(528,""));return v}if(r&&h!==null)throw Error(i(529,""));return null;case"script":return r=c.async,c=c.src,typeof c=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=bo(c),c=An(m).hoistableScripts,h=c.get(r),h||(h={type:"script",instance:null,count:0,state:null},c.set(r,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function yo(s){return'href="'+Dt(s)+'"'}function Qc(s){return'link[rel="stylesheet"]['+s+"]"}function X1(s){return b({},s,{"data-precedence":s.precedence,precedence:null})}function X_(s,r,c,h){s.querySelector('link[rel="preload"][as="style"]['+r+"]")?h.loading=1:(r=s.createElement("link"),h.preload=r,r.addEventListener("load",function(){return h.loading|=1}),r.addEventListener("error",function(){return h.loading|=2}),In(r,"link",c),wt(r),s.head.appendChild(r))}function bo(s){return'[src="'+Dt(s)+'"]'}function Zc(s){return"script[async]"+s}function Q1(s,r,c){if(r.count++,r.instance===null)switch(r.type){case"style":var h=s.querySelector('style[data-href~="'+Dt(c.href)+'"]');if(h)return r.instance=h,wt(h),h;var m=b({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),wt(h),In(h,"style",m),oh(h,c.precedence,s),r.instance=h;case"stylesheet":m=yo(c.href);var g=s.querySelector(Qc(m));if(g)return r.state.loading|=4,r.instance=g,wt(g),g;h=X1(c),(m=ls.get(m))&&$m(h,m),g=(s.ownerDocument||s).createElement("link"),wt(g);var v=g;return v._p=new Promise(function(A,D){v.onload=A,v.onerror=D}),In(g,"link",h),r.state.loading|=4,oh(g,c.precedence,s),r.instance=g;case"script":return g=bo(c.src),(m=s.querySelector(Zc(g)))?(r.instance=m,wt(m),m):(h=c,(m=ls.get(g))&&(h=b({},c),Km(h,m)),s=s.ownerDocument||s,m=s.createElement("script"),wt(m),In(m,"link",h),s.head.appendChild(m),r.instance=m);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(h=r.instance,r.state.loading|=4,oh(h,c.precedence,s));return r.instance}function oh(s,r,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=h.length?h[h.length-1]:null,g=m,v=0;v<h.length;v++){var A=h[v];if(A.dataset.precedence===r)g=A;else if(g!==m)break}g?g.parentNode.insertBefore(s,g.nextSibling):(r=c.nodeType===9?c.head:c,r.insertBefore(s,r.firstChild))}function $m(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function Km(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var ch=null;function Z1(s,r,c){if(ch===null){var h=new Map,m=ch=new Map;m.set(c,h)}else m=ch,h=m.get(c),h||(h=new Map,m.set(c,h));if(h.has(s))return h;for(h.set(s,null),c=c.getElementsByTagName(s),m=0;m<c.length;m++){var g=c[m];if(!(g[Gs]||g[Nt]||s==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var v=g.getAttribute(r)||"";v=s+v;var A=h.get(v);A?A.push(g):h.set(v,[g])}}return h}function J1(s,r,c){s=s.ownerDocument||s,s.head.insertBefore(c,r==="title"?s.querySelector("head > title"):null)}function Q_(s,r,c){if(c===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return s=r.disabled,typeof r.precedence=="string"&&s==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function ev(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Z_(s,r,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=yo(h.href),g=r.querySelector(Qc(m));if(g){r=g._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=uh.bind(s),r.then(s,s)),c.state.loading|=4,c.instance=g,wt(g);return}g=r.ownerDocument||r,h=X1(h),(m=ls.get(m))&&$m(h,m),g=g.createElement("link"),wt(g);var v=g;v._p=new Promise(function(A,D){v.onload=A,v.onerror=D}),In(g,"link",h),c.instance=g}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,r),(r=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=uh.bind(s),r.addEventListener("load",c),r.addEventListener("error",c))}}var Xm=0;function J_(s,r){return s.stylesheets&&s.count===0&&hh(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var h=setTimeout(function(){if(s.stylesheets&&hh(s,s.stylesheets),s.unsuspend){var g=s.unsuspend;s.unsuspend=null,g()}},6e4+r);0<s.imgBytes&&Xm===0&&(Xm=62500*R_());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&hh(s,s.stylesheets),s.unsuspend)){var g=s.unsuspend;s.unsuspend=null,g()}},(s.imgBytes>Xm?50:800)+r);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function uh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)hh(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var fh=null;function hh(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,fh=new Map,r.forEach(e2,s),fh=null,uh.call(s))}function e2(s,r){if(!(r.state.loading&4)){var c=fh.get(s);if(c)var h=c.get(null);else{c=new Map,fh.set(s,c);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<m.length;g++){var v=m[g];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(c.set(v.dataset.precedence,v),h=v)}h&&c.set(null,h)}m=r.instance,v=m.getAttribute("data-precedence"),g=c.get(v)||h,g===h&&c.set(null,m),c.set(v,m),this.count++,h=uh.bind(this),m.addEventListener("load",h),m.addEventListener("error",h),g?g.parentNode.insertBefore(m,g.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),r.state.loading|=4}}var Jc={$$typeof:B,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function t2(s,r,c,h,m,g,v,A,D){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ri(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ri(0),this.hiddenUpdates=ri(null),this.identifierPrefix=h,this.onUncaughtError=m,this.onCaughtError=g,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function tv(s,r,c,h,m,g,v,A,D,G,K,te){return s=new t2(s,r,c,v,D,G,K,te,A),r=1,g===!0&&(r|=24),g=zi(3,null,null,r),s.current=g,g.stateNode=s,r=Ep(),r.refCount++,s.pooledCache=r,r.refCount++,g.memoizedState={element:h,isDehydrated:c,cache:r},Rp(g),s}function nv(s){return s?(s=$a,s):$a}function iv(s,r,c,h,m,g){m=nv(m),h.context===null?h.context=m:h.pendingContext=m,h=or(r),h.payload={element:c},g=g===void 0?null:g,g!==null&&(h.callback=g),c=cr(s,h,r),c!==null&&(wi(c,s,r),Dc(c,s,r))}function sv(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<r?c:r}}function Qm(s,r){sv(s,r),(s=s.alternate)&&sv(s,r)}function lv(s){if(s.tag===13||s.tag===31){var r=ta(s,67108864);r!==null&&wi(r,s,67108864),Qm(s,67108864)}}function rv(s){if(s.tag===13||s.tag===31){var r=qi();r=ps(r);var c=ta(s,r);c!==null&&wi(c,s,r),Qm(s,r)}}var dh=!0;function n2(s,r,c,h){var m=I.T;I.T=null;var g=Z.p;try{Z.p=2,Zm(s,r,c,h)}finally{Z.p=g,I.T=m}}function i2(s,r,c,h){var m=I.T;I.T=null;var g=Z.p;try{Z.p=8,Zm(s,r,c,h)}finally{Z.p=g,I.T=m}}function Zm(s,r,c,h){if(dh){var m=Jm(h);if(m===null)Hm(s,r,h,ph,c),ov(s,h);else if(l2(m,s,r,c,h))h.stopPropagation();else if(ov(s,h),r&4&&-1<s2.indexOf(s)){for(;m!==null;){var g=ys(m);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var v=Xn(g.pendingLanes);if(v!==0){var A=g;for(A.pendingLanes|=2,A.entangledLanes|=2;v;){var D=1<<31-mn(v);A.entanglements[1]|=D,v&=~D}Ks(g),(yt&6)===0&&(Xf=Fe()+500,Wc(0))}}break;case 31:case 13:A=ta(g,2),A!==null&&wi(A,g,2),Zf(),Qm(g,2)}if(g=Jm(h),g===null&&Hm(s,r,h,ph,c),g===m)break;m=g}m!==null&&h.stopPropagation()}else Hm(s,r,h,null,c)}}function Jm(s){return s=pe(s),eg(s)}var ph=null;function eg(s){if(ph=null,s=Di(s),s!==null){var r=a(s);if(r===null)s=null;else{var c=r.tag;if(c===13){if(s=o(r),s!==null)return s;s=null}else if(c===31){if(s=u(r),s!==null)return s;s=null}else if(c===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return ph=s,null}function av(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch($()){case fe:return 2;case ze:return 8;case Je:case vn:return 32;case $n:return 268435456;default:return 32}default:return 32}}var tg=!1,vr=null,Sr=null,wr=null,eu=new Map,tu=new Map,kr=[],s2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ov(s,r){switch(s){case"focusin":case"focusout":vr=null;break;case"dragenter":case"dragleave":Sr=null;break;case"mouseover":case"mouseout":wr=null;break;case"pointerover":case"pointerout":eu.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":tu.delete(r.pointerId)}}function nu(s,r,c,h,m,g){return s===null||s.nativeEvent!==g?(s={blockedOn:r,domEventName:c,eventSystemFlags:h,nativeEvent:g,targetContainers:[m]},r!==null&&(r=ys(r),r!==null&&lv(r)),s):(s.eventSystemFlags|=h,r=s.targetContainers,m!==null&&r.indexOf(m)===-1&&r.push(m),s)}function l2(s,r,c,h,m){switch(r){case"focusin":return vr=nu(vr,s,r,c,h,m),!0;case"dragenter":return Sr=nu(Sr,s,r,c,h,m),!0;case"mouseover":return wr=nu(wr,s,r,c,h,m),!0;case"pointerover":var g=m.pointerId;return eu.set(g,nu(eu.get(g)||null,s,r,c,h,m)),!0;case"gotpointercapture":return g=m.pointerId,tu.set(g,nu(tu.get(g)||null,s,r,c,h,m)),!0}return!1}function cv(s){var r=Di(s.target);if(r!==null){var c=a(r);if(c!==null){if(r=c.tag,r===13){if(r=o(c),r!==null){s.blockedOn=r,kn(s.priority,function(){rv(c)});return}}else if(r===31){if(r=u(c),r!==null){s.blockedOn=r,kn(s.priority,function(){rv(c)});return}}else if(r===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function mh(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var c=Jm(s.nativeEvent);if(c===null){c=s.nativeEvent;var h=new c.constructor(c.type,c);re=h,c.target.dispatchEvent(h),re=null}else return r=ys(c),r!==null&&lv(r),s.blockedOn=c,!1;r.shift()}return!0}function uv(s,r,c){mh(s)&&c.delete(r)}function r2(){tg=!1,vr!==null&&mh(vr)&&(vr=null),Sr!==null&&mh(Sr)&&(Sr=null),wr!==null&&mh(wr)&&(wr=null),eu.forEach(uv),tu.forEach(uv)}function gh(s,r){s.blockedOn===r&&(s.blockedOn=null,tg||(tg=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,r2)))}var yh=null;function fv(s){yh!==s&&(yh=s,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){yh===s&&(yh=null);for(var r=0;r<s.length;r+=3){var c=s[r],h=s[r+1],m=s[r+2];if(typeof h!="function"){if(eg(h||c)===null)continue;break}var g=ys(c);g!==null&&(s.splice(r,3),r-=3,Jp(g,{pending:!0,data:m,method:c.method,action:h},h,m))}}))}function xo(s){function r(D){return gh(D,s)}vr!==null&&gh(vr,s),Sr!==null&&gh(Sr,s),wr!==null&&gh(wr,s),eu.forEach(r),tu.forEach(r);for(var c=0;c<kr.length;c++){var h=kr[c];h.blockedOn===s&&(h.blockedOn=null)}for(;0<kr.length&&(c=kr[0],c.blockedOn===null);)cv(c),c.blockedOn===null&&kr.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(h=0;h<c.length;h+=3){var m=c[h],g=c[h+1],v=m[Xe]||null;if(typeof g=="function")v||fv(c);else if(v){var A=null;if(g&&g.hasAttribute("formAction")){if(m=g,v=g[Xe]||null)A=v.formAction;else if(eg(m)!==null)continue}else A=v.action;typeof A=="function"?c[h+1]=A:(c.splice(h,3),h-=3),fv(c)}}}function hv(){function s(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(v){return m=v})},focusReset:"manual",scroll:"manual"})}function r(){m!==null&&(m(),m=null),h||setTimeout(c,20)}function c(){if(!h&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(c,100),function(){h=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),m!==null&&(m(),m=null)}}}function ng(s){this._internalRoot=s}bh.prototype.render=ng.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(i(409));var c=r.current,h=qi();iv(c,h,s,r,null,null)},bh.prototype.unmount=ng.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;iv(s.current,2,null,s,null,null),Zf(),r[en]=null}};function bh(s){this._internalRoot=s}bh.prototype.unstable_scheduleHydration=function(s){if(s){var r=Vs();s={blockedOn:null,target:s,priority:r};for(var c=0;c<kr.length&&r!==0&&r<kr[c].priority;c++);kr.splice(c,0,s),c===0&&cv(s)}};var dv=e.version;if(dv!=="19.2.8")throw Error(i(527,dv,"19.2.8"));Z.findDOMNode=function(s){var r=s._reactInternals;if(r===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=d(r),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var a2={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xh.isDisabled&&xh.supportsFiber)try{hs=xh.inject(a2),Sn=xh}catch{}}return su.createRoot=function(s,r){if(!l(s))throw Error(i(299));var c=!1,h="",m=vx,g=Sx,v=wx;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(h=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(g=r.onCaughtError),r.onRecoverableError!==void 0&&(v=r.onRecoverableError)),r=tv(s,1,!1,null,null,c,h,null,m,g,v,hv),s[en]=r.current,zm(s),new ng(r)},su.hydrateRoot=function(s,r,c){if(!l(s))throw Error(i(299));var h=!1,m="",g=vx,v=Sx,A=wx,D=null;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(g=c.onUncaughtError),c.onCaughtError!==void 0&&(v=c.onCaughtError),c.onRecoverableError!==void 0&&(A=c.onRecoverableError),c.formState!==void 0&&(D=c.formState)),r=tv(s,1,!0,r,c??null,h,m,D,g,v,A,hv),r.context=nv(null),c=r.current,h=qi(),h=ps(h),m=or(h),m.callback=null,cr(c,m,h),c=h,r.current.lanes=c,mi(r,c),Ks(r),s[en]=r.current,zm(s),new bh(r)},su.version="19.2.8",su}var Av;function x2(){if(Av)return rg.exports;Av=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(),rg.exports=b2(),rg.exports}var v2=x2();const sk=1;var Hl,Vo,qo,Go,Po,Pu,Yo,zd,lk;class S2{constructor(e){$t(this,zd);$t(this,Hl,null);$t(this,Vo,new Set);$t(this,qo,500);$t(this,Go,null);$t(this,Po,!1);$t(this,Pu,null);$t(this,Yo,null);this.url=e}get statusText(){return this.connected?"Хост на связи":"Нет связи с хостом"}onStatus(e){bt(this,Yo,e)}connect(){if(Ue(this,Po))return;const e=new WebSocket(this.url);bt(this,Hl,e),e.addEventListener("open",()=>{var t,i;bt(this,qo,500),this.send({type:"hello",protocol:sk,clientName:"ccv-web"}),(t=Ue(this,Pu))==null||t.call(this),(i=Ue(this,Yo))==null||i.call(this)}),e.addEventListener("message",t=>{let i;try{i=JSON.parse(String(t.data))}catch{return}for(const l of Ue(this,Vo))l(i)}),e.addEventListener("close",()=>{var t;bt(this,Hl,null),(t=Ue(this,Yo))==null||t.call(this),fn(this,zd,lk).call(this)}),e.addEventListener("error",()=>e.close())}onReconnect(e){bt(this,Pu,e)}on(e){return Ue(this,Vo).add(e),()=>Ue(this,Vo).delete(e)}send(e){var t;((t=Ue(this,Hl))==null?void 0:t.readyState)===WebSocket.OPEN&&Ue(this,Hl).send(JSON.stringify(e))}get connected(){var e;return((e=Ue(this,Hl))==null?void 0:e.readyState)===WebSocket.OPEN}close(){var e;bt(this,Po,!0),(e=Ue(this,Hl))==null||e.close()}}Hl=new WeakMap,Vo=new WeakMap,qo=new WeakMap,Go=new WeakMap,Po=new WeakMap,Pu=new WeakMap,Yo=new WeakMap,zd=new WeakSet,lk=function(){if(Ue(this,Po)||Ue(this,Go)!==null)return;const e=Ue(this,qo);bt(this,qo,Math.min(e*2,1e4)),bt(this,Go,window.setTimeout(()=>{bt(this,Go,null),this.connect()},e))};const w2=1,rk="ccv:relay",Kh="ccv:relay.host";function k2(){try{const n=localStorage.getItem(rk);if(!n)return null;const e=JSON.parse(n);return typeof(e==null?void 0:e.token)!="string"||typeof e.expiresAt=="number"&&e.expiresAt<=Date.now()?null:e}catch{return null}}function ak(){localStorage.removeItem(rk)}var il,Fo,sl,Wo,$o,jr,Aa,Ca,Lr,Ta,Ko,_a,Ma,qt,_r,Zg,ok,ya,Jg;class A2{constructor(e){$t(this,qt);$t(this,il,null);$t(this,Fo,new Set);$t(this,sl,null);$t(this,Wo,null);$t(this,$o,500);$t(this,jr,null);$t(this,Aa,!1);$t(this,Ca,!1);$t(this,Lr,!1);$t(this,Ta,null);$t(this,Ko,"Подключаемся…");$t(this,_a,0);$t(this,Ma,[]);this.session=e}get connected(){return Ue(this,Ca)&&Ue(this,Lr)}get statusText(){return Ue(this,Ko)}get hostId(){return Ue(this,Ta)}on(e){return Ue(this,Fo).add(e),()=>Ue(this,Fo).delete(e)}onReconnect(e){bt(this,Wo,e)}onStatus(e){bt(this,sl,e)}connect(){Ue(this,Aa)||fn(this,qt,Zg).call(this)}send(e){if(!Ue(this,Ca)){Ue(this,Ma).length<64&&Ue(this,Ma).push(e);return}fn(this,qt,ya).call(this,{t:"client.frame",body:e})}close(){var e;bt(this,Aa,!0),Ue(this,jr)!==null&&window.clearTimeout(Ue(this,jr)),(e=Ue(this,il))==null||e.close()}}il=new WeakMap,Fo=new WeakMap,sl=new WeakMap,Wo=new WeakMap,$o=new WeakMap,jr=new WeakMap,Aa=new WeakMap,Ca=new WeakMap,Lr=new WeakMap,Ta=new WeakMap,Ko=new WeakMap,_a=new WeakMap,Ma=new WeakMap,qt=new WeakSet,_r=function(e){var t;Ue(this,Ko)!==e&&(bt(this,Ko,e),(t=Ue(this,sl))==null||t.call(this))},Zg=async function(){if(Ue(this,il))return;if(!Ue(this,Ta))try{bt(this,Ta,await C2(this.session.token))}catch(i){fn(this,qt,_r).call(this,i instanceof Error?i.message:String(i)),fn(this,qt,Jg).call(this);return}const e=location.protocol==="https:"?"wss":"ws",t=new WebSocket(`${e}://${location.host}/relay/client`);bt(this,il,t),t.addEventListener("open",()=>{fn(this,qt,ya).call(this,{t:"client.hello",protocol:w2,token:this.session.token})}),t.addEventListener("message",i=>{let l;try{l=JSON.parse(String(i.data))}catch{return}fn(this,qt,ok).call(this,l)}),t.addEventListener("close",()=>{var i;bt(this,il,null),bt(this,Ca,!1),bt(this,Lr,!1),fn(this,qt,_r).call(this,"Нет связи с сервером"),(i=Ue(this,sl))==null||i.call(this),fn(this,qt,Jg).call(this)}),t.addEventListener("error",()=>t.close())},ok=function(e){var t,i,l,a,o,u,f;switch(e.t){case"client.ok":bt(this,$o,500),fn(this,qt,ya).call(this,{t:"client.attach",hostId:Ue(this,Ta)??"",...Ue(this,_a)>0?{sinceRseq:Ue(this,_a)}:{}});return;case"client.attached":bt(this,Ca,!0),bt(this,Lr,e.online),bt(this,_a,e.rseq),fn(this,qt,_r).call(this,e.online?"Хост на связи":"Компьютер не на связи"),fn(this,qt,ya).call(this,{t:"client.frame",body:{type:"hello",protocol:sk,clientName:"ccv-web-relay"}});const d=Ue(this,Ma);bt(this,Ma,[]);for(const p of d)fn(this,qt,ya).call(this,{t:"client.frame",body:p});(t=Ue(this,Wo))==null||t.call(this),(i=Ue(this,sl))==null||i.call(this);return;case"host.frame":{e.rseq>0&&bt(this,_a,e.rseq);const p=e.body;for(const b of Ue(this,Fo))b(p);return}case"host.online":bt(this,Lr,!0),fn(this,qt,_r).call(this,"Хост на связи"),(l=Ue(this,Wo))==null||l.call(this),(a=Ue(this,sl))==null||a.call(this);return;case"host.offline":bt(this,Lr,!1),fn(this,qt,_r).call(this,"Компьютер не на связи"),(o=Ue(this,sl))==null||o.call(this);return;case"ping":fn(this,qt,ya).call(this,{t:"pong",nonce:e.nonce});return;case"error":if(e.code==="auth"){ak(),location.href="/login";return}if(e.code==="not_found"){localStorage.removeItem(Kh),fn(this,qt,_r).call(this,"Этот компьютер отвязан от аккаунта"),bt(this,Aa,!0),(u=Ue(this,il))==null||u.close();return}e.code!=="offline"&&fn(this,qt,_r).call(this,e.message),(f=Ue(this,sl))==null||f.call(this);return}},ya=function(e){var t;((t=Ue(this,il))==null?void 0:t.readyState)===WebSocket.OPEN&&Ue(this,il).send(JSON.stringify(e))},Jg=function(){if(Ue(this,Aa)||Ue(this,jr)!==null)return;const e=Ue(this,$o);bt(this,$o,Math.min(e*2,1e4)),bt(this,jr,window.setTimeout(()=>{bt(this,jr,null),fn(this,qt,Zg).call(this)},e))};async function C2(n){const e=new URLSearchParams(location.search).get("host");if(e)return localStorage.setItem(Kh,e),e;const t=localStorage.getItem(Kh);if(t)return t;const i=await fetch("/api/hosts",{headers:{authorization:`Bearer ${n}`}});if(i.status===401)throw ak(),location.href="/login",new Error("нужен вход");const a=(await i.json()).hosts??[];if(a.length===1&&a[0])return localStorage.setItem(Kh,a[0].id),a[0].id;throw location.href="/hosts",new Error("выберите компьютер")}function ck(){return location.pathname==="/app"||location.pathname.startsWith("/app/")?"relay":"local"}const T2=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`;function _2(){if(ck()==="local")return new S2(T2);const n=k2();return n?new A2(n):(location.replace(`/login?next=${encodeURIComponent(location.pathname+location.search)}`),null)}const Gi={items:[],pending:[],lastSeq:0};function ug(n,e){let t=n;for(const i of e)i.seq<=t.lastSeq||(t={...M2(t,i.event,i.seq),lastSeq:i.seq});return t}function M2(n,e,t){var l,a;const i=n.items;switch(e.kind){case"user.message":return Xs(n,{id:`u${t}`,kind:"user",text:e.text});case"assistant.delta":{const o=i.findIndex(f=>f.id===e.blockId);if(o===-1)return Xs(n,{id:e.blockId,kind:"assistant",text:e.text,streaming:!0});const u=i[o];return lu(n,o,{...u,text:u.text+e.text})}case"assistant.text":{const o=i.findIndex(f=>f.id===e.blockId),u={id:e.blockId,kind:"assistant",text:e.text,streaming:!1};return o===-1?Xs(n,u):lu(n,o,u)}case"thinking.delta":{const o=i.findIndex(f=>f.id===e.blockId);if(o===-1)return Xs(n,{id:e.blockId,kind:"thinking",text:e.text});const u=i[o];return lu(n,o,{...u,text:u.text+e.text})}case"assistant.thinking":{const o=i.findIndex(f=>f.id===e.blockId),u={id:e.blockId,kind:"thinking",text:e.text};return o===-1?Xs(n,u):lu(n,o,u)}case"tool.use":return Xs(n,{id:`t${e.toolUseId}`,kind:"tool",toolUseId:e.toolUseId,name:e.name,input:e.input,result:null,isError:!1,awaitingPermission:!1});case"tool.result":{const o=i.findIndex(f=>f.kind==="tool"&&f.toolUseId===e.toolUseId);if(o===-1)return n;const u=i[o];return lu(n,o,{...u,result:e.content,isError:e.isError,awaitingPermission:!1})}case"permission.request":return{...n,pending:[...n.pending,{requestId:e.requestId,toolName:e.toolName,input:e.input,...e.reason?{reason:e.reason}:{}}]};case"permission.resolved":{const o=n.pending.filter(u=>u.requestId!==e.requestId);return e.decision==="allow"?{...n,pending:o}:Xs({...n,pending:o},{id:`p${t}`,kind:"notice",tone:"info",text:`Отклонено${e.reason?`: ${e.reason}`:""}`})}case"result":{const o=n.items.map(u=>u.kind==="assistant"&&u.streaming?{...u,streaming:!1}:u);return Xs({...n,items:o},{id:`r${t}`,kind:"result",subtype:e.subtype,isError:e.isError,durationMs:e.durationMs,costUsd:e.costUsd,inputTokens:((l=e.usage)==null?void 0:l.inputTokens)??0,outputTokens:((a=e.usage)==null?void 0:a.outputTokens)??0})}case"system":return e.subtype!=="compact_boundary"?n:Xs(n,{id:`s${t}`,kind:"notice",tone:"info",text:"Контекст сжат"});case"error":return Xs(n,{id:`e${t}`,kind:"notice",tone:"error",text:e.message});case"state":return n;default:return n}}function Xs(n,e){return{...n,items:[...n.items,e]}}function lu(n,e,t){const i=n.items.slice();return i[e]=t,{...n,items:i}}const e0="ccv:theme",fg=["system","light","dark"];function E2(){const[n,e]=M.useState(N2);M.useEffect(()=>{const l=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{const o=n==="dark"||n==="system"&&l.matches;document.documentElement.dataset.theme=o?"dark":"light"};return a(),l.addEventListener("change",a),()=>l.removeEventListener("change",a)},[n]);const t=M.useCallback(l=>{try{localStorage.setItem(e0,l)}catch{}e(l)},[]),i=M.useCallback(()=>{e(l=>{const a=fg[(fg.indexOf(l)+1)%fg.length];try{localStorage.setItem(e0,a)}catch{}return a})},[]);return[n,t,i]}function N2(){try{const n=localStorage.getItem(e0);if(n==="light"||n==="dark"||n==="system")return n}catch{}return"system"}const Ea={sidebar:{side:"left",min:200,max:520,width:276,label:"сессий"},files:{side:"left",min:180,max:560,width:260,label:"файлов"},search:{side:"left",min:220,max:640,width:320,label:"поиска"},git:{side:"left",min:220,max:640,width:320,label:"истории"},ask:{side:"right",min:260,max:720,width:380,label:"вопроса"}},D2=320,uk="ccv:panes";function O2(n){return`--${n}-w`}function fk(n,e){const t=Ea[n];return Math.round(Math.min(t.max,Math.max(t.min,e)))}function R2(){const n={};for(const e of Object.keys(Ea))n[e]=Ea[e].width;try{const e=localStorage.getItem(uk);if(e){const t=JSON.parse(e);for(const i of Object.keys(Ea)){const l=t[i];typeof l=="number"&&Number.isFinite(l)&&(n[i]=fk(i,l))}}}catch{}return n}function j2(){const[n,e]=M.useState(R2),t=M.useCallback(o=>{try{localStorage.setItem(uk,JSON.stringify(o))}catch{}},[]),i=M.useCallback((o,u)=>{e(f=>{const d=fk(o,u);if(f[o]===d)return f;const p={...f,[o]:d};return t(p),p})},[t]),l=M.useCallback(o=>{e(u=>{const f={...u,[o]:Ea[o].width};return t(f),f})},[t]),a={};for(const o of Object.keys(Ea))a[O2(o)]=`${n[o]}px`;return{widths:n,style:a,setWidth:i,reset:l}}function L2(n){const[e,t]=M.useState(()=>typeof window>"u"?!1:window.matchMedia(n).matches);return M.useEffect(()=>{const i=window.matchMedia(n),l=()=>t(i.matches);return l(),i.addEventListener("change",l),()=>i.removeEventListener("change",l)},[n]),e}function J0(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var za=J0();function hk(n){za=n}var xa={exec:()=>null};function vo(n){let e=[];return t=>{let i=Math.max(0,Math.min(3,t-1)),l=e[i];return l||(l=n(i),e[i]=l),l}}function ht(n,e=""){let t=typeof n=="string"?n:n.source,i={replace:(l,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(ti.caret,"$1"),t=t.replace(l,o),i},getRegex:()=>new RegExp(t,e)};return i}var B2=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),ti={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:vo(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:vo(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:vo(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:vo(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:vo(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:vo(n=>new RegExp(`^ {0,${n}}>`))},z2=/^(?:[ \t]*(?:\n|$))+/,H2=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,I2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Yu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,U2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ey=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,dk=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,pk=ht(dk).replace(/bull/g,ey).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),V2=ht(dk).replace(/bull/g,ey).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ty=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,q2=/^[^\n]+/,ny=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,G2=ht(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ny).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),P2=ht(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ey).getRegex(),Hd="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",iy=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Y2=ht("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",iy).replace("tag",Hd).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),mk=n=>ht(ty).replace("hr",Yu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hd).getRegex(),F2=mk(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),W2=mk(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),$2=ht(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",W2).getRegex(),sy={blockquote:$2,code:H2,def:G2,fences:I2,heading:U2,hr:Yu,html:Y2,lheading:pk,list:P2,newline:z2,paragraph:F2,table:xa,text:q2},Cv=ht("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hd).getRegex(),K2={...sy,lheading:V2,table:Cv,paragraph:ht(ty).replace("hr",Yu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Cv).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hd).getRegex()},X2={...sy,html:ht(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",iy).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:xa,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ht(ty).replace("hr",Yu).replace("heading",` *#{1,6} *[^
51
- ]`).replace("lheading",pk).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Q2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Z2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,gk=/^( {2,}|\\)\n(?!\s*$)/,J2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,sc=/[\p{P}\p{S}]/u,Id=/[\s\p{P}\p{S}]/u,ly=/[^\s\p{P}\p{S}]/u,eM=ht(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Id).getRegex(),yk=/(?!~)[\p{P}\p{S}]/u,tM=/(?!~)[\s\p{P}\p{S}]/u,nM=/(?:[^\s\p{P}\p{S}]|~)/u,iM=ht(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",B2?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),bk=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,sM=ht(bk,"u").replace(/punct/g,sc).getRegex(),lM=ht(bk,"u").replace(/punct/g,yk).getRegex(),xk="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",rM=ht(xk,"gu").replace(/notPunctSpace/g,ly).replace(/punctSpace/g,Id).replace(/punct/g,sc).getRegex(),aM=ht(xk,"gu").replace(/notPunctSpace/g,nM).replace(/punctSpace/g,tM).replace(/punct/g,yk).getRegex(),oM=ht("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ly).replace(/punctSpace/g,Id).replace(/punct/g,sc).getRegex(),cM=ht(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,sc).getRegex(),uM="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",fM=ht(uM,"gu").replace(/notPunctSpace/g,ly).replace(/punctSpace/g,Id).replace(/punct/g,sc).getRegex(),hM=ht(/\\(punct)/,"gu").replace(/punct/g,sc).getRegex(),dM=ht(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),pM=ht(iy).replace("(?:-->|$)","-->").getRegex(),mM=ht("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",pM).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),sd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,gM=ht(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",sd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),vk=ht(/^!?\[(label)\]\[(ref)\]/).replace("label",sd).replace("ref",ny).getRegex(),Sk=ht(/^!?\[(ref)\](?:\[\])?/).replace("ref",ny).getRegex(),yM=ht("reflink|nolink(?!\\()","g").replace("reflink",vk).replace("nolink",Sk).getRegex(),Tv=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ry={_backpedal:xa,anyPunctuation:hM,autolink:dM,blockSkip:iM,br:gk,code:Z2,del:xa,delLDelim:xa,delRDelim:xa,emStrongLDelim:sM,emStrongRDelimAst:rM,emStrongRDelimUnd:oM,escape:Q2,link:gM,nolink:Sk,punctuation:eM,reflink:vk,reflinkSearch:yM,tag:mM,text:J2,url:xa},bM={...ry,link:ht(/^!?\[(label)\]\((.*?)\)/).replace("label",sd).getRegex(),reflink:ht(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",sd).getRegex()},t0={...ry,emStrongRDelimAst:aM,emStrongLDelim:lM,delLDelim:cM,delRDelim:fM,url:ht(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Tv).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ht(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Tv).getRegex()},xM={...t0,br:ht(gk).replace("{2,}","*").getRegex(),text:ht(t0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},vh={normal:sy,gfm:K2,pedantic:X2},ru={normal:ry,gfm:t0,breaks:xM,pedantic:bM},vM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},_v=n=>vM[n];function el(n,e){if(e){if(ti.escapeTest.test(n))return n.replace(ti.escapeReplace,_v)}else if(ti.escapeTestNoEncode.test(n))return n.replace(ti.escapeReplaceNoEncode,_v);return n}function Mv(n){try{n=encodeURI(n).replace(ti.percentDecode,"%")}catch{return null}return n}function Ev(n,e){var a;let t=n.replace(ti.findPipe,(o,u,f)=>{let d=!1,p=u;for(;--p>=0&&f[p]==="\\";)d=!d;return d?"|":" |"}),i=t.split(ti.splitPipe),l=0;if(i[0].trim()||i.shift(),i.length>0&&!((a=i.at(-1))!=null&&a.trim())&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;l<i.length;l++)i[l]=i[l].trim().replace(ti.slashPipe,"|");return i}function Cr(n,e,t){let i=n.length;if(i===0)return"";let l=0;for(;l<i&&n.charAt(i-l-1)===e;)l++;return n.slice(0,i-l)}function Nv(n){let e=n.split(`
52
- `),t=e.length-1;for(;t>=0&&ti.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
53
- `)}function SM(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<n.length;i++)if(n[i]==="\\")i++;else if(n[i]===e[0])t++;else if(n[i]===e[1]&&(t--,t<0))return i;return t>0?-2:-1}function wM(n,e=0){let t=e,i="";for(let l of n)if(l===" "){let a=4-t%4;i+=" ".repeat(a),t+=a}else i+=l,t++;return i}function Dv(n,e,t,i,l){let a=e.href,o=e.title||null,u=n[1].replace(l.other.outputLinkReplace,"$1");i.state.inLink=!0;let f={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:a,title:o,text:u,tokens:i.inlineTokens(u)};return i.state.inLink=!1,f}function kM(n,e,t){let i=n.match(t.other.indentCodeCompensation);if(i===null)return e;let l=i[1];return e.split(`
54
- `).map(a=>{let o=a.match(t.other.beginningSpace);if(o===null)return a;let[u]=o;return u.length>=l.length?a.slice(l.length):a}).join(`
55
- `)}var ld=class{constructor(n){Mt(this,"options");Mt(this,"rules");Mt(this,"lexer");this.options=n||za}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:Nv(e[0]),i=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:i}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],i=kM(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let i=Cr(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:Cr(e[0],`
56
- `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:Cr(e[0],`
57
- `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=Cr(e[0],`
58
- `).split(`
59
- `),i="",l="",a=[];for(;t.length>0;){let o=!1,u=[],f;for(f=0;f<t.length;f++)if(this.rules.other.blockquoteStart.test(t[f]))u.push(t[f]),o=!0;else if(!o)u.push(t[f]);else break;t=t.slice(f);let d=u.join(`
60
- `),p=d.replace(this.rules.other.blockquoteSetextReplace,`
61
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
62
- ${d}`:d,l=l?`${l}
63
- ${p}`:p;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,a,!0),this.lexer.state.top=b,t.length===0)break;let x=a.at(-1);if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){let S=x,w=S.raw+`
64
- `+t.join(`
65
- `),T=this.blockquote(w);a[a.length-1]=T,i=i.substring(0,i.length-S.raw.length)+T.raw,l=l.substring(0,l.length-S.text.length)+T.text;break}else if((x==null?void 0:x.type)==="list"){let S=x,w=S.raw+`
66
- `+t.join(`
67
- `),T=this.list(w);a[a.length-1]=T,i=i.substring(0,i.length-x.raw.length)+T.raw,l=l.substring(0,l.length-S.raw.length)+T.raw,t=w.substring(a.at(-1).raw.length).split(`
68
- `);continue}}return{type:"blockquote",raw:i,tokens:a,text:l}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),i=t.length>1,l={type:"list",raw:"",ordered:i,start:i?+t.slice(0,-1):"",loose:!1,items:[]};t=i?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=i?t:"[*+-]");let a=this.rules.other.listItemRegex(t),o=!1;for(;n;){let f=!1,d="",p="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let b=wM(e[2].split(`
69
- `,1)[0],e[1].length),x=n.split(`
70
- `,1)[0],S=!b.trim(),w=0;if(this.options.pedantic?(w=2,p=b.trimStart()):S?w=e[1].length+1:(w=b.search(this.rules.other.nonSpaceChar),w=w>4?1:w,p=b.slice(w),w+=e[1].length),S&&this.rules.other.blankLine.test(x)&&(d+=x+`
71
- `,n=n.substring(x.length+1),f=!0),!f){let T=this.rules.other.nextBulletRegex(w),C=this.rules.other.hrRegex(w),E=this.rules.other.fencesBeginRegex(w),O=this.rules.other.headingBeginRegex(w),B=this.rules.other.htmlBeginRegex(w),q=this.rules.other.blockquoteBeginRegex(w);for(;n;){let H=n.split(`
72
- `,1)[0],L;if(x=H,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),L=x):L=x.replace(this.rules.other.tabCharGlobal," "),E.test(x)||O.test(x)||B.test(x)||q.test(x)||T.test(x)||C.test(x))break;if(L.search(this.rules.other.nonSpaceChar)>=w||!x.trim())p+=`
73
- `+L.slice(w);else{if(S||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(b)||O.test(b)||C.test(b))break;p+=`
74
- `+x}S=!x.trim(),d+=H+`
75
- `,n=n.substring(H.length+1),b=L.slice(w)}}l.loose||(o?l.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),l.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),l.raw+=d}let u=l.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let f of l.items){this.lexer.state.top=!1,f.tokens=this.lexer.blockTokens(f.text,[]);let d=f.tokens[0];if(f.task&&((d==null?void 0:d.type)==="text"||(d==null?void 0:d.type)==="paragraph")){f.text=f.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let b=this.lexer.inlineQueue.length-1;b>=0;b--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[b].src)){this.lexer.inlineQueue[b].src=this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(f.raw);if(p){let b={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};f.checked=b.checked,l.loose?f.tokens[0]&&["paragraph","text"].includes(f.tokens[0].type)&&"tokens"in f.tokens[0]&&f.tokens[0].tokens?(f.tokens[0].raw=b.raw+f.tokens[0].raw,f.tokens[0].text=b.raw+f.tokens[0].text,f.tokens[0].tokens.unshift(b)):f.tokens.unshift({type:"paragraph",raw:b.raw,text:b.raw,tokens:[b]}):f.tokens.unshift(b)}}else f.task&&(f.task=!1);if(!l.loose){let p=f.tokens.filter(x=>x.type==="space"),b=p.length>0&&p.some(x=>this.rules.other.anyLine.test(x.raw));l.loose=b}}if(l.loose)for(let f of l.items){f.loose=!0;for(let d of f.tokens)d.type==="text"&&(d.type="paragraph")}return l}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=Nv(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:Cr(e[0],`
76
- `),href:i,title:l}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Ev(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
77
- `):[],a={type:"table",raw:Cr(e[0],`
78
- `),header:[],align:[],rows:[]};if(t.length===i.length){for(let u of i)this.rules.other.tableAlignRight.test(u)?a.align.push("right"):this.rules.other.tableAlignCenter.test(u)?a.align.push("center"):this.rules.other.tableAlignLeft.test(u)?a.align.push("left"):a.align.push(null);for(let u=0;u<t.length;u++)a.header.push({text:t[u],tokens:this.lexer.inline(t[u]),header:!0,align:a.align[u]});for(let u of l)a.rows.push(Ev(u,a.header.length).map((f,d)=>({text:f,tokens:this.lexer.inline(f),header:!1,align:a.align[d]})));return a}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:Cr(e[0],`
79
- `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
80
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let a=Cr(t.slice(0,-1),"\\");if((t.length-a.length)%2===0)return}else{let a=SM(e[2],"()");if(a===-2)return;if(a>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let i=e[2],l="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(i);a&&(i=a[1],l=a[3])}else l=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?i=i.slice(1):i=i.slice(1,-1)),Dv(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let i=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=e[i.toLowerCase()];if(!l){let a=t[0].charAt(0);return{type:"text",raw:a,text:a}}return Dv(t,l,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let i=this.rules.inline.emStrongLDelim.exec(n);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!t||this.rules.inline.punctuation.exec(t))){let l=[...i[0]].length-1,a,o,u=l,f=0,d=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*n.length+l);(i=d.exec(e))!==null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(o=[...a].length,i[3]||i[4]){u+=o;continue}else if((i[5]||i[6])&&l%3&&!((l+o)%3)){f+=o;continue}if(u-=o,u>0)continue;o=Math.min(o,o+u+f);let p=[...i[0]][0].length,b=n.slice(0,l+i.index+p+o);if(Math.min(l,o)%2){let S=b.slice(1,-1);return{type:"em",raw:b,text:S,tokens:this.lexer.inlineTokens(S)}}let x=b.slice(2,-2);return{type:"strong",raw:b,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(t),l=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return i&&l&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let i=this.rules.inline.delLDelim.exec(n);if(i&&(!i[1]||!t||this.rules.inline.punctuation.exec(t))){let l=[...i[0]].length-1,a,o,u=l,f=this.rules.inline.delRDelim;for(f.lastIndex=0,e=e.slice(-1*n.length+l);(i=f.exec(e))!==null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a||(o=[...a].length,o!==l))continue;if(i[3]||i[4]){u+=o;continue}if(u-=o,u>0)continue;o=Math.min(o,o+u);let d=[...i[0]][0].length,p=n.slice(0,l+i.index+d+o),b=p.slice(l,-l);return{type:"del",raw:p,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,i;return e[2]==="@"?(t=e[1],i="mailto:"+t):(t=e[1],i=t),{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let i,l;if(e[2]==="@")i=e[0],l="mailto:"+i;else{let a;do a=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(a!==e[0]);i=e[0],e[1]==="www."?l="http://"+e[0]:l=e[0]}return{type:"link",raw:e[0],text:i,href:l,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Es=class n0{constructor(e){Mt(this,"tokens");Mt(this,"options");Mt(this,"state");Mt(this,"inlineQueue");Mt(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||za,this.options.tokenizer=this.options.tokenizer||new ld,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:ti,block:vh.normal,inline:ru.normal};this.options.pedantic?(t.block=vh.pedantic,t.inline=ru.pedantic):this.options.gfm&&(t.block=vh.gfm,this.options.breaks?t.inline=ru.breaks:t.inline=ru.gfm),this.tokenizer.rules=t}static get rules(){return{block:vh,inline:ru}}static lex(e,t){return new n0(t).lex(e)}static lexInline(e,t){return new n0(t).inlineTokens(e)}lex(e){e=e.replace(ti.carriageReturn,`
81
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let i=this.inlineQueue[t];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],i=!1){var a,o,u;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(ti.tabCharGlobal," ").replace(ti.spaceLine,""));let l=1/0;for(;e;){if(e.length<l)l=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let f;if((o=(a=this.options.extensions)==null?void 0:a.block)!=null&&o.some(p=>(f=p.call({lexer:this},e,t))?(e=e.substring(f.raw.length),t.push(f),!0):!1))continue;if(f=this.tokenizer.space(e)){e=e.substring(f.raw.length);let p=t.at(-1);f.raw.length===1&&p!==void 0?p.raw+=`
82
- `:t.push(f);continue}if(f=this.tokenizer.code(e)){e=e.substring(f.raw.length);let p=t.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
83
- `)?"":`
84
- `)+f.raw,p.text+=`
85
- `+f.text,this.inlineQueue.at(-1).src=p.text):t.push(f);continue}if(f=this.tokenizer.fences(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.heading(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.hr(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.blockquote(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.list(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.html(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.def(e)){e=e.substring(f.raw.length);let p=t.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
86
- `)?"":`
87
- `)+f.raw,p.text+=`
88
- `+f.raw,this.inlineQueue.at(-1).src=p.text):this.tokens.links[f.tag]||(this.tokens.links[f.tag]={href:f.href,title:f.title},t.push(f));continue}if(f=this.tokenizer.table(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.lheading(e)){e=e.substring(f.raw.length),t.push(f);continue}let d=e;if((u=this.options.extensions)!=null&&u.startBlock){let p=1/0,b=e.slice(1),x;this.options.extensions.startBlock.forEach(S=>{x=S.call({lexer:this},b),typeof x=="number"&&x>=0&&(p=Math.min(p,x))}),p<1/0&&p>=0&&(d=e.substring(0,p+1))}if(this.state.top&&(f=this.tokenizer.paragraph(d))){let p=t.at(-1);i&&(p==null?void 0:p.type)==="paragraph"?(p.raw+=(p.raw.endsWith(`
89
- `)?"":`
90
- `)+f.raw,p.text+=`
91
- `+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):t.push(f),i=d.length!==e.length,e=e.substring(f.raw.length);continue}if(f=this.tokenizer.text(e)){e=e.substring(f.raw.length);let p=t.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
92
- `)?"":`
93
- `)+f.raw,p.text+=`
94
- `+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):t.push(f);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var u,f,d,p,b;this.tokenizer.lexer=this;let i=e;if(this.tokens.links){let x=Object.keys(this.tokens.links);x.length>0&&(i=i.replace(this.tokenizer.rules.inline.reflinkSearch,S=>x.includes(S.slice(S.lastIndexOf("[")+1,-1))?"["+"a".repeat(S.length-2)+"]":S))}i=i.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),i=i.replace(this.tokenizer.rules.inline.blockSkip,(x,S,w)=>{let T=w?w.length:0;return x.slice(0,T)+"["+"a".repeat(x.length-T-2)+"]"}),i=((f=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:f.call({lexer:this},i))??i;let l=!1,a="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}l||(a=""),l=!1;let x;if((p=(d=this.options.extensions)==null?void 0:d.inline)!=null&&p.some(w=>(x=w.call({lexer:this},e,t))?(e=e.substring(x.raw.length),t.push(x),!0):!1))continue;if(x=this.tokenizer.escape(e)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.tag(e)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.link(e)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(x.raw.length);let w=t.at(-1);x.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=x.raw,w.text+=x.text):t.push(x);continue}if(x=this.tokenizer.emStrong(e,i,a)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.codespan(e)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.br(e)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.del(e,i,a)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.autolink(e)){e=e.substring(x.raw.length),t.push(x);continue}if(!this.state.inLink&&(x=this.tokenizer.url(e))){e=e.substring(x.raw.length),t.push(x);continue}let S=e;if((b=this.options.extensions)!=null&&b.startInline){let w=1/0,T=e.slice(1),C;this.options.extensions.startInline.forEach(E=>{C=E.call({lexer:this},T),typeof C=="number"&&C>=0&&(w=Math.min(w,C))}),w<1/0&&w>=0&&(S=e.substring(0,w+1))}if(x=this.tokenizer.inlineText(S)){e=e.substring(x.raw.length),x.raw.slice(-1)!=="_"&&(a=x.raw.slice(-1)),l=!0;let w=t.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=x.raw,w.text+=x.text):t.push(x);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},rd=class{constructor(n){Mt(this,"options");Mt(this,"parser");this.options=n||za}space(n){return""}code({text:n,lang:e,escaped:t}){var a;let i=(a=(e||"").match(ti.notSpaceStart))==null?void 0:a[0],l=n.replace(ti.endingNewline,"")+`
95
- `;return i?'<pre><code class="language-'+el(i)+'">'+(t?l:el(l,!0))+`</code></pre>
96
- `:"<pre><code>"+(t?l:el(l,!0))+`</code></pre>
97
- `}blockquote({tokens:n}){return`<blockquote>
98
- ${this.parser.parse(n)}</blockquote>
99
- `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
100
- `}hr(n){return`<hr>
101
- `}list(n){let e=n.ordered,t=n.start,i="";for(let o=0;o<n.items.length;o++){let u=n.items[o];i+=this.listitem(u)}let l=e?"ol":"ul",a=e&&t!==1?' start="'+t+'"':"";return"<"+l+a+`>
102
- `+i+"</"+l+`>
103
- `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
104
- `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
105
- `}table(n){let e="",t="";for(let l=0;l<n.header.length;l++)t+=this.tablecell(n.header[l]);e+=this.tablerow({text:t});let i="";for(let l=0;l<n.rows.length;l++){let a=n.rows[l];t="";for(let o=0;o<a.length;o++)t+=this.tablecell(a[o]);i+=this.tablerow({text:t})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
106
- <thead>
107
- `+e+`</thead>
108
- `+i+`</table>
109
- `}tablerow({text:n}){return`<tr>
110
- ${n}</tr>
111
- `}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
112
- `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${el(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let i=this.parser.parseInline(t),l=Mv(n);if(l===null)return i;n=l;let a='<a href="'+n+'"';return e&&(a+=' title="'+el(e)+'"'),a+=">"+i+"</a>",a}image({href:n,title:e,text:t,tokens:i}){i&&(t=this.parser.parseInline(i,this.parser.textRenderer));let l=Mv(n);if(l===null)return el(t);n=l;let a=`<img src="${n}" alt="${el(t)}"`;return e&&(a+=` title="${el(e)}"`),a+=">",a}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:el(n.text)}},ay=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},Ns=class i0{constructor(e){Mt(this,"options");Mt(this,"renderer");Mt(this,"textRenderer");this.options=e||za,this.options.renderer=this.options.renderer||new rd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ay}static parse(e,t){return new i0(t).parse(e)}static parseInline(e,t){return new i0(t).parseInline(e)}parse(e){var i,l;this.renderer.parser=this;let t="";for(let a=0;a<e.length;a++){let o=e[a];if((l=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&l[o.type]){let f=o,d=this.options.extensions.renderers[f.type].call({parser:this},f);if(d!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(f.type)){t+=d||"";continue}}let u=o;switch(u.type){case"space":{t+=this.renderer.space(u);break}case"hr":{t+=this.renderer.hr(u);break}case"heading":{t+=this.renderer.heading(u);break}case"code":{t+=this.renderer.code(u);break}case"table":{t+=this.renderer.table(u);break}case"blockquote":{t+=this.renderer.blockquote(u);break}case"list":{t+=this.renderer.list(u);break}case"checkbox":{t+=this.renderer.checkbox(u);break}case"html":{t+=this.renderer.html(u);break}case"def":{t+=this.renderer.def(u);break}case"paragraph":{t+=this.renderer.paragraph(u);break}case"text":{t+=this.renderer.text(u);break}default:{let f='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(f),"";throw new Error(f)}}}return t}parseInline(e,t=this.renderer){var l,a;this.renderer.parser=this;let i="";for(let o=0;o<e.length;o++){let u=e[o];if((a=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&a[u.type]){let d=this.options.extensions.renderers[u.type].call({parser:this},u);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(u.type)){i+=d||"";continue}}let f=u;switch(f.type){case"escape":{i+=t.text(f);break}case"html":{i+=t.html(f);break}case"link":{i+=t.link(f);break}case"image":{i+=t.image(f);break}case"checkbox":{i+=t.checkbox(f);break}case"strong":{i+=t.strong(f);break}case"em":{i+=t.em(f);break}case"codespan":{i+=t.codespan(f);break}case"br":{i+=t.br(f);break}case"del":{i+=t.del(f);break}case"text":{i+=t.text(f);break}default:{let d='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}},$h,gu=($h=class{constructor(n){Mt(this,"options");Mt(this,"block");this.options=n||za}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?Es.lex:Es.lexInline}provideParser(n=this.block){return n?Ns.parse:Ns.parseInline}},Mt($h,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Mt($h,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),$h),AM=class{constructor(...n){Mt(this,"defaults",J0());Mt(this,"options",this.setOptions);Mt(this,"parse",this.parseMarkdown(!0));Mt(this,"parseInline",this.parseMarkdown(!1));Mt(this,"Parser",Ns);Mt(this,"Renderer",rd);Mt(this,"TextRenderer",ay);Mt(this,"Lexer",Es);Mt(this,"Tokenizer",ld);Mt(this,"Hooks",gu);this.use(...n)}walkTokens(n,e){var i,l;let t=[];for(let a of n)switch(t=t.concat(e.call(this,a)),a.type){case"table":{let o=a;for(let u of o.header)t=t.concat(this.walkTokens(u.tokens,e));for(let u of o.rows)for(let f of u)t=t.concat(this.walkTokens(f.tokens,e));break}case"list":{let o=a;t=t.concat(this.walkTokens(o.items,e));break}default:{let o=a;(l=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&l[o.type]?this.defaults.extensions.childTokens[o.type].forEach(u=>{let f=o[u].flat(1/0);t=t.concat(this.walkTokens(f,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let i={...t};if(i.async=this.defaults.async||i.async||!1,t.extensions&&(t.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){let a=e.renderers[l.name];a?e.renderers[l.name]=function(...o){let u=l.renderer.apply(this,o);return u===!1&&(u=a.apply(this,o)),u}:e.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[l.level];a?a.unshift(l.tokenizer):e[l.level]=[l.tokenizer],l.start&&(l.level==="block"?e.startBlock?e.startBlock.push(l.start):e.startBlock=[l.start]:l.level==="inline"&&(e.startInline?e.startInline.push(l.start):e.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(e.childTokens[l.name]=l.childTokens)}),i.extensions=e),t.renderer){let l=this.defaults.renderer||new rd(this.defaults);for(let a in t.renderer){if(!(a in l))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,u=t.renderer[o],f=l[o];l[o]=(...d)=>{let p=u.apply(l,d);return p===!1&&(p=f.apply(l,d)),p||""}}i.renderer=l}if(t.tokenizer){let l=this.defaults.tokenizer||new ld(this.defaults);for(let a in t.tokenizer){if(!(a in l))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,u=t.tokenizer[o],f=l[o];l[o]=(...d)=>{let p=u.apply(l,d);return p===!1&&(p=f.apply(l,d)),p}}i.tokenizer=l}if(t.hooks){let l=this.defaults.hooks||new gu;for(let a in t.hooks){if(!(a in l))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,u=t.hooks[o],f=l[o];gu.passThroughHooks.has(a)?l[o]=d=>{if(this.defaults.async&&gu.passThroughHooksRespectAsync.has(a))return(async()=>{let b=await u.call(l,d);return f.call(l,b)})();let p=u.call(l,d);return f.call(l,p)}:l[o]=(...d)=>{if(this.defaults.async)return(async()=>{let b=await u.apply(l,d);return b===!1&&(b=await f.apply(l,d)),b})();let p=u.apply(l,d);return p===!1&&(p=f.apply(l,d)),p}}i.hooks=l}if(t.walkTokens){let l=this.defaults.walkTokens,a=t.walkTokens;i.walkTokens=function(o){let u=[];return u.push(a.call(this,o)),l&&(u=u.concat(l.call(this,o))),u}}this.defaults={...this.defaults,...i}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return Es.lex(n,e??this.defaults)}parser(n,e){return Ns.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let i={...t},l={...this.defaults,...i},a=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&i.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(l.hooks&&(l.hooks.options=l,l.hooks.block=n),l.async)return(async()=>{let o=l.hooks?await l.hooks.preprocess(e):e,u=await(l.hooks?await l.hooks.provideLexer(n):n?Es.lex:Es.lexInline)(o,l),f=l.hooks?await l.hooks.processAllTokens(u):u;l.walkTokens&&await Promise.all(this.walkTokens(f,l.walkTokens));let d=await(l.hooks?await l.hooks.provideParser(n):n?Ns.parse:Ns.parseInline)(f,l);return l.hooks?await l.hooks.postprocess(d):d})().catch(a);try{l.hooks&&(e=l.hooks.preprocess(e));let o=(l.hooks?l.hooks.provideLexer(n):n?Es.lex:Es.lexInline)(e,l);l.hooks&&(o=l.hooks.processAllTokens(o)),l.walkTokens&&this.walkTokens(o,l.walkTokens);let u=(l.hooks?l.hooks.provideParser(n):n?Ns.parse:Ns.parseInline)(o,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(o){return a(o)}}}onError(n,e){return t=>{if(t.message+=`
113
- Please report this to https://github.com/markedjs/marked.`,n){let i="<p>An error occurred:</p><pre>"+el(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},Oa=new AM;function vt(n,e){return Oa.parse(n,e)}vt.options=vt.setOptions=function(n){return Oa.setOptions(n),vt.defaults=Oa.defaults,hk(vt.defaults),vt};vt.getDefaults=J0;vt.defaults=za;vt.use=function(...n){return Oa.use(...n),vt.defaults=Oa.defaults,hk(vt.defaults),vt};vt.walkTokens=function(n,e){return Oa.walkTokens(n,e)};vt.parseInline=Oa.parseInline;vt.Parser=Ns;vt.parser=Ns.parse;vt.Renderer=rd;vt.TextRenderer=ay;vt.Lexer=Es;vt.lexer=Es.lex;vt.Tokenizer=ld;vt.Hooks=gu;vt.parse=vt;vt.options;vt.setOptions;vt.use;vt.walkTokens;vt.parseInline;Ns.parse;Es.lex;/*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE */function Ov(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function CM(n){if(Array.isArray(n))return n}function TM(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,l,a,o,u=[],f=!0,d=!1;try{if(a=(t=t.call(n)).next,e!==0)for(;!(f=(i=a.call(t)).done)&&(u.push(i.value),u.length!==e);f=!0);}catch(p){d=!0,l=p}finally{try{if(!f&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(d)throw l}}return u}}function _M(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
114
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MM(n,e){return CM(n)||TM(n,e)||EM(n,e)||_M()}function EM(n,e){if(n){if(typeof n=="string")return Ov(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ov(n,e):void 0}}const wk=Object.entries,Rv=Object.setPrototypeOf,NM=Object.isFrozen,DM=Object.getPrototypeOf,OM=Object.getOwnPropertyDescriptor;let Gn=Object.freeze,Yn=Object.seal,Ao=Object.create,kk=typeof Reflect<"u"&&Reflect,s0=kk.apply,l0=kk.construct;Gn||(Gn=function(e){return e});Yn||(Yn=function(e){return e});s0||(s0=function(e,t){for(var i=arguments.length,l=new Array(i>2?i-2:0),a=2;a<i;a++)l[a-2]=arguments[a];return e.apply(t,l)});l0||(l0=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),l=1;l<t;l++)i[l-1]=arguments[l];return new e(...i)});const So=pn(Array.prototype.forEach),RM=pn(Array.prototype.lastIndexOf),jv=pn(Array.prototype.pop),wo=pn(Array.prototype.push),jM=pn(Array.prototype.splice),Dr=Array.isArray,yu=pn(String.prototype.toLowerCase),hg=pn(String.prototype.toString),Lv=pn(String.prototype.match),au=pn(String.prototype.replace),Bv=pn(String.prototype.indexOf),LM=pn(String.prototype.trim),BM=pn(Number.prototype.toString),zM=pn(Boolean.prototype.toString),zv=typeof BigInt>"u"?null:pn(BigInt.prototype.toString),Hv=typeof Symbol>"u"?null:pn(Symbol.prototype.toString),Nn=pn(Object.prototype.hasOwnProperty),ou=pn(Object.prototype.toString),En=pn(RegExp.prototype.test),pa=HM(TypeError);function pn(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,i=new Array(t>1?t-1:0),l=1;l<t;l++)i[l-1]=arguments[l];return s0(n,e,i)}}function HM(n){return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return l0(n,t)}}function ut(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yu;if(Rv&&Rv(n,null),!Dr(e))return n;let i=e.length;for(;i--;){let l=e[i];if(typeof l=="string"){const a=t(l);a!==l&&(NM(e)||(e[i]=a),l=a)}n[l]=!0}return n}function IM(n){for(let e=0;e<n.length;e++)Nn(n,e)||(n[e]=null);return n}function fi(n){const e=Ao(null);for(const i of wk(n)){var t=MM(i,2);const l=t[0],a=t[1];Nn(n,l)&&(Dr(a)?e[l]=IM(a):a&&typeof a=="object"&&a.constructor===Object?e[l]=fi(a):e[l]=a)}return e}function UM(n){switch(typeof n){case"string":return n;case"number":return BM(n);case"boolean":return zM(n);case"bigint":return zv?zv(n):"0";case"symbol":return Hv?Hv(n):"Symbol()";case"undefined":return ou(n);case"function":case"object":{if(n===null)return ou(n);const e=n,t=tl(e,"toString");if(typeof t=="function"){const i=t(e);return typeof i=="string"?i:ou(i)}return ou(n)}default:return ou(n)}}function tl(n,e){for(;n!==null;){const i=OM(n,e);if(i){if(i.get)return pn(i.get);if(typeof i.value=="function")return pn(i.value)}n=DM(n)}function t(){return null}return t}function VM(n){try{return En(n,""),!0}catch{return!1}}const Iv=Gn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),dg=Gn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),pg=Gn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),qM=Gn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mg=Gn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),GM=Gn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Uv=Gn(["#text"]),Vv=Gn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),gg=Gn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),qv=Gn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sh=Gn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),PM=Yn(/{{[\w\W]*|^[\w\W]*}}/g),YM=Yn(/<%[\w\W]*|^[\w\W]*%>/g),FM=Yn(/\${[\w\W]*/g),WM=Yn(/^data-[\-\w.\u00B7-\uFFFF]+$/),$M=Yn(/^aria-[\-\w]+$/),Gv=Yn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),KM=Yn(/^(?:\w+script|data):/i),XM=Yn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),QM=Yn(/^html$/i),ZM=Yn(/^[a-z][.\w]*(-[.\w]+)+$/i),Pv=Yn(/<[/\w!]/g),Yv=Yn(/<[/\w]/g),JM=Yn(/<\/no(script|embed|frames)/i),eE=Yn(/\/>/i),Pi={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},tE=function(){return typeof window>"u"?null:window},nE=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const l="data-tt-policy-suffix";t&&t.hasAttribute(l)&&(i=t.getAttribute(l));const a="dompurify"+(i?"#"+i:"");try{return e.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Fv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Tr=function(e,t,i,l){return Nn(e,t)&&Dr(e[t])?ut(l.base?fi(l.base):{},e[t],l.transform):i};function Ak(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tE();const e=ae=>Ak(ae);if(e.version="3.4.12",e.removed=[],!n||!n.document||n.document.nodeType!==Pi.document||!n.Element)return e.isSupported=!1,e;let t=n.document;const i=t,l=i.currentScript;n.DocumentFragment;const a=n.HTMLTemplateElement,o=n.Node,u=n.Element,f=n.NodeFilter,d=n.NamedNodeMap;d===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const p=n.DOMParser,b=n.trustedTypes,x=u.prototype,S=tl(x,"cloneNode"),w=tl(x,"remove"),T=tl(x,"nextSibling"),C=tl(x,"childNodes"),E=tl(x,"parentNode"),O=tl(x,"shadowRoot"),B=tl(x,"attributes"),q=o&&o.prototype?tl(o.prototype,"nodeType"):null,H=o&&o.prototype?tl(o.prototype,"nodeName"):null;if(typeof a=="function"){const ae=t.createElement("template");ae.content&&ae.content.ownerDocument&&(t=ae.content.ownerDocument)}let L,j="",se,he=!1,Me=0;const ue=function(){if(Me>0)throw pa('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},le=function(_){ue(),Me++;try{return L.createHTML(_)}finally{Me--}},Ee=function(_){ue(),Me++;try{return L.createScriptURL(_)}finally{Me--}},ve=function(){return he||(se=nE(b,l),he=!0),se},ke=t,I=ke.implementation,Z=ke.createNodeIterator,ee=ke.createDocumentFragment,Ne=ke.getElementsByTagName,_e=i.importNode;let N=Fv();e.isSupported=typeof wk=="function"&&typeof E=="function"&&I&&I.createHTMLDocument!==void 0;const F=PM,J=YM,oe=FM,de=WM,Se=$M,Ie=KM,pt=XM,$e=ZM;let It=Gv,Ze=null;const Kt=ut({},[...Iv,...dg,...pg,...mg,...Uv]);let at=null;const we=ut({},[...Vv,...gg,...qv,...Sh]);let xe=Object.seal(Ao(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ft=null,xn=null;const Ve=Object.seal(Ao(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Rn=!0,si=!0,ce=!1,qe=!0,St=!1,Fe=!0,$=!1,fe=!1,ze=null,Je=null,vn=!1,$n=!1,Wl=!1,$l=!1,hs=!0,Sn=!1;const Ei="user-content-";let mn=!0,Hs=!1,Kn={},wn=null;const Xt=ut({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Is=null;const ds=ut({},["audio","video","img","source","image","track"]);let Xn=null;const ml=ut({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),li="http://www.w3.org/1998/Math/MathML",Kl="http://www.w3.org/2000/svg",jn="http://www.w3.org/1999/xhtml";let ri=jn,mi=!1,Ln=null;const Us=ut({},[li,Kl,jn],hg),Ni=Gn(["mi","mo","mn","ms","mtext"]);let $i=ut({},Ni);const ps=Gn(["annotation-xml"]);let Ki=ut({},ps);const Vs=ut({},["title","style","font","a","script"]);let kn=null;const ai=["application/xhtml+xml","text/html"],Nt="text/html";let Xe=null,en=null;const ms=t.createElement("form"),gl=function(_){return _ instanceof RegExp||_ instanceof Function},gs=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(en&&en===_)return;(!_||typeof _!="object")&&(_={}),_=fi(_),kn=ai.indexOf(_.PARSER_MEDIA_TYPE)===-1?Nt:_.PARSER_MEDIA_TYPE,Xe=kn==="application/xhtml+xml"?hg:yu,Ze=Tr(_,"ALLOWED_TAGS",Kt,{transform:Xe}),at=Tr(_,"ALLOWED_ATTR",we,{transform:Xe}),Ln=Tr(_,"ALLOWED_NAMESPACES",Us,{transform:hg}),Xn=Tr(_,"ADD_URI_SAFE_ATTR",ml,{transform:Xe,base:ml}),Is=Tr(_,"ADD_DATA_URI_TAGS",ds,{transform:Xe,base:ds}),wn=Tr(_,"FORBID_CONTENTS",Xt,{transform:Xe}),Ft=Tr(_,"FORBID_TAGS",fi({}),{transform:Xe}),xn=Tr(_,"FORBID_ATTR",fi({}),{transform:Xe}),Kn=Nn(_,"USE_PROFILES")?_.USE_PROFILES&&typeof _.USE_PROFILES=="object"?fi(_.USE_PROFILES):_.USE_PROFILES:!1,Rn=_.ALLOW_ARIA_ATTR!==!1,si=_.ALLOW_DATA_ATTR!==!1,ce=_.ALLOW_UNKNOWN_PROTOCOLS||!1,qe=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,St=_.SAFE_FOR_TEMPLATES||!1,Fe=_.SAFE_FOR_XML!==!1,$=_.WHOLE_DOCUMENT||!1,$n=_.RETURN_DOM||!1,Wl=_.RETURN_DOM_FRAGMENT||!1,$l=_.RETURN_TRUSTED_TYPE||!1,vn=_.FORCE_BODY||!1,hs=_.SANITIZE_DOM!==!1,Sn=_.SANITIZE_NAMED_PROPS||!1,mn=_.KEEP_CONTENT!==!1,Hs=_.IN_PLACE||!1,It=VM(_.ALLOWED_URI_REGEXP)?_.ALLOWED_URI_REGEXP:Gv,ri=typeof _.NAMESPACE=="string"?_.NAMESPACE:jn,$i=Nn(_,"MATHML_TEXT_INTEGRATION_POINTS")&&_.MATHML_TEXT_INTEGRATION_POINTS&&typeof _.MATHML_TEXT_INTEGRATION_POINTS=="object"?fi(_.MATHML_TEXT_INTEGRATION_POINTS):ut({},Ni),Ki=Nn(_,"HTML_INTEGRATION_POINTS")&&_.HTML_INTEGRATION_POINTS&&typeof _.HTML_INTEGRATION_POINTS=="object"?fi(_.HTML_INTEGRATION_POINTS):ut({},ps);const U=Nn(_,"CUSTOM_ELEMENT_HANDLING")&&_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING=="object"?fi(_.CUSTOM_ELEMENT_HANDLING):Ao(null);if(xe=Ao(null),Nn(U,"tagNameCheck")&&gl(U.tagNameCheck)&&(xe.tagNameCheck=U.tagNameCheck),Nn(U,"attributeNameCheck")&&gl(U.attributeNameCheck)&&(xe.attributeNameCheck=U.attributeNameCheck),Nn(U,"allowCustomizedBuiltInElements")&&typeof U.allowCustomizedBuiltInElements=="boolean"&&(xe.allowCustomizedBuiltInElements=U.allowCustomizedBuiltInElements),Yn(xe),St&&(si=!1),Wl&&($n=!0),Kn&&(Ze=ut({},Uv),at=Ao(null),Kn.html===!0&&(ut(Ze,Iv),ut(at,Vv)),Kn.svg===!0&&(ut(Ze,dg),ut(at,gg),ut(at,Sh)),Kn.svgFilters===!0&&(ut(Ze,pg),ut(at,gg),ut(at,Sh)),Kn.mathMl===!0&&(ut(Ze,mg),ut(at,qv),ut(at,Sh))),Ve.tagCheck=null,Ve.attributeCheck=null,Nn(_,"ADD_TAGS")&&(typeof _.ADD_TAGS=="function"?Ve.tagCheck=_.ADD_TAGS:Dr(_.ADD_TAGS)&&(Ze===Kt&&(Ze=fi(Ze)),ut(Ze,_.ADD_TAGS,Xe))),Nn(_,"ADD_ATTR")&&(typeof _.ADD_ATTR=="function"?Ve.attributeCheck=_.ADD_ATTR:Dr(_.ADD_ATTR)&&(at===we&&(at=fi(at)),ut(at,_.ADD_ATTR,Xe))),Nn(_,"ADD_URI_SAFE_ATTR")&&Dr(_.ADD_URI_SAFE_ATTR)&&ut(Xn,_.ADD_URI_SAFE_ATTR,Xe),Nn(_,"FORBID_CONTENTS")&&Dr(_.FORBID_CONTENTS)&&(wn===Xt&&(wn=fi(wn)),ut(wn,_.FORBID_CONTENTS,Xe)),Nn(_,"ADD_FORBID_CONTENTS")&&Dr(_.ADD_FORBID_CONTENTS)&&(wn===Xt&&(wn=fi(wn)),ut(wn,_.ADD_FORBID_CONTENTS,Xe)),mn&&(Ze["#text"]=!0),$&&ut(Ze,["html","head","body"]),Ze.table&&(ut(Ze,["tbody"]),delete Ft.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw pa('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw pa('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ie=L;L=_.TRUSTED_TYPES_POLICY;try{j=le("")}catch(Ae){throw L=ie,Ae}}else _.TRUSTED_TYPES_POLICY===null?(L=void 0,j=""):(L===void 0&&(L=ve()),L&&typeof j=="string"&&(j=le("")));Gn&&Gn(_),en=_},qs=ut({},[...dg,...pg,...qM]),Gs=ut({},[...mg,...GM]),yl=function(_,U,ie){return U.namespaceURI===jn?_==="svg":U.namespaceURI===li?_==="svg"&&(ie==="annotation-xml"||$i[ie]):!!qs[_]},Di=function(_,U,ie){return U.namespaceURI===jn?_==="math":U.namespaceURI===Kl?_==="math"&&Ki[ie]:!!Gs[_]},ys=function(_,U,ie){return U.namespaceURI===Kl&&!Ki[ie]||U.namespaceURI===li&&!$i[ie]?!1:!Gs[_]&&(Vs[_]||!qs[_])},Xi=function(_){let U=E(_);(!U||!U.tagName)&&(U={namespaceURI:ri,tagName:"template"});const ie=yu(_.tagName),Ae=yu(U.tagName);return Ln[_.namespaceURI]?_.namespaceURI===Kl?yl(ie,U,Ae):_.namespaceURI===li?Di(ie,U,Ae):_.namespaceURI===jn?ys(ie,U,Ae):!!(kn==="application/xhtml+xml"&&Ln[_.namespaceURI]):!1},An=function(_){wo(e.removed,{element:_});try{E(_).removeChild(_)}catch{if(w(_),!E(_))throw pa("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},wt=function(_){oi(_);const U=C(_);if(U){const Ae=[];So(U,Oe=>{wo(Ae,Oe)}),So(Ae,Oe=>{try{w(Oe)}catch{}})}const ie=B(_);if(ie)for(let Ae=ie.length-1;Ae>=0;--Ae){const Oe=ie[Ae],je=Oe&&Oe.name;if(typeof je=="string")try{_.removeAttribute(je)}catch{}}},Qn=function(_,U){try{wo(e.removed,{attribute:U.getAttributeNode(_),from:U})}catch{wo(e.removed,{attribute:null,from:U})}if(U.removeAttribute(_),_==="is")if($n||Wl)try{An(U)}catch{}else try{U.setAttribute(_,"")}catch{}},Ha=function(_){const U=B(_);if(U)for(let ie=U.length-1;ie>=0;--ie){const Ae=U[ie],Oe=Ae&&Ae.name;if(!(typeof Oe!="string"||at[Xe(Oe)]))try{_.removeAttribute(Oe)}catch{}}},oi=function(_){const U=[_];for(;U.length>0;){const ie=U.pop();(q?q(ie):ie.nodeType)===Pi.element&&Ha(ie);const Oe=C(ie);if(Oe)for(let je=Oe.length-1;je>=0;--je)U.push(Oe[je])}},Oi=function(_){if(!Fe)return;const U=[_];for(;U.length>0;){const ie=U.pop(),Ae=q?q(ie):ie.nodeType;if(Ae===Pi.processingInstruction||Ae===Pi.comment&&En(Yv,ie.data)){try{w(ie)}catch{}continue}if(Ae===Pi.element){const je=ie,xt=Xe(H?H(ie):ie.nodeName);try{je.hasAttribute&&je.hasAttribute("patchsrc")&&je.removeAttribute("patchsrc"),je.hasAttribute&&je.hasAttribute("for")&&xt!=="label"&&xt!=="output"&&je.removeAttribute("for")}catch{}}const Oe=C(ie);if(Oe)for(let je=Oe.length-1;je>=0;--je)U.push(Oe[je])}},Xl=function(_){let U=null,ie=null;if(vn)_="<remove></remove>"+_;else{const je=Lv(_,/^[\r\n\t ]+/);ie=je&&je[0]}kn==="application/xhtml+xml"&&ri===jn&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const Ae=L?le(_):_;if(ri===jn)try{U=new p().parseFromString(Ae,kn)}catch{}if(!U||!U.documentElement){U=I.createDocument(ri,"template",null);try{U.documentElement.innerHTML=mi?j:Ae}catch{}}const Oe=U.body||U.documentElement;return _&&ie&&Oe.insertBefore(t.createTextNode(ie),Oe.childNodes[0]||null),ri===jn?Ne.call(U,$?"html":"body")[0]:$?U.documentElement:Oe},Ql=function(_){return Z.call(_.ownerDocument||_,_,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},Qi=function(_){return _=au(_,F," "),_=au(_,J," "),_=au(_,oe," "),_},bs=function(_){var U;_.normalize();const ie=Z.call(_.ownerDocument||_,_,f.SHOW_TEXT|f.SHOW_COMMENT|f.SHOW_CDATA_SECTION|f.SHOW_PROCESSING_INSTRUCTION,null);let Ae=ie.nextNode();for(;Ae;)Ae.data=Qi(Ae.data),Ae=ie.nextNode();const Oe=(U=_.querySelectorAll)===null||U===void 0?void 0:U.call(_,"template");Oe&&So(Oe,je=>{gi(je.content)&&bs(je.content)})},Ri=function(_){const U=H?H(_):null;return typeof U!="string"||Xe(U)!=="form"?!1:typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||_.attributes!==B(_)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function"||_.nodeType!==q(_)||_.childNodes!==C(_)},gi=function(_){if(!q||typeof _!="object"||_===null)return!1;try{return q(_)===Pi.documentFragment}catch{return!1}},rn=function(_){if(!q||typeof _!="object"||_===null)return!1;try{return typeof q(_)=="number"}catch{return!1}};function Bt(ae,_,U){ae.length!==0&&So(ae,ie=>{ie.call(e,_,U,en)})}const bl=function(_,U){return!!(Fe&&_.hasChildNodes()&&!rn(_.firstElementChild)&&En(Pv,_.textContent)&&En(Pv,_.innerHTML)||Fe&&_.namespaceURI===jn&&U==="style"&&rn(_.firstElementChild)||_.nodeType===Pi.processingInstruction||Fe&&_.nodeType===Pi.comment&&En(Yv,_.data))},ji=function(_,U){if(!Ft[U]&&Ps(U)&&(xe.tagNameCheck instanceof RegExp&&En(xe.tagNameCheck,U)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(U)))return!1;if(mn&&!wn[U]){const ie=E(_),Ae=C(_);if(Ae&&ie){const Oe=Ae.length;for(let je=Oe-1;je>=0;--je){const xt=Hs?Ae[je]:S(Ae[je],!0);ie.insertBefore(xt,T(_))}}}return An(_),!0},xs=function(_,U){if(Bt(N.beforeSanitizeElements,_,null),_!==U&&E(_)===null)return!0;if(Ri(_))return An(_),!0;const ie=Xe(H?H(_):_.nodeName);if(Bt(N.uponSanitizeElement,_,{tagName:ie,allowedTags:Ze}),_!==U&&E(_)===null)return!0;if(bl(_,ie))return An(_),!0;if(Ft[ie]||!(Ve.tagCheck instanceof Function&&Ve.tagCheck(ie))&&!Ze[ie]){const Oe=ji(_,ie);return Oe===!1&&Bt(N.afterSanitizeElements,_,null),Oe}if((q?q(_):_.nodeType)===Pi.element&&!Xi(_)||(ie==="noscript"||ie==="noembed"||ie==="noframes")&&En(JM,_.innerHTML))return An(_),!0;if(St&&_.nodeType===Pi.text){const Oe=Qi(_.textContent);_.textContent!==Oe&&(wo(e.removed,{element:_.cloneNode()}),_.textContent=Oe)}return Bt(N.afterSanitizeElements,_,null),!1},vs=function(_,U,ie){if(xn[U]||Fe&&U==="patchsrc"||Fe&&U==="for"&&_!=="label"&&_!=="output"||hs&&(U==="id"||U==="name")&&(ie in t||ie in ms))return!1;const Ae=at[U]||Ve.attributeCheck instanceof Function&&Ve.attributeCheck(U,_);if(!(si&&En(de,U))){if(!(Rn&&En(Se,U))){if(Ae){if(!Xn[U]){if(!En(It,au(ie,pt,""))){if(!((U==="src"||U==="xlink:href"||U==="href")&&_!=="script"&&Bv(ie,"data:")===0&&Is[_])){if(!(ce&&!En(Ie,au(ie,pt,"")))){if(ie)return!1}}}}}else if(!(Ps(_)&&(xe.tagNameCheck instanceof RegExp&&En(xe.tagNameCheck,_)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(_))&&(xe.attributeNameCheck instanceof RegExp&&En(xe.attributeNameCheck,U)||xe.attributeNameCheck instanceof Function&&xe.attributeNameCheck(U,_))||U==="is"&&xe.allowCustomizedBuiltInElements&&(xe.tagNameCheck instanceof RegExp&&En(xe.tagNameCheck,ie)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(ie))))return!1}}return!0},yi=ut({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ps=function(_){return!yi[yu(_)]&&En($e,_)},Dt=function(_,U,ie,Ae){if(L&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!ie)switch(b.getAttributeType(_,U)){case"TrustedHTML":return le(Ae);case"TrustedScriptURL":return Ee(Ae)}return Ae},Cn=function(_,U,ie,Ae){try{ie?_.setAttributeNS(ie,U,Ae):_.setAttribute(U,Ae),Ri(_)?An(_):jv(e.removed)}catch{Qn(U,_)}},Zl=function(_){Bt(N.beforeSanitizeAttributes,_,null);const U=_.attributes;if(!U||Ri(_))return;const ie={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:at,forceKeepAttr:void 0};let Ae=U.length;const Oe=Xe(_.nodeName);for(;Ae--;){const je=U[Ae],xt=je.name,Gt=je.namespaceURI,gn=je.value,zt=Xe(xt),re=gn;let pe=xt==="value"?re:LM(re);if(ie.attrName=zt,ie.attrValue=pe,ie.keepAttr=!0,ie.forceKeepAttr=void 0,Bt(N.uponSanitizeAttribute,_,ie),pe=ie.attrValue,Sn&&(zt==="id"||zt==="name")&&Bv(pe,Ei)!==0&&(Qn(xt,_),pe=Ei+pe),Fe&&En(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,pe)){Qn(xt,_);continue}if(zt==="attributename"&&Lv(pe,"href")){Qn(xt,_);continue}if(!ie.forceKeepAttr){if(!ie.keepAttr){Qn(xt,_);continue}if(!qe&&En(eE,pe)){Qn(xt,_);continue}if(St&&(pe=Qi(pe)),!vs(Oe,zt,pe)){Qn(xt,_);continue}pe=Dt(Oe,zt,Gt,pe),pe!==re&&Cn(_,xt,Gt,pe)}}Bt(N.afterSanitizeAttributes,_,null)},Tn=function(_){let U=null;const ie=Ql(_);for(Bt(N.beforeSanitizeShadowDOM,_,null);U=ie.nextNode();)if(Bt(N.uponSanitizeShadowNode,U,null),xs(U,_),Zl(U),gi(U.content)&&Tn(U.content),(q?q(U):U.nodeType)===Pi.element){const Oe=O(U);gi(Oe)&&(Li(Oe),Tn(Oe))}Bt(N.afterSanitizeShadowDOM,_,null)},Li=function(_){const U=[{node:_,shadow:null}];for(;U.length>0;){const ie=U.pop();if(ie.shadow){Tn(ie.shadow);continue}const Ae=ie.node,je=(q?q(Ae):Ae.nodeType)===Pi.element,xt=C(Ae);if(xt)for(let Gt=xt.length-1;Gt>=0;--Gt)U.push({node:xt[Gt],shadow:null});if(je){const Gt=H?H(Ae):null;if(typeof Gt=="string"&&Xe(Gt)==="template"){const gn=Ae.content;gi(gn)&&U.push({node:gn,shadow:null})}}if(je){const Gt=O(Ae);gi(Gt)&&U.push({node:null,shadow:Gt},{node:Gt,shadow:null})}}};return e.sanitize=function(ae){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=null,ie=null,Ae=null,Oe=null;if(mi=!ae,mi&&(ae="<!-->"),typeof ae!="string"&&!rn(ae)&&(ae=UM(ae),typeof ae!="string"))throw pa("dirty is not a string, aborting");if(!e.isSupported)return ae;fe?(Ze=ze,at=Je):gs(_),(N.uponSanitizeElement.length>0||N.uponSanitizeAttribute.length>0)&&(Ze=fi(Ze)),N.uponSanitizeAttribute.length>0&&(at=fi(at)),e.removed=[];const je=Hs&&typeof ae!="string"&&rn(ae);if(je){Oi(ae);const zt=H?H(ae):ae.nodeName;if(typeof zt=="string"){const re=Xe(zt);if(!Ze[re]||Ft[re])throw wt(ae),pa("root node is forbidden and cannot be sanitized in-place")}if(Ri(ae))throw wt(ae),pa("root node is clobbered and cannot be sanitized in-place");try{Li(ae)}catch(re){throw wt(ae),re}}else if(rn(ae))U=Xl("<!---->"),ie=U.ownerDocument.importNode(ae,!0),ie.nodeType===Pi.element&&ie.nodeName==="BODY"||ie.nodeName==="HTML"?U=ie:U.appendChild(ie),Li(ie);else{if(!$n&&!St&&!$&&ae.indexOf("<")===-1)return L&&$l?le(ae):ae;if(U=Xl(ae),!U)return $n?null:$l?j:""}U&&vn&&An(U.firstChild);const xt=je?ae:U,Gt=Ql(xt);try{for(;Ae=Gt.nextNode();)xs(Ae,xt),Zl(Ae),gi(Ae.content)&&Tn(Ae.content)}catch(zt){throw je&&(wt(ae),So(e.removed,re=>{re.element&&oi(re.element)})),zt}if(je)return So(e.removed,zt=>{zt.element&&oi(zt.element)}),St&&bs(ae),ae;if($n){if(St&&bs(U),Wl)for(Oe=ee.call(U.ownerDocument);U.firstChild;)Oe.appendChild(U.firstChild);else Oe=U;return(at.shadowroot||at.shadowrootmode)&&(Oe=_e.call(i,Oe,!0)),Oe}let gn=$?U.outerHTML:U.innerHTML;return $&&Ze["!doctype"]&&U.ownerDocument&&U.ownerDocument.doctype&&U.ownerDocument.doctype.name&&En(QM,U.ownerDocument.doctype.name)&&(gn="<!DOCTYPE "+U.ownerDocument.doctype.name+`>
115
- `+gn),St&&(gn=Qi(gn)),L&&$l?le(gn):gn},e.setConfig=function(){let ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};gs(ae),fe=!0,ze=Ze,Je=at},e.clearConfig=function(){en=null,fe=!1,ze=null,Je=null,L=se,j=""},e.isValidAttribute=function(ae,_,U){en||gs({});const ie=Xe(ae),Ae=Xe(_);return vs(ie,Ae,U)},e.addHook=function(ae,_){typeof _=="function"&&Nn(N,ae)&&wo(N[ae],_)},e.removeHook=function(ae,_){if(Nn(N,ae)){if(_!==void 0){const U=RM(N[ae],_);return U===-1?void 0:jM(N[ae],U,1)[0]}return jv(N[ae])}},e.removeHooks=function(ae){Nn(N,ae)&&(N[ae]=[])},e.removeAllHooks=function(){N=Fv()},e}var iE=Ak();const sE=1024;let lE=0,as=class{constructor(e,t){this.from=e,this.to=t}};class st{constructor(e={}){this.id=lE++,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=Mi.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}st.closedBy=new st({deserialize:n=>n.split(" ")});st.openedBy=new st({deserialize:n=>n.split(" ")});st.group=new st({deserialize:n=>n.split(" ")});st.isolate=new st({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});st.contextHash=new st({perNode:!0});st.lookAhead=new st({perNode:!0});st.mounted=new st({perNode:!0});class Ro{constructor(e,t,i,l=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=l}static get(e){return e&&e.props&&e.props[st.mounted.id]}}const rE=Object.create(null);class Mi{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):rE,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Mi(e.name||"",t,e.id,i);if(e.props){for(let a of e.props)if(Array.isArray(a)||(a=a(l)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[a[0].id]=a[1]}}return l}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(st.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(st.group),a=-1;a<(l?l.length:0);a++){let o=t[a<0?i.name:l[a]];if(o)return o}}}}Mi.none=new Mi("",Object.create(null),0,8);class Ck{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 i of this.types){let l=null;for(let a of e){let o=a(i);if(o){l||(l=Object.assign({},i.props));let u=o[1],f=o[0];f.combine&&f.id in l&&(u=f.combine(l[f.id],u)),l[f.id]=u}}t.push(l?new Mi(i.name,l,i.id,i.flags):i)}return new Ck(t)}}const wh=new WeakMap,Wv=new WeakMap;var jt;(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"})(jt||(jt={}));class hn{constructor(e,t,i,l,a){if(this.type=e,this.children=t,this.positions=i,this.length=l,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,u]of a)this.props[typeof o=="number"?o:o.id]=u}}toString(){let e=Ro.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let l=i.toString();l&&(t&&(t+=","),t+=l)}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 ad(this.topNode,e)}cursorAt(e,t=0,i=0){let l=wh.get(this)||this.topNode,a=new ad(l);return a.moveTo(e,t),wh.set(this,a._tree),a}get topNode(){return new ni(this,0,0,null)}resolve(e,t=0){let i=_u(wh.get(this)||this.topNode,e,t,!1);return wh.set(this,i),i}resolveInner(e,t=0){let i=_u(Wv.get(this)||this.topNode,e,t,!0);return Wv.set(this,i),i}resolveStack(e,t=0){return cE(this,e,t)}iterate(e){let{enter:t,leave:i,from:l=0,to:a=this.length}=e,o=e.mode||0,u=(o&jt.IncludeAnonymous)>0;for(let f=this.cursor(o|jt.IncludeAnonymous);;){let d=!1;if(f.from<=a&&f.to>=l&&(!u&&f.type.isAnonymous||t(f)!==!1)){if(f.firstChild())continue;d=!0}for(;d&&i&&(u||!f.type.isAnonymous)&&i(f),!f.nextSibling();){if(!f.parent())return;d=!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:uy(Mi.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new hn(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new hn(Mi.none,t,i,l)))}static build(e){return uE(e)}}hn.empty=new hn(Mi.none,[],[],0);class oy{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 oy(this.buffer,this.index)}}class Hr{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Mi.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],i=this.buffer[e+3],l=this.set.types[t],a=l.name;if(/\W/.test(a)&&!l.isError&&(a=JSON.stringify(a)),e+=4,i==e)return a;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return a+"("+o.join(",")+")"}findChild(e,t,i,l,a){let{buffer:o}=this,u=-1;for(let f=e;f!=t&&!(Tk(a,l,o[f+1],o[f+2])&&(u=f,i>0));f=o[f+3]);return u}slice(e,t,i){let l=this.buffer,a=new Uint16Array(t-e),o=0;for(let u=e,f=0;u<t;){a[f++]=l[u++],a[f++]=l[u++]-i;let d=a[f++]=l[u++]-i;a[f++]=l[u++]-e,o=Math.max(o,d)}return new Hr(a,o,this.set)}}function Tk(n,e,t,i){switch(n){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function _u(n,e,t,i){for(var l;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!i&&n instanceof ni&&n.index<0?null:n.parent;if(!o)return n;n=o}let a=i?0:jt.IgnoreOverlays;if(i)for(let o=n,u=o.parent;u;o=u,u=o.parent)o instanceof ni&&o.index<0&&((l=u.enter(e,t,a))===null||l===void 0?void 0:l.from)!=o.from&&(n=u);for(;;){let o=n.enter(e,t,a);if(!o)return n;n=o}}class _k{cursor(e=0){return new ad(this,e)}getChild(e,t=null,i=null){let l=$v(this,e,t,i);return l.length?l[0]:null}getChildren(e,t=null,i=null){return $v(this,e,t,i)}resolve(e,t=0){return _u(this,e,t,!1)}resolveInner(e,t=0){return _u(this,e,t,!0)}matchContext(e){return r0(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(i=t,t=l.prevSibling):t=l}return i}get node(){return this}get next(){return this.parent}}class ni extends _k{constructor(e,t,i,l){super(),this._tree=e,this.from=t,this.index=i,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,l,a=0){for(let o=this;;){for(let{children:u,positions:f}=o._tree,d=t>0?u.length:-1;e!=d;e+=t){let p=u[e],b=f[e]+o.from,x;if(!(!(a&jt.EnterBracketed&&p instanceof hn&&(x=Ro.get(p))&&!x.overlay&&x.bracketed&&i>=b&&i<=b+p.length)&&!Tk(l,i,b,b+p.length))){if(p instanceof Hr){if(a&jt.ExcludeBuffers)continue;let S=p.findChild(0,p.buffer.length,t,i-b,l);if(S>-1)return new ol(new aE(o,p,e,b),null,S)}else if(a&jt.IncludeAnonymous||!p.type.isAnonymous||cy(p)){let S;if(!(a&jt.IgnoreMounts)&&(S=Ro.get(p))&&!S.overlay)return new ni(S.tree,b,e,o);let w=new ni(p,b,e,o);return a&jt.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(t<0?p.children.length-1:0,t,i,l,a)}}}if(a&jt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let l;if(!(i&jt.IgnoreOverlays)&&(l=Ro.get(this._tree))&&l.overlay){let a=e-this.from,o=i&jt.EnterBracketed&&l.bracketed;for(let{from:u,to:f}of l.overlay)if((t>0||o?u<=a:u<a)&&(t<0||o?f>=a:f>a))return new ni(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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 $v(n,e,t,i){let l=n.cursor(),a=[];if(!l.firstChild())return a;if(t!=null){for(let o=!1;!o;)if(o=l.type.is(t),!l.nextSibling())return a}for(;;){if(i!=null&&l.type.is(i))return a;if(l.type.is(e)&&a.push(l.node),!l.nextSibling())return i==null?a:[]}}function r0(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class aE{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class ol extends _k{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,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,a=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return a<0?null:new ol(this.context,this,a)}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,i=0){if(i&jt.ExcludeBuffers)return null;let{buffer:l}=this.context,a=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return a<0?null:new ol(this.context,this,a)}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 ol(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 ol(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,a=i.buffer[this.index+3];if(a>l){let o=i.buffer[this.index+1];e.push(i.slice(l,a,o)),t.push(0)}return new hn(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Mk(n){if(!n.length)return null;let e=0,t=n[0];for(let a=1;a<n.length;a++){let o=n[a];(o.from>t.from||o.to<t.to)&&(t=o,e=a)}let i=t instanceof ni&&t.index<0?null:t.parent,l=n.slice();return i?l[e]=i:l.splice(e,1),new oE(l,t)}class oE{constructor(e,t){this.heads=e,this.node=t}get next(){return Mk(this.heads)}}function cE(n,e,t){let i=n.resolveInner(e,t),l=null;for(let a=i instanceof ni?i:i.context.parent;a;a=a.parent)if(a.index<0){let o=a.parent;(l||(l=[i])).push(o.resolve(e,t)),a=o}else{let o=Ro.get(a.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let u=new ni(o.tree,o.overlay[0].from+a.from,-1,a);(l||(l=[i])).push(_u(u,e,t,!1))}}return l?Mk(l):i}class ad{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&~jt.EnterBracketed,e instanceof ni)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.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:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof ni?(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,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,a=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}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,i=this.mode){return this.buffer?i&jt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&jt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&jt.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,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<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,i,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(l.buffer.buffer[a+3]<this.index)return!1;({index:t,parent:i}=l)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let a=t+e,o=e<0?-1:i._tree.children.length;a!=o;a+=e){let u=i._tree.children[a];if(this.mode&jt.IncludeAnonymous||u instanceof Hr||!u.type.isAnonymous||cy(u))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,i=0;if(e&&e.context==this.buffer)e:for(let l=this.index,a=this.stack.length;a>=0;){for(let o=e;o;o=o._parent)if(o.index==l){if(l==this.index)return o;t=o,i=a+1;break e}l=this.stack[--a]}for(let l=i;l<this.stack.length;l++)t=new ol(this.buffer,t,this.stack[l]);return this.bufferNode=new ol(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(l=!0)}for(;;){if(l&&t&&t(this),l=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,l=!0}}}matchContext(e){if(!this.buffer)return r0(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let l=e.length-1,a=this.stack.length-1;l>=0;a--){if(a<0)return r0(this._tree,e,l);let o=i[t.buffer[this.stack[a]]];if(!o.isAnonymous){if(e[l]&&e[l]!=o.name)return!1;l--}}return!0}}function cy(n){return n.children.some(e=>e instanceof Hr||!e.type.isAnonymous||cy(e))}function uE(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=sE,reused:a=[],minRepeatType:o=i.types.length}=n,u=Array.isArray(t)?new oy(t,t.length):t,f=i.types,d=0,p=0;function b(H,L,j,se,he,Me){let{id:ue,start:le,end:Ee,size:ve}=u,ke=p,I=d;if(ve<0)if(u.next(),ve==-1){let N=a[ue];j.push(N),se.push(le-H);return}else if(ve==-3){d=ue;return}else if(ve==-4){p=ue;return}else throw new RangeError(`Unrecognized record size: ${ve}`);let Z=f[ue],ee,Ne,_e=le-H;if(Ee-le<=l&&(Ne=C(u.pos-L,he))){let N=new Uint16Array(Ne.size-Ne.skip),F=u.pos-Ne.size,J=N.length;for(;u.pos>F;)J=E(Ne.start,N,J);ee=new Hr(N,Ee-Ne.start,i),_e=Ne.start-H}else{let N=u.pos-ve;u.next();let F=[],J=[],oe=ue>=o?ue:-1,de=0,Se=Ee;for(;u.pos>N;)oe>=0&&u.id==oe&&u.size>=0?(u.end<=Se-l&&(w(F,J,le,de,u.end,Se,oe,ke,I),de=F.length,Se=u.end),u.next()):Me>2500?x(le,N,F,J):b(le,N,F,J,oe,Me+1);if(oe>=0&&de>0&&de<F.length&&w(F,J,le,de,le,Se,oe,ke,I),F.reverse(),J.reverse(),oe>-1&&de>0){let Ie=S(Z,I);ee=uy(Z,F,J,0,F.length,0,Ee-le,Ie,Ie)}else ee=T(Z,F,J,Ee-le,ke-Ee,I)}j.push(ee),se.push(_e)}function x(H,L,j,se){let he=[],Me=0,ue=-1;for(;u.pos>L;){let{id:le,start:Ee,end:ve,size:ke}=u;if(ke>4)u.next();else{if(ue>-1&&Ee<ue)break;ue<0&&(ue=ve-l),he.push(le,Ee,ve),Me++,u.next()}}if(Me){let le=new Uint16Array(Me*4),Ee=he[he.length-2];for(let ve=he.length-3,ke=0;ve>=0;ve-=3)le[ke++]=he[ve],le[ke++]=he[ve+1]-Ee,le[ke++]=he[ve+2]-Ee,le[ke++]=ke;j.push(new Hr(le,he[2]-Ee,i)),se.push(Ee-H)}}function S(H,L){return(j,se,he)=>{let Me=0,ue=j.length-1,le,Ee;if(ue>=0&&(le=j[ue])instanceof hn){if(!ue&&le.type==H&&le.length==he)return le;(Ee=le.prop(st.lookAhead))&&(Me=se[ue]+le.length+Ee)}return T(H,j,se,he,Me,L)}}function w(H,L,j,se,he,Me,ue,le,Ee){let ve=[],ke=[];for(;H.length>se;)ve.push(H.pop()),ke.push(L.pop()+j-he);H.push(T(i.types[ue],ve,ke,Me-he,le-Me,Ee)),L.push(he-j)}function T(H,L,j,se,he,Me,ue){if(Me){let le=[st.contextHash,Me];ue=ue?[le].concat(ue):[le]}if(he>25){let le=[st.lookAhead,he];ue=ue?[le].concat(ue):[le]}return new hn(H,L,j,se,ue)}function C(H,L){let j=u.fork(),se=0,he=0,Me=0,ue=j.end-l,le={size:0,start:0,skip:0};e:for(let Ee=j.pos-H;j.pos>Ee;){let ve=j.size;if(j.id==L&&ve>=0){le.size=se,le.start=he,le.skip=Me,Me+=4,se+=4,j.next();continue}let ke=j.pos-ve;if(ve<0||ke<Ee||j.start<ue)break;let I=j.id>=o?4:0,Z=j.start;for(j.next();j.pos>ke;){if(j.size<0)if(j.size==-3||j.size==-4)I+=4;else break e;else j.id>=o&&(I+=4);j.next()}he=Z,se+=ve,Me+=I}return(L<0||se==H)&&(le.size=se,le.start=he,le.skip=Me),le.size>4?le:void 0}function E(H,L,j){let{id:se,start:he,end:Me,size:ue}=u;if(u.next(),ue>=0&&se<o){let le=j;if(ue>4){let Ee=u.pos-(ue-4);for(;u.pos>Ee;)j=E(H,L,j)}L[--j]=le,L[--j]=Me-H,L[--j]=he-H,L[--j]=se}else ue==-3?d=se:ue==-4&&(p=se);return j}let O=[],B=[];for(;u.pos>0;)b(n.start||0,n.bufferStart||0,O,B,-1,0);let q=(e=n.length)!==null&&e!==void 0?e:O.length?B[0]+O[0].length:0;return new hn(f[n.topID],O.reverse(),B.reverse(),q)}const Kv=new WeakMap;function Xh(n,e){if(!n.isAnonymous||e instanceof Hr||e.type!=n)return 1;let t=Kv.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof hn)){t=1;break}t+=Xh(n,i)}Kv.set(e,t)}return t}function uy(n,e,t,i,l,a,o,u,f){let d=0;for(let w=i;w<l;w++)d+=Xh(n,e[w]);let p=Math.ceil(d*1.5/8),b=[],x=[];function S(w,T,C,E,O){for(let B=C;B<E;){let q=B,H=T[B],L=Xh(n,w[B]);for(B++;B<E;B++){let j=Xh(n,w[B]);if(L+j>=p)break;L+=j}if(B==q+1){if(L>p){let j=w[q];S(j.children,j.positions,0,j.children.length,T[q]+O);continue}b.push(w[q])}else{let j=T[B-1]+w[B-1].length-H;b.push(uy(n,w,T,q,B,H,j,null,f))}x.push(H+O-a)}}return S(e,t,i,l,0),(u||f)(b,x,o)}class oz{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let l=this.map.get(e);l||this.map.set(e,l=new Map),l.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof ol?this.setBuffer(e.context.buffer,e.index,t):e instanceof ni&&this.map.set(e.tree,t)}get(e){return e instanceof ol?this.getBuffer(e.context.buffer,e.index):e instanceof ni?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Ul{constructor(e,t,i,l,a=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let l=[new Ul(0,e.length,e,0,!1,i)];for(let a of t)a.to>e.length&&l.push(a);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],a=1,o=e.length?e[0]:null;for(let u=0,f=0,d=0;;u++){let p=u<t.length?t[u]:null,b=p?p.fromA:1e9;if(b-f>=i)for(;o&&o.from<b;){let x=o;if(f>=x.from||b<=x.to||d){let S=Math.max(x.from,f)-d,w=Math.min(x.to,b)-d;x=S>=w?null:new Ul(S,w,x.tree,x.offset+d,u>0,!!p)}if(x&&l.push(x),o.to>b)break;o=a<e.length?e[a++]:null}if(!p)break;f=p.toA,d=p.toA-p.toB}return l}}class fE{startParse(e,t,i){return typeof e=="string"&&(e=new hE(e)),i=i?i.length?i.map(l=>new as(l.from,l.to)):[new as(0,0)]:[new as(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let a=l.advance();if(a)return a}}}class hE{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)}}function cz(n){return(e,t,i,l)=>new pE(e,n,t,i,l)}class Xv{constructor(e,t,i,l,a,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=l,this.target=a,this.from=o}}function Qv(n){if(!n.length||n.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class dE{constructor(e,t,i,l,a,o,u,f){this.parser=e,this.predicate=t,this.mounts=i,this.index=l,this.start=a,this.bracketed=o,this.target=u,this.prev=f,this.depth=0,this.ranges=[]}}const a0=new st({perNode:!0});class pE{constructor(e,t,i,l,a){this.nest=t,this.input=i,this.fragments=l,this.ranges=a,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let l of this.inner)l.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new hn(i.type,i.children,i.positions,i.length,i.propValues.concat([[a0,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[st.mounted.id]=new Ro(t,e.overlay,e.parser,e.bracketed),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new yE(this.fragments),t=null,i=null,l=new ad(new ni(this.baseTree,this.ranges[0].from,0,null),jt.IncludeAnonymous|jt.IgnoreMounts);e:for(let a,o;;){let u=!0,f;if(this.stoppedAt!=null&&l.from>=this.stoppedAt)u=!1;else if(e.hasNode(l)){if(t){let d=t.mounts.find(p=>p.frag.from<=l.from&&p.frag.to>=l.to&&p.mount.overlay);if(d)for(let p of d.mount.overlay){let b=p.from+d.pos,x=p.to+d.pos;b>=l.from&&x<=l.to&&!t.ranges.some(S=>S.from<x&&S.to>b)&&t.ranges.push({from:b,to:x})}}u=!1}else if(i&&(o=mE(i.ranges,l.from,l.to)))u=o!=2;else if(!l.type.isAnonymous&&(a=this.nest(l,this.input))&&(l.from<l.to||!a.overlay)){l.tree||(gE(l),t&&t.depth++,i&&i.depth++);let d=e.findMounts(l.from,a.parser);if(typeof a.overlay=="function")t=new dE(a.parser,a.overlay,d,this.inner.length,l.from,!!a.bracketed,l.tree,t);else{let p=eS(this.ranges,a.overlay||(l.from<l.to?[new as(l.from,l.to)]:[]));p.length&&Qv(p),(p.length||!a.overlay)&&this.inner.push(new Xv(a.parser,p.length?a.parser.startParse(this.input,tS(d,p),p):a.parser.startParse(""),a.overlay?a.overlay.map(b=>new as(b.from-l.from,b.to-l.from)):null,!!a.bracketed,l.tree,p.length?p[0].from:l.from)),a.overlay?p.length&&(i={ranges:p,depth:0,prev:i}):u=!1}}else if(t&&(f=t.predicate(l))&&(f===!0&&(f=new as(l.from,l.to)),f.from<f.to)){let d=t.ranges.length-1;d>=0&&t.ranges[d].to==f.from?t.ranges[d]={from:t.ranges[d].from,to:f.to}:t.ranges.push(f)}if(u&&l.firstChild())t&&t.depth++,i&&i.depth++;else for(;!l.nextSibling();){if(!l.parent())break e;if(t&&!--t.depth){let d=eS(this.ranges,t.ranges);d.length&&(Qv(d),this.inner.splice(t.index,0,new Xv(t.parser,t.parser.startParse(this.input,tS(t.mounts,d),d),t.ranges.map(p=>new as(p.from-t.start,p.to-t.start)),t.bracketed,t.target,d[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function mE(n,e,t){for(let i of n){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function Zv(n,e,t,i,l,a){if(e<t){let o=n.buffer[e+1];i.push(n.slice(e,t,o)),l.push(o-a)}}function gE(n){let{node:e}=n,t=[],i=e.context.buffer;do t.push(n.index),n.parent();while(!n.tree);let l=n.tree,a=l.children.indexOf(i),o=l.children[a],u=o.buffer,f=[a];function d(p,b,x,S,w,T){let C=t[T],E=[],O=[];Zv(o,p,C,E,O,S);let B=u[C+1],q=u[C+2];f.push(E.length);let H=T?d(C+4,u[C+3],o.set.types[u[C]],B,q-B,T-1):e.toTree();return E.push(H),O.push(B-S),Zv(o,u[C+3],b,E,O,S),new hn(x,E,O,w)}l.children[a]=d(0,u.length,Mi.none,0,o.length,t.length-1);for(let p of f){let b=n.tree.children[p],x=n.tree.positions[p];n.yield(new ni(b,x+n.from,p,n._tree))}}class Jv{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(jt.IncludeAnonymous|jt.IgnoreMounts)}moveTo(e){let{cursor:t}=this,i=e-this.offset;for(;!this.done&&t.from<i;)if(!(t.to>=e&&t.enter(i,1,jt.IgnoreOverlays|jt.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof hn)t=t.children[0];else break}return!1}}class yE{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(a0))!==null&&t!==void 0?t:i.to,this.inner=new Jv(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(a0))!==null&&e!==void 0?e:t.to,this.inner=new Jv(t.tree,-t.offset)}}findMounts(e,t){var i;let l=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let a=this.inner.cursor.node;a;a=a.parent){let o=(i=a.tree)===null||i===void 0?void 0:i.prop(st.mounted);if(o&&o.parser==t)for(let u=this.fragI;u<this.fragments.length;u++){let f=this.fragments[u];if(f.from>=a.to)break;f.tree==this.curFrag.tree&&l.push({frag:f,pos:a.from-f.offset,mount:o})}}}return l}}function eS(n,e){let t=null,i=e;for(let l=1,a=0;l<n.length;l++){let o=n[l-1].to,u=n[l].from;for(;a<i.length;a++){let f=i[a];if(f.from>=u)break;f.to<=o||(t||(i=t=e.slice()),f.from<o?(t[a]=new as(f.from,o),f.to>u&&t.splice(a+1,0,new as(u,f.to))):f.to>u?t[a--]=new as(u,f.to):t.splice(a--,1))}}return i}function bE(n,e,t,i){let l=0,a=0,o=!1,u=!1,f=-1e9,d=[];for(;;){let p=l==n.length?1e9:o?n[l].to:n[l].from,b=a==e.length?1e9:u?e[a].to:e[a].from;if(o!=u){let x=Math.max(f,t),S=Math.min(p,b,i);x<S&&d.push(new as(x,S))}if(f=Math.min(p,b),f==1e9)break;p==f&&(o?(o=!1,l++):o=!0),b==f&&(u?(u=!1,a++):u=!0)}return d}function tS(n,e){let t=[];for(let{pos:i,mount:l,frag:a}of n){let o=i+(l.overlay?l.overlay[0].from:0),u=o+l.tree.length,f=Math.max(a.from,o),d=Math.min(a.to,u);if(l.overlay){let p=l.overlay.map(x=>new as(x.from+i,x.to+i)),b=bE(e,p,f,d);for(let x=0,S=f;;x++){let w=x==b.length,T=w?d:b[x].from;if(T>S&&t.push(new Ul(S,T,l.tree,-o,a.from>=S||a.openStart,a.to<=T||a.openEnd)),w)break;S=b[x].to}}else t.push(new Ul(f,d,l.tree,-o,a.from>=o||a.openStart,a.to<=u||a.openEnd))}return t}let xE=0;class rs{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=xE++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof rs&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let l=new rs(i,[],null,[]);if(l.set.push(l),t)for(let a of t.set)l.set.push(a);return l}static defineModifier(e){let t=new od(e);return i=>i.modified.indexOf(t)>-1?i:od.get(i.base||i,i.modified.concat(t).sort((l,a)=>l.id-a.id))}}let vE=0;class od{constructor(e){this.name=e,this.instances=[],this.id=vE++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(u=>u.base==e&&SE(t,u.modified));if(i)return i;let l=[],a=new rs(e.name,l,e,t);for(let u of t)u.instances.push(a);let o=wE(t);for(let u of e.set)if(!u.modified.length)for(let f of o)l.push(od.get(u,f));return a}}function SE(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function wE(n){let e=[[]];for(let t=0;t<n.length;t++)for(let i=0,l=e.length;i<l;i++)e.push(e[i].concat(n[t]));return e.sort((t,i)=>i.length-t.length)}function kE(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let a=[],o=2,u=l;for(let b=0;;){if(u=="..."&&b>0&&b+3==l.length){o=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!x)throw new RangeError("Invalid path: "+l);if(a.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),b+=x[0].length,b==l.length)break;let S=l[b++];if(b==l.length&&S=="!"){o=0;break}if(S!="/")throw new RangeError("Invalid path: "+l);u=l.slice(b)}let f=a.length-1,d=a[f];if(!d)throw new RangeError("Invalid path: "+l);let p=new Mu(i,o,f>0?a.slice(0,f):null);e[d]=p.sort(e[d])}}return Ek.add(e)}const Ek=new st({combine(n,e){let t,i,l;for(;n||e;){if(!n||e&&n.depth>=e.depth?(l=e,e=e.next):(l=n,n=n.next),t&&t.mode==l.mode&&!l.context&&!t.context)continue;let a=new Mu(l.tags,l.mode,l.context);t?t.next=a:i=a,t=a}return i}});class Mu{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,this.next=l}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}}Mu.empty=new Mu([],2,null);function fy(n,e){let t=Object.create(null);for(let a of n)if(!Array.isArray(a.tag))t[a.tag.id]=a.class;else for(let o of a.tag)t[o.id]=a.class;let{scope:i,all:l=null}=e||{};return{style:a=>{let o=l;for(let u of a)for(let f of u.set){let d=t[f.id];if(d){o=o?o+" "+d:d;break}}return o},scope:i}}function AE(n,e){let t=null;for(let i of n){let l=i.style(e);l&&(t=t?t+" "+l:l)}return t}function Nk(n,e,t,i=0,l=n.length){let a=new TE(i,Array.isArray(e)?e:[e],t);a.highlightRange(n.cursor(),i,l,"",a.highlighters),a.flush(l)}function CE(n,e,t,i,l,a=0,o=n.length){let u=a;function f(d,p){if(!(d<=u)){for(let b=n.slice(u,d),x=0;;){let S=b.indexOf(`
116
- `,x),w=S<0?b.length:S;if(w>x&&i(b.slice(x,w),p),S<0)break;l(),x=S+1}u=d}}Nk(e,t,(d,p,b)=>{f(d,""),f(p,b)},a,o),f(o,"")}class TE{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,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,i,l,a){let{type:o,from:u,to:f}=e;if(u>=i||f<=t)return;o.isTop&&(a=this.highlighters.filter(S=>!S.scope||S.scope(o)));let d=l,p=_E(e)||Mu.empty,b=AE(a,p.tags);if(b&&(d&&(d+=" "),d+=b,p.mode==1&&(l+=(l?" ":"")+b)),this.startSpan(Math.max(t,u),d),p.opaque)return;let x=e.tree&&e.tree.prop(st.mounted);if(x&&x.overlay){let S=e.node.enter(x.overlay[0].from+u,1),w=this.highlighters.filter(C=>!C.scope||C.scope(x.tree.type)),T=e.firstChild();for(let C=0,E=u;;C++){let O=C<x.overlay.length?x.overlay[C]:null,B=O?O.from+u:f,q=Math.max(t,E),H=Math.min(i,B);if(q<H&&T)for(;e.from<H&&(this.highlightRange(e,q,H,l,a),this.startSpan(Math.min(H,e.to),d),!(e.to>=B||!e.nextSibling())););if(!O||B>i)break;E=O.to+u,E>t&&(this.highlightRange(S.cursor(),Math.max(t,O.from+u),Math.min(i,E),"",w),this.startSpan(Math.min(i,E),d))}T&&e.parent()}else if(e.firstChild()){x&&(l="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,l,a),this.startSpan(Math.min(i,e.to),d)}while(e.nextSibling());e.parent()}}}function _E(n){let e=n.type.prop(Ek);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const me=rs.define,kh=me(),Mr=me(),nS=me(Mr),iS=me(Mr),Er=me(),Ah=me(Er),yg=me(Er),nl=me(),ma=me(nl),Qs=me(),Zs=me(),o0=me(),cu=me(o0),Ch=me(),Y={comment:kh,lineComment:me(kh),blockComment:me(kh),docComment:me(kh),name:Mr,variableName:me(Mr),typeName:nS,tagName:me(nS),propertyName:iS,attributeName:me(iS),className:me(Mr),labelName:me(Mr),namespace:me(Mr),macroName:me(Mr),literal:Er,string:Ah,docString:me(Ah),character:me(Ah),attributeValue:me(Ah),number:yg,integer:me(yg),float:me(yg),bool:me(Er),regexp:me(Er),escape:me(Er),color:me(Er),url:me(Er),keyword:Qs,self:me(Qs),null:me(Qs),atom:me(Qs),unit:me(Qs),modifier:me(Qs),operatorKeyword:me(Qs),controlKeyword:me(Qs),definitionKeyword:me(Qs),moduleKeyword:me(Qs),operator:Zs,derefOperator:me(Zs),arithmeticOperator:me(Zs),logicOperator:me(Zs),bitwiseOperator:me(Zs),compareOperator:me(Zs),updateOperator:me(Zs),definitionOperator:me(Zs),typeOperator:me(Zs),controlOperator:me(Zs),punctuation:o0,separator:me(o0),bracket:cu,angleBracket:me(cu),squareBracket:me(cu),paren:me(cu),brace:me(cu),content:nl,heading:ma,heading1:me(ma),heading2:me(ma),heading3:me(ma),heading4:me(ma),heading5:me(ma),heading6:me(ma),contentSeparator:me(nl),list:me(nl),quote:me(nl),emphasis:me(nl),strong:me(nl),link:me(nl),monospace:me(nl),strikethrough:me(nl),inserted:me(),deleted:me(),changed:me(),invalid:me(),meta:Ch,documentMeta:me(Ch),annotation:me(Ch),processingInstruction:me(Ch),definition:rs.defineModifier("definition"),constant:rs.defineModifier("constant"),function:rs.defineModifier("function"),standard:rs.defineModifier("standard"),local:rs.defineModifier("local"),special:rs.defineModifier("special")};for(let n in Y){let e=Y[n];e instanceof rs&&(e.name=n)}fy([{tag:Y.link,class:"tok-link"},{tag:Y.heading,class:"tok-heading"},{tag:Y.emphasis,class:"tok-emphasis"},{tag:Y.strong,class:"tok-strong"},{tag:Y.keyword,class:"tok-keyword"},{tag:Y.atom,class:"tok-atom"},{tag:Y.bool,class:"tok-bool"},{tag:Y.url,class:"tok-url"},{tag:Y.labelName,class:"tok-labelName"},{tag:Y.inserted,class:"tok-inserted"},{tag:Y.deleted,class:"tok-deleted"},{tag:Y.literal,class:"tok-literal"},{tag:Y.string,class:"tok-string"},{tag:Y.number,class:"tok-number"},{tag:[Y.regexp,Y.escape,Y.special(Y.string)],class:"tok-string2"},{tag:Y.variableName,class:"tok-variableName"},{tag:Y.local(Y.variableName),class:"tok-variableName tok-local"},{tag:Y.definition(Y.variableName),class:"tok-variableName tok-definition"},{tag:Y.special(Y.variableName),class:"tok-variableName2"},{tag:Y.definition(Y.propertyName),class:"tok-propertyName tok-definition"},{tag:Y.typeName,class:"tok-typeName"},{tag:Y.namespace,class:"tok-namespace"},{tag:Y.className,class:"tok-className"},{tag:Y.macroName,class:"tok-macroName"},{tag:Y.propertyName,class:"tok-propertyName"},{tag:Y.operator,class:"tok-operator"},{tag:Y.comment,class:"tok-comment"},{tag:Y.meta,class:"tok-meta"},{tag:Y.invalid,class:"tok-invalid"},{tag:Y.punctuation,class:"tok-punctuation"}]);const ME="modulepreload",EE=function(n,e){return new URL(n,e).href},sS={},ct=function(e,t,i){let l=Promise.resolve();if(t&&t.length>0){let o=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const u=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),d=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=o(t.map(p=>{if(p=EE(p,i),p in sS)return;sS[p]=!0;const b=p.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let T=u.length-1;T>=0;T--){const C=u[T];if(C.href===p&&(!b||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${p}"]${x}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":ME,b||(w.as="script"),w.crossOrigin="",w.href=p,d&&w.setAttribute("nonce",d),document.head.appendChild(w),b)return new Promise((T,C)=>{w.addEventListener("load",T),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function a(o){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=o,window.dispatchEvent(u),!u.defaultPrevented)throw o}return l.then(o=>{for(const u of o||[])u.status==="rejected"&&a(u.reason);return e().catch(a)})};let c0=[],Dk=[];(()=>{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?Dk:c0).push(t=t+n[e])})();function NE(n){if(n<768)return!1;for(let e=0,t=c0.length;;){let i=e+t>>1;if(n<c0[i])t=i;else if(n>=Dk[i])e=i+1;else return!0;if(e==t)return!1}}function lS(n){return n>=127462&&n<=127487}const rS=8205;function DE(n,e,t=!0,i=!0){return(t?Ok:OE)(n,e,i)}function Ok(n,e,t){if(e==n.length)return e;e&&Rk(n.charCodeAt(e))&&jk(n.charCodeAt(e-1))&&e--;let i=bg(n,e);for(e+=aS(i);e<n.length;){let l=bg(n,e);if(i==rS||l==rS||t&&NE(l))e+=aS(l),i=l;else if(lS(l)){let a=0,o=e-2;for(;o>=0&&lS(bg(n,o));)a++,o-=2;if(a%2==0)break;e+=2}else break}return e}function OE(n,e,t){for(;e>1;){let i=Ok(n,e-2,t);if(i<e)return i;e--}return 0}function bg(n,e){let t=n.charCodeAt(e);if(!jk(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Rk(i)?(t-55296<<10)+(i-56320)+65536:t}function Rk(n){return n>=56320&&n<57344}function jk(n){return n>=55296&&n<56320}function aS(n){return n<65536?1:2}class ft{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,i){[e,t]=Xo(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),ll.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Xo(this,e,t);let i=[];return this.decompose(e,t,i,0),ll.from(i,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),i=this.length-this.scanIdentical(e,-1),l=new Su(this),a=new Su(e);for(let o=t,u=t;;){if(l.next(o),a.next(o),o=0,l.lineBreak!=a.lineBreak||l.done!=a.done||l.value!=a.value)return!1;if(u+=l.value.length,l.done||u>=i)return!0}}iter(e=1){return new Su(this,e)}iterRange(e,t=this.length){return new Lk(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Bk(i)}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]?ft.empty:e.length<=32?new sn(e):ll.from(sn.split(e,[]))}}class sn extends ft{constructor(e,t=RE(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let a=0;;a++){let o=this.text[a],u=l+o.length;if((t?i:u)>=e)return new jE(l,u,i,o);l=u+1,i++}}decompose(e,t,i,l){let a=e<=0&&t>=this.length?this:new sn(oS(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let o=i.pop(),u=Qh(a.text,o.text.slice(),0,a.length);if(u.length<=32)i.push(new sn(u,o.length+a.length));else{let f=u.length>>1;i.push(new sn(u.slice(0,f)),new sn(u.slice(f)))}}else i.push(a)}replace(e,t,i){if(!(i instanceof sn))return super.replace(e,t,i);[e,t]=Xo(this,e,t);let l=Qh(this.text,Qh(i.text,oS(this.text,0,e)),t),a=this.length+i.length-(t-e);return l.length<=32?new sn(l,a):ll.from(sn.split(l,[]),a)}sliceString(e,t=this.length,i=`
117
- `){[e,t]=Xo(this,e,t);let l="";for(let a=0,o=0;a<=t&&o<this.text.length;o++){let u=this.text[o],f=a+u.length;a>e&&o&&(l+=i),e<f&&t>a&&(l+=u.slice(Math.max(0,e-a),t-a)),a=f+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],l=-1;for(let a of e)i.push(a),l+=a.length+1,i.length==32&&(t.push(new sn(i,l)),i=[],l=-1);return l>-1&&t.push(new sn(i,l)),t}}class ll extends ft{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,l){for(let a=0;;a++){let o=this.children[a],u=l+o.length,f=i+o.lines-1;if((t?f:u)>=e)return o.lineInner(e,t,i,l);l=u+1,i=f+1}}decompose(e,t,i,l){for(let a=0,o=0;o<=t&&a<this.children.length;a++){let u=this.children[a],f=o+u.length;if(e<=f&&t>=o){let d=l&((o<=e?1:0)|(f>=t?2:0));o>=e&&f<=t&&!d?i.push(u):u.decompose(e-o,t-o,i,d)}o=f+1}}replace(e,t,i){if([e,t]=Xo(this,e,t),i.lines<this.lines)for(let l=0,a=0;l<this.children.length;l++){let o=this.children[l],u=a+o.length;if(e>=a&&t<=u){let f=o.replace(e-a,t-a,i),d=this.lines-o.lines+f.lines;if(f.lines<d>>4&&f.lines>d>>6){let p=this.children.slice();return p[l]=f,new ll(p,this.length-(t-e)+i.length)}return super.replace(a,u,f)}a=u+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
118
- `){[e,t]=Xo(this,e,t);let l="";for(let a=0,o=0;a<this.children.length&&o<=t;a++){let u=this.children[a],f=o+u.length;o>e&&a&&(l+=i),e<f&&t>o&&(l+=u.sliceString(e-o,t-o,i)),o=f+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ll))return 0;let i=0,[l,a,o,u]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,a+=t){if(l==o||a==u)return i;let f=this.children[l],d=e.children[a];if(f!=d)return i+f.scanIdentical(d,t);i+=f.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let S of e)i+=S.lines;if(i<32){let S=[];for(let w of e)w.flatten(S);return new sn(S,t)}let l=Math.max(32,i>>5),a=l<<1,o=l>>1,u=[],f=0,d=-1,p=[];function b(S){let w;if(S.lines>a&&S instanceof ll)for(let T of S.children)b(T);else S.lines>o&&(f>o||!f)?(x(),u.push(S)):S instanceof sn&&f&&(w=p[p.length-1])instanceof sn&&S.lines+w.lines<=32?(f+=S.lines,d+=S.length+1,p[p.length-1]=new sn(w.text.concat(S.text),w.length+1+S.length)):(f+S.lines>l&&x(),f+=S.lines,d+=S.length+1,p.push(S))}function x(){f!=0&&(u.push(p.length==1?p[0]:ll.from(p,d)),d=-1,f=p.length=0)}for(let S of e)b(S);return x(),u.length==1?u[0]:new ll(u,t)}}ft.empty=new sn([""],0);function RE(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Qh(n,e,t=0,i=1e9){for(let l=0,a=0,o=!0;a<n.length&&l<=i;a++){let u=n[a],f=l+u.length;f>=t&&(f>i&&(u=u.slice(0,i-l)),l<t&&(u=u.slice(t-l)),o?(e[e.length-1]+=u,o=!1):e.push(u)),l=f+1}return e}function oS(n,e,t){return Qh(n,[""],e,t)}class Su{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 sn?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],a=this.offsets[i],o=a>>1,u=l instanceof sn?l.text.length:l.children.length;if(o==(t>0?u:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
119
- `,this;e--}else if(l instanceof sn){let f=l.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,f.length>Math.max(0,e))return this.value=e==0?f:t>0?f.slice(e):f.slice(0,f.length-e),this;e-=f.length}else{let f=l.children[o+(t<0?-1:0)];e>f.length?(e-=f.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(f),this.offsets.push(t>0?1:(f instanceof sn?f.text.length:f.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Lk{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Su(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}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 i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),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 Bk{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ft.prototype[Symbol.iterator]=function(){return this.iter()},Su.prototype[Symbol.iterator]=Lk.prototype[Symbol.iterator]=Bk.prototype[Symbol.iterator]=function(){return this});class jE{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function Xo(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function On(n,e,t=!0,i=!0){return DE(n,e,t,i)}function LE(n){return n>=56320&&n<57344}function BE(n){return n>=55296&&n<56320}function ki(n,e){let t=n.charCodeAt(e);if(!BE(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return LE(i)?(t-55296<<10)+(i-56320)+65536:t}function hy(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function rl(n){return n<65536?1:2}const u0=/\r\n?|\n/;var qn=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(qn||(qn={}));class hl{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 i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,l=0;t<this.sections.length;){let a=this.sections[t++],o=this.sections[t++];o<0?(e(i,l,a),l+=a):l+=o,i+=a}}iterChangedRanges(e,t=!1){f0(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];l<0?e.push(i,l):e.push(l,i)}return new hl(e)}composeDesc(e){return this.empty?e:e.empty?this:zk(this,e)}mapDesc(e,t=!1){return e.empty?this:h0(this,e,t)}mapPos(e,t=-1,i=qn.Simple){let l=0,a=0;for(let o=0;o<this.sections.length;){let u=this.sections[o++],f=this.sections[o++],d=l+u;if(f<0){if(d>e)return a+(e-l);a+=u}else{if(i!=qn.Simple&&d>=e&&(i==qn.TrackDel&&l<e&&d>e||i==qn.TrackBefore&&l<e||i==qn.TrackAfter&&d>e))return null;if(d>e||d==e&&t<0&&!u)return e==l||t<0?a:a+f;a+=f}l=d}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return a}touchesRange(e,t=e){for(let i=0,l=0;i<this.sections.length&&l<=t;){let a=this.sections[i++],o=this.sections[i++],u=l+a;if(o>=0&&l<=t&&u>=e)return l<e&&u>t?"cover":!0;l=u}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+i+(l>=0?":"+l:"")}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 hl(e)}static create(e){return new hl(e)}}class bn extends hl{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 f0(this,(t,i,l,a,o)=>e=e.replace(l,l+(i-t),o),!1),e}mapDesc(e,t=!1){return h0(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,a=0;l<t.length;l+=2){let o=t[l],u=t[l+1];if(u>=0){t[l]=u,t[l+1]=o;let f=l>>1;for(;i.length<f;)i.push(ft.empty);i.push(o?e.slice(a,a+o):ft.empty)}a+=o}return new bn(t,i)}compose(e){return this.empty?e:e.empty?this:zk(this,e,!0)}map(e,t=!1){return e.empty?this:h0(this,e,t,!0)}iterChanges(e,t=!1){f0(this,e,t)}get desc(){return hl.create(this.sections)}filter(e){let t=[],i=[],l=[],a=new Eu(this);e:for(let o=0,u=0;;){let f=o==e.length?1e9:e[o++];for(;u<f||u==f&&a.len==0;){if(a.done)break e;let p=Math.min(a.len,f-u);ei(l,p,-1);let b=a.ins==-1?-1:a.off==0?a.ins:0;ei(t,p,b),b>0&&Br(i,t,a.text),a.forward(p),u+=p}let d=e[o++];for(;u<d;){if(a.done)break e;let p=Math.min(a.len,d-u);ei(t,p,-1),ei(l,p,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(p),u+=p}}return{changes:new bn(t,i),filtered:hl.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],l=this.sections[t+1];l<0?e.push(i):l==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let l=[],a=[],o=0,u=null;function f(p=!1){if(!p&&!l.length)return;o<t&&ei(l,t-o,-1);let b=new bn(l,a);u=u?u.compose(b.map(u)):b,l=[],a=[],o=0}function d(p){if(Array.isArray(p))for(let b of p)d(b);else if(p instanceof bn){if(p.length!=t)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${t})`);f(),u=u?u.compose(p.map(u)):p}else{let{from:b,to:x=b,insert:S}=p;if(b>x||b<0||x>t)throw new RangeError(`Invalid change range ${b} to ${x} (in doc of length ${t})`);let w=S?typeof S=="string"?ft.of(S.split(i||u0)):S:ft.empty,T=w.length;if(b==x&&T==0)return;b<o&&f(),b>o&&ei(l,b-o,-1),ei(l,x-b,T),Br(a,l,w),o=x}}return d(e),f(!u),u}static empty(e){return new bn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;l<e.length;l++){let a=e[l];if(typeof a=="number")t.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,u)=>u&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)t.push(a[0],0);else{for(;i.length<l;)i.push(ft.empty);i[l]=ft.of(a.slice(1)),t.push(a[0],i[l].length)}}}return new bn(t,i)}static createSet(e,t){return new bn(e,t)}}function ei(n,e,t,i=!1){if(e==0&&t<=0)return;let l=n.length-2;l>=0&&t<=0&&t==n[l+1]?n[l]+=e:l>=0&&e==0&&n[l]==0?n[l+1]+=t:i?(n[l]+=e,n[l+1]+=t):n.push(e,t)}function Br(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(ft.empty);n.push(t)}}function f0(n,e,t){let i=n.inserted;for(let l=0,a=0,o=0;o<n.sections.length;){let u=n.sections[o++],f=n.sections[o++];if(f<0)l+=u,a+=u;else{let d=l,p=a,b=ft.empty;for(;d+=u,p+=f,f&&i&&(b=b.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)u=n.sections[o++],f=n.sections[o++];e(l,d,a,p,b),l=d,a=p}}}function h0(n,e,t,i=!1){let l=[],a=i?[]:null,o=new Eu(n),u=new Eu(e);for(let f=-1;;){if(o.done&&u.len||u.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&u.ins==-1){let d=Math.min(o.len,u.len);ei(l,d,-1),o.forward(d),u.forward(d)}else if(u.ins>=0&&(o.ins<0||f==o.i||o.off==0&&(u.len<o.len||u.len==o.len&&!t))){let d=u.len;for(ei(l,u.ins,-1);d;){let p=Math.min(o.len,d);o.ins>=0&&f<o.i&&o.len<=p&&(ei(l,0,o.ins),a&&Br(a,l,o.text),f=o.i),o.forward(p),d-=p}u.next()}else if(o.ins>=0){let d=0,p=o.len;for(;p;)if(u.ins==-1){let b=Math.min(p,u.len);d+=b,p-=b,u.forward(b)}else if(u.ins==0&&u.len<p)p-=u.len,u.next();else break;ei(l,d,f<o.i?o.ins:0),a&&f<o.i&&Br(a,l,o.text),f=o.i,o.forward(o.len-p)}else{if(o.done&&u.done)return a?bn.createSet(l,a):hl.create(l);throw new Error("Mismatched change set lengths")}}}function zk(n,e,t=!1){let i=[],l=t?[]:null,a=new Eu(n),o=new Eu(e);for(let u=!1;;){if(a.done&&o.done)return l?bn.createSet(i,l):hl.create(i);if(a.ins==0)ei(i,a.len,0,u),a.next();else if(o.len==0&&!o.done)ei(i,0,o.ins,u),l&&Br(l,i,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let f=Math.min(a.len2,o.len),d=i.length;if(a.ins==-1){let p=o.ins==-1?-1:o.off?0:o.ins;ei(i,f,p,u),l&&p&&Br(l,i,o.text)}else o.ins==-1?(ei(i,a.off?0:a.len,f,u),l&&Br(l,i,a.textBit(f))):(ei(i,a.off?0:a.len,o.off?0:o.ins,u),l&&!o.off&&Br(l,i,o.text));u=(a.ins>f||o.ins>=0&&o.len>f)&&(u||i.length>d),a.forward2(f),o.forward(f)}}}}class Eu{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?ft.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?ft.empty:t[i].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 Or{constructor(e,t,i,l){this.from=e,this.to=t,this.flags=i,this.goalColumn=l}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new Or(i,l,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return X.range(e,t,void 0,void 0,i);let l=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return X.range(this.anchor,l,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return X.range(e.anchor,e.head)}static create(e,t,i,l){return new Or(e,t,i,l)}}class X{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:X.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new X([this.main],0)}addRange(e,t=!0){return X.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,X.create(i,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 X(e.ranges.map(t=>Or.fromJSON(t)),e.main)}static single(e,t=e){return new X([X.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 i=0,l=0;l<e.length;l++){let a=e[l];if(a.empty?a.from<=i:a.from<i)return X.normalized(e.slice(),t);i=a.to}return new X(e,t)}static cursor(e,t=0,i,l){return Or.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i)),l)}static range(e,t,i,l,a){let o=l==null?7:Math.min(6,l);return!a&&e!=t&&(a=t<e?1:-1),a&&(o|=a<0?8:16),t<e?Or.create(t,e,o|32,i):Or.create(e,t,o,i)}static undirectionalRange(e,t){return Or.create(e,t,64,void 0)}static normalized(e,t=0){let i=e[t];e.sort((l,a)=>l.from-a.from),t=e.indexOf(i);for(let l=1;l<e.length;l++){let a=e[l],o=e[l-1];if(a.empty?a.from<=o.to:a.from<o.to){let u=o.from,f=Math.max(a.to,o.to);l<=t&&t--,e.splice(--l,2,a.anchor>a.head?X.range(f,u):X.range(u,f))}}return new X(e,t)}}function Hk(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let dy=0;class be{constructor(e,t,i,l,a){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=dy++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new be(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:py),!!e.static,e.enables)}of(e){return new Zh([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zh(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zh(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function py(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Zh{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=dy++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,a=this.id,o=e[a]>>1,u=this.type==2,f=!1,d=!1,p=[];for(let b of this.dependencies)b=="doc"?f=!0:b=="selection"?d=!0:(((t=e[b.id])!==null&&t!==void 0?t:1)&1)==0&&p.push(e[b.id]);return{create(b){return b.values[o]=i(b),1},update(b,x){if(f&&x.docChanged||d&&(x.docChanged||x.selection)||d0(b,p)){let S=i(b);if(u?!cS(S,b.values[o],l):!l(S,b.values[o]))return b.values[o]=S,1}return 0},reconfigure:(b,x)=>{let S,w=x.config.address[a];if(w!=null){let T=ud(x,w);if(this.dependencies.every(C=>C instanceof be?x.facet(C)===b.facet(C):C instanceof Wn?x.field(C,!1)==b.field(C,!1):!0)||(u?cS(S=i(b),T,l):l(S=i(b),T)))return b.values[o]=T,0}else S=i(b);return b.values[o]=S,1}}}get extension(){return this}}function cS(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function d0(n,e){let t=!1;for(let i of e)wu(n,i)&1&&(t=!0);return t}function zE(n,e,t){let i=t.map(f=>n[f.id]),l=t.map(f=>f.type),a=i.filter(f=>!(f&1)),o=n[e.id]>>1;function u(f){let d=[];for(let p=0;p<i.length;p++){let b=ud(f,i[p]);if(l[p]==2)for(let x of b)d.push(x);else d.push(b)}return e.combine(d)}return{create(f){for(let d of i)wu(f,d);return f.values[o]=u(f),1},update(f,d){if(!d0(f,a))return 0;let p=u(f);return e.compare(p,f.values[o])?0:(f.values[o]=p,1)},reconfigure(f,d){let p=d0(f,i),b=d.config.facets[e.id],x=d.facet(e);if(b&&!p&&py(t,b))return f.values[o]=x,0;let S=u(f);return e.compare(S,x)?(f.values[o]=x,0):(f.values[o]=S,1)}}}const Th=be.define({static:!0});class Wn{constructor(e,t,i,l,a){this.id=e,this.createF=t,this.updateF=i,this.compareF=l,this.spec=a,this.provides=void 0}static define(e){let t=new Wn(dy++,e.create,e.update,e.compare||((i,l)=>i===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Th).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let a=i.values[t],o=this.updateF(a,l);return this.compareF(a,o)?0:(i.values[t]=o,1)},reconfigure:(i,l)=>{let a=i.facet(Th),o=l.facet(Th),u;return(u=a.find(f=>f.field==this))&&u!=o.find(f=>f.field==this)?(i.values[t]=u.create(i),1):l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Th.of({field:this,create:e})]}get extension(){return this}}const va={lowest:4,low:3,default:2,high:1,highest:0};function uu(n){return e=>new Ik(e,n)}const Yl={highest:uu(va.highest),high:uu(va.high),default:uu(va.default),low:uu(va.low),lowest:uu(va.lowest)};class Ik{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Fu{of(e){return new p0(this,e)}reconfigure(e){return Fu.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class p0{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class cd{constructor(e,t,i,l,a,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.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,i){let l=[],a=Object.create(null),o=new Map;for(let x of HE(e,t,o))x instanceof Wn?l.push(x):(a[x.facet.id]||(a[x.facet.id]=[])).push(x);let u=Object.create(null),f=[],d=[];for(let x of l)u[x.id]=d.length<<1,d.push(S=>x.slot(S));let p=i==null?void 0:i.config.facets;for(let x in a){let S=a[x],w=S[0].facet,T=p&&p[x]||[];if(S.every(C=>C.type==0))if(u[w.id]=f.length<<1|1,py(T,S))f.push(i.facet(w));else{let C=w.combine(S.map(E=>E.value));f.push(i&&w.compare(C,i.facet(w))?i.facet(w):C)}else{for(let C of S)C.type==0?(u[C.id]=f.length<<1|1,f.push(C.value)):(u[C.id]=d.length<<1,d.push(E=>C.dynamicSlot(E)));u[w.id]=d.length<<1,d.push(C=>zE(C,w,S))}}let b=d.map(x=>x(u));return new cd(e,o,b,u,f,a)}}function HE(n,e,t){let i=[[],[],[],[],[]],l=new Map;function a(o,u){let f=l.get(o);if(f!=null){if(f<=u)return;let d=i[f].indexOf(o);d>-1&&i[f].splice(d,1),o instanceof p0&&t.delete(o.compartment)}if(l.set(o,u),Array.isArray(o))for(let d of o)a(d,u);else if(o instanceof p0){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(o.compartment)||o.inner;t.set(o.compartment,d),a(d,u)}else if(o instanceof Ik)a(o.inner,o.prec);else if(o instanceof Wn)i[u].push(o),o.provides&&a(o.provides,u);else if(o instanceof Zh)i[u].push(o),o.facet.extensions&&a(o.facet.extensions,va.default);else{let d=o.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(d==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(d,u)}}return a(n,va.default),i.reduce((o,u)=>o.concat(u))}function wu(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let l=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|l}function ud(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Uk=be.define(),m0=be.define({combine:n=>n.some(e=>e),static:!0}),Vk=be.define({combine:n=>n.length?n[0]:void 0,static:!0}),qk=be.define(),Gk=be.define(),Pk=be.define(),Yk=be.define({combine:n=>n.length?n[0]:!1});class Fl{constructor(e,t){this.type=e,this.value=t}static define(){return new IE}}class IE{of(e){return new Fl(this,e)}}class UE{constructor(e){this.map=e}of(e){return new Ge(this,e)}}class Ge{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 Ge(this.type,t)}is(e){return this.type==e}static define(e={}){return new UE(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let a=l.map(t);a&&i.push(a)}return i}}Ge.reconfigure=Ge.define();Ge.appendConfig=Ge.define();class dn{constructor(e,t,i,l,a,o){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Hk(i,t.newLength),a.some(u=>u.type==dn.time)||(this.annotations=a.concat(dn.time.of(Date.now())))}static create(e,t,i,l,a,o){return new dn(e,t,i,l,a,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(dn.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}dn.time=Fl.define();dn.userEvent=Fl.define();dn.addToHistory=Fl.define();dn.remote=Fl.define();function VE(n,e){let t=[];for(let i=0,l=0;;){let a,o;if(i<n.length&&(l==e.length||e[l]>=n[i]))a=n[i++],o=n[i++];else if(l<e.length)a=e[l++],o=e[l++];else return t;!t.length||t[t.length-1]<a?t.push(a,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Fk(n,e,t){var i;let l,a,o;return t?(l=e.changes,a=bn.empty(e.changes.length),o=n.changes.compose(e.changes)):(l=e.changes.map(n.changes),a=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(l)),{changes:o,selection:e.selection?e.selection.map(a):(i=n.selection)===null||i===void 0?void 0:i.map(l),effects:Ge.mapEffects(n.effects,l).concat(Ge.mapEffects(e.effects,a)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function g0(n,e,t){let i=e.selection,l=jo(e.annotations);return e.userEvent&&(l=l.concat(dn.userEvent.of(e.userEvent))),{changes:e.changes instanceof bn?e.changes:bn.of(e.changes||[],t,n.facet(Vk)),selection:i&&(i instanceof X?i:X.single(i.anchor,i.head)),effects:jo(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function Wk(n,e,t){let i=g0(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(t=!1);let o=!!e[a].sequential;i=Fk(i,g0(n,e[a],o?i.changes.newLength:n.doc.length),o)}let l=dn.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return GE(t?qE(l):l)}function qE(n){let e=n.startState,t=!0;for(let l of e.facet(qk)){let a=l(n);if(a===!1){t=!1;break}Array.isArray(a)&&(t=t===!0?a:VE(t,a))}if(t!==!0){let l,a;if(t===!1)a=n.changes.invertedDesc,l=bn.empty(e.doc.length);else{let o=n.changes.filter(t);l=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}n=dn.create(e,l,n.selection&&n.selection.map(a),Ge.mapEffects(n.effects,a),n.annotations,n.scrollIntoView)}let i=e.facet(Gk);for(let l=i.length-1;l>=0;l--){let a=i[l](n);a instanceof dn?n=a:Array.isArray(a)&&a.length==1&&a[0]instanceof dn?n=a[0]:n=Wk(e,jo(a),!1)}return n}function GE(n){let e=n.startState,t=e.facet(Pk),i=n;for(let l=t.length-1;l>=0;l--){let a=t[l](n);a&&Object.keys(a).length&&(i=Fk(i,g0(e,a,n.changes.newLength),!0))}return i==n?n:dn.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const PE=[];function jo(n){return n==null?PE:Array.isArray(n)?n:[n]}var Yt=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Yt||(Yt={}));const YE=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let y0;try{y0=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function FE(n){if(y0)return y0.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||YE.test(t)))return!0}return!1}function WE(n){return e=>{if(!/\S/.test(e))return Yt.Space;if(FE(e))return Yt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Yt.Word;return Yt.Other}}class dt{constructor(e,t,i,l,a,o){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let u=0;u<this.config.dynamicSlots.length;u++)wu(this,u<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return wu(this,i),ud(this,i)}update(...e){return Wk(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:l}=t;for(let u of e.effects)u.is(Fu.reconfigure)?(t&&(l=new Map,t.compartments.forEach((f,d)=>l.set(d,f)),t=null),l.set(u.value.compartment,u.value.extension)):u.is(Ge.reconfigure)?(t=null,i=u.value):u.is(Ge.appendConfig)&&(t=null,i=jo(i).concat(u.value));let a;t?a=e.startState.values.slice():(t=cd.resolve(i,l,this),a=new dt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(f,d)=>d.reconfigure(f,this),null).values);let o=e.startState.facet(m0)?e.newSelection:e.newSelection.asSingle();new dt(t,e.newDoc,o,a,(u,f)=>f.update(u,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:X.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),a=[i.range],o=jo(i.effects);for(let u=1;u<t.ranges.length;u++){let f=e(t.ranges[u]),d=this.changes(f.changes),p=d.map(l);for(let x=0;x<u;x++)a[x]=a[x].map(p);let b=l.mapDesc(d,!0);a.push(f.range.map(b)),l=l.compose(p),o=Ge.mapEffects(o,p).concat(Ge.mapEffects(jo(f.effects),b))}return{changes:l,selection:X.create(a,t.mainIndex),effects:o}}changes(e=[]){return e instanceof bn?e:bn.of(e,this.doc.length,this.facet(dt.lineSeparator))}toText(e){return ft.of(e.split(this.facet(dt.lineSeparator)||u0))}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:(wu(this,t),ud(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let l=e[i];l instanceof Wn&&this.config.address[l.id]!=null&&(t[i]=l.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(i){for(let a in i)if(Object.prototype.hasOwnProperty.call(e,a)){let o=i[a],u=e[a];l.push(o.init(f=>o.spec.fromJSON(u,f)))}}return dt.create({doc:e.doc,selection:X.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=cd.resolve(e.extensions||[],new Map),i=e.doc instanceof ft?e.doc:ft.of((e.doc||"").split(t.staticFacet(dt.lineSeparator)||u0)),l=e.selection?e.selection instanceof X?e.selection:X.single(e.selection.anchor,e.selection.head):X.single(0);return Hk(l,i.length),t.staticFacet(m0)||(l=l.asSingle()),new dt(t,i,l,t.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(dt.tabSize)}get lineBreak(){return this.facet(dt.lineSeparator)||`
120
- `}get readOnly(){return this.facet(Yk)}phrase(e,...t){for(let i of this.facet(dt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let a=+(l||1);return!a||a>t.length?i:t[a-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let a of this.facet(Uk))for(let o of a(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&l.push(o[e]);return l}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return WE(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),a=this.charCategorizer(e),o=e-i,u=e-i;for(;o>0;){let f=On(t,o,!1);if(a(t.slice(f,o))!=Yt.Word)break;o=f}for(;u<l;){let f=On(t,u);if(a(t.slice(u,f))!=Yt.Word)break;u=f}return o==u?null:X.range(o+i,u+i)}}dt.allowMultipleSelections=m0;dt.tabSize=be.define({combine:n=>n.length?n[0]:4});dt.lineSeparator=Vk;dt.readOnly=Yk;dt.phrases=be.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(l=>n[l]==e[l])}});dt.languageData=Uk;dt.changeFilter=qk;dt.transactionFilter=Gk;dt.transactionExtender=Pk;Fu.reconfigure=Ge.define();function dl(n,e,t={}){let i={};for(let l of n)for(let a of Object.keys(l)){let o=l[a],u=i[a];if(u===void 0)i[a]=o;else if(!(u===o||o===void 0))if(Object.hasOwnProperty.call(t,a))i[a]=t[a](u,o);else throw new Error("Config merge conflict for field "+a)}for(let l in e)i[l]===void 0&&(i[l]=e[l]);return i}class Ir{eq(e){return this==e}range(e,t=e){return Nu.create(e,t,this)}}Ir.prototype.startSide=Ir.prototype.endSide=0;Ir.prototype.point=!1;Ir.prototype.mapMode=qn.TrackDel;function my(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}class Nu{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Nu(e,t,i)}}function b0(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class gy{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,l=0){let a=i?this.to:this.from;for(let o=l,u=a.length;;){if(o==u)return o;let f=o+u>>1,d=a[f]-e||(i?this.value[f].endSide:this.value[f].startSide)-t;if(f==o)return d>=0?o:u;d>=0?u=f:o=f+1}}between(e,t,i,l){for(let a=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,a);a<o;a++)if(l(this.from[a]+e,this.to[a]+e,this.value[a])===!1)return!1}map(e,t){let i=[],l=[],a=[],o=-1,u=-1;for(let f=0;f<this.value.length;f++){let d=this.value[f],p=this.from[f]+e,b=this.to[f]+e,x,S;if(p==b){let w=t.mapPos(p,d.startSide,d.mapMode);if(w==null||(x=S=w,d.startSide!=d.endSide&&(S=t.mapPos(p,d.endSide),S<x)))continue}else if(x=t.mapPos(p,d.startSide),S=t.mapPos(b,d.endSide),x>S||x==S&&d.startSide>0&&d.endSide<=0)continue;(S-x||d.endSide-d.startSide)<0||(o<0&&(o=x),d.point&&(u=Math.max(u,S-x)),i.push(d),l.push(x-o),a.push(S-o))}return{mapped:i.length?new gy(l,a,i,u):null,pos:o}}}class it{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new it(e,t,i,l)}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:i=!1,filterFrom:l=0,filterTo:a=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(b0)),this.isEmpty)return t.length?it.of(t):this;let u=new $k(this,null,-1).goto(0),f=0,d=[],p=new ql;for(;u.value||f<t.length;)if(f<t.length&&(u.from-t[f].from||u.startSide-t[f].value.startSide)>=0){let b=t[f++];p.addInner(b.from,b.to,b.value)||d.push(b)}else u.rangeIndex==1&&u.chunkIndex<this.chunk.length&&(f==t.length||this.chunkEnd(u.chunkIndex)<t[f].from)&&(!o||l>this.chunkEnd(u.chunkIndex)||a<this.chunkPos[u.chunkIndex])&&p.addChunk(this.chunkPos[u.chunkIndex],this.chunk[u.chunkIndex])?u.nextChunk():((!o||l>u.to||a<u.from||o(u.from,u.to,u.value))&&(p.addInner(u.from,u.to,u.value)||d.push(Nu.create(u.from,u.to,u.value))),u.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?it.empty:this.nextLayer.update({add:d,filter:o,filterFrom:l,filterTo:a}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],l=-1;for(let o=0;o<this.chunk.length;o++){let u=this.chunkPos[o],f=this.chunk[o],d=e.touchesRange(u,u+f.length);if(d===!1)l=Math.max(l,f.maxPoint),t.push(f),i.push(e.mapPos(u));else if(d===!0){let{mapped:p,pos:b}=f.map(u,e);p&&(l=Math.max(l,p.maxPoint),t.push(p),i.push(b))}}let a=this.nextLayer.map(e);return t.length==0?a:new it(i,t,a||it.empty,l)}between(e,t,i){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let a=this.chunkPos[l],o=this.chunk[l];if(t>=a&&e<=a+o.length&&o.between(a,e-a,t-a,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Du.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Du.from(e).goto(t)}static compare(e,t,i,l,a=-1){let o=e.filter(b=>b.maxPoint>0||!b.isEmpty&&b.maxPoint>=a),u=t.filter(b=>b.maxPoint>0||!b.isEmpty&&b.maxPoint>=a),f=uS(o,u,i),d=new fu(o,f,a),p=new fu(u,f,a);i.iterGaps((b,x,S)=>fS(d,b,p,x,S,l)),i.empty&&i.length==0&&fS(d,0,p,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let a=e.filter(p=>!p.isEmpty&&t.indexOf(p)<0),o=t.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(a.length!=o.length)return!1;if(!a.length)return!0;let u=uS(a,o),f=new fu(a,u,0).goto(i),d=new fu(o,u,0).goto(i);for(;;){if(f.to!=d.to||!x0(f.active,d.active)||f.point&&(!d.point||!my(f.point,d.point)))return!1;if(f.to>l)return!0;f.next(),d.next()}}static spans(e,t,i,l,a=-1){let o=new fu(e,null,a).goto(t),u=t,f=o.openStart;for(;;){let d=Math.min(o.to,i);if(o.point){let p=o.activeForPoint(o.to),b=o.pointFrom<t?p.length+1:o.point.startSide<0?p.length:Math.min(p.length,f);l.point(u,d,o.point,p,b,o.pointRank),f=Math.min(o.openEnd(d),p.length)}else d>u&&(l.span(u,d,o.active,f),f=o.openEnd(d));if(o.to>i)return f+(o.point&&o.to>i?1:0);u=o.to,o.next()}}static of(e,t=!1){let i=new ql;for(let l of e instanceof Nu?[e]:t?$E(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return it.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=it.empty;l=l.nextLayer)t=new it(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}it.empty=new it([],[],null,-1);function $E(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let i=n[t];if(b0(e,i)>0)return n.slice().sort(b0);e=i}return n}it.empty.nextLayer=it.empty;class ql{finishChunk(e){this.chunks.push(new gy(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,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new ql)).add(e,t,i)}addInner(e,t,i){let l=e-this.lastTo||i.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<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=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.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 i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(it.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=it.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function uS(n,e,t){let i=new Map;for(let a of n)for(let o=0;o<a.chunk.length;o++)a.chunk[o].maxPoint<=0&&i.set(a.chunk[o],a.chunkPos[o]);let l=new Set;for(let a of e)for(let o=0;o<a.chunk.length;o++){let u=i.get(a.chunk[o]);u!=null&&(t?t.mapPos(u):u)==a.chunkPos[o]&&!(t!=null&&t.touchesRange(u,u+a.chunk[o].length))&&l.add(a.chunk[o])}return l}class $k{constructor(e,t,i,l=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=l}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,i){for(;this.chunkIndex<this.layer.chunk.length;){let l=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(l)||this.layer.chunkEnd(this.chunkIndex)<e||l.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<l)&&this.setRangeIndex(l)}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],i=e+t.from[this.rangeIndex];if(this.from=i,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 Du{constructor(e){this.heap=e}static from(e,t=null,i=-1){let l=[];for(let a=0;a<e.length;a++)for(let o=e[a];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&l.push(new $k(o,t,i,a));return l.length==1?l[0]:new Du(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)xg(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)xg(this.heap,i);(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(),xg(this.heap,0)}}}function xg(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let l=n[i];if(i+1<n.length&&l.compare(n[i+1])>=0&&(l=n[i+1],i++),t.compare(l)<0)break;n[i]=t,n[e]=l,e=i}}class fu{constructor(e,t,i){this.minPoint=i,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=Du.from(e,t,i)}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){_h(this.active,e),_h(this.activeTo,e),_h(this.activeRank,e),this.minActive=hS(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:a}=this.cursor;for(;t<this.activeRank.length&&(a-this.activeRank[t]||l-this.activeTo[t])>0;)t++;Mh(this.active,t,i),Mh(this.activeTo,t,l),Mh(this.activeRank,t,a),e&&Mh(e,t,this.cursor.from),this.minActive=hS(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),i&&_h(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let l=i.length-1;l>=0&&i[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function fS(n,e,t,i,l,a){n.goto(e),t.goto(i);let o=i+l,u=i,f=i-e,d=!!a.boundChange;for(let p=!1;;){let b=n.to+f-t.to,x=b||n.endSide-t.endSide,S=x<0?n.to+f:t.to,w=Math.min(S,o);if(n.point||t.point?(n.point&&t.point&&my(n.point,t.point)&&x0(n.activeForPoint(n.to),t.activeForPoint(t.to))||a.comparePoint(u,w,n.point,t.point),p=!1):(p&&a.boundChange(u),w>u&&!x0(n.active,t.active)&&a.compareRange(u,w,n.active,t.active),d&&w<o&&(b||n.openEnd(S)!=t.openEnd(S))&&(p=!0)),S>o)break;u=S,x<=0&&n.next(),x>=0&&t.next()}}function x0(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!my(n[t],e[t]))return!1;return!0}function _h(n,e){for(let t=e,i=n.length-1;t<i;t++)n[t]=n[t+1];n.pop()}function Mh(n,e,t){for(let i=n.length-1;i>=e;i--)n[i+1]=n[i];n[e]=t}function hS(n,e){let t=-1,i=1e9;for(let l=0;l<e.length;l++)(e[l]-i||n[l].endSide-n[t].endSide)<0&&(t=l,i=e[l]);return t}function lc(n,e,t=n.length){let i=0;for(let l=0;l<t&&l<n.length;)n.charCodeAt(l)==9?(i+=e-i%e,l++):(i++,l=On(n,l));return i}function v0(n,e,t,i){for(let l=0,a=0;;){if(a>=e)return l;if(l==n.length)break;a+=n.charCodeAt(l)==9?t-a%t:1,l=On(n,l)}return i===!0?-1:n.length}const S0="ͼ",dS=typeof Symbol>"u"?"__"+S0:Symbol.for(S0),w0=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),pS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Ur{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,u,f,d){let p=[],b=/^@(\w+)\b/.exec(o[0]),x=b&&b[1]=="keyframes";if(b&&u==null)return f.push(o[0]+";");for(let S in u){let w=u[S];if(/&/.test(S))a(S.split(/,\s*/).map(T=>o.map(C=>T.replace(/&/,C))).reduce((T,C)=>T.concat(C)),w,f);else if(w&&typeof w=="object"){if(!b)throw new RangeError("The value of a property ("+S+") should be a primitive value.");a(l(S),w,p,x)}else w!=null&&p.push(S.replace(/_.*/,"").replace(/[A-Z]/g,T=>"-"+T.toLowerCase())+": "+w+";")}(p.length||x)&&f.push((i&&!b&&!d?o.map(i):o).join(", ")+" {"+p.join(" ")+"}")}for(let o in e)a(l(o),e[o],this.rules)}getRules(){return this.rules.join(`
121
- `)}static newName(){let e=pS[dS]||1;return pS[dS]=e+1,S0+e.toString(36)}static mount(e,t,i){let l=e[w0],a=i&&i.nonce;l?a&&l.setNonce(a):l=new KE(e,a),l.mount(Array.isArray(t)?t:[t],e)}}let mS=new Map;class KE{constructor(e,t){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let a=mS.get(i);if(a)return e[w0]=a;this.sheet=new l.CSSStyleSheet,mS.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[w0]=this}mount(e,t){let i=this.sheet,l=0,a=0;for(let o=0;o<e.length;o++){let u=e[o],f=this.modules.indexOf(u);if(f<a&&f>-1&&(this.modules.splice(f,1),a--,f=-1),f==-1){if(this.modules.splice(a++,0,u),i)for(let d=0;d<u.rules.length;d++)i.insertRule(u.rules[d],l++)}else{for(;a<f;)l+=this.modules[a++].rules.length;l+=u.rules.length,a++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let f=0;f<this.modules.length;f++)o+=this.modules[f].getRules()+`
122
- `;this.styleTag.textContent=o;let u=t.head||t;this.styleTag.parentNode!=u&&u.insertBefore(this.styleTag,u.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Vr={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:"'"},Ou={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},XE=typeof navigator<"u"&&/Mac/.test(navigator.platform),QE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Vn=0;Vn<10;Vn++)Vr[48+Vn]=Vr[96+Vn]=String(Vn);for(var Vn=1;Vn<=24;Vn++)Vr[Vn+111]="F"+Vn;for(var Vn=65;Vn<=90;Vn++)Vr[Vn]=String.fromCharCode(Vn+32),Ou[Vn]=String.fromCharCode(Vn);for(var vg in Vr)Ou.hasOwnProperty(vg)||(Ou[vg]=Vr[vg]);function ZE(n){var e=XE&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||QE&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ou:Vr)[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 Et(){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 i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var l=t[i];typeof l=="string"?n.setAttribute(i,l):l!=null&&(n[i]=l)}e++}for(;e<arguments.length;e++)Kk(n,arguments[e]);return n}function Kk(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++)Kk(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let hi=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},k0=typeof document<"u"?document:{documentElement:{style:{}}};const A0=/Edge\/(\d+)/.exec(hi.userAgent),Xk=/MSIE \d/.test(hi.userAgent),C0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hi.userAgent),Ud=!!(Xk||C0||A0),gS=!Ud&&/gecko\/(\d+)/i.test(hi.userAgent),Sg=!Ud&&/Chrome\/(\d+)/.exec(hi.userAgent),yS="webkitFontSmoothing"in k0.documentElement.style,T0=!Ud&&/Apple Computer/.test(hi.vendor),bS=T0&&(/Mobile\/\w+/.test(hi.userAgent)||hi.maxTouchPoints>2);var ge={mac:bS||/Mac/.test(hi.platform),windows:/Win/.test(hi.platform),linux:/Linux|X11/.test(hi.platform),ie:Ud,ie_version:Xk?k0.documentMode||6:C0?+C0[1]:A0?+A0[1]:0,gecko:gS,gecko_version:gS?+(/Firefox\/(\d+)/.exec(hi.userAgent)||[0,0])[1]:0,chrome:!!Sg,chrome_version:Sg?+Sg[1]:0,ios:bS,android:/Android\b/.test(hi.userAgent),webkit:yS,webkit_version:yS?+(/\bAppleWebKit\/(\d+)/.exec(hi.userAgent)||[0,0])[1]:0,safari:T0,safari_version:T0?+(/\bVersion\/(\d+(\.\d+)?)/.exec(hi.userAgent)||[0,0])[1]:0,tabSize:k0.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function yy(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 fd=Object.create(null);function by(n,e,t){if(n==e)return!0;n||(n=fd),e||(e=fd);let i=Object.keys(n),l=Object.keys(e);if(i.length-0!=l.length-0)return!1;for(let a of i)if(a!=t&&(l.indexOf(a)==-1||n[a]!==e[a]))return!1;return!0}function JE(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function xS(n,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?n.style.cssText="":n.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?n.style.cssText=t[l]:n.setAttribute(l,t[l]));return i}function eN(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let i=n.attributes[t];e[i.name]=i.value}return e}class pl{eq(e){return!1}updateDOM(e,t,i){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,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Pn=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(Pn||(Pn={}));class Le extends Ir{constructor(e,t,i,l){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=l}get heightRelevant(){return!1}static mark(e){return new Wu(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Ra(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:a,end:o}=Qk(e,t);i=(a?t?-3e8:-1:5e8)-1,l=(o?t?2e8:1:-6e8)+1}return new Ra(e,i,l,t,e.widget||null,!0)}static line(e){return new $u(e)}static set(e,t=!1){return it.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Le.none=it.empty;class Wu extends Le{constructor(e){let{start:t,end:i}=Qk(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?yy(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||fd}eq(e){return this==e||e instanceof Wu&&this.tagName==e.tagName&&by(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)}}Wu.prototype.point=!1;class $u extends Le{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof $u&&this.spec.class==e.spec.class&&by(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)}}$u.prototype.mapMode=qn.TrackBefore;$u.prototype.point=!0;class Ra extends Le{constructor(e,t,i,l,a,o){super(t,i,a,e),this.block=l,this.isReplace=o,this.mapMode=l?t<=0?qn.TrackBefore:qn.TrackAfter:qn.TrackDel}get type(){return this.startSide!=this.endSide?Pn.WidgetRange:this.startSide<=0?Pn.WidgetBefore:Pn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ra&&tN(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)}}Ra.prototype.point=!0;function Qk(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function tN(n,e){return n==e||!!(n&&e&&n.compare(e))}function Lo(n,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=n?t[l]=Math.max(t[l],e):t.push(n,e)}class Ru extends Ir{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof Ru&&this.tagName==e.tagName&&by(this.attributes,e.attributes)}static create(e){return new Ru(e.tagName,e.attributes||fd,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return it.of(e,t)}}Ru.prototype.startSide=Ru.prototype.endSide=-1;function ju(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function _0(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function ku(n,e){if(!e.anchorNode)return!1;try{return _0(n,e.anchorNode)}catch{return!1}}function Jh(n){return n.nodeType==3?Lu(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Au(n,e,t,i){return t?vS(n,e,t,i,-1)||vS(n,e,t,i,1):!1}function qr(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function hd(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function vS(n,e,t,i,l){for(;;){if(n==t&&e==i)return!0;if(e==(l<0?0:Gl(n))){if(n.nodeName=="DIV")return!1;let a=n.parentNode;if(!a||a.nodeType!=1)return!1;e=qr(n)+(l<0?0:1),n=a}else if(n.nodeType==1){if(n=n.childNodes[e+(l<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=l<0?Gl(n):0}else return!1}}function Gl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function dd(n,e){let{left:t,right:i}=n;if(t==i)return n;let l=e?t:i;return{left:l,right:l,top:n.top,bottom:n.bottom}}function nN(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 Zk(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function iN(n,e,t,i,l,a,o,u){let f=n.ownerDocument,d=f.defaultView||window;for(let p=n,b=!1;p&&!b;)if(p.nodeType==1){let x,S=p==f.body,w=1,T=1;if(S)x=nN(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(p).position)&&(b=!0),p.scrollHeight<=p.clientHeight&&p.scrollWidth<=p.clientWidth){p=p.assignedSlot||p.parentNode;continue}let O=p.getBoundingClientRect();({scaleX:w,scaleY:T}=Zk(p,O)),x={left:O.left,right:O.left+p.clientWidth*w,top:O.top,bottom:O.top+p.clientHeight*T}}let C=0,E=0;if(l=="nearest")e.top<x.top+o?(E=e.top-(x.top+o),t>0&&e.bottom>x.bottom+E&&(E=e.bottom-x.bottom+o)):e.bottom>x.bottom-o&&(E=e.bottom-x.bottom+o,t<0&&e.top-E<x.top&&(E=e.top-(x.top+o)));else{let O=e.bottom-e.top,B=x.bottom-x.top;E=(l=="center"&&O<=B?e.top+O/2-B/2:l=="start"||l=="center"&&t<0?e.top-o:e.bottom-B+o)-x.top}if(i=="nearest"?e.left<x.left+a?(C=e.left-(x.left+a),t>0&&e.right>x.right+C&&(C=e.right-x.right+a)):e.right>x.right-a&&(C=e.right-x.right+a,t<0&&e.left<x.left+C&&(C=e.left-(x.left+a))):C=(i=="center"?e.left+(e.right-e.left)/2-(x.right-x.left)/2:i=="start"==u?e.left-a:e.right-(x.right-x.left)+a)-x.left,C||E)if(S)d.scrollBy(C,E);else{let O=0,B=0;if(E){let q=p.scrollTop;p.scrollTop+=E/T,B=(p.scrollTop-q)*T}if(C){let q=p.scrollLeft;p.scrollLeft+=C/w,O=(p.scrollLeft-q)*w}e={left:e.left-O,top:e.top-B,right:e.right-O,bottom:e.bottom-B},O&&Math.abs(O-C)<1&&(i="nearest"),B&&Math.abs(B-E)<1&&(l="nearest")}if(S)break;(e.top<x.top||e.bottom>x.bottom||e.left<x.left||e.right>x.right)&&(e={left:Math.max(e.left,x.left),right:Math.min(e.right,x.right),top:Math.max(e.top,x.top),bottom:Math.min(e.bottom,x.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function Jk(n,e=!0){let t=n.ownerDocument,i=null,l=null;for(let a=n.parentNode;a&&!(a==t.body||(!e||i)&&l);)if(a.nodeType==1)!l&&a.scrollHeight>a.clientHeight&&(l=a),e&&!i&&a.scrollWidth>a.clientWidth&&(i=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:i,y:l}}class sN{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:i}=e;this.set(t,Math.min(e.anchorOffset,t?Gl(t):0),i,Math.min(e.focusOffset,i?Gl(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}let ba=null;ge.safari&&ge.safari_version>=26&&(ba=!1);function eA(n){if(n.setActive)return n.setActive();if(ba)return n.focus(ba);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(ba==null?{get preventScroll(){return ba={preventScroll:!0},!0}}:void 0),!ba){ba=!1;for(let t=0;t<e.length;){let i=e[t++],l=e[t++],a=e[t++];i.scrollTop!=l&&(i.scrollTop=l),i.scrollLeft!=a&&(i.scrollLeft=a)}}}let SS;function Lu(n,e,t=e){let i=SS||(SS=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function Bo(n,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let a=new KeyboardEvent("keydown",l);a.synthetic=!0,n.dispatchEvent(a);let o=new KeyboardEvent("keyup",l);return o.synthetic=!0,n.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function lN(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function rN(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Gl(t));;)if(i){if(t.nodeType!=1)return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=Gl(t))}else{if(t==n)return!0;i=qr(t),t=t.parentNode}}function tA(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function nA(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Gl(t)}else if(t.parentNode&&!hd(t))i=qr(t),t=t.parentNode;else return null}}function iA(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!hd(t))i=qr(t)+1,t=t.parentNode;else return null}}class Os{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new Os(e.parentNode,qr(e),t)}static after(e,t){return new Os(e.parentNode,qr(e)+1,t)}}var Lt=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(Lt||(Lt={}));const ja=Lt.LTR,xy=Lt.RTL;function sA(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const aN=sA("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),oN=sA("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),M0=Object.create(null),Js=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);M0[e]=t,M0[t]=-e}function lA(n){return n<=247?aN[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?oN[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const cN=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class cl{get dir(){return this.level%2?xy:ja}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,l){let a=-1;for(let o=0;o<e.length;o++){let u=e[o];if(u.from<=t&&u.to>=t){if(u.level==i)return o;(a<0||(l!=0?l<0?u.from<t:u.to>t:e[a].level>u.level))&&(a=o)}}if(a<0)throw new RangeError("Index out of range");return a}}function rA(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let i=n[t],l=e[t];if(i.from!=l.from||i.to!=l.to||i.direction!=l.direction||!rA(i.inner,l.inner))return!1}return!0}const Rt=[];function uN(n,e,t,i,l){for(let a=0;a<=i.length;a++){let o=a?i[a-1].to:e,u=a<i.length?i[a].from:t,f=a?256:l;for(let d=o,p=f,b=f;d<u;d++){let x=lA(n.charCodeAt(d));x==512?x=p:x==8&&b==4&&(x=16),Rt[d]=x==4?2:x,x&7&&(b=x),p=x}for(let d=o,p=f,b=f;d<u;d++){let x=Rt[d];if(x==128)d<u-1&&p==Rt[d+1]&&p&24?x=Rt[d]=p:Rt[d]=256;else if(x==64){let S=d+1;for(;S<u&&Rt[S]==64;)S++;let w=d&&p==8||S<t&&Rt[S]==8?b==1?1:8:256;for(let T=d;T<S;T++)Rt[T]=w;d=S-1}else x==8&&b==1&&(Rt[d]=1);p=x,x&7&&(b=x)}}}function fN(n,e,t,i,l){let a=l==1?2:1;for(let o=0,u=0,f=0;o<=i.length;o++){let d=o?i[o-1].to:e,p=o<i.length?i[o].from:t;for(let b=d,x,S,w;b<p;b++)if(S=M0[x=n.charCodeAt(b)])if(S<0){for(let T=u-3;T>=0;T-=3)if(Js[T+1]==-S){let C=Js[T+2],E=C&2?l:C&4?C&1?a:l:0;E&&(Rt[b]=Rt[Js[T]]=E),u=T;break}}else{if(Js.length==189)break;Js[u++]=b,Js[u++]=x,Js[u++]=f}else if((w=Rt[b])==2||w==1){let T=w==l;f=T?0:1;for(let C=u-3;C>=0;C-=3){let E=Js[C+2];if(E&2)break;if(T)Js[C+2]|=2;else{if(E&4)break;Js[C+2]|=4}}}}}function hN(n,e,t,i){for(let l=0,a=i;l<=t.length;l++){let o=l?t[l-1].to:n,u=l<t.length?t[l].from:e;for(let f=o;f<u;){let d=Rt[f];if(d==256){let p=f+1;for(;;)if(p==u){if(l==t.length)break;p=t[l++].to,u=l<t.length?t[l].from:e}else if(Rt[p]==256)p++;else break;let b=a==1,x=(p<e?Rt[p]:i)==1,S=b==x?b?1:2:i;for(let w=p,T=l,C=T?t[T-1].to:n;w>f;)w==C&&(w=t[--T].from,C=T?t[T-1].to:n),Rt[--w]=S;f=p}else a=d,f++}}}function E0(n,e,t,i,l,a,o){let u=i%2?2:1;if(i%2==l%2)for(let f=e,d=0;f<t;){let p=!0,b=!1;if(d==a.length||f<a[d].from){let T=Rt[f];T!=u&&(p=!1,b=T==16)}let x=!p&&u==1?[]:null,S=p?i:i+1,w=f;e:for(;;)if(d<a.length&&w==a[d].from){if(b)break e;let T=a[d];if(!p)for(let C=T.to,E=d+1;;){if(C==t)break e;if(E<a.length&&a[E].from==C)C=a[E++].to;else{if(Rt[C]==u)break e;break}}if(d++,x)x.push(T);else{T.from>f&&o.push(new cl(f,T.from,S));let C=T.direction==ja!=!(S%2);N0(n,C?i+1:i,l,T.inner,T.from,T.to,o),f=T.to}w=T.to}else{if(w==t||(p?Rt[w]!=u:Rt[w]==u))break;w++}x?E0(n,f,w,i+1,l,x,o):f<w&&o.push(new cl(f,w,S)),f=w}else for(let f=t,d=a.length;f>e;){let p=!0,b=!1;if(!d||f>a[d-1].to){let T=Rt[f-1];T!=u&&(p=!1,b=T==16)}let x=!p&&u==1?[]:null,S=p?i:i+1,w=f;e:for(;;)if(d&&w==a[d-1].to){if(b)break e;let T=a[--d];if(!p)for(let C=T.from,E=d;;){if(C==e)break e;if(E&&a[E-1].to==C)C=a[--E].from;else{if(Rt[C-1]==u)break e;break}}if(x)x.push(T);else{T.to<f&&o.push(new cl(T.to,f,S));let C=T.direction==ja!=!(S%2);N0(n,C?i+1:i,l,T.inner,T.from,T.to,o),f=T.from}w=T.from}else{if(w==e||(p?Rt[w-1]!=u:Rt[w-1]==u))break;w--}x?E0(n,w,f,i+1,l,x,o):w<f&&o.push(new cl(w,f,S)),f=w}}function N0(n,e,t,i,l,a,o){let u=e%2?2:1;uN(n,l,a,i,u),fN(n,l,a,i,u),hN(l,a,i,u),E0(n,l,a,e,t,i,o)}function dN(n,e,t){if(!n)return[new cl(0,0,e==xy?1:0)];if(e==ja&&!t.length&&!cN.test(n))return aA(n.length);if(t.length)for(;n.length>Rt.length;)Rt[Rt.length]=256;let i=[],l=e==ja?0:1;return N0(n,l,l,t,0,n.length,i),i}function aA(n){return[new cl(0,n,0)]}let oA="";function pN(n,e,t,i,l){var a;let o=i.head-n.from,u=cl.find(e,o,(a=i.bidiLevel)!==null&&a!==void 0?a:-1,i.assoc),f=e[u],d=f.side(l,t);if(o==d){let x=u+=l?1:-1;if(x<0||x>=e.length)return null;f=e[u=x],o=f.side(!l,t),d=f.side(l,t)}let p=On(n.text,o,f.forward(l,t));(p<f.from||p>f.to)&&(p=d),oA=n.text.slice(Math.min(o,p),Math.max(o,p));let b=u==(l?e.length-1:0)?null:e[u+(l?1:-1)];return b&&p==d&&b.level+(l?0:1)<f.level?X.cursor(b.side(!l,t)+n.from,b.forward(l,t)?1:-1,b.level):X.cursor(p+n.from,f.forward(l,t)?-1:1,f.level)}function mN(n,e,t){for(let i=e;i<t;i++){let l=lA(n.charCodeAt(i));if(l==1)return ja;if(l==2||l==4)return xy}return ja}const cA=be.define(),uA=be.define(),fA=be.define(),hA=be.define(),D0=be.define(),dA=be.define(),pA=be.define(),vy=be.define(),Sy=be.define(),mA=be.define({combine:n=>n.some(e=>e)}),gA=be.define({combine:n=>n.some(e=>e)}),yA=be.define();class zo{constructor(e,t,i,l,a,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=a,this.isSnapshot=o}map(e){return e.empty?this:new zo(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 zo(X.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Eh=Ge.define({map:(n,e)=>n.map(e)}),bA=Ge.define();function Ti(n,e,t){let i=n.facet(hA);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Il=be.define({combine:n=>n.length?n[0]:!0});let gN=0;const Mo=be.define({combine(n){return n.filter((e,t)=>{for(let i=0;i<t;i++)if(n[i].plugin==e.plugin)return!1;return!0})}});class ln{constructor(e,t,i,l,a){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=l,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(Mo.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Mo.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:i,eventObservers:l,provide:a,decorations:o}=t||{};return new ln(gN++,e,i,l,u=>{let f=[];return o&&f.push(Vd.of(d=>{let p=d.plugin(u);return p?o(p):Le.none})),a&&f.push(a(u)),f})}static fromClass(e,t){return ln.define((i,l)=>new e(i,l),t)}}class wg{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(i){if(Ti(t.state,i,"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){Ti(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(i){Ti(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const xA=be.define(),wy=be.define(),Vd=be.define(),vA=be.define(),ky=be.define(),Ku=be.define(),SA=be.define();function wS(n,e){let t=n.state.facet(SA);if(!t.length)return t;let i=t.map(a=>a instanceof Function?a(n):a),l=[];return it.spans(i,e.from,e.to,{point(){},span(a,o,u,f){let d=a-e.from,p=o-e.from,b=l;for(let x=u.length-1;x>=0;x--,f--){let S=u[x].spec.bidiIsolate,w;if(S==null&&(S=mN(e.text,d,p)),f>0&&b.length&&(w=b[b.length-1]).to==d&&w.direction==S)w.to=p,b=w.inner;else{let T={from:d,to:p,direction:S,inner:[]};b.push(T),b=T.inner}}}}),l}const wA=be.define();function Ay(n){let e=0,t=0,i=0,l=0;for(let a of n.state.facet(wA)){let o=a(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(l=Math.max(l,o.bottom)))}return{left:e,right:t,top:i,bottom:l}}const bu=be.define();class os{constructor(e,t,i,l){this.fromA=e,this.toA=t,this.fromB=i,this.toB=l}join(e){return new os(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,i=this;for(;t>0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toA<i.fromA)break;i=i.join(l),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let l=0,a=0,o=0;;){let u=l<e.length?e[l].fromB:1e9,f=a<t.length?t[a]:1e9,d=Math.min(u,f);if(d==1e9)break;let p=d+o,b=d,x=p;for(;;)if(a<t.length&&t[a]<=b){let S=t[a+1];a+=2,b=Math.max(b,S);for(let w=l;w<e.length&&e[w].fromB<=b;w++)o=e[w].toA-e[w].toB;x=Math.max(x,S+o)}else if(l<e.length&&e[l].fromB<=b){let S=e[l++];b=Math.max(b,S.toB),x=Math.max(x,S.toA),o=S.toA-S.toB}else break;i.push(new os(p,x,d,b))}return i}}class pd{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=bn.empty(this.startState.doc.length);for(let a of i)this.changes=this.changes.compose(a.changes);let l=[];this.changes.iterChangedRanges((a,o,u,f)=>l.push(new os(a,o,u,f))),this.changedRanges=l}static create(e,t,i){return new pd(e,t,i)}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 yN=[];class Jt{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return yN}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&&JE(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 i=t;for(let l of this.children){if(l==e)return i;i+=l.length+l.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,i){return null}domPosFor(e,t){let i=qr(this.dom),l=this.length?e>0:t>0;return new Os(this.parent.dom,i+(l?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 Gd)return e;return null}static get(e){return e.cmTile}}class qd extends Jt{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,i=null,l,a=(e==null?void 0:e.node)==t?e:null,o=0;for(let u of this.children){if(u.sync(e),o+=u.length+u.breakAfter,l=i?i.nextSibling:t.firstChild,a&&l!=u.dom&&(a.written=!0),u.dom.parentNode==t)for(;l&&l!=u.dom;)l=kS(l);else t.insertBefore(u.dom,l);i=u.dom}for(l=i?i.nextSibling:t.firstChild,a&&l&&(a.written=!0);l;)l=kS(l);this.length=o}}function kS(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Gd extends qd{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=Jt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,l=0,a=0;;)if(l==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&a++,l=t.pop()}else{let o=i.children[l++];if(o instanceof Vl)t.push(l),i=o,l=0;else{let u=a+o.length,f=e(o,a);if(f!==void 0)return f;a=u+o.breakAfter}}}resolveBlock(e,t){let i,l=-1,a,o=-1;if(this.blockTiles((u,f)=>{let d=f+u.length;if(e>=f&&e<=d){if(u.isWidget()&&t>=-1&&t<=1){if(u.flags&32)return!0;u.flags&16&&(i=void 0)}(f<e||e==d&&(t<-1?u.length:u.covers(1)))&&(!i||!u.isWidget()&&i.isWidget())&&(i=u,l=e-f),(d>e||e==f&&(t>1?u.length:u.covers(-1)))&&(!a||!u.isWidget()&&a.isWidget())&&(a=u,o=e-f)}}),!i&&!a)throw new Error("No tile at position "+e);return i&&t<0||!a?{tile:i,offset:l}:{tile:a,offset:o}}}class Vl extends qd{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 i=new Vl(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Qo extends qd{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let l=new Qo(t||document.createElement("div"),e);return(!t||!i)&&(l.flags|=4),l}get domAttrs(){return this.attrs}resolveInline(e,t,i){let l=null,a=-1,o=null,u=-1;function f(p,b){for(let x=0,S=0;x<p.children.length&&S<=b;x++){let w=p.children[x],T=S+w.length;T>=b&&(w.isComposite()?f(w,b-S):(!o||o.isHidden&&(t>0&&!(o.flags&32)||i&&xN(o,w)))&&(T>b||w.flags&32)?(o=w,u=b-S):(S<b||w.flags&16&&!w.isHidden)&&(l=w,a=b-S)),S=T}}f(this,e);let d=(t<0?l:o)||l||o;return d?{tile:d,offset:d==l?a:u}:null}coordsIn(e,t,i){let l=this.resolveInline(e,t,!0);return l?l.tile.coordsIn(Math.max(0,l.offset),t,i):bN(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:l,offset:a}=i;if(this.dom.contains(l.dom))return l.isText()?new Os(l.dom,Math.min(l.dom.nodeValue.length,a)):l.domPosFor(a,l.flags&16?1:l.flags&32?-1:t);let o=i.tile.parent,u=!1;for(let f of o.children){if(u)return new Os(f.dom,0);f==i.tile&&(u=!0)}}return new Os(this.dom,0)}}function bN(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Jh(e);return t[t.length-1]||null}function xN(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.top<t.bottom}class Ci extends qd{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let i=new Ci(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class wa extends Jt{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,i){let l=this.dom.nodeValue.length;e>l&&(e=l);let a=e,o=e,u=0;e==0&&t<0||e==l&&t>=0?ge.chrome||ge.gecko||(e?(a--,u=1):o<l&&(o++,u=-1)):t<0?a--:o<l&&o++;let f=Lu(this.dom,a,o).getClientRects();if(!f.length)return null;let d=f[(u?u<0:t>=0)?0:f.length-1];return ge.safari&&!u&&d.width==0&&(d=Array.prototype.find.call(f,p=>p.width)||d),i==null?d:dd(d,(u?u>0:t<0)==i)}static of(e,t){let i=new wa(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class La extends Jt{constructor(e,t,i,l){super(e,t,l),this.widget=i}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,i){let l=this.widget.coordsAt(this.dom,e,t);if(l)return l;if(i)return dd(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let a=this.dom.getClientRects(),o=null;if(!a.length)return null;let u=this.flags&16?!0:this.flags&32?!1:e>0;for(let f=u?a.length-1:0;o=a[f],!(e>0?f==0:f==a.length-1||o.top<o.bottom);f+=u?-1:1);return dd(o,!u)}}get overrideDOMText(){if(!this.length)return ft.empty;let{root:e}=this;if(!e)return ft.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,i,l,a){return a||(a=e.toDOM(t),e.editable||(a.contentEditable="false")),new La(a,i,e,l)}}class md extends Jt{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return ft.empty}coordsIn(e,t,i){let l=this.dom.getBoundingClientRect();return i==null?l:dd(l,t>0==i)}}class vN{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:l,index:a,beforeBreak:o,parents:u}=this;for(;e||t>0;)if(l.isComposite())if(o){if(!e)break;i&&i.break(),e--,o=!1}else if(a==l.children.length){if(!e&&!u.length)break;i&&i.leave(l),o=!!l.breakAfter,{tile:l,index:a}=u.pop(),a++}else{let f=l.children[a],d=f.breakAfter;(t>0?f.length<=e:f.length<e)&&(!i||i.skip(f,0,f.length)!==!1||!f.isComposite)?(o=!!d,a++,e-=f.length):(u.push({tile:l,index:a}),l=f,a=0,i&&f.isComposite()&&i.enter(f))}else if(a==l.length)o=!!l.breakAfter,{tile:l,index:a}=u.pop(),a++;else if(e){let f=Math.min(e,l.length-a);i&&i.skip(l,a,a+f),e-=f,a+=f}else break;return this.tile=l,this.index=a,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class SN{constructor(e,t,i,l){this.from=e,this.to=t,this.wrapper=i,this.rank=l}}class wN{constructor(e,t,i){this.cache=e,this.root=t,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,i,l){var a;this.flushBuffer();let o=this.ensureMarks(t,i),u=o.lastChild;if(u&&u.isText()&&!(u.flags&8)&&u.length+e.length<512){this.cache.reused.set(u,2);let f=o.children[o.children.length-1]=new wa(u.dom,u.text+e);f.parent=o}else o.append(l||wa.of(e,(a=this.cache.find(wa))===null||a===void 0?void 0:a.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let i=this.curLine;i.dom!=t.line.dom&&(i.setDOM(this.cache.reused.has(t.line)?kg(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let l=i;for(let u=t.marks.length-1;u>=0;u--){let f=t.marks[u],d=l.lastChild;if(d instanceof Ci&&d.mark.eq(f.mark))d.dom!=f.dom&&d.setDOM(kg(f.dom)),l=d;else{if(this.cache.reused.get(f)){let b=Jt.get(f.dom);b&&b.setDOM(kg(f.dom))}let p=Ci.of(f.mark,f.dom);l.append(p),l=p}this.cache.reused.set(f,2)}let a=Jt.get(e.text);a&&this.cache.reused.set(a,2);let o=new wa(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,l.append(o)}addInlineWidget(e,t,i){let l=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);l||this.flushBuffer();let a=this.ensureMarks(t,i);!l&&!(e.flags&16)&&a.append(this.getBuffer(1)),a.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).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 i;e||(e=kA);let l=Qo.start(e,t||((i=this.cache.find(Qo))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=l)}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 i;let l=this.curLine;for(let a=e.length-1;a>=0;a--){let o=e[a],u;if(t>0&&(u=l.lastChild)&&u instanceof Ci&&u.mark.eq(o))l=u,t--;else{let f=Ci.of(o,(i=this.cache.find(Ci,d=>d.mark.eq(o)))===null||i===void 0?void 0:i.dom);l.append(f),l=f,t=0}}return l}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!AS(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(ge.ios&&AS(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Ag,0,32)||new La(Ag.toDOM(),0,Ag,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,i=new SN(e.from,e.to,e.value,t),l=this.wrappers.length;for(;l>0&&(this.wrappers[l-1].rank-i.rank||this.wrappers[l-1].to-i.to)<0;)l--;this.wrappers.splice(l,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let l=t.lastChild;if(i.from<this.pos&&l instanceof Vl&&l.wrapper.eq(i.wrapper))t=l;else{let a=Vl.of(i.wrapper,(e=this.cache.find(Vl,o=>o.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(a),t=a}}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),i=this.cache.find(md,void 0,1);return i&&(i.flags=t),i||new md(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class kN{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:l,lineBreak:a,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=l;let u=this.textOff=Math.min(e,l.length);return a?null:l.slice(0,u)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const gd=[La,Qo,wa,Ci,md,Vl,Gd];for(let n=0;n<gd.length;n++)gd[n].bucket=n;class AN{constructor(e){this.view=e,this.buckets=gd.map(()=>[]),this.index=gd.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let l=e.bucket,a=this.buckets[l],o=this.index[l];for(let u=0;u<a.length;u++){let f=(u+o)%a.length,d=a[f];if((!t||t(d))&&!this.reused.has(d))return a.splice(f,1),f<o&&this.index[l]--,this.reused.set(d,i),d}return null}findWidget(e,t,i){let l=this.buckets[0];if(l.length)for(let a=0,o=0;;a++){if(a==l.length){if(o)return null;o=1,a=0}let u=l[a];if(!this.reused.has(u)&&(o==0?u.widget.compare(e):u.widget.constructor==e.constructor&&e.updateDOM(u.dom,this.view,u.widget)))return l.splice(a,1),a<this.index[0]&&this.index[0]--,u.widget==e&&u.length==t&&(u.flags&497)==i?(this.reused.set(u,1),u):(this.reused.set(u,2),new La(u.dom,t,e,u.flags&-498|i))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class CN{constructor(e,t,i,l,a){this.view=e,this.decorations=l,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new AN(e),this.text=new kN(e.state.doc),this.builder=new wN(this.cache,new Gd(e,e.contentDOM),it.iter(i)),this.cache.reused.set(t,2),this.old=new vN(t),this.reuseWalker={skip:(o,u,f)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let l=0,a=0,o=0;;){let u=o<e.length?e[o++]:null,f=u?u.fromA:this.old.root.length;if(f>l){let d=f-l;this.preserve(d,!o,!u),l=f,a+=d}if(!u)break;t&&u.fromA<=t.range.fromA&&u.toA>=t.range.toA?(this.forward(u.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(a,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,i),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,u.toA),this.emit(t.range.toB,u.toB)):(this.forward(u.fromA,u.toA),this.emit(a,u.toB)),a=u.toB,l=u.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,i){let l=MN(this.old),a=this.openMarks;this.old.advance(e,i?1:-1,{skip:(o,u,f)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(f-u);else{let d=f>0||u<o.length?La.of(o.widget,this.view,f-u,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,l,a),a=l.length)}else if(o.isText())this.builder.ensureLine(null),!u&&f==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,l,a,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(u,f),l,a)),a=l.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof md)this.cache.add(o);else if(o instanceof Ci)this.builder.ensureLine(null),this.builder.addMark(o,l,a),this.cache.reused.set(o,1),a=l.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Ci&&l.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?l.length&&(l.length=a=0):o instanceof Ci&&(l.shift(),a=Math.min(a,l.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,l=this.builder,a=-1,o=it.spans(this.decorations,e,t,{point:(u,f,d,p,b,x)=>{if(d instanceof Ra){if(this.disallowBlockEffectsFor[x]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(f>this.view.state.doc.lineAt(u).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=p.length,b>p.length)l.continueWidget(f-u);else{let S=d.widget||(d.block?Zo.block:Zo.inline),w=TN(d),T=this.cache.findWidget(S,f-u,w)||La.of(S,this.view,f-u,w);d.block?(d.startSide>0&&l.addLineStartIfNotCovered(i),l.addBlockWidget(T)):(l.ensureLine(i),l.addInlineWidget(T,p,b))}i=null}else i=_N(i,d);f>u&&this.text.skip(f-u)},span:(u,f,d,p)=>{for(let b=u;b<f;){let x=this.text.next(Math.min(512,f-b));x==null?(l.addLineStartIfNotCovered(i),l.addBreak(),b++):(l.ensureLine(i),l.addText(x,d,b==u?p:d.length),b+=x.length),i=null}a=d.length}});a>-1&&(this.openWidget=o>a),this.openWidget||l.addLineStartIfNotCovered(i),this.openMarks=o}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let l=e.parentNode;;l=l.parentNode){let a=Jt.get(l);if(l==this.view.contentDOM)break;a instanceof Ci?t.push(a):a!=null&&a.isLine()?i=a:a instanceof Vl||(l.nodeName=="DIV"&&!i&&l!=this.view.contentDOM?i=new Qo(l,kA):i||t.push(Ci.of(new Wu({tagName:l.nodeName.toLowerCase(),attributes:eN(l)}),l)))}return{line:i,marks:t}}}function AS(n,e){let t=i=>{for(let l of i.children)if((e?l.isText():l.length)||t(l))return!0;return!1};return t(n)}function TN(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 kA={class:"cm-line"};function _N(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&yy(t,n),i&&(n.class+=" "+i)),n}function MN(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof Ci&&e.push(i.mark)}return e}function kg(n){let e=Jt.get(n);return e&&e.setDOM(n.cloneNode()),n}class Zo extends pl{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Zo.inline=new Zo("span");Zo.block=new Zo("div");const Ag=new class extends pl{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class CS{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Le.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 Gd(e,e.contentDOM),this.updateInner([new os(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:p,toA:b})=>b<this.minWidthFrom||p>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 l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!zN(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let a=l>-1?NN(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:b}=this.hasComposition;i=new os(p,b,e.changes.mapPos(p,-1),e.changes.mapPos(b,1)).addToSet(i.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(ge.ie||ge.chrome)&&!a&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,u=this.blockWrappers;this.updateDeco();let f=RN(o,this.decorations,e.changes);f.length&&(i=os.extendWithRanges(i,f));let d=LN(u,this.blockWrappers,e.changes);return d.length&&(i=os.extendWithRanges(i,d)),a&&!i.some(p=>p.fromA<=a.range.fromA&&p.toA>=a.range.toA)&&(i=a.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,a),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let o=this.tile,u=new CN(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Jt.get(t.text)&&u.cache.reused.set(Jt.get(t.text),2),this.tile=u.run(e,t),O0(o,u.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 a=ge.chrome||ge.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||i.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let l=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof Cg&&l.push(a.dom);i.updateGaps(l)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(bA)&&(this.editContextFormatting=i.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,l=this.view.root.activeElement,a=l==i,o=!a&&!(this.view.state.facet(Il)||i.tabIndex>-1)&&ku(i,this.view.observer.selectionRange)&&!(l&&i.contains(l));if(!(a||t||o))return;let u=this.forceSelection;this.forceSelection=!1;let f=this.view.state.selection.main,d,p;if(f.empty?p=d=this.inlineDOMNearPos(f.anchor,f.assoc||1):(p=this.inlineDOMNearPos(f.head,f.head==f.from?1:-1),d=this.inlineDOMNearPos(f.anchor,f.anchor==f.from?1:-1)),ge.gecko&&f.empty&&!this.hasComposition&&EN(d)){let x=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(x,d.node.childNodes[d.offset]||null)),d=p=new Os(x,0),u=!0}let b=this.view.observer.selectionRange;(u||!b.focusNode||(!Au(d.node,d.offset,b.anchorNode,b.anchorOffset)||!Au(p.node,p.offset,b.focusNode,b.focusOffset))&&!this.suppressWidgetCursorChange(b,f))&&(this.view.observer.ignore(()=>{ge.android&&ge.chrome&&i.contains(b.focusNode)&&BN(b.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let x=ju(this.view.root);if(x)if(f.empty){if(ge.gecko){let S=DN(d.node,d.offset);if(S&&S!=3){let w=(S==1?nA:iA)(d.node,d.offset);w&&(d=new Os(w.node,w.offset))}}x.collapse(d.node,d.offset),f.bidiLevel!=null&&x.caretBidiLevel!==void 0&&(x.caretBidiLevel=f.bidiLevel)}else if(x.extend){x.collapse(d.node,d.offset);try{x.extend(p.node,p.offset)}catch{}}else{let S=document.createRange();f.anchor>f.head&&([d,p]=[p,d]),S.setEnd(p.node,p.offset),S.setStart(d.node,d.offset),x.removeAllRanges(),x.addRange(S)}o&&this.view.root.activeElement==i&&(i.blur(),l&&l.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new Os(b.anchorNode,b.anchorOffset),this.impreciseHead=p.precise?null:new Os(b.focusNode,b.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Au(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,i=ju(e.root),{anchorNode:l,anchorOffset:a}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let u=o.posAtStart;if(t.head==u||t.head==u+o.length)return;let f=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!f||!d||f.bottom>d.top)return;let p=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(p.node,p.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let b=e.observer.selectionRange;e.docView.posFromDOM(b.anchorNode,b.anchorOffset)!=t.from&&i.collapse(l,a)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let l=i.posAtStart;if(i.isComposite()){let a;if(e==i.dom)a=i.dom.childNodes[t];else{let o=Gl(e)==0?0:t==0?-1:1;for(;;){let u=e.parentNode;if(u==i.dom)break;o==0&&u.firstChild!=u.lastChild&&(e==u.firstChild?o=-1:o=1),e=u}o<0?a=e:a=e.nextSibling}if(a==i.dom.firstChild)return l;for(;a&&!Jt.get(a);)a=a.nextSibling;if(!a)return l+i.length;for(let o=0,u=l;;o++){let f=i.children[o];if(f.dom==a)return u;u+=f.length+f.breakAfter}}else return i.isText()?e==i.dom?l+t:l+(t?i.length:0):l}domAtPos(e,t){let{tile:i,offset:l}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(l,t):i.domIn(l,t)}inlineDOMNearPos(e,t){let i,l=-1,a=!1,o,u=-1,f=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=e)return!0;d.flags&16&&(a=!0)}else{let b=p+d.length;if(p<=e&&(i=d,l=e-p,a=b<e),b>=e&&!o&&(o=d,u=e-p,f=p>e),p>e&&o)return!0}}),!i&&!o?this.domAtPos(e,t):(a&&o?i=null:f&&i&&(o=null),i&&t<0||!o?i.domIn(l,t):o.domIn(u,t))}coordsAt(e,t,i){let{tile:l,offset:a}=this.tile.resolveBlock(e,t);return l.isWidget()?l.widget instanceof Cg?null:l.coordsInWidget(a,t,!0):l.coordsIn(a,t,i)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function l(a,o){if(a.isComposite())for(let u of a.children){if(u.length>=o){let f=l(u,o);if(f)return f}if(o-=u.length,o<0)break}else if(a.isText()&&o<a.length){let u=On(a.text,o);if(u==o)return null;let f=Lu(a.dom,o,u).getClientRects();for(let d=0;d<f.length;d++){let p=f[d];if(d==f.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return l(t,i)}measureVisibleLineHeights(e){let t=[],{from:i,to:l}=e,a=this.view.contentDOM.clientWidth,o=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,u=-1,f=this.view.textDirection==Lt.LTR,d=0,p=(b,x,S)=>{for(let w=0;w<b.children.length&&!(x>l);w++){let T=b.children[w],C=x+T.length,E=T.dom.getBoundingClientRect(),{height:O}=E;if(S&&!w&&(d+=E.top-S.top),T instanceof Vl)C>i&&p(T,x,E);else if(x>=i&&(d>0&&t.push(-d),t.push(O+d),d=0,o)){let B=T.dom.lastChild,q=B?Jh(B):[];if(q.length){let H=q[q.length-1],L=f?H.right-E.left:E.right-H.left;L>u&&(u=L,this.minWidth=a,this.minWidthFrom=x,this.minWidthTo=C)}}S&&w==b.children.length-1&&(d+=S.bottom-E.bottom),x=C+T.breakAfter}};return p(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Lt.RTL:Lt.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let u=0,f;for(let d of o.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=Jh(d.dom);if(p.length!=1)return;u+=p[0].width,f=p[0].height}if(u)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:u/o.length,textHeight:f}}});if(e)return e;let t=document.createElement("div"),i,l,a;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Jh(t.firstChild)[0];i=t.getBoundingClientRect().height,l=o&&o.width?o.width/27:7,a=o&&o.height?o.height:i,t.remove()}),{lineHeight:i,charWidth:l,textHeight:a}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let a=l==t.viewports.length?null:t.viewports[l],o=a?a.from-1:this.view.state.doc.length;if(o>i){let u=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(Le.replace({widget:new Cg(u),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!a)break;i=a.to+1}return Le.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Vd).map(a=>(this.dynamicDecorationMap[e++]=typeof a=="function")?a(this.view):a),i=!1,l=this.view.state.facet(ky).map((a,o)=>{let u=typeof a=="function";return u&&(i=!0),u?a(this.view):a});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(it.join(l))),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(vA).map(a=>typeof a=="function"?a(this.view):a)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(yA))try{if(d(this.view,e.range,e))return!0}catch(p){Ti(this.view.state,p,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let a=Ay(this.view),o={left:i.left-a.left,top:i.top-a.top,right:i.right+a.right,bottom:i.bottom+a.bottom},{offsetWidth:u,offsetHeight:f}=this.view.scrollDOM;if(iN(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,u),-u),Math.max(Math.min(e.yMargin,f),-f),this.view.textDirection==Lt.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(t.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=i=>i.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){O0(this.tile)}}function O0(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)O0(i,e)}}function EN(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 AA(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=nA(t.focusNode,t.focusOffset),l=iA(t.focusNode,t.focusOffset),a=i||l;if(l&&i&&l.node!=i.node){let u=Jt.get(l.node);if(!u||u.isText()&&u.text!=l.node.nodeValue)a=l;else if(n.docView.lastCompositionAfterCursor){let f=Jt.get(i.node);!f||f.isText()&&f.text!=i.node.nodeValue||(a=l)}}if(n.docView.lastCompositionAfterCursor=a!=i,!a)return null;let o=e-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function NN(n,e,t){let i=AA(n,t);if(!i)return null;let{node:l,from:a,to:o}=i,u=l.nodeValue;if(/[\n\r]/.test(u)||n.state.doc.sliceString(i.from,i.to)!=u)return null;let f=e.invertedDesc;return{range:new os(f.mapPos(a),f.mapPos(o),a,o),text:l}}function DN(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 ON=class{constructor(){this.changes=[]}compareRange(e,t){Lo(e,t,this.changes)}comparePoint(e,t){Lo(e,t,this.changes)}boundChange(e){Lo(e,e,this.changes)}};function RN(n,e,t){let i=new ON;return it.compare(n,e,t,i),i.changes}class jN{constructor(){this.changes=[]}compareRange(e,t){Lo(e,t,this.changes)}comparePoint(){}boundChange(e){Lo(e,e,this.changes)}}function LN(n,e,t){let i=new jN;return it.compare(n,e,t,i),i.changes}function BN(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 zN(n,e){let t=!1;return e&&n.iterChangedRanges((i,l)=>{i<e.to&&l>e.from&&(t=!0)}),t}class Cg extends pl{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 HN(n,e,t=1){let i=n.charCategorizer(e),l=n.doc.lineAt(e),a=e-l.from;if(l.length==0)return X.cursor(e);a==0?t=1:a==l.length&&(t=-1);let o=a,u=a;t<0?o=On(l.text,a,!1):u=On(l.text,a);let f=i(l.text.slice(o,u));for(;o>0;){let d=On(l.text,o,!1);if(i(l.text.slice(d,o))!=f)break;o=d}for(;u<l.length;){let d=On(l.text,u);if(i(l.text.slice(u,d))!=f)break;u=d}return X.undirectionalRange(o+l.from,u+l.from)}function IN(n,e,t,i,l){let a=Math.round((i-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let u=n.viewState.heightOracle.textHeight,f=Math.floor((l-t.top-(n.defaultLineHeight-u)*.5)/u);a+=f*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+v0(o,a,n.state.tabSize)}function R0(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let l;for(let a of i.type){if(a.from>e)break;if(!(a.to<e)){if(a.from<e&&a.to>e)return a;(!l||a.type==Pn.Text&&(l.type!=a.type||(t<0?a.from<e:a.to>e)))&&(l=a)}}return l||i}return i}function UN(n,e,t,i){let l=R0(n,e.head,e.assoc||-1),a=!i||l.type!=Pn.Text||!(n.lineWrapping||l.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(a){let o=n.dom.getBoundingClientRect(),u=n.textDirectionAt(l.from),f=n.posAtCoords({x:t==(u==Lt.LTR)?o.right-1:o.left+1,y:(a.top+a.bottom)/2});if(f!=null)return X.cursor(f,t?-1:1)}return X.cursor(t?l.to:l.from,t?-1:1)}function TS(n,e,t,i){let l=n.state.doc.lineAt(e.head),a=n.bidiSpans(l),o=n.textDirectionAt(l.from);for(let u=e,f=null;;){let d=pN(l,a,o,u,t),p=oA;if(!d){if(l.number==(t?n.state.doc.lines:1))return u;p=`
123
- `,l=n.state.doc.line(l.number+(t?1:-1)),a=n.bidiSpans(l),d=n.visualLineSide(l,!t)}if(f){if(!f(p))return u}else{if(!i)return d;f=i(p)}u=d}}function VN(n,e,t){let i=n.state.charCategorizer(e),l=i(t);return a=>{let o=i(a);return l==Yt.Space&&(l=o),l==o}}function qN(n,e,t,i){let l=e.head,a=t?1:-1;if(l==(t?n.state.doc.length:0))return X.cursor(l,e.assoc);let o=e.goalColumn,u,f=n.contentDOM.getBoundingClientRect(),d=n.coordsAtPos(l,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),p=n.documentTop;if(d)o==null&&(o=d.left-f.left),u=a<0?d.top:d.bottom;else{let w=n.viewState.lineBlockAt(l);o==null&&(o=Math.min(f.right-f.left,n.defaultCharacterWidth*(l-w.from))),u=(a<0?w.top:w.bottom)+p}let b=f.left+o,x=n.viewState.heightOracle.textHeight>>1,S=i??x;for(let w=0;;w+=x){let T=u+(S+w)*a,C=j0(n,{x:b,y:T},!1,a);if(t?T>f.bottom:T<f.top)return X.cursor(C.pos,C.assoc);let E=n.coordsAtPos(C.pos,C.assoc),O=E?(E.top+E.bottom)/2:0;if(!E||(t?O>u:O<u))return X.cursor(C.pos,C.assoc,void 0,o)}}function Cu(n,e,t){for(;;){let i=0;for(let l of n)l.between(e-1,e+1,(a,o,u)=>{if(e>a&&e<o){let f=i||t||(e-a<o-e?-1:1);e=f<0?a:o,i=f}});if(!i)return e}}function CA(n,e){let t=null;for(let i=0;i<e.ranges.length;i++){let l=e.ranges[i],a=null;if(l.empty){let o=Cu(n,l.from,0);o!=l.from&&(a=X.cursor(o,-1))}else{let o=Cu(n,l.from,-1),u=Cu(n,l.to,1);(o!=l.from||u!=l.to)&&(l.undirectional?a=X.undirectionalRange(l.from,l.to):a=X.range(l.from==l.anchor?o:u,l.from==l.head?o:u))}a&&(t||(t=e.ranges.slice()),t[i]=a)}return t?X.create(t,e.mainIndex):e}function Tg(n,e,t){let i=Cu(n.state.facet(Ku).map(l=>l(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:X.cursor(i,i<t.from?1:-1)}class al{constructor(e,t){this.pos=e,this.assoc=t}}function j0(n,e,t,i){let l=n.contentDOM.getBoundingClientRect(),a=l.top+n.viewState.paddingTop,{x:o,y:u}=e,f=u-a,d;for(;;){if(f<0)return new al(0,1);if(f>n.viewState.docHeight)return new al(n.state.doc.length,-1);if(d=n.elementAtHeight(f),i==null)break;if(d.type==Pn.Text){if(i<0?d.to<n.viewport.from:d.from>n.viewport.to)break;let x=n.docView.coordsAt(i<0?d.from:d.to,i>0?-1:1);if(x&&(i<0?x.top<=f+a:x.bottom>=f+a))break}let b=n.viewState.heightOracle.textHeight/2;f=i>0?d.bottom+b:d.top-b}if(n.viewport.from>=d.to||n.viewport.to<=d.from){if(t)return null;if(d.type==Pn.Text){let b=IN(n,l,d,o,u);return new al(b,b==d.from?1:-1)}}if(d.type!=Pn.Text)return f<(d.top+d.bottom)/2?new al(d.from,1):new al(d.to,-1);let p=n.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=n.docView.lineAt(d.from,-2)),new GN(n,o,u,n.textDirectionAt(d.from)).scanTile(p,d.from)}class GN{constructor(e,t,i,l){this.view=e,this.x=t,this.y=i,this.baseDir=l,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:i,spans:l}=this.bidiSpansAt(e);return l[cl.find(l,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:l}=this.bidiSpansAt(e);return l[cl.find(l,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:l}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+l.from<t)}scan(e,t,i=!1){let l=0,a=e.length-1,o=new Set,u=this.bidiIn(e[0],e[a]),f,d,p=-1,b=1e9,x;e:for(;l<a;){let w=a-l,T=l+a>>1;t:if(o.has(T)){let E=l+Math.floor(Math.random()*w);for(let O=0;O<w;O++){if(!o.has(E)){T=E;break t}E++,E==a&&(E=l)}break e}o.add(T);let C=t(T);if(C)for(let E=0;E<C.length;E++){let O=C[E],B=0;if(!(O.width==0&&C.length>1)){if(O.bottom<this.y)(!f||f.bottom<O.bottom)&&(f=O),B=1;else if(O.top>this.y)(!d||d.top>O.top)&&(d=O),B=-1;else{let q=O.left>this.x?this.x-O.left:O.right<this.x?this.x-O.right:0,H=Math.abs(q);H<b&&(p=T,b=H,x=O),q&&(B=q<0==(this.baseDir==Lt.LTR)?-1:1)}B==-1&&(!u||this.baseDirAt(e[T],1))?a=T:B==1&&(!u||this.baseDirAt(e[T+1],-1))&&(l=T+1)}}}if(!x){if(!d&&!f)return{i:e[0],after:!1};let w=f&&(!d||this.y-f.bottom<d.top-this.y)?f:d;return this.y=(w.top+w.bottom)/2,this.scan(e,t,!0)}if(b&&!i){let{top:w,bottom:T}=x;if(f&&f.bottom>(w+w+T)/3)return this.y=f.bottom-1,this.scan(e,t,!0);if(d&&d.top<(w+T+T)/3)return this.y=d.top+1,this.scan(e,t,!0)}let S=(u?this.dirAt(e[p],1):this.baseDir)==Lt.LTR;return{i:p,after:this.x>(x.left+x.right)/2==S}}scanText(e,t){let i=[];for(let a=0;a<e.length;a=On(e.text,a))i.push(t+a);i.push(t+e.length);let l=this.scan(i,a=>{let o=i[a]-t,u=i[a+1]-t;return Lu(e.dom,o,u).getClientRects()});return l.after?new al(i[l.i+1],-1):new al(i[l.i],1)}scanTile(e,t){if(!e.length)return new al(t,1);if(e.children.length==1){let u=e.children[0];if(u.isText())return this.scanText(u,t);if(u.isComposite())return this.scanTile(u,t)}let i=[t];for(let u=0,f=t;u<e.children.length;u++)i.push(f+=e.children[u].length);let l=this.scan(i,u=>{let f=e.children[u];return f.flags&48?null:(f.dom.nodeType==1?f.dom:Lu(f.dom,0,f.length)).getClientRects()}),a=e.children[l.i],o=i[l.i];return a.isText()?this.scanText(a,o):a.isComposite()?this.scanTile(a,o):l.after?new al(i[l.i+1],-1):new al(o,1)}}const Co="￿";class PN{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(dt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Co}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let a=this.text.length;this.readNode(l);let o=Jt.get(l),u=l.nextSibling;if(u==t){o!=null&&o.breakAfter&&!u&&i!=this.view.contentDOM&&this.lineBreak();break}let f=Jt.get(u);(o&&f?o.breakAfter:(o?o.breakAfter:hd(l))||hd(u)&&(l.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>a)&&!FN(u,t)&&this.lineBreak(),l=u}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,o=1,u;if(this.lineSeparator?(a=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(u=l.exec(t))&&(a=u.index,o=u[0].length),this.append(t.slice(i,a<0?t.length:a)),a<0)break;if(this.lineBreak(),o>1)for(let f of this.points)f.node==e&&f.pos>this.text.length&&(f.pos-=o-1);i=a+o}}readNode(e){let t=Jt.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.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 i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(YN(e,i.node,i.offset)?t:0))}}function YN(n,e,t){for(;;){if(!e||t<Gl(e))return!1;if(e==n)return!0;t=qr(e)+1,e=e.parentNode}}function FN(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let i=Jt.get(n);if(!(i!=null&&i.isWidget()))return!1;i&&(t||(t=[])).push(i)}if(t)for(let i of t){let l=i.overrideDOMText;if(l!=null&&l.length)return!1}return!0}class _S{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class WN{constructor(e,t,i,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:a,impreciseAnchor:o}=e.docView,u=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=TA(e.docView.tile,t,i,0))){let f=a||o?[]:KN(e),d=new PN(f,e);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=XN(f,this.bounds.from)}else{let f=e.observer.selectionRange,d=a&&a.node==f.focusNode&&a.offset==f.focusOffset||!_0(e.contentDOM,f.focusNode)?u.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),p=o&&o.node==f.anchorNode&&o.offset==f.anchorOffset||!_0(e.contentDOM,f.anchorNode)?u.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset),b=e.viewport;if((ge.ios||ge.chrome)&&d!=p&&Math.min(d,p)<=u.main.from&&Math.max(d,p)>=u.main.to&&(b.from>0||b.to<e.state.doc.length)){let x=Math.min(d,p),S=Math.max(d,p),w=b.from-x,T=b.to-S;(w==0||w==1||x==0)&&(T==0||T==-1||S==e.state.doc.length)&&(d=0,p=e.state.doc.length)}if(e.inputState.composing>-1&&u.ranges.length>1)this.newSel=u.replaceRange(X.range(p,d));else if(e.lineWrapping&&p==d&&!(u.main.empty&&u.main.head==d)&&e.inputState.lastTouchTime>Date.now()-100){let x=e.coordsAtPos(d,-1),S=0;x&&(S=e.inputState.lastTouchY<=x.bottom?-1:1),this.newSel=X.create([X.cursor(d,S)])}else this.newSel=X.single(p,d)}}}function TA(n,e,t,i){if(n.isComposite()){let l=-1,a=-1,o=-1,u=-1;for(let f=0,d=i,p=i;f<n.children.length;f++){let b=n.children[f],x=d+b.length;if(d<e&&x>t)return TA(b,e,t,d);if(x>=e&&l==-1&&(l=f,a=d),d>t&&b.dom.parentNode==n.dom){o=f,u=p;break}p=x,d=x+b.breakAfter}return{from:a,to:u<0?i+n.length:u,startDOM:(l?n.children[l-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o<n.children.length&&o>=0?n.children[o].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function _A(n,e){let t,{newSel:i}=e,{state:l}=n,a=l.selection.main,o=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:u,to:f}=e.bounds,d=a.from,p=null;(o===8||ge.android&&e.text.length<f-u)&&(d=a.to,p="end");let b=l.doc.sliceString(u,f,Co),x,S;!a.empty&&a.from>=u&&a.to<=f&&(e.typeOver||b!=e.text)&&b.slice(0,a.from-u)==e.text.slice(0,a.from-u)&&b.slice(a.to-u)==e.text.slice(x=e.text.length-(b.length-(a.to-u)))?t={from:a.from,to:a.to,insert:ft.of(e.text.slice(a.from-u,x).split(Co))}:(S=MA(b,e.text,d-u,p))&&(ge.chrome&&o==13&&S.toB==S.from+2&&e.text.slice(S.from,S.toB)==Co+Co&&S.toB--,t={from:u+S.from,to:u+S.toA,insert:ft.of(e.text.slice(S.from,S.toB).split(Co))})}else i&&(!n.hasFocus&&l.facet(Il)||yd(i,a))&&(i=null);if(!t&&!i)return!1;if((ge.mac||ge.android)&&t&&t.from==t.to&&t.from==a.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=X.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:ft.of([t.insert.toString().replace("."," ")])}):l.doc.lineAt(a.from).to<a.to&&n.docView.lineHasWidget(a.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:a.from,to:a.to,insert:l.toText(n.inputState.insertingText)}:ge.chrome&&t&&t.from==t.to&&t.from==a.head&&t.insert.toString()==`
124
- `&&n.lineWrapping&&(i&&(i=X.single(i.main.anchor-1,i.main.head-1)),t={from:a.from,to:a.to,insert:ft.of([" "])}),t)return Cy(n,t,i,o);if(i&&!yd(i,a)){let u=!1,f="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(u=!0),f=n.inputState.lastSelectionOrigin,f=="select.pointer"&&(i=CA(l.facet(Ku).map(d=>d(n)),i))),n.dispatch({selection:i,scrollIntoView:u,userEvent:f}),!0}else return!1}function Cy(n,e,t,i=-1){if(ge.ios&&n.inputState.flushIOSKey(e))return!0;let l=n.state.selection.main;if(ge.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&n.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Bo(n.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&Bo(n.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&Bo(n.contentDOM,"Delete",46)))return!0;let a=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,u=()=>o||(o=$N(n,e,t));return n.state.facet(dA).some(f=>f(n,e.from,e.to,a,u))||n.dispatch(u()),!0}function $N(n,e,t){let i,l=n.state,a=l.selection.main,o=-1;if(e.from==e.to&&e.from<a.from||e.from>a.to){let f=e.from<a.from?-1:1,d=f<0?a.from:a.to,p=Cu(l.facet(Ku).map(b=>b(n)),d,f);e.from==p&&(o=p)}if(o>-1)i={changes:e,selection:X.cursor(e.from+e.insert.length,-1)};else if(e.from>=a.from&&e.to<=a.to&&e.to-e.from>=(a.to-a.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let f=a.from<e.from?l.sliceDoc(a.from,e.from):"",d=a.to>e.to?l.sliceDoc(e.to,a.to):"";i=l.replaceSelection(n.state.toText(f+e.insert.sliceString(0,void 0,n.state.lineBreak)+d))}else{let f=l.changes(e),d=t&&t.main.to<=f.newLength?t.main:void 0;if(l.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=a.to+10&&e.to>=a.to-10){let p=n.state.sliceDoc(e.from,e.to),b,x=t&&AA(n,t.main.head);if(x){let w=e.insert.length-(e.to-e.from);b={from:x.from,to:x.to-w}}else b=n.state.doc.lineAt(a.head);let S=a.to-e.to;i=l.changeByRange(w=>{if(w.from==a.from&&w.to==a.to)return{changes:f,range:d||w.map(f)};let T=w.to-S,C=T-p.length;if(n.state.sliceDoc(C,T)!=p||T>=b.from&&C<=b.to)return{range:w};let E=l.changes({from:C,to:T,insert:e.insert}),O=w.to-a.to;return{changes:E,range:d?X.range(Math.max(0,d.anchor+O),Math.max(0,d.head+O)):w.map(E)}})}else i={changes:f,selection:d&&l.selection.replaceRange(d)}}let u="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,u+=".compose",n.inputState.compositionFirstChange&&(u+=".start",n.inputState.compositionFirstChange=!1)),l.update(i,{userEvent:u,scrollIntoView:!0})}function MA(n,e,t,i){let l=Math.min(n.length,e.length),a=0;for(;a<l&&n.charCodeAt(a)==e.charCodeAt(a);)a++;if(a==l&&n.length==e.length)return null;let o=n.length,u=e.length;for(;o>0&&u>0&&n.charCodeAt(o-1)==e.charCodeAt(u-1);)o--,u--;if(i=="end"){let f=Math.max(0,a-Math.min(o,u));t-=o+f-a}if(o<a&&n.length<e.length){let f=t<=a&&t>=o?a-t:0;a-=f,u=a+(u-o),o=a}else if(u<a){let f=t<=a&&t>=u?a-t:0;a-=f,o=a+(o-u),u=a}return{from:a,toA:o,toB:u}}function KN(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:a}=n.observer.selectionRange;return t&&(e.push(new _S(t,i)),(l!=t||a!=i)&&e.push(new _S(l,a))),e}function XN(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?X.single(t+e,i+e):null}function yd(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class QN{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ge.safari&&e.contentDOM.addEventListener("input",()=>null),ge.gecko&&dD(e.contentDOM.ownerDocument)}handleEvent(e){!rD(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 i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=JN(e),i=this.handlers,l=this.view.contentDOM;for(let a in t)if(a!="scroll"){let o=!t[a].handlers.length,u=i[a];u&&o!=!u.handlers.length&&(l.removeEventListener(a,this.handleEvent),u=null),u||l.addEventListener(a,this.handleEvent,{passive:o})}for(let a in i)a!="scroll"&&!t[a]&&l.removeEventListener(a,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&&NA.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ge.android&&ge.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(ge.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(EA.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||eD.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return t.shiftKey&&ge.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&ZN(this.view.win)&&(t.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t},setTimeout(()=>this.flushIOSKey(),250),!0}return 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,Bo(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:ge.safari&&!ge.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ZN(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function MS(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(l){Ti(t.state,l)}}}function JN(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let l=i.spec,a=l&&l.plugin.domEventHandlers,o=l&&l.plugin.domEventObservers;if(a)for(let u in a){let f=a[u];f&&t(u).handlers.push(MS(i.value,f))}if(o)for(let u in o){let f=o[u];f&&t(u).observers.push(MS(i.value,f))}}for(let i in Ls)t(i).handlers.push(Ls[i]);for(let i in pi)t(i).observers.push(pi[i]);return e}const EA=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],eD="dthko",NA=[16,17,18,20,91,92,224,225],Nh=6;function Dh(n){return Math.max(0,n)*.7+8}function tD(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class nD{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Jk(e.contentDOM),this.atoms=e.state.facet(Ku).map(o=>o(e));let a=e.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(dt.allowMultipleSelections)&&iD(e,t),this.dragging=lD(e,t)&&RA(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&&tD(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,a=0,o=this.view.win.innerWidth,u=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:u}=this.scrollParents.y.getBoundingClientRect());let f=Ay(this.view);e.clientX-f.left<=l+Nh?t=-Dh(l-e.clientX):e.clientX+f.right>=o-Nh&&(t=Dh(e.clientX-o)),e.clientY-f.top<=a+Nh?i=-Dh(a-e.clientY):e.clientY+f.bottom>=u-Nh&&(i=Dh(e.clientY-u)),this.setScrollSpeed(t,i)}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,i=CA(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,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 iD(n,e){let t=n.state.facet(cA);return t.length?t[0](e):ge.mac?e.metaKey:e.ctrlKey}function sD(n,e){let t=n.state.facet(uA);return t.length?t[0](e):ge.mac?!e.altKey:!e.ctrlKey}function lD(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=ju(n.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let a=0;a<l.length;a++){let o=l[a];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function rD(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=Jt.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const Ls=Object.create(null),pi=Object.create(null),DA=ge.ie&&ge.ie_version<15||ge.ios&&ge.webkit_version<604;function aD(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(),OA(n,t.value)},50)}function Pd(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function OA(n,e){e=Pd(n.state,vy,e);let{state:t}=n,i,l=1,a=t.toText(e),o=a.lines==t.selection.ranges.length;if(L0!=null&&t.selection.ranges.every(f=>f.empty)&&L0==a.toString()){let f=-1;i=t.changeByRange(d=>{let p=t.doc.lineAt(d.from);if(p.from==f)return{range:d};f=p.from;let b=t.toText((o?a.line(l++).text:e)+t.lineBreak);return{changes:{from:p.from,insert:b},range:X.cursor(d.from+b.length)}})}else o?i=t.changeByRange(f=>{let d=a.line(l++);return{changes:{from:f.from,to:f.to,insert:d.text},range:X.cursor(f.from+d.length)}}):i=t.replaceSelection(a);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}pi.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,ge.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};pi.wheel=pi.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};Ls.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);pi.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};pi.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};pi.touchend=(n,e)=>{n.inputState.touchActive=!1};Ls.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(fA))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=cD(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new nD(n,e,t,i)),i&&n.observer.ignore(()=>{eA(n.contentDOM);let a=n.root.activeElement;a&&!a.contains(n.contentDOM)&&a.blur()});let l=n.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function ES(n,e,t,i){if(i==1)return X.cursor(e,t);if(i==2)return HN(n.state,e,t);{let l=n.docView.lineAt(e,t),a=n.state.doc.lineAt(l?l.posAtEnd:e),o=l?l.posAtStart:a.from,u=l?l.posAtEnd:a.to;return u<n.state.doc.length&&u==a.to&&u++,X.undirectionalRange(o,u)}}const oD=ge.ie&&ge.ie_version<=11;let NS=null,DS=0,OS=0;function RA(n){if(!oD)return n.detail;let e=NS,t=OS;return NS=n,OS=Date.now(),DS=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(DS+1)%3:1}function cD(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=RA(e),l=n.state.selection;return{update(a){a.docChanged&&(t.pos=a.changes.mapPos(t.pos),l=l.map(a.changes))},get(a,o,u){let f=n.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),d,p=ES(n,f.pos,f.assoc,i);if(t.pos!=f.pos&&!o){let b=ES(n,t.pos,t.assoc,i),x=Math.min(b.from,p.from),S=Math.max(b.to,p.to);p=x<p.from?X.range(x,S,p.assoc):X.range(S,x,p.assoc)}return o?l.replaceRange(l.main.extend(p.from,p.to,p.assoc)):u&&i==1&&l.ranges.length>1&&(d=uD(l,f.pos))?d:u?l.addRange(p):X.create([p])}}}function uD(n,e){for(let t=0;t<n.ranges.length;t++){let{from:i,to:l}=n.ranges[t];if(i<=e&&l>=e)return X.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}Ls.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let l=n.docView.tile.nearest(e.target);if(l&&l.isWidget()){let a=l.posAtStart,o=a+l.length;(a>=t.to||o<=t.from)&&(t=X.undirectionalRange(a,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Pd(n.state,Sy,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ls.dragend=n=>(n.inputState.draggedContent=null,!1);function RS(n,e,t,i){if(t=Pd(n.state,vy,t),!t)return;let l=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:a}=n.inputState,o=i&&a&&sD(n,e)?{from:a.from,to:a.to}:null,u={from:l,insert:t},f=n.state.changes(o?[o,u]:u);n.focus(),n.dispatch({changes:f,selection:{anchor:f.mapPos(l,-1),head:f.mapPos(l,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Ls.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),l=0,a=()=>{++l==t.length&&RS(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let u=new FileReader;u.onerror=a,u.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(u.result)||(i[o]=u.result),a()},u.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return RS(n,e,i,!0),!0}return!1};Ls.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=DA?null:e.clipboardData;return t?(OA(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(aD(n),!1)};function fD(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function hD(n){let e=[],t=[],i=!1;for(let l of n.selection.ranges)l.empty||(e.push(n.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:a}of n.selection.ranges){let o=n.doc.lineAt(a);o.number>l&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),l=o.number}i=!0}return{text:Pd(n,Sy,e.join(n.lineBreak)),ranges:t,linewise:i}}let L0=null;Ls.copy=Ls.cut=(n,e)=>{if(!ku(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:l}=hD(n.state);if(!t&&!l)return!1;L0=l?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let a=DA?null:e.clipboardData;return a?(a.clearData(),a.setData("text/plain",t),!0):(fD(n,t),!1)};const jA=Fl.define();function LA(n,e){let t=[];for(let i of n.facet(pA)){let l=i(n,e);l&&t.push(l)}return t.length?n.update({effects:t,annotations:jA.of(!0)}):null}function BA(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=LA(n.state,e);t?n.dispatch(t):n.update([])}},10)}pi.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),BA(n)};pi.blur=n=>{n.observer.clearSelectionRange(),BA(n)};pi.compositionstart=pi.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};pi.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,ge.chrome&&ge.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};pi.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Ls.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let a=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(a&&o.length){let u=o[0],f=n.posAtDOM(u.startContainer,u.startOffset),d=n.posAtDOM(u.endContainer,u.endOffset);return Cy(n,{from:f,to:d,insert:n.state.toText(a)},null),!0}}let l;if(ge.chrome&&ge.android&&(l=EA.find(a=>a.inputType==e.inputType))&&(n.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let a=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>a+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return ge.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),ge.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>pi.compositionend(n,e),20),!1};const jS=new Set;function dD(n){jS.has(n)||(jS.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const LS=["pre-wrap","normal","pre-line","break-spaces"];let Jo=!1;function BS(){Jo=!1}class pD{constructor(e){this.lineWrapping=e,this.doc=ft.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}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 LS.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let l=e[i];l<0?i++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,i,l,a,o){let u=LS.indexOf(e)>-1,f=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=u;if(this.lineWrapping=u,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=a,f){this.heightSamples={};for(let d=0;d<o.length;d++){let p=o[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return f}}class mD{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Ds{constructor(e,t,i,l,a){this.from=e,this.length=t,this.top=i,this.height=l,this._content=a}get type(){return typeof this._content=="number"?Pn.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 Ra?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 Ds(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Ht=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(Ht||(Ht={}));const ed=.001;class di{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}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)>ed&&(Jo=!0),this.height=e)}replace(e,t,i){return di.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let a=this,o=i.doc;for(let u=l.length-1;u>=0;u--){let{fromA:f,toA:d,fromB:p,toB:b}=l[u],x=a.lineAt(f,Ht.ByPosNoHeight,i.setDoc(t),0,0),S=x.to>=d?x:a.lineAt(d,Ht.ByPosNoHeight,i,0,0);for(b+=S.to-d,d=S.to;u>0&&x.from<=l[u-1].toA;)f=l[u-1].fromA,p=l[u-1].fromB,u--,f<x.from&&(x=a.lineAt(f,Ht.ByPosNoHeight,i,0,0));p+=x.from-f,f=x.from;let w=Ty.build(i.setDoc(o),e,p,b);a=bd(a,a.replace(f,d,w))}return a.updateHeight(i,0)}static empty(){return new Fi(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,l=0,a=0;for(;;)if(t==i)if(l>a*2){let u=e[t-1];u.break?e.splice(--t,1,u.left,null,u.right):e.splice(--t,1,u.left,u.right),i+=1+u.break,l-=u.size}else if(a>l*2){let u=e[i];u.break?e.splice(i,1,u.left,null,u.right):e.splice(i,1,u.left,u.right),i+=2+u.break,a-=u.size}else break;else if(l<a){let u=e[t++];u&&(l+=u.size)}else{let u=e[--i];u&&(a+=u.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,i++),new yD(di.of(e.slice(0,t)),o,di.of(e.slice(i)))}}function bd(n,e){return n==e?n:(n.constructor!=e.constructor&&(Jo=!0),e)}di.prototype.size=1;const gD=Le.replace({});class zA extends di{constructor(e,t,i){super(e,t),this.deco=i,this.spaceAbove=0}mainBlock(e,t){return new Ds(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,i,l){return this.spaceAbove&&e<i+this.spaceAbove?new Ds(l,0,i,this.spaceAbove,gD):this.mainBlock(i,l)}lineAt(e,t,i,l,a){let o=this.mainBlock(l,a);return this.spaceAbove?this.blockAt(0,i,l,a).join(o):o}forEachLine(e,t,i,l,a,o){e<=a+this.length&&t>=a&&o(this.lineAt(0,Ht.ByPos,i,l,a))}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,i=!1,l){return l&&l.from<=t&&l.more&&this.setMeasuredHeight(l),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Fi extends zA{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Ds(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Fi||l instanceof Un&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof Un?l=new Fi(l.length,this.height,this.spaceAbove):l.height=this.height,this.outdated||(l.outdated=!1),l):di.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setMeasuredHeight(l):(i||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 Un extends di{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,a=l-i+1,o,u=0;if(e.lineWrapping){let f=Math.min(this.height,e.lineHeight*a);o=f/a,this.length>a+1&&(u=(this.height-f)/(this.length-a-1))}else o=this.height/a;return{firstLine:i,lastLine:l,perLine:o,perChar:u}}blockAt(e,t,i,l){let{firstLine:a,lastLine:o,perLine:u,perChar:f}=this.heightMetrics(t,l);if(t.lineWrapping){let d=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),p=t.doc.lineAt(d),b=u+p.length*f,x=Math.max(i,e-b/2);return new Ds(p.from,p.length,x,b,0)}else{let d=Math.max(0,Math.min(o-a,Math.floor((e-i)/u))),{from:p,length:b}=t.doc.line(a+d);return new Ds(p,b,i+u*d,u,0)}}lineAt(e,t,i,l,a){if(t==Ht.ByHeight)return this.blockAt(e,i,l,a);if(t==Ht.ByPosNoHeight){let{from:S,to:w}=i.doc.lineAt(e);return new Ds(S,w-S,0,0,0)}let{firstLine:o,perLine:u,perChar:f}=this.heightMetrics(i,a),d=i.doc.lineAt(e),p=u+d.length*f,b=d.number-o,x=l+u*b+f*(d.from-a-b);return new Ds(d.from,d.length,Math.max(l,Math.min(x,l+this.height-p)),p,0)}forEachLine(e,t,i,l,a,o){e=Math.max(e,a),t=Math.min(t,a+this.length);let{firstLine:u,perLine:f,perChar:d}=this.heightMetrics(i,a);for(let p=e,b=l;p<=t;){let x=i.doc.lineAt(p);if(p==e){let w=x.number-u;b+=f*w+d*(e-a-w)}let S=f+d*x.length;o(new Ds(x.from,x.length,b,S,0)),b+=S,p=x.to+1}}replace(e,t,i){let l=this.length-t;if(l>0){let a=i[i.length-1];a instanceof Un?i[i.length-1]=new Un(a.length+l):i.push(null,new Un(l-1))}if(e>0){let a=i[0];a instanceof Un?i[0]=new Un(e+a.length):i.unshift(new Un(e-1),null)}return di.of(i)}decomposeLeft(e,t){t.push(new Un(e-1),null)}decomposeRight(e,t){t.push(null,new Un(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let a=t+this.length;if(l&&l.from<=t+this.length&&l.more){let o=[],u=Math.max(t,l.from),f=-1;for(l.from>t&&o.push(new Un(l.from-t-1).updateHeight(e,t));u<=a&&l.more;){let p=e.doc.lineAt(u).length;o.length&&o.push(null);let b=l.heights[l.index++],x=0;b<0&&(x=-b,b=l.heights[l.index++]),f==-1?f=b:Math.abs(b-f)>=ed&&(f=-2);let S=new Fi(p,b,x);S.outdated=!1,o.push(S),u+=p+1}u<=a&&o.push(null,new Un(a-u).updateHeight(e,u));let d=di.of(o);return(f<0||Math.abs(d.height-this.height)>=ed||Math.abs(f-this.heightMetrics(e,t).perLine)>=ed)&&(Jo=!0),bd(this,d)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class yD extends di{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let a=i+this.left.height;return e<a?this.left.blockAt(e,t,i,l):this.right.blockAt(e,t,a,l+this.left.length+this.break)}lineAt(e,t,i,l,a){let o=l+this.left.height,u=a+this.left.length+this.break,f=t==Ht.ByHeight?e<o:e<u,d=f?this.left.lineAt(e,t,i,l,a):this.right.lineAt(e,t,i,o,u);if(this.break||(f?d.to<u:d.from>u))return d;let p=t==Ht.ByPosNoHeight?Ht.ByPosNoHeight:Ht.ByPos;return f?d.join(this.right.lineAt(u,p,i,o,u)):this.left.lineAt(u,p,i,l,a).join(d)}forEachLine(e,t,i,l,a,o){let u=l+this.left.height,f=a+this.left.length+this.break;if(this.break)e<f&&this.left.forEachLine(e,t,i,l,a,o),t>=f&&this.right.forEachLine(e,t,i,u,f,o);else{let d=this.lineAt(f,Ht.ByPos,i,l,a);e<d.from&&this.left.forEachLine(e,d.from-1,i,l,a,o),d.to>=e&&d.from<=t&&o(d),t>d.to&&this.right.forEachLine(d.to+1,t,i,u,f,o)}}replace(e,t,i){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let a=[];e>0&&this.decomposeLeft(e,a);let o=a.length;for(let u of i)a.push(u);if(e>0&&zS(a,o-1),t<this.length){let u=a.length;this.decomposeRight(t,a),zS(a,u)}return di.of(a)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<l&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?di.of(this.break?[e,null,t]:[e,t]):(this.left=bd(this.left,e),this.right=bd(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,i=!1,l){let{left:a,right:o}=this,u=t+a.length+this.break,f=null;return l&&l.from<=t+a.length&&l.more?f=a=a.updateHeight(e,t,i,l):a.updateHeight(e,t,i),l&&l.from<=u+o.length&&l.more?f=o=o.updateHeight(e,u,i,l):o.updateHeight(e,u,i),f?this.balanced(a,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function zS(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof Un&&(i=n[e+1])instanceof Un&&n.splice(e-1,3,new Un(t.length+1+i.length))}const bD=5;class Ty{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 i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Fi?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Fi(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let l=i.widget?i.widget.estimatedHeight:0,a=i.widget?i.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let o=t-e;i.block?this.addBlock(new zA(o,l,i)):(o||a||l>=bD)&&this.addLineDeco(l,a,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Fi(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new Un(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Fi)return e;let t=new Fi(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,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Fi)&&!this.isCovered?this.nodes.push(new Fi(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let l of this.nodes)l instanceof Fi&&l.updateHeight(this.oracle,i),i+=l?l.length:1;return this.nodes}static build(e,t,i,l){let a=new Ty(i,e);return it.spans(t,i,l,a,0),a.finish(i)}}function xD(n,e,t){let i=new vD;return it.compare(n,e,t,i,0),i.changes}class vD{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,l){(e<t||i&&i.heightRelevant||l&&l.heightRelevant)&&Lo(e,t,this.changes,5)}}function SD(n,e){let t=n.getBoundingClientRect(),i=n.ownerDocument,l=i.defaultView||window,a=Math.max(0,t.left),o=Math.min(l.innerWidth,t.right),u=Math.max(0,t.top),f=Math.min(l.innerHeight,t.bottom);for(let d=n.parentNode;d&&d!=i.body;)if(d.nodeType==1){let p=d,b=window.getComputedStyle(p);if((p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth)&&b.overflow!="visible"){let x=p.getBoundingClientRect();a=Math.max(a,x.left),o=Math.min(o,x.right),u=Math.max(u,x.top),f=Math.min(d==n.parentNode?l.innerHeight:f,x.bottom)}d=b.position=="absolute"||b.position=="fixed"?p.offsetParent:p.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:a-t.left,right:Math.max(a,o)-t.left,top:u-(t.top+e),bottom:Math.max(u,f)-(t.top+e)}}function wD(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 kD(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class _g{constructor(e,t,i,l){this.from=e,this.to=t,this.size=i,this.displaySize=l}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let l=e[i],a=t[i];if(l.from!=a.from||l.to!=a.to||l.size!=a.size)return!1}return!0}draw(e,t){return Le.replace({widget:new AD(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class AD extends pl{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 HS{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=IS,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Lt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=t.facet(wy).some(l=>typeof l!="function"&&l.class=="cm-lineWrapping");this.heightOracle=new pD(i),this.stateDeco=US(t),this.heightMap=di.empty().applyChanges(this.stateDeco,ft.empty,this.heightOracle.setDoc(t.doc),[new os(0,0,0,t.doc.length)]);for(let l=0;l<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());l++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Le.set(this.lineGaps.map(l=>l.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:a,to:o})=>l>=a&&l<=o)){let{from:a,to:o}=this.lineBlockAt(l);e.push(new Oh(a,o))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?IS:new _y(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(xu(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=US(this.state);let l=e.changedRanges,a=os.extendWithRanges(l,xD(i,this.stateDeco,e?e.changes:bn.empty(this.state.doc.length))),o=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);BS(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=o||Jo)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let f=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<f.from||t.range.head>f.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,t));let d=f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(gA)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,a=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Lt.RTL:Lt.LTR;let o=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent==="refresh",u=t.getBoundingClientRect(),f=o||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let d=0,p=0;if(u.width&&u.height){let{scaleX:H,scaleY:L}=Zk(t,u);(H>.005&&Math.abs(this.scaleX-H)>.005||L>.005&&Math.abs(this.scaleY-L)>.005)&&(this.scaleX=H,this.scaleY=L,d|=16,o=f=!0)}let b=(parseInt(i.paddingTop)||0)*this.scaleY,x=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=b||this.paddingBottom!=x)&&(this.paddingTop=b,this.paddingBottom=x,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(f=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let S=Jk(this.view.contentDOM,!1).y;S!=this.scrollParent&&(this.scrollParent=S,this.scrollAnchorHeight=-1,this.scrollOffset=0);let w=this.getScrollOffset();this.scrollOffset!=w&&(this.scrollAnchorHeight=-1,this.scrollOffset=w),this.scrolledToBottom=tA(this.scrollParent||e.win);let T=(this.printing?kD:SD)(t,this.paddingTop),C=T.top-this.pixelViewport.top,E=T.bottom-this.pixelViewport.bottom;this.pixelViewport=T;let O=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(O!=this.inView&&(this.inView=O,O&&(f=!0)),!this.inView&&!this.scrollTarget&&!wD(e.dom))return 0;let B=u.width;if((this.contentDOMWidth!=B||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),f){let H=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(H)&&(o=!0),o||l.lineWrapping&&Math.abs(B-this.contentDOMWidth)>l.charWidth){let{lineHeight:L,charWidth:j,textHeight:se}=e.docView.measureTextSize();o=L>0&&l.refresh(a,L,j,se,Math.max(5,B/j),H),o&&(e.docView.minWidth=0,d|=16)}C>0&&E>0?p=Math.max(C,E):C<0&&E<0&&(p=Math.min(C,E)),BS();for(let L of this.viewports){let j=L.from==this.viewport.from?H:e.docView.measureVisibleLineHeights(L);this.heightMap=(o?di.empty().applyChanges(this.stateDeco,ft.empty,this.heightOracle,[new os(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,o,new mD(L.from,j))}Jo&&(d|=2)}let q=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return q&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||q)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,a=this.heightOracle,{visibleTop:o,visibleBottom:u}=this,f=new Oh(l.lineAt(o-i*1e3,Ht.ByHeight,a,0,0).from,l.lineAt(u+(1-i)*1e3,Ht.ByHeight,a,0,0).to);if(t){let{head:d}=t.range;if(d<f.from||d>f.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),b=l.lineAt(d,Ht.ByPos,a,0,0),x;t.y=="center"?x=(b.top+b.bottom)/2-p/2:t.y=="start"||t.y=="nearest"&&d<f.from?x=b.top:x=b.bottom-p,f=new Oh(l.lineAt(x-1e3/2,Ht.ByHeight,a,0,0).from,l.lineAt(x+p+1e3/2,Ht.ByHeight,a,0,0).to)}}return f}mapViewport(e,t){let i=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Oh(this.heightMap.lineAt(i,Ht.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,Ht.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,Ht.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(t,Ht.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:u}=this;return(e==0||l<=o-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||a>=u+Math.max(10,Math.min(i,250)))&&l>o-2*1e3&&a<u+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let l of e)t.touchesRange(l.from,l.to)||i.push(new _g(t.mapPos(l.from),t.mapPos(l.to),l.size,l.displaySize));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,l=i?1e4:2e3,a=l>>1,o=l<<1;if(this.defaultTextDirection!=Lt.LTR&&!i)return[];let u=[],f=(p,b,x,S)=>{if(b-p<a)return;let w=this.state.selection.main,T=[w.from];w.empty||T.push(w.to);for(let E of T)if(E>p&&E<b){f(p,E-10,x,S),f(E+10,b,x,S);return}let C=TD(e,E=>E.from>=x.from&&E.to<=x.to&&Math.abs(E.from-p)<a&&Math.abs(E.to-b)<a&&!T.some(O=>E.from<O&&E.to>O));if(!C){if(b<x.to&&t&&i&&t.visibleRanges.some(B=>B.from<=b&&B.to>=b)){let B=t.moveToLineBoundary(X.cursor(b),!1,!0).head;B>p&&(b=B)}let E=this.gapSize(x,p,b,S),O=i||E<2e6?E:2e6;C=new _g(p,b,E,O)}u.push(C)},d=p=>{if(p.length<o||p.type!=Pn.Text)return;let b=CD(p.from,p.to,this.stateDeco);if(b.total<o)return;let x=this.scrollTarget?this.scrollTarget.range.head:null,S,w;if(i){let T=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,C,E;if(x!=null){let O=jh(b,x),B=((this.visibleBottom-this.visibleTop)/2+T)/p.height;C=O-B,E=O+B}else C=(this.visibleTop-p.top-T)/p.height,E=(this.visibleBottom-p.top+T)/p.height;S=Rh(b,C),w=Rh(b,E)}else{let T=b.total*this.heightOracle.charWidth,C=l*this.heightOracle.charWidth,E=0;if(T>2e6)for(let L of e)L.from>=p.from&&L.from<p.to&&L.size!=L.displaySize&&L.from*this.heightOracle.charWidth+E<this.pixelViewport.left&&(E=L.size-L.displaySize);let O=this.pixelViewport.left+E,B=this.pixelViewport.right+E,q,H;if(x!=null){let L=jh(b,x),j=((B-O)/2+C)/T;q=L-j,H=L+j}else q=(O-C)/T,H=(B+C)/T;S=Rh(b,q),w=Rh(b,H)}S>p.from&&f(p.from,S,p,b),w<p.to&&f(w,p.to,p,b)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return u}gapSize(e,t,i,l){let a=jh(l,i)-jh(l,t);return this.heightOracle.lineWrapping?e.height*a:l.total*this.heightOracle.charWidth*a}updateLineGaps(e){_g.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Le.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 i=[];it.spans(t,this.viewport.from,this.viewport.to,{span(a,o){i.push({from:a,to:o})},point(){}},20);let l=0;if(i.length!=this.visibleRanges.length)l=12;else for(let a=0;a<i.length&&!(l&8);a++){let o=this.visibleRanges[a],u=i[a];(o.from!=u.from||o.to!=u.to)&&(l|=4,e&&e.mapPos(o.from,-1)==u.from&&e.mapPos(o.to,1)==u.to||(l|=8))}return this.visibleRanges=i,l}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||xu(this.heightMap.lineAt(e,Ht.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)||xu(this.heightMap.lineAt(this.scaler.fromDOM(e),Ht.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return xu(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 Oh{constructor(e,t){this.from=e,this.to=t}}function CD(n,e,t){let i=[],l=n,a=0;return it.spans(t,n,e,{span(){},point(o,u){o>l&&(i.push({from:l,to:o}),a+=o-l),l=u}},20),l<e&&(i.push({from:l,to:e}),a+=e-l),{total:a,ranges:i}}function Rh({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let l=0;;l++){let{from:a,to:o}=e[l],u=o-a;if(i<=u)return a+i;i-=u}}function jh(n,e){let t=0;for(let{from:i,to:l}of n.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/n.total}function TD(n,e){for(let t of n)if(e(t))return t}const IS={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function US(n){let e=n.facet(Vd).filter(i=>typeof i!="function"),t=n.facet(ky).filter(i=>typeof i!="function");return t.length&&e.push(it.join(t)),e}class _y{constructor(e,t,i){let l=0,a=0,o=0;this.viewports=i.map(({from:u,to:f})=>{let d=t.lineAt(u,Ht.ByPos,e,0,0).top,p=t.lineAt(f,Ht.ByPos,e,0,0).bottom;return l+=p-d,{from:u,to:f,top:d,bottom:p,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.height-l);for(let u of this.viewports)u.domTop=o+(u.top-a)*this.scale,o=u.domBottom=u.domTop+(u.bottom-u.top),a=u.bottom}toDOM(e){for(let t=0,i=0,l=0;;t++){let a=t<this.viewports.length?this.viewports[t]:null;if(!a||e<a.top)return l+(e-i)*this.scale;if(e<=a.bottom)return a.domTop+(e-a.top);i=a.bottom,l=a.domBottom}}fromDOM(e){for(let t=0,i=0,l=0;;t++){let a=t<this.viewports.length?this.viewports[t]:null;if(!a||e<a.domTop)return i+(e-l)/this.scale;if(e<=a.domBottom)return a.top+(e-a.domTop);i=a.bottom,l=a.domBottom}}eq(e){return e instanceof _y?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function xu(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Ds(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(l=>xu(l,e)):n._content)}const Lh=be.define({combine:n=>n.join(" ")}),B0=be.define({combine:n=>n.indexOf(!0)>-1}),z0=Ur.newName(),HA=Ur.newName(),IA=Ur.newName(),UA={"&light":"."+HA,"&dark":"."+IA};function H0(n,e,t){return new Ur(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return n;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):n+" "+i}})}const _D=H0("."+z0,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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"}},UA),MD={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Mg=ge.ie&&ge.ie_version<=11;class ED{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new sN,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 i of t)this.queue.push(i);(ge.ie&&ge.ie_version<=11||ge.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&ge.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ge.chrome&&ge.chrome_version<126)&&(this.editContext=new DD(e),e.state.facet(Il)&&(e.contentDOM.editContext=this.editContext.editContext)),Mg&&(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,i)=>t!=e[i]))){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:i}=this,l=this.selectionRange;if(i.state.facet(Il)?i.root.activeElement!=this.dom:!ku(this.dom,l))return;let a=l.anchorNode&&i.docView.tile.nearest(l.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ge.ie&&ge.ie_version<=11||ge.android&&ge.chrome)&&!i.state.selection.main.empty&&l.focusNode&&Au(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ju(e.root);if(!t)return!1;let i=ge.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&ND(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=ku(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&rN(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),l&&(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 i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.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,MD),Mg&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Mg&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let l=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&Bo(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.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,i=-1,l=!1;for(let a of e){let o=this.readMutation(a);o&&(o.typeOver&&(l=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&ku(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new WN(this.view,e,t,i);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}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 i=this.view.state,l=_A(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!yd(this.view.state.selection,t.newSel.main))&&this.view.update([]),l}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 i=VS(t,e.previousSibling||e.target.previousSibling,-1),l=VS(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:l?t.posBefore(l):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(Il)!=e.state.facet(Il)&&(e.view.contentDOM.editContext=e.state.facet(Il)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let l of this.scrollTargets)l.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 VS(n,e,t){for(;e;){let i=Jt.get(e);if(i&&i.parent==n)return i;let l=e.parentNode;e=l!=n.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function qS(n,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,a=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Au(o.node,o.offset,l,a)&&([t,i,l,a]=[l,a,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:a}}function ND(n,e){if(e.getComposedRanges){let l=e.getComposedRanges(n.root)[0];if(l)return qS(n,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?qS(n,t):null}class DD{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=i=>{let l=e.state.selection.main,{anchor:a,head:o}=l,u=this.toEditorPos(i.updateRangeStart),f=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:u,drifted:!1});let d=f-u>i.text.length;u==this.from&&a<this.from?u=a:f==this.to&&a>this.to&&(f=a);let p=MA(e.state.sliceDoc(u,f),i.text,(d?l.from:l.to)-u,d?"end":null);if(!p){let x=X.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));yd(x,l)||e.dispatch({selection:x,userEvent:"select"});return}let b={from:p.from+u,to:p.toA+u,insert:ft.of(i.text.slice(p.from,p.toB).split(`
125
- `))};if((ge.mac||ge.android)&&b.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(b={from:u,to:f,insert:ft.of([i.text.replace("."," ")])}),this.pendingContextChange=b,!e.state.readOnly){let x=this.to-this.from+(b.to-b.from+b.insert.length);Cy(e,b,X.single(this.toEditorPos(i.selectionStart,x),this.toEditorPos(i.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),b.from<b.to&&!b.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let l=[],a=null;for(let o=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);o<u;o++){let f=e.coordsForChar(o);a=f&&new DOMRect(f.left,f.top,f.right-f.left,f.bottom-f.top)||a||new DOMRect,l.push(a)}t.updateCharacterBounds(i.rangeStart,l)},this.handlers.textformatupdate=i=>{let l=[];for(let a of i.getTextFormats()){let o=a.underlineStyle,u=a.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(u)){let f=this.toEditorPos(a.rangeStart),d=this.toEditorPos(a.rangeEnd);if(f<d){let p=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(u)?1:2}px`;l.push(Le.mark({attributes:{style:p}}).range(f,d))}}}e.dispatch({effects:bA.of(Le.set(l))})},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:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let l=ju(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((a,o,u,f,d)=>{if(i)return;let p=d.length-(o-a);if(l&&o>=l.to)if(l.from==a&&l.to==o&&l.insert.eq(d)){l=this.pendingContextChange=null,t+=p,this.to+=p;return}else l=null,this.revertPending(e.state);if(a+=t,o+=t,o<=this.from)this.from+=p,this.to+=p;else if(a<this.to){if(a<this.from||o>this.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(o),d.toString()),this.to+=p}t+=p}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(l=>!l.isUserEvent("input.type")&&l.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,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}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 i=this.composing;return i&&i.drifted?i.editorBase+(e-i.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 ye{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:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(a=>i(a,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||lN(e.parent)||document,this.viewState=new HS(this,e.state||dt.create(e)),e.scrollTo&&e.scrollTo.is(Eh)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Mo).map(l=>new wg(l));for(let l of this.plugins)l.update(this);this.observer=new ED(this),this.inputState=new QN(this),this.inputState.ensureHandlers(this.plugins),this.docView=new CS(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof dn?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,i=!1,l,a=this.state;for(let x of e){if(x.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=x.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,u=0,f=null;e.some(x=>x.annotation(jA))?(this.inputState.notifiedFocused=o,u=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,f=LA(a,o),f||(u=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(p=null)):this.observer.clear(),a.facet(dt.phrases)!=this.state.facet(dt.phrases))return this.setState(a);l=pd.create(this,a,e),l.flags|=u;let b=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(b&&(b=b.map(x.changes)),x.scrollIntoView){let{main:S}=x.state.selection,{x:w,y:T}=this.state.facet(ye.cursorScrollMargin);b=new zo(S.empty?S:X.cursor(S.head,S.head>S.anchor?-1:1),"nearest","nearest",T,w)}for(let S of x.effects)S.is(Eh)&&(b=S.value.clip(this.state))}this.viewState.update(l,b),this.bidiCache=xd.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(bu)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Lh)!=l.state.facet(Lh)&&(this.viewState.mustMeasureContent=!0),(t||i||b||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let x of this.state.facet(D0))try{x(l)}catch(S){Ti(this.state,S,"update listener")}(f||p)&&Promise.resolve().then(()=>{f&&this.state==f.startState&&this.dispatch(f),p&&!_A(this,p)&&d.force&&Bo(this.contentDOM,d.key,d.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 i of this.plugins)i.destroy(this);this.viewState=new HS(this,e),this.plugins=e.facet(Mo).map(i=>new wg(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new CS(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(Mo),i=e.state.facet(Mo);if(t!=i){let l=[];for(let a of i){let o=t.indexOf(a);if(o<0)l.push(new wg(a));else{let u=this.plugins[o];u.mustUpdate=e,l.push(u)}}for(let a of this.plugins)a.mustUpdate!=e&&a.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);t!=i&&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(i){Ti(this.state,i,"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,i=this.viewState.scrollParent,l=this.viewState.getScrollOffset(),{scrollAnchorPos:a,scrollAnchorHeight:o}=this.viewState;Math.abs(l-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let u=0;;u++){if(o<0)if(tA(i||this.win))a=-1,o=this.viewState.heightMap.height;else{let S=this.viewState.scrollAnchorAt(l);a=S.from,o=S.top}this.updateState=1;let f=this.viewState.measure();if(!f&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(u>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];f&4||([this.measureRequests,d]=[d,this.measureRequests]);let p=d.map(S=>{try{return S.read(this)}catch(w){return Ti(this.state,w),GS}}),b=pd.create(this,this.state,[]),x=!1;b.flags|=f,t?t.flags|=f:t=b,this.updateState=2,b.empty||(this.updatePlugins(b),this.inputState.update(b),this.updateAttrs(),x=this.docView.update(b),x&&this.docViewUpdate());for(let S=0;S<d.length;S++)if(p[S]!=GS)try{let w=d[S];w.write&&w.write(p[S],this)}catch(w){Ti(this.state,w)}if(x&&this.docView.updateSelection(!0),!b.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let w=((a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-o)/this.scaleY;if((w>1||w<-1)&&!(ge.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){l=l+w,i?i.scrollTop+=w:this.win.scrollBy(0,w),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let u of this.state.facet(D0))u(t)}get themeClasses(){return z0+" "+(this.state.facet(B0)?IA:HA)+" "+this.state.facet(Lh)}updateAttrs(){let e=PS(this,xA,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Il)?"true":"false",class:"cm-content",style:`${ge.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),PS(this,wy,t);let i=this.observer.ignore(()=>{let l=xS(this.contentDOM,this.contentAttrs,t),a=xS(this.dom,this.editorAttrs,e);return l||a});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(ye.announce)){t&&(this.announceDOM.textContent=""),t=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(bu);let e=this.state.facet(ye.cspNonce);Ur.mount(this.root,this.styleModules.concat(_D).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(i=>i.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,i){return Tg(this,e,TS(this,e,t,i))}moveByGroup(e,t){return Tg(this,e,TS(this,e,t,i=>VN(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),l=this.textDirectionAt(e.from),a=i[t?i.length-1:0];return X.cursor(a.side(t,l)+e.from,a.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,i=!0){return UN(this,e,t,i)}moveVertically(e,t,i){return Tg(this,e,qN(this,e,t,i))}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 i=j0(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),j0(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.state.doc.lineAt(e),l=this.bidiSpans(i),a=l[cl.find(l,e-i.from,-1,t)];return this.docView.coordsAt(e,t,a.dir==Lt.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(mA)||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>OD)return aA(e.length);let t=this.textDirectionAt(e.from),i;for(let a of this.bidiCache)if(a.from==e.from&&a.dir==t&&(a.fresh||rA(a.isolates,i=wS(this,e))))return a.order;i||(i=wS(this,e));let l=dN(e.text,t,i);return this.bidiCache.push(new xd(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ge.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{eA(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var i,l,a,o;return Eh.of(new zo(typeof e=="number"?X.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(l=t.x)!==null&&l!==void 0?l:"nearest",(a=t.yMargin)!==null&&a!==void 0?a:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Eh.of(new zo(X.cursor(i.from),"start","start",i.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 ln.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ln.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=Ur.newName(),l=[Lh.of(i),bu.of(H0(`.${i}`,e))];return t&&t.dark&&l.push(B0.of(!0)),l}static baseTheme(e){return Yl.lowest(bu.of(H0("."+z0,e,UA)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&Jt.get(i)||Jt.get(e);return((t=l==null?void 0:l.root)===null||t===void 0?void 0:t.view)||null}}ye.styleModule=bu;ye.inputHandler=dA;ye.clipboardInputFilter=vy;ye.clipboardOutputFilter=Sy;ye.scrollHandler=yA;ye.focusChangeEffect=pA;ye.perLineTextDirection=mA;ye.exceptionSink=hA;ye.updateListener=D0;ye.editable=Il;ye.mouseSelectionStyle=fA;ye.dragMovesSelection=uA;ye.clickAddsSelectionRange=cA;ye.decorations=Vd;ye.blockWrappers=vA;ye.outerDecorations=ky;ye.atomicRanges=Ku;ye.bidiIsolatedRanges=SA;ye.cursorScrollMargin=be.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});ye.scrollMargins=wA;ye.darkTheme=B0;ye.cspNonce=be.define({combine:n=>n.length?n[0]:""});ye.contentAttributes=wy;ye.editorAttributes=xA;ye.lineWrapping=ye.contentAttributes.of({class:"cm-lineWrapping"});ye.announce=Ge.define();const OD=4096,GS={};class xd{constructor(e,t,i,l,a,o){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=a,this.order=o}static update(e,t){if(t.empty&&!e.some(a=>a.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:Lt.LTR;for(let a=Math.max(0,e.length-10);a<e.length;a++){let o=e[a];o.dir==l&&!t.touchesRange(o.from,o.to)&&i.push(new xd(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function PS(n,e,t){for(let i=n.state.facet(e),l=i.length-1;l>=0;l--){let a=i[l],o=typeof a=="function"?a(n):a;o&&yy(o,t)}return t}const RD=ge.mac?"mac":ge.windows?"win":ge.linux?"linux":"key";function jD(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let l,a,o,u;for(let f=0;f<t.length-1;++f){const d=t[f];if(/^(cmd|meta|m)$/i.test(d))u=!0;else if(/^a(lt)?$/i.test(d))l=!0;else if(/^(c|ctrl|control)$/i.test(d))a=!0;else if(/^s(hift)?$/i.test(d))o=!0;else if(/^mod$/i.test(d))e=="mac"?u=!0:a=!0;else throw new Error("Unrecognized modifier name: "+d)}return l&&(i="Alt-"+i),a&&(i="Ctrl-"+i),u&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function Bh(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 LD=Yl.default(ye.domEventHandlers({keydown(n,e){return qA(VA(e.state),n,e,"editor")}})),ec=be.define({enables:LD}),YS=new WeakMap;function VA(n){let e=n.facet(ec),t=YS.get(e);return t||YS.set(e,t=HD(e.reduce((i,l)=>i.concat(l),[]))),t}function BD(n,e,t){return qA(VA(n.state),e,n,t)}let Rr=null;const zD=4e3;function HD(n,e=RD){let t=Object.create(null),i=Object.create(null),l=(o,u)=>{let f=i[o];if(f==null)i[o]=u;else if(f!=u)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},a=(o,u,f,d,p)=>{var b,x;let S=t[o]||(t[o]=Object.create(null)),w=u.split(/ (?!$)/).map(E=>jD(E,e));for(let E=1;E<w.length;E++){let O=w.slice(0,E).join(" ");l(O,!0),S[O]||(S[O]={preventDefault:!0,stopPropagation:!1,run:[B=>{let q=Rr={view:B,prefix:O,scope:o};return setTimeout(()=>{Rr==q&&(Rr=null)},zD),!0}]})}let T=w.join(" ");l(T,!1);let C=S[T]||(S[T]={preventDefault:!1,stopPropagation:!1,run:((x=(b=S._any)===null||b===void 0?void 0:b.run)===null||x===void 0?void 0:x.slice())||[]});f&&C.run.push(f),d&&(C.preventDefault=!0),p&&(C.stopPropagation=!0)};for(let o of n){let u=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let d of u){let p=t[d]||(t[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:b}=o;for(let x in p)p[x].run.push(S=>b(S,I0))}let f=o[e]||o.key;if(f)for(let d of u)a(d,f,o.run,o.preventDefault,o.stopPropagation),o.shift&&a(d,"Shift-"+f,o.shift,o.preventDefault,o.stopPropagation)}return t}let I0=null;function qA(n,e,t,i){I0=e;let l=ZE(e),a=ki(l,0),o=rl(a)==l.length&&l!=" ",u="",f=!1,d=!1,p=!1;Rr&&Rr.view==t&&Rr.scope==i&&(u=Rr.prefix+" ",NA.indexOf(e.keyCode)<0&&(d=!0,Rr=null));let b=new Set,x=C=>{if(C){for(let E of C.run)if(!b.has(E)&&(b.add(E),E(t)))return C.stopPropagation&&(p=!0),!0;C.preventDefault&&(C.stopPropagation&&(p=!0),d=!0)}return!1},S=n[i],w,T;return S&&(x(S[u+Bh(l,e,!o)])?f=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ge.windows&&e.ctrlKey&&e.altKey)&&!(ge.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(w=Vr[e.keyCode])&&w!=l?(x(S[u+Bh(w,e,!0)])||e.shiftKey&&(T=Ou[e.keyCode])!=l&&T!=w&&x(S[u+Bh(T,e,!1)]))&&(f=!0):o&&e.shiftKey&&x(S[u+Bh(l,e,!0)])&&(f=!0),!f&&x(S._any)&&(f=!0)),d&&(f=!0),f&&p&&e.stopPropagation(),I0=null,f}class Na{constructor(e,t,i,l,a){this.className=e,this.left=t,this.top=i,this.width=l,this.height=a}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,i){if(i.empty){let l=e.coordsAtPos(i.head,i.assoc||1);if(!l)return[];let a=GA(e);return[new Na(t,l.left-a.left,l.top-a.top,null,l.bottom-l.top)]}else return ID(e,t,i)}}function GA(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Lt.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function FS(n,e,t,i){let l=n.coordsAtPos(e,t*2);if(!l)return i;let a=n.dom.getBoundingClientRect(),o=(l.top+l.bottom)/2,u=n.posAtCoords({x:a.left+1,y:o}),f=n.posAtCoords({x:a.right-1,y:o});return u==null||f==null?i:{from:Math.max(i.from,Math.min(u,f)),to:Math.min(i.to,Math.max(u,f))}}function ID(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),l=Math.min(t.to,n.viewport.to),a=n.textDirection==Lt.LTR,o=n.contentDOM,u=o.getBoundingClientRect(),f=GA(n),d=o.querySelector(".cm-line"),p=d&&window.getComputedStyle(d),b=u.left+(p?parseInt(p.paddingLeft)+Math.min(0,parseInt(p.textIndent)):0),x=u.right-(p?parseInt(p.paddingRight):0),S=R0(n,i,1),w=R0(n,l,-1),T=S.type==Pn.Text?S:null,C=w.type==Pn.Text?w:null;if(T&&(n.lineWrapping||S.widgetLineBreaks)&&(T=FS(n,i,1,T)),C&&(n.lineWrapping||w.widgetLineBreaks)&&(C=FS(n,l,-1,C)),T&&C&&T.from==C.from&&T.to==C.to)return O(B(t.from,t.to,T));{let H=T?B(t.from,null,T):q(S,!1),L=C?B(null,t.to,C):q(w,!0),j=[];return(T||S).to<(C||w).from-(T&&C?1:0)||S.widgetLineBreaks>1&&H.bottom+n.defaultLineHeight/2<L.top?j.push(E(b,H.bottom,x,L.top)):H.bottom<L.top&&n.elementAtHeight((H.bottom+L.top)/2).type==Pn.Text&&(H.bottom=L.top=(H.bottom+L.top)/2),O(H).concat(j).concat(O(L))}function E(H,L,j,se){return new Na(e,H-f.left,L-f.top,Math.max(0,j-H),se-L)}function O({top:H,bottom:L,horizontal:j}){let se=[];for(let he=0;he<j.length;he+=2)se.push(E(j[he],H,j[he+1],L));return se}function B(H,L,j){let se=1e9,he=-1e9,Me=[];function ue(ve,ke,I,Z,ee){let Ne=n.coordsAtPos(ve,ve==j.to?-2:2),_e=n.coordsAtPos(I,I==j.from?2:-2);!Ne||!_e||(se=Math.min(Ne.top,_e.top,se),he=Math.max(Ne.bottom,_e.bottom,he),ee==Lt.LTR?Me.push(a&&ke?b:Ne.left,a&&Z?x:_e.right):Me.push(!a&&Z?b:_e.left,!a&&ke?x:Ne.right))}let le=H??j.from,Ee=L??j.to;for(let ve of n.visibleRanges)if(ve.to>le&&ve.from<Ee)for(let ke=Math.max(ve.from,le),I=Math.min(ve.to,Ee);;){let Z=n.state.doc.lineAt(ke);for(let ee of n.bidiSpans(Z)){let Ne=ee.from+Z.from,_e=ee.to+Z.from;if(Ne>=I)break;_e>ke&&ue(Math.max(Ne,ke),H==null&&Ne<=le,Math.min(_e,I),L==null&&_e>=Ee,ee.dir)}if(ke=Z.to+1,ke>=I)break}return Me.length==0&&ue(le,H==null,Ee,L==null,n.textDirection),{top:se,bottom:he,horizontal:Me}}function q(H,L){let j=u.top+(L?H.top:H.bottom);return{top:j,bottom:j,horizontal:[]}}}function UD(n,e){return n.constructor==e.constructor&&n.eq(e)}class VD{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(td)!=e.state.facet(td)&&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,i=e.facet(td);for(;t<i.length&&i[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,i)=>!UD(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let l of e)l.update&&t&&l.constructor&&this.drawn[i].constructor&&l.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(l.draw(),t);for(;t;){let l=t.nextSibling;t.remove(),t=l}this.drawn=e,ge.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const td=be.define();function PA(n){return[ln.define(e=>new VD(e,n)),td.of(n)]}const tc=be.define({combine(n){return dl(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function qD(n={}){return[tc.of(n),GD,PD,YD,gA.of(!0)]}function YA(n){return n.startState.facet(tc)!=n.state.facet(tc)}const GD=PA({above:!0,markers(n){let{state:e}=n,t=e.facet(tc),i=[];for(let l of e.selection.ranges){let a=l==e.selection.main;if(l.empty||t.drawRangeCursor&&!(a&&ge.ios&&t.iosSelectionHandles)){let o=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",u=l.empty?l:X.cursor(l.head,l.assoc);for(let f of Na.forRange(n,o,u))i.push(f)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=YA(n);return t&&WS(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){WS(e.state,n)},class:"cm-cursorLayer"});function WS(n,e){e.style.animationDuration=n.facet(tc).cursorBlinkRate+"ms"}const PD=PA({above:!1,markers(n){let e=[],{main:t,ranges:i}=n.state.selection;for(let l of i)if(!l.empty)for(let a of Na.forRange(n,"cm-selectionBackground",l))e.push(a);if(ge.ios&&!t.empty&&n.state.facet(tc).iosSelectionHandles){for(let l of Na.forRange(n,"cm-selectionHandle cm-selectionHandle-start",X.cursor(t.from,1)))e.push(l);for(let l of Na.forRange(n,"cm-selectionHandle cm-selectionHandle-end",X.cursor(t.to,1)))e.push(l)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||YA(n)},class:"cm-selectionLayer"}),YD=Yl.highest(ye.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"}}}})),FA=Ge.define({map(n,e){return n==null?null:e.mapPos(n)}}),vu=Wn.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(FA)?i.value:t,n)}}),FD=ln.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(vu);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(vu)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(vu),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.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(vu)!=n&&this.view.dispatch({effects:FA.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 WD(){return[vu,FD]}function $S(n,e,t,i,l){e.lastIndex=0;for(let a=n.iterRange(t,i),o=t,u;!a.next().done;o+=a.value.length)if(!a.lineBreak)for(;u=e.exec(a.value);)l(o+u.index,u)}function $D(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 i=[];for(let{from:l,to:a}of t)l=Math.max(n.state.doc.lineAt(l).from,l-e),a=Math.min(n.state.doc.lineAt(a).to,a+e),i.length&&i[i.length-1].to>=l?i[i.length-1].to=a:i.push({from:l,to:a});return i}class KD{constructor(e){const{regexp:t,decoration:i,decorate:l,boundary:a,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,l)this.addMatch=(u,f,d,p)=>l(p,d,d+u[0].length,u,f);else if(typeof i=="function")this.addMatch=(u,f,d,p)=>{let b=i(u,f,d);b&&p(d,d+u[0].length,b)};else if(i)this.addMatch=(u,f,d,p)=>p(d,d+u[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=a,this.maxLength=o}createDeco(e){let t=new ql,i=t.add.bind(t);for(let{from:l,to:a}of $D(e,this.maxLength))$S(e.state.doc,this.regexp,l,a,(o,u)=>this.addMatch(u,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,l=-1;return e.docChanged&&e.changes.iterChanges((a,o,u,f)=>{f>=e.view.viewport.from&&u<=e.view.viewport.to&&(i=Math.min(u,i),l=Math.max(f,l))}),e.viewportMoved||l-i>1e3?this.createDeco(e.view):l>-1?this.updateRange(e.view,t.map(e.changes),i,l):t}updateRange(e,t,i,l){for(let a of e.visibleRanges){let o=Math.max(a.from,i),u=Math.min(a.to,l);if(u>=o){let f=e.state.doc.lineAt(o),d=f.to<u?e.state.doc.lineAt(u):f,p=Math.max(a.from,f.from),b=Math.min(a.to,d.to);if(this.boundary){for(;o>f.from;o--)if(this.boundary.test(f.text[o-1-f.from])){p=o;break}for(;u<d.to;u++)if(this.boundary.test(d.text[u-d.from])){b=u;break}}let x=[],S,w=(T,C,E)=>x.push(E.range(T,C));if(f==d)for(this.regexp.lastIndex=p-f.from;(S=this.regexp.exec(f.text))&&S.index<b-f.from;)this.addMatch(S,e,S.index+f.from,w);else $S(e.state.doc,this.regexp,p,b,(T,C)=>this.addMatch(C,e,T,w));t=t.update({filterFrom:p,filterTo:b,filter:(T,C)=>T<p||C>b,add:x})}}return t}}const U0=/x/.unicode!=null?"gu":"g",XD=new RegExp(`[\0-\b
126
- --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,U0),QD={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 Eg=null;function ZD(){var n;if(Eg==null&&typeof document<"u"&&document.body){let e=document.body.style;Eg=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Eg||!1}const nd=be.define({combine(n){let e=dl(n,{render:null,specialChars:XD,addSpecialChars:null});return(e.replaceTabs=!ZD())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,U0)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,U0)),e}});function JD(n={}){return[nd.of(n),eO()]}let KS=null;function eO(){return KS||(KS=ln.fromClass(class{constructor(n){this.view=n,this.decorations=Le.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(nd)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new KD({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:l}=t.state,a=ki(e[0],0);if(a==9){let o=l.lineAt(i),u=t.state.tabSize,f=lc(o.text,u,i-o.from);return Le.replace({widget:new sO((u-f%u)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=Le.replace({widget:new iO(n,a)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(nd);n.startState.facet(nd)!=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 tO="•";function nO(n){return n>=32?tO:n==10?"␤":String.fromCharCode(9216+n)}class iO extends pl{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=nO(this.code),i=e.state.phrase("Control character")+" "+(QD[this.code]||"0x"+this.code.toString(16)),l=this.options.render&&this.options.render(this.code,i,t);if(l)return l;let a=document.createElement("span");return a.textContent=t,a.title=i,a.setAttribute("aria-label",i),a.className="cm-specialChar",a}ignoreEvent(){return!1}}class sO extends pl{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 lO(){return aO}const rO=Le.line({class:"cm-activeLine"}),aO=ln.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 i of n.state.selection.ranges){let l=n.lineBlockAt(i.head);l.from>e&&(t.push(rO.range(l.from)),e=l.from)}return Le.set(t)}},{decorations:n=>n.decorations}),V0=2e3;function oO(n,e,t){let i=Math.min(e.line,t.line),l=Math.max(e.line,t.line),a=[];if(e.off>V0||t.off>V0||e.col<0||t.col<0){let o=Math.min(e.off,t.off),u=Math.max(e.off,t.off);for(let f=i;f<=l;f++){let d=n.doc.line(f);d.length<=u&&a.push(X.range(d.from+o,d.to+u))}}else{let o=Math.min(e.col,t.col),u=Math.max(e.col,t.col);for(let f=i;f<=l;f++){let d=n.doc.line(f),p=v0(d.text,o,n.tabSize,!0);if(p<0)a.push(X.cursor(d.to));else{let b=v0(d.text,u,n.tabSize);a.push(X.range(d.from+p,d.from+b))}}}return a}function cO(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function XS(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),l=t-i.from,a=l>V0?-1:l==i.length?cO(n,e.clientX):lc(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:a,off:l}}function uO(n,e){let t=XS(n,e),i=n.state.selection;return t?{update(l){if(l.docChanged){let a=l.changes.mapPos(l.startState.doc.line(t.line).from),o=l.state.doc.lineAt(a);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(l.changes)}},get(l,a,o){let u=XS(n,l);if(!u)return i;let f=oO(n.state,t,u);return f.length?o?X.create(f.concat(i.ranges)):X.create(f):i}}:null}function fO(n){let e=(t=>t.altKey&&t.button==0);return ye.mouseSelectionStyle.of((t,i)=>e(i)?uO(t,i):null)}const hO={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},dO={style:"cursor: crosshair"};function pO(n={}){let[e,t]=hO[n.key||"Alt"],i=ln.fromClass(class{constructor(l){this.view=l,this.isDown=!1}set(l){this.isDown!=l&&(this.isDown=l,this.view.update([]))}},{eventObservers:{keydown(l){this.set(l.keyCode==e||t(l))},keyup(l){(l.keyCode==e||!t(l))&&this.set(!1)},mousemove(l){this.set(t(l))}}});return[i,ye.contentAttributes.of(l=>{var a;return!((a=l.plugin(i))===null||a===void 0)&&a.isDown?dO:null})]}const zh="-10000px";class WA{constructor(e,t,i,l){this.facet=t,this.createTooltipView=i,this.removeTooltipView=l,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let a=null;this.tooltipViews=this.tooltips.map(o=>a=i(o,a))}update(e,t){var i;let l=e.state.facet(this.facet),a=l.filter(f=>f);if(l===this.input){for(let f of this.tooltipViews)f.update&&f.update(e);return!1}let o=[],u=t?[]:null;for(let f=0;f<a.length;f++){let d=a[f],p=-1;if(d){for(let b=0;b<this.tooltips.length;b++){let x=this.tooltips[b];x&&x.create==d.create&&(p=b)}if(p<0)o[f]=this.createTooltipView(d,f?o[f-1]:null),u&&(u[f]=!!d.above);else{let b=o[f]=this.tooltipViews[p];u&&(u[f]=t[p]),b.update&&b.update(e)}}}for(let f of this.tooltipViews)o.indexOf(f)<0&&(this.removeTooltipView(f),(i=f.destroy)===null||i===void 0||i.call(f));return t&&(u.forEach((f,d)=>t[d]=f),t.length=u.length),this.input=l,this.tooltips=a,this.tooltipViews=o,!0}}function mO(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Ng=be.define({combine:n=>{var e,t,i;return{position:ge.ios?"absolute":((e=n.find(l=>l.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(l=>l.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(l=>l.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||mO}}}),QS=new WeakMap,My=ln.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(Ng);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 WA(n,Ey,(t,i)=>this.createTooltip(t,i),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,i=n.state.facet(Ng);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let l of this.manager.tooltipViews)l.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let l of this.manager.tooltipViews)this.container.appendChild(l.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),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let l=document.createElement("div");l.className="cm-tooltip-arrow",t.dom.appendChild(l)}return t.dom.style.position=this.position,t.dom.style.top=zh,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),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 i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);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:a}=this.manager.tooltipViews[0];if(ge.safari){let o=a.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(n=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),l=Ay(this.view);return{visible:{left:i.left+l.left,top:i.top+l.top,right:i.right-l.right,bottom:i.bottom-l.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,o)=>{let u=this.manager.tooltipViews[o];return u.getCoords?u.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(Ng).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let u of this.manager.tooltipViews)u.dom.style.position="absolute"}let{visible:t,space:i,scaleX:l,scaleY:a}=n,o=[];for(let u=0;u<this.manager.tooltips.length;u++){let f=this.manager.tooltips[u],d=this.manager.tooltipViews[u],{dom:p}=d,b=n.pos[u],x=n.size[u];if(!b||f.clip!==!1&&(b.bottom<=Math.max(t.top,i.top)||b.top>=Math.min(t.bottom,i.bottom)||b.right<Math.max(t.left,i.left)-.1||b.left>Math.min(t.right,i.right)+.1)){p.style.top=zh;continue}let S=f.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=S?7:0,T=x.right-x.left,C=(e=QS.get(d))!==null&&e!==void 0?e:x.bottom-x.top,E=d.offset||yO,O=this.view.textDirection==Lt.LTR,B=x.width>i.right-i.left?O?i.left:i.right-x.width:O?Math.max(i.left,Math.min(b.left-(S?14:0)+E.x,i.right-T)):Math.min(Math.max(i.left,b.left-T+(S?14:0)-E.x),i.right-T),q=this.above[u];!f.strictSide&&(q?b.top-C-w-E.y<i.top:b.bottom+C+w+E.y>i.bottom)&&q==i.bottom-b.bottom>b.top-i.top&&(q=this.above[u]=!q);let H=(q?b.top-i.top:i.bottom-b.bottom)-w;if(H<C&&d.resize!==!1){if(H<this.view.defaultLineHeight){p.style.top=zh;continue}QS.set(d,C),p.style.height=(C=H)/a+"px"}else p.style.height&&(p.style.height="");let L=q?b.top-C-w-E.y:b.bottom+w+E.y,j=B+T;if(d.overlap!==!0)for(let se of o)se.left<j&&se.right>B&&se.top<L+C&&se.bottom>L&&(L=q?se.top-C-2-w:se.bottom+w+2);if(this.position=="absolute"?(p.style.top=(L-n.parent.top)/a+"px",ZS(p,(B-n.parent.left)/l)):(p.style.top=L/a+"px",ZS(p,B/l)),S){let se=b.left+(O?E.x:-E.x)-(B+14-7);S.style.left=se/l+"px"}d.overlap!==!0&&o.push({left:B,top:L,right:j,bottom:L+C}),p.classList.toggle("cm-tooltip-above",q),p.classList.toggle("cm-tooltip-below",!q),d.positioned&&d.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=zh}},{eventObservers:{scroll(){this.maybeMeasure()}}});function ZS(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const gO=ye.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),yO={x:0,y:0},Ey=be.define({enables:[My,gO]}),vd=be.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Yd{static create(e){return new Yd(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new WA(e,vd,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}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 i of this.manager.tooltipViews){let l=i[e];if(l!==void 0){if(t===void 0)t=l;else if(t!==l)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 bO=Ey.compute([vd],n=>{let e=n.facet(vd);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Yd.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),$A=be.define();class xO{constructor(e,t,i,l,a,o){this.view=e,this.source=t,this.field=i,this.locked=l,this.setHover=a,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,i=e.docView.tile.nearest(t.target);if(!i)return;let l,a=1;if(i.isWidget())l=i.posAtStart;else{if(l=e.posAtCoords(t),l==null)return;let o=e.coordsAtPos(l);if(!o||t.y<o.top||t.y>o.bottom||t.x<o.left-e.defaultCharacterWidth||t.x>o.right+e.defaultCharacterWidth)return;let u=e.bidiSpans(e.state.doc.lineAt(l)).find(d=>d.from<=l&&d.to>=l),f=u&&u.dir==Lt.RTL?-1:1;a=t.x<o.left?-f:f}this.activateHover(e,l,a)}activateHover(e,t,i,l){let a=this.source(e,t,i),o=u=>{if(u&&!(Array.isArray(u)&&!u.length)){let f=Array.isArray(u)?u:[u];l&&this.locked.set(f,l),e.dispatch({effects:this.setHover.of(f)})}};if(a&&"then"in a){let u=this.pending={pos:t};a.then(f=>{this.pending==u&&(this.pending=null,o(f))},f=>Ti(e.state,f,"hover tooltip"))}else o(a)}get tooltip(){let e=this.view.plugin(My),t=e?e.manager.tooltips.findIndex(i=>i.create==Yd.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;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:l,tooltip:a}=this;if(l.length&&!this.locked.has(l)&&a&&!vO(a.dom,e)||this.pending){let{pos:o}=l[0]||this.pending,u=(i=(t=l[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==u?this.view.posAtCoords(this.lastMove)!=o:!SO(this.view,o,u,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t);let{active:l}=this;l.length&&!this.locked.has(l)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Hh=4;function vO(n,e){let{left:t,right:i,top:l,bottom:a}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let u=o.getBoundingClientRect();l=Math.min(u.top,l),a=Math.max(u.bottom,a)}return e.clientX>=t-Hh&&e.clientX<=i+Hh&&e.clientY>=l-Hh&&e.clientY<=a+Hh}function SO(n,e,t,i,l,a){let o=n.scrollDOM.getBoundingClientRect(),u=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.right<i||o.top>l||Math.min(o.bottom,u)<l)return!1;let f=n.posAtCoords({x:i,y:l},!1);return f>=e&&f<=t}function wO(n,e={}){let t=Ge.define(),i=new WeakMap,l=Wn.define({create(){return[]},update(o,u){let f=i.get(o);if(o.length&&(e.hideOnChange&&(u.docChanged||u.selection)?o=[]:f&&f(u)?o=[]:e.hideOn&&(o=o.filter(d=>!e.hideOn(u,d)))),u.docChanged&&o.length){let d=[];for(let p of o){let b=u.changes.mapPos(p.pos,-1,qn.TrackDel);if(b!=null){let x=Object.assign(Object.create(null),p);x.pos=b,x.end!=null&&(x.end=u.changes.mapPos(x.end)),d.push(x)}}o=d}for(let d of u.effects)d.is(t)&&(o=d.value,f=void 0),(d.is(AO)&&!d.value||d.value==l)&&(o=[]);return o.length&&f&&i.set(o,f),o},provide:o=>vd.from(o)});const a=ln.define(o=>new xO(o,n,l,i,t,e.hoverTime||300));return{active:l,extension:[l,a,$A.of(a),bO]}}function kO(n,e,t,i={}){var l;let a=n.state.facet($A).map(o=>n.plugin(o)).filter(o=>!!o);if(i.tooltip&&i.tooltip.active){let o=a.find(u=>u.field==i.tooltip.active);o&&(a=[o])}for(let o of a)o.activateHover(n,e,t,(l=i.until)!==null&&l!==void 0?l:(()=>!1))}function KA(n,e){let t=n.plugin(My);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const AO=Ge.define(),JS=be.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Ny(n,e){let t=n.plugin(XA),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const XA=ln.fromClass(class{constructor(n){this.input=n.state.facet(Bu),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(JS);this.top=new Ih(n,!0,e.topContainer),this.bottom=new Ih(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(JS);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ih(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ih(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Bu);if(t!=this.input){let i=t.filter(f=>f),l=[],a=[],o=[],u=[];for(let f of i){let d=this.specs.indexOf(f),p;d<0?(p=f(n.view),u.push(p)):(p=this.panels[d],p.update&&p.update(n)),l.push(p),(p.top?a:o).push(p)}this.specs=i,this.panels=l,this.top.sync(a),this.bottom.sync(o);for(let f of u)f.dom.classList.add("cm-panel"),f.mount&&f.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>ye.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Ih{constructor(e,t,i){this.view=e,this.top=t,this.container=i,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=ew(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ew(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 ew(n){let e=n.nextSibling;return n.remove(),e}const Bu=be.define({enables:XA});function CO(n,e){let t,i=new Promise(o=>t=o),l=o=>TO(o,e,t);n.state.field(Dg,!1)?n.dispatch({effects:QA.of(l)}):n.dispatch({effects:Ge.appendConfig.of(Dg.init(()=>[l]))});let a=ZA.of(l);return{close:a,result:i.then(o=>((n.win.queueMicrotask||(f=>n.win.setTimeout(f,10)))(()=>{n.state.field(Dg).indexOf(l)>-1&&n.dispatch({effects:a})}),o))}}const Dg=Wn.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(QA)?n=[t.value].concat(n):t.is(ZA)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>Bu.computeN([n],e=>e.field(n))}),QA=Ge.define(),ZA=Ge.define();function TO(n,e,t){let i=e.content?e.content(n,()=>o(null)):null;if(!i){if(i=Et("form"),e.input){let u=Et("input",e.input);/^(text|password|number|email|tel|url)$/.test(u.type)&&u.classList.add("cm-textfield"),u.name||(u.name="input"),i.appendChild(Et("label",(e.label||"")+": ",u))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Et("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let l=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let u=0;u<l.length;u++){let f=l[u];f.addEventListener("keydown",d=>{d.keyCode==27?(d.preventDefault(),o(null)):d.keyCode==13&&(d.preventDefault(),o(f))}),f.addEventListener("submit",d=>{d.preventDefault(),o(f)})}let a=Et("div",i,Et("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(a.className=e.class),a.classList.add("cm-dialog");function o(u){a.contains(a.ownerDocument.activeElement)&&n.focus(),t(u)}return{dom:a,top:e.top,mount:()=>{if(e.focus){let u;typeof e.focus=="string"?u=i.querySelector(e.focus):u=i.querySelector("input")||i.querySelector("button"),u&&"select"in u?u.select():u&&"focus"in u&&u.focus()}}}}class Pl extends Ir{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Pl.prototype.elementClass="";Pl.prototype.toDOM=void 0;Pl.prototype.mapMode=qn.TrackBefore;Pl.prototype.startSide=Pl.prototype.endSide=-1;Pl.prototype.point=!0;const id=be.define(),_O=be.define(),MO={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>it.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Tu=be.define();function EO(n){return[JA(),Tu.of({...MO,...n})]}const tw=be.define({combine:n=>n.some(e=>e)});function JA(n){return[NO]}const NO=ln.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(Tu).map(e=>new iw(n,e)),this.fixed=!n.state.facet(tw);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,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(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(tw)!=!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=it.iter(this.view.state.facet(id),this.view.viewport.from),i=[],l=this.gutters.map(a=>new DO(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(a.type)){let o=!0;for(let u of a.type)if(u.type==Pn.Text&&o){q0(t,i,u.from);for(let f of l)f.line(this.view,u,i);o=!1}else if(u.widget)for(let f of l)f.widget(this.view,u)}else if(a.type==Pn.Text){q0(t,i,a.from);for(let o of l)o.line(this.view,a,i)}else if(a.widget)for(let o of l)o.widget(this.view,a);for(let a of l)a.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Tu),t=n.state.facet(Tu),i=n.docChanged||n.heightChanged||n.viewportChanged||!it.eq(n.startState.facet(id),n.state.facet(id),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let l of this.gutters)l.update(n)&&(i=!0);else{i=!0;let l=[];for(let a of t){let o=e.indexOf(a);o<0?l.push(new iw(this.view,a)):(this.gutters[o].update(n),l.push(this.gutters[o]))}for(let a of this.gutters)a.dom.remove(),l.indexOf(a)<0&&a.destroy();for(let a of l)a.config.side=="after"?this.getDOMAfter().appendChild(a.dom):this.dom.appendChild(a.dom);this.gutters=l}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>ye.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,l=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Lt.LTR?{left:i,right:l}:{right:i,left:l}})});function nw(n){return Array.isArray(n)?n:[n]}function q0(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class DO{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=it.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:l}=this,a=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==l.elements.length){let u=new eC(e,o,a,i);l.elements.push(u),l.dom.appendChild(u.dom)}else l.elements[this.i].update(e,o,a,i);this.height=t.bottom,this.i++}line(e,t,i){let l=[];q0(this.cursor,l,t.from),i.length&&(l=l.concat(i));let a=this.gutter.config.lineMarker(e,t,l);a&&l.unshift(a);let o=this.gutter;l.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,l)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),l=i?[i]:null;for(let a of e.state.facet(_O)){let o=a(e,t.widget,t);o&&(l||(l=[])).push(o)}l&&this.addElement(e,t,l)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class iw{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 i in t.domEventHandlers)this.dom.addEventListener(i,l=>{let a=l.target,o;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let f=a.getBoundingClientRect();o=(f.top+f.bottom)/2}else o=l.clientY;let u=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,u,l)&&l.preventDefault()});this.markers=nw(t.markers(e)),t.initialSpacer&&(this.spacer=new eC(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=nw(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let l=this.config.updateSpacer(this.spacer.markers[0],e);l!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[l])}let i=e.view.viewport;return!it.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class eC{constructor(e,t,i,l){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,l)}update(e,t,i,l){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),OO(this.markers,l)||this.setMarkers(e,l)}setMarkers(e,t){let i="cm-gutterElement",l=this.dom.firstChild;for(let a=0,o=0;;){let u=o,f=a<t.length?t[a++]:null,d=!1;if(f){let p=f.elementClass;p&&(i+=" "+p);for(let b=o;b<this.markers.length;b++)if(this.markers[b].compare(f)){u=b,d=!0;break}}else u=this.markers.length;for(;o<u;){let p=this.markers[o++];if(p.toDOM){p.destroy(l);let b=l.nextSibling;l.remove(),l=b}}if(!f)break;f.toDOM&&(d?l=l.nextSibling:this.dom.insertBefore(f.toDOM(e),l)),d&&o++}this.dom.className=i,this.markers=t}destroy(){this.setMarkers(null,[])}}function OO(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 RO=be.define(),jO=be.define(),Eo=be.define({combine(n){return dl(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let i=Object.assign({},e);for(let l in t){let a=i[l],o=t[l];i[l]=a?(u,f,d)=>a(u,f,d)||o(u,f,d):o}return i}})}});class Og extends Pl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Rg(n,e){return n.state.facet(Eo).formatNumber(e,n.state)}const LO=Tu.compute([Eo],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(RO)},lineMarker(e,t,i){return i.some(l=>l.toDOM)?null:new Og(Rg(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let l of e.state.facet(jO)){let a=l(e,t,i);if(a)return a}return null},lineMarkerChange:e=>e.startState.facet(Eo)!=e.state.facet(Eo),initialSpacer(e){return new Og(Rg(e,sw(e.state.doc.lines)))},updateSpacer(e,t){let i=Rg(t.view,sw(t.view.state.doc.lines));return i==e.number?e:new Og(i)},domEventHandlers:n.facet(Eo).domEventHandlers,side:"before"}));function BO(n={}){return[Eo.of(n),JA(),LO]}function sw(n){let e=9;for(;e<n;)e=e*10+9;return e}const zO=new class extends Pl{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},HO=id.compute(["selection"],n=>{let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head).from;l>t&&(t=l,e.push(zO.range(l)))}return it.of(e)});function IO(){return HO}var jg;const No=new st;function UO(n){return be.define({combine:n?e=>e.concat(n):void 0})}const VO=new st;class Rs{constructor(e,t,i=[],l=""){this.data=e,this.name=l,dt.prototype.hasOwnProperty("tree")||Object.defineProperty(dt.prototype,"tree",{get(){return Fn(this)}}),this.parser=t,this.extension=[Gr.of(this),dt.languageData.of((a,o,u)=>{let f=lw(a,o,u),d=f.type.prop(No);if(!d)return[];let p=a.facet(d),b=f.type.prop(VO);if(b){let x=f.resolve(o-f.from,u);for(let S of b)if(S.test(x,a)){let w=a.facet(S.facet);return S.type=="replace"?w:w.concat(p)}}return p})].concat(i)}isActiveAt(e,t,i=-1){return lw(e,t,i).type.prop(No)==this.data}findRegions(e){let t=e.facet(Gr);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(a,o)=>{if(a.prop(No)==this.data){i.push({from:o,to:o+a.length});return}let u=a.prop(st.mounted);if(u){if(u.tree.prop(No)==this.data){if(u.overlay)for(let f of u.overlay)i.push({from:f.from+o,to:f.to+o});else i.push({from:o,to:o+a.length});return}else if(u.overlay){let f=i.length;if(l(u.tree,u.overlay[0].from+o),i.length>f)return}}for(let f=0;f<a.children.length;f++){let d=a.children[f];d instanceof hn&&l(d,a.positions[f]+o)}};return l(Fn(e),0),i}get allowsNesting(){return!0}}Rs.setState=Ge.define();function lw(n,e,t){let i=n.facet(Gr),l=Fn(n).topNode;if(!i||i.allowsNesting)for(let a=l;a;a=a.enter(e,t,jt.ExcludeBuffers|jt.EnterBracketed))a.type.isTop&&(l=a);return l}class G0 extends Rs{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=UO(e.languageData);return new G0(t,e.parser.configure({props:[No.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new G0(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Fn(n){let e=n.field(Rs.state,!1);return e?e.tree:hn.empty}class qO{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 i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let hu=null;class Sd{constructor(e,t,i=[],l,a,o,u,f){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=a,this.viewport=o,this.skipped=u,this.scheduleOn=f,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Sd(e,t,[],hn.empty,0,i,[],null)}startParse(){return this.parser.startParse(new qO(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=hn.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}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 l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(Ul.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=l,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(Ul.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=hu;hu=this;try{return e()}finally{hu=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=rw(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:a,viewport:o,skipped:u}=this;if(this.takeTree(),!e.empty){let f=[];if(e.iterChangedRanges((d,p,b,x)=>f.push({fromA:d,toA:p,fromB:b,toB:x})),i=Ul.applyChanges(i,f),l=hn.empty,a=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){u=[];for(let d of this.skipped){let p=e.mapPos(d.from,1),b=e.mapPos(d.to,-1);p<b&&u.push({from:p,to:b})}}}return new Sd(this.parser,t,i,l,a,o,u,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 i=0;i<this.skipped.length;i++){let{from:l,to:a}=this.skipped[i];l<e.to&&a>e.from&&(this.fragments=rw(this.fragments,l,a),this.skipped.splice(i--,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 fE{createParse(t,i,l){let a=l[0].from,o=l[l.length-1].to;return{parsedPos:a,advance(){let f=hu;if(f){for(let d of l)f.tempSkipped.push(d);e&&(f.scheduleOn=f.scheduleOn?Promise.all([f.scheduleOn,e]):e)}return this.parsedPos=o,new hn(Mi.none,[],[],o-a)},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 hu}}function rw(n,e,t){return Ul.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class nc{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),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new nc(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Sd.create(e.facet(Gr).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new nc(i)}}Rs.state=Wn.define({create:nc.init,update(n,e){for(let t of e.effects)if(t.is(Rs.setState))return t.value;return e.startState.facet(Gr)!=e.state.facet(Gr)?nc.init(e.state):n.apply(e)}});let tC=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(tC=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Lg=typeof navigator<"u"&&(!((jg=navigator.scheduling)===null||jg===void 0)&&jg.isInputPending)?()=>navigator.scheduling.isInputPending():null,GO=ln.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(Rs.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(Rs.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=tC(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:i,viewport:{to:l}}=this.view,a=i.field(Rs.state);if(a.tree==a.context.tree&&a.context.isDone(l+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Lg?Math.max(25,e.timeRemaining()-5):1e9),u=a.context.treeLen<l&&i.doc.length>l+1e3,f=a.context.work(()=>Lg&&Lg()||Date.now()>o,l+(u?0:1e5));this.chunkBudget-=Date.now()-t,(f||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Rs.setState.of(new nc(a.context))})),this.chunkBudget>0&&!(f&&!u)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ti(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()}}}),Gr=be.define({combine(n){return n.length?n[0]:null},enables:n=>[Rs.state,GO,ye.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class hz{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class nC{constructor(e,t,i,l,a,o=void 0){this.name=e,this.alias=t,this.extensions=i,this.filename=l,this.loadFunc=a,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:i}=e;if(!t){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(i)}return new nC(e.name,(e.alias||[]).concat(e.name).map(l=>l.toLowerCase()),e.extensions||[],e.filename,t,i)}static matchFilename(e,t){for(let l of e)if(l.filename&&l.filename.test(t))return l;let i=/\.([^.]+)$/.exec(t);if(i){for(let l of e)if(l.extensions.indexOf(i[1])>-1)return l}return null}static matchLanguageName(e,t,i=!0){t=t.toLowerCase();for(let l of e)if(l.alias.some(a=>a==t))return l;if(i)for(let l of e)for(let a of l.alias){let o=t.indexOf(a);if(o>-1&&(a.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+a.length])))return l}return null}}const PO=be.define(),Fd=be.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 wd(n){let e=n.facet(Fd);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function zu(n,e){let t="",i=n.tabSize,l=n.facet(Fd)[0];if(l==" "){for(;e>=i;)t+=" ",e-=i;l=" "}for(let a=0;a<e;a++)t+=l;return t}function Dy(n,e){n instanceof dt&&(n=new Wd(n));for(let i of n.state.facet(PO)){let l=i(n,e);if(l!==void 0)return l}let t=Fn(n.state);return t.length>=e?FO(n,t,e):null}class Wd{constructor(e,t={}){this.state=e,this.options=t,this.unit=wd(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:l,simulateDoubleBreak:a}=this.options;return l!=null&&l>=i.from&&l<=i.to?a&&l==e?{text:"",from:e}:(t<0?l<e:l<=e)?{text:i.text.slice(l-i.from),from:l}:{text:i.text.slice(0,l-i.from),from:i.from}:i}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:i,from:l}=this.lineAt(e,t);return i.slice(e-l,Math.min(i.length,e+100-l))}column(e,t=1){let{text:i,from:l}=this.lineAt(e,t),a=this.countColumn(i,e-l),o=this.options.overrideIndentation?this.options.overrideIndentation(l):-1;return o>-1&&(a+=o-this.countColumn(i,i.search(/\S|$/))),a}countColumn(e,t=e.length){return lc(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:l}=this.lineAt(e,t),a=this.options.overrideIndentation;if(a){let o=a(l);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const YO=new st;function FO(n,e,t){let i=e.resolveStack(t),l=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(l!=i.node){let a=[];for(let o=l;o&&!(o.from<i.node.from||o.to>i.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)a.push(o);for(let o=a.length-1;o>=0;o--)i={node:a[o],next:i}}return iC(i,n,t)}function iC(n,e,t){for(let i=n;i;i=i.next){let l=$O(i.node);if(l)return l(Oy.create(e,t,i))}return 0}function WO(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function $O(n){let e=n.type.prop(YO);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(st.closedBy))){let l=n.lastChild,a=l&&i.indexOf(l.name)>-1;return o=>sC(o,!0,1,void 0,a&&!WO(o)?l.from:void 0)}return n.parent==null?KO:null}function KO(){return 0}class Oy extends Wd{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Oy(e,t,i)}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 i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(XO(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return iC(this.context.next,this.base,this.pos)}}function XO(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function QO(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let l=n.options.simulateBreak,a=n.state.doc.lineAt(t.from),o=l==null||l<=a.from?a.to:Math.min(a.to,l);for(let u=t.to;;){let f=e.childAfter(u);if(!f||f==i)return null;if(!f.type.isSkipped){if(f.from>=o)return null;let d=/^ */.exec(a.text.slice(t.to-a.from))[0].length;return{from:t.from,to:t.to+d}}u=f.to}}function dz({closing:n,align:e=!0,units:t=1}){return i=>sC(i,e,t,n)}function sC(n,e,t,i,l){let a=n.textAfter,o=a.match(/^\s*/)[0].length,u=i&&a.slice(o,o+i.length)==i||l==n.pos+o,f=e?QO(n):null;return f?u?n.column(f.from):n.column(f.to):n.baseIndent+(u?0:n.unit*t)}const pz=n=>n.baseIndent;function mz({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const ZO=200;function JO(){return dt.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:i}=n.newSelection.main,l=t.lineAt(i);if(i>l.from+ZO)return n;let a=t.sliceString(l.from,i);if(!e.some(d=>d.test(a)))return n;let{state:o}=n,u=-1,f=[];for(let{head:d}of o.selection.ranges){let p=o.doc.lineAt(d);if(p.from==u)continue;u=p.from;let b=Dy(o,p.from);if(b==null)continue;let x=/^\s*/.exec(p.text)[0],S=zu(o,b);x!=S&&f.push({from:p.from,to:p.from+x.length,insert:S})}return f.length?[n,{changes:f,sequential:!0}]:n})}const eR=be.define(),tR=new st;function gz(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function nR(n,e,t){let i=Fn(n);if(i.length<t)return null;let l=i.resolveStack(t,1),a=null;for(let o=l;o;o=o.next){let u=o.node;if(u.to<=t||u.from>t)continue;if(a&&u.from<e)break;let f=u.type.prop(tR);if(f&&(u.to<i.length-50||i.length==n.doc.length||!iR(u))){let d=f(u,n);d&&d.from<=t&&d.from>=e&&d.to>t&&(a=d)}}return a}function iR(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function kd(n,e,t){for(let i of n.facet(eR)){let l=i(n,e,t);if(l)return l}return nR(n,e,t)}function lC(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const $d=Ge.define({map:lC}),Xu=Ge.define({map:lC});function rC(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const Ba=Wn.define({create(){return Le.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((i,l)=>n=aw(n,i,l)),n=n.map(e.changes);let t=[];for(let i of e.effects)i.is($d)&&!sR(n,i.value.from,i.value.to)?t.push(i.value):i.is(Xu)&&(n=n.update({filter:(l,a)=>i.value.from!=l||i.value.to!=a,filterFrom:i.value.from,filterTo:i.value.to}));if(t.length){let{preparePlaceholder:i}=e.state.facet(cC),l=t.map(a=>(i?Le.replace({widget:new fR(i(e.state,a))}):ow).range(a.from,a.to));n=n.update({add:l})}return e.selection&&(n=aw(n,e.selection.main.head)),n},provide:n=>ye.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,l)=>{t.push(i,l)}),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 i=n[t++],l=n[t++];if(typeof i!="number"||typeof l!="number")throw new RangeError("Invalid JSON for fold state");e.push(ow.range(i,l))}return Le.set(e,!0)}});function aw(n,e,t=e){let i=!1;return n.between(e,t,(l,a)=>{l<t&&a>e&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(l,a)=>l>=t||a<=e}):n}function Ad(n,e,t){var i;let l=null;return(i=n.field(Ba,!1))===null||i===void 0||i.between(e,t,(a,o)=>{(!l||l.from>a)&&(l={from:a,to:o})}),l}function sR(n,e,t){let i=!1;return n.between(e,e,(l,a)=>{l==e&&a==t&&(i=!0)}),i}function aC(n,e){return n.field(Ba,!1)?e:e.concat(Ge.appendConfig.of(uC()))}const lR=n=>{for(let e of rC(n)){let t=kd(n.state,e.from,e.to);if(t)return n.dispatch({effects:aC(n.state,[$d.of(t),oC(n,t)])}),!0}return!1},rR=n=>{if(!n.state.field(Ba,!1))return!1;let e=[];for(let t of rC(n)){let i=Ad(n.state,t.from,t.to);i&&e.push(Xu.of(i),oC(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function oC(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,l=n.state.doc.lineAt(e.to).number;return ye.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${l}.`)}const aR=n=>{let{state:e}=n,t=[];for(let i=0;i<e.doc.length;){let l=n.lineBlockAt(i),a=kd(e,l.from,l.to);a&&t.push($d.of(a)),i=(a?n.lineBlockAt(a.to):l).to+1}return t.length&&n.dispatch({effects:aC(n.state,t)}),!!t.length},oR=n=>{let e=n.state.field(Ba,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,l)=>{t.push(Xu.of({from:i,to:l}))}),n.dispatch({effects:t}),!0},cR=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:lR},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:rR},{key:"Ctrl-Alt-[",run:aR},{key:"Ctrl-Alt-]",run:oR}],uR={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},cC=be.define({combine(n){return dl(n,uR)}});function uC(n){return[Ba,pR]}function fC(n,e){let{state:t}=n,i=t.facet(cC),l=o=>{let u=n.lineBlockAt(n.posAtDOM(o.target)),f=Ad(n.state,u.from,u.to);f&&n.dispatch({effects:Xu.of(f)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,l,e);let a=document.createElement("span");return a.textContent=i.placeholderText,a.setAttribute("aria-label",t.phrase("folded code")),a.title=t.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=l,a}const ow=Le.replace({widget:new class extends pl{toDOM(n){return fC(n,null)}}});class fR extends pl{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return fC(e,this.value)}}const hR={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Bg extends Pl{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 dR(n={}){let e={...hR,...n},t=new Bg(e,!0),i=new Bg(e,!1),l=ln.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Gr)!=o.state.facet(Gr)||o.startState.field(Ba,!1)!=o.state.field(Ba,!1)||Fn(o.startState)!=Fn(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let u=new ql;for(let f of o.viewportLineBlocks){let d=Ad(o.state,f.from,f.to)?i:kd(o.state,f.from,f.to)?t:null;d&&u.add(f.from,f.from,d)}return u.finish()}}),{domEventHandlers:a}=e;return[l,EO({class:"cm-foldGutter",markers(o){var u;return((u=o.plugin(l))===null||u===void 0?void 0:u.markers)||it.empty},initialSpacer(){return new Bg(e,!1)},domEventHandlers:{...a,click:(o,u,f)=>{if(a.click&&a.click(o,u,f))return!0;let d=Ad(o.state,u.from,u.to);if(d)return o.dispatch({effects:Xu.of(d)}),!0;let p=kd(o.state,u.from,u.to);return p?(o.dispatch({effects:$d.of(p)}),!0):!1}}}),uC()]}const pR=ye.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 Qu{constructor(e,t){this.specs=e;let i;function l(u){let f=Ur.newName();return(i||(i=Object.create(null)))["."+f]=u,f}const a=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,o=t.scope;this.scope=o instanceof Rs?u=>u.prop(No)==o.data:o?u=>u==o:void 0,this.style=fy(e.map(u=>({tag:u.tag,class:u.class||l(Object.assign({},u,{tag:null}))})),{all:a}).style,this.module=i?new Ur(i):null,this.themeType=t.themeType}static define(e,t){return new Qu(e,t||{})}}const P0=be.define(),hC=be.define({combine(n){return n.length?[n[0]]:null}});function zg(n){let e=n.facet(P0);return e.length?e:n.facet(hC)}function dC(n,e){let t=[gR],i;return n instanceof Qu&&(n.module&&t.push(ye.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(hC.of(n)):i?t.push(P0.computeN([ye.darkTheme],l=>l.facet(ye.darkTheme)==(i=="dark")?[n]:[])):t.push(P0.of(n)),t}class mR{constructor(e){this.markCache=Object.create(null),this.tree=Fn(e.state),this.decorations=this.buildDeco(e,zg(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Fn(e.state),i=zg(e.state),l=i!=zg(e.startState),{viewport:a}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<a.to&&!l&&t.type==this.tree.type&&o>=a.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||l)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=a.to)}buildDeco(e,t){if(!t||!this.tree.length)return Le.none;let i=new ql;for(let{from:l,to:a}of e.visibleRanges)Nk(this.tree,t,(o,u,f)=>{i.add(o,u,this.markCache[f]||(this.markCache[f]=Le.mark({class:f})))},l,a);return i.finish()}}const gR=Yl.high(ln.fromClass(mR,{decorations:n=>n.decorations})),yR=Qu.define([{tag:Y.meta,color:"#404740"},{tag:Y.link,textDecoration:"underline"},{tag:Y.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Y.emphasis,fontStyle:"italic"},{tag:Y.strong,fontWeight:"bold"},{tag:Y.strikethrough,textDecoration:"line-through"},{tag:Y.keyword,color:"#708"},{tag:[Y.atom,Y.bool,Y.url,Y.contentSeparator,Y.labelName],color:"#219"},{tag:[Y.literal,Y.inserted],color:"#164"},{tag:[Y.string,Y.deleted],color:"#a11"},{tag:[Y.regexp,Y.escape,Y.special(Y.string)],color:"#e40"},{tag:Y.definition(Y.variableName),color:"#00f"},{tag:Y.local(Y.variableName),color:"#30a"},{tag:[Y.typeName,Y.namespace],color:"#085"},{tag:Y.className,color:"#167"},{tag:[Y.special(Y.variableName),Y.macroName],color:"#256"},{tag:Y.definition(Y.propertyName),color:"#00c"},{tag:Y.comment,color:"#940"},{tag:Y.invalid,color:"#f00"}]),bR=ye.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),pC=1e4,mC="()[]{}",gC=be.define({combine(n){return dl(n,{afterCursor:!0,brackets:mC,maxScanDistance:pC,renderMatch:SR})}}),xR=Le.mark({class:"cm-matchingBracket"}),vR=Le.mark({class:"cm-nonmatchingBracket"});function SR(n){let e=[],t=n.matched?xR:vR;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function cw(n){let e=[],t=n.facet(gC);for(let i of n.selection.ranges){if(!i.empty)continue;let l=ul(n,i.head,-1,t)||i.head>0&&ul(n,i.head-1,1,t)||t.afterCursor&&(ul(n,i.head,1,t)||i.head<n.doc.length&&ul(n,i.head+1,-1,t));l&&(e=e.concat(t.renderMatch(l,n)))}return Le.set(e,!0)}const wR=ln.fromClass(class{constructor(n){this.paused=!1,this.decorations=cw(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=cw(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),kR=[wR,bR];function AR(n={}){return[gC.of(n),kR]}const CR=new st;function Y0(n,e,t){let i=n.prop(e<0?st.openedBy:st.closedBy);if(i)return i;if(n.name.length==1){let l=t.indexOf(n.name);if(l>-1&&l%2==(e<0?1:0))return[t[l+e]]}return null}function F0(n){let e=n.type.prop(CR);return e?e(n.node):n}function ul(n,e,t,i={}){let l=i.maxScanDistance||pC,a=i.brackets||mC,o=Fn(n),u=o.resolveInner(e,t);for(let f=u;f;f=f.parent){let d=Y0(f.type,t,a);if(d&&f.from<f.to){let p=F0(f);if(p&&(t>0?e>=p.from&&e<p.to:e>p.from&&e<=p.to))return TR(n,e,t,f,p,d,a)}}return _R(n,e,t,o,u.type,l,a)}function TR(n,e,t,i,l,a,o){let u=i.parent,f={from:l.from,to:l.to},d=0,p=u==null?void 0:u.cursor();if(p&&(t<0?p.childBefore(i.from):p.childAfter(i.to)))do if(t<0?p.to<=i.from:p.from>=i.to){if(d==0&&a.indexOf(p.type.name)>-1&&p.from<p.to){let b=F0(p);return{start:f,end:b?{from:b.from,to:b.to}:void 0,matched:!0}}else if(Y0(p.type,t,o))d++;else if(Y0(p.type,-t,o)){if(d==0){let b=F0(p);return{start:f,end:b&&b.from<b.to?{from:b.from,to:b.to}:void 0,matched:!1}}d--}}while(t<0?p.prevSibling():p.nextSibling());return{start:f,matched:!1}}function _R(n,e,t,i,l,a,o){if(t<0?!e:e==n.doc.length)return null;let u=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),f=o.indexOf(u);if(f<0||f%2==0!=t>0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},p=n.doc.iterRange(e,t>0?n.doc.length:0),b=0;for(let x=0;!p.next().done&&x<=a;){let S=p.value;t<0&&(x+=S.length);let w=e+x*t;for(let T=t>0?0:S.length-1,C=t>0?S.length:-1;T!=C;T+=t){let E=o.indexOf(S[T]);if(!(E<0||i.resolveInner(w+T,1).type!=l))if(E%2==0==t>0)b++;else{if(b==1)return{start:d,end:{from:w+T,to:w+T+1},matched:E>>1==f>>1};b--}}t>0&&(x+=S.length)}return p.done?{start:d,matched:!1}:null}const MR=Object.create(null),uw=[Mi.none],fw=[],hw=Object.create(null),ER=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"]])ER[n]=NR(MR,e);function Hg(n,e){fw.indexOf(n)>-1||(fw.push(n),console.warn(e))}function NR(n,e){let t=[];for(let u of e.split(" ")){let f=[];for(let d of u.split(".")){let p=n[d]||Y[d];p?typeof p=="function"?f.length?f=f.map(p):Hg(d,`Modifier ${d} used at start of tag`):f.length?Hg(d,`Tag ${d} used as modifier`):f=Array.isArray(p)?p:[p]:Hg(d,`Unknown highlighting tag ${d}`)}for(let d of f)t.push(d)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(u=>u.id),a=hw[l];if(a)return a.id;let o=hw[l]=Mi.define({id:uw.length,name:i,props:[kE({[i]:t})]});return uw.push(o),o.id}Lt.RTL,Lt.LTR;const DR=ye.theme({"&":{height:"100%",color:"var(--text)",backgroundColor:"var(--bg)",fontSize:"13px"},".cm-scroller":{fontFamily:"var(--mono)",lineHeight:"1.6"},".cm-content":{caretColor:"var(--accent)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--accent)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--cm-selection)"},".cm-gutters":{backgroundColor:"var(--bg)",color:"var(--muted)",borderRight:"1px solid var(--border-soft)"},".cm-activeLineGutter":{backgroundColor:"var(--surface-2)",color:"var(--text-2)"},".cm-activeLine":{backgroundColor:"var(--cm-active)"},".cm-selectionMatch":{backgroundColor:"var(--cm-match)"},"&.cm-focused .cm-matchingBracket":{backgroundColor:"var(--cm-match)",outline:"1px solid var(--accent-line)"},".cm-foldPlaceholder":{backgroundColor:"var(--surface-2)",border:"1px solid var(--border)",color:"var(--muted)"},".cm-panels":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--border)"},".cm-panels input, .cm-panels button, .cm-panels select":{fontFamily:"var(--sans)",fontSize:"12px",background:"var(--surface-2)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:"6px",padding:"3px 6px"},".cm-searchMatch":{backgroundColor:"var(--cm-match)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)"},".cm-tooltip":{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:"8px",boxShadow:"var(--shadow-md)",color:"var(--text)"},".cm-tooltip-autocomplete ul li[aria-selected]":{background:"var(--surface-2)",color:"var(--text)"}}),OR=dC(Qu.define([{tag:[Y.keyword,Y.modifier,Y.controlKeyword,Y.moduleKeyword],color:"var(--cm-key)"},{tag:[Y.name,Y.deleted,Y.character,Y.macroName],color:"var(--text)"},{tag:[Y.propertyName],color:"var(--cm-prop)"},{tag:[Y.function(Y.variableName),Y.labelName],color:"var(--cm-fn)"},{tag:[Y.color,Y.constant(Y.name),Y.standard(Y.name),Y.bool],color:"var(--cm-const)"},{tag:[Y.definition(Y.name),Y.separator],color:"var(--text)"},{tag:[Y.typeName,Y.className,Y.changed,Y.annotation,Y.self,Y.namespace],color:"var(--cm-type)"},{tag:[Y.number,Y.integer,Y.float],color:"var(--cm-num)"},{tag:[Y.string,Y.special(Y.string),Y.regexp],color:"var(--cm-str)"},{tag:[Y.operator,Y.operatorKeyword,Y.escape],color:"var(--cm-op)"},{tag:[Y.meta,Y.comment],color:"var(--cm-comment)",fontStyle:"italic"},{tag:Y.strong,fontWeight:"650"},{tag:Y.emphasis,fontStyle:"italic"},{tag:Y.strikethrough,textDecoration:"line-through"},{tag:Y.link,color:"var(--cm-str)",textDecoration:"underline"},{tag:Y.heading,fontWeight:"650",color:"var(--cm-key)"},{tag:Y.invalid,color:"var(--danger)"}])),yC={js:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-D8swzi0v.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-D8swzi0v.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript(),mjs:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-D8swzi0v.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript(),jsx:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-D8swzi0v.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-D8swzi0v.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-D8swzi0v.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-D8swzi0v.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-D8swzi0v.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await ct(async()=>{const{json:n}=await import("./index-4x6fBcbV.js");return{json:n}},__vite__mapDeps([2,1]),import.meta.url)).json(),jsonc:async()=>(await ct(async()=>{const{json:n}=await import("./index-4x6fBcbV.js");return{json:n}},__vite__mapDeps([2,1]),import.meta.url)).json(),css:async()=>(await ct(async()=>{const{css:n}=await import("./index-e0Ev4udb.js");return{css:n}},__vite__mapDeps([3,1]),import.meta.url)).css(),scss:async()=>(await ct(async()=>{const{css:n}=await import("./index-e0Ev4udb.js");return{css:n}},__vite__mapDeps([3,1]),import.meta.url)).css(),less:async()=>(await ct(async()=>{const{css:n}=await import("./index-e0Ev4udb.js");return{css:n}},__vite__mapDeps([3,1]),import.meta.url)).css(),html:async()=>(await ct(async()=>{const{html:n}=await import("./index-BBL1LP-l.js");return{html:n}},__vite__mapDeps([4,1,3,0]),import.meta.url)).html(),htm:async()=>(await ct(async()=>{const{html:n}=await import("./index-BBL1LP-l.js");return{html:n}},__vite__mapDeps([4,1,3,0]),import.meta.url)).html(),vue:async()=>(await ct(async()=>{const{html:n}=await import("./index-BBL1LP-l.js");return{html:n}},__vite__mapDeps([4,1,3,0]),import.meta.url)).html(),svelte:async()=>(await ct(async()=>{const{html:n}=await import("./index-BBL1LP-l.js");return{html:n}},__vite__mapDeps([4,1,3,0]),import.meta.url)).html(),md:async()=>(await ct(async()=>{const{markdown:n}=await import("./index-D0qAiokq.js");return{markdown:n}},__vite__mapDeps([5,4,1,3,0]),import.meta.url)).markdown(),markdown:async()=>(await ct(async()=>{const{markdown:n}=await import("./index-D0qAiokq.js");return{markdown:n}},__vite__mapDeps([5,4,1,3,0]),import.meta.url)).markdown(),py:async()=>(await ct(async()=>{const{python:n}=await import("./index-BVHAVdqc.js");return{python:n}},__vite__mapDeps([6,1]),import.meta.url)).python(),pyi:async()=>(await ct(async()=>{const{python:n}=await import("./index-BVHAVdqc.js");return{python:n}},__vite__mapDeps([6,1]),import.meta.url)).python(),yaml:async()=>(await ct(async()=>{const{yaml:n}=await import("./index-Dw1tTDZW.js");return{yaml:n}},__vite__mapDeps([7,1]),import.meta.url)).yaml(),yml:async()=>(await ct(async()=>{const{yaml:n}=await import("./index-Dw1tTDZW.js");return{yaml:n}},__vite__mapDeps([7,1]),import.meta.url)).yaml(),rs:async()=>(await ct(async()=>{const{rust:n}=await import("./index-CtQ2lLVm.js");return{rust:n}},__vite__mapDeps([8,1]),import.meta.url)).rust(),c:async()=>(await ct(async()=>{const{cpp:n}=await import("./index-CYyCCyf_.js");return{cpp:n}},__vite__mapDeps([9,1]),import.meta.url)).cpp(),h:async()=>(await ct(async()=>{const{cpp:n}=await import("./index-CYyCCyf_.js");return{cpp:n}},__vite__mapDeps([9,1]),import.meta.url)).cpp(),cc:async()=>(await ct(async()=>{const{cpp:n}=await import("./index-CYyCCyf_.js");return{cpp:n}},__vite__mapDeps([9,1]),import.meta.url)).cpp(),cpp:async()=>(await ct(async()=>{const{cpp:n}=await import("./index-CYyCCyf_.js");return{cpp:n}},__vite__mapDeps([9,1]),import.meta.url)).cpp(),hpp:async()=>(await ct(async()=>{const{cpp:n}=await import("./index-CYyCCyf_.js");return{cpp:n}},__vite__mapDeps([9,1]),import.meta.url)).cpp(),java:async()=>(await ct(async()=>{const{java:n}=await import("./index-CPBnfhi2.js");return{java:n}},__vite__mapDeps([10,1]),import.meta.url)).java(),go:async()=>(await ct(async()=>{const{go:n}=await import("./index-CG3BWhrU.js");return{go:n}},__vite__mapDeps([11,1]),import.meta.url)).go(),php:async()=>(await ct(async()=>{const{php:n}=await import("./index-DSNRlHPG.js");return{php:n}},__vite__mapDeps([12,1,4,3,0]),import.meta.url)).php(),sql:async()=>(await ct(async()=>{const{sql:n}=await import("./index-DJN3PaCw.js");return{sql:n}},__vite__mapDeps([13,1]),import.meta.url)).sql(),xml:async()=>(await ct(async()=>{const{xml:n}=await import("./index-BQbBSCN3.js");return{xml:n}},__vite__mapDeps([14,1]),import.meta.url)).xml(),svg:async()=>(await ct(async()=>{const{xml:n}=await import("./index-BQbBSCN3.js");return{xml:n}},__vite__mapDeps([14,1]),import.meta.url)).xml()},RR={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},jR={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function LR(n){const e=jR[n.toLowerCase()]??n.toLowerCase(),t=yC[e];return t?t().catch(()=>null):null}async function BR(n){const e=(n.split("/").pop()??"").toLowerCase(),t=RR[e]??e.split(".").pop()??"",i=yC[t];return i?i().catch(()=>null):null}const zR=fy([{tag:[Y.keyword,Y.modifier,Y.controlKeyword,Y.moduleKeyword],class:"cmh-key"},{tag:[Y.propertyName],class:"cmh-prop"},{tag:[Y.function(Y.variableName),Y.labelName],class:"cmh-fn"},{tag:[Y.color,Y.constant(Y.name),Y.standard(Y.name),Y.bool],class:"cmh-const"},{tag:[Y.typeName,Y.className,Y.changed,Y.annotation,Y.self,Y.namespace],class:"cmh-type"},{tag:[Y.number,Y.integer,Y.float],class:"cmh-num"},{tag:[Y.string,Y.special(Y.string),Y.regexp],class:"cmh-str"},{tag:[Y.operator,Y.operatorKeyword,Y.escape],class:"cmh-op"},{tag:[Y.meta,Y.comment],class:"cmh-comment"},{tag:Y.invalid,class:"cmh-invalid"}]);function Uh(n){return n.replace(/[&<>]/g,e=>e==="&"?"&amp;":e==="<"?"&lt;":"&gt;")}async function HR(n,e){const t=e?await LR(e):null;if(!t)return Uh(n);try{const i=t.language.parser.parse(n);let l="";return CE(n,i,zR,(a,o)=>{l+=o?`<span class="${o}">${Uh(a)}</span>`:Uh(a)},()=>{l+=`
127
- `}),l}catch{return Uh(n)}}vt.setOptions({gfm:!0,breaks:!1});function bC(n){var t;const e=(t=n.split(".").pop())==null?void 0:t.toLowerCase();return e==="md"||e==="markdown"}async function IR(n){const e=await vt.parse(n,{async:!0,walkTokens:async t=>{if(t.type!=="code")return;const i=t;i.text=await HR(i.text,i.lang??""),i.escaped=!0}});return iE.sanitize(e)}function dw(n,e){return{path:n.path,text:n.content,saved:n.content,eol:n.eol,mtime:n.mtime,size:n.size,binary:n.binary,tooLarge:n.tooLarge,stale:!1,revision:e,previewMode:bC(n.path)}}function Nr(n){return!n.binary&&!n.tooLarge&&n.text!==n.saved}function UR(n){return n.split("/").pop()??n}function Ho(n){const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function Ig(n){return n<1024?`${n} Б`:n<1024*1024?`${(n/1024).toFixed(1)} КБ`:`${(n/1024/1024).toFixed(1)} МБ`}const VR=3500,qR=9e3,GR=220;function Zu({result:n}){const[e,t]=M.useState(n),[i,l]=M.useState(!1);return M.useEffect(()=>{if(!n){t(null),l(!1);return}t(n),l(!1);const a=n.ok?VR:qR,o=setTimeout(()=>l(!0),a),u=setTimeout(()=>t(null),a+GR);return()=>{clearTimeout(o),clearTimeout(u)}},[n]),e?y.jsx("div",{className:"oplog "+(e.ok?"oplog--ok":"oplog--bad")+(i?" oplog--leaving":""),role:"status","aria-live":e.ok?"polite":"assertive",children:e.message}):null}function Cd({value:n,className:e,placeholder:t="Название сессии",onCommit:i,onCancel:l}){const[a,o]=M.useState(n),u=M.useRef(null);M.useEffect(()=>{var d;(d=u.current)==null||d.select()},[]);function f(){const d=a.trim();if(!d||d===n)return l();i(d)}return y.jsx("input",{ref:u,className:e?`rename ${e}`:"rename",value:a,autoFocus:!0,spellCheck:!1,placeholder:t,onChange:d=>o(d.target.value),onBlur:f,onKeyDown:d=>{d.stopPropagation(),d.key==="Enter"?(d.preventDefault(),f()):d.key==="Escape"&&(d.preventDefault(),l())}})}const ga="application/x-ccv-fs-path",PR=200;function YR({open:n,tree:e,expanded:t,activePath:i,dirty:l,gitChanges:a,result:o,searchResult:u,onSearch:f,onReveal:d,onToggle:p,onOpen:b,onCreate:x,onRename:S,onMove:w,onDelete:T,onRefresh:C,onClose:E}){const[O,B]=M.useState(""),[q,H]=M.useState(null),[L,j]=M.useState(null),[se,he]=M.useState(null),[Me,ue]=M.useState(null),le=M.useMemo(()=>KR(a),[a]);function Ee(we){return!(!se||we===se.path||se.kind==="dir"&&we.startsWith(`${se.path}/`)||we===Ho(se.path))}function ve(we){return xe=>{xe.dataTransfer.effectAllowed="move",xe.dataTransfer.setData(ga,we.path),he({path:we.path,kind:we.kind})}}function ke(){he(null),ue(null)}function I(we){return xe=>{xe.dataTransfer.types.includes(ga)&&(xe.stopPropagation(),!(we.kind!=="dir"||!Ee(we.path))&&(xe.preventDefault(),ue(we.path)))}}function Z(we){return xe=>{if(!xe.dataTransfer.types.includes(ga)||(xe.stopPropagation(),we.kind!=="dir"||!Ee(we.path)))return;xe.preventDefault();const Ft=xe.dataTransfer.getData(ga);ue(null),Ft&&w(Ft,we.path)}}function ee(we){!we.dataTransfer.types.includes(ga)||!Ee("")||(we.preventDefault(),ue(""))}function Ne(we){if(!we.dataTransfer.types.includes(ga)||!Ee(""))return;we.preventDefault();const xe=we.dataTransfer.getData(ga);ue(null),xe&&w(xe,"")}const[_e,N]=M.useState(""),F=_e.trim(),J=F.length>0,oe=M.useRef(null),de=M.useRef(f);de.current=f;function Se(we){N(we),oe.current&&clearTimeout(oe.current);const xe=we.trim();if(!xe){de.current("");return}oe.current=setTimeout(()=>de.current(xe),PR)}function Ie(we){oe.current&&clearTimeout(oe.current),N(""),de.current(""),B(we.path),d(we)}const pt=J&&(u==null?void 0:u.query)===F?u:null;function $e(){if(O==="")return"";const we=$R(e,O);if((we==null?void 0:we.kind)==="dir")return O;const xe=O.lastIndexOf("/");return xe===-1?"":O.slice(0,xe)}function It(we){const xe=$e();xe&&!t.has(xe)&&p(xe),j({parent:xe,kind:we})}const Ze=J?[]:Kt("",0);function Kt(we,xe){const Ft=e[we],xn=[];if(L&&L.parent===we&&xn.push(y.jsxs("div",{className:"fsrow fsrow--draft",style:zl(xe),children:[y.jsx("span",{className:"fsrow__icon",children:L.kind==="dir"?y.jsx(_d,{}):y.jsx(Md,{})}),y.jsx(Cd,{className:"rename--file",value:"",placeholder:L.kind==="dir"?"имя каталога":"имя файла",onCommit:Ve=>{j(null),x(we,L.kind,Ve)},onCancel:()=>j(null)})]},`draft:${we}`)),!Ft)return xn.push(y.jsx("p",{className:"fsrow__pending",style:zl(xe),children:"читаем…"},`wait:${we}`)),xn;Ft.length===0&&!L&&xn.push(y.jsx("p",{className:"fsrow__pending",style:zl(xe),children:"пусто"},`empty:${we}`));for(const Ve of Ft){const Rn=Ve.kind==="dir"&&t.has(Ve.path);xn.push(q===Ve.path?y.jsxs("div",{className:"fsrow fsrow--draft",style:zl(xe),children:[y.jsx("span",{className:"fsrow__icon",children:Ve.kind==="dir"?y.jsx(_d,{open:Rn}):y.jsx(Md,{})}),y.jsx(Cd,{className:"rename--file",value:Ve.name,placeholder:"новое имя",onCommit:si=>{H(null),S(Ve.path,si)},onCancel:()=>H(null)})]},Ve.path):y.jsx(FR,{entry:Ve,depth:xe,open:Rn,active:Ve.path===i,selected:Ve.path===O,dirty:l.has(Ve.path),gitStatus:le.get(Ve.path),dragging:(se==null?void 0:se.path)===Ve.path,dropTarget:Me===Ve.path,onClick:()=>{B(Ve.path),Ve.kind==="dir"?p(Ve.path):b(Ve.path)},onRename:()=>H(Ve.path),onDelete:()=>T(Ve),onDragStart:ve(Ve),onDragEnd:ke,onDragOver:I(Ve),onDrop:Z(Ve)},Ve.path)),Rn&&xn.push(...Kt(Ve.path,xe+1))}return xn}function at(){if(!pt)return[y.jsx("p",{className:"fsrow__pending",style:zl(0),children:"ищем…"},"search:wait")];if(pt.entries.length===0)return[y.jsx("p",{className:"fsrow__pending",style:zl(0),children:"ничего не найдено"},"search:empty")];const we=pt.entries.map(xe=>y.jsx(WR,{entry:xe,gitStatus:le.get(xe.path),onClick:()=>Ie(xe)},xe.path));return pt.truncated&&we.push(y.jsxs("p",{className:"fsrow__pending",style:zl(0),children:["показаны первые ",pt.entries.length," — уточните запрос"]},"search:truncated")),we}return y.jsxs("aside",{className:n?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files","aria-label":"Файлы проекта",children:[y.jsxs("div",{className:"sidepane__head",children:[y.jsx(JR,{}),y.jsx("span",{className:"sidepane__title",children:"Файлы"}),y.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>It("file"),children:y.jsx(QR,{})}),y.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>It("dir"),children:y.jsx(ZR,{})}),y.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:C,children:"↻"}),y.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:E,children:"✕"})]}),y.jsxs("div",{className:"fssearch",children:[y.jsx(ej,{}),y.jsx("input",{className:"fssearch__input",type:"text",value:_e,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:we=>Se(we.target.value),onKeyDown:we=>{we.stopPropagation(),we.key==="Escape"&&(we.preventDefault(),_e?Se(""):we.currentTarget.blur())}}),_e&&y.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>Se(""),children:"✕"})]}),y.jsx("div",{className:"sidepane__scroll fstree"+(Me===""?" fstree--drop-target":""),onDragOver:ee,onDrop:Ne,children:J?at():Ze}),y.jsx(Zu,{result:o})]})}function FR({entry:n,depth:e,open:t,active:i,selected:l,dirty:a,gitStatus:o,dragging:u,dropTarget:f,onClick:d,onRename:p,onDelete:b,onDragStart:x,onDragEnd:S,onDragOver:w,onDrop:T}){const C="fsrow"+(i?" is-open":"")+(l&&!i?" is-selected":"")+(n.ignored?" fsrow--ignored":"")+(u?" fsrow--dragging":"")+(f?" fsrow--drop-target":"");return y.jsxs("div",{className:C,style:zl(e),draggable:!0,onDragStart:x,onDragEnd:S,onDragOver:w,onDrop:T,children:[y.jsxs("button",{className:"fsrow__main",onClick:d,title:xC(n),children:[y.jsx("span",{className:"fsrow__icon"+Td("fsrow__icon",o),children:n.kind==="dir"?y.jsx(_d,{open:t}):y.jsx(Md,{})}),y.jsx("span",{className:"fsrow__name"+Td("fsrow__name",o),children:n.name}),n.ignored&&y.jsx("span",{className:"fsrow__tag",title:"Игнорируется git (.gitignore)",children:"git-ignore"}),a&&y.jsx("span",{className:"fsrow__dot",title:"Есть несохранённые правки"})]}),y.jsx("button",{className:"fsrow__act",title:"Переименовать","aria-label":`Переименовать ${n.name}`,onClick:p,children:"✎"}),y.jsx("button",{className:"fsrow__act",title:"Удалить","aria-label":`Удалить ${n.name}`,onClick:b,children:"✕"})]})}function WR({entry:n,gitStatus:e,onClick:t}){const i=n.path.slice(0,n.path.length-n.name.length-1);return y.jsxs("button",{className:"fsrow fsrow--search"+(n.ignored?" fsrow--ignored":""),style:zl(0),onClick:t,title:xC(n),children:[y.jsx("span",{className:"fsrow__icon"+Td("fsrow__icon",e),children:n.kind==="dir"?y.jsx(_d,{}):y.jsx(Md,{})}),y.jsx("span",{className:"fsrow__name"+Td("fsrow__name",e),children:n.name}),n.ignored&&y.jsx("span",{className:"fsrow__tag",children:"git-ignore"}),i&&y.jsx("span",{className:"fsrow__path",children:i})]})}function xC(n){return n.ignored?`${n.path} — игнорируется git (.gitignore)`:n.path}function zl(n){return{"--depth":n}}function $R(n,e){var l;const t=e.lastIndexOf("/"),i=t===-1?"":e.slice(0,t);return((l=n[i])==null?void 0:l.find(a=>a.path===e))??null}function KR(n){const e=new Map,t={added:1,modified:2},i=(l,a)=>{const o=e.get(l);(!o||t[a]>t[o])&&e.set(l,a)};for(const l of n){const a=XR(l.status);if(!a)continue;i(l.path,a);let o=Ho(l.path);for(;i(o,a),!!o;)o=Ho(o)}return e}function XR(n){if(n==="??")return"added";const[e="",t=""]=n;return e==="A"||e==="R"||e==="C"?"added":e==="M"||t==="M"?"modified":null}function Td(n,e){return e?` ${n}--git-${e}`:""}function _d({open:n=!1}){return y.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:n?y.jsx("path",{d:"M2 12.5V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h4.4a.7.7 0 0 1 .7.7v1.2M2 12.5l1.7-4.6a.7.7 0 0 1 .66-.46h9.2a.5.5 0 0 1 .47.66L12.4 12.5Z"}):y.jsx("path",{d:"M2 12.4V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h5.9a.7.7 0 0 1 .7.7v6.6a.7.7 0 0 1-.7.7H2.7a.7.7 0 0 1-.7-.7Z"})})}function Md(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M9 2H4.4a.7.7 0 0 0-.7.7v10.6a.7.7 0 0 0 .7.7h7.2a.7.7 0 0 0 .7-.7V5.2Z"}),y.jsx("path",{d:"M9 2v3.2h3.3"})]})}function QR(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[y.jsxs("g",{transform:"translate(-1.3,-1.6) scale(0.78)",strokeLinejoin:"round",children:[y.jsx("path",{d:"M9 2H4.4a.7.7 0 0 0-.7.7v10.6a.7.7 0 0 0 .7.7h7.2a.7.7 0 0 0 .7-.7V5.2Z"}),y.jsx("path",{d:"M9 2v3.2h3.3"})]}),y.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function ZR(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[y.jsx("g",{transform:"translate(-1.3,-1.6) scale(0.78)",children:y.jsx("path",{d:"M2 12.4V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h5.9a.7.7 0 0 1 .7.7v6.6a.7.7 0 0 1-.7.7H2.7a.7.7 0 0 1-.7-.7Z"})}),y.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function JR(){return y.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M2 4.1V3a.6.6 0 0 1 .6-.6h2.6l1.2 1.4h5a.6.6 0 0 1 .6.6v1.1"}),y.jsx("path",{d:"M2 12.6V5.7h11.4a.6.6 0 0 1 .58.75l-1.5 6.2a.6.6 0 0 1-.58.45H2.6a.6.6 0 0 1-.6-.5Z"})]})}function ej(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[y.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),y.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const tj=200;function nj({open:n,result:e,onSearch:t,onOpenMatch:i,onClose:l}){const[a,o]=M.useState(""),u=a.trim(),f=u.length>0,d=M.useRef(null),p=M.useRef(t);p.current=t;function b(w){o(w),d.current&&clearTimeout(d.current);const T=w.trim();if(!T){p.current("");return}d.current=setTimeout(()=>p.current(T),tj)}const x=f&&(e==null?void 0:e.query)===u?e:null;function S(){if(!x)return[y.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(x.matches.length===0)return[y.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const w=[];let T="";for(const C of x.matches)C.path!==T&&(T=C.path,w.push(y.jsx("p",{className:"searchgroup__path",title:C.path,children:C.path},`path:${C.path}`))),w.push(y.jsx(ij,{match:C,onClick:()=>i(C)},`${C.path}:${C.line}:${C.column}`));return x.truncated&&w.push(y.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",x.matches.length," — уточните запрос"]},"grep:truncated")),w}return y.jsxs("aside",{className:n?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search","aria-label":"Поиск по тексту в проекте",children:[y.jsxs("div",{className:"sidepane__head",children:[y.jsx(sj,{}),y.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),y.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель поиска",onClick:l,children:"✕"})]}),y.jsxs("div",{className:"fssearch",children:[y.jsx(lj,{}),y.jsx("input",{className:"fssearch__input",type:"text",value:a,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:w=>b(w.target.value),onKeyDown:w=>{w.stopPropagation(),w.key==="Escape"&&(w.preventDefault(),a?b(""):w.currentTarget.blur())}}),a&&y.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>b(""),children:"✕"})]}),y.jsx("div",{className:"sidepane__scroll fstree",children:f?S():y.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function ij({match:n,onClick:e}){const t=n.lineText.slice(0,n.column-1),i=n.lineText.slice(n.column-1,n.column-1+n.matchLength),l=n.lineText.slice(n.column-1+n.matchLength);return y.jsxs("button",{className:"searchmatch",onClick:e,title:`${n.path}:${n.line}`,children:[y.jsx("span",{className:"searchmatch__line",children:n.line}),y.jsxs("span",{className:"searchmatch__text",children:[t,y.jsx("mark",{children:i}),l]})]})}function sj(){return y.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[y.jsx("circle",{cx:"6.8",cy:"6.8",r:"4.3"}),y.jsx("path",{d:"M13.2 13.2 10.1 10.1"})]})}function lj(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[y.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),y.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const rj=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=jy(n.state,t.from);return i.line?aj(n):i.block?cj(n):!1};function Ry(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let l=n(e,t);return l?(i(t.update(l)),!0):!1}}const aj=Ry(hj,0),oj=Ry(vC,0),cj=Ry((n,e)=>vC(n,e,fj(e)),0);function jy(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const du=50;function uj(n,{open:e,close:t},i,l){let a=n.sliceDoc(i-du,i),o=n.sliceDoc(l,l+du),u=/\s*$/.exec(a)[0].length,f=/^\s*/.exec(o)[0].length,d=a.length-u;if(a.slice(d-e.length,d)==e&&o.slice(f,f+t.length)==t)return{open:{pos:i-u,margin:u&&1},close:{pos:l+f,margin:f&&1}};let p,b;l-i<=2*du?p=b=n.sliceDoc(i,l):(p=n.sliceDoc(i,i+du),b=n.sliceDoc(l-du,l));let x=/^\s*/.exec(p)[0].length,S=/\s*$/.exec(b)[0].length,w=b.length-S-t.length;return p.slice(x,x+e.length)==e&&b.slice(w,w+t.length)==t?{open:{pos:i+x+e.length,margin:/\s/.test(p.charAt(x+e.length))?1:0},close:{pos:l-S-t.length,margin:/\s/.test(b.charAt(w-1))?1:0}}:null}function fj(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),l=t.to<=i.to?i:n.doc.lineAt(t.to);l.from>i.from&&l.from==t.to&&(l=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let a=e.length-1;a>=0&&e[a].to>i.from?e[a].to=l.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:l.to})}return e}function vC(n,e,t=e.selection.ranges){let i=t.map(a=>jy(e,a.from).block);if(!i.every(a=>a))return null;let l=t.map((a,o)=>uj(e,i[o],a.from,a.to));if(n!=2&&!l.every(a=>a))return{changes:e.changes(t.map((a,o)=>l[o]?[]:[{from:a.from,insert:i[o].open+" "},{from:a.to,insert:" "+i[o].close}]))};if(n!=1&&l.some(a=>a)){let a=[];for(let o=0,u;o<l.length;o++)if(u=l[o]){let f=i[o],{open:d,close:p}=u;a.push({from:d.pos-f.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+f.close.length})}return{changes:a}}return null}function hj(n,e,t=e.selection.ranges){let i=[],l=-1;e:for(let{from:a,to:o}of t){let u=i.length,f=1e9,d;for(let p=a;p<=o;){let b=e.doc.lineAt(p);if(d==null&&(d=jy(e,b.from).line,!d))continue e;if(b.from>l&&(a==o||o>b.from)){l=b.from;let x=/^\s*/.exec(b.text)[0].length,S=x==b.length,w=b.text.slice(x,x+d.length)==d?x:-1;x<b.text.length&&x<f&&(f=x),i.push({line:b,comment:w,token:d,indent:x,empty:S,single:!1})}p=b.to+1}if(f<1e9)for(let p=u;p<i.length;p++)i[p].indent<i[p].line.text.length&&(i[p].indent=f);i.length==u+1&&(i[u].single=!0)}if(n!=2&&i.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:u,token:f,indent:d,empty:p,single:b}of i)(b||!p)&&a.push({from:u.from+d,insert:f+" "});let o=e.changes(a);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(a=>a.comment>=0)){let a=[];for(let{line:o,comment:u,token:f}of i)if(u>=0){let d=o.from+u,p=d+f.length;o.text[p-o.from]==" "&&p++,a.push({from:d,to:p})}return{changes:a}}return null}const W0=Fl.define(),dj=Fl.define(),pj=be.define(),SC=be.define({combine(n){return dl(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,l)=>e(i,l)||t(i,l)})}}),wC=Wn.define({create(){return fl.empty},update(n,e){let t=e.state.facet(SC),i=e.annotation(W0);if(i){let f=_i.fromTransaction(e,i.selection),d=i.side,p=d==0?n.undone:n.done;return f?p=Ed(p,p.length,t.minDepth,f):p=CC(p,e.startState.selection),new fl(d==0?i.rest:p,d==0?p:i.rest)}let l=e.annotation(dj);if((l=="full"||l=="before")&&(n=n.isolate()),e.annotation(dn.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let a=_i.fromTransaction(e),o=e.annotation(dn.time),u=e.annotation(dn.userEvent);return a?n=n.addChanges(a,o,u,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,u,t.newGroupDelay)),(l=="full"||l=="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 fl(n.done.map(_i.fromJSON),n.undone.map(_i.fromJSON))}});function mj(n={}){return[wC,SC.of(n),ye.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?kC:e.inputType=="historyRedo"?$0:null;return i?(e.preventDefault(),i(t)):!1}})]}function Kd(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let l=t.field(wC,!1);if(!l)return!1;let a=l.pop(n,t,e);return a?(i(a),!0):!1}}const kC=Kd(0,!1),$0=Kd(1,!1),gj=Kd(0,!0),yj=Kd(1,!0);class _i{constructor(e,t,i,l,a){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=l,this.selectionsAfter=a}setSelAfter(e){return new _i(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;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:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(e){return new _i(e.changes&&bn.fromJSON(e.changes),[],e.mapped&&hl.fromJSON(e.mapped),e.startSelection&&X.fromJSON(e.startSelection),e.selectionsAfter.map(X.fromJSON))}static fromTransaction(e,t){let i=cs;for(let l of e.startState.facet(pj)){let a=l(e);a.length&&(i=i.concat(a))}return!i.length&&e.changes.empty?null:new _i(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,cs)}static selection(e){return new _i(void 0,cs,void 0,void 0,e)}}function Ed(n,e,t,i){let l=e+1>t+20?e-t-1:0,a=n.slice(l,e);return a.push(i),a}function bj(n,e){let t=[],i=!1;return n.iterChangedRanges((l,a)=>t.push(l,a)),e.iterChangedRanges((l,a,o,u)=>{for(let f=0;f<t.length;){let d=t[f++],p=t[f++];u>=d&&o<=p&&(i=!0)}}),i}function xj(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function AC(n,e){return n.length?e.length?n.concat(e):n:e}const cs=[],vj=200;function CC(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-vj));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Ed(n,n.length-1,1e9,t.setSelAfter(i)))}else return[_i.selection([e])]}function Sj(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 Ug(n,e){if(!n.length)return n;let t=n.length,i=cs;for(;t;){let l=wj(n[t-1],e,i);if(l.changes&&!l.changes.empty||l.effects.length){let a=n.slice(0,t);return a[t-1]=l,a}else e=l.mapped,t--,i=l.selectionsAfter}return i.length?[_i.selection(i)]:cs}function wj(n,e,t){let i=AC(n.selectionsAfter.length?n.selectionsAfter.map(u=>u.map(e)):cs,t);if(!n.changes)return _i.selection(i);let l=n.changes.map(e),a=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(a):a;return new _i(l,Ge.mapEffects(n.effects,e),o,n.startSelection.map(a),i)}const kj=/^(input\.type|delete)($|\.)/;class fl{constructor(e,t,i=0,l=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=l}isolate(){return this.prevTime?new fl(this.done,this.undone):this}addChanges(e,t,i,l,a){let o=this.done,u=o[o.length-1];return u&&u.changes&&!u.changes.empty&&e.changes&&(!i||kj.test(i))&&(!u.selectionsAfter.length&&t-this.prevTime<l.newGroupDelay&&l.joinToEvent(a,bj(u.changes,e.changes))||i=="input.type.compose")?o=Ed(o,o.length-1,l.minDepth,new _i(e.changes.compose(u.changes),AC(Ge.mapEffects(e.effects,u.changes),u.effects),u.mapped,u.startSelection,cs)):o=Ed(o,o.length,l.minDepth,e),new fl(o,cs,t,i)}addSelection(e,t,i,l){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:cs;return a.length>0&&t-this.prevTime<l&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&xj(a[a.length-1],e)?this:new fl(CC(this.done,e),this.undone,t,i)}addMapping(e){return new fl(Ug(this.done,e),Ug(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,i){let l=e==0?this.done:this.undone;if(l.length==0)return null;let a=l[l.length-1],o=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):t.selection);if(i&&a.selectionsAfter.length)return t.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:W0.of({side:e,rest:Sj(l),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let u=l.length==1?cs:l.slice(0,l.length-1);return a.mapped&&(u=Ug(u,a.mapped)),t.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:W0.of({side:e,rest:u,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}fl.empty=new fl(cs,cs);const Aj=[{key:"Mod-z",run:kC,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:$0,preventDefault:!0},{linux:"Ctrl-Shift-z",run:$0,preventDefault:!0},{key:"Mod-u",run:gj,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:yj,preventDefault:!0}];function rc(n,e){return X.create(n.ranges.map(e),n.mainIndex)}function Bs(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function zs({state:n,dispatch:e},t){let i=rc(n.selection,t);return i.eq(n.selection,!0)?!1:(e(Bs(n,i)),!0)}function Xd(n,e){return X.cursor(e?n.to:n.from)}function TC(n,e){return zs(n,t=>t.empty?n.moveByChar(t,e):Xd(t,e))}function ii(n){return n.textDirectionAt(n.state.selection.main.head)==Lt.LTR}const _C=n=>TC(n,!ii(n)),MC=n=>TC(n,ii(n));function EC(n,e){return zs(n,t=>t.empty?n.moveByGroup(t,e):Xd(t,e))}const Cj=n=>EC(n,!ii(n)),Tj=n=>EC(n,ii(n));function _j(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Qd(n,e,t){let i=Fn(n).resolveInner(e.head),l=t?st.closedBy:st.openedBy;for(let f=e.head;;){let d=t?i.childAfter(f):i.childBefore(f);if(!d)break;_j(n,d,l)?i=d:f=t?d.to:d.from}let a=i.type.prop(l),o,u;return a&&(o=t?ul(n,i.from,1):ul(n,i.to,-1))&&o.matched?u=t?o.end.to:o.end.from:u=t?i.to:i.from,X.cursor(u,t?-1:1)}const Mj=n=>zs(n,e=>Qd(n.state,e,!ii(n))),Ej=n=>zs(n,e=>Qd(n.state,e,ii(n)));function NC(n,e){return zs(n,t=>{if(!t.empty)return Xd(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const DC=n=>NC(n,!1),OC=n=>NC(n,!0);function RC(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,i=0,l;if(e){for(let a of n.state.facet(ye.scrollMargins)){let o=a(n);o!=null&&o.top&&(t=Math.max(o==null?void 0:o.top,t)),o!=null&&o.bottom&&(i=Math.max(o==null?void 0:o.bottom,i))}l=n.scrollDOM.clientHeight-t-i}else l=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:i,selfScroll:e,height:Math.max(n.defaultLineHeight,l-5)}}function jC(n,e){let t=RC(n),{state:i}=n,l=rc(i.selection,o=>o.empty?n.moveVertically(o,e,t.height):Xd(o,e));if(l.eq(i.selection))return!1;let a;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),u=n.scrollDOM.getBoundingClientRect(),f=u.top+t.marginTop,d=u.bottom-t.marginBottom;o&&o.top>f&&o.bottom<d&&(a=ye.scrollIntoView(l.main.head,{y:"start",yMargin:o.top-f}))}return n.dispatch(Bs(i,l),{effects:a}),!0}const pw=n=>jC(n,!1),K0=n=>jC(n,!0);function Yr(n,e,t){let i=n.lineBlockAt(e.head),l=n.moveToLineBoundary(e,t);if(l.head==e.head&&l.head!=(t?i.to:i.from)&&(l=n.moveToLineBoundary(e,t,!1)),!t&&l.head==i.from&&i.length){let a=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;a&&e.head!=i.from+a&&(l=X.cursor(i.from+a))}return l}const Nj=n=>zs(n,e=>Yr(n,e,!0)),Dj=n=>zs(n,e=>Yr(n,e,!1)),Oj=n=>zs(n,e=>Yr(n,e,!ii(n))),Rj=n=>zs(n,e=>Yr(n,e,ii(n))),jj=n=>zs(n,e=>X.cursor(n.lineBlockAt(e.head).from,1)),Lj=n=>zs(n,e=>X.cursor(n.lineBlockAt(e.head).to,-1));function Bj(n,e,t){let i=!1,l=rc(n.selection,a=>{let o=ul(n,a.head,-1)||ul(n,a.head,1)||a.head>0&&ul(n,a.head-1,1)||a.head<n.doc.length&&ul(n,a.head+1,-1);if(!o||!o.end)return a;i=!0;let u=o.start.from==a.head?o.end.to:o.end.from;return X.cursor(u)});return i?(e(Bs(n,l)),!0):!1}const zj=({state:n,dispatch:e})=>Bj(n,e);function fs(n,e,t){let i=rc(n.state.selection,l=>{l.undirectional&&l.head>=l.anchor!=e&&(l=X.range(l.head,l.anchor));let a=t(l);return X.range(l.anchor,a.head,a.goalColumn,a.bidiLevel||void 0,a.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(Bs(n.state,i)),!0)}function LC(n,e){return fs(n,e,t=>n.moveByChar(t,e))}const BC=n=>LC(n,!ii(n)),zC=n=>LC(n,ii(n));function HC(n,e){return fs(n,e,t=>n.moveByGroup(t,e))}const Hj=n=>HC(n,!ii(n)),Ij=n=>HC(n,ii(n)),Uj=n=>{let e=!ii(n);return fs(n,e,t=>Qd(n.state,t,e))},Vj=n=>{let e=ii(n);return fs(n,e,t=>Qd(n.state,t,e))};function IC(n,e){return fs(n,e,t=>n.moveVertically(t,e))}const UC=n=>IC(n,!1),VC=n=>IC(n,!0);function qC(n,e){return fs(n,e,t=>n.moveVertically(t,e,RC(n).height))}const mw=n=>qC(n,!1),gw=n=>qC(n,!0),qj=n=>fs(n,!0,e=>Yr(n,e,!0)),Gj=n=>fs(n,!1,e=>Yr(n,e,!1)),Pj=n=>{let e=!ii(n);return fs(n,e,t=>Yr(n,t,e))},Yj=n=>{let e=ii(n);return fs(n,e,t=>Yr(n,t,e))},Fj=n=>fs(n,!1,e=>X.cursor(n.lineBlockAt(e.head).from)),Wj=n=>fs(n,!0,e=>X.cursor(n.lineBlockAt(e.head).to)),yw=({state:n,dispatch:e})=>(e(Bs(n,{anchor:0})),!0),bw=({state:n,dispatch:e})=>(e(Bs(n,{anchor:n.doc.length})),!0),xw=({state:n,dispatch:e})=>(e(Bs(n,{anchor:n.selection.main.anchor,head:0})),!0),vw=({state:n,dispatch:e})=>(e(Bs(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),$j=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Kj=({state:n,dispatch:e})=>{let t=Zd(n).map(({from:i,to:l})=>X.range(i,Math.min(l+1,n.doc.length)));return e(n.update({selection:X.create(t),userEvent:"select"})),!0},Xj=({state:n,dispatch:e})=>{let t=rc(n.selection,i=>{let l=Fn(n),a=l.resolveStack(i.from,1);if(i.empty){let o=l.resolveStack(i.from,-1);o.node.from>=a.node.from&&o.node.to<=a.node.to&&(a=o)}for(let o=a;o;o=o.next){let{node:u}=o;if((u.from<i.from&&u.to>=i.to||u.to>i.to&&u.from<=i.from)&&o.next)return X.range(u.to,u.from)}return i});return t.eq(n.selection)?!1:(e(Bs(n,t)),!0)};function GC(n,e){let{state:t}=n,i=t.selection,l=t.selection.ranges.slice();for(let a of t.selection.ranges){let o=t.doc.lineAt(a.head);if(e?o.to<n.state.doc.length:o.from>0)for(let u=a;;){let f=n.moveVertically(u,e);if(f.head<o.from||f.head>o.to){l.some(d=>d.head==f.head)||l.push(f);break}else{if(f.head==u.head)break;u=f}}}return l.length==i.ranges.length?!1:(n.dispatch(Bs(t,X.create(l,l.length-1))),!0)}const Qj=n=>GC(n,!1),Zj=n=>GC(n,!0),Jj=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=X.create([t.main]):t.main.empty||(i=X.create([X.cursor(t.main.head)])),i?(e(Bs(n,i)),!0):!1};function Ju(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,l=i.changeByRange(a=>{let{from:o,to:u}=a;if(o==u){let f=e(a);f<o?(t="delete.backward",f=Vh(n,f,!1)):f>o&&(t="delete.forward",f=Vh(n,f,!0)),o=Math.min(o,f),u=Math.max(u,f)}else o=Vh(n,o,!1),u=Vh(n,u,!0);return o==u?{range:a}:{changes:{from:o,to:u},range:X.cursor(o,o<a.head?-1:1)}});return l.changes.empty?!1:(n.dispatch(i.update(l,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?ye.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Vh(n,e,t){if(n instanceof ye)for(let i of n.state.facet(ye.atomicRanges).map(l=>l(n)))i.between(e,e,(l,a)=>{l<e&&a>e&&(e=t?a:l)});return e}const PC=(n,e,t)=>Ju(n,i=>{let l=i.from,{state:a}=n,o=a.doc.lineAt(l),u,f;if(t&&!e&&l>o.from&&l<o.from+200&&!/[^ \t]/.test(u=o.text.slice(0,l-o.from))){if(u[u.length-1]==" ")return l-1;let d=lc(u,a.tabSize),p=d%wd(a)||wd(a);for(let b=0;b<p&&u[u.length-1-b]==" ";b++)l--;f=l}else f=On(o.text,l-o.from,e,e)+o.from,f==l&&o.number!=(e?a.doc.lines:1)?f+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(f-o.from,l-o.from))&&(f=On(o.text,f-o.from,!1,!1)+o.from);return f}),X0=n=>PC(n,!1,!0),YC=n=>PC(n,!0,!1),FC=(n,e)=>Ju(n,t=>{let i=t.head,{state:l}=n,a=l.doc.lineAt(i),o=l.charCategorizer(i);for(let u=null;;){if(i==(e?a.to:a.from)){i==t.head&&a.number!=(e?l.doc.lines:1)&&(i+=e?1:-1);break}let f=On(a.text,i-a.from,e)+a.from,d=a.text.slice(Math.min(i,f)-a.from,Math.max(i,f)-a.from),p=o(d);if(u!=null&&p!=u)break;(d!=" "||i!=t.head)&&(u=p),i=f}return i}),WC=n=>FC(n,!1),eL=n=>FC(n,!0),tL=n=>Ju(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),nL=n=>Ju(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),iL=n=>Ju(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),sL=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:ft.of(["",""])},range:X.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},lL=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let l=i.from,a=n.doc.lineAt(l),o=l==a.from?l-1:On(a.text,l-a.from,!1)+a.from,u=l==a.to?l+1:On(a.text,l-a.from,!0)+a.from;return{changes:{from:o,to:u,insert:n.doc.slice(l,u).append(n.doc.slice(o,l))},range:X.cursor(u)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Zd(n){let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.from),a=n.doc.lineAt(i.to);if(!i.empty&&i.to==a.from&&(a=n.doc.lineAt(i.to-1)),t>=l.number){let o=e[e.length-1];o.to=a.to,o.ranges.push(i)}else e.push({from:l.from,to:a.to,ranges:[i]});t=a.number+1}return e}function $C(n,e,t){if(n.readOnly)return!1;let i=[],l=[];for(let a of Zd(n)){if(t?a.to==n.doc.length:a.from==0)continue;let o=n.doc.lineAt(t?a.to+1:a.from-1),u=o.length+1;if(t){i.push({from:a.to,to:o.to},{from:a.from,insert:o.text+n.lineBreak});for(let f of a.ranges)l.push(X.range(Math.min(n.doc.length,f.anchor+u),Math.min(n.doc.length,f.head+u)))}else{i.push({from:o.from,to:a.from},{from:a.to,insert:n.lineBreak+o.text});for(let f of a.ranges)l.push(X.range(f.anchor-u,f.head-u))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:X.create(l,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rL=({state:n,dispatch:e})=>$C(n,e,!1),aL=({state:n,dispatch:e})=>$C(n,e,!0);function KC(n,e,t){if(n.readOnly)return!1;let i=[];for(let a of Zd(n))t?i.push({from:a.from,insert:n.doc.slice(a.from,a.to)+n.lineBreak}):i.push({from:a.to,insert:n.lineBreak+n.doc.slice(a.from,a.to)});let l=n.changes(i);return e(n.update({changes:l,selection:n.selection.map(l,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const oL=({state:n,dispatch:e})=>KC(n,e,!1),cL=({state:n,dispatch:e})=>KC(n,e,!0),uL=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Zd(e).map(({from:l,to:a})=>(l>0?l--:a<e.doc.length&&a++,{from:l,to:a}))),i=rc(e.selection,l=>{let a;if(n.lineWrapping){let o=n.lineBlockAt(l.head),u=n.coordsAtPos(l.head,l.assoc||1);u&&(a=o.bottom+n.documentTop-u.bottom+n.defaultLineHeight/2)}return n.moveVertically(l,!0,a)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function fL(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Fn(n).resolveInner(e),i=t.childBefore(e),l=t.childAfter(e),a;return i&&l&&i.to<=e&&l.from>=e&&(a=i.type.prop(st.closedBy))&&a.indexOf(l.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(l.from).from&&!/\S/.test(n.sliceDoc(i.to,l.from))?{from:i.to,to:l.from}:null}const Sw=XC(!1),hL=XC(!0);function XC(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(l=>{let{from:a,to:o}=l,u=e.doc.lineAt(a),f=!n&&a==o&&fL(e,a);n&&(a=o=(o<=u.to?u:e.doc.lineAt(o)).to);let d=new Wd(e,{simulateBreak:a,simulateDoubleBreak:!!f}),p=Dy(d,a);for(p==null&&(p=lc(/^\s*/.exec(e.doc.lineAt(a).text)[0],e.tabSize));o<u.to&&/\s/.test(u.text[o-u.from]);)o++;f?{from:a,to:o}=f:a>u.from&&a<u.from+100&&!/\S/.test(u.text.slice(0,a))&&(a=u.from);let b=["",zu(e,p)];return f&&b.push(zu(e,d.lineIndent(u.from,-1))),{changes:{from:a,to:o,insert:ft.of(b)},range:X.cursor(a+1+b[1].length)}});return t(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ly(n,e){let t=-1;return n.changeByRange(i=>{let l=[];for(let o=i.from;o<=i.to;){let u=n.doc.lineAt(o);u.number>t&&(i.empty||i.to>u.from)&&(e(u,l,i),t=u.number),o=u.to+1}let a=n.changes(l);return{changes:l,range:X.range(a.mapPos(i.anchor,1),a.mapPos(i.head,1))}})}const dL=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new Wd(n,{overrideIndentation:a=>{let o=t[a];return o??-1}}),l=Ly(n,(a,o,u)=>{let f=Dy(i,a.from);if(f==null)return;/\S/.test(a.text)||(f=0);let d=/^\s*/.exec(a.text)[0],p=zu(n,f);(d!=p||u.from<a.from+d.length)&&(t[a.from]=f,o.push({from:a.from,to:a.from+d.length,insert:p}))});return l.changes.empty||e(n.update(l,{userEvent:"indent"})),!0},QC=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Ly(n,(t,i)=>{i.push({from:t.from,insert:n.facet(Fd)})}),{userEvent:"input.indent"})),!0),ZC=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Ly(n,(t,i)=>{let l=/^\s*/.exec(t.text)[0];if(!l)return;let a=lc(l,n.tabSize),o=0,u=zu(n,Math.max(0,a-wd(n)));for(;o<l.length&&o<u.length&&l.charCodeAt(o)==u.charCodeAt(o);)o++;i.push({from:t.from+o,to:t.from+l.length,insert:u.slice(o)})}),{userEvent:"delete.dedent"})),!0),pL=n=>(n.setTabFocusMode(),!0),mL=[{key:"Ctrl-b",run:_C,shift:BC,preventDefault:!0},{key:"Ctrl-f",run:MC,shift:zC},{key:"Ctrl-p",run:DC,shift:UC},{key:"Ctrl-n",run:OC,shift:VC},{key:"Ctrl-a",run:jj,shift:Fj},{key:"Ctrl-e",run:Lj,shift:Wj},{key:"Ctrl-d",run:YC},{key:"Ctrl-h",run:X0},{key:"Ctrl-k",run:tL},{key:"Ctrl-Alt-h",run:WC},{key:"Ctrl-o",run:sL},{key:"Ctrl-t",run:lL},{key:"Ctrl-v",run:K0}],gL=[{key:"ArrowLeft",run:_C,shift:BC,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Cj,shift:Hj,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Oj,shift:Pj,preventDefault:!0},{key:"ArrowRight",run:MC,shift:zC,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Tj,shift:Ij,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Rj,shift:Yj,preventDefault:!0},{key:"ArrowUp",run:DC,shift:UC,preventDefault:!0},{mac:"Cmd-ArrowUp",run:yw,shift:xw},{mac:"Ctrl-ArrowUp",run:pw,shift:mw},{key:"ArrowDown",run:OC,shift:VC,preventDefault:!0},{mac:"Cmd-ArrowDown",run:bw,shift:vw},{mac:"Ctrl-ArrowDown",run:K0,shift:gw},{key:"PageUp",run:pw,shift:mw},{key:"PageDown",run:K0,shift:gw},{key:"Home",run:Dj,shift:Gj,preventDefault:!0},{key:"Mod-Home",run:yw,shift:xw},{key:"End",run:Nj,shift:qj,preventDefault:!0},{key:"Mod-End",run:bw,shift:vw},{key:"Enter",run:Sw,shift:Sw},{key:"Mod-a",run:$j},{key:"Backspace",run:X0,shift:X0,preventDefault:!0},{key:"Delete",run:YC,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:WC,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:eL,preventDefault:!0},{mac:"Mod-Backspace",run:nL,preventDefault:!0},{mac:"Mod-Delete",run:iL,preventDefault:!0}].concat(mL.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),yL=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Mj,shift:Uj},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Ej,shift:Vj},{key:"Alt-ArrowUp",run:rL},{key:"Shift-Alt-ArrowUp",run:oL},{key:"Alt-ArrowDown",run:aL},{key:"Shift-Alt-ArrowDown",run:cL},{key:"Mod-Alt-ArrowUp",run:Qj},{key:"Mod-Alt-ArrowDown",run:Zj},{key:"Escape",run:Jj},{key:"Mod-Enter",run:hL},{key:"Alt-l",mac:"Ctrl-l",run:Kj},{key:"Mod-i",run:Xj,preventDefault:!0},{key:"Mod-[",run:ZC},{key:"Mod-]",run:QC},{key:"Mod-Alt-\\",run:dL},{key:"Shift-Mod-k",run:uL},{key:"Shift-Mod-\\",run:zj},{key:"Mod-/",run:rj},{key:"Alt-A",run:oj},{key:"Ctrl-m",mac:"Shift-Alt-m",run:pL}].concat(gL),bL={key:"Tab",run:QC,shift:ZC},ww=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class ic{constructor(e,t,i=0,l=e.length,a,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,l),this.bufferStart=i,this.normalize=a?u=>a(ww(u)):ww,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 ki(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=hy(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=rl(e);let l=this.normalize(t);if(l.length)for(let a=0,o=i,u=!0;;a++){let f=l.charCodeAt(a),d=this.match(f,o,u,this.bufferPos+this.bufferStart,a==l.length-1);if(d)return this.value=d,this;if(a==l.length-1)break;u&&a<t.length&&t.charCodeAt(a)==f?o++:u=!1}}}match(e,t,i,l,a){let o=null;for(let u=0;u<this.matches.length;){let f=this.matches[u],d=!1;this.query.charCodeAt(f.index)==e&&(f.index==this.query.length-1?o={from:f.from,to:l,precise:a&&f.precise}:(f.index++,d=!0)),d?u++:this.matches.splice(u,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:l,precise:i&&a}:this.matches.push({from:t,index:1,precise:i})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(ic.prototype[Symbol.iterator]=function(){return this});const JC={from:-1,to:-1,match:/.*/.exec(""),precise:!0},By="gm"+(/x/.unicode==null?"":"u");class eT{constructor(e,t,i,l=0,a=e.length){if(this.text=e,this.to=a,this.curLine="",this.done=!1,this.value=JC,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new tT(e,t,i,l,a);this.re=new RegExp(t,By+(i!=null&&i.ignoreCase?"i":"")),this.test=i==null?void 0:i.test,this.iter=e.iter();let o=e.lineAt(l);this.curLineStart=o.from,this.matchPos=Nd(e,l),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 i=this.curLineStart+t.index,l=i+t[0].length;if(this.matchPos=Nd(this.text,l+(i==l?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<l||i>this.value.to)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Vg=new WeakMap;class Io{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,i){let l=Vg.get(e);if(!l||l.from>=i||l.to<=t){let u=new Io(t,e.sliceString(t,i));return Vg.set(e,u),u}if(l.from==t&&l.to==i)return l;let{text:a,from:o}=l;return o>t&&(a=e.sliceString(t,o)+a,o=t),l.to<i&&(a+=e.sliceString(l.to,i)),Vg.set(e,new Io(o,a)),new Io(t,a.slice(t-o,i-o))}}class tT{constructor(e,t,i,l,a){this.text=e,this.to=a,this.done=!1,this.value=JC,this.matchPos=Nd(e,l),this.re=new RegExp(t,By+(i!=null&&i.ignoreCase?"i":"")),this.test=i==null?void 0:i.test,this.flat=Io.get(e,l,this.chunkEnd(l+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 i=this.flat.from+t.index,l=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this.matchPos=Nd(this.text,l+(i==l?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Io.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(eT.prototype[Symbol.iterator]=tT.prototype[Symbol.iterator]=function(){return this});function xL(n){try{return new RegExp(n,By),!0}catch{return!1}}function Nd(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e<t.to&&(i=t.text.charCodeAt(e-t.from))>=56320&&i<57344;)e++;return e}const vL=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:i,result:l}=CO(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return l.then(a=>{let o=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!o){n.dispatch({effects:i});return}let u=e.doc.lineAt(e.selection.main.head),[,f,d,p,b]=o,x=p?+p.slice(1):0,S=d?+d:u.number;if(d&&b){let C=S/100;f&&(C=C*(f=="-"?-1:1)+u.number/e.doc.lines),S=Math.round(e.doc.lines*C)}else d&&f&&(S=S*(f=="-"?-1:1)+u.number);let w=e.doc.line(Math.max(1,Math.min(e.doc.lines,S))),T=X.cursor(w.from+Math.max(0,Math.min(x,w.length)));n.dispatch({effects:[i,ye.scrollIntoView(T.from,{y:"center"})],selection:T})}),!0},SL={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},wL=be.define({combine(n){return dl(n,SL,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function kL(n){return[ML,_L]}const AL=Le.mark({class:"cm-selectionMatch"}),CL=Le.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function kw(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=Yt.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=Yt.Word)}function TL(n,e,t,i){return n(e.sliceDoc(t,t+1))==Yt.Word&&n(e.sliceDoc(i-1,i))==Yt.Word}const _L=ln.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(wL),{state:t}=n,i=t.selection;if(i.ranges.length>1)return Le.none;let l=i.main,a,o=null;if(l.empty){if(!e.highlightWordAroundCursor)return Le.none;let f=t.wordAt(l.head);if(!f)return Le.none;o=t.charCategorizer(l.head),a=t.sliceDoc(f.from,f.to)}else{let f=l.to-l.from;if(f<e.minSelectionLength||f>200)return Le.none;if(e.wholeWords){if(a=t.sliceDoc(l.from,l.to),o=t.charCategorizer(l.head),!(kw(o,t,l.from,l.to)&&TL(o,t,l.from,l.to)))return Le.none}else if(a=t.sliceDoc(l.from,l.to),!a)return Le.none}let u=[];for(let f of n.visibleRanges){let d=new ic(t.doc,a,f.from,f.to);for(;!d.next().done;){let{from:p,to:b}=d.value;if((!o||kw(o,t,p,b))&&(l.empty&&p<=l.from&&b>=l.to?u.push(CL.range(p,b)):(p>=l.to||b<=l.from)&&u.push(AL.range(p,b)),u.length>e.maxMatches))return Le.none}}return Le.set(u)}},{decorations:n=>n.decorations}),ML=ye.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),EL=({state:n,dispatch:e})=>{let{selection:t}=n,i=X.create(t.ranges.map(l=>n.wordAt(l.head)||X.cursor(l.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function NL(n,e){let{main:t,ranges:i}=n.selection,l=n.wordAt(t.head),a=l&&l.from==t.from&&l.to==t.to;for(let o=!1,u=new ic(n.doc,e,i[i.length-1].to);;)if(u.next(),u.done){if(o)return null;u=new ic(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(f=>f.from==u.value.from))continue;if(a){let f=n.wordAt(u.value.from);if(!f||f.from!=u.value.from||f.to!=u.value.to)continue}return u.value}}const DL=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(a=>a.from===a.to))return EL({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(a=>n.sliceDoc(a.from,a.to)!=i))return!1;let l=NL(n,i);return l?(e(n.update({selection:n.selection.addRange(X.range(l.from,l.to),!1),effects:ye.scrollIntoView(l.to)})),!0):!1},ac=be.define({combine(n){return dl(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new YL(e),scrollToMatch:e=>ye.scrollIntoView(e)})}});class nT{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||xL(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?`
128
- `:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new zL(this):new jL(this)}getCursor(e,t=0,i){let l=e.doc?e:dt.create({doc:e});return i==null&&(i=l.doc.length),this.regexp?_o(this,l,t,i):To(this,l,t,i)}}class iT{constructor(e){this.spec=e}}function OL(n,e,t){return(i,l,a,o)=>{if(t&&!t(i,l,a,o))return!1;let u=i>=o&&l<=o+a.length?a.slice(i-o,l-o):e.doc.sliceString(i,l);return n(u,e,i,l)}}function To(n,e,t,i){let l;return n.wholeWord&&(l=RL(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(l=OL(n.test,e,l)),new ic(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:a=>a.toLowerCase(),l)}function RL(n,e){return(t,i,l,a)=>((a>t||a+l.length<i)&&(a=Math.max(0,t-2),l=n.sliceString(a,Math.min(n.length,i+2))),(e(Dd(l,t-a))!=Yt.Word||e(Od(l,t-a))!=Yt.Word)&&(e(Od(l,i-a))!=Yt.Word||e(Dd(l,i-a))!=Yt.Word))}class jL extends iT{constructor(e){super(e)}nextMatch(e,t,i){let l=To(this.spec,e,i,e.doc.length).nextOverlapping();if(l.done){let a=Math.min(e.doc.length,t+this.spec.unquoted.length);l=To(this.spec,e,0,a).nextOverlapping()}return l.done||l.value.from==t&&l.value.to==i?null:l.value}prevMatchInRange(e,t,i){for(let l=i;;){let a=Math.max(t,l-1e4-this.spec.unquoted.length),o=To(this.spec,e,a,l),u=null;for(;!o.nextOverlapping().done;)u=o.value;if(u)return u;if(a==t)return null;l-=1e4}}prevMatch(e,t,i){let l=this.prevMatchInRange(e,0,t);return l||(l=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),l&&(l.from!=t||l.to!=i)?l:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=To(this.spec,e,0,e.doc.length),l=[];for(;!i.next().done;){if(l.length>=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let a=To(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)l(a.value.from,a.value.to)}}function LL(n,e,t){return(i,l,a)=>(!t||t(i,l,a))&&n(a[0],e,i,l)}function _o(n,e,t,i){let l;return n.wholeWord&&(l=BL(e.charCategorizer(e.selection.main.head))),n.test&&(l=LL(n.test,e,l)),new eT(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:l},t,i)}function Dd(n,e){return n.slice(On(n,e,!1),e)}function Od(n,e){return n.slice(e,On(n,e))}function BL(n){return(e,t,i)=>!i[0].length||(n(Dd(i.input,i.index))!=Yt.Word||n(Od(i.input,i.index))!=Yt.Word)&&(n(Od(i.input,i.index+i[0].length))!=Yt.Word||n(Dd(i.input,i.index+i[0].length))!=Yt.Word)}class zL extends iT{nextMatch(e,t,i){let l=_o(this.spec,e,i,e.doc.length).next();return l.done&&(l=_o(this.spec,e,0,t).next()),l.done?null:l.value}prevMatchInRange(e,t,i){for(let l=1;;l++){let a=Math.max(t,i-l*1e4),o=_o(this.spec,e,a,i),u=null;for(;!o.next().done;)u=o.value;if(u&&(a==t||u.from>a+10))return u;if(a==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let l=i.length;l>0;l--){let a=+i.slice(0,l);if(a>0&&a<e.match.length)return e.match[a]+i.slice(l)}return t})}matchAll(e,t){let i=_o(this.spec,e,0,e.doc.length),l=[];for(;!i.next().done;){if(l.length>=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let a=_o(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!a.next().done;)l(a.value.from,a.value.to)}}const Hu=Ge.define(),zy=Ge.define(),zr=Wn.define({create(n){return new qg(Q0(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Hu)?n=new qg(t.value.create(),n.panel):t.is(zy)&&(n=new qg(n.query,t.value?Hy:null));return n},provide:n=>Bu.from(n,e=>e.panel)});class qg{constructor(e,t){this.query=e,this.panel=t}}const HL=Le.mark({class:"cm-searchMatch"}),IL=Le.mark({class:"cm-searchMatch cm-searchMatch-selected"}),UL=ln.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(zr))}update(n){let e=n.state.field(zr);(e!=n.startState.field(zr)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Le.none;let{view:t}=this,i=new ql;for(let l=0,a=t.visibleRanges,o=a.length;l<o;l++){let{from:u,to:f}=a[l];for(;l<o-1&&f>a[l+1].from-500;)f=a[++l].to;n.highlight(t.state,u,f,(d,p)=>{let b=t.state.selection.ranges.some(x=>x.from==d&&x.to==p);i.add(d,p,b?IL:HL)})}return i.finish()}},{decorations:n=>n.decorations});function ef(n){return e=>{let t=e.state.field(zr,!1);return t&&t.query.spec.valid?n(e,t):rT(e)}}const Rd=ef((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let l=X.single(i.from,i.to),a=n.state.facet(ac);return n.dispatch({selection:l,effects:[Iy(n,i),a.scrollToMatch(l.main,n)],userEvent:"select.search"}),lT(n),!0}),jd=ef((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,l=e.prevMatch(t,i,i);if(!l)return!1;let a=X.single(l.from,l.to),o=n.state.facet(ac);return n.dispatch({selection:a,effects:[Iy(n,l),o.scrollToMatch(a.main,n)],userEvent:"select.search"}),lT(n),!0}),VL=ef((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:X.create(t.map(i=>X.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),qL=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:l}=t.main,a=[],o=0;for(let u=new ic(n.doc,n.sliceDoc(i,l));!u.next().done;){if(a.length>1e3)return!1;u.value.from==i&&(o=a.length),a.push(X.range(u.value.from,u.value.to))}return e(n.update({selection:X.create(a,o),userEvent:"select.search.matches"})),!0},Aw=ef((n,{query:e})=>{let{state:t}=n,{from:i,to:l}=t.selection.main;if(t.readOnly)return!1;let a=e.nextMatch(t,i,i);if(!a)return!1;let o=a,u=[],f,d,p=[];o.precise?o.from==i&&o.to==l&&(d=t.toText(e.getReplacement(o)),u.push({from:o.from,to:o.to,insert:d}),o=e.nextMatch(t,o.from,o.to),p.push(ye.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):o=e.nextMatch(t,o.from,o.to);let b=n.state.changes(u);return o&&(f=X.single(o.from,o.to).map(b),p.push(Iy(n,o)),p.push(t.facet(ac).scrollToMatch(f.main,n))),n.dispatch({changes:b,selection:f,effects:p,userEvent:"input.replace"}),!0}),GL=ef((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let l of e.matchAll(n.state,1e9)){let{from:a,to:o,precise:u}=l;u&&t.push({from:a,to:o,insert:e.getReplacement(l)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:ye.announce.of(i),userEvent:"input.replace.all"}),!0});function Hy(n){return n.state.facet(ac).createPanel(n)}function Q0(n,e){var t,i,l,a,o;let u=n.selection.main,f=u.empty||u.to>u.from+100?"":n.sliceDoc(u.from,u.to);if(e&&!f)return e;let d=n.facet(ac);return new nT({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:d.literal)?f:f.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:d.caseSensitive,literal:(l=e==null?void 0:e.literal)!==null&&l!==void 0?l:d.literal,regexp:(a=e==null?void 0:e.regexp)!==null&&a!==void 0?a:d.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:d.wholeWord})}function sT(n){let e=Ny(n,Hy);return e&&e.dom.querySelector("[main-field]")}function lT(n){let e=sT(n);e&&e==n.root.activeElement&&e.select()}const rT=n=>{let e=n.state.field(zr,!1);if(e&&e.panel){let t=sT(n);if(t&&t!=n.root.activeElement){let i=Q0(n.state,e.query.spec);i.valid&&n.dispatch({effects:Hu.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[zy.of(!0),e?Hu.of(Q0(n.state,e.query.spec)):Ge.appendConfig.of(WL)]});return!0},aT=n=>{let e=n.state.field(zr,!1);if(!e||!e.panel)return!1;let t=Ny(n,Hy);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:zy.of(!1)}),!0},PL=[{key:"Mod-f",run:rT,scope:"editor search-panel"},{key:"F3",run:Rd,shift:jd,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Rd,shift:jd,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:aT,scope:"editor search-panel"},{key:"Mod-Shift-l",run:qL},{key:"Mod-Alt-g",run:vL},{key:"Mod-d",run:DL,preventDefault:!0}];class YL{constructor(e){this.view=e;let t=this.query=e.state.field(zr).query.spec;this.commit=this.commit.bind(this),this.searchField=Et("input",{value:t.search,placeholder:Yi(e,"Find"),"aria-label":Yi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Et("input",{value:t.replace,placeholder:Yi(e,"Replace"),"aria-label":Yi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Et("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Et("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Et("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(l,a,o){return Et("button",{class:"cm-button",name:l,onclick:a,type:"button"},o)}this.dom=Et("div",{onkeydown:l=>this.keydown(l),class:"cm-search"},[this.searchField,i("next",()=>Rd(e),[Yi(e,"next")]),i("prev",()=>jd(e),[Yi(e,"previous")]),i("select",()=>VL(e),[Yi(e,"all")]),Et("label",null,[this.caseField,Yi(e,"match case")]),Et("label",null,[this.reField,Yi(e,"regexp")]),Et("label",null,[this.wordField,Yi(e,"by word")]),...e.state.readOnly?[]:[Et("br"),this.replaceField,i("replace",()=>Aw(e),[Yi(e,"replace")]),i("replaceAll",()=>GL(e),[Yi(e,"replace all")])],Et("button",{name:"close",onclick:()=>aT(e),"aria-label":Yi(e,"close"),type:"button"},["×"])])}commit(){let e=new nT({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:Hu.of(e)}))}keydown(e){BD(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?jd:Rd)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Aw(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Hu)&&!i.value.eq(this.query)&&this.setQuery(i.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(ac).top}}function Yi(n,e){return n.state.phrase(e)}const qh=30,Gh=/[\s\.,:;?!]/;function Iy(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),l=n.state.doc.lineAt(t).to,a=Math.max(i.from,e-qh),o=Math.min(l,t+qh),u=n.state.sliceDoc(a,o);if(a!=i.from){for(let f=0;f<qh;f++)if(!Gh.test(u[f+1])&&Gh.test(u[f])){u=u.slice(f);break}}if(o!=l){for(let f=u.length-1;f>u.length-qh;f--)if(!Gh.test(u[f-1])&&Gh.test(u[f])){u=u.slice(0,f);break}}return ye.announce.of(`${n.state.phrase("current match")}. ${u} ${n.state.phrase("on line")} ${i.number}.`)}const FL=ye.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"}}),WL=[zr,Yl.low(UL),FL];class oT{constructor(e,t,i,l){this.state=e,this.pos=t,this.explicit=i,this.view=l,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Fn(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),i=Math.max(t.from,this.pos-250),l=t.text.slice(i-t.from,this.pos-t.from),a=l.search(cT(e,!1));return a<0?null:{from:i+a,to:this.pos,text:l.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function Cw(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 $L(n){let e=Object.create(null),t=Object.create(null);for(let{label:l}of n){e[l[0]]=!0;for(let a=1;a<l.length;a++)t[l[a]]=!0}let i=Cw(e)+Cw(t)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function KL(n){let e=n.map(l=>typeof l=="string"?{label:l}:l),[t,i]=e.every(l=>/^\w+$/.test(l.label))?[/\w*$/,/\w+$/]:$L(e);return l=>{let a=l.matchBefore(i);return a||l.explicit?{from:a?a.from:l.pos,options:e,validFor:t}:null}}function yz(n,e){return t=>{for(let i=Fn(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class Tw{constructor(e,t,i,l){this.completion=e,this.source=t,this.match=i,this.score=l}}function Da(n){return n.selection.main.from}function cT(n,e){var t;let{source:i}=n,l=e&&i[0]!="^",a=i[i.length-1]!="$";return!l&&!a?n:new RegExp(`${l?"^":""}(?:${i})${a?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const Uy=Fl.define();function XL(n,e,t,i){let{main:l}=n.selection,a=t-l.from,o=i-l.from;return{...n.changeByRange(u=>{if(u!=l&&t!=i&&n.sliceDoc(u.from+a,u.from+o)!=n.sliceDoc(t,i))return{range:u};let f=n.toText(e);return{changes:{from:u.from+a,to:i==l.from?u.to:u.from+o,insert:f},range:X.cursor(u.from+a+f.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const _w=new WeakMap;function QL(n){if(!Array.isArray(n))return n;let e=_w.get(n);return e||_w.set(n,e=KL(n)),e}const Ld=Ge.define(),Iu=Ge.define();class ZL{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 i=ki(e,t),l=rl(i);this.chars.push(i);let a=e.slice(t,t+l),o=a.toUpperCase();this.folded.push(ki(o==a?a.toLowerCase():o,0)),t+=l}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:i,any:l,precise:a,byWord:o}=this;if(t.length==1){let O=ki(e,0),B=rl(O),q=B==e.length?0:-100;if(O!=t[0])if(O==i[0])q+=-200;else return null;return this.ret(q,[0,B])}let u=e.indexOf(this.pattern);if(u==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let f=t.length,d=0;if(u<0){for(let O=0,B=Math.min(e.length,200);O<B&&d<f;){let q=ki(e,O);(q==t[d]||q==i[d])&&(l[d++]=O),O+=rl(q)}if(d<f)return null}let p=0,b=0,x=!1,S=0,w=-1,T=-1,C=/[a-z]/.test(e),E=!0;for(let O=0,B=Math.min(e.length,200),q=0;O<B&&b<f;){let H=ki(e,O);u<0&&(p<f&&H==t[p]&&(a[p++]=O),S<f&&(H==t[S]||H==i[S]?(S==0&&(w=O),T=O+1,S++):S=0));let L,j=H<255?H>=48&&H<=57||H>=97&&H<=122?2:H>=65&&H<=90?1:0:(L=hy(H))!=L.toLowerCase()?1:L!=L.toUpperCase()?2:0;(!O||j==1&&C||q==0&&j!=0)&&(t[b]==H||i[b]==H&&(x=!0)?o[b++]=O:o.length&&(E=!1)),q=j,O+=rl(H)}return b==f&&o[0]==0&&E?this.result(-100+(x?-200:0),o,e):S==f&&w==0?this.ret(-200-e.length+(T==e.length?0:-100),[0,T]):u>-1?this.ret(-700-e.length,[u,u+this.pattern.length]):S==f?this.ret(-900-e.length,[w,T]):b==f?this.result(-100+(x?-200:0)+-700+(E?0:-1100),o,e):t.length==2?null:this.result((l[0]?-700:0)+-200+-1100,l,e)}result(e,t,i){let l=[],a=0;for(let o of t){let u=o+(this.astral?rl(ki(i,o)):1);a&&l[a-1]==o?l[a-1]=u:(l[a++]=o,l[a++]=u)}return this.ret(e-i.length,l)}}class JL{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),i=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return i==null?null:(this.matched=[0,t.length],this.score=i+(e.length==this.pattern.length?0:-100),this)}}const Dn=be.define({combine(n){return dl(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:e3,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)=>i=>Mw(e(i),t(i)),optionClass:(e,t)=>i=>Mw(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Mw(n,e){return n?e?n+" "+e:n:e}function e3(n,e,t,i,l,a){let o=n.textDirection==Lt.RTL,u=o,f=!1,d="top",p,b,x=e.left-l.left,S=l.right-e.right,w=i.right-i.left,T=i.bottom-i.top;if(u&&x<Math.min(w,S)?u=!1:!u&&S<Math.min(w,x)&&(u=!0),w<=(u?x:S))p=Math.max(l.top,Math.min(t.top,l.bottom-T))-e.top,b=Math.min(400,u?x:S);else{f=!0,b=Math.min(400,(o?e.right:l.right-e.left)-30);let O=l.bottom-e.bottom;O>=T||O>e.top?p=t.bottom-e.top:(d="bottom",p=e.bottom-t.top)}let C=(e.bottom-e.top)/a.offsetHeight,E=(e.right-e.left)/a.offsetWidth;return{style:`${d}: ${p/C}px; max-width: ${b/E}px`,class:"cm-completionInfo-"+(f?o?"left-narrow":"right-narrow":u?"left":"right")}}const Vy=Ge.define();function t3(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(l=>"cm-completionIcon-"+l)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,l,a){let o=document.createElement("span");o.className="cm-completionLabel";let u=t.displayLabel||t.label,f=0;for(let d=0;d<a.length;){let p=a[d++],b=a[d++];p>f&&o.appendChild(document.createTextNode(u.slice(f,p)));let x=o.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(u.slice(p,b))),x.className="cm-completionMatchedText",f=b}return f<u.length&&o.appendChild(document.createTextNode(u.slice(f))),o},position:50},{render(t){if(!t.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=t.detail,i},position:80}),e.sort((t,i)=>t.position-i.position).map(t=>t.render)}function Gg(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let l=Math.floor(e/t);return{from:l*t,to:(l+1)*t}}let i=Math.ceil((n-e)/t);return{from:n-i*t,to:n-(i-1)*t}}class n3{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:f=>this.placeInfo(f),key:this},this.space=null,this.currentClass="";let l=e.state.field(t),{options:a,selected:o}=l.open,u=e.state.facet(Dn);this.optionContent=t3(u),this.optionClass=u.optionClass,this.tooltipClass=u.tooltipClass,this.range=Gg(a.length,o,u.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",f=>{let{options:d}=e.state.field(t).open;for(let p=f.target,b;p&&p!=this.dom;p=p.parentNode)if(p.nodeName=="LI"&&(b=/-(\d+)$/.exec(p.id))&&+b[1]<d.length){this.applyCompletion(e,d[+b[1]]),f.preventDefault();return}if(f.target==this.list){let p=this.list.classList.contains("cm-completionListIncompleteTop")&&f.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&f.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;p!=null&&(e.dispatch({effects:Vy.of(p)}),f.preventDefault())}}),this.dom.addEventListener("focusout",f=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(Dn).closeOnBlur&&f.relatedTarget!=e.contentDOM&&e.dispatch({effects:Iu.of(null)})}),this.showOptions(a,l.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 i=e.state.field(this.stateField),l=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=l){let{options:a,selected:o,disabled:u}=i.open;(!l.open||l.open.options!=a)&&(this.range=Gg(a.length,o,e.state.facet(Dn).maxRenderedOptions),this.showOptions(a,i.id)),this.updateSel(),u!=((t=l.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!u)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);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=Gg(t.options.length,t.selected,this.view.state.facet(Dn).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:l}=t.options[t.selected],{info:a}=l;if(!a)return;let o=typeof a=="string"?document.createTextNode(a):a(l);if(!o)return;"then"in o?o.then(u=>{u&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(u,l)}).catch(u=>Ti(this.view.state,u,"completion info")):(this.addInfoPane(o,l),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:l,destroy:a}=e;i.appendChild(l),this.infoDestroy=a||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,l=this.range.from;i;i=i.nextSibling,l++)i.nodeName!="LI"||!i.id?l--:l==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&s3(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),l=e.getBoundingClientRect(),a=this.space;if(!a){let o=this.dom.ownerDocument.documentElement;a={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return l.top>Math.min(a.bottom,t.bottom)-10||l.bottom<Math.max(a.top,t.top)+10?null:this.view.state.facet(Dn).positionInfo(this.view,t,l,i,a,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,i){const l=document.createElement("ul");l.id=t,l.setAttribute("role","listbox"),l.setAttribute("aria-expanded","true"),l.setAttribute("aria-label",this.view.state.phrase("Completions")),l.addEventListener("mousedown",o=>{o.target==l&&o.preventDefault()});let a=null;for(let o=i.from;o<i.to;o++){let{completion:u,match:f}=e[o],{section:d}=u;if(d){let x=typeof d=="string"?d:d.name;if(x!=a&&(o>i.from||i.from==0))if(a=x,typeof d!="string"&&d.header)l.appendChild(d.header(d));else{let S=l.appendChild(document.createElement("completion-section"));S.textContent=x}}const p=l.appendChild(document.createElement("li"));p.id=t+"-"+o,p.setAttribute("role","option");let b=this.optionClass(u);b&&(p.className=b);for(let x of this.optionContent){let S=x(u,this.view.state,this.view,f);S&&p.appendChild(S)}}return i.from&&l.classList.add("cm-completionListIncompleteTop"),i.to<e.length&&l.classList.add("cm-completionListIncompleteBottom"),l}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function i3(n,e){return t=>new n3(t,n,e)}function s3(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),l=t.height/n.offsetHeight;i.top<t.top?n.scrollTop-=(t.top-i.top)/l:i.bottom>t.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/l)}function Ew(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function l3(n,e){let t=[],i=null,l=null,a=p=>{t.push(p);let{section:b}=p.completion;if(b){i||(i=[]);let x=typeof b=="string"?b:b.name;i.some(S=>S.name==x)||i.push(typeof b=="string"?{name:x}:b)}},o=e.facet(Dn);for(let p of n)if(p.hasResult()){let b=p.result.getMatch;if(p.result.filter===!1)for(let x of p.result.options)a(new Tw(x,p.source,b?b(x):[],1e9-t.length));else{let x=e.sliceDoc(p.from,p.to),S,w=o.filterStrict?new JL(x):new ZL(x);for(let T of p.result.options)if(S=w.match(T.label)){let C=T.displayLabel?b?b(T,S.matched):[]:S.matched,E=S.score+(T.boost||0);if(a(new Tw(T,p.source,C,E)),typeof T.section=="object"&&T.section.rank==="dynamic"){let{name:O}=T.section;l||(l=Object.create(null)),l[O]=Math.max(E,l[O]||-1e9)}}}}if(i){let p=Object.create(null),b=0,x=(S,w)=>(S.rank==="dynamic"&&w.rank==="dynamic"?l[w.name]-l[S.name]:0)||(typeof S.rank=="number"?S.rank:1e9)-(typeof w.rank=="number"?w.rank:1e9)||(S.name<w.name?-1:1);for(let S of i.sort(x))b-=1e5,p[S.name]=b;for(let S of t){let{section:w}=S.completion;w&&(S.score+=p[typeof w=="string"?w:w.name])}}let u=[],f=null,d=o.compareCompletions;for(let p of t.sort((b,x)=>x.score-b.score||d(b.completion,x.completion))){let b=p.completion;!f||f.label!=b.label||f.detail!=b.detail||f.type!=null&&b.type!=null&&f.type!=b.type||f.apply!=b.apply||f.boost!=b.boost?u.push(p):Ew(p.completion)>Ew(f)&&(u[u.length-1]=p),f=p.completion}return u}class Do{constructor(e,t,i,l,a,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=l,this.selected=a,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Do(this.options,Nw(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,l,a,o){if(l&&!o&&e.some(d=>d.isPending))return l.setDisabled();let u=l3(e,t);if(!u.length)return l&&e.some(d=>d.isPending)?l.setDisabled():null;let f=t.facet(Dn).selectOnOpen?0:-1;if(l&&l.selected!=f&&l.selected!=-1){let d=l.options[l.selected].completion;for(let p=0;p<u.length;p++)if(u[p].completion==d){f=p;break}}return new Do(u,Nw(i,f),{pos:e.reduce((d,p)=>p.hasResult()?Math.min(d,p.from):d,1e8),create:f3,above:a.aboveCursor},l?l.timestamp:Date.now(),f,!1)}map(e){return new Do(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Do(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Bd{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new Bd(c3,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(Dn),a=(i.override||t.languageDataAt("autocomplete",Da(t)).map(QL)).map(f=>(this.active.find(p=>p.source==f)||new us(f,this.active.some(p=>p.state!=0)?1:0)).update(e,i));a.length==this.active.length&&a.every((f,d)=>f==this.active[d])&&(a=this.active);let o=this.open,u=e.effects.some(f=>f.is(qy));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||a.some(f=>f.hasResult()&&e.changes.touchesRange(f.from,f.to))||!r3(a,this.active)||u?o=Do.build(a,t,this.id,o,i,u):o&&o.disabled&&!a.some(f=>f.isPending)&&(o=null),!o&&a.every(f=>!f.isPending)&&a.some(f=>f.hasResult())&&(a=a.map(f=>f.hasResult()?new us(f.source,0):f));for(let f of e.effects)f.is(Vy)&&(o=o&&o.setSelected(f.value,this.id));return a==this.active&&o==this.open?this:new Bd(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?a3:o3}}function r3(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;i<e.length&&!e[i].hasResult();)i++;let l=t==n.length,a=i==e.length;if(l||a)return l==a;if(n[t++].result!=e[i++].result)return!1}}const a3={"aria-autocomplete":"list"},o3={};function Nw(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const c3=[];function uT(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(Uy);if(i&&e.activateOnCompletion(i))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 us{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=uT(e,t),l=this;(i&8||i&16&&this.touches(e))&&(l=new us(l.source,0)),i&4&&l.state==0&&(l=new us(this.source,1)),l=l.updateFor(e,i);for(let a of e.effects)if(a.is(Ld))l=new us(l.source,1,a.value);else if(a.is(Iu))l=new us(l.source,0);else if(a.is(qy))for(let o of a.value)o.source==l.source&&(l=o);return l}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Da(e.state))}}class Uo extends us{constructor(e,t,i,l,a,o){super(e,3,t),this.limit=i,this.result=l,this.from=a,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let l=this.result;l.map&&!e.changes.empty&&(l=l.map(l,e.changes));let a=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),u=Da(e.state);if(u>o||!l||t&2&&(Da(e.startState)==this.from||u<this.limit))return new us(this.source,t&4?1:0);let f=e.changes.mapPos(this.limit);return u3(l.validFor,e.state,a,o)?new Uo(this.source,this.explicit,f,l,a,o):l.update&&(l=l.update(l,a,o,new oT(e.state,u,!1)))?new Uo(this.source,this.explicit,f,l,l.from,(i=l.to)!==null&&i!==void 0?i:Da(e.state)):new us(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new Uo(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new us(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function u3(n,e,t,i){if(!n)return!1;let l=e.sliceDoc(t,i);return typeof n=="function"?n(l,t,i,e):cT(n,!0).test(l)}const qy=Ge.define({map(n,e){return n.map(t=>t.map(e))}}),Ai=Wn.define({create(){return Bd.start()},update(n,e){return n.update(e)},provide:n=>[Ey.from(n,e=>e.tooltip),ye.contentAttributes.from(n,e=>e.attrs)]});function Gy(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Ai).active.find(l=>l.source==e.source);return i instanceof Uo?(typeof t=="string"?n.dispatch({...XL(n.state,t,i.from,i.to),annotations:Uy.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const f3=i3(Ai,Gy);function Ph(n,e="option"){return t=>{let i=t.state.field(Ai,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<t.state.facet(Dn).interactionDelay)return!1;let l=1,a;e=="page"&&(a=KA(t,i.open.tooltip))&&(l=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,u=i.open.selected>-1?i.open.selected+l*(n?1:-1):n?0:o-1;return u<0?u=e=="page"?0:o-1:u>=o&&(u=e=="page"?o-1:0),t.dispatch({effects:Vy.of(u)}),!0}}const h3=n=>{let e=n.state.field(Ai,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(Dn).interactionDelay?!1:Gy(n,e.open.options[e.open.selected])},Pg=n=>n.state.field(Ai,!1)?(n.dispatch({effects:Ld.of(!0)}),!0):!1,d3=n=>{let e=n.state.field(Ai,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Iu.of(null)}),!0)};class p3{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const m3=50,g3=1e3,y3=ln.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(Ai).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Ai),t=n.state.facet(Dn);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Ai)==e)return;let i=n.transactions.some(a=>{let o=uT(a,t);return o&8||(a.selection||a.docChanged)&&!(o&3)});for(let a=0;a<this.running.length;a++){let o=this.running[a];if(i||o.context.abortOnDocChange&&n.docChanged||o.updates.length+n.transactions.length>m3&&Date.now()-o.time>g3){for(let u of o.context.abortListeners)try{u()}catch(f){Ti(this.view.state,f)}o.context.abortListeners=null,this.running.splice(a--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(a=>a.effects.some(o=>o.is(Ld)))&&(this.pendingStart=!0);let l=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(a=>a.isPending&&!this.running.some(o=>o.active.source==a.source))?setTimeout(()=>this.startUpdate(),l):-1,this.composing!=0)for(let a of n.transactions)a.isUserEvent("input.type")?this.composing=2:this.composing==2&&a.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(Ai);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dn).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Da(e),i=new oT(e,t,n.explicit,this.view),l=new p3(n,i);this.running.push(l),Promise.resolve(n.source(i)).then(a=>{l.context.aborted||(l.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:Iu.of(null)}),Ti(this.view.state,a)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dn).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Dn),i=this.view.state.field(Ai);for(let l=0;l<this.running.length;l++){let a=this.running[l];if(a.done===void 0)continue;if(this.running.splice(l--,1),a.done){let u=Da(a.updates.length?a.updates[0].startState:this.view.state),f=Math.min(u,a.done.from+(a.active.explicit?0:1)),d=new Uo(a.active.source,a.active.explicit,f,a.done,a.done.from,(n=a.done.to)!==null&&n!==void 0?n:u);for(let p of a.updates)d=d.update(p,t);if(d.hasResult()){e.push(d);continue}}let o=i.active.find(u=>u.source==a.active.source);if(o&&o.isPending)if(a.done==null){let u=new us(a.active.source,0);for(let f of a.updates)u=u.update(f,t);u.isPending||e.push(u)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:qy.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Ai,!1);if(e&&e.tooltip&&this.view.state.facet(Dn).closeOnBlur){let t=e.open&&KA(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Iu.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ld.of(!1)}),20),this.composing=0}}}),b3=typeof navigator=="object"&&/Win/.test(navigator.platform),x3=Yl.highest(ye.domEventHandlers({keydown(n,e){let t=e.state.field(Ai,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(b3&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],l=t.active.find(o=>o.source==i.source),a=i.completion.commitCharacters||l.result.commitCharacters;return a&&a.indexOf(n.key)>-1&&Gy(e,i),!1}})),fT=ye.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class v3{constructor(e,t,i,l){this.field=e,this.line=t,this.from=i,this.to=l}}class Py{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,qn.TrackDel),i=e.mapPos(this.to,1,qn.TrackDel);return t==null||i==null?null:new Py(this.field,t,i)}}class Yy{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],l=[t],a=e.doc.lineAt(t),o=/^\s*/.exec(a.text)[0];for(let f of this.lines){if(i.length){let d=o,p=/^\t*/.exec(f)[0].length;for(let b=0;b<p;b++)d+=e.facet(Fd);l.push(t+d.length-p),f=d+f.slice(p)}i.push(f),t+=f.length+1}let u=this.fieldPositions.map(f=>new Py(f.field,l[f.line]+f.from,l[f.line]+f.to));return{text:i,ranges:u}}static parse(e){let t=[],i=[],l=[],a;for(let o of e.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let u=a[1]?+a[1]:null,f=a[2]||a[3]||"",d=-1;u===0&&(u=1e9);let p=f.replace(/\\[{}]/g,b=>b[1]);for(let b=0;b<t.length;b++)(u!=null?t[b].seq==u:p&&t[b].name==p)&&(d=b);if(d<0){let b=0;for(;b<t.length&&(u==null||t[b].seq!=null&&t[b].seq<u);)b++;t.splice(b,0,{seq:u,name:p}),d=b;for(let x of l)x.field>=d&&x.field++}for(let b of l)if(b.line==i.length&&b.from>a.index){let x=a[2]?3+(a[1]||"").length:2;b.from-=x,b.to-=x}l.push(new v3(d,i.length,a.index,a.index+p.length)),o=o.slice(0,a.index)+f+o.slice(a.index+a[0].length)}o=o.replace(/\\([{}])/g,(u,f,d)=>{for(let p of l)p.line==i.length&&p.from>d&&(p.from--,p.to--);return f}),i.push(o)}return new Yy(i,l)}}let S3=Le.widget({widget:new class extends pl{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),w3=Le.mark({class:"cm-snippetField"});class oc{constructor(e,t){this.ranges=e,this.active=t,this.deco=Le.set(e.map(i=>(i.from==i.to?S3:w3).range(i.from,i.to)),!0)}map(e){let t=[];for(let i of this.ranges){let l=i.map(e);if(!l)return null;t.push(l)}return new oc(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const tf=Ge.define({map(n,e){return n&&n.map(e)}}),k3=Ge.define(),Uu=Wn.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(tf))return t.value;if(t.is(k3)&&n)return new oc(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>ye.decorations.from(n,e=>e?e.deco:Le.none)});function Fy(n,e){return X.create(n.filter(t=>t.field==e).map(t=>X.range(t.from,t.to)))}function A3(n){let e=Yy.parse(n);return(t,i,l,a)=>{let{text:o,ranges:u}=e.instantiate(t.state,l),{main:f}=t.state.selection,d={changes:{from:l,to:a==f.from?f.to:a,insert:ft.of(o)},scrollIntoView:!0,annotations:i?[Uy.of(i),dn.userEvent.of("input.complete")]:void 0};if(u.length&&(d.selection=Fy(u,0)),u.some(p=>p.field>0)){let p=new oc(u,0),b=d.effects=[tf.of(p)];t.state.field(Uu,!1)===void 0&&b.push(Ge.appendConfig.of([Uu,E3,N3,fT]))}t.dispatch(t.state.update(d))}}function hT(n){return({state:e,dispatch:t})=>{let i=e.field(Uu,!1);if(!i||n<0&&i.active==0)return!1;let l=i.active+n,a=n>0&&!i.ranges.some(o=>o.field==l+n);return t(e.update({selection:Fy(i.ranges,l),effects:tf.of(a?null:new oc(i.ranges,l)),scrollIntoView:!0})),!0}}const C3=({state:n,dispatch:e})=>n.field(Uu,!1)?(e(n.update({effects:tf.of(null)})),!0):!1,T3=hT(1),_3=hT(-1),M3=[{key:"Tab",run:T3,shift:_3},{key:"Escape",run:C3}],Dw=be.define({combine(n){return n.length?n[0]:M3}}),E3=Yl.highest(ec.compute([Dw],n=>n.facet(Dw)));function bz(n,e){return{...e,apply:A3(n)}}const N3=ye.domEventHandlers({mousedown(n,e){let t=e.state.field(Uu,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let l=t.ranges.find(a=>a.from<=i&&a.to>=i);return!l||l.field==t.active?!1:(e.dispatch({selection:Fy(t.ranges,l.field),effects:tf.of(t.ranges.some(a=>a.field>l.field)?new oc(t.ranges,l.field):null),scrollIntoView:!0}),!0)}}),Vu={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ka=Ge.define({map(n,e){let t=e.mapPos(n,-1,qn.TrackAfter);return t??void 0}}),Wy=new class extends Ir{};Wy.startSide=1;Wy.endSide=-1;const dT=Wn.define({create(){return it.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:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(ka)&&(n=n.update({add:[Wy.range(t.value,t.value+1)]}));return n}});function D3(){return[R3,dT]}const Yg="()[]{}<>«»»«[]{}";function pT(n){for(let e=0;e<Yg.length;e+=2)if(Yg.charCodeAt(e)==n)return Yg.charAt(e+1);return hy(n<128?n:n+1)}function mT(n,e){return n.languageDataAt("closeBrackets",e)[0]||Vu}const O3=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),R3=ye.inputHandler.of((n,e,t,i)=>{if((O3?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let l=n.state.selection.main;if(i.length>2||i.length==2&&rl(ki(i,0))==1||e!=l.from||t!=l.to)return!1;let a=B3(n.state,i);return a?(n.dispatch(a),!0):!1}),j3=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=mT(n,n.selection.main.head).brackets||Vu.brackets,l=null,a=n.changeByRange(o=>{if(o.empty){let u=z3(n.doc,o.head);for(let f of i)if(f==u&&Jd(n.doc,o.head)==pT(ki(f,0)))return{changes:{from:o.head-f.length,to:o.head+f.length},range:X.cursor(o.head-f.length)}}return{range:l=o}});return l||e(n.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!l},L3=[{key:"Backspace",run:j3}];function B3(n,e){let t=mT(n,n.selection.main.head),i=t.brackets||Vu.brackets;for(let l of i){let a=pT(ki(l,0));if(e==l)return a==l?U3(n,l,i.indexOf(l+l+l)>-1,t):H3(n,l,a,t.before||Vu.before);if(e==a&&gT(n,n.selection.main.from))return I3(n,l,a)}return null}function gT(n,e){let t=!1;return n.field(dT).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Jd(n,e){let t=n.sliceString(e,e+2);return t.slice(0,rl(ki(t,0)))}function z3(n,e){let t=n.sliceString(e-2,e);return rl(ki(t,0))==t.length?t:t.slice(1)}function H3(n,e,t,i){let l=null,a=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:ka.of(o.to+e.length),range:X.range(o.anchor+e.length,o.head+e.length)};let u=Jd(n.doc,o.head);return!u||/\s/.test(u)||i.indexOf(u)>-1?{changes:{insert:e+t,from:o.head},effects:ka.of(o.head+e.length),range:X.cursor(o.head+e.length)}:{range:l=o}});return l?null:n.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function I3(n,e,t){let i=null,l=n.changeByRange(a=>a.empty&&Jd(n.doc,a.head)==t?{changes:{from:a.head,to:a.head+t.length,insert:t},range:X.cursor(a.head+t.length)}:i={range:a});return i?null:n.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function U3(n,e,t,i){let l=i.stringPrefixes||Vu.stringPrefixes,a=null,o=n.changeByRange(u=>{if(!u.empty)return{changes:[{insert:e,from:u.from},{insert:e,from:u.to}],effects:ka.of(u.to+e.length),range:X.range(u.anchor+e.length,u.head+e.length)};let f=u.head,d=Jd(n.doc,f),p;if(d==e){if(Ow(n,f))return{changes:{insert:e+e,from:f},effects:ka.of(f+e.length),range:X.cursor(f+e.length)};if(gT(n,f)){let x=t&&n.sliceDoc(f,f+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:f,to:f+x.length,insert:x},range:X.cursor(f+x.length)}}}else{if(t&&n.sliceDoc(f-2*e.length,f)==e+e&&(p=Rw(n,f-2*e.length,l))>-1&&Ow(n,p))return{changes:{insert:e+e+e+e,from:f},effects:ka.of(f+e.length),range:X.cursor(f+e.length)};if(n.charCategorizer(f)(d)!=Yt.Word&&Rw(n,f,l)>-1&&!V3(n,f,e,l))return{changes:{insert:e+e,from:f},effects:ka.of(f+e.length),range:X.cursor(f+e.length)}}return{range:a=u}});return a?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ow(n,e){let t=Fn(n).resolveInner(e+1);return t.parent&&t.from==e}function V3(n,e,t,i){let l=Fn(n).resolveInner(e,-1),a=i.reduce((o,u)=>Math.max(o,u.length),0);for(let o=0;o<5;o++){let u=n.sliceDoc(l.from,Math.min(l.to,l.from+t.length+a)),f=u.indexOf(t);if(!f||f>-1&&i.indexOf(u.slice(0,f))>-1){let p=l.firstChild;for(;p&&p.from==l.from&&p.to-p.from>t.length+f;){if(n.sliceDoc(p.to-t.length,p.to)==t)return!1;p=p.firstChild}return!0}let d=l.to==e&&l.parent;if(!d)break;l=d}return!1}function Rw(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Yt.Word)return e;for(let l of t){let a=e-l.length;if(n.sliceDoc(a,e)==l&&i(n.sliceDoc(a-1,a))!=Yt.Word)return a}return-1}function q3(n={}){return[x3,Ai,Dn.of(n),y3,G3,fT]}const yT=[{key:"Ctrl-Space",run:Pg},{mac:"Alt-`",run:Pg},{mac:"Alt-i",run:Pg},{key:"Escape",run:d3},{key:"ArrowDown",run:Ph(!0)},{key:"ArrowUp",run:Ph(!1)},{key:"PageDown",run:Ph(!0,"page")},{key:"PageUp",run:Ph(!1,"page")},{key:"Enter",run:h3}],G3=Yl.highest(ec.computeN([Dn],n=>n.facet(Dn).defaultKeymap?[yT]:[]));class jw{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Sa{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let l=i.facet(qu).markerFilter;l&&(e=l(e,i));let a=e.slice().sort((S,w)=>S.from-w.from||S.to-w.to),o=new ql,u=[],f=0,d=i.doc.iter(),p=0,b=i.doc.length;for(let S=0;;){let w=S==a.length?null:a[S];if(!w&&!u.length)break;let T,C;if(u.length)T=f,C=u.reduce((B,q)=>Math.min(B,q.to),w&&w.from>T?w.from:1e8);else{if(T=w.from,T>b)break;C=w.to,u.push(w),S++}for(;S<a.length;){let B=a[S];if(B.from==T&&(B.to>B.from||B.to==T))u.push(B),S++,C=Math.min(B.to,C);else{C=Math.min(B.from,C);break}}C=Math.min(C,b);let E=!1;if(u.some(B=>B.from==T&&(B.to==C||C==b))&&(E=T==C,!E&&C-T<10)){let B=T-(p+d.value.length);B>0&&(d.next(B),p=T);for(let q=T;;){if(q>=C){E=!0;break}if(!d.lineBreak&&p+d.value.length>q)break;q=p+d.value.length,p+=d.value.length,d.next()}}let O=nB(u);if(E)o.add(T,T,Le.widget({widget:new Z3(O),diagnostics:u.slice()}));else{let B=u.reduce((q,H)=>H.markClass?q+" "+H.markClass:q,"");o.add(T,C,Le.mark({class:"cm-lintRange cm-lintRange-"+O+B,diagnostics:u.slice(),inclusiveEnd:u.some(q=>q.to>C)}))}if(f=C,f==b)break;for(let B=0;B<u.length;B++)u[B].to<=f&&u.splice(B--,1)}let x=o.finish();return new Sa(x,t,Pr(x))}}function Pr(n,e=null,t=0){let i=null;return n.between(t,1e9,(l,a,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new jw(l,a,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new jw(i.from,a,i.diagnostic)}}),i}function P3(n,e){let t=e.pos,i=e.end||t,l=n.state.facet(qu).hideOn(n,t,i);if(l!=null)return l;let a=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(bT))||n.changes.touchesRange(a.from,Math.max(a.to,i)))}function Y3(n,e){return n.field(Wi,!1)?e:e.concat(Ge.appendConfig.of(iB))}const bT=Ge.define(),$y=Ge.define(),xT=Ge.define(),Wi=Wn.define({create(){return new Sa(Le.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,l=n.panel;if(n.selected){let a=e.changes.mapPos(n.selected.from,1);i=Pr(t,n.selected.diagnostic,a)||Pr(t,null,a)}!t.size&&l&&e.state.facet(qu).autoPanel&&(l=null),n=new Sa(t,l,i)}for(let t of e.effects)if(t.is(bT)){let i=e.state.facet(qu).autoPanel?t.value.length?Gu.open:null:n.panel;n=Sa.init(t.value,i,e.state)}else t.is($y)?n=new Sa(n.diagnostics,t.value?Gu.open:null,n.selected):t.is(xT)&&(n=new Sa(n.diagnostics,n.panel,t.value));return n},provide:n=>[Bu.from(n,e=>e.panel),ye.decorations.from(n,e=>e.diagnostics)]}),F3=Le.mark({class:"cm-lintRange cm-lintRange-active"});function W3(n,e,t){let{diagnostics:i}=n.state.field(Wi),l,a=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(f,d,{spec:p})=>{if(e>=f&&e<=d&&(f==d||(e>f||t>0)&&(e<d||t<0)))return l=p.diagnostics,a=f,o=d,!1});let u=n.state.facet(qu).tooltipFilter;return l&&u&&(l=u(l,n.state)),l?{pos:a,end:o,above:!0,create(){return{dom:$3(n,l)}}}:null}function $3(n,e){return Et("ul",{class:"cm-tooltip-lint"},e.map(t=>ST(n,t,!1)))}const K3=n=>{let e=n.state.field(Wi,!1);(!e||!e.panel)&&n.dispatch({effects:Y3(n.state,[$y.of(!0)])});let t=Ny(n,Gu.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Lw=n=>{let e=n.state.field(Wi,!1);return!e||!e.panel?!1:(n.dispatch({effects:$y.of(!1)}),!0)},X3=n=>{let e=n.state.field(Wi,!1);if(!e)return!1;let t=n.state.selection.main,i=Pr(e.diagnostics,null,t.to+1);return!i&&(i=Pr(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),kO(n,i.from,1,{tooltip:wT,until:l=>l.docChanged||l.newSelection.main.head<i.from||l.newSelection.main.head>i.to}),!0)},Q3=[{key:"Mod-Shift-m",run:K3,preventDefault:!0},{key:"F8",run:X3}],qu=be.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...dl(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Bw,tooltipFilter:Bw,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,l,a)=>e(i,l,a)||t(i,l,a):e:t,autoPanel:(e,t)=>e||t})}}});function Bw(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function vT(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;i<t.length;i++){let l=t[i];if(/[a-zA-Z]/.test(l)&&!e.some(a=>a.toLowerCase()==l.toLowerCase())){e.push(l);continue e}}e.push("")}return e}function ST(n,e,t){var i;let l=t?vT(e.actions):[];return Et("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Et("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((a,o)=>{let u=!1,f=S=>{if(S.preventDefault(),u)return;u=!0;let w=Pr(n.state.field(Wi).diagnostics,e);w&&a.apply(n,w.from,w.to)},{name:d}=a,p=l[o]?d.indexOf(l[o]):-1,b=p<0?d:[d.slice(0,p),Et("u",d.slice(p,p+1)),d.slice(p+1)],x=a.markClass?" "+a.markClass:"";return Et("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:f,onmousedown:f,"aria-label":` Action: ${d}${p<0?"":` (access key "${l[o]})"`}.`},b)}),e.source&&Et("div",{class:"cm-diagnosticSource"},e.source))}class Z3 extends pl{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Et("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=ST(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Gu{constructor(e){this.view=e,this.items=[];let t=l=>{if(!(l.ctrlKey||l.altKey||l.metaKey)){if(l.keyCode==27)Lw(this.view),this.view.focus();else if(l.keyCode==38||l.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(l.keyCode==40||l.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(l.keyCode==36)this.moveSelection(0);else if(l.keyCode==35)this.moveSelection(this.items.length-1);else if(l.keyCode==13)this.view.focus();else if(l.keyCode>=65&&l.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],o=vT(a.actions);for(let u=0;u<o.length;u++)if(o[u].toUpperCase().charCodeAt(0)==l.keyCode){let f=Pr(this.view.state.field(Wi).diagnostics,a);f&&a.actions[u].apply(e,f.from,f.to)}}else return;l.preventDefault()}},i=l=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(l.target)&&this.moveSelection(a)};this.list=Et("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:i}),this.dom=Et("div",{class:"cm-panel-lint"},this.list,Et("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Lw(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Wi).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(Wi),i=0,l=!1,a=null,o=new Set;for(e.between(0,this.view.state.doc.length,(u,f,{spec:d})=>{for(let p of d.diagnostics){if(o.has(p))continue;o.add(p);let b=-1,x;for(let S=i;S<this.items.length;S++)if(this.items[S].diagnostic==p){b=S;break}b<0?(x=new zw(this.view,p),this.items.splice(i,0,x),l=!0):(x=this.items[b],b>i&&(this.items.splice(i,b-i),l=!0)),t&&x.diagnostic==t.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),a=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)l=!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")})),l=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:u,panel:f})=>{let d=f.height/this.list.offsetHeight;u.top<f.top?this.list.scrollTop-=(f.top-u.top)/d:u.bottom>f.bottom&&(this.list.scrollTop+=(u.bottom-f.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),l&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Wi),i=Pr(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:xT.of(i)})}static open(e){return new Gu(e)}}function J3(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 Yh(n){return J3(`<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 eB=ye.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:Yh("#f11")},".cm-lintRange-warning":{backgroundImage:Yh("orange")},".cm-lintRange-info":{backgroundImage:Yh("#999")},".cm-lintRange-hint":{backgroundImage:Yh("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function tB(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function nB(n){let e="hint",t=1;for(let i of n){let l=tB(i.severity);l>t&&(t=l,e=i.severity)}return e}const wT=wO(W3,{hideOn:P3}),iB=[Wi,ye.decorations.compute([Wi],n=>{let{selected:e,panel:t}=n.field(Wi);return!e||!t||e.from==e.to?Le.none:Le.set([F3.range(e.from,e.to)])}),wT,eB],sB=[BO(),IO(),JD(),mj(),dR(),qD(),WD(),dt.allowMultipleSelections.of(!0),JO(),dC(yR,{fallback:!0}),AR(),D3(),q3(),fO(),pO(),lO(),kL(),ec.of([...L3,...yL,...PL,...Aj,...cR,...yT,...Q3])];function lB({file:n,goto:e,onChange:t,onSave:i,onReload:l,onOverwrite:a,onTogglePreview:o}){const u=Nr(n),f=bC(n.path)&&!n.binary&&!n.tooLarge;return y.jsxs("div",{className:"editor",children:[y.jsxs("div",{className:"editor__bar",children:[y.jsx("span",{className:"editor__path",title:n.path,children:n.path}),y.jsxs("span",{className:"editor__meta",children:[Ig(n.size),n.eol==="crlf"&&" · CRLF"]}),f&&y.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[y.jsx("button",{className:"btn btn--sm"+(n.previewMode?" is-on":""),role:"tab","aria-selected":n.previewMode,onClick:()=>!n.previewMode&&o(n.path),children:"Просмотр"}),y.jsx("button",{className:"btn btn--sm"+(n.previewMode?"":" is-on"),role:"tab","aria-selected":!n.previewMode,onClick:()=>n.previewMode&&o(n.path),children:"Код"})]}),y.jsx("button",{className:"btn btn--sm",disabled:!u,title:"Сохранить (Ctrl+S)",onClick:()=>i(n.path),children:u?"Сохранить":"Сохранено"})]}),n.stale&&y.jsxs("div",{className:"editor__warn",children:[y.jsxs("span",{children:["Файл изменился на диске",u?" — а здесь есть несохранённые правки.":"."]}),y.jsx("button",{className:"btn btn--sm",onClick:()=>l(n.path),children:"Взять с диска"}),u&&y.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>a(n.path),children:"Сохранить поверх"})]}),n.binary?y.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",Ig(n.size)," на диске."]}):n.tooLarge?y.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",Ig(n.size),"). Такие правит агент, а не браузер."]}):f&&n.previewMode?y.jsx(rB,{text:n.text}):y.jsx(oB,{path:n.path,doc:n.text,revision:n.revision,goto:e,onChange:t,onSave:i})]})}function rB({text:n}){const[e,t]=M.useState("");return M.useEffect(()=>{let i=!1;return IR(n).then(l=>{i||t(l)}),()=>{i=!0}},[n]),y.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:e}})}function aB({files:n,activePath:e,busy:t,onSelect:i,onClose:l}){return y.jsxs("div",{className:"worktabs",role:"tablist",children:[y.jsxs("button",{className:"worktab"+(e===null?" is-on":""),role:"tab","aria-selected":e===null,onClick:()=>i(null),children:[y.jsx("span",{className:"worktab__name",children:"Разговор"}),t&&y.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),n.map(a=>y.jsxs("div",{className:"worktab"+(a.path===e?" is-on":""),role:"tab","aria-selected":a.path===e,children:[y.jsx("button",{className:"worktab__name",title:a.path,onClick:()=>i(a.path),children:UR(a.path)}),Nr(a)?y.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${a.path}`,onClick:()=>l(a.path)}):y.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${a.path}`,onClick:()=>l(a.path),children:"✕"})]},a.path))]})}function oB({path:n,doc:e,revision:t,goto:i,onChange:l,onSave:a}){const o=M.useRef(null),u=M.useRef(null),f=M.useRef(new Map),d=M.useRef(new Map),p=M.useRef(new Set),b=M.useRef(new Fu),x=M.useRef(l),S=M.useRef(a),w=M.useRef(n),T=M.useRef(e);x.current=l,S.current=a,w.current=n,T.current=e,M.useEffect(()=>{const E=new ye({parent:o.current??void 0});return u.current=E,()=>{E.destroy(),u.current=null}},[]),M.useEffect(()=>{const E=u.current;if(!E)return;const O=f.current.get(n),B=d.current.get(n)!==t;if(O&&!B)E.setState(O);else{const H=dt.create({doc:T.current,extensions:[sB,Yl.highest(ec.of([{key:"Mod-s",preventDefault:!0,run:()=>(S.current(w.current),!0)}])),ec.of([bL]),b.current.of([]),DR,OR,ye.updateListener.of(L=>{L.docChanged&&x.current(w.current,L.state.doc.toString())})]});f.current.set(n,H),d.current.set(n,t),E.setState(H),p.current.delete(n)}if(p.current.has(n))return;let q=!1;return BR(n).then(H=>{q||!H||w.current!==n||(E.dispatch({effects:b.current.reconfigure(H)}),f.current.set(n,E.state),p.current.add(n))}),()=>{q=!0}},[n,t]);const C=M.useRef(0);return M.useEffect(()=>{const E=u.current;if(!E||!i||i.token===C.current)return;C.current=i.token;const O=E.state.doc.lines,B=Math.min(Math.max(i.line,1),O),q=E.state.doc.line(B),H=Math.min(q.from+Math.max(i.column-1,0),q.to);E.dispatch({selection:X.cursor(H),effects:ye.scrollIntoView(H,{y:"center"})}),E.focus()},[i]),M.useEffect(()=>()=>{const E=u.current;E&&f.current.set(n,E.state)},[n]),y.jsx("div",{className:"editor__code",ref:o})}function Hw({x:n,y:e,items:t,note:i,onClose:l}){const a=M.useRef(null),[o,u]=M.useState({left:n,top:e}),[f,d]=M.useState(()=>{const x=t.findIndex(S=>!S.disabled);return x===-1?0:x});M.useLayoutEffect(()=>{const x=a.current;if(!x)return;const S=x.getBoundingClientRect(),w=8,T=Math.max(w,Math.min(n,window.innerWidth-S.width-w)),C=Math.max(w,Math.min(e,window.innerHeight-S.height-w));u({left:T,top:C})},[n,e]),M.useLayoutEffect(()=>{var x;(x=a.current)==null||x.focus()},[]),M.useLayoutEffect(()=>{function x(w){var T;(T=a.current)!=null&&T.contains(w.target)||l()}function S(){l()}return document.addEventListener("mousedown",x),document.addEventListener("scroll",S,!0),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("scroll",S,!0)}},[l]);function p(x){x.disabled||(x.onSelect(),l())}function b(x){if(x.key==="Escape"){x.preventDefault(),x.stopPropagation(),l();return}const S=t.map((w,T)=>({item:w,index:T})).filter(w=>!w.item.disabled);if(S.length!==0){if(x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();const w=x.key==="ArrowDown"?1:-1,T=S.findIndex(E=>E.index===f),C=S[(((T===-1?0:T)+w)%S.length+S.length)%S.length];C&&d(C.index);return}if(x.key==="Enter"||x.key===" "){x.preventDefault();const w=t[f];w&&p(w)}}}return y.jsxs("div",{ref:a,className:"ctxmenu",style:{left:o.left,top:o.top},role:"menu",tabIndex:-1,onKeyDown:b,children:[i&&y.jsx("div",{className:"ctxmenu__note",children:i}),t.map((x,S)=>y.jsxs("button",{type:"button",role:"menuitem","aria-disabled":x.disabled,className:"ctxmenu__item"+(S===f?" is-cursor":""),onMouseEnter:()=>d(S),onClick:()=>p(x),children:[y.jsx("span",{className:"ctxmenu__label",children:x.label}),x.hint&&y.jsx("span",{className:"ctxmenu__hint",children:x.hint})]},x.id))]})}const kT="ccv:sidebar.collapsed",cB=500;function uB({open:n,connected:e,status:t,workspaces:i,sessions:l,archived:a,activeWorkspaceId:o,activeSessionId:u,onSelectWorkspace:f,onSelectSession:d,onRenameSession:p,onCloseWorkspaces:b,onArchiveSessions:x,onUnarchiveSessions:S,onOpenWorkspace:w,onNewSession:T,onOpenExtensions:C,account:E,onOpenAccount:O,relay:B,onOpenRelay:q,onOpenSettings:H,themeMode:L,onCycleTheme:j}){const[se,he]=M.useState(null),[Me,ue]=M.useState(""),[le,Ee]=M.useState(dB),ve=Me.trim().toLowerCase(),ke=ve!=="",I=M.useMemo(()=>ke?i.filter(ce=>ce.name.toLowerCase().includes(ve)||ce.path.toLowerCase().includes(ve)):i,[i,ve,ke]),Z=M.useMemo(()=>ke?l.filter(ce=>(ce.title??"").toLowerCase().includes(ve)):l,[l,ve,ke]),ee=M.useMemo(()=>ke?a.filter(ce=>(ce.title??"").toLowerCase().includes(ve)):a,[a,ve,ke]);function Ne(ce){Ee(qe=>{const St=qe.includes(ce)?qe.filter(Fe=>Fe!==ce):[...qe,ce];try{localStorage.setItem(kT,JSON.stringify(St))}catch{}return St})}const _e=ce=>!le.includes(ce),N=Uw(I),F=Uw(Z),[J,oe]=M.useState(null),[de,Se]=M.useState(null),Ie=M.useRef(null);function pt(ce,qe){const St=ce.touches[0];if(!St)return;const Fe={timer:0,x:St.clientX,y:St.clientY,el:ce.currentTarget,fired:!1};Fe.timer=window.setTimeout(()=>{Fe.fired=!0,qe(Fe.x,Fe.y,Fe.el)},cB),Ie.current=Fe}function $e(ce){const qe=Ie.current,St=ce.touches[0];!qe||!St||Math.hypot(St.clientX-qe.x,St.clientY-qe.y)>10&&(window.clearTimeout(qe.timer),Ie.current=null)}function It(ce){const qe=Ie.current;qe&&(window.clearTimeout(qe.timer),qe.fired&&ce.preventDefault())}function Ze(){var ce;return(ce=Ie.current)!=null&&ce.fired?(Ie.current=null,!0):!1}function Kt(){const ce=J==null?void 0:J.opener;oe(null),ce!=null&&ce.isConnected&&ce.focus()}function at(){const ce=de==null?void 0:de.opener;Se(null),ce!=null&&ce.isConnected&&ce.focus()}function we(ce){return{onContextMenu:qe=>{qe.preventDefault(),oe({x:qe.clientX,y:qe.clientY,opener:qe.currentTarget,ids:N.targetsFor(ce)})},onTouchStart:qe=>pt(qe,(St,Fe,$)=>oe({x:St,y:Fe,opener:$,ids:N.targetsFor(ce)})),onTouchMove:$e,onTouchEnd:It,onTouchCancel:It}}function xe(ce){return{onContextMenu:qe=>{qe.preventDefault(),Se({x:qe.clientX,y:qe.clientY,opener:qe.currentTarget,ids:F.targetsFor(ce)})},onTouchStart:qe=>pt(qe,(St,Fe,$)=>Se({x:St,y:Fe,opener:$,ids:F.targetsFor(ce)})),onTouchMove:$e,onTouchEnd:It,onTouchCancel:It}}const Ft=l.filter(ce=>ce.state!=="closed").length,xn=J?[{id:"close",label:J.ids.length>1?`Закрыть проекты (${J.ids.length})`:"Закрыть проект",onSelect:()=>{b(J.ids),N.clear()}}]:[],Ve=J?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(o&&J.ids.includes(o)&&Ft>0?` в нём сейчас незавершённых сессий: ${Ft} — при закрытии они остановятся на хосте.`:""):void 0,Rn=de?[...de.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>he(de.ids[0])}]:[],{id:"archive",label:de.ids.length>1?`Убрать в архив (${de.ids.length})`:"Убрать в архив",onSelect:()=>{x(de.ids),F.clear()}}]:[],si=de?"транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.":void 0;return y.jsxs("aside",{className:n?"sidebar sidebar--open":"sidebar",children:[y.jsxs("div",{className:"sidebar__head",children:[y.jsx("span",{className:e?"dot dot--on":"dot",title:t}),y.jsx("span",{className:"brand",children:"Claude Code Visual"}),y.jsx("button",{className:"theme-btn",title:`Тема: ${Vw[L]}`,"aria-label":`Тема: ${Vw[L]}. Переключить`,onClick:j,children:y.jsx(pB,{mode:L})})]}),y.jsxs("div",{className:"fssearch fssearch--sidebar",children:[y.jsx(hB,{}),y.jsx("input",{className:"fssearch__input",type:"text",value:Me,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:ce=>ue(ce.target.value),onKeyDown:ce=>{ce.stopPropagation(),ce.key==="Escape"&&(ce.preventDefault(),Me?ue(""):ce.currentTarget.blur())}}),Me&&y.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>ue(""),children:"✕"})]}),y.jsxs("div",{className:"sidebar__scroll",children:[y.jsx(Fg,{title:"Проекты",count:I.length,open:_e("workspaces"),onToggle:()=>Ne("workspaces")}),_e("workspaces")&&y.jsxs(y.Fragment,{children:[I.length===0&&y.jsx("div",{className:"row",children:y.jsx("span",{className:"row__meta",children:ke?"Ничего не найдено":"Пока ни одного"})}),I.map(ce=>y.jsx("div",{className:Iw(ce.id===o,N.selected.includes(ce.id)),...we(ce),children:y.jsxs("button",{className:"row__main",onClick:qe=>{Ze()||N.click(qe,ce,()=>f(ce.id))},children:[y.jsxs("span",{className:"row__title",children:[ce.name,ce.hasClaudeMd&&" ·"]}),y.jsx("span",{className:"row__meta",title:ce.path,children:ce.path})]})},ce.id))]}),o&&y.jsxs(y.Fragment,{children:[y.jsx(Fg,{title:"Сессии",count:Z.length,open:_e("sessions"),onToggle:()=>Ne("sessions")}),_e("sessions")&&y.jsxs(y.Fragment,{children:[Z.length===0&&y.jsx("div",{className:"row",children:y.jsx("span",{className:"row__meta",children:ke?"Ничего не найдено":"Пока ни одной"})}),Z.map(ce=>y.jsx("div",{className:Iw(ce.id===u,F.selected.includes(ce.id)),...se===ce.id?{}:xe(ce),children:se===ce.id?y.jsx("div",{className:"row__main",children:y.jsx(Cd,{value:ce.title??"",onCommit:qe=>{p(ce,qe),he(null)},onCancel:()=>he(null)})}):y.jsxs(y.Fragment,{children:[y.jsxs("button",{className:"row__main",onClick:qe=>{Ze()||F.click(qe,ce,()=>d(ce))},children:[y.jsx("span",{className:"row__title",children:ce.title??"Без названия"}),y.jsxs("span",{className:"row__meta",children:[mB(ce)," · ",new Date(ce.updatedAt).toLocaleString()]})]}),y.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{Ze()||he(ce.id)},children:"✎"})]})},ce.id))]}),a.length>0&&y.jsxs(y.Fragment,{children:[y.jsx(Fg,{title:"Архив",count:ee.length,open:_e("archive"),onToggle:()=>Ne("archive"),hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется"}),_e("archive")&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"row",children:y.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),ee.length===0&&y.jsx("div",{className:"row",children:y.jsx("span",{className:"row__meta",children:ke?"Ничего не найдено":"Пока пусто"})}),ee.map(ce=>y.jsxs("div",{className:ce.id===u?"row row--active":"row",children:[y.jsxs("button",{className:"row__main",onClick:()=>d(ce),children:[y.jsx("span",{className:"row__title",children:ce.title??"Без названия"}),y.jsx("span",{className:"row__meta",children:gB(ce)})]}),y.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>S([ce.id]),children:"Вернуть"})]},ce.id))]})]})]})]}),y.jsxs("div",{className:"sidebar__foot",children:[y.jsxs("button",{className:"account-btn sidebar__wide",title:"Аккаунт Claude",onClick:O,children:[y.jsx("span",{className:E!=null&&E.loggedIn?"dot dot--on":"dot"}),y.jsx("span",{className:"account-btn__id",children:E===null?"Аккаунт":E.loggedIn?E.email||"Вход выполнен":"Войти в аккаунт"}),(E==null?void 0:E.plan)&&y.jsx("span",{className:"chip",children:E.plan})]}),q&&y.jsxs("button",{className:"account-btn sidebar__wide",title:"Доступ с телефона и из браузера",onClick:q,children:[y.jsx("span",{className:B!=null&&B.connected?"dot dot--on":"dot"}),y.jsx("span",{className:"account-btn__id",children:B===null?"Удалённый доступ":B.paired?B.connected?B.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(B==null?void 0:B.connected)&&B.clients>0&&y.jsx("span",{className:"chip",children:B.clients})]}),y.jsx("button",{className:"btn btn--ghost sidebar__wide",disabled:!C,title:"MCP-серверы и плагины",onClick:()=>C==null?void 0:C(),children:"Расширения"}),y.jsx("button",{className:"btn btn--ghost sidebar__wide",title:"Настройки приложения",onClick:H,children:"Настройки"}),y.jsx("button",{className:"btn btn--ghost",onClick:w,children:"+ Проект"}),y.jsx("button",{className:"btn btn--primary",onClick:T,disabled:!o,children:"+ Сессия"})]}),J&&y.jsx(Hw,{x:J.x,y:J.y,items:xn,note:Ve,onClose:Kt}),de&&y.jsx(Hw,{x:de.x,y:de.y,items:Rn,note:si,onClose:at})]})}function Iw(n,e){const t=["row"];return n&&t.push("row--active"),e&&t.push("row--selected"),t.join(" ")}function Uw(n){const[e,t]=M.useState([]),i=M.useRef(null);function l(){t([]),i.current=null}function a(u,f,d){if(u.ctrlKey||u.metaKey){t(p=>p.includes(f.id)?p.filter(b=>b!==f.id):[...p,f.id]),i.current=f.id;return}if(u.shiftKey&&i.current){const p=n.findIndex(x=>x.id===i.current),b=n.findIndex(x=>x.id===f.id);if(p!==-1&&b!==-1){const[x,S]=p<b?[p,b]:[b,p];t(n.slice(x,S+1).map(w=>w.id));return}}l(),i.current=f.id,d()}function o(u){return e.includes(u.id)?e:(t([u.id]),i.current=u.id,[u.id])}return{selected:e,click:a,targetsFor:o,clear:l}}function Fg({title:n,count:e,open:t,onToggle:i,hint:l}){const a=t?`Свернуть «${n}»`:`Развернуть «${n}»`;return y.jsxs("button",{className:"sidebar__section sidebar__section--btn","aria-expanded":t,title:l?`${a} — ${l}`:a,onClick:i,children:[y.jsx(fB,{open:t}),y.jsx("span",{className:"sidebar__section-name",children:n}),y.jsx("span",{className:"sidebar__count",children:e})]})}function fB({open:n}){return y.jsx("svg",{className:n?"sidebar__chev sidebar__chev--open":"sidebar__chev",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function hB(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[y.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),y.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function dB(){try{const n=localStorage.getItem(kT);if(n===null)return["archive"];const e=JSON.parse(n);return Array.isArray(e)?e.filter(t=>t==="workspaces"||t==="sessions"||t==="archive"):["archive"]}catch{return["archive"]}}const Vw={system:"как в системе",light:"светлая",dark:"тёмная"};function pB({mode:n}){const e={viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return n==="dark"?y.jsx("svg",{...e,children:y.jsx("path",{d:"M13.2 9.7A5.4 5.4 0 0 1 6.3 2.8a5.6 5.6 0 1 0 6.9 6.9Z"})}):n==="light"?y.jsxs("svg",{...e,children:[y.jsx("circle",{cx:"8",cy:"8",r:"3.1"}),y.jsx("path",{d:"M8 1.4v1.4M8 13.2v1.4M2.4 8H1M15 8h-1.4M4 4l-1-1M13 13l-1-1M12 4l1-1M3 13l1-1"})]}):y.jsxs("svg",{...e,children:[y.jsx("rect",{x:"1.8",y:"2.6",width:"12.4",height:"8.4",rx:"1.4"}),y.jsx("path",{d:"M5.6 13.4h4.8"})]})}function mB(n){switch(n.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return"готова";case"starting":return"запускается";case"error":return"ошибка";case"closed":return"на диске"}}function gB(n){const e=n.archivedAuto?"сама, по сроку молчания":"убрана вручную";return n.archivedAt?`${new Date(n.archivedAt).toLocaleString()} · ${e}`:e}const qw=3,yB=15e5;function AT(n,e){if(!e||typeof e!="object")return null;const t=e,i=typeof t.file_path=="string"?t.file_path:"";if(!i)return null;if(n==="Write"){if(typeof t.content!="string")return null;const l=Wg(t.content).map(a=>({type:"add",text:a}));return{kind:"create",filePath:i,rows:l,added:l.length,removed:0,note:"файл записывается целиком"}}if(n==="Edit"){if(typeof t.old_string!="string"||typeof t.new_string!="string")return null;const l=SB(bB(Wg(t.old_string),Wg(t.new_string)));return{kind:"edit",filePath:i,rows:l,added:l.filter(a=>a.type==="add").length,removed:l.filter(a=>a.type==="del").length,note:t.replace_all===!0?"все вхождения":null}}return null}function Wg(n){if(n==="")return[];const e=n.split(/\r?\n/);return e.length>1&&e[e.length-1]===""&&e.pop(),e}function bB(n,e){let t=0;for(;t<n.length&&t<e.length&&n[t]===e[t];)t++;let i=n.length,l=e.length;for(;i>t&&l>t&&n[i-1]===e[l-1];)i--,l--;const a=o=>({type:"ctx",text:o});return[...n.slice(0,t).map(a),...xB(n.slice(t,i),e.slice(t,l)),...n.slice(i).map(a)]}function xB(n,e){if(n.length===0&&e.length===0)return[];if(n.length===0)return e.map(p=>({type:"add",text:p}));if(e.length===0)return n.map(p=>({type:"del",text:p}));if((n.length+1)*(e.length+1)>yB)return[...n.map(p=>({type:"del",text:p})),...e.map(p=>({type:"add",text:p}))];const t=n.length,i=e.length,l=i+1,a=new Uint32Array((t+1)*l),o=(p,b)=>a[p*l+b]??0;for(let p=t-1;p>=0;p--)for(let b=i-1;b>=0;b--)a[p*l+b]=n[p]===e[b]?o(p+1,b+1)+1:Math.max(o(p+1,b),o(p,b+1));const u=[];let f=0,d=0;for(;f<t&&d<i;){const p=n[f],b=e[d];p===b?(u.push({type:"ctx",text:p}),f++,d++):o(f+1,d)>=o(f,d+1)?(u.push({type:"del",text:p}),f++):(u.push({type:"add",text:b}),d++)}for(;f<t;)u.push({type:"del",text:n[f++]});for(;d<i;)u.push({type:"add",text:e[d++]});return vB(u)}function vB(n){const e=[];let t=[];function i(){e.push(...t.filter(l=>l.type==="del")),e.push(...t.filter(l=>l.type==="add")),t=[]}for(const l of n)l.type==="ctx"?(i(),e.push(l)):t.push(l);return i(),e}function SB(n){if(!n.some(a=>a.type!=="ctx"))return n;const e=n.map(()=>!1);n.forEach((a,o)=>{if(a.type!=="ctx")for(let u=Math.max(0,o-qw);u<=Math.min(n.length-1,o+qw);u++)e[u]=!0});const t=[];let i=[];function l(){i.length===1?t.push(...i):i.length>1&&t.push({type:"gap",text:`⋯ ${i.length} ${wB(i.length)} без изменений`}),i=[]}return n.forEach((a,o)=>{e[o]?(l(),t.push(a)):i.push(a)}),l(),t}function wB(n){const e=n%100;if(e>=11&&e<=14)return"строк";switch(n%10){case 1:return"строка";case 2:case 3:case 4:return"строки";default:return"строк"}}function Ky({diff:n}){return y.jsxs("div",{className:"diff",children:[y.jsxs("div",{className:"diff__head",children:[y.jsx("span",{className:"diff__path",title:n.filePath,children:n.filePath}),y.jsxs("span",{className:"diff__stat",children:[n.added>0&&y.jsxs("span",{className:"diff__stat--add",children:["+",n.added]}),n.removed>0&&y.jsxs("span",{className:"diff__stat--del",children:["−",n.removed]})]})]}),n.note&&y.jsx("div",{className:"diff__note",children:n.note}),y.jsx("div",{className:"diff__body",children:n.rows.length===0?y.jsx("div",{className:"diff__row diff__row--gap",children:y.jsx("span",{className:"diff__text",children:"пустое содержимое"})}):n.rows.map((e,t)=>y.jsxs("div",{className:`diff__row diff__row--${e.type}`,children:[y.jsx("span",{className:"diff__mark","aria-hidden":"true",children:e.type==="add"?"+":e.type==="del"?"−":""}),y.jsx("span",{className:"diff__text",children:e.text===""?" ":e.text})]},t))})]})}function kB({waiting:n}){const[e,t]=M.useState(0);return M.useEffect(()=>{const i=window.setInterval(()=>t(l=>l+1),1e3);return()=>window.clearInterval(i)},[]),y.jsxs("div",{className:n?"work work--wait":"work",children:[y.jsxs("span",{className:"work__dots","aria-hidden":"true",children:[y.jsx("span",{className:"work__dot"}),y.jsx("span",{className:"work__dot"}),y.jsx("span",{className:"work__dot"})]}),y.jsx("span",{className:"work__label",children:n?"ждёт разрешения":"думает"}),!n&&y.jsxs("span",{className:"work__time",children:[e," с"]})]})}function Xy({items:n,busy:e,waiting:t,empty:i="Сессия пуста. Опишите задачу — Claude Code работает в каталоге проекта с полным набором инструментов."}){const l=M.useRef(null),a=M.useRef(!0);M.useEffect(()=>{const u=l.current;!u||!a.current||(u.scrollTop=u.scrollHeight)},[n,e]);function o(){const u=l.current;u&&(a.current=u.scrollHeight-u.scrollTop-u.clientHeight<80)}return y.jsx("div",{className:"transcript",ref:l,onScroll:o,children:y.jsxs("div",{className:"stream",children:[n.length===0&&y.jsx("p",{className:"empty",children:i}),n.map(u=>y.jsx(AB,{item:u},u.id)),e&&y.jsx(kB,{waiting:t})]})})}function AB({item:n}){switch(n.kind){case"user":return y.jsx("div",{className:"msg--user",children:n.text});case"assistant":return y.jsxs("div",{className:"msg--assistant",children:[n.text,n.streaming&&y.jsx("span",{className:"caret"})]});case"thinking":return y.jsx("div",{className:"thinking",children:n.text});case"tool":return y.jsx(CB,{item:n});case"result":return y.jsxs("div",{className:"result-line",children:[y.jsx("span",{children:n.isError?"✗ "+n.subtype:"✓ готово"}),y.jsxs("span",{children:[(n.durationMs/1e3).toFixed(1)," с"]}),n.costUsd!==null&&y.jsxs("span",{children:["$",n.costUsd.toFixed(4)]}),y.jsxs("span",{children:["↑",Gw(n.inputTokens)," ↓",Gw(n.outputTokens)]})]});case"notice":return y.jsx("div",{className:n.tone==="error"?"notice notice--error":"notice",children:n.text})}}function CB({item:n}){const[e,t]=M.useState(!1),i=n.result===null,l=AT(n.name,n.input);return y.jsxs("div",{className:"tool"+(n.isError?" tool--error":"")+(n.awaitingPermission?" tool--wait":""),children:[y.jsxs("button",{className:"tool__head",onClick:()=>t(a=>!a),children:[y.jsx("span",{className:"tool__name",children:n.name}),y.jsx("span",{className:"tool__arg",children:TB(n.input)}),y.jsx("span",{className:"tool__status",children:i?"…":n.isError?"ошибка":e?"▴":"▾"})]}),e&&y.jsxs("div",{className:"tool__body",children:[l?y.jsx(Ky,{diff:l}):y.jsx("pre",{className:"code",children:JSON.stringify(n.input,null,2)}),n.result!==null&&y.jsx("pre",{className:"code",style:{marginTop:10},children:n.result})]})]})}function TB(n){if(!n||typeof n!="object")return"";const e=n;for(const t of["file_path","command","pattern","path","url","prompt"]){const i=e[t];if(typeof i=="string")return i.replace(/\s+/g," ").slice(0,160)}return JSON.stringify(e).slice(0,160)}function Gw(n){return n>=1e3?`${(n/1e3).toFixed(1)}k`:String(n)}const _B="ccv.dictation.lang",Pw="ru-RU";function MB(n){try{return Function.prototype.toString.call(n).includes("[native code]")}catch{return!1}}function Yw(){const n=window,e=[n.SpeechRecognition,n.webkitSpeechRecognition].filter(i=>typeof i=="function"),t=e.find(MB);return!t&&e.length>0&&Ms("распознавание подменено: родной реализации в странице нет"),t??e[0]??null}function CT(){var n;try{return((n=localStorage.getItem(_B))==null?void 0:n.trim())||Pw}catch{return Pw}}function Ms(n,e){e===void 0?console.debug(`[dictation] ${n}`):console.debug(`[dictation] ${n}`,e)}const EB=3,NB=400,DB=5,OB=250,RB=2e3,jB=2e4;async function LB(){try{return(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch{return!1}}const BB={"not-allowed":"Браузер не дал доступ к микрофону","service-not-allowed":"Браузер не дал доступ к микрофону","audio-capture":"Микрофон не найден",network:"Сервис распознавания недоступен","language-not-supported":`Распознавание не знает языка ${CT()}`};function zB(n){const[e]=M.useState(()=>Yw()!==null),[t,i]=M.useState(!1),[l,a]=M.useState(null),o=M.useRef(null),u=M.useRef(!1),f=M.useRef(!1),d=M.useRef(n),p=M.useRef({openedAt:0,audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1}),b=M.useRef(null),x=M.useRef(!1),S=M.useRef(null),w=M.useCallback(()=>{S.current&&clearTimeout(S.current),S.current=null},[]),T=M.useCallback(()=>{w();const q=async H=>{if(S.current=null,!(!u.current||x.current)){if(!H&&!await LB()){if(Ms("ждём ответа на запрос доступа к микрофону"),!u.current||x.current)return;S.current=setTimeout(()=>void q(!0),jB);return}Ms("движок не ответил на start()"),u.current=!1,i(!1),a("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};S.current=setTimeout(()=>void q(!1),RB)},[w]);M.useEffect(()=>{d.current=n}),M.useEffect(()=>{const q=Yw();if(!q)return;const H=new q;return H.lang=CT(),H.continuous=!0,H.interimResults=!0,H.onstart=()=>{Ms("сессия открыта"),x.current=!0,w(),i(!0)},H.onaudiostart=()=>{Ms("пошёл звук с микрофона"),p.current.audio=!0},H.onresult=L=>{var Me;if(f.current)return;let j="",se="";for(let ue=L.resultIndex;ue<L.results.length;ue++){const le=L.results[ue];if(!le)continue;const Ee=((Me=le[0])==null?void 0:Me.transcript)??"";le.isFinal?j+=Ee:se+=Ee}const he=p.current;he.heard=!0,he.everHeard=!0,Ms("распознано",{final:j,interim:se}),d.current(j,se)},H.onerror=L=>{p.current.lastError=L.error,Ms("ошибка движка",L.error),!(L.error==="no-speech"||L.error==="aborted")&&(u.current=!1,i(!1),a(BB[L.error]??`Распознавание не работает: ${L.error}`))},H.onend=()=>{f.current=!1,x.current=!1;const L=p.current,j=Date.now()-L.openedAt;if(Ms("сессия закрыта",{мс:j,звук:L.audio,слова:L.heard,ошибка:L.lastError||null}),!u.current){i(!1);return}if(L.dead=!L.audio&&j<NB?L.dead+1:0,L.dead>=DB){u.current=!1,i(!1),a(L.lastError?`Распознавание не работает: ${L.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}L.silent=L.heard?0:L.silent+1,!L.everHeard&&!L.warned&&L.silent>=EB&&(L.warned=!0,a(L.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),b.current=setTimeout(()=>{if(b.current=null,!!u.current){L.openedAt=Date.now(),L.audio=!1,L.heard=!1,L.lastError="",T();try{H.start()}catch{}}},OB)},o.current=H,()=>{u.current=!1,b.current&&clearTimeout(b.current),b.current=null,w(),H.onend=null,H.onresult=null,H.onerror=null,H.onstart=null,H.onaudiostart=null,H.abort(),o.current=null}},[]);const C=M.useCallback(()=>{var q;if(u.current){if(u.current=!1,Ms("выключение микрофона"),b.current&&clearTimeout(b.current),b.current=null,w(),!x.current){i(!1);return}(q=o.current)==null||q.stop()}},[]),E=M.useCallback(()=>{const q=o.current;if(q){if(!window.isSecureContext){a("Микрофон доступен только по https или с localhost");return}a(null),u.current=!0,f.current=!1,b.current&&clearTimeout(b.current),b.current=null,p.current={openedAt:Date.now(),audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1},i(!0),Ms("включение микрофона",{язык:q.lang}),T();try{q.start()}catch(H){Ms("start() не прошёл",H)}}},[T]),O=M.useCallback(()=>{u.current?C():E()},[E,C]),B=M.useCallback(()=>{var q;u.current&&x.current&&(f.current=!0,(q=o.current)==null||q.abort())},[]);return{supported:e,listening:t,error:l,toggle:O,stop:C,drop:B}}const Fw=/^\/(\S*)$/,HB=new Set(["model","permissions"]);function IB(n){return HB.has(n.name)||n.name.startsWith("__")}const UB=new Set(["clear","rename"]),Ww=/(?:^|\s)@([^\s@]*)$/,VB=200,qB=100,GB=190;function TT({disabled:n,busy:e,commands:t,sessionTitle:i,contextResult:l,className:a,placeholder:o,sendLabel:u="Отправить",autoFocus:f=!1,onContextSearch:d,onCommand:p,onSend:b,onInterrupt:x,onEscape:S}){var Fe;const[w,T]=M.useState(""),[C,E]=M.useState(!1),[O,B]=M.useState(0),q=M.useRef(null),H=M.useRef(null),L=M.useRef(null),[j,se]=M.useState(0),[he,Me]=M.useState([]),[ue,le]=M.useState(-1),Ee=M.useRef(""),[ve,ke]=M.useState(""),I=zB(M.useCallback(($,fe)=>{$&&T(ze=>$g(ze,$)),ke(fe.trim())},[])),Z=ve?$g(w,ve):w;M.useEffect(()=>{I.listening||ve===""||(T($=>$g($,ve)),ke(""))},[I.listening,ve]),M.useEffect(()=>{var $;f&&(($=q.current)==null||$.focus())},[f]);const ee=n?"Выберите сессию":o??"Опишите задачу… («/» — команды, «@» — файлы)",Ne=M.useRef(0),_e=M.useCallback($=>{const fe=parseFloat(getComputedStyle($).maxHeight),ze=Number.isFinite(fe)&&fe>0?fe:GB;$.style.height="auto";const Je=$.scrollHeight;$.style.height=`${Math.min(Je,ze)}px`,$.style.overflowY=Je>ze?"auto":"hidden";const vn=L.current;vn&&(L.current=null,$.setSelectionRange(vn[0],vn[1]))},[]);M.useEffect(()=>{const $=q.current;$&&_e($)},[Z,ee,n,_e]),M.useEffect(()=>{const $=q.current;if(!$)return;const fe=new ResizeObserver(([ze])=>{const Je=ze==null?void 0:ze.contentRect.width;Je===void 0||Math.abs(Je-Ne.current)<1||(Ne.current=Je,_e($))});return fe.observe($),()=>fe.disconnect()},[_e]);const N=I.stop;M.useEffect(()=>{n&&N()},[n,N]);const F=M.useMemo(()=>I.error?{ok:!1,message:I.error}:null,[I.error]),J=M.useMemo(()=>{var ze;const $=(ze=Fw.exec(w))==null?void 0:ze[1];if($===void 0)return[];const fe=$.toLowerCase();return t.filter(Je=>!IB(Je)&&Kg(Je,fe)<_T).sort((Je,vn)=>Kg(Je,fe)-Kg(vn,fe))},[w,t]),oe=!C&&J.length>0,de=Math.min(O,J.length-1),Se=C?null:((Fe=Ww.exec(Z.slice(0,j)))==null?void 0:Fe[1])??null,Ie=M.useRef(d);Ie.current=d,M.useEffect(()=>{if(Se===null||Se===""||Se.endsWith("/")){Ie.current(Se);return}const $=setTimeout(()=>Ie.current(Se),VB);return()=>clearTimeout($)},[Se]);const pt=Se!==null&&(l==null?void 0:l.query)===Se,$e=pt?l.entries:[],It=Se!==null,Ze=It&&!pt,Kt=Math.min(O,Math.max($e.length-1,0));M.useEffect(()=>{var fe,ze;if(!oe&&!It)return;const $=oe?de:Kt;(ze=(fe=H.current)==null?void 0:fe.children[$])==null||ze.scrollIntoView({block:"nearest"})},[oe,It,de,Kt]);function at($,fe){var ze;T($),se(fe),L.current=[fe,fe],B(0),E(!1),ve!==""&&(ke(""),I.drop()),(ze=q.current)==null||ze.focus()}function we(){T(""),ke(""),B(0),se(0),E(!1),le(-1),Ee.current="",I.drop()}function xe($){const fe=$.trim();!fe||n||(b(fe),Me(ze=>[fe,...ze.filter(Je=>Je!==fe)].slice(0,qB)),we())}function Ft($){if($<-1||$>=he.length)return;ue===-1&&(Ee.current=w);const fe=$===-1?Ee.current:he[$]??"";le($),at(fe,fe.length)}function xn(){var Je;const $=((Je=q.current)==null?void 0:Je.selectionStart)??Z.length,ze=`${$>0&&!/\s$/.test(Z.slice(0,$))?" ":""}@`;at(Z.slice(0,$)+ze+Z.slice($),$+ze.length)}function Ve($){var vn;const fe=(vn=Ww.exec(Z.slice(0,j)))==null?void 0:vn[1];if(fe===void 0)return;const ze=j-fe.length-1,Je=$.kind==="dir"?`@${$.path}/`:`@${$.path} `;at(Z.slice(0,ze)+Je+Z.slice(j),ze+Je.length)}function Rn(){var fe;const $=(fe=Fw.exec(Z.trim()))==null?void 0:fe[1];if($&&p($)){we();return}xe(Z)}function si($,fe){T($),se(fe),B(0),E(!1),le(-1),ve!==""&&(ke(""),I.drop())}function ce($){var Je;const fe=UB.has($.name)?i:null,ze=`/${$.name} `;T(ze+(fe??"")),se(ze.length+((fe==null?void 0:fe.length)??0)),fe&&(L.current=[ze.length,ze.length+fe.length]),B(0),(Je=q.current)==null||Je.focus()}function qe($){if(p($.name)){T(""),B(0),E(!1);return}$.argumentHint?ce($):xe(`/${$.name}`)}function St($){if(oe){if($.key==="ArrowDown")return $.preventDefault(),B(fe=>(Math.min(fe,J.length-1)+1)%J.length);if($.key==="ArrowUp"){$.preventDefault();const fe=J.length-1;return B(ze=>(Math.min(ze,fe)+fe)%J.length)}if($.key==="Enter"&&!$.shiftKey){$.preventDefault();const fe=J[de];fe&&qe(fe);return}if($.key==="Tab"){$.preventDefault();const fe=J[de];fe&&ce(fe);return}if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),E(!0);return}}if(It){if($.key==="ArrowDown"&&$e.length>0)return $.preventDefault(),B(fe=>(Math.min(fe,$e.length-1)+1)%$e.length);if($.key==="ArrowUp"&&$e.length>0){$.preventDefault();const fe=$e.length-1;return B(ze=>(Math.min(ze,fe)+fe)%$e.length)}if($.key==="Enter"&&!$.shiftKey||$.key==="Tab"){const fe=$e[Kt];if(fe){$.preventDefault(),Ve(fe);return}if($.key==="Tab")return}if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),E(!0);return}}if(($.key==="ArrowUp"||$.key==="ArrowDown")&&!$.shiftKey){const fe=$.currentTarget,ze=fe.selectionStart;if(fe.selectionEnd===ze){const Je=$.key==="ArrowUp",vn=Je?!Z.slice(0,ze).includes(`
129
- `):!Z.slice(ze).includes(`
130
- `),$n=Je?ue+1:ue-1;if(vn&&$n>=-1&&$n<he.length){$.preventDefault(),Ft($n);return}}}if($.key==="Escape"&&S){$.preventDefault(),$.stopPropagation(),S();return}$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),Rn())}return y.jsx("div",{className:a?`composer ${a}`:"composer",children:y.jsxs("div",{className:"composer__inner",children:[y.jsx(Zu,{result:F}),It&&!oe&&y.jsxs("div",{className:"cmdmenu",role:"listbox",ref:H,children:[$e.map(($,fe)=>y.jsxs("button",{role:"option","aria-selected":fe===Kt,className:fe===Kt?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>B(fe),onMouseDown:ze=>{ze.preventDefault(),Ve($)},children:[y.jsxs("span",{className:"cmdmenu__name",children:[$.name,$.kind==="dir"?"/":""]}),y.jsx("span",{className:"cmdmenu__desc",children:$.path}),$.ignored&&y.jsx("span",{className:"cmdmenu__tag",children:"git-ignore"})]},$.path)),$e.length===0&&y.jsx("div",{className:"cmdmenu__empty",children:Ze?"ищем…":Se?"Ничего не нашлось":"Наберите имя файла или каталога"})]}),oe&&y.jsx("div",{className:"cmdmenu",role:"listbox",ref:H,children:J.map(($,fe)=>y.jsxs("button",{role:"option","aria-selected":fe===de,className:fe===de?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>B(fe),onMouseDown:ze=>{ze.preventDefault(),qe($)},children:[y.jsxs("span",{className:"cmdmenu__name",children:["/",$.name]}),$.argumentHint&&y.jsx("span",{className:"cmdmenu__hint",children:$.argumentHint}),y.jsx("span",{className:"cmdmenu__desc",children:$.description})]},$.name))}),y.jsxs("div",{className:"composer__field",children:[y.jsx("button",{type:"button",className:"addbtn",title:"Добавить контекст — файл проекта («@»)","aria-label":"Добавить контекст",disabled:n,onClick:xn,children:y.jsx(PB,{})}),y.jsx("textarea",{ref:q,value:Z,disabled:n,placeholder:ee,onChange:$=>si($.target.value,$.target.selectionStart),onSelect:$=>se($.currentTarget.selectionStart),onKeyDown:St}),I.supported&&y.jsx("button",{type:"button",className:I.listening?"micbtn is-on":"micbtn",title:I.listening?"Остановить диктовку":"Продиктовать промпт","aria-label":I.listening?"Остановить диктовку":"Продиктовать промпт","aria-pressed":I.listening,disabled:n,onClick:I.toggle,children:y.jsx(FB,{on:I.listening})}),e?y.jsx("button",{className:"btn",onClick:x,title:"Прервать (Esc)",children:"Стоп"}):y.jsxs("button",{className:"btn btn--primary sendbtn",onClick:Rn,disabled:n||Z.trim()==="","aria-label":u,title:u,children:[y.jsx("span",{className:"sendbtn__label",children:u}),y.jsx(YB,{})]})]})]})})}function $g(n,e){const t=e.trim();return t===""?n:n===""||/\s$/.test(n)?n+t:`${n} ${t}`}function PB(){return y.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round","aria-hidden":"true",children:y.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2"})})}function YB(){return y.jsx("svg",{className:"sendbtn__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M8 12.5V3.5M4 7.5 8 3.5l4 4"})})}function FB({on:n}){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("rect",{x:"5.9",y:"1.7",width:"4.2",height:"7.6",rx:"2.1",fill:n?"currentColor":"none"}),y.jsx("path",{d:"M3.3 7.3v.8a4.7 4.7 0 0 0 9.4 0v-.8"}),y.jsx("path",{d:"M8 12.8v1.5"})]})}const _T=4;function Kg(n,e){const t=n.name.toLowerCase();return t===e?0:t.startsWith(e)?1:n.aliases.some(i=>i.toLowerCase().startsWith(e))?2:t.includes(e)?3:_T}function WB({request:n,queued:e,onDecide:t}){const i=AT(n.toolName,n.input);return y.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:y.jsxs("div",{className:"sheet",role:"dialog","aria-modal":"true",children:[y.jsxs("div",{className:"sheet__head",children:["Разрешить действие?",e>0&&` (ещё ${e} в очереди)`]}),y.jsxs("div",{className:"sheet__body",children:[y.jsx("div",{className:"sheet__tool",children:n.toolName}),n.reason&&y.jsx("p",{className:"sheet__reason",children:n.reason}),i?y.jsx(Ky,{diff:i}):y.jsx("pre",{className:"code",children:JSON.stringify(n.input,null,2)})]}),y.jsxs("div",{className:"sheet__actions",children:[y.jsx("button",{className:"btn",onClick:()=>t(n.requestId,"deny"),children:"Отклонить"}),y.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>t(n.requestId,"allow"),children:"Разрешить"})]})]})})}function MT({path:n}){const[e,t]=M.useState(!1),[i,l]=M.useState(!1),a=M.useRef(null);M.useEffect(()=>{if(!e)return;function u(f){var d;(d=a.current)!=null&&d.contains(f.target)||t(!1)}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e]),M.useEffect(()=>{if(!i)return;const u=setTimeout(()=>l(!1),1600);return()=>clearTimeout(u)},[i]),M.useEffect(()=>t(!1),[n]);async function o(){await $B(n)&&l(!0)}return y.jsxs("div",{ref:a,className:"cwd",children:[y.jsxs("button",{type:"button",className:"cwd__toggle","aria-expanded":e,title:e?"Свернуть путь":`Полный путь: ${n}`,onClick:()=>t(u=>!u),onKeyDown:u=>{u.key!=="Escape"||!e||(u.preventDefault(),u.stopPropagation(),t(!1))},children:[y.jsx(KB,{open:e}),y.jsx("span",{className:"cwd__short",children:n})]}),e&&y.jsxs("div",{className:"cwd__pop",children:[y.jsx("span",{className:"cwd__full",children:n}),y.jsx("button",{type:"button",className:"btn btn--ghost cwd__copy",onClick:()=>void o(),children:i?"Скопировано":"Копировать"})]})]})}async function $B(n){try{return await navigator.clipboard.writeText(n),!0}catch{}const e=document.createElement("textarea");e.value=n,e.setAttribute("readonly",""),e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e);try{return e.select(),document.execCommand("copy")}catch{return!1}finally{e.remove()}}function KB({open:n}){return y.jsx("svg",{className:n?"cwd__chev cwd__chev--open":"cwd__chev",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function nf({value:n,options:e,onChange:t,className:i,title:l,ariaLabel:a,placeholder:o="—"}){const[u,f]=M.useState(!1),[d,p]=M.useState(0),b=M.useRef(null),x=M.useRef(null),S=e.find(C=>C.value===n)??null;M.useEffect(()=>{if(!u)return;const C=e.findIndex(E=>E.value===n);p(C===-1?0:C)},[u]),M.useEffect(()=>{if(!u)return;function C(E){var O;(O=b.current)!=null&&O.contains(E.target)||f(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[u]),M.useEffect(()=>{var C,E;u&&((E=(C=x.current)==null?void 0:C.querySelector(".is-cursor"))==null||E.scrollIntoView({block:"nearest"}))},[u,d]);function w(C){f(!1),C.value!==n&&t(C.value)}function T(C){if(C.key==="Escape"){if(!u)return;C.preventDefault(),C.stopPropagation(),f(!1);return}if(C.key==="ArrowDown"||C.key==="ArrowUp"){if(C.preventDefault(),!u)return f(!0);const E=C.key==="ArrowDown"?1:e.length-1;return p(O=>(O+E)%e.length)}if(C.key==="Enter"||C.key===" "){if(C.preventDefault(),!u)return f(!0);const E=e[d];E&&w(E)}}return y.jsxs("div",{ref:b,className:"select"+(u?" select--open":"")+(i?` ${i}`:""),children:[y.jsxs("button",{type:"button",className:"select__trigger",title:l,"aria-label":a??l,"aria-haspopup":"listbox","aria-expanded":u,onClick:()=>f(C=>!C),onKeyDown:T,children:[y.jsx("span",{className:"select__value",children:(S==null?void 0:S.label)??o}),y.jsx(XB,{})]}),u&&y.jsx("div",{ref:x,className:"select__menu",role:"listbox","aria-label":a??l,children:e.map((C,E)=>y.jsxs("button",{type:"button",role:"option","aria-selected":C.value===n,className:"select__option"+(E===d?" is-cursor":"")+(C.value===n?" is-on":""),onMouseEnter:()=>p(E),onClick:()=>w(C),children:[y.jsx("span",{className:"select__check","aria-hidden":"true",children:C.value===n?"✓":""}),y.jsx("span",{className:"select__label",children:C.label}),C.hint&&y.jsx("span",{className:"select__hint",children:C.hint})]},C.value))})]})}function XB(){return y.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const QB=["low","medium","high"];function ET({models:n,value:e,effort:t,ultracode:i,thinking:l,switchOnFlag:a,className:o,onModel:u,onEffort:f,onUltracode:d,onThinking:p,onSwitchOnFlag:b}){const[x,S]=M.useState(!1),[w,T]=M.useState(0),C=M.useRef(null),E=M.useRef(null),O=n.find(j=>j.value===e)??null,B=O&&O.supportsEffort?O.effortLevels.length>0?O.effortLevels:QB:[],q=B.includes("xhigh");M.useEffect(()=>{if(!x)return;const j=n.findIndex(se=>se.value===e);T(j===-1?0:j)},[x]),M.useEffect(()=>{if(!x)return;function j(se){var he;(he=C.current)!=null&&he.contains(se.target)||S(!1)}return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[x]),M.useEffect(()=>{var j,se;x&&((se=(j=E.current)==null?void 0:j.querySelector(".is-cursor"))==null||se.scrollIntoView({block:"nearest"}))},[x,w]);function H(j){S(!1),j.value!==e&&u(j.value)}function L(j){if(j.key==="Escape"){if(!x)return;j.preventDefault(),j.stopPropagation(),S(!1);return}if(j.key==="ArrowDown"||j.key==="ArrowUp"){if(j.preventDefault(),!x)return S(!0);if(n.length===0)return;const se=j.key==="ArrowDown"?1:n.length-1;return T(he=>(he+se)%n.length)}if(j.key==="Enter"||j.key===" "){if(j.preventDefault(),!x)return S(!0);const se=n[w];se&&H(se)}}return y.jsxs("div",{ref:C,className:"select"+(x?" select--open":"")+(o?` ${o}`:""),children:[y.jsxs("button",{type:"button",className:"select__trigger",title:"Модель, усилие и размышления","aria-label":"Модель, усилие и размышления","aria-haspopup":"menu","aria-expanded":x,onClick:()=>S(j=>!j),onKeyDown:L,children:[y.jsx("span",{className:"select__value",children:(O==null?void 0:O.displayName)??e??"—"}),i?y.jsx("span",{className:"select__suffix select__suffix--hot",children:"ultracode"}):B.length>0&&t&&y.jsx("span",{className:"select__suffix",children:t}),y.jsx(ZB,{})]}),x&&y.jsxs("div",{ref:E,className:"select__menu modelmenu",role:"menu",children:[y.jsx("div",{className:"modelmenu__head",children:"Модель"}),n.map((j,se)=>y.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":j.value===e,className:"select__option"+(se===w?" is-cursor":"")+(j.value===e?" is-on":""),onMouseEnter:()=>T(se),onClick:()=>H(j),children:[y.jsx("span",{className:"select__check","aria-hidden":"true",children:j.value===e?"✓":""}),y.jsx("span",{className:"select__label",children:j.displayName}),j.description&&y.jsx("span",{className:"select__hint",children:j.description})]},j.value)),B.length>0&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"modelmenu__sep",role:"separator"}),y.jsxs("div",{className:"modelmenu__row",children:[y.jsxs("span",{className:"modelmenu__label",children:["Усилие",y.jsx("span",{className:"modelmenu__desc",children:"насколько усердно модель думает"})]}),y.jsx("span",{className:"modelmenu__levels",children:B.map(j=>y.jsx("button",{type:"button",role:"menuitemradio","aria-checked":j===t,className:j===t?"modelmenu__level is-on":"modelmenu__level",onClick:()=>f(j),children:j},j))})]}),q&&y.jsx(Xg,{label:"Ultracode",desc:"xhigh и постоянная оркестрация подагентами",on:i,onToggle:()=>d(!i)})]}),y.jsx("div",{className:"modelmenu__sep",role:"separator"}),(O==null?void 0:O.supportsThinking)!==!1&&y.jsx(Xg,{label:"Размышления",desc:"расширенное обдумывание перед ответом",on:l,onToggle:()=>p(!l)}),y.jsx(Xg,{label:"Менять модель по флагу",desc:"иначе помеченный ход встаёт на паузу",on:a,onToggle:()=>b(!a)})]})]})}function Xg({label:n,desc:e,on:t,onToggle:i}){return y.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":t,className:"modelmenu__row modelmenu__row--btn",onClick:i,children:[y.jsxs("span",{className:"modelmenu__label",children:[n,y.jsx("span",{className:"modelmenu__desc",children:e})]}),y.jsx("span",{className:t?"switch is-on":"switch","aria-hidden":"true",children:y.jsx("span",{className:"switch__knob"})})]})}function ZB(){return y.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function js({title:n,children:e,actions:t,className:i,sheet:l=!1,onClose:a}){const o=M.useRef(null);return M.useEffect(()=>{function u(f){if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),a();return}if(f.key!=="Tab")return;const d=o.current;if(!d)return;const p=d.querySelectorAll('button, input, textarea, select, a[href], [tabindex]:not([tabindex="-1"])'),b=p[0],x=p[p.length-1];!b||!x||(f.shiftKey&&document.activeElement===b?(f.preventDefault(),x.focus()):!f.shiftKey&&document.activeElement===x&&(f.preventDefault(),b.focus()))}return document.addEventListener("keydown",u,!0),()=>document.removeEventListener("keydown",u,!0)},[a]),y.jsx("div",{className:l?"modal-backdrop modal-backdrop--sheet":"modal-backdrop",onMouseDown:u=>{u.target===u.currentTarget&&a()},children:y.jsxs("div",{ref:o,className:i?`modal ${i}`:"modal",role:"dialog","aria-modal":"true","aria-label":n,children:[y.jsxs("div",{className:"modal__head",children:[y.jsx("h2",{className:"modal__title",children:n}),y.jsx("button",{className:"modal__close","aria-label":"Закрыть",onClick:a,children:"✕"})]}),y.jsx("div",{className:"modal__body",children:e}),t&&y.jsx("div",{className:"modal__actions",children:t})]})})}function JB({candidates:n,searching:e,agentItems:t,agentBusy:i,error:l,roots:a,created:o,onSearch:u,onAskAgent:f,onInterrupt:d,onSubmit:p,onCreate:b,onClose:x}){const[S,w]=M.useState("open"),[T,C]=M.useState(""),[E,O]=M.useState(!1),[B,q]=M.useState(""),[H,L]=M.useState(""),[j,se]=M.useState({git:!0,claudeMd:!0,readme:!0}),he=T.trim(),Me=he!=="",ue=B.trim(),le=H.trim(),Ee=ue!==""&&le!=="";M.useEffect(()=>{B===""&&a.length>0&&q(a[0])},[a]);const ve=M.useRef(u);ve.current=u,M.useEffect(()=>{if(S!=="open")return;const ee=T.trim(),Ne=setTimeout(()=>ve.current(ee),200);return()=>clearTimeout(Ne)},[T,S]);function ke(){Me&&p(he)}function I(){Ee&&b(ue,le,j)}function Z(){Me&&(O(!0),f(he))}return o?y.jsxs(js,{title:"Новый проект",onClose:x,actions:y.jsx("button",{className:"btn btn--primary",onClick:x,autoFocus:!0,children:"Понятно"}),children:[y.jsx("p",{className:"modal__text",children:"Каталог создан и открыт как проект, но часть шагов не удалась."}),y.jsx("p",{className:"newproj__preview",children:o.path}),y.jsx("div",{className:"modal__error",children:y.jsx("ul",{className:"newproj__warnings",children:o.warnings.map(ee=>y.jsx("li",{children:ee},ee))})}),y.jsx("p",{className:"modal__text modal__text--dim",children:"Проект открыт и работает — недостающее можно добавить руками, в дереве файлов или из терминала."})]}):y.jsxs(js,{title:"Новый проект",className:E&&S==="open"?"modal--wide":void 0,onClose:x,actions:y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:x,children:"Отмена"}),S==="open"?y.jsxs(y.Fragment,{children:[i?y.jsx("button",{className:"btn",onClick:d,children:"Остановить"}):y.jsx("button",{className:"btn",disabled:!Me,onClick:Z,title:"Найти по описанию",children:"Попросить агента"}),y.jsx("button",{className:"btn btn--primary",disabled:!Me,onClick:ke,children:"Открыть"})]}):y.jsx("button",{className:"btn btn--primary",disabled:!Ee,onClick:I,children:"Создать"})]}),children:[y.jsxs("div",{className:"tabs",children:[y.jsx($w,{label:"Открыть",on:S==="open",onClick:()=>w("open")}),y.jsx($w,{label:"Создать",on:S==="create",onClick:()=>w("create")})]}),S==="open"?y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"modal__text",children:"Каталог, в котором будет работать агент. Введите путь или часть имени — подходящие каталоги появятся ниже."}),y.jsx("label",{className:"field",htmlFor:"workspace-path",children:"Путь или название"}),y.jsx("input",{id:"workspace-path",className:"input input--mono",value:T,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects\\my-app",onChange:ee=>C(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&(ee.preventDefault(),ke())}}),l&&y.jsx("p",{className:"modal__error",children:l}),n.length>0&&y.jsx("ul",{className:"finds",children:n.map(ee=>y.jsx("li",{children:y.jsxs("button",{className:"find",disabled:ee.open,title:ee.open?"Этот проект уже открыт":ee.path,onClick:()=>C(ee.path),onDoubleClick:()=>p(ee.path),children:[y.jsx("span",{className:"find__name",children:ee.name}),y.jsx("span",{className:"find__path",children:ee.path}),y.jsx("span",{className:"find__note",children:n4(ee)})]})},ee.path))}),n.length===0&&Me&&!e&&!E&&y.jsx("p",{className:"modal__text modal__text--dim",children:"Ничего похожего среди каталогов, где вы работали. Если помните не имя, а суть проекта — опишите его и нажмите «Попросить агента». Проекта ещё нет вовсе — рядом вкладка «Создать»."}),E&&y.jsx("div",{className:"finds__agent",children:y.jsx(Xy,{items:t,busy:i,waiting:!1,empty:"Агент ищет…"})})]}):y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"modal__text",children:"Пустой каталог для нового проекта. Дальше в нём работает агент — с первого промпта, без отдельной настройки."}),y.jsx("label",{className:"field",htmlFor:"workspace-parent",children:"Где создать"}),y.jsx("input",{id:"workspace-parent",className:"input input--mono",value:B,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects",onChange:ee=>q(ee.target.value)}),a.length>0&&y.jsx("div",{className:"newproj__roots",children:a.map(ee=>y.jsx("button",{type:"button",className:ee===ue?"newproj__root is-on":"newproj__root",title:ee,onClick:()=>q(ee),children:t4(ee)},ee))}),y.jsx("label",{className:"field newproj__field",htmlFor:"workspace-name",children:"Имя проекта"}),y.jsx("input",{id:"workspace-name",className:"input input--mono",value:H,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"my-app",onChange:ee=>L(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&(ee.preventDefault(),I())}}),y.jsx("p",{className:"newproj__preview",children:Ee?e4(ue,le):"Каталог появится здесь"}),l&&y.jsx("p",{className:"modal__error",children:l}),y.jsxs("div",{className:"newproj__opts",children:[y.jsx(Qg,{label:"git init",desc:"панель истории работает сразу",on:j.git,onToggle:()=>se(ee=>({...ee,git:!ee.git}))}),y.jsx(Qg,{label:"CLAUDE.md",desc:"заготовка инструкций для агента",on:j.claudeMd,onToggle:()=>se(ee=>({...ee,claudeMd:!ee.claudeMd}))}),y.jsx(Qg,{label:"README.md",desc:"по нему проект потом узнаёт поиск",on:j.readme,onToggle:()=>se(ee=>({...ee,readme:!ee.readme}))})]})]})]})}function $w({label:n,on:e,onClick:t}){return y.jsx("button",{type:"button",className:e?"tabs__tab is-on":"tabs__tab","aria-pressed":e,onClick:t,children:n})}function Qg({label:n,desc:e,on:t,onToggle:i}){return y.jsxs("button",{type:"button",role:"checkbox","aria-checked":t,className:"newproj__opt",onClick:i,children:[y.jsxs("span",{className:"newproj__optlabel",children:[n,y.jsx("span",{className:"newproj__optdesc",children:e})]}),y.jsx("span",{className:t?"switch is-on":"switch","aria-hidden":"true",children:y.jsx("span",{className:"switch__knob"})})]})}function e4(n,e){const t=n.includes("\\")?"\\":"/";return n.replace(/[\\/]+$/,"")+t+e}function t4(n){const e=n.includes("\\")?"\\":"/",t=n.split(/[\\/]/).filter(Boolean);return t.length<=2?n:`…${e}${t.slice(-2).join(e)}`}function n4(n){return n.open?"уже открыт":n.why?n.why:n.sessions===0?"рядом с вашими проектами":`${i4(n.sessions)}${s4(n.lastUsedAt)}`}function i4(n){const e=n%10,t=n%100;return t>=11&&t<=14?`${n} сессий`:e===1?`${n} сессия`:e>=2&&e<=4?`${n} сессии`:`${n} сессий`}function s4(n){if(!n)return"";const e=Math.floor((Date.now()-n)/864e5);return e<=0?" · сегодня":e===1?" · вчера":e<30?` · ${e} дн. назад`:` · ${new Date(n).toLocaleDateString("ru-RU")}`}const Qy=7;function l4(n){const e=[],t=[];let i=1;for(const l of n){const a=e.slice();let o=e.indexOf(l.hash);o===-1&&(o=Kw(e),e[o]=l.hash);const[u,...f]=l.parents;e[o]=u??null;const d=[];u!==void 0&&d.push({from:o,to:o});for(const x of f){let S=e.indexOf(x);S===-1&&(S=Kw(e),e[S]=x),d.push({from:o,to:S})}const p=[];for(let x=0;x<a.length;x++)a[x]===l.hash&&(p.push({from:x,to:o}),x!==o&&(e[x]=null));const b=[];for(let x=0;x<a.length;x++){const S=a[x];!S||S===l.hash||x===o||e[x]===S&&b.push(x)}r4(e),i=Math.max(i,e.length,o+1),t.push({commit:l,col:o,up:p,down:d,through:b})}return{rows:t,columns:Math.min(i,Qy)}}function Kw(n){const e=n.indexOf(null);return e!==-1?e:(n.push(null),n.length-1)}function r4(n){for(;n.length>0&&n[n.length-1]===null;)n.pop()}const NT=1500;function a4(n){const e=[];let t=!1;for(const i of n.patch.split(`
131
- `)){if(e.length>=NT){t=!0;break}if(i.startsWith("@@"))e.push({type:"gap",text:o4(i)});else if(i.startsWith("+"))e.push({type:"add",text:i.slice(1)});else if(i.startsWith("-"))e.push({type:"del",text:i.slice(1)});else{if(i.startsWith("\\"))continue;(i!==""||e.length>0)&&e.push({type:"ctx",text:i.startsWith(" ")?i.slice(1):i})}}return{kind:"patch",filePath:n.path||n.oldPath,rows:e,added:n.added,removed:n.removed,note:c4(n,t)}}function o4(n){const e=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@ ?(.*)$/.exec(n);if(!e)return n;const t=Number(e[1]),i=e[2]===void 0?1:Number(e[2]),l=(e[3]??"").trim(),a=i>1?`строки ${t}–${t+i-1}`:`строка ${t}`;return l?`⋯ ${a} · ${l}`:`⋯ ${a}`}function c4(n,e){const t=[];return n.status==="added"&&t.push("новый файл"),n.status==="deleted"&&t.push("файл удалён"),n.status==="renamed"&&t.push(`переименован из ${n.oldPath}`),n.binary?t.push("двоичный файл"):n.patch===""&&t.push("содержимое не показано"),e&&t.push(`показаны первые ${NT} строк`),t.length>0?t.join(" · "):null}function u4({open:n,state:e,result:t,selected:i,onRefresh:l,onShow:a,onCheckout:o,onClose:u}){const f=l4((e==null?void 0:e.commits)??[]),d=[...e!=null&&e.detached?[{value:"",label:`отделён · ${e.head.slice(0,8)}`}]:[],...((e==null?void 0:e.branches)??[]).map(p=>({value:p.name,label:p.name,hint:p.hash.slice(0,8)}))];return y.jsxs("aside",{className:n?"sidepane sidepane--git sidepane--open":"sidepane sidepane--git","aria-label":"История git",children:[y.jsxs("div",{className:"sidepane__head",children:[y.jsx(m4,{}),y.jsx("span",{className:"sidepane__title",children:"История"}),y.jsx("button",{className:"sidepane__btn",title:"Обновить","aria-label":"Обновить историю",onClick:l,children:"↻"}),y.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель истории",onClick:u,children:"✕"})]}),e===null?y.jsx("p",{className:"sidepane__empty",children:"Читаем репозиторий…"}):e.available?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"gitbar",children:[y.jsx(nf,{className:"gitbar__branch",title:"Ветка — выбрать значит переключиться",value:e.detached?"":e.branch,options:d,onChange:p=>{p&&o(p,`ветку ${p}`)}}),e.ahead>0&&y.jsxs("span",{className:"chip",title:`${e.ahead} — столько коммитов не отправлено`,children:["↑",e.ahead]}),e.behind>0&&y.jsxs("span",{className:"chip",title:`${e.behind} — столько коммитов не забрано`,children:["↓",e.behind]})]}),e.detached&&y.jsx("p",{className:"gitbar__note",children:"HEAD отделён от ветки. Выберите ветку в списке, чтобы вернуться."}),y.jsxs("div",{className:"sidepane__scroll",children:[y.jsx("button",{className:"gitrow gitrow--work"+(i===""?" is-on":""),onClick:()=>a(""),children:y.jsxs("span",{className:"gitrow__body",children:[y.jsx("span",{className:"gitrow__subject",children:e.changed.length>0?`Рабочее дерево · ${e.changed.length} ${b4(e.changed.length)}`:"Рабочее дерево чистое"}),y.jsx("span",{className:"gitrow__meta",children:e.changed.length>0?e.changed.slice(0,4).map(p=>y4(p.path)).join(", "):"незакоммиченных изменений нет"})]})}),f.rows.map(p=>y.jsx(f4,{row:p,columns:f.columns,head:p.commit.hash===e.head,local:e.hasRemote&&!p.commit.pushed,active:i===p.commit.hash,onOpen:()=>a(p.commit.hash)},p.commit.hash)),f.rows.length===0&&y.jsx("p",{className:"sidepane__empty",children:"В репозитории ещё нет коммитов"})]})]}):y.jsx("p",{className:"sidepane__empty",children:e.message||"Это не git-репозиторий"}),y.jsx(Zu,{result:t})]})}const pu=50,Xw=13;function f4({row:n,columns:e,head:t,local:i,active:l,onOpen:a}){const{commit:o}=n,u=o.refs.map(g4).filter(Boolean);return y.jsxs("button",{className:"gitrow"+(l?" is-on":""),title:i?"Коммит ещё не отправлен на удалённый репозиторий":void 0,onClick:a,children:[y.jsx(h4,{row:n,columns:e,head:t,local:i}),y.jsxs("span",{className:"gitrow__body",children:[y.jsxs("span",{className:"gitrow__subject",children:[u.map(f=>y.jsx("span",{className:"gitrow__ref",children:f},f)),o.subject]}),y.jsxs("span",{className:"gitrow__meta",children:[o.shortHash," · ",o.author," · ",x4(o.date),i&&y.jsx("span",{className:"gitrow__local",children:"· не отправлен"})]})]})]})}function h4({row:n,columns:e,head:t,local:i}){const l=e*Xw+6,a=pu/2,o=d=>8+Math.min(d,Qy-1)*Xw,u=i?"3.5 2.5":void 0,f=Fh(n.col);return y.jsxs("svg",{className:"gitgraph",width:l,height:pu,viewBox:`0 0 ${l} ${pu}`,"aria-hidden":"true",children:[n.through.map(d=>y.jsx("line",{x1:o(d),y1:0,x2:o(d),y2:pu,style:{stroke:Fh(d)}},`t${d}`)),n.up.map((d,p)=>y.jsx("path",{d:`M${o(d.from)} 0 L${o(d.from)} ${a-12} L${o(d.to)} ${a}`,fill:"none",style:{stroke:Fh(d.from),strokeDasharray:u}},`u${p}`)),n.down.map((d,p)=>y.jsx("path",{d:`M${o(d.from)} ${a} L${o(d.to)} ${a+12} L${o(d.to)} ${pu}`,fill:"none",style:{stroke:Fh(d.to),strokeDasharray:u}},`d${p}`)),t&&y.jsx("circle",{className:"gitgraph__head",cx:o(n.col),cy:a,r:n.commit.parents.length>1?7.4:6.6}),y.jsx("circle",{className:"gitgraph__dot",cx:o(n.col),cy:a,r:n.commit.parents.length>1?4.6:3.6,style:{stroke:f,fill:i?void 0:f}})]})}function Fh(n){return`var(--lane-${n%Qy})`}function d4({detail:n,local:e,onCheckout:t,onClose:i}){const l=n.hash==="";return y.jsxs(js,{className:"modal--wide",title:l?"Незакоммиченные изменения":`Коммит ${n.shortHash}`,onClose:i,actions:y.jsxs(y.Fragment,{children:[!l&&y.jsx("button",{className:"btn",onClick:()=>t(n.hash,`коммит ${n.shortHash} (HEAD отделится от ветки)`),children:"Переключиться сюда"}),y.jsx("button",{className:"btn btn--primary",onClick:i,children:"Закрыть"})]}),children:[!l&&y.jsxs("div",{className:"commit__head",children:[y.jsx("p",{className:"commit__subject",children:n.subject}),y.jsxs("p",{className:"commit__meta",children:[n.author,n.email&&` <${n.email}>`," · ",v4(n.date)," ·"," ",y.jsx("span",{className:"commit__hash",children:n.hash})]}),e&&y.jsx("p",{className:"commit__meta commit__meta--local",children:"Не отправлен: этого коммита нет ни в одной удалённой ветке."}),n.parents.length>0&&y.jsxs("p",{className:"commit__meta",children:[n.parents.length>1?"слияние: ":"родитель: ",n.parents.map(a=>a.slice(0,8)).join(", ")]}),n.body&&y.jsx("pre",{className:"commit__body",children:n.body})]}),n.truncated&&y.jsx("p",{className:"modal__text",children:"Изменения слишком велики — часть патча не показана."}),n.files.length===0?y.jsx("p",{className:"modal__text",children:"Изменений нет."}):n.files.map(a=>y.jsx(p4,{file:a,defaultOpen:n.files.length<=3},a.path+a.oldPath))]})}function p4({file:n,defaultOpen:e}){const[t,i]=M.useState(e);return y.jsxs("div",{className:"commit__file",children:[y.jsxs("button",{className:"commit__filehead",onClick:()=>i(l=>!l),children:[y.jsx("span",{className:"commit__filepath",children:n.path||n.oldPath}),y.jsxs("span",{className:"diff__stat",children:[n.added>0&&y.jsxs("span",{className:"diff__stat--add",children:["+",n.added]}),n.removed>0&&y.jsxs("span",{className:"diff__stat--del",children:["−",n.removed]})]}),y.jsx("span",{className:"tool__status",children:t?"▴":"▾"})]}),t&&y.jsx(Ky,{diff:a4(n)})]})}function m4(){return y.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[y.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),y.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),y.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),y.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function g4(n){return n.replace(/^HEAD -> /,"").replace(/^tag: /,"⌂ ").trim()}function y4(n){const e=n.split("/");return e[e.length-1]??n}function b4(n){const e=n%100;if(e>=11&&e<=14)return"файлов";switch(n%10){case 1:return"файл";case 2:case 3:case 4:return"файла";default:return"файлов"}}function x4(n){const e=Date.parse(n);if(Number.isNaN(e))return n;const t=Math.round((Date.now()-e)/6e4);if(t<1)return"только что";if(t<60)return`${t} мин назад`;const i=Math.round(t/60);if(i<24)return`${i} ч назад`;const l=Math.round(i/24);return l<30?`${l} дн назад`:new Date(e).toLocaleDateString()}function v4(n){const e=Date.parse(n);return Number.isNaN(e)?n:new Date(e).toLocaleString()}function S4({open:n,items:e,busy:t,ready:i,commands:l,contextResult:a,models:o,model:u,effort:f,ultracode:d,thinking:p,switchOnFlag:b,onContextSearch:x,onCommand:S,onModel:w,onEffort:T,onUltracode:C,onThinking:E,onSwitchOnFlag:O,onAsk:B,onInterrupt:q,onReset:H,onClose:L}){return y.jsxs("aside",{className:n?"sidepane sidepane--ask sidepane--open":"sidepane sidepane--ask","aria-label":"Вопрос на полях",children:[y.jsxs("div",{className:"sidepane__head",children:[y.jsx(w4,{}),y.jsx("span",{className:"sidepane__title",children:"Вопрос на полях"}),y.jsx("button",{className:"sidepane__btn",title:"Начать заново — следующий вопрос возьмёт свежий контекст","aria-label":"Начать боковой разговор заново",disabled:e.length===0,onClick:H,children:"↻"}),y.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель вопроса",onClick:L,children:"✕"})]}),o.length>0&&y.jsxs("div",{className:"sidepane__tools",children:[y.jsx(ET,{className:"select--compact",models:o,value:u,effort:f,ultracode:d,thinking:p,switchOnFlag:b,onModel:w,onEffort:T,onUltracode:C,onThinking:E,onSwitchOnFlag:O}),y.jsx("span",{className:"sidepane__note",title:"Боковой вопрос работает только на чтение",children:"только чтение"})]}),y.jsx(Xy,{items:e,busy:t,waiting:!1,empty:i?"Спросите о том, что происходит: вопрос уйдёт в сторону от основного разговора и не попадёт в его контекст. Отвечающий видит сессию и проект, но ничего не меняет.":"Откройте сессию — вопрос задаётся о ней."}),y.jsx(TT,{className:"composer--side",disabled:!i,busy:t,commands:l,sessionTitle:null,contextResult:a,placeholder:"Спросить, не мешая работе…",sendLabel:"Спросить",autoFocus:n,onContextSearch:x,onCommand:S,onSend:B,onInterrupt:q,onEscape:t?q:L})]})}function w4(){return y.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M13.6 9.4a1.6 1.6 0 0 1-1.6 1.6H6.2L3.2 13.4V4.2a1.6 1.6 0 0 1 1.6-1.6h7.2a1.6 1.6 0 0 1 1.6 1.6Z"}),y.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}const k4=75,A4=90;function DT({usage:n}){if(!(n!=null&&n.available))return null;const e=[];return n.fiveHour&&e.push({key:"five",label:"5 ч",window:n.fiveHour}),n.sevenDay&&e.push({key:"week",label:"нед",window:n.sevenDay}),e.length===0?null:y.jsx("div",{className:"usage",title:_4(n),"aria-label":`Расход лимитов плана${n.plan?` ${n.plan}`:""}`,children:e.map(t=>y.jsx(C4,{label:t.label,window:t.window},t.key))})}function C4({label:n,window:e}){const t=Math.round(e.utilization),i=M4(e.resetsAt);return y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"usage__label",children:n}),y.jsx("span",{className:"usage__track",role:"progressbar","aria-label":n,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,children:y.jsx("span",{className:`usage__fill${T4(t)}`,style:{width:`${t}%`}})}),y.jsxs("span",{className:"usage__pct",children:[t,"%"]}),y.jsx("span",{className:"usage__reset",title:jT(e.resetsAt)||void 0,children:i&&`↻ ${i}`})]})}function T4(n){return n>=A4?" usage__fill--over":n>=k4?" usage__fill--warn":""}function _4(n){const e=[n.plan?`Лимиты плана ${n.plan}`:"Лимиты плана"],t=(i,l)=>{if(!l)return;const a=jT(l.resetsAt);e.push(`${i}: ${Math.round(l.utilization)}%${a?`, ${a}`:""}`)};return t("5 часов",n.fiveHour),t("Неделя",n.sevenDay),t("Неделя, Opus",n.sevenDayOpus),e.join(`
132
- `)}function OT(n){if(!n)return null;const e=new Date(n);return Number.isNaN(e.getTime())?null:e}function RT(n){return n.getTime()-Date.now()<1440*60*1e3}function M4(n){const e=OT(n);return e?RT(e)?e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(void 0,{day:"numeric",month:"short"}):""}function jT(n){const e=OT(n);return e?`обнулится ${RT(e)?`в ${e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:e.toLocaleDateString(void 0,{day:"numeric",month:"long"})}`:""}function LT(){const[n,e]=M.useState(()=>new Date);return M.useEffect(()=>{let t=0;const i=()=>{const a=new Date;e(a),t=window.setTimeout(i,6e4-(a.getSeconds()*1e3+a.getMilliseconds()))};i();const l=()=>{document.hidden||(window.clearTimeout(t),i())};return document.addEventListener("visibilitychange",l),()=>{window.clearTimeout(t),document.removeEventListener("visibilitychange",l)}},[]),y.jsxs("time",{className:"clock",dateTime:n.toISOString(),title:E4(n),children:[y.jsx("span",{className:"clock__time",children:n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),y.jsx("span",{className:"clock__date",children:n.toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})})]})}function E4(n){return n.toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"})}function N4({onClose:n,permission:e,model:t,usage:i,cwd:l,costLabel:a,onRename:o}){return y.jsx(js,{title:"Настройки сессии",className:"modal--sheet",sheet:!0,onClose:n,children:y.jsxs("div",{className:"sessionmenu",children:[e&&y.jsx(ko,{label:"Режим прав",children:e}),y.jsx(ko,{label:"Модель",children:t}),(i==null?void 0:i.available)&&(i.fiveHour||i.sevenDay)&&y.jsx(ko,{label:"Лимиты плана",children:y.jsx(DT,{usage:i})}),y.jsx(ko,{label:"Время",children:y.jsx(LT,{})}),a&&y.jsx(ko,{label:"Стоимость хода",children:y.jsx("span",{className:"badge badge--cost",children:a})}),l&&y.jsx(ko,{label:"Каталог проекта",children:y.jsx(MT,{path:l})}),o&&y.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:o,children:"Переименовать сессию"})]})})}function ko({label:n,children:e}){return y.jsxs("div",{className:"sessionmenu__row",children:[y.jsx("span",{className:"sessionmenu__label",children:n}),e]})}function D4({tab:n,servers:e,plugins:t,marketplaces:i,catalog:l,result:a,actions:o,onTab:u,onClose:f}){const d=[{id:"mcp",label:"MCP-серверы",count:e.length},{id:"plugins",label:"Плагины",count:t.length},{id:"catalog",label:"Каталог",count:l.length}];return y.jsxs(js,{title:"Расширения",className:"modal--wide",onClose:f,children:[y.jsx("div",{className:"tabs",role:"tablist",children:d.map(p=>y.jsxs("button",{role:"tab","aria-selected":n===p.id,className:n===p.id?"tabs__tab is-on":"tabs__tab",onClick:()=>u(p.id),children:[p.label,y.jsx("span",{className:"tabs__count",children:p.count})]},p.id))}),n==="mcp"&&y.jsx(O4,{servers:e,actions:o}),n==="plugins"&&y.jsx(z4,{plugins:t,marketplaces:i,actions:o}),n==="catalog"&&y.jsx(H4,{catalog:l,hasMarketplaces:i.length>0,actions:o,onMarketplaces:()=>u("plugins")}),y.jsx(Zu,{result:a})]})}function O4({servers:n,actions:e}){const[t,i]=M.useState(!1);return y.jsxs(y.Fragment,{children:[n.length===0&&!t&&y.jsxs("p",{className:"modal__text",children:["Ни одного MCP-сервера. Добавленный здесь попадёт в ",y.jsx("code",{children:".mcp.json"})," ","проекта — его увидит и консольный ",y.jsx("code",{children:"claude mcp list"}),"."]}),y.jsx("ul",{className:"extlist",children:n.map(l=>y.jsxs("li",{className:"extlist__row",children:[y.jsxs("div",{className:"extlist__head",children:[y.jsx("span",{className:"extlist__name",children:l.name}),y.jsx("span",{className:`chip chip--${j4(l.status)}`,children:R4[l.status]}),l.scope&&y.jsx("span",{className:"chip",children:l.scope}),l.transport&&y.jsx("span",{className:"chip",children:l.transport})]}),l.target&&y.jsx("div",{className:"extlist__meta",title:l.target,children:l.target}),l.error&&y.jsx("div",{className:"extlist__error",children:l.error}),l.tools.length>0&&y.jsxs("div",{className:"extlist__meta",children:["Инструментов: ",l.tools.length," · ",l.tools.slice(0,6).join(", "),l.tools.length>6&&"…"]}),y.jsxs("div",{className:"extlist__actions",children:[y.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>e.mcpAction(l.name,"reconnect"),children:"Переподключить"}),l.status==="disabled"?y.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>e.mcpAction(l.name,"enable"),children:"Включить"}):y.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>e.mcpAction(l.name,"disable"),children:"Выключить"}),l.editable&&y.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>e.mcpRemove(l.name),children:"Удалить"})]})]},l.name))}),t?y.jsx(L4,{onCancel:()=>i(!1),onSubmit:(l,a)=>{e.mcpAdd(l,a),i(!1)}}):y.jsx("div",{className:"extbar",children:y.jsx("button",{className:"btn btn--primary",onClick:()=>i(!0),children:"+ Сервер"})})]})}const R4={connected:"подключён",failed:"ошибка","needs-auth":"нужна авторизация",pending:"подключается",disabled:"выключен",unknown:"неизвестно"};function j4(n){return n==="connected"?"ok":n==="failed"?"bad":n==="needs-auth"?"warn":"mute"}function L4({onSubmit:n,onCancel:e}){const[t,i]=M.useState(""),[l,a]=M.useState("stdio"),[o,u]=M.useState(""),[f,d]=M.useState(""),[p,b]=M.useState(""),x=l==="stdio",S=t.trim()!==""&&(x?o.trim()!=="":f.trim()!=="");function w(){if(S)if(x){const[T,...C]=B4(o);n(t.trim(),{transport:"stdio",command:T??"",args:C,env:Qw(p)})}else n(t.trim(),{transport:l,url:f.trim(),headers:Qw(p)})}return y.jsxs("div",{className:"extform extform--card",children:[y.jsx("label",{className:"field",htmlFor:"mcp-name",children:"Имя сервера"}),y.jsx("input",{id:"mcp-name",className:"input input--mono",value:t,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"context7",onChange:T=>i(T.target.value)}),y.jsx("label",{className:"field",children:"Транспорт"}),y.jsx(nf,{title:"Транспорт",value:l,options:[{value:"stdio",label:"stdio",hint:"локальный процесс"},{value:"http",label:"http",hint:"удалённый сервер"},{value:"sse",label:"sse",hint:"удалённый, поток событий"}],onChange:T=>a(T)}),x?y.jsxs(y.Fragment,{children:[y.jsx("label",{className:"field",htmlFor:"mcp-command",children:"Команда с аргументами"}),y.jsx("input",{id:"mcp-command",className:"input input--mono",value:o,spellCheck:!1,autoComplete:"off",placeholder:"npx -y @upstash/context7-mcp",onChange:T=>u(T.target.value)})]}):y.jsxs(y.Fragment,{children:[y.jsx("label",{className:"field",htmlFor:"mcp-url",children:"URL"}),y.jsx("input",{id:"mcp-url",className:"input input--mono",value:f,spellCheck:!1,autoComplete:"off",placeholder:"https://mcp.example.dev/mcp",onChange:T=>d(T.target.value)})]}),y.jsxs("label",{className:"field",htmlFor:"mcp-pairs",children:[x?"Переменные окружения":"Заголовки"," — по одной на строку, необязательно"]}),y.jsx("textarea",{id:"mcp-pairs",className:"input input--mono input--area",value:p,spellCheck:!1,placeholder:x?"API_KEY=xxx":"Authorization: Bearer xxx",onChange:T=>b(T.target.value)}),y.jsxs("div",{className:"extbar",children:[y.jsx("button",{className:"btn",onClick:e,children:"Отмена"}),y.jsx("button",{className:"btn btn--primary",disabled:!S,onClick:w,children:"Подключить"})]})]})}function Qw(n){const e={};for(const t of n.split(`
133
- `)){const i=t.trim();if(!i)continue;const l=i.indexOf("="),a=i.indexOf(":"),o=l===-1?a:a===-1?l:Math.min(l,a);o<=0||(e[i.slice(0,o).trim()]=i.slice(o+1).trim())}return e}function B4(n){return(n.trim().match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(e=>e.replace(/^["']|["']$/g,""))}function z4({plugins:n,marketplaces:e,actions:t}){const[i,l]=M.useState("");return y.jsxs(y.Fragment,{children:[n.length===0&&y.jsx("p",{className:"modal__text",children:"Ни одного установленного плагина. Что можно поставить — на вкладке «Каталог»."}),y.jsx("ul",{className:"extlist",children:n.map(a=>y.jsxs("li",{className:"extlist__row",children:[y.jsxs("div",{className:"extlist__head",children:[y.jsx("span",{className:"extlist__name",children:a.name}),y.jsx("span",{className:a.enabled?"chip chip--ok":"chip chip--mute",children:a.enabled?"включён":"выключен"}),a.version&&a.version!=="unknown"&&y.jsx("span",{className:"chip",children:a.version}),a.scope&&y.jsx("span",{className:"chip",children:a.scope})]}),a.marketplace&&y.jsx("div",{className:"extlist__meta",children:a.marketplace}),a.mcpServers.length>0&&y.jsxs("div",{className:"extlist__meta",children:["MCP-серверы: ",a.mcpServers.join(", ")]}),y.jsxs("div",{className:"extlist__actions",children:[y.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>t.pluginToggle(a.id,!a.enabled),children:a.enabled?"Выключить":"Включить"}),y.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>t.pluginUninstall(a.id),children:"Удалить"})]})]},a.id))}),y.jsx("div",{className:"sidebar__section",children:"Маркетплейсы"}),y.jsx("ul",{className:"extlist",children:e.map(a=>y.jsxs("li",{className:"extlist__row",children:[y.jsx("div",{className:"extlist__head",children:y.jsx("span",{className:"extlist__name",children:a.name})}),a.source&&y.jsx("div",{className:"extlist__meta",children:a.source}),y.jsx("div",{className:"extlist__actions",children:y.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>t.marketplaceRemove(a.name),children:"Отключить"})})]},a.name))}),y.jsxs("div",{className:"extform__row",children:[y.jsx("input",{className:"input input--mono",value:i,spellCheck:!1,autoComplete:"off","aria-label":"Источник маркетплейса",placeholder:"owner/repo, URL или путь",onChange:a=>l(a.target.value),onKeyDown:a=>{a.key!=="Enter"||i.trim()===""||(a.preventDefault(),t.marketplaceAdd(i.trim()),l(""))}}),y.jsx("button",{className:"btn",disabled:i.trim()==="",onClick:()=>{t.marketplaceAdd(i.trim()),l("")},children:"Добавить"})]})]})}const mu=30;function H4({catalog:n,hasMarketplaces:e,actions:t,onMarketplaces:i}){const[l,a]=M.useState(""),[o,u]=M.useState(""),[f,d]=M.useState(mu),[p,b]=M.useState(""),x=M.useMemo(()=>[...new Set(n.map(T=>T.category).filter(Boolean))].sort(),[n]),S=M.useMemo(()=>{const w=l.trim().toLowerCase();return n.filter(T=>o&&T.category!==o?!1:w?`${T.name} ${T.displayName} ${T.description} ${T.author}`.toLowerCase().includes(w):!0)},[n,l,o]);return n.length===0?y.jsxs("p",{className:"modal__text",children:[e?"Маркетплейсы подключены, но их каталог ещё не выкачан. Попробуйте открыть окно ещё раз через минуту.":"Ни одного маркетплейса — ставить нечего."," ",y.jsx("button",{className:"linkish",onClick:i,children:"Подключить маркетплейс"})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"catalog__filters",children:[y.jsx("input",{className:"input",value:l,spellCheck:!1,autoComplete:"off","aria-label":"Поиск по каталогу",placeholder:"Поиск: имя, описание, автор",onChange:w=>{a(w.target.value),d(mu)}}),y.jsx(nf,{title:"Категория",value:o,options:[{value:"",label:"все категории"},...x.map(w=>({value:w,label:w}))],onChange:w=>{u(w),d(mu)}})]}),S.length===0?y.jsx("p",{className:"modal__text",children:"Ничего не нашлось."}):y.jsx("ul",{className:"extlist",children:S.slice(0,f).map(w=>y.jsxs("li",{className:"extlist__row",children:[y.jsxs("div",{className:"extlist__head",children:[y.jsx("span",{className:"extlist__name",children:w.name}),w.installed&&y.jsx("span",{className:"chip chip--ok",children:"установлен"}),w.version&&y.jsx("span",{className:"chip",children:w.version}),w.category&&y.jsx("span",{className:"chip",children:w.category})]}),w.description&&y.jsx("div",{className:"catalog__desc",children:w.description}),y.jsxs("div",{className:"extlist__meta",children:[w.author&&`${w.author} · `,w.marketplace]}),y.jsxs("div",{className:"extlist__actions",children:[y.jsx("button",{className:"btn btn--ghost btn--sm",disabled:w.installed,onClick:()=>t.pluginInstall(w.id),children:w.installed?"Уже стоит":"Установить"}),w.homepage&&y.jsx("a",{className:"btn btn--ghost btn--sm",href:w.homepage,target:"_blank",rel:"noreferrer",children:"Страница"})]})]},w.id))}),S.length>f&&y.jsx("div",{className:"extbar",children:y.jsxs("button",{className:"btn",onClick:()=>d(w=>w+mu),children:["Ещё ",Math.min(mu,S.length-f)," из ",S.length-f]})}),y.jsxs("div",{className:"extform",children:[y.jsx("label",{className:"field",htmlFor:"plugin-spec",children:"Или установить по имени — если нужного в каталоге нет"}),y.jsxs("div",{className:"extform__row",children:[y.jsx("input",{id:"plugin-spec",className:"input input--mono",value:p,spellCheck:!1,autoComplete:"off",placeholder:"имя или имя@маркетплейс",onChange:w=>b(w.target.value),onKeyDown:w=>{w.key!=="Enter"||p.trim()===""||(w.preventDefault(),t.pluginInstall(p.trim()),b(""))}}),y.jsx("button",{className:"btn",disabled:p.trim()==="",onClick:()=>{t.pluginInstall(p.trim()),b("")},children:"Установить"})]})]})]})}function I4({status:n,login:e,actions:t,onClose:i}){const[l,a]=M.useState(""),[o,u]=M.useState(!1),f=M.useMemo(()=>{if(e.error)return{ok:!1,message:e.error};const p=e.output.trim();return p===""?null:{ok:!0,message:p}},[e.error,e.output]);function d(){l.trim()!==""&&(t.submitCode(l.trim()),a(""))}return y.jsxs(js,{title:"Аккаунт",onClose:i,children:[n===null?y.jsx("p",{className:"modal__text",children:"Спрашиваем у хоста…"}):n.loggedIn?y.jsxs("div",{className:"account",children:[y.jsx("div",{className:"account__id",children:n.email||"Вход выполнен"}),y.jsxs("div",{className:"account__chips",children:[y.jsx("span",{className:"chip chip--ok",children:U4[n.method]??n.method}),n.plan&&y.jsx("span",{className:"chip",children:n.plan})]}),n.organization&&y.jsx("div",{className:"extlist__meta",children:n.organization})]}):y.jsxs("p",{className:"modal__text",children:["Вход не выполнен. Сессии не запустятся, пока аккаунт не подключён — или пока в окружении хоста нет ",y.jsx("code",{children:"ANTHROPIC_API_KEY"}),"."]}),e.active?y.jsx(V4,{login:e,code:l,onCode:a,onSubmit:d,onCancel:t.cancel}):y.jsxs(y.Fragment,{children:[y.jsx(Zu,{result:f}),y.jsx("div",{className:"extbar",children:n!=null&&n.loggedIn?y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:()=>t.login("claudeai",!0),children:"Сменить аккаунт"}),o?y.jsx("button",{className:"btn btn--danger",autoFocus:!0,onClick:()=>{u(!1),t.logout()},children:"Точно выйти?"}):y.jsx("button",{className:"btn",onClick:()=>u(!0),children:"Выйти"})]}):y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:()=>t.login("console",!1),children:"Через Console"}),y.jsx("button",{className:"btn btn--primary",onClick:()=>t.login("claudeai",!1),children:"Войти"})]})})]})]})}const U4={"claude.ai":"подписка Claude",console:"Anthropic Console",apiKey:"API-ключ",none:"нет"};function V4({login:n,code:e,onCode:t,onSubmit:i,onCancel:l}){return y.jsxs("div",{className:"account__flow",children:[n.url?y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"field",children:"Откройте ссылку и подтвердите вход"}),y.jsx("a",{className:"account__link",href:n.url,target:"_blank",rel:"noreferrer",children:n.url})]}):y.jsx("p",{className:"modal__text",children:"Запускаем вход…"}),n.awaitingCode&&y.jsxs(y.Fragment,{children:[y.jsx("label",{className:"field",htmlFor:"auth-code",children:"Код со страницы авторизации"}),y.jsxs("div",{className:"extform__row",children:[y.jsx("input",{id:"auth-code",className:"input input--mono",value:e,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"вставьте код",onChange:a=>t(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),i())}}),y.jsx("button",{className:"btn btn--primary",disabled:e.trim()==="",onClick:i,children:"Готово"})]})]}),n.output.trim()!==""&&y.jsx("pre",{className:"account__log",children:n.output.trim()}),y.jsx("div",{className:"extbar",children:y.jsx("button",{className:"btn",onClick:l,children:"Отменить вход"})})]})}function q4({state:n,onPair:e,onUnpair:t,onClose:i}){const[l,a]=M.useState(""),[o,u]=M.useState(""),[f,d]=M.useState(!1),p=M.useRef(null),b=(n==null?void 0:n.paired)===!0;M.useEffect(()=>{var S;b||(S=p.current)==null||S.focus()},[b]),M.useEffect(()=>{d(!1),b&&a("")},[b,n==null?void 0:n.error]);const x=(n==null?void 0:n.url)??"https://claudevisual.com";return y.jsx(js,{title:"Удалённый доступ",onClose:i,children:b?y.jsxs("div",{className:"relay",children:[y.jsxs("p",{className:"relay__lede",children:["Компьютер связан с аккаунтом на ",y.jsx("b",{children:Zw(x)}),". Открывайте его оттуда с любого устройства — с телефона в том числе."]}),y.jsxs("dl",{className:"relay__facts",children:[y.jsxs("div",{children:[y.jsx("dt",{children:"Имя"}),y.jsx("dd",{children:(n==null?void 0:n.name)??"—"})]}),y.jsxs("div",{children:[y.jsx("dt",{children:"Связь"}),y.jsxs("dd",{children:[y.jsx("span",{className:n!=null&&n.connected?"dot dot--on":"dot"})," ",n!=null&&n.connected?"на связи":"нет связи, пробуем переподключиться"]})]}),y.jsxs("div",{children:[y.jsx("dt",{children:"Подключено"}),y.jsxs("dd",{children:[(n==null?void 0:n.clients)??0," вкладок"]})]})]}),(n==null?void 0:n.error)&&y.jsx("p",{className:"relay__error",children:n.error}),y.jsx("p",{className:"relay__note",children:"Отвязка гасит токен этой машины: чтобы вернуть доступ, понадобится новый код. Сессии Claude Code это не трогает."}),y.jsx("button",{className:"btn btn--danger",onClick:t,children:"Отвязать компьютер"})]}):y.jsxs("div",{className:"relay",children:[y.jsx("p",{className:"relay__lede",children:"Чтобы работать с этим компьютером из браузера и с телефона, свяжите его с аккаунтом."}),y.jsxs("ol",{className:"relay__steps",children:[y.jsxs("li",{children:["Откройте ",y.jsx("b",{children:Zw(x)})," и войдите (или зарегистрируйтесь)."]}),y.jsxs("li",{children:["Нажмите ",y.jsx("b",{children:"«Подключить ПК»"})," — появится код из восьми знаков."]}),y.jsx("li",{children:"Введите его сюда."})]}),y.jsxs("form",{className:"relay__form",onSubmit:S=>{S.preventDefault(),l.trim()&&(d(!0),e(l.trim(),o.trim()))},children:[y.jsxs("label",{className:"field",children:[y.jsx("span",{children:"Код сопряжения"}),y.jsx("input",{ref:p,className:"input relay__code",value:l,onChange:S=>a(S.target.value.toUpperCase()),placeholder:"XXXX-XXXX",autoComplete:"off",spellCheck:!1,maxLength:12})]}),y.jsxs("label",{className:"field",children:[y.jsx("span",{children:"Как назвать этот компьютер"}),y.jsx("input",{className:"input",value:o,onChange:S=>u(S.target.value),placeholder:"имя машины",autoComplete:"off",maxLength:64})]}),(n==null?void 0:n.error)&&y.jsx("p",{className:"relay__error",children:n.error}),y.jsx("button",{className:"btn btn--primary",type:"submit",disabled:!l.trim()||f,children:f?"Связываем…":"Связать"})]})]})})}function Zw(n){try{return new URL(n).host}catch{return n}}const Wh=3600*1e3,G4=[{value:"6h",label:"6 часов"},{value:"24h",label:"Сутки"},{value:"48h",label:"Двое суток"},{value:"168h",label:"Неделя"},{value:"never",label:"Никогда"}],Oo={"6h":6*Wh,"24h":24*Wh,"48h":48*Wh,"168h":168*Wh,never:0};function P4(n){return Oo[n]??Oo["48h"]}function Y4(n){const e=Object.entries(Oo).find(([,t])=>t===n);return e?e[0]:Object.keys(Oo).reduce((t,i)=>Math.abs(Oo[i]-n)<Math.abs(Oo[t]-n)?i:t)}const F4=[{value:"project",title:"Только текущий проект",description:"Агент молча пишет файлы в открытом проекте и в ~/.claude — настройках самого Claude Code. Чужой проект и любая новая папка — только с явного разрешения."},{value:"projects",title:"Папка с проектами",description:"То же плюс каталог, где лежат открытые проекты, — то есть и соседний проект тоже. Всё остальное — с разрешения."},{value:"all",title:"Все папки на компьютере",description:"Агент пишет файлы куда угодно на диске — вопросов про место записи не будет.",risky:!0}];function W4({settings:n,onChange:e,onClose:t}){const i=n===null;return y.jsx(js,{title:"Настройки",onClose:t,children:y.jsxs("div",{className:"settings",children:[y.jsxs("section",{className:"settings__section",children:[y.jsx("h3",{className:"settings__heading",children:"Архивация молчащих сессий"}),y.jsx("p",{className:"settings__hint",children:"Сессия, к которой долго не возвращались, сама уезжает в архив — на диске ничего не удаляется, транскрипт остаётся, и её можно вернуть обратно в любой момент."}),i?y.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):y.jsx(nf,{className:"settings__select",value:Y4(n.autoArchiveAfterMs),options:G4,onChange:l=>e({autoArchiveAfterMs:P4(l)}),ariaLabel:"Через сколько молчащая сессия уезжает в архив"})]}),y.jsxs("section",{className:"settings__section",children:[y.jsx("h3",{className:"settings__heading",children:"Доступ к папкам"}),y.jsx("p",{className:"settings__hint",children:"Это про то, где агент пишет файлы (Write, Edit, NotebookEdit), не спрашивая разрешения, — не про чтение: читает он в любом случае. Ничего не запрещается наглухо — выход за выбранную границу просто превращается в обычный запрос прав, который остаётся подтвердить или отклонить."}),y.jsx("div",{className:"access",role:"radiogroup","aria-label":"Доступ к папкам",children:F4.map(l=>{const a=!i&&n.folderAccess===l.value;return y.jsxs("button",{type:"button",role:"radio","aria-checked":a,disabled:i,className:"access__card"+(a?" is-on":"")+(l.risky?" access__card--risky":""),onClick:()=>e({folderAccess:l.value}),children:[y.jsx("span",{className:"access__radio","aria-hidden":"true"}),y.jsxs("span",{className:"access__body",children:[y.jsxs("span",{className:"access__title",children:[l.title,l.risky&&y.jsx("span",{className:"access__risk",children:"самое широкое"})]}),y.jsx("span",{className:"access__desc",children:l.description})]})]},l.value)})})]})]})})}const $4=16;function K4({pane:n,width:e,onResize:t,onReset:i}){const l=Ea[n],a=M.useRef(null);function o(p){if(p.button!==0)return;const b=document.querySelector(".main"),x=b?Math.max(0,b.getBoundingClientRect().width-D2):0;a.current={x:p.clientX,width:e,max:Math.min(l.max,e+x)},p.currentTarget.setPointerCapture(p.pointerId),document.body.classList.add("is-resizing"),p.preventDefault()}function u(p){const b=a.current;if(!b)return;const x=l.side==="left"?p.clientX-b.x:b.x-p.clientX;t(Math.min(b.max,b.width+x))}function f(p){a.current&&(a.current=null,p.currentTarget.hasPointerCapture(p.pointerId)&&p.currentTarget.releasePointerCapture(p.pointerId),document.body.classList.remove("is-resizing"))}function d(p){const b=p.key==="ArrowRight"?1:p.key==="ArrowLeft"?-1:0;b!==0&&(p.preventDefault(),t(e+b*$4*(l.side==="left"?1:-1)))}return y.jsx("div",{className:`pane-resizer pane-resizer--${n} pane-resizer--${l.side}`,role:"separator","aria-orientation":"vertical","aria-label":`Ширина панели ${l.label}`,"aria-valuenow":e,"aria-valuemin":l.min,"aria-valuemax":l.max,tabIndex:0,title:"Потяните, чтобы изменить ширину; двойной щелчок — ширина по умолчанию",onPointerDown:o,onPointerMove:u,onPointerUp:f,onPointerCancel:f,onDoubleClick:i,onKeyDown:d,children:y.jsx("span",{className:"pane-resizer__line","aria-hidden":"true"})})}const X4=[{value:"default",hint:"спрашивать перед каждым действием"},{value:"acceptEdits",hint:"правки файлов без подтверждения"},{value:"plan",hint:"только чтение и план, без изменений"},{value:"auto",hint:"спрашивать только о рискованном — решает сам"},{value:"bypassPermissions",hint:"ничего не спрашивать"}],Q4={mcp:"mcp",plugins:"plugins",plugin:"plugins"},Jw=[{name:"login",description:"Войти в аккаунт Claude — окно приложения",argumentHint:"",aliases:["signin","вход"]},{name:"switch-account",description:"Сменить аккаунт: выйти и войти заново",argumentHint:"",aliases:["account","аккаунт"]},{name:"logout",description:"Выйти из аккаунта Claude",argumentHint:"",aliases:["signout","выход"]}],Z4={active:!1,url:"",awaitingCode:!1,output:"",error:null};function ek(n,e,t){if(n===null)return null;const i=n.lastIndexOf("/");if(i===-1&&n!=="")return e;const l=t[i===-1?"":n.slice(0,i)];if(!l)return null;const a=n.slice(i+1).toLowerCase();return a===""?{query:n,entries:l}:{query:n,entries:l.filter(o=>o.name.toLowerCase().includes(a)).sort((o,u)=>tk(o.name,a)-tk(u.name,a))}}function tk(n,e){return n.toLowerCase().startsWith(e)?0:1}function nk(n,e){const t=n.find(l=>l.value===e)??n.find(l=>l.resolvedModel===e),i=e&&!t?e:null;return{rows:[...i?[{value:i,resolvedModel:i,displayName:i,description:"задана в настройках",supportsEffort:!1,effortLevels:[],supportsThinking:!0,supportsAutoMode:!1}]:[],...n],selected:(t==null?void 0:t.value)??i??(n.some(l=>l.value==="default")?"default":"")}}function J4(){const n=M.useRef(null),[e,t]=M.useState(!1),[i,l]=M.useState("Нет связи с хостом"),[a,o]=M.useState(null),[u,f]=M.useState(!1),d=M.useMemo(()=>ck()==="relay",[]),[p,b]=M.useState([]),[x,S]=M.useState([]),[w,T]=M.useState([]),[C,E]=M.useState(null),[O,B]=M.useState(null),[q,H]=M.useState(null),[L,j]=M.useState(Gi),[se,he]=M.useState(!1),[Me,ue]=M.useState(!1),le=L2("(max-width: 860px)"),[Ee,ve]=M.useState(!1);M.useEffect(()=>{le||ve(!1)},[le]);const[ke,I]=M.useState(!1),[Z,ee]=M.useState([]),[Ne,_e]=M.useState(!1),[N,F]=M.useState(Gi),[J,oe]=M.useState(null),[de,Se]=M.useState(null),[Ie,pt]=M.useState([]),[$e,It]=M.useState(null),[Ze,Kt]=M.useState(null),[at,we]=M.useState([]),[xe,Ft]=M.useState([]),[xn,Ve]=M.useState([]),[Rn,si]=M.useState([]),[ce,qe]=M.useState(null),[St,Fe]=M.useState(!1),[$,fe]=M.useState(null),[ze,Je]=M.useState(null),[vn,$n]=M.useState(!1),[Wl,$l]=M.useState(Z4),[hs,Sn]=M.useState(null),[Ei,,mn]=E2(),Hs=j2(),[Kn,wn]=M.useState(!1),[Xt,Is]=M.useState(null),[ds,Xn]=M.useState(null),[ml,li]=M.useState(null),[Kl,jn]=M.useState(null),[ri,mi]=M.useState(null),[Ln,Us]=M.useState(!1),[Ni,$i]=M.useState({}),[ps,Ki]=M.useState([""]),[Vs,kn]=M.useState([]),[ai,Nt]=M.useState(null),[Xe,en]=M.useState(null),[ms,gl]=M.useState(null),[gs,qs]=M.useState(null),[Gs,yl]=M.useState(null),[Di,ys]=M.useState({}),[Xi,An]=M.useState({}),[wt,Qn]=M.useState(!1),[Ha,oi]=M.useState(null),[Oi,Xl]=M.useState(null),Ql=M.useRef(0),Qi=M.useRef(null),[bs,Ri]=M.useState(!1),[gi,rn]=M.useState(null),[Bt,bl]=M.useState(Gi),[ji,xs]=M.useState(null),[vs,yi]=M.useState({}),Ps=M.useRef([]),Dt=M.useRef(null),Cn=M.useRef(null),Zl=M.useRef(0);Dt.current=O,Cn.current=C,Zl.current=L.lastSeq;const Tn=M.useRef(null),Li=M.useRef(0);Li.current=Bt.lastSeq;const ae=M.useRef(null),_=M.useRef(""),U=M.useRef(null),ie=M.useRef([]),Ae=M.useRef([""]);ie.current=Vs,Ae.current=ps;const Oe=M.useRef(new Map),je=M.useRef(new Set),xt=M.useRef(null),Gt=M.useRef(null),gn=M.useRef(0);M.useEffect(()=>{const k=_2();if(!k)return;n.current=k;const ne=()=>{t(k.connected),l(k.statusText)};k.onStatus(ne),k.onReconnect(()=>{ne();const _n=Dt.current;_n&&k.send({type:"session.sync",sessionId:_n,sinceSeq:Zl.current});const Be=Tn.current;Be&&k.send({type:"session.sync",sessionId:Be,sinceSeq:Li.current})});const Te=k.on(_n=>zt(_n));k.connect();const Qe=window.setInterval(()=>{ne(),k.connected&&k.send({type:"ping",nonce:Date.now()})},15e3);return()=>{Te(),window.clearInterval(Qe),k.close()}},[]);const zt=M.useCallback(k=>{var ne,Te,Qe,_n;switch(k.type){case"hello.ok":t(!0);break;case"workspace.list":{b(k.workspaces),E(et=>{var Wt;return et??((Wt=k.workspaces[0])==null?void 0:Wt.id)??null});const Be=U.current;if(!Be)break;const Pe=k.workspaces.find(et=>iz(et.path,Be));if(!Pe)break;U.current=null,I(!1),E(Pe.id);break}case"workspace.candidates":if(k.query.trim()!==_.current)break;ee(k.candidates),k.source==="host"&&_e(!1);break;case"finder.opened":ae.current=k.sessionId;break;case"workspace.roots":pt(k.roots);break;case"workspace.created":if(E(k.workspace.id),k.warnings.length===0){I(!1),Se(null);break}It({path:k.workspace.path,warnings:k.warnings});break;case"session.list":if(k.workspaceId!==Cn.current)break;S(k.sessions),T(k.archived);break;case"session.summary":if(k.session.id===ae.current){oe(k.session);break}if(k.session.parentSessionId){k.session.id===Tn.current&&xs(k.session);break}S(Be=>{const Pe=Be.findIndex(Wt=>Wt.id===k.session.id);if(Pe===-1)return[k.session,...Be];const et=Be.slice();return et[Pe]=k.session,et}),B(Be=>Be??k.session.id);break;case"usage.state":k.sessionId===Dt.current&&Sn(k.usage);break;case"session.capabilities":k.sessionId===Dt.current&&H(k.capabilities);break;case"session.events":if(k.sessionId===Tn.current){bl(Be=>ug(Be,k.entries));break}if(k.sessionId===ae.current){F(Be=>ug(Be,k.entries));break}if(k.sessionId!==Dt.current)break;j(Be=>ug(Be,k.entries));break;case"side.opened":{if(k.parentSessionId!==Dt.current)break;Tn.current=k.sessionId,rn(k.sessionId);const Be=Ps.current;Ps.current=[];for(const Pe of Be)Pe(k.sessionId);break}case"side.closed":if(k.parentSessionId!==Dt.current)break;Tn.current=null,rn(null),bl(Gi),xs(null);break;case"git.state":if(k.workspaceId!==Cn.current)break;Is(k.state);break;case"git.commit":if(k.workspaceId!==Cn.current)break;Xn(k.detail);break;case"git.result":if(k.workspaceId!==Cn.current)break;jn({ok:k.ok,message:k.message}),k.ok&&(Xn(null),li(null));break;case"fs.dir":if(k.workspaceId!==Cn.current)break;$i(Be=>({...Be,[k.path]:k.entries}));break;case"fs.search":if(k.workspaceId!==Cn.current)break;if(k.scope!=="tree"){const Be=k.scope;An(Pe=>({...Pe,[Be]:{query:k.query,entries:k.entries}}));break}yl({query:k.query,entries:k.entries,truncated:k.truncated});break;case"fs.grep":if(k.workspaceId!==Cn.current)break;oi({query:k.query,matches:k.matches,truncated:k.truncated});break;case"fs.file":{if(k.workspaceId!==Cn.current)break;const Be=je.current.delete(k.file.path);kn(et=>{const Wt=et.findIndex(wc=>wc.path===k.file.path);if(Wt===-1)return[...et,dw(k.file,++gn.current)];const ci=et[Wt],Zr=et.slice();return Zr[Wt]=ci.saved===k.file.content&&!Nr(ci)?{...ci,mtime:k.file.mtime,size:k.file.size,stale:!1}:dw(k.file,++gn.current),Zr}),Be&&Nt(k.file.path);const Pe=Qi.current;Pe&&Pe.path===k.file.path&&(Qi.current=null,Xl({...Pe,token:++Ql.current}));break}case"fs.saved":{if(k.workspaceId!==Cn.current)break;const Be=Oe.current.get(k.path);Oe.current.delete(k.path);const Pe=Be!==void 0;kn(Wt=>Wt.map(ci=>ci.path!==k.path?ci:Pe?{...ci,saved:Be,mtime:k.mtime,size:k.size,stale:!1}:{...ci,stale:!0}));const et=ie.current.find(Wt=>Wt.path===k.path);!Pe&&et&&!Nr(et)&&((ne=n.current)==null||ne.send({type:"fs.read",workspaceId:k.workspaceId,path:k.path})),(Te=n.current)==null||Te.send({type:"git.state",workspaceId:k.workspaceId});break}case"fs.result":{if(k.workspaceId!==Cn.current)break;if(en({ok:k.ok,message:k.message}),k.ok||Oe.current.delete(k.path),k.conflict&&kn(Pe=>Pe.map(et=>et.path===k.path?{...et,stale:!0}:et)),Gt.current===k.path){const Pe=Gt.current;Gt.current=null,k.ok&&(je.current.add(Pe),(Qe=n.current)==null||Qe.send({type:"fs.read",workspaceId:k.workspaceId,path:Pe}))}const Be=xt.current;if(k.ok&&Be&&Be.to===k.path){xt.current=null;const Pe=et=>et===Be.from?Be.to:et.startsWith(`${Be.from}/`)?Be.to+et.slice(Be.from.length):et;kn(et=>et.map(Wt=>({...Wt,path:Pe(Wt.path)}))),Nt(et=>et===null?null:Pe(et)),Ki(et=>et.map(Pe)),$i(et=>{const Wt={};for(const[ci,Zr]of Object.entries(et))ci===Be.from||ci.startsWith(`${Be.from}/`)||(Wt[ci]=Zr);return Wt})}k.ok&&((_n=n.current)==null||_n.send({type:"git.state",workspaceId:k.workspaceId}));break}case"mcp.list":k.sessionId===Dt.current&&we(k.servers);break;case"plugin.list":if(k.sessionId!==Dt.current)break;Ft(k.plugins),Ve(k.marketplaces),si(k.catalog);break;case"operation.result":k.sessionId===Dt.current&&qe(k.result);break;case"auth.status":fe(k.status);break;case"relay.state":o(k.state);break;case"settings.state":Je(k.settings);break;case"auth.login":$l(k.state),k.state.active&&Fe(!0);break;case"session.closed":S(Be=>Be.map(Pe=>Pe.id===k.sessionId?{...Pe,state:"closed"}:Pe));break;case"error":console.error("[host]",k.message,k.context??""),(k.context==="workspace.open"||k.context==="workspace.create")&&(U.current=null,Se(k.message));break}},[]),re=M.useCallback(k=>{var ne;(ne=n.current)==null||ne.send(k)},[]);M.useEffect(()=>{C&&re({type:"session.list",workspaceId:C})},[C,re]),M.useEffect(()=>{ke&&re({type:"workspace.roots"})},[ke,re]),M.useEffect(()=>{O&&re({type:"usage.get",sessionId:O})},[O,re]);const pe=M.useMemo(()=>x.find(k=>k.id===O)??null,[x,O]);function Jl(k){U.current=k,Se(null),re({type:"workspace.open",path:k})}function er(k,ne,Te){Se(null),re({type:"workspace.create",parent:k,name:ne,init:Te})}function sf(k){if(_.current=k,!k){ee([]),_e(!1);return}_e(!0),re({type:"workspace.find",query:k})}function cc(k){_.current=k,F(Gi),re({type:"workspace.find.agent",query:k})}function lf(){I(!1),Se(null),It(null),ee([]),F(Gi),oe(null),_.current="",U.current=null}function Ss(){const k=Dt.current;k&&Tn.current&&re({type:"side.reset",sessionId:k}),Tn.current=null,rn(null),bl(Gi),xs(null),yi({}),Ps.current=[]}function ws(k){re({type:"workspace.close",workspaceIds:k}),!(!C||!k.includes(C))&&(Ss(),E(null),B(null),S([]),T([]),j(Gi),H(null),ue(!1))}function uc(k){!C||(re({type:"session.archive",workspaceId:C,sessionIds:k}),!(O&&(k.includes(O)||(pe==null?void 0:pe.claudeSessionId)&&k.includes(pe.claudeSessionId))))||(Ss(),B(null),j(Gi),H(null),ue(!1))}function Fr(){C&&(Ss(),B(null),H(null),j(Gi),ue(!1),re({type:"session.start",workspaceId:C}),he(!1))}function Ys(k){if(he(!1),Ss(),j(Gi),H(null),ue(!1),k.state==="closed"){B(null),re({type:"session.start",workspaceId:k.workspaceId,resume:k.id});return}B(k.id),re({type:"session.sync",sessionId:k.id,sinceSeq:0})}function Ia(k,ne){re({type:"session.rename",sessionId:k.id,title:ne,workspaceId:k.workspaceId}),S(Te=>Te.map(Qe=>Qe.id===k.id?{...Qe,title:ne}:Qe))}function Wr(k){O&&(he(!1),qe(null),Kt(k),re({type:"mcp.list",sessionId:O}),re({type:"plugin.list",sessionId:O}))}const rf={mcpAction:(k,ne)=>{O&&(re({type:"mcp.action",sessionId:O,name:k,action:ne}),Kt(null))},mcpAdd:(k,ne)=>{O&&re({type:"mcp.add",sessionId:O,name:k,draft:ne})},mcpRemove:k=>{O&&re({type:"mcp.remove",sessionId:O,name:k})},pluginInstall:k=>{O&&re({type:"plugin.install",sessionId:O,spec:k})},pluginUninstall:k=>{O&&re({type:"plugin.uninstall",sessionId:O,id:k})},pluginToggle:(k,ne)=>{O&&re({type:"plugin.toggle",sessionId:O,id:k,enabled:ne})},marketplaceAdd:k=>{O&&re({type:"marketplace.add",sessionId:O,source:k})},marketplaceRemove:k=>{O&&re({type:"marketplace.remove",sessionId:O,name:k})}};function $r(){he(!1),Fe(!0),re({type:"auth.status"})}const tr={login:(k,ne)=>re({type:"auth.login",mode:k,switchAccount:ne}),submitCode:k=>re({type:"auth.code",code:k}),cancel:()=>re({type:"auth.cancel"}),logout:()=>re({type:"auth.logout"})};function af(){he(!1),$n(!0),re({type:"settings.get"})}function Zn(k){Je(ne=>ne&&{...ne,...k}),re({type:"settings.update",settings:k})}function xl(k){O&&re({type:"side.ask",sessionId:O,text:k})}function Ua(){O&&(re({type:"side.reset",sessionId:O}),Tn.current=null,rn(null),bl(Gi),xs(null),yi({}),Ps.current=[])}function ks(k){const ne=Tn.current;if(ne){k(ne);return}const Te=Dt.current;Te&&(Ps.current.push(k),re({type:"side.open",sessionId:Te}))}function of(){C&&re({type:"git.state",workspaceId:C})}function fc(k){C&&(li(k),re({type:"git.show",workspaceId:C,ref:k}))}function Va(k,ne){jn(null),mi({target:k,label:ne})}function Kr(){!C||!ri||(re({type:"git.checkout",workspaceId:C,target:ri.target}),mi(null))}M.useEffect(()=>{if(!(!Ln||!C))for(const k of ps)k in Ni||re({type:"fs.list",workspaceId:C,path:k})},[Ln,ps,Ni,C,re]);function qa(k){Ki(ne=>ne.includes(k)?ne.filter(Te=>Te!==k):[...ne,k])}function cf(k){if(!k){yl(null);return}C&&re({type:"fs.search",workspaceId:C,query:k})}function ep(k){if(!k){oi(null);return}C&&re({type:"fs.grep",workspaceId:C,query:k})}const uf=M.useCallback((k,ne)=>{ys(_n=>({..._n,[k]:ne}));const Te=Cn.current;if(ne===null||!Te)return;const Qe=ne.lastIndexOf("/");if(Qe!==-1){re({type:"fs.list",workspaceId:Te,path:ne.slice(0,Qe)});return}if(ne===""){re({type:"fs.list",workspaceId:Te,path:""});return}re({type:"fs.search",workspaceId:Te,query:ne,scope:k})},[re]),tp=M.useMemo(()=>ek(Di.mention??null,Xi.mention??null,Ni),[Di.mention,Xi.mention,Ni]),hc=M.useMemo(()=>ek(Di.side??null,Xi.side??null,Ni),[Di.side,Xi.side,Ni]);function np(k){dc(k.path,{line:k.line,column:k.column})}function ip(k){const ne=[];let Te=Ho(k.path);for(;ne.push(Te),!!Te;)Te=Ho(Te);Ki(Qe=>{const _n=new Set(Qe);for(const Be of ne)_n.add(Be);return k.kind==="dir"&&_n.add(k.path),[..._n]}),k.kind==="file"&&dc(k.path)}function dc(k,ne){if(ie.current.find(Qe=>Qe.path===k)){Nt(k),ne&&Xl({path:k,...ne,token:++Ql.current});return}C&&(ne&&(Qi.current={path:k,...ne}),je.current.add(k),re({type:"fs.read",workspaceId:C,path:k}))}function pc(k,ne=!1){const Te=ie.current,Qe=Te.find(Pe=>Pe.path===k);if(Qe&&Nr(Qe)&&!ne){qs(k);return}qs(null);const _n=Te.findIndex(Pe=>Pe.path===k),Be=Te.filter(Pe=>Pe.path!==k);kn(Be),Nt(Pe=>{var et;return Pe===k?((et=Be[Math.min(_n,Be.length-1)])==null?void 0:et.path)??null:Pe})}function mc(k,ne=!1){const Te=ie.current.find(Qe=>Qe.path===k);!Te||!C||!ne&&!Nr(Te)||(Oe.current.set(k,Te.text),re({type:"fs.write",workspaceId:C,path:k,content:Te.text,eol:Te.eol,baseMtime:Te.mtime,...ne?{force:!0}:{}}))}function ff(k){C&&re({type:"fs.read",workspaceId:C,path:k})}function sp(k,ne,Te){if(!C)return;const Qe=k?`${k}/${Te}`:Te;en(null),ne==="file"&&(Gt.current=Qe),re({type:"fs.create",workspaceId:C,path:Qe,kind:ne})}function lp(k,ne){if(!C)return;const Te=Ho(k),Qe=Te?`${Te}/${ne}`:ne;en(null),xt.current={from:k,to:Qe},re({type:"fs.rename",workspaceId:C,path:k,to:Qe})}function rp(k,ne){if(!C)return;const Te=k.slice(k.lastIndexOf("/")+1),Qe=ne?`${ne}/${Te}`:Te;Qe!==k&&(en(null),xt.current={from:k,to:Qe},re({type:"fs.rename",workspaceId:C,path:k,to:Qe}))}function ap(k){C&&(en(null),gl(null),re({type:"fs.delete",workspaceId:C,path:k.path}),kn(ne=>ne.filter(Te=>Te.path!==k.path&&!Te.path.startsWith(`${k.path}/`))),Nt(ne=>ne&&(ne===k.path||ne.startsWith(`${k.path}/`))?null:ne))}function gc(){$i({}),Ki([""]),kn([]),Nt(null),en(null),yl(null),oi(null),ys({}),An({}),Xl(null),je.current.clear(),Oe.current.clear(),Qi.current=null,xt.current=null,Gt.current=null}function op(k,ne){O&&re({type:"permission.respond",sessionId:O,requestId:k,decision:ne})}M.useEffect(()=>{function k(ne){if(ne.key!=="Escape"||!O||L.pending.length>0)return;const Te=ne.target;Te instanceof HTMLElement&&Te.closest(".sidepane, .editor")||re({type:"control.interrupt",sessionId:O})}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[O,L.pending.length,re]);const hf=M.useMemo(()=>{const k=(q==null?void 0:q.commands)??[];return k.length===0?k:[...k,{name:"plugins",description:"Плагины и маркетплейсы — окно приложения",argumentHint:"",aliases:["plugin"]},...Jw]},[q]);function df(k){const ne=Q4[k];return ne?(Wr(ne),!0):Jw.some(Te=>Te.name===k)?($r(),k==="logout"&&tr.logout(),k==="switch-account"&&tr.login("claudeai",!0),!0):!1}const Xr=(pe==null?void 0:pe.state)==="waiting_permission",As=(pe==null?void 0:pe.state)==="running"||Xr,pf=L.pending[0]??null;M.useEffect(()=>{!Kn&&!Ln||!C||As||re({type:"git.state",workspaceId:C})},[Kn,Ln,C,As,re]),M.useEffect(()=>{if(!(As||!C)){Ln&&$i(k=>{const ne={};for(const[Te,Qe]of Object.entries(k))Ae.current.includes(Te)||(ne[Te]=Qe);return ne});for(const k of ie.current)Nr(k)||re({type:"fs.read",workspaceId:C,path:k.path})}},[As,C,Ln,re]);const yc=(pe==null?void 0:pe.cwd)??(q==null?void 0:q.cwd)??null,mf=(q==null?void 0:q.models)??[],Ga=(pe==null?void 0:pe.model)??(q==null?void 0:q.model)??null,{rows:gf,selected:cp}=nk(mf,Ga),Qr=ji?{model:ji.model,effort:ji.effort,ultracode:ji.ultracode,thinking:ji.thinking,switchOnFlag:ji.switchModelsOnFlag}:{model:vs.model??Ga,effort:vs.effort??(pe==null?void 0:pe.effort)??null,ultracode:vs.ultracode??(pe==null?void 0:pe.ultracode)??!1,thinking:vs.thinking??(pe==null?void 0:pe.thinking)??!0,switchOnFlag:vs.switchOnFlag??(pe==null?void 0:pe.switchModelsOnFlag)??!0},yf=nk(mf,Qr.model),bc=(ji==null?void 0:ji.state)==="running",vl=ai?Vs.find(k=>k.path===ai)??null:null,up=new Set(Vs.filter(Nr).map(k=>k.path)),nr=k=>y.jsx(K4,{pane:k,width:Hs.widths[k],onResize:ne=>Hs.setWidth(k,ne),onReset:()=>Hs.reset(k)}),xc=q&&y.jsx(nf,{title:"Режим прав",value:(pe==null?void 0:pe.permissionMode)??"default",options:X4.map(k=>({value:k.value,label:k.value,hint:k.hint})),onChange:k=>{O&&re({type:"control.set_mode",sessionId:O,mode:k})}}),vc=gf.length>0?y.jsx(ET,{models:gf,value:cp,effort:(pe==null?void 0:pe.effort)??null,ultracode:(pe==null?void 0:pe.ultracode)??!1,thinking:(pe==null?void 0:pe.thinking)??!0,switchOnFlag:(pe==null?void 0:pe.switchModelsOnFlag)??!0,onModel:k=>{!O||!k||re({type:"control.set_model",sessionId:O,model:k})},onEffort:k=>{O&&re({type:"control.set_effort",sessionId:O,effort:k})},onUltracode:k=>{O&&re({type:"control.set_ultracode",sessionId:O,enabled:k})},onThinking:k=>{O&&re({type:"control.set_thinking",sessionId:O,enabled:k})},onSwitchOnFlag:k=>{O&&re({type:"control.set_flag_switch",sessionId:O,enabled:k})}}):Ga&&y.jsx("span",{className:"badge",children:Ga}),Sc=As&&y.jsx("span",{className:Xr?"badge badge--wait":"badge badge--live",children:Xr?"ждёт":"работает"}),Pa=pe&&pe.totalCostUsd>0?`$${pe.totalCostUsd.toFixed(3)}`:null,Sl=y.jsx("button",{className:bs?"pane-btn is-on":"pane-btn",title:"Вопрос на полях — спросить, не мешая работе","aria-label":"Вопрос на полях","aria-pressed":bs,onClick:()=>Ri(k=>!k),children:y.jsx(sz,{})});return y.jsxs("div",{className:"app",style:Hs.style,children:[y.jsx(uB,{open:se,connected:e,status:i,workspaces:p,sessions:x.filter(k=>k.workspaceId===C),archived:w.filter(k=>k.workspaceId===C),activeWorkspaceId:C,activeSessionId:O,onCloseWorkspaces:ws,onArchiveSessions:uc,onUnarchiveSessions:k=>{C&&re({type:"session.unarchive",workspaceId:C,sessionIds:k})},onSelectWorkspace:k=>{Ss(),gc(),E(k),B(null),j(Gi),H(null),ue(!1),Is(null),Xn(null),li(null),jn(null)},onSelectSession:Ys,onRenameSession:Ia,onOpenWorkspace:()=>I(!0),onNewSession:Fr,onOpenExtensions:O?()=>Wr("mcp"):null,account:$,onOpenAccount:$r,relay:a,onOpenRelay:d?null:()=>f(!0),onOpenSettings:af,themeMode:Ei,onCycleTheme:mn}),nr("sidebar"),se&&y.jsx("div",{className:"scrim",onClick:()=>he(!1)}),y.jsx(YR,{open:Ln,tree:Ni,expanded:new Set(ps),activePath:ai,dirty:up,gitChanges:(Xt==null?void 0:Xt.changed)??[],result:Xe,searchResult:Gs,onSearch:cf,onReveal:ip,onToggle:qa,onOpen:dc,onCreate:sp,onRename:lp,onMove:rp,onDelete:gl,onRefresh:()=>{en(null),$i({}),of()},onClose:()=>Us(!1)}),Ln&&nr("files"),y.jsx(nj,{open:wt,result:Ha,onSearch:ep,onOpenMatch:np,onClose:()=>Qn(!1)}),wt&&nr("search"),y.jsx(u4,{open:Kn,state:Xt,result:Kl,selected:ml,onRefresh:of,onShow:fc,onCheckout:Va,onClose:()=>wn(!1)}),Kn&&nr("git"),y.jsxs("main",{className:"main",children:[y.jsxs("header",{className:"topbar",children:[y.jsx("button",{className:"btn btn--ghost menu-btn",onClick:()=>he(!0),children:"☰"}),y.jsx("button",{className:Ln?"pane-btn is-on":"pane-btn",title:"Файлы проекта","aria-label":"Файлы проекта","aria-pressed":Ln,onClick:()=>{Us(k=>!k),wn(!1),Qn(!1)},children:y.jsx(ez,{})}),y.jsx("button",{className:wt?"pane-btn is-on":"pane-btn",title:"Поиск по тексту в проекте","aria-label":"Поиск по тексту в проекте","aria-pressed":wt,onClick:()=>{Qn(k=>!k),Us(!1),wn(!1)},children:y.jsx(tz,{})}),y.jsx("button",{className:Kn?"pane-btn is-on":"pane-btn",title:"История git","aria-label":"История git","aria-pressed":Kn,onClick:()=>{wn(k=>!k),Us(!1),Qn(!1)},children:y.jsx(nz,{})}),le&&Sl,le&&y.jsx("button",{className:Ee?"pane-btn is-on":"pane-btn",title:"Ещё","aria-label":"Ещё","aria-haspopup":"menu","aria-pressed":Ee,onClick:()=>ve(!0),children:y.jsx(lz,{})}),y.jsxs("div",{className:"topbar__id",children:[Me&&pe?y.jsx(Cd,{className:"rename--title",value:pe.title??"",onCommit:k=>{Ia(pe,k),ue(!1)},onCancel:()=>ue(!1)}):y.jsx("button",{className:"topbar__title",disabled:!pe||le,title:pe&&!le?"Переименовать сессию":void 0,onClick:()=>ue(!0),children:(pe==null?void 0:pe.title)??"Claude Code Visual"}),le?Sc:yc&&y.jsx(MT,{path:yc})]}),!le&&y.jsxs("div",{className:"topbar__tools",children:[y.jsx(DT,{usage:hs}),y.jsx(LT,{}),xc,vc,Sc,Pa&&y.jsx("span",{className:"badge badge--cost",children:Pa}),Sl]})]}),le&&Ee&&y.jsx(N4,{onClose:()=>ve(!1),permission:xc,model:vc,usage:hs,cwd:yc,costLabel:Pa,onRename:pe?()=>{ue(!0),ve(!1)}:null}),Vs.length>0&&y.jsx(aB,{files:Vs,activePath:ai,busy:As,onSelect:Nt,onClose:k=>pc(k)}),vl?y.jsx(lB,{file:vl,goto:(Oi==null?void 0:Oi.path)===vl.path?Oi:null,onChange:(k,ne)=>kn(Te=>Te.map(Qe=>Qe.path===k?{...Qe,text:ne}:Qe)),onSave:k=>mc(k),onReload:ff,onOverwrite:k=>mc(k,!0),onTogglePreview:k=>kn(ne=>ne.map(Te=>Te.path===k?{...Te,previewMode:!Te.previewMode}:Te))}):y.jsxs(y.Fragment,{children:[y.jsx(Xy,{items:L.items,busy:As,waiting:Xr}),y.jsx(TT,{disabled:!O,busy:As,commands:hf,sessionTitle:(pe==null?void 0:pe.title)??null,contextResult:tp,onContextSearch:k=>uf("mention",k),onCommand:df,onSend:k=>{O&&re({type:"prompt.send",sessionId:O,text:k})},onInterrupt:()=>{O&&re({type:"control.interrupt",sessionId:O})}})]})]}),y.jsx(S4,{open:bs,items:Bt.items,busy:bc,ready:O!==null,commands:hf,contextResult:hc,models:yf.rows,model:yf.selected,effort:Qr.effort,ultracode:Qr.ultracode,thinking:Qr.thinking,switchOnFlag:Qr.switchOnFlag,onContextSearch:k=>uf("side",k),onCommand:df,onModel:k=>{k&&(yi(ne=>({...ne,model:k})),ks(ne=>re({type:"control.set_model",sessionId:ne,model:k})))},onEffort:k=>{yi(ne=>({...ne,effort:k,ultracode:!1})),ks(ne=>re({type:"control.set_effort",sessionId:ne,effort:k}))},onUltracode:k=>{yi(ne=>({...ne,ultracode:k,...k?{effort:"xhigh"}:{}})),ks(ne=>re({type:"control.set_ultracode",sessionId:ne,enabled:k}))},onThinking:k=>{yi(ne=>({...ne,thinking:k})),ks(ne=>re({type:"control.set_thinking",sessionId:ne,enabled:k}))},onSwitchOnFlag:k=>{yi(ne=>({...ne,switchOnFlag:k})),ks(ne=>re({type:"control.set_flag_switch",sessionId:ne,enabled:k}))},onAsk:xl,onInterrupt:()=>{gi&&re({type:"control.interrupt",sessionId:gi})},onReset:Ua,onClose:()=>Ri(!1)}),bs&&nr("ask"),(Kn||bs||Ln||wt)&&y.jsx("div",{className:"scrim scrim--pane",onClick:()=>{wn(!1),Ri(!1),Us(!1),Qn(!1)}}),ds&&y.jsx(d4,{detail:ds,local:((Xt==null?void 0:Xt.hasRemote)??!1)&&(Xt==null?void 0:Xt.commits.some(k=>k.hash===ds.hash&&!k.pushed))===!0,onCheckout:Va,onClose:()=>{Xn(null),li(null)}}),ri&&y.jsxs(js,{title:"Переключить рабочее дерево?",onClose:()=>mi(null),actions:y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:()=>mi(null),children:"Отмена"}),y.jsx("button",{className:"btn btn--warn",onClick:Kr,children:"Переключиться"})]}),children:[y.jsxs("p",{className:"modal__text",children:["git переключится на ",ri.label,". Файлы в каталоге проекта изменятся — это тот же каталог, в котором работает агент."]}),As&&y.jsx("p",{className:"modal__text",children:"Сейчас идёт ход агента: он читает и правит файлы прямо сейчас."}),Xt&&Xt.changed.length>0&&y.jsxs("p",{className:"modal__text",children:["Незакоммиченных изменений: ",Xt.changed.length,". Git откажется переключаться, если они будут затёрты."]})]}),ms&&y.jsx(js,{title:ms.kind==="dir"?"Удалить каталог?":"Удалить файл?",onClose:()=>gl(null),actions:y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:()=>gl(null),children:"Отмена"}),y.jsx("button",{className:"btn btn--warn",onClick:()=>ap(ms),children:"Удалить"})]}),children:y.jsxs("p",{className:"modal__text",children:[ms.path," будет удалён с диска",ms.kind==="dir"?" вместе со всем содержимым":"",". Корзины здесь нет: это тот же каталог, в котором работает агент."]})}),gs&&y.jsx(js,{title:"Закрыть без сохранения?",onClose:()=>qs(null),actions:y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:()=>qs(null),children:"Отмена"}),y.jsx("button",{className:"btn btn--warn",onClick:()=>pc(gs,!0),children:"Закрыть"}),y.jsx("button",{className:"btn btn--primary",onClick:()=>{mc(gs),pc(gs,!0)},children:"Сохранить и закрыть"})]}),children:y.jsxs("p",{className:"modal__text",children:["В ",gs," есть несохранённые правки."]})}),Ze&&y.jsx(D4,{tab:Ze,servers:at,plugins:xe,marketplaces:xn,catalog:Rn,result:ce,actions:rf,onTab:Kt,onClose:()=>Kt(null)}),St&&y.jsx(I4,{status:$,login:Wl,actions:tr,onClose:()=>Fe(!1)}),u&&y.jsx(q4,{state:a,onPair:(k,ne)=>re({type:"relay.pair",code:k,...ne?{name:ne}:{}}),onUnpair:()=>re({type:"relay.unpair"}),onClose:()=>f(!1)}),vn&&y.jsx(W4,{settings:ze,onChange:Zn,onClose:()=>$n(!1)}),ke&&y.jsx(JB,{candidates:Z,searching:Ne,agentItems:N.items,agentBusy:(J==null?void 0:J.state)==="running",error:de,roots:Ie,created:$e,onSearch:sf,onAskAgent:cc,onInterrupt:()=>{const k=ae.current;k&&re({type:"control.interrupt",sessionId:k})},onSubmit:Jl,onCreate:er,onClose:lf}),pf&&y.jsx(WB,{request:pf,queued:L.pending.length-1,onDecide:op})]})}function ez(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M2 4.1V3a.6.6 0 0 1 .6-.6h2.6l1.2 1.4h5a.6.6 0 0 1 .6.6v1.1"}),y.jsx("path",{d:"M2 12.6V5.7h11.4a.6.6 0 0 1 .58.75l-1.5 6.2a.6.6 0 0 1-.58.45H2.6a.6.6 0 0 1-.6-.5Z"})]})}function tz(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[y.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),y.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function nz(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[y.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),y.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),y.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),y.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function iz(n,e){return ik(n)===ik(e)}function ik(n){return n.replace(/[\\/]+/g,"/").replace(/\/+$/,"").toLowerCase()}function sz(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M13.6 9.4a1.6 1.6 0 0 1-1.6 1.6H6.2L3.2 13.4V4.2a1.6 1.6 0 0 1 1.6-1.6h7.2a1.6 1.6 0 0 1 1.6 1.6Z"}),y.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}function lz(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[y.jsx("circle",{cx:"3.2",cy:"8",r:"1.5"}),y.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),y.jsx("circle",{cx:"12.8",cy:"8",r:"1.5"})]})}const BT=document.getElementById("root");if(!BT)throw new Error("#root not found");v2.createRoot(BT).render(y.jsx(M.StrictMode,{children:y.jsx(J4,{})}));export{KL as A,oz as B,oT as C,bz as D,X as E,pz as F,CR as G,VO as H,jt as I,sE as J,hz as L,Mi as N,fE as P,rs as T,G0 as a,gz as b,mz as c,st as d,Ck as e,tR as f,hn as g,Yl as h,YO as i,eR as j,ec as k,Fn as l,lc as m,Rs as n,Fd as o,cz as p,UO as q,dt as r,kE as s,Y as t,No as u,ye as v,nC as w,Sd as x,dz as y,yz as z};