interceptr 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,60 @@
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function i(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(r){if(r.ep)return;r.ep=!0;const o=i(r);fetch(r.href,o)}})();var yp={exports:{}},Ho={};var k1;function gO(){if(k1)return Ho;k1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function i(n,r,o){var a=null;if(o!==void 0&&(a=""+o),r.key!==void 0&&(a=""+r.key),"key"in r){o={};for(var c in r)c!=="key"&&(o[c]=r[c])}else o=r;return r=o.ref,{$$typeof:t,type:n,key:a,ref:r!==void 0?r:null,props:o}}return Ho.Fragment=e,Ho.jsx=i,Ho.jsxs=i,Ho}var A1;function yO(){return A1||(A1=1,yp.exports=gO()),yp.exports}var S=yO(),bp={exports:{}},ve={};var M1;function bO(){if(M1)return ve;M1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function x(E){return E===null||typeof E!="object"?null:(E=b&&E[b]||E["@@iterator"],typeof E=="function"?E:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,k={};function M(E,I,$){this.props=E,this.context=I,this.refs=k,this.updater=$||w}M.prototype.isReactComponent={},M.prototype.setState=function(E,I){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,I,"setState")},M.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function O(){}O.prototype=M.prototype;function D(E,I,$){this.props=E,this.context=I,this.refs=k,this.updater=$||w}var V=D.prototype=new O;V.constructor=D,C(V,M.prototype),V.isPureReactComponent=!0;var H=Array.isArray;function Y(){}var U={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function Z(E,I,$){var re=$.ref;return{$$typeof:t,type:E,key:I,ref:re!==void 0?re:null,props:$}}function ce(E,I){return Z(E.type,I,E.props)}function oe(E){return typeof E=="object"&&E!==null&&E.$$typeof===t}function q(E){var I={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function($){return I[$]})}var ee=/\/+/g;function fe(E,I){return typeof E=="object"&&E!==null&&E.key!=null?q(""+E.key):I.toString(36)}function de(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(Y,Y):(E.status="pending",E.then(function(I){E.status==="pending"&&(E.status="fulfilled",E.value=I)},function(I){E.status==="pending"&&(E.status="rejected",E.reason=I)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function _(E,I,$,re,xe){var we=typeof E;(we==="undefined"||we==="boolean")&&(E=null);var ze=!1;if(E===null)ze=!0;else switch(we){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(E.$$typeof){case t:case e:ze=!0;break;case p:return ze=E._init,_(ze(E._payload),I,$,re,xe)}}if(ze)return xe=xe(E),ze=re===""?"."+fe(E,0):re,H(xe)?($="",ze!=null&&($=ze.replace(ee,"$&/")+"/"),_(xe,I,$,"",function(Il){return Il})):xe!=null&&(oe(xe)&&(xe=ce(xe,$+(xe.key==null||E&&E.key===xe.key?"":(""+xe.key).replace(ee,"$&/")+"/")+ze)),I.push(xe)),1;ze=0;var Yt=re===""?".":re+":";if(H(E))for(var ut=0;ut<E.length;ut++)re=E[ut],we=Yt+fe(re,ut),ze+=_(re,I,$,we,xe);else if(ut=x(E),typeof ut=="function")for(E=ut.call(E),ut=0;!(re=E.next()).done;)re=re.value,we=Yt+fe(re,ut++),ze+=_(re,I,$,we,xe);else if(we==="object"){if(typeof E.then=="function")return _(de(E),I,$,re,xe);throw I=String(E),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return ze}function X(E,I,$){if(E==null)return E;var re=[],xe=0;return _(E,re,"","",function(we){return I.call($,we,xe++)}),re}function ne(E){if(E._status===-1){var I=E._result;I=I(),I.then(function($){(E._status===0||E._status===-1)&&(E._status=1,E._result=$)},function($){(E._status===0||E._status===-1)&&(E._status=2,E._result=$)}),E._status===-1&&(E._status=0,E._result=I)}if(E._status===1)return E._result.default;throw E._result}var ue=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},ye={map:X,forEach:function(E,I,$){X(E,function(){I.apply(this,arguments)},$)},count:function(E){var I=0;return X(E,function(){I++}),I},toArray:function(E){return X(E,function(I){return I})||[]},only:function(E){if(!oe(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return ve.Activity=y,ve.Children=ye,ve.Component=M,ve.Fragment=i,ve.Profiler=r,ve.PureComponent=D,ve.StrictMode=n,ve.Suspense=h,ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,ve.__COMPILER_RUNTIME={__proto__:null,c:function(E){return U.H.useMemoCache(E)}},ve.cache=function(E){return function(){return E.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(E,I,$){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var re=C({},E.props),xe=E.key;if(I!=null)for(we in I.key!==void 0&&(xe=""+I.key),I)!J.call(I,we)||we==="key"||we==="__self"||we==="__source"||we==="ref"&&I.ref===void 0||(re[we]=I[we]);var we=arguments.length-2;if(we===1)re.children=$;else if(1<we){for(var ze=Array(we),Yt=0;Yt<we;Yt++)ze[Yt]=arguments[Yt+2];re.children=ze}return Z(E.type,xe,re)},ve.createContext=function(E){return E={$$typeof:a,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:o,_context:E},E},ve.createElement=function(E,I,$){var re,xe={},we=null;if(I!=null)for(re in I.key!==void 0&&(we=""+I.key),I)J.call(I,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(xe[re]=I[re]);var ze=arguments.length-2;if(ze===1)xe.children=$;else if(1<ze){for(var Yt=Array(ze),ut=0;ut<ze;ut++)Yt[ut]=arguments[ut+2];xe.children=Yt}if(E&&E.defaultProps)for(re in ze=E.defaultProps,ze)xe[re]===void 0&&(xe[re]=ze[re]);return Z(E,we,xe)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(E){return{$$typeof:c,render:E}},ve.isValidElement=oe,ve.lazy=function(E){return{$$typeof:p,_payload:{_status:-1,_result:E},_init:ne}},ve.memo=function(E,I){return{$$typeof:d,type:E,compare:I===void 0?null:I}},ve.startTransition=function(E){var I=U.T,$={};U.T=$;try{var re=E(),xe=U.S;xe!==null&&xe($,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(Y,ue)}catch(we){ue(we)}finally{I!==null&&$.types!==null&&(I.types=$.types),U.T=I}},ve.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},ve.use=function(E){return U.H.use(E)},ve.useActionState=function(E,I,$){return U.H.useActionState(E,I,$)},ve.useCallback=function(E,I){return U.H.useCallback(E,I)},ve.useContext=function(E){return U.H.useContext(E)},ve.useDebugValue=function(){},ve.useDeferredValue=function(E,I){return U.H.useDeferredValue(E,I)},ve.useEffect=function(E,I){return U.H.useEffect(E,I)},ve.useEffectEvent=function(E){return U.H.useEffectEvent(E)},ve.useId=function(){return U.H.useId()},ve.useImperativeHandle=function(E,I,$){return U.H.useImperativeHandle(E,I,$)},ve.useInsertionEffect=function(E,I){return U.H.useInsertionEffect(E,I)},ve.useLayoutEffect=function(E,I){return U.H.useLayoutEffect(E,I)},ve.useMemo=function(E,I){return U.H.useMemo(E,I)},ve.useOptimistic=function(E,I){return U.H.useOptimistic(E,I)},ve.useReducer=function(E,I,$){return U.H.useReducer(E,I,$)},ve.useRef=function(E){return U.H.useRef(E)},ve.useState=function(E){return U.H.useState(E)},ve.useSyncExternalStore=function(E,I,$){return U.H.useSyncExternalStore(E,I,$)},ve.useTransition=function(){return U.H.useTransition()},ve.version="19.2.4",ve}var T1;function vg(){return T1||(T1=1,bp.exports=bO()),bp.exports}var N=vg(),xp={exports:{}},Uo={},vp={exports:{}},Sp={};var O1;function xO(){return O1||(O1=1,(function(t){function e(_,X){var ne=_.length;_.push(X);e:for(;0<ne;){var ue=ne-1>>>1,ye=_[ue];if(0<r(ye,X))_[ue]=X,_[ne]=ye,ne=ue;else break e}}function i(_){return _.length===0?null:_[0]}function n(_){if(_.length===0)return null;var X=_[0],ne=_.pop();if(ne!==X){_[0]=ne;e:for(var ue=0,ye=_.length,E=ye>>>1;ue<E;){var I=2*(ue+1)-1,$=_[I],re=I+1,xe=_[re];if(0>r($,ne))re<ye&&0>r(xe,$)?(_[ue]=xe,_[re]=ne,ue=re):(_[ue]=$,_[I]=ne,ue=I);else if(re<ye&&0>r(xe,ne))_[ue]=xe,_[re]=ne,ue=re;else break e}}return X}function r(_,X){var ne=_.sortIndex-X.sortIndex;return ne!==0?ne:_.id-X.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var a=Date,c=a.now();t.unstable_now=function(){return a.now()-c}}var h=[],d=[],p=1,y=null,b=3,x=!1,w=!1,C=!1,k=!1,M=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function V(_){for(var X=i(d);X!==null;){if(X.callback===null)n(d);else if(X.startTime<=_)n(d),X.sortIndex=X.expirationTime,e(h,X);else break;X=i(d)}}function H(_){if(C=!1,V(_),!w)if(i(h)!==null)w=!0,Y||(Y=!0,q());else{var X=i(d);X!==null&&de(H,X.startTime-_)}}var Y=!1,U=-1,J=5,Z=-1;function ce(){return k?!0:!(t.unstable_now()-Z<J)}function oe(){if(k=!1,Y){var _=t.unstable_now();Z=_;var X=!0;try{e:{w=!1,C&&(C=!1,O(U),U=-1),x=!0;var ne=b;try{t:{for(V(_),y=i(h);y!==null&&!(y.expirationTime>_&&ce());){var ue=y.callback;if(typeof ue=="function"){y.callback=null,b=y.priorityLevel;var ye=ue(y.expirationTime<=_);if(_=t.unstable_now(),typeof ye=="function"){y.callback=ye,V(_),X=!0;break t}y===i(h)&&n(h),V(_)}else n(h);y=i(h)}if(y!==null)X=!0;else{var E=i(d);E!==null&&de(H,E.startTime-_),X=!1}}break e}finally{y=null,b=ne,x=!1}X=void 0}}finally{X?q():Y=!1}}}var q;if(typeof D=="function")q=function(){D(oe)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,fe=ee.port2;ee.port1.onmessage=oe,q=function(){fe.postMessage(null)}}else q=function(){M(oe,0)};function de(_,X){U=M(function(){_(t.unstable_now())},X)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(_){_.callback=null},t.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<_?Math.floor(1e3/_):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(_){switch(b){case 1:case 2:case 3:var X=3;break;default:X=b}var ne=b;b=X;try{return _()}finally{b=ne}},t.unstable_requestPaint=function(){k=!0},t.unstable_runWithPriority=function(_,X){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var ne=b;b=_;try{return X()}finally{b=ne}},t.unstable_scheduleCallback=function(_,X,ne){var ue=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?ue+ne:ue):ne=ue,_){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=ne+ye,_={id:p++,callback:X,priorityLevel:_,startTime:ne,expirationTime:ye,sortIndex:-1},ne>ue?(_.sortIndex=ne,e(d,_),i(h)===null&&_===i(d)&&(C?(O(U),U=-1):C=!0,de(H,ne-ue))):(_.sortIndex=ye,e(h,_),w||x||(w=!0,Y||(Y=!0,q()))),_},t.unstable_shouldYield=ce,t.unstable_wrapCallback=function(_){var X=b;return function(){var ne=b;b=X;try{return _.apply(this,arguments)}finally{b=ne}}}})(Sp)),Sp}var E1;function vO(){return E1||(E1=1,vp.exports=xO()),vp.exports}var wp={exports:{}},qt={};var N1;function SO(){if(N1)return qt;N1=1;var t=vg();function e(h){var d="https://react.dev/errors/"+h;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 #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var n={d:{f:i,r:function(){throw Error(e(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},r=Symbol.for("react.portal");function o(h,d,p){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:y==null?null:""+y,children:h,containerInfo:d,implementation:p}}var a=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,qt.createPortal=function(h,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 o(h,d,null,p)},qt.flushSync=function(h){var d=a.T,p=n.p;try{if(a.T=null,n.p=2,h)return h()}finally{a.T=d,n.p=p,n.d.f()}},qt.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(h,d))},qt.prefetchDNS=function(h){typeof h=="string"&&n.d.D(h)},qt.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var p=d.as,y=c(p,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,x=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?n.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:x}):p==="script"&&n.d.X(h,{crossOrigin:y,integrity:b,fetchPriority:x,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},qt.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=c(d.as,d.crossOrigin);n.d.M(h,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(h)},qt.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,y=c(p,d.crossOrigin);n.d.L(h,p,{crossOrigin:y,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})}},qt.preloadModule=function(h,d){if(typeof h=="string")if(d){var p=c(d.as,d.crossOrigin);n.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(h)},qt.requestFormReset=function(h){n.d.r(h)},qt.unstable_batchedUpdates=function(h,d){return h(d)},qt.useFormState=function(h,d,p){return a.H.useFormState(h,d,p)},qt.useFormStatus=function(){return a.H.useHostTransitionStatus()},qt.version="19.2.4",qt}var R1;function wO(){if(R1)return wp.exports;R1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),wp.exports=SO(),wp.exports}var D1;function CO(){if(D1)return Uo;D1=1;var t=vO(),e=vg(),i=wO();function n(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)l+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var l=s,u=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(u=l.return),s=l.return;while(s)}return l.tag===3?u:null}function a(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function c(s){if(s.tag===31){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function h(s){if(o(s)!==s)throw Error(n(188))}function d(s){var l=s.alternate;if(!l){if(l=o(s),l===null)throw Error(n(188));return l!==s?null:s}for(var u=s,f=l;;){var m=u.return;if(m===null)break;var g=m.alternate;if(g===null){if(f=m.return,f!==null){u=f;continue}break}if(m.child===g.child){for(g=m.child;g;){if(g===u)return h(m),s;if(g===f)return h(m),l;g=g.sibling}throw Error(n(188))}if(u.return!==f.return)u=m,f=g;else{for(var v=!1,A=m.child;A;){if(A===u){v=!0,u=m,f=g;break}if(A===f){v=!0,f=m,u=g;break}A=A.sibling}if(!v){for(A=g.child;A;){if(A===u){v=!0,u=g,f=m;break}if(A===f){v=!0,f=g,u=m;break}A=A.sibling}if(!v)throw Error(n(189))}}if(u.alternate!==f)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?s:l}function p(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=p(s),l!==null)return l;s=s.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),D=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),ce=Symbol.for("react.memo_cache_sentinel"),oe=Symbol.iterator;function q(s){return s===null||typeof s!="object"?null:(s=oe&&s[oe]||s["@@iterator"],typeof s=="function"?s:null)}var ee=Symbol.for("react.client.reference");function fe(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 C:return"Fragment";case M:return"Profiler";case k:return"StrictMode";case H:return"Suspense";case Y:return"SuspenseList";case Z:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case D:return s.displayName||"Context";case O:return(s._context.displayName||"Context")+".Consumer";case V:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case U:return l=s.displayName||null,l!==null?l:fe(s.type)||"Memo";case J:l=s._payload,s=s._init;try{return fe(s(l))}catch{}}return null}var de=Array.isArray,_=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},ue=[],ye=-1;function E(s){return{current:s}}function I(s){0>ye||(s.current=ue[ye],ue[ye]=null,ye--)}function $(s,l){ye++,ue[ye]=s.current,s.current=l}var re=E(null),xe=E(null),we=E(null),ze=E(null);function Yt(s,l){switch($(we,l),$(xe,s),$(re,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?Gx(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=Gx(l),s=Kx(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}I(re),$(re,s)}function ut(){I(re),I(xe),I(we)}function Il(s){s.memoizedState!==null&&$(ze,s);var l=re.current,u=Kx(l,s.type);l!==u&&($(xe,s),$(re,u))}function Va(s){xe.current===s&&(I(re),I(xe)),ze.current===s&&(I(ze),Lo._currentValue=ne)}var Jh,C0;function Vr(s){if(Jh===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);Jh=l&&l[1]||"",C0=-1<u.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Jh+s+C0}var $h=!1;function ef(s,l){if(!s||$h)return"";$h=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(l){var K=function(){throw Error()};if(Object.defineProperty(K.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(K,[])}catch(P){var z=P}Reflect.construct(s,[],K)}else{try{K.call()}catch(P){z=P}s.call(K.prototype)}}else{try{throw Error()}catch(P){z=P}(K=s())&&typeof K.catch=="function"&&K.catch(function(){})}}catch(P){if(P&&z&&typeof P.stack=="string")return[P.stack,z.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=f.DetermineComponentFrameRoot(),v=g[0],A=g[1];if(v&&A){var T=v.split(`
4
+ `),B=A.split(`
5
+ `);for(m=f=0;f<T.length&&!T[f].includes("DetermineComponentFrameRoot");)f++;for(;m<B.length&&!B[m].includes("DetermineComponentFrameRoot");)m++;if(f===T.length||m===B.length)for(f=T.length-1,m=B.length-1;1<=f&&0<=m&&T[f]!==B[m];)m--;for(;1<=f&&0<=m;f--,m--)if(T[f]!==B[m]){if(f!==1||m!==1)do if(f--,m--,0>m||T[f]!==B[m]){var Q=`
6
+ `+T[f].replace(" at new "," at ");return s.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",s.displayName)),Q}while(1<=f&&0<=m);break}}}finally{$h=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?Vr(u):""}function GA(s,l){switch(s.tag){case 26:case 27:case 5:return Vr(s.type);case 16:return Vr("Lazy");case 13:return s.child!==l&&l!==null?Vr("Suspense Fallback"):Vr("Suspense");case 19:return Vr("SuspenseList");case 0:case 15:return ef(s.type,!1);case 11:return ef(s.type.render,!1);case 1:return ef(s.type,!0);case 31:return Vr("Activity");default:return""}}function k0(s){try{var l="",u=null;do l+=GA(s,u),u=s,s=s.return;while(s);return l}catch(f){return`
7
+ Error generating stack: `+f.message+`
8
+ `+f.stack}}var tf=Object.prototype.hasOwnProperty,nf=t.unstable_scheduleCallback,rf=t.unstable_cancelCallback,KA=t.unstable_shouldYield,WA=t.unstable_requestPaint,di=t.unstable_now,XA=t.unstable_getCurrentPriorityLevel,A0=t.unstable_ImmediatePriority,M0=t.unstable_UserBlockingPriority,Ia=t.unstable_NormalPriority,ZA=t.unstable_LowPriority,T0=t.unstable_IdlePriority,JA=t.log,$A=t.unstable_setDisableYieldValue,Ql=null,pi=null;function Jn(s){if(typeof JA=="function"&&$A(s),pi&&typeof pi.setStrictMode=="function")try{pi.setStrictMode(Ql,s)}catch{}}var mi=Math.clz32?Math.clz32:iM,eM=Math.log,tM=Math.LN2;function iM(s){return s>>>=0,s===0?32:31-(eM(s)/tM|0)|0}var Qa=256,Ya=262144,Ga=4194304;function Ir(s){var l=s&42;if(l!==0)return l;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 Ka(s,l,u){var f=s.pendingLanes;if(f===0)return 0;var m=0,g=s.suspendedLanes,v=s.pingedLanes;s=s.warmLanes;var A=f&134217727;return A!==0?(f=A&~g,f!==0?m=Ir(f):(v&=A,v!==0?m=Ir(v):u||(u=A&~s,u!==0&&(m=Ir(u))))):(A=f&~g,A!==0?m=Ir(A):v!==0?m=Ir(v):u||(u=f&~s,u!==0&&(m=Ir(u)))),m===0?0:l!==0&&l!==m&&(l&g)===0&&(g=m&-m,u=l&-l,g>=u||g===32&&(u&4194048)!==0)?l:m}function Yl(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function nM(s,l){switch(s){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 O0(){var s=Ga;return Ga<<=1,(Ga&62914560)===0&&(Ga=4194304),s}function sf(s){for(var l=[],u=0;31>u;u++)l.push(s);return l}function Gl(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function rM(s,l,u,f,m,g){var v=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var A=s.entanglements,T=s.expirationTimes,B=s.hiddenUpdates;for(u=v&~u;0<u;){var Q=31-mi(u),K=1<<Q;A[Q]=0,T[Q]=-1;var z=B[Q];if(z!==null)for(B[Q]=null,Q=0;Q<z.length;Q++){var P=z[Q];P!==null&&(P.lane&=-536870913)}u&=~K}f!==0&&E0(s,f,0),g!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=g&~(v&~l))}function E0(s,l,u){s.pendingLanes|=l,s.suspendedLanes&=~l;var f=31-mi(l);s.entangledLanes|=l,s.entanglements[f]=s.entanglements[f]|1073741824|u&261930}function N0(s,l){var u=s.entangledLanes|=l;for(s=s.entanglements;u;){var f=31-mi(u),m=1<<f;m&l|s[f]&l&&(s[f]|=l),u&=~m}}function R0(s,l){var u=l&-l;return u=(u&42)!==0?1:lf(u),(u&(s.suspendedLanes|l))!==0?0:u}function lf(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 of(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function D0(){var s=X.p;return s!==0?s:(s=window.event,s===void 0?32:y1(s.type))}function j0(s,l){var u=X.p;try{return X.p=s,l()}finally{X.p=u}}var $n=Math.random().toString(36).slice(2),Rt="__reactFiber$"+$n,$t="__reactProps$"+$n,Ms="__reactContainer$"+$n,af="__reactEvents$"+$n,sM="__reactListeners$"+$n,lM="__reactHandles$"+$n,L0="__reactResources$"+$n,Kl="__reactMarker$"+$n;function uf(s){delete s[Rt],delete s[$t],delete s[af],delete s[sM],delete s[lM]}function Ts(s){var l=s[Rt];if(l)return l;for(var u=s.parentNode;u;){if(l=u[Ms]||u[Rt]){if(u=l.alternate,l.child!==null||u!==null&&u.child!==null)for(s=t1(s);s!==null;){if(u=s[Rt])return u;s=t1(s)}return l}s=u,u=s.parentNode}return null}function Os(s){if(s=s[Rt]||s[Ms]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function Wl(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(n(33))}function Es(s){var l=s[L0];return l||(l=s[L0]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Mt(s){s[Kl]=!0}var B0=new Set,z0={};function Qr(s,l){Ns(s,l),Ns(s+"Capture",l)}function Ns(s,l){for(z0[s]=l,s=0;s<l.length;s++)B0.add(l[s])}var oM=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]*$"),_0={},H0={};function aM(s){return tf.call(H0,s)?!0:tf.call(_0,s)?!1:oM.test(s)?H0[s]=!0:(_0[s]=!0,!1)}function Wa(s,l,u){if(aM(l))if(u===null)s.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":s.removeAttribute(l);return;case"boolean":var f=l.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){s.removeAttribute(l);return}}s.setAttribute(l,""+u)}}function Xa(s,l,u){if(u===null)s.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttribute(l,""+u)}}function kn(s,l,u,f){if(f===null)s.removeAttribute(u);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(u);return}s.setAttributeNS(l,u,""+f)}}function Oi(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function U0(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function uM(s,l,u){var f=Object.getOwnPropertyDescriptor(s.constructor.prototype,l);if(!s.hasOwnProperty(l)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var m=f.get,g=f.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return m.call(this)},set:function(v){u=""+v,g.call(this,v)}}),Object.defineProperty(s,l,{enumerable:f.enumerable}),{getValue:function(){return u},setValue:function(v){u=""+v},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function cf(s){if(!s._valueTracker){var l=U0(s)?"checked":"value";s._valueTracker=uM(s,l,""+s[l])}}function q0(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var u=l.getValue(),f="";return s&&(f=U0(s)?s.checked?"true":"false":s.value),s=f,s!==u?(l.setValue(s),!0):!1}function Za(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 cM=/[\n"\\]/g;function Ei(s){return s.replace(cM,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function hf(s,l,u,f,m,g,v,A){s.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?s.type=v:s.removeAttribute("type"),l!=null?v==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+Oi(l)):s.value!==""+Oi(l)&&(s.value=""+Oi(l)):v!=="submit"&&v!=="reset"||s.removeAttribute("value"),l!=null?ff(s,v,Oi(l)):u!=null?ff(s,v,Oi(u)):f!=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=""+Oi(A):s.removeAttribute("name")}function P0(s,l,u,f,m,g,v,A){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(s.type=g),l!=null||u!=null){if(!(g!=="submit"&&g!=="reset"||l!=null)){cf(s);return}u=u!=null?""+Oi(u):"",l=l!=null?""+Oi(l):u,A||l===s.value||(s.value=l),s.defaultValue=l}f=f??m,f=typeof f!="function"&&typeof f!="symbol"&&!!f,s.checked=A?s.checked:!!f,s.defaultChecked=!!f,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.name=v),cf(s)}function ff(s,l,u){l==="number"&&Za(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function Rs(s,l,u,f){if(s=s.options,l){l={};for(var m=0;m<u.length;m++)l["$"+u[m]]=!0;for(u=0;u<s.length;u++)m=l.hasOwnProperty("$"+s[u].value),s[u].selected!==m&&(s[u].selected=m),m&&f&&(s[u].defaultSelected=!0)}else{for(u=""+Oi(u),l=null,m=0;m<s.length;m++){if(s[m].value===u){s[m].selected=!0,f&&(s[m].defaultSelected=!0);return}l!==null||s[m].disabled||(l=s[m])}l!==null&&(l.selected=!0)}}function F0(s,l,u){if(l!=null&&(l=""+Oi(l),l!==s.value&&(s.value=l),u==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=u!=null?""+Oi(u):""}function V0(s,l,u,f){if(l==null){if(f!=null){if(u!=null)throw Error(n(92));if(de(f)){if(1<f.length)throw Error(n(93));f=f[0]}u=f}u==null&&(u=""),l=u}u=Oi(l),s.defaultValue=u,f=s.textContent,f===u&&f!==""&&f!==null&&(s.value=f),cf(s)}function Ds(s,l){if(l){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=l;return}}s.textContent=l}var hM=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 I0(s,l,u){var f=l.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?f?s.setProperty(l,""):l==="float"?s.cssFloat="":s[l]="":f?s.setProperty(l,u):typeof u!="number"||u===0||hM.has(l)?l==="float"?s.cssFloat=u:s[l]=(""+u).trim():s[l]=u+"px"}function Q0(s,l,u){if(l!=null&&typeof l!="object")throw Error(n(62));if(s=s.style,u!=null){for(var f in u)!u.hasOwnProperty(f)||l!=null&&l.hasOwnProperty(f)||(f.indexOf("--")===0?s.setProperty(f,""):f==="float"?s.cssFloat="":s[f]="");for(var m in l)f=l[m],l.hasOwnProperty(m)&&u[m]!==f&&I0(s,m,f)}else for(var g in l)l.hasOwnProperty(g)&&I0(s,g,l[g])}function df(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 fM=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"]]),dM=/^[\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 Ja(s){return dM.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function An(){}var pf=null;function mf(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var js=null,Ls=null;function Y0(s){var l=Os(s);if(l&&(s=l.stateNode)){var u=s[$t]||null;e:switch(s=l.stateNode,l.type){case"input":if(hf(s,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),l=u.name,u.type==="radio"&&l!=null){for(u=s;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Ei(""+l)+'"][type="radio"]'),l=0;l<u.length;l++){var f=u[l];if(f!==s&&f.form===s.form){var m=f[$t]||null;if(!m)throw Error(n(90));hf(f,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(l=0;l<u.length;l++)f=u[l],f.form===s.form&&q0(f)}break e;case"textarea":F0(s,u.value,u.defaultValue);break e;case"select":l=u.value,l!=null&&Rs(s,!!u.multiple,l,!1)}}}var gf=!1;function G0(s,l,u){if(gf)return s(l,u);gf=!0;try{var f=s(l);return f}finally{if(gf=!1,(js!==null||Ls!==null)&&(Uu(),js&&(l=js,s=Ls,Ls=js=null,Y0(l),s)))for(l=0;l<s.length;l++)Y0(s[l])}}function Xl(s,l){var u=s.stateNode;if(u===null)return null;var f=u[$t]||null;if(f===null)return null;u=f[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(s=s.type,f=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!f;break e;default:s=!1}if(s)return null;if(u&&typeof u!="function")throw Error(n(231,l,typeof u));return u}var Mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yf=!1;if(Mn)try{var Zl={};Object.defineProperty(Zl,"passive",{get:function(){yf=!0}}),window.addEventListener("test",Zl,Zl),window.removeEventListener("test",Zl,Zl)}catch{yf=!1}var er=null,bf=null,$a=null;function K0(){if($a)return $a;var s,l=bf,u=l.length,f,m="value"in er?er.value:er.textContent,g=m.length;for(s=0;s<u&&l[s]===m[s];s++);var v=u-s;for(f=1;f<=v&&l[u-f]===m[g-f];f++);return $a=m.slice(s,1<f?1-f:void 0)}function eu(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function tu(){return!0}function W0(){return!1}function ei(s){function l(u,f,m,g,v){this._reactName=u,this._targetInst=m,this.type=f,this.nativeEvent=g,this.target=v,this.currentTarget=null;for(var A in s)s.hasOwnProperty(A)&&(u=s[A],this[A]=u?u(g):g[A]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?tu:W0,this.isPropagationStopped=W0,this}return y(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=tu)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=tu)},persist:function(){},isPersistent:tu}),l}var Yr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},iu=ei(Yr),Jl=y({},Yr,{view:0,detail:0}),pM=ei(Jl),xf,vf,$l,nu=y({},Jl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wf,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!==$l&&($l&&s.type==="mousemove"?(xf=s.screenX-$l.screenX,vf=s.screenY-$l.screenY):vf=xf=0,$l=s),xf)},movementY:function(s){return"movementY"in s?s.movementY:vf}}),X0=ei(nu),mM=y({},nu,{dataTransfer:0}),gM=ei(mM),yM=y({},Jl,{relatedTarget:0}),Sf=ei(yM),bM=y({},Yr,{animationName:0,elapsedTime:0,pseudoElement:0}),xM=ei(bM),vM=y({},Yr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),SM=ei(vM),wM=y({},Yr,{data:0}),Z0=ei(wM),CM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kM={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"},AM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function MM(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=AM[s])?!!l[s]:!1}function wf(){return MM}var TM=y({},Jl,{key:function(s){if(s.key){var l=CM[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=eu(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?kM[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wf,charCode:function(s){return s.type==="keypress"?eu(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?eu(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),OM=ei(TM),EM=y({},nu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),J0=ei(EM),NM=y({},Jl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wf}),RM=ei(NM),DM=y({},Yr,{propertyName:0,elapsedTime:0,pseudoElement:0}),jM=ei(DM),LM=y({},nu,{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}),BM=ei(LM),zM=y({},Yr,{newState:0,oldState:0}),_M=ei(zM),HM=[9,13,27,32],Cf=Mn&&"CompositionEvent"in window,eo=null;Mn&&"documentMode"in document&&(eo=document.documentMode);var UM=Mn&&"TextEvent"in window&&!eo,$0=Mn&&(!Cf||eo&&8<eo&&11>=eo),ey=" ",ty=!1;function iy(s,l){switch(s){case"keyup":return HM.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ny(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Bs=!1;function qM(s,l){switch(s){case"compositionend":return ny(l);case"keypress":return l.which!==32?null:(ty=!0,ey);case"textInput":return s=l.data,s===ey&&ty?null:s;default:return null}}function PM(s,l){if(Bs)return s==="compositionend"||!Cf&&iy(s,l)?(s=K0(),$a=bf=er=null,Bs=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return $0&&l.locale!=="ko"?null:l.data;default:return null}}var FM={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 ry(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!FM[s.type]:l==="textarea"}function sy(s,l,u,f){js?Ls?Ls.push(f):Ls=[f]:js=f,l=Yu(l,"onChange"),0<l.length&&(u=new iu("onChange","change",null,u,f),s.push({event:u,listeners:l}))}var to=null,io=null;function VM(s){Px(s,0)}function ru(s){var l=Wl(s);if(q0(l))return s}function ly(s,l){if(s==="change")return l}var oy=!1;if(Mn){var kf;if(Mn){var Af="oninput"in document;if(!Af){var ay=document.createElement("div");ay.setAttribute("oninput","return;"),Af=typeof ay.oninput=="function"}kf=Af}else kf=!1;oy=kf&&(!document.documentMode||9<document.documentMode)}function uy(){to&&(to.detachEvent("onpropertychange",cy),io=to=null)}function cy(s){if(s.propertyName==="value"&&ru(io)){var l=[];sy(l,io,s,mf(s)),G0(VM,l)}}function IM(s,l,u){s==="focusin"?(uy(),to=l,io=u,to.attachEvent("onpropertychange",cy)):s==="focusout"&&uy()}function QM(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return ru(io)}function YM(s,l){if(s==="click")return ru(l)}function GM(s,l){if(s==="input"||s==="change")return ru(l)}function KM(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var gi=typeof Object.is=="function"?Object.is:KM;function no(s,l){if(gi(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var u=Object.keys(s),f=Object.keys(l);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var m=u[f];if(!tf.call(l,m)||!gi(s[m],l[m]))return!1}return!0}function hy(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function fy(s,l){var u=hy(s);s=0;for(var f;u;){if(u.nodeType===3){if(f=s+u.textContent.length,s<=l&&f>=l)return{node:u,offset:l-s};s=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=hy(u)}}function dy(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?dy(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function py(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=Za(s.document);l instanceof s.HTMLIFrameElement;){try{var u=typeof l.contentWindow.location.href=="string"}catch{u=!1}if(u)s=l.contentWindow;else break;l=Za(s.document)}return l}function Mf(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}var WM=Mn&&"documentMode"in document&&11>=document.documentMode,zs=null,Tf=null,ro=null,Of=!1;function my(s,l,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Of||zs==null||zs!==Za(f)||(f=zs,"selectionStart"in f&&Mf(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),ro&&no(ro,f)||(ro=f,f=Yu(Tf,"onSelect"),0<f.length&&(l=new iu("onSelect","select",null,l,u),s.push({event:l,listeners:f}),l.target=zs)))}function Gr(s,l){var u={};return u[s.toLowerCase()]=l.toLowerCase(),u["Webkit"+s]="webkit"+l,u["Moz"+s]="moz"+l,u}var _s={animationend:Gr("Animation","AnimationEnd"),animationiteration:Gr("Animation","AnimationIteration"),animationstart:Gr("Animation","AnimationStart"),transitionrun:Gr("Transition","TransitionRun"),transitionstart:Gr("Transition","TransitionStart"),transitioncancel:Gr("Transition","TransitionCancel"),transitionend:Gr("Transition","TransitionEnd")},Ef={},gy={};Mn&&(gy=document.createElement("div").style,"AnimationEvent"in window||(delete _s.animationend.animation,delete _s.animationiteration.animation,delete _s.animationstart.animation),"TransitionEvent"in window||delete _s.transitionend.transition);function Kr(s){if(Ef[s])return Ef[s];if(!_s[s])return s;var l=_s[s],u;for(u in l)if(l.hasOwnProperty(u)&&u in gy)return Ef[s]=l[u];return s}var yy=Kr("animationend"),by=Kr("animationiteration"),xy=Kr("animationstart"),XM=Kr("transitionrun"),ZM=Kr("transitionstart"),JM=Kr("transitioncancel"),vy=Kr("transitionend"),Sy=new Map,Nf="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(" ");Nf.push("scrollEnd");function Yi(s,l){Sy.set(s,l),Qr(l,[s])}var su=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=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(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ni=[],Hs=0,Rf=0;function lu(){for(var s=Hs,l=Rf=Hs=0;l<s;){var u=Ni[l];Ni[l++]=null;var f=Ni[l];Ni[l++]=null;var m=Ni[l];Ni[l++]=null;var g=Ni[l];if(Ni[l++]=null,f!==null&&m!==null){var v=f.pending;v===null?m.next=m:(m.next=v.next,v.next=m),f.pending=m}g!==0&&wy(u,m,g)}}function ou(s,l,u,f){Ni[Hs++]=s,Ni[Hs++]=l,Ni[Hs++]=u,Ni[Hs++]=f,Rf|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function Df(s,l,u,f){return ou(s,l,u,f),au(s)}function Wr(s,l){return ou(s,null,null,l),au(s)}function wy(s,l,u){s.lanes|=u;var f=s.alternate;f!==null&&(f.lanes|=u);for(var m=!1,g=s.return;g!==null;)g.childLanes|=u,f=g.alternate,f!==null&&(f.childLanes|=u),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&&l!==null&&(m=31-mi(u),s=g.hiddenUpdates,f=s[m],f===null?s[m]=[l]:f.push(l),l.lane=u|536870912),g):null}function au(s){if(50<To)throw To=0,Pd=null,Error(n(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var Us={};function $M(s,l,u,f){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yi(s,l,u,f){return new $M(s,l,u,f)}function jf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Tn(s,l){var u=s.alternate;return u===null?(u=yi(s.tag,l,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=l,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,l=s.dependencies,u.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function Cy(s,l){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=l,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,l=u.dependencies,s.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s}function uu(s,l,u,f,m,g){var v=0;if(f=s,typeof s=="function")jf(s)&&(v=1);else if(typeof s=="string")v=rO(s,u,re.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case Z:return s=yi(31,u,l,m),s.elementType=Z,s.lanes=g,s;case C:return Xr(u.children,m,g,l);case k:v=8,m|=24;break;case M:return s=yi(12,u,l,m|2),s.elementType=M,s.lanes=g,s;case H:return s=yi(13,u,l,m),s.elementType=H,s.lanes=g,s;case Y:return s=yi(19,u,l,m),s.elementType=Y,s.lanes=g,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case D:v=10;break e;case O:v=9;break e;case V:v=11;break e;case U:v=14;break e;case J:v=16,f=null;break e}v=29,u=Error(n(130,s===null?"null":typeof s,"")),f=null}return l=yi(v,u,l,m),l.elementType=s,l.type=f,l.lanes=g,l}function Xr(s,l,u,f){return s=yi(7,s,f,l),s.lanes=u,s}function Lf(s,l,u){return s=yi(6,s,null,l),s.lanes=u,s}function ky(s){var l=yi(18,null,null,0);return l.stateNode=s,l}function Bf(s,l,u){return l=yi(4,s.children!==null?s.children:[],s.key,l),l.lanes=u,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var Ay=new WeakMap;function Ri(s,l){if(typeof s=="object"&&s!==null){var u=Ay.get(s);return u!==void 0?u:(l={value:s,source:l,stack:k0(l)},Ay.set(s,l),l)}return{value:s,source:l,stack:k0(l)}}var qs=[],Ps=0,cu=null,so=0,Di=[],ji=0,tr=null,rn=1,sn="";function On(s,l){qs[Ps++]=so,qs[Ps++]=cu,cu=s,so=l}function My(s,l,u){Di[ji++]=rn,Di[ji++]=sn,Di[ji++]=tr,tr=s;var f=rn;s=sn;var m=32-mi(f)-1;f&=~(1<<m),u+=1;var g=32-mi(l)+m;if(30<g){var v=m-m%5;g=(f&(1<<v)-1).toString(32),f>>=v,m-=v,rn=1<<32-mi(l)+m|u<<m|f,sn=g+s}else rn=1<<g|u<<m|f,sn=s}function zf(s){s.return!==null&&(On(s,1),My(s,1,0))}function _f(s){for(;s===cu;)cu=qs[--Ps],qs[Ps]=null,so=qs[--Ps],qs[Ps]=null;for(;s===tr;)tr=Di[--ji],Di[ji]=null,sn=Di[--ji],Di[ji]=null,rn=Di[--ji],Di[ji]=null}function Ty(s,l){Di[ji++]=rn,Di[ji++]=sn,Di[ji++]=tr,rn=l.id,sn=l.overflow,tr=s}var Dt=null,$e=null,je=!1,ir=null,Li=!1,Hf=Error(n(519));function nr(s){var l=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw lo(Ri(l,s)),Hf}function Oy(s){var l=s.stateNode,u=s.type,f=s.memoizedProps;switch(l[Rt]=s,l[$t]=f,u){case"dialog":Ee("cancel",l),Ee("close",l);break;case"iframe":case"object":case"embed":Ee("load",l);break;case"video":case"audio":for(u=0;u<Eo.length;u++)Ee(Eo[u],l);break;case"source":Ee("error",l);break;case"img":case"image":case"link":Ee("error",l),Ee("load",l);break;case"details":Ee("toggle",l);break;case"input":Ee("invalid",l),P0(l,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Ee("invalid",l);break;case"textarea":Ee("invalid",l),V0(l,f.value,f.defaultValue,f.children)}u=f.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||l.textContent===""+u||f.suppressHydrationWarning===!0||Qx(l.textContent,u)?(f.popover!=null&&(Ee("beforetoggle",l),Ee("toggle",l)),f.onScroll!=null&&Ee("scroll",l),f.onScrollEnd!=null&&Ee("scrollend",l),f.onClick!=null&&(l.onclick=An),l=!0):l=!1,l||nr(s,!0)}function Ey(s){for(Dt=s.return;Dt;)switch(Dt.tag){case 5:case 31:case 13:Li=!1;return;case 27:case 3:Li=!0;return;default:Dt=Dt.return}}function Fs(s){if(s!==Dt)return!1;if(!je)return Ey(s),je=!0,!1;var l=s.tag,u;if((u=l!==3&&l!==27)&&((u=l===5)&&(u=s.type,u=!(u!=="form"&&u!=="button")||ip(s.type,s.memoizedProps)),u=!u),u&&$e&&nr(s),Ey(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));$e=e1(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));$e=e1(s)}else l===27?(l=$e,yr(s.type)?(s=op,op=null,$e=s):$e=l):$e=Dt?zi(s.stateNode.nextSibling):null;return!0}function Zr(){$e=Dt=null,je=!1}function Uf(){var s=ir;return s!==null&&(ri===null?ri=s:ri.push.apply(ri,s),ir=null),s}function lo(s){ir===null?ir=[s]:ir.push(s)}var qf=E(null),Jr=null,En=null;function rr(s,l,u){$(qf,l._currentValue),l._currentValue=u}function Nn(s){s._currentValue=qf.current,I(qf)}function Pf(s,l,u){for(;s!==null;){var f=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,f!==null&&(f.childLanes|=l)):f!==null&&(f.childLanes&l)!==l&&(f.childLanes|=l),s===u)break;s=s.return}}function Ff(s,l,u,f){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 T=0;T<l.length;T++)if(A.context===l[T]){g.lanes|=u,A=g.alternate,A!==null&&(A.lanes|=u),Pf(g.return,u,s),f||(v=null);break e}g=A.next}}else if(m.tag===18){if(v=m.return,v===null)throw Error(n(341));v.lanes|=u,g=v.alternate,g!==null&&(g.lanes|=u),Pf(v,u,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 Vs(s,l,u,f){s=null;for(var m=l,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(n(387));if(v=v.memoizedProps,v!==null){var A=m.type;gi(m.pendingProps.value,v.value)||(s!==null?s.push(A):s=[A])}}else if(m===ze.current){if(v=m.alternate,v===null)throw Error(n(387));v.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Lo):s=[Lo])}m=m.return}s!==null&&Ff(l,s,u,f),l.flags|=262144}function hu(s){for(s=s.firstContext;s!==null;){if(!gi(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function $r(s){Jr=s,En=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function jt(s){return Ny(Jr,s)}function fu(s,l){return Jr===null&&$r(s),Ny(s,l)}function Ny(s,l){var u=l._currentValue;if(l={context:l,memoizedValue:u,next:null},En===null){if(s===null)throw Error(n(308));En=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else En=En.next=l;return u}var eT=typeof AbortController<"u"?AbortController:function(){var s=[],l=this.signal={aborted:!1,addEventListener:function(u,f){s.push(f)}};this.abort=function(){l.aborted=!0,s.forEach(function(u){return u()})}},tT=t.unstable_scheduleCallback,iT=t.unstable_NormalPriority,mt={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Vf(){return{controller:new eT,data:new Map,refCount:0}}function oo(s){s.refCount--,s.refCount===0&&tT(iT,function(){s.controller.abort()})}var ao=null,If=0,Is=0,Qs=null;function nT(s,l){if(ao===null){var u=ao=[];If=0,Is=Gd(),Qs={status:"pending",value:void 0,then:function(f){u.push(f)}}}return If++,l.then(Ry,Ry),l}function Ry(){if(--If===0&&ao!==null){Qs!==null&&(Qs.status="fulfilled");var s=ao;ao=null,Is=0,Qs=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function rT(s,l){var u=[],f={status:"pending",value:null,reason:null,then:function(m){u.push(m)}};return s.then(function(){f.status="fulfilled",f.value=l;for(var m=0;m<u.length;m++)(0,u[m])(l)},function(m){for(f.status="rejected",f.reason=m,m=0;m<u.length;m++)(0,u[m])(void 0)}),f}var Dy=_.S;_.S=function(s,l){mx=di(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&nT(s,l),Dy!==null&&Dy(s,l)};var es=E(null);function Qf(){var s=es.current;return s!==null?s:We.pooledCache}function du(s,l){l===null?$(es,es.current):$(es,l.pool)}function jy(){var s=Qf();return s===null?null:{parent:mt._currentValue,pool:s}}var Ys=Error(n(460)),Yf=Error(n(474)),pu=Error(n(542)),mu={then:function(){}};function Ly(s){return s=s.status,s==="fulfilled"||s==="rejected"}function By(s,l,u){switch(u=s[u],u===void 0?s.push(l):u!==l&&(l.then(An,An),l=u),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,_y(s),s;default:if(typeof l.status=="string")l.then(An,An);else{if(s=We,s!==null&&100<s.shellSuspendCounter)throw Error(n(482));s=l,s.status="pending",s.then(function(f){if(l.status==="pending"){var m=l;m.status="fulfilled",m.value=f}},function(f){if(l.status==="pending"){var m=l;m.status="rejected",m.reason=f}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,_y(s),s}throw is=l,Ys}}function ts(s){try{var l=s._init;return l(s._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(is=u,Ys):u}}var is=null;function zy(){if(is===null)throw Error(n(459));var s=is;return is=null,s}function _y(s){if(s===Ys||s===pu)throw Error(n(483))}var Gs=null,uo=0;function gu(s){var l=uo;return uo+=1,Gs===null&&(Gs=[]),By(Gs,s,l)}function co(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function yu(s,l){throw l.$$typeof===b?Error(n(525)):(s=Object.prototype.toString.call(l),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s)))}function Hy(s){function l(j,R){if(s){var L=j.deletions;L===null?(j.deletions=[R],j.flags|=16):L.push(R)}}function u(j,R){if(!s)return null;for(;R!==null;)l(j,R),R=R.sibling;return null}function f(j){for(var R=new Map;j!==null;)j.key!==null?R.set(j.key,j):R.set(j.index,j),j=j.sibling;return R}function m(j,R){return j=Tn(j,R),j.index=0,j.sibling=null,j}function g(j,R,L){return j.index=L,s?(L=j.alternate,L!==null?(L=L.index,L<R?(j.flags|=67108866,R):L):(j.flags|=67108866,R)):(j.flags|=1048576,R)}function v(j){return s&&j.alternate===null&&(j.flags|=67108866),j}function A(j,R,L,G){return R===null||R.tag!==6?(R=Lf(L,j.mode,G),R.return=j,R):(R=m(R,L),R.return=j,R)}function T(j,R,L,G){var me=L.type;return me===C?Q(j,R,L.props.children,G,L.key):R!==null&&(R.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===J&&ts(me)===R.type)?(R=m(R,L.props),co(R,L),R.return=j,R):(R=uu(L.type,L.key,L.props,null,j.mode,G),co(R,L),R.return=j,R)}function B(j,R,L,G){return R===null||R.tag!==4||R.stateNode.containerInfo!==L.containerInfo||R.stateNode.implementation!==L.implementation?(R=Bf(L,j.mode,G),R.return=j,R):(R=m(R,L.children||[]),R.return=j,R)}function Q(j,R,L,G,me){return R===null||R.tag!==7?(R=Xr(L,j.mode,G,me),R.return=j,R):(R=m(R,L),R.return=j,R)}function K(j,R,L){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=Lf(""+R,j.mode,L),R.return=j,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case x:return L=uu(R.type,R.key,R.props,null,j.mode,L),co(L,R),L.return=j,L;case w:return R=Bf(R,j.mode,L),R.return=j,R;case J:return R=ts(R),K(j,R,L)}if(de(R)||q(R))return R=Xr(R,j.mode,L,null),R.return=j,R;if(typeof R.then=="function")return K(j,gu(R),L);if(R.$$typeof===D)return K(j,fu(j,R),L);yu(j,R)}return null}function z(j,R,L,G){var me=R!==null?R.key:null;if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return me!==null?null:A(j,R,""+L,G);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case x:return L.key===me?T(j,R,L,G):null;case w:return L.key===me?B(j,R,L,G):null;case J:return L=ts(L),z(j,R,L,G)}if(de(L)||q(L))return me!==null?null:Q(j,R,L,G,null);if(typeof L.then=="function")return z(j,R,gu(L),G);if(L.$$typeof===D)return z(j,R,fu(j,L),G);yu(j,L)}return null}function P(j,R,L,G,me){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return j=j.get(L)||null,A(R,j,""+G,me);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case x:return j=j.get(G.key===null?L:G.key)||null,T(R,j,G,me);case w:return j=j.get(G.key===null?L:G.key)||null,B(R,j,G,me);case J:return G=ts(G),P(j,R,L,G,me)}if(de(G)||q(G))return j=j.get(L)||null,Q(R,j,G,me,null);if(typeof G.then=="function")return P(j,R,L,gu(G),me);if(G.$$typeof===D)return P(j,R,L,fu(R,G),me);yu(R,G)}return null}function ae(j,R,L,G){for(var me=null,_e=null,he=R,ke=R=0,De=null;he!==null&&ke<L.length;ke++){he.index>ke?(De=he,he=null):De=he.sibling;var He=z(j,he,L[ke],G);if(He===null){he===null&&(he=De);break}s&&he&&He.alternate===null&&l(j,he),R=g(He,R,ke),_e===null?me=He:_e.sibling=He,_e=He,he=De}if(ke===L.length)return u(j,he),je&&On(j,ke),me;if(he===null){for(;ke<L.length;ke++)he=K(j,L[ke],G),he!==null&&(R=g(he,R,ke),_e===null?me=he:_e.sibling=he,_e=he);return je&&On(j,ke),me}for(he=f(he);ke<L.length;ke++)De=P(he,j,ke,L[ke],G),De!==null&&(s&&De.alternate!==null&&he.delete(De.key===null?ke:De.key),R=g(De,R,ke),_e===null?me=De:_e.sibling=De,_e=De);return s&&he.forEach(function(wr){return l(j,wr)}),je&&On(j,ke),me}function be(j,R,L,G){if(L==null)throw Error(n(151));for(var me=null,_e=null,he=R,ke=R=0,De=null,He=L.next();he!==null&&!He.done;ke++,He=L.next()){he.index>ke?(De=he,he=null):De=he.sibling;var wr=z(j,he,He.value,G);if(wr===null){he===null&&(he=De);break}s&&he&&wr.alternate===null&&l(j,he),R=g(wr,R,ke),_e===null?me=wr:_e.sibling=wr,_e=wr,he=De}if(He.done)return u(j,he),je&&On(j,ke),me;if(he===null){for(;!He.done;ke++,He=L.next())He=K(j,He.value,G),He!==null&&(R=g(He,R,ke),_e===null?me=He:_e.sibling=He,_e=He);return je&&On(j,ke),me}for(he=f(he);!He.done;ke++,He=L.next())He=P(he,j,ke,He.value,G),He!==null&&(s&&He.alternate!==null&&he.delete(He.key===null?ke:He.key),R=g(He,R,ke),_e===null?me=He:_e.sibling=He,_e=He);return s&&he.forEach(function(mO){return l(j,mO)}),je&&On(j,ke),me}function Ge(j,R,L,G){if(typeof L=="object"&&L!==null&&L.type===C&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case x:e:{for(var me=L.key;R!==null;){if(R.key===me){if(me=L.type,me===C){if(R.tag===7){u(j,R.sibling),G=m(R,L.props.children),G.return=j,j=G;break e}}else if(R.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===J&&ts(me)===R.type){u(j,R.sibling),G=m(R,L.props),co(G,L),G.return=j,j=G;break e}u(j,R);break}else l(j,R);R=R.sibling}L.type===C?(G=Xr(L.props.children,j.mode,G,L.key),G.return=j,j=G):(G=uu(L.type,L.key,L.props,null,j.mode,G),co(G,L),G.return=j,j=G)}return v(j);case w:e:{for(me=L.key;R!==null;){if(R.key===me)if(R.tag===4&&R.stateNode.containerInfo===L.containerInfo&&R.stateNode.implementation===L.implementation){u(j,R.sibling),G=m(R,L.children||[]),G.return=j,j=G;break e}else{u(j,R);break}else l(j,R);R=R.sibling}G=Bf(L,j.mode,G),G.return=j,j=G}return v(j);case J:return L=ts(L),Ge(j,R,L,G)}if(de(L))return ae(j,R,L,G);if(q(L)){if(me=q(L),typeof me!="function")throw Error(n(150));return L=me.call(L),be(j,R,L,G)}if(typeof L.then=="function")return Ge(j,R,gu(L),G);if(L.$$typeof===D)return Ge(j,R,fu(j,L),G);yu(j,L)}return typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint"?(L=""+L,R!==null&&R.tag===6?(u(j,R.sibling),G=m(R,L),G.return=j,j=G):(u(j,R),G=Lf(L,j.mode,G),G.return=j,j=G),v(j)):u(j,R)}return function(j,R,L,G){try{uo=0;var me=Ge(j,R,L,G);return Gs=null,me}catch(he){if(he===Ys||he===pu)throw he;var _e=yi(29,he,null,j.mode);return _e.lanes=G,_e.return=j,_e}}}var ns=Hy(!0),Uy=Hy(!1),sr=!1;function Gf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kf(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function lr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function or(s,l,u){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(qe&2)!==0){var m=f.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),f.pending=l,l=au(s),wy(s,null,u),l}return ou(s,f,l,u),au(s)}function ho(s,l,u){if(l=l.updateQueue,l!==null&&(l=l.shared,(u&4194048)!==0)){var f=l.lanes;f&=s.pendingLanes,u|=f,l.lanes=u,N0(s,u)}}function Wf(s,l){var u=s.updateQueue,f=s.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var m=null,g=null;if(u=u.firstBaseUpdate,u!==null){do{var v={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};g===null?m=g=v:g=g.next=v,u=u.next}while(u!==null);g===null?m=g=l:g=g.next=l}else m=g=l;u={baseState:f.baseState,firstBaseUpdate:m,lastBaseUpdate:g,shared:f.shared,callbacks:f.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=l}var Xf=!1;function fo(){if(Xf){var s=Qs;if(s!==null)throw s}}function po(s,l,u,f){Xf=!1;var m=s.updateQueue;sr=!1;var g=m.firstBaseUpdate,v=m.lastBaseUpdate,A=m.shared.pending;if(A!==null){m.shared.pending=null;var T=A,B=T.next;T.next=null,v===null?g=B:v.next=B,v=T;var Q=s.alternate;Q!==null&&(Q=Q.updateQueue,A=Q.lastBaseUpdate,A!==v&&(A===null?Q.firstBaseUpdate=B:A.next=B,Q.lastBaseUpdate=T))}if(g!==null){var K=m.baseState;v=0,Q=B=T=null,A=g;do{var z=A.lane&-536870913,P=z!==A.lane;if(P?(Re&z)===z:(f&z)===z){z!==0&&z===Is&&(Xf=!0),Q!==null&&(Q=Q.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var ae=s,be=A;z=l;var Ge=u;switch(be.tag){case 1:if(ae=be.payload,typeof ae=="function"){K=ae.call(Ge,K,z);break e}K=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=be.payload,z=typeof ae=="function"?ae.call(Ge,K,z):ae,z==null)break e;K=y({},K,z);break e;case 2:sr=!0}}z=A.callback,z!==null&&(s.flags|=64,P&&(s.flags|=8192),P=m.callbacks,P===null?m.callbacks=[z]:P.push(z))}else P={lane:z,tag:A.tag,payload:A.payload,callback:A.callback,next:null},Q===null?(B=Q=P,T=K):Q=Q.next=P,v|=z;if(A=A.next,A===null){if(A=m.shared.pending,A===null)break;P=A,A=P.next,P.next=null,m.lastBaseUpdate=P,m.shared.pending=null}}while(!0);Q===null&&(T=K),m.baseState=T,m.firstBaseUpdate=B,m.lastBaseUpdate=Q,g===null&&(m.shared.lanes=0),fr|=v,s.lanes=v,s.memoizedState=K}}function qy(s,l){if(typeof s!="function")throw Error(n(191,s));s.call(l)}function Py(s,l){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;s<u.length;s++)qy(u[s],l)}var Ks=E(null),bu=E(0);function Fy(s,l){s=Un,$(bu,s),$(Ks,l),Un=s|l.baseLanes}function Zf(){$(bu,Un),$(Ks,Ks.current)}function Jf(){Un=bu.current,I(Ks),I(bu)}var bi=E(null),Bi=null;function ar(s){var l=s.alternate;$(ct,ct.current&1),$(bi,s),Bi===null&&(l===null||Ks.current!==null||l.memoizedState!==null)&&(Bi=s)}function $f(s){$(ct,ct.current),$(bi,s),Bi===null&&(Bi=s)}function Vy(s){s.tag===22?($(ct,ct.current),$(bi,s),Bi===null&&(Bi=s)):ur()}function ur(){$(ct,ct.current),$(bi,bi.current)}function xi(s){I(bi),Bi===s&&(Bi=null),I(ct)}var ct=E(0);function xu(s){for(var l=s;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||sp(u)||lp(u)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Rn=0,Ce=null,Qe=null,gt=null,vu=!1,Ws=!1,rs=!1,Su=0,mo=0,Xs=null,sT=0;function st(){throw Error(n(321))}function ed(s,l){if(l===null)return!1;for(var u=0;u<l.length&&u<s.length;u++)if(!gi(s[u],l[u]))return!1;return!0}function td(s,l,u,f,m,g){return Rn=g,Ce=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,_.H=s===null||s.memoizedState===null?Mb:gd,rs=!1,g=u(f,m),rs=!1,Ws&&(g=Qy(l,u,f,m)),Iy(s),g}function Iy(s){_.H=bo;var l=Qe!==null&&Qe.next!==null;if(Rn=0,gt=Qe=Ce=null,vu=!1,mo=0,Xs=null,l)throw Error(n(300));s===null||yt||(s=s.dependencies,s!==null&&hu(s)&&(yt=!0))}function Qy(s,l,u,f){Ce=s;var m=0;do{if(Ws&&(Xs=null),mo=0,Ws=!1,25<=m)throw Error(n(301));if(m+=1,gt=Qe=null,s.updateQueue!=null){var g=s.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}_.H=Tb,g=l(u,f)}while(Ws);return g}function lT(){var s=_.H,l=s.useState()[0];return l=typeof l.then=="function"?go(l):l,s=s.useState()[0],(Qe!==null?Qe.memoizedState:null)!==s&&(Ce.flags|=1024),l}function id(){var s=Su!==0;return Su=0,s}function nd(s,l,u){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~u}function rd(s){if(vu){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}vu=!1}Rn=0,gt=Qe=Ce=null,Ws=!1,mo=Su=0,Xs=null}function Gt(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?Ce.memoizedState=gt=s:gt=gt.next=s,gt}function ht(){if(Qe===null){var s=Ce.alternate;s=s!==null?s.memoizedState:null}else s=Qe.next;var l=gt===null?Ce.memoizedState:gt.next;if(l!==null)gt=l,Qe=s;else{if(s===null)throw Ce.alternate===null?Error(n(467)):Error(n(310));Qe=s,s={memoizedState:Qe.memoizedState,baseState:Qe.baseState,baseQueue:Qe.baseQueue,queue:Qe.queue,next:null},gt===null?Ce.memoizedState=gt=s:gt=gt.next=s}return gt}function wu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function go(s){var l=mo;return mo+=1,Xs===null&&(Xs=[]),s=By(Xs,s,l),l=Ce,(gt===null?l.memoizedState:gt.next)===null&&(l=l.alternate,_.H=l===null||l.memoizedState===null?Mb:gd),s}function Cu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return go(s);if(s.$$typeof===D)return jt(s)}throw Error(n(438,String(s)))}function sd(s){var l=null,u=Ce.updateQueue;if(u!==null&&(l=u.memoCache),l==null){var f=Ce.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(l={data:f.data.map(function(m){return m.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),u===null&&(u=wu(),Ce.updateQueue=u),u.memoCache=l,u=l.data[l.index],u===void 0)for(u=l.data[l.index]=Array(s),f=0;f<s;f++)u[f]=ce;return l.index++,u}function Dn(s,l){return typeof l=="function"?l(s):l}function ku(s){var l=ht();return ld(l,Qe,s)}function ld(s,l,u){var f=s.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=u;var m=s.baseQueue,g=f.pending;if(g!==null){if(m!==null){var v=m.next;m.next=g.next,g.next=v}l.baseQueue=m=g,f.pending=null}if(g=s.baseState,m===null)s.memoizedState=g;else{l=m.next;var A=v=null,T=null,B=l,Q=!1;do{var K=B.lane&-536870913;if(K!==B.lane?(Re&K)===K:(Rn&K)===K){var z=B.revertLane;if(z===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),K===Is&&(Q=!0);else if((Rn&z)===z){B=B.next,z===Is&&(Q=!0);continue}else K={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},T===null?(A=T=K,v=g):T=T.next=K,Ce.lanes|=z,fr|=z;K=B.action,rs&&u(g,K),g=B.hasEagerState?B.eagerState:u(g,K)}else z={lane:K,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},T===null?(A=T=z,v=g):T=T.next=z,Ce.lanes|=K,fr|=K;B=B.next}while(B!==null&&B!==l);if(T===null?v=g:T.next=A,!gi(g,s.memoizedState)&&(yt=!0,Q&&(u=Qs,u!==null)))throw u;s.memoizedState=g,s.baseState=v,s.baseQueue=T,f.lastRenderedState=g}return m===null&&(f.lanes=0),[s.memoizedState,f.dispatch]}function od(s){var l=ht(),u=l.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=s;var f=u.dispatch,m=u.pending,g=l.memoizedState;if(m!==null){u.pending=null;var v=m=m.next;do g=s(g,v.action),v=v.next;while(v!==m);gi(g,l.memoizedState)||(yt=!0),l.memoizedState=g,l.baseQueue===null&&(l.baseState=g),u.lastRenderedState=g}return[g,f]}function Yy(s,l,u){var f=Ce,m=ht(),g=je;if(g){if(u===void 0)throw Error(n(407));u=u()}else u=l();var v=!gi((Qe||m).memoizedState,u);if(v&&(m.memoizedState=u,yt=!0),m=m.queue,cd(Wy.bind(null,f,m,s),[s]),m.getSnapshot!==l||v||gt!==null&&gt.memoizedState.tag&1){if(f.flags|=2048,Zs(9,{destroy:void 0},Ky.bind(null,f,m,u,l),null),We===null)throw Error(n(349));g||(Rn&127)!==0||Gy(f,l,u)}return u}function Gy(s,l,u){s.flags|=16384,s={getSnapshot:l,value:u},l=Ce.updateQueue,l===null?(l=wu(),Ce.updateQueue=l,l.stores=[s]):(u=l.stores,u===null?l.stores=[s]:u.push(s))}function Ky(s,l,u,f){l.value=u,l.getSnapshot=f,Xy(l)&&Zy(s)}function Wy(s,l,u){return u(function(){Xy(l)&&Zy(s)})}function Xy(s){var l=s.getSnapshot;s=s.value;try{var u=l();return!gi(s,u)}catch{return!0}}function Zy(s){var l=Wr(s,2);l!==null&&si(l,s,2)}function ad(s){var l=Gt();if(typeof s=="function"){var u=s;if(s=u(),rs){Jn(!0);try{u()}finally{Jn(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:s},l}function Jy(s,l,u,f){return s.baseState=u,ld(s,Qe,typeof f=="function"?f:Dn)}function oT(s,l,u,f,m){if(Tu(s))throw Error(n(485));if(s=l.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)}};_.T!==null?u(!0):g.isTransition=!1,f(g),u=l.pending,u===null?(g.next=l.pending=g,$y(l,g)):(g.next=u.next,l.pending=u.next=g)}}function $y(s,l){var u=l.action,f=l.payload,m=s.state;if(l.isTransition){var g=_.T,v={};_.T=v;try{var A=u(m,f),T=_.S;T!==null&&T(v,A),eb(s,l,A)}catch(B){ud(s,l,B)}finally{g!==null&&v.types!==null&&(g.types=v.types),_.T=g}}else try{g=u(m,f),eb(s,l,g)}catch(B){ud(s,l,B)}}function eb(s,l,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){tb(s,l,f)},function(f){return ud(s,l,f)}):tb(s,l,u)}function tb(s,l,u){l.status="fulfilled",l.value=u,ib(l),s.state=u,l=s.pending,l!==null&&(u=l.next,u===l?s.pending=null:(u=u.next,l.next=u,$y(s,u)))}function ud(s,l,u){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do l.status="rejected",l.reason=u,ib(l),l=l.next;while(l!==f)}s.action=null}function ib(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function nb(s,l){return l}function rb(s,l){if(je){var u=We.formState;if(u!==null){e:{var f=Ce;if(je){if($e){t:{for(var m=$e,g=Li;m.nodeType!==8;){if(!g){m=null;break t}if(m=zi(m.nextSibling),m===null){m=null;break t}}g=m.data,m=g==="F!"||g==="F"?m:null}if(m){$e=zi(m.nextSibling),f=m.data==="F!";break e}}nr(f)}f=!1}f&&(l=u[0])}}return u=Gt(),u.memoizedState=u.baseState=l,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nb,lastRenderedState:l},u.queue=f,u=Cb.bind(null,Ce,f),f.dispatch=u,f=ad(!1),g=md.bind(null,Ce,!1,f.queue),f=Gt(),m={state:l,dispatch:null,action:s,pending:null},f.queue=m,u=oT.bind(null,Ce,m,g,u),m.dispatch=u,f.memoizedState=s,[l,u,!1]}function sb(s){var l=ht();return lb(l,Qe,s)}function lb(s,l,u){if(l=ld(s,l,nb)[0],s=ku(Dn)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var f=go(l)}catch(v){throw v===Ys?pu:v}else f=l;l=ht();var m=l.queue,g=m.dispatch;return u!==l.memoizedState&&(Ce.flags|=2048,Zs(9,{destroy:void 0},aT.bind(null,m,u),null)),[f,g,s]}function aT(s,l){s.action=l}function ob(s){var l=ht(),u=Qe;if(u!==null)return lb(l,u,s);ht(),l=l.memoizedState,u=ht();var f=u.queue.dispatch;return u.memoizedState=s,[l,f,!1]}function Zs(s,l,u,f){return s={tag:s,create:u,deps:f,inst:l,next:null},l=Ce.updateQueue,l===null&&(l=wu(),Ce.updateQueue=l),u=l.lastEffect,u===null?l.lastEffect=s.next=s:(f=u.next,u.next=s,s.next=f,l.lastEffect=s),s}function ab(){return ht().memoizedState}function Au(s,l,u,f){var m=Gt();Ce.flags|=s,m.memoizedState=Zs(1|l,{destroy:void 0},u,f===void 0?null:f)}function Mu(s,l,u,f){var m=ht();f=f===void 0?null:f;var g=m.memoizedState.inst;Qe!==null&&f!==null&&ed(f,Qe.memoizedState.deps)?m.memoizedState=Zs(l,g,u,f):(Ce.flags|=s,m.memoizedState=Zs(1|l,g,u,f))}function ub(s,l){Au(8390656,8,s,l)}function cd(s,l){Mu(2048,8,s,l)}function uT(s){Ce.flags|=4;var l=Ce.updateQueue;if(l===null)l=wu(),Ce.updateQueue=l,l.events=[s];else{var u=l.events;u===null?l.events=[s]:u.push(s)}}function cb(s){var l=ht().memoizedState;return uT({ref:l,nextImpl:s}),function(){if((qe&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}function hb(s,l){return Mu(4,2,s,l)}function fb(s,l){return Mu(4,4,s,l)}function db(s,l){if(typeof l=="function"){s=s();var u=l(s);return function(){typeof u=="function"?u():l(null)}}if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function pb(s,l,u){u=u!=null?u.concat([s]):null,Mu(4,4,db.bind(null,l,s),u)}function hd(){}function mb(s,l){var u=ht();l=l===void 0?null:l;var f=u.memoizedState;return l!==null&&ed(l,f[1])?f[0]:(u.memoizedState=[s,l],s)}function gb(s,l){var u=ht();l=l===void 0?null:l;var f=u.memoizedState;if(l!==null&&ed(l,f[1]))return f[0];if(f=s(),rs){Jn(!0);try{s()}finally{Jn(!1)}}return u.memoizedState=[f,l],f}function fd(s,l,u){return u===void 0||(Rn&1073741824)!==0&&(Re&261930)===0?s.memoizedState=l:(s.memoizedState=u,s=yx(),Ce.lanes|=s,fr|=s,u)}function yb(s,l,u,f){return gi(u,l)?u:Ks.current!==null?(s=fd(s,u,f),gi(s,l)||(yt=!0),s):(Rn&42)===0||(Rn&1073741824)!==0&&(Re&261930)===0?(yt=!0,s.memoizedState=u):(s=yx(),Ce.lanes|=s,fr|=s,l)}function bb(s,l,u,f,m){var g=X.p;X.p=g!==0&&8>g?g:8;var v=_.T,A={};_.T=A,md(s,!1,l,u);try{var T=m(),B=_.S;if(B!==null&&B(A,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var Q=rT(T,f);yo(s,l,Q,wi(s))}else yo(s,l,f,wi(s))}catch(K){yo(s,l,{then:function(){},status:"rejected",reason:K},wi())}finally{X.p=g,v!==null&&A.types!==null&&(v.types=A.types),_.T=v}}function cT(){}function dd(s,l,u,f){if(s.tag!==5)throw Error(n(476));var m=xb(s).queue;bb(s,m,l,ne,u===null?cT:function(){return vb(s),u(f)})}function xb(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:ne},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function vb(s){var l=xb(s);l.next===null&&(l=s.alternate.memoizedState),yo(s,l.next.queue,{},wi())}function pd(){return jt(Lo)}function Sb(){return ht().memoizedState}function wb(){return ht().memoizedState}function hT(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var u=wi();s=lr(u);var f=or(l,s,u);f!==null&&(si(f,l,u),ho(f,l,u)),l={cache:Vf()},s.payload=l;return}l=l.return}}function fT(s,l,u){var f=wi();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Tu(s)?kb(l,u):(u=Df(s,l,u,f),u!==null&&(si(u,s,f),Ab(u,l,f)))}function Cb(s,l,u){var f=wi();yo(s,l,u,f)}function yo(s,l,u,f){var m={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Tu(s))kb(l,m);else{var g=s.alternate;if(s.lanes===0&&(g===null||g.lanes===0)&&(g=l.lastRenderedReducer,g!==null))try{var v=l.lastRenderedState,A=g(v,u);if(m.hasEagerState=!0,m.eagerState=A,gi(A,v))return ou(s,l,m,0),We===null&&lu(),!1}catch{}if(u=Df(s,l,m,f),u!==null)return si(u,s,f),Ab(u,l,f),!0}return!1}function md(s,l,u,f){if(f={lane:2,revertLane:Gd(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Tu(s)){if(l)throw Error(n(479))}else l=Df(s,u,f,2),l!==null&&si(l,s,2)}function Tu(s){var l=s.alternate;return s===Ce||l!==null&&l===Ce}function kb(s,l){Ws=vu=!0;var u=s.pending;u===null?l.next=l:(l.next=u.next,u.next=l),s.pending=l}function Ab(s,l,u){if((u&4194048)!==0){var f=l.lanes;f&=s.pendingLanes,u|=f,l.lanes=u,N0(s,u)}}var bo={readContext:jt,use:Cu,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useLayoutEffect:st,useInsertionEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useSyncExternalStore:st,useId:st,useHostTransitionStatus:st,useFormState:st,useActionState:st,useOptimistic:st,useMemoCache:st,useCacheRefresh:st};bo.useEffectEvent=st;var Mb={readContext:jt,use:Cu,useCallback:function(s,l){return Gt().memoizedState=[s,l===void 0?null:l],s},useContext:jt,useEffect:ub,useImperativeHandle:function(s,l,u){u=u!=null?u.concat([s]):null,Au(4194308,4,db.bind(null,l,s),u)},useLayoutEffect:function(s,l){return Au(4194308,4,s,l)},useInsertionEffect:function(s,l){Au(4,2,s,l)},useMemo:function(s,l){var u=Gt();l=l===void 0?null:l;var f=s();if(rs){Jn(!0);try{s()}finally{Jn(!1)}}return u.memoizedState=[f,l],f},useReducer:function(s,l,u){var f=Gt();if(u!==void 0){var m=u(l);if(rs){Jn(!0);try{u(l)}finally{Jn(!1)}}}else m=l;return f.memoizedState=f.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},f.queue=s,s=s.dispatch=fT.bind(null,Ce,s),[f.memoizedState,s]},useRef:function(s){var l=Gt();return s={current:s},l.memoizedState=s},useState:function(s){s=ad(s);var l=s.queue,u=Cb.bind(null,Ce,l);return l.dispatch=u,[s.memoizedState,u]},useDebugValue:hd,useDeferredValue:function(s,l){var u=Gt();return fd(u,s,l)},useTransition:function(){var s=ad(!1);return s=bb.bind(null,Ce,s.queue,!0,!1),Gt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,u){var f=Ce,m=Gt();if(je){if(u===void 0)throw Error(n(407));u=u()}else{if(u=l(),We===null)throw Error(n(349));(Re&127)!==0||Gy(f,l,u)}m.memoizedState=u;var g={value:u,getSnapshot:l};return m.queue=g,ub(Wy.bind(null,f,g,s),[s]),f.flags|=2048,Zs(9,{destroy:void 0},Ky.bind(null,f,g,u,l),null),u},useId:function(){var s=Gt(),l=We.identifierPrefix;if(je){var u=sn,f=rn;u=(f&~(1<<32-mi(f)-1)).toString(32)+u,l="_"+l+"R_"+u,u=Su++,0<u&&(l+="H"+u.toString(32)),l+="_"}else u=sT++,l="_"+l+"r_"+u.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:pd,useFormState:rb,useActionState:rb,useOptimistic:function(s){var l=Gt();l.memoizedState=l.baseState=s;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=u,l=md.bind(null,Ce,!0,u),u.dispatch=l,[s,l]},useMemoCache:sd,useCacheRefresh:function(){return Gt().memoizedState=hT.bind(null,Ce)},useEffectEvent:function(s){var l=Gt(),u={impl:s};return l.memoizedState=u,function(){if((qe&2)!==0)throw Error(n(440));return u.impl.apply(void 0,arguments)}}},gd={readContext:jt,use:Cu,useCallback:mb,useContext:jt,useEffect:cd,useImperativeHandle:pb,useInsertionEffect:hb,useLayoutEffect:fb,useMemo:gb,useReducer:ku,useRef:ab,useState:function(){return ku(Dn)},useDebugValue:hd,useDeferredValue:function(s,l){var u=ht();return yb(u,Qe.memoizedState,s,l)},useTransition:function(){var s=ku(Dn)[0],l=ht().memoizedState;return[typeof s=="boolean"?s:go(s),l]},useSyncExternalStore:Yy,useId:Sb,useHostTransitionStatus:pd,useFormState:sb,useActionState:sb,useOptimistic:function(s,l){var u=ht();return Jy(u,Qe,s,l)},useMemoCache:sd,useCacheRefresh:wb};gd.useEffectEvent=cb;var Tb={readContext:jt,use:Cu,useCallback:mb,useContext:jt,useEffect:cd,useImperativeHandle:pb,useInsertionEffect:hb,useLayoutEffect:fb,useMemo:gb,useReducer:od,useRef:ab,useState:function(){return od(Dn)},useDebugValue:hd,useDeferredValue:function(s,l){var u=ht();return Qe===null?fd(u,s,l):yb(u,Qe.memoizedState,s,l)},useTransition:function(){var s=od(Dn)[0],l=ht().memoizedState;return[typeof s=="boolean"?s:go(s),l]},useSyncExternalStore:Yy,useId:Sb,useHostTransitionStatus:pd,useFormState:ob,useActionState:ob,useOptimistic:function(s,l){var u=ht();return Qe!==null?Jy(u,Qe,s,l):(u.baseState=s,[s,u.queue.dispatch])},useMemoCache:sd,useCacheRefresh:wb};Tb.useEffectEvent=cb;function yd(s,l,u,f){l=s.memoizedState,u=u(f,l),u=u==null?l:y({},l,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var bd={enqueueSetState:function(s,l,u){s=s._reactInternals;var f=wi(),m=lr(f);m.payload=l,u!=null&&(m.callback=u),l=or(s,m,f),l!==null&&(si(l,s,f),ho(l,s,f))},enqueueReplaceState:function(s,l,u){s=s._reactInternals;var f=wi(),m=lr(f);m.tag=1,m.payload=l,u!=null&&(m.callback=u),l=or(s,m,f),l!==null&&(si(l,s,f),ho(l,s,f))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var u=wi(),f=lr(u);f.tag=2,l!=null&&(f.callback=l),l=or(s,f,u),l!==null&&(si(l,s,u),ho(l,s,u))}};function Ob(s,l,u,f,m,g,v){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(f,g,v):l.prototype&&l.prototype.isPureReactComponent?!no(u,f)||!no(m,g):!0}function Eb(s,l,u,f){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(u,f),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(u,f),l.state!==s&&bd.enqueueReplaceState(l,l.state,null)}function ss(s,l){var u=l;if("ref"in l){u={};for(var f in l)f!=="ref"&&(u[f]=l[f])}if(s=s.defaultProps){u===l&&(u=y({},u));for(var m in s)u[m]===void 0&&(u[m]=s[m])}return u}function Nb(s){su(s)}function Rb(s){console.error(s)}function Db(s){su(s)}function Ou(s,l){try{var u=s.onUncaughtError;u(l.value,{componentStack:l.stack})}catch(f){setTimeout(function(){throw f})}}function jb(s,l,u){try{var f=s.onCaughtError;f(u.value,{componentStack:u.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function xd(s,l,u){return u=lr(u),u.tag=3,u.payload={element:null},u.callback=function(){Ou(s,l)},u}function Lb(s){return s=lr(s),s.tag=3,s}function Bb(s,l,u,f){var m=u.type.getDerivedStateFromError;if(typeof m=="function"){var g=f.value;s.payload=function(){return m(g)},s.callback=function(){jb(l,u,f)}}var v=u.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(s.callback=function(){jb(l,u,f),typeof m!="function"&&(dr===null?dr=new Set([this]):dr.add(this));var A=f.stack;this.componentDidCatch(f.value,{componentStack:A!==null?A:""})})}function dT(s,l,u,f,m){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(l=u.alternate,l!==null&&Vs(l,u,m,!0),u=bi.current,u!==null){switch(u.tag){case 31:case 13:return Bi===null?qu():u.alternate===null&&lt===0&&(lt=3),u.flags&=-257,u.flags|=65536,u.lanes=m,f===mu?u.flags|=16384:(l=u.updateQueue,l===null?u.updateQueue=new Set([f]):l.add(f),Id(s,f,m)),!1;case 22:return u.flags|=65536,f===mu?u.flags|=16384:(l=u.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([f])},u.updateQueue=l):(u=l.retryQueue,u===null?l.retryQueue=new Set([f]):u.add(f)),Id(s,f,m)),!1}throw Error(n(435,u.tag))}return Id(s,f,m),qu(),!1}if(je)return l=bi.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=m,f!==Hf&&(s=Error(n(422),{cause:f}),lo(Ri(s,u)))):(f!==Hf&&(l=Error(n(423),{cause:f}),lo(Ri(l,u))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,f=Ri(f,u),m=xd(s.stateNode,f,m),Wf(s,m),lt!==4&&(lt=2)),!1;var g=Error(n(520),{cause:f});if(g=Ri(g,u),Mo===null?Mo=[g]:Mo.push(g),lt!==4&&(lt=2),l===null)return!0;f=Ri(f,u),u=l;do{switch(u.tag){case 3:return u.flags|=65536,s=m&-m,u.lanes|=s,s=xd(u.stateNode,f,s),Wf(u,s),!1;case 1:if(l=u.type,g=u.stateNode,(u.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(dr===null||!dr.has(g))))return u.flags|=65536,m&=-m,u.lanes|=m,m=Lb(m),Bb(m,s,u,f),Wf(u,m),!1}u=u.return}while(u!==null);return!1}var vd=Error(n(461)),yt=!1;function Lt(s,l,u,f){l.child=s===null?Uy(l,null,u,f):ns(l,s.child,u,f)}function zb(s,l,u,f,m){u=u.render;var g=l.ref;if("ref"in f){var v={};for(var A in f)A!=="ref"&&(v[A]=f[A])}else v=f;return $r(l),f=td(s,l,u,v,g,m),A=id(),s!==null&&!yt?(nd(s,l,m),jn(s,l,m)):(je&&A&&zf(l),l.flags|=1,Lt(s,l,f,m),l.child)}function _b(s,l,u,f,m){if(s===null){var g=u.type;return typeof g=="function"&&!jf(g)&&g.defaultProps===void 0&&u.compare===null?(l.tag=15,l.type=g,Hb(s,l,g,f,m)):(s=uu(u.type,null,f,l,l.mode,m),s.ref=l.ref,s.return=l,l.child=s)}if(g=s.child,!Od(s,m)){var v=g.memoizedProps;if(u=u.compare,u=u!==null?u:no,u(v,f)&&s.ref===l.ref)return jn(s,l,m)}return l.flags|=1,s=Tn(g,f),s.ref=l.ref,s.return=l,l.child=s}function Hb(s,l,u,f,m){if(s!==null){var g=s.memoizedProps;if(no(g,f)&&s.ref===l.ref)if(yt=!1,l.pendingProps=f=g,Od(s,m))(s.flags&131072)!==0&&(yt=!0);else return l.lanes=s.lanes,jn(s,l,m)}return Sd(s,l,u,f,m)}function Ub(s,l,u,f){var m=f.children,g=s!==null?s.memoizedState:null;if(s===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((l.flags&128)!==0){if(g=g!==null?g.baseLanes|u:u,s!==null){for(f=l.child=s.child,m=0;f!==null;)m=m|f.lanes|f.childLanes,f=f.sibling;f=m&~g}else f=0,l.child=null;return qb(s,l,g,u,f)}if((u&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&du(l,g!==null?g.cachePool:null),g!==null?Fy(l,g):Zf(),Vy(l);else return f=l.lanes=536870912,qb(s,l,g!==null?g.baseLanes|u:u,u,f)}else g!==null?(du(l,g.cachePool),Fy(l,g),ur(),l.memoizedState=null):(s!==null&&du(l,null),Zf(),ur());return Lt(s,l,m,u),l.child}function xo(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function qb(s,l,u,f,m){var g=Qf();return g=g===null?null:{parent:mt._currentValue,pool:g},l.memoizedState={baseLanes:u,cachePool:g},s!==null&&du(l,null),Zf(),Vy(l),s!==null&&Vs(s,l,f,!0),l.childLanes=m,null}function Eu(s,l){return l=Ru({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function Pb(s,l,u){return ns(l,s.child,null,u),s=Eu(l,l.pendingProps),s.flags|=2,xi(l),l.memoizedState=null,s}function pT(s,l,u){var f=l.pendingProps,m=(l.flags&128)!==0;if(l.flags&=-129,s===null){if(je){if(f.mode==="hidden")return s=Eu(l,f),l.lanes=536870912,xo(null,s);if($f(l),(s=$e)?(s=$x(s,Li),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:tr!==null?{id:rn,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},u=ky(s),u.return=l,l.child=u,Dt=l,$e=null)):s=null,s===null)throw nr(l);return l.lanes=536870912,null}return Eu(l,f)}var g=s.memoizedState;if(g!==null){var v=g.dehydrated;if($f(l),m)if(l.flags&256)l.flags&=-257,l=Pb(s,l,u);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(n(558));else if(yt||Vs(s,l,u,!1),m=(u&s.childLanes)!==0,yt||m){if(f=We,f!==null&&(v=R0(f,u),v!==0&&v!==g.retryLane))throw g.retryLane=v,Wr(s,v),si(f,s,v),vd;qu(),l=Pb(s,l,u)}else s=g.treeContext,$e=zi(v.nextSibling),Dt=l,je=!0,ir=null,Li=!1,s!==null&&Ty(l,s),l=Eu(l,f),l.flags|=4096;return l}return s=Tn(s.child,{mode:f.mode,children:f.children}),s.ref=l.ref,l.child=s,s.return=l,s}function Nu(s,l){var u=l.ref;if(u===null)s!==null&&s.ref!==null&&(l.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(n(284));(s===null||s.ref!==u)&&(l.flags|=4194816)}}function Sd(s,l,u,f,m){return $r(l),u=td(s,l,u,f,void 0,m),f=id(),s!==null&&!yt?(nd(s,l,m),jn(s,l,m)):(je&&f&&zf(l),l.flags|=1,Lt(s,l,u,m),l.child)}function Fb(s,l,u,f,m,g){return $r(l),l.updateQueue=null,u=Qy(l,f,u,m),Iy(s),f=id(),s!==null&&!yt?(nd(s,l,g),jn(s,l,g)):(je&&f&&zf(l),l.flags|=1,Lt(s,l,u,g),l.child)}function Vb(s,l,u,f,m){if($r(l),l.stateNode===null){var g=Us,v=u.contextType;typeof v=="object"&&v!==null&&(g=jt(v)),g=new u(f,g),l.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=bd,l.stateNode=g,g._reactInternals=l,g=l.stateNode,g.props=f,g.state=l.memoizedState,g.refs={},Gf(l),v=u.contextType,g.context=typeof v=="object"&&v!==null?jt(v):Us,g.state=l.memoizedState,v=u.getDerivedStateFromProps,typeof v=="function"&&(yd(l,u,v,f),g.state=l.memoizedState),typeof u.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&&bd.enqueueReplaceState(g,g.state,null),po(l,f,g,m),fo(),g.state=l.memoizedState),typeof g.componentDidMount=="function"&&(l.flags|=4194308),f=!0}else if(s===null){g=l.stateNode;var A=l.memoizedProps,T=ss(u,A);g.props=T;var B=g.context,Q=u.contextType;v=Us,typeof Q=="object"&&Q!==null&&(v=jt(Q));var K=u.getDerivedStateFromProps;Q=typeof K=="function"||typeof g.getSnapshotBeforeUpdate=="function",A=l.pendingProps!==A,Q||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(A||B!==v)&&Eb(l,g,f,v),sr=!1;var z=l.memoizedState;g.state=z,po(l,f,g,m),fo(),B=l.memoizedState,A||z!==B||sr?(typeof K=="function"&&(yd(l,u,K,f),B=l.memoizedState),(T=sr||Ob(l,u,T,f,z,B,v))?(Q||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"&&(l.flags|=4194308)):(typeof g.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=f,l.memoizedState=B),g.props=f,g.state=B,g.context=v,f=T):(typeof g.componentDidMount=="function"&&(l.flags|=4194308),f=!1)}else{g=l.stateNode,Kf(s,l),v=l.memoizedProps,Q=ss(u,v),g.props=Q,K=l.pendingProps,z=g.context,B=u.contextType,T=Us,typeof B=="object"&&B!==null&&(T=jt(B)),A=u.getDerivedStateFromProps,(B=typeof A=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(v!==K||z!==T)&&Eb(l,g,f,T),sr=!1,z=l.memoizedState,g.state=z,po(l,f,g,m),fo();var P=l.memoizedState;v!==K||z!==P||sr||s!==null&&s.dependencies!==null&&hu(s.dependencies)?(typeof A=="function"&&(yd(l,u,A,f),P=l.memoizedState),(Q=sr||Ob(l,u,Q,f,z,P,T)||s!==null&&s.dependencies!==null&&hu(s.dependencies))?(B||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(f,P,T),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(f,P,T)),typeof g.componentDidUpdate=="function"&&(l.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof g.componentDidUpdate!="function"||v===s.memoizedProps&&z===s.memoizedState||(l.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||v===s.memoizedProps&&z===s.memoizedState||(l.flags|=1024),l.memoizedProps=f,l.memoizedState=P),g.props=f,g.state=P,g.context=T,f=Q):(typeof g.componentDidUpdate!="function"||v===s.memoizedProps&&z===s.memoizedState||(l.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||v===s.memoizedProps&&z===s.memoizedState||(l.flags|=1024),f=!1)}return g=f,Nu(s,l),f=(l.flags&128)!==0,g||f?(g=l.stateNode,u=f&&typeof u.getDerivedStateFromError!="function"?null:g.render(),l.flags|=1,s!==null&&f?(l.child=ns(l,s.child,null,m),l.child=ns(l,null,u,m)):Lt(s,l,u,m),l.memoizedState=g.state,s=l.child):s=jn(s,l,m),s}function Ib(s,l,u,f){return Zr(),l.flags|=256,Lt(s,l,u,f),l.child}var wd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cd(s){return{baseLanes:s,cachePool:jy()}}function kd(s,l,u){return s=s!==null?s.childLanes&~u:0,l&&(s|=Si),s}function Qb(s,l,u){var f=l.pendingProps,m=!1,g=(l.flags&128)!==0,v;if((v=g)||(v=s!==null&&s.memoizedState===null?!1:(ct.current&2)!==0),v&&(m=!0,l.flags&=-129),v=(l.flags&32)!==0,l.flags&=-33,s===null){if(je){if(m?ar(l):ur(),(s=$e)?(s=$x(s,Li),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:tr!==null?{id:rn,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},u=ky(s),u.return=l,l.child=u,Dt=l,$e=null)):s=null,s===null)throw nr(l);return lp(s)?l.lanes=32:l.lanes=536870912,null}var A=f.children;return f=f.fallback,m?(ur(),m=l.mode,A=Ru({mode:"hidden",children:A},m),f=Xr(f,m,u,null),A.return=l,f.return=l,A.sibling=f,l.child=A,f=l.child,f.memoizedState=Cd(u),f.childLanes=kd(s,v,u),l.memoizedState=wd,xo(null,f)):(ar(l),Ad(l,A))}var T=s.memoizedState;if(T!==null&&(A=T.dehydrated,A!==null)){if(g)l.flags&256?(ar(l),l.flags&=-257,l=Md(s,l,u)):l.memoizedState!==null?(ur(),l.child=s.child,l.flags|=128,l=null):(ur(),A=f.fallback,m=l.mode,f=Ru({mode:"visible",children:f.children},m),A=Xr(A,m,u,null),A.flags|=2,f.return=l,A.return=l,f.sibling=A,l.child=f,ns(l,s.child,null,u),f=l.child,f.memoizedState=Cd(u),f.childLanes=kd(s,v,u),l.memoizedState=wd,l=xo(null,f));else if(ar(l),lp(A)){if(v=A.nextSibling&&A.nextSibling.dataset,v)var B=v.dgst;v=B,f=Error(n(419)),f.stack="",f.digest=v,lo({value:f,source:null,stack:null}),l=Md(s,l,u)}else if(yt||Vs(s,l,u,!1),v=(u&s.childLanes)!==0,yt||v){if(v=We,v!==null&&(f=R0(v,u),f!==0&&f!==T.retryLane))throw T.retryLane=f,Wr(s,f),si(v,s,f),vd;sp(A)||qu(),l=Md(s,l,u)}else sp(A)?(l.flags|=192,l.child=s.child,l=null):(s=T.treeContext,$e=zi(A.nextSibling),Dt=l,je=!0,ir=null,Li=!1,s!==null&&Ty(l,s),l=Ad(l,f.children),l.flags|=4096);return l}return m?(ur(),A=f.fallback,m=l.mode,T=s.child,B=T.sibling,f=Tn(T,{mode:"hidden",children:f.children}),f.subtreeFlags=T.subtreeFlags&65011712,B!==null?A=Tn(B,A):(A=Xr(A,m,u,null),A.flags|=2),A.return=l,f.return=l,f.sibling=A,l.child=f,xo(null,f),f=l.child,A=s.child.memoizedState,A===null?A=Cd(u):(m=A.cachePool,m!==null?(T=mt._currentValue,m=m.parent!==T?{parent:T,pool:T}:m):m=jy(),A={baseLanes:A.baseLanes|u,cachePool:m}),f.memoizedState=A,f.childLanes=kd(s,v,u),l.memoizedState=wd,xo(s.child,f)):(ar(l),u=s.child,s=u.sibling,u=Tn(u,{mode:"visible",children:f.children}),u.return=l,u.sibling=null,s!==null&&(v=l.deletions,v===null?(l.deletions=[s],l.flags|=16):v.push(s)),l.child=u,l.memoizedState=null,u)}function Ad(s,l){return l=Ru({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function Ru(s,l){return s=yi(22,s,null,l),s.lanes=0,s}function Md(s,l,u){return ns(l,s.child,null,u),s=Ad(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function Yb(s,l,u){s.lanes|=l;var f=s.alternate;f!==null&&(f.lanes|=l),Pf(s.return,l,u)}function Td(s,l,u,f,m,g){var v=s.memoizedState;v===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:m,treeForkCount:g}:(v.isBackwards=l,v.rendering=null,v.renderingStartTime=0,v.last=f,v.tail=u,v.tailMode=m,v.treeForkCount=g)}function Gb(s,l,u){var f=l.pendingProps,m=f.revealOrder,g=f.tail;f=f.children;var v=ct.current,A=(v&2)!==0;if(A?(v=v&1|2,l.flags|=128):v&=1,$(ct,v),Lt(s,l,f,u),f=je?so:0,!A&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Yb(s,u,l);else if(s.tag===19)Yb(s,u,l);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===l)break e;for(;s.sibling===null;){if(s.return===null||s.return===l)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"forwards":for(u=l.child,m=null;u!==null;)s=u.alternate,s!==null&&xu(s)===null&&(m=u),u=u.sibling;u=m,u===null?(m=l.child,l.child=null):(m=u.sibling,u.sibling=null),Td(l,!1,m,u,g,f);break;case"backwards":case"unstable_legacy-backwards":for(u=null,m=l.child,l.child=null;m!==null;){if(s=m.alternate,s!==null&&xu(s)===null){l.child=m;break}s=m.sibling,m.sibling=u,u=m,m=s}Td(l,!0,u,null,g,f);break;case"together":Td(l,!1,null,null,void 0,f);break;default:l.memoizedState=null}return l.child}function jn(s,l,u){if(s!==null&&(l.dependencies=s.dependencies),fr|=l.lanes,(u&l.childLanes)===0)if(s!==null){if(Vs(s,l,u,!1),(u&l.childLanes)===0)return null}else return null;if(s!==null&&l.child!==s.child)throw Error(n(153));if(l.child!==null){for(s=l.child,u=Tn(s,s.pendingProps),l.child=u,u.return=l;s.sibling!==null;)s=s.sibling,u=u.sibling=Tn(s,s.pendingProps),u.return=l;u.sibling=null}return l.child}function Od(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&hu(s)))}function mT(s,l,u){switch(l.tag){case 3:Yt(l,l.stateNode.containerInfo),rr(l,mt,s.memoizedState.cache),Zr();break;case 27:case 5:Il(l);break;case 4:Yt(l,l.stateNode.containerInfo);break;case 10:rr(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,$f(l),null;break;case 13:var f=l.memoizedState;if(f!==null)return f.dehydrated!==null?(ar(l),l.flags|=128,null):(u&l.child.childLanes)!==0?Qb(s,l,u):(ar(l),s=jn(s,l,u),s!==null?s.sibling:null);ar(l);break;case 19:var m=(s.flags&128)!==0;if(f=(u&l.childLanes)!==0,f||(Vs(s,l,u,!1),f=(u&l.childLanes)!==0),m){if(f)return Gb(s,l,u);l.flags|=128}if(m=l.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),$(ct,ct.current),f)break;return null;case 22:return l.lanes=0,Ub(s,l,u,l.pendingProps);case 24:rr(l,mt,s.memoizedState.cache)}return jn(s,l,u)}function Kb(s,l,u){if(s!==null)if(s.memoizedProps!==l.pendingProps)yt=!0;else{if(!Od(s,u)&&(l.flags&128)===0)return yt=!1,mT(s,l,u);yt=(s.flags&131072)!==0}else yt=!1,je&&(l.flags&1048576)!==0&&My(l,so,l.index);switch(l.lanes=0,l.tag){case 16:e:{var f=l.pendingProps;if(s=ts(l.elementType),l.type=s,typeof s=="function")jf(s)?(f=ss(s,f),l.tag=1,l=Vb(null,l,s,f,u)):(l.tag=0,l=Sd(null,l,s,f,u));else{if(s!=null){var m=s.$$typeof;if(m===V){l.tag=11,l=zb(null,l,s,f,u);break e}else if(m===U){l.tag=14,l=_b(null,l,s,f,u);break e}}throw l=fe(s)||s,Error(n(306,l,""))}}return l;case 0:return Sd(s,l,l.type,l.pendingProps,u);case 1:return f=l.type,m=ss(f,l.pendingProps),Vb(s,l,f,m,u);case 3:e:{if(Yt(l,l.stateNode.containerInfo),s===null)throw Error(n(387));f=l.pendingProps;var g=l.memoizedState;m=g.element,Kf(s,l),po(l,f,null,u);var v=l.memoizedState;if(f=v.cache,rr(l,mt,f),f!==g.cache&&Ff(l,[mt],u,!0),fo(),f=v.element,g.isDehydrated)if(g={element:f,isDehydrated:!1,cache:v.cache},l.updateQueue.baseState=g,l.memoizedState=g,l.flags&256){l=Ib(s,l,f,u);break e}else if(f!==m){m=Ri(Error(n(424)),l),lo(m),l=Ib(s,l,f,u);break e}else for(s=l.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,$e=zi(s.firstChild),Dt=l,je=!0,ir=null,Li=!0,u=Uy(l,null,f,u),l.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Zr(),f===m){l=jn(s,l,u);break e}Lt(s,l,f,u)}l=l.child}return l;case 26:return Nu(s,l),s===null?(u=s1(l.type,null,l.pendingProps,null))?l.memoizedState=u:je||(u=l.type,s=l.pendingProps,f=Gu(we.current).createElement(u),f[Rt]=l,f[$t]=s,Bt(f,u,s),Mt(f),l.stateNode=f):l.memoizedState=s1(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return Il(l),s===null&&je&&(f=l.stateNode=i1(l.type,l.pendingProps,we.current),Dt=l,Li=!0,m=$e,yr(l.type)?(op=m,$e=zi(f.firstChild)):$e=m),Lt(s,l,l.pendingProps.children,u),Nu(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&je&&((m=f=$e)&&(f=QT(f,l.type,l.pendingProps,Li),f!==null?(l.stateNode=f,Dt=l,$e=zi(f.firstChild),Li=!1,m=!0):m=!1),m||nr(l)),Il(l),m=l.type,g=l.pendingProps,v=s!==null?s.memoizedProps:null,f=g.children,ip(m,g)?f=null:v!==null&&ip(m,v)&&(l.flags|=32),l.memoizedState!==null&&(m=td(s,l,lT,null,null,u),Lo._currentValue=m),Nu(s,l),Lt(s,l,f,u),l.child;case 6:return s===null&&je&&((s=u=$e)&&(u=YT(u,l.pendingProps,Li),u!==null?(l.stateNode=u,Dt=l,$e=null,s=!0):s=!1),s||nr(l)),null;case 13:return Qb(s,l,u);case 4:return Yt(l,l.stateNode.containerInfo),f=l.pendingProps,s===null?l.child=ns(l,null,f,u):Lt(s,l,f,u),l.child;case 11:return zb(s,l,l.type,l.pendingProps,u);case 7:return Lt(s,l,l.pendingProps,u),l.child;case 8:return Lt(s,l,l.pendingProps.children,u),l.child;case 12:return Lt(s,l,l.pendingProps.children,u),l.child;case 10:return f=l.pendingProps,rr(l,l.type,f.value),Lt(s,l,f.children,u),l.child;case 9:return m=l.type._context,f=l.pendingProps.children,$r(l),m=jt(m),f=f(m),l.flags|=1,Lt(s,l,f,u),l.child;case 14:return _b(s,l,l.type,l.pendingProps,u);case 15:return Hb(s,l,l.type,l.pendingProps,u);case 19:return Gb(s,l,u);case 31:return pT(s,l,u);case 22:return Ub(s,l,u,l.pendingProps);case 24:return $r(l),f=jt(mt),s===null?(m=Qf(),m===null&&(m=We,g=Vf(),m.pooledCache=g,g.refCount++,g!==null&&(m.pooledCacheLanes|=u),m=g),l.memoizedState={parent:f,cache:m},Gf(l),rr(l,mt,m)):((s.lanes&u)!==0&&(Kf(s,l),po(l,null,null,u),fo()),m=s.memoizedState,g=l.memoizedState,m.parent!==f?(m={parent:f,cache:f},l.memoizedState=m,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=m),rr(l,mt,f)):(f=g.cache,rr(l,mt,f),f!==m.cache&&Ff(l,[mt],u,!0))),Lt(s,l,l.pendingProps.children,u),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function Ln(s){s.flags|=4}function Ed(s,l,u,f,m){if((l=(s.mode&32)!==0)&&(l=!1),l){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(Sx())s.flags|=8192;else throw is=mu,Yf}else s.flags&=-16777217}function Wb(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!c1(l))if(Sx())s.flags|=8192;else throw is=mu,Yf}function Du(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?O0():536870912,s.lanes|=l,tl|=l)}function vo(s,l){if(!je)switch(s.tailMode){case"hidden":l=s.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:f.sibling=null}}function et(s){var l=s.alternate!==null&&s.alternate.child===s.child,u=0,f=0;if(l)for(var m=s.child;m!==null;)u|=m.lanes|m.childLanes,f|=m.subtreeFlags&65011712,f|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)u|=m.lanes|m.childLanes,f|=m.subtreeFlags,f|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=f,s.childLanes=u,l}function gT(s,l,u){var f=l.pendingProps;switch(_f(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(l),null;case 1:return et(l),null;case 3:return u=l.stateNode,f=null,s!==null&&(f=s.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),Nn(mt),ut(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(Fs(l)?Ln(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Uf())),et(l),null;case 26:var m=l.type,g=l.memoizedState;return s===null?(Ln(l),g!==null?(et(l),Wb(l,g)):(et(l),Ed(l,m,null,f,u))):g?g!==s.memoizedState?(Ln(l),et(l),Wb(l,g)):(et(l),l.flags&=-16777217):(s=s.memoizedProps,s!==f&&Ln(l),et(l),Ed(l,m,s,f,u)),null;case 27:if(Va(l),u=we.current,m=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==f&&Ln(l);else{if(!f){if(l.stateNode===null)throw Error(n(166));return et(l),null}s=re.current,Fs(l)?Oy(l):(s=i1(m,f,u),l.stateNode=s,Ln(l))}return et(l),null;case 5:if(Va(l),m=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==f&&Ln(l);else{if(!f){if(l.stateNode===null)throw Error(n(166));return et(l),null}if(g=re.current,Fs(l))Oy(l);else{var v=Gu(we.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 f.is=="string"?v.createElement("select",{is:f.is}):v.createElement("select"),f.multiple?g.multiple=!0:f.size&&(g.size=f.size);break;default:g=typeof f.is=="string"?v.createElement(m,{is:f.is}):v.createElement(m)}}g[Rt]=l,g[$t]=f;e:for(v=l.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===l)break e;for(;v.sibling===null;){if(v.return===null||v.return===l)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}l.stateNode=g;e:switch(Bt(g,m,f),m){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Ln(l)}}return et(l),Ed(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,u),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==f&&Ln(l);else{if(typeof f!="string"&&l.stateNode===null)throw Error(n(166));if(s=we.current,Fs(l)){if(s=l.stateNode,u=l.memoizedProps,f=null,m=Dt,m!==null)switch(m.tag){case 27:case 5:f=m.memoizedProps}s[Rt]=l,s=!!(s.nodeValue===u||f!==null&&f.suppressHydrationWarning===!0||Qx(s.nodeValue,u)),s||nr(l,!0)}else s=Gu(s).createTextNode(f),s[Rt]=l,l.stateNode=s}return et(l),null;case 31:if(u=l.memoizedState,s===null||s.memoizedState!==null){if(f=Fs(l),u!==null){if(s===null){if(!f)throw Error(n(318));if(s=l.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(557));s[Rt]=l}else Zr(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;et(l),s=!1}else u=Uf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return l.flags&256?(xi(l),l):(xi(l),null);if((l.flags&128)!==0)throw Error(n(558))}return et(l),null;case 13:if(f=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=Fs(l),f!==null&&f.dehydrated!==null){if(s===null){if(!m)throw Error(n(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(n(317));m[Rt]=l}else Zr(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;et(l),m=!1}else m=Uf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(xi(l),l):(xi(l),null)}return xi(l),(l.flags&128)!==0?(l.lanes=u,l):(u=f!==null,s=s!==null&&s.memoizedState!==null,u&&(f=l.child,m=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(m=f.alternate.memoizedState.cachePool.pool),g=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(g=f.memoizedState.cachePool.pool),g!==m&&(f.flags|=2048)),u!==s&&u&&(l.child.flags|=8192),Du(l,l.updateQueue),et(l),null);case 4:return ut(),s===null&&Zd(l.stateNode.containerInfo),et(l),null;case 10:return Nn(l.type),et(l),null;case 19:if(I(ct),f=l.memoizedState,f===null)return et(l),null;if(m=(l.flags&128)!==0,g=f.rendering,g===null)if(m)vo(f,!1);else{if(lt!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(g=xu(s),g!==null){for(l.flags|=128,vo(f,!1),s=g.updateQueue,l.updateQueue=s,Du(l,s),l.subtreeFlags=0,s=u,u=l.child;u!==null;)Cy(u,s),u=u.sibling;return $(ct,ct.current&1|2),je&&On(l,f.treeForkCount),l.child}s=s.sibling}f.tail!==null&&di()>_u&&(l.flags|=128,m=!0,vo(f,!1),l.lanes=4194304)}else{if(!m)if(s=xu(g),s!==null){if(l.flags|=128,m=!0,s=s.updateQueue,l.updateQueue=s,Du(l,s),vo(f,!0),f.tail===null&&f.tailMode==="hidden"&&!g.alternate&&!je)return et(l),null}else 2*di()-f.renderingStartTime>_u&&u!==536870912&&(l.flags|=128,m=!0,vo(f,!1),l.lanes=4194304);f.isBackwards?(g.sibling=l.child,l.child=g):(s=f.last,s!==null?s.sibling=g:l.child=g,f.last=g)}return f.tail!==null?(s=f.tail,f.rendering=s,f.tail=s.sibling,f.renderingStartTime=di(),s.sibling=null,u=ct.current,$(ct,m?u&1|2:u&1),je&&On(l,f.treeForkCount),s):(et(l),null);case 22:case 23:return xi(l),Jf(),f=l.memoizedState!==null,s!==null?s.memoizedState!==null!==f&&(l.flags|=8192):f&&(l.flags|=8192),f?(u&536870912)!==0&&(l.flags&128)===0&&(et(l),l.subtreeFlags&6&&(l.flags|=8192)):et(l),u=l.updateQueue,u!==null&&Du(l,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),f=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(f=l.memoizedState.cachePool.pool),f!==u&&(l.flags|=2048),s!==null&&I(es),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),l.memoizedState.cache!==u&&(l.flags|=2048),Nn(mt),et(l),null;case 25:return null;case 30:return null}throw Error(n(156,l.tag))}function yT(s,l){switch(_f(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return Nn(mt),ut(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return Va(l),null;case 31:if(l.memoizedState!==null){if(xi(l),l.alternate===null)throw Error(n(340));Zr()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(xi(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(n(340));Zr()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return I(ct),null;case 4:return ut(),null;case 10:return Nn(l.type),null;case 22:case 23:return xi(l),Jf(),s!==null&&I(es),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return Nn(mt),null;case 25:return null;default:return null}}function Xb(s,l){switch(_f(l),l.tag){case 3:Nn(mt),ut();break;case 26:case 27:case 5:Va(l);break;case 4:ut();break;case 31:l.memoizedState!==null&&xi(l);break;case 13:xi(l);break;case 19:I(ct);break;case 10:Nn(l.type);break;case 22:case 23:xi(l),Jf(),s!==null&&I(es);break;case 24:Nn(mt)}}function So(s,l){try{var u=l.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var m=f.next;u=m;do{if((u.tag&s)===s){f=void 0;var g=u.create,v=u.inst;f=g(),v.destroy=f}u=u.next}while(u!==m)}}catch(A){Ie(l,l.return,A)}}function cr(s,l,u){try{var f=l.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var g=m.next;f=g;do{if((f.tag&s)===s){var v=f.inst,A=v.destroy;if(A!==void 0){v.destroy=void 0,m=l;var T=u,B=A;try{B()}catch(Q){Ie(m,T,Q)}}}f=f.next}while(f!==g)}}catch(Q){Ie(l,l.return,Q)}}function Zb(s){var l=s.updateQueue;if(l!==null){var u=s.stateNode;try{Py(l,u)}catch(f){Ie(s,s.return,f)}}}function Jb(s,l,u){u.props=ss(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(f){Ie(s,l,f)}}function wo(s,l){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var f=s.stateNode;break;case 30:f=s.stateNode;break;default:f=s.stateNode}typeof u=="function"?s.refCleanup=u(f):u.current=f}}catch(m){Ie(s,l,m)}}function ln(s,l){var u=s.ref,f=s.refCleanup;if(u!==null)if(typeof f=="function")try{f()}catch(m){Ie(s,l,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(m){Ie(s,l,m)}else u.current=null}function $b(s){var l=s.type,u=s.memoizedProps,f=s.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":u.autoFocus&&f.focus();break e;case"img":u.src?f.src=u.src:u.srcSet&&(f.srcset=u.srcSet)}}catch(m){Ie(s,s.return,m)}}function Nd(s,l,u){try{var f=s.stateNode;UT(f,s.type,u,l),f[$t]=l}catch(m){Ie(s,s.return,m)}}function ex(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&yr(s.type)||s.tag===4}function Rd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||ex(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&&yr(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 Dd(s,l,u){var f=s.tag;if(f===5||f===6)s=s.stateNode,l?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(s,l):(l=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,l.appendChild(s),u=u._reactRootContainer,u!=null||l.onclick!==null||(l.onclick=An));else if(f!==4&&(f===27&&yr(s.type)&&(u=s.stateNode,l=null),s=s.child,s!==null))for(Dd(s,l,u),s=s.sibling;s!==null;)Dd(s,l,u),s=s.sibling}function ju(s,l,u){var f=s.tag;if(f===5||f===6)s=s.stateNode,l?u.insertBefore(s,l):u.appendChild(s);else if(f!==4&&(f===27&&yr(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(ju(s,l,u),s=s.sibling;s!==null;)ju(s,l,u),s=s.sibling}function tx(s){var l=s.stateNode,u=s.memoizedProps;try{for(var f=s.type,m=l.attributes;m.length;)l.removeAttributeNode(m[0]);Bt(l,f,u),l[Rt]=s,l[$t]=u}catch(g){Ie(s,s.return,g)}}var Bn=!1,bt=!1,jd=!1,ix=typeof WeakSet=="function"?WeakSet:Set,Tt=null;function bT(s,l){if(s=s.containerInfo,ep=ec,s=py(s),Mf(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var m=f.anchorOffset,g=f.focusNode;f=f.focusOffset;try{u.nodeType,g.nodeType}catch{u=null;break e}var v=0,A=-1,T=-1,B=0,Q=0,K=s,z=null;t:for(;;){for(var P;K!==u||m!==0&&K.nodeType!==3||(A=v+m),K!==g||f!==0&&K.nodeType!==3||(T=v+f),K.nodeType===3&&(v+=K.nodeValue.length),(P=K.firstChild)!==null;)z=K,K=P;for(;;){if(K===s)break t;if(z===u&&++B===m&&(A=v),z===g&&++Q===f&&(T=v),(P=K.nextSibling)!==null)break;K=z,z=K.parentNode}K=P}u=A===-1||T===-1?null:{start:A,end:T}}else u=null}u=u||{start:0,end:0}}else u=null;for(tp={focusedElem:s,selectionRange:u},ec=!1,Tt=l;Tt!==null;)if(l=Tt,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,Tt=s;else for(;Tt!==null;){switch(l=Tt,g=l.alternate,s=l.flags,l.tag){case 0:if((s&4)!==0&&(s=l.updateQueue,s=s!==null?s.events:null,s!==null))for(u=0;u<s.length;u++)m=s[u],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&g!==null){s=void 0,u=l,m=g.memoizedProps,g=g.memoizedState,f=u.stateNode;try{var ae=ss(u.type,m);s=f.getSnapshotBeforeUpdate(ae,g),f.__reactInternalSnapshotBeforeUpdate=s}catch(be){Ie(u,u.return,be)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,u=s.nodeType,u===9)rp(s);else if(u===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":rp(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(n(163))}if(s=l.sibling,s!==null){s.return=l.return,Tt=s;break}Tt=l.return}}function nx(s,l,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:_n(s,u),f&4&&So(5,u);break;case 1:if(_n(s,u),f&4)if(s=u.stateNode,l===null)try{s.componentDidMount()}catch(v){Ie(u,u.return,v)}else{var m=ss(u.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(m,l,s.__reactInternalSnapshotBeforeUpdate)}catch(v){Ie(u,u.return,v)}}f&64&&Zb(u),f&512&&wo(u,u.return);break;case 3:if(_n(s,u),f&64&&(s=u.updateQueue,s!==null)){if(l=null,u.child!==null)switch(u.child.tag){case 27:case 5:l=u.child.stateNode;break;case 1:l=u.child.stateNode}try{Py(s,l)}catch(v){Ie(u,u.return,v)}}break;case 27:l===null&&f&4&&tx(u);case 26:case 5:_n(s,u),l===null&&f&4&&$b(u),f&512&&wo(u,u.return);break;case 12:_n(s,u);break;case 31:_n(s,u),f&4&&lx(s,u);break;case 13:_n(s,u),f&4&&ox(s,u),f&64&&(s=u.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(u=TT.bind(null,u),GT(s,u))));break;case 22:if(f=u.memoizedState!==null||Bn,!f){l=l!==null&&l.memoizedState!==null||bt,m=Bn;var g=bt;Bn=f,(bt=l)&&!g?Hn(s,u,(u.subtreeFlags&8772)!==0):_n(s,u),Bn=m,bt=g}break;case 30:break;default:_n(s,u)}}function rx(s){var l=s.alternate;l!==null&&(s.alternate=null,rx(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&uf(l)),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 it=null,ti=!1;function zn(s,l,u){for(u=u.child;u!==null;)sx(s,l,u),u=u.sibling}function sx(s,l,u){if(pi&&typeof pi.onCommitFiberUnmount=="function")try{pi.onCommitFiberUnmount(Ql,u)}catch{}switch(u.tag){case 26:bt||ln(u,l),zn(s,l,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:bt||ln(u,l);var f=it,m=ti;yr(u.type)&&(it=u.stateNode,ti=!1),zn(s,l,u),Ro(u.stateNode),it=f,ti=m;break;case 5:bt||ln(u,l);case 6:if(f=it,m=ti,it=null,zn(s,l,u),it=f,ti=m,it!==null)if(ti)try{(it.nodeType===9?it.body:it.nodeName==="HTML"?it.ownerDocument.body:it).removeChild(u.stateNode)}catch(g){Ie(u,l,g)}else try{it.removeChild(u.stateNode)}catch(g){Ie(u,l,g)}break;case 18:it!==null&&(ti?(s=it,Zx(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,u.stateNode),ul(s)):Zx(it,u.stateNode));break;case 4:f=it,m=ti,it=u.stateNode.containerInfo,ti=!0,zn(s,l,u),it=f,ti=m;break;case 0:case 11:case 14:case 15:cr(2,u,l),bt||cr(4,u,l),zn(s,l,u);break;case 1:bt||(ln(u,l),f=u.stateNode,typeof f.componentWillUnmount=="function"&&Jb(u,l,f)),zn(s,l,u);break;case 21:zn(s,l,u);break;case 22:bt=(f=bt)||u.memoizedState!==null,zn(s,l,u),bt=f;break;default:zn(s,l,u)}}function lx(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{ul(s)}catch(u){Ie(l,l.return,u)}}}function ox(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{ul(s)}catch(u){Ie(l,l.return,u)}}function xT(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new ix),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new ix),l;default:throw Error(n(435,s.tag))}}function Lu(s,l){var u=xT(s);l.forEach(function(f){if(!u.has(f)){u.add(f);var m=OT.bind(null,s,f);f.then(m,m)}})}function ii(s,l){var u=l.deletions;if(u!==null)for(var f=0;f<u.length;f++){var m=u[f],g=s,v=l,A=v;e:for(;A!==null;){switch(A.tag){case 27:if(yr(A.type)){it=A.stateNode,ti=!1;break e}break;case 5:it=A.stateNode,ti=!1;break e;case 3:case 4:it=A.stateNode.containerInfo,ti=!0;break e}A=A.return}if(it===null)throw Error(n(160));sx(g,v,m),it=null,ti=!1,g=m.alternate,g!==null&&(g.return=null),m.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)ax(l,s),l=l.sibling}var Gi=null;function ax(s,l){var u=s.alternate,f=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:ii(l,s),ni(s),f&4&&(cr(3,s,s.return),So(3,s),cr(5,s,s.return));break;case 1:ii(l,s),ni(s),f&512&&(bt||u===null||ln(u,u.return)),f&64&&Bn&&(s=s.updateQueue,s!==null&&(f=s.callbacks,f!==null&&(u=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=u===null?f:u.concat(f))));break;case 26:var m=Gi;if(ii(l,s),ni(s),f&512&&(bt||u===null||ln(u,u.return)),f&4){var g=u!==null?u.memoizedState:null;if(f=s.memoizedState,u===null)if(f===null)if(s.stateNode===null){e:{f=s.type,u=s.memoizedProps,m=m.ownerDocument||m;t:switch(f){case"title":g=m.getElementsByTagName("title")[0],(!g||g[Kl]||g[Rt]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=m.createElement(f),m.head.insertBefore(g,m.querySelector("head > title"))),Bt(g,f,u),g[Rt]=s,Mt(g),f=g;break e;case"link":var v=a1("link","href",m).get(f+(u.href||""));if(v){for(var A=0;A<v.length;A++)if(g=v[A],g.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&g.getAttribute("rel")===(u.rel==null?null:u.rel)&&g.getAttribute("title")===(u.title==null?null:u.title)&&g.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){v.splice(A,1);break t}}g=m.createElement(f),Bt(g,f,u),m.head.appendChild(g);break;case"meta":if(v=a1("meta","content",m).get(f+(u.content||""))){for(A=0;A<v.length;A++)if(g=v[A],g.getAttribute("content")===(u.content==null?null:""+u.content)&&g.getAttribute("name")===(u.name==null?null:u.name)&&g.getAttribute("property")===(u.property==null?null:u.property)&&g.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&g.getAttribute("charset")===(u.charSet==null?null:u.charSet)){v.splice(A,1);break t}}g=m.createElement(f),Bt(g,f,u),m.head.appendChild(g);break;default:throw Error(n(468,f))}g[Rt]=s,Mt(g),f=g}s.stateNode=f}else u1(m,s.type,s.stateNode);else s.stateNode=o1(m,f,s.memoizedProps);else g!==f?(g===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):g.count--,f===null?u1(m,s.type,s.stateNode):o1(m,f,s.memoizedProps)):f===null&&s.stateNode!==null&&Nd(s,s.memoizedProps,u.memoizedProps)}break;case 27:ii(l,s),ni(s),f&512&&(bt||u===null||ln(u,u.return)),u!==null&&f&4&&Nd(s,s.memoizedProps,u.memoizedProps);break;case 5:if(ii(l,s),ni(s),f&512&&(bt||u===null||ln(u,u.return)),s.flags&32){m=s.stateNode;try{Ds(m,"")}catch(ae){Ie(s,s.return,ae)}}f&4&&s.stateNode!=null&&(m=s.memoizedProps,Nd(s,m,u!==null?u.memoizedProps:m)),f&1024&&(jd=!0);break;case 6:if(ii(l,s),ni(s),f&4){if(s.stateNode===null)throw Error(n(162));f=s.memoizedProps,u=s.stateNode;try{u.nodeValue=f}catch(ae){Ie(s,s.return,ae)}}break;case 3:if(Xu=null,m=Gi,Gi=Ku(l.containerInfo),ii(l,s),Gi=m,ni(s),f&4&&u!==null&&u.memoizedState.isDehydrated)try{ul(l.containerInfo)}catch(ae){Ie(s,s.return,ae)}jd&&(jd=!1,ux(s));break;case 4:f=Gi,Gi=Ku(s.stateNode.containerInfo),ii(l,s),ni(s),Gi=f;break;case 12:ii(l,s),ni(s);break;case 31:ii(l,s),ni(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Lu(s,f)));break;case 13:ii(l,s),ni(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(zu=di()),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Lu(s,f)));break;case 22:m=s.memoizedState!==null;var T=u!==null&&u.memoizedState!==null,B=Bn,Q=bt;if(Bn=B||m,bt=Q||T,ii(l,s),bt=Q,Bn=B,ni(s),f&8192)e:for(l=s.stateNode,l._visibility=m?l._visibility&-2:l._visibility|1,m&&(u===null||T||Bn||bt||ls(s)),u=null,l=s;;){if(l.tag===5||l.tag===26){if(u===null){T=u=l;try{if(g=T.stateNode,m)v=g.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{A=T.stateNode;var K=T.memoizedProps.style,z=K!=null&&K.hasOwnProperty("display")?K.display:null;A.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ae){Ie(T,T.return,ae)}}}else if(l.tag===6){if(u===null){T=l;try{T.stateNode.nodeValue=m?"":T.memoizedProps}catch(ae){Ie(T,T.return,ae)}}}else if(l.tag===18){if(u===null){T=l;try{var P=T.stateNode;m?Jx(P,!0):Jx(T.stateNode,!1)}catch(ae){Ie(T,T.return,ae)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===s)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break e;for(;l.sibling===null;){if(l.return===null||l.return===s)break e;u===l&&(u=null),l=l.return}u===l&&(u=null),l.sibling.return=l.return,l=l.sibling}f&4&&(f=s.updateQueue,f!==null&&(u=f.retryQueue,u!==null&&(f.retryQueue=null,Lu(s,u))));break;case 19:ii(l,s),ni(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Lu(s,f)));break;case 30:break;case 21:break;default:ii(l,s),ni(s)}}function ni(s){var l=s.flags;if(l&2){try{for(var u,f=s.return;f!==null;){if(ex(f)){u=f;break}f=f.return}if(u==null)throw Error(n(160));switch(u.tag){case 27:var m=u.stateNode,g=Rd(s);ju(s,g,m);break;case 5:var v=u.stateNode;u.flags&32&&(Ds(v,""),u.flags&=-33);var A=Rd(s);ju(s,A,v);break;case 3:case 4:var T=u.stateNode.containerInfo,B=Rd(s);Dd(s,B,T);break;default:throw Error(n(161))}}catch(Q){Ie(s,s.return,Q)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function ux(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;ux(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function _n(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)nx(s,l.alternate,l),l=l.sibling}function ls(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:cr(4,l,l.return),ls(l);break;case 1:ln(l,l.return);var u=l.stateNode;typeof u.componentWillUnmount=="function"&&Jb(l,l.return,u),ls(l);break;case 27:Ro(l.stateNode);case 26:case 5:ln(l,l.return),ls(l);break;case 22:l.memoizedState===null&&ls(l);break;case 30:ls(l);break;default:ls(l)}s=s.sibling}}function Hn(s,l,u){for(u=u&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var f=l.alternate,m=s,g=l,v=g.flags;switch(g.tag){case 0:case 11:case 15:Hn(m,g,u),So(4,g);break;case 1:if(Hn(m,g,u),f=g,m=f.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(B){Ie(f,f.return,B)}if(f=g,m=f.updateQueue,m!==null){var A=f.stateNode;try{var T=m.shared.hiddenCallbacks;if(T!==null)for(m.shared.hiddenCallbacks=null,m=0;m<T.length;m++)qy(T[m],A)}catch(B){Ie(f,f.return,B)}}u&&v&64&&Zb(g),wo(g,g.return);break;case 27:tx(g);case 26:case 5:Hn(m,g,u),u&&f===null&&v&4&&$b(g),wo(g,g.return);break;case 12:Hn(m,g,u);break;case 31:Hn(m,g,u),u&&v&4&&lx(m,g);break;case 13:Hn(m,g,u),u&&v&4&&ox(m,g);break;case 22:g.memoizedState===null&&Hn(m,g,u),wo(g,g.return);break;case 30:break;default:Hn(m,g,u)}l=l.sibling}}function Ld(s,l){var u=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==u&&(s!=null&&s.refCount++,u!=null&&oo(u))}function Bd(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&oo(s))}function Ki(s,l,u,f){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)cx(s,l,u,f),l=l.sibling}function cx(s,l,u,f){var m=l.flags;switch(l.tag){case 0:case 11:case 15:Ki(s,l,u,f),m&2048&&So(9,l);break;case 1:Ki(s,l,u,f);break;case 3:Ki(s,l,u,f),m&2048&&(s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&oo(s)));break;case 12:if(m&2048){Ki(s,l,u,f),s=l.stateNode;try{var g=l.memoizedProps,v=g.id,A=g.onPostCommit;typeof A=="function"&&A(v,l.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(T){Ie(l,l.return,T)}}else Ki(s,l,u,f);break;case 31:Ki(s,l,u,f);break;case 13:Ki(s,l,u,f);break;case 23:break;case 22:g=l.stateNode,v=l.alternate,l.memoizedState!==null?g._visibility&2?Ki(s,l,u,f):Co(s,l):g._visibility&2?Ki(s,l,u,f):(g._visibility|=2,Js(s,l,u,f,(l.subtreeFlags&10256)!==0||!1)),m&2048&&Ld(v,l);break;case 24:Ki(s,l,u,f),m&2048&&Bd(l.alternate,l);break;default:Ki(s,l,u,f)}}function Js(s,l,u,f,m){for(m=m&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var g=s,v=l,A=u,T=f,B=v.flags;switch(v.tag){case 0:case 11:case 15:Js(g,v,A,T,m),So(8,v);break;case 23:break;case 22:var Q=v.stateNode;v.memoizedState!==null?Q._visibility&2?Js(g,v,A,T,m):Co(g,v):(Q._visibility|=2,Js(g,v,A,T,m)),m&&B&2048&&Ld(v.alternate,v);break;case 24:Js(g,v,A,T,m),m&&B&2048&&Bd(v.alternate,v);break;default:Js(g,v,A,T,m)}l=l.sibling}}function Co(s,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var u=s,f=l,m=f.flags;switch(f.tag){case 22:Co(u,f),m&2048&&Ld(f.alternate,f);break;case 24:Co(u,f),m&2048&&Bd(f.alternate,f);break;default:Co(u,f)}l=l.sibling}}var ko=8192;function $s(s,l,u){if(s.subtreeFlags&ko)for(s=s.child;s!==null;)hx(s,l,u),s=s.sibling}function hx(s,l,u){switch(s.tag){case 26:$s(s,l,u),s.flags&ko&&s.memoizedState!==null&&sO(u,Gi,s.memoizedState,s.memoizedProps);break;case 5:$s(s,l,u);break;case 3:case 4:var f=Gi;Gi=Ku(s.stateNode.containerInfo),$s(s,l,u),Gi=f;break;case 22:s.memoizedState===null&&(f=s.alternate,f!==null&&f.memoizedState!==null?(f=ko,ko=16777216,$s(s,l,u),ko=f):$s(s,l,u));break;default:$s(s,l,u)}}function fx(s){var l=s.alternate;if(l!==null&&(s=l.child,s!==null)){l.child=null;do l=s.sibling,s.sibling=null,s=l;while(s!==null)}}function Ao(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var f=l[u];Tt=f,px(f,s)}fx(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)dx(s),s=s.sibling}function dx(s){switch(s.tag){case 0:case 11:case 15:Ao(s),s.flags&2048&&cr(9,s,s.return);break;case 3:Ao(s);break;case 12:Ao(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,Bu(s)):Ao(s);break;default:Ao(s)}}function Bu(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var f=l[u];Tt=f,px(f,s)}fx(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:cr(8,l,l.return),Bu(l);break;case 22:u=l.stateNode,u._visibility&2&&(u._visibility&=-3,Bu(l));break;default:Bu(l)}s=s.sibling}}function px(s,l){for(;Tt!==null;){var u=Tt;switch(u.tag){case 0:case 11:case 15:cr(8,u,l);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var f=u.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:oo(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,Tt=f;else e:for(u=s;Tt!==null;){f=Tt;var m=f.sibling,g=f.return;if(rx(f),f===u){Tt=null;break e}if(m!==null){m.return=g,Tt=m;break e}Tt=g}}}var vT={getCacheForType:function(s){var l=jt(mt),u=l.data.get(s);return u===void 0&&(u=s(),l.data.set(s,u)),u},cacheSignal:function(){return jt(mt).controller.signal}},ST=typeof WeakMap=="function"?WeakMap:Map,qe=0,We=null,Oe=null,Re=0,Ve=0,vi=null,hr=!1,el=!1,zd=!1,Un=0,lt=0,fr=0,os=0,_d=0,Si=0,tl=0,Mo=null,ri=null,Hd=!1,zu=0,mx=0,_u=1/0,Hu=null,dr=null,St=0,pr=null,il=null,qn=0,Ud=0,qd=null,gx=null,To=0,Pd=null;function wi(){return(qe&2)!==0&&Re!==0?Re&-Re:_.T!==null?Gd():D0()}function yx(){if(Si===0)if((Re&536870912)===0||je){var s=Ya;Ya<<=1,(Ya&3932160)===0&&(Ya=262144),Si=s}else Si=536870912;return s=bi.current,s!==null&&(s.flags|=32),Si}function si(s,l,u){(s===We&&(Ve===2||Ve===9)||s.cancelPendingCommit!==null)&&(nl(s,0),mr(s,Re,Si,!1)),Gl(s,u),((qe&2)===0||s!==We)&&(s===We&&((qe&2)===0&&(os|=u),lt===4&&mr(s,Re,Si,!1)),on(s))}function bx(s,l,u){if((qe&6)!==0)throw Error(n(327));var f=!u&&(l&127)===0&&(l&s.expiredLanes)===0||Yl(s,l),m=f?kT(s,l):Vd(s,l,!0),g=f;do{if(m===0){el&&!f&&mr(s,l,0,!1);break}else{if(u=s.current.alternate,g&&!wT(u)){m=Vd(s,l,!1),g=!1;continue}if(m===2){if(g=l,s.errorRecoveryDisabledLanes&g)var v=0;else v=s.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){l=v;e:{var A=s;m=Mo;var T=A.current.memoizedState.isDehydrated;if(T&&(nl(A,v).flags|=256),v=Vd(A,v,!1),v!==2){if(zd&&!T){A.errorRecoveryDisabledLanes|=g,os|=g,m=4;break e}g=ri,ri=m,g!==null&&(ri===null?ri=g:ri.push.apply(ri,g))}m=v}if(g=!1,m!==2)continue}}if(m===1){nl(s,0),mr(s,l,0,!0);break}e:{switch(f=s,g=m,g){case 0:case 1:throw Error(n(345));case 4:if((l&4194048)!==l)break;case 6:mr(f,l,Si,!hr);break e;case 2:ri=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(m=zu+300-di(),10<m)){if(mr(f,l,Si,!hr),Ka(f,0,!0)!==0)break e;qn=l,f.timeoutHandle=Wx(xx.bind(null,f,u,ri,Hu,Hd,l,Si,os,tl,hr,g,"Throttled",-0,0),m);break e}xx(f,u,ri,Hu,Hd,l,Si,os,tl,hr,g,null,-0,0)}}break}while(!0);on(s)}function xx(s,l,u,f,m,g,v,A,T,B,Q,K,z,P){if(s.timeoutHandle=-1,K=l.subtreeFlags,K&8192||(K&16785408)===16785408){K={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:An},hx(l,g,K);var ae=(g&62914560)===g?zu-di():(g&4194048)===g?mx-di():0;if(ae=lO(K,ae),ae!==null){qn=g,s.cancelPendingCommit=ae(Tx.bind(null,s,l,g,u,f,m,v,A,T,Q,K,null,z,P)),mr(s,g,v,!B);return}}Tx(s,l,g,u,f,m,v,A,T)}function wT(s){for(var l=s;;){var u=l.tag;if((u===0||u===11||u===15)&&l.flags&16384&&(u=l.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var f=0;f<u.length;f++){var m=u[f],g=m.getSnapshot;m=m.value;try{if(!gi(g(),m))return!1}catch{return!1}}if(u=l.child,l.subtreeFlags&16384&&u!==null)u.return=l,l=u;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function mr(s,l,u,f){l&=~_d,l&=~os,s.suspendedLanes|=l,s.pingedLanes&=~l,f&&(s.warmLanes|=l),f=s.expirationTimes;for(var m=l;0<m;){var g=31-mi(m),v=1<<g;f[g]=-1,m&=~v}u!==0&&E0(s,u,l)}function Uu(){return(qe&6)===0?(Oo(0),!1):!0}function Fd(){if(Oe!==null){if(Ve===0)var s=Oe.return;else s=Oe,En=Jr=null,rd(s),Gs=null,uo=0,s=Oe;for(;s!==null;)Xb(s.alternate,s),s=s.return;Oe=null}}function nl(s,l){var u=s.timeoutHandle;u!==-1&&(s.timeoutHandle=-1,FT(u)),u=s.cancelPendingCommit,u!==null&&(s.cancelPendingCommit=null,u()),qn=0,Fd(),We=s,Oe=u=Tn(s.current,null),Re=l,Ve=0,vi=null,hr=!1,el=Yl(s,l),zd=!1,tl=Si=_d=os=fr=lt=0,ri=Mo=null,Hd=!1,(l&8)!==0&&(l|=l&32);var f=s.entangledLanes;if(f!==0)for(s=s.entanglements,f&=l;0<f;){var m=31-mi(f),g=1<<m;l|=s[m],f&=~g}return Un=l,lu(),u}function vx(s,l){Ce=null,_.H=bo,l===Ys||l===pu?(l=zy(),Ve=3):l===Yf?(l=zy(),Ve=4):Ve=l===vd?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,vi=l,Oe===null&&(lt=1,Ou(s,Ri(l,s.current)))}function Sx(){var s=bi.current;return s===null?!0:(Re&4194048)===Re?Bi===null:(Re&62914560)===Re||(Re&536870912)!==0?s===Bi:!1}function wx(){var s=_.H;return _.H=bo,s===null?bo:s}function Cx(){var s=_.A;return _.A=vT,s}function qu(){lt=4,hr||(Re&4194048)!==Re&&bi.current!==null||(el=!0),(fr&134217727)===0&&(os&134217727)===0||We===null||mr(We,Re,Si,!1)}function Vd(s,l,u){var f=qe;qe|=2;var m=wx(),g=Cx();(We!==s||Re!==l)&&(Hu=null,nl(s,l)),l=!1;var v=lt;e:do try{if(Ve!==0&&Oe!==null){var A=Oe,T=vi;switch(Ve){case 8:Fd(),v=6;break e;case 3:case 2:case 9:case 6:bi.current===null&&(l=!0);var B=Ve;if(Ve=0,vi=null,rl(s,A,T,B),u&&el){v=0;break e}break;default:B=Ve,Ve=0,vi=null,rl(s,A,T,B)}}CT(),v=lt;break}catch(Q){vx(s,Q)}while(!0);return l&&s.shellSuspendCounter++,En=Jr=null,qe=f,_.H=m,_.A=g,Oe===null&&(We=null,Re=0,lu()),v}function CT(){for(;Oe!==null;)kx(Oe)}function kT(s,l){var u=qe;qe|=2;var f=wx(),m=Cx();We!==s||Re!==l?(Hu=null,_u=di()+500,nl(s,l)):el=Yl(s,l);e:do try{if(Ve!==0&&Oe!==null){l=Oe;var g=vi;t:switch(Ve){case 1:Ve=0,vi=null,rl(s,l,g,1);break;case 2:case 9:if(Ly(g)){Ve=0,vi=null,Ax(l);break}l=function(){Ve!==2&&Ve!==9||We!==s||(Ve=7),on(s)},g.then(l,l);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:Ly(g)?(Ve=0,vi=null,Ax(l)):(Ve=0,vi=null,rl(s,l,g,7));break;case 5:var v=null;switch(Oe.tag){case 26:v=Oe.memoizedState;case 5:case 27:var A=Oe;if(v?c1(v):A.stateNode.complete){Ve=0,vi=null;var T=A.sibling;if(T!==null)Oe=T;else{var B=A.return;B!==null?(Oe=B,Pu(B)):Oe=null}break t}}Ve=0,vi=null,rl(s,l,g,5);break;case 6:Ve=0,vi=null,rl(s,l,g,6);break;case 8:Fd(),lt=6;break e;default:throw Error(n(462))}}AT();break}catch(Q){vx(s,Q)}while(!0);return En=Jr=null,_.H=f,_.A=m,qe=u,Oe!==null?0:(We=null,Re=0,lu(),lt)}function AT(){for(;Oe!==null&&!KA();)kx(Oe)}function kx(s){var l=Kb(s.alternate,s,Un);s.memoizedProps=s.pendingProps,l===null?Pu(s):Oe=l}function Ax(s){var l=s,u=l.alternate;switch(l.tag){case 15:case 0:l=Fb(u,l,l.pendingProps,l.type,void 0,Re);break;case 11:l=Fb(u,l,l.pendingProps,l.type.render,l.ref,Re);break;case 5:rd(l);default:Xb(u,l),l=Oe=Cy(l,Un),l=Kb(u,l,Un)}s.memoizedProps=s.pendingProps,l===null?Pu(s):Oe=l}function rl(s,l,u,f){En=Jr=null,rd(l),Gs=null,uo=0;var m=l.return;try{if(dT(s,m,l,u,Re)){lt=1,Ou(s,Ri(u,s.current)),Oe=null;return}}catch(g){if(m!==null)throw Oe=m,g;lt=1,Ou(s,Ri(u,s.current)),Oe=null;return}l.flags&32768?(je||f===1?s=!0:el||(Re&536870912)!==0?s=!1:(hr=s=!0,(f===2||f===9||f===3||f===6)&&(f=bi.current,f!==null&&f.tag===13&&(f.flags|=16384))),Mx(l,s)):Pu(l)}function Pu(s){var l=s;do{if((l.flags&32768)!==0){Mx(l,hr);return}s=l.return;var u=gT(l.alternate,l,Un);if(u!==null){Oe=u;return}if(l=l.sibling,l!==null){Oe=l;return}Oe=l=s}while(l!==null);lt===0&&(lt=5)}function Mx(s,l){do{var u=yT(s.alternate,s);if(u!==null){u.flags&=32767,Oe=u;return}if(u=s.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!l&&(s=s.sibling,s!==null)){Oe=s;return}Oe=s=u}while(s!==null);lt=6,Oe=null}function Tx(s,l,u,f,m,g,v,A,T){s.cancelPendingCommit=null;do Fu();while(St!==0);if((qe&6)!==0)throw Error(n(327));if(l!==null){if(l===s.current)throw Error(n(177));if(g=l.lanes|l.childLanes,g|=Rf,rM(s,u,g,v,A,T),s===We&&(Oe=We=null,Re=0),il=l,pr=s,qn=u,Ud=g,qd=m,gx=f,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,ET(Ia,function(){return Dx(),null})):(s.callbackNode=null,s.callbackPriority=0),f=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||f){f=_.T,_.T=null,m=X.p,X.p=2,v=qe,qe|=4;try{bT(s,l,u)}finally{qe=v,X.p=m,_.T=f}}St=1,Ox(),Ex(),Nx()}}function Ox(){if(St===1){St=0;var s=pr,l=il,u=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||u){u=_.T,_.T=null;var f=X.p;X.p=2;var m=qe;qe|=4;try{ax(l,s);var g=tp,v=py(s.containerInfo),A=g.focusedElem,T=g.selectionRange;if(v!==A&&A&&A.ownerDocument&&dy(A.ownerDocument.documentElement,A)){if(T!==null&&Mf(A)){var B=T.start,Q=T.end;if(Q===void 0&&(Q=B),"selectionStart"in A)A.selectionStart=B,A.selectionEnd=Math.min(Q,A.value.length);else{var K=A.ownerDocument||document,z=K&&K.defaultView||window;if(z.getSelection){var P=z.getSelection(),ae=A.textContent.length,be=Math.min(T.start,ae),Ge=T.end===void 0?be:Math.min(T.end,ae);!P.extend&&be>Ge&&(v=Ge,Ge=be,be=v);var j=fy(A,be),R=fy(A,Ge);if(j&&R&&(P.rangeCount!==1||P.anchorNode!==j.node||P.anchorOffset!==j.offset||P.focusNode!==R.node||P.focusOffset!==R.offset)){var L=K.createRange();L.setStart(j.node,j.offset),P.removeAllRanges(),be>Ge?(P.addRange(L),P.extend(R.node,R.offset)):(L.setEnd(R.node,R.offset),P.addRange(L))}}}}for(K=[],P=A;P=P.parentNode;)P.nodeType===1&&K.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<K.length;A++){var G=K[A];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}ec=!!ep,tp=ep=null}finally{qe=m,X.p=f,_.T=u}}s.current=l,St=2}}function Ex(){if(St===2){St=0;var s=pr,l=il,u=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||u){u=_.T,_.T=null;var f=X.p;X.p=2;var m=qe;qe|=4;try{nx(s,l.alternate,l)}finally{qe=m,X.p=f,_.T=u}}St=3}}function Nx(){if(St===4||St===3){St=0,WA();var s=pr,l=il,u=qn,f=gx;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?St=5:(St=0,il=pr=null,Rx(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(dr=null),of(u),l=l.stateNode,pi&&typeof pi.onCommitFiberRoot=="function")try{pi.onCommitFiberRoot(Ql,l,void 0,(l.current.flags&128)===128)}catch{}if(f!==null){l=_.T,m=X.p,X.p=2,_.T=null;try{for(var g=s.onRecoverableError,v=0;v<f.length;v++){var A=f[v];g(A.value,{componentStack:A.stack})}}finally{_.T=l,X.p=m}}(qn&3)!==0&&Fu(),on(s),m=s.pendingLanes,(u&261930)!==0&&(m&42)!==0?s===Pd?To++:(To=0,Pd=s):To=0,Oo(0)}}function Rx(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,oo(l)))}function Fu(){return Ox(),Ex(),Nx(),Dx()}function Dx(){if(St!==5)return!1;var s=pr,l=Ud;Ud=0;var u=of(qn),f=_.T,m=X.p;try{X.p=32>u?32:u,_.T=null,u=qd,qd=null;var g=pr,v=qn;if(St=0,il=pr=null,qn=0,(qe&6)!==0)throw Error(n(331));var A=qe;if(qe|=4,dx(g.current),cx(g,g.current,v,u),qe=A,Oo(0,!1),pi&&typeof pi.onPostCommitFiberRoot=="function")try{pi.onPostCommitFiberRoot(Ql,g)}catch{}return!0}finally{X.p=m,_.T=f,Rx(s,l)}}function jx(s,l,u){l=Ri(u,l),l=xd(s.stateNode,l,2),s=or(s,l,2),s!==null&&(Gl(s,2),on(s))}function Ie(s,l,u){if(s.tag===3)jx(s,s,u);else for(;l!==null;){if(l.tag===3){jx(l,s,u);break}else if(l.tag===1){var f=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(dr===null||!dr.has(f))){s=Ri(u,s),u=Lb(2),f=or(l,u,2),f!==null&&(Bb(u,f,l,s),Gl(f,2),on(f));break}}l=l.return}}function Id(s,l,u){var f=s.pingCache;if(f===null){f=s.pingCache=new ST;var m=new Set;f.set(l,m)}else m=f.get(l),m===void 0&&(m=new Set,f.set(l,m));m.has(u)||(zd=!0,m.add(u),s=MT.bind(null,s,l,u),l.then(s,s))}function MT(s,l,u){var f=s.pingCache;f!==null&&f.delete(l),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,We===s&&(Re&u)===u&&(lt===4||lt===3&&(Re&62914560)===Re&&300>di()-zu?(qe&2)===0&&nl(s,0):_d|=u,tl===Re&&(tl=0)),on(s)}function Lx(s,l){l===0&&(l=O0()),s=Wr(s,l),s!==null&&(Gl(s,l),on(s))}function TT(s){var l=s.memoizedState,u=0;l!==null&&(u=l.retryLane),Lx(s,u)}function OT(s,l){var u=0;switch(s.tag){case 31:case 13:var f=s.stateNode,m=s.memoizedState;m!==null&&(u=m.retryLane);break;case 19:f=s.stateNode;break;case 22:f=s.stateNode._retryCache;break;default:throw Error(n(314))}f!==null&&f.delete(l),Lx(s,u)}function ET(s,l){return nf(s,l)}var Vu=null,sl=null,Qd=!1,Iu=!1,Yd=!1,gr=0;function on(s){s!==sl&&s.next===null&&(sl===null?Vu=sl=s:sl=sl.next=s),Iu=!0,Qd||(Qd=!0,RT())}function Oo(s,l){if(!Yd&&Iu){Yd=!0;do for(var u=!1,f=Vu;f!==null;){if(s!==0){var m=f.pendingLanes;if(m===0)var g=0;else{var v=f.suspendedLanes,A=f.pingedLanes;g=(1<<31-mi(42|s)+1)-1,g&=m&~(v&~A),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(u=!0,Hx(f,g))}else g=Re,g=Ka(f,f===We?g:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(g&3)===0||Yl(f,g)||(u=!0,Hx(f,g));f=f.next}while(u);Yd=!1}}function NT(){Bx()}function Bx(){Iu=Qd=!1;var s=0;gr!==0&&PT()&&(s=gr);for(var l=di(),u=null,f=Vu;f!==null;){var m=f.next,g=zx(f,l);g===0?(f.next=null,u===null?Vu=m:u.next=m,m===null&&(sl=u)):(u=f,(s!==0||(g&3)!==0)&&(Iu=!0)),f=m}St!==0&&St!==5||Oo(s),gr!==0&&(gr=0)}function zx(s,l){for(var u=s.suspendedLanes,f=s.pingedLanes,m=s.expirationTimes,g=s.pendingLanes&-62914561;0<g;){var v=31-mi(g),A=1<<v,T=m[v];T===-1?((A&u)===0||(A&f)!==0)&&(m[v]=nM(A,l)):T<=l&&(s.expiredLanes|=A),g&=~A}if(l=We,u=Re,u=Ka(s,s===l?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f=s.callbackNode,u===0||s===l&&(Ve===2||Ve===9)||s.cancelPendingCommit!==null)return f!==null&&f!==null&&rf(f),s.callbackNode=null,s.callbackPriority=0;if((u&3)===0||Yl(s,u)){if(l=u&-u,l===s.callbackPriority)return l;switch(f!==null&&rf(f),of(u)){case 2:case 8:u=M0;break;case 32:u=Ia;break;case 268435456:u=T0;break;default:u=Ia}return f=_x.bind(null,s),u=nf(u,f),s.callbackPriority=l,s.callbackNode=u,l}return f!==null&&f!==null&&rf(f),s.callbackPriority=2,s.callbackNode=null,2}function _x(s,l){if(St!==0&&St!==5)return s.callbackNode=null,s.callbackPriority=0,null;var u=s.callbackNode;if(Fu()&&s.callbackNode!==u)return null;var f=Re;return f=Ka(s,s===We?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f===0?null:(bx(s,f,l),zx(s,di()),s.callbackNode!=null&&s.callbackNode===u?_x.bind(null,s):null)}function Hx(s,l){if(Fu())return null;bx(s,l,!0)}function RT(){VT(function(){(qe&6)!==0?nf(A0,NT):Bx()})}function Gd(){if(gr===0){var s=Is;s===0&&(s=Qa,Qa<<=1,(Qa&261888)===0&&(Qa=256)),gr=s}return gr}function Ux(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Ja(""+s)}function qx(s,l){var u=l.ownerDocument.createElement("input");return u.name=l.name,u.value=l.value,s.id&&u.setAttribute("form",s.id),l.parentNode.insertBefore(u,l),s=new FormData(s),u.parentNode.removeChild(u),s}function DT(s,l,u,f,m){if(l==="submit"&&u&&u.stateNode===m){var g=Ux((m[$t]||null).action),v=f.submitter;v&&(l=(l=v[$t]||null)?Ux(l.formAction):v.getAttribute("formAction"),l!==null&&(g=l,v=null));var A=new iu("action","action",null,f,m);s.push({event:A,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(gr!==0){var T=v?qx(m,v):new FormData(m);dd(u,{pending:!0,data:T,method:m.method,action:g},null,T)}}else typeof g=="function"&&(A.preventDefault(),T=v?qx(m,v):new FormData(m),dd(u,{pending:!0,data:T,method:m.method,action:g},g,T))},currentTarget:m}]})}}for(var Kd=0;Kd<Nf.length;Kd++){var Wd=Nf[Kd],jT=Wd.toLowerCase(),LT=Wd[0].toUpperCase()+Wd.slice(1);Yi(jT,"on"+LT)}Yi(yy,"onAnimationEnd"),Yi(by,"onAnimationIteration"),Yi(xy,"onAnimationStart"),Yi("dblclick","onDoubleClick"),Yi("focusin","onFocus"),Yi("focusout","onBlur"),Yi(XM,"onTransitionRun"),Yi(ZM,"onTransitionStart"),Yi(JM,"onTransitionCancel"),Yi(vy,"onTransitionEnd"),Ns("onMouseEnter",["mouseout","mouseover"]),Ns("onMouseLeave",["mouseout","mouseover"]),Ns("onPointerEnter",["pointerout","pointerover"]),Ns("onPointerLeave",["pointerout","pointerover"]),Qr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Eo="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(" "),BT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Eo));function Px(s,l){l=(l&4)!==0;for(var u=0;u<s.length;u++){var f=s[u],m=f.event;f=f.listeners;e:{var g=void 0;if(l)for(var v=f.length-1;0<=v;v--){var A=f[v],T=A.instance,B=A.currentTarget;if(A=A.listener,T!==g&&m.isPropagationStopped())break e;g=A,m.currentTarget=B;try{g(m)}catch(Q){su(Q)}m.currentTarget=null,g=T}else for(v=0;v<f.length;v++){if(A=f[v],T=A.instance,B=A.currentTarget,A=A.listener,T!==g&&m.isPropagationStopped())break e;g=A,m.currentTarget=B;try{g(m)}catch(Q){su(Q)}m.currentTarget=null,g=T}}}}function Ee(s,l){var u=l[af];u===void 0&&(u=l[af]=new Set);var f=s+"__bubble";u.has(f)||(Fx(l,s,2,!1),u.add(f))}function Xd(s,l,u){var f=0;l&&(f|=4),Fx(u,s,f,l)}var Qu="_reactListening"+Math.random().toString(36).slice(2);function Zd(s){if(!s[Qu]){s[Qu]=!0,B0.forEach(function(u){u!=="selectionchange"&&(BT.has(u)||Xd(u,!1,s),Xd(u,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Qu]||(l[Qu]=!0,Xd("selectionchange",!1,l))}}function Fx(s,l,u,f){switch(y1(l)){case 2:var m=uO;break;case 8:m=cO;break;default:m=fp}u=m.bind(null,l,u,s),m=void 0,!yf||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(m=!0),f?m!==void 0?s.addEventListener(l,u,{capture:!0,passive:m}):s.addEventListener(l,u,!0):m!==void 0?s.addEventListener(l,u,{passive:m}):s.addEventListener(l,u,!1)}function Jd(s,l,u,f,m){var g=f;if((l&1)===0&&(l&2)===0&&f!==null)e:for(;;){if(f===null)return;var v=f.tag;if(v===3||v===4){var A=f.stateNode.containerInfo;if(A===m)break;if(v===4)for(v=f.return;v!==null;){var T=v.tag;if((T===3||T===4)&&v.stateNode.containerInfo===m)return;v=v.return}for(;A!==null;){if(v=Ts(A),v===null)return;if(T=v.tag,T===5||T===6||T===26||T===27){f=g=v;continue e}A=A.parentNode}}f=f.return}G0(function(){var B=g,Q=mf(u),K=[];e:{var z=Sy.get(s);if(z!==void 0){var P=iu,ae=s;switch(s){case"keypress":if(eu(u)===0)break e;case"keydown":case"keyup":P=OM;break;case"focusin":ae="focus",P=Sf;break;case"focusout":ae="blur",P=Sf;break;case"beforeblur":case"afterblur":P=Sf;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=X0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=gM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=RM;break;case yy:case by:case xy:P=xM;break;case vy:P=jM;break;case"scroll":case"scrollend":P=pM;break;case"wheel":P=BM;break;case"copy":case"cut":case"paste":P=SM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=J0;break;case"toggle":case"beforetoggle":P=_M}var be=(l&4)!==0,Ge=!be&&(s==="scroll"||s==="scrollend"),j=be?z!==null?z+"Capture":null:z;be=[];for(var R=B,L;R!==null;){var G=R;if(L=G.stateNode,G=G.tag,G!==5&&G!==26&&G!==27||L===null||j===null||(G=Xl(R,j),G!=null&&be.push(No(R,G,L))),Ge)break;R=R.return}0<be.length&&(z=new P(z,ae,null,u,Q),K.push({event:z,listeners:be}))}}if((l&7)===0){e:{if(z=s==="mouseover"||s==="pointerover",P=s==="mouseout"||s==="pointerout",z&&u!==pf&&(ae=u.relatedTarget||u.fromElement)&&(Ts(ae)||ae[Ms]))break e;if((P||z)&&(z=Q.window===Q?Q:(z=Q.ownerDocument)?z.defaultView||z.parentWindow:window,P?(ae=u.relatedTarget||u.toElement,P=B,ae=ae?Ts(ae):null,ae!==null&&(Ge=o(ae),be=ae.tag,ae!==Ge||be!==5&&be!==27&&be!==6)&&(ae=null)):(P=null,ae=B),P!==ae)){if(be=X0,G="onMouseLeave",j="onMouseEnter",R="mouse",(s==="pointerout"||s==="pointerover")&&(be=J0,G="onPointerLeave",j="onPointerEnter",R="pointer"),Ge=P==null?z:Wl(P),L=ae==null?z:Wl(ae),z=new be(G,R+"leave",P,u,Q),z.target=Ge,z.relatedTarget=L,G=null,Ts(Q)===B&&(be=new be(j,R+"enter",ae,u,Q),be.target=L,be.relatedTarget=Ge,G=be),Ge=G,P&&ae)t:{for(be=zT,j=P,R=ae,L=0,G=j;G;G=be(G))L++;G=0;for(var me=R;me;me=be(me))G++;for(;0<L-G;)j=be(j),L--;for(;0<G-L;)R=be(R),G--;for(;L--;){if(j===R||R!==null&&j===R.alternate){be=j;break t}j=be(j),R=be(R)}be=null}else be=null;P!==null&&Vx(K,z,P,be,!1),ae!==null&&Ge!==null&&Vx(K,Ge,ae,be,!0)}}e:{if(z=B?Wl(B):window,P=z.nodeName&&z.nodeName.toLowerCase(),P==="select"||P==="input"&&z.type==="file")var _e=ly;else if(ry(z))if(oy)_e=GM;else{_e=QM;var he=IM}else P=z.nodeName,!P||P.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?B&&df(B.elementType)&&(_e=ly):_e=YM;if(_e&&(_e=_e(s,B))){sy(K,_e,u,Q);break e}he&&he(s,z,B),s==="focusout"&&B&&z.type==="number"&&B.memoizedProps.value!=null&&ff(z,"number",z.value)}switch(he=B?Wl(B):window,s){case"focusin":(ry(he)||he.contentEditable==="true")&&(zs=he,Tf=B,ro=null);break;case"focusout":ro=Tf=zs=null;break;case"mousedown":Of=!0;break;case"contextmenu":case"mouseup":case"dragend":Of=!1,my(K,u,Q);break;case"selectionchange":if(WM)break;case"keydown":case"keyup":my(K,u,Q)}var ke;if(Cf)e:{switch(s){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else Bs?iy(s,u)&&(De="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(De="onCompositionStart");De&&($0&&u.locale!=="ko"&&(Bs||De!=="onCompositionStart"?De==="onCompositionEnd"&&Bs&&(ke=K0()):(er=Q,bf="value"in er?er.value:er.textContent,Bs=!0)),he=Yu(B,De),0<he.length&&(De=new Z0(De,s,null,u,Q),K.push({event:De,listeners:he}),ke?De.data=ke:(ke=ny(u),ke!==null&&(De.data=ke)))),(ke=UM?qM(s,u):PM(s,u))&&(De=Yu(B,"onBeforeInput"),0<De.length&&(he=new Z0("onBeforeInput","beforeinput",null,u,Q),K.push({event:he,listeners:De}),he.data=ke)),DT(K,s,B,u,Q)}Px(K,l)})}function No(s,l,u){return{instance:s,listener:l,currentTarget:u}}function Yu(s,l){for(var u=l+"Capture",f=[];s!==null;){var m=s,g=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||g===null||(m=Xl(s,u),m!=null&&f.unshift(No(s,m,g)),m=Xl(s,l),m!=null&&f.push(No(s,m,g))),s.tag===3)return f;s=s.return}return[]}function zT(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Vx(s,l,u,f,m){for(var g=l._reactName,v=[];u!==null&&u!==f;){var A=u,T=A.alternate,B=A.stateNode;if(A=A.tag,T!==null&&T===f)break;A!==5&&A!==26&&A!==27||B===null||(T=B,m?(B=Xl(u,g),B!=null&&v.unshift(No(u,B,T))):m||(B=Xl(u,g),B!=null&&v.push(No(u,B,T)))),u=u.return}v.length!==0&&s.push({event:l,listeners:v})}var _T=/\r\n?/g,HT=/\u0000|\uFFFD/g;function Ix(s){return(typeof s=="string"?s:""+s).replace(_T,`
9
+ `).replace(HT,"")}function Qx(s,l){return l=Ix(l),Ix(s)===l}function Ye(s,l,u,f,m,g){switch(u){case"children":typeof f=="string"?l==="body"||l==="textarea"&&f===""||Ds(s,f):(typeof f=="number"||typeof f=="bigint")&&l!=="body"&&Ds(s,""+f);break;case"className":Xa(s,"class",f);break;case"tabIndex":Xa(s,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Xa(s,u,f);break;case"style":Q0(s,f,g);break;case"data":if(l!=="object"){Xa(s,"data",f);break}case"src":case"href":if(f===""&&(l!=="a"||u!=="href")){s.removeAttribute(u);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(u);break}f=Ja(""+f),s.setAttribute(u,f);break;case"action":case"formAction":if(typeof f=="function"){s.setAttribute(u,"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"&&(u==="formAction"?(l!=="input"&&Ye(s,l,"name",m.name,m,null),Ye(s,l,"formEncType",m.formEncType,m,null),Ye(s,l,"formMethod",m.formMethod,m,null),Ye(s,l,"formTarget",m.formTarget,m,null)):(Ye(s,l,"encType",m.encType,m,null),Ye(s,l,"method",m.method,m,null),Ye(s,l,"target",m.target,m,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(u);break}f=Ja(""+f),s.setAttribute(u,f);break;case"onClick":f!=null&&(s.onclick=An);break;case"onScroll":f!=null&&Ee("scroll",s);break;case"onScrollEnd":f!=null&&Ee("scrollend",s);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(u=f.__html,u!=null){if(m.children!=null)throw Error(n(60));s.innerHTML=u}}break;case"multiple":s.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":s.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){s.removeAttribute("xlink:href");break}u=Ja(""+f),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,""+f):s.removeAttribute(u);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":f&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,""):s.removeAttribute(u);break;case"capture":case"download":f===!0?s.setAttribute(u,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,f):s.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?s.setAttribute(u,f):s.removeAttribute(u);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?s.removeAttribute(u):s.setAttribute(u,f);break;case"popover":Ee("beforetoggle",s),Ee("toggle",s),Wa(s,"popover",f);break;case"xlinkActuate":kn(s,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":kn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":kn(s,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":kn(s,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":kn(s,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":kn(s,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":kn(s,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":kn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":kn(s,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Wa(s,"is",f);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=fM.get(u)||u,Wa(s,u,f))}}function $d(s,l,u,f,m,g){switch(u){case"style":Q0(s,f,g);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(u=f.__html,u!=null){if(m.children!=null)throw Error(n(60));s.innerHTML=u}}break;case"children":typeof f=="string"?Ds(s,f):(typeof f=="number"||typeof f=="bigint")&&Ds(s,""+f);break;case"onScroll":f!=null&&Ee("scroll",s);break;case"onScrollEnd":f!=null&&Ee("scrollend",s);break;case"onClick":f!=null&&(s.onclick=An);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!z0.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(m=u.endsWith("Capture"),l=u.slice(2,m?u.length-7:void 0),g=s[$t]||null,g=g!=null?g[u]:null,typeof g=="function"&&s.removeEventListener(l,g,m),typeof f=="function")){typeof g!="function"&&g!==null&&(u in s?s[u]=null:s.hasAttribute(u)&&s.removeAttribute(u)),s.addEventListener(l,f,m);break e}u in s?s[u]=f:f===!0?s.setAttribute(u,""):Wa(s,u,f)}}}function Bt(s,l,u){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",s),Ee("load",s);var f=!1,m=!1,g;for(g in u)if(u.hasOwnProperty(g)){var v=u[g];if(v!=null)switch(g){case"src":f=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Ye(s,l,g,v,u,null)}}m&&Ye(s,l,"srcSet",u.srcSet,u,null),f&&Ye(s,l,"src",u.src,u,null);return;case"input":Ee("invalid",s);var A=g=v=m=null,T=null,B=null;for(f in u)if(u.hasOwnProperty(f)){var Q=u[f];if(Q!=null)switch(f){case"name":m=Q;break;case"type":v=Q;break;case"checked":T=Q;break;case"defaultChecked":B=Q;break;case"value":g=Q;break;case"defaultValue":A=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(n(137,l));break;default:Ye(s,l,f,Q,u,null)}}P0(s,g,A,T,B,v,m,!1);return;case"select":Ee("invalid",s),f=v=g=null;for(m in u)if(u.hasOwnProperty(m)&&(A=u[m],A!=null))switch(m){case"value":g=A;break;case"defaultValue":v=A;break;case"multiple":f=A;default:Ye(s,l,m,A,u,null)}l=g,u=v,s.multiple=!!f,l!=null?Rs(s,!!f,l,!1):u!=null&&Rs(s,!!f,u,!0);return;case"textarea":Ee("invalid",s),g=m=f=null;for(v in u)if(u.hasOwnProperty(v)&&(A=u[v],A!=null))switch(v){case"value":f=A;break;case"defaultValue":m=A;break;case"children":g=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(n(91));break;default:Ye(s,l,v,A,u,null)}V0(s,f,m,g);return;case"option":for(T in u)u.hasOwnProperty(T)&&(f=u[T],f!=null)&&(T==="selected"?s.selected=f&&typeof f!="function"&&typeof f!="symbol":Ye(s,l,T,f,u,null));return;case"dialog":Ee("beforetoggle",s),Ee("toggle",s),Ee("cancel",s),Ee("close",s);break;case"iframe":case"object":Ee("load",s);break;case"video":case"audio":for(f=0;f<Eo.length;f++)Ee(Eo[f],s);break;case"image":Ee("error",s),Ee("load",s);break;case"details":Ee("toggle",s);break;case"embed":case"source":case"link":Ee("error",s),Ee("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(B in u)if(u.hasOwnProperty(B)&&(f=u[B],f!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Ye(s,l,B,f,u,null)}return;default:if(df(l)){for(Q in u)u.hasOwnProperty(Q)&&(f=u[Q],f!==void 0&&$d(s,l,Q,f,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(f=u[A],f!=null&&Ye(s,l,A,f,u,null))}function UT(s,l,u,f){switch(l){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,T=null,B=null,Q=null;for(P in u){var K=u[P];if(u.hasOwnProperty(P)&&K!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":T=K;default:f.hasOwnProperty(P)||Ye(s,l,P,null,f,K)}}for(var z in f){var P=f[z];if(K=u[z],f.hasOwnProperty(z)&&(P!=null||K!=null))switch(z){case"type":g=P;break;case"name":m=P;break;case"checked":B=P;break;case"defaultChecked":Q=P;break;case"value":v=P;break;case"defaultValue":A=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(n(137,l));break;default:P!==K&&Ye(s,l,z,P,f,K)}}hf(s,v,A,T,B,Q,g,m);return;case"select":P=v=A=z=null;for(g in u)if(T=u[g],u.hasOwnProperty(g)&&T!=null)switch(g){case"value":break;case"multiple":P=T;default:f.hasOwnProperty(g)||Ye(s,l,g,null,f,T)}for(m in f)if(g=f[m],T=u[m],f.hasOwnProperty(m)&&(g!=null||T!=null))switch(m){case"value":z=g;break;case"defaultValue":A=g;break;case"multiple":v=g;default:g!==T&&Ye(s,l,m,g,f,T)}l=A,u=v,f=P,z!=null?Rs(s,!!u,z,!1):!!f!=!!u&&(l!=null?Rs(s,!!u,l,!0):Rs(s,!!u,u?[]:"",!1));return;case"textarea":P=z=null;for(A in u)if(m=u[A],u.hasOwnProperty(A)&&m!=null&&!f.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Ye(s,l,A,null,f,m)}for(v in f)if(m=f[v],g=u[v],f.hasOwnProperty(v)&&(m!=null||g!=null))switch(v){case"value":z=m;break;case"defaultValue":P=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(n(91));break;default:m!==g&&Ye(s,l,v,m,f,g)}F0(s,z,P);return;case"option":for(var ae in u)z=u[ae],u.hasOwnProperty(ae)&&z!=null&&!f.hasOwnProperty(ae)&&(ae==="selected"?s.selected=!1:Ye(s,l,ae,null,f,z));for(T in f)z=f[T],P=u[T],f.hasOwnProperty(T)&&z!==P&&(z!=null||P!=null)&&(T==="selected"?s.selected=z&&typeof z!="function"&&typeof z!="symbol":Ye(s,l,T,z,f,P));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 be in u)z=u[be],u.hasOwnProperty(be)&&z!=null&&!f.hasOwnProperty(be)&&Ye(s,l,be,null,f,z);for(B in f)if(z=f[B],P=u[B],f.hasOwnProperty(B)&&z!==P&&(z!=null||P!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(n(137,l));break;default:Ye(s,l,B,z,f,P)}return;default:if(df(l)){for(var Ge in u)z=u[Ge],u.hasOwnProperty(Ge)&&z!==void 0&&!f.hasOwnProperty(Ge)&&$d(s,l,Ge,void 0,f,z);for(Q in f)z=f[Q],P=u[Q],!f.hasOwnProperty(Q)||z===P||z===void 0&&P===void 0||$d(s,l,Q,z,f,P);return}}for(var j in u)z=u[j],u.hasOwnProperty(j)&&z!=null&&!f.hasOwnProperty(j)&&Ye(s,l,j,null,f,z);for(K in f)z=f[K],P=u[K],!f.hasOwnProperty(K)||z===P||z==null&&P==null||Ye(s,l,K,z,f,P)}function Yx(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function qT(){if(typeof performance.getEntriesByType=="function"){for(var s=0,l=0,u=performance.getEntriesByType("resource"),f=0;f<u.length;f++){var m=u[f],g=m.transferSize,v=m.initiatorType,A=m.duration;if(g&&A&&Yx(v)){for(v=0,A=m.responseEnd,f+=1;f<u.length;f++){var T=u[f],B=T.startTime;if(B>A)break;var Q=T.transferSize,K=T.initiatorType;Q&&Yx(K)&&(T=T.responseEnd,v+=Q*(T<A?1:(A-B)/(T-B)))}if(--f,l+=8*(g+v)/(m.duration/1e3),s++,10<s)break}}if(0<s)return l/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var ep=null,tp=null;function Gu(s){return s.nodeType===9?s:s.ownerDocument}function Gx(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 Kx(s,l){if(s===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&l==="foreignObject"?0:s}function ip(s,l){return s==="textarea"||s==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var np=null;function PT(){var s=window.event;return s&&s.type==="popstate"?s===np?!1:(np=s,!0):(np=null,!1)}var Wx=typeof setTimeout=="function"?setTimeout:void 0,FT=typeof clearTimeout=="function"?clearTimeout:void 0,Xx=typeof Promise=="function"?Promise:void 0,VT=typeof queueMicrotask=="function"?queueMicrotask:typeof Xx<"u"?function(s){return Xx.resolve(null).then(s).catch(IT)}:Wx;function IT(s){setTimeout(function(){throw s})}function yr(s){return s==="head"}function Zx(s,l){var u=l,f=0;do{var m=u.nextSibling;if(s.removeChild(u),m&&m.nodeType===8)if(u=m.data,u==="/$"||u==="/&"){if(f===0){s.removeChild(m),ul(l);return}f--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")f++;else if(u==="html")Ro(s.ownerDocument.documentElement);else if(u==="head"){u=s.ownerDocument.head,Ro(u);for(var g=u.firstChild;g;){var v=g.nextSibling,A=g.nodeName;g[Kl]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&g.rel.toLowerCase()==="stylesheet"||u.removeChild(g),g=v}}else u==="body"&&Ro(s.ownerDocument.body);u=m}while(u);ul(l)}function Jx(s,l){var u=s;s=0;do{var f=u.nextSibling;if(u.nodeType===1?l?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(l?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),f&&f.nodeType===8)if(u=f.data,u==="/$"){if(s===0)break;s--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||s++;u=f}while(u)}function rp(s){var l=s.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var u=l;switch(l=l.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":rp(u),uf(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}s.removeChild(u)}}function QT(s,l,u,f){for(;s.nodeType===1;){var m=u;if(s.nodeName.toLowerCase()!==l.toLowerCase()){if(!f&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(f){if(!s[Kl])switch(l){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(l==="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=zi(s.nextSibling),s===null)break}return null}function YT(s,l,u){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!u||(s=zi(s.nextSibling),s===null))return null;return s}function $x(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=zi(s.nextSibling),s===null))return null;return s}function sp(s){return s.data==="$?"||s.data==="$~"}function lp(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function GT(s,l){var u=s.ownerDocument;if(s.data==="$~")s._reactRetry=l;else if(s.data!=="$?"||u.readyState!=="loading")l();else{var f=function(){l(),u.removeEventListener("DOMContentLoaded",f)};u.addEventListener("DOMContentLoaded",f),s._reactRetry=f}}function zi(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return s}var op=null;function e1(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var u=s.data;if(u==="/$"||u==="/&"){if(l===0)return zi(s.nextSibling);l--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||l++}s=s.nextSibling}return null}function t1(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var u=s.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(l===0)return s;l--}else u!=="/$"&&u!=="/&"||l++}s=s.previousSibling}return null}function i1(s,l,u){switch(l=Gu(u),s){case"html":if(s=l.documentElement,!s)throw Error(n(452));return s;case"head":if(s=l.head,!s)throw Error(n(453));return s;case"body":if(s=l.body,!s)throw Error(n(454));return s;default:throw Error(n(451))}}function Ro(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);uf(s)}var _i=new Map,n1=new Set;function Ku(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Pn=X.d;X.d={f:KT,r:WT,D:XT,C:ZT,L:JT,m:$T,X:tO,S:eO,M:iO};function KT(){var s=Pn.f(),l=Uu();return s||l}function WT(s){var l=Os(s);l!==null&&l.tag===5&&l.type==="form"?vb(l):Pn.r(s)}var ll=typeof document>"u"?null:document;function r1(s,l,u){var f=ll;if(f&&typeof l=="string"&&l){var m=Ei(l);m='link[rel="'+s+'"][href="'+m+'"]',typeof u=="string"&&(m+='[crossorigin="'+u+'"]'),n1.has(m)||(n1.add(m),s={rel:s,crossOrigin:u,href:l},f.querySelector(m)===null&&(l=f.createElement("link"),Bt(l,"link",s),Mt(l),f.head.appendChild(l)))}}function XT(s){Pn.D(s),r1("dns-prefetch",s,null)}function ZT(s,l){Pn.C(s,l),r1("preconnect",s,l)}function JT(s,l,u){Pn.L(s,l,u);var f=ll;if(f&&s&&l){var m='link[rel="preload"][as="'+Ei(l)+'"]';l==="image"&&u&&u.imageSrcSet?(m+='[imagesrcset="'+Ei(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(m+='[imagesizes="'+Ei(u.imageSizes)+'"]')):m+='[href="'+Ei(s)+'"]';var g=m;switch(l){case"style":g=ol(s);break;case"script":g=al(s)}_i.has(g)||(s=y({rel:"preload",href:l==="image"&&u&&u.imageSrcSet?void 0:s,as:l},u),_i.set(g,s),f.querySelector(m)!==null||l==="style"&&f.querySelector(Do(g))||l==="script"&&f.querySelector(jo(g))||(l=f.createElement("link"),Bt(l,"link",s),Mt(l),f.head.appendChild(l)))}}function $T(s,l){Pn.m(s,l);var u=ll;if(u&&s){var f=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+Ei(f)+'"][href="'+Ei(s)+'"]',g=m;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=al(s)}if(!_i.has(g)&&(s=y({rel:"modulepreload",href:s},l),_i.set(g,s),u.querySelector(m)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(jo(g)))return}f=u.createElement("link"),Bt(f,"link",s),Mt(f),u.head.appendChild(f)}}}function eO(s,l,u){Pn.S(s,l,u);var f=ll;if(f&&s){var m=Es(f).hoistableStyles,g=ol(s);l=l||"default";var v=m.get(g);if(!v){var A={loading:0,preload:null};if(v=f.querySelector(Do(g)))A.loading=5;else{s=y({rel:"stylesheet",href:s,"data-precedence":l},u),(u=_i.get(g))&&ap(s,u);var T=v=f.createElement("link");Mt(T),Bt(T,"link",s),T._p=new Promise(function(B,Q){T.onload=B,T.onerror=Q}),T.addEventListener("load",function(){A.loading|=1}),T.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Wu(v,l,f)}v={type:"stylesheet",instance:v,count:1,state:A},m.set(g,v)}}}function tO(s,l){Pn.X(s,l);var u=ll;if(u&&s){var f=Es(u).hoistableScripts,m=al(s),g=f.get(m);g||(g=u.querySelector(jo(m)),g||(s=y({src:s,async:!0},l),(l=_i.get(m))&&up(s,l),g=u.createElement("script"),Mt(g),Bt(g,"link",s),u.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},f.set(m,g))}}function iO(s,l){Pn.M(s,l);var u=ll;if(u&&s){var f=Es(u).hoistableScripts,m=al(s),g=f.get(m);g||(g=u.querySelector(jo(m)),g||(s=y({src:s,async:!0,type:"module"},l),(l=_i.get(m))&&up(s,l),g=u.createElement("script"),Mt(g),Bt(g,"link",s),u.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},f.set(m,g))}}function s1(s,l,u,f){var m=(m=we.current)?Ku(m):null;if(!m)throw Error(n(446));switch(s){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(l=ol(u.href),u=Es(m).hoistableStyles,f=u.get(l),f||(f={type:"style",instance:null,count:0,state:null},u.set(l,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){s=ol(u.href);var g=Es(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(Do(s)))&&!g._p&&(v.instance=g,v.state.loading=5),_i.has(s)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},_i.set(s,u),g||nO(m,s,u,v.state))),l&&f===null)throw Error(n(528,""));return v}if(l&&f!==null)throw Error(n(529,""));return null;case"script":return l=u.async,u=u.src,typeof u=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=al(u),u=Es(m).hoistableScripts,f=u.get(l),f||(f={type:"script",instance:null,count:0,state:null},u.set(l,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,s))}}function ol(s){return'href="'+Ei(s)+'"'}function Do(s){return'link[rel="stylesheet"]['+s+"]"}function l1(s){return y({},s,{"data-precedence":s.precedence,precedence:null})}function nO(s,l,u,f){s.querySelector('link[rel="preload"][as="style"]['+l+"]")?f.loading=1:(l=s.createElement("link"),f.preload=l,l.addEventListener("load",function(){return f.loading|=1}),l.addEventListener("error",function(){return f.loading|=2}),Bt(l,"link",u),Mt(l),s.head.appendChild(l))}function al(s){return'[src="'+Ei(s)+'"]'}function jo(s){return"script[async]"+s}function o1(s,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var f=s.querySelector('style[data-href~="'+Ei(u.href)+'"]');if(f)return l.instance=f,Mt(f),f;var m=y({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return f=(s.ownerDocument||s).createElement("style"),Mt(f),Bt(f,"style",m),Wu(f,u.precedence,s),l.instance=f;case"stylesheet":m=ol(u.href);var g=s.querySelector(Do(m));if(g)return l.state.loading|=4,l.instance=g,Mt(g),g;f=l1(u),(m=_i.get(m))&&ap(f,m),g=(s.ownerDocument||s).createElement("link"),Mt(g);var v=g;return v._p=new Promise(function(A,T){v.onload=A,v.onerror=T}),Bt(g,"link",f),l.state.loading|=4,Wu(g,u.precedence,s),l.instance=g;case"script":return g=al(u.src),(m=s.querySelector(jo(g)))?(l.instance=m,Mt(m),m):(f=u,(m=_i.get(g))&&(f=y({},u),up(f,m)),s=s.ownerDocument||s,m=s.createElement("script"),Mt(m),Bt(m,"link",f),s.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(n(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(f=l.instance,l.state.loading|=4,Wu(f,u.precedence,s));return l.instance}function Wu(s,l,u){for(var f=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=f.length?f[f.length-1]:null,g=m,v=0;v<f.length;v++){var A=f[v];if(A.dataset.precedence===l)g=A;else if(g!==m)break}g?g.parentNode.insertBefore(s,g.nextSibling):(l=u.nodeType===9?u.head:u,l.insertBefore(s,l.firstChild))}function ap(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function up(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var Xu=null;function a1(s,l,u){if(Xu===null){var f=new Map,m=Xu=new Map;m.set(u,f)}else m=Xu,f=m.get(u),f||(f=new Map,m.set(u,f));if(f.has(s))return f;for(f.set(s,null),u=u.getElementsByTagName(s),m=0;m<u.length;m++){var g=u[m];if(!(g[Kl]||g[Rt]||s==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var v=g.getAttribute(l)||"";v=s+v;var A=f.get(v);A?A.push(g):f.set(v,[g])}}return f}function u1(s,l,u){s=s.ownerDocument||s,s.head.insertBefore(u,l==="title"?s.querySelector("head > title"):null)}function rO(s,l,u){if(u===1||l.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(s=l.disabled,typeof l.precedence=="string"&&s==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function c1(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function sO(s,l,u,f){if(u.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var m=ol(f.href),g=l.querySelector(Do(m));if(g){l=g._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=Zu.bind(s),l.then(s,s)),u.state.loading|=4,u.instance=g,Mt(g);return}g=l.ownerDocument||l,f=l1(f),(m=_i.get(m))&&ap(f,m),g=g.createElement("link"),Mt(g);var v=g;v._p=new Promise(function(A,T){v.onload=A,v.onerror=T}),Bt(g,"link",f),u.instance=g}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(u,l),(l=u.state.preload)&&(u.state.loading&3)===0&&(s.count++,u=Zu.bind(s),l.addEventListener("load",u),l.addEventListener("error",u))}}var cp=0;function lO(s,l){return s.stylesheets&&s.count===0&&$u(s,s.stylesheets),0<s.count||0<s.imgCount?function(u){var f=setTimeout(function(){if(s.stylesheets&&$u(s,s.stylesheets),s.unsuspend){var g=s.unsuspend;s.unsuspend=null,g()}},6e4+l);0<s.imgBytes&&cp===0&&(cp=62500*qT());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&$u(s,s.stylesheets),s.unsuspend)){var g=s.unsuspend;s.unsuspend=null,g()}},(s.imgBytes>cp?50:800)+l);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(f),clearTimeout(m)}}:null}function Zu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$u(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Ju=null;function $u(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Ju=new Map,l.forEach(oO,s),Ju=null,Zu.call(s))}function oO(s,l){if(!(l.state.loading&4)){var u=Ju.get(s);if(u)var f=u.get(null);else{u=new Map,Ju.set(s,u);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")&&(u.set(v.dataset.precedence,v),f=v)}f&&u.set(null,f)}m=l.instance,v=m.getAttribute("data-precedence"),g=u.get(v)||f,g===f&&u.set(null,m),u.set(v,m),this.count++,f=Zu.bind(this),m.addEventListener("load",f),m.addEventListener("error",f),g?g.parentNode.insertBefore(m,g.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),l.state.loading|=4}}var Lo={$$typeof:D,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function aO(s,l,u,f,m,g,v,A,T){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=sf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sf(0),this.hiddenUpdates=sf(null),this.identifierPrefix=f,this.onUncaughtError=m,this.onCaughtError=g,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function h1(s,l,u,f,m,g,v,A,T,B,Q,K){return s=new aO(s,l,u,v,T,B,Q,K,A),l=1,g===!0&&(l|=24),g=yi(3,null,null,l),s.current=g,g.stateNode=s,l=Vf(),l.refCount++,s.pooledCache=l,l.refCount++,g.memoizedState={element:f,isDehydrated:u,cache:l},Gf(g),s}function f1(s){return s?(s=Us,s):Us}function d1(s,l,u,f,m,g){m=f1(m),f.context===null?f.context=m:f.pendingContext=m,f=lr(l),f.payload={element:u},g=g===void 0?null:g,g!==null&&(f.callback=g),u=or(s,f,l),u!==null&&(si(u,s,l),ho(u,s,l))}function p1(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<l?u:l}}function hp(s,l){p1(s,l),(s=s.alternate)&&p1(s,l)}function m1(s){if(s.tag===13||s.tag===31){var l=Wr(s,67108864);l!==null&&si(l,s,67108864),hp(s,67108864)}}function g1(s){if(s.tag===13||s.tag===31){var l=wi();l=lf(l);var u=Wr(s,l);u!==null&&si(u,s,l),hp(s,l)}}var ec=!0;function uO(s,l,u,f){var m=_.T;_.T=null;var g=X.p;try{X.p=2,fp(s,l,u,f)}finally{X.p=g,_.T=m}}function cO(s,l,u,f){var m=_.T;_.T=null;var g=X.p;try{X.p=8,fp(s,l,u,f)}finally{X.p=g,_.T=m}}function fp(s,l,u,f){if(ec){var m=dp(f);if(m===null)Jd(s,l,f,tc,u),b1(s,f);else if(fO(m,s,l,u,f))f.stopPropagation();else if(b1(s,f),l&4&&-1<hO.indexOf(s)){for(;m!==null;){var g=Os(m);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var v=Ir(g.pendingLanes);if(v!==0){var A=g;for(A.pendingLanes|=2,A.entangledLanes|=2;v;){var T=1<<31-mi(v);A.entanglements[1]|=T,v&=~T}on(g),(qe&6)===0&&(_u=di()+500,Oo(0))}}break;case 31:case 13:A=Wr(g,2),A!==null&&si(A,g,2),Uu(),hp(g,2)}if(g=dp(f),g===null&&Jd(s,l,f,tc,u),g===m)break;m=g}m!==null&&f.stopPropagation()}else Jd(s,l,f,null,u)}}function dp(s){return s=mf(s),pp(s)}var tc=null;function pp(s){if(tc=null,s=Ts(s),s!==null){var l=o(s);if(l===null)s=null;else{var u=l.tag;if(u===13){if(s=a(l),s!==null)return s;s=null}else if(u===31){if(s=c(l),s!==null)return s;s=null}else if(u===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return tc=s,null}function y1(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(XA()){case A0:return 2;case M0:return 8;case Ia:case ZA:return 32;case T0:return 268435456;default:return 32}default:return 32}}var mp=!1,br=null,xr=null,vr=null,Bo=new Map,zo=new Map,Sr=[],hO="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 b1(s,l){switch(s){case"focusin":case"focusout":br=null;break;case"dragenter":case"dragleave":xr=null;break;case"mouseover":case"mouseout":vr=null;break;case"pointerover":case"pointerout":Bo.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":zo.delete(l.pointerId)}}function _o(s,l,u,f,m,g){return s===null||s.nativeEvent!==g?(s={blockedOn:l,domEventName:u,eventSystemFlags:f,nativeEvent:g,targetContainers:[m]},l!==null&&(l=Os(l),l!==null&&m1(l)),s):(s.eventSystemFlags|=f,l=s.targetContainers,m!==null&&l.indexOf(m)===-1&&l.push(m),s)}function fO(s,l,u,f,m){switch(l){case"focusin":return br=_o(br,s,l,u,f,m),!0;case"dragenter":return xr=_o(xr,s,l,u,f,m),!0;case"mouseover":return vr=_o(vr,s,l,u,f,m),!0;case"pointerover":var g=m.pointerId;return Bo.set(g,_o(Bo.get(g)||null,s,l,u,f,m)),!0;case"gotpointercapture":return g=m.pointerId,zo.set(g,_o(zo.get(g)||null,s,l,u,f,m)),!0}return!1}function x1(s){var l=Ts(s.target);if(l!==null){var u=o(l);if(u!==null){if(l=u.tag,l===13){if(l=a(u),l!==null){s.blockedOn=l,j0(s.priority,function(){g1(u)});return}}else if(l===31){if(l=c(u),l!==null){s.blockedOn=l,j0(s.priority,function(){g1(u)});return}}else if(l===3&&u.stateNode.current.memoizedState.isDehydrated){s.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}s.blockedOn=null}function ic(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var u=dp(s.nativeEvent);if(u===null){u=s.nativeEvent;var f=new u.constructor(u.type,u);pf=f,u.target.dispatchEvent(f),pf=null}else return l=Os(u),l!==null&&m1(l),s.blockedOn=u,!1;l.shift()}return!0}function v1(s,l,u){ic(s)&&u.delete(l)}function dO(){mp=!1,br!==null&&ic(br)&&(br=null),xr!==null&&ic(xr)&&(xr=null),vr!==null&&ic(vr)&&(vr=null),Bo.forEach(v1),zo.forEach(v1)}function nc(s,l){s.blockedOn===l&&(s.blockedOn=null,mp||(mp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,dO)))}var rc=null;function S1(s){rc!==s&&(rc=s,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){rc===s&&(rc=null);for(var l=0;l<s.length;l+=3){var u=s[l],f=s[l+1],m=s[l+2];if(typeof f!="function"){if(pp(f||u)===null)continue;break}var g=Os(u);g!==null&&(s.splice(l,3),l-=3,dd(g,{pending:!0,data:m,method:u.method,action:f},f,m))}}))}function ul(s){function l(T){return nc(T,s)}br!==null&&nc(br,s),xr!==null&&nc(xr,s),vr!==null&&nc(vr,s),Bo.forEach(l),zo.forEach(l);for(var u=0;u<Sr.length;u++){var f=Sr[u];f.blockedOn===s&&(f.blockedOn=null)}for(;0<Sr.length&&(u=Sr[0],u.blockedOn===null);)x1(u),u.blockedOn===null&&Sr.shift();if(u=(s.ownerDocument||s).$$reactFormReplay,u!=null)for(f=0;f<u.length;f+=3){var m=u[f],g=u[f+1],v=m[$t]||null;if(typeof g=="function")v||S1(u);else if(v){var A=null;if(g&&g.hasAttribute("formAction")){if(m=g,v=g[$t]||null)A=v.formAction;else if(pp(m)!==null)continue}else A=v.action;typeof A=="function"?u[f+1]=A:(u.splice(f,3),f-=3),S1(u)}}}function w1(){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 l(){m!==null&&(m(),m=null),f||setTimeout(u,20)}function u(){if(!f&&!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 f=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(u,100),function(){f=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),m!==null&&(m(),m=null)}}}function gp(s){this._internalRoot=s}sc.prototype.render=gp.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(n(409));var u=l.current,f=wi();d1(u,f,s,l,null,null)},sc.prototype.unmount=gp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;d1(s.current,2,null,s,null,null),Uu(),l[Ms]=null}};function sc(s){this._internalRoot=s}sc.prototype.unstable_scheduleHydration=function(s){if(s){var l=D0();s={blockedOn:null,target:s,priority:l};for(var u=0;u<Sr.length&&l!==0&&l<Sr[u].priority;u++);Sr.splice(u,0,s),u===0&&x1(s)}};var C1=e.version;if(C1!=="19.2.4")throw Error(n(527,C1,"19.2.4"));X.findDOMNode=function(s){var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=d(l),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var pO={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:_,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lc.isDisabled&&lc.supportsFiber)try{Ql=lc.inject(pO),pi=lc}catch{}}return Uo.createRoot=function(s,l){if(!r(s))throw Error(n(299));var u=!1,f="",m=Nb,g=Rb,v=Db;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(f=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(g=l.onCaughtError),l.onRecoverableError!==void 0&&(v=l.onRecoverableError)),l=h1(s,1,!1,null,null,u,f,null,m,g,v,w1),s[Ms]=l.current,Zd(s),new gp(l)},Uo.hydrateRoot=function(s,l,u){if(!r(s))throw Error(n(299));var f=!1,m="",g=Nb,v=Rb,A=Db,T=null;return u!=null&&(u.unstable_strictMode===!0&&(f=!0),u.identifierPrefix!==void 0&&(m=u.identifierPrefix),u.onUncaughtError!==void 0&&(g=u.onUncaughtError),u.onCaughtError!==void 0&&(v=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(T=u.formState)),l=h1(s,1,!0,l,u??null,f,m,T,g,v,A,w1),l.context=f1(null),u=l.current,f=wi(),f=lf(f),m=lr(f),m.callback=null,or(u,m,f),u=f,l.current.lanes=u,Gl(l,u),on(l),s[Ms]=l.current,Zd(s),new sc(l)},Uo.version="19.2.4",Uo}var j1;function kO(){if(j1)return xp.exports;j1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),xp.exports=CO(),xp.exports}var AO=kO();var L1="popstate";function B1(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function MO(t={}){function e(n,r){let o=r.state?.masked,{pathname:a,search:c,hash:h}=o||n.location;return um("",{pathname:a,search:c,hash:h},r.state&&r.state.usr||null,r.state&&r.state.key||"default",o?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function i(n,r){return typeof r=="string"?r:oa(r)}return OO(e,i,null,t)}function rt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Ji(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function TO(){return Math.random().toString(36).substring(2,10)}function z1(t,e){return{usr:t.state,key:t.key,idx:e,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function um(t,e,i=null,n,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?zl(e):e,state:i,key:e&&e.key||n||TO(),unstable_mask:r}}function oa({pathname:t="/",search:e="",hash:i=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),i&&i!=="#"&&(t+=i.charAt(0)==="#"?i:"#"+i),t}function zl(t){let e={};if(t){let i=t.indexOf("#");i>=0&&(e.hash=t.substring(i),t=t.substring(0,i));let n=t.indexOf("?");n>=0&&(e.search=t.substring(n),t=t.substring(0,n)),t&&(e.pathname=t)}return e}function OO(t,e,i,n={}){let{window:r=document.defaultView,v5Compat:o=!1}=n,a=r.history,c="POP",h=null,d=p();d==null&&(d=0,a.replaceState({...a.state,idx:d},""));function p(){return(a.state||{idx:null}).idx}function y(){c="POP";let k=p(),M=k==null?null:k-d;d=k,h&&h({action:c,location:C.location,delta:M})}function b(k,M){c="PUSH";let O=B1(k)?k:um(C.location,k,M);d=p()+1;let D=z1(O,d),V=C.createHref(O.unstable_mask||O);try{a.pushState(D,"",V)}catch(H){if(H instanceof DOMException&&H.name==="DataCloneError")throw H;r.location.assign(V)}o&&h&&h({action:c,location:C.location,delta:1})}function x(k,M){c="REPLACE";let O=B1(k)?k:um(C.location,k,M);d=p();let D=z1(O,d),V=C.createHref(O.unstable_mask||O);a.replaceState(D,"",V),o&&h&&h({action:c,location:C.location,delta:0})}function w(k){return EO(k)}let C={get action(){return c},get location(){return t(r,a)},listen(k){if(h)throw new Error("A history only accepts one active listener");return r.addEventListener(L1,y),h=k,()=>{r.removeEventListener(L1,y),h=null}},createHref(k){return e(r,k)},createURL:w,encodeLocation(k){let M=w(k);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:b,replace:x,go(k){return a.go(k)}};return C}function EO(t,e=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),rt(i,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:oa(t);return n=n.replace(/ $/,"%20"),!e&&n.startsWith("//")&&(n=i+n),new URL(n,i)}function d2(t,e,i="/"){return NO(t,e,i,!1)}function NO(t,e,i,n){let r=typeof e=="string"?zl(e):e,o=Yn(r.pathname||"/",i);if(o==null)return null;let a=p2(t);RO(a);let c=null;for(let h=0;c==null&&h<a.length;++h){let d=FO(o);c=qO(a[h],d,n)}return c}function p2(t,e=[],i=[],n="",r=!1){let o=(a,c,h=r,d)=>{let p={relativePath:d===void 0?a.path||"":d,caseSensitive:a.caseSensitive===!0,childrenIndex:c,route:a};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(n)&&h)return;rt(p.relativePath.startsWith(n),`Absolute route path "${p.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(n.length)}let y=bn([n,p.relativePath]),b=i.concat(p);a.children&&a.children.length>0&&(rt(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),p2(a.children,e,b,y,h)),!(a.path==null&&!a.index)&&e.push({path:y,score:HO(y,a.index),routesMeta:b})};return t.forEach((a,c)=>{if(a.path===""||!a.path?.includes("?"))o(a,c);else for(let h of m2(a.path))o(a,c,!0,h)}),e}function m2(t){let e=t.split("/");if(e.length===0)return[];let[i,...n]=e,r=i.endsWith("?"),o=i.replace(/\?$/,"");if(n.length===0)return r?[o,""]:[o];let a=m2(n.join("/")),c=[];return c.push(...a.map(h=>h===""?o:[o,h].join("/"))),r&&c.push(...a),c.map(h=>t.startsWith("/")&&h===""?"/":h)}function RO(t){t.sort((e,i)=>e.score!==i.score?i.score-e.score:UO(e.routesMeta.map(n=>n.childrenIndex),i.routesMeta.map(n=>n.childrenIndex)))}var DO=/^:[\w-]+$/,jO=3,LO=2,BO=1,zO=10,_O=-2,_1=t=>t==="*";function HO(t,e){let i=t.split("/"),n=i.length;return i.some(_1)&&(n+=_O),e&&(n+=LO),i.filter(r=>!_1(r)).reduce((r,o)=>r+(DO.test(o)?jO:o===""?BO:zO),n)}function UO(t,e){return t.length===e.length&&t.slice(0,-1).every((n,r)=>n===e[r])?t[t.length-1]-e[e.length-1]:0}function qO(t,e,i=!1){let{routesMeta:n}=t,r={},o="/",a=[];for(let c=0;c<n.length;++c){let h=n[c],d=c===n.length-1,p=o==="/"?e:e.slice(o.length)||"/",y=Qc({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},p),b=h.route;if(!y&&d&&i&&!n[n.length-1].route.index&&(y=Qc({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},p)),!y)return null;Object.assign(r,y.params),a.push({params:r,pathname:bn([o,y.pathname]),pathnameBase:YO(bn([o,y.pathnameBase])),route:b}),y.pathnameBase!=="/"&&(o=bn([o,y.pathnameBase]))}return a}function Qc(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,n]=PO(t.path,t.caseSensitive,t.end),r=e.match(i);if(!r)return null;let o=r[0],a=o.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:n.reduce((d,{paramName:p,isOptional:y},b)=>{if(p==="*"){let w=c[b]||"";a=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const x=c[b];return y&&!x?d[p]=void 0:d[p]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:a,pattern:t}}function PO(t,e=!1,i=!0){Ji(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let n=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,c,h,d,p)=>{if(n.push({paramName:c,isOptional:h!=null}),h){let y=p.charAt(d+a.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(n.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),n]}function FO(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ji(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Yn(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let i=e.endsWith("/")?e.length-1:e.length,n=t.charAt(i);return n&&n!=="/"?null:t.slice(i)||"/"}var VO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function IO(t,e="/"){let{pathname:i,search:n="",hash:r=""}=typeof t=="string"?zl(t):t,o;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?o=H1(i.substring(1),"/"):o=H1(i,e)):o=e,{pathname:o,search:GO(n),hash:KO(r)}}function H1(t,e){let i=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(r=>{r===".."?i.length>1&&i.pop():r!=="."&&i.push(r)}),i.length>1?i.join("/"):"/"}function Cp(t,e,i,n){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function QO(t){return t.filter((e,i)=>i===0||e.route.path&&e.route.path.length>0)}function Sg(t){let e=QO(t);return e.map((i,n)=>n===e.length-1?i.pathname:i.pathnameBase)}function Dh(t,e,i,n=!1){let r;typeof t=="string"?r=zl(t):(r={...t},rt(!r.pathname||!r.pathname.includes("?"),Cp("?","pathname","search",r)),rt(!r.pathname||!r.pathname.includes("#"),Cp("#","pathname","hash",r)),rt(!r.search||!r.search.includes("#"),Cp("#","search","hash",r)));let o=t===""||r.pathname==="",a=o?"/":r.pathname,c;if(a==null)c=i;else{let y=e.length-1;if(!n&&a.startsWith("..")){let b=a.split("/");for(;b[0]==="..";)b.shift(),y-=1;r.pathname=b.join("/")}c=y>=0?e[y]:"/"}let h=IO(r,c),d=a&&a!=="/"&&a.endsWith("/"),p=(o||a===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(d||p)&&(h.pathname+="/"),h}var bn=t=>t.join("/").replace(/\/\/+/g,"/"),YO=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),GO=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,KO=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,WO=class{constructor(t,e,i,n=!1){this.status=t,this.statusText=e||"",this.internal=n,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function XO(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function ZO(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var g2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function y2(t,e){let i=t;if(typeof i!="string"||!VO.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let n=i,r=!1;if(g2)try{let o=new URL(window.location.href),a=i.startsWith("//")?new URL(o.protocol+i):new URL(i),c=Yn(a.pathname,e);a.origin===o.origin&&c!=null?i=c+a.search+a.hash:r=!0}catch{Ji(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:r,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var b2=["POST","PUT","PATCH","DELETE"];new Set(b2);var JO=["GET",...b2];new Set(JO);var _l=N.createContext(null);_l.displayName="DataRouter";var jh=N.createContext(null);jh.displayName="DataRouterState";var $O=N.createContext(!1),x2=N.createContext({isTransitioning:!1});x2.displayName="ViewTransition";var eE=N.createContext(new Map);eE.displayName="Fetchers";var tE=N.createContext(null);tE.displayName="Await";var Ti=N.createContext(null);Ti.displayName="Navigation";var Da=N.createContext(null);Da.displayName="Location";var en=N.createContext({outlet:null,matches:[],isDataRoute:!1});en.displayName="Route";var wg=N.createContext(null);wg.displayName="RouteError";var v2="REACT_ROUTER_ERROR",iE="REDIRECT",nE="ROUTE_ERROR_RESPONSE";function rE(t){if(t.startsWith(`${v2}:${iE}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function sE(t){if(t.startsWith(`${v2}:${nE}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new WO(e.status,e.statusText,e.data)}catch{}}function lE(t,{relative:e}={}){rt(Hl(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:n}=N.useContext(Ti),{hash:r,pathname:o,search:a}=ja(t,{relative:e}),c=o;return i!=="/"&&(c=o==="/"?i:bn([i,o])),n.createHref({pathname:c,search:a,hash:r})}function Hl(){return N.useContext(Da)!=null}function Zn(){return rt(Hl(),"useLocation() may be used only in the context of a <Router> component."),N.useContext(Da).location}var S2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function w2(t){N.useContext(Ti).static||N.useLayoutEffect(t)}function C2(){let{isDataRoute:t}=N.useContext(en);return t?SE():oE()}function oE(){rt(Hl(),"useNavigate() may be used only in the context of a <Router> component.");let t=N.useContext(_l),{basename:e,navigator:i}=N.useContext(Ti),{matches:n}=N.useContext(en),{pathname:r}=Zn(),o=JSON.stringify(Sg(n)),a=N.useRef(!1);return w2(()=>{a.current=!0}),N.useCallback((h,d={})=>{if(Ji(a.current,S2),!a.current)return;if(typeof h=="number"){i.go(h);return}let p=Dh(h,JSON.parse(o),r,d.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:bn([e,p.pathname])),(d.replace?i.replace:i.push)(p,d.state,d)},[e,i,o,r,t])}var aE=N.createContext(null);function uE(t){let e=N.useContext(en).outlet;return N.useMemo(()=>e&&N.createElement(aE.Provider,{value:t},e),[e,t])}function ja(t,{relative:e}={}){let{matches:i}=N.useContext(en),{pathname:n}=Zn(),r=JSON.stringify(Sg(i));return N.useMemo(()=>Dh(t,JSON.parse(r),n,e==="path"),[t,r,n,e])}function cE(t,e){return k2(t,e)}function k2(t,e,i){rt(Hl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=N.useContext(Ti),{matches:r}=N.useContext(en),o=r[r.length-1],a=o?o.params:{},c=o?o.pathname:"/",h=o?o.pathnameBase:"/",d=o&&o.route;{let k=d&&d.path||"";M2(c,!d||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
+
11
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let p=Zn(),y;if(e){let k=typeof e=="string"?zl(e):e;rt(h==="/"||k.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${k.pathname}" was given in the \`location\` prop.`),y=k}else y=p;let b=y.pathname||"/",x=b;if(h!=="/"){let k=h.replace(/^\//,"").split("/");x="/"+b.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=d2(t,{pathname:x});Ji(d||w!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),Ji(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=mE(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},a,k.params),pathname:bn([h,n.encodeLocation?n.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?h:bn([h,n.encodeLocation?n.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),r,i);return e&&C?N.createElement(Da.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...y},navigationType:"POP"}},C):C}function hE(){let t=vE(),e=XO(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),i=t instanceof Error?t.stack:null,n="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:n},o={padding:"2px 4px",backgroundColor:n},a=null;return console.error("Error handled by React Router default ErrorBoundary:",t),a=N.createElement(N.Fragment,null,N.createElement("p",null,"💿 Hey developer 👋"),N.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",N.createElement("code",{style:o},"ErrorBoundary")," or"," ",N.createElement("code",{style:o},"errorElement")," prop on your route.")),N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},e),i?N.createElement("pre",{style:r},i):null,a)}var fE=N.createElement(hE,null),A2=class extends N.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const i=sE(t.digest);i&&(t=i)}let e=t!==void 0?N.createElement(en.Provider,{value:this.props.routeContext},N.createElement(wg.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?N.createElement(dE,{error:t},e):e}};A2.contextType=$O;var kp=new WeakMap;function dE({children:t,error:e}){let{basename:i}=N.useContext(Ti);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let n=rE(e.digest);if(n){let r=kp.get(e);if(r)throw r;let o=y2(n.location,i);if(g2&&!kp.get(e))if(o.isExternal||n.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:n.replace}));throw kp.set(e,a),a}return N.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return t}function pE({routeContext:t,match:e,children:i}){let n=N.useContext(_l);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),N.createElement(en.Provider,{value:t},i)}function mE(t,e=[],i){let n=i?.state;if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let r=t,o=n?.errors;if(o!=null){let p=r.findIndex(y=>y.route.id&&o?.[y.route.id]!==void 0);rt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,p+1))}let a=!1,c=-1;if(i&&n){a=n.renderFallback;for(let p=0;p<r.length;p++){let y=r[p];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(c=p),y.route.id){let{loaderData:b,errors:x}=n,w=y.route.loader&&!b.hasOwnProperty(y.route.id)&&(!x||x[y.route.id]===void 0);if(y.route.lazy||w){i.isStatic&&(a=!0),c>=0?r=r.slice(0,c+1):r=[r[0]];break}}}}let h=i?.onError,d=n&&h?(p,y)=>{h(p,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:ZO(n.matches),errorInfo:y})}:void 0;return r.reduceRight((p,y,b)=>{let x,w=!1,C=null,k=null;n&&(x=o&&y.route.id?o[y.route.id]:void 0,C=y.route.errorElement||fE,a&&(c<0&&b===0?(M2("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,k=null):c===b&&(w=!0,k=y.route.hydrateFallbackElement||null)));let M=e.concat(r.slice(0,b+1)),O=()=>{let D;return x?D=C:w?D=k:y.route.Component?D=N.createElement(y.route.Component,null):y.route.element?D=y.route.element:D=p,N.createElement(pE,{match:y,routeContext:{outlet:p,matches:M,isDataRoute:n!=null},children:D})};return n&&(y.route.ErrorBoundary||y.route.errorElement||b===0)?N.createElement(A2,{location:n.location,revalidation:n.revalidation,component:C,error:x,children:O(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:d}):O()},null)}function Cg(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gE(t){let e=N.useContext(_l);return rt(e,Cg(t)),e}function yE(t){let e=N.useContext(jh);return rt(e,Cg(t)),e}function bE(t){let e=N.useContext(en);return rt(e,Cg(t)),e}function kg(t){let e=bE(t),i=e.matches[e.matches.length-1];return rt(i.route.id,`${t} can only be used on routes that contain a unique "id"`),i.route.id}function xE(){return kg("useRouteId")}function vE(){let t=N.useContext(wg),e=yE("useRouteError"),i=kg("useRouteError");return t!==void 0?t:e.errors?.[i]}function SE(){let{router:t}=gE("useNavigate"),e=kg("useNavigate"),i=N.useRef(!1);return w2(()=>{i.current=!0}),N.useCallback(async(r,o={})=>{Ji(i.current,S2),i.current&&(typeof r=="number"?await t.navigate(r):await t.navigate(r,{fromRouteId:e,...o}))},[t,e])}var U1={};function M2(t,e,i){!e&&!U1[t]&&(U1[t]=!0,Ji(!1,i))}N.memo(wE);function wE({routes:t,future:e,state:i,isStatic:n,onError:r}){return k2(t,void 0,{state:i,isStatic:n,onError:r})}function CE({to:t,replace:e,state:i,relative:n}){rt(Hl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=N.useContext(Ti);Ji(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=N.useContext(en),{pathname:a}=Zn(),c=C2(),h=Dh(t,Sg(o),a,n==="path"),d=JSON.stringify(h);return N.useEffect(()=>{c(JSON.parse(d),{replace:e,state:i,relative:n})},[c,d,n,e,i]),null}function kE(t){return uE(t.context)}function jc(t){rt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function AE({basename:t="/",children:e=null,location:i,navigationType:n="POP",navigator:r,static:o=!1,unstable_useTransitions:a}){rt(!Hl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=t.replace(/^\/*/,"/"),h=N.useMemo(()=>({basename:c,navigator:r,static:o,unstable_useTransitions:a,future:{}}),[c,r,o,a]);typeof i=="string"&&(i=zl(i));let{pathname:d="/",search:p="",hash:y="",state:b=null,key:x="default",unstable_mask:w}=i,C=N.useMemo(()=>{let k=Yn(d,c);return k==null?null:{location:{pathname:k,search:p,hash:y,state:b,key:x,unstable_mask:w},navigationType:n}},[c,d,p,y,b,x,n,w]);return Ji(C!=null,`<Router basename="${c}"> is not able to match the URL "${d}${p}${y}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:N.createElement(Ti.Provider,{value:h},N.createElement(Da.Provider,{children:e,value:C}))}function ME({children:t,location:e}){return cE(cm(t),e)}function cm(t,e=[]){let i=[];return N.Children.forEach(t,(n,r)=>{if(!N.isValidElement(n))return;let o=[...e,r];if(n.type===N.Fragment){i.push.apply(i,cm(n.props.children,o));return}rt(n.type===jc,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),rt(!n.props.index||!n.props.children,"An index route cannot have child routes.");let a={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(a.children=cm(n.props.children,o)),i.push(a)}),i}var Lc="get",Bc="application/x-www-form-urlencoded";function Lh(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function TE(t){return Lh(t)&&t.tagName.toLowerCase()==="button"}function OE(t){return Lh(t)&&t.tagName.toLowerCase()==="form"}function EE(t){return Lh(t)&&t.tagName.toLowerCase()==="input"}function NE(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function RE(t,e){return t.button===0&&(!e||e==="_self")&&!NE(t)}var oc=null;function DE(){if(oc===null)try{new FormData(document.createElement("form"),0),oc=!1}catch{oc=!0}return oc}var jE=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ap(t){return t!=null&&!jE.has(t)?(Ji(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Bc}"`),null):t}function LE(t,e){let i,n,r,o,a;if(OE(t)){let c=t.getAttribute("action");n=c?Yn(c,e):null,i=t.getAttribute("method")||Lc,r=Ap(t.getAttribute("enctype"))||Bc,o=new FormData(t)}else if(TE(t)||EE(t)&&(t.type==="submit"||t.type==="image")){let c=t.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=t.getAttribute("formaction")||c.getAttribute("action");if(n=h?Yn(h,e):null,i=t.getAttribute("formmethod")||c.getAttribute("method")||Lc,r=Ap(t.getAttribute("formenctype"))||Ap(c.getAttribute("enctype"))||Bc,o=new FormData(c,t),!DE()){let{name:d,type:p,value:y}=t;if(p==="image"){let b=d?`${d}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else d&&o.append(d,y)}}else{if(Lh(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Lc,n=null,r=Bc,a=t}return o&&r==="text/plain"&&(a=o,o=void 0),{action:n,method:i.toLowerCase(),encType:r,formData:o,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ag(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function BE(t,e,i,n){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return i?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${n}`:r.pathname=`${r.pathname}.${n}`:r.pathname==="/"?r.pathname=`_root.${n}`:e&&Yn(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function zE(t,e){if(t.id in e)return e[t.id];try{let i=await import(t.module);return e[t.id]=i,i}catch(i){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function _E(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function HE(t,e,i){let n=await Promise.all(t.map(async r=>{let o=e.routes[r.route.id];if(o){let a=await zE(o,i);return a.links?a.links():[]}return[]}));return FE(n.flat(1).filter(_E).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function q1(t,e,i,n,r,o){let a=(h,d)=>i[d]?h.route.id!==i[d].route.id:!0,c=(h,d)=>i[d].pathname!==h.pathname||i[d].route.path?.endsWith("*")&&i[d].params["*"]!==h.params["*"];return o==="assets"?e.filter((h,d)=>a(h,d)||c(h,d)):o==="data"?e.filter((h,d)=>{let p=n.routes[h.route.id];if(!p||!p.hasLoader)return!1;if(a(h,d)||c(h,d))return!0;if(h.route.shouldRevalidate){let y=h.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function UE(t,e,{includeHydrateFallback:i}={}){return qE(t.map(n=>{let r=e.routes[n.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),i&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o}).flat(1))}function qE(t){return[...new Set(t)]}function PE(t){let e={},i=Object.keys(t).sort();for(let n of i)e[n]=t[n];return e}function FE(t,e){let i=new Set;return new Set(e),t.reduce((n,r)=>{let o=JSON.stringify(PE(r));return i.has(o)||(i.add(o),n.push({key:o,link:r})),n},[])}function T2(){let t=N.useContext(_l);return Ag(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function VE(){let t=N.useContext(jh);return Ag(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Mg=N.createContext(void 0);Mg.displayName="FrameworkContext";function O2(){let t=N.useContext(Mg);return Ag(t,"You must render this element inside a <HydratedRouter> element"),t}function IE(t,e){let i=N.useContext(Mg),[n,r]=N.useState(!1),[o,a]=N.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:d,onMouseLeave:p,onTouchStart:y}=e,b=N.useRef(null);N.useEffect(()=>{if(t==="render"&&a(!0),t==="viewport"){let C=M=>{M.forEach(O=>{a(O.isIntersecting)})},k=new IntersectionObserver(C,{threshold:.5});return b.current&&k.observe(b.current),()=>{k.disconnect()}}},[t]),N.useEffect(()=>{if(n){let C=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(C)}}},[n]);let x=()=>{r(!0)},w=()=>{r(!1),a(!1)};return i?t!=="intent"?[o,b,{}]:[o,b,{onFocus:qo(c,x),onBlur:qo(h,w),onMouseEnter:qo(d,x),onMouseLeave:qo(p,w),onTouchStart:qo(y,x)}]:[!1,b,{}]}function qo(t,e){return i=>{t&&t(i),i.defaultPrevented||e(i)}}function QE({page:t,...e}){let{router:i}=T2(),n=N.useMemo(()=>d2(i.routes,t,i.basename),[i.routes,t,i.basename]);return n?N.createElement(GE,{page:t,matches:n,...e}):null}function YE(t){let{manifest:e,routeModules:i}=O2(),[n,r]=N.useState([]);return N.useEffect(()=>{let o=!1;return HE(t,e,i).then(a=>{o||r(a)}),()=>{o=!0}},[t,e,i]),n}function GE({page:t,matches:e,...i}){let n=Zn(),{future:r,manifest:o,routeModules:a}=O2(),{basename:c}=T2(),{loaderData:h,matches:d}=VE(),p=N.useMemo(()=>q1(t,e,d,o,n,"data"),[t,e,d,o,n]),y=N.useMemo(()=>q1(t,e,d,o,n,"assets"),[t,e,d,o,n]),b=N.useMemo(()=>{if(t===n.pathname+n.search+n.hash)return[];let C=new Set,k=!1;if(e.forEach(O=>{let D=o.routes[O.route.id];!D||!D.hasLoader||(!p.some(V=>V.route.id===O.route.id)&&O.route.id in h&&a[O.route.id]?.shouldRevalidate||D.hasClientLoader?k=!0:C.add(O.route.id))}),C.size===0)return[];let M=BE(t,c,r.unstable_trailingSlashAwareDataRequests,"data");return k&&C.size>0&&M.searchParams.set("_routes",e.filter(O=>C.has(O.route.id)).map(O=>O.route.id).join(",")),[M.pathname+M.search]},[c,r.unstable_trailingSlashAwareDataRequests,h,n,o,p,e,t,a]),x=N.useMemo(()=>UE(y,o),[y,o]),w=YE(y);return N.createElement(N.Fragment,null,b.map(C=>N.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...i})),x.map(C=>N.createElement("link",{key:C,rel:"modulepreload",href:C,...i})),w.map(({key:C,link:k})=>N.createElement("link",{key:C,nonce:i.nonce,...k,crossOrigin:k.crossOrigin??i.crossOrigin})))}function KE(...t){return e=>{t.forEach(i=>{typeof i=="function"?i(e):i!=null&&(i.current=e)})}}var WE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{WE&&(window.__reactRouterVersion="7.13.1")}catch{}function XE({basename:t,children:e,unstable_useTransitions:i,window:n}){let r=N.useRef();r.current==null&&(r.current=MO({window:n,v5Compat:!0}));let o=r.current,[a,c]=N.useState({action:o.action,location:o.location}),h=N.useCallback(d=>{i===!1?c(d):N.startTransition(()=>c(d))},[i]);return N.useLayoutEffect(()=>o.listen(h),[o,h]),N.createElement(AE,{basename:t,children:e,location:a.location,navigationType:a.action,navigator:o,unstable_useTransitions:i})}var E2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,N2=N.forwardRef(function({onClick:e,discover:i="render",prefetch:n="none",relative:r,reloadDocument:o,replace:a,unstable_mask:c,state:h,target:d,to:p,preventScrollReset:y,viewTransition:b,unstable_defaultShouldRevalidate:x,...w},C){let{basename:k,navigator:M,unstable_useTransitions:O}=N.useContext(Ti),D=typeof p=="string"&&E2.test(p),V=y2(p,k);p=V.to;let H=lE(p,{relative:r}),Y=Zn(),U=null;if(c){let de=Dh(c,[],Y.unstable_mask?Y.unstable_mask.pathname:"/",!0);k!=="/"&&(de.pathname=de.pathname==="/"?k:bn([k,de.pathname])),U=M.createHref(de)}let[J,Z,ce]=IE(n,w),oe=e3(p,{replace:a,unstable_mask:c,state:h,target:d,preventScrollReset:y,relative:r,viewTransition:b,unstable_defaultShouldRevalidate:x,unstable_useTransitions:O});function q(de){e&&e(de),de.defaultPrevented||oe(de)}let ee=!(V.isExternal||o),fe=N.createElement("a",{...w,...ce,href:(ee?U:void 0)||V.absoluteURL||H,onClick:ee?q:e,ref:KE(C,Z),target:d,"data-discover":!D&&i==="render"?"true":void 0});return J&&!D?N.createElement(N.Fragment,null,fe,N.createElement(QE,{page:H})):fe});N2.displayName="Link";var ZE=N.forwardRef(function({"aria-current":e="page",caseSensitive:i=!1,className:n="",end:r=!1,style:o,to:a,viewTransition:c,children:h,...d},p){let y=ja(a,{relative:d.relative}),b=Zn(),x=N.useContext(jh),{navigator:w,basename:C}=N.useContext(Ti),k=x!=null&&s3(y)&&c===!0,M=w.encodeLocation?w.encodeLocation(y).pathname:y.pathname,O=b.pathname,D=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(O=O.toLowerCase(),D=D?D.toLowerCase():null,M=M.toLowerCase()),D&&C&&(D=Yn(D,C)||D);const V=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let H=O===M||!r&&O.startsWith(M)&&O.charAt(V)==="/",Y=D!=null&&(D===M||!r&&D.startsWith(M)&&D.charAt(M.length)==="/"),U={isActive:H,isPending:Y,isTransitioning:k},J=H?e:void 0,Z;typeof n=="function"?Z=n(U):Z=[n,H?"active":null,Y?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let ce=typeof o=="function"?o(U):o;return N.createElement(N2,{...d,"aria-current":J,className:Z,ref:p,style:ce,to:a,viewTransition:c},typeof h=="function"?h(U):h)});ZE.displayName="NavLink";var JE=N.forwardRef(({discover:t="render",fetcherKey:e,navigate:i,reloadDocument:n,replace:r,state:o,method:a=Lc,action:c,onSubmit:h,relative:d,preventScrollReset:p,viewTransition:y,unstable_defaultShouldRevalidate:b,...x},w)=>{let{unstable_useTransitions:C}=N.useContext(Ti),k=n3(),M=r3(c,{relative:d}),O=a.toLowerCase()==="get"?"get":"post",D=typeof c=="string"&&E2.test(c),V=H=>{if(h&&h(H),H.defaultPrevented)return;H.preventDefault();let Y=H.nativeEvent.submitter,U=Y?.getAttribute("formmethod")||a,J=()=>k(Y||H.currentTarget,{fetcherKey:e,method:U,navigate:i,replace:r,state:o,relative:d,preventScrollReset:p,viewTransition:y,unstable_defaultShouldRevalidate:b});C&&i!==!1?N.startTransition(()=>J()):J()};return N.createElement("form",{ref:w,method:O,action:M,onSubmit:n?h:V,...x,"data-discover":!D&&t==="render"?"true":void 0})});JE.displayName="Form";function $E(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function R2(t){let e=N.useContext(_l);return rt(e,$E(t)),e}function e3(t,{target:e,replace:i,unstable_mask:n,state:r,preventScrollReset:o,relative:a,viewTransition:c,unstable_defaultShouldRevalidate:h,unstable_useTransitions:d}={}){let p=C2(),y=Zn(),b=ja(t,{relative:a});return N.useCallback(x=>{if(RE(x,e)){x.preventDefault();let w=i!==void 0?i:oa(y)===oa(b),C=()=>p(t,{replace:w,unstable_mask:n,state:r,preventScrollReset:o,relative:a,viewTransition:c,unstable_defaultShouldRevalidate:h});d?N.startTransition(()=>C()):C()}},[y,p,b,i,n,r,e,t,o,a,c,h,d])}var t3=0,i3=()=>`__${String(++t3)}__`;function n3(){let{router:t}=R2("useSubmit"),{basename:e}=N.useContext(Ti),i=xE(),n=t.fetch,r=t.navigate;return N.useCallback(async(o,a={})=>{let{action:c,method:h,encType:d,formData:p,body:y}=LE(o,e);if(a.navigate===!1){let b=a.fetcherKey||i3();await n(b,i,a.action||c,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:y,formMethod:a.method||h,formEncType:a.encType||d,flushSync:a.flushSync})}else await r(a.action||c,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:y,formMethod:a.method||h,formEncType:a.encType||d,replace:a.replace,state:a.state,fromRouteId:i,flushSync:a.flushSync,viewTransition:a.viewTransition})},[n,r,e,i])}function r3(t,{relative:e}={}){let{basename:i}=N.useContext(Ti),n=N.useContext(en);rt(n,"useFormAction must be used inside a RouteContext");let[r]=n.matches.slice(-1),o={...ja(t||".",{relative:e})},a=Zn();if(t==null){o.search=a.search;let c=new URLSearchParams(o.search),h=c.getAll("index");if(h.some(p=>p==="")){c.delete("index"),h.filter(y=>y).forEach(y=>c.append("index",y));let p=c.toString();o.search=p?`?${p}`:""}}return(!t||t===".")&&r.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(o.pathname=o.pathname==="/"?i:bn([i,o.pathname])),oa(o)}function s3(t,{relative:e}={}){let i=N.useContext(x2);rt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=R2("useViewTransitionState"),r=ja(t,{relative:e});if(!i.isTransitioning)return!1;let o=Yn(i.currentLocation.pathname,n)||i.currentLocation.pathname,a=Yn(i.nextLocation.pathname,n)||i.nextLocation.pathname;return Qc(r.pathname,a)!=null||Qc(r.pathname,o)!=null}var Ul=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},l3={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},o3=class{#e=l3;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},fs=new o3;function a3(t){setTimeout(t,0)}var xs=typeof window>"u"||"Deno"in globalThis;function Kt(){}function u3(t,e){return typeof t=="function"?t(e):t}function hm(t){return typeof t=="number"&&t>=0&&t!==1/0}function D2(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Nr(t,e){return typeof t=="function"?t(e):t}function Hi(t,e){return typeof t=="function"?t(e):t}function P1(t,e){const{type:i="all",exact:n,fetchStatus:r,predicate:o,queryKey:a,stale:c}=t;if(a){if(n){if(e.queryHash!==Tg(a,e.options))return!1}else if(!aa(e.queryKey,a))return!1}if(i!=="all"){const h=e.isActive();if(i==="active"&&!h||i==="inactive"&&h)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||r&&r!==e.state.fetchStatus||o&&!o(e))}function F1(t,e){const{exact:i,status:n,predicate:r,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(i){if(vs(e.options.mutationKey)!==vs(o))return!1}else if(!aa(e.options.mutationKey,o))return!1}return!(n&&e.state.status!==n||r&&!r(e))}function Tg(t,e){return(e?.queryKeyHashFn||vs)(t)}function vs(t){return JSON.stringify(t,(e,i)=>fm(i)?Object.keys(i).sort().reduce((n,r)=>(n[r]=i[r],n),{}):i)}function aa(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(i=>aa(t[i],e[i])):!1}var c3=Object.prototype.hasOwnProperty;function j2(t,e,i=0){if(t===e)return t;if(i>500)return e;const n=V1(t)&&V1(e);if(!n&&!(fm(t)&&fm(e)))return e;const o=(n?t:Object.keys(t)).length,a=n?e:Object.keys(e),c=a.length,h=n?new Array(c):{};let d=0;for(let p=0;p<c;p++){const y=n?p:a[p],b=t[y],x=e[y];if(b===x){h[y]=b,(n?p<o:c3.call(t,y))&&d++;continue}if(b===null||x===null||typeof b!="object"||typeof x!="object"){h[y]=x;continue}const w=j2(b,x,i+1);h[y]=w,w===b&&d++}return o===c&&d===o?t:h}function Yc(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(t[i]!==e[i])return!1;return!0}function V1(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function fm(t){if(!I1(t))return!1;const e=t.constructor;if(e===void 0)return!0;const i=e.prototype;return!(!I1(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function I1(t){return Object.prototype.toString.call(t)==="[object Object]"}function h3(t){return new Promise(e=>{fs.setTimeout(e,t)})}function dm(t,e,i){return typeof i.structuralSharing=="function"?i.structuralSharing(t,e):i.structuralSharing!==!1?j2(t,e):e}function f3(t,e,i=0){const n=[...t,e];return i&&n.length>i?n.slice(1):n}function d3(t,e,i=0){const n=[e,...t];return i&&n.length>i?n.slice(0,-1):n}var Og=Symbol();function L2(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===Og?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Eg(t,e){return typeof t=="function"?t(...e):!!t}function p3(t,e,i){let n=!1,r;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??=e(),n||(n=!0,r.aborted?i():r.addEventListener("abort",i,{once:!0})),r)}),t}var m3=class extends Ul{#e;#t;#i;constructor(){super(),this.#i=t=>{if(!xs&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#i=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Ng=new m3;function pm(){let t,e;const i=new Promise((r,o)=>{t=r,e=o});i.status="pending",i.catch(()=>{});function n(r){Object.assign(i,r),delete i.resolve,delete i.reject}return i.resolve=r=>{n({status:"fulfilled",value:r}),t(r)},i.reject=r=>{n({status:"rejected",reason:r}),e(r)},i}var g3=a3;function y3(){let t=[],e=0,i=c=>{c()},n=c=>{c()},r=g3;const o=c=>{e?t.push(c):r(()=>{i(c)})},a=()=>{const c=t;t=[],c.length&&r(()=>{n(()=>{c.forEach(h=>{i(h)})})})};return{batch:c=>{let h;e++;try{h=c()}finally{e--,e||a()}return h},batchCalls:c=>(...h)=>{o(()=>{c(...h)})},schedule:o,setNotifyFunction:c=>{i=c},setBatchNotifyFunction:c=>{n=c},setScheduler:c=>{r=c}}}var Ct=y3(),b3=class extends Ul{#e=!0;#t;#i;constructor(){super(),this.#i=t=>{if(!xs&&window.addEventListener){const e=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",i)}}}}onSubscribe(){this.#t||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#i=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(i=>{i(t)}))}isOnline(){return this.#e}},Gc=new b3;function x3(t){return Math.min(1e3*2**t,3e4)}function B2(t){return(t??"online")==="online"?Gc.isOnline():!0}var mm=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function z2(t){let e=!1,i=0,n;const r=pm(),o=()=>r.status!=="pending",a=C=>{if(!o()){const k=new mm(C);b(k),t.onCancel?.(k)}},c=()=>{e=!0},h=()=>{e=!1},d=()=>Ng.isFocused()&&(t.networkMode==="always"||Gc.isOnline())&&t.canRun(),p=()=>B2(t.networkMode)&&t.canRun(),y=C=>{o()||(n?.(),r.resolve(C))},b=C=>{o()||(n?.(),r.reject(C))},x=()=>new Promise(C=>{n=k=>{(o()||d())&&C(k)},t.onPause?.()}).then(()=>{n=void 0,o()||t.onContinue?.()}),w=()=>{if(o())return;let C;const k=i===0?t.initialPromise:void 0;try{C=k??t.fn()}catch(M){C=Promise.reject(M)}Promise.resolve(C).then(y).catch(M=>{if(o())return;const O=t.retry??(xs?0:3),D=t.retryDelay??x3,V=typeof D=="function"?D(i,M):D,H=O===!0||typeof O=="number"&&i<O||typeof O=="function"&&O(i,M);if(e||!H){b(M);return}i++,t.onFail?.(i,M),h3(V).then(()=>d()?void 0:x()).then(()=>{e?b(M):w()})})};return{promise:r,status:()=>r.status,cancel:a,continue:()=>(n?.(),r),cancelRetry:c,continueRetry:h,canStart:p,start:()=>(p()?w():x().then(w),r)}}var _2=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),hm(this.gcTime)&&(this.#e=fs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(xs?1/0:300*1e3))}clearGcTimeout(){this.#e&&(fs.clearTimeout(this.#e),this.#e=void 0)}},v3=class extends _2{#e;#t;#i;#r;#n;#l;#o;constructor(t){super(),this.#o=!1,this.#l=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#r=t.client,this.#i=this.#r.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#e=Y1(this.options),this.state=t.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(t){if(this.options={...this.#l,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=Y1(this.options);e.data!==void 0&&(this.setState(Q1(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(t,e){const i=dm(this.state.data,t,this.options);return this.#s({data:i,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),i}setState(t,e){this.#s({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#n?.promise;return this.#n?.cancel(t),e?e.then(Kt).catch(Kt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>Hi(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Og||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Nr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!D2(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#n&&(this.#o?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){const c=this.observers.find(h=>h.options.queryFn);c&&this.setOptions(c.options)}const i=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(this.#o=!0,i.signal)})},r=()=>{const c=L2(this.options,e),d=(()=>{const p={client:this.#r,queryKey:this.queryKey,meta:this.meta};return n(p),p})();return this.#o=!1,this.options.persister?this.options.persister(c,d,this):c(d)},a=(()=>{const c={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:r};return n(c),c})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:"fetch",meta:a.fetchOptions?.meta}),this.#n=z2({initialPromise:e?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof mm&&c.revert&&this.setState({...this.#t,fetchStatus:"idle"}),i.abort()},onFail:(c,h)=>{this.#s({type:"failed",failureCount:c,error:h})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const c=await this.#n.start();if(c===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(c),this.#i.config.onSuccess?.(c,this),this.#i.config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof mm){if(c.silent)return this.#n.promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw this.#s({type:"error",error:c}),this.#i.config.onError?.(c,this),this.#i.config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc()}}#s(t){const e=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...H2(i.data,this.options),fetchMeta:t.meta??null};case"success":const n={...i,...Q1(t.data,t.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=t.manual?n:void 0,n;case"error":const r=t.error;return{...i,error:r,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=e(this.state),Ct.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:t})})}};function H2(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:B2(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Q1(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Y1(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,i=e!==void 0,n=i?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:i?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var S3=class extends Ul{constructor(t,e){super(),this.options=e,this.#e=t,this.#s=null,this.#o=pm(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#i=void 0;#r=void 0;#n;#l;#o;#s;#m;#f;#d;#u;#c;#a;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),G1(this.#t,this.options)?this.#h():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return gm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return gm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#S(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,i=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Hi(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#t.setOptions(this.options),e._defaulted&&!Yc(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const n=this.hasListeners();n&&K1(this.#t,i,this.options,e)&&this.#h(),this.updateResult(),n&&(this.#t!==i||Hi(this.options.enabled,this.#t)!==Hi(e.enabled,this.#t)||Nr(this.options.staleTime,this.#t)!==Nr(e.staleTime,this.#t))&&this.#g();const r=this.#y();n&&(this.#t!==i||Hi(this.options.enabled,this.#t)!==Hi(e.enabled,this.#t)||r!==this.#a)&&this.#b(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),i=this.createResult(e,t);return C3(this,i)&&(this.#r=i,this.#l=this.options,this.#n=this.#t.state),i}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:(i,n)=>(this.trackProp(n),e?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,n))})}trackProp(t){this.#p.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),i=this.#e.getQueryCache().build(this.#e,e);return i.fetch().then(()=>this.createResult(i,e))}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(t){this.#w();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Kt)),e}#g(){this.#v();const t=Nr(this.options.staleTime,this.#t);if(xs||this.#r.isStale||!hm(t))return;const i=D2(this.#r.dataUpdatedAt,t)+1;this.#u=fs.setTimeout(()=>{this.#r.isStale||this.updateResult()},i)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#b(t){this.#S(),this.#a=t,!(xs||Hi(this.options.enabled,this.#t)===!1||!hm(this.#a)||this.#a===0)&&(this.#c=fs.setInterval(()=>{(this.options.refetchIntervalInBackground||Ng.isFocused())&&this.#h()},this.#a))}#x(){this.#g(),this.#b(this.#y())}#v(){this.#u&&(fs.clearTimeout(this.#u),this.#u=void 0)}#S(){this.#c&&(fs.clearInterval(this.#c),this.#c=void 0)}createResult(t,e){const i=this.#t,n=this.options,r=this.#r,o=this.#n,a=this.#l,h=t!==i?t.state:this.#i,{state:d}=t;let p={...d},y=!1,b;if(e._optimisticResults){const J=this.hasListeners(),Z=!J&&G1(t,e),ce=J&&K1(t,i,e,n);(Z||ce)&&(p={...p,...H2(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:x,errorUpdatedAt:w,status:C}=p;b=p.data;let k=!1;if(e.placeholderData!==void 0&&b===void 0&&C==="pending"){let J;r?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(J=r.data,k=!0):J=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,J!==void 0&&(C="success",b=dm(r?.data,J,e),y=!0)}if(e.select&&b!==void 0&&!k)if(r&&b===o?.data&&e.select===this.#m)b=this.#f;else try{this.#m=e.select,b=e.select(b),b=dm(r?.data,b,e),this.#f=b,this.#s=null}catch(J){this.#s=J}this.#s&&(x=this.#s,b=this.#f,w=Date.now(),C="error");const M=p.fetchStatus==="fetching",O=C==="pending",D=C==="error",V=O&&M,H=b!==void 0,U={status:C,fetchStatus:p.fetchStatus,isPending:O,isSuccess:C==="success",isError:D,isInitialLoading:V,isLoading:V,data:b,dataUpdatedAt:p.dataUpdatedAt,error:x,errorUpdatedAt:w,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>h.dataUpdateCount||p.errorUpdateCount>h.errorUpdateCount,isFetching:M,isRefetching:M&&!O,isLoadingError:D&&!H,isPaused:p.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:D&&H,isStale:Rg(t,e),refetch:this.refetch,promise:this.#o,isEnabled:Hi(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const J=U.data!==void 0,Z=U.status==="error"&&!J,ce=ee=>{Z?ee.reject(U.error):J&&ee.resolve(U.data)},oe=()=>{const ee=this.#o=U.promise=pm();ce(ee)},q=this.#o;switch(q.status){case"pending":t.queryHash===i.queryHash&&ce(q);break;case"fulfilled":(Z||U.data!==q.value)&&oe();break;case"rejected":(!Z||U.error!==q.reason)&&oe();break}}return U}updateResult(){const t=this.#r,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#l=this.options,this.#n.data!==void 0&&(this.#d=this.#t),Yc(e,t))return;this.#r=e;const i=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,r=typeof n=="function"?n():n;if(r==="all"||!r&&!this.#p.size)return!0;const o=new Set(r??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#r).some(a=>{const c=a;return this.#r[c]!==t[c]&&o.has(c)})};this.#C({listeners:i()})}#w(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#i=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#C(t){Ct.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function w3(t,e){return Hi(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function G1(t,e){return w3(t,e)||t.state.data!==void 0&&gm(t,e,e.refetchOnMount)}function gm(t,e,i){if(Hi(e.enabled,t)!==!1&&Nr(e.staleTime,t)!=="static"){const n=typeof i=="function"?i(t):i;return n==="always"||n!==!1&&Rg(t,e)}return!1}function K1(t,e,i,n){return(t!==e||Hi(n.enabled,t)===!1)&&(!i.suspense||t.state.status!=="error")&&Rg(t,i)}function Rg(t,e){return Hi(e.enabled,t)!==!1&&t.isStaleByTime(Nr(e.staleTime,t))}function C3(t,e){return!Yc(t.getCurrentResult(),e)}function W1(t){return{onFetch:(e,i)=>{const n=e.options,r=e.fetchOptions?.meta?.fetchMore?.direction,o=e.state.data?.pages||[],a=e.state.data?.pageParams||[];let c={pages:[],pageParams:[]},h=0;const d=async()=>{let p=!1;const y=w=>{p3(w,()=>e.signal,()=>p=!0)},b=L2(e.options,e.fetchOptions),x=async(w,C,k)=>{if(p)return Promise.reject();if(C==null&&w.pages.length)return Promise.resolve(w);const O=(()=>{const Y={client:e.client,queryKey:e.queryKey,pageParam:C,direction:k?"backward":"forward",meta:e.options.meta};return y(Y),Y})(),D=await b(O),{maxPages:V}=e.options,H=k?d3:f3;return{pages:H(w.pages,D,V),pageParams:H(w.pageParams,C,V)}};if(r&&o.length){const w=r==="backward",C=w?k3:X1,k={pages:o,pageParams:a},M=C(n,k);c=await x(k,M,w)}else{const w=t??o.length;do{const C=h===0?a[0]??n.initialPageParam:X1(n,c);if(h>0&&C==null)break;c=await x(c,C),h++}while(h<w)}return c};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},i):e.fetchFn=d}}}function X1(t,{pages:e,pageParams:i}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,i[n],i):void 0}function k3(t,{pages:e,pageParams:i}){return e.length>0?t.getPreviousPageParam?.(e[0],e,i[0],i):void 0}var A3=class extends _2{#e;#t;#i;#r;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#i=t.mutationCache,this.#t=[],this.state=t.state||U2(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#i.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#i.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#n({type:"continue"})},i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=z2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(o,a)=>{this.#n({type:"failed",failureCount:o,error:a})},onPause:()=>{this.#n({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#i.canRun(this)});const n=this.state.status==="pending",r=!this.#r.canStart();try{if(n)e();else{this.#n({type:"pending",variables:t,isPaused:r}),this.#i.config.onMutate&&await this.#i.config.onMutate(t,this,i);const a=await this.options.onMutate?.(t,i);a!==this.state.context&&this.#n({type:"pending",context:a,variables:t,isPaused:r})}const o=await this.#r.start();return await this.#i.config.onSuccess?.(o,t,this.state.context,this,i),await this.options.onSuccess?.(o,t,this.state.context,i),await this.#i.config.onSettled?.(o,null,this.state.variables,this.state.context,this,i),await this.options.onSettled?.(o,null,t,this.state.context,i),this.#n({type:"success",data:o}),o}catch(o){try{await this.#i.config.onError?.(o,t,this.state.context,this,i)}catch(a){Promise.reject(a)}try{await this.options.onError?.(o,t,this.state.context,i)}catch(a){Promise.reject(a)}try{await this.#i.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,i)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,o,t,this.state.context,i)}catch(a){Promise.reject(a)}throw this.#n({type:"error",error:o}),o}finally{this.#i.runNext(this)}}#n(t){const e=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),Ct.batch(()=>{this.#t.forEach(i=>{i.onMutationUpdate(t)}),this.#i.notify({mutation:this,type:"updated",action:t})})}};function U2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var M3=class extends Ul{constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#i=0}#e;#t;#i;build(t,e,i){const n=new A3({client:t,mutationCache:this,mutationId:++this.#i,options:t.defaultMutationOptions(e),state:i});return this.add(n),n}add(t){this.#e.add(t);const e=ac(t);if(typeof e=="string"){const i=this.#t.get(e);i?i.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){const e=ac(t);if(typeof e=="string"){const i=this.#t.get(e);if(i)if(i.length>1){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}else i[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=ac(t);if(typeof e=="string"){const n=this.#t.get(e)?.find(r=>r.state.status==="pending");return!n||n===t}else return!0}runNext(t){const e=ac(t);return typeof e=="string"?this.#t.get(e)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ct.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){const e={exact:!0,...t};return this.getAll().find(i=>F1(e,i))}findAll(t={}){return this.getAll().filter(e=>F1(t,e))}notify(t){Ct.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return Ct.batch(()=>Promise.all(t.map(e=>e.continue().catch(Kt))))}};function ac(t){return t.options.scope?.id}var T3=class extends Ul{#e;#t=void 0;#i;#r;constructor(e,i){super(),this.#e=e,this.setOptions(i),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const i=this.options;this.options=this.#e.defaultMutationOptions(e),Yc(this.options,i)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#i,observer:this}),i?.mutationKey&&this.options.mutationKey&&vs(i.mutationKey)!==vs(this.options.mutationKey)?this.reset():this.#i?.state.status==="pending"&&this.#i.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#i?.removeObserver(this)}onMutationUpdate(e){this.#n(),this.#l(e)}getCurrentResult(){return this.#t}reset(){this.#i?.removeObserver(this),this.#i=void 0,this.#n(),this.#l()}mutate(e,i){return this.#r=i,this.#i?.removeObserver(this),this.#i=this.#e.getMutationCache().build(this.#e,this.options),this.#i.addObserver(this),this.#i.execute(e)}#n(){const e=this.#i?.state??U2();this.#t={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#l(e){Ct.batch(()=>{if(this.#r&&this.hasListeners()){const i=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#r.onSuccess?.(e.data,i,n,r)}catch(o){Promise.reject(o)}try{this.#r.onSettled?.(e.data,null,i,n,r)}catch(o){Promise.reject(o)}}else if(e?.type==="error"){try{this.#r.onError?.(e.error,i,n,r)}catch(o){Promise.reject(o)}try{this.#r.onSettled?.(void 0,e.error,i,n,r)}catch(o){Promise.reject(o)}}}this.listeners.forEach(i=>{i(this.#t)})})}},O3=class extends Ul{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,i){const n=e.queryKey,r=e.queryHash??Tg(n,e);let o=this.get(r);return o||(o=new v3({client:t,queryKey:n,queryHash:r,options:t.defaultQueryOptions(e),state:i,defaultOptions:t.getQueryDefaults(n)}),this.add(o)),o}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ct.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(i=>P1(e,i))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(i=>P1(t,i)):e}notify(t){Ct.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){Ct.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ct.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},E3=class{#e;#t;#i;#r;#n;#l;#o;#s;constructor(t={}){this.#e=t.queryCache||new O3,this.#t=t.mutationCache||new M3,this.#i=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#l=0}mount(){this.#l++,this.#l===1&&(this.#o=Ng.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Gc.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#l--,this.#l===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),i=this.#e.build(this,e),n=i.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&i.isStaleByTime(Nr(e.staleTime,i))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:i})=>{const n=i.data;return[e,n]})}setQueryData(t,e,i){const n=this.defaultQueryOptions({queryKey:t}),o=this.#e.get(n.queryHash)?.state.data,a=u3(e,o);if(a!==void 0)return this.#e.build(this,n).setData(a,{...i,manual:!0})}setQueriesData(t,e,i){return Ct.batch(()=>this.#e.findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,i)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){const e=this.#e;Ct.batch(()=>{e.findAll(t).forEach(i=>{e.remove(i)})})}resetQueries(t,e){const i=this.#e;return Ct.batch(()=>(i.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const i={revert:!0,...e},n=Ct.batch(()=>this.#e.findAll(t).map(r=>r.cancel(i)));return Promise.all(n).then(Kt).catch(Kt)}invalidateQueries(t,e={}){return Ct.batch(()=>(this.#e.findAll(t).forEach(i=>{i.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const i={...e,cancelRefetch:e.cancelRefetch??!0},n=Ct.batch(()=>this.#e.findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let o=r.fetch(void 0,i);return i.throwOnError||(o=o.catch(Kt)),r.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(Kt)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const i=this.#e.build(this,e);return i.isStaleByTime(Nr(e.staleTime,i))?i.fetch(e):Promise.resolve(i.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Kt).catch(Kt)}fetchInfiniteQuery(t){return t.behavior=W1(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Kt).catch(Kt)}ensureInfiniteQueryData(t){return t.behavior=W1(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Gc.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#i}setDefaultOptions(t){this.#i=t}setQueryDefaults(t,e){this.#r.set(vs(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],i={};return e.forEach(n=>{aa(t,n.queryKey)&&Object.assign(i,n.defaultOptions)}),i}setMutationDefaults(t,e){this.#n.set(vs(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#n.values()],i={};return e.forEach(n=>{aa(t,n.mutationKey)&&Object.assign(i,n.defaultOptions)}),i}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#i.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Tg(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Og&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#i.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},q2=N.createContext(void 0),pt=t=>{const e=N.useContext(q2);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},N3=({client:t,children:e})=>(N.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),S.jsx(q2.Provider,{value:t,children:e})),P2=N.createContext(!1),R3=()=>N.useContext(P2);P2.Provider;function D3(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var j3=N.createContext(D3()),L3=()=>N.useContext(j3),B3=(t,e,i)=>{const n=i?.state.error&&typeof t.throwOnError=="function"?Eg(t.throwOnError,[i.state.error,i]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||n)&&(e.isReset()||(t.retryOnMount=!1))},z3=t=>{N.useEffect(()=>{t.clearReset()},[t])},_3=({result:t,errorResetBoundary:e,throwOnError:i,query:n,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(r&&t.data===void 0||Eg(i,[t.error,n])),H3=t=>{if(t.suspense){const i=r=>r==="static"?r:Math.max(r??1e3,1e3),n=t.staleTime;t.staleTime=typeof n=="function"?(...r)=>i(n(...r)):i(n),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},U3=(t,e)=>t.isLoading&&t.isFetching&&!e,q3=(t,e)=>t?.suspense&&e.isPending,Z1=(t,e,i)=>e.fetchOptimistic(t).catch(()=>{i.clearReset()});function P3(t,e,i){const n=R3(),r=L3(),o=pt(),a=o.defaultQueryOptions(t);o.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const c=o.getQueryCache().get(a.queryHash);a._optimisticResults=n?"isRestoring":"optimistic",H3(a),B3(a,r,c),z3(r);const h=!o.getQueryCache().get(a.queryHash),[d]=N.useState(()=>new e(o,a)),p=d.getOptimisticResult(a),y=!n&&t.subscribed!==!1;if(N.useSyncExternalStore(N.useCallback(b=>{const x=y?d.subscribe(Ct.batchCalls(b)):Kt;return d.updateResult(),x},[d,y]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),N.useEffect(()=>{d.setOptions(a)},[a,d]),q3(a,p))throw Z1(a,d,r);if(_3({result:p,errorResetBoundary:r,throwOnError:a.throwOnError,query:c,suspense:a.suspense}))throw p.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(a,p),a.experimental_prefetchInRender&&!xs&&U3(p,n)&&(h?Z1(a,d,r):c?.promise)?.catch(Kt).finally(()=>{d.updateResult()}),a.notifyOnChangeProps?p:d.trackResult(p)}function jr(t,e){return P3(t,S3)}function Nt(t,e){const i=pt(),[n]=N.useState(()=>new T3(i,t));N.useEffect(()=>{n.setOptions(t)},[n,t]);const r=N.useSyncExternalStore(N.useCallback(a=>n.subscribe(Ct.batchCalls(a)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=N.useCallback((a,c)=>{n.mutate(a,c).catch(Kt)},[n]);if(r.error&&Eg(n.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:o,mutateAsync:r.mutate}}const F3="/api";async function Pe(t,e){const i=await fetch(`${F3}${t}`,{headers:{"Content-Type":"application/json",...e?.headers},...e}),n=await i.json();if(!i.ok)throw new Error(n.error??`Request failed: ${i.status}`);return n.data}const Fe={health:()=>Pe("/health"),projects:{list:()=>Pe("/projects"),create:t=>Pe("/projects",{method:"POST",body:JSON.stringify({name:t})}),getActive:()=>Pe("/projects/active"),switchActive:t=>Pe("/projects/active",{method:"PUT",body:JSON.stringify({projectId:t})}),rename:(t,e)=>Pe(`/projects/${t}`,{method:"PUT",body:JSON.stringify({name:e})}),delete:t=>Pe(`/projects/${t}`,{method:"DELETE"})},specs:{list:()=>Pe("/specs"),upload:(t,e,i)=>Pe("/specs",{method:"POST",body:JSON.stringify({spec:t,name:e,upstreamUrl:i})}),uploadFromUrl:(t,e)=>Pe("/specs/url",{method:"POST",body:JSON.stringify({url:t,name:e})}),update:(t,e)=>Pe(`/specs/${t}`,{method:"PUT",body:JSON.stringify(e)}),toggle:t=>Pe(`/specs/${t}/toggle`,{method:"PUT"}),delete:t=>Pe(`/specs/${t}`,{method:"DELETE"}),reimport:(t,e)=>Pe(`/specs/${t}/reimport`,{method:"POST",body:e?JSON.stringify({spec:e}):"{}"})},endpoints:{list:()=>Pe("/endpoints"),update:(t,e)=>Pe(`/endpoints/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(e)}),bulkUpdate:t=>Pe("/endpoints/bulk",{method:"PUT",body:JSON.stringify(t)})},config:{get:()=>Pe("/config"),update:t=>Pe("/config",{method:"PUT",body:JSON.stringify(t)}),export:()=>Pe("/config/export"),import:t=>Pe("/config/import",{method:"POST",body:JSON.stringify(t)})},logs:{get:(t=100)=>Pe(`/logs?limit=${t}`),clear:()=>Pe("/logs",{method:"DELETE"})},proxy:{status:()=>Pe("/proxy/status"),start:()=>Pe("/proxy/start",{method:"POST"}),stop:()=>Pe("/proxy/stop",{method:"POST"})},presets:{list:()=>Pe("/presets"),create:t=>Pe("/presets",{method:"POST",body:JSON.stringify(t)}),delete:t=>Pe(`/presets/${encodeURIComponent(t)}`,{method:"DELETE"}),apply:t=>Pe(`/presets/${encodeURIComponent(t)}/apply`,{method:"POST"})}};function V3(){return jr({queryKey:["proxyStatus"],queryFn:Fe.proxy.status,refetchInterval:5e3})}function I3(){const t=pt();return Nt({mutationFn:Fe.proxy.start,onSuccess:()=>{t.invalidateQueries({queryKey:["proxyStatus"]})}})}function Q3(){const t=pt();return Nt({mutationFn:Fe.proxy.stop,onSuccess:()=>{t.invalidateQueries({queryKey:["proxyStatus"]})}})}const Y3=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F2=(...t)=>t.filter((e,i,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===i).join(" ").trim();var G3={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const K3=N.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:i=2,absoluteStrokeWidth:n,className:r="",children:o,iconNode:a,...c},h)=>N.createElement("svg",{ref:h,...G3,width:e,height:e,stroke:t,strokeWidth:n?Number(i)*24/Number(e):i,className:F2("lucide",r),...c},[...a.map(([d,p])=>N.createElement(d,p)),...Array.isArray(o)?o:[o]]));const Me=(t,e)=>{const i=N.forwardRef(({className:n,...r},o)=>N.createElement(K3,{ref:o,iconNode:e,className:F2(`lucide-${Y3(t)}`,n),...r}));return i.displayName=`${t}`,i};const ym=Me("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);const bm=Me("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Kc=Me("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const Wc=Me("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const La=Me("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const V2=Me("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Ol=Me("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const W3=Me("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const X3=Me("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const xm=Me("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const Z3=Me("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);const J3=Me("FileJson",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);const $3=Me("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const eN=Me("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const I2=Me("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const Xc=Me("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const Q2=Me("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const Zc=Me("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);const tN=Me("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);const iN=Me("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const Jc=Me("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const nN=Me("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const rN=Me("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const Y2=Me("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const sN=Me("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);const lN=Me("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);const oN=Me("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const aN=Me("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const uN=Me("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const cN=Me("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);const hN=Me("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);const fN=Me("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const G2=Me("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const dN=Me("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const ua=Me("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const pN=Me("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const K2=Me("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const mN=Me("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const gN=Me("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);const ca=Me("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Dg=Me("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function W2(t){var e,i,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(i=W2(t[e]))&&(n&&(n+=" "),n+=i)}else for(i in t)t[i]&&(n&&(n+=" "),n+=i);return n}function yN(){for(var t,e,i=0,n="",r=arguments.length;i<r;i++)(t=arguments[i])&&(e=W2(t))&&(n&&(n+=" "),n+=e);return n}const jg="-",bN=t=>{const e=vN(t),{conflictingClassGroups:i,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{const c=a.split(jg);return c[0]===""&&c.length!==1&&c.shift(),X2(c,e)||xN(a)},getConflictingClassGroupIds:(a,c)=>{const h=i[a]||[];return c&&n[a]?[...h,...n[a]]:h}}},X2=(t,e)=>{if(t.length===0)return e.classGroupId;const i=t[0],n=e.nextPart.get(i),r=n?X2(t.slice(1),n):void 0;if(r)return r;if(e.validators.length===0)return;const o=t.join(jg);return e.validators.find(({validator:a})=>a(o))?.classGroupId},J1=/^\[(.+)\]$/,xN=t=>{if(J1.test(t)){const e=J1.exec(t)[1],i=e?.substring(0,e.indexOf(":"));if(i)return"arbitrary.."+i}},vN=t=>{const{theme:e,prefix:i}=t,n={nextPart:new Map,validators:[]};return wN(Object.entries(t.classGroups),i).forEach(([o,a])=>{vm(a,n,o,e)}),n},vm=(t,e,i,n)=>{t.forEach(r=>{if(typeof r=="string"){const o=r===""?e:$1(e,r);o.classGroupId=i;return}if(typeof r=="function"){if(SN(r)){vm(r(n),e,i,n);return}e.validators.push({validator:r,classGroupId:i});return}Object.entries(r).forEach(([o,a])=>{vm(a,$1(e,o),i,n)})})},$1=(t,e)=>{let i=t;return e.split(jg).forEach(n=>{i.nextPart.has(n)||i.nextPart.set(n,{nextPart:new Map,validators:[]}),i=i.nextPart.get(n)}),i},SN=t=>t.isThemeGetter,wN=(t,e)=>e?t.map(([i,n])=>{const r=n.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([a,c])=>[e+a,c])):o);return[i,r]}):t,CN=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,i=new Map,n=new Map;const r=(o,a)=>{i.set(o,a),e++,e>t&&(e=0,n=i,i=new Map)};return{get(o){let a=i.get(o);if(a!==void 0)return a;if((a=n.get(o))!==void 0)return r(o,a),a},set(o,a){i.has(o)?i.set(o,a):r(o,a)}}},Z2="!",kN=t=>{const{separator:e,experimentalParseClassName:i}=t,n=e.length===1,r=e[0],o=e.length,a=c=>{const h=[];let d=0,p=0,y;for(let k=0;k<c.length;k++){let M=c[k];if(d===0){if(M===r&&(n||c.slice(k,k+o)===e)){h.push(c.slice(p,k)),p=k+o;continue}if(M==="/"){y=k;continue}}M==="["?d++:M==="]"&&d--}const b=h.length===0?c:c.substring(p),x=b.startsWith(Z2),w=x?b.substring(1):b,C=y&&y>p?y-p:void 0;return{modifiers:h,hasImportantModifier:x,baseClassName:w,maybePostfixModifierPosition:C}};return i?c=>i({className:c,parseClassName:a}):a},AN=t=>{if(t.length<=1)return t;const e=[];let i=[];return t.forEach(n=>{n[0]==="["?(e.push(...i.sort(),n),i=[]):i.push(n)}),e.push(...i.sort()),e},MN=t=>({cache:CN(t.cacheSize),parseClassName:kN(t),...bN(t)}),TN=/\s+/,ON=(t,e)=>{const{parseClassName:i,getClassGroupId:n,getConflictingClassGroupIds:r}=e,o=[],a=t.trim().split(TN);let c="";for(let h=a.length-1;h>=0;h-=1){const d=a[h],{modifiers:p,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:x}=i(d);let w=!!x,C=n(w?b.substring(0,x):b);if(!C){if(!w){c=d+(c.length>0?" "+c:c);continue}if(C=n(b),!C){c=d+(c.length>0?" "+c:c);continue}w=!1}const k=AN(p).join(":"),M=y?k+Z2:k,O=M+C;if(o.includes(O))continue;o.push(O);const D=r(C,w);for(let V=0;V<D.length;++V){const H=D[V];o.push(M+H)}c=d+(c.length>0?" "+c:c)}return c};function EN(){let t=0,e,i,n="";for(;t<arguments.length;)(e=arguments[t++])&&(i=J2(e))&&(n&&(n+=" "),n+=i);return n}const J2=t=>{if(typeof t=="string")return t;let e,i="";for(let n=0;n<t.length;n++)t[n]&&(e=J2(t[n]))&&(i&&(i+=" "),i+=e);return i};function NN(t,...e){let i,n,r,o=a;function a(h){const d=e.reduce((p,y)=>y(p),t());return i=MN(d),n=i.cache.get,r=i.cache.set,o=c,c(h)}function c(h){const d=n(h);if(d)return d;const p=ON(h,i);return r(h,p),p}return function(){return o(EN.apply(null,arguments))}}const tt=t=>{const e=i=>i[t]||[];return e.isThemeGetter=!0,e},$2=/^\[(?:([a-z-]+):)?(.+)\]$/i,RN=/^\d+\/\d+$/,DN=new Set(["px","full","screen"]),jN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,LN=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,BN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_N=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fn=t=>vl(t)||DN.has(t)||RN.test(t),Cr=t=>ql(t,"length",QN),vl=t=>!!t&&!Number.isNaN(Number(t)),Mp=t=>ql(t,"number",vl),Po=t=>!!t&&Number.isInteger(Number(t)),HN=t=>t.endsWith("%")&&vl(t.slice(0,-1)),Ae=t=>$2.test(t),kr=t=>jN.test(t),UN=new Set(["length","size","percentage"]),qN=t=>ql(t,UN,ew),PN=t=>ql(t,"position",ew),FN=new Set(["image","url"]),VN=t=>ql(t,FN,GN),IN=t=>ql(t,"",YN),Fo=()=>!0,ql=(t,e,i)=>{const n=$2.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):i(n[2]):!1},QN=t=>LN.test(t)&&!BN.test(t),ew=()=>!1,YN=t=>zN.test(t),GN=t=>_N.test(t),KN=()=>{const t=tt("colors"),e=tt("spacing"),i=tt("blur"),n=tt("brightness"),r=tt("borderColor"),o=tt("borderRadius"),a=tt("borderSpacing"),c=tt("borderWidth"),h=tt("contrast"),d=tt("grayscale"),p=tt("hueRotate"),y=tt("invert"),b=tt("gap"),x=tt("gradientColorStops"),w=tt("gradientColorStopPositions"),C=tt("inset"),k=tt("margin"),M=tt("opacity"),O=tt("padding"),D=tt("saturate"),V=tt("scale"),H=tt("sepia"),Y=tt("skew"),U=tt("space"),J=tt("translate"),Z=()=>["auto","contain","none"],ce=()=>["auto","hidden","clip","visible","scroll"],oe=()=>["auto",Ae,e],q=()=>[Ae,e],ee=()=>["",Fn,Cr],fe=()=>["auto",vl,Ae],de=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],_=()=>["solid","dashed","dotted","double","none"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>["start","end","center","between","around","evenly","stretch"],ue=()=>["","0",Ae],ye=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>[vl,Ae];return{cacheSize:500,separator:":",theme:{colors:[Fo],spacing:[Fn,Cr],blur:["none","",kr,Ae],brightness:E(),borderColor:[t],borderRadius:["none","","full",kr,Ae],borderSpacing:q(),borderWidth:ee(),contrast:E(),grayscale:ue(),hueRotate:E(),invert:ue(),gap:q(),gradientColorStops:[t],gradientColorStopPositions:[HN,Cr],inset:oe(),margin:oe(),opacity:E(),padding:q(),saturate:E(),scale:E(),sepia:ue(),skew:E(),space:q(),translate:q()},classGroups:{aspect:[{aspect:["auto","square","video",Ae]}],container:["container"],columns:[{columns:[kr]}],"break-after":[{"break-after":ye()}],"break-before":[{"break-before":ye()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...de(),Ae]}],overflow:[{overflow:ce()}],"overflow-x":[{"overflow-x":ce()}],"overflow-y":[{"overflow-y":ce()}],overscroll:[{overscroll:Z()}],"overscroll-x":[{"overscroll-x":Z()}],"overscroll-y":[{"overscroll-y":Z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[C]}],"inset-x":[{"inset-x":[C]}],"inset-y":[{"inset-y":[C]}],start:[{start:[C]}],end:[{end:[C]}],top:[{top:[C]}],right:[{right:[C]}],bottom:[{bottom:[C]}],left:[{left:[C]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Po,Ae]}],basis:[{basis:oe()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ae]}],grow:[{grow:ue()}],shrink:[{shrink:ue()}],order:[{order:["first","last","none",Po,Ae]}],"grid-cols":[{"grid-cols":[Fo]}],"col-start-end":[{col:["auto",{span:["full",Po,Ae]},Ae]}],"col-start":[{"col-start":fe()}],"col-end":[{"col-end":fe()}],"grid-rows":[{"grid-rows":[Fo]}],"row-start-end":[{row:["auto",{span:[Po,Ae]},Ae]}],"row-start":[{"row-start":fe()}],"row-end":[{"row-end":fe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ae]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ae]}],gap:[{gap:[b]}],"gap-x":[{"gap-x":[b]}],"gap-y":[{"gap-y":[b]}],"justify-content":[{justify:["normal",...ne()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ne(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ne(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[O]}],px:[{px:[O]}],py:[{py:[O]}],ps:[{ps:[O]}],pe:[{pe:[O]}],pt:[{pt:[O]}],pr:[{pr:[O]}],pb:[{pb:[O]}],pl:[{pl:[O]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[U]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[U]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ae,e]}],"min-w":[{"min-w":[Ae,e,"min","max","fit"]}],"max-w":[{"max-w":[Ae,e,"none","full","min","max","fit","prose",{screen:[kr]},kr]}],h:[{h:[Ae,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ae,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ae,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ae,e,"auto","min","max","fit"]}],"font-size":[{text:["base",kr,Cr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mp]}],"font-family":[{font:[Fo]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ae]}],"line-clamp":[{"line-clamp":["none",vl,Mp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Fn,Ae]}],"list-image":[{"list-image":["none",Ae]}],"list-style-type":[{list:["none","disc","decimal",Ae]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[M]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[M]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[..._(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Fn,Cr]}],"underline-offset":[{"underline-offset":["auto",Fn,Ae]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[M]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...de(),PN]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",qN]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VN]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[M]}],"border-style":[{border:[..._(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[M]}],"divide-style":[{divide:_()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",..._()]}],"outline-offset":[{"outline-offset":[Fn,Ae]}],"outline-w":[{outline:[Fn,Cr]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[M]}],"ring-offset-w":[{"ring-offset":[Fn,Cr]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",kr,IN]}],"shadow-color":[{shadow:[Fo]}],opacity:[{opacity:[M]}],"mix-blend":[{"mix-blend":[...X(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[n]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",kr,Ae]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[y]}],saturate:[{saturate:[D]}],sepia:[{sepia:[H]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[M]}],"backdrop-saturate":[{"backdrop-saturate":[D]}],"backdrop-sepia":[{"backdrop-sepia":[H]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ae]}],duration:[{duration:E()}],ease:[{ease:["linear","in","out","in-out",Ae]}],delay:[{delay:E()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ae]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[V]}],"scale-x":[{"scale-x":[V]}],"scale-y":[{"scale-y":[V]}],rotate:[{rotate:[Po,Ae]}],"translate-x":[{"translate-x":[J]}],"translate-y":[{"translate-y":[J]}],"skew-x":[{"skew-x":[Y]}],"skew-y":[{"skew-y":[Y]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ae]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ae]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ae]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Fn,Cr,Mp]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},WN=NN(KN);function Be(...t){return WN(yN(t))}function XN(){return jr({queryKey:["projects"],queryFn:Fe.projects.list})}function tw(){return jr({queryKey:["activeProject"],queryFn:Fe.projects.getActive,retry:!1})}function ZN(){const t=pt();return Nt({mutationFn:e=>Fe.projects.create(e),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]})}})}function JN(){const t=pt();return Nt({mutationFn:e=>Fe.projects.switchActive(e),onSuccess:()=>{t.invalidateQueries()}})}function $N(){const t=pt();return Nt({mutationFn:({id:e,name:i})=>Fe.projects.rename(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]}),t.invalidateQueries({queryKey:["activeProject"]})}})}function eR(){const t=pt();return Nt({mutationFn:e=>Fe.projects.delete(e),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]})}})}function tR(){const{data:t}=XN(),{data:e}=tw(),i=ZN(),n=JN(),r=eR(),[o,a]=N.useState(!1),[c,h]=N.useState(!1),[d,p]=N.useState(""),y=N.useRef(null);N.useEffect(()=>{function x(w){y.current&&!y.current.contains(w.target)&&(a(!1),h(!1))}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]);const b=()=>{d.trim()&&i.mutate(d.trim(),{onSuccess:()=>{p(""),h(!1)}})};return S.jsxs("div",{className:"relative",ref:y,children:[S.jsxs("button",{onClick:()=>a(!o),className:Be("flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg transition-all border shrink-0",o?"bg-accent border-primary/20":"bg-muted/30 border-border/40 hover:bg-accent/40 hover:border-border/60"),children:[S.jsx(tN,{className:"w-3.5 h-3.5 text-primary opacity-70"}),S.jsx("span",{className:"font-bold truncate max-w-[120px]",children:e?.name??"Select Project"}),S.jsx(La,{className:Be("w-3 h-3 text-muted-foreground transition-transform",o&&"rotate-180")})]}),o&&S.jsxs("div",{className:"absolute left-0 top-full mt-2 z-50 bg-popover border border-border shadow-2xl rounded-xl py-1.5 min-w-[200px] animate-in fade-in zoom-in-95 duration-200",children:[S.jsx("div",{className:"px-3 py-1 mb-1 border-b border-border/40",children:S.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"Switch Project"})}),S.jsx("div",{className:"max-h-60 overflow-y-auto px-1.5",children:t?.map(x=>S.jsxs("div",{className:Be("group flex items-center gap-2 px-3 py-2 text-sm rounded-lg cursor-pointer transition-all",x.id===e?.id?"bg-primary/10 text-primary font-bold shadow-sm":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[S.jsxs("button",{className:"flex-1 text-left truncate flex items-center gap-2",onClick:()=>{n.mutate(x.id),a(!1)},children:[S.jsx(eN,{className:"w-3.5 h-3.5 opacity-40"}),x.name]}),x.id!==e?.id&&S.jsx("button",{onClick:w=>{w.stopPropagation(),r.mutate(x.id)},className:"p-1 text-muted-foreground hover:text-destructive rounded-md transition-all opacity-0 group-hover:opacity-100",children:S.jsx(ua,{className:"w-3 h-3"})})]},x.id))}),S.jsx("div",{className:"border-t border-border mt-1.5 pt-1.5 px-1.5",children:c?S.jsxs("div",{className:"px-1 py-1 flex gap-1.5",children:[S.jsx("input",{autoFocus:!0,type:"text",placeholder:"Name...",value:d,onChange:x=>p(x.target.value),onKeyDown:x=>{x.key==="Enter"&&b(),x.key==="Escape"&&h(!1)},className:"flex-1 px-2.5 py-1.5 text-xs rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),S.jsx("button",{onClick:b,disabled:!d.trim(),className:"px-3 py-1.5 text-xs font-bold rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 shadow-sm",children:"Add"})]}):S.jsxs("button",{onClick:()=>h(!0),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-primary hover:bg-primary/5 rounded-lg transition-all font-bold",children:[S.jsx(Y2,{className:"w-3.5 h-3.5"}),"New Project"]})})]})]})}function iw(t){return typeof t>"u"||t===null}function iR(t){return typeof t=="object"&&t!==null}function nR(t){return Array.isArray(t)?t:iw(t)?[]:[t]}function rR(t,e){var i,n,r,o;if(e)for(o=Object.keys(e),i=0,n=o.length;i<n;i+=1)r=o[i],t[r]=e[r];return t}function sR(t,e){var i="",n;for(n=0;n<e;n+=1)i+=t;return i}function lR(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}var oR=iw,aR=iR,uR=nR,cR=sR,hR=lR,fR=rR,kt={isNothing:oR,isObject:aR,toArray:uR,repeat:cR,isNegativeZero:hR,extend:fR};function nw(t,e){var i="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(i+='in "'+t.mark.name+'" '),i+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(i+=`
12
+
13
+ `+t.mark.snippet),n+" "+i):n}function ha(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=nw(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}ha.prototype=Object.create(Error.prototype);ha.prototype.constructor=ha;ha.prototype.toString=function(e){return this.name+": "+nw(this,e)};var Xt=ha;function Tp(t,e,i,n,r){var o="",a="",c=Math.floor(r/2)-1;return n-e>c&&(o=" ... ",e=n-c+o.length),i-n>c&&(a=" ...",i=n+c-a.length),{str:o+t.slice(e,i).replace(/\t/g,"→")+a,pos:n-e+o.length}}function Op(t,e){return kt.repeat(" ",e-t.length)+t}function dR(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var i=/\r?\n|\r|\0/g,n=[0],r=[],o,a=-1;o=i.exec(t.buffer);)r.push(o.index),n.push(o.index+o[0].length),t.position<=o.index&&a<0&&(a=n.length-2);a<0&&(a=n.length-1);var c="",h,d,p=Math.min(t.line+e.linesAfter,r.length).toString().length,y=e.maxLength-(e.indent+p+3);for(h=1;h<=e.linesBefore&&!(a-h<0);h++)d=Tp(t.buffer,n[a-h],r[a-h],t.position-(n[a]-n[a-h]),y),c=kt.repeat(" ",e.indent)+Op((t.line-h+1).toString(),p)+" | "+d.str+`
14
+ `+c;for(d=Tp(t.buffer,n[a],r[a],t.position,y),c+=kt.repeat(" ",e.indent)+Op((t.line+1).toString(),p)+" | "+d.str+`
15
+ `,c+=kt.repeat("-",e.indent+p+3+d.pos)+`^
16
+ `,h=1;h<=e.linesAfter&&!(a+h>=r.length);h++)d=Tp(t.buffer,n[a+h],r[a+h],t.position-(n[a]-n[a+h]),y),c+=kt.repeat(" ",e.indent)+Op((t.line+h+1).toString(),p)+" | "+d.str+`
17
+ `;return c.replace(/\n$/,"")}var pR=dR,mR=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],gR=["scalar","sequence","mapping"];function yR(t){var e={};return t!==null&&Object.keys(t).forEach(function(i){t[i].forEach(function(n){e[String(n)]=i})}),e}function bR(t,e){if(e=e||{},Object.keys(e).forEach(function(i){if(mR.indexOf(i)===-1)throw new Xt('Unknown option "'+i+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(i){return i},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=yR(e.styleAliases||null),gR.indexOf(this.kind)===-1)throw new Xt('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}var Ht=bR;function ev(t,e){var i=[];return t[e].forEach(function(n){var r=i.length;i.forEach(function(o,a){o.tag===n.tag&&o.kind===n.kind&&o.multi===n.multi&&(r=a)}),i[r]=n}),i}function xR(){var t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,i;function n(r){r.multi?(t.multi[r.kind].push(r),t.multi.fallback.push(r)):t[r.kind][r.tag]=t.fallback[r.tag]=r}for(e=0,i=arguments.length;e<i;e+=1)arguments[e].forEach(n);return t}function Sm(t){return this.extend(t)}Sm.prototype.extend=function(e){var i=[],n=[];if(e instanceof Ht)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(i=i.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new Xt("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");i.forEach(function(o){if(!(o instanceof Ht))throw new Xt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new Xt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(o.multi)throw new Xt("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(o){if(!(o instanceof Ht))throw new Xt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(Sm.prototype);return r.implicit=(this.implicit||[]).concat(i),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=ev(r,"implicit"),r.compiledExplicit=ev(r,"explicit"),r.compiledTypeMap=xR(r.compiledImplicit,r.compiledExplicit),r};var rw=Sm,sw=new Ht("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}}),lw=new Ht("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}}),ow=new Ht("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}}),aw=new rw({explicit:[sw,lw,ow]});function vR(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function SR(){return null}function wR(t){return t===null}var uw=new Ht("tag:yaml.org,2002:null",{kind:"scalar",resolve:vR,construct:SR,predicate:wR,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function CR(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function kR(t){return t==="true"||t==="True"||t==="TRUE"}function AR(t){return Object.prototype.toString.call(t)==="[object Boolean]"}var cw=new Ht("tag:yaml.org,2002:bool",{kind:"scalar",resolve:CR,construct:kR,predicate:AR,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"});function MR(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function TR(t){return 48<=t&&t<=55}function OR(t){return 48<=t&&t<=57}function ER(t){if(t===null)return!1;var e=t.length,i=0,n=!1,r;if(!e)return!1;if(r=t[i],(r==="-"||r==="+")&&(r=t[++i]),r==="0"){if(i+1===e)return!0;if(r=t[++i],r==="b"){for(i++;i<e;i++)if(r=t[i],r!=="_"){if(r!=="0"&&r!=="1")return!1;n=!0}return n&&r!=="_"}if(r==="x"){for(i++;i<e;i++)if(r=t[i],r!=="_"){if(!MR(t.charCodeAt(i)))return!1;n=!0}return n&&r!=="_"}if(r==="o"){for(i++;i<e;i++)if(r=t[i],r!=="_"){if(!TR(t.charCodeAt(i)))return!1;n=!0}return n&&r!=="_"}}if(r==="_")return!1;for(;i<e;i++)if(r=t[i],r!=="_"){if(!OR(t.charCodeAt(i)))return!1;n=!0}return!(!n||r==="_")}function NR(t){var e=t,i=1,n;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),n=e[0],(n==="-"||n==="+")&&(n==="-"&&(i=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return i*parseInt(e.slice(2),2);if(e[1]==="x")return i*parseInt(e.slice(2),16);if(e[1]==="o")return i*parseInt(e.slice(2),8)}return i*parseInt(e,10)}function RR(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!kt.isNegativeZero(t)}var hw=new Ht("tag:yaml.org,2002:int",{kind:"scalar",resolve:ER,construct:NR,predicate:RR,represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),DR=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function jR(t){return!(t===null||!DR.test(t)||t[t.length-1]==="_")}function LR(t){var e,i;return e=t.replace(/_/g,"").toLowerCase(),i=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?i===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:i*parseFloat(e,10)}var BR=/^[-+]?[0-9]+e/;function zR(t,e){var i;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(kt.isNegativeZero(t))return"-0.0";return i=t.toString(10),BR.test(i)?i.replace("e",".e"):i}function _R(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||kt.isNegativeZero(t))}var fw=new Ht("tag:yaml.org,2002:float",{kind:"scalar",resolve:jR,construct:LR,predicate:_R,represent:zR,defaultStyle:"lowercase"}),dw=aw.extend({implicit:[uw,cw,hw,fw]}),pw=dw,mw=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),gw=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function HR(t){return t===null?!1:mw.exec(t)!==null||gw.exec(t)!==null}function UR(t){var e,i,n,r,o,a,c,h=0,d=null,p,y,b;if(e=mw.exec(t),e===null&&(e=gw.exec(t)),e===null)throw new Error("Date resolve error");if(i=+e[1],n=+e[2]-1,r=+e[3],!e[4])return new Date(Date.UTC(i,n,r));if(o=+e[4],a=+e[5],c=+e[6],e[7]){for(h=e[7].slice(0,3);h.length<3;)h+="0";h=+h}return e[9]&&(p=+e[10],y=+(e[11]||0),d=(p*60+y)*6e4,e[9]==="-"&&(d=-d)),b=new Date(Date.UTC(i,n,r,o,a,c,h)),d&&b.setTime(b.getTime()-d),b}function qR(t){return t.toISOString()}var yw=new Ht("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:HR,construct:UR,instanceOf:Date,represent:qR});function PR(t){return t==="<<"||t===null}var bw=new Ht("tag:yaml.org,2002:merge",{kind:"scalar",resolve:PR}),Lg=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
18
+ \r`;function FR(t){if(t===null)return!1;var e,i,n=0,r=t.length,o=Lg;for(i=0;i<r;i++)if(e=o.indexOf(t.charAt(i)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}function VR(t){var e,i,n=t.replace(/[\r\n=]/g,""),r=n.length,o=Lg,a=0,c=[];for(e=0;e<r;e++)e%4===0&&e&&(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)),a=a<<6|o.indexOf(n.charAt(e));return i=r%4*6,i===0?(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)):i===18?(c.push(a>>10&255),c.push(a>>2&255)):i===12&&c.push(a>>4&255),new Uint8Array(c)}function IR(t){var e="",i=0,n,r,o=t.length,a=Lg;for(n=0;n<o;n++)n%3===0&&n&&(e+=a[i>>18&63],e+=a[i>>12&63],e+=a[i>>6&63],e+=a[i&63]),i=(i<<8)+t[n];return r=o%3,r===0?(e+=a[i>>18&63],e+=a[i>>12&63],e+=a[i>>6&63],e+=a[i&63]):r===2?(e+=a[i>>10&63],e+=a[i>>4&63],e+=a[i<<2&63],e+=a[64]):r===1&&(e+=a[i>>2&63],e+=a[i<<4&63],e+=a[64],e+=a[64]),e}function QR(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}var xw=new Ht("tag:yaml.org,2002:binary",{kind:"scalar",resolve:FR,construct:VR,predicate:QR,represent:IR}),YR=Object.prototype.hasOwnProperty,GR=Object.prototype.toString;function KR(t){if(t===null)return!0;var e=[],i,n,r,o,a,c=t;for(i=0,n=c.length;i<n;i+=1){if(r=c[i],a=!1,GR.call(r)!=="[object Object]")return!1;for(o in r)if(YR.call(r,o))if(!a)a=!0;else return!1;if(!a)return!1;if(e.indexOf(o)===-1)e.push(o);else return!1}return!0}function WR(t){return t!==null?t:[]}var vw=new Ht("tag:yaml.org,2002:omap",{kind:"sequence",resolve:KR,construct:WR}),XR=Object.prototype.toString;function ZR(t){if(t===null)return!0;var e,i,n,r,o,a=t;for(o=new Array(a.length),e=0,i=a.length;e<i;e+=1){if(n=a[e],XR.call(n)!=="[object Object]"||(r=Object.keys(n),r.length!==1))return!1;o[e]=[r[0],n[r[0]]]}return!0}function JR(t){if(t===null)return[];var e,i,n,r,o,a=t;for(o=new Array(a.length),e=0,i=a.length;e<i;e+=1)n=a[e],r=Object.keys(n),o[e]=[r[0],n[r[0]]];return o}var Sw=new Ht("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:ZR,construct:JR}),$R=Object.prototype.hasOwnProperty;function eD(t){if(t===null)return!0;var e,i=t;for(e in i)if($R.call(i,e)&&i[e]!==null)return!1;return!0}function tD(t){return t!==null?t:{}}var ww=new Ht("tag:yaml.org,2002:set",{kind:"mapping",resolve:eD,construct:tD}),Bg=pw.extend({implicit:[yw,bw],explicit:[xw,vw,Sw,ww]}),Lr=Object.prototype.hasOwnProperty,$c=1,Cw=2,kw=3,eh=4,Ep=1,iD=2,tv=3,nD=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,rD=/[\x85\u2028\u2029]/,sD=/[,\[\]\{\}]/,Aw=/^(?:!|!!|![a-z\-]+!)$/i,Mw=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function iv(t){return Object.prototype.toString.call(t)}function xn(t){return t===10||t===13}function gs(t){return t===9||t===32}function ui(t){return t===9||t===32||t===10||t===13}function pl(t){return t===44||t===91||t===93||t===123||t===125}function lD(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}function oD(t){return t===120?2:t===117?4:t===85?8:0}function aD(t){return 48<=t&&t<=57?t-48:-1}function nv(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
19
+ `:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"…":t===95?" ":t===76?"\u2028":t===80?"\u2029":""}function uD(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function Tw(t,e,i){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:i}):t[e]=i}var Ow=new Array(256),Ew=new Array(256);for(var cl=0;cl<256;cl++)Ow[cl]=nv(cl)?1:0,Ew[cl]=nv(cl);function cD(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Bg,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Nw(t,e){var i={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return i.snippet=pR(i),new Xt(e,i)}function pe(t,e){throw Nw(t,e)}function th(t,e){t.onWarning&&t.onWarning.call(null,Nw(t,e))}var rv={YAML:function(e,i,n){var r,o,a;e.version!==null&&pe(e,"duplication of %YAML directive"),n.length!==1&&pe(e,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),r===null&&pe(e,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),a=parseInt(r[2],10),o!==1&&pe(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&th(e,"unsupported YAML version of the document")},TAG:function(e,i,n){var r,o;n.length!==2&&pe(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],Aw.test(r)||pe(e,"ill-formed tag handle (first argument) of the TAG directive"),Lr.call(e.tagMap,r)&&pe(e,'there is a previously declared suffix for "'+r+'" tag handle'),Mw.test(o)||pe(e,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{pe(e,"tag prefix is malformed: "+o)}e.tagMap[r]=o}};function Rr(t,e,i,n){var r,o,a,c;if(e<i){if(c=t.input.slice(e,i),n)for(r=0,o=c.length;r<o;r+=1)a=c.charCodeAt(r),a===9||32<=a&&a<=1114111||pe(t,"expected valid JSON character");else nD.test(c)&&pe(t,"the stream contains non-printable characters");t.result+=c}}function sv(t,e,i,n){var r,o,a,c;for(kt.isObject(i)||pe(t,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(i),a=0,c=r.length;a<c;a+=1)o=r[a],Lr.call(e,o)||(Tw(e,o,i[o]),n[o]=!0)}function ml(t,e,i,n,r,o,a,c,h){var d,p;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),d=0,p=r.length;d<p;d+=1)Array.isArray(r[d])&&pe(t,"nested arrays are not supported inside keys"),typeof r=="object"&&iv(r[d])==="[object Object]"&&(r[d]="[object Object]");if(typeof r=="object"&&iv(r)==="[object Object]"&&(r="[object Object]"),r=String(r),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(d=0,p=o.length;d<p;d+=1)sv(t,e,o[d],i);else sv(t,e,o,i);else!t.json&&!Lr.call(i,r)&&Lr.call(e,r)&&(t.line=a||t.line,t.lineStart=c||t.lineStart,t.position=h||t.position,pe(t,"duplicated mapping key")),Tw(e,r,o),delete i[r];return e}function zg(t){var e;e=t.input.charCodeAt(t.position),e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):pe(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function xt(t,e,i){for(var n=0,r=t.input.charCodeAt(t.position);r!==0;){for(;gs(r);)r===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),r=t.input.charCodeAt(++t.position);if(e&&r===35)do r=t.input.charCodeAt(++t.position);while(r!==10&&r!==13&&r!==0);if(xn(r))for(zg(t),r=t.input.charCodeAt(t.position),n++,t.lineIndent=0;r===32;)t.lineIndent++,r=t.input.charCodeAt(++t.position);else break}return i!==-1&&n!==0&&t.lineIndent<i&&th(t,"deficient indentation"),n}function Bh(t){var e=t.position,i;return i=t.input.charCodeAt(e),!!((i===45||i===46)&&i===t.input.charCodeAt(e+1)&&i===t.input.charCodeAt(e+2)&&(e+=3,i=t.input.charCodeAt(e),i===0||ui(i)))}function _g(t,e){e===1?t.result+=" ":e>1&&(t.result+=kt.repeat(`
20
+ `,e-1))}function hD(t,e,i){var n,r,o,a,c,h,d,p,y=t.kind,b=t.result,x;if(x=t.input.charCodeAt(t.position),ui(x)||pl(x)||x===35||x===38||x===42||x===33||x===124||x===62||x===39||x===34||x===37||x===64||x===96||(x===63||x===45)&&(r=t.input.charCodeAt(t.position+1),ui(r)||i&&pl(r)))return!1;for(t.kind="scalar",t.result="",o=a=t.position,c=!1;x!==0;){if(x===58){if(r=t.input.charCodeAt(t.position+1),ui(r)||i&&pl(r))break}else if(x===35){if(n=t.input.charCodeAt(t.position-1),ui(n))break}else{if(t.position===t.lineStart&&Bh(t)||i&&pl(x))break;if(xn(x))if(h=t.line,d=t.lineStart,p=t.lineIndent,xt(t,!1,-1),t.lineIndent>=e){c=!0,x=t.input.charCodeAt(t.position);continue}else{t.position=a,t.line=h,t.lineStart=d,t.lineIndent=p;break}}c&&(Rr(t,o,a,!1),_g(t,t.line-h),o=a=t.position,c=!1),gs(x)||(a=t.position+1),x=t.input.charCodeAt(++t.position)}return Rr(t,o,a,!1),t.result?!0:(t.kind=y,t.result=b,!1)}function fD(t,e){var i,n,r;if(i=t.input.charCodeAt(t.position),i!==39)return!1;for(t.kind="scalar",t.result="",t.position++,n=r=t.position;(i=t.input.charCodeAt(t.position))!==0;)if(i===39)if(Rr(t,n,t.position,!0),i=t.input.charCodeAt(++t.position),i===39)n=t.position,t.position++,r=t.position;else return!0;else xn(i)?(Rr(t,n,r,!0),_g(t,xt(t,!1,e)),n=r=t.position):t.position===t.lineStart&&Bh(t)?pe(t,"unexpected end of the document within a single quoted scalar"):(t.position++,r=t.position);pe(t,"unexpected end of the stream within a single quoted scalar")}function dD(t,e){var i,n,r,o,a,c;if(c=t.input.charCodeAt(t.position),c!==34)return!1;for(t.kind="scalar",t.result="",t.position++,i=n=t.position;(c=t.input.charCodeAt(t.position))!==0;){if(c===34)return Rr(t,i,t.position,!0),t.position++,!0;if(c===92){if(Rr(t,i,t.position,!0),c=t.input.charCodeAt(++t.position),xn(c))xt(t,!1,e);else if(c<256&&Ow[c])t.result+=Ew[c],t.position++;else if((a=oD(c))>0){for(r=a,o=0;r>0;r--)c=t.input.charCodeAt(++t.position),(a=lD(c))>=0?o=(o<<4)+a:pe(t,"expected hexadecimal character");t.result+=uD(o),t.position++}else pe(t,"unknown escape sequence");i=n=t.position}else xn(c)?(Rr(t,i,n,!0),_g(t,xt(t,!1,e)),i=n=t.position):t.position===t.lineStart&&Bh(t)?pe(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}pe(t,"unexpected end of the stream within a double quoted scalar")}function pD(t,e){var i=!0,n,r,o,a=t.tag,c,h=t.anchor,d,p,y,b,x,w=Object.create(null),C,k,M,O;if(O=t.input.charCodeAt(t.position),O===91)p=93,x=!1,c=[];else if(O===123)p=125,x=!0,c={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=c),O=t.input.charCodeAt(++t.position);O!==0;){if(xt(t,!0,e),O=t.input.charCodeAt(t.position),O===p)return t.position++,t.tag=a,t.anchor=h,t.kind=x?"mapping":"sequence",t.result=c,!0;i?O===44&&pe(t,"expected the node content, but found ','"):pe(t,"missed comma between flow collection entries"),k=C=M=null,y=b=!1,O===63&&(d=t.input.charCodeAt(t.position+1),ui(d)&&(y=b=!0,t.position++,xt(t,!0,e))),n=t.line,r=t.lineStart,o=t.position,El(t,e,$c,!1,!0),k=t.tag,C=t.result,xt(t,!0,e),O=t.input.charCodeAt(t.position),(b||t.line===n)&&O===58&&(y=!0,O=t.input.charCodeAt(++t.position),xt(t,!0,e),El(t,e,$c,!1,!0),M=t.result),x?ml(t,c,w,k,C,M,n,r,o):y?c.push(ml(t,null,w,k,C,M,n,r,o)):c.push(C),xt(t,!0,e),O=t.input.charCodeAt(t.position),O===44?(i=!0,O=t.input.charCodeAt(++t.position)):i=!1}pe(t,"unexpected end of the stream within a flow collection")}function mD(t,e){var i,n,r=Ep,o=!1,a=!1,c=e,h=0,d=!1,p,y;if(y=t.input.charCodeAt(t.position),y===124)n=!1;else if(y===62)n=!0;else return!1;for(t.kind="scalar",t.result="";y!==0;)if(y=t.input.charCodeAt(++t.position),y===43||y===45)Ep===r?r=y===43?tv:iD:pe(t,"repeat of a chomping mode identifier");else if((p=aD(y))>=0)p===0?pe(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?pe(t,"repeat of an indentation width identifier"):(c=e+p-1,a=!0);else break;if(gs(y)){do y=t.input.charCodeAt(++t.position);while(gs(y));if(y===35)do y=t.input.charCodeAt(++t.position);while(!xn(y)&&y!==0)}for(;y!==0;){for(zg(t),t.lineIndent=0,y=t.input.charCodeAt(t.position);(!a||t.lineIndent<c)&&y===32;)t.lineIndent++,y=t.input.charCodeAt(++t.position);if(!a&&t.lineIndent>c&&(c=t.lineIndent),xn(y)){h++;continue}if(t.lineIndent<c){r===tv?t.result+=kt.repeat(`
21
+ `,o?1+h:h):r===Ep&&o&&(t.result+=`
22
+ `);break}for(n?gs(y)?(d=!0,t.result+=kt.repeat(`
23
+ `,o?1+h:h)):d?(d=!1,t.result+=kt.repeat(`
24
+ `,h+1)):h===0?o&&(t.result+=" "):t.result+=kt.repeat(`
25
+ `,h):t.result+=kt.repeat(`
26
+ `,o?1+h:h),o=!0,a=!0,h=0,i=t.position;!xn(y)&&y!==0;)y=t.input.charCodeAt(++t.position);Rr(t,i,t.position,!1)}return!0}function lv(t,e){var i,n=t.tag,r=t.anchor,o=[],a,c=!1,h;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=o),h=t.input.charCodeAt(t.position);h!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,pe(t,"tab characters must not be used in indentation")),!(h!==45||(a=t.input.charCodeAt(t.position+1),!ui(a))));){if(c=!0,t.position++,xt(t,!0,-1)&&t.lineIndent<=e){o.push(null),h=t.input.charCodeAt(t.position);continue}if(i=t.line,El(t,e,kw,!1,!0),o.push(t.result),xt(t,!0,-1),h=t.input.charCodeAt(t.position),(t.line===i||t.lineIndent>e)&&h!==0)pe(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return c?(t.tag=n,t.anchor=r,t.kind="sequence",t.result=o,!0):!1}function gD(t,e,i){var n,r,o,a,c,h,d=t.tag,p=t.anchor,y={},b=Object.create(null),x=null,w=null,C=null,k=!1,M=!1,O;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=y),O=t.input.charCodeAt(t.position);O!==0;){if(!k&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,pe(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),o=t.line,(O===63||O===58)&&ui(n))O===63?(k&&(ml(t,y,b,x,w,null,a,c,h),x=w=C=null),M=!0,k=!0,r=!0):k?(k=!1,r=!0):pe(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,O=n;else{if(a=t.line,c=t.lineStart,h=t.position,!El(t,i,Cw,!1,!0))break;if(t.line===o){for(O=t.input.charCodeAt(t.position);gs(O);)O=t.input.charCodeAt(++t.position);if(O===58)O=t.input.charCodeAt(++t.position),ui(O)||pe(t,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(ml(t,y,b,x,w,null,a,c,h),x=w=C=null),M=!0,k=!1,r=!1,x=t.tag,w=t.result;else if(M)pe(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=d,t.anchor=p,!0}else if(M)pe(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=d,t.anchor=p,!0}if((t.line===o||t.lineIndent>e)&&(k&&(a=t.line,c=t.lineStart,h=t.position),El(t,e,eh,!0,r)&&(k?w=t.result:C=t.result),k||(ml(t,y,b,x,w,C,a,c,h),x=w=C=null),xt(t,!0,-1),O=t.input.charCodeAt(t.position)),(t.line===o||t.lineIndent>e)&&O!==0)pe(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return k&&ml(t,y,b,x,w,null,a,c,h),M&&(t.tag=d,t.anchor=p,t.kind="mapping",t.result=y),M}function yD(t){var e,i=!1,n=!1,r,o,a;if(a=t.input.charCodeAt(t.position),a!==33)return!1;if(t.tag!==null&&pe(t,"duplication of a tag property"),a=t.input.charCodeAt(++t.position),a===60?(i=!0,a=t.input.charCodeAt(++t.position)):a===33?(n=!0,r="!!",a=t.input.charCodeAt(++t.position)):r="!",e=t.position,i){do a=t.input.charCodeAt(++t.position);while(a!==0&&a!==62);t.position<t.length?(o=t.input.slice(e,t.position),a=t.input.charCodeAt(++t.position)):pe(t,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!ui(a);)a===33&&(n?pe(t,"tag suffix cannot contain exclamation marks"):(r=t.input.slice(e-1,t.position+1),Aw.test(r)||pe(t,"named tag handle cannot contain such characters"),n=!0,e=t.position+1)),a=t.input.charCodeAt(++t.position);o=t.input.slice(e,t.position),sD.test(o)&&pe(t,"tag suffix cannot contain flow indicator characters")}o&&!Mw.test(o)&&pe(t,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{pe(t,"tag name is malformed: "+o)}return i?t.tag=o:Lr.call(t.tagMap,r)?t.tag=t.tagMap[r]+o:r==="!"?t.tag="!"+o:r==="!!"?t.tag="tag:yaml.org,2002:"+o:pe(t,'undeclared tag handle "'+r+'"'),!0}function bD(t){var e,i;if(i=t.input.charCodeAt(t.position),i!==38)return!1;for(t.anchor!==null&&pe(t,"duplication of an anchor property"),i=t.input.charCodeAt(++t.position),e=t.position;i!==0&&!ui(i)&&!pl(i);)i=t.input.charCodeAt(++t.position);return t.position===e&&pe(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}function xD(t){var e,i,n;if(n=t.input.charCodeAt(t.position),n!==42)return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;n!==0&&!ui(n)&&!pl(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&pe(t,"name of an alias node must contain at least one character"),i=t.input.slice(e,t.position),Lr.call(t.anchorMap,i)||pe(t,'unidentified alias "'+i+'"'),t.result=t.anchorMap[i],xt(t,!0,-1),!0}function El(t,e,i,n,r){var o,a,c,h=1,d=!1,p=!1,y,b,x,w,C,k;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,o=a=c=eh===i||kw===i,n&&xt(t,!0,-1)&&(d=!0,t.lineIndent>e?h=1:t.lineIndent===e?h=0:t.lineIndent<e&&(h=-1)),h===1)for(;yD(t)||bD(t);)xt(t,!0,-1)?(d=!0,c=o,t.lineIndent>e?h=1:t.lineIndent===e?h=0:t.lineIndent<e&&(h=-1)):c=!1;if(c&&(c=d||r),(h===1||eh===i)&&($c===i||Cw===i?C=e:C=e+1,k=t.position-t.lineStart,h===1?c&&(lv(t,k)||gD(t,k,C))||pD(t,C)?p=!0:(a&&mD(t,C)||fD(t,C)||dD(t,C)?p=!0:xD(t)?(p=!0,(t.tag!==null||t.anchor!==null)&&pe(t,"alias node should not have any properties")):hD(t,C,$c===i)&&(p=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):h===0&&(p=c&&lv(t,k))),t.tag===null)t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);else if(t.tag==="?"){for(t.result!==null&&t.kind!=="scalar"&&pe(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),y=0,b=t.implicitTypes.length;y<b;y+=1)if(w=t.implicitTypes[y],w.resolve(t.result)){t.result=w.construct(t.result),t.tag=w.tag,t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);break}}else if(t.tag!=="!"){if(Lr.call(t.typeMap[t.kind||"fallback"],t.tag))w=t.typeMap[t.kind||"fallback"][t.tag];else for(w=null,x=t.typeMap.multi[t.kind||"fallback"],y=0,b=x.length;y<b;y+=1)if(t.tag.slice(0,x[y].tag.length)===x[y].tag){w=x[y];break}w||pe(t,"unknown tag !<"+t.tag+">"),t.result!==null&&w.kind!==t.kind&&pe(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+w.kind+'", not "'+t.kind+'"'),w.resolve(t.result,t.tag)?(t.result=w.construct(t.result,t.tag),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):pe(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||p}function vD(t){var e=t.position,i,n,r,o=!1,a;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(a=t.input.charCodeAt(t.position))!==0&&(xt(t,!0,-1),a=t.input.charCodeAt(t.position),!(t.lineIndent>0||a!==37));){for(o=!0,a=t.input.charCodeAt(++t.position),i=t.position;a!==0&&!ui(a);)a=t.input.charCodeAt(++t.position);for(n=t.input.slice(i,t.position),r=[],n.length<1&&pe(t,"directive name must not be less than one character in length");a!==0;){for(;gs(a);)a=t.input.charCodeAt(++t.position);if(a===35){do a=t.input.charCodeAt(++t.position);while(a!==0&&!xn(a));break}if(xn(a))break;for(i=t.position;a!==0&&!ui(a);)a=t.input.charCodeAt(++t.position);r.push(t.input.slice(i,t.position))}a!==0&&zg(t),Lr.call(rv,n)?rv[n](t,n,r):th(t,'unknown document directive "'+n+'"')}if(xt(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,xt(t,!0,-1)):o&&pe(t,"directives end mark is expected"),El(t,t.lineIndent-1,eh,!1,!0),xt(t,!0,-1),t.checkLineBreaks&&rD.test(t.input.slice(e,t.position))&&th(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&Bh(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,xt(t,!0,-1));return}if(t.position<t.length-1)pe(t,"end of the stream or a document separator is expected");else return}function Rw(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
27
+ `),t.charCodeAt(0)===65279&&(t=t.slice(1)));var i=new cD(t,e),n=t.indexOf("\0");for(n!==-1&&(i.position=n,pe(i,"null byte is not allowed in input")),i.input+="\0";i.input.charCodeAt(i.position)===32;)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)vD(i);return i.documents}function SD(t,e,i){e!==null&&typeof e=="object"&&typeof i>"u"&&(i=e,e=null);var n=Rw(t,i);if(typeof e!="function")return n;for(var r=0,o=n.length;r<o;r+=1)e(n[r])}function wD(t,e){var i=Rw(t,e);if(i.length!==0){if(i.length===1)return i[0];throw new Xt("expected a single document in the stream, but found more")}}var CD=SD,kD=wD,Dw={loadAll:CD,load:kD},jw=Object.prototype.toString,Lw=Object.prototype.hasOwnProperty,Hg=65279,AD=9,fa=10,MD=13,TD=32,OD=33,ED=34,wm=35,ND=37,RD=38,DD=39,jD=42,Bw=44,LD=45,ih=58,BD=61,zD=62,_D=63,HD=64,zw=91,_w=93,UD=96,Hw=123,qD=124,Uw=125,Vt={};Vt[0]="\\0";Vt[7]="\\a";Vt[8]="\\b";Vt[9]="\\t";Vt[10]="\\n";Vt[11]="\\v";Vt[12]="\\f";Vt[13]="\\r";Vt[27]="\\e";Vt[34]='\\"';Vt[92]="\\\\";Vt[133]="\\N";Vt[160]="\\_";Vt[8232]="\\L";Vt[8233]="\\P";var PD=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],FD=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function VD(t,e){var i,n,r,o,a,c,h;if(e===null)return{};for(i={},n=Object.keys(e),r=0,o=n.length;r<o;r+=1)a=n[r],c=String(e[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),h=t.compiledTypeMap.fallback[a],h&&Lw.call(h.styleAliases,c)&&(c=h.styleAliases[c]),i[a]=c;return i}function ID(t){var e,i,n;if(e=t.toString(16).toUpperCase(),t<=255)i="x",n=2;else if(t<=65535)i="u",n=4;else if(t<=4294967295)i="U",n=8;else throw new Xt("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+i+kt.repeat("0",n-e.length)+e}var QD=1,da=2;function YD(t){this.schema=t.schema||Bg,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=kt.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=VD(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType==='"'?da:QD,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer=="function"?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ov(t,e){for(var i=kt.repeat(" ",e),n=0,r=-1,o="",a,c=t.length;n<c;)r=t.indexOf(`
28
+ `,n),r===-1?(a=t.slice(n),n=c):(a=t.slice(n,r+1),n=r+1),a.length&&a!==`
29
+ `&&(o+=i),o+=a;return o}function Cm(t,e){return`
30
+ `+kt.repeat(" ",t.indent*e)}function GD(t,e){var i,n,r;for(i=0,n=t.implicitTypes.length;i<n;i+=1)if(r=t.implicitTypes[i],r.resolve(e))return!0;return!1}function nh(t){return t===TD||t===AD}function pa(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==Hg||65536<=t&&t<=1114111}function av(t){return pa(t)&&t!==Hg&&t!==MD&&t!==fa}function uv(t,e,i){var n=av(t),r=n&&!nh(t);return(i?n:n&&t!==Bw&&t!==zw&&t!==_w&&t!==Hw&&t!==Uw)&&t!==wm&&!(e===ih&&!r)||av(e)&&!nh(e)&&t===wm||e===ih&&r}function KD(t){return pa(t)&&t!==Hg&&!nh(t)&&t!==LD&&t!==_D&&t!==ih&&t!==Bw&&t!==zw&&t!==_w&&t!==Hw&&t!==Uw&&t!==wm&&t!==RD&&t!==jD&&t!==OD&&t!==qD&&t!==BD&&t!==zD&&t!==DD&&t!==ED&&t!==ND&&t!==HD&&t!==UD}function WD(t){return!nh(t)&&t!==ih}function Ko(t,e){var i=t.charCodeAt(e),n;return i>=55296&&i<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(i-55296)*1024+n-56320+65536:i}function qw(t){var e=/^\n* /;return e.test(t)}var Pw=1,km=2,Fw=3,Vw=4,hl=5;function XD(t,e,i,n,r,o,a,c){var h,d=0,p=null,y=!1,b=!1,x=n!==-1,w=-1,C=KD(Ko(t,0))&&WD(Ko(t,t.length-1));if(e||a)for(h=0;h<t.length;d>=65536?h+=2:h++){if(d=Ko(t,h),!pa(d))return hl;C=C&&uv(d,p,c),p=d}else{for(h=0;h<t.length;d>=65536?h+=2:h++){if(d=Ko(t,h),d===fa)y=!0,x&&(b=b||h-w-1>n&&t[w+1]!==" ",w=h);else if(!pa(d))return hl;C=C&&uv(d,p,c),p=d}b=b||x&&h-w-1>n&&t[w+1]!==" "}return!y&&!b?C&&!a&&!r(t)?Pw:o===da?hl:km:i>9&&qw(t)?hl:a?o===da?hl:km:b?Vw:Fw}function ZD(t,e,i,n,r){t.dump=(function(){if(e.length===0)return t.quotingType===da?'""':"''";if(!t.noCompatMode&&(PD.indexOf(e)!==-1||FD.test(e)))return t.quotingType===da?'"'+e+'"':"'"+e+"'";var o=t.indent*Math.max(1,i),a=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-o),c=n||t.flowLevel>-1&&i>=t.flowLevel;function h(d){return GD(t,d)}switch(XD(e,c,t.indent,a,h,t.quotingType,t.forceQuotes&&!n,r)){case Pw:return e;case km:return"'"+e.replace(/'/g,"''")+"'";case Fw:return"|"+cv(e,t.indent)+hv(ov(e,o));case Vw:return">"+cv(e,t.indent)+hv(ov(JD(e,a),o));case hl:return'"'+$D(e)+'"';default:throw new Xt("impossible error: invalid scalar style")}})()}function cv(t,e){var i=qw(t)?String(e):"",n=t[t.length-1]===`
31
+ `,r=n&&(t[t.length-2]===`
32
+ `||t===`
33
+ `),o=r?"+":n?"":"-";return i+o+`
34
+ `}function hv(t){return t[t.length-1]===`
35
+ `?t.slice(0,-1):t}function JD(t,e){for(var i=/(\n+)([^\n]*)/g,n=(function(){var d=t.indexOf(`
36
+ `);return d=d!==-1?d:t.length,i.lastIndex=d,fv(t.slice(0,d),e)})(),r=t[0]===`
37
+ `||t[0]===" ",o,a;a=i.exec(t);){var c=a[1],h=a[2];o=h[0]===" ",n+=c+(!r&&!o&&h!==""?`
38
+ `:"")+fv(h,e),r=o}return n}function fv(t,e){if(t===""||t[0]===" ")return t;for(var i=/ [^ ]/g,n,r=0,o,a=0,c=0,h="";n=i.exec(t);)c=n.index,c-r>e&&(o=a>r?a:c,h+=`
39
+ `+t.slice(r,o),r=o+1),a=c;return h+=`
40
+ `,t.length-r>e&&a>r?h+=t.slice(r,a)+`
41
+ `+t.slice(a+1):h+=t.slice(r),h.slice(1)}function $D(t){for(var e="",i=0,n,r=0;r<t.length;i>=65536?r+=2:r++)i=Ko(t,r),n=Vt[i],!n&&pa(i)?(e+=t[r],i>=65536&&(e+=t[r+1])):e+=n||ID(i);return e}function e4(t,e,i){var n="",r=t.tag,o,a,c;for(o=0,a=i.length;o<a;o+=1)c=i[o],t.replacer&&(c=t.replacer.call(i,String(o),c)),(Gn(t,e,c,!1,!1)||typeof c>"u"&&Gn(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=r,t.dump="["+n+"]"}function dv(t,e,i,n){var r="",o=t.tag,a,c,h;for(a=0,c=i.length;a<c;a+=1)h=i[a],t.replacer&&(h=t.replacer.call(i,String(a),h)),(Gn(t,e+1,h,!0,!0,!1,!0)||typeof h>"u"&&Gn(t,e+1,null,!0,!0,!1,!0))&&((!n||r!=="")&&(r+=Cm(t,e)),t.dump&&fa===t.dump.charCodeAt(0)?r+="-":r+="- ",r+=t.dump);t.tag=o,t.dump=r||"[]"}function t4(t,e,i){var n="",r=t.tag,o=Object.keys(i),a,c,h,d,p;for(a=0,c=o.length;a<c;a+=1)p="",n!==""&&(p+=", "),t.condenseFlow&&(p+='"'),h=o[a],d=i[h],t.replacer&&(d=t.replacer.call(i,h,d)),Gn(t,e,h,!1,!1)&&(t.dump.length>1024&&(p+="? "),p+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Gn(t,e,d,!1,!1)&&(p+=t.dump,n+=p));t.tag=r,t.dump="{"+n+"}"}function i4(t,e,i,n){var r="",o=t.tag,a=Object.keys(i),c,h,d,p,y,b;if(t.sortKeys===!0)a.sort();else if(typeof t.sortKeys=="function")a.sort(t.sortKeys);else if(t.sortKeys)throw new Xt("sortKeys must be a boolean or a function");for(c=0,h=a.length;c<h;c+=1)b="",(!n||r!=="")&&(b+=Cm(t,e)),d=a[c],p=i[d],t.replacer&&(p=t.replacer.call(i,d,p)),Gn(t,e+1,d,!0,!0,!0)&&(y=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,y&&(t.dump&&fa===t.dump.charCodeAt(0)?b+="?":b+="? "),b+=t.dump,y&&(b+=Cm(t,e)),Gn(t,e+1,p,!0,y)&&(t.dump&&fa===t.dump.charCodeAt(0)?b+=":":b+=": ",b+=t.dump,r+=b));t.tag=o,t.dump=r||"{}"}function pv(t,e,i){var n,r,o,a,c,h;for(r=i?t.explicitTypes:t.implicitTypes,o=0,a=r.length;o<a;o+=1)if(c=r[o],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof e=="object"&&e instanceof c.instanceOf)&&(!c.predicate||c.predicate(e))){if(i?c.multi&&c.representName?t.tag=c.representName(e):t.tag=c.tag:t.tag="?",c.represent){if(h=t.styleMap[c.tag]||c.defaultStyle,jw.call(c.represent)==="[object Function]")n=c.represent(e,h);else if(Lw.call(c.represent,h))n=c.represent[h](e,h);else throw new Xt("!<"+c.tag+'> tag resolver accepts not "'+h+'" style');t.dump=n}return!0}return!1}function Gn(t,e,i,n,r,o,a){t.tag=null,t.dump=i,pv(t,i,!1)||pv(t,i,!0);var c=jw.call(t.dump),h=n,d;n&&(n=t.flowLevel<0||t.flowLevel>e);var p=c==="[object Object]"||c==="[object Array]",y,b;if(p&&(y=t.duplicates.indexOf(i),b=y!==-1),(t.tag!==null&&t.tag!=="?"||b||t.indent!==2&&e>0)&&(r=!1),b&&t.usedDuplicates[y])t.dump="*ref_"+y;else{if(p&&b&&!t.usedDuplicates[y]&&(t.usedDuplicates[y]=!0),c==="[object Object]")n&&Object.keys(t.dump).length!==0?(i4(t,e,t.dump,r),b&&(t.dump="&ref_"+y+t.dump)):(t4(t,e,t.dump),b&&(t.dump="&ref_"+y+" "+t.dump));else if(c==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!a&&e>0?dv(t,e-1,t.dump,r):dv(t,e,t.dump,r),b&&(t.dump="&ref_"+y+t.dump)):(e4(t,e,t.dump),b&&(t.dump="&ref_"+y+" "+t.dump));else if(c==="[object String]")t.tag!=="?"&&ZD(t,t.dump,e,o,h);else{if(c==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new Xt("unacceptable kind of an object to dump "+c)}t.tag!==null&&t.tag!=="?"&&(d=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",t.dump=d+" "+t.dump)}return!0}function n4(t,e){var i=[],n=[],r,o;for(Am(t,i,n),r=0,o=n.length;r<o;r+=1)e.duplicates.push(i[n[r]]);e.usedDuplicates=new Array(o)}function Am(t,e,i){var n,r,o;if(t!==null&&typeof t=="object")if(r=e.indexOf(t),r!==-1)i.indexOf(r)===-1&&i.push(r);else if(e.push(t),Array.isArray(t))for(r=0,o=t.length;r<o;r+=1)Am(t[r],e,i);else for(n=Object.keys(t),r=0,o=n.length;r<o;r+=1)Am(t[n[r]],e,i)}function r4(t,e){e=e||{};var i=new YD(e);i.noRefs||n4(t,i);var n=t;return i.replacer&&(n=i.replacer.call({"":n},"",n)),Gn(i,0,n,!0,!0)?i.dump+`
42
+ `:""}var s4=r4,l4={dump:s4};function Ug(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o4=Ht,a4=rw,u4=aw,c4=dw,h4=pw,f4=Bg,d4=Dw.load,p4=Dw.loadAll,m4=l4.dump,g4=Xt,y4={binary:xw,float:fw,map:ow,null:uw,pairs:Sw,set:ww,timestamp:yw,bool:cw,int:hw,merge:bw,omap:vw,seq:lw,str:sw},b4=Ug("safeLoad","load"),x4=Ug("safeLoadAll","loadAll"),v4=Ug("safeDump","dump"),mv={Type:o4,Schema:a4,FAILSAFE_SCHEMA:u4,JSON_SCHEMA:c4,CORE_SCHEMA:h4,DEFAULT_SCHEMA:f4,load:d4,loadAll:p4,dump:m4,YAMLException:g4,types:y4,safeLoad:b4,safeLoadAll:x4,safeDump:v4};function Iw(){return jr({queryKey:["specs"],queryFn:Fe.specs.list})}function S4(){const t=pt();return Nt({mutationFn:({spec:e,name:i,upstreamUrl:n})=>Fe.specs.upload(e,i,n),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function w4(){const t=pt();return Nt({mutationFn:({url:e,name:i})=>Fe.specs.uploadFromUrl(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function C4(){const t=pt();return Nt({mutationFn:({specId:e,data:i})=>Fe.specs.update(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function k4(){const t=pt();return Nt({mutationFn:e=>Fe.specs.toggle(e),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function A4(){const t=pt();return Nt({mutationFn:({specId:e,spec:i})=>Fe.specs.reimport(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function M4(){const t=pt();return Nt({mutationFn:e=>Fe.specs.delete(e),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function T4(){const{data:t}=Iw(),e=k4(),i=M4(),n=S4(),r=w4(),o=C4(),a=A4(),[c,h]=N.useState(!1),[d,p]=N.useState(!1),[y,b]=N.useState(null),[x,w]=N.useState("url"),[C,k]=N.useState(""),[M,O]=N.useState(""),[D,V]=N.useState(""),H=N.useRef(null);N.useEffect(()=>{function q(ee){H.current&&!H.current.contains(ee.target)&&(h(!1),p(!1),b(null))}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[]);const Y=N.useCallback(async q=>{if(!C.trim())return alert("Enter a spec name");try{const ee=await q.text(),de=/\.ya?ml$/i.test(q.name)?mv.load(ee):JSON.parse(ee);n.mutate({spec:de,name:C.trim()},{onSuccess:()=>{k(""),p(!1),h(!1)}})}catch{alert("Invalid file")}},[n,C]),U=()=>{!M.trim()||!C.trim()||r.mutate({url:M.trim(),name:C.trim()},{onSuccess:()=>{O(""),k(""),p(!1),h(!1)}})},J=q=>{if(q.metadata.sourceUrl)a.mutate({specId:q.id});else{const ee=document.createElement("input");ee.type="file",ee.accept=".json,.yaml,.yml",ee.onchange=async fe=>{const de=fe.target.files?.[0];if(de)try{const _=await de.text(),ne=/\.ya?ml$/i.test(de.name)?mv.load(_):JSON.parse(_);a.mutate({specId:q.id,spec:ne})}catch{alert("Invalid file")}},ee.click()}},Z=q=>{o.mutate({specId:q,data:{upstreamUrl:D.trim()}},{onSuccess:()=>b(null)})},ce=t?.filter(q=>q.active)??[],oe=ce.length===1?ce[0].name:ce.length>1?`${ce.length} Specs`:"Select Spec";return S.jsxs("div",{className:"relative",ref:H,children:[S.jsxs("button",{onClick:()=>h(!c),className:Be("flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg transition-all border shrink-0",c?"bg-accent border-primary/20":"bg-muted/30 border-border/40 hover:bg-accent/40 hover:border-border/60"),children:[S.jsx(Kc,{className:"w-3.5 h-3.5 text-mode-mock opacity-70"}),S.jsx("span",{className:"font-bold truncate max-w-[150px]",children:oe}),S.jsx(La,{className:Be("w-3 h-3 text-muted-foreground transition-transform",c&&"rotate-180")})]}),c&&S.jsxs("div",{className:"absolute left-0 top-full mt-2 z-50 bg-popover border border-border shadow-2xl rounded-xl py-1.5 min-w-[340px] animate-in fade-in zoom-in-95 duration-200",children:[S.jsxs("div",{className:"px-3 py-1 mb-1 border-b border-border/40 flex items-center justify-between",children:[S.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"API Specifications"}),S.jsx("button",{onClick:()=>{p(!d),b(null),k(""),O("")},className:"p-1 hover:bg-primary/10 text-primary rounded-md transition-all",children:d?S.jsx(ca,{className:"w-3.5 h-3.5"}):S.jsx(Y2,{className:"w-3.5 h-3.5"})})]}),S.jsx("div",{className:"max-h-[450px] overflow-y-auto px-1.5 py-1 ",children:d?S.jsxs("div",{className:"p-3 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Spec Identifier"}),S.jsx("input",{autoFocus:!0,type:"text",placeholder:"e.g. staging-api",value:C,onChange:q=>k(q.target.value),className:"w-full px-3 py-2 text-xs font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"})]}),S.jsxs("div",{className:"flex p-0.5 bg-muted rounded-lg border border-border/40",children:[S.jsxs("button",{onClick:()=>w("url"),className:Be("flex-1 flex items-center justify-center gap-1.5 py-1 text-[9px] font-black uppercase tracking-wider rounded-md transition-all",x==="url"?"bg-background shadow-sm text-primary":"text-muted-foreground"),children:[S.jsx(I2,{className:"w-3 h-3"})," URL"]}),S.jsxs("button",{onClick:()=>w("file"),className:Be("flex-1 flex items-center justify-center gap-1.5 py-1 text-[9px] font-black uppercase tracking-wider rounded-md transition-all",x==="file"?"bg-background shadow-sm text-primary":"text-muted-foreground"),children:[S.jsx(K2,{className:"w-3 h-3"})," File"]})]}),x==="url"?S.jsxs("div",{className:"space-y-3",children:[S.jsxs("div",{className:"relative group",children:[S.jsx(iN,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground/40 group-focus-within:text-primary transition-colors"}),S.jsx("input",{type:"url",placeholder:"https://api.example.com/spec.json",value:M,onChange:q=>O(q.target.value),className:"w-full pl-9 pr-3 py-2 text-xs font-mono font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"})]}),S.jsxs("button",{onClick:U,disabled:!M.trim()||!C.trim()||r.isPending,className:"w-full py-2 bg-primary text-primary-foreground text-[10px] font-black uppercase tracking-widest rounded-lg hover:bg-primary/90 transition-all flex items-center justify-center gap-2",children:[r.isPending?S.jsx(Jc,{className:"w-3.5 h-3.5 animate-spin"}):S.jsx(Wc,{className:"w-3.5 h-3.5"}),"Import from URL"]})]}):S.jsxs("label",{className:"flex flex-col items-center justify-center p-8 border-2 border-dashed border-border/60 rounded-xl hover:border-primary/40 hover:bg-primary/5 transition-all cursor-pointer group",children:[S.jsx(J3,{className:"w-8 h-8 text-muted-foreground/40 group-hover:text-primary transition-colors mb-2"}),S.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground group-hover:text-primary",children:"Click to select file"}),S.jsx("input",{type:"file",accept:".json,.yaml,.yml",className:"hidden",onChange:q=>{const ee=q.target.files?.[0];ee&&Y(ee)}})]})]}):S.jsxs("div",{className:"space-y-1",children:[t?.length===0&&S.jsxs("div",{className:"py-10 text-center px-6 space-y-2",children:[S.jsx(Kc,{className:"w-8 h-8 mx-auto text-muted-foreground opacity-20"}),S.jsx("p",{className:"text-[11px] font-bold text-muted-foreground/60 leading-tight",children:"No specifications yet. Import one to start intercepting."})]}),t?.map(q=>S.jsxs("div",{className:"space-y-1",children:[S.jsxs("div",{className:Be("group flex items-center gap-3 px-3 py-2.5 text-sm rounded-lg transition-all border border-transparent cursor-pointer relative overflow-hidden",q.active?"bg-primary/10 border-primary/20 shadow-sm ring-1 ring-primary/5":"text-muted-foreground/60 hover:bg-accent/40"),onClick:()=>e.mutate(q.id),children:[S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:Be("font-black truncate text-xs uppercase tracking-tight",q.active?"text-foreground":"text-muted-foreground"),children:q.name}),q.active&&S.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary shadow-[0_0_8px_rgba(var(--color-primary),0.5)]"})]}),S.jsxs("p",{className:"text-[10px] font-bold opacity-40 truncate leading-none mt-1",children:[q.metadata.title," (v",q.metadata.version,")"]})]}),S.jsxs("div",{className:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[S.jsx("button",{onClick:ee=>{ee.stopPropagation(),b(y===q.id?null:q.id),V(q.upstreamUrl)},className:"p-1.5 text-muted-foreground hover:text-primary rounded-md hover:bg-primary/10 transition-all",title:"Configure",children:S.jsx(hN,{className:"w-3.5 h-3.5"})}),S.jsx("button",{onClick:ee=>{ee.stopPropagation(),confirm(`Delete spec "${q.name}"?`)&&i.mutate(q.id)},className:"p-1.5 text-muted-foreground hover:text-destructive rounded-md hover:bg-destructive/10 transition-all",title:"Delete",children:S.jsx(ua,{className:"w-3.5 h-3.5"})})]})]}),y===q.id&&S.jsxs("div",{className:"mx-2 p-3 rounded-xl bg-muted/40 border border-border/40 space-y-3 animate-in slide-in-from-top-2 duration-200 shadow-inner",children:[S.jsxs("div",{className:"space-y-1.5",children:[S.jsx("label",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Upstream URL"}),S.jsxs("div",{className:"flex gap-2",children:[S.jsx("input",{autoFocus:!0,type:"url",value:D,onChange:ee=>V(ee.target.value),className:"flex-1 px-3 py-1.5 text-[11px] font-mono font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),S.jsx("button",{onClick:()=>Z(q.id),className:"p-1.5 bg-primary/10 text-primary rounded-lg hover:bg-primary hover:text-primary-foreground transition-all",children:S.jsx(Wc,{className:"w-4 h-4"})})]})]}),S.jsxs("div",{className:"flex items-center justify-between gap-3 pt-1",children:[S.jsxs("button",{onClick:()=>J(q),disabled:a.isPending,className:"flex-1 flex items-center justify-center gap-2 py-1.5 bg-muted border border-border/60 text-[9px] font-black uppercase tracking-widest rounded-lg hover:bg-accent transition-all",children:[a.isPending?S.jsx(Jc,{className:"w-3 h-3 animate-spin"}):S.jsx(oN,{className:"w-3 h-3"}),"Reimport"]}),S.jsx("button",{onClick:()=>b(null),className:"px-3 py-1.5 text-[9px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]})]},q.id))]})}),S.jsx("div",{className:"border-t border-border mt-1.5 pt-2 px-3 pb-1",children:S.jsxs("div",{className:"flex items-center justify-between text-[9px] font-black text-muted-foreground/40 uppercase tracking-[0.2em]",children:[S.jsxs("span",{children:["Total: ",t?.length??0]}),S.jsxs("span",{className:"text-primary/60",children:[ce.length," Active"]})]})})]})]})}const Qw=N.createContext(void 0);function O4(){const t=N.useContext(Qw);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}const Yw="/assets/logo-full-DJtzE5xc.png",E4="#181717",N4=N.forwardRef(function({title:e="GitHub",color:i="currentColor",size:n=24,...r},o){return i==="default"&&(i=E4),S.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,fill:i,viewBox:"0 0 24 24",ref:o,...r,children:[S.jsx("title",{children:e}),S.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})});function R4({open:t,onClose:e}){const i=pt(),{data:n}=jr({queryKey:["config"],queryFn:Fe.config.get}),{data:r}=jr({queryKey:["health"],queryFn:Fe.health}),{data:o}=tw(),a=$N(),[c,h]=N.useState("config"),[d,p]=N.useState(4e3),[y,b]=N.useState(!1),[x,w]=N.useState("");N.useEffect(()=>{n&&p(n.proxyPort)},[n]),N.useEffect(()=>{o&&w(o.name)},[o]);const C=Nt({mutationFn:()=>Fe.config.update({proxyPort:d}),onSuccess:()=>{i.invalidateQueries({queryKey:["config"]}),e()}}),k=async()=>{const D=await Fe.config.export(),V=new Blob([JSON.stringify(D,null,2)],{type:"application/json"}),H=URL.createObjectURL(V),Y=document.createElement("a");Y.href=H,Y.download=`interceptr-config-${new Date().toISOString().slice(0,10)}.json`,Y.click(),URL.revokeObjectURL(H)},M=async D=>{const V=await D.text(),H=JSON.parse(V);await Fe.config.import(H),i.invalidateQueries()},O=()=>{!o||!x.trim()||a.mutate({id:o.id,name:x.trim()},{onSuccess:()=>b(!1)})};return t?S.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[S.jsx("div",{className:"absolute inset-0 bg-background/60 backdrop-blur-md",onClick:e}),S.jsxs("div",{className:"relative w-full max-w-xl bg-card border border-border/60 shadow-2xl rounded-3xl overflow-hidden flex flex-col max-h-[90vh]",children:[S.jsxs("div",{className:"px-6 py-4 border-b border-border/40 bg-muted flex items-center justify-between shrink-0",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(cN,{className:"w-4 h-4 text-primary"}),S.jsx("h2",{className:"text-[10px] font-black uppercase tracking-[0.2em] text-foreground/80",children:"System Control"})]}),S.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors duration-75",children:S.jsx(ca,{className:"w-4 h-4"})})]}),S.jsxs("div",{className:"flex border-b border-border/20 bg-muted/30 shrink-0 px-4",children:[S.jsx("button",{onClick:()=>h("config"),className:Be("px-4 py-3 text-[10px] font-black uppercase tracking-widest border-b-2 transition-all duration-75",c==="config"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Configuration"}),S.jsx("button",{onClick:()=>h("about"),className:Be("px-4 py-3 text-[10px] font-black uppercase tracking-widest border-b-2 transition-all duration-75",c==="about"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"About"})]}),S.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:c==="config"?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center gap-2 px-1",children:[S.jsx(mN,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),S.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Project Identity"})]}),o&&S.jsx("div",{className:"space-y-3",children:y?S.jsxs("div",{className:"flex gap-2",children:[S.jsx("input",{autoFocus:!0,type:"text",value:x,onChange:D=>w(D.target.value),className:"flex-1 px-4 py-2.5 text-sm font-bold rounded-xl border border-primary/20 bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),S.jsxs("div",{className:"flex items-center gap-1.5",children:[S.jsx("button",{onClick:O,className:"p-2.5 bg-success/10 text-success rounded-xl hover:bg-success hover:text-success-foreground transition-colors duration-75 shadow-sm",children:S.jsx(Wc,{className:"w-4 h-4"})}),S.jsx("button",{onClick:()=>{w(o.name),b(!1)},className:"p-2.5 bg-muted text-muted-foreground rounded-xl transition-colors duration-75",children:S.jsx(ca,{className:"w-4 h-4"})})]})]}):S.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl border border-border/40 bg-muted/10 group",children:[S.jsxs("div",{className:"flex flex-col",children:[S.jsx("span",{className:"text-sm font-black text-foreground",children:o.name}),S.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground opacity-60 uppercase mt-0.5 tracking-tighter",children:["Project ID: ",o.id]})]}),S.jsxs("button",{onClick:()=>b(!0),className:"flex items-center gap-2 px-3 py-1.5 text-[10px] font-black uppercase tracking-widest text-primary hover:bg-primary/5 rounded-lg transition-all border border-transparent hover:border-primary/20",children:[S.jsx(rN,{className:"w-3 h-3"}),"Rename"]})]})})]}),S.jsxs("div",{className:"space-y-4 pt-4 border-t border-border/40",children:[S.jsxs("div",{className:"flex items-center gap-2 px-1",children:[S.jsx(I2,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),S.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Network Environment"})]}),S.jsxs("div",{className:"flex items-center gap-4",children:[S.jsxs("div",{className:"flex-1 space-y-1",children:[S.jsx("p",{className:"text-xs font-black text-foreground uppercase tracking-tight leading-none mb-1",children:"Proxy Port"}),S.jsx("p",{className:"text-[10px] text-muted-foreground/60 font-medium",children:"Internal server interface listener port."})]}),S.jsx("input",{type:"number",value:d,onChange:D=>p(Number(D.target.value)),className:"w-32 px-4 py-2 text-sm font-mono font-black rounded-xl border border-border/60 bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner text-right"})]})]}),S.jsxs("div",{className:"space-y-4 pt-4 border-t border-border/40",children:[S.jsxs("div",{className:"flex items-center gap-2 px-1",children:[S.jsx(W3,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),S.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Data Sovereignty"})]}),S.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[S.jsxs("button",{onClick:k,className:"flex items-center justify-center gap-2.5 px-4 py-3 text-[10px] font-black uppercase tracking-widest rounded-xl border border-border/60 bg-card/40 hover:bg-accent/40 hover:border-primary/20 transition-all shadow-sm group",children:[S.jsx(X3,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors"}),"Backup"]}),S.jsxs("label",{className:"flex items-center justify-center gap-2.5 px-4 py-3 text-[10px] font-black uppercase tracking-widest rounded-xl border border-border/60 bg-card/40 hover:bg-accent/40 hover:border-primary/20 transition-all shadow-sm cursor-pointer group",children:[S.jsx(K2,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors"}),"Restore",S.jsx("input",{type:"file",accept:".json",className:"hidden",onChange:D=>{const V=D.target.files?.[0];V&&M(V)}})]})]})]})]}):S.jsxs("div",{className:"flex flex-col items-center text-center space-y-8 py-4",children:[S.jsx("div",{className:"max-w-[300px] p-4",children:S.jsx("img",{src:Yw,alt:"Interceptr Full Logo",className:"w-full h-auto object-contain"})}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("h3",{className:"text-xl font-black tracking-tighter uppercase",children:"Interceptr"}),S.jsxs("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-widest",children:["Version ",r?.version??"—"]})]}),S.jsx("div",{className:"max-w-md",children:S.jsx("p",{className:"text-sm font-medium text-muted-foreground leading-relaxed",children:"A professional-grade HTTP interception proxy and mocking tool designed specifically for modern engineering workflows."})}),S.jsxs("div",{className:"w-full grid grid-cols-1 gap-3 pt-4",children:[S.jsxs("a",{href:"https://github.com/pckhib/interceptr",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-4 rounded-2xl border border-border/60 bg-muted/10 hover:bg-primary/5 hover:border-primary/20 transition-all group",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("div",{className:"w-8 h-8 rounded-lg bg-background border border-border/40 flex items-center justify-center",children:S.jsx(N4,{className:"w-4 h-4"})}),S.jsxs("div",{className:"text-left",children:[S.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-1",children:"GitHub Repository"}),S.jsx("p",{className:"text-[11px] font-bold text-muted-foreground",children:"Contribute or report issues."})]})]}),S.jsx(xm,{className:"w-4 h-4 text-muted-foreground/40 group-hover:text-primary transition-colors"})]}),S.jsxs("a",{href:"https://github.com/pckhib",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-4 rounded-2xl border border-border/60 bg-muted/10 hover:bg-primary/5 hover:border-primary/20 transition-all group",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("div",{className:"w-8 h-8 rounded-lg bg-background border border-border/40 flex items-center justify-center",children:S.jsx(Q2,{className:"w-4 h-4 text-primary"})}),S.jsxs("div",{className:"text-left",children:[S.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-1",children:"Developer"}),S.jsx("p",{className:"text-[11px] font-bold text-muted-foreground",children:"Patrick Hieber"})]})]}),S.jsx(xm,{className:"w-4 h-4 text-muted-foreground/40 group-hover:text-primary transition-colors"})]})]}),S.jsx("p",{className:"text-[9px] font-black text-muted-foreground/40 uppercase tracking-[0.3em] pt-4",children:"API Simulation Made Simple."})]})}),S.jsx("div",{className:"p-4 border-t border-border/40 bg-muted flex justify-end gap-3 px-6 shrink-0",children:c==="config"?S.jsxs(S.Fragment,{children:[S.jsx("button",{onClick:e,className:"px-6 py-2.5 text-[10px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors duration-75",children:"Cancel"}),S.jsx("button",{onClick:()=>C.mutate(),className:"px-6 py-2.5 text-[10px] font-black uppercase tracking-widest bg-primary text-primary-foreground rounded-xl hover:bg-primary/90 transition-all shadow-md active:scale-95",children:"Persist Settings"})]}):S.jsx("button",{onClick:e,className:"px-8 py-2.5 text-[10px] font-black uppercase tracking-widest bg-foreground text-background rounded-xl hover:opacity-90 transition-all shadow-md active:scale-95",children:"Close"})})]})]}):null}function D4(){const{theme:t,toggleTheme:e}=O4(),{data:i}=V3(),n=I3(),r=Q3(),[o,a]=N.useState(!1),c=i?.running??!1,h=n.isPending||r.isPending;return S.jsxs(S.Fragment,{children:[S.jsxs("header",{className:"h-14 border-b-2 border-border/60 bg-card header-gradient flex items-center justify-between px-4 shrink-0 z-50 relative",children:[S.jsx("div",{className:"absolute top-0 left-0 right-0 h-[1px] bg-white/5"}),S.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[S.jsx("div",{className:"flex items-center group cursor-pointer h-8",children:S.jsx("img",{src:Yw,alt:"Interceptr",className:"h-7 w-auto object-contain transition-transform duration-75 group-hover:scale-105"})}),S.jsx("div",{className:"h-6 w-px bg-border/40 mx-1 hidden sm:block"}),S.jsx(tR,{}),S.jsx(T4,{})]}),S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsxs("div",{className:Be("hidden md:flex items-center gap-2 px-3 py-1.5 rounded-full border text-[10px] font-black uppercase tracking-widest transition-all duration-300",c?"bg-success/10 border-success/30 text-success shadow-[0_0_10px_-2px_rgba(34,197,94,0.3)]":"bg-muted border-border text-muted-foreground/60"),children:[S.jsx("div",{className:Be("w-2 h-2 rounded-full",c?"bg-success animate-pulse":"bg-muted-foreground/20")}),S.jsx("span",{children:c?`:${i?.port}`:"Offline"})]}),S.jsxs("button",{onClick:()=>c?r.mutate():n.mutate(),disabled:h,className:Be("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[10px] font-black uppercase tracking-widest transition-all shadow-sm border",c?"bg-destructive/10 border-destructive/20 text-destructive hover:bg-destructive hover:text-destructive-foreground":"bg-primary border-primary/20 text-primary-foreground hover:bg-primary/90",h&&"opacity-50 cursor-not-allowed"),children:[S.jsx(sN,{className:"w-3.5 h-3.5"}),S.jsx("span",{className:"hidden lg:inline",children:c?"Stop":"Start"})]}),S.jsx("div",{className:"h-6 w-px bg-border/40 mx-1"}),S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-all",title:"Toggle theme",children:t==="dark"?S.jsx(dN,{className:"w-4 h-4"}):S.jsx(nN,{className:"w-4 h-4"})}),S.jsx("button",{onClick:()=>a(!0),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-all",title:"Settings",children:S.jsx(fN,{className:"w-4 h-4"})})]})]})]}),S.jsx(R4,{open:o,onClose:()=>a(!1)})]})}function j4(){const[t,e]=N.useState(()=>typeof window<"u"&&localStorage.getItem("theme")||"dark");N.useEffect(()=>{const n=window.document.documentElement;n.classList.remove("light","dark"),n.classList.add(t),localStorage.setItem("theme",t)},[t]);const i=()=>e(n=>n==="light"?"dark":"light");return S.jsx(Qw.Provider,{value:{theme:t,toggleTheme:i},children:S.jsxs("div",{className:"flex flex-col h-screen overflow-hidden bg-background text-foreground",children:[S.jsx(D4,{}),S.jsx("main",{className:"flex-1 overflow-hidden relative",children:S.jsx(kE,{})})]})})}function Gw(){return jr({queryKey:["endpoints"],queryFn:Fe.endpoints.list})}function L4(){const t=pt();return Nt({mutationFn:({id:e,config:i})=>Fe.endpoints.update(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}function Kw(){const t=pt();return Nt({mutationFn:e=>Fe.endpoints.bulkUpdate(e),onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}const B4={GET:"text-emerald-400 bg-emerald-400/10 border-emerald-400/30 shadow-[0_0_10px_-3px_rgba(52,211,153,0.3)]",POST:"text-blue-400 bg-blue-400/10 border-blue-400/30 shadow-[0_0_10px_-3px_rgba(96,165,250,0.3)]",PUT:"text-amber-400 bg-amber-400/10 border-amber-400/30 shadow-[0_0_10px_-3px_rgba(251,191,36,0.3)]",PATCH:"text-orange-400 bg-orange-400/10 border-orange-400/30 shadow-[0_0_10px_-3px_rgba(251,146,60,0.3)]",DELETE:"text-rose-400 bg-rose-400/10 border-rose-400/30 shadow-[0_0_10px_-3px_rgba(251,113,133,0.3)]",HEAD:"text-purple-400 bg-purple-400/10 border-purple-400/30 shadow-[0_0_10px_-3px_rgba(192,132,252,0.3)]",OPTIONS:"text-slate-400 bg-slate-400/10 border-slate-400/30"};function qg({method:t}){return S.jsx("span",{className:Be("inline-flex items-center justify-center px-1.5 py-0.5 text-[10px] font-black rounded-[4px] border uppercase tracking-widest w-[52px] shrink-0 font-mono transition-all",B4[t]??"text-muted-foreground bg-muted/20 border-border"),children:t})}const z4=[{value:"passthrough",label:"Pass",icon:bm,activeClass:"bg-mode-passthrough/20 text-mode-passthrough border-mode-passthrough/30 shadow-[0_0_8px_-2px_rgba(var(--mode-passthrough),0.3)]"},{value:"delay",label:"Delay",icon:Ol,activeClass:"bg-mode-delay/20 text-mode-delay border-mode-delay/30 shadow-[0_0_8px_-2px_rgba(var(--mode-delay),0.3)]"},{value:"mock",label:"Mock",icon:Z3,activeClass:"bg-mode-mock/20 text-mode-mock border-mode-mock/30 shadow-[0_0_8px_-2px_rgba(var(--mode-mock),0.3)]"}];function _4({value:t,onChange:e}){return S.jsx("div",{className:"inline-flex rounded-lg border border-border/60 bg-muted/30 p-1 shadow-inner backdrop-blur-sm",children:z4.map(({value:i,label:n,icon:r,activeClass:o})=>S.jsxs("button",{onClick:()=>e(i),className:Be("flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-black uppercase tracking-widest rounded-md transition-all duration-200 border border-transparent",t===i?Be("font-bold",o):"text-muted-foreground/60 hover:text-foreground hover:bg-white/5"),children:[S.jsx(r,{className:Be("w-3.5 h-3.5",t===i?"animate-in zoom-in-75 duration-300":"opacity-50")}),S.jsx("span",{className:"hidden sm:inline",children:n})]},i))})}function H4({delay:t,onChange:e}){const[i,n]=N.useState(t.ms),[r,o]=N.useState(t.jitterMs??0);N.useEffect(()=>{n(t.ms),o(t.jitterMs??0)},[t.ms,t.jitterMs]);const a=()=>{e({ms:i,jitterMs:r||void 0})};return S.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 max-w-2xl py-2",children:[S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-bold text-muted-foreground uppercase tracking-widest",children:[S.jsx(Ol,{className:"w-3.5 h-3.5 text-mode-delay"}),"Base Delay"]}),S.jsxs("div",{className:"flex items-center gap-1.5",children:[S.jsx("input",{type:"number",value:i,onChange:c=>n(Number(c.target.value)),onBlur:a,className:"w-20 px-2 py-1 text-xs font-mono font-bold bg-background border border-border/60 rounded-md focus:ring-1 focus:ring-mode-delay focus:border-mode-delay outline-none text-right"}),S.jsx("span",{className:"text-[10px] font-bold text-muted-foreground",children:"ms"})]})]}),S.jsx("input",{type:"range",min:0,max:1e4,step:50,value:i,onChange:c=>n(Number(c.target.value)),onMouseUp:a,className:"w-full accent-mode-delay h-4 bg-transparent cursor-pointer"}),S.jsxs("div",{className:"flex justify-between text-[9px] font-bold text-muted-foreground/40 uppercase tracking-tighter",children:[S.jsx("span",{children:"0ms"}),S.jsx("span",{children:"5,000ms"}),S.jsx("span",{children:"10,000ms"})]})]}),S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-bold text-muted-foreground uppercase tracking-widest",children:[S.jsx(Dg,{className:"w-3.5 h-3.5 text-mode-delay/60"}),"Jitter (±)"]}),S.jsxs("div",{className:"flex items-center gap-1.5",children:[S.jsx("input",{type:"number",value:r,onChange:c=>o(Number(c.target.value)),onBlur:a,className:"w-16 px-2 py-1 text-xs font-mono font-bold bg-background border border-border/60 rounded-md focus:ring-1 focus:ring-mode-delay/40 focus:border-mode-delay/40 outline-none text-right"}),S.jsx("span",{className:"text-[10px] font-bold text-muted-foreground",children:"ms"})]})]}),S.jsx("input",{type:"range",min:0,max:2e3,step:10,value:r,onChange:c=>o(Number(c.target.value)),onMouseUp:a,className:"w-full accent-mode-delay/60 h-4 bg-transparent cursor-pointer"}),S.jsxs("div",{className:"flex justify-between text-[9px] font-bold text-muted-foreground/40 uppercase tracking-tighter",children:[S.jsx("span",{children:"0ms"}),S.jsx("span",{children:"1,000ms"}),S.jsx("span",{children:"2,000ms"})]})]})]})}function Mm(){return Mm=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},Mm.apply(null,arguments)}function U4(t,e){if(t==null)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;i[n]=t[n]}return i}let Tm=[],Ww=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,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,i=0;e<t.length;e++)(e%2?Ww:Tm).push(i=i+t[e])})();function q4(t){if(t<768)return!1;for(let e=0,i=Tm.length;;){let n=e+i>>1;if(t<Tm[n])i=n;else if(t>=Ww[n])e=n+1;else return!0;if(e==i)return!1}}function gv(t){return t>=127462&&t<=127487}const yv=8205;function P4(t,e,i=!0,n=!0){return(i?Xw:F4)(t,e,n)}function Xw(t,e,i){if(e==t.length)return e;e&&Zw(t.charCodeAt(e))&&Jw(t.charCodeAt(e-1))&&e--;let n=Np(t,e);for(e+=bv(n);e<t.length;){let r=Np(t,e);if(n==yv||r==yv||i&&q4(r))e+=bv(r),n=r;else if(gv(r)){let o=0,a=e-2;for(;a>=0&&gv(Np(t,a));)o++,a-=2;if(o%2==0)break;e+=2}else break}return e}function F4(t,e,i){for(;e>0;){let n=Xw(t,e-2,i);if(n<e)return n;e--}return 0}function Np(t,e){let i=t.charCodeAt(e);if(!Jw(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return Zw(n)?(i-55296<<10)+(n-56320)+65536:i}function Zw(t){return t>=56320&&t<57344}function Jw(t){return t>=55296&&t<56320}function bv(t){return t<65536?1:2}class Ue{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,i,n){[e,i]=Nl(this,e,i);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(i,this.length,r,1),fn.from(r,this.length-(i-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=Nl(this,e,i);let n=[];return this.decompose(e,i,n,0),fn.from(n,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new $o(this),o=new $o(e);for(let a=i,c=i;;){if(r.next(a),o.next(a),a=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(c+=r.value.length,r.done||c>=n)return!0}}iter(e=1){return new $o(this,e)}iterRange(e,i=this.length){return new $w(this,e,i)}iterLines(e,i){let n;if(e==null)n=this.iter();else{i==null&&(i=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new eC(n)}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]?Ue.empty:e.length<=32?new ft(e):fn.from(ft.split(e,[]))}}class ft extends Ue{constructor(e,i=V4(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,n,r){for(let o=0;;o++){let a=this.text[o],c=r+a.length;if((i?n:c)>=e)return new I4(r,c,n,a);r=c+1,n++}}decompose(e,i,n,r){let o=e<=0&&i>=this.length?this:new ft(xv(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(r&1){let a=n.pop(),c=zc(o.text,a.text.slice(),0,o.length);if(c.length<=32)n.push(new ft(c,a.length+o.length));else{let h=c.length>>1;n.push(new ft(c.slice(0,h)),new ft(c.slice(h)))}}else n.push(o)}replace(e,i,n){if(!(n instanceof ft))return super.replace(e,i,n);[e,i]=Nl(this,e,i);let r=zc(this.text,zc(n.text,xv(this.text,0,e)),i),o=this.length+n.length-(i-e);return r.length<=32?new ft(r,o):fn.from(ft.split(r,[]),o)}sliceString(e,i=this.length,n=`
43
+ `){[e,i]=Nl(this,e,i);let r="";for(let o=0,a=0;o<=i&&a<this.text.length;a++){let c=this.text[a],h=o+c.length;o>e&&a&&(r+=n),e<h&&i>o&&(r+=c.slice(Math.max(0,e-o),i-o)),o=h+1}return r}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let n=[],r=-1;for(let o of e)n.push(o),r+=o.length+1,n.length==32&&(i.push(new ft(n,r)),n=[],r=-1);return r>-1&&i.push(new ft(n,r)),i}}class fn extends Ue{constructor(e,i){super(),this.children=e,this.length=i,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,i,n,r){for(let o=0;;o++){let a=this.children[o],c=r+a.length,h=n+a.lines-1;if((i?h:c)>=e)return a.lineInner(e,i,n,r);r=c+1,n=h+1}}decompose(e,i,n,r){for(let o=0,a=0;a<=i&&o<this.children.length;o++){let c=this.children[o],h=a+c.length;if(e<=h&&i>=a){let d=r&((a<=e?1:0)|(h>=i?2:0));a>=e&&h<=i&&!d?n.push(c):c.decompose(e-a,i-a,n,d)}a=h+1}}replace(e,i,n){if([e,i]=Nl(this,e,i),n.lines<this.lines)for(let r=0,o=0;r<this.children.length;r++){let a=this.children[r],c=o+a.length;if(e>=o&&i<=c){let h=a.replace(e-o,i-o,n),d=this.lines-a.lines+h.lines;if(h.lines<d>>4&&h.lines>d>>6){let p=this.children.slice();return p[r]=h,new fn(p,this.length-(i-e)+n.length)}return super.replace(o,c,h)}o=c+1}return super.replace(e,i,n)}sliceString(e,i=this.length,n=`
44
+ `){[e,i]=Nl(this,e,i);let r="";for(let o=0,a=0;o<this.children.length&&a<=i;o++){let c=this.children[o],h=a+c.length;a>e&&o&&(r+=n),e<h&&i>a&&(r+=c.sliceString(e-a,i-a,n)),a=h+1}return r}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof fn))return 0;let n=0,[r,o,a,c]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=i,o+=i){if(r==a||o==c)return n;let h=this.children[r],d=e.children[o];if(h!=d)return n+h.scanIdentical(d,i);n+=h.length+1}}static from(e,i=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let x of e)n+=x.lines;if(n<32){let x=[];for(let w of e)w.flatten(x);return new ft(x,i)}let r=Math.max(32,n>>5),o=r<<1,a=r>>1,c=[],h=0,d=-1,p=[];function y(x){let w;if(x.lines>o&&x instanceof fn)for(let C of x.children)y(C);else x.lines>a&&(h>a||!h)?(b(),c.push(x)):x instanceof ft&&h&&(w=p[p.length-1])instanceof ft&&x.lines+w.lines<=32?(h+=x.lines,d+=x.length+1,p[p.length-1]=new ft(w.text.concat(x.text),w.length+1+x.length)):(h+x.lines>r&&b(),h+=x.lines,d+=x.length+1,p.push(x))}function b(){h!=0&&(c.push(p.length==1?p[0]:fn.from(p,d)),d=-1,h=p.length=0)}for(let x of e)y(x);return b(),c.length==1?c[0]:new fn(c,i)}}Ue.empty=new ft([""],0);function V4(t){let e=-1;for(let i of t)e+=i.length+1;return e}function zc(t,e,i=0,n=1e9){for(let r=0,o=0,a=!0;o<t.length&&r<=n;o++){let c=t[o],h=r+c.length;h>=i&&(h>n&&(c=c.slice(0,n-r)),r<i&&(c=c.slice(i-r)),a?(e[e.length-1]+=c,a=!1):e.push(c)),r=h+1}return e}function xv(t,e,i){return zc(t,[""],e,i)}class $o{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof ft?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],o=this.offsets[n],a=o>>1,c=r instanceof ft?r.text.length:r.children.length;if(a==(i>0?c:0)){if(n==0)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(i>0?0:1)){if(this.offsets[n]+=i,e==0)return this.lineBreak=!0,this.value=`
45
+ `,this;e--}else if(r instanceof ft){let h=r.text[a+(i<0?-1:0)];if(this.offsets[n]+=i,h.length>Math.max(0,e))return this.value=e==0?h:i>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=r.children[a+(i<0?-1:0)];e>h.length?(e-=h.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(i>0?1:(h instanceof ft?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class $w{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new $o(e,i>n?-1:1),this.pos=i>n?e.length:0,this.from=Math.min(i,n),this.to=Math.max(i,n)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let n=i<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*i,this.value=r.length<=n?r:i<0?r.slice(r.length-n):r.slice(0,n),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 eC{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:n,value:r}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Ue.prototype[Symbol.iterator]=function(){return this.iter()},$o.prototype[Symbol.iterator]=$w.prototype[Symbol.iterator]=eC.prototype[Symbol.iterator]=function(){return this});class I4{constructor(e,i,n,r){this.from=e,this.to=i,this.number=n,this.text=r}get length(){return this.to-this.from}}function Nl(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function Et(t,e,i=!0,n=!0){return P4(t,e,i,n)}function Q4(t){return t>=56320&&t<57344}function Y4(t){return t>=55296&&t<56320}function li(t,e){let i=t.charCodeAt(e);if(!Y4(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return Q4(n)?(i-55296<<10)+(n-56320)+65536:i}function Pg(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function dn(t){return t<65536?1:2}const Om=/\r\n?|\n/;var Zt=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Zt||(Zt={}));class vn{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i+1];e+=n<0?this.sections[i]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,n=0,r=0;i<this.sections.length;){let o=this.sections[i++],a=this.sections[i++];a<0?(e(n,r,o),r+=o):r+=a,n+=o}}iterChangedRanges(e,i=!1){Em(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];r<0?e.push(n,r):e.push(r,n)}return new vn(e)}composeDesc(e){return this.empty?e:e.empty?this:tC(this,e)}mapDesc(e,i=!1){return e.empty?this:Nm(this,e,i)}mapPos(e,i=-1,n=Zt.Simple){let r=0,o=0;for(let a=0;a<this.sections.length;){let c=this.sections[a++],h=this.sections[a++],d=r+c;if(h<0){if(d>e)return o+(e-r);o+=c}else{if(n!=Zt.Simple&&d>=e&&(n==Zt.TrackDel&&r<e&&d>e||n==Zt.TrackBefore&&r<e||n==Zt.TrackAfter&&d>e))return null;if(d>e||d==e&&i<0&&!c)return e==r||i<0?o:o+h;o+=h}r=d}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return o}touchesRange(e,i=e){for(let n=0,r=0;n<this.sections.length&&r<=i;){let o=this.sections[n++],a=this.sections[n++],c=r+o;if(a>=0&&r<=i&&c>=e)return r<e&&c>i?"cover":!0;r=c}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new vn(e)}static create(e){return new vn(e)}}class wt extends vn{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Em(this,(i,n,r,o,a)=>e=e.replace(r,r+(n-i),a),!1),e}mapDesc(e,i=!1){return Nm(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,o=0;r<i.length;r+=2){let a=i[r],c=i[r+1];if(c>=0){i[r]=c,i[r+1]=a;let h=r>>1;for(;n.length<h;)n.push(Ue.empty);n.push(a?e.slice(o,o+a):Ue.empty)}o+=a}return new wt(i,n)}compose(e){return this.empty?e:e.empty?this:tC(this,e,!0)}map(e,i=!1){return e.empty?this:Nm(this,e,i,!0)}iterChanges(e,i=!1){Em(this,e,i)}get desc(){return vn.create(this.sections)}filter(e){let i=[],n=[],r=[],o=new ma(this);e:for(let a=0,c=0;;){let h=a==e.length?1e9:e[a++];for(;c<h||c==h&&o.len==0;){if(o.done)break e;let p=Math.min(o.len,h-c);Pt(r,p,-1);let y=o.ins==-1?-1:o.off==0?o.ins:0;Pt(i,p,y),y>0&&Or(n,i,o.text),o.forward(p),c+=p}let d=e[a++];for(;c<d;){if(o.done)break e;let p=Math.min(o.len,d-c);Pt(i,p,-1),Pt(r,p,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(p),c+=p}}return{changes:new wt(i,n),filtered:vn.create(r)}}toJSON(){let e=[];for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i],r=this.sections[i+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[i>>1].toJSON()))}return e}static of(e,i,n){let r=[],o=[],a=0,c=null;function h(p=!1){if(!p&&!r.length)return;a<i&&Pt(r,i-a,-1);let y=new wt(r,o);c=c?c.compose(y.map(c)):y,r=[],o=[],a=0}function d(p){if(Array.isArray(p))for(let y of p)d(y);else if(p instanceof wt){if(p.length!=i)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${i})`);h(),c=c?c.compose(p.map(c)):p}else{let{from:y,to:b=y,insert:x}=p;if(y>b||y<0||b>i)throw new RangeError(`Invalid change range ${y} to ${b} (in doc of length ${i})`);let w=x?typeof x=="string"?Ue.of(x.split(n||Om)):x:Ue.empty,C=w.length;if(y==b&&C==0)return;y<a&&h(),y>a&&Pt(r,y-a,-1),Pt(r,b-y,C),Or(o,r,w),a=b}}return d(e),h(!c),c}static empty(e){return new wt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let r=0;r<e.length;r++){let o=e[r];if(typeof o=="number")i.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((a,c)=>c&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)i.push(o[0],0);else{for(;n.length<r;)n.push(Ue.empty);n[r]=Ue.of(o.slice(1)),i.push(o[0],n[r].length)}}}return new wt(i,n)}static createSet(e,i){return new wt(e,i)}}function Pt(t,e,i,n=!1){if(e==0&&i<=0)return;let r=t.length-2;r>=0&&i<=0&&i==t[r+1]?t[r]+=e:r>=0&&e==0&&t[r]==0?t[r+1]+=i:n?(t[r]+=e,t[r+1]+=i):t.push(e,i)}function Or(t,e,i){if(i.length==0)return;let n=e.length-2>>1;if(n<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<n;)t.push(Ue.empty);t.push(i)}}function Em(t,e,i){let n=t.inserted;for(let r=0,o=0,a=0;a<t.sections.length;){let c=t.sections[a++],h=t.sections[a++];if(h<0)r+=c,o+=c;else{let d=r,p=o,y=Ue.empty;for(;d+=c,p+=h,h&&n&&(y=y.append(n[a-2>>1])),!(i||a==t.sections.length||t.sections[a+1]<0);)c=t.sections[a++],h=t.sections[a++];e(r,d,o,p,y),r=d,o=p}}}function Nm(t,e,i,n=!1){let r=[],o=n?[]:null,a=new ma(t),c=new ma(e);for(let h=-1;;){if(a.done&&c.len||c.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&c.ins==-1){let d=Math.min(a.len,c.len);Pt(r,d,-1),a.forward(d),c.forward(d)}else if(c.ins>=0&&(a.ins<0||h==a.i||a.off==0&&(c.len<a.len||c.len==a.len&&!i))){let d=c.len;for(Pt(r,c.ins,-1);d;){let p=Math.min(a.len,d);a.ins>=0&&h<a.i&&a.len<=p&&(Pt(r,0,a.ins),o&&Or(o,r,a.text),h=a.i),a.forward(p),d-=p}c.next()}else if(a.ins>=0){let d=0,p=a.len;for(;p;)if(c.ins==-1){let y=Math.min(p,c.len);d+=y,p-=y,c.forward(y)}else if(c.ins==0&&c.len<p)p-=c.len,c.next();else break;Pt(r,d,h<a.i?a.ins:0),o&&h<a.i&&Or(o,r,a.text),h=a.i,a.forward(a.len-p)}else{if(a.done&&c.done)return o?wt.createSet(r,o):vn.create(r);throw new Error("Mismatched change set lengths")}}}function tC(t,e,i=!1){let n=[],r=i?[]:null,o=new ma(t),a=new ma(e);for(let c=!1;;){if(o.done&&a.done)return r?wt.createSet(n,r):vn.create(n);if(o.ins==0)Pt(n,o.len,0,c),o.next();else if(a.len==0&&!a.done)Pt(n,0,a.ins,c),r&&Or(r,n,a.text),a.next();else{if(o.done||a.done)throw new Error("Mismatched change set lengths");{let h=Math.min(o.len2,a.len),d=n.length;if(o.ins==-1){let p=a.ins==-1?-1:a.off?0:a.ins;Pt(n,h,p,c),r&&p&&Or(r,n,a.text)}else a.ins==-1?(Pt(n,o.off?0:o.len,h,c),r&&Or(r,n,o.textBit(h))):(Pt(n,o.off?0:o.len,a.off?0:a.ins,c),r&&!a.off&&Or(r,n,a.text));c=(o.ins>h||a.ins>=0&&a.len>h)&&(c||n.length>d),o.forward2(h),a.forward(h)}}}}class ma{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,i=this.i-2>>1;return i>=e.length?Ue.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?Ue.empty:i[n].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 ds{constructor(e,i,n){this.from=e,this.to=i,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,i=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,i):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new ds(n,r,this.flags)}extend(e,i=e){if(e<=this.anchor&&i>=this.anchor)return W.range(e,i);let n=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return W.range(this.anchor,n)}eq(e,i=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!i||!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 W.range(e.anchor,e.head)}static create(e,i,n){return new ds(e,i,n)}}class W{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:W.create(this.ranges.map(n=>n.map(e,i)),this.mainIndex)}eq(e,i=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],i))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new W([this.main],0)}addRange(e,i=!0){return W.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let n=this.ranges.slice();return n[i]=e,W.create(n,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 W(e.ranges.map(i=>ds.fromJSON(i)),e.main)}static single(e,i=e){return new W([W.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let o=e[r];if(o.empty?o.from<=n:o.from<n)return W.normalized(e.slice(),i);n=o.to}return new W(e,i)}static cursor(e,i=0,n,r){return ds.create(e,e,(i==0?0:i<0?8:16)|(n==null?7:Math.min(6,n))|(r??16777215)<<6)}static range(e,i,n,r){let o=(n??16777215)<<6|(r==null?7:Math.min(6,r));return i<e?ds.create(i,e,48|o):ds.create(e,i,(i>e?8:0)|o)}static normalized(e,i=0){let n=e[i];e.sort((r,o)=>r.from-o.from),i=e.indexOf(n);for(let r=1;r<e.length;r++){let o=e[r],a=e[r-1];if(o.empty?o.from<=a.to:o.from<a.to){let c=a.from,h=Math.max(o.to,a.to);r<=i&&i--,e.splice(--r,2,o.anchor>o.head?W.range(h,c):W.range(c,h))}}return new W(e,i)}}function iC(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let Fg=0;class le{constructor(e,i,n,r,o){this.combine=e,this.compareInput=i,this.compare=n,this.isStatic=r,this.id=Fg++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new le(e.combine||(i=>i),e.compareInput||((i,n)=>i===n),e.compare||(e.combine?(i,n)=>i===n:Vg),!!e.static,e.enables)}of(e){return new _c([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new _c(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new _c(e,this,2,i)}from(e,i){return i||(i=n=>n),this.compute([e],n=>i(n.field(e)))}}function Vg(t,e){return t==e||t.length==e.length&&t.every((i,n)=>i===e[n])}class _c{constructor(e,i,n,r){this.dependencies=e,this.facet=i,this.type=n,this.value=r,this.id=Fg++}dynamicSlot(e){var i;let n=this.value,r=this.facet.compareInput,o=this.id,a=e[o]>>1,c=this.type==2,h=!1,d=!1,p=[];for(let y of this.dependencies)y=="doc"?h=!0:y=="selection"?d=!0:(((i=e[y.id])!==null&&i!==void 0?i:1)&1)==0&&p.push(e[y.id]);return{create(y){return y.values[a]=n(y),1},update(y,b){if(h&&b.docChanged||d&&(b.docChanged||b.selection)||Rm(y,p)){let x=n(y);if(c?!vv(x,y.values[a],r):!r(x,y.values[a]))return y.values[a]=x,1}return 0},reconfigure:(y,b)=>{let x,w=b.config.address[o];if(w!=null){let C=sh(b,w);if(this.dependencies.every(k=>k instanceof le?b.facet(k)===y.facet(k):k instanceof It?b.field(k,!1)==y.field(k,!1):!0)||(c?vv(x=n(y),C,r):r(x=n(y),C)))return y.values[a]=C,0}else x=n(y);return y.values[a]=x,1}}}}function vv(t,e,i){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!i(t[n],e[n]))return!1;return!0}function Rm(t,e){let i=!1;for(let n of e)ea(t,n)&1&&(i=!0);return i}function G4(t,e,i){let n=i.map(h=>t[h.id]),r=i.map(h=>h.type),o=n.filter(h=>!(h&1)),a=t[e.id]>>1;function c(h){let d=[];for(let p=0;p<n.length;p++){let y=sh(h,n[p]);if(r[p]==2)for(let b of y)d.push(b);else d.push(y)}return e.combine(d)}return{create(h){for(let d of n)ea(h,d);return h.values[a]=c(h),1},update(h,d){if(!Rm(h,o))return 0;let p=c(h);return e.compare(p,h.values[a])?0:(h.values[a]=p,1)},reconfigure(h,d){let p=Rm(h,n),y=d.config.facets[e.id],b=d.facet(e);if(y&&!p&&Vg(i,y))return h.values[a]=b,0;let x=c(h);return e.compare(x,b)?(h.values[a]=b,0):(h.values[a]=x,1)}}}const uc=le.define({static:!0});class It{constructor(e,i,n,r,o){this.id=e,this.createF=i,this.updateF=n,this.compareF=r,this.spec=o,this.provides=void 0}static define(e){let i=new It(Fg++,e.create,e.update,e.compare||((n,r)=>n===r),e);return e.provide&&(i.provides=e.provide(i)),i}create(e){let i=e.facet(uc).find(n=>n.field==this);return(i?.create||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:n=>(n.values[i]=this.create(n),1),update:(n,r)=>{let o=n.values[i],a=this.updateF(o,r);return this.compareF(o,a)?0:(n.values[i]=a,1)},reconfigure:(n,r)=>{let o=n.facet(uc),a=r.facet(uc),c;return(c=o.find(h=>h.field==this))&&c!=a.find(h=>h.field==this)?(n.values[i]=c.create(n),1):r.config.address[this.id]!=null?(n.values[i]=r.field(this),0):(n.values[i]=this.create(n),1)}}}init(e){return[this,uc.of({field:this,create:e})]}get extension(){return this}}const cs={lowest:4,low:3,default:2,high:1,highest:0};function Vo(t){return e=>new nC(e,t)}const As={highest:Vo(cs.highest),high:Vo(cs.high),default:Vo(cs.default),low:Vo(cs.low),lowest:Vo(cs.lowest)};class nC{constructor(e,i){this.inner=e,this.prec=i}}class zh{of(e){return new Dm(this,e)}reconfigure(e){return zh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Dm{constructor(e,i){this.compartment=e,this.inner=i}}class rh{constructor(e,i,n,r,o,a){for(this.base=e,this.compartments=i,this.dynamicSlots=n,this.address=r,this.staticValues=o,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let i=this.address[e.id];return i==null?e.default:this.staticValues[i>>1]}static resolve(e,i,n){let r=[],o=Object.create(null),a=new Map;for(let b of K4(e,i,a))b instanceof It?r.push(b):(o[b.facet.id]||(o[b.facet.id]=[])).push(b);let c=Object.create(null),h=[],d=[];for(let b of r)c[b.id]=d.length<<1,d.push(x=>b.slot(x));let p=n?.config.facets;for(let b in o){let x=o[b],w=x[0].facet,C=p&&p[b]||[];if(x.every(k=>k.type==0))if(c[w.id]=h.length<<1|1,Vg(C,x))h.push(n.facet(w));else{let k=w.combine(x.map(M=>M.value));h.push(n&&w.compare(k,n.facet(w))?n.facet(w):k)}else{for(let k of x)k.type==0?(c[k.id]=h.length<<1|1,h.push(k.value)):(c[k.id]=d.length<<1,d.push(M=>k.dynamicSlot(M)));c[w.id]=d.length<<1,d.push(k=>G4(k,w,x))}}let y=d.map(b=>b(c));return new rh(e,a,y,c,h,o)}}function K4(t,e,i){let n=[[],[],[],[],[]],r=new Map;function o(a,c){let h=r.get(a);if(h!=null){if(h<=c)return;let d=n[h].indexOf(a);d>-1&&n[h].splice(d,1),a instanceof Dm&&i.delete(a.compartment)}if(r.set(a,c),Array.isArray(a))for(let d of a)o(d,c);else if(a instanceof Dm){if(i.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;i.set(a.compartment,d),o(d,c)}else if(a instanceof nC)o(a.inner,a.prec);else if(a instanceof It)n[c].push(a),a.provides&&o(a.provides,c);else if(a instanceof _c)n[c].push(a),a.facet.extensions&&o(a.facet.extensions,cs.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,c)}}return o(t,cs.default),n.reduce((a,c)=>a.concat(c))}function ea(t,e){if(e&1)return 2;let i=e>>1,n=t.status[i];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;t.status[i]=4;let r=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|r}function sh(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const rC=le.define(),jm=le.define({combine:t=>t.some(e=>e),static:!0}),sC=le.define({combine:t=>t.length?t[0]:void 0,static:!0}),lC=le.define(),oC=le.define(),aC=le.define(),uC=le.define({combine:t=>t.length?t[0]:!1});class Sn{constructor(e,i){this.type=e,this.value=i}static define(){return new W4}}class W4{of(e){return new Sn(this,e)}}class X4{constructor(e){this.map=e}of(e){return new Se(this,e)}}class Se{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new Se(this.type,i)}is(e){return this.type==e}static define(e={}){return new X4(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let n=[];for(let r of e){let o=r.map(i);o&&n.push(o)}return n}}Se.reconfigure=Se.define();Se.appendConfig=Se.define();class At{constructor(e,i,n,r,o,a){this.startState=e,this.changes=i,this.selection=n,this.effects=r,this.annotations=o,this.scrollIntoView=a,this._doc=null,this._state=null,n&&iC(n,i.newLength),o.some(c=>c.type==At.time)||(this.annotations=o.concat(At.time.of(Date.now())))}static create(e,i,n,r,o,a){return new At(e,i,n,r,o,a)}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 i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(At.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}At.time=Sn.define();At.userEvent=Sn.define();At.addToHistory=Sn.define();At.remote=Sn.define();function Z4(t,e){let i=[];for(let n=0,r=0;;){let o,a;if(n<t.length&&(r==e.length||e[r]>=t[n]))o=t[n++],a=t[n++];else if(r<e.length)o=e[r++],a=e[r++];else return i;!i.length||i[i.length-1]<o?i.push(o,a):i[i.length-1]<a&&(i[i.length-1]=a)}}function cC(t,e,i){var n;let r,o,a;return i?(r=e.changes,o=wt.empty(e.changes.length),a=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),a=t.changes.compose(r)),{changes:a,selection:e.selection?e.selection.map(o):(n=t.selection)===null||n===void 0?void 0:n.map(r),effects:Se.mapEffects(t.effects,r).concat(Se.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Lm(t,e,i){let n=e.selection,r=Sl(e.annotations);return e.userEvent&&(r=r.concat(At.userEvent.of(e.userEvent))),{changes:e.changes instanceof wt?e.changes:wt.of(e.changes||[],i,t.facet(sC)),selection:n&&(n instanceof W?n:W.single(n.anchor,n.head)),effects:Sl(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function hC(t,e,i){let n=Lm(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(i=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(i=!1);let a=!!e[o].sequential;n=cC(n,Lm(t,e[o],a?n.changes.newLength:t.doc.length),a)}let r=At.create(t,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return $4(i?J4(r):r)}function J4(t){let e=t.startState,i=!0;for(let r of e.facet(lC)){let o=r(t);if(o===!1){i=!1;break}Array.isArray(o)&&(i=i===!0?o:Z4(i,o))}if(i!==!0){let r,o;if(i===!1)o=t.changes.invertedDesc,r=wt.empty(e.doc.length);else{let a=t.changes.filter(i);r=a.changes,o=a.filtered.mapDesc(a.changes).invertedDesc}t=At.create(e,r,t.selection&&t.selection.map(o),Se.mapEffects(t.effects,o),t.annotations,t.scrollIntoView)}let n=e.facet(oC);for(let r=n.length-1;r>=0;r--){let o=n[r](t);o instanceof At?t=o:Array.isArray(o)&&o.length==1&&o[0]instanceof At?t=o[0]:t=hC(e,Sl(o),!1)}return t}function $4(t){let e=t.startState,i=e.facet(aC),n=t;for(let r=i.length-1;r>=0;r--){let o=i[r](t);o&&Object.keys(o).length&&(n=cC(n,Lm(e,o,t.changes.newLength),!0))}return n==t?t:At.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}const e5=[];function Sl(t){return t==null?e5:Array.isArray(t)?t:[t]}var nt=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(nt||(nt={}));const t5=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Bm;try{Bm=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function i5(t){if(Bm)return Bm.test(t);for(let e=0;e<t.length;e++){let i=t[e];if(/\w/.test(i)||i>"€"&&(i.toUpperCase()!=i.toLowerCase()||t5.test(i)))return!0}return!1}function n5(t){return e=>{if(!/\S/.test(e))return nt.Space;if(i5(e))return nt.Word;for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>-1)return nt.Word;return nt.Other}}class Le{constructor(e,i,n,r,o,a){this.config=e,this.doc=i,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,a&&(a._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)ea(this,c<<1);this.computeSlot=null}field(e,i=!0){let n=this.config.address[e.id];if(n==null){if(i)throw new RangeError("Field is not present in this state");return}return ea(this,n),sh(this,n)}update(...e){return hC(this,e,!0)}applyTransaction(e){let i=this.config,{base:n,compartments:r}=i;for(let c of e.effects)c.is(zh.reconfigure)?(i&&(r=new Map,i.compartments.forEach((h,d)=>r.set(d,h)),i=null),r.set(c.value.compartment,c.value.extension)):c.is(Se.reconfigure)?(i=null,n=c.value):c.is(Se.appendConfig)&&(i=null,n=Sl(n).concat(c.value));let o;i?o=e.startState.values.slice():(i=rh.resolve(n,r,this),o=new Le(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(h,d)=>d.reconfigure(h,this),null).values);let a=e.startState.facet(jm)?e.newSelection:e.newSelection.asSingle();new Le(i,e.newDoc,a,o,(c,h)=>h.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:W.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,n=e(i.ranges[0]),r=this.changes(n.changes),o=[n.range],a=Sl(n.effects);for(let c=1;c<i.ranges.length;c++){let h=e(i.ranges[c]),d=this.changes(h.changes),p=d.map(r);for(let b=0;b<c;b++)o[b]=o[b].map(p);let y=r.mapDesc(d,!0);o.push(h.range.map(y)),r=r.compose(p),a=Se.mapEffects(a,p).concat(Se.mapEffects(Sl(h.effects),y))}return{changes:r,selection:W.create(o,i.mainIndex),effects:a}}changes(e=[]){return e instanceof wt?e:wt.of(e,this.doc.length,this.facet(Le.lineSeparator))}toText(e){return Ue.of(e.split(this.facet(Le.lineSeparator)||Om))}sliceDoc(e=0,i=this.doc.length){return this.doc.sliceString(e,i,this.lineBreak)}facet(e){let i=this.config.address[e.id];return i==null?e.default:(ea(this,i),sh(this,i))}toJSON(e){let i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof It&&this.config.address[r.id]!=null&&(i[n]=r.spec.toJSON(this.field(e[n]),this))}return i}static fromJSON(e,i={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let o in n)if(Object.prototype.hasOwnProperty.call(e,o)){let a=n[o],c=e[o];r.push(a.init(h=>a.spec.fromJSON(c,h)))}}return Le.create({doc:e.doc,selection:W.fromJSON(e.selection),extensions:i.extensions?r.concat([i.extensions]):r})}static create(e={}){let i=rh.resolve(e.extensions||[],new Map),n=e.doc instanceof Ue?e.doc:Ue.of((e.doc||"").split(i.staticFacet(Le.lineSeparator)||Om)),r=e.selection?e.selection instanceof W?e.selection:W.single(e.selection.anchor,e.selection.head):W.single(0);return iC(r,n.length),i.staticFacet(jm)||(r=r.asSingle()),new Le(i,n,r,i.dynamicSlots.map(()=>null),(o,a)=>a.create(o),null)}get tabSize(){return this.facet(Le.tabSize)}get lineBreak(){return this.facet(Le.lineSeparator)||`
46
+ `}get readOnly(){return this.facet(uC)}phrase(e,...i){for(let n of this.facet(Le.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let o=+(r||1);return!o||o>i.length?n:i[o-1]})),e}languageDataAt(e,i,n=-1){let r=[];for(let o of this.facet(rC))for(let a of o(this,i,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let i=this.languageDataAt("wordChars",e);return n5(i.length?i[0]:"")}wordAt(e){let{text:i,from:n,length:r}=this.doc.lineAt(e),o=this.charCategorizer(e),a=e-n,c=e-n;for(;a>0;){let h=Et(i,a,!1);if(o(i.slice(h,a))!=nt.Word)break;a=h}for(;c<r;){let h=Et(i,c);if(o(i.slice(c,h))!=nt.Word)break;c=h}return a==c?null:W.range(a+n,c+n)}}Le.allowMultipleSelections=jm;Le.tabSize=le.define({combine:t=>t.length?t[0]:4});Le.lineSeparator=sC;Le.readOnly=uC;Le.phrases=le.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every(r=>t[r]==e[r])}});Le.languageData=rC;Le.changeFilter=lC;Le.transactionFilter=oC;Le.transactionExtender=aC;zh.reconfigure=Se.define();function wn(t,e,i={}){let n={};for(let r of t)for(let o of Object.keys(r)){let a=r[o],c=n[o];if(c===void 0)n[o]=a;else if(!(c===a||a===void 0))if(Object.hasOwnProperty.call(i,o))n[o]=i[o](c,a);else throw new Error("Config merge conflict for field "+o)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}class Br{eq(e){return this==e}range(e,i=e){return zm.create(e,i,this)}}Br.prototype.startSide=Br.prototype.endSide=0;Br.prototype.point=!1;Br.prototype.mapMode=Zt.TrackDel;function Ig(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let zm=class fC{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new fC(e,i,n)}};function _m(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Qg{constructor(e,i,n,r){this.from=e,this.to=i,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,i,n,r=0){let o=n?this.to:this.from;for(let a=r,c=o.length;;){if(a==c)return a;let h=a+c>>1,d=o[h]-e||(n?this.value[h].endSide:this.value[h].startSide)-i;if(h==a)return d>=0?a:c;d>=0?c=h:a=h+1}}between(e,i,n,r){for(let o=this.findIndex(i,-1e9,!0),a=this.findIndex(n,1e9,!1,o);o<a;o++)if(r(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,i){let n=[],r=[],o=[],a=-1,c=-1;for(let h=0;h<this.value.length;h++){let d=this.value[h],p=this.from[h]+e,y=this.to[h]+e,b,x;if(p==y){let w=i.mapPos(p,d.startSide,d.mapMode);if(w==null||(b=x=w,d.startSide!=d.endSide&&(x=i.mapPos(p,d.endSide),x<b)))continue}else if(b=i.mapPos(p,d.startSide),x=i.mapPos(y,d.endSide),b>x||b==x&&d.startSide>0&&d.endSide<=0)continue;(x-b||d.endSide-d.startSide)<0||(a<0&&(a=b),d.point&&(c=Math.max(c,x-b)),n.push(d),r.push(b-a),o.push(x-a))}return{mapped:n.length?new Qg(r,o,n,c):null,pos:a}}}class Ne{constructor(e,i,n,r){this.chunkPos=e,this.chunk=i,this.nextLayer=n,this.maxPoint=r}static create(e,i,n,r){return new Ne(e,i,n,r)}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 i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:n=!1,filterFrom:r=0,filterTo:o=this.length}=e,a=e.filter;if(i.length==0&&!a)return this;if(n&&(i=i.slice().sort(_m)),this.isEmpty)return i.length?Ne.of(i):this;let c=new dC(this,null,-1).goto(0),h=0,d=[],p=new Kn;for(;c.value||h<i.length;)if(h<i.length&&(c.from-i[h].from||c.startSide-i[h].value.startSide)>=0){let y=i[h++];p.addInner(y.from,y.to,y.value)||d.push(y)}else c.rangeIndex==1&&c.chunkIndex<this.chunk.length&&(h==i.length||this.chunkEnd(c.chunkIndex)<i[h].from)&&(!a||r>this.chunkEnd(c.chunkIndex)||o<this.chunkPos[c.chunkIndex])&&p.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!a||r>c.to||o<c.from||a(c.from,c.to,c.value))&&(p.addInner(c.from,c.to,c.value)||d.push(zm.create(c.from,c.to,c.value))),c.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?Ne.empty:this.nextLayer.update({add:d,filter:a,filterFrom:r,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],r=-1;for(let a=0;a<this.chunk.length;a++){let c=this.chunkPos[a],h=this.chunk[a],d=e.touchesRange(c,c+h.length);if(d===!1)r=Math.max(r,h.maxPoint),i.push(h),n.push(e.mapPos(c));else if(d===!0){let{mapped:p,pos:y}=h.map(c,e);p&&(r=Math.max(r,p.maxPoint),i.push(p),n.push(y))}}let o=this.nextLayer.map(e);return i.length==0?o:new Ne(n,i,o||Ne.empty,r)}between(e,i,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let o=this.chunkPos[r],a=this.chunk[r];if(i>=o&&e<=o+a.length&&a.between(o,e-o,i-o,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return ga.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return ga.from(e).goto(i)}static compare(e,i,n,r,o=-1){let a=e.filter(y=>y.maxPoint>0||!y.isEmpty&&y.maxPoint>=o),c=i.filter(y=>y.maxPoint>0||!y.isEmpty&&y.maxPoint>=o),h=Sv(a,c,n),d=new Io(a,h,o),p=new Io(c,h,o);n.iterGaps((y,b,x)=>wv(d,y,p,b,x,r)),n.empty&&n.length==0&&wv(d,0,p,0,0,r)}static eq(e,i,n=0,r){r==null&&(r=999999999);let o=e.filter(p=>!p.isEmpty&&i.indexOf(p)<0),a=i.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(o.length!=a.length)return!1;if(!o.length)return!0;let c=Sv(o,a),h=new Io(o,c,0).goto(n),d=new Io(a,c,0).goto(n);for(;;){if(h.to!=d.to||!Hm(h.active,d.active)||h.point&&(!d.point||!Ig(h.point,d.point)))return!1;if(h.to>r)return!0;h.next(),d.next()}}static spans(e,i,n,r,o=-1){let a=new Io(e,null,o).goto(i),c=i,h=a.openStart;for(;;){let d=Math.min(a.to,n);if(a.point){let p=a.activeForPoint(a.to),y=a.pointFrom<i?p.length+1:a.point.startSide<0?p.length:Math.min(p.length,h);r.point(c,d,a.point,p,y,a.pointRank),h=Math.min(a.openEnd(d),p.length)}else d>c&&(r.span(c,d,a.active,h),h=a.openEnd(d));if(a.to>n)return h+(a.point&&a.to>n?1:0);c=a.to,a.next()}}static of(e,i=!1){let n=new Kn;for(let r of e instanceof zm?[e]:i?r5(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return Ne.empty;let i=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=Ne.empty;r=r.nextLayer)i=new Ne(r.chunkPos,r.chunk,i,Math.max(r.maxPoint,i.maxPoint));return i}}Ne.empty=new Ne([],[],null,-1);function r5(t){if(t.length>1)for(let e=t[0],i=1;i<t.length;i++){let n=t[i];if(_m(e,n)>0)return t.slice().sort(_m);e=n}return t}Ne.empty.nextLayer=Ne.empty;class Kn{finishChunk(e){this.chunks.push(new Qg(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,i,n){this.addInner(e,i,n)||(this.nextLayer||(this.nextLayer=new Kn)).add(e,i,n)}addInner(e,i,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(i-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=i,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,i-e)),!0)}addChunk(e,i){if((e-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(e);let n=i.value.length-1;return this.last=i.value[n],this.lastFrom=i.from[n]+e,this.lastTo=i.to[n]+e,!0}finish(){return this.finishInner(Ne.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let i=Ne.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,i}}function Sv(t,e,i){let n=new Map;for(let o of t)for(let a=0;a<o.chunk.length;a++)o.chunk[a].maxPoint<=0&&n.set(o.chunk[a],o.chunkPos[a]);let r=new Set;for(let o of e)for(let a=0;a<o.chunk.length;a++){let c=n.get(o.chunk[a]);c!=null&&(i?i.mapPos(c):c)==o.chunkPos[a]&&!i?.touchesRange(c,c+o.chunk[a].length)&&r.add(o.chunk[a])}return r}class dC{constructor(e,i,n,r=0){this.layer=e,this.skip=i,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,i=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,i,!1),this}gotoInner(e,i,n){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<e||r.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],i,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,i){(this.to-e||this.endSide-i)<0&&this.gotoInner(e,i,!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],i=this.layer.chunk[this.chunkIndex],n=e+i.from[this.rangeIndex];if(this.from=n,this.to=e+i.to[this.rangeIndex],this.value=i.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 ga{constructor(e){this.heap=e}static from(e,i=null,n=-1){let r=[];for(let o=0;o<e.length;o++)for(let a=e[o];!a.isEmpty;a=a.nextLayer)a.maxPoint>=n&&r.push(new dC(a,i,n,o));return r.length==1?r[0]:new ga(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,i=-1e9){for(let n of this.heap)n.goto(e,i);for(let n=this.heap.length>>1;n>=0;n--)Rp(this.heap,n);return this.next(),this}forward(e,i){for(let n of this.heap)n.forward(e,i);for(let n=this.heap.length>>1;n>=0;n--)Rp(this.heap,n);(this.to-e||this.value.endSide-i)<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(),Rp(this.heap,0)}}}function Rp(t,e){for(let i=t[e];;){let n=(e<<1)+1;if(n>=t.length)break;let r=t[n];if(n+1<t.length&&r.compare(t[n+1])>=0&&(r=t[n+1],n++),i.compare(r)<0)break;t[n]=i,t[e]=r,e=n}}class Io{constructor(e,i,n){this.minPoint=n,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=ga.from(e,i,n)}goto(e,i=-1e9){return this.cursor.goto(e,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=i,this.openStart=-1,this.next(),this}forward(e,i){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(e,i)}removeActive(e){cc(this.active,e),cc(this.activeTo,e),cc(this.activeRank,e),this.minActive=Cv(this.active,this.activeTo)}addActive(e){let i=0,{value:n,to:r,rank:o}=this.cursor;for(;i<this.activeRank.length&&(o-this.activeRank[i]||r-this.activeTo[i])>0;)i++;hc(this.active,i,n),hc(this.activeTo,i,r),hc(this.activeRank,i,o),e&&hc(e,i,this.cursor.from),this.minActive=Cv(this.active,this.activeTo)}next(){let e=this.to,i=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&cc(n,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(n),this.cursor.next();else if(i&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=o,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=o.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let r=n.length-1;r>=0&&n[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let i=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&i.push(this.active[n]);return i.reverse()}openEnd(e){let i=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)i++;return i}}function wv(t,e,i,n,r,o){t.goto(e),i.goto(n);let a=n+r,c=n,h=n-e,d=!!o.boundChange;for(let p=!1;;){let y=t.to+h-i.to,b=y||t.endSide-i.endSide,x=b<0?t.to+h:i.to,w=Math.min(x,a);if(t.point||i.point?(t.point&&i.point&&Ig(t.point,i.point)&&Hm(t.activeForPoint(t.to),i.activeForPoint(i.to))||o.comparePoint(c,w,t.point,i.point),p=!1):(p&&o.boundChange(c),w>c&&!Hm(t.active,i.active)&&o.compareRange(c,w,t.active,i.active),d&&w<a&&(y||t.openEnd(x)!=i.openEnd(x))&&(p=!0)),x>a)break;c=x,b<=0&&t.next(),b>=0&&i.next()}}function Hm(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!=e[i]&&!Ig(t[i],e[i]))return!1;return!0}function cc(t,e){for(let i=e,n=t.length-1;i<n;i++)t[i]=t[i+1];t.pop()}function hc(t,e,i){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=i}function Cv(t,e){let i=-1,n=1e9;for(let r=0;r<e.length;r++)(e[r]-n||t[r].endSide-t[i].endSide)<0&&(i=r,n=e[r]);return i}function Pl(t,e,i=t.length){let n=0;for(let r=0;r<i&&r<t.length;)t.charCodeAt(r)==9?(n+=e-n%e,r++):(n++,r=Et(t,r));return n}function Um(t,e,i,n){for(let r=0,o=0;;){if(o>=e)return r;if(r==t.length)break;o+=t.charCodeAt(r)==9?i-o%i:1,r=Et(t,r)}return n===!0?-1:t.length}const qm="ͼ",kv=typeof Symbol>"u"?"__"+qm:Symbol.for(qm),Pm=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Av=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class zr{constructor(e,i){this.rules=[];let{finish:n}=i||{};function r(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function o(a,c,h,d){let p=[],y=/^@(\w+)\b/.exec(a[0]),b=y&&y[1]=="keyframes";if(y&&c==null)return h.push(a[0]+";");for(let x in c){let w=c[x];if(/&/.test(x))o(x.split(/,\s*/).map(C=>a.map(k=>C.replace(/&/,k))).reduce((C,k)=>C.concat(k)),w,h);else if(w&&typeof w=="object"){if(!y)throw new RangeError("The value of a property ("+x+") should be a primitive value.");o(r(x),w,p,b)}else w!=null&&p.push(x.replace(/_.*/,"").replace(/[A-Z]/g,C=>"-"+C.toLowerCase())+": "+w+";")}(p.length||b)&&h.push((n&&!y&&!d?a.map(n):a).join(", ")+" {"+p.join(" ")+"}")}for(let a in e)o(r(a),e[a],this.rules)}getRules(){return this.rules.join(`
47
+ `)}static newName(){let e=Av[kv]||1;return Av[kv]=e+1,qm+e.toString(36)}static mount(e,i,n){let r=e[Pm],o=n&&n.nonce;r?o&&r.setNonce(o):r=new s5(e,o),r.mount(Array.isArray(i)?i:[i],e)}}let Mv=new Map;class s5{constructor(e,i){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let o=Mv.get(n);if(o)return e[Pm]=o;this.sheet=new r.CSSStyleSheet,Mv.set(n,this)}else this.styleTag=n.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[Pm]=this}mount(e,i){let n=this.sheet,r=0,o=0;for(let a=0;a<e.length;a++){let c=e[a],h=this.modules.indexOf(c);if(h<o&&h>-1&&(this.modules.splice(h,1),o--,h=-1),h==-1){if(this.modules.splice(o++,0,c),n)for(let d=0;d<c.rules.length;d++)n.insertRule(c.rules[d],r++)}else{for(;o<h;)r+=this.modules[o++].rules.length;r+=c.rules.length,o++}}if(n)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let a="";for(let h=0;h<this.modules.length;h++)a+=this.modules[h].getRules()+`
48
+ `;this.styleTag.textContent=a;let c=i.head||i;this.styleTag.parentNode!=c&&c.insertBefore(this.styleTag,c.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var _r={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:"'"},ya={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},l5=typeof navigator<"u"&&/Mac/.test(navigator.platform),o5=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var _t=0;_t<10;_t++)_r[48+_t]=_r[96+_t]=String(_t);for(var _t=1;_t<=24;_t++)_r[_t+111]="F"+_t;for(var _t=65;_t<=90;_t++)_r[_t]=String.fromCharCode(_t+32),ya[_t]=String.fromCharCode(_t);for(var Dp in _r)ya.hasOwnProperty(Dp)||(ya[Dp]=_r[Dp]);function a5(t){var e=l5&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||o5&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?ya:_r)[t.keyCode]||t.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}function Ke(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&typeof i=="object"&&i.nodeType==null&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var r=i[n];typeof r=="string"?t.setAttribute(n,r):r!=null&&(t[n]=r)}e++}for(;e<arguments.length;e++)pC(t,arguments[e]);return t}function pC(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var i=0;i<e.length;i++)pC(t,e[i]);else throw new RangeError("Unsupported child node: "+e)}let Wt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Fm=typeof document<"u"?document:{documentElement:{style:{}}};const Vm=/Edge\/(\d+)/.exec(Wt.userAgent),mC=/MSIE \d/.test(Wt.userAgent),Im=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Wt.userAgent),_h=!!(mC||Im||Vm),Tv=!_h&&/gecko\/(\d+)/i.test(Wt.userAgent),jp=!_h&&/Chrome\/(\d+)/.exec(Wt.userAgent),u5="webkitFontSmoothing"in Fm.documentElement.style,Qm=!_h&&/Apple Computer/.test(Wt.vendor),Ov=Qm&&(/Mobile\/\w+/.test(Wt.userAgent)||Wt.maxTouchPoints>2);var se={mac:Ov||/Mac/.test(Wt.platform),windows:/Win/.test(Wt.platform),linux:/Linux|X11/.test(Wt.platform),ie:_h,ie_version:mC?Fm.documentMode||6:Im?+Im[1]:Vm?+Vm[1]:0,gecko:Tv,gecko_version:Tv?+(/Firefox\/(\d+)/.exec(Wt.userAgent)||[0,0])[1]:0,chrome:!!jp,chrome_version:jp?+jp[1]:0,ios:Ov,android:/Android\b/.test(Wt.userAgent),webkit_version:u5?+(/\bAppleWebKit\/(\d+)/.exec(Wt.userAgent)||[0,0])[1]:0,safari:Qm,safari_version:Qm?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Wt.userAgent)||[0,0])[1]:0,tabSize:Fm.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Yg(t,e){for(let i in t)i=="class"&&e.class?e.class+=" "+t.class:i=="style"&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}const lh=Object.create(null);function Gg(t,e,i){if(t==e)return!0;t||(t=lh),e||(e=lh);let n=Object.keys(t),r=Object.keys(e);if(n.length-0!=r.length-0)return!1;for(let o of n)if(o!=i&&(r.indexOf(o)==-1||t[o]!==e[o]))return!1;return!0}function c5(t,e){for(let i=t.attributes.length-1;i>=0;i--){let n=t.attributes[i].name;e[n]==null&&t.removeAttribute(n)}for(let i in e){let n=e[i];i=="style"?t.style.cssText=n:t.getAttribute(i)!=n&&t.setAttribute(i,n)}}function Ev(t,e,i){let n=!1;if(e)for(let r in e)i&&r in i||(n=!0,r=="style"?t.style.cssText="":t.removeAttribute(r));if(i)for(let r in i)e&&e[r]==i[r]||(n=!0,r=="style"?t.style.cssText=i[r]:t.setAttribute(r,i[r]));return n}function h5(t){let e=Object.create(null);for(let i=0;i<t.attributes.length;i++){let n=t.attributes[i];e[n.name]=n.value}return e}class Cn{eq(e){return!1}updateDOM(e,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,i,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Ut=(function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t})(Ut||(Ut={}));class ge extends Br{constructor(e,i,n,r){super(),this.startSide=e,this.endSide=i,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Ba(e)}static widget(e){let i=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return i+=n&&!e.inlineOrder?i>0?3e8:-4e8:i>0?1e8:-1e8,new Ss(e,i,i,n,e.widget||null,!1)}static replace(e){let i=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:o,end:a}=gC(e,i);n=(o?i?-3e8:-1:5e8)-1,r=(a?i?2e8:1:-6e8)+1}return new Ss(e,n,r,i,e.widget||null,!0)}static line(e){return new za(e)}static set(e,i=!1){return Ne.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ge.none=Ne.empty;class Ba extends ge{constructor(e){let{start:i,end:n}=gC(e);super(i?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Yg(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||lh}eq(e){return this==e||e instanceof Ba&&this.tagName==e.tagName&&Gg(this.attrs,e.attrs)}range(e,i=e){if(e>=i)throw new RangeError("Mark decorations may not be empty");return super.range(e,i)}}Ba.prototype.point=!1;class za extends ge{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof za&&this.spec.class==e.spec.class&&Gg(this.spec.attributes,e.spec.attributes)}range(e,i=e){if(i!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,i)}}za.prototype.mapMode=Zt.TrackBefore;za.prototype.point=!0;class Ss extends ge{constructor(e,i,n,r,o,a){super(i,n,o,e),this.block=r,this.isReplace=a,this.mapMode=r?i<=0?Zt.TrackBefore:Zt.TrackAfter:Zt.TrackDel}get type(){return this.startSide!=this.endSide?Ut.WidgetRange:this.startSide<=0?Ut.WidgetBefore:Ut.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ss&&f5(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,i=e){if(this.isReplace&&(e>i||e==i&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&i!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,i)}}Ss.prototype.point=!0;function gC(t,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=t;return i==null&&(i=t.inclusive),n==null&&(n=t.inclusive),{start:i??e,end:n??e}}function f5(t,e){return t==e||!!(t&&e&&t.compare(e))}function wl(t,e,i,n=0){let r=i.length-1;r>=0&&i[r]+n>=t?i[r]=Math.max(i[r],e):i.push(t,e)}class ba extends Br{constructor(e,i){super(),this.tagName=e,this.attributes=i}eq(e){return e==this||e instanceof ba&&this.tagName==e.tagName&&Gg(this.attributes,e.attributes)}static create(e){return new ba(e.tagName,e.attributes||lh)}static set(e,i=!1){return Ne.of(e,i)}}ba.prototype.startSide=ba.prototype.endSide=-1;function xa(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Ym(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function ta(t,e){if(!e.anchorNode)return!1;try{return Ym(t,e.anchorNode)}catch{return!1}}function ia(t){return t.nodeType==3?Sa(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function na(t,e,i,n){return i?Nv(t,e,i,n,-1)||Nv(t,e,i,n,1):!1}function Hr(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function oh(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Nv(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:Wn(t))){if(t.nodeName=="DIV")return!1;let o=t.parentNode;if(!o||o.nodeType!=1)return!1;e=Hr(t)+(r<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=r<0?Wn(t):0}else return!1}}function Wn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function va(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function d5(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function yC(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function p5(t,e,i,n,r,o,a,c){let h=t.ownerDocument,d=h.defaultView||window;for(let p=t,y=!1;p&&!y;)if(p.nodeType==1){let b,x=p==h.body,w=1,C=1;if(x)b=d5(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(p).position)&&(y=!0),p.scrollHeight<=p.clientHeight&&p.scrollWidth<=p.clientWidth){p=p.assignedSlot||p.parentNode;continue}let O=p.getBoundingClientRect();({scaleX:w,scaleY:C}=yC(p,O)),b={left:O.left,right:O.left+p.clientWidth*w,top:O.top,bottom:O.top+p.clientHeight*C}}let k=0,M=0;if(r=="nearest")e.top<b.top?(M=e.top-(b.top+a),i>0&&e.bottom>b.bottom+M&&(M=e.bottom-b.bottom+a)):e.bottom>b.bottom&&(M=e.bottom-b.bottom+a,i<0&&e.top-M<b.top&&(M=e.top-(b.top+a)));else{let O=e.bottom-e.top,D=b.bottom-b.top;M=(r=="center"&&O<=D?e.top+O/2-D/2:r=="start"||r=="center"&&i<0?e.top-a:e.bottom-D+a)-b.top}if(n=="nearest"?e.left<b.left?(k=e.left-(b.left+o),i>0&&e.right>b.right+k&&(k=e.right-b.right+o)):e.right>b.right&&(k=e.right-b.right+o,i<0&&e.left<b.left+k&&(k=e.left-(b.left+o))):k=(n=="center"?e.left+(e.right-e.left)/2-(b.right-b.left)/2:n=="start"==c?e.left-o:e.right-(b.right-b.left)+o)-b.left,k||M)if(x)d.scrollBy(k,M);else{let O=0,D=0;if(M){let V=p.scrollTop;p.scrollTop+=M/C,D=(p.scrollTop-V)*C}if(k){let V=p.scrollLeft;p.scrollLeft+=k/w,O=(p.scrollLeft-V)*w}e={left:e.left-O,top:e.top-D,right:e.right-O,bottom:e.bottom-D},O&&Math.abs(O-k)<1&&(n="nearest"),D&&Math.abs(D-M)<1&&(r="nearest")}if(x)break;(e.top<b.top||e.bottom>b.bottom||e.left<b.left||e.right>b.right)&&(e={left:Math.max(e.left,b.left),right:Math.min(e.right,b.right),top:Math.max(e.top,b.top),bottom:Math.min(e.bottom,b.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function m5(t){let e=t.ownerDocument,i,n;for(let r=t.parentNode;r&&!(r==e.body||i&&n);)if(r.nodeType==1)!n&&r.scrollHeight>r.clientHeight&&(n=r),!i&&r.scrollWidth>r.clientWidth&&(i=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:i,y:n}}class g5{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:i,focusNode:n}=e;this.set(i,Math.min(e.anchorOffset,i?Wn(i):0),n,Math.min(e.focusOffset,n?Wn(n):0))}set(e,i,n,r){this.anchorNode=e,this.anchorOffset=i,this.focusNode=n,this.focusOffset=r}}let us=null;se.safari&&se.safari_version>=26&&(us=!1);function bC(t){if(t.setActive)return t.setActive();if(us)return t.focus(us);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(us==null?{get preventScroll(){return us={preventScroll:!0},!0}}:void 0),!us){us=!1;for(let i=0;i<e.length;){let n=e[i++],r=e[i++],o=e[i++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=o&&(n.scrollLeft=o)}}}let Rv;function Sa(t,e,i=e){let n=Rv||(Rv=document.createRange());return n.setEnd(t,i),n.setStart(t,e),n}function Cl(t,e,i,n){let r={key:e,code:e,keyCode:i,which:i,cancelable:!0};n&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=n);let o=new KeyboardEvent("keydown",r);o.synthetic=!0,t.dispatchEvent(o);let a=new KeyboardEvent("keyup",r);return a.synthetic=!0,t.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function y5(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function b5(t,e){let i=e.focusNode,n=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=n)return!1;for(n=Math.min(n,Wn(i));;)if(n){if(i.nodeType!=1)return!1;let r=i.childNodes[n-1];r.contentEditable=="false"?n--:(i=r,n=Wn(i))}else{if(i==t)return!0;n=Hr(i),i=i.parentNode}}function xC(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function vC(t,e){for(let i=t,n=e;;){if(i.nodeType==3&&n>0)return{node:i,offset:n};if(i.nodeType==1&&n>0){if(i.contentEditable=="false")return null;i=i.childNodes[n-1],n=Wn(i)}else if(i.parentNode&&!oh(i))n=Hr(i),i=i.parentNode;else return null}}function SC(t,e){for(let i=t,n=e;;){if(i.nodeType==3&&n<i.nodeValue.length)return{node:i,offset:n};if(i.nodeType==1&&n<i.childNodes.length){if(i.contentEditable=="false")return null;i=i.childNodes[n],n=0}else if(i.parentNode&&!oh(i))n=Hr(i)+1,i=i.parentNode;else return null}}class Xi{constructor(e,i,n=!0){this.node=e,this.offset=i,this.precise=n}static before(e,i){return new Xi(e.parentNode,Hr(e),i)}static after(e,i){return new Xi(e.parentNode,Hr(e)+1,i)}}var Ze=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Ze||(Ze={}));const ws=Ze.LTR,Kg=Ze.RTL;function wC(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const x5=wC("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),v5=wC("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Gm=Object.create(null),an=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);Gm[e]=i,Gm[i]=-e}function CC(t){return t<=247?x5[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?v5[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const S5=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class mn{get dir(){return this.level%2?Kg:ws}constructor(e,i,n){this.from=e,this.to=i,this.level=n}side(e,i){return this.dir==i==e?this.to:this.from}forward(e,i){return e==(this.dir==i)}static find(e,i,n,r){let o=-1;for(let a=0;a<e.length;a++){let c=e[a];if(c.from<=i&&c.to>=i){if(c.level==n)return a;(o<0||(r!=0?r<0?c.from<i:c.to>i:e[o].level>c.level))&&(o=a)}}if(o<0)throw new RangeError("Index out of range");return o}}function kC(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let n=t[i],r=e[i];if(n.from!=r.from||n.to!=r.to||n.direction!=r.direction||!kC(n.inner,r.inner))return!1}return!0}const Xe=[];function w5(t,e,i,n,r){for(let o=0;o<=n.length;o++){let a=o?n[o-1].to:e,c=o<n.length?n[o].from:i,h=o?256:r;for(let d=a,p=h,y=h;d<c;d++){let b=CC(t.charCodeAt(d));b==512?b=p:b==8&&y==4&&(b=16),Xe[d]=b==4?2:b,b&7&&(y=b),p=b}for(let d=a,p=h,y=h;d<c;d++){let b=Xe[d];if(b==128)d<c-1&&p==Xe[d+1]&&p&24?b=Xe[d]=p:Xe[d]=256;else if(b==64){let x=d+1;for(;x<c&&Xe[x]==64;)x++;let w=d&&p==8||x<i&&Xe[x]==8?y==1?1:8:256;for(let C=d;C<x;C++)Xe[C]=w;d=x-1}else b==8&&y==1&&(Xe[d]=1);p=b,b&7&&(y=b)}}}function C5(t,e,i,n,r){let o=r==1?2:1;for(let a=0,c=0,h=0;a<=n.length;a++){let d=a?n[a-1].to:e,p=a<n.length?n[a].from:i;for(let y=d,b,x,w;y<p;y++)if(x=Gm[b=t.charCodeAt(y)])if(x<0){for(let C=c-3;C>=0;C-=3)if(an[C+1]==-x){let k=an[C+2],M=k&2?r:k&4?k&1?o:r:0;M&&(Xe[y]=Xe[an[C]]=M),c=C;break}}else{if(an.length==189)break;an[c++]=y,an[c++]=b,an[c++]=h}else if((w=Xe[y])==2||w==1){let C=w==r;h=C?0:1;for(let k=c-3;k>=0;k-=3){let M=an[k+2];if(M&2)break;if(C)an[k+2]|=2;else{if(M&4)break;an[k+2]|=4}}}}}function k5(t,e,i,n){for(let r=0,o=n;r<=i.length;r++){let a=r?i[r-1].to:t,c=r<i.length?i[r].from:e;for(let h=a;h<c;){let d=Xe[h];if(d==256){let p=h+1;for(;;)if(p==c){if(r==i.length)break;p=i[r++].to,c=r<i.length?i[r].from:e}else if(Xe[p]==256)p++;else break;let y=o==1,b=(p<e?Xe[p]:n)==1,x=y==b?y?1:2:n;for(let w=p,C=r,k=C?i[C-1].to:t;w>h;)w==k&&(w=i[--C].from,k=C?i[C-1].to:t),Xe[--w]=x;h=p}else o=d,h++}}}function Km(t,e,i,n,r,o,a){let c=n%2?2:1;if(n%2==r%2)for(let h=e,d=0;h<i;){let p=!0,y=!1;if(d==o.length||h<o[d].from){let C=Xe[h];C!=c&&(p=!1,y=C==16)}let b=!p&&c==1?[]:null,x=p?n:n+1,w=h;e:for(;;)if(d<o.length&&w==o[d].from){if(y)break e;let C=o[d];if(!p)for(let k=C.to,M=d+1;;){if(k==i)break e;if(M<o.length&&o[M].from==k)k=o[M++].to;else{if(Xe[k]==c)break e;break}}if(d++,b)b.push(C);else{C.from>h&&a.push(new mn(h,C.from,x));let k=C.direction==ws!=!(x%2);Wm(t,k?n+1:n,r,C.inner,C.from,C.to,a),h=C.to}w=C.to}else{if(w==i||(p?Xe[w]!=c:Xe[w]==c))break;w++}b?Km(t,h,w,n+1,r,b,a):h<w&&a.push(new mn(h,w,x)),h=w}else for(let h=i,d=o.length;h>e;){let p=!0,y=!1;if(!d||h>o[d-1].to){let C=Xe[h-1];C!=c&&(p=!1,y=C==16)}let b=!p&&c==1?[]:null,x=p?n:n+1,w=h;e:for(;;)if(d&&w==o[d-1].to){if(y)break e;let C=o[--d];if(!p)for(let k=C.from,M=d;;){if(k==e)break e;if(M&&o[M-1].to==k)k=o[--M].from;else{if(Xe[k-1]==c)break e;break}}if(b)b.push(C);else{C.to<h&&a.push(new mn(C.to,h,x));let k=C.direction==ws!=!(x%2);Wm(t,k?n+1:n,r,C.inner,C.from,C.to,a),h=C.from}w=C.from}else{if(w==e||(p?Xe[w-1]!=c:Xe[w-1]==c))break;w--}b?Km(t,w,h,n+1,r,b,a):w<h&&a.push(new mn(w,h,x)),h=w}}function Wm(t,e,i,n,r,o,a){let c=e%2?2:1;w5(t,r,o,n,c),C5(t,r,o,n,c),k5(r,o,n,c),Km(t,r,o,e,i,n,a)}function A5(t,e,i){if(!t)return[new mn(0,0,e==Kg?1:0)];if(e==ws&&!i.length&&!S5.test(t))return AC(t.length);if(i.length)for(;t.length>Xe.length;)Xe[Xe.length]=256;let n=[],r=e==ws?0:1;return Wm(t,r,r,i,0,t.length,n),n}function AC(t){return[new mn(0,t,0)]}let MC="";function M5(t,e,i,n,r){var o;let a=n.head-t.from,c=mn.find(e,a,(o=n.bidiLevel)!==null&&o!==void 0?o:-1,n.assoc),h=e[c],d=h.side(r,i);if(a==d){let b=c+=r?1:-1;if(b<0||b>=e.length)return null;h=e[c=b],a=h.side(!r,i),d=h.side(r,i)}let p=Et(t.text,a,h.forward(r,i));(p<h.from||p>h.to)&&(p=d),MC=t.text.slice(Math.min(a,p),Math.max(a,p));let y=c==(r?e.length-1:0)?null:e[c+(r?1:-1)];return y&&p==d&&y.level+(r?0:1)<h.level?W.cursor(y.side(!r,i)+t.from,y.forward(r,i)?1:-1,y.level):W.cursor(p+t.from,h.forward(r,i)?-1:1,h.level)}function T5(t,e,i){for(let n=e;n<i;n++){let r=CC(t.charCodeAt(n));if(r==1)return ws;if(r==2||r==4)return Kg}return ws}const TC=le.define(),OC=le.define(),EC=le.define(),NC=le.define(),Xm=le.define(),RC=le.define(),DC=le.define(),Wg=le.define(),Xg=le.define(),jC=le.define({combine:t=>t.some(e=>e)}),LC=le.define({combine:t=>t.some(e=>e)}),BC=le.define();class kl{constructor(e,i="nearest",n="nearest",r=5,o=5,a=!1){this.range=e,this.y=i,this.x=n,this.yMargin=r,this.xMargin=o,this.isSnapshot=a}map(e){return e.empty?this:new kl(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 kl(W.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const fc=Se.define({map:(t,e)=>t.map(e)}),zC=Se.define();function ci(t,e,i){let n=t.facet(NC);n.length?n[0](e):window.onerror&&window.onerror(String(e),i,void 0,void 0,e)||(i?console.error(i+":",e):console.error(e))}const In=le.define({combine:t=>t.length?t[0]:!0});let O5=0;const gl=le.define({combine(t){return t.filter((e,i)=>{for(let n=0;n<i;n++)if(t[n].plugin==e.plugin)return!1;return!0})}});class at{constructor(e,i,n,r,o){this.id=e,this.create=i,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(gl.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(gl.of({plugin:this,arg:e}))}static define(e,i){const{eventHandlers:n,eventObservers:r,provide:o,decorations:a}=i||{};return new at(O5++,e,n,r,c=>{let h=[];return a&&h.push(Hh.of(d=>{let p=d.plugin(c);return p?a(p):ge.none})),o&&h.push(o(c)),h})}static fromClass(e,i){return at.define((n,r)=>new e(n,r),i)}}class Lp{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 i=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(i)}catch(n){if(ci(i.state,n,"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(i){ci(e.state,i,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var i;if(!((i=this.value)===null||i===void 0)&&i.destroy)try{this.value.destroy()}catch(n){ci(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const _C=le.define(),Zg=le.define(),Hh=le.define(),HC=le.define(),Jg=le.define(),_a=le.define(),UC=le.define();function Dv(t,e){let i=t.state.facet(UC);if(!i.length)return i;let n=i.map(o=>o instanceof Function?o(t):o),r=[];return Ne.spans(n,e.from,e.to,{point(){},span(o,a,c,h){let d=o-e.from,p=a-e.from,y=r;for(let b=c.length-1;b>=0;b--,h--){let x=c[b].spec.bidiIsolate,w;if(x==null&&(x=T5(e.text,d,p)),h>0&&y.length&&(w=y[y.length-1]).to==d&&w.direction==x)w.to=p,y=w.inner;else{let C={from:d,to:p,direction:x,inner:[]};y.push(C),y=C.inner}}}}),r}const qC=le.define();function $g(t){let e=0,i=0,n=0,r=0;for(let o of t.state.facet(qC)){let a=o(t);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(i=Math.max(i,a.right)),a.top!=null&&(n=Math.max(n,a.top)),a.bottom!=null&&(r=Math.max(r,a.bottom)))}return{left:e,right:i,top:n,bottom:r}}const Wo=le.define();class qi{constructor(e,i,n,r){this.fromA=e,this.toA=i,this.fromB=n,this.toB=r}join(e){return new qi(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 i=e.length,n=this;for(;i>0;i--){let r=e[i-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(i-1,1)}}return e.splice(i,0,n),e}static extendWithRanges(e,i){if(i.length==0)return e;let n=[];for(let r=0,o=0,a=0;;){let c=r<e.length?e[r].fromB:1e9,h=o<i.length?i[o]:1e9,d=Math.min(c,h);if(d==1e9)break;let p=d+a,y=d,b=p;for(;;)if(o<i.length&&i[o]<=y){let x=i[o+1];o+=2,y=Math.max(y,x);for(let w=r;w<e.length&&e[w].fromB<=y;w++)a=e[w].toA-e[w].toB;b=Math.max(b,x+a)}else if(r<e.length&&e[r].fromB<=y){let x=e[r++];y=Math.max(y,x.toB),b=Math.max(b,x.toA),a=x.toA-x.toB}else break;n.push(new qi(p,b,d,y))}return n}}class ah{constructor(e,i,n){this.view=e,this.state=i,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=wt.empty(this.startState.doc.length);for(let o of n)this.changes=this.changes.compose(o.changes);let r=[];this.changes.iterChangedRanges((o,a,c,h)=>r.push(new qi(o,a,c,h))),this.changedRanges=r}static create(e,i,n){return new ah(e,i,n)}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 E5=[];class vt{constructor(e,i,n=0){this.dom=e,this.length=i,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return E5}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 i=this.domAttrs;i&&c5(this.dom,i)}}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,i=this.posAtStart){let n=i;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,i){return null}domPosFor(e,i){let n=Hr(this.dom),r=this.length?e>0:i>0;return new Xi(this.parent.dom,n+(r?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 qh)return e;return null}static get(e){return e.cmTile}}class Uh extends vt{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 i=this.dom,n=null,r,o=e?.node==i?e:null,a=0;for(let c of this.children){if(c.sync(e),a+=c.length+c.breakAfter,r=n?n.nextSibling:i.firstChild,o&&r!=c.dom&&(o.written=!0),c.dom.parentNode==i)for(;r&&r!=c.dom;)r=jv(r);else i.insertBefore(c.dom,r);n=c.dom}for(r=n?n.nextSibling:i.firstChild,o&&r&&(o.written=!0);r;)r=jv(r);this.length=a}}function jv(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class qh extends Uh{constructor(e,i){super(i),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 i=vt.get(e);if(i&&this.owns(i))return i;e=e.parentNode}}blockTiles(e){for(let i=[],n=this,r=0,o=0;;)if(r==n.children.length){if(!i.length)return;n=n.parent,n.breakAfter&&o++,r=i.pop()}else{let a=n.children[r++];if(a instanceof Qn)i.push(r),n=a,r=0;else{let c=o+a.length,h=e(a,o);if(h!==void 0)return h;o=c+a.breakAfter}}}resolveBlock(e,i){let n,r=-1,o,a=-1;if(this.blockTiles((c,h)=>{let d=h+c.length;if(e>=h&&e<=d){if(c.isWidget()&&i>=-1&&i<=1){if(c.flags&32)return!0;c.flags&16&&(n=void 0)}(h<e||e==d&&(i<-1?c.length:c.covers(1)))&&(!n||!c.isWidget()&&n.isWidget())&&(n=c,r=e-h),(d>e||e==h&&(i>1?c.length:c.covers(-1)))&&(!o||!c.isWidget()&&o.isWidget())&&(o=c,a=e-h)}}),!n&&!o)throw new Error("No tile at position "+e);return n&&i<0||!o?{tile:n,offset:r}:{tile:o,offset:a}}}class Qn extends Uh{constructor(e,i){super(e),this.wrapper=i}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,i){let n=new Qn(i||document.createElement(e.tagName),e);return i||(n.flags|=4),n}}class Rl extends Uh{constructor(e,i){super(e),this.attrs=i}isLine(){return!0}static start(e,i,n){let r=new Rl(i||document.createElement("div"),e);return(!i||!n)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,i,n){let r=null,o=-1,a=null,c=-1;function h(p,y){for(let b=0,x=0;b<p.children.length&&x<=y;b++){let w=p.children[b],C=x+w.length;C>=y&&(w.isComposite()?h(w,y-x):(!a||a.isHidden&&(i>0||n&&R5(a,w)))&&(C>y||w.flags&32)?(a=w,c=y-x):(x<y||w.flags&16&&!w.isHidden)&&(r=w,o=y-x)),x=C}}h(this,e);let d=(i<0?r:a)||r||a;return d?{tile:d,offset:d==r?o:c}:null}coordsIn(e,i){let n=this.resolveInline(e,i,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),i):N5(this)}domIn(e,i){let n=this.resolveInline(e,i);if(n){let{tile:r,offset:o}=n;if(this.dom.contains(r.dom))return r.isText()?new Xi(r.dom,Math.min(r.dom.nodeValue.length,o)):r.domPosFor(o,r.flags&16?1:r.flags&32?-1:i);let a=n.tile.parent,c=!1;for(let h of a.children){if(c)return new Xi(h.dom,0);h==n.tile&&(c=!0)}}return new Xi(this.dom,0)}}function N5(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=ia(e);return i[i.length-1]||null}function R5(t,e){let i=t.coordsIn(0,1),n=e.coordsIn(0,1);return i&&n&&n.top<i.bottom}class ai extends Uh{constructor(e,i){super(e),this.mark=i}get domAttrs(){return this.mark.attrs}static of(e,i){let n=new ai(i||document.createElement(e.tagName),e);return i||(n.flags|=4),n}}class ps extends vt{constructor(e,i){super(e,i.length),this.text=i}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,i){let n=this.dom.nodeValue.length;e>n&&(e=n);let r=e,o=e,a=0;e==0&&i<0||e==n&&i>=0?se.chrome||se.gecko||(e?(r--,a=1):o<n&&(o++,a=-1)):i<0?r--:o<n&&o++;let c=Sa(this.dom,r,o).getClientRects();if(!c.length)return null;let h=c[(a?a<0:i>=0)?0:c.length-1];return se.safari&&!a&&h.width==0&&(h=Array.prototype.find.call(c,d=>d.width)||h),a?va(h,a<0):h||null}static of(e,i){let n=new ps(i||document.createTextNode(e),e);return i||(n.flags|=2),n}}class Cs extends vt{constructor(e,i,n,r){super(e,i,r),this.widget=n}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,i){return this.coordsInWidget(e,i,!1)}coordsInWidget(e,i,n){let r=this.widget.coordsAt(this.dom,e,i);if(r)return r;if(n)return va(this.dom.getBoundingClientRect(),this.length?e==0:i<=0);{let o=this.dom.getClientRects(),a=null;if(!o.length)return null;let c=this.flags&16?!0:this.flags&32?!1:e>0;for(let h=c?o.length-1:0;a=o[h],!(e>0?h==0:h==o.length-1||a.top<a.bottom);h+=c?-1:1);return va(a,!c)}}get overrideDOMText(){if(!this.length)return Ue.empty;let{root:e}=this;if(!e)return Ue.empty;let i=this.posAtStart;return e.view.state.doc.slice(i,i+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,i,n,r,o){return o||(o=e.toDOM(i),e.editable||(o.contentEditable="false")),new Cs(o,n,e,r)}}class uh extends vt{constructor(e){let i=document.createElement("img");i.className="cm-widgetBuffer",i.setAttribute("aria-hidden","true"),super(i,0,e)}get isHidden(){return!0}get overrideDOMText(){return Ue.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class D5{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,i,n){let{tile:r,index:o,beforeBreak:a,parents:c}=this;for(;e||i>0;)if(r.isComposite())if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(o==r.children.length){if(!e&&!c.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:o}=c.pop(),o++}else{let h=r.children[o],d=h.breakAfter;(i>0?h.length<=e:h.length<e)&&(!n||n.skip(h,0,h.length)!==!1||!h.isComposite)?(a=!!d,o++,e-=h.length):(c.push({tile:r,index:o}),r=h,o=0,n&&h.isComposite()&&n.enter(h))}else if(o==r.length)a=!!r.breakAfter,{tile:r,index:o}=c.pop(),o++;else if(e){let h=Math.min(e,r.length-o);n&&n.skip(r,o,o+h),e-=h,o+=h}else break;return this.tile=r,this.index=o,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class j5{constructor(e,i,n,r){this.from=e,this.to=i,this.wrapper=n,this.rank=r}}class L5{constructor(e,i,n){this.cache=e,this.root=i,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,i,n,r){var o;this.flushBuffer();let a=this.ensureMarks(i,n),c=a.lastChild;if(c&&c.isText()&&!(c.flags&8)&&c.length+e.length<512){this.cache.reused.set(c,2);let h=a.children[a.children.length-1]=new ps(c.dom,c.text+e);h.parent=a}else a.append(r||ps.of(e,(o=this.cache.find(ps))===null||o===void 0?void 0:o.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,i){let n=this.curLine;n.dom!=i.line.dom&&(n.setDOM(this.cache.reused.has(i.line)?Bp(i.line.dom):i.line.dom),this.cache.reused.set(i.line,2));let r=n;for(let c=i.marks.length-1;c>=0;c--){let h=i.marks[c],d=r.lastChild;if(d instanceof ai&&d.mark.eq(h.mark))d.dom!=h.dom&&d.setDOM(Bp(h.dom)),r=d;else{if(this.cache.reused.get(h)){let y=vt.get(h.dom);y&&y.setDOM(Bp(h.dom))}let p=ai.of(h.mark,h.dom);r.append(p),r=p}this.cache.reused.set(h,2)}let o=vt.get(e.text);o&&this.cache.reused.set(o,2);let a=new ps(e.text,e.text.nodeValue);a.flags|=8,r.append(a)}addInlineWidget(e,i,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let o=this.ensureMarks(i,n);!r&&!(e.flags&16)&&o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,i,n){this.flushBuffer(),this.ensureMarks(i,n).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 i=this.afterWidget||this.lastBlock;i.length+=e,this.pos+=e}addLineStart(e,i){var n;e||(e=PC);let r=Rl.start(e,i||((n=this.cache.find(Rl))===null||n===void 0?void 0:n.dom),!!i);this.getBlockPos().append(this.lastBlock=this.curLine=r)}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,i){var n;let r=this.curLine;for(let o=e.length-1;o>=0;o--){let a=e[o],c;if(i>0&&(c=r.lastChild)&&c instanceof ai&&c.mark.eq(a))r=c,i--;else{let h=ai.of(a,(n=this.cache.find(ai,d=>d.mark.eq(a)))===null||n===void 0?void 0:n.dom);r.append(h),r=h,i=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Lv(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(se.ios&&Lv(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(zp,0,32)||new Cs(zp.toDOM(),0,zp,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 i=new j5(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-i.rank||this.wrappers[n-1].to-i.to)<0;)n--;this.wrappers.splice(n,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let i=this.root;for(let n of this.wrappers){let r=i.lastChild;if(n.from<this.pos&&r instanceof Qn&&r.wrapper.eq(n.wrapper))i=r;else{let o=Qn.of(n.wrapper,(e=this.cache.find(Qn,a=>a.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);i.append(o),i=o}}return i}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let i=2|(e<0?16:32),n=this.cache.find(uh,void 0,1);return n&&(n.flags=i),n||new uh(i)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class B5{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:r,lineBreak:o,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=r;let c=this.textOff=Math.min(e,r.length);return o?null:r.slice(0,c)}let i=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,i);return this.textOff=i,n}}const ch=[Cs,Rl,ps,ai,uh,Qn,qh];for(let t=0;t<ch.length;t++)ch[t].bucket=t;class z5{constructor(e){this.view=e,this.buckets=ch.map(()=>[]),this.index=ch.map(()=>0),this.reused=new Map}add(e){let i=e.constructor.bucket,n=this.buckets[i];n.length<6?n.push(e):n[this.index[i]=(this.index[i]+1)%6]=e}find(e,i,n=2){let r=e.bucket,o=this.buckets[r],a=this.index[r];for(let c=o.length-1;c>=0;c--){let h=(c+a)%o.length,d=o[h];if((!i||i(d))&&!this.reused.has(d))return o.splice(h,1),h<a&&this.index[r]--,this.reused.set(d,n),d}return null}findWidget(e,i,n){let r=this.buckets[0];if(r.length)for(let o=0,a=0;;o++){if(o==r.length){if(a)return null;a=1,o=0}let c=r[o];if(!this.reused.has(c)&&(a==0?c.widget.compare(e):c.widget.constructor==e.constructor&&e.updateDOM(c.dom,this.view)))return r.splice(o,1),o<this.index[0]&&this.index[0]--,c.widget==e&&c.length==i&&(c.flags&497)==n?(this.reused.set(c,1),c):(this.reused.set(c,2),new Cs(c.dom,i,e,c.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,i=2){if(!this.reused.has(e))return this.reused.set(e,i),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class _5{constructor(e,i,n,r,o){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=o,this.openWidget=!1,this.openMarks=0,this.cache=new z5(e),this.text=new B5(e.state.doc),this.builder=new L5(this.cache,new qh(e,e.contentDOM),Ne.iter(n)),this.cache.reused.set(i,2),this.old=new D5(i),this.reuseWalker={skip:(a,c,h)=>{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,i){let n=i&&this.getCompositionContext(i.text);for(let r=0,o=0,a=0;;){let c=a<e.length?e[a++]:null,h=c?c.fromA:this.old.root.length;if(h>r){let d=h-r;this.preserve(d,!a,!c),r=h,o+=d}if(!c)break;i&&c.fromA<=i.range.fromA&&c.toA>=i.range.toA?(this.forward(c.fromA,i.range.fromA,i.range.fromA<i.range.toA?1:-1),this.emit(o,i.range.fromB),this.cache.clear(),this.builder.addComposition(i,n),this.text.skip(i.range.toB-i.range.fromB),this.forward(i.range.fromA,c.toA),this.emit(i.range.toB,c.toB)):(this.forward(c.fromA,c.toA),this.emit(o,c.toB)),o=c.toB,r=c.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,i,n){let r=q5(this.old),o=this.openMarks;this.old.advance(e,n?1:-1,{skip:(a,c,h)=>{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(h-c);else{let d=h>0||c<a.length?Cs.of(a.widget,this.view,h-c,a.flags&496,this.cache.maybeReuse(a)):this.cache.reuse(a);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,r,o),o=r.length)}else if(a.isText())this.builder.ensureLine(null),!c&&h==a.length?this.builder.addText(a.text,r,o,this.cache.reuse(a)):(this.cache.add(a),this.builder.addText(a.text.slice(c,h),r,o)),o=r.length;else if(a.isLine())a.flags&=-2,this.cache.reused.set(a,1),this.builder.addLine(a);else if(a instanceof uh)this.cache.add(a);else if(a instanceof ai)this.builder.ensureLine(null),this.builder.addMark(a,r,o),this.cache.reused.set(a,1),o=r.length;else return!1;this.openWidget=!1},enter:a=>{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof ai&&r.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?r.length&&(r.length=o=0):a instanceof ai&&(r.shift(),o=Math.min(o,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,i){let n=null,r=this.builder,o=0,a=Ne.spans(this.decorations,e,i,{point:(c,h,d,p,y,b)=>{if(d instanceof Ss){if(this.disallowBlockEffectsFor[b]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(h>this.view.state.doc.lineAt(c).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=p.length,y>p.length)r.continueWidget(h-c);else{let x=d.widget||(d.block?Dl.block:Dl.inline),w=H5(d),C=this.cache.findWidget(x,h-c,w)||Cs.of(x,this.view,h-c,w);d.block?(d.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(C)):(r.ensureLine(n),r.addInlineWidget(C,p,y))}n=null}else n=U5(n,d);h>c&&this.text.skip(h-c)},span:(c,h,d,p)=>{for(let y=c;y<h;){let b=this.text.next(Math.min(512,h-y));b==null?(r.addLineStartIfNotCovered(n),r.addBreak(),y++):(r.ensureLine(n),r.addText(b,d,y==c?p:d.length),y+=b.length),n=null}}});r.addLineStartIfNotCovered(n),this.openWidget=a>o,this.openMarks=a}forward(e,i,n=1){i-e<=10?this.old.advance(i-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(i-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let i=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let o=vt.get(r);if(r==this.view.contentDOM)break;o instanceof ai?i.push(o):o?.isLine()?n=o:o instanceof Qn||(r.nodeName=="DIV"&&!n&&r!=this.view.contentDOM?n=new Rl(r,PC):n||i.push(ai.of(new Ba({tagName:r.nodeName.toLowerCase(),attributes:h5(r)}),r)))}return{line:n,marks:i}}}function Lv(t,e){let i=n=>{for(let r of n.children)if((e?r.isText():r.length)||i(r))return!0;return!1};return i(t)}function H5(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const PC={class:"cm-line"};function U5(t,e){let i=e.spec.attributes,n=e.spec.class;return!i&&!n||(t||(t={class:"cm-line"}),i&&Yg(i,t),n&&(t.class+=" "+n)),t}function q5(t){let e=[];for(let i=t.parents.length;i>1;i--){let n=i==t.parents.length?t.tile:t.parents[i].tile;n instanceof ai&&e.push(n.mark)}return e}function Bp(t){let e=vt.get(t);return e&&e.setDOM(t.cloneNode()),t}class Dl extends Cn{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}}Dl.inline=new Dl("span");Dl.block=new Dl("div");const zp=new class extends Cn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Bv{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ge.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 qh(e,e.contentDOM),this.updateInner([new qi(0,0,0,e.state.doc.length)],null)}update(e){var i;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:p,toA:y})=>y<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 r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((i=this.domChanged)===null||i===void 0)&&i.newSel?r=this.domChanged.newSel.head:!W5(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let o=r>-1?F5(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:y}=this.hasComposition;n=new qi(p,y,e.changes.mapPos(p,-1),e.changes.mapPos(y,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(se.ie||se.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,c=this.blockWrappers;this.updateDeco();let h=Q5(a,this.decorations,e.changes);h.length&&(n=qi.extendWithRanges(n,h));let d=G5(c,this.blockWrappers,e.changes);return d.length&&(n=qi.extendWithRanges(n,d)),o&&!n.some(p=>p.fromA<=o.range.fromA&&p.toA>=o.range.toA)&&(n=o.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,i){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(i||e.length){let a=this.tile,c=new _5(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=c.run(e,i),Zm(a,c.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=se.chrome||se.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(o),o&&(o.written||n.selectionRange.focusNode!=o.node||!this.tile.dom.contains(o.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.tile.children)o.isWidget()&&o.widget instanceof _p&&r.push(o.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let i of e.transactions)for(let n of i.effects)n.is(zC)&&(this.editContextFormatting=n.value)}updateSelection(e=!1,i=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,o=r==n,a=!o&&!(this.view.state.facet(In)||n.tabIndex>-1)&&ta(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(o||i||a))return;let c=this.forceSelection;this.forceSelection=!1;let h=this.view.state.selection.main,d,p;if(h.empty?p=d=this.inlineDOMNearPos(h.anchor,h.assoc||1):(p=this.inlineDOMNearPos(h.head,h.head==h.from?1:-1),d=this.inlineDOMNearPos(h.anchor,h.anchor==h.from?1:-1)),se.gecko&&h.empty&&!this.hasComposition&&P5(d)){let b=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(b,d.node.childNodes[d.offset]||null)),d=p=new Xi(b,0),c=!0}let y=this.view.observer.selectionRange;(c||!y.focusNode||(!na(d.node,d.offset,y.anchorNode,y.anchorOffset)||!na(p.node,p.offset,y.focusNode,y.focusOffset))&&!this.suppressWidgetCursorChange(y,h))&&(this.view.observer.ignore(()=>{se.android&&se.chrome&&n.contains(y.focusNode)&&K5(y.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let b=xa(this.view.root);if(b)if(h.empty){if(se.gecko){let x=V5(d.node,d.offset);if(x&&x!=3){let w=(x==1?vC:SC)(d.node,d.offset);w&&(d=new Xi(w.node,w.offset))}}b.collapse(d.node,d.offset),h.bidiLevel!=null&&b.caretBidiLevel!==void 0&&(b.caretBidiLevel=h.bidiLevel)}else if(b.extend){b.collapse(d.node,d.offset);try{b.extend(p.node,p.offset)}catch{}}else{let x=document.createRange();h.anchor>h.head&&([d,p]=[p,d]),x.setEnd(p.node,p.offset),x.setStart(d.node,d.offset),b.removeAllRanges(),b.addRange(x)}a&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new Xi(y.anchorNode,y.anchorOffset),this.impreciseHead=p.precise?null:new Xi(y.focusNode,y.focusOffset)}suppressWidgetCursorChange(e,i){return this.hasComposition&&i.empty&&na(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==i.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,i=e.state.selection.main,n=xa(e.root),{anchorNode:r,anchorOffset:o}=e.observer.selectionRange;if(!n||!i.empty||!i.assoc||!n.modify)return;let a=this.lineAt(i.head,i.assoc);if(!a)return;let c=a.posAtStart;if(i.head==c||i.head==c+a.length)return;let h=this.coordsAt(i.head,-1),d=this.coordsAt(i.head,1);if(!h||!d||h.bottom>d.top)return;let p=this.domAtPos(i.head+i.assoc,i.assoc);n.collapse(p.node,p.offset),n.modify("move",i.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let y=e.observer.selectionRange;e.docView.posFromDOM(y.anchorNode,y.anchorOffset)!=i.from&&n.collapse(r,o)}posFromDOM(e,i){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let o;if(e==n.dom)o=n.dom.childNodes[i];else{let a=Wn(e)==0?0:i==0?-1:1;for(;;){let c=e.parentNode;if(c==n.dom)break;a==0&&c.firstChild!=c.lastChild&&(e==c.firstChild?a=-1:a=1),e=c}a<0?o=e:o=e.nextSibling}if(o==n.dom.firstChild)return r;for(;o&&!vt.get(o);)o=o.nextSibling;if(!o)return r+n.length;for(let a=0,c=r;;a++){let h=n.children[a];if(h.dom==o)return c;c+=h.length+h.breakAfter}}else return n.isText()?e==n.dom?r+i:r+(i?n.length:0):r}domAtPos(e,i){let{tile:n,offset:r}=this.tile.resolveBlock(e,i);return n.isWidget()?n.domPosFor(e,i):n.domIn(r,i)}inlineDOMNearPos(e,i){let n,r=-1,o=!1,a,c=-1,h=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=e)return!0;d.flags&16&&(o=!0)}else{let y=p+d.length;if(p<=e&&(n=d,r=e-p,o=y<e),y>=e&&!a&&(a=d,c=e-p,h=p>e),p>e&&a)return!0}}),!n&&!a?this.domAtPos(e,i):(o&&a?n=null:h&&n&&(a=null),n&&i<0||!a?n.domIn(r,i):a.domIn(c,i))}coordsAt(e,i){let{tile:n,offset:r}=this.tile.resolveBlock(e,i);return n.isWidget()?n.widget instanceof _p?null:n.coordsInWidget(r,i,!0):n.coordsIn(r,i)}lineAt(e,i){let{tile:n}=this.tile.resolveBlock(e,i);return n.isLine()?n:null}coordsForChar(e){let{tile:i,offset:n}=this.tile.resolveBlock(e,1);if(!i.isLine())return null;function r(o,a){if(o.isComposite())for(let c of o.children){if(c.length>=a){let h=r(c,a);if(h)return h}if(a-=c.length,a<0)break}else if(o.isText()&&a<o.length){let c=Et(o.text,a);if(c==a)return null;let h=Sa(o.dom,a,c).getClientRects();for(let d=0;d<h.length;d++){let p=h[d];if(d==h.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return r(i,n)}measureVisibleLineHeights(e){let i=[],{from:n,to:r}=e,o=this.view.contentDOM.clientWidth,a=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,h=this.view.textDirection==Ze.LTR,d=0,p=(y,b,x)=>{for(let w=0;w<y.children.length&&!(b>r);w++){let C=y.children[w],k=b+C.length,M=C.dom.getBoundingClientRect(),{height:O}=M;if(x&&!w&&(d+=M.top-x.top),C instanceof Qn)k>n&&p(C,b,M);else if(b>=n&&(d>0&&i.push(-d),i.push(O+d),d=0,a)){let D=C.dom.lastChild,V=D?ia(D):[];if(V.length){let H=V[V.length-1],Y=h?H.right-M.left:M.right-H.left;Y>c&&(c=Y,this.minWidth=o,this.minWidthFrom=b,this.minWidthTo=k)}}x&&w==y.children.length-1&&(d+=x.bottom-M.bottom),b=k+C.breakAfter}};return p(this.tile,0,null),i}textDirectionAt(e){let{tile:i}=this.tile.resolveBlock(e,1);return getComputedStyle(i.dom).direction=="rtl"?Ze.RTL:Ze.LTR}measureTextSize(){let e=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let c=0,h;for(let d of a.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=ia(d.dom);if(p.length!=1)return;c+=p[0].width,h=p[0].height}if(c)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:c/a.length,textHeight:h}}});if(e)return e;let i=document.createElement("div"),n,r,o;return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(i);let a=ia(i.firstChild)[0];n=i.getBoundingClientRect().height,r=a&&a.width?a.width/27:7,o=a&&a.height?a.height:n,i.remove()}),{lineHeight:n,charWidth:r,textHeight:o}}computeBlockGapDeco(){let e=[],i=this.view.viewState;for(let n=0,r=0;;r++){let o=r==i.viewports.length?null:i.viewports[r],a=o?o.from-1:this.view.state.doc.length;if(a>n){let c=(i.lineBlockAt(a).bottom-i.lineBlockAt(n).top)/this.view.scaleY;e.push(ge.replace({widget:new _p(c),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!o)break;n=o.to+1}return ge.set(e)}updateDeco(){let e=1,i=this.view.state.facet(Hh).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),n=!1,r=this.view.state.facet(Jg).map((o,a)=>{let c=typeof o=="function";return c&&(n=!0),c?o(this.view):o});for(r.length&&(this.dynamicDecorationMap[e++]=n,i.push(Ne.join(r))),this.decorations=[this.editContextFormatting,...i,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(HC).map(o=>typeof o=="function"?o(this.view):o)}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(BC))try{if(d(this.view,e.range,e))return!0}catch(p){ci(this.view.state,p,"scroll handler")}let{range:i}=e,n=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1),r;if(!n)return;!i.empty&&(r=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let o=$g(this.view),a={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:c,offsetHeight:h}=this.view.scrollDOM;if(p5(this.view.scrollDOM,a,i.head<i.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,c),-c),Math.max(Math.min(e.yMargin,h),-h),this.view.textDirection==Ze.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(i.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let i=n=>n.isWidget()||n.children.some(i);return i(this.tile.resolveBlock(e,1).tile)}destroy(){Zm(this.tile)}}function Zm(t,e){let i=e?.get(t);if(i!=1){i==null&&t.destroy();for(let n of t.children)Zm(n,e)}}function P5(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function FC(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let n=vC(i.focusNode,i.focusOffset),r=SC(i.focusNode,i.focusOffset),o=n||r;if(r&&n&&r.node!=n.node){let c=vt.get(r.node);if(!c||c.isText()&&c.text!=r.node.nodeValue)o=r;else if(t.docView.lastCompositionAfterCursor){let h=vt.get(n.node);!h||h.isText()&&h.text!=n.node.nodeValue||(o=r)}}if(t.docView.lastCompositionAfterCursor=o!=n,!o)return null;let a=e-o.offset;return{from:a,to:a+o.node.nodeValue.length,node:o.node}}function F5(t,e,i){let n=FC(t,i);if(!n)return null;let{node:r,from:o,to:a}=n,c=r.nodeValue;if(/[\n\r]/.test(c)||t.state.doc.sliceString(n.from,n.to)!=c)return null;let h=e.invertedDesc;return{range:new qi(h.mapPos(o),h.mapPos(a),o,a),text:r}}function V5(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let I5=class{constructor(){this.changes=[]}compareRange(e,i){wl(e,i,this.changes)}comparePoint(e,i){wl(e,i,this.changes)}boundChange(e){wl(e,e,this.changes)}};function Q5(t,e,i){let n=new I5;return Ne.compare(t,e,i,n),n.changes}class Y5{constructor(){this.changes=[]}compareRange(e,i){wl(e,i,this.changes)}comparePoint(){}boundChange(e){wl(e,e,this.changes)}}function G5(t,e,i){let n=new Y5;return Ne.compare(t,e,i,n),n.changes}function K5(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(i.nodeType==1&&i.contentEditable=="false")return!0;return!1}function W5(t,e){let i=!1;return e&&t.iterChangedRanges((n,r)=>{n<e.to&&r>e.from&&(i=!0)}),i}class _p extends Cn{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 X5(t,e,i=1){let n=t.charCategorizer(e),r=t.doc.lineAt(e),o=e-r.from;if(r.length==0)return W.cursor(e);o==0?i=1:o==r.length&&(i=-1);let a=o,c=o;i<0?a=Et(r.text,o,!1):c=Et(r.text,o);let h=n(r.text.slice(a,c));for(;a>0;){let d=Et(r.text,a,!1);if(n(r.text.slice(d,a))!=h)break;a=d}for(;c<r.length;){let d=Et(r.text,c);if(n(r.text.slice(c,d))!=h)break;c=d}return W.range(a+r.from,c+r.from)}function Z5(t,e,i,n,r){let o=Math.round((n-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>t.defaultLineHeight*1.5){let c=t.viewState.heightOracle.textHeight,h=Math.floor((r-i.top-(t.defaultLineHeight-c)*.5)/c);o+=h*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(i.from,i.to);return i.from+Um(a,o,t.state.tabSize)}function Jm(t,e,i){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){let r;for(let o of n.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!r||o.type==Ut.Text&&(r.type!=o.type||(i<0?o.from<e:o.to>e)))&&(r=o)}}return r||n}return n}function J5(t,e,i,n){let r=Jm(t,e.head,e.assoc||-1),o=!n||r.type!=Ut.Text||!(t.lineWrapping||r.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(o){let a=t.dom.getBoundingClientRect(),c=t.textDirectionAt(r.from),h=t.posAtCoords({x:i==(c==Ze.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(h!=null)return W.cursor(h,i?-1:1)}return W.cursor(i?r.to:r.from,i?-1:1)}function zv(t,e,i,n){let r=t.state.doc.lineAt(e.head),o=t.bidiSpans(r),a=t.textDirectionAt(r.from);for(let c=e,h=null;;){let d=M5(r,o,a,c,i),p=MC;if(!d){if(r.number==(i?t.state.doc.lines:1))return c;p=`
49
+ `,r=t.state.doc.line(r.number+(i?1:-1)),o=t.bidiSpans(r),d=t.visualLineSide(r,!i)}if(h){if(!h(p))return c}else{if(!n)return d;h=n(p)}c=d}}function $5(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return o=>{let a=n(o);return r==nt.Space&&(r=a),r==a}}function ej(t,e,i,n){let r=e.head,o=i?1:-1;if(r==(i?t.state.doc.length:0))return W.cursor(r,e.assoc);let a=e.goalColumn,c,h=t.contentDOM.getBoundingClientRect(),d=t.coordsAtPos(r,(e.empty?e.assoc:0)||(i?1:-1)),p=t.documentTop;if(d)a==null&&(a=d.left-h.left),c=o<0?d.top:d.bottom;else{let w=t.viewState.lineBlockAt(r);a==null&&(a=Math.min(h.right-h.left,t.defaultCharacterWidth*(r-w.from))),c=(o<0?w.top:w.bottom)+p}let y=h.left+a,b=n??t.viewState.heightOracle.textHeight>>1,x=$m(t,{x:y,y:c+b*o},!1,o);return W.cursor(x.pos,x.assoc,void 0,a)}function ra(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,(o,a,c)=>{if(e>o&&e<a){let h=n||i||(e-o<a-e?-1:1);e=h<0?o:a,n=h}});if(!n)return e}}function VC(t,e){let i=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],o=null;if(r.empty){let a=ra(t,r.from,0);a!=r.from&&(o=W.cursor(a,-1))}else{let a=ra(t,r.from,-1),c=ra(t,r.to,1);(a!=r.from||c!=r.to)&&(o=W.range(r.from==r.anchor?a:c,r.from==r.head?a:c))}o&&(i||(i=e.ranges.slice()),i[n]=o)}return i?W.create(i,e.mainIndex):e}function Hp(t,e,i){let n=ra(t.state.facet(_a).map(r=>r(t)),i.from,e.head>i.from?-1:1);return n==i.from?i:W.cursor(n,n<i.from?1:-1)}class pn{constructor(e,i){this.pos=e,this.assoc=i}}function $m(t,e,i,n){let r=t.contentDOM.getBoundingClientRect(),o=r.top+t.viewState.paddingTop,{x:a,y:c}=e,h=c-o,d;for(;;){if(h<0)return new pn(0,1);if(h>t.viewState.docHeight)return new pn(t.state.doc.length,-1);if(d=t.elementAtHeight(h),n==null)break;if(d.type==Ut.Text){if(n<0?d.to<t.viewport.from:d.from>t.viewport.to)break;let b=t.docView.coordsAt(n<0?d.from:d.to,n>0?-1:1);if(b&&(n<0?b.top<=h+o:b.bottom>=h+o))break}let y=t.viewState.heightOracle.textHeight/2;h=n>0?d.bottom+y:d.top-y}if(t.viewport.from>=d.to||t.viewport.to<=d.from){if(i)return null;if(d.type==Ut.Text){let y=Z5(t,r,d,a,c);return new pn(y,y==d.from?1:-1)}}if(d.type!=Ut.Text)return h<(d.top+d.bottom)/2?new pn(d.from,1):new pn(d.to,-1);let p=t.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=t.docView.lineAt(d.from,-2)),new tj(t,a,c,t.textDirectionAt(d.from)).scanTile(p,d.from)}class tj{constructor(e,i,n,r){this.view=e,this.x=i,this.y=n,this.baseDir=r,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,i){let{line:n,spans:r}=this.bidiSpansAt(e);return r[mn.find(r,e-n.from,-1,i)].level==this.baseDir}dirAt(e,i){let{line:n,spans:r}=this.bidiSpansAt(e);return r[mn.find(r,e-n.from,-1,i)].dir}bidiIn(e,i){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<i)}scan(e,i){let n=0,r=e.length-1,o=new Set,a=this.bidiIn(e[0],e[r]),c,h,d=-1,p=1e9,y;e:for(;n<r;){let x=r-n,w=n+r>>1;t:if(o.has(w)){let k=n+Math.floor(Math.random()*x);for(let M=0;M<x;M++){if(!o.has(k)){w=k;break t}k++,k==r&&(k=n)}break e}o.add(w);let C=i(w);if(C)for(let k=0;k<C.length;k++){let M=C[k],O=0;if(M.bottom<this.y)(!c||c.bottom<M.bottom)&&(c=M),O=1;else if(M.top>this.y)(!h||h.top>M.top)&&(h=M),O=-1;else{let D=M.left>this.x?this.x-M.left:M.right<this.x?this.x-M.right:0,V=Math.abs(D);V<p&&(d=w,p=V,y=M),D&&(O=D<0==(this.baseDir==Ze.LTR)?-1:1)}O==-1&&(!a||this.baseDirAt(e[w],1))?r=w:O==1&&(!a||this.baseDirAt(e[w+1],-1))&&(n=w+1)}}if(!y){let x=c&&(!h||this.y-c.bottom<h.top-this.y)?c:h;return this.y=(x.top+x.bottom)/2,this.scan(e,i)}let b=(a?this.dirAt(e[d],1):this.baseDir)==Ze.LTR;return{i:d,after:this.x>(y.left+y.right)/2==b}}scanText(e,i){let n=[];for(let o=0;o<e.length;o=Et(e.text,o))n.push(i+o);n.push(i+e.length);let r=this.scan(n,o=>{let a=n[o]-i,c=n[o+1]-i;return Sa(e.dom,a,c).getClientRects()});return r.after?new pn(n[r.i+1],-1):new pn(n[r.i],1)}scanTile(e,i){if(!e.length)return new pn(i,1);if(e.children.length==1){let c=e.children[0];if(c.isText())return this.scanText(c,i);if(c.isComposite())return this.scanTile(c,i)}let n=[i];for(let c=0,h=i;c<e.children.length;c++)n.push(h+=e.children[c].length);let r=this.scan(n,c=>{let h=e.children[c];return h.flags&48?null:(h.dom.nodeType==1?h.dom:Sa(h.dom,0,h.length)).getClientRects()}),o=e.children[r.i],a=n[r.i];return o.isText()?this.scanText(o,a):o.isComposite()?this.scanTile(o,a):r.after?new pn(n[r.i+1],-1):new pn(a,1)}}const Xo="￿";class ij{constructor(e,i){this.points=e,this.view=i,this.text="",this.lineSeparator=i.state.facet(Le.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Xo}readRange(e,i){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let o=this.text.length;this.readNode(r);let a=vt.get(r),c=r.nextSibling;if(c==i){a?.breakAfter&&!c&&n!=this.view.contentDOM&&this.lineBreak();break}let h=vt.get(c);(a&&h?a.breakAfter:(a?a.breakAfter:oh(r))||oh(c)&&(r.nodeName!="BR"||a?.isWidget())&&this.text.length>o)&&!rj(c,i)&&this.lineBreak(),r=c}return this.findPointBefore(n,i),this}readTextNode(e){let i=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,i.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,a=1,c;if(this.lineSeparator?(o=i.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(c=r.exec(i))&&(o=c.index,a=c[0].length),this.append(i.slice(n,o<0?i.length:o)),o<0)break;if(this.lineBreak(),a>1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=a-1);n=o+a}}readNode(e){let i=vt.get(e),n=i&&i.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.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,i){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==i&&(n.pos=this.text.length)}findPointInside(e,i){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(nj(e,n.node,n.offset)?i:0))}}function nj(t,e,i){for(;;){if(!e||i<Wn(e))return!1;if(e==t)return!0;i=Hr(e)+1,e=e.parentNode}}function rj(t,e){let i;for(;!(t==e||!t);t=t.nextSibling){let n=vt.get(t);if(!n?.isWidget())return!1;n&&(i||(i=[])).push(n)}if(i)for(let n of i){let r=n.overrideDOMText;if(r?.length)return!1}return!0}class _v{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}}class sj{constructor(e,i,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:o,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=IC(e.docView.tile,i,n,0))){let c=o||a?[]:oj(e),h=new ij(c,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=aj(c,this.bounds.from)}else{let c=e.observer.selectionRange,h=o&&o.node==c.focusNode&&o.offset==c.focusOffset||!Ym(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),d=a&&a.node==c.anchorNode&&a.offset==c.anchorOffset||!Ym(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),p=e.viewport;if((se.ios||se.chrome)&&e.state.selection.main.empty&&h!=d&&(p.from>0||p.to<e.state.doc.length)){let y=Math.min(h,d),b=Math.max(h,d),x=p.from-y,w=p.to-b;(x==0||x==1||y==0)&&(w==0||w==-1||b==e.state.doc.length)&&(h=0,d=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(W.range(d,h)):this.newSel=W.single(d,h)}}}function IC(t,e,i,n){if(t.isComposite()){let r=-1,o=-1,a=-1,c=-1;for(let h=0,d=n,p=n;h<t.children.length;h++){let y=t.children[h],b=d+y.length;if(d<e&&b>i)return IC(y,e,i,d);if(b>=e&&r==-1&&(r=h,o=d),d>i&&y.dom.parentNode==t.dom){a=h,c=p;break}p=b,d=b+y.breakAfter}return{from:o,to:c<0?n+t.length:c,startDOM:(r?t.children[r-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:a<t.children.length&&a>=0?t.children[a].dom:null}}else return t.isText()?{from:n,to:n+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function QC(t,e){let i,{newSel:n}=e,r=t.state.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:c}=e.bounds,h=r.from,d=null;(o===8||se.android&&e.text.length<c-a)&&(h=r.to,d="end");let p=YC(t.state.doc.sliceString(a,c,Xo),e.text,h-a,d);p&&(se.chrome&&o==13&&p.toB==p.from+2&&e.text.slice(p.from,p.toB)==Xo+Xo&&p.toB--,i={from:a+p.from,to:a+p.toA,insert:Ue.of(e.text.slice(p.from,p.toB).split(Xo))})}else n&&(!t.hasFocus&&t.state.facet(In)||hh(n,r))&&(n=null);if(!i&&!n)return!1;if(!i&&e.typeOver&&!r.empty&&n&&n.main.empty?i={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:(se.mac||se.android)&&i&&i.from==i.to&&i.from==r.head-1&&/^\. ?$/.test(i.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(n&&i.insert.length==2&&(n=W.single(n.main.anchor-1,n.main.head-1)),i={from:i.from,to:i.to,insert:Ue.of([i.insert.toString().replace("."," ")])}):i&&i.from>=r.from&&i.to<=r.to&&(i.from!=r.from||i.to!=r.to)&&r.to-r.from-(i.to-i.from)<=4?i={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,r.to))}:t.state.doc.lineAt(r.from).to<r.to&&t.docView.lineHasWidget(r.to)&&t.inputState.insertingTextAt>Date.now()-50?i={from:r.from,to:r.to,insert:t.state.toText(t.inputState.insertingText)}:se.chrome&&i&&i.from==i.to&&i.from==r.head&&i.insert.toString()==`
50
+ `&&t.lineWrapping&&(n&&(n=W.single(n.main.anchor-1,n.main.head-1)),i={from:r.from,to:r.to,insert:Ue.of([" "])}),i)return e0(t,i,n,o);if(n&&!hh(n,r)){let a=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(n=VC(t.state.facet(_a).map(h=>h(t)),n))),t.dispatch({selection:n,scrollIntoView:a,userEvent:c}),!0}else return!1}function e0(t,e,i,n=-1){if(se.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(se.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&t.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Cl(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&Cl(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Cl(t.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,c=()=>a||(a=lj(t,e,i));return t.state.facet(RC).some(h=>h(t,e.from,e.to,o,c))||t.dispatch(c()),!0}function lj(t,e,i){let n,r=t.state,o=r.selection.main,a=-1;if(e.from==e.to&&e.from<o.from||e.from>o.to){let h=e.from<o.from?-1:1,d=h<0?o.from:o.to,p=ra(r.facet(_a).map(y=>y(t)),d,h);e.from==p&&(a=p)}if(a>-1)n={changes:e,selection:W.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let h=o.from<e.from?r.sliceDoc(o.from,e.from):"",d=o.to>e.to?r.sliceDoc(e.to,o.to):"";n=r.replaceSelection(t.state.toText(h+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))}else{let h=r.changes(e),d=i&&i.main.to<=h.newLength?i.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=o.to+10&&e.to>=o.to-10){let p=t.state.sliceDoc(e.from,e.to),y,b=i&&FC(t,i.main.head);if(b){let w=e.insert.length-(e.to-e.from);y={from:b.from,to:b.to-w}}else y=t.state.doc.lineAt(o.head);let x=o.to-e.to;n=r.changeByRange(w=>{if(w.from==o.from&&w.to==o.to)return{changes:h,range:d||w.map(h)};let C=w.to-x,k=C-p.length;if(t.state.sliceDoc(k,C)!=p||C>=y.from&&k<=y.to)return{range:w};let M=r.changes({from:k,to:C,insert:e.insert}),O=w.to-o.to;return{changes:M,range:d?W.range(Math.max(0,d.anchor+O),Math.max(0,d.head+O)):w.map(M)}})}else n={changes:h,selection:d&&r.selection.replaceRange(d)}}let c="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,c+=".compose",t.inputState.compositionFirstChange&&(c+=".start",t.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:c,scrollIntoView:!0})}function YC(t,e,i,n){let r=Math.min(t.length,e.length),o=0;for(;o<r&&t.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==r&&t.length==e.length)return null;let a=t.length,c=e.length;for(;a>0&&c>0&&t.charCodeAt(a-1)==e.charCodeAt(c-1);)a--,c--;if(n=="end"){let h=Math.max(0,o-Math.min(a,c));i-=a+h-o}if(a<o&&t.length<e.length){let h=i<=o&&i>=a?o-i:0;o-=h,c=o+(c-a),a=o}else if(c<o){let h=i<=o&&i>=c?o-i:0;o-=h,a=o+(a-c),c=o}return{from:o,toA:a,toB:c}}function oj(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:o}=t.observer.selectionRange;return i&&(e.push(new _v(i,n)),(r!=i||o!=n)&&e.push(new _v(r,o))),e}function aj(t,e){if(t.length==0)return null;let i=t[0].pos,n=t.length==2?t[1].pos:i;return i>-1&&n>-1?W.single(i+e,n+e):null}function hh(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class uj{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,se.safari&&e.contentDOM.addEventListener("input",()=>null),se.gecko&&kj(e.contentDOM.ownerDocument)}handleEvent(e){!yj(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,i){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,i);for(let r of n.handlers){if(i.defaultPrevented)break;if(r(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=cj(e),n=this.handlers,r=this.view.contentDOM;for(let o in i)if(o!="scroll"){let a=!i[o].handlers.length,c=n[o];c&&a!=!c.handlers.length&&(r.removeEventListener(o,this.handleEvent),c=null),c||r.addEventListener(o,this.handleEvent,{passive:a})}for(let o in n)o!="scroll"&&!i[o]&&r.removeEventListener(o,this.handleEvent);this.handlers=i}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&&KC.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),se.android&&se.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let i;return se.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((i=GC.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||hj.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=i||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let i=this.pendingIOSKey;return!i||i.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Cl(this.view.contentDOM,i.key,i.keyCode,i instanceof KeyboardEvent?i:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:se.safari&&!se.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 Hv(t,e){return(i,n)=>{try{return e.call(t,n,i)}catch(r){ci(i.state,r)}}}function cj(t){let e=Object.create(null);function i(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of t){let r=n.spec,o=r&&r.plugin.domEventHandlers,a=r&&r.plugin.domEventObservers;if(o)for(let c in o){let h=o[c];h&&i(c).handlers.push(Hv(n.value,h))}if(a)for(let c in a){let h=a[c];h&&i(c).observers.push(Hv(n.value,h))}}for(let n in $i)i(n).handlers.push($i[n]);for(let n in Ii)i(n).observers.push(Ii[n]);return e}const GC=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],hj="dthko",KC=[16,17,18,20,91,92,224,225],dc=6;function pc(t){return Math.max(0,t)*.7+8}function fj(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class dj{constructor(e,i,n,r){this.view=e,this.startEvent=i,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParents=m5(e.contentDOM),this.atoms=e.state.facet(_a).map(a=>a(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=e.state.facet(Le.allowMultipleSelections)&&pj(e,i),this.dragging=gj(e,i)&&ZC(i)==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&&fj(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,n=0,r=0,o=0,a=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:c}=this.scrollParents.y.getBoundingClientRect());let h=$g(this.view);e.clientX-h.left<=r+dc?i=-pc(r-e.clientX):e.clientX+h.right>=a-dc&&(i=pc(e.clientX-a)),e.clientY-h.top<=o+dc?n=-pc(o-e.clientY):e.clientY+h.bottom>=c-dc&&(n=pc(e.clientY-c)),this.setScrollSpeed(i,n)}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,i){this.scrollSpeed={x:e,y:i},e||i?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:i}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),i&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=i,i=0),(e||i)&&this.view.win.scrollBy(e,i),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:i}=this,n=VC(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(i.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(i=>i.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function pj(t,e){let i=t.state.facet(TC);return i.length?i[0](e):se.mac?e.metaKey:e.ctrlKey}function mj(t,e){let i=t.state.facet(OC);return i.length?i[0](e):se.mac?!e.altKey:!e.ctrlKey}function gj(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=xa(t.root);if(!n||n.rangeCount==0)return!0;let r=n.getRangeAt(0).getClientRects();for(let o=0;o<r.length;o++){let a=r[o];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function yj(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target,n;i!=t.contentDOM;i=i.parentNode)if(!i||i.nodeType==11||(n=vt.get(i))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(e))return!1;return!0}const $i=Object.create(null),Ii=Object.create(null),WC=se.ie&&se.ie_version<15||se.ios&&se.webkit_version<604;function bj(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{t.focus(),i.remove(),XC(t,i.value)},50)}function Ph(t,e,i){for(let n of t.facet(e))i=n(i,t);return i}function XC(t,e){e=Ph(t.state,Wg,e);let{state:i}=t,n,r=1,o=i.toText(e),a=o.lines==i.selection.ranges.length;if(eg!=null&&i.selection.ranges.every(h=>h.empty)&&eg==o.toString()){let h=-1;n=i.changeByRange(d=>{let p=i.doc.lineAt(d.from);if(p.from==h)return{range:d};h=p.from;let y=i.toText((a?o.line(r++).text:e)+i.lineBreak);return{changes:{from:p.from,insert:y},range:W.cursor(d.from+y.length)}})}else a?n=i.changeByRange(h=>{let d=o.line(r++);return{changes:{from:h.from,to:h.to,insert:d.text},range:W.cursor(h.from+d.length)}}):n=i.replaceSelection(o);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ii.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};$i.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ii.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ii.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};$i.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of t.state.facet(EC))if(i=n(t,e),i)break;if(!i&&e.button==0&&(i=vj(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new dj(t,e,i,n)),n&&t.observer.ignore(()=>{bC(t.contentDOM);let o=t.root.activeElement;o&&!o.contains(t.contentDOM)&&o.blur()});let r=t.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Uv(t,e,i,n){if(n==1)return W.cursor(e,i);if(n==2)return X5(t.state,e,i);{let r=t.docView.lineAt(e,i),o=t.state.doc.lineAt(r?r.posAtEnd:e),a=r?r.posAtStart:o.from,c=r?r.posAtEnd:o.to;return c<t.state.doc.length&&c==o.to&&c++,W.range(a,c)}}const xj=se.ie&&se.ie_version<=11;let qv=null,Pv=0,Fv=0;function ZC(t){if(!xj)return t.detail;let e=qv,i=Fv;return qv=t,Fv=Date.now(),Pv=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Pv+1)%3:1}function vj(t,e){let i=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=ZC(e),r=t.state.selection;return{update(o){o.docChanged&&(i.pos=o.changes.mapPos(i.pos),r=r.map(o.changes))},get(o,a,c){let h=t.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),d,p=Uv(t,h.pos,h.assoc,n);if(i.pos!=h.pos&&!a){let y=Uv(t,i.pos,i.assoc,n),b=Math.min(y.from,p.from),x=Math.max(y.to,p.to);p=b<p.from?W.range(b,x):W.range(x,b)}return a?r.replaceRange(r.main.extend(p.from,p.to)):c&&n==1&&r.ranges.length>1&&(d=Sj(r,h.pos))?d:c?r.addRange(p):W.create([p])}}}function Sj(t,e){for(let i=0;i<t.ranges.length;i++){let{from:n,to:r}=t.ranges[i];if(n<=e&&r>=e)return W.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}$i.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let r=t.docView.tile.nearest(e.target);if(r&&r.isWidget()){let o=r.posAtStart,a=o+r.length;(o>=i.to||a<=i.from)&&(i=W.range(o,a))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",Ph(t.state,Xg,t.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1};$i.dragend=t=>(t.inputState.draggedContent=null,!1);function Vv(t,e,i,n){if(i=Ph(t.state,Wg,i),!i)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=t.inputState,a=n&&o&&mj(t,e)?{from:o.from,to:o.to}:null,c={from:r,insert:i},h=t.state.changes(a?[a,c]:c);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}$i.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),r=0,o=()=>{++r==i.length&&Vv(t,e,n.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a<i.length;a++){let c=new FileReader;c.onerror=o,c.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(n[a]=c.result),o()},c.readAsText(i[a])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Vv(t,e,n,!0),!0}return!1};$i.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=WC?null:e.clipboardData;return i?(XC(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(bj(t),!1)};function wj(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),t.focus()},50)}function Cj(t){let e=[],i=[],n=!1;for(let r of t.selection.ranges)r.empty||(e.push(t.sliceDoc(r.from,r.to)),i.push(r));if(!e.length){let r=-1;for(let{from:o}of t.selection.ranges){let a=t.doc.lineAt(o);a.number>r&&(e.push(a.text),i.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),r=a.number}n=!0}return{text:Ph(t,Xg,e.join(t.lineBreak)),ranges:i,linewise:n}}let eg=null;$i.copy=$i.cut=(t,e)=>{if(!ta(t.contentDOM,t.observer.selectionRange))return!1;let{text:i,ranges:n,linewise:r}=Cj(t.state);if(!i&&!r)return!1;eg=r?i:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=WC?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",i),!0):(wj(t,i),!1)};const JC=Sn.define();function $C(t,e){let i=[];for(let n of t.facet(DC)){let r=n(t,e);r&&i.push(r)}return i.length?t.update({effects:i,annotations:JC.of(!0)}):null}function ek(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=$C(t.state,e);i?t.dispatch(i):t.update([])}},10)}Ii.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),ek(t)};Ii.blur=t=>{t.observer.clearSelectionRange(),ek(t)};Ii.compositionstart=Ii.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ii.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,se.chrome&&se.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ii.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};$i.beforeinput=(t,e)=>{var i,n;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let o=(i=e.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain"),a=e.getTargetRanges();if(o&&a.length){let c=a[0],h=t.posAtDOM(c.startContainer,c.startOffset),d=t.posAtDOM(c.endContainer,c.endOffset);return e0(t,{from:h,to:d,insert:t.state.toText(o)},null),!0}}let r;if(se.chrome&&se.android&&(r=GC.find(o=>o.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let o=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return se.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),se.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ii.compositionend(t,e),20),!1};const Iv=new Set;function kj(t){Iv.has(t)||(Iv.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Qv=["pre-wrap","normal","pre-line","break-spaces"];let jl=!1;function Yv(){jl=!1}class Aj{constructor(e){this.lineWrapping=e,this.doc=Ue.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,i){let n=this.doc.lineAt(i).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((i-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}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 Qv.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let i=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(i=!0,this.heightSamples[Math.floor(r*10)]=!0)}return i}refresh(e,i,n,r,o,a){let c=Qv.indexOf(e)>-1,h=Math.abs(i-this.lineHeight)>.3||this.lineWrapping!=c||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=c,this.lineHeight=i,this.charWidth=n,this.textHeight=r,this.lineLength=o,h){this.heightSamples={};for(let d=0;d<a.length;d++){let p=a[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return h}}class Mj{constructor(e,i){this.from=e,this.heights=i,this.index=0}get more(){return this.index<this.heights.length}}class Wi{constructor(e,i,n,r,o){this.from=e,this.length=i,this.top=n,this.height=r,this._content=o}get type(){return typeof this._content=="number"?Ut.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 Ss?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let i=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Wi(this.from,this.length+e.length,this.top,this.height+e.height,i)}}var Je=(function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t})(Je||(Je={}));const Hc=.001;class Jt{constructor(e,i,n=2){this.length=e,this.height=i,this.flags=n}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)>Hc&&(jl=!0),this.height=e)}replace(e,i,n){return Jt.of(n)}decomposeLeft(e,i){i.push(this)}decomposeRight(e,i){i.push(this)}applyChanges(e,i,n,r){let o=this,a=n.doc;for(let c=r.length-1;c>=0;c--){let{fromA:h,toA:d,fromB:p,toB:y}=r[c],b=o.lineAt(h,Je.ByPosNoHeight,n.setDoc(i),0,0),x=b.to>=d?b:o.lineAt(d,Je.ByPosNoHeight,n,0,0);for(y+=x.to-d,d=x.to;c>0&&b.from<=r[c-1].toA;)h=r[c-1].fromA,p=r[c-1].fromB,c--,h<b.from&&(b=o.lineAt(h,Je.ByPosNoHeight,n,0,0));p+=b.from-h,h=b.from;let w=t0.build(n.setDoc(a),e,p,y);o=fh(o,o.replace(h,d,w))}return o.updateHeight(n,0)}static empty(){return new Ai(0,0,0)}static of(e){if(e.length==1)return e[0];let i=0,n=e.length,r=0,o=0;for(;;)if(i==n)if(r>o*2){let c=e[i-1];c.break?e.splice(--i,1,c.left,null,c.right):e.splice(--i,1,c.left,c.right),n+=1+c.break,r-=c.size}else if(o>r*2){let c=e[n];c.break?e.splice(n,1,c.left,null,c.right):e.splice(n,1,c.left,c.right),n+=2+c.break,o-=c.size}else break;else if(r<o){let c=e[i++];c&&(r+=c.size)}else{let c=e[--n];c&&(o+=c.size)}let a=0;return e[i-1]==null?(a=1,i--):e[i]==null&&(a=1,n++),new Oj(Jt.of(e.slice(0,i)),a,Jt.of(e.slice(n)))}}function fh(t,e){return t==e?t:(t.constructor!=e.constructor&&(jl=!0),e)}Jt.prototype.size=1;const Tj=ge.replace({});class tk extends Jt{constructor(e,i,n){super(e,i),this.deco=n,this.spaceAbove=0}mainBlock(e,i){return new Wi(i,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,i,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new Wi(r,0,n,this.spaceAbove,Tj):this.mainBlock(n,r)}lineAt(e,i,n,r,o){let a=this.mainBlock(r,o);return this.spaceAbove?this.blockAt(0,n,r,o).join(a):a}forEachLine(e,i,n,r,o,a){e<=o+this.length&&i>=o&&a(this.lineAt(0,Je.ByPos,n,r,o))}setMeasuredHeight(e){let i=e.heights[e.index++];i<0?(this.spaceAbove=-i,i=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(i)}updateHeight(e,i=0,n=!1,r){return r&&r.from<=i&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ai extends tk{constructor(e,i,n){super(e,i,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,i){return new Wi(i,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,i,n){let r=n[0];return n.length==1&&(r instanceof Ai||r instanceof zt&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof zt?r=new Ai(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Jt.of(n)}updateHeight(e,i=0,n=!1,r){return r&&r.from<=i&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class zt extends Jt{constructor(e){super(e,0)}heightMetrics(e,i){let n=e.doc.lineAt(i).number,r=e.doc.lineAt(i+this.length).number,o=r-n+1,a,c=0;if(e.lineWrapping){let h=Math.min(this.height,e.lineHeight*o);a=h/o,this.length>o+1&&(c=(this.height-h)/(this.length-o-1))}else a=this.height/o;return{firstLine:n,lastLine:r,perLine:a,perChar:c}}blockAt(e,i,n,r){let{firstLine:o,lastLine:a,perLine:c,perChar:h}=this.heightMetrics(i,r);if(i.lineWrapping){let d=r+(e<i.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),p=i.doc.lineAt(d),y=c+p.length*h,b=Math.max(n,e-y/2);return new Wi(p.from,p.length,b,y,0)}else{let d=Math.max(0,Math.min(a-o,Math.floor((e-n)/c))),{from:p,length:y}=i.doc.line(o+d);return new Wi(p,y,n+c*d,c,0)}}lineAt(e,i,n,r,o){if(i==Je.ByHeight)return this.blockAt(e,n,r,o);if(i==Je.ByPosNoHeight){let{from:x,to:w}=n.doc.lineAt(e);return new Wi(x,w-x,0,0,0)}let{firstLine:a,perLine:c,perChar:h}=this.heightMetrics(n,o),d=n.doc.lineAt(e),p=c+d.length*h,y=d.number-a,b=r+c*y+h*(d.from-o-y);return new Wi(d.from,d.length,Math.max(r,Math.min(b,r+this.height-p)),p,0)}forEachLine(e,i,n,r,o,a){e=Math.max(e,o),i=Math.min(i,o+this.length);let{firstLine:c,perLine:h,perChar:d}=this.heightMetrics(n,o);for(let p=e,y=r;p<=i;){let b=n.doc.lineAt(p);if(p==e){let w=b.number-c;y+=h*w+d*(e-o-w)}let x=h+d*b.length;a(new Wi(b.from,b.length,y,x,0)),y+=x,p=b.to+1}}replace(e,i,n){let r=this.length-i;if(r>0){let o=n[n.length-1];o instanceof zt?n[n.length-1]=new zt(o.length+r):n.push(null,new zt(r-1))}if(e>0){let o=n[0];o instanceof zt?n[0]=new zt(e+o.length):n.unshift(new zt(e-1),null)}return Jt.of(n)}decomposeLeft(e,i){i.push(new zt(e-1),null)}decomposeRight(e,i){i.push(null,new zt(this.length-e-1))}updateHeight(e,i=0,n=!1,r){let o=i+this.length;if(r&&r.from<=i+this.length&&r.more){let a=[],c=Math.max(i,r.from),h=-1;for(r.from>i&&a.push(new zt(r.from-i-1).updateHeight(e,i));c<=o&&r.more;){let p=e.doc.lineAt(c).length;a.length&&a.push(null);let y=r.heights[r.index++],b=0;y<0&&(b=-y,y=r.heights[r.index++]),h==-1?h=y:Math.abs(y-h)>=Hc&&(h=-2);let x=new Ai(p,y,b);x.outdated=!1,a.push(x),c+=p+1}c<=o&&a.push(null,new zt(o-c).updateHeight(e,c));let d=Jt.of(a);return(h<0||Math.abs(d.height-this.height)>=Hc||Math.abs(h-this.heightMetrics(e,i).perLine)>=Hc)&&(jl=!0),fh(this,d)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(i,i+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Oj extends Jt{constructor(e,i,n){super(e.length+i+n.length,e.height+n.height,i|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,i,n,r){let o=n+this.left.height;return e<o?this.left.blockAt(e,i,n,r):this.right.blockAt(e,i,o,r+this.left.length+this.break)}lineAt(e,i,n,r,o){let a=r+this.left.height,c=o+this.left.length+this.break,h=i==Je.ByHeight?e<a:e<c,d=h?this.left.lineAt(e,i,n,r,o):this.right.lineAt(e,i,n,a,c);if(this.break||(h?d.to<c:d.from>c))return d;let p=i==Je.ByPosNoHeight?Je.ByPosNoHeight:Je.ByPos;return h?d.join(this.right.lineAt(c,p,n,a,c)):this.left.lineAt(c,p,n,r,o).join(d)}forEachLine(e,i,n,r,o,a){let c=r+this.left.height,h=o+this.left.length+this.break;if(this.break)e<h&&this.left.forEachLine(e,i,n,r,o,a),i>=h&&this.right.forEachLine(e,i,n,c,h,a);else{let d=this.lineAt(h,Je.ByPos,n,r,o);e<d.from&&this.left.forEachLine(e,d.from-1,n,r,o,a),d.to>=e&&d.from<=i&&a(d),i>d.to&&this.right.forEachLine(d.to+1,i,n,c,h,a)}}replace(e,i,n){let r=this.left.length+this.break;if(i<r)return this.balanced(this.left.replace(e,i,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,i-r,n));let o=[];e>0&&this.decomposeLeft(e,o);let a=o.length;for(let c of n)o.push(c);if(e>0&&Gv(o,a-1),i<this.length){let c=o.length;this.decomposeRight(i,o),Gv(o,c)}return Jt.of(o)}decomposeLeft(e,i){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,i);i.push(this.left),this.break&&(n++,e>=n&&i.push(null)),e>n&&this.right.decomposeLeft(e-n,i)}decomposeRight(e,i){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,i);e<n&&this.left.decomposeRight(e,i),this.break&&e<r&&i.push(null),i.push(this.right)}balanced(e,i){return e.size>2*i.size||i.size>2*e.size?Jt.of(this.break?[e,null,i]:[e,i]):(this.left=fh(this.left,e),this.right=fh(this.right,i),this.setHeight(e.height+i.height),this.outdated=e.outdated||i.outdated,this.size=e.size+i.size,this.length=e.length+this.break+i.length,this)}updateHeight(e,i=0,n=!1,r){let{left:o,right:a}=this,c=i+o.length+this.break,h=null;return r&&r.from<=i+o.length&&r.more?h=o=o.updateHeight(e,i,n,r):o.updateHeight(e,i,n),r&&r.from<=c+a.length&&r.more?h=a=a.updateHeight(e,c,n,r):a.updateHeight(e,c,n),h?this.balanced(o,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Gv(t,e){let i,n;t[e]==null&&(i=t[e-1])instanceof zt&&(n=t[e+1])instanceof zt&&t.splice(e-1,3,new zt(i.length+1+n.length))}const Ej=5;class t0{constructor(e,i){this.pos=e,this.oracle=i,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,i){if(this.lineStart>-1){let n=Math.min(i,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Ai?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ai(n-this.pos,-1,0)),this.writtenTo=n,i>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}point(e,i,n){if(e<i||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,o=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=i-e;n.block?this.addBlock(new tk(a,r,n)):(a||o||r>=Ej)&&this.addLineDeco(r,o,a)}else i>e&&this.span(e,i);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:i}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=i,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 Ai(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,i){let n=new zt(i-e);return this.oracle.doc.lineAt(e).to==i&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ai)return e;let i=new Ai(0,-1,0);return this.nodes.push(i),i}addBlock(e){this.enterLine();let i=e.deco;i&&i.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,i&&i.endSide>0&&(this.covering=e)}addLineDeco(e,i,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=i,this.writtenTo=this.pos=this.pos+n}finish(e){let i=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(i instanceof Ai)&&!this.isCovered?this.nodes.push(new Ai(0,-1,0)):(this.writtenTo<this.pos||i==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let r of this.nodes)r instanceof Ai&&r.updateHeight(this.oracle,n),n+=r?r.length:1;return this.nodes}static build(e,i,n,r){let o=new t0(n,e);return Ne.spans(i,n,r,o,0),o.finish(n)}}function Nj(t,e,i){let n=new Rj;return Ne.compare(t,e,i,n,0),n.changes}class Rj{constructor(){this.changes=[]}compareRange(){}comparePoint(e,i,n,r){(e<i||n&&n.heightRelevant||r&&r.heightRelevant)&&wl(e,i,this.changes,5)}}function Dj(t,e){let i=t.getBoundingClientRect(),n=t.ownerDocument,r=n.defaultView||window,o=Math.max(0,i.left),a=Math.min(r.innerWidth,i.right),c=Math.max(0,i.top),h=Math.min(r.innerHeight,i.bottom);for(let d=t.parentNode;d&&d!=n.body;)if(d.nodeType==1){let p=d,y=window.getComputedStyle(p);if((p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth)&&y.overflow!="visible"){let b=p.getBoundingClientRect();o=Math.max(o,b.left),a=Math.min(a,b.right),c=Math.max(c,b.top),h=Math.min(d==t.parentNode?r.innerHeight:h,b.bottom)}d=y.position=="absolute"||y.position=="fixed"?p.offsetParent:p.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-i.left,right:Math.max(o,a)-i.left,top:c-(i.top+e),bottom:Math.max(c,h)-(i.top+e)}}function jj(t){let e=t.getBoundingClientRect(),i=t.ownerDocument.defaultView||window;return e.left<i.innerWidth&&e.right>0&&e.top<i.innerHeight&&e.bottom>0}function Lj(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class Up{constructor(e,i,n,r){this.from=e,this.to=i,this.size=n,this.displaySize=r}static same(e,i){if(e.length!=i.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=i[n];if(r.from!=o.from||r.to!=o.to||r.size!=o.size)return!1}return!0}draw(e,i){return ge.replace({widget:new Bj(this.displaySize*(i?e.scaleY:e.scaleX),i)}).range(this.from,this.to)}}class Bj extends Cn{constructor(e,i){super(),this.size=e,this.vertical=i}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 Kv{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Wv,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ze.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet(Zg).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Aj(i),this.stateDeco=Xv(e),this.heightMap=Jt.empty().applyChanges(this.stateDeco,Ue.empty,this.heightOracle.setDoc(e.doc),[new qi(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ge.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:i}=this.state.selection;for(let n=0;n<=1;n++){let r=n?i.head:i.anchor;if(!e.some(({from:o,to:a})=>r>=o&&r<=a)){let{from:o,to:a}=this.lineBlockAt(r);e.push(new mc(o,a))}}return this.viewports=e.sort((n,r)=>n.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Wv:new i0(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(Zo(e,this.scaler))})}update(e,i=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Xv(this.state);let r=e.changedRanges,o=qi.extendWithRanges(r,Nj(n,this.stateDeco,e?e.changes:wt.empty(this.state.doc.length))),a=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Yv(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=a||jl)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let h=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(i&&(i.range.head<h.from||i.range.head>h.to)||!this.viewportIsAppropriate(h))&&(h=this.getViewport(0,i));let d=h.from!=this.viewport.from||h.to!=this.viewport.to;this.viewport=h,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),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(LC)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),r=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Ze.RTL:Ze.LTR;let a=this.heightOracle.mustRefreshForWrapping(o)||this.mustMeasureContent==="refresh",c=i.getBoundingClientRect(),h=a||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let d=0,p=0;if(c.width&&c.height){let{scaleX:V,scaleY:H}=yC(i,c);(V>.005&&Math.abs(this.scaleX-V)>.005||H>.005&&Math.abs(this.scaleY-H)>.005)&&(this.scaleX=V,this.scaleY=H,d|=16,a=h=!0)}let y=(parseInt(n.paddingTop)||0)*this.scaleY,b=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=y||this.paddingBottom!=b)&&(this.paddingTop=y,this.paddingBottom=b,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(h=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let x=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=x&&(this.scrollAnchorHeight=-1,this.scrollTop=x),this.scrolledToBottom=xC(e.scrollDOM);let w=(this.printing?Lj:Dj)(i,this.paddingTop),C=w.top-this.pixelViewport.top,k=w.bottom-this.pixelViewport.bottom;this.pixelViewport=w;let M=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(M!=this.inView&&(this.inView=M,M&&(h=!0)),!this.inView&&!this.scrollTarget&&!jj(e.dom))return 0;let O=c.width;if((this.contentDOMWidth!=O||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),h){let V=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(V)&&(a=!0),a||r.lineWrapping&&Math.abs(O-this.contentDOMWidth)>r.charWidth){let{lineHeight:H,charWidth:Y,textHeight:U}=e.docView.measureTextSize();a=H>0&&r.refresh(o,H,Y,U,Math.max(5,O/Y),V),a&&(e.docView.minWidth=0,d|=16)}C>0&&k>0?p=Math.max(C,k):C<0&&k<0&&(p=Math.min(C,k)),Yv();for(let H of this.viewports){let Y=H.from==this.viewport.from?V:e.docView.measureVisibleLineHeights(H);this.heightMap=(a?Jt.empty().applyChanges(this.stateDeco,Ue.empty,this.heightOracle,[new qi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new Mj(H.from,Y))}jl&&(d|=2)}let D=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return D&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||D)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]: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,i){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,o=this.heightOracle,{visibleTop:a,visibleBottom:c}=this,h=new mc(r.lineAt(a-n*1e3,Je.ByHeight,o,0,0).from,r.lineAt(c+(1-n)*1e3,Je.ByHeight,o,0,0).to);if(i){let{head:d}=i.range;if(d<h.from||d>h.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),y=r.lineAt(d,Je.ByPos,o,0,0),b;i.y=="center"?b=(y.top+y.bottom)/2-p/2:i.y=="start"||i.y=="nearest"&&d<h.from?b=y.top:b=y.bottom-p,h=new mc(r.lineAt(b-1e3/2,Je.ByHeight,o,0,0).from,r.lineAt(b+p+1e3/2,Je.ByHeight,o,0,0).to)}}return h}mapViewport(e,i){let n=i.mapPos(e.from,-1),r=i.mapPos(e.to,1);return new mc(this.heightMap.lineAt(n,Je.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Je.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:i},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Je.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(i,Je.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:c}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(i==this.state.doc.length||o>=c+Math.max(10,Math.min(n,250)))&&r>a-2*1e3&&o<c+2*1e3}mapLineGaps(e,i){if(!e.length||i.empty)return e;let n=[];for(let r of e)i.touchesRange(r.from,r.to)||n.push(new Up(i.mapPos(r.from),i.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,i){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,o=r>>1,a=r<<1;if(this.defaultTextDirection!=Ze.LTR&&!n)return[];let c=[],h=(p,y,b,x)=>{if(y-p<o)return;let w=this.state.selection.main,C=[w.from];w.empty||C.push(w.to);for(let M of C)if(M>p&&M<y){h(p,M-10,b,x),h(M+10,y,b,x);return}let k=_j(e,M=>M.from>=b.from&&M.to<=b.to&&Math.abs(M.from-p)<o&&Math.abs(M.to-y)<o&&!C.some(O=>M.from<O&&M.to>O));if(!k){if(y<b.to&&i&&n&&i.visibleRanges.some(D=>D.from<=y&&D.to>=y)){let D=i.moveToLineBoundary(W.cursor(y),!1,!0).head;D>p&&(y=D)}let M=this.gapSize(b,p,y,x),O=n||M<2e6?M:2e6;k=new Up(p,y,M,O)}c.push(k)},d=p=>{if(p.length<a||p.type!=Ut.Text)return;let y=zj(p.from,p.to,this.stateDeco);if(y.total<a)return;let b=this.scrollTarget?this.scrollTarget.range.head:null,x,w;if(n){let C=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,k,M;if(b!=null){let O=yc(y,b),D=((this.visibleBottom-this.visibleTop)/2+C)/p.height;k=O-D,M=O+D}else k=(this.visibleTop-p.top-C)/p.height,M=(this.visibleBottom-p.top+C)/p.height;x=gc(y,k),w=gc(y,M)}else{let C=y.total*this.heightOracle.charWidth,k=r*this.heightOracle.charWidth,M=0;if(C>2e6)for(let Y of e)Y.from>=p.from&&Y.from<p.to&&Y.size!=Y.displaySize&&Y.from*this.heightOracle.charWidth+M<this.pixelViewport.left&&(M=Y.size-Y.displaySize);let O=this.pixelViewport.left+M,D=this.pixelViewport.right+M,V,H;if(b!=null){let Y=yc(y,b),U=((D-O)/2+k)/C;V=Y-U,H=Y+U}else V=(O-k)/C,H=(D+k)/C;x=gc(y,V),w=gc(y,H)}x>p.from&&h(p.from,x,p,y),w<p.to&&h(w,p.to,p,y)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return c}gapSize(e,i,n,r){let o=yc(r,n)-yc(r,i);return this.heightOracle.lineWrapping?e.height*o:r.total*this.heightOracle.charWidth*o}updateLineGaps(e){Up.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ge.set(e.map(i=>i.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let i=this.stateDeco;this.lineGaps.length&&(i=i.concat(this.lineGapDeco));let n=[];Ne.spans(i,this.viewport.from,this.viewport.to,{span(o,a){n.push({from:o,to:a})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let o=0;o<n.length&&!(r&8);o++){let a=this.visibleRanges[o],c=n[o];(a.from!=c.from||a.to!=c.to)&&(r|=4,e&&e.mapPos(a.from,-1)==c.from&&e.mapPos(a.to,1)==c.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(i=>i.from<=e&&i.to>=e)||Zo(this.heightMap.lineAt(e,Je.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(i=>i.top<=e&&i.bottom>=e)||Zo(this.heightMap.lineAt(this.scaler.fromDOM(e),Je.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let i=this.lineBlockAtHeight(e+8);return i.from>=this.viewport.from||this.viewportLines[0].top-e>200?i:this.viewportLines[0]}elementAtHeight(e){return Zo(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 mc{constructor(e,i){this.from=e,this.to=i}}function zj(t,e,i){let n=[],r=t,o=0;return Ne.spans(i,t,e,{span(){},point(a,c){a>r&&(n.push({from:r,to:a}),o+=a-r),r=c}},20),r<e&&(n.push({from:r,to:e}),o+=e-r),{total:o,ranges:n}}function gc({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let r=0;;r++){let{from:o,to:a}=e[r],c=a-o;if(n<=c)return o+n;n-=c}}function yc(t,e){let i=0;for(let{from:n,to:r}of t.ranges){if(e<=r){i+=e-n;break}i+=r-n}return i/t.total}function _j(t,e){for(let i of t)if(e(i))return i}const Wv={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function Xv(t){let e=t.facet(Hh).filter(n=>typeof n!="function"),i=t.facet(Jg).filter(n=>typeof n!="function");return i.length&&e.push(Ne.join(i)),e}class i0{constructor(e,i,n){let r=0,o=0,a=0;this.viewports=n.map(({from:c,to:h})=>{let d=i.lineAt(c,Je.ByPos,e,0,0).top,p=i.lineAt(h,Je.ByPos,e,0,0).bottom;return r+=p-d,{from:c,to:h,top:d,bottom:p,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(i.height-r);for(let c of this.viewports)c.domTop=a+(c.top-o)*this.scale,a=c.domBottom=c.domTop+(c.bottom-c.top),o=c.bottom}toDOM(e){for(let i=0,n=0,r=0;;i++){let o=i<this.viewports.length?this.viewports[i]:null;if(!o||e<o.top)return r+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,r=o.domBottom}}fromDOM(e){for(let i=0,n=0,r=0;;i++){let o=i<this.viewports.length?this.viewports[i]:null;if(!o||e<o.domTop)return n+(e-r)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,r=o.domBottom}}eq(e){return e instanceof i0?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((i,n)=>i.from==e.viewports[n].from&&i.to==e.viewports[n].to):!1}}function Zo(t,e){if(e.scale==1)return t;let i=e.toDOM(t.top),n=e.toDOM(t.bottom);return new Wi(t.from,t.length,i,n-i,Array.isArray(t._content)?t._content.map(r=>Zo(r,e)):t._content)}const bc=le.define({combine:t=>t.join(" ")}),tg=le.define({combine:t=>t.indexOf(!0)>-1}),ig=zr.newName(),ik=zr.newName(),nk=zr.newName(),rk={"&light":"."+ik,"&dark":"."+nk};function ng(t,e,i){return new zr(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,r=>{if(r=="&")return t;if(!i||!i[r])throw new RangeError(`Unsupported selector: ${r}`);return i[r]}):t+" "+n}})}const Hj=ng("."+ig,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},rk),Uj={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},qp=se.ie&&se.ie_version<=11;class qj{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new g5,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(i=>{for(let n of i)this.queue.push(n);(se.ie&&se.ie_version<=11||se.ios&&e.composing)&&i.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&se.android&&e.constructor.EDIT_CONTEXT!==!1&&!(se.chrome&&se.chrome_version<126)&&(this.editContext=new Fj(e),e.state.facet(In)&&(e.contentDOM.editContext=this.editContext.editContext)),qp&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.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 i;((i=this.view.docView)===null||i===void 0?void 0:i.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(i=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),i.length>0&&i[i.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(i=>{i.length>0&&i[i.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((i,n)=>i!=e[n]))){this.gapIntersection.disconnect();for(let i of e)this.gapIntersection.observe(i);this.gaps=e}}onSelectionChange(e){let i=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(In)?n.root.activeElement!=this.dom:!ta(this.dom,r))return;let o=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(o&&o.isWidget()&&o.widget.ignoreEvent(e)){i||(this.selectionChanged=!1);return}(se.ie&&se.ie_version<=11||se.android&&se.chrome)&&!n.state.selection.main.empty&&r.focusNode&&na(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=xa(e.root);if(!i)return!1;let n=se.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Pj(this.view,i)||i;if(!n||this.selectionRange.eq(n))return!1;let r=ta(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&b5(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,i){this.selectionRange.set(e.node,e.offset,i.node,i.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,i=null;for(let n=this.dom;n;)if(n.nodeType==1)!i&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:i||(i=this.scrollTargets.slice(0,e)),i&&i.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!i&&(i=this.scrollTargets.slice(0,e)),i){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=i)n.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,Uj),qp&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),qp&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,i){var n;if(!this.delayedAndroidKey){let r=()=>{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&Cl(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:i,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.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 i=-1,n=-1,r=!1;for(let o of e){let a=this.readMutation(o);a&&(a.typeOver&&(r=!0),i==-1?{from:i,to:n}=a:(i=Math.min(a.from,i),n=Math.max(a.to,n)))}return{from:i,to:n,typeOver:r}}readChange(){let{from:e,to:i,typeOver:n}=this.processRecords(),r=this.selectionChanged&&ta(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new sj(this.view,e,i,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let n=this.view.state,r=QC(this.view,i);return this.view.state==n&&(i.domChanged||i.newSel&&!hh(this.view.state.selection,i.newSel.main))&&this.view.update([]),r}readMutation(e){let i=this.view.docView.tile.nearest(e.target);if(!i||i.isWidget())return null;if(i.markDirty(e.type=="attributes"),e.type=="childList"){let n=Zv(i,e.previousSibling||e.target.previousSibling,-1),r=Zv(i,e.nextSibling||e.target.nextSibling,1);return{from:n?i.posAfter(n):i.posAtStart,to:r?i.posBefore(r):i.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:i.posAtStart,to:i.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(In)!=e.state.facet(In)&&(e.view.contentDOM.editContext=e.state.facet(In)?this.editContext.editContext:null))}destroy(){var e,i,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(i=this.gapIntersection)===null||i===void 0||i.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let r of this.scrollTargets)r.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 Zv(t,e,i){for(;e;){let n=vt.get(e);if(n&&n.parent==t)return n;let r=e.parentNode;e=r!=t.dom?r:i>0?e.nextSibling:e.previousSibling}return null}function Jv(t,e){let i=e.startContainer,n=e.startOffset,r=e.endContainer,o=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor,1);return na(a.node,a.offset,r,o)&&([i,n,r,o]=[r,o,i,n]),{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:o}}function Pj(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return Jv(t,r)}let i=null;function n(r){r.preventDefault(),r.stopImmediatePropagation(),i=r.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),i?Jv(t,i):null}class Fj{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let i=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=n=>{let r=e.state.selection.main,{anchor:o,head:a}=r,c=this.toEditorPos(n.updateRangeStart),h=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:c,drifted:!1});let d=h-c>n.text.length;c==this.from&&o<this.from?c=o:h==this.to&&o>this.to&&(h=o);let p=YC(e.state.sliceDoc(c,h),n.text,(d?r.from:r.to)-c,d?"end":null);if(!p){let b=W.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));hh(b,r)||e.dispatch({selection:b,userEvent:"select"});return}let y={from:p.from+c,to:p.toA+c,insert:Ue.of(n.text.slice(p.from,p.toB).split(`
51
+ `))};if((se.mac||se.android)&&y.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(y={from:c,to:h,insert:Ue.of([n.text.replace("."," ")])}),this.pendingContextChange=y,!e.state.readOnly){let b=this.to-this.from+(y.to-y.from+y.insert.length);e0(e,y,W.single(this.toEditorPos(n.selectionStart,b),this.toEditorPos(n.selectionEnd,b)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),y.from<y.to&&!y.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(i.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(i.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],o=null;for(let a=this.toEditorPos(n.rangeStart),c=this.toEditorPos(n.rangeEnd);a<c;a++){let h=e.coordsForChar(a);o=h&&new DOMRect(h.left,h.top,h.right-h.left,h.bottom-h.top)||o||new DOMRect,r.push(o)}i.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let o of n.getTextFormats()){let a=o.underlineStyle,c=o.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(c)){let h=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(h<d){let p=`text-decoration: underline ${/^[a-z]/.test(a)?a+" ":a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${/thin/i.test(c)?1:2}px`;r.push(ge.mark({attributes:{style:p}}).range(h,d))}}}e.dispatch({effects:zC.of(ge.set(r))})},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:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)i.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=xa(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((o,a,c,h,d)=>{if(n)return;let p=d.length-(a-o);if(r&&a>=r.to)if(r.from==o&&r.to==a&&r.insert.eq(d)){r=this.pendingContextChange=null,i+=p,this.to+=p;return}else r=null,this.revertPending(e.state);if(o+=i,a+=i,a<=this.from)this.from+=p,this.to+=p;else if(o<this.to){if(o<this.from||a>this.to||this.to-this.from+d.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(a),d.toString()),this.to+=p}i+=p}),r&&!n&&this.revertPending(e.state),!n}update(e){let i=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.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||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+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 i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),r=this.toContextPos(i.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ie{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 i;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(r=>r.forEach(o=>n(o,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||y5(e.parent)||document,this.viewState=new Kv(e.state||Le.create(e)),e.scrollTo&&e.scrollTo.is(fc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(gl).map(r=>new Lp(r));for(let r of this.plugins)r.update(this);this.observer=new qj(this),this.inputState=new uj(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Bv(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((i=document.fonts)===null||i===void 0)&&i.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let i=e.length==1&&e[0]instanceof At?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(i,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let i=!1,n=!1,r,o=this.state;for(let b of e){if(b.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=b.state}if(this.destroyed){this.viewState.state=o;return}let a=this.hasFocus,c=0,h=null;e.some(b=>b.annotation(JC))?(this.inputState.notifiedFocused=a,c=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,h=$C(o,a),h||(c=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(p=null)):this.observer.clear(),o.facet(Le.phrases)!=this.state.facet(Le.phrases))return this.setState(o);r=ah.create(this,o,e),r.flags|=c;let y=this.viewState.scrollTarget;try{this.updateState=2;for(let b of e){if(y&&(y=y.map(b.changes)),b.scrollIntoView){let{main:x}=b.state.selection;y=new kl(x.empty?x:W.cursor(x.head,x.head>x.anchor?-1:1))}for(let x of b.effects)x.is(fc)&&(y=x.value.clip(this.state))}this.viewState.update(r,y),this.bidiCache=dh.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),i=this.docView.update(r),this.state.facet(Wo)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(i,e.some(b=>b.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(bc)!=r.state.facet(bc)&&(this.viewState.mustMeasureContent=!0),(i||n||y||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!r.empty)for(let b of this.state.facet(Xm))try{b(r)}catch(x){ci(this.state,x,"update listener")}(h||p)&&Promise.resolve().then(()=>{h&&this.state==h.startState&&this.dispatch(h),p&&!QC(this,p)&&d.force&&Cl(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 i=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Kv(e),this.plugins=e.facet(gl).map(n=>new Lp(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Bv(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}updatePlugins(e){let i=e.startState.facet(gl),n=e.state.facet(gl);if(i!=n){let r=[];for(let o of n){let a=i.indexOf(o);if(a<0)r.push(new Lp(o));else{let c=this.plugins[a];c.mustUpdate=e,r.push(c)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);i!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let i=e.value;if(i&&i.docViewUpdate)try{i.docViewUpdate(this)}catch(n){ci(this.state,n,"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 i=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:a}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(a<0)if(xC(n))o=-1,a=this.viewState.heightMap.height;else{let x=this.viewState.scrollAnchorAt(r);o=x.from,a=x.top}this.updateState=1;let h=this.viewState.measure(this);if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];h&4||([this.measureRequests,d]=[d,this.measureRequests]);let p=d.map(x=>{try{return x.read(this)}catch(w){return ci(this.state,w),$v}}),y=ah.create(this,this.state,[]),b=!1;y.flags|=h,i?i.flags|=h:i=y,this.updateState=2,y.empty||(this.updatePlugins(y),this.inputState.update(y),this.updateAttrs(),b=this.docView.update(y),b&&this.docViewUpdate());for(let x=0;x<d.length;x++)if(p[x]!=$v)try{let w=d[x];w.write&&w.write(p[x],this)}catch(w){ci(this.state,w)}if(b&&this.docView.updateSelection(!0),!y.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let w=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-a;if(w>1||w<-1){r=r+w,n.scrollTop=r/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(i&&!i.empty)for(let c of this.state.facet(Xm))c(i)}get themeClasses(){return ig+" "+(this.state.facet(tg)?nk:ik)+" "+this.state.facet(bc)}updateAttrs(){let e=eS(this,_C,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(In)?"true":"false",class:"cm-content",style:`${se.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),eS(this,Zg,i);let n=this.observer.ignore(()=>{let r=Ev(this.contentDOM,this.contentAttrs,i),o=Ev(this.dom,this.editorAttrs,e);return r||o});return this.editorAttrs=e,this.contentAttrs=i,n}showAnnouncements(e){let i=!0;for(let n of e)for(let r of n.effects)if(r.is(ie.announce)){i&&(this.announceDOM.textContent=""),i=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Wo);let e=this.state.facet(ie.cspNonce);zr.mount(this.root,this.styleModules.concat(Hj).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 i=0;i<this.measureRequests.length;i++)if(this.measureRequests[i].key===e.key){this.measureRequests[i]=e;return}}this.measureRequests.push(e)}}plugin(e){let i=this.pluginMap.get(e);return(i===void 0||i&&i.plugin!=e)&&this.pluginMap.set(e,i=this.plugins.find(n=>n.plugin==e)||null),i&&i.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,i,n){return Hp(this,e,zv(this,e,i,n))}moveByGroup(e,i){return Hp(this,e,zv(this,e,i,n=>$5(this,e.head,n)))}visualLineSide(e,i){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),o=n[i?n.length-1:0];return W.cursor(o.side(i,r)+e.from,o.forward(!i,r)?1:-1)}moveToLineBoundary(e,i,n=!0){return J5(this,e,i,n)}moveVertically(e,i,n){return Hp(this,e,ej(this,e,i,n))}domAtPos(e,i=1){return this.docView.domAtPos(e,i)}posAtDOM(e,i=0){return this.docView.posFromDOM(e,i)}posAtCoords(e,i=!0){this.readMeasured();let n=$m(this,e,i);return n&&n.pos}posAndSideAtCoords(e,i=!0){return this.readMeasured(),$m(this,e,i)}coordsAtPos(e,i=1){this.readMeasured();let n=this.docView.coordsAt(e,i);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),o=this.bidiSpans(r),a=o[mn.find(o,e-r.from,-1,i)];return va(n,a.dir==Ze.LTR==i>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(jC)||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>Vj)return AC(e.length);let i=this.textDirectionAt(e.from),n;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==i&&(o.fresh||kC(o.isolates,n=Dv(this,e))))return o.order;n||(n=Dv(this,e));let r=A5(e.text,i,n);return this.bidiCache.push(new dh(e.from,e.to,i,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||se.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{bC(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,i={}){return fc.of(new kl(typeof e=="number"?W.cursor(e):e,i.y,i.x,i.yMargin,i.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:i}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return fc.of(new kl(W.cursor(n.from),"start","start",n.top-e,i,!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 at.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return at.define(()=>({}),{eventObservers:e})}static theme(e,i){let n=zr.newName(),r=[bc.of(n),Wo.of(ng(`.${n}`,e))];return i&&i.dark&&r.push(tg.of(!0)),r}static baseTheme(e){return As.lowest(Wo.of(ng("."+ig,e,rk)))}static findFromDOM(e){var i;let n=e.querySelector(".cm-content"),r=n&&vt.get(n)||vt.get(e);return((i=r?.root)===null||i===void 0?void 0:i.view)||null}}ie.styleModule=Wo;ie.inputHandler=RC;ie.clipboardInputFilter=Wg;ie.clipboardOutputFilter=Xg;ie.scrollHandler=BC;ie.focusChangeEffect=DC;ie.perLineTextDirection=jC;ie.exceptionSink=NC;ie.updateListener=Xm;ie.editable=In;ie.mouseSelectionStyle=EC;ie.dragMovesSelection=OC;ie.clickAddsSelectionRange=TC;ie.decorations=Hh;ie.blockWrappers=HC;ie.outerDecorations=Jg;ie.atomicRanges=_a;ie.bidiIsolatedRanges=UC;ie.scrollMargins=qC;ie.darkTheme=tg;ie.cspNonce=le.define({combine:t=>t.length?t[0]:""});ie.contentAttributes=Zg;ie.editorAttributes=_C;ie.lineWrapping=ie.contentAttributes.of({class:"cm-lineWrapping"});ie.announce=Se.define();const Vj=4096,$v={};class dh{constructor(e,i,n,r,o,a){this.from=e,this.to=i,this.dir=n,this.isolates=r,this.fresh=o,this.order=a}static update(e,i){if(i.empty&&!e.some(o=>o.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:Ze.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let a=e[o];a.dir==r&&!i.touchesRange(a.from,a.to)&&n.push(new dh(i.mapPos(a.from,1),i.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return n}}function eS(t,e,i){for(let n=t.state.facet(e),r=n.length-1;r>=0;r--){let o=n[r],a=typeof o=="function"?o(t):o;a&&Yg(a,i)}return i}const Ij=se.mac?"mac":se.windows?"win":se.linux?"linux":"key";function Qj(t,e){const i=t.split(/-(?!$)/);let n=i[i.length-1];n=="Space"&&(n=" ");let r,o,a,c;for(let h=0;h<i.length-1;++h){const d=i[h];if(/^(cmd|meta|m)$/i.test(d))c=!0;else if(/^a(lt)?$/i.test(d))r=!0;else if(/^(c|ctrl|control)$/i.test(d))o=!0;else if(/^s(hift)?$/i.test(d))a=!0;else if(/^mod$/i.test(d))e=="mac"?c=!0:o=!0;else throw new Error("Unrecognized modifier name: "+d)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),c&&(n="Meta-"+n),a&&(n="Shift-"+n),n}function xc(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),i!==!1&&e.shiftKey&&(t="Shift-"+t),t}const Yj=As.default(ie.domEventHandlers({keydown(t,e){return lk(sk(e.state),t,e,"editor")}})),Fh=le.define({enables:Yj}),tS=new WeakMap;function sk(t){let e=t.facet(Fh),i=tS.get(e);return i||tS.set(e,i=Wj(e.reduce((n,r)=>n.concat(r),[]))),i}function Gj(t,e,i){return lk(sk(t.state),e,t,i)}let Tr=null;const Kj=4e3;function Wj(t,e=Ij){let i=Object.create(null),n=Object.create(null),r=(a,c)=>{let h=n[a];if(h==null)n[a]=c;else if(h!=c)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},o=(a,c,h,d,p)=>{var y,b;let x=i[a]||(i[a]=Object.create(null)),w=c.split(/ (?!$)/).map(M=>Qj(M,e));for(let M=1;M<w.length;M++){let O=w.slice(0,M).join(" ");r(O,!0),x[O]||(x[O]={preventDefault:!0,stopPropagation:!1,run:[D=>{let V=Tr={view:D,prefix:O,scope:a};return setTimeout(()=>{Tr==V&&(Tr=null)},Kj),!0}]})}let C=w.join(" ");r(C,!1);let k=x[C]||(x[C]={preventDefault:!1,stopPropagation:!1,run:((b=(y=x._any)===null||y===void 0?void 0:y.run)===null||b===void 0?void 0:b.slice())||[]});h&&k.run.push(h),d&&(k.preventDefault=!0),p&&(k.stopPropagation=!0)};for(let a of t){let c=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of c){let p=i[d]||(i[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:y}=a;for(let b in p)p[b].run.push(x=>y(x,rg))}let h=a[e]||a.key;if(h)for(let d of c)o(d,h,a.run,a.preventDefault,a.stopPropagation),a.shift&&o(d,"Shift-"+h,a.shift,a.preventDefault,a.stopPropagation)}return i}let rg=null;function lk(t,e,i,n){rg=e;let r=a5(e),o=li(r,0),a=dn(o)==r.length&&r!=" ",c="",h=!1,d=!1,p=!1;Tr&&Tr.view==i&&Tr.scope==n&&(c=Tr.prefix+" ",KC.indexOf(e.keyCode)<0&&(d=!0,Tr=null));let y=new Set,b=k=>{if(k){for(let M of k.run)if(!y.has(M)&&(y.add(M),M(i)))return k.stopPropagation&&(p=!0),!0;k.preventDefault&&(k.stopPropagation&&(p=!0),d=!0)}return!1},x=t[n],w,C;return x&&(b(x[c+xc(r,e,!a)])?h=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(se.windows&&e.ctrlKey&&e.altKey)&&!(se.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(w=_r[e.keyCode])&&w!=r?(b(x[c+xc(w,e,!0)])||e.shiftKey&&(C=ya[e.keyCode])!=r&&C!=w&&b(x[c+xc(C,e,!1)]))&&(h=!0):a&&e.shiftKey&&b(x[c+xc(r,e,!0)])&&(h=!0),!h&&b(x._any)&&(h=!0)),d&&(h=!0),h&&p&&e.stopPropagation(),rg=null,h}class Ha{constructor(e,i,n,r,o){this.className=e,this.left=i,this.top=n,this.width=r,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,i){return i.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,i,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let o=ok(e);return[new Ha(i,r.left-o.left,r.top-o.top,null,r.bottom-r.top)]}else return Xj(e,i,n)}}function ok(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ze.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function iS(t,e,i,n){let r=t.coordsAtPos(e,i*2);if(!r)return n;let o=t.dom.getBoundingClientRect(),a=(r.top+r.bottom)/2,c=t.posAtCoords({x:o.left+1,y:a}),h=t.posAtCoords({x:o.right-1,y:a});return c==null||h==null?n:{from:Math.max(n.from,Math.min(c,h)),to:Math.min(n.to,Math.max(c,h))}}function Xj(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),o=t.textDirection==Ze.LTR,a=t.contentDOM,c=a.getBoundingClientRect(),h=ok(t),d=a.querySelector(".cm-line"),p=d&&window.getComputedStyle(d),y=c.left+(p?parseInt(p.paddingLeft)+Math.min(0,parseInt(p.textIndent)):0),b=c.right-(p?parseInt(p.paddingRight):0),x=Jm(t,n,1),w=Jm(t,r,-1),C=x.type==Ut.Text?x:null,k=w.type==Ut.Text?w:null;if(C&&(t.lineWrapping||x.widgetLineBreaks)&&(C=iS(t,n,1,C)),k&&(t.lineWrapping||w.widgetLineBreaks)&&(k=iS(t,r,-1,k)),C&&k&&C.from==k.from&&C.to==k.to)return O(D(i.from,i.to,C));{let H=C?D(i.from,null,C):V(x,!1),Y=k?D(null,i.to,k):V(w,!0),U=[];return(C||x).to<(k||w).from-(C&&k?1:0)||x.widgetLineBreaks>1&&H.bottom+t.defaultLineHeight/2<Y.top?U.push(M(y,H.bottom,b,Y.top)):H.bottom<Y.top&&t.elementAtHeight((H.bottom+Y.top)/2).type==Ut.Text&&(H.bottom=Y.top=(H.bottom+Y.top)/2),O(H).concat(U).concat(O(Y))}function M(H,Y,U,J){return new Ha(e,H-h.left,Y-h.top,Math.max(0,U-H),J-Y)}function O({top:H,bottom:Y,horizontal:U}){let J=[];for(let Z=0;Z<U.length;Z+=2)J.push(M(U[Z],H,U[Z+1],Y));return J}function D(H,Y,U){let J=1e9,Z=-1e9,ce=[];function oe(fe,de,_,X,ne){let ue=t.coordsAtPos(fe,fe==U.to?-2:2),ye=t.coordsAtPos(_,_==U.from?2:-2);!ue||!ye||(J=Math.min(ue.top,ye.top,J),Z=Math.max(ue.bottom,ye.bottom,Z),ne==Ze.LTR?ce.push(o&&de?y:ue.left,o&&X?b:ye.right):ce.push(!o&&X?y:ye.left,!o&&de?b:ue.right))}let q=H??U.from,ee=Y??U.to;for(let fe of t.visibleRanges)if(fe.to>q&&fe.from<ee)for(let de=Math.max(fe.from,q),_=Math.min(fe.to,ee);;){let X=t.state.doc.lineAt(de);for(let ne of t.bidiSpans(X)){let ue=ne.from+X.from,ye=ne.to+X.from;if(ue>=_)break;ye>de&&oe(Math.max(ue,de),H==null&&ue<=q,Math.min(ye,_),Y==null&&ye>=ee,ne.dir)}if(de=X.to+1,de>=_)break}return ce.length==0&&oe(q,H==null,ee,Y==null,t.textDirection),{top:J,bottom:Z,horizontal:ce}}function V(H,Y){let U=c.top+(Y?H.top:H.bottom);return{top:U,bottom:U,horizontal:[]}}}function Zj(t,e){return t.constructor==e.constructor&&t.eq(e)}class Jj{constructor(e,i){this.view=e,this.layer=i,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"),i.above&&this.dom.classList.add("cm-layer-above"),i.class&&this.dom.classList.add(i.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),i.mount&&i.mount(this.dom,e)}update(e){e.startState.facet(Uc)!=e.state.facet(Uc)&&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 i=0,n=e.facet(Uc);for(;i<n.length&&n[i]!=this.layer;)i++;this.dom.style.zIndex=String((this.layer.above?150:-1)-i)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:i}=this.view;(e!=this.scaleX||i!=this.scaleY)&&(this.scaleX=e,this.scaleY=i,this.dom.style.transform=`scale(${1/e}, ${1/i})`)}draw(e){if(e.length!=this.drawn.length||e.some((i,n)=>!Zj(i,this.drawn[n]))){let i=this.dom.firstChild,n=0;for(let r of e)r.update&&i&&r.constructor&&this.drawn[n].constructor&&r.update(i,this.drawn[n])?(i=i.nextSibling,n++):this.dom.insertBefore(r.draw(),i);for(;i;){let r=i.nextSibling;i.remove(),i=r}this.drawn=e,se.safari&&se.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Uc=le.define();function ak(t){return[at.define(e=>new Jj(e,t)),Uc.of(t)]}const wa=le.define({combine(t){return wn(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,i)=>Math.min(e,i),drawRangeCursor:(e,i)=>e||i})}});function $j(t={}){return[wa.of(t),eL,tL,iL,LC.of(!0)]}function uk(t){return t.startState.facet(wa)!=t.state.facet(wa)}const eL=ak({above:!0,markers(t){let{state:e}=t,i=e.facet(wa),n=[];for(let r of e.selection.ranges){let o=r==e.selection.main;if(r.empty||i.drawRangeCursor){let a=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=r.empty?r:W.cursor(r.head,r.head>r.anchor?-1:1);for(let h of Ha.forRange(t,a,c))n.push(h)}}return n},update(t,e){t.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let i=uk(t);return i&&nS(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){nS(e.state,t)},class:"cm-cursorLayer"});function nS(t,e){e.style.animationDuration=t.facet(wa).cursorBlinkRate+"ms"}const tL=ak({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Ha.forRange(t,"cm-selectionBackground",e)).reduce((e,i)=>e.concat(i))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||uk(t)},class:"cm-selectionLayer"}),iL=As.highest(ie.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"}}}})),ck=Se.define({map(t,e){return t==null?null:e.mapPos(t)}}),Jo=It.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((i,n)=>n.is(ck)?n.value:i,t)}}),nL=at.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(Jo);i==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Jo)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Jo),i=e!=null&&t.coordsAtPos(e);if(!i)return null;let n=t.scrollDOM.getBoundingClientRect();return{left:i.left-n.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-n.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:i}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/i+"px",this.cursor.style.height=t.height/i+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Jo)!=t&&this.view.dispatch({effects:ck.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function rL(){return[Jo,nL]}function rS(t,e,i,n,r){e.lastIndex=0;for(let o=t.iterRange(i,n),a=i,c;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;c=e.exec(o.value);)r(a+c.index,c)}function sL(t,e){let i=t.visibleRanges;if(i.length==1&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:r,to:o}of i)r=Math.max(t.state.doc.lineAt(r).from,r-e),o=Math.min(t.state.doc.lineAt(o).to,o+e),n.length&&n[n.length-1].to>=r?n[n.length-1].to=o:n.push({from:r,to:o});return n}class lL{constructor(e){const{regexp:i,decoration:n,decorate:r,boundary:o,maxLength:a=1e3}=e;if(!i.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=i,r)this.addMatch=(c,h,d,p)=>r(p,d,d+c[0].length,c,h);else if(typeof n=="function")this.addMatch=(c,h,d,p)=>{let y=n(c,h,d);y&&p(d,d+c[0].length,y)};else if(n)this.addMatch=(c,h,d,p)=>p(d,d+c[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=a}createDeco(e){let i=new Kn,n=i.add.bind(i);for(let{from:r,to:o}of sL(e,this.maxLength))rS(e.state.doc,this.regexp,r,o,(a,c)=>this.addMatch(c,e,a,n));return i.finish()}updateDeco(e,i){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((o,a,c,h)=>{h>=e.view.viewport.from&&c<=e.view.viewport.to&&(n=Math.min(c,n),r=Math.max(h,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,i.map(e.changes),n,r):i}updateRange(e,i,n,r){for(let o of e.visibleRanges){let a=Math.max(o.from,n),c=Math.min(o.to,r);if(c>=a){let h=e.state.doc.lineAt(a),d=h.to<c?e.state.doc.lineAt(c):h,p=Math.max(o.from,h.from),y=Math.min(o.to,d.to);if(this.boundary){for(;a>h.from;a--)if(this.boundary.test(h.text[a-1-h.from])){p=a;break}for(;c<d.to;c++)if(this.boundary.test(d.text[c-d.from])){y=c;break}}let b=[],x,w=(C,k,M)=>b.push(M.range(C,k));if(h==d)for(this.regexp.lastIndex=p-h.from;(x=this.regexp.exec(h.text))&&x.index<y-h.from;)this.addMatch(x,e,x.index+h.from,w);else rS(e.state.doc,this.regexp,p,y,(C,k)=>this.addMatch(k,e,C,w));i=i.update({filterFrom:p,filterTo:y,filter:(C,k)=>C<p||k>y,add:b})}}return i}}const sg=/x/.unicode!=null?"gu":"g",oL=new RegExp(`[\0-\b
52
+ --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,sg),aL={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 Pp=null;function uL(){var t;if(Pp==null&&typeof document<"u"&&document.body){let e=document.body.style;Pp=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Pp||!1}const qc=le.define({combine(t){let e=wn(t,{render:null,specialChars:oL,addSpecialChars:null});return(e.replaceTabs=!uL())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,sg)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,sg)),e}});function cL(t={}){return[qc.of(t),hL()]}let sS=null;function hL(){return sS||(sS=at.fromClass(class{constructor(t){this.view=t,this.decorations=ge.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(qc)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new lL({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:r}=i.state,o=li(e[0],0);if(o==9){let a=r.lineAt(n),c=i.state.tabSize,h=Pl(a.text,c,n-a.from);return ge.replace({widget:new mL((c-h%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=ge.replace({widget:new pL(t,o)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(qc);t.startState.facet(qc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const fL="•";function dL(t){return t>=32?fL:t==10?"␤":String.fromCharCode(9216+t)}class pL extends Cn{constructor(e,i){super(),this.options=e,this.code=i}eq(e){return e.code==this.code}toDOM(e){let i=dL(this.code),n=e.state.phrase("Control character")+" "+(aL[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,i);if(r)return r;let o=document.createElement("span");return o.textContent=i,o.title=n,o.setAttribute("aria-label",n),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class mL extends Cn{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 gL(){return bL}const yL=ge.line({class:"cm-activeLine"}),bL=at.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let n of t.state.selection.ranges){let r=t.lineBlockAt(n.head);r.from>e&&(i.push(yL.range(r.from)),e=r.from)}return ge.set(i)}},{decorations:t=>t.decorations});class xL extends Cn{constructor(e){super(),this.content=e}toDOM(e){let i=document.createElement("span");return i.className="cm-placeholder",i.style.pointerEvents="none",i.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),i.setAttribute("aria-hidden","true"),i}coordsAt(e){let i=e.firstChild?ia(e.firstChild):[];if(!i.length)return null;let n=window.getComputedStyle(e.parentNode),r=va(i[0],n.direction!="rtl"),o=parseInt(n.lineHeight);return r.bottom-r.top>o*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+o}:r}ignoreEvent(){return!1}}function vL(t){let e=at.fromClass(class{constructor(i){this.view=i,this.placeholder=t?ge.set([ge.widget({widget:new xL(t),side:1}).range(0)]):ge.none}get decorations(){return this.view.state.doc.length?ge.none:this.placeholder}},{decorations:i=>i.decorations});return typeof t=="string"?[e,ie.contentAttributes.of({"aria-placeholder":t})]:e}const lg=2e3;function SL(t,e,i){let n=Math.min(e.line,i.line),r=Math.max(e.line,i.line),o=[];if(e.off>lg||i.off>lg||e.col<0||i.col<0){let a=Math.min(e.off,i.off),c=Math.max(e.off,i.off);for(let h=n;h<=r;h++){let d=t.doc.line(h);d.length<=c&&o.push(W.range(d.from+a,d.to+c))}}else{let a=Math.min(e.col,i.col),c=Math.max(e.col,i.col);for(let h=n;h<=r;h++){let d=t.doc.line(h),p=Um(d.text,a,t.tabSize,!0);if(p<0)o.push(W.cursor(d.to));else{let y=Um(d.text,c,t.tabSize);o.push(W.range(d.from+p,d.from+y))}}}return o}function wL(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}function lS(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),r=i-n.from,o=r>lg?-1:r==n.length?wL(t,e.clientX):Pl(n.text,t.state.tabSize,i-n.from);return{line:n.number,col:o,off:r}}function CL(t,e){let i=lS(t,e),n=t.state.selection;return i?{update(r){if(r.docChanged){let o=r.changes.mapPos(r.startState.doc.line(i.line).from),a=r.state.doc.lineAt(o);i={line:a.number,col:i.col,off:Math.min(i.off,a.length)},n=n.map(r.changes)}},get(r,o,a){let c=lS(t,r);if(!c)return n;let h=SL(t.state,i,c);return h.length?a?W.create(h.concat(n.ranges)):W.create(h):n}}:null}function kL(t){let e=(i=>i.altKey&&i.button==0);return ie.mouseSelectionStyle.of((i,n)=>e(n)?CL(i,n):null)}const AL={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},ML={style:"cursor: crosshair"};function TL(t={}){let[e,i]=AL[t.key||"Alt"],n=at.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==e||i(r))},keyup(r){(r.keyCode==e||!i(r))&&this.set(!1)},mousemove(r){this.set(i(r))}}});return[n,ie.contentAttributes.of(r=>{var o;return!((o=r.plugin(n))===null||o===void 0)&&o.isDown?ML:null})]}const vc="-10000px";class hk{constructor(e,i,n,r){this.facet=i,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(i),this.tooltips=this.input.filter(a=>a);let o=null;this.tooltipViews=this.tooltips.map(a=>o=n(a,o))}update(e,i){var n;let r=e.state.facet(this.facet),o=r.filter(h=>h);if(r===this.input){for(let h of this.tooltipViews)h.update&&h.update(e);return!1}let a=[],c=i?[]:null;for(let h=0;h<o.length;h++){let d=o[h],p=-1;if(d){for(let y=0;y<this.tooltips.length;y++){let b=this.tooltips[y];b&&b.create==d.create&&(p=y)}if(p<0)a[h]=this.createTooltipView(d,h?a[h-1]:null),c&&(c[h]=!!d.above);else{let y=a[h]=this.tooltipViews[p];c&&(c[h]=i[p]),y.update&&y.update(e)}}}for(let h of this.tooltipViews)a.indexOf(h)<0&&(this.removeTooltipView(h),(n=h.destroy)===null||n===void 0||n.call(h));return i&&(c.forEach((h,d)=>i[d]=h),i.length=c.length),this.input=r,this.tooltips=o,this.tooltipViews=a,!0}}function OL(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Fp=le.define({combine:t=>{var e,i,n;return{position:se.ios?"absolute":((e=t.find(r=>r.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((i=t.find(r=>r.parent))===null||i===void 0?void 0:i.parent)||null,tooltipSpace:((n=t.find(r=>r.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||OL}}}),oS=new WeakMap,n0=at.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Fp);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new hk(t,r0,(i,n)=>this.createTooltip(i,n),i=>{this.resizeObserver&&this.resizeObserver.unobserve(i.dom),i.dom.remove()}),this.above=this.manager.tooltips.map(i=>!!i.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(i=>{Date.now()>this.lastTransaction-50&&i.length>0&&i[i.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Fp);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t,e){let i=t.create(this.view),n=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",i.dom.appendChild(r)}return i.dom.style.position=this.position,i.dom.style.top=vc,i.dom.style.left="0px",this.container.insertBefore(i.dom,n),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i}destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(t=n.destroy)===null||t===void 0||t.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(i=this.intersectionObserver)===null||i===void 0||i.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,i=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:o}=this.manager.tooltipViews[0];if(se.safari){let a=o.getBoundingClientRect();i=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else i=!!o.offsetParent&&o.offsetParent!=this.container.ownerDocument.body}if(i||this.position=="absolute")if(this.parent){let o=this.parent.getBoundingClientRect();o.width&&o.height&&(t=o.width/this.parent.offsetWidth,e=o.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),r=$g(this.view);return{visible:{left:n.left+r.left,top:n.top+r.top,right:n.right-r.right,bottom:n.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((o,a)=>{let c=this.manager.tooltipViews[a];return c.getCoords?c.getCoords(o.pos):this.view.coordsAtPos(o.pos)}),size:this.manager.tooltipViews.map(({dom:o})=>o.getBoundingClientRect()),space:this.view.state.facet(Fp).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:i}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:i,space:n,scaleX:r,scaleY:o}=t,a=[];for(let c=0;c<this.manager.tooltips.length;c++){let h=this.manager.tooltips[c],d=this.manager.tooltipViews[c],{dom:p}=d,y=t.pos[c],b=t.size[c];if(!y||h.clip!==!1&&(y.bottom<=Math.max(i.top,n.top)||y.top>=Math.min(i.bottom,n.bottom)||y.right<Math.max(i.left,n.left)-.1||y.left>Math.min(i.right,n.right)+.1)){p.style.top=vc;continue}let x=h.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=x?7:0,C=b.right-b.left,k=(e=oS.get(d))!==null&&e!==void 0?e:b.bottom-b.top,M=d.offset||NL,O=this.view.textDirection==Ze.LTR,D=b.width>n.right-n.left?O?n.left:n.right-b.width:O?Math.max(n.left,Math.min(y.left-(x?14:0)+M.x,n.right-C)):Math.min(Math.max(n.left,y.left-C+(x?14:0)-M.x),n.right-C),V=this.above[c];!h.strictSide&&(V?y.top-k-w-M.y<n.top:y.bottom+k+w+M.y>n.bottom)&&V==n.bottom-y.bottom>y.top-n.top&&(V=this.above[c]=!V);let H=(V?y.top-n.top:n.bottom-y.bottom)-w;if(H<k&&d.resize!==!1){if(H<this.view.defaultLineHeight){p.style.top=vc;continue}oS.set(d,k),p.style.height=(k=H)/o+"px"}else p.style.height&&(p.style.height="");let Y=V?y.top-k-w-M.y:y.bottom+w+M.y,U=D+C;if(d.overlap!==!0)for(let J of a)J.left<U&&J.right>D&&J.top<Y+k&&J.bottom>Y&&(Y=V?J.top-k-2-w:J.bottom+w+2);if(this.position=="absolute"?(p.style.top=(Y-t.parent.top)/o+"px",aS(p,(D-t.parent.left)/r)):(p.style.top=Y/o+"px",aS(p,D/r)),x){let J=y.left+(O?M.x:-M.x)-(D+14-7);x.style.left=J/r+"px"}d.overlap!==!0&&a.push({left:D,top:Y,right:U,bottom:Y+k}),p.classList.toggle("cm-tooltip-above",V),p.classList.toggle("cm-tooltip-below",!V),d.positioned&&d.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=vc}},{eventObservers:{scroll(){this.maybeMeasure()}}});function aS(t,e){let i=parseInt(t.style.left,10);(isNaN(i)||Math.abs(e-i)>1)&&(t.style.left=e+"px")}const EL=ie.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"}}}),NL={x:0,y:0},r0=le.define({enables:[n0,EL]}),ph=le.define({combine:t=>t.reduce((e,i)=>e.concat(i),[])});class Vh{static create(e){return new Vh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new hk(e,ph,(i,n)=>this.createHostedView(i,n),i=>i.dom.remove())}createHostedView(e,i){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,i?i.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let i of this.manager.tooltipViews)i.mount&&i.mount(e);this.mounted=!0}positioned(e){for(let i of this.manager.tooltipViews)i.positioned&&i.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let i of this.manager.tooltipViews)(e=i.destroy)===null||e===void 0||e.call(i)}passProp(e){let i;for(let n of this.manager.tooltipViews){let r=n[e];if(r!==void 0){if(i===void 0)i=r;else if(i!==r)return}}return i}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 RL=r0.compute([ph],t=>{let e=t.facet(ph);return e.length===0?null:{pos:Math.min(...e.map(i=>i.pos)),end:Math.max(...e.map(i=>{var n;return(n=i.end)!==null&&n!==void 0?n:i.pos})),create:Vh.create,above:e[0].above,arrow:e.some(i=>i.arrow)}});class DL{constructor(e,i,n,r,o){this.view=e,this.source=i,this.field=n,this.setHover=r,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(){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:i}=this,n=e.docView.tile.nearest(i.target);if(!n)return;let r,o=1;if(n.isWidget())r=n.posAtStart;else{if(r=e.posAtCoords(i),r==null)return;let c=e.coordsAtPos(r);if(!c||i.y<c.top||i.y>c.bottom||i.x<c.left-e.defaultCharacterWidth||i.x>c.right+e.defaultCharacterWidth)return;let h=e.bidiSpans(e.state.doc.lineAt(r)).find(p=>p.from<=r&&p.to>=r),d=h&&h.dir==Ze.RTL?-1:1;o=i.x<c.left?-d:d}let a=this.source(e,r,o);if(a?.then){let c=this.pending={pos:r};a.then(h=>{this.pending==c&&(this.pending=null,h&&!(Array.isArray(h)&&!h.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(h)?h:[h])}))},h=>ci(e.state,h,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(n0),i=e?e.manager.tooltips.findIndex(n=>n.create==Vh.create):-1;return i>-1?e.manager.tooltipViews[i]:null}mousemove(e){var i,n;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:r,tooltip:o}=this;if(r.length&&o&&!jL(o.dom,e)||this.pending){let{pos:a}=r[0]||this.pending,c=(n=(i=r[0])===null||i===void 0?void 0:i.end)!==null&&n!==void 0?n:a;(a==c?this.view.posAtCoords(this.lastMove)!=a:!LL(this.view,a,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:i}=this;if(i.length){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let i=n=>{e.removeEventListener("mouseleave",i),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",i)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Sc=4;function jL(t,e){let{left:i,right:n,top:r,bottom:o}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let c=a.getBoundingClientRect();r=Math.min(c.top,r),o=Math.max(c.bottom,o)}return e.clientX>=i-Sc&&e.clientX<=n+Sc&&e.clientY>=r-Sc&&e.clientY<=o+Sc}function LL(t,e,i,n,r,o){let a=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>n||a.right<n||a.top>r||Math.min(a.bottom,c)<r)return!1;let h=t.posAtCoords({x:n,y:r},!1);return h>=e&&h<=i}function BL(t,e={}){let i=Se.define(),n=It.define({create(){return[]},update(r,o){if(r.length&&(e.hideOnChange&&(o.docChanged||o.selection)?r=[]:e.hideOn&&(r=r.filter(a=>!e.hideOn(o,a))),o.docChanged)){let a=[];for(let c of r){let h=o.changes.mapPos(c.pos,-1,Zt.TrackDel);if(h!=null){let d=Object.assign(Object.create(null),c);d.pos=h,d.end!=null&&(d.end=o.changes.mapPos(d.end)),a.push(d)}}r=a}for(let a of o.effects)a.is(i)&&(r=a.value),a.is(zL)&&(r=[]);return r},provide:r=>ph.from(r)});return{active:n,extension:[n,at.define(r=>new DL(r,t,n,i,e.hoverTime||300)),RL]}}function fk(t,e){let i=t.plugin(n0);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const zL=Se.define(),uS=le.define({combine(t){let e,i;for(let n of t)e=e||n.topContainer,i=i||n.bottomContainer;return{topContainer:e,bottomContainer:i}}});function s0(t,e){let i=t.plugin(dk),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const dk=at.fromClass(class{constructor(t){this.input=t.state.facet(Ca),this.specs=this.input.filter(i=>i),this.panels=this.specs.map(i=>i(t));let e=t.state.facet(uS);this.top=new wc(t,!0,e.topContainer),this.bottom=new wc(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(i=>i.top)),this.bottom.sync(this.panels.filter(i=>!i.top));for(let i of this.panels)i.dom.classList.add("cm-panel"),i.mount&&i.mount()}update(t){let e=t.state.facet(uS);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new wc(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new wc(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ca);if(i!=this.input){let n=i.filter(h=>h),r=[],o=[],a=[],c=[];for(let h of n){let d=this.specs.indexOf(h),p;d<0?(p=h(t.view),c.push(p)):(p=this.panels[d],p.update&&p.update(t)),r.push(p),(p.top?o:a).push(p)}this.specs=n,this.panels=r,this.top.sync(o),this.bottom.sync(a);for(let h of c)h.dom.classList.add("cm-panel"),h.mount&&h.mount()}else for(let n of this.panels)n.update&&n.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>ie.scrollMargins.of(e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}})});class wc{constructor(e,i,n){this.view=e,this.top=i,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let i of this.panels)i.destroy&&e.indexOf(i)<0&&i.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 i=this.container||this.view.dom;i.insertBefore(this.dom,this.top?i.firstChild:null)}let e=this.dom.firstChild;for(let i of this.panels)if(i.dom.parentNode==this.dom){for(;e!=i.dom;)e=cS(e);e=e.nextSibling}else this.dom.insertBefore(i.dom,e);for(;e;)e=cS(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 cS(t){let e=t.nextSibling;return t.remove(),e}const Ca=le.define({enables:dk});function _L(t,e){let i,n=new Promise(a=>i=a),r=a=>HL(a,e,i);t.state.field(Vp,!1)?t.dispatch({effects:pk.of(r)}):t.dispatch({effects:Se.appendConfig.of(Vp.init(()=>[r]))});let o=mk.of(r);return{close:o,result:n.then(a=>((t.win.queueMicrotask||(h=>t.win.setTimeout(h,10)))(()=>{t.state.field(Vp).indexOf(r)>-1&&t.dispatch({effects:o})}),a))}}const Vp=It.define({create(){return[]},update(t,e){for(let i of e.effects)i.is(pk)?t=[i.value].concat(t):i.is(mk)&&(t=t.filter(n=>n!=i.value));return t},provide:t=>Ca.computeN([t],e=>e.field(t))}),pk=Se.define(),mk=Se.define();function HL(t,e,i){let n=e.content?e.content(t,()=>a(null)):null;if(!n){if(n=Ke("form"),e.input){let c=Ke("input",e.input);/^(text|password|number|email|tel|url)$/.test(c.type)&&c.classList.add("cm-textfield"),c.name||(c.name="input"),n.appendChild(Ke("label",(e.label||"")+": ",c))}else n.appendChild(document.createTextNode(e.label||""));n.appendChild(document.createTextNode(" ")),n.appendChild(Ke("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let r=n.nodeName=="FORM"?[n]:n.querySelectorAll("form");for(let c=0;c<r.length;c++){let h=r[c];h.addEventListener("keydown",d=>{d.keyCode==27?(d.preventDefault(),a(null)):d.keyCode==13&&(d.preventDefault(),a(h))}),h.addEventListener("submit",d=>{d.preventDefault(),a(h)})}let o=Ke("div",n,Ke("button",{onclick:()=>a(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(o.className=e.class),o.classList.add("cm-dialog");function a(c){o.contains(o.ownerDocument.activeElement)&&t.focus(),i(c)}return{dom:o,top:e.top,mount:()=>{if(e.focus){let c;typeof e.focus=="string"?c=n.querySelector(e.focus):c=n.querySelector("input")||n.querySelector("button"),c&&"select"in c?c.select():c&&"focus"in c&&c.focus()}}}}class Xn extends Br{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Xn.prototype.elementClass="";Xn.prototype.toDOM=void 0;Xn.prototype.mapMode=Zt.TrackBefore;Xn.prototype.startSide=Xn.prototype.endSide=-1;Xn.prototype.point=!0;const Pc=le.define(),UL=le.define(),qL={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ne.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},sa=le.define();function PL(t){return[gk(),sa.of({...qL,...t})]}const hS=le.define({combine:t=>t.some(e=>e)});function gk(t){return[FL]}const FL=at.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(sa).map(e=>new dS(t,e)),this.fixed=!t.state.facet(hS);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,n=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(n<(i.to-i.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(hS)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let i=Ne.iter(this.view.state.facet(Pc),this.view.viewport.from),n=[],r=this.gutters.map(o=>new VL(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(o.type)){let a=!0;for(let c of o.type)if(c.type==Ut.Text&&a){og(i,n,c.from);for(let h of r)h.line(this.view,c,n);a=!1}else if(c.widget)for(let h of r)h.widget(this.view,c)}else if(o.type==Ut.Text){og(i,n,o.from);for(let a of r)a.line(this.view,o,n)}else if(o.widget)for(let a of r)a.widget(this.view,o);for(let o of r)o.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(sa),i=t.state.facet(sa),n=t.docChanged||t.heightChanged||t.viewportChanged||!Ne.eq(t.startState.facet(Pc),t.state.facet(Pc),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let r of this.gutters)r.update(t)&&(n=!0);else{n=!0;let r=[];for(let o of i){let a=e.indexOf(o);a<0?r.push(new dS(this.view,o)):(this.gutters[a].update(t),r.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),r.indexOf(o)<0&&o.destroy();for(let o of r)o.config.side=="after"?this.getDOMAfter().appendChild(o.dom):this.dom.appendChild(o.dom);this.gutters=r}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>ie.scrollMargins.of(e=>{let i=e.plugin(t);if(!i||i.gutters.length==0||!i.fixed)return null;let n=i.dom.offsetWidth*e.scaleX,r=i.domAfter?i.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ze.LTR?{left:n,right:r}:{right:n,left:r}})});function fS(t){return Array.isArray(t)?t:[t]}function og(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class VL{constructor(e,i,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ne.iter(e.markers,i.from)}addElement(e,i,n){let{gutter:r}=this,o=(i.top-this.height)/e.scaleY,a=i.height/e.scaleY;if(this.i==r.elements.length){let c=new yk(e,a,o,n);r.elements.push(c),r.dom.appendChild(c.dom)}else r.elements[this.i].update(e,a,o,n);this.height=i.bottom,this.i++}line(e,i,n){let r=[];og(this.cursor,r,i.from),n.length&&(r=r.concat(n));let o=this.gutter.config.lineMarker(e,i,r);o&&r.unshift(o);let a=this.gutter;r.length==0&&!a.config.renderEmptyElements||this.addElement(e,i,r)}widget(e,i){let n=this.gutter.config.widgetMarker(e,i.widget,i),r=n?[n]:null;for(let o of e.state.facet(UL)){let a=o(e,i.widget,i);a&&(r||(r=[])).push(a)}r&&this.addElement(e,i,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let i=e.elements.pop();e.dom.removeChild(i.dom),i.destroy()}}}class dS{constructor(e,i){this.view=e,this.config=i,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in i.domEventHandlers)this.dom.addEventListener(n,r=>{let o=r.target,a;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let h=o.getBoundingClientRect();a=(h.top+h.bottom)/2}else a=r.clientY;let c=e.lineBlockAtHeight(a-e.documentTop);i.domEventHandlers[n](e,c,r)&&r.preventDefault()});this.markers=fS(i.markers(e)),i.initialSpacer&&(this.spacer=new yk(e,0,0,[i.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let i=this.markers;if(this.markers=fS(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let n=e.view.viewport;return!Ne.eq(this.markers,i,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class yk{constructor(e,i,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,i,n,r)}update(e,i,n,r){this.height!=i&&(this.height=i,this.dom.style.height=i+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),IL(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,i){let n="cm-gutterElement",r=this.dom.firstChild;for(let o=0,a=0;;){let c=a,h=o<i.length?i[o++]:null,d=!1;if(h){let p=h.elementClass;p&&(n+=" "+p);for(let y=a;y<this.markers.length;y++)if(this.markers[y].compare(h)){c=y,d=!0;break}}else c=this.markers.length;for(;a<c;){let p=this.markers[a++];if(p.toDOM){p.destroy(r);let y=r.nextSibling;r.remove(),r=y}}if(!h)break;h.toDOM&&(d?r=r.nextSibling:this.dom.insertBefore(h.toDOM(e),r)),d&&a++}this.dom.className=n,this.markers=i}destroy(){this.setMarkers(null,[])}}function IL(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!t[i].compare(e[i]))return!1;return!0}const QL=le.define(),YL=le.define(),yl=le.define({combine(t){return wn(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,i){let n=Object.assign({},e);for(let r in i){let o=n[r],a=i[r];n[r]=o?(c,h,d)=>o(c,h,d)||a(c,h,d):a}return n}})}});class Ip extends Xn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Qp(t,e){return t.state.facet(yl).formatNumber(e,t.state)}const GL=sa.compute([yl],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(QL)},lineMarker(e,i,n){return n.some(r=>r.toDOM)?null:new Ip(Qp(e,e.state.doc.lineAt(i.from).number))},widgetMarker:(e,i,n)=>{for(let r of e.state.facet(YL)){let o=r(e,i,n);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(yl)!=e.state.facet(yl),initialSpacer(e){return new Ip(Qp(e,pS(e.state.doc.lines)))},updateSpacer(e,i){let n=Qp(i.view,pS(i.view.state.doc.lines));return n==e.number?e:new Ip(n)},domEventHandlers:t.facet(yl).domEventHandlers,side:"before"}));function KL(t={}){return[yl.of(t),gk(),GL]}function pS(t){let e=9;for(;e<t;)e=e*10+9;return e}const WL=new class extends Xn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},XL=Pc.compute(["selection"],t=>{let e=[],i=-1;for(let n of t.selection.ranges){let r=t.doc.lineAt(n.head).from;r>i&&(i=r,e.push(WL.range(r)))}return Ne.of(e)});function ZL(){return XL}const bk=1024;let JL=0;class Yp{constructor(e,i){this.from=e,this.to=i}}class Te{constructor(e={}){this.id=JL++,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=fi.match(e)),i=>{let n=e(i);return n===void 0?null:[this,n]}}}Te.closedBy=new Te({deserialize:t=>t.split(" ")});Te.openedBy=new Te({deserialize:t=>t.split(" ")});Te.group=new Te({deserialize:t=>t.split(" ")});Te.isolate=new Te({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Te.contextHash=new Te({perNode:!0});Te.lookAhead=new Te({perNode:!0});Te.mounted=new Te({perNode:!0});class la{constructor(e,i,n,r=!1){this.tree=e,this.overlay=i,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[Te.mounted.id]}}const $L=Object.create(null);class fi{constructor(e,i,n,r=0){this.name=e,this.props=i,this.id=n,this.flags=r}static define(e){let i=e.props&&e.props.length?Object.create(null):$L,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new fi(e.name||"",i,e.id,n);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(r)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[o[0].id]=o[1]}}return r}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 i=this.prop(Te.group);return i?i.indexOf(e)>-1:!1}return this.id==e}static match(e){let i=Object.create(null);for(let n in e)for(let r of n.split(" "))i[r]=e[n];return n=>{for(let r=n.prop(Te.group),o=-1;o<(r?r.length:0);o++){let a=i[o<0?n.name:r[o]];if(a)return a}}}}fi.none=new fi("",Object.create(null),0,8);class l0{constructor(e){this.types=e;for(let i=0;i<e.length;i++)if(e[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let i=[];for(let n of this.types){let r=null;for(let o of e){let a=o(n);if(a){r||(r=Object.assign({},n.props));let c=a[1],h=a[0];h.combine&&h.id in r&&(c=h.combine(r[h.id],c)),r[h.id]=c}}i.push(r?new fi(n.name,r,n.id,n.flags):n)}return new l0(i)}}const Cc=new WeakMap,mS=new WeakMap;var ot;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(ot||(ot={}));class dt{constructor(e,i,n,r,o){if(this.type=e,this.children=i,this.positions=n,this.length=r,this.props=null,o&&o.length){this.props=Object.create(null);for(let[a,c]of o)this.props[typeof a=="number"?a:a.id]=c}}toString(){let e=la.get(this);if(e&&!e.overlay)return e.tree.toString();let i="";for(let n of this.children){let r=n.toString();r&&(i&&(i+=","),i+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}cursor(e=0){return new ug(this.topNode,e)}cursorAt(e,i=0,n=0){let r=Cc.get(this)||this.topNode,o=new ug(r);return o.moveTo(e,i),Cc.set(this,o._tree),o}get topNode(){return new Vi(this,0,0,null)}resolve(e,i=0){let n=ka(Cc.get(this)||this.topNode,e,i,!1);return Cc.set(this,n),n}resolveInner(e,i=0){let n=ka(mS.get(this)||this.topNode,e,i,!0);return mS.set(this,n),n}resolveStack(e,i=0){return i6(this,e,i)}iterate(e){let{enter:i,leave:n,from:r=0,to:o=this.length}=e,a=e.mode||0,c=(a&ot.IncludeAnonymous)>0;for(let h=this.cursor(a|ot.IncludeAnonymous);;){let d=!1;if(h.from<=o&&h.to>=r&&(!c&&h.type.isAnonymous||i(h)!==!1)){if(h.firstChild())continue;d=!0}for(;d&&n&&(c||!h.type.isAnonymous)&&n(h),!h.nextSibling();){if(!h.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 i in this.props)e.push([+i,this.props[i]]);return e}balance(e={}){return this.children.length<=8?this:u0(fi.none,this.children,this.positions,0,this.children.length,0,this.length,(i,n,r)=>new dt(this.type,i,n,r,this.propValues),e.makeTree||((i,n,r)=>new dt(fi.none,i,n,r)))}static build(e){return n6(e)}}dt.empty=new dt(fi.none,[],[],0);class o0{constructor(e,i){this.buffer=e,this.index=i}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 o0(this.buffer,this.index)}}class Ur{constructor(e,i,n){this.buffer=e,this.length=i,this.set=n}get type(){return fi.none}toString(){let e=[];for(let i=0;i<this.buffer.length;)e.push(this.childString(i)),i=this.buffer[i+3];return e.join(",")}childString(e){let i=this.buffer[e],n=this.buffer[e+3],r=this.set.types[i],o=r.name;if(/\W/.test(o)&&!r.isError&&(o=JSON.stringify(o)),e+=4,n==e)return o;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return o+"("+a.join(",")+")"}findChild(e,i,n,r,o){let{buffer:a}=this,c=-1;for(let h=e;h!=i&&!(xk(o,r,a[h+1],a[h+2])&&(c=h,n>0));h=a[h+3]);return c}slice(e,i,n){let r=this.buffer,o=new Uint16Array(i-e),a=0;for(let c=e,h=0;c<i;){o[h++]=r[c++],o[h++]=r[c++]-n;let d=o[h++]=r[c++]-n;o[h++]=r[c++]-e,a=Math.max(a,d)}return new Ur(o,a,this.set)}}function xk(t,e,i,n){switch(t){case-2:return i<e;case-1:return n>=e&&i<e;case 0:return i<e&&n>e;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function ka(t,e,i,n){for(var r;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){let a=!n&&t instanceof Vi&&t.index<0?null:t.parent;if(!a)return t;t=a}let o=n?0:ot.IgnoreOverlays;if(n)for(let a=t,c=a.parent;c;a=c,c=a.parent)a instanceof Vi&&a.index<0&&((r=c.enter(e,i,o))===null||r===void 0?void 0:r.from)!=a.from&&(t=c);for(;;){let a=t.enter(e,i,o);if(!a)return t;t=a}}class vk{cursor(e=0){return new ug(this,e)}getChild(e,i=null,n=null){let r=gS(this,e,i,n);return r.length?r[0]:null}getChildren(e,i=null,n=null){return gS(this,e,i,n)}resolve(e,i=0){return ka(this,e,i,!1)}resolveInner(e,i=0){return ka(this,e,i,!0)}matchContext(e){return ag(this.parent,e)}enterUnfinishedNodesBefore(e){let i=this.childBefore(e),n=this;for(;i;){let r=i.lastChild;if(!r||r.to!=i.to)break;r.type.isError&&r.from==r.to?(n=i,i=r.prevSibling):i=r}return n}get node(){return this}get next(){return this.parent}}class Vi extends vk{constructor(e,i,n,r){super(),this._tree=e,this.from=i,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,i,n,r,o=0){for(let a=this;;){for(let{children:c,positions:h}=a._tree,d=i>0?c.length:-1;e!=d;e+=i){let p=c[e],y=h[e]+a.from,b;if(!(!(o&ot.EnterBracketed&&p instanceof dt&&(b=la.get(p))&&!b.overlay&&b.bracketed&&n>=y&&n<=y+p.length)&&!xk(r,n,y,y+p.length))){if(p instanceof Ur){if(o&ot.ExcludeBuffers)continue;let x=p.findChild(0,p.buffer.length,i,n-y,r);if(x>-1)return new Er(new e6(a,p,e,y),null,x)}else if(o&ot.IncludeAnonymous||!p.type.isAnonymous||a0(p)){let x;if(!(o&ot.IgnoreMounts)&&(x=la.get(p))&&!x.overlay)return new Vi(x.tree,y,e,a);let w=new Vi(p,y,e,a);return o&ot.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(i<0?p.children.length-1:0,i,n,r,o)}}}if(o&ot.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+i:e=i<0?-1:a._parent._tree.children.length,a=a._parent,!a))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,i,n=0){let r;if(!(n&ot.IgnoreOverlays)&&(r=la.get(this._tree))&&r.overlay){let o=e-this.from,a=n&ot.EnterBracketed&&r.bracketed;for(let{from:c,to:h}of r.overlay)if((i>0||a?c<=o:c<o)&&(i<0||a?h>=o:h>o))return new Vi(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,i,n)}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 gS(t,e,i,n){let r=t.cursor(),o=[];if(!r.firstChild())return o;if(i!=null){for(let a=!1;!a;)if(a=r.type.is(i),!r.nextSibling())return o}for(;;){if(n!=null&&r.type.is(n))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return n==null?o:[]}}function ag(t,e,i=e.length-1){for(let n=t;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class e6{constructor(e,i,n,r){this.parent=e,this.buffer=i,this.index=n,this.start=r}}class Er extends vk{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,i,n){super(),this.context=e,this._parent=i,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,i,n){let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],e,i-this.context.start,n);return o<0?null:new Er(this.context,this,o)}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,i,n=0){if(n&ot.ExcludeBuffers)return null;let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return o<0?null:new Er(this.context,this,o)}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,i=e.buffer[this.index+3];return i<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Er(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new Er(this.context,this._parent,e.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],i=[],{buffer:n}=this.context,r=this.index+4,o=n.buffer[this.index+3];if(o>r){let a=n.buffer[this.index+1];e.push(n.slice(r,o,a)),i.push(0)}return new dt(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Sk(t){if(!t.length)return null;let e=0,i=t[0];for(let o=1;o<t.length;o++){let a=t[o];(a.from>i.from||a.to<i.to)&&(i=a,e=o)}let n=i instanceof Vi&&i.index<0?null:i.parent,r=t.slice();return n?r[e]=n:r.splice(e,1),new t6(r,i)}class t6{constructor(e,i){this.heads=e,this.node=i}get next(){return Sk(this.heads)}}function i6(t,e,i){let n=t.resolveInner(e,i),r=null;for(let o=n instanceof Vi?n:n.context.parent;o;o=o.parent)if(o.index<0){let a=o.parent;(r||(r=[n])).push(a.resolve(e,i)),o=a}else{let a=la.get(o.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let c=new Vi(a.tree,a.overlay[0].from+o.from,-1,o);(r||(r=[n])).push(ka(c,e,i,!1))}}return r?Sk(r):n}class ug{get name(){return this.type.name}constructor(e,i=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=i&~ot.EnterBracketed,e instanceof Vi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.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,i){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=i||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Vi?(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,i,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,i,n,this.mode));let{buffer:r}=this.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,i-this.buffer.start,n);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}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,i,n=this.mode){return this.buffer?n&ot.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ot.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ot.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:i}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(i.findChild(r,this.index,-1,0,4))}else{let r=i.buffer[this.index+3];if(r<(n<0?i.buffer.length:i.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<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 i,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(r.buffer.buffer[o+3]<this.index)return!1;({index:i,parent:n}=r)}else({index:i,_parent:n}=this._tree);for(;n;{index:i,_parent:n}=n)if(i>-1)for(let o=i+e,a=e<0?-1:n._tree.children.length;o!=a;o+=e){let c=n._tree.children[o];if(this.mode&ot.IncludeAnonymous||c instanceof Ur||!c.type.isAnonymous||a0(c))return!1}return!0}move(e,i){if(i&&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,i=0){for(;(this.from==this.to||(i<1?this.from>=e:this.from>e)||(i>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,i););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,i=null,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,o=this.stack.length;o>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;i=a,n=o+1;break e}r=this.stack[--o]}for(let r=n;r<this.stack.length;r++)i=new Er(this.buffer,i,this.stack[r]);return this.bufferNode=new Er(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,i){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&i&&i(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return ag(this.node.parent,e);let{buffer:i}=this.buffer,{types:n}=i.set;for(let r=e.length-1,o=this.stack.length-1;r>=0;o--){if(o<0)return ag(this._tree,e,r);let a=n[i.buffer[this.stack[o]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}}function a0(t){return t.children.some(e=>e instanceof Ur||!e.type.isAnonymous||a0(e))}function n6(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:r=bk,reused:o=[],minRepeatType:a=n.types.length}=t,c=Array.isArray(i)?new o0(i,i.length):i,h=n.types,d=0,p=0;function y(H,Y,U,J,Z,ce){let{id:oe,start:q,end:ee,size:fe}=c,de=p,_=d;if(fe<0)if(c.next(),fe==-1){let E=o[oe];U.push(E),J.push(q-H);return}else if(fe==-3){d=oe;return}else if(fe==-4){p=oe;return}else throw new RangeError(`Unrecognized record size: ${fe}`);let X=h[oe],ne,ue,ye=q-H;if(ee-q<=r&&(ue=k(c.pos-Y,Z))){let E=new Uint16Array(ue.size-ue.skip),I=c.pos-ue.size,$=E.length;for(;c.pos>I;)$=M(ue.start,E,$);ne=new Ur(E,ee-ue.start,n),ye=ue.start-H}else{let E=c.pos-fe;c.next();let I=[],$=[],re=oe>=a?oe:-1,xe=0,we=ee;for(;c.pos>E;)re>=0&&c.id==re&&c.size>=0?(c.end<=we-r&&(w(I,$,q,xe,c.end,we,re,de,_),xe=I.length,we=c.end),c.next()):ce>2500?b(q,E,I,$):y(q,E,I,$,re,ce+1);if(re>=0&&xe>0&&xe<I.length&&w(I,$,q,xe,q,we,re,de,_),I.reverse(),$.reverse(),re>-1&&xe>0){let ze=x(X,_);ne=u0(X,I,$,0,I.length,0,ee-q,ze,ze)}else ne=C(X,I,$,ee-q,de-ee,_)}U.push(ne),J.push(ye)}function b(H,Y,U,J){let Z=[],ce=0,oe=-1;for(;c.pos>Y;){let{id:q,start:ee,end:fe,size:de}=c;if(de>4)c.next();else{if(oe>-1&&ee<oe)break;oe<0&&(oe=fe-r),Z.push(q,ee,fe),ce++,c.next()}}if(ce){let q=new Uint16Array(ce*4),ee=Z[Z.length-2];for(let fe=Z.length-3,de=0;fe>=0;fe-=3)q[de++]=Z[fe],q[de++]=Z[fe+1]-ee,q[de++]=Z[fe+2]-ee,q[de++]=de;U.push(new Ur(q,Z[2]-ee,n)),J.push(ee-H)}}function x(H,Y){return(U,J,Z)=>{let ce=0,oe=U.length-1,q,ee;if(oe>=0&&(q=U[oe])instanceof dt){if(!oe&&q.type==H&&q.length==Z)return q;(ee=q.prop(Te.lookAhead))&&(ce=J[oe]+q.length+ee)}return C(H,U,J,Z,ce,Y)}}function w(H,Y,U,J,Z,ce,oe,q,ee){let fe=[],de=[];for(;H.length>J;)fe.push(H.pop()),de.push(Y.pop()+U-Z);H.push(C(n.types[oe],fe,de,ce-Z,q-ce,ee)),Y.push(Z-U)}function C(H,Y,U,J,Z,ce,oe){if(ce){let q=[Te.contextHash,ce];oe=oe?[q].concat(oe):[q]}if(Z>25){let q=[Te.lookAhead,Z];oe=oe?[q].concat(oe):[q]}return new dt(H,Y,U,J,oe)}function k(H,Y){let U=c.fork(),J=0,Z=0,ce=0,oe=U.end-r,q={size:0,start:0,skip:0};e:for(let ee=U.pos-H;U.pos>ee;){let fe=U.size;if(U.id==Y&&fe>=0){q.size=J,q.start=Z,q.skip=ce,ce+=4,J+=4,U.next();continue}let de=U.pos-fe;if(fe<0||de<ee||U.start<oe)break;let _=U.id>=a?4:0,X=U.start;for(U.next();U.pos>de;){if(U.size<0)if(U.size==-3||U.size==-4)_+=4;else break e;else U.id>=a&&(_+=4);U.next()}Z=X,J+=fe,ce+=_}return(Y<0||J==H)&&(q.size=J,q.start=Z,q.skip=ce),q.size>4?q:void 0}function M(H,Y,U){let{id:J,start:Z,end:ce,size:oe}=c;if(c.next(),oe>=0&&J<a){let q=U;if(oe>4){let ee=c.pos-(oe-4);for(;c.pos>ee;)U=M(H,Y,U)}Y[--U]=q,Y[--U]=ce-H,Y[--U]=Z-H,Y[--U]=J}else oe==-3?d=J:oe==-4&&(p=J);return U}let O=[],D=[];for(;c.pos>0;)y(t.start||0,t.bufferStart||0,O,D,-1,0);let V=(e=t.length)!==null&&e!==void 0?e:O.length?D[0]+O[0].length:0;return new dt(h[t.topID],O.reverse(),D.reverse(),V)}const yS=new WeakMap;function Fc(t,e){if(!t.isAnonymous||e instanceof Ur||e.type!=t)return 1;let i=yS.get(e);if(i==null){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof dt)){i=1;break}i+=Fc(t,n)}yS.set(e,i)}return i}function u0(t,e,i,n,r,o,a,c,h){let d=0;for(let w=n;w<r;w++)d+=Fc(t,e[w]);let p=Math.ceil(d*1.5/8),y=[],b=[];function x(w,C,k,M,O){for(let D=k;D<M;){let V=D,H=C[D],Y=Fc(t,w[D]);for(D++;D<M;D++){let U=Fc(t,w[D]);if(Y+U>=p)break;Y+=U}if(D==V+1){if(Y>p){let U=w[V];x(U.children,U.positions,0,U.children.length,C[V]+O);continue}y.push(w[V])}else{let U=C[D-1]+w[D-1].length-H;y.push(u0(t,w,C,V,D,H,U,null,h))}b.push(H+O-o)}}return x(e,i,n,r,0),(c||h)(y,b,a)}class ys{constructor(e,i,n,r,o=!1,a=!1){this.from=e,this.to=i,this.tree=n,this.offset=r,this.open=(o?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,i=[],n=!1){let r=[new ys(0,e.length,e,0,!1,n)];for(let o of i)o.to>e.length&&r.push(o);return r}static applyChanges(e,i,n=128){if(!i.length)return e;let r=[],o=1,a=e.length?e[0]:null;for(let c=0,h=0,d=0;;c++){let p=c<i.length?i[c]:null,y=p?p.fromA:1e9;if(y-h>=n)for(;a&&a.from<y;){let b=a;if(h>=b.from||y<=b.to||d){let x=Math.max(b.from,h)-d,w=Math.min(b.to,y)-d;b=x>=w?null:new ys(x,w,b.tree,b.offset+d,c>0,!!p)}if(b&&r.push(b),a.to>y)break;a=o<e.length?e[o++]:null}if(!p)break;h=p.toA,d=p.toA-p.toB}return r}}class wk{startParse(e,i,n){return typeof e=="string"&&(e=new r6(e)),n=n?n.length?n.map(r=>new Yp(r.from,r.to)):[new Yp(0,0)]:[new Yp(0,e.length)],this.createParse(e,i||[],n)}parse(e,i,n){let r=this.startParse(e,i,n);for(;;){let o=r.advance();if(o)return o}}}class r6{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,i){return this.string.slice(e,i)}}new Te({perNode:!0});let s6=0;class Ui{constructor(e,i,n,r){this.name=e,this.set=i,this.base=n,this.modified=r,this.id=s6++}toString(){let{name:e}=this;for(let i of this.modified)i.name&&(e=`${i.name}(${e})`);return e}static define(e,i){let n=typeof e=="string"?e:"?";if(e instanceof Ui&&(i=e),i?.base)throw new Error("Can not derive from a modified tag");let r=new Ui(n,[],null,[]);if(r.set.push(r),i)for(let o of i.set)r.set.push(o);return r}static defineModifier(e){let i=new mh(e);return n=>n.modified.indexOf(i)>-1?n:mh.get(n.base||n,n.modified.concat(i).sort((r,o)=>r.id-o.id))}}let l6=0;class mh{constructor(e){this.name=e,this.instances=[],this.id=l6++}static get(e,i){if(!i.length)return e;let n=i[0].instances.find(c=>c.base==e&&o6(i,c.modified));if(n)return n;let r=[],o=new Ui(e.name,r,e,i);for(let c of i)c.instances.push(o);let a=a6(i);for(let c of e.set)if(!c.modified.length)for(let h of a)r.push(mh.get(c,h));return o}}function o6(t,e){return t.length==e.length&&t.every((i,n)=>i==e[n])}function a6(t){let e=[[]];for(let i=0;i<t.length;i++)for(let n=0,r=e.length;n<r;n++)e.push(e[n].concat(t[i]));return e.sort((i,n)=>n.length-i.length)}function Ck(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let r of i.split(" "))if(r){let o=[],a=2,c=r;for(let y=0;;){if(c=="..."&&y>0&&y+3==r.length){a=1;break}let b=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!b)throw new RangeError("Invalid path: "+r);if(o.push(b[0]=="*"?"":b[0][0]=='"'?JSON.parse(b[0]):b[0]),y+=b[0].length,y==r.length)break;let x=r[y++];if(y==r.length&&x=="!"){a=0;break}if(x!="/")throw new RangeError("Invalid path: "+r);c=r.slice(y)}let h=o.length-1,d=o[h];if(!d)throw new RangeError("Invalid path: "+r);let p=new Aa(n,a,h>0?o.slice(0,h):null);e[d]=p.sort(e[d])}}return kk.add(e)}const kk=new Te({combine(t,e){let i,n,r;for(;t||e;){if(!t||e&&t.depth>=e.depth?(r=e,e=e.next):(r=t,t=t.next),i&&i.mode==r.mode&&!r.context&&!i.context)continue;let o=new Aa(r.tags,r.mode,r.context);i?i.next=o:n=o,i=o}return n}});class Aa{constructor(e,i,n,r){this.tags=e,this.mode=i,this.context=n,this.next=r}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}}Aa.empty=new Aa([],2,null);function Ak(t,e){let i=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))i[o.tag.id]=o.class;else for(let a of o.tag)i[a.id]=o.class;let{scope:n,all:r=null}=e||{};return{style:o=>{let a=r;for(let c of o)for(let h of c.set){let d=i[h.id];if(d){a=a?a+" "+d:d;break}}return a},scope:n}}function u6(t,e){let i=null;for(let n of t){let r=n.style(e);r&&(i=i?i+" "+r:r)}return i}function c6(t,e,i,n=0,r=t.length){let o=new h6(n,Array.isArray(e)?e:[e],i);o.highlightRange(t.cursor(),n,r,"",o.highlighters),o.flush(r)}class h6{constructor(e,i,n){this.at=e,this.highlighters=i,this.span=n,this.class=""}startSpan(e,i){i!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=i)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,i,n,r,o){let{type:a,from:c,to:h}=e;if(c>=n||h<=i)return;a.isTop&&(o=this.highlighters.filter(x=>!x.scope||x.scope(a)));let d=r,p=f6(e)||Aa.empty,y=u6(o,p.tags);if(y&&(d&&(d+=" "),d+=y,p.mode==1&&(r+=(r?" ":"")+y)),this.startSpan(Math.max(i,c),d),p.opaque)return;let b=e.tree&&e.tree.prop(Te.mounted);if(b&&b.overlay){let x=e.node.enter(b.overlay[0].from+c,1),w=this.highlighters.filter(k=>!k.scope||k.scope(b.tree.type)),C=e.firstChild();for(let k=0,M=c;;k++){let O=k<b.overlay.length?b.overlay[k]:null,D=O?O.from+c:h,V=Math.max(i,M),H=Math.min(n,D);if(V<H&&C)for(;e.from<H&&(this.highlightRange(e,V,H,r,o),this.startSpan(Math.min(H,e.to),d),!(e.to>=D||!e.nextSibling())););if(!O||D>n)break;M=O.to+c,M>i&&(this.highlightRange(x.cursor(),Math.max(i,O.from+c),Math.min(n,M),"",w),this.startSpan(Math.min(n,M),d))}C&&e.parent()}else if(e.firstChild()){b&&(r="");do if(!(e.to<=i)){if(e.from>=n)break;this.highlightRange(e,i,n,r,o),this.startSpan(Math.min(n,e.to),d)}while(e.nextSibling());e.parent()}}}function f6(t){let e=t.type.prop(kk);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const te=Ui.define,kc=te(),Ar=te(),bS=te(Ar),xS=te(Ar),Mr=te(),Ac=te(Mr),Gp=te(Mr),hn=te(),as=te(hn),un=te(),cn=te(),cg=te(),Qo=te(cg),Mc=te(),F={comment:kc,lineComment:te(kc),blockComment:te(kc),docComment:te(kc),name:Ar,variableName:te(Ar),typeName:bS,tagName:te(bS),propertyName:xS,attributeName:te(xS),className:te(Ar),labelName:te(Ar),namespace:te(Ar),macroName:te(Ar),literal:Mr,string:Ac,docString:te(Ac),character:te(Ac),attributeValue:te(Ac),number:Gp,integer:te(Gp),float:te(Gp),bool:te(Mr),regexp:te(Mr),escape:te(Mr),color:te(Mr),url:te(Mr),keyword:un,self:te(un),null:te(un),atom:te(un),unit:te(un),modifier:te(un),operatorKeyword:te(un),controlKeyword:te(un),definitionKeyword:te(un),moduleKeyword:te(un),operator:cn,derefOperator:te(cn),arithmeticOperator:te(cn),logicOperator:te(cn),bitwiseOperator:te(cn),compareOperator:te(cn),updateOperator:te(cn),definitionOperator:te(cn),typeOperator:te(cn),controlOperator:te(cn),punctuation:cg,separator:te(cg),bracket:Qo,angleBracket:te(Qo),squareBracket:te(Qo),paren:te(Qo),brace:te(Qo),content:hn,heading:as,heading1:te(as),heading2:te(as),heading3:te(as),heading4:te(as),heading5:te(as),heading6:te(as),contentSeparator:te(hn),list:te(hn),quote:te(hn),emphasis:te(hn),strong:te(hn),link:te(hn),monospace:te(hn),strikethrough:te(hn),inserted:te(),deleted:te(),changed:te(),invalid:te(),meta:Mc,documentMeta:te(Mc),annotation:te(Mc),processingInstruction:te(Mc),definition:Ui.defineModifier("definition"),constant:Ui.defineModifier("constant"),function:Ui.defineModifier("function"),standard:Ui.defineModifier("standard"),local:Ui.defineModifier("local"),special:Ui.defineModifier("special")};for(let t in F){let e=F[t];e instanceof Ui&&(e.name=t)}Ak([{tag:F.link,class:"tok-link"},{tag:F.heading,class:"tok-heading"},{tag:F.emphasis,class:"tok-emphasis"},{tag:F.strong,class:"tok-strong"},{tag:F.keyword,class:"tok-keyword"},{tag:F.atom,class:"tok-atom"},{tag:F.bool,class:"tok-bool"},{tag:F.url,class:"tok-url"},{tag:F.labelName,class:"tok-labelName"},{tag:F.inserted,class:"tok-inserted"},{tag:F.deleted,class:"tok-deleted"},{tag:F.literal,class:"tok-literal"},{tag:F.string,class:"tok-string"},{tag:F.number,class:"tok-number"},{tag:[F.regexp,F.escape,F.special(F.string)],class:"tok-string2"},{tag:F.variableName,class:"tok-variableName"},{tag:F.local(F.variableName),class:"tok-variableName tok-local"},{tag:F.definition(F.variableName),class:"tok-variableName tok-definition"},{tag:F.special(F.variableName),class:"tok-variableName2"},{tag:F.definition(F.propertyName),class:"tok-propertyName tok-definition"},{tag:F.typeName,class:"tok-typeName"},{tag:F.namespace,class:"tok-namespace"},{tag:F.className,class:"tok-className"},{tag:F.macroName,class:"tok-macroName"},{tag:F.propertyName,class:"tok-propertyName"},{tag:F.operator,class:"tok-operator"},{tag:F.comment,class:"tok-comment"},{tag:F.meta,class:"tok-meta"},{tag:F.invalid,class:"tok-invalid"},{tag:F.punctuation,class:"tok-punctuation"}]);var Kp;const bl=new Te;function d6(t){return le.define({combine:t?e=>e.concat(t):void 0})}const p6=new Te;class Zi{constructor(e,i,n=[],r=""){this.data=e,this.name=r,Le.prototype.hasOwnProperty("tree")||Object.defineProperty(Le.prototype,"tree",{get(){return Ft(this)}}),this.parser=i,this.extension=[qr.of(this),Le.languageData.of((o,a,c)=>{let h=vS(o,a,c),d=h.type.prop(bl);if(!d)return[];let p=o.facet(d),y=h.type.prop(p6);if(y){let b=h.resolve(a-h.from,c);for(let x of y)if(x.test(b,o)){let w=o.facet(x.facet);return x.type=="replace"?w:w.concat(p)}}return p})].concat(n)}isActiveAt(e,i,n=-1){return vS(e,i,n).type.prop(bl)==this.data}findRegions(e){let i=e.facet(qr);if(i?.data==this.data)return[{from:0,to:e.doc.length}];if(!i||!i.allowsNesting)return[];let n=[],r=(o,a)=>{if(o.prop(bl)==this.data){n.push({from:a,to:a+o.length});return}let c=o.prop(Te.mounted);if(c){if(c.tree.prop(bl)==this.data){if(c.overlay)for(let h of c.overlay)n.push({from:h.from+a,to:h.to+a});else n.push({from:a,to:a+o.length});return}else if(c.overlay){let h=n.length;if(r(c.tree,c.overlay[0].from+a),n.length>h)return}}for(let h=0;h<o.children.length;h++){let d=o.children[h];d instanceof dt&&r(d,o.positions[h]+a)}};return r(Ft(e),0),n}get allowsNesting(){return!0}}Zi.setState=Se.define();function vS(t,e,i){let n=t.facet(qr),r=Ft(t).topNode;if(!n||n.allowsNesting)for(let o=r;o;o=o.enter(e,i,ot.ExcludeBuffers|ot.EnterBracketed))o.type.isTop&&(r=o);return r}class gh extends Zi{constructor(e,i,n){super(e,i,[],n),this.parser=i}static define(e){let i=d6(e.languageData);return new gh(i,e.parser.configure({props:[bl.add(n=>n.isTop?i:void 0)]}),e.name)}configure(e,i){return new gh(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ft(t){let e=t.field(Zi.state,!1);return e?e.tree:dt.empty}class m6{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,i){let n=this.cursorPos-this.string.length;return e<n||i>=this.cursorPos?this.doc.sliceString(e,i):this.string.slice(e-n,i-n)}}let Yo=null;class yh{constructor(e,i,n=[],r,o,a,c,h){this.parser=e,this.state=i,this.fragments=n,this.tree=r,this.treeLen=o,this.viewport=a,this.skipped=c,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}static create(e,i,n){return new yh(e,i,[],dt.empty,0,n,[],null)}startParse(){return this.parser.startParse(new m6(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=dt.empty&&this.isDone(i??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),i!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>i)&&i<this.state.doc.length&&this.parse.stopAt(i);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(ys.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(i??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,i;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(i=this.parse.advance()););}),this.treeLen=e,this.tree=i,this.fragments=this.withoutTempSkipped(ys.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=Yo;Yo=this;try{return e()}finally{Yo=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=SS(e,i.from,i.to);return e}changes(e,i){let{fragments:n,tree:r,treeLen:o,viewport:a,skipped:c}=this;if(this.takeTree(),!e.empty){let h=[];if(e.iterChangedRanges((d,p,y,b)=>h.push({fromA:d,toA:p,fromB:y,toB:b})),n=ys.applyChanges(n,h),r=dt.empty,o=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){c=[];for(let d of this.skipped){let p=e.mapPos(d.from,1),y=e.mapPos(d.to,-1);p<y&&c.push({from:p,to:y})}}}return new yh(this.parser,i,n,r,o,a,c,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let i=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:r,to:o}=this.skipped[n];r<e.to&&o>e.from&&(this.fragments=SS(this.fragments,r,o),this.skipped.splice(n--,1))}return this.skipped.length>=i?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,i){this.skipped.push({from:e,to:i})}static getSkippingParser(e){return new class extends wk{createParse(i,n,r){let o=r[0].from,a=r[r.length-1].to;return{parsedPos:o,advance(){let h=Yo;if(h){for(let d of r)h.tempSkipped.push(d);e&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,e]):e)}return this.parsedPos=a,new dt(fi.none,[],[],a-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let i=this.fragments;return this.treeLen>=e&&i.length&&i[0].from==0&&i[0].to>=e}static get(){return Yo}}function SS(t,e,i){return ys.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ll{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let i=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),i.viewport.to);return i.work(20,n)||i.takeTree(),new Ll(i)}static init(e){let i=Math.min(3e3,e.doc.length),n=yh.create(e.facet(qr).parser,e,{from:0,to:i});return n.work(20,i)||n.takeTree(),new Ll(n)}}Zi.state=It.define({create:Ll.init,update(t,e){for(let i of e.effects)if(i.is(Zi.setState))return i.value;return e.startState.facet(qr)!=e.state.facet(qr)?Ll.init(e.state):t.apply(e)}});let Mk=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Mk=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Wp=typeof navigator<"u"&&(!((Kp=navigator.scheduling)===null||Kp===void 0)&&Kp.isInputPending)?()=>navigator.scheduling.isInputPending():null,g6=at.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 i=this.view.state.field(Zi.state).context;(i.updateViewport(e.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}scheduleWork(){if(this.working)return;let{state:e}=this.view,i=e.field(Zi.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=Mk(this.work))}work(e){this.working=null;let i=Date.now();if(this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,o=n.field(Zi.state);if(o.tree==o.context.tree&&o.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!Wp?Math.max(25,e.timeRemaining()-5):1e9),c=o.context.treeLen<r&&n.doc.length>r+1e3,h=o.context.work(()=>Wp&&Wp()||Date.now()>a,r+(c?0:1e5));this.chunkBudget-=Date.now()-i,(h||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Zi.setState.of(new Ll(o.context))})),this.chunkBudget>0&&!(h&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(i=>ci(this.view.state,i)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),qr=le.define({combine(t){return t.length?t[0]:null},enables:t=>[Zi.state,g6,ie.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]});class y6{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}}const b6=le.define(),Ih=le.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(i=>i!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function bh(t){let e=t.facet(Ih);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Ma(t,e){let i="",n=t.tabSize,r=t.facet(Ih)[0];if(r==" "){for(;e>=n;)i+=" ",e-=n;r=" "}for(let o=0;o<e;o++)i+=r;return i}function c0(t,e){t instanceof Le&&(t=new Qh(t));for(let n of t.state.facet(b6)){let r=n(t,e);if(r!==void 0)return r}let i=Ft(t.state);return i.length>=e?x6(t,i,e):null}class Qh{constructor(e,i={}){this.state=e,this.options=i,this.unit=bh(e)}lineAt(e,i=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:o}=this.options;return r!=null&&r>=n.from&&r<=n.to?o&&r==e?{text:"",from:e}:(i<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,i=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,i);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,i=1){let{text:n,from:r}=this.lineAt(e,i),o=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(o+=a-this.countColumn(n,n.search(/\S|$/))),o}countColumn(e,i=e.length){return Pl(e,this.state.tabSize,i)}lineIndent(e,i=1){let{text:n,from:r}=this.lineAt(e,i),o=this.options.overrideIndentation;if(o){let a=o(r);if(a>-1)return a}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Tk=new Te;function x6(t,e,i){let n=e.resolveStack(i),r=e.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(r!=n.node){let o=[];for(let a=r;a&&!(a.from<n.node.from||a.to>n.node.to||a.from==n.node.from&&a.type==n.node.type);a=a.parent)o.push(a);for(let a=o.length-1;a>=0;a--)n={node:o[a],next:n}}return Ok(n,t,i)}function Ok(t,e,i){for(let n=t;n;n=n.next){let r=S6(n.node);if(r)return r(h0.create(e,i,n))}return 0}function v6(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function S6(t){let e=t.type.prop(Tk);if(e)return e;let i=t.firstChild,n;if(i&&(n=i.type.prop(Te.closedBy))){let r=t.lastChild,o=r&&n.indexOf(r.name)>-1;return a=>A6(a,!0,1,void 0,o&&!v6(a)?r.from:void 0)}return t.parent==null?w6:null}function w6(){return 0}class h0 extends Qh{constructor(e,i,n){super(e.state,e.options),this.base=e,this.pos=i,this.context=n}get node(){return this.context.node}static create(e,i,n){return new h0(e,i,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let i=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(i.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(C6(n,e))break;i=this.state.doc.lineAt(n.from)}return this.lineIndent(i.from)}continue(){return Ok(this.context.next,this.base,this.pos)}}function C6(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function k6(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let r=t.options.simulateBreak,o=t.state.doc.lineAt(i.from),a=r==null||r<=o.from?o.to:Math.min(o.to,r);for(let c=i.to;;){let h=e.childAfter(c);if(!h||h==n)return null;if(!h.type.isSkipped){if(h.from>=a)return null;let d=/^ */.exec(o.text.slice(i.to-o.from))[0].length;return{from:i.from,to:i.to+d}}c=h.to}}function A6(t,e,i,n,r){let o=t.textAfter,a=o.match(/^\s*/)[0].length,c=n&&o.slice(a,a+n.length)==n||r==t.pos+a,h=k6(t);return h?c?t.column(h.from):t.column(h.to):t.baseIndent+(c?0:t.unit*i)}function wS({except:t,units:e=1}={}){return i=>{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}const M6=200;function T6(){return Le.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,r=i.lineAt(n);if(n>r.from+M6)return t;let o=i.sliceString(r.from,n);if(!e.some(d=>d.test(o)))return t;let{state:a}=t,c=-1,h=[];for(let{head:d}of a.selection.ranges){let p=a.doc.lineAt(d);if(p.from==c)continue;c=p.from;let y=c0(a,p.from);if(y==null)continue;let b=/^\s*/.exec(p.text)[0],x=Ma(a,y);b!=x&&h.push({from:p.from,to:p.from+b.length,insert:x})}return h.length?[t,{changes:h,sequential:!0}]:t})}const O6=le.define(),Ek=new Te;function E6(t){let e=t.firstChild,i=t.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?t.to:i.from}:null}function N6(t,e,i){let n=Ft(t);if(n.length<i)return null;let r=n.resolveStack(i,1),o=null;for(let a=r;a;a=a.next){let c=a.node;if(c.to<=i||c.from>i)continue;if(o&&c.from<e)break;let h=c.type.prop(Ek);if(h&&(c.to<n.length-50||n.length==t.doc.length||!R6(c))){let d=h(c,t);d&&d.from<=i&&d.from>=e&&d.to>i&&(o=d)}}return o}function R6(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function xh(t,e,i){for(let n of t.facet(O6)){let r=n(t,e,i);if(r)return r}return N6(t,e,i)}function Nk(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const Yh=Se.define({map:Nk}),Ua=Se.define({map:Nk});function Rk(t){let e=[];for(let{head:i}of t.state.selection.ranges)e.some(n=>n.from<=i&&n.to>=i)||e.push(t.lineBlockAt(i));return e}const ks=It.define({create(){return ge.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((i,n)=>t=CS(t,i,n)),t=t.map(e.changes);for(let i of e.effects)if(i.is(Yh)&&!D6(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(Lk),r=n?ge.replace({widget:new U6(n(e.state,i.value))}):kS;t=t.update({add:[r.range(i.value.from,i.value.to)]})}else i.is(Ua)&&(t=t.update({filter:(n,r)=>i.value.from!=n||i.value.to!=r,filterFrom:i.value.from,filterTo:i.value.to}));return e.selection&&(t=CS(t,e.selection.main.head)),t},provide:t=>ie.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,(n,r)=>{i.push(n,r)}),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i<t.length;){let n=t[i++],r=t[i++];if(typeof n!="number"||typeof r!="number")throw new RangeError("Invalid JSON for fold state");e.push(kS.range(n,r))}return ge.set(e,!0)}});function CS(t,e,i=e){let n=!1;return t.between(e,i,(r,o)=>{r<i&&o>e&&(n=!0)}),n?t.update({filterFrom:e,filterTo:i,filter:(r,o)=>r>=i||o<=e}):t}function vh(t,e,i){var n;let r=null;return(n=t.field(ks,!1))===null||n===void 0||n.between(e,i,(o,a)=>{(!r||r.from>o)&&(r={from:o,to:a})}),r}function D6(t,e,i){let n=!1;return t.between(e,e,(r,o)=>{r==e&&o==i&&(n=!0)}),n}function Dk(t,e){return t.field(ks,!1)?e:e.concat(Se.appendConfig.of(Bk()))}const j6=t=>{for(let e of Rk(t)){let i=xh(t.state,e.from,e.to);if(i)return t.dispatch({effects:Dk(t.state,[Yh.of(i),jk(t,i)])}),!0}return!1},L6=t=>{if(!t.state.field(ks,!1))return!1;let e=[];for(let i of Rk(t)){let n=vh(t.state,i.from,i.to);n&&e.push(Ua.of(n),jk(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function jk(t,e,i=!0){let n=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return ie.announce.of(`${t.state.phrase(i?"Folded lines":"Unfolded lines")} ${n} ${t.state.phrase("to")} ${r}.`)}const B6=t=>{let{state:e}=t,i=[];for(let n=0;n<e.doc.length;){let r=t.lineBlockAt(n),o=xh(e,r.from,r.to);o&&i.push(Yh.of(o)),n=(o?t.lineBlockAt(o.to):r).to+1}return i.length&&t.dispatch({effects:Dk(t.state,i)}),!!i.length},z6=t=>{let e=t.state.field(ks,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,(n,r)=>{i.push(Ua.of({from:n,to:r}))}),t.dispatch({effects:i}),!0},_6=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:j6},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:L6},{key:"Ctrl-Alt-[",run:B6},{key:"Ctrl-Alt-]",run:z6}],H6={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Lk=le.define({combine(t){return wn(t,H6)}});function Bk(t){return[ks,F6]}function zk(t,e){let{state:i}=t,n=i.facet(Lk),r=a=>{let c=t.lineBlockAt(t.posAtDOM(a.target)),h=vh(t.state,c.from,c.to);h&&t.dispatch({effects:Ua.of(h)}),a.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,r,e);let o=document.createElement("span");return o.textContent=n.placeholderText,o.setAttribute("aria-label",i.phrase("folded code")),o.title=i.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o}const kS=ge.replace({widget:new class extends Cn{toDOM(t){return zk(t,null)}}});class U6 extends Cn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return zk(e,this.value)}}const q6={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Xp extends Xn{constructor(e,i){super(),this.config=e,this.open=i}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let i=document.createElement("span");return i.textContent=this.open?this.config.openText:this.config.closedText,i.title=e.state.phrase(this.open?"Fold line":"Unfold line"),i}}function P6(t={}){let e={...q6,...t},i=new Xp(e,!0),n=new Xp(e,!1),r=at.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(qr)!=a.state.facet(qr)||a.startState.field(ks,!1)!=a.state.field(ks,!1)||Ft(a.startState)!=Ft(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let c=new Kn;for(let h of a.viewportLineBlocks){let d=vh(a.state,h.from,h.to)?n:xh(a.state,h.from,h.to)?i:null;d&&c.add(h.from,h.from,d)}return c.finish()}}),{domEventHandlers:o}=e;return[r,PL({class:"cm-foldGutter",markers(a){var c;return((c=a.plugin(r))===null||c===void 0?void 0:c.markers)||Ne.empty},initialSpacer(){return new Xp(e,!1)},domEventHandlers:{...o,click:(a,c,h)=>{if(o.click&&o.click(a,c,h))return!0;let d=vh(a.state,c.from,c.to);if(d)return a.dispatch({effects:Ua.of(d)}),!0;let p=xh(a.state,c.from,c.to);return p?(a.dispatch({effects:Yh.of(p)}),!0):!1}}}),Bk()]}const F6=ie.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 qa{constructor(e,i){this.specs=e;let n;function r(c){let h=zr.newName();return(n||(n=Object.create(null)))["."+h]=c,h}const o=typeof i.all=="string"?i.all:i.all?r(i.all):void 0,a=i.scope;this.scope=a instanceof Zi?c=>c.prop(bl)==a.data:a?c=>c==a:void 0,this.style=Ak(e.map(c=>({tag:c.tag,class:c.class||r(Object.assign({},c,{tag:null}))})),{all:o}).style,this.module=n?new zr(n):null,this.themeType=i.themeType}static define(e,i){return new qa(e,i||{})}}const hg=le.define(),_k=le.define({combine(t){return t.length?[t[0]]:null}});function Zp(t){let e=t.facet(hg);return e.length?e:t.facet(_k)}function Hk(t,e){let i=[I6],n;return t instanceof qa&&(t.module&&i.push(ie.styleModule.of(t.module)),n=t.themeType),e?.fallback?i.push(_k.of(t)):n?i.push(hg.computeN([ie.darkTheme],r=>r.facet(ie.darkTheme)==(n=="dark")?[t]:[])):i.push(hg.of(t)),i}class V6{constructor(e){this.markCache=Object.create(null),this.tree=Ft(e.state),this.decorations=this.buildDeco(e,Zp(e.state)),this.decoratedTo=e.viewport.to}update(e){let i=Ft(e.state),n=Zp(e.state),r=n!=Zp(e.startState),{viewport:o}=e.view,a=e.changes.mapPos(this.decoratedTo,1);i.length<o.to&&!r&&i.type==this.tree.type&&a>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(i!=this.tree||e.viewportChanged||r)&&(this.tree=i,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=o.to)}buildDeco(e,i){if(!i||!this.tree.length)return ge.none;let n=new Kn;for(let{from:r,to:o}of e.visibleRanges)c6(this.tree,i,(a,c,h)=>{n.add(a,c,this.markCache[h]||(this.markCache[h]=ge.mark({class:h})))},r,o);return n.finish()}}const I6=As.high(at.fromClass(V6,{decorations:t=>t.decorations})),Q6=qa.define([{tag:F.meta,color:"#404740"},{tag:F.link,textDecoration:"underline"},{tag:F.heading,textDecoration:"underline",fontWeight:"bold"},{tag:F.emphasis,fontStyle:"italic"},{tag:F.strong,fontWeight:"bold"},{tag:F.strikethrough,textDecoration:"line-through"},{tag:F.keyword,color:"#708"},{tag:[F.atom,F.bool,F.url,F.contentSeparator,F.labelName],color:"#219"},{tag:[F.literal,F.inserted],color:"#164"},{tag:[F.string,F.deleted],color:"#a11"},{tag:[F.regexp,F.escape,F.special(F.string)],color:"#e40"},{tag:F.definition(F.variableName),color:"#00f"},{tag:F.local(F.variableName),color:"#30a"},{tag:[F.typeName,F.namespace],color:"#085"},{tag:F.className,color:"#167"},{tag:[F.special(F.variableName),F.macroName],color:"#256"},{tag:F.definition(F.propertyName),color:"#00c"},{tag:F.comment,color:"#940"},{tag:F.invalid,color:"#f00"}]),Y6=ie.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Uk=1e4,qk="()[]{}",Pk=le.define({combine(t){return wn(t,{afterCursor:!0,brackets:qk,maxScanDistance:Uk,renderMatch:W6})}}),G6=ge.mark({class:"cm-matchingBracket"}),K6=ge.mark({class:"cm-nonmatchingBracket"});function W6(t){let e=[],i=t.matched?G6:K6;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}function AS(t){let e=[],i=t.facet(Pk);for(let n of t.selection.ranges){if(!n.empty)continue;let r=gn(t,n.head,-1,i)||n.head>0&&gn(t,n.head-1,1,i)||i.afterCursor&&(gn(t,n.head,1,i)||n.head<t.doc.length&&gn(t,n.head+1,-1,i));r&&(e=e.concat(i.renderMatch(r,t)))}return ge.set(e,!0)}const X6=at.fromClass(class{constructor(t){this.paused=!1,this.decorations=AS(t.state)}update(t){(t.docChanged||t.selectionSet||this.paused)&&(t.view.composing?(this.decorations=this.decorations.map(t.changes),this.paused=!0):(this.decorations=AS(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),Z6=[X6,Y6];function J6(t={}){return[Pk.of(t),Z6]}const $6=new Te;function fg(t,e,i){let n=t.prop(e<0?Te.openedBy:Te.closedBy);if(n)return n;if(t.name.length==1){let r=i.indexOf(t.name);if(r>-1&&r%2==(e<0?1:0))return[i[r+e]]}return null}function dg(t){let e=t.type.prop($6);return e?e(t.node):t}function gn(t,e,i,n={}){let r=n.maxScanDistance||Uk,o=n.brackets||qk,a=Ft(t),c=a.resolveInner(e,i);for(let h=c;h;h=h.parent){let d=fg(h.type,i,o);if(d&&h.from<h.to){let p=dg(h);if(p&&(i>0?e>=p.from&&e<p.to:e>p.from&&e<=p.to))return eB(t,e,i,h,p,d,o)}}return tB(t,e,i,a,c.type,r,o)}function eB(t,e,i,n,r,o,a){let c=n.parent,h={from:r.from,to:r.to},d=0,p=c?.cursor();if(p&&(i<0?p.childBefore(n.from):p.childAfter(n.to)))do if(i<0?p.to<=n.from:p.from>=n.to){if(d==0&&o.indexOf(p.type.name)>-1&&p.from<p.to){let y=dg(p);return{start:h,end:y?{from:y.from,to:y.to}:void 0,matched:!0}}else if(fg(p.type,i,a))d++;else if(fg(p.type,-i,a)){if(d==0){let y=dg(p);return{start:h,end:y&&y.from<y.to?{from:y.from,to:y.to}:void 0,matched:!1}}d--}}while(i<0?p.prevSibling():p.nextSibling());return{start:h,matched:!1}}function tB(t,e,i,n,r,o,a){let c=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),h=a.indexOf(c);if(h<0||h%2==0!=i>0)return null;let d={from:i<0?e-1:e,to:i>0?e+1:e},p=t.doc.iterRange(e,i>0?t.doc.length:0),y=0;for(let b=0;!p.next().done&&b<=o;){let x=p.value;i<0&&(b+=x.length);let w=e+b*i;for(let C=i>0?0:x.length-1,k=i>0?x.length:-1;C!=k;C+=i){let M=a.indexOf(x[C]);if(!(M<0||n.resolveInner(w+C,1).type!=r))if(M%2==0==i>0)y++;else{if(y==1)return{start:d,end:{from:w+C,to:w+C+1},matched:M>>1==h>>1};y--}}i>0&&(b+=x.length)}return p.done?{start:d,matched:!1}:null}const iB=Object.create(null),MS=[fi.none],TS=[],OS=Object.create(null),nB=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])nB[t]=rB(iB,e);function Jp(t,e){TS.indexOf(t)>-1||(TS.push(t),console.warn(e))}function rB(t,e){let i=[];for(let c of e.split(" ")){let h=[];for(let d of c.split(".")){let p=t[d]||F[d];p?typeof p=="function"?h.length?h=h.map(p):Jp(d,`Modifier ${d} used at start of tag`):h.length?Jp(d,`Tag ${d} used as modifier`):h=Array.isArray(p)?p:[p]:Jp(d,`Unknown highlighting tag ${d}`)}for(let d of h)i.push(d)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map(c=>c.id),o=OS[r];if(o)return o.id;let a=OS[r]=fi.define({id:MS.length,name:n,props:[Ck({[n]:i})]});return MS.push(a),a.id}Ze.RTL,Ze.LTR;const sB=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=d0(t.state,i.from);return n.line?lB(t):n.block?aB(t):!1};function f0(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return r?(n(i.update(r)),!0):!1}}const lB=f0(hB,0),oB=f0(Fk,0),aB=f0((t,e)=>Fk(t,e,cB(e)),0);function d0(t,e){let i=t.languageDataAt("commentTokens",e,1);return i.length?i[0]:{}}const Go=50;function uB(t,{open:e,close:i},n,r){let o=t.sliceDoc(n-Go,n),a=t.sliceDoc(r,r+Go),c=/\s*$/.exec(o)[0].length,h=/^\s*/.exec(a)[0].length,d=o.length-c;if(o.slice(d-e.length,d)==e&&a.slice(h,h+i.length)==i)return{open:{pos:n-c,margin:c&&1},close:{pos:r+h,margin:h&&1}};let p,y;r-n<=2*Go?p=y=t.sliceDoc(n,r):(p=t.sliceDoc(n,n+Go),y=t.sliceDoc(r-Go,r));let b=/^\s*/.exec(p)[0].length,x=/\s*$/.exec(y)[0].length,w=y.length-x-i.length;return p.slice(b,b+e.length)==e&&y.slice(w,w+i.length)==i?{open:{pos:n+b+e.length,margin:/\s/.test(p.charAt(b+e.length))?1:0},close:{pos:r-x-i.length,margin:/\s/.test(y.charAt(w-1))?1:0}}:null}function cB(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to);r.from>n.from&&r.from==i.to&&(r=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let o=e.length-1;o>=0&&e[o].to>n.from?e[o].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function Fk(t,e,i=e.selection.ranges){let n=i.map(o=>d0(e,o.from).block);if(!n.every(o=>o))return null;let r=i.map((o,a)=>uB(e,n[a],o.from,o.to));if(t!=2&&!r.every(o=>o))return{changes:e.changes(i.map((o,a)=>r[a]?[]:[{from:o.from,insert:n[a].open+" "},{from:o.to,insert:" "+n[a].close}]))};if(t!=1&&r.some(o=>o)){let o=[];for(let a=0,c;a<r.length;a++)if(c=r[a]){let h=n[a],{open:d,close:p}=c;o.push({from:d.pos-h.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+h.close.length})}return{changes:o}}return null}function hB(t,e,i=e.selection.ranges){let n=[],r=-1;e:for(let{from:o,to:a}of i){let c=n.length,h=1e9,d;for(let p=o;p<=a;){let y=e.doc.lineAt(p);if(d==null&&(d=d0(e,y.from).line,!d))continue e;if(y.from>r&&(o==a||a>y.from)){r=y.from;let b=/^\s*/.exec(y.text)[0].length,x=b==y.length,w=y.text.slice(b,b+d.length)==d?b:-1;b<y.text.length&&b<h&&(h=b),n.push({line:y,comment:w,token:d,indent:b,empty:x,single:!1})}p=y.to+1}if(h<1e9)for(let p=c;p<n.length;p++)n[p].indent<n[p].line.text.length&&(n[p].indent=h);n.length==c+1&&(n[c].single=!0)}if(t!=2&&n.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:c,token:h,indent:d,empty:p,single:y}of n)(y||!p)&&o.push({from:c.from+d,insert:h+" "});let a=e.changes(o);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&n.some(o=>o.comment>=0)){let o=[];for(let{line:a,comment:c,token:h}of n)if(c>=0){let d=a.from+c,p=d+h.length;a.text[p-a.from]==" "&&p++,o.push({from:d,to:p})}return{changes:o}}return null}const pg=Sn.define(),fB=Sn.define(),dB=le.define(),Vk=le.define({combine(t){return wn(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,i)=>i},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,i)=>(n,r)=>e(n,r)||i(n,r)})}}),Ik=It.define({create(){return yn.empty},update(t,e){let i=e.state.facet(Vk),n=e.annotation(pg);if(n){let h=hi.fromTransaction(e,n.selection),d=n.side,p=d==0?t.undone:t.done;return h?p=Sh(p,p.length,i.minDepth,h):p=Gk(p,e.startState.selection),new yn(d==0?n.rest:p,d==0?p:n.rest)}let r=e.annotation(fB);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(At.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=hi.fromTransaction(e),a=e.annotation(At.time),c=e.annotation(At.userEvent);return o?t=t.addChanges(o,a,c,i,e):e.selection&&(t=t.addSelection(e.startState.selection,a,c,i.newGroupDelay)),(r=="full"||r=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new yn(t.done.map(hi.fromJSON),t.undone.map(hi.fromJSON))}});function pB(t={}){return[Ik,Vk.of(t),ie.domEventHandlers({beforeinput(e,i){let n=e.inputType=="historyUndo"?Qk:e.inputType=="historyRedo"?mg:null;return n?(e.preventDefault(),n(i)):!1}})]}function Gh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(Ik,!1);if(!r)return!1;let o=r.pop(t,i,e);return o?(n(o),!0):!1}}const Qk=Gh(0,!1),mg=Gh(1,!1),mB=Gh(0,!0),gB=Gh(1,!0);class hi{constructor(e,i,n,r,o){this.changes=e,this.effects=i,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new hi(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,i,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(i=this.mapped)===null||i===void 0?void 0:i.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new hi(e.changes&&wt.fromJSON(e.changes),[],e.mapped&&vn.fromJSON(e.mapped),e.startSelection&&W.fromJSON(e.startSelection),e.selectionsAfter.map(W.fromJSON))}static fromTransaction(e,i){let n=Pi;for(let r of e.startState.facet(dB)){let o=r(e);o.length&&(n=n.concat(o))}return!n.length&&e.changes.empty?null:new hi(e.changes.invert(e.startState.doc),n,void 0,i||e.startState.selection,Pi)}static selection(e){return new hi(void 0,Pi,void 0,void 0,e)}}function Sh(t,e,i,n){let r=e+1>i+20?e-i-1:0,o=t.slice(r,e);return o.push(n),o}function yB(t,e){let i=[],n=!1;return t.iterChangedRanges((r,o)=>i.push(r,o)),e.iterChangedRanges((r,o,a,c)=>{for(let h=0;h<i.length;){let d=i[h++],p=i[h++];c>=d&&a<=p&&(n=!0)}}),n}function bB(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,n)=>i.empty!=e.ranges[n].empty).length===0}function Yk(t,e){return t.length?e.length?t.concat(e):t:e}const Pi=[],xB=200;function Gk(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-xB));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),Sh(t,t.length-1,1e9,i.setSelAfter(n)))}else return[hi.selection([e])]}function vB(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function $p(t,e){if(!t.length)return t;let i=t.length,n=Pi;for(;i;){let r=SB(t[i-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let o=t.slice(0,i);return o[i-1]=r,o}else e=r.mapped,i--,n=r.selectionsAfter}return n.length?[hi.selection(n)]:Pi}function SB(t,e,i){let n=Yk(t.selectionsAfter.length?t.selectionsAfter.map(c=>c.map(e)):Pi,i);if(!t.changes)return hi.selection(n);let r=t.changes.map(e),o=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(o):o;return new hi(r,Se.mapEffects(t.effects,e),a,t.startSelection.map(o),n)}const wB=/^(input\.type|delete)($|\.)/;class yn{constructor(e,i,n=0,r=void 0){this.done=e,this.undone=i,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new yn(this.done,this.undone):this}addChanges(e,i,n,r,o){let a=this.done,c=a[a.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!n||wB.test(n))&&(!c.selectionsAfter.length&&i-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,yB(c.changes,e.changes))||n=="input.type.compose")?a=Sh(a,a.length-1,r.minDepth,new hi(e.changes.compose(c.changes),Yk(Se.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,Pi)):a=Sh(a,a.length,r.minDepth,e),new yn(a,Pi,i,n)}addSelection(e,i,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:Pi;return o.length>0&&i-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&bB(o[o.length-1],e)?this:new yn(Gk(this.done,e),this.undone,i,n)}addMapping(e){return new yn($p(this.done,e),$p(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,i,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let o=r[r.length-1],a=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):i.selection);if(n&&o.selectionsAfter.length)return i.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:pg.of({side:e,rest:vB(r),selection:a}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let c=r.length==1?Pi:r.slice(0,r.length-1);return o.mapped&&(c=$p(c,o.mapped)),i.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:pg.of({side:e,rest:c,selection:a}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}yn.empty=new yn(Pi,Pi);const CB=[{key:"Mod-z",run:Qk,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:mg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:mg,preventDefault:!0},{key:"Mod-u",run:mB,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:gB,preventDefault:!0}];function Fl(t,e){return W.create(t.ranges.map(e),t.mainIndex)}function tn(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function nn({state:t,dispatch:e},i){let n=Fl(t.selection,i);return n.eq(t.selection,!0)?!1:(e(tn(t,n)),!0)}function Kh(t,e){return W.cursor(e?t.to:t.from)}function Kk(t,e){return nn(t,i=>i.empty?t.moveByChar(i,e):Kh(i,e))}function Qt(t){return t.textDirectionAt(t.state.selection.main.head)==Ze.LTR}const Wk=t=>Kk(t,!Qt(t)),Xk=t=>Kk(t,Qt(t));function Zk(t,e){return nn(t,i=>i.empty?t.moveByGroup(i,e):Kh(i,e))}const kB=t=>Zk(t,!Qt(t)),AB=t=>Zk(t,Qt(t));function MB(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Wh(t,e,i){let n=Ft(t).resolveInner(e.head),r=i?Te.closedBy:Te.openedBy;for(let h=e.head;;){let d=i?n.childAfter(h):n.childBefore(h);if(!d)break;MB(t,d,r)?n=d:h=i?d.to:d.from}let o=n.type.prop(r),a,c;return o&&(a=i?gn(t,n.from,1):gn(t,n.to,-1))&&a.matched?c=i?a.end.to:a.end.from:c=i?n.to:n.from,W.cursor(c,i?-1:1)}const TB=t=>nn(t,e=>Wh(t.state,e,!Qt(t))),OB=t=>nn(t,e=>Wh(t.state,e,Qt(t)));function Jk(t,e){return nn(t,i=>{if(!i.empty)return Kh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)})}const $k=t=>Jk(t,!1),eA=t=>Jk(t,!0);function tA(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,n=0,r;if(e){for(let o of t.state.facet(ie.scrollMargins)){let a=o(t);a?.top&&(i=Math.max(a?.top,i)),a?.bottom&&(n=Math.max(a?.bottom,n))}r=t.scrollDOM.clientHeight-i-n}else r=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:n,selfScroll:e,height:Math.max(t.defaultLineHeight,r-5)}}function iA(t,e){let i=tA(t),{state:n}=t,r=Fl(n.selection,a=>a.empty?t.moveVertically(a,e,i.height):Kh(a,e));if(r.eq(n.selection))return!1;let o;if(i.selfScroll){let a=t.coordsAtPos(n.selection.main.head),c=t.scrollDOM.getBoundingClientRect(),h=c.top+i.marginTop,d=c.bottom-i.marginBottom;a&&a.top>h&&a.bottom<d&&(o=ie.scrollIntoView(r.main.head,{y:"start",yMargin:a.top-h}))}return t.dispatch(tn(n,r),{effects:o}),!0}const ES=t=>iA(t,!1),gg=t=>iA(t,!0);function Fr(t,e,i){let n=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?n.to:n.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==n.from&&n.length){let o=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;o&&e.head!=n.from+o&&(r=W.cursor(n.from+o))}return r}const EB=t=>nn(t,e=>Fr(t,e,!0)),NB=t=>nn(t,e=>Fr(t,e,!1)),RB=t=>nn(t,e=>Fr(t,e,!Qt(t))),DB=t=>nn(t,e=>Fr(t,e,Qt(t))),jB=t=>nn(t,e=>W.cursor(t.lineBlockAt(e.head).from,1)),LB=t=>nn(t,e=>W.cursor(t.lineBlockAt(e.head).to,-1));function BB(t,e,i){let n=!1,r=Fl(t.selection,o=>{let a=gn(t,o.head,-1)||gn(t,o.head,1)||o.head>0&&gn(t,o.head-1,1)||o.head<t.doc.length&&gn(t,o.head+1,-1);if(!a||!a.end)return o;n=!0;let c=a.start.from==o.head?a.end.to:a.end.from;return W.cursor(c)});return n?(e(tn(t,r)),!0):!1}const zB=({state:t,dispatch:e})=>BB(t,e);function Qi(t,e){let i=Fl(t.state.selection,n=>{let r=e(n);return W.range(n.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return i.eq(t.state.selection)?!1:(t.dispatch(tn(t.state,i)),!0)}function nA(t,e){return Qi(t,i=>t.moveByChar(i,e))}const rA=t=>nA(t,!Qt(t)),sA=t=>nA(t,Qt(t));function lA(t,e){return Qi(t,i=>t.moveByGroup(i,e))}const _B=t=>lA(t,!Qt(t)),HB=t=>lA(t,Qt(t)),UB=t=>Qi(t,e=>Wh(t.state,e,!Qt(t))),qB=t=>Qi(t,e=>Wh(t.state,e,Qt(t)));function oA(t,e){return Qi(t,i=>t.moveVertically(i,e))}const aA=t=>oA(t,!1),uA=t=>oA(t,!0);function cA(t,e){return Qi(t,i=>t.moveVertically(i,e,tA(t).height))}const NS=t=>cA(t,!1),RS=t=>cA(t,!0),PB=t=>Qi(t,e=>Fr(t,e,!0)),FB=t=>Qi(t,e=>Fr(t,e,!1)),VB=t=>Qi(t,e=>Fr(t,e,!Qt(t))),IB=t=>Qi(t,e=>Fr(t,e,Qt(t))),QB=t=>Qi(t,e=>W.cursor(t.lineBlockAt(e.head).from)),YB=t=>Qi(t,e=>W.cursor(t.lineBlockAt(e.head).to)),DS=({state:t,dispatch:e})=>(e(tn(t,{anchor:0})),!0),jS=({state:t,dispatch:e})=>(e(tn(t,{anchor:t.doc.length})),!0),LS=({state:t,dispatch:e})=>(e(tn(t,{anchor:t.selection.main.anchor,head:0})),!0),BS=({state:t,dispatch:e})=>(e(tn(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),GB=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),KB=({state:t,dispatch:e})=>{let i=Xh(t).map(({from:n,to:r})=>W.range(n,Math.min(r+1,t.doc.length)));return e(t.update({selection:W.create(i),userEvent:"select"})),!0},WB=({state:t,dispatch:e})=>{let i=Fl(t.selection,n=>{let r=Ft(t),o=r.resolveStack(n.from,1);if(n.empty){let a=r.resolveStack(n.from,-1);a.node.from>=o.node.from&&a.node.to<=o.node.to&&(o=a)}for(let a=o;a;a=a.next){let{node:c}=a;if((c.from<n.from&&c.to>=n.to||c.to>n.to&&c.from<=n.from)&&a.next)return W.range(c.to,c.from)}return n});return i.eq(t.selection)?!1:(e(tn(t,i)),!0)};function hA(t,e){let{state:i}=t,n=i.selection,r=i.selection.ranges.slice();for(let o of i.selection.ranges){let a=i.doc.lineAt(o.head);if(e?a.to<t.state.doc.length:a.from>0)for(let c=o;;){let h=t.moveVertically(c,e);if(h.head<a.from||h.head>a.to){r.some(d=>d.head==h.head)||r.push(h);break}else{if(h.head==c.head)break;c=h}}}return r.length==n.ranges.length?!1:(t.dispatch(tn(i,W.create(r,r.length-1))),!0)}const XB=t=>hA(t,!1),ZB=t=>hA(t,!0),JB=({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=W.create([i.main]):i.main.empty||(n=W.create([W.cursor(i.main.head)])),n?(e(tn(t,n)),!0):!1};function Pa(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,r=n.changeByRange(o=>{let{from:a,to:c}=o;if(a==c){let h=e(o);h<a?(i="delete.backward",h=Tc(t,h,!1)):h>a&&(i="delete.forward",h=Tc(t,h,!0)),a=Math.min(a,h),c=Math.max(c,h)}else a=Tc(t,a,!1),c=Tc(t,c,!0);return a==c?{range:o}:{changes:{from:a,to:c},range:W.cursor(a,a<o.head?-1:1)}});return r.changes.empty?!1:(t.dispatch(n.update(r,{scrollIntoView:!0,userEvent:i,effects:i=="delete.selection"?ie.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Tc(t,e,i){if(t instanceof ie)for(let n of t.state.facet(ie.atomicRanges).map(r=>r(t)))n.between(e,e,(r,o)=>{r<e&&o>e&&(e=i?o:r)});return e}const fA=(t,e,i)=>Pa(t,n=>{let r=n.from,{state:o}=t,a=o.doc.lineAt(r),c,h;if(i&&!e&&r>a.from&&r<a.from+200&&!/[^ \t]/.test(c=a.text.slice(0,r-a.from))){if(c[c.length-1]==" ")return r-1;let d=Pl(c,o.tabSize),p=d%bh(o)||bh(o);for(let y=0;y<p&&c[c.length-1-y]==" ";y++)r--;h=r}else h=Et(a.text,r-a.from,e,e)+a.from,h==r&&a.number!=(e?o.doc.lines:1)?h+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(h-a.from,r-a.from))&&(h=Et(a.text,h-a.from,!1,!1)+a.from);return h}),yg=t=>fA(t,!1,!0),dA=t=>fA(t,!0,!1),pA=(t,e)=>Pa(t,i=>{let n=i.head,{state:r}=t,o=r.doc.lineAt(n),a=r.charCategorizer(n);for(let c=null;;){if(n==(e?o.to:o.from)){n==i.head&&o.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let h=Et(o.text,n-o.from,e)+o.from,d=o.text.slice(Math.min(n,h)-o.from,Math.max(n,h)-o.from),p=a(d);if(c!=null&&p!=c)break;(d!=" "||n!=i.head)&&(c=p),n=h}return n}),mA=t=>pA(t,!1),$B=t=>pA(t,!0),e8=t=>Pa(t,e=>{let i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),t8=t=>Pa(t,e=>{let i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1)}),i8=t=>Pa(t,e=>{let i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),n8=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Ue.of(["",""])},range:W.cursor(n.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},r8=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>{if(!n.empty||n.from==0||n.from==t.doc.length)return{range:n};let r=n.from,o=t.doc.lineAt(r),a=r==o.from?r-1:Et(o.text,r-o.from,!1)+o.from,c=r==o.to?r+1:Et(o.text,r-o.from,!0)+o.from;return{changes:{from:a,to:c,insert:t.doc.slice(r,c).append(t.doc.slice(a,r))},range:W.cursor(c)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Xh(t){let e=[],i=-1;for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),o=t.doc.lineAt(n.to);if(!n.empty&&n.to==o.from&&(o=t.doc.lineAt(n.to-1)),i>=r.number){let a=e[e.length-1];a.to=o.to,a.ranges.push(n)}else e.push({from:r.from,to:o.to,ranges:[n]});i=o.number+1}return e}function gA(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let o of Xh(t)){if(i?o.to==t.doc.length:o.from==0)continue;let a=t.doc.lineAt(i?o.to+1:o.from-1),c=a.length+1;if(i){n.push({from:o.to,to:a.to},{from:o.from,insert:a.text+t.lineBreak});for(let h of o.ranges)r.push(W.range(Math.min(t.doc.length,h.anchor+c),Math.min(t.doc.length,h.head+c)))}else{n.push({from:a.from,to:o.from},{from:o.to,insert:t.lineBreak+a.text});for(let h of o.ranges)r.push(W.range(h.anchor-c,h.head-c))}}return n.length?(e(t.update({changes:n,scrollIntoView:!0,selection:W.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const s8=({state:t,dispatch:e})=>gA(t,e,!1),l8=({state:t,dispatch:e})=>gA(t,e,!0);function yA(t,e,i){if(t.readOnly)return!1;let n=[];for(let o of Xh(t))i?n.push({from:o.from,insert:t.doc.slice(o.from,o.to)+t.lineBreak}):n.push({from:o.to,insert:t.lineBreak+t.doc.slice(o.from,o.to)});let r=t.changes(n);return e(t.update({changes:r,selection:t.selection.map(r,i?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const o8=({state:t,dispatch:e})=>yA(t,e,!1),a8=({state:t,dispatch:e})=>yA(t,e,!0),u8=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Xh(e).map(({from:r,to:o})=>(r>0?r--:o<e.doc.length&&o++,{from:r,to:o}))),n=Fl(e.selection,r=>{let o;if(t.lineWrapping){let a=t.lineBlockAt(r.head),c=t.coordsAtPos(r.head,r.assoc||1);c&&(o=a.bottom+t.documentTop-c.bottom+t.defaultLineHeight/2)}return t.moveVertically(r,!0,o)}).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function c8(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i=Ft(t).resolveInner(e),n=i.childBefore(e),r=i.childAfter(e),o;return n&&r&&n.to<=e&&r.from>=e&&(o=n.type.prop(Te.closedBy))&&o.indexOf(r.name)>-1&&t.doc.lineAt(n.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}const zS=bA(!1),h8=bA(!0);function bA(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{let{from:o,to:a}=r,c=e.doc.lineAt(o),h=!t&&o==a&&c8(e,o);t&&(o=a=(a<=c.to?c:e.doc.lineAt(a)).to);let d=new Qh(e,{simulateBreak:o,simulateDoubleBreak:!!h}),p=c0(d,o);for(p==null&&(p=Pl(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));a<c.to&&/\s/.test(c.text[a-c.from]);)a++;h?{from:o,to:a}=h:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let y=["",Ma(e,p)];return h&&y.push(Ma(e,d.lineIndent(c.from,-1))),{changes:{from:o,to:a,insert:Ue.of(y)},range:W.cursor(o+1+y[1].length)}});return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function p0(t,e){let i=-1;return t.changeByRange(n=>{let r=[];for(let a=n.from;a<=n.to;){let c=t.doc.lineAt(a);c.number>i&&(n.empty||n.to>c.from)&&(e(c,r,n),i=c.number),a=c.to+1}let o=t.changes(r);return{changes:r,range:W.range(o.mapPos(n.anchor,1),o.mapPos(n.head,1))}})}const f8=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new Qh(t,{overrideIndentation:o=>{let a=i[o];return a??-1}}),r=p0(t,(o,a,c)=>{let h=c0(n,o.from);if(h==null)return;/\S/.test(o.text)||(h=0);let d=/^\s*/.exec(o.text)[0],p=Ma(t,h);(d!=p||c.from<o.from+d.length)&&(i[o.from]=h,a.push({from:o.from,to:o.from+d.length,insert:p}))});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0},xA=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(p0(t,(i,n)=>{n.push({from:i.from,insert:t.facet(Ih)})}),{userEvent:"input.indent"})),!0),vA=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(p0(t,(i,n)=>{let r=/^\s*/.exec(i.text)[0];if(!r)return;let o=Pl(r,t.tabSize),a=0,c=Ma(t,Math.max(0,o-bh(t)));for(;a<r.length&&a<c.length&&r.charCodeAt(a)==c.charCodeAt(a);)a++;n.push({from:i.from+a,to:i.from+r.length,insert:c.slice(a)})}),{userEvent:"delete.dedent"})),!0),d8=t=>(t.setTabFocusMode(),!0),p8=[{key:"Ctrl-b",run:Wk,shift:rA,preventDefault:!0},{key:"Ctrl-f",run:Xk,shift:sA},{key:"Ctrl-p",run:$k,shift:aA},{key:"Ctrl-n",run:eA,shift:uA},{key:"Ctrl-a",run:jB,shift:QB},{key:"Ctrl-e",run:LB,shift:YB},{key:"Ctrl-d",run:dA},{key:"Ctrl-h",run:yg},{key:"Ctrl-k",run:e8},{key:"Ctrl-Alt-h",run:mA},{key:"Ctrl-o",run:n8},{key:"Ctrl-t",run:r8},{key:"Ctrl-v",run:gg}],m8=[{key:"ArrowLeft",run:Wk,shift:rA,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:kB,shift:_B,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:RB,shift:VB,preventDefault:!0},{key:"ArrowRight",run:Xk,shift:sA,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:AB,shift:HB,preventDefault:!0},{mac:"Cmd-ArrowRight",run:DB,shift:IB,preventDefault:!0},{key:"ArrowUp",run:$k,shift:aA,preventDefault:!0},{mac:"Cmd-ArrowUp",run:DS,shift:LS},{mac:"Ctrl-ArrowUp",run:ES,shift:NS},{key:"ArrowDown",run:eA,shift:uA,preventDefault:!0},{mac:"Cmd-ArrowDown",run:jS,shift:BS},{mac:"Ctrl-ArrowDown",run:gg,shift:RS},{key:"PageUp",run:ES,shift:NS},{key:"PageDown",run:gg,shift:RS},{key:"Home",run:NB,shift:FB,preventDefault:!0},{key:"Mod-Home",run:DS,shift:LS},{key:"End",run:EB,shift:PB,preventDefault:!0},{key:"Mod-End",run:jS,shift:BS},{key:"Enter",run:zS,shift:zS},{key:"Mod-a",run:GB},{key:"Backspace",run:yg,shift:yg,preventDefault:!0},{key:"Delete",run:dA,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:mA,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:$B,preventDefault:!0},{mac:"Mod-Backspace",run:t8,preventDefault:!0},{mac:"Mod-Delete",run:i8,preventDefault:!0}].concat(p8.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),g8=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:TB,shift:UB},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:OB,shift:qB},{key:"Alt-ArrowUp",run:s8},{key:"Shift-Alt-ArrowUp",run:o8},{key:"Alt-ArrowDown",run:l8},{key:"Shift-Alt-ArrowDown",run:a8},{key:"Mod-Alt-ArrowUp",run:XB},{key:"Mod-Alt-ArrowDown",run:ZB},{key:"Escape",run:JB},{key:"Mod-Enter",run:h8},{key:"Alt-l",mac:"Ctrl-l",run:KB},{key:"Mod-i",run:WB,preventDefault:!0},{key:"Mod-[",run:vA},{key:"Mod-]",run:xA},{key:"Mod-Alt-\\",run:f8},{key:"Shift-Mod-k",run:u8},{key:"Shift-Mod-\\",run:zB},{key:"Mod-/",run:sB},{key:"Alt-A",run:oB},{key:"Ctrl-m",mac:"Shift-Alt-m",run:d8}].concat(m8),y8={key:"Tab",run:xA,shift:vA},_S=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Bl{constructor(e,i,n=0,r=e.length,o,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=o?c=>o(_S(c)):_S,this.query=this.normalize(i)}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 li(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 i=Pg(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=dn(e);let r=this.normalize(i);if(r.length)for(let o=0,a=n;;o++){let c=r.charCodeAt(o),h=this.match(c,a,this.bufferPos+this.bufferStart);if(o==r.length-1){if(h)return this.value=h,this;break}a==n&&o<i.length&&i.charCodeAt(o)==c&&a++}}}match(e,i,n){let r=null;for(let o=0;o<this.matches.length;o+=2){let a=this.matches[o],c=!1;this.query.charCodeAt(a)==e&&(a==this.query.length-1?r={from:this.matches[o+1],to:n}:(this.matches[o]++,c=!0)),c||(this.matches.splice(o,2),o-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:i,to:n}:this.matches.push(1,i)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}typeof Symbol<"u"&&(Bl.prototype[Symbol.iterator]=function(){return this});const SA={from:-1,to:-1,match:/.*/.exec("")},m0="gm"+(/x/.unicode==null?"":"u");class wA{constructor(e,i,n,r=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=SA,/\\[sWDnr]|\n|\r|\[\^/.test(i))return new CA(e,i,n,r,o);this.re=new RegExp(i,m0+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=wh(e,r),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 i=this.matchPos<=this.to&&this.re.exec(this.curLine);if(i){let n=this.curLineStart+i.index,r=n+i[0].length;if(this.matchPos=wh(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,i)))return this.value={from:n,to:r,match:i},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 em=new WeakMap;class Al{constructor(e,i){this.from=e,this.text=i}get to(){return this.from+this.text.length}static get(e,i,n){let r=em.get(e);if(!r||r.from>=n||r.to<=i){let c=new Al(i,e.sliceString(i,n));return em.set(e,c),c}if(r.from==i&&r.to==n)return r;let{text:o,from:a}=r;return a>i&&(o=e.sliceString(i,a)+o,a=i),r.to<n&&(o+=e.sliceString(r.to,n)),em.set(e,new Al(a,o)),new Al(i,o.slice(i-a,n-a))}}class CA{constructor(e,i,n,r,o){this.text=e,this.to=o,this.done=!1,this.value=SA,this.matchPos=wh(e,r),this.re=new RegExp(i,m0+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=Al.get(e,r,this.chunkEnd(r+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,i=this.re.exec(this.flat.text);if(i&&!i[0]&&i.index==e&&(this.re.lastIndex=e+1,i=this.re.exec(this.flat.text)),i){let n=this.flat.from+i.index,r=n+i[0].length;if((this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,i)))return this.value={from:n,to:r,match:i},this.matchPos=wh(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Al.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(wA.prototype[Symbol.iterator]=CA.prototype[Symbol.iterator]=function(){return this});function b8(t){try{return new RegExp(t,m0),!0}catch{return!1}}function wh(t,e){if(e>=t.length)return e;let i=t.lineAt(e),n;for(;e<i.to&&(n=i.text.charCodeAt(e-i.from))>=56320&&n<57344;)e++;return e}const x8=t=>{let{state:e}=t,i=String(e.doc.lineAt(t.state.selection.main.head).number),{close:n,result:r}=_L(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:e.phrase("go")});return r.then(o=>{let a=o&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(o.elements.line.value);if(!a){t.dispatch({effects:n});return}let c=e.doc.lineAt(e.selection.main.head),[,h,d,p,y]=a,b=p?+p.slice(1):0,x=d?+d:c.number;if(d&&y){let k=x/100;h&&(k=k*(h=="-"?-1:1)+c.number/e.doc.lines),x=Math.round(e.doc.lines*k)}else d&&h&&(x=x*(h=="-"?-1:1)+c.number);let w=e.doc.line(Math.max(1,Math.min(e.doc.lines,x))),C=W.cursor(w.from+Math.max(0,Math.min(b,w.length)));t.dispatch({effects:[n,ie.scrollIntoView(C.from,{y:"center"})],selection:C})}),!0},v8={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},S8=le.define({combine(t){return wn(t,v8,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function w8(t){return[T8,M8]}const C8=ge.mark({class:"cm-selectionMatch"}),k8=ge.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function HS(t,e,i,n){return(i==0||t(e.sliceDoc(i-1,i))!=nt.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=nt.Word)}function A8(t,e,i,n){return t(e.sliceDoc(i,i+1))==nt.Word&&t(e.sliceDoc(n-1,n))==nt.Word}const M8=at.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(S8),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ge.none;let r=n.main,o,a=null;if(r.empty){if(!e.highlightWordAroundCursor)return ge.none;let h=i.wordAt(r.head);if(!h)return ge.none;a=i.charCategorizer(r.head),o=i.sliceDoc(h.from,h.to)}else{let h=r.to-r.from;if(h<e.minSelectionLength||h>200)return ge.none;if(e.wholeWords){if(o=i.sliceDoc(r.from,r.to),a=i.charCategorizer(r.head),!(HS(a,i,r.from,r.to)&&A8(a,i,r.from,r.to)))return ge.none}else if(o=i.sliceDoc(r.from,r.to),!o)return ge.none}let c=[];for(let h of t.visibleRanges){let d=new Bl(i.doc,o,h.from,h.to);for(;!d.next().done;){let{from:p,to:y}=d.value;if((!a||HS(a,i,p,y))&&(r.empty&&p<=r.from&&y>=r.to?c.push(k8.range(p,y)):(p>=r.to||y<=r.from)&&c.push(C8.range(p,y)),c.length>e.maxMatches))return ge.none}}return ge.set(c)}},{decorations:t=>t.decorations}),T8=ie.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),O8=({state:t,dispatch:e})=>{let{selection:i}=t,n=W.create(i.ranges.map(r=>t.wordAt(r.head)||W.cursor(r.head)),i.mainIndex);return n.eq(i)?!1:(e(t.update({selection:n})),!0)};function E8(t,e){let{main:i,ranges:n}=t.selection,r=t.wordAt(i.head),o=r&&r.from==i.from&&r.to==i.to;for(let a=!1,c=new Bl(t.doc,e,n[n.length-1].to);;)if(c.next(),c.done){if(a)return null;c=new Bl(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),a=!0}else{if(a&&n.some(h=>h.from==c.value.from))continue;if(o){let h=t.wordAt(c.value.from);if(!h||h.from!=c.value.from||h.to!=c.value.to)continue}return c.value}}const N8=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(o=>o.from===o.to))return O8({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(o=>t.sliceDoc(o.from,o.to)!=n))return!1;let r=E8(t,n);return r?(e(t.update({selection:t.selection.addRange(W.range(r.from,r.to),!1),effects:ie.scrollIntoView(r.to)})),!0):!1},Vl=le.define({combine(t){return wn(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new I8(e),scrollToMatch:e=>ie.scrollIntoView(e)})}});class kA{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||b8(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,(i,n)=>n=="n"?`
53
+ `:n=="r"?"\r":n=="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 z8(this):new j8(this)}getCursor(e,i=0,n){let r=e.doc?e:Le.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?dl(this,r,i,n):fl(this,r,i,n)}}class AA{constructor(e){this.spec=e}}function R8(t,e,i){return(n,r,o,a)=>{if(i&&!i(n,r,o,a))return!1;let c=n>=a&&r<=a+o.length?o.slice(n-a,r-a):e.doc.sliceString(n,r);return t(c,e,n,r)}}function fl(t,e,i,n){let r;return t.wholeWord&&(r=D8(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(r=R8(t.test,e,r)),new Bl(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:o=>o.toLowerCase(),r)}function D8(t,e){return(i,n,r,o)=>((o>i||o+r.length<n)&&(o=Math.max(0,i-2),r=t.sliceString(o,Math.min(t.length,n+2))),(e(Ch(r,i-o))!=nt.Word||e(kh(r,i-o))!=nt.Word)&&(e(kh(r,n-o))!=nt.Word||e(Ch(r,n-o))!=nt.Word))}class j8 extends AA{constructor(e){super(e)}nextMatch(e,i,n){let r=fl(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let o=Math.min(e.doc.length,i+this.spec.unquoted.length);r=fl(this.spec,e,0,o).nextOverlapping()}return r.done||r.value.from==i&&r.value.to==n?null:r.value}prevMatchInRange(e,i,n){for(let r=n;;){let o=Math.max(i,r-1e4-this.spec.unquoted.length),a=fl(this.spec,e,o,r),c=null;for(;!a.nextOverlapping().done;)c=a.value;if(c)return c;if(o==i)return null;r-=1e4}}prevMatch(e,i,n){let r=this.prevMatchInRange(e,0,i);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=i||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,i){let n=fl(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let o=fl(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}function L8(t,e,i){return(n,r,o)=>(!i||i(n,r,o))&&t(o[0],e,n,r)}function dl(t,e,i,n){let r;return t.wholeWord&&(r=B8(e.charCategorizer(e.selection.main.head))),t.test&&(r=L8(t.test,e,r)),new wA(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:r},i,n)}function Ch(t,e){return t.slice(Et(t,e,!1),e)}function kh(t,e){return t.slice(e,Et(t,e))}function B8(t){return(e,i,n)=>!n[0].length||(t(Ch(n.input,n.index))!=nt.Word||t(kh(n.input,n.index))!=nt.Word)&&(t(kh(n.input,n.index+n[0].length))!=nt.Word||t(Ch(n.input,n.index+n[0].length))!=nt.Word)}class z8 extends AA{nextMatch(e,i,n){let r=dl(this.spec,e,n,e.doc.length).next();return r.done&&(r=dl(this.spec,e,0,i).next()),r.done?null:r.value}prevMatchInRange(e,i,n){for(let r=1;;r++){let o=Math.max(i,n-r*1e4),a=dl(this.spec,e,o,n),c=null;for(;!a.next().done;)c=a.value;if(c&&(o==i||c.from>o+10))return c;if(o==i)return null}}prevMatch(e,i,n){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(i,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let o=+n.slice(0,r);if(o>0&&o<e.match.length)return e.match[o]+n.slice(r)}return i})}matchAll(e,i){let n=dl(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let o=dl(this.spec,e,Math.max(0,i-250),Math.min(n+250,e.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}const Ta=Se.define(),g0=Se.define(),Dr=It.define({create(t){return new tm(bg(t).create(),null)},update(t,e){for(let i of e.effects)i.is(Ta)?t=new tm(i.value.create(),t.panel):i.is(g0)&&(t=new tm(t.query,i.value?y0:null));return t},provide:t=>Ca.from(t,e=>e.panel)});class tm{constructor(e,i){this.query=e,this.panel=i}}const _8=ge.mark({class:"cm-searchMatch"}),H8=ge.mark({class:"cm-searchMatch cm-searchMatch-selected"}),U8=at.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Dr))}update(t){let e=t.state.field(Dr);(e!=t.startState.field(Dr)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ge.none;let{view:i}=this,n=new Kn;for(let r=0,o=i.visibleRanges,a=o.length;r<a;r++){let{from:c,to:h}=o[r];for(;r<a-1&&h>o[r+1].from-500;)h=o[++r].to;t.highlight(i.state,c,h,(d,p)=>{let y=i.state.selection.ranges.some(b=>b.from==d&&b.to==p);n.add(d,p,y?H8:_8)})}return n.finish()}},{decorations:t=>t.decorations});function Fa(t){return e=>{let i=e.state.field(Dr,!1);return i&&i.query.spec.valid?t(e,i):OA(e)}}const Ah=Fa((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=W.single(n.from,n.to),o=t.state.facet(Vl);return t.dispatch({selection:r,effects:[b0(t,n),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),TA(t),!0}),Mh=Fa((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let o=W.single(r.from,r.to),a=t.state.facet(Vl);return t.dispatch({selection:o,effects:[b0(t,r),a.scrollToMatch(o.main,t)],userEvent:"select.search"}),TA(t),!0}),q8=Fa((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:W.create(i.map(n=>W.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),P8=({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:r}=i.main,o=[],a=0;for(let c=new Bl(t.doc,t.sliceDoc(n,r));!c.next().done;){if(o.length>1e3)return!1;c.value.from==n&&(a=o.length),o.push(W.range(c.value.from,c.value.to))}return e(t.update({selection:W.create(o,a),userEvent:"select.search.matches"})),!0},US=Fa((t,{query:e})=>{let{state:i}=t,{from:n,to:r}=i.selection.main;if(i.readOnly)return!1;let o=e.nextMatch(i,n,n);if(!o)return!1;let a=o,c=[],h,d,p=[];a.from==n&&a.to==r&&(d=i.toText(e.getReplacement(a)),c.push({from:a.from,to:a.to,insert:d}),a=e.nextMatch(i,a.from,a.to),p.push(ie.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+".")));let y=t.state.changes(c);return a&&(h=W.single(a.from,a.to).map(y),p.push(b0(t,a)),p.push(i.facet(Vl).scrollToMatch(h.main,t))),t.dispatch({changes:y,selection:h,effects:p,userEvent:"input.replace"}),!0}),F8=Fa((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map(r=>{let{from:o,to:a}=r;return{from:o,to:a,insert:e.getReplacement(r)}});if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:ie.announce.of(n),userEvent:"input.replace.all"}),!0});function y0(t){return t.state.facet(Vl).createPanel(t)}function bg(t,e){var i,n,r,o,a;let c=t.selection.main,h=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!h)return e;let d=t.facet(Vl);return new kA({search:((i=e?.literal)!==null&&i!==void 0?i:d.literal)?h:h.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:d.caseSensitive,literal:(r=e?.literal)!==null&&r!==void 0?r:d.literal,regexp:(o=e?.regexp)!==null&&o!==void 0?o:d.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:d.wholeWord})}function MA(t){let e=s0(t,y0);return e&&e.dom.querySelector("[main-field]")}function TA(t){let e=MA(t);e&&e==t.root.activeElement&&e.select()}const OA=t=>{let e=t.state.field(Dr,!1);if(e&&e.panel){let i=MA(t);if(i&&i!=t.root.activeElement){let n=bg(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ta.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[g0.of(!0),e?Ta.of(bg(t.state,e.query.spec)):Se.appendConfig.of(Y8)]});return!0},EA=t=>{let e=t.state.field(Dr,!1);if(!e||!e.panel)return!1;let i=s0(t,y0);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:g0.of(!1)}),!0},V8=[{key:"Mod-f",run:OA,scope:"editor search-panel"},{key:"F3",run:Ah,shift:Mh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ah,shift:Mh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:EA,scope:"editor search-panel"},{key:"Mod-Shift-l",run:P8},{key:"Mod-Alt-g",run:x8},{key:"Mod-d",run:N8,preventDefault:!0}];class I8{constructor(e){this.view=e;let i=this.query=e.state.field(Dr).query.spec;this.commit=this.commit.bind(this),this.searchField=Ke("input",{value:i.search,placeholder:Ci(e,"Find"),"aria-label":Ci(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ke("input",{value:i.replace,placeholder:Ci(e,"Replace"),"aria-label":Ci(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ke("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=Ke("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=Ke("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit});function n(r,o,a){return Ke("button",{class:"cm-button",name:r,onclick:o,type:"button"},a)}this.dom=Ke("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>Ah(e),[Ci(e,"next")]),n("prev",()=>Mh(e),[Ci(e,"previous")]),n("select",()=>q8(e),[Ci(e,"all")]),Ke("label",null,[this.caseField,Ci(e,"match case")]),Ke("label",null,[this.reField,Ci(e,"regexp")]),Ke("label",null,[this.wordField,Ci(e,"by word")]),...e.state.readOnly?[]:[Ke("br"),this.replaceField,n("replace",()=>US(e),[Ci(e,"replace")]),n("replaceAll",()=>F8(e),[Ci(e,"replace all")])],Ke("button",{name:"close",onclick:()=>EA(e),"aria-label":Ci(e,"close"),type:"button"},["×"])])}commit(){let e=new kA({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:Ta.of(e)}))}keydown(e){Gj(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Mh:Ah)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),US(this.view))}update(e){for(let i of e.transactions)for(let n of i.effects)n.is(Ta)&&!n.value.eq(this.query)&&this.setQuery(n.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(Vl).top}}function Ci(t,e){return t.state.phrase(e)}const Oc=30,Ec=/[\s\.,:;?!]/;function b0(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,o=Math.max(n.from,e-Oc),a=Math.min(r,i+Oc),c=t.state.sliceDoc(o,a);if(o!=n.from){for(let h=0;h<Oc;h++)if(!Ec.test(c[h+1])&&Ec.test(c[h])){c=c.slice(h);break}}if(a!=r){for(let h=c.length-1;h>c.length-Oc;h--)if(!Ec.test(c[h-1])&&Ec.test(c[h])){c=c.slice(0,h);break}}return ie.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${n.number}.`)}const Q8=ie.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"}}),Y8=[Dr,As.low(U8),Q8];class NA{constructor(e,i,n,r){this.state=e,this.pos=i,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let i=Ft(this.state).resolveInner(this.pos,-1);for(;i&&e.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}matchBefore(e){let i=this.state.doc.lineAt(this.pos),n=Math.max(i.from,this.pos-250),r=i.text.slice(n-i.from,this.pos-i.from),o=r.search(RA(e,!1));return o<0?null:{from:n+o,to:this.pos,text:r.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,i,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(i),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function qS(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function G8(t){let e=Object.create(null),i=Object.create(null);for(let{label:r}of t){e[r[0]]=!0;for(let o=1;o<r.length;o++)i[r[o]]=!0}let n=qS(e)+qS(i)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function K8(t){let e=t.map(r=>typeof r=="string"?{label:r}:r),[i,n]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:G8(e);return r=>{let o=r.matchBefore(n);return o||r.explicit?{from:o?o.from:r.pos,options:e,validFor:i}:null}}class PS{constructor(e,i,n,r){this.completion=e,this.source=i,this.match=n,this.score=r}}function bs(t){return t.selection.main.from}function RA(t,e){var i;let{source:n}=t,r=e&&n[0]!="^",o=n[n.length-1]!="$";return!r&&!o?t:new RegExp(`${r?"^":""}(?:${n})${o?"$":""}`,(i=t.flags)!==null&&i!==void 0?i:t.ignoreCase?"i":"")}const DA=Sn.define();function W8(t,e,i,n){let{main:r}=t.selection,o=i-r.from,a=n-r.from;return{...t.changeByRange(c=>{if(c!=r&&i!=n&&t.sliceDoc(c.from+o,c.from+a)!=t.sliceDoc(i,n))return{range:c};let h=t.toText(e);return{changes:{from:c.from+o,to:n==r.from?c.to:c.from+a,insert:h},range:W.cursor(c.from+o+h.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const FS=new WeakMap;function X8(t){if(!Array.isArray(t))return t;let e=FS.get(t);return e||FS.set(t,e=K8(t)),e}const Th=Se.define(),Oa=Se.define();class Z8{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let i=0;i<e.length;){let n=li(e,i),r=dn(n);this.chars.push(n);let o=e.slice(i,i+r),a=o.toUpperCase();this.folded.push(li(a==o?o.toLowerCase():a,0)),i+=r}this.astral=e.length!=this.chars.length}ret(e,i){return this.score=e,this.matched=i,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:i,folded:n,any:r,precise:o,byWord:a}=this;if(i.length==1){let O=li(e,0),D=dn(O),V=D==e.length?0:-100;if(O!=i[0])if(O==n[0])V+=-200;else return null;return this.ret(V,[0,D])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let h=i.length,d=0;if(c<0){for(let O=0,D=Math.min(e.length,200);O<D&&d<h;){let V=li(e,O);(V==i[d]||V==n[d])&&(r[d++]=O),O+=dn(V)}if(d<h)return null}let p=0,y=0,b=!1,x=0,w=-1,C=-1,k=/[a-z]/.test(e),M=!0;for(let O=0,D=Math.min(e.length,200),V=0;O<D&&y<h;){let H=li(e,O);c<0&&(p<h&&H==i[p]&&(o[p++]=O),x<h&&(H==i[x]||H==n[x]?(x==0&&(w=O),C=O+1,x++):x=0));let Y,U=H<255?H>=48&&H<=57||H>=97&&H<=122?2:H>=65&&H<=90?1:0:(Y=Pg(H))!=Y.toLowerCase()?1:Y!=Y.toUpperCase()?2:0;(!O||U==1&&k||V==0&&U!=0)&&(i[y]==H||n[y]==H&&(b=!0)?a[y++]=O:a.length&&(M=!1)),V=U,O+=dn(H)}return y==h&&a[0]==0&&M?this.result(-100+(b?-200:0),a,e):x==h&&w==0?this.ret(-200-e.length+(C==e.length?0:-100),[0,C]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):x==h?this.ret(-900-e.length,[w,C]):y==h?this.result(-100+(b?-200:0)+-700+(M?0:-1100),a,e):i.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,i,n){let r=[],o=0;for(let a of i){let c=a+(this.astral?dn(li(n,a)):1);o&&r[o-1]==a?r[o-1]=c:(r[o++]=a,r[o++]=c)}return this.ret(e-n.length,r)}}class J8{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 i=e.slice(0,this.pattern.length),n=i==this.pattern?0:i.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,i.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const Ot=le.define({combine(t){return wn(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:$8,filterStrict:!1,compareCompletions:(e,i)=>(e.sortText||e.label).localeCompare(i.sortText||i.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,i)=>e&&i,closeOnBlur:(e,i)=>e&&i,icons:(e,i)=>e&&i,tooltipClass:(e,i)=>n=>VS(e(n),i(n)),optionClass:(e,i)=>n=>VS(e(n),i(n)),addToOptions:(e,i)=>e.concat(i),filterStrict:(e,i)=>e||i})}});function VS(t,e){return t?e?t+" "+e:t:e}function $8(t,e,i,n,r,o){let a=t.textDirection==Ze.RTL,c=a,h=!1,d="top",p,y,b=e.left-r.left,x=r.right-e.right,w=n.right-n.left,C=n.bottom-n.top;if(c&&b<Math.min(w,x)?c=!1:!c&&x<Math.min(w,b)&&(c=!0),w<=(c?b:x))p=Math.max(r.top,Math.min(i.top,r.bottom-C))-e.top,y=Math.min(400,c?b:x);else{h=!0,y=Math.min(400,(a?e.right:r.right-e.left)-30);let O=r.bottom-e.bottom;O>=C||O>e.top?p=i.bottom-e.top:(d="bottom",p=e.bottom-i.top)}let k=(e.bottom-e.top)/o.offsetHeight,M=(e.right-e.left)/o.offsetWidth;return{style:`${d}: ${p/k}px; max-width: ${y/M}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":c?"left":"right")}}function ez(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(i){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),i.type&&n.classList.add(...i.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(i,n,r,o){let a=document.createElement("span");a.className="cm-completionLabel";let c=i.displayLabel||i.label,h=0;for(let d=0;d<o.length;){let p=o[d++],y=o[d++];p>h&&a.appendChild(document.createTextNode(c.slice(h,p)));let b=a.appendChild(document.createElement("span"));b.appendChild(document.createTextNode(c.slice(p,y))),b.className="cm-completionMatchedText",h=y}return h<c.length&&a.appendChild(document.createTextNode(c.slice(h))),a},position:50},{render(i){if(!i.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=i.detail,n},position:80}),e.sort((i,n)=>i.position-n.position).map(i=>i.render)}function im(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let r=Math.floor(e/i);return{from:r*i,to:(r+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class tz{constructor(e,i,n){this.view=e,this.stateField=i,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:h=>this.placeInfo(h),key:this},this.space=null,this.currentClass="";let r=e.state.field(i),{options:o,selected:a}=r.open,c=e.state.facet(Ot);this.optionContent=ez(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=im(o.length,a,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",h=>{let{options:d}=e.state.field(i).open;for(let p=h.target,y;p&&p!=this.dom;p=p.parentNode)if(p.nodeName=="LI"&&(y=/-(\d+)$/.exec(p.id))&&+y[1]<d.length){this.applyCompletion(e,d[+y[1]]),h.preventDefault();return}}),this.dom.addEventListener("focusout",h=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(Ot).closeOnBlur&&h.relatedTarget!=e.contentDOM&&e.dispatch({effects:Oa.of(null)})}),this.showOptions(o,r.id)}mount(){this.updateSel()}showOptions(e,i){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,i,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var i;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:o,selected:a,disabled:c}=n.open;(!r.open||r.open.options!=o)&&(this.range=im(o.length,a,e.state.facet(Ot).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),c!=((i=r.open)===null||i===void 0?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let i=this.tooltipClass(e);if(i!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of i.split(" "))n&&this.dom.classList.add(n);this.currentClass=i}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),i=e.open;(i.selected>-1&&i.selected<this.range.from||i.selected>=this.range.to)&&(this.range=im(i.options.length,i.selected,this.view.state.facet(Ot).maxRenderedOptions),this.showOptions(i.options,e.id));let n=this.updateSelectedOption(i.selected);if(n){this.destroyInfo();let{completion:r}=i.options[i.selected],{info:o}=r;if(!o)return;let a=typeof o=="string"?document.createTextNode(o):o(r);if(!a)return;"then"in a?a.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,r)}).catch(c=>ci(this.view.state,c,"completion info")):(this.addInfoPane(a,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,i){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:o}=e;n.appendChild(r),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let i=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!="LI"||!n.id?r--:r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),i=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return i&&nz(this.list,i),i}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let i=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),o=this.space;if(!o){let a=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return r.top>Math.min(o.bottom,i.bottom)-10||r.bottom<Math.max(o.top,i.top)+10?null:this.view.state.facet(Ot).positionInfo(this.view,i,r,n,o,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,i,n){const r=document.createElement("ul");r.id=i,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",a=>{a.target==r&&a.preventDefault()});let o=null;for(let a=n.from;a<n.to;a++){let{completion:c,match:h}=e[a],{section:d}=c;if(d){let b=typeof d=="string"?d:d.name;if(b!=o&&(a>n.from||n.from==0))if(o=b,typeof d!="string"&&d.header)r.appendChild(d.header(d));else{let x=r.appendChild(document.createElement("completion-section"));x.textContent=b}}const p=r.appendChild(document.createElement("li"));p.id=i+"-"+a,p.setAttribute("role","option");let y=this.optionClass(c);y&&(p.className=y);for(let b of this.optionContent){let x=b(c,this.view.state,this.view,h);x&&p.appendChild(x)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function iz(t,e){return i=>new tz(i,t,e)}function nz(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect(),r=i.height/t.offsetHeight;n.top<i.top?t.scrollTop-=(i.top-n.top)/r:n.bottom>i.bottom&&(t.scrollTop+=(n.bottom-i.bottom)/r)}function IS(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function rz(t,e){let i=[],n=null,r=null,o=p=>{i.push(p);let{section:y}=p.completion;if(y){n||(n=[]);let b=typeof y=="string"?y:y.name;n.some(x=>x.name==b)||n.push(typeof y=="string"?{name:b}:y)}},a=e.facet(Ot);for(let p of t)if(p.hasResult()){let y=p.result.getMatch;if(p.result.filter===!1)for(let b of p.result.options)o(new PS(b,p.source,y?y(b):[],1e9-i.length));else{let b=e.sliceDoc(p.from,p.to),x,w=a.filterStrict?new J8(b):new Z8(b);for(let C of p.result.options)if(x=w.match(C.label)){let k=C.displayLabel?y?y(C,x.matched):[]:x.matched,M=x.score+(C.boost||0);if(o(new PS(C,p.source,k,M)),typeof C.section=="object"&&C.section.rank==="dynamic"){let{name:O}=C.section;r||(r=Object.create(null)),r[O]=Math.max(M,r[O]||-1e9)}}}}if(n){let p=Object.create(null),y=0,b=(x,w)=>(x.rank==="dynamic"&&w.rank==="dynamic"?r[w.name]-r[x.name]:0)||(typeof x.rank=="number"?x.rank:1e9)-(typeof w.rank=="number"?w.rank:1e9)||(x.name<w.name?-1:1);for(let x of n.sort(b))y-=1e5,p[x.name]=y;for(let x of i){let{section:w}=x.completion;w&&(x.score+=p[typeof w=="string"?w:w.name])}}let c=[],h=null,d=a.compareCompletions;for(let p of i.sort((y,b)=>b.score-y.score||d(y.completion,b.completion))){let y=p.completion;!h||h.label!=y.label||h.detail!=y.detail||h.type!=null&&y.type!=null&&h.type!=y.type||h.apply!=y.apply||h.boost!=y.boost?c.push(p):IS(p.completion)>IS(h)&&(c[c.length-1]=p),h=p.completion}return c}class xl{constructor(e,i,n,r,o,a){this.options=e,this.attrs=i,this.tooltip=n,this.timestamp=r,this.selected=o,this.disabled=a}setSelected(e,i){return e==this.selected||e>=this.options.length?this:new xl(this.options,QS(i,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,i,n,r,o,a){if(r&&!a&&e.some(d=>d.isPending))return r.setDisabled();let c=rz(e,i);if(!c.length)return r&&e.some(d=>d.isPending)?r.setDisabled():null;let h=i.facet(Ot).selectOnOpen?0:-1;if(r&&r.selected!=h&&r.selected!=-1){let d=r.options[r.selected].completion;for(let p=0;p<c.length;p++)if(c[p].completion==d){h=p;break}}return new xl(c,QS(n,h),{pos:e.reduce((d,p)=>p.hasResult()?Math.min(d,p.from):d,1e8),create:cz,above:o.aboveCursor},r?r.timestamp:Date.now(),h,!1)}map(e){return new xl(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new xl(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Oh{constructor(e,i,n){this.active=e,this.id=i,this.open=n}static start(){return new Oh(az,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:i}=e,n=i.facet(Ot),o=(n.override||i.languageDataAt("autocomplete",bs(i)).map(X8)).map(h=>(this.active.find(p=>p.source==h)||new Fi(h,this.active.some(p=>p.state!=0)?1:0)).update(e,n));o.length==this.active.length&&o.every((h,d)=>h==this.active[d])&&(o=this.active);let a=this.open,c=e.effects.some(h=>h.is(x0));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||o.some(h=>h.hasResult()&&e.changes.touchesRange(h.from,h.to))||!sz(o,this.active)||c?a=xl.build(o,i,this.id,a,n,c):a&&a.disabled&&!o.some(h=>h.isPending)&&(a=null),!a&&o.every(h=>!h.isPending)&&o.some(h=>h.hasResult())&&(o=o.map(h=>h.hasResult()?new Fi(h.source,0):h));for(let h of e.effects)h.is(LA)&&(a=a&&a.setSelected(h.value,this.id));return o==this.active&&a==this.open?this:new Oh(o,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?lz:oz}}function sz(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i<t.length&&!t[i].hasResult();)i++;for(;n<e.length&&!e[n].hasResult();)n++;let r=i==t.length,o=n==e.length;if(r||o)return r==o;if(t[i++].result!=e[n++].result)return!1}}const lz={"aria-autocomplete":"list"},oz={};function QS(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const az=[];function jA(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(DA);if(n&&e.activateOnCompletion(n))return 12}let i=t.isUserEvent("input.type");return i&&e.activateOnTyping?5:i?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Fi{constructor(e,i,n=!1){this.source=e,this.state=i,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,i){let n=jA(e,i),r=this;(n&8||n&16&&this.touches(e))&&(r=new Fi(r.source,0)),n&4&&r.state==0&&(r=new Fi(this.source,1)),r=r.updateFor(e,n);for(let o of e.effects)if(o.is(Th))r=new Fi(r.source,1,o.value);else if(o.is(Oa))r=new Fi(r.source,0);else if(o.is(x0))for(let a of o.value)a.source==r.source&&(r=a);return r}updateFor(e,i){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(bs(e.state))}}class Ml extends Fi{constructor(e,i,n,r,o,a){super(e,3,i),this.limit=n,this.result=r,this.from=o,this.to=a}hasResult(){return!0}updateFor(e,i){var n;if(!(i&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),c=bs(e.state);if(c>a||!r||i&2&&(bs(e.startState)==this.from||c<this.limit))return new Fi(this.source,i&4?1:0);let h=e.changes.mapPos(this.limit);return uz(r.validFor,e.state,o,a)?new Ml(this.source,this.explicit,h,r,o,a):r.update&&(r=r.update(r,o,a,new NA(e.state,c,!1)))?new Ml(this.source,this.explicit,h,r,r.from,(n=r.to)!==null&&n!==void 0?n:bs(e.state)):new Fi(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Ml(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Fi(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function uz(t,e,i,n){if(!t)return!1;let r=e.sliceDoc(i,n);return typeof t=="function"?t(r,i,n,e):RA(t,!0).test(r)}const x0=Se.define({map(t,e){return t.map(i=>i.map(e))}}),LA=Se.define(),oi=It.define({create(){return Oh.start()},update(t,e){return t.update(e)},provide:t=>[r0.from(t,e=>e.tooltip),ie.contentAttributes.from(t,e=>e.attrs)]});function v0(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(oi).active.find(r=>r.source==e.source);return n instanceof Ml?(typeof i=="string"?t.dispatch({...W8(t.state,i,n.from,n.to),annotations:DA.of(e.completion)}):i(t,e.completion,n.from,n.to),!0):!1}const cz=iz(oi,v0);function Nc(t,e="option"){return i=>{let n=i.state.field(oi,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<i.state.facet(Ot).interactionDelay)return!1;let r=1,o;e=="page"&&(o=fk(i,n.open.tooltip))&&(r=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:a}=n.open.options,c=n.open.selected>-1?n.open.selected+r*(t?1:-1):t?0:a-1;return c<0?c=e=="page"?0:a-1:c>=a&&(c=e=="page"?a-1:0),i.dispatch({effects:LA.of(c)}),!0}}const hz=t=>{let e=t.state.field(oi,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Ot).interactionDelay?!1:v0(t,e.open.options[e.open.selected])},nm=t=>t.state.field(oi,!1)?(t.dispatch({effects:Th.of(!0)}),!0):!1,fz=t=>{let e=t.state.field(oi,!1);return!e||!e.active.some(i=>i.state!=0)?!1:(t.dispatch({effects:Oa.of(null)}),!0)};class dz{constructor(e,i){this.active=e,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0}}const pz=50,mz=1e3,gz=at.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(oi).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(oi),i=t.state.facet(Ot);if(!t.selectionSet&&!t.docChanged&&t.startState.field(oi)==e)return;let n=t.transactions.some(o=>{let a=jA(o,i);return a&8||(o.selection||o.docChanged)&&!(a&3)});for(let o=0;o<this.running.length;o++){let a=this.running[o];if(n||a.context.abortOnDocChange&&t.docChanged||a.updates.length+t.transactions.length>pz&&Date.now()-a.time>mz){for(let c of a.context.abortListeners)try{c()}catch(h){ci(this.view.state,h)}a.context.abortListeners=null,this.running.splice(o--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(o=>o.effects.some(a=>a.is(Th)))&&(this.pendingStart=!0);let r=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(a=>a.active.source==o.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let o of t.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(oi);for(let i of e.active)i.isPending&&!this.running.some(n=>n.active.source==i.source)&&this.startQuery(i);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ot).updateSyncTime))}startQuery(t){let{state:e}=this.view,i=bs(e),n=new NA(e,i,t.explicit,this.view),r=new dz(t,n);this.running.push(r),Promise.resolve(t.source(n)).then(o=>{r.context.aborted||(r.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:Oa.of(null)}),ci(this.view.state,o)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ot).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(Ot),n=this.view.state.field(oi);for(let r=0;r<this.running.length;r++){let o=this.running[r];if(o.done===void 0)continue;if(this.running.splice(r--,1),o.done){let c=bs(o.updates.length?o.updates[0].startState:this.view.state),h=Math.min(c,o.done.from+(o.active.explicit?0:1)),d=new Ml(o.active.source,o.active.explicit,h,o.done,o.done.from,(t=o.done.to)!==null&&t!==void 0?t:c);for(let p of o.updates)d=d.update(p,i);if(d.hasResult()){e.push(d);continue}}let a=n.active.find(c=>c.source==o.active.source);if(a&&a.isPending)if(o.done==null){let c=new Fi(o.active.source,0);for(let h of o.updates)c=c.update(h,i);c.isPending||e.push(c)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:x0.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(oi,!1);if(e&&e.tooltip&&this.view.state.facet(Ot).closeOnBlur){let i=e.open&&fk(this.view,e.open.tooltip);(!i||!i.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Oa.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Th.of(!1)}),20),this.composing=0}}}),yz=typeof navigator=="object"&&/Win/.test(navigator.platform),bz=As.highest(ie.domEventHandlers({keydown(t,e){let i=e.state.field(oi,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&!(yz&&t.altKey)||t.metaKey)return!1;let n=i.open.options[i.open.selected],r=i.active.find(a=>a.source==n.source),o=n.completion.commitCharacters||r.result.commitCharacters;return o&&o.indexOf(t.key)>-1&&v0(e,n),!1}})),xz=ie.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Ea={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ms=Se.define({map(t,e){let i=e.mapPos(t,-1,Zt.TrackAfter);return i??void 0}}),S0=new class extends Br{};S0.startSide=1;S0.endSide=-1;const BA=It.define({create(){return Ne.empty},update(t,e){if(t=t.map(e.changes),e.selection){let i=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:n=>n>=i.from&&n<=i.to})}for(let i of e.effects)i.is(ms)&&(t=t.update({add:[S0.range(i.value,i.value+1)]}));return t}});function vz(){return[wz,BA]}const rm="()[]{}<>«»»«[]{}";function zA(t){for(let e=0;e<rm.length;e+=2)if(rm.charCodeAt(e)==t)return rm.charAt(e+1);return Pg(t<128?t:t+1)}function _A(t,e){return t.languageDataAt("closeBrackets",e)[0]||Ea}const Sz=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),wz=ie.inputHandler.of((t,e,i,n)=>{if((Sz?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(n.length>2||n.length==2&&dn(li(n,0))==1||e!=r.from||i!=r.to)return!1;let o=Az(t.state,n);return o?(t.dispatch(o),!0):!1}),Cz=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=_A(t,t.selection.main.head).brackets||Ea.brackets,r=null,o=t.changeByRange(a=>{if(a.empty){let c=Mz(t.doc,a.head);for(let h of n)if(h==c&&Zh(t.doc,a.head)==zA(li(h,0)))return{changes:{from:a.head-h.length,to:a.head+h.length},range:W.cursor(a.head-h.length)}}return{range:r=a}});return r||e(t.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},kz=[{key:"Backspace",run:Cz}];function Az(t,e){let i=_A(t,t.selection.main.head),n=i.brackets||Ea.brackets;for(let r of n){let o=zA(li(r,0));if(e==r)return o==r?Ez(t,r,n.indexOf(r+r+r)>-1,i):Tz(t,r,o,i.before||Ea.before);if(e==o&&HA(t,t.selection.main.from))return Oz(t,r,o)}return null}function HA(t,e){let i=!1;return t.field(BA).between(0,t.doc.length,n=>{n==e&&(i=!0)}),i}function Zh(t,e){let i=t.sliceString(e,e+2);return i.slice(0,dn(li(i,0)))}function Mz(t,e){let i=t.sliceString(e-2,e);return dn(li(i,0))==i.length?i:i.slice(1)}function Tz(t,e,i,n){let r=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:i,from:a.to}],effects:ms.of(a.to+e.length),range:W.range(a.anchor+e.length,a.head+e.length)};let c=Zh(t.doc,a.head);return!c||/\s/.test(c)||n.indexOf(c)>-1?{changes:{insert:e+i,from:a.head},effects:ms.of(a.head+e.length),range:W.cursor(a.head+e.length)}:{range:r=a}});return r?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Oz(t,e,i){let n=null,r=t.changeByRange(o=>o.empty&&Zh(t.doc,o.head)==i?{changes:{from:o.head,to:o.head+i.length,insert:i},range:W.cursor(o.head+i.length)}:n={range:o});return n?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Ez(t,e,i,n){let r=n.stringPrefixes||Ea.stringPrefixes,o=null,a=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:ms.of(c.to+e.length),range:W.range(c.anchor+e.length,c.head+e.length)};let h=c.head,d=Zh(t.doc,h),p;if(d==e){if(YS(t,h))return{changes:{insert:e+e,from:h},effects:ms.of(h+e.length),range:W.cursor(h+e.length)};if(HA(t,h)){let b=i&&t.sliceDoc(h,h+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:h,to:h+b.length,insert:b},range:W.cursor(h+b.length)}}}else{if(i&&t.sliceDoc(h-2*e.length,h)==e+e&&(p=GS(t,h-2*e.length,r))>-1&&YS(t,p))return{changes:{insert:e+e+e+e,from:h},effects:ms.of(h+e.length),range:W.cursor(h+e.length)};if(t.charCategorizer(h)(d)!=nt.Word&&GS(t,h,r)>-1&&!Nz(t,h,e,r))return{changes:{insert:e+e,from:h},effects:ms.of(h+e.length),range:W.cursor(h+e.length)}}return{range:o=c}});return o?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function YS(t,e){let i=Ft(t).resolveInner(e+1);return i.parent&&i.from==e}function Nz(t,e,i,n){let r=Ft(t).resolveInner(e,-1),o=n.reduce((a,c)=>Math.max(a,c.length),0);for(let a=0;a<5;a++){let c=t.sliceDoc(r.from,Math.min(r.to,r.from+i.length+o)),h=c.indexOf(i);if(!h||h>-1&&n.indexOf(c.slice(0,h))>-1){let p=r.firstChild;for(;p&&p.from==r.from&&p.to-p.from>i.length+h;){if(t.sliceDoc(p.to-i.length,p.to)==i)return!1;p=p.firstChild}return!0}let d=r.to==e&&r.parent;if(!d)break;r=d}return!1}function GS(t,e,i){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=nt.Word)return e;for(let r of i){let o=e-r.length;if(t.sliceDoc(o,e)==r&&n(t.sliceDoc(o-1,o))!=nt.Word)return o}return-1}function Rz(t={}){return[bz,oi,Ot.of(t),gz,Dz,xz]}const UA=[{key:"Ctrl-Space",run:nm},{mac:"Alt-`",run:nm},{mac:"Alt-i",run:nm},{key:"Escape",run:fz},{key:"ArrowDown",run:Nc(!0)},{key:"ArrowUp",run:Nc(!1)},{key:"PageDown",run:Nc(!0,"page")},{key:"PageUp",run:Nc(!1,"page")},{key:"Enter",run:hz}],Dz=As.highest(Fh.computeN([Ot],t=>t.facet(Ot).defaultKeymap?[UA]:[]));class KS{constructor(e,i,n){this.from=e,this.to=i,this.diagnostic=n}}class hs{constructor(e,i,n){this.diagnostics=e,this.panel=i,this.selected=n}static init(e,i,n){let r=n.facet(Na).markerFilter;r&&(e=r(e,n));let o=e.slice().sort((x,w)=>x.from-w.from||x.to-w.to),a=new Kn,c=[],h=0,d=n.doc.iter(),p=0,y=n.doc.length;for(let x=0;;){let w=x==o.length?null:o[x];if(!w&&!c.length)break;let C,k;if(c.length)C=h,k=c.reduce((D,V)=>Math.min(D,V.to),w&&w.from>C?w.from:1e8);else{if(C=w.from,C>y)break;k=w.to,c.push(w),x++}for(;x<o.length;){let D=o[x];if(D.from==C&&(D.to>D.from||D.to==C))c.push(D),x++,k=Math.min(D.to,k);else{k=Math.min(D.from,k);break}}k=Math.min(k,y);let M=!1;if(c.some(D=>D.from==C&&(D.to==k||k==y))&&(M=C==k,!M&&k-C<10)){let D=C-(p+d.value.length);D>0&&(d.next(D),p=C);for(let V=C;;){if(V>=k){M=!0;break}if(!d.lineBreak&&p+d.value.length>V)break;V=p+d.value.length,p+=d.value.length,d.next()}}let O=Qz(c);if(M)a.add(C,C,ge.widget({widget:new Pz(O),diagnostics:c.slice()}));else{let D=c.reduce((V,H)=>H.markClass?V+" "+H.markClass:V,"");a.add(C,k,ge.mark({class:"cm-lintRange cm-lintRange-"+O+D,diagnostics:c.slice(),inclusiveEnd:c.some(V=>V.to>k)}))}if(h=k,h==y)break;for(let D=0;D<c.length;D++)c[D].to<=h&&c.splice(D--,1)}let b=a.finish();return new hs(b,i,Pr(b))}}function Pr(t,e=null,i=0){let n=null;return t.between(i,1e9,(r,o,{spec:a})=>{if(!(e&&a.diagnostics.indexOf(e)<0))if(!n)n=new KS(r,o,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new KS(n.from,o,n.diagnostic)}}),n}function jz(t,e){let i=e.pos,n=e.end||i,r=t.state.facet(Na).hideOn(t,i,n);if(r!=null)return r;let o=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(qA))||t.changes.touchesRange(o.from,Math.max(o.to,n)))}function Lz(t,e){return t.field(Mi,!1)?e:e.concat(Se.appendConfig.of(Yz))}const qA=Se.define(),w0=Se.define(),PA=Se.define(),Mi=It.define({create(){return new hs(ge.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let i=t.diagnostics.map(e.changes),n=null,r=t.panel;if(t.selected){let o=e.changes.mapPos(t.selected.from,1);n=Pr(i,t.selected.diagnostic,o)||Pr(i,null,o)}!i.size&&r&&e.state.facet(Na).autoPanel&&(r=null),t=new hs(i,r,n)}for(let i of e.effects)if(i.is(qA)){let n=e.state.facet(Na).autoPanel?i.value.length?Ra.open:null:t.panel;t=hs.init(i.value,n,e.state)}else i.is(w0)?t=new hs(t.diagnostics,i.value?Ra.open:null,t.selected):i.is(PA)&&(t=new hs(t.diagnostics,t.panel,i.value));return t},provide:t=>[Ca.from(t,e=>e.panel),ie.decorations.from(t,e=>e.diagnostics)]}),Bz=ge.mark({class:"cm-lintRange cm-lintRange-active"});function zz(t,e,i){let{diagnostics:n}=t.state.field(Mi),r,o=-1,a=-1;n.between(e-(i<0?1:0),e+(i>0?1:0),(h,d,{spec:p})=>{if(e>=h&&e<=d&&(h==d||(e>h||i>0)&&(e<d||i<0)))return r=p.diagnostics,o=h,a=d,!1});let c=t.state.facet(Na).tooltipFilter;return r&&c&&(r=c(r,t.state)),r?{pos:o,end:a,above:t.state.doc.lineAt(o).to<a,create(){return{dom:_z(t,r)}}}:null}function _z(t,e){return Ke("ul",{class:"cm-tooltip-lint"},e.map(i=>VA(t,i,!1)))}const Hz=t=>{let e=t.state.field(Mi,!1);(!e||!e.panel)&&t.dispatch({effects:Lz(t.state,[w0.of(!0)])});let i=s0(t,Ra.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},WS=t=>{let e=t.state.field(Mi,!1);return!e||!e.panel?!1:(t.dispatch({effects:w0.of(!1)}),!0)},Uz=t=>{let e=t.state.field(Mi,!1);if(!e)return!1;let i=t.state.selection.main,n=Pr(e.diagnostics,null,i.to+1);return!n&&(n=Pr(e.diagnostics,null,0),!n||n.from==i.from&&n.to==i.to)?!1:(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},qz=[{key:"Mod-Shift-m",run:Hz,preventDefault:!0},{key:"F8",run:Uz}],Na=le.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...wn(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:XS,tooltipFilter:XS,needsRefresh:(e,i)=>e?i?n=>e(n)||i(n):e:i,hideOn:(e,i)=>e?i?(n,r,o)=>e(n,r,o)||i(n,r,o):e:i,autoPanel:(e,i)=>e||i})}}});function XS(t,e){return t?e?(i,n)=>e(t(i,n),n):t:e}function FA(t){let e=[];if(t)e:for(let{name:i}of t){for(let n=0;n<i.length;n++){let r=i[n];if(/[a-zA-Z]/.test(r)&&!e.some(o=>o.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function VA(t,e,i){var n;let r=i?FA(e.actions):[];return Ke("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ke("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((o,a)=>{let c=!1,h=x=>{if(x.preventDefault(),c)return;c=!0;let w=Pr(t.state.field(Mi).diagnostics,e);w&&o.apply(t,w.from,w.to)},{name:d}=o,p=r[a]?d.indexOf(r[a]):-1,y=p<0?d:[d.slice(0,p),Ke("u",d.slice(p,p+1)),d.slice(p+1)],b=o.markClass?" "+o.markClass:"";return Ke("button",{type:"button",class:"cm-diagnosticAction"+b,onclick:h,onmousedown:h,"aria-label":` Action: ${d}${p<0?"":` (access key "${r[a]})"`}.`},y)}),e.source&&Ke("div",{class:"cm-diagnosticSource"},e.source))}class Pz extends Cn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Ke("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class ZS{constructor(e,i){this.diagnostic=i,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=VA(e,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ra{constructor(e){this.view=e,this.items=[];let i=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)WS(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],a=FA(o.actions);for(let c=0;c<a.length;c++)if(a[c].toUpperCase().charCodeAt(0)==r.keyCode){let h=Pr(this.view.state.field(Mi).diagnostics,o);h&&o.actions[c].apply(e,h.from,h.to)}}else return;r.preventDefault()}},n=r=>{for(let o=0;o<this.items.length;o++)this.items[o].dom.contains(r.target)&&this.moveSelection(o)};this.list=Ke("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:i,onclick:n}),this.dom=Ke("div",{class:"cm-panel-lint"},this.list,Ke("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>WS(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Mi).selected;if(!e)return-1;for(let i=0;i<this.items.length;i++)if(this.items[i].diagnostic==e.diagnostic)return i;return-1}update(){let{diagnostics:e,selected:i}=this.view.state.field(Mi),n=0,r=!1,o=null,a=new Set;for(e.between(0,this.view.state.doc.length,(c,h,{spec:d})=>{for(let p of d.diagnostics){if(a.has(p))continue;a.add(p);let y=-1,b;for(let x=n;x<this.items.length;x++)if(this.items[x].diagnostic==p){y=x;break}y<0?(b=new ZS(this.view,p),this.items.splice(n,0,b),r=!0):(b=this.items[y],y>n&&(this.items.splice(n,y-n),r=!0)),i&&b.diagnostic==i.diagnostic?b.dom.hasAttribute("aria-selected")||(b.dom.setAttribute("aria-selected","true"),o=b):b.dom.hasAttribute("aria-selected")&&b.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new ZS(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:h})=>{let d=h.height/this.list.offsetHeight;c.top<h.top?this.list.scrollTop-=(h.top-c.top)/d:c.bottom>h.bottom&&(this.list.scrollTop+=(c.bottom-h.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function i(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)i();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)i()}moveSelection(e){if(this.selectedIndex<0)return;let i=this.view.state.field(Mi),n=Pr(i.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:PA.of(n)})}static open(e){return new Ra(e)}}function Fz(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Rc(t){return Fz(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Vz=ie.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:Rc("#d11")},".cm-lintRange-warning":{backgroundImage:Rc("orange")},".cm-lintRange-info":{backgroundImage:Rc("#999")},".cm-lintRange-hint":{backgroundImage:Rc("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function Iz(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function Qz(t){let e="hint",i=1;for(let n of t){let r=Iz(n.severity);r>i&&(i=r,e=n.severity)}return e}const Yz=[Mi,ie.decorations.compute([Mi],t=>{let{selected:e,panel:i}=t.field(Mi);return!e||!i||e.from==e.to?ge.none:ge.set([Bz.range(e.from,e.to)])}),BL(zz,{hideOn:jz}),Vz];var JS=function(e){e===void 0&&(e={});var{crosshairCursor:i=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(kz)),e.defaultKeymap!==!1&&(n=n.concat(g8)),e.searchKeymap!==!1&&(n=n.concat(V8)),e.historyKeymap!==!1&&(n=n.concat(CB)),e.foldKeymap!==!1&&(n=n.concat(_6)),e.completionKeymap!==!1&&(n=n.concat(UA)),e.lintKeymap!==!1&&(n=n.concat(qz));var r=[];return e.lineNumbers!==!1&&r.push(KL()),e.highlightActiveLineGutter!==!1&&r.push(ZL()),e.highlightSpecialChars!==!1&&r.push(cL()),e.history!==!1&&r.push(pB()),e.foldGutter!==!1&&r.push(P6()),e.drawSelection!==!1&&r.push($j()),e.dropCursor!==!1&&r.push(rL()),e.allowMultipleSelections!==!1&&r.push(Le.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(T6()),e.syntaxHighlighting!==!1&&r.push(Hk(Q6,{fallback:!0})),e.bracketMatching!==!1&&r.push(J6()),e.closeBrackets!==!1&&r.push(vz()),e.autocompletion!==!1&&r.push(Rz()),e.rectangularSelection!==!1&&r.push(kL()),i!==!1&&r.push(TL()),e.highlightActiveLine!==!1&&r.push(gL()),e.highlightSelectionMatches!==!1&&r.push(w8()),e.tabSize&&typeof e.tabSize=="number"&&r.push(Ih.of(" ".repeat(e.tabSize))),r.concat([Fh.of(n.flat())]).filter(Boolean)};const Gz="#e5c07b",$S="#e06c75",Kz="#56b6c2",Wz="#ffffff",Vc="#abb2bf",xg="#7d8799",Xz="#61afef",Zz="#98c379",e2="#d19a66",Jz="#c678dd",$z="#21252b",t2="#2c313a",i2="#282c34",sm="#353a42",e9="#3E4451",n2="#528bff",t9=ie.theme({"&":{color:Vc,backgroundColor:i2},".cm-content":{caretColor:n2},".cm-cursor, .cm-dropCursor":{borderLeftColor:n2},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e9},".cm-panels":{backgroundColor:$z,color:Vc},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:i2,color:xg,border:"none"},".cm-activeLineGutter":{backgroundColor:t2},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:sm},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:sm,borderBottomColor:sm},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:t2,color:Vc}}},{dark:!0}),i9=qa.define([{tag:F.keyword,color:Jz},{tag:[F.name,F.deleted,F.character,F.propertyName,F.macroName],color:$S},{tag:[F.function(F.variableName),F.labelName],color:Xz},{tag:[F.color,F.constant(F.name),F.standard(F.name)],color:e2},{tag:[F.definition(F.name),F.separator],color:Vc},{tag:[F.typeName,F.className,F.number,F.changed,F.annotation,F.modifier,F.self,F.namespace],color:Gz},{tag:[F.operator,F.operatorKeyword,F.url,F.escape,F.regexp,F.link,F.special(F.string)],color:Kz},{tag:[F.meta,F.comment],color:xg},{tag:F.strong,fontWeight:"bold"},{tag:F.emphasis,fontStyle:"italic"},{tag:F.strikethrough,textDecoration:"line-through"},{tag:F.link,color:xg,textDecoration:"underline"},{tag:F.heading,fontWeight:"bold",color:$S},{tag:[F.atom,F.bool,F.special(F.variableName)],color:e2},{tag:[F.processingInstruction,F.string,F.inserted],color:Zz},{tag:F.invalid,color:Wz}]),n9=[t9,Hk(i9)];var r9=ie.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),s9=function(e){e===void 0&&(e={});var{indentWithTab:i=!0,editable:n=!0,readOnly:r=!1,theme:o="light",placeholder:a="",basicSetup:c=!0}=e,h=[];switch(i&&h.unshift(Fh.of([y8])),c&&(typeof c=="boolean"?h.unshift(JS()):h.unshift(JS(c))),a&&h.unshift(vL(a)),o){case"light":h.push(r9);break;case"dark":h.push(n9);break;case"none":break;default:h.push(o);break}return n===!1&&h.push(ie.editable.of(!1)),r&&h.push(Le.readOnly.of(!0)),[...h]},l9=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class o9{constructor(e,i){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=i,this.timeoutMS=i,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(i=>{try{i()}catch(n){console.error("TimeoutLatch callback error:",n)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class r2{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var lm=null,a9=()=>typeof window>"u"?new r2:(lm||(lm=new r2),lm),s2=Sn.define(),u9=200,c9=[];function h9(t){var{value:e,selection:i,onChange:n,onStatistics:r,onCreateEditor:o,onUpdate:a,extensions:c=c9,autoFocus:h,theme:d="light",height:p=null,minHeight:y=null,maxHeight:b=null,width:x=null,minWidth:w=null,maxWidth:C=null,placeholder:k="",editable:M=!0,readOnly:O=!1,indentWithTab:D=!0,basicSetup:V=!0,root:H,initialState:Y}=t,[U,J]=N.useState(),[Z,ce]=N.useState(),[oe,q]=N.useState(),ee=N.useState(()=>({current:null}))[0],fe=N.useState(()=>({current:null}))[0],de=ie.theme({"&":{height:p,minHeight:y,maxHeight:b,width:x,minWidth:w,maxWidth:C},"& .cm-scroller":{height:"100% !important"}}),_=ie.updateListener.of(ue=>{if(ue.docChanged&&typeof n=="function"&&!ue.transactions.some(I=>I.annotation(s2))){ee.current?ee.current.reset():(ee.current=new o9(()=>{if(fe.current){var I=fe.current;fe.current=null,I()}ee.current=null},u9),a9().add(ee.current));var ye=ue.state.doc,E=ye.toString();n(E,ue)}r&&r(l9(ue))}),X=s9({theme:d,editable:M,readOnly:O,placeholder:k,indentWithTab:D,basicSetup:V}),ne=[_,de,...X];return a&&typeof a=="function"&&ne.push(ie.updateListener.of(a)),ne=ne.concat(c),N.useLayoutEffect(()=>{if(U&&!oe){var ue={doc:e,selection:i,extensions:ne},ye=Y?Le.fromJSON(Y.json,ue,Y.fields):Le.create(ue);if(q(ye),!Z){var E=new ie({state:ye,parent:U,root:H});ce(E),o&&o(E,ye)}}return()=>{Z&&(q(void 0),ce(void 0))}},[U,oe]),N.useEffect(()=>{t.container&&J(t.container)},[t.container]),N.useEffect(()=>()=>{Z&&(Z.destroy(),ce(void 0)),ee.current&&(ee.current.cancel(),ee.current=null)},[Z]),N.useEffect(()=>{h&&Z&&Z.focus()},[h,Z]),N.useEffect(()=>{Z&&Z.dispatch({effects:Se.reconfigure.of(ne)})},[d,c,p,y,b,x,w,C,k,M,O,D,V,n,a]),N.useEffect(()=>{if(e!==void 0){var ue=Z?Z.state.doc.toString():"";if(Z&&e!==ue){var ye=ee.current&&!ee.current.isDone,E=()=>{Z&&e!==Z.state.doc.toString()&&Z.dispatch({changes:{from:0,to:Z.state.doc.toString().length,insert:e||""},annotations:[s2.of(!0)]})};ye?fe.current=E:E()}}},[e,Z]),{state:oe,setState:q,view:Z,setView:ce,container:U,setContainer:J}}var f9=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],IA=N.forwardRef((t,e)=>{var{className:i,value:n="",selection:r,extensions:o=[],onChange:a,onStatistics:c,onCreateEditor:h,onUpdate:d,autoFocus:p,theme:y="light",height:b,minHeight:x,maxHeight:w,width:C,minWidth:k,maxWidth:M,basicSetup:O,placeholder:D,indentWithTab:V,editable:H,readOnly:Y,root:U,initialState:J}=t,Z=U4(t,f9),ce=N.useRef(null),{state:oe,view:q,container:ee,setContainer:fe}=h9({root:U,value:n,autoFocus:p,theme:y,height:b,minHeight:x,maxHeight:w,width:C,minWidth:k,maxWidth:M,basicSetup:O,placeholder:D,indentWithTab:V,editable:H,readOnly:Y,selection:r,onChange:a,onStatistics:c,onCreateEditor:h,onUpdate:d,extensions:o,initialState:J});N.useImperativeHandle(e,()=>({editor:ce.current,state:oe,view:q}),[ce,ee,oe,q]);var de=N.useCallback(X=>{ce.current=X,fe(X)},[fe]);if(typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var _=typeof y=="string"?"cm-theme-"+y:"cm-theme";return S.jsx("div",Mm({ref:de,className:""+_+(i?" "+i:"")},Z))});IA.displayName="CodeMirror";var l2={};class Eh{constructor(e,i,n,r,o,a,c,h,d,p=0,y){this.p=e,this.stack=i,this.state=n,this.reducePos=r,this.pos=o,this.score=a,this.buffer=c,this.bufferBase=h,this.curContext=d,this.lookAhead=p,this.parent=y}toString(){return`[${this.stack.filter((e,i)=>i%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,i,n=0){let r=e.parser.context;return new Eh(e,[],i,n,n,0,[],0,r?new o2(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,i){this.stack.push(this.state,i,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var i;let n=e>>19,r=e&65535,{parser:o}=this.p,a=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),c=o.dynamicPrecedence(r);if(c&&(this.score+=c),n==0){this.pushState(o.getGoto(this.state,r,!0),this.reducePos),r<o.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(r,this.reducePos);return}let h=this.stack.length-(n-1)*3-(e&262144?6:0),d=h?this.stack[h-2]:this.p.ranges[0].from,p=this.reducePos-d;p>=2e3&&!(!((i=this.p.parser.nodeSet.types[r])===null||i===void 0)&&i.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let y=h?this.stack[h-1]:0,b=this.bufferBase+this.buffer.length-y;if(r<o.minRepeatTerm||e&131072){let x=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,d,x,b+4,!0)}if(e&262144)this.state=this.stack[h];else{let x=this.stack[h-3];this.state=o.getGoto(x,r,!0)}for(;this.stack.length>h;)this.stack.pop();this.reduceContext(r,d)}storeNode(e,i,n,r=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this,c=this.buffer.length;if(c==0&&a.parent&&(c=a.bufferBase-a.parent.bufferBase,a=a.parent),c>0&&a.buffer[c-4]==0&&a.buffer[c-1]>-1){if(i==n)return;if(a.buffer[c-2]>=i){a.buffer[c-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(e,i,n,r);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let c=!1;for(let h=a;h>0&&this.buffer[h-2]>n;h-=4)if(this.buffer[h-1]>=0){c=!0;break}if(c)for(;a>0&&this.buffer[a-2]>n;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,r>4&&(r-=4)}this.buffer[a]=e,this.buffer[a+1]=i,this.buffer[a+2]=n,this.buffer[a+3]=r}}shift(e,i,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:a}=this.p;this.pos=r;let c=a.stateFlag(o,1);!c&&(r>n||i<=a.maxNode)&&(this.reducePos=r),this.pushState(o,c?n:Math.min(n,this.reducePos)),this.shiftContext(i,n),i<=a.maxNode&&this.buffer.push(i,n,r,4)}else this.pos=r,this.shiftContext(i,n),i<=this.p.parser.maxNode&&this.buffer.push(i,n,r,4)}apply(e,i,n,r){e&65536?this.reduce(e):this.shift(e,i,n,r)}useNode(e,i){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(i,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,i=e.buffer.length;for(;i>0&&e.buffer[i-2]>e.reducePos;)i-=4;let n=e.buffer.slice(i),r=e.bufferBase+i;for(;e&&r==e.bufferBase;)e=e.parent;return new Eh(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,i){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,i,4),this.storeNode(0,this.pos,i,n?8:4),this.pos=this.reducePos=i,this.score-=190}canShift(e){for(let i=new d9(this);;){let n=this.p.parser.stateSlot(i.state,4)||this.p.parser.hasAction(i.state,e);if(n==0)return!1;if((n&65536)==0)return!0;i.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let i=this.p.parser.nextStates(this.state);if(i.length>8||this.stack.length>=120){let r=[];for(let o=0,a;o<i.length;o+=2)(a=i[o+1])!=this.state&&this.p.parser.hasAction(a,e)&&r.push(i[o],a);if(this.stack.length<120)for(let o=0;r.length<8&&o<i.length;o+=2){let a=i[o+1];r.some((c,h)=>h&1&&c==a)||r.push(i[o],a)}i=r}let n=[];for(let r=0;r<i.length&&n.length<4;r+=2){let o=i[r+1];if(o==this.state)continue;let a=this.split();a.pushState(o,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(i[r],this.pos),a.reducePos=this.pos,a.score-=200,n.push(a)}return n}forceReduce(){let{parser:e}=this.p,i=e.stateSlot(this.state,5);if((i&65536)==0)return!1;if(!e.validAction(this.state,i)){let n=i>>19,r=i&65535,o=this.stack.length-n*3;if(o<0||e.getGoto(this.stack[o],r,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;i=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(i),!0}findForcedReduction(){let{parser:e}=this.p,i=[],n=(r,o)=>{if(!i.includes(r))return i.push(r),e.allActions(r,a=>{if(!(a&393216))if(a&65536){let c=(a>>19)-o;if(c>1){let h=a&65535,d=this.stack.length-c*3;if(d>=0&&e.getGoto(this.stack[d],h,!1)>=0)return c<<19|65536|h}}else{let c=n(a,o+1);if(c!=null)return c}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let i=0;i<this.stack.length;i+=3)if(this.stack[i]!=e.stack[i])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(i)))}reduceContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(i)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let i=new o2(this.curContext.tracker,e);i.hash!=this.curContext.hash&&this.emitContext(),this.curContext=i}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class o2{constructor(e,i){this.tracker=e,this.context=i,this.hash=e.strict?e.hash(i):0}}class d9{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let i=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],i,!0);this.state=r}}class Nh{constructor(e,i,n){this.stack=e,this.pos=i,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,i=e.bufferBase+e.buffer.length){return new Nh(e,i,i-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Nh(this.stack,this.pos,this.index)}}function Dc(t,e=Uint16Array){if(typeof t!="string")return t;let i=null;for(let n=0,r=0;n<t.length;){let o=0;for(;;){let a=t.charCodeAt(n++),c=!1;if(a==126){o=65535;break}a>=92&&a--,a>=34&&a--;let h=a-32;if(h>=46&&(h-=46,c=!0),o+=h,c)break;o*=46}i?i[r++]=o:i=new e(o)}return i}class Ic{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const a2=new Ic;class p9{constructor(e,i){this.input=e,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=a2,this.rangeIndex=0,this.pos=this.chunkPos=i[0].from,this.range=i[0],this.end=i[i.length-1].to,this.readNext()}resolveOffset(e,i){let n=this.range,r=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!r)return null;let a=this.ranges[--r];o-=n.from-a.to,n=a}for(;i<0?o>n.to:o>=n.to;){if(r==this.ranges.length-1)return null;let a=this.ranges[++r];o+=a.from-n.to,n=a}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let i of this.ranges)if(i.to>e)return Math.max(e,i.from);return this.end}peek(e){let i=this.chunkOff+e,n,r;if(i>=0&&i<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(i);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(n=o,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let a=this.rangeIndex,c=this.range;for(;c.to<=n;)c=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>c.to&&(this.chunk2=this.chunk2.slice(0,c.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,i=0){let n=i?this.resolveOffset(i,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,i){this.token.value=e,this.token.end=i}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:i}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=i,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),i=this.pos+e.length;this.chunk=i>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,i){if(i?(this.token=i,i.start=e,i.lookAhead=e+1,i.value=i.extended=-1):this.token=a2,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,i){if(e>=this.chunkPos&&i<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,i-this.chunkPos);if(e>=this.chunk2Pos&&i<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,i-this.chunk2Pos);if(e>=this.range.from&&i<=this.range.to)return this.input.read(e,i);let n="";for(let r of this.ranges){if(r.from>=i)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,i)))}return n}}class Tl{constructor(e,i){this.data=e,this.id=i}token(e,i){let{parser:n}=i.p;m9(this.data,e,i,this.id,n.data,n.tokenPrecTable)}}Tl.prototype.contextual=Tl.prototype.fallback=Tl.prototype.extend=!1;Tl.prototype.fallback=Tl.prototype.extend=!1;function m9(t,e,i,n,r,o){let a=0,c=1<<n,{dialect:h}=i.p.parser;e:for(;(c&t[a])!=0;){let d=t[a+1];for(let x=a+3;x<d;x+=2)if((t[x+1]&c)>0){let w=t[x];if(h.allows(w)&&(e.token.value==-1||e.token.value==w||g9(w,e.token.value,r,o))){e.acceptToken(w);break}}let p=e.next,y=0,b=t[a+2];if(e.next<0&&b>y&&t[d+b*3-3]==65535){a=t[d+b*3-1];continue e}for(;y<b;){let x=y+b>>1,w=d+x+(x<<1),C=t[w],k=t[w+1]||65536;if(p<C)b=x;else if(p>=k)y=x+1;else{a=t[w+2],e.advance();continue e}}break}}function u2(t,e,i){for(let n=e,r;(r=t[n])!=65535;n++)if(r==i)return n-e;return-1}function g9(t,e,i,n){let r=u2(i,n,e);return r<0||u2(i,n,t)<r}const ki=typeof process<"u"&&l2&&/\bparse\b/.test(l2.LOG);let om=null;function c2(t,e,i){let n=t.cursor(ot.IncludeAnonymous);for(n.moveTo(e);;)if(!(i<0?n.childBefore(e):n.childAfter(e)))for(;;){if((i<0?n.to<e:n.from>e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}class y9{constructor(e,i){this.fragments=e,this.nodeSet=i,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?c2(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?c2(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let i=this.trees.length-1;if(i<0)return this.nextFragment(),null;let n=this.trees[i],r=this.index[i];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[r],a=this.start[i]+n.positions[r];if(a>e)return this.nextStart=a,null;if(o instanceof dt){if(a==e){if(a<this.safeFrom)return null;let c=a+o.length;if(c<=this.safeTo){let h=o.prop(Te.lookAhead);if(!h||c+h<this.fragment.to)return o}}this.index[i]++,a+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[i]++,this.nextStart=a+o.length}}}class b9{constructor(e,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Ic)}getActions(e){let i=0,n=null,{parser:r}=e.p,{tokenizers:o}=r,a=r.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,h=0;for(let d=0;d<o.length;d++){if((1<<d&a)==0)continue;let p=o[d],y=this.tokens[d];if(!(n&&!p.fallback)&&((p.contextual||y.start!=e.pos||y.mask!=a||y.context!=c)&&(this.updateCachedToken(y,p,e),y.mask=a,y.context=c),y.lookAhead>y.end+25&&(h=Math.max(y.lookAhead,h)),y.value!=0)){let b=i;if(y.extended>-1&&(i=this.addActions(e,y.extended,y.end,i)),i=this.addActions(e,y.value,y.end,i),!p.extend&&(n=y,i>b))break}}for(;this.actions.length>i;)this.actions.pop();return h&&e.setLookAhead(h),!n&&e.pos==this.stream.end&&(n=new Ic,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,i=this.addActions(e,n.value,n.end,i)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let i=new Ic,{pos:n,p:r}=e;return i.start=n,i.end=Math.min(n+1,r.stream.end),i.value=n==r.stream.end?r.parser.eofTerm:0,i}updateCachedToken(e,i,n){let r=this.stream.clipPos(n.pos);if(i.token(this.stream.reset(r,e),n),e.value>-1){let{parser:o}=n.p;for(let a=0;a<o.specialized.length;a++)if(o.specialized[a]==e.value){let c=o.specializers[a](this.stream.read(e.start,e.end),n);if(c>=0&&n.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,i,n,r){for(let o=0;o<r;o+=3)if(this.actions[o]==e)return r;return this.actions[r++]=e,this.actions[r++]=i,this.actions[r++]=n,r}addActions(e,i,n,r){let{state:o}=e,{parser:a}=e.p,{data:c}=a;for(let h=0;h<2;h++)for(let d=a.stateSlot(o,h?2:1);;d+=3){if(c[d]==65535)if(c[d+1]==1)d=Vn(c,d+2);else{r==0&&c[d+1]==2&&(r=this.putAction(Vn(c,d+2),i,n,r));break}c[d]==i&&(r=this.putAction(Vn(c,d+1),i,n,r))}return r}}class x9{constructor(e,i,n,r){this.parser=e,this.input=i,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new p9(i,r),this.tokens=new b9(e,this.stream),this.topTerm=e.top[1];let{from:o}=r[0];this.stacks=[Eh.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new y9(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,i=this.minStackPos,n=this.stacks=[],r,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let c=e[a];for(;;){if(this.tokens.mainToken=null,c.pos>i)n.push(c);else{if(this.advanceStack(c,n,e))continue;{r||(r=[],o=[]),r.push(c);let h=this.tokens.getMainToken(c);o.push(h.value,h.end)}}break}}if(!n.length){let a=r&&S9(r);if(a)return ki&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw ki&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&r){let a=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,o,n);if(a)return ki&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(n.length>a)for(n.sort((c,h)=>h.score-c.score);n.length>a;)n.pop();n.some(c=>c.reducePos>i)&&this.recovering--}else if(n.length>1){e:for(let a=0;a<n.length-1;a++){let c=n[a];for(let h=a+1;h<n.length;h++){let d=n[h];if(c.sameState(d)||c.buffer.length>500&&d.buffer.length>500)if((c.score-d.score||c.buffer.length-d.buffer.length)>0)n.splice(h--,1);else{n.splice(a--,1);continue e}}}n.length>12&&(n.sort((a,c)=>c.score-a.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let a=1;a<n.length;a++)n[a].pos<this.minStackPos&&(this.minStackPos=n[a].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,i,n){let r=e.pos,{parser:o}=this,a=ki?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,p=d?e.curContext.hash:0;for(let y=this.fragments.nodeAt(r);y;){let b=this.parser.nodeSet.types[y.type.id]==y.type?o.getGoto(e.state,y.type.id):-1;if(b>-1&&y.length&&(!d||(y.prop(Te.contextHash)||0)==p))return e.useNode(y,b),ki&&console.log(a+this.stackID(e)+` (via reuse of ${o.getName(y.type.id)})`),!0;if(!(y instanceof dt)||y.children.length==0||y.positions[0]>0)break;let x=y.children[0];if(x instanceof dt&&y.positions[0]==0)y=x;else break}}let c=o.stateSlot(e.state,4);if(c>0)return e.reduce(c),ki&&console.log(a+this.stackID(e)+` (via always-reduce ${o.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let h=this.tokens.getActions(e);for(let d=0;d<h.length;){let p=h[d++],y=h[d++],b=h[d++],x=d==h.length||!n,w=x?e:e.split(),C=this.tokens.mainToken;if(w.apply(p,y,C?C.start:w.pos,b),ki&&console.log(a+this.stackID(w)+` (via ${(p&65536)==0?"shift":`reduce of ${o.getName(p&65535)}`} for ${o.getName(y)} @ ${r}${w==e?"":", split"})`),x)return!0;w.pos>r?i.push(w):n.push(w)}return!1}advanceFully(e,i){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return h2(e,i),!0}}runRecovery(e,i,n){let r=null,o=!1;for(let a=0;a<e.length;a++){let c=e[a],h=i[a<<1],d=i[(a<<1)+1],p=ki?this.stackID(c)+" -> ":"";if(c.deadEnd&&(o||(o=!0,c.restart(),ki&&console.log(p+this.stackID(c)+" (restarted)"),this.advanceFully(c,n))))continue;let y=c.split(),b=p;for(let x=0;x<10&&y.forceReduce()&&(ki&&console.log(b+this.stackID(y)+" (via force-reduce)"),!this.advanceFully(y,n));x++)ki&&(b=this.stackID(y)+" -> ");for(let x of c.recoverByInsert(h))ki&&console.log(p+this.stackID(x)+" (via recover-insert)"),this.advanceFully(x,n);this.stream.end>c.pos?(d==c.pos&&(d++,h=0),c.recoverByDelete(h,d),ki&&console.log(p+this.stackID(c)+` (via recover-delete ${this.parser.getName(h)})`),h2(c,n)):(!r||r.score<y.score)&&(r=y)}return r}stackToTree(e){return e.close(),dt.build({buffer:Nh.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let i=(om||(om=new WeakMap)).get(e);return i||om.set(e,i=String.fromCodePoint(this.nextStackID++)),i+e}}function h2(t,e){for(let i=0;i<e.length;i++){let n=e[i];if(n.pos==t.pos&&n.sameState(t)){e[i].score<t.score&&(e[i]=t);return}}e.push(t)}class v9{constructor(e,i,n){this.source=e,this.flags=i,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class Rh extends wk{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let i=e.nodeNames.split(" ");this.minRepeatTerm=i.length;for(let c=0;c<e.repeatNodeCount;c++)i.push("");let n=Object.keys(e.topRules).map(c=>e.topRules[c][1]),r=[];for(let c=0;c<i.length;c++)r.push([]);function o(c,h,d){r[c].push([h,h.deserialize(String(d))])}if(e.nodeProps)for(let c of e.nodeProps){let h=c[0];typeof h=="string"&&(h=Te[h]);for(let d=1;d<c.length;){let p=c[d++];if(p>=0)o(p,h,c[d++]);else{let y=c[d+-p];for(let b=-p;b>0;b--)o(c[d++],h,y);d++}}}this.nodeSet=new l0(i.map((c,h)=>fi.define({name:h>=this.minRepeatTerm?void 0:c,id:h,props:r[h],top:n.indexOf(h)>-1,error:h==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(h)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=bk;let a=Dc(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;c<this.specializerSpecs.length;c++)this.specialized[c]=this.specializerSpecs[c].term;this.specializers=this.specializerSpecs.map(f2),this.states=Dc(e.states,Uint32Array),this.data=Dc(e.stateData),this.goto=Dc(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(c=>typeof c=="number"?new Tl(a,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,i,n){let r=new x9(this,e,i,n);for(let o of this.wrappers)r=o(r,e,i,n);return r}getGoto(e,i,n=!1){let r=this.goto;if(i>=r[0])return-1;for(let o=r[i+1];;){let a=r[o++],c=a&1,h=r[o++];if(c&&n)return h;for(let d=o+(a>>1);o<d;o++)if(r[o]==e)return h;if(c)return-1}}hasAction(e,i){let n=this.data;for(let r=0;r<2;r++)for(let o=this.stateSlot(e,r?2:1),a;;o+=3){if((a=n[o])==65535)if(n[o+1]==1)a=n[o=Vn(n,o+2)];else{if(n[o+1]==2)return Vn(n,o+2);break}if(a==i||a==0)return Vn(n,o+1)}return 0}stateSlot(e,i){return this.states[e*6+i]}stateFlag(e,i){return(this.stateSlot(e,0)&i)>0}validAction(e,i){return!!this.allActions(e,n=>n==i?!0:null)}allActions(e,i){let n=this.stateSlot(e,4),r=n?i(n):void 0;for(let o=this.stateSlot(e,1);r==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Vn(this.data,o+2);else break;r=i(Vn(this.data,o+1))}return r}nextStates(e){let i=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Vn(this.data,n+2);else break;if((this.data[n+2]&1)==0){let r=this.data[n+1];i.some((o,a)=>a&1&&o==r)||i.push(this.data[n],r)}}return i}configure(e){let i=Object.assign(Object.create(Rh.prototype),this);if(e.props&&(i.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);i.top=n}return e.tokenizers&&(i.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(o=>o.from==n);return r?r.to:n})),e.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((n,r)=>{let o=e.specializers.find(c=>c.from==n.external);if(!o)return n;let a=Object.assign(Object.assign({},n),{external:o.to});return i.specializers[r]=f2(a),a})),e.contextTracker&&(i.context=e.contextTracker),e.dialect&&(i.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(i.strict=e.strict),e.wrap&&(i.wrappers=i.wrappers.concat(e.wrap)),e.bufferLength!=null&&(i.bufferLength=e.bufferLength),i}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let i=this.dynamicPrecedences;return i==null?0:i[e]||0}parseDialect(e){let i=Object.keys(this.dialects),n=i.map(()=>!1);if(e)for(let o of e.split(" ")){let a=i.indexOf(o);a>=0&&(n[a]=!0)}let r=null;for(let o=0;o<i.length;o++)if(!n[o])for(let a=this.dialects[i[o]],c;(c=this.data[a++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[c]=1;return new v9(e,n,r)}static deserialize(e){return new Rh(e)}}function Vn(t,e){return t[e]|t[e+1]<<16}function S9(t){let e=null;for(let i of t){let n=i.p.stoppedAt;(i.pos==i.p.stream.end||n!=null&&i.pos>n)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.score<i.score)&&(e=i)}return e}function f2(t){if(t.external){let e=t.extend?1:0;return(i,n)=>t.external(i,n)<<1|e}return t.get}const w9=Ck({String:F.string,Number:F.number,"True False":F.bool,PropertyName:F.propertyName,Null:F.null,", :":F.separator,"[ ]":F.squareBracket,"{ }":F.brace}),C9=Rh.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[w9],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),k9=gh.define({name:"json",parser:C9.configure({props:[Tk.add({Object:wS({except:/^\s*\}/}),Array:wS({except:/^\s*\]/})}),Ek.add({"Object Array":E6})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function A9(){return new y6(k9)}const am=[200,201,204,400,401,403,404,500,502,503];function M9({mock:t,specResponses:e,onChange:i}){const[n,r]=N.useState(t.statusCode),[o,a]=N.useState(t.body),[c,h]=N.useState(Object.entries(t.headers).map(([x,w])=>`${x}: ${w}`).join(`
54
+ `)),[d,p]=N.useState(am.includes(t.statusCode)?"preset":"manual");N.useEffect(()=>{r(t.statusCode),a(t.body),h(Object.entries(t.headers).map(([x,w])=>`${x}: ${w}`).join(`
55
+ `)),am.includes(t.statusCode)||p("manual")},[t.statusCode,t.body,t.headers]);const y=N.useCallback(()=>{const x={};for(const w of c.split(`
56
+ `)){const C=w.indexOf(":");C>0&&(x[w.slice(0,C).trim()]=w.slice(C+1).trim())}i({statusCode:n,headers:x,body:o})},[n,c,o,i]),b=x=>{r(x.statusCode),p("manual");const w=x.headers||{"content-type":"application/json"};h(Object.entries(w).map(([C,k])=>`${C}: ${k}`).join(`
57
+ `)),a(x.body||""),i({statusCode:x.statusCode,headers:w,body:x.body||""})};return S.jsxs("div",{className:"flex flex-col gap-6 p-2 bg-background",children:[e&&e.length>0&&S.jsxs("div",{className:"space-y-3",children:[S.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest px-1",children:[S.jsx(G2,{className:"w-3.5 h-3.5 text-primary"}),"Spec Defined Responses"]}),S.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:e.map((x,w)=>S.jsxs("button",{onClick:()=>b(x),className:"flex items-start gap-3 p-3 text-left rounded-xl border border-border bg-card hover:border-primary/40 hover:bg-primary/5 transition-all group",children:[S.jsx("span",{className:Be("px-1.5 py-0.5 text-[10px] font-black font-mono rounded border shrink-0",x.statusCode<300?"text-emerald-400 border-emerald-400/30":x.statusCode<500?"text-amber-400 border-amber-400/30":"text-rose-400 border-rose-400/30"),children:x.statusCode}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-[11px] font-bold text-foreground truncate group-hover:text-primary transition-colors",children:x.name}),x.description&&x.description!==x.name&&S.jsx("p",{className:"text-[9px] text-muted-foreground line-clamp-1 mt-0.5",children:x.description})]})]},w))})]}),S.jsxs("div",{className:"space-y-3",children:[S.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest px-1",children:[S.jsx(Xc,{className:"w-3.5 h-3.5"}),"Status Code"]}),S.jsxs("div",{className:"flex flex-wrap gap-2",children:[am.map(x=>S.jsx("button",{onClick:()=>{r(x),p("preset");const w={};for(const C of c.split(`
58
+ `)){const k=C.indexOf(":");k>0&&(w[C.slice(0,k).trim()]=C.slice(k+1).trim())}i({statusCode:x,headers:w,body:o})},className:Be("px-2.5 py-1.5 text-xs font-mono font-bold rounded-lg border transition-colors duration-75",d==="preset"&&n===x?"bg-mode-mock/20 border-mode-mock text-mode-mock shadow-sm":"bg-muted border-border text-muted-foreground hover:border-mode-mock/40 hover:text-foreground"),children:x},x)),S.jsx("input",{type:"number",value:n,onChange:x=>{r(Number(x.target.value)),p("manual")},onFocus:()=>p("manual"),onBlur:y,className:Be("w-16 px-2.5 py-1.5 text-xs font-mono font-bold bg-background border rounded-lg focus:ring-1 focus:ring-mode-mock focus:border-mode-mock outline-none transition-colors duration-75",d==="manual"?"bg-mode-mock/20 border-mode-mock text-mode-mock shadow-sm":"border-border text-muted-foreground hover:border-mode-mock/20")})]})]}),S.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[S.jsxs("div",{className:"space-y-3",children:[S.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest px-1",children:[S.jsx(Zc,{className:"w-3.5 h-3.5"}),"Headers"]}),S.jsx("textarea",{value:c,onChange:x=>h(x.target.value),onBlur:y,rows:6,className:"w-full text-[11px] font-mono rounded-xl border border-border bg-background px-4 py-3 focus:outline-none focus:ring-1 focus:ring-mode-mock resize-none shadow-inner leading-relaxed",placeholder:"content-type: application/json"})]}),S.jsxs("div",{className:"space-y-3",children:[S.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest px-1",children:[S.jsx(Kc,{className:"w-3.5 h-3.5"}),"Body"]}),S.jsx("div",{className:"rounded-xl border border-border bg-background overflow-hidden shadow-inner focus-within:ring-1 focus-within:ring-mode-mock",children:S.jsx(IA,{value:o,onChange:a,onBlur:y,extensions:[A9()],height:"150px",theme:"dark",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},className:"text-[11px] font-mono"})})]})]})]})}const T9={passthrough:"border-mode-passthrough/20",delay:"border-mode-delay/20",mock:"border-mode-mock/20"},O9={passthrough:"bg-mode-passthrough",delay:"bg-mode-delay",mock:"bg-mode-mock"};function E9({endpoint:t,specName:e,showSpecBadge:i}){const[n,r]=N.useState(!1),o=L4(),a=c=>{const h={mode:c};c==="delay"&&!t.delay&&(h.delay={ms:1e3}),c==="mock"&&!t.mock&&(h.mock={statusCode:200,headers:{"content-type":"application/json"},body:"{}"}),o.mutate({id:t.id,config:h}),c!=="passthrough"&&r(!0)};return S.jsxs("div",{className:Be("group relative border sm:rounded-xl card-slab overflow-hidden mb-1 shadow-sm",T9[t.mode]),children:[S.jsx("div",{className:Be("absolute left-0 top-0 bottom-0 w-[2px] transition-all duration-75",O9[t.mode])}),S.jsxs("div",{className:"flex items-center gap-4 px-4 py-2.5 cursor-pointer select-none hover:bg-primary/5 transition-colors duration-75",onClick:()=>r(!n),children:[S.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[S.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[S.jsx("button",{className:"text-muted-foreground/40 group-hover:text-primary transition-colors duration-75",children:n?S.jsx(La,{className:"w-4 h-4"}):S.jsx(V2,{className:"w-4 h-4"})}),S.jsx(qg,{method:t.method})]}),S.jsxs("div",{className:"flex flex-col min-w-0",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-sm font-black font-mono tracking-tight text-foreground/90 truncate",children:t.path}),i&&e&&S.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-black uppercase tracking-widest rounded-[4px] bg-accent text-accent-foreground border border-border",children:e})]}),t.summary&&S.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-medium truncate mt-0.5",children:t.summary})]})]}),S.jsxs("div",{className:"flex items-center gap-4 shrink-0",onClick:c=>c.stopPropagation(),children:[S.jsxs("div",{className:"flex items-center gap-2",children:[t.mode==="delay"&&t.delay&&S.jsxs("span",{className:"px-2 py-0.5 text-[10px] font-black font-mono rounded bg-mode-delay/10 text-mode-delay border border-mode-delay/20 shadow-sm",children:[t.delay.ms,"ms"]}),t.mode==="mock"&&t.mock&&S.jsx("span",{className:Be("px-2 py-0.5 text-[10px] font-black font-mono rounded border shadow-sm",t.mock.statusCode<300?"bg-emerald-400/10 text-emerald-400 border-emerald-400/20":t.mock.statusCode<500?"bg-amber-400/10 text-amber-400 border-amber-400/20":"bg-rose-400/10 text-rose-400 border-rose-400/20"),children:t.mock.statusCode})]}),S.jsx(_4,{value:t.mode,onChange:a})]})]}),n&&S.jsx("div",{className:Be("px-5 pb-5 pt-0","border-t border-border/20 mx-4"),children:S.jsxs("div",{className:"pt-5 space-y-4",children:[t.mode==="delay"&&S.jsxs("div",{className:"space-y-2",children:[S.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-mode-delay uppercase tracking-widest px-1",children:[S.jsx(Xc,{className:"w-3 h-3"}),"Configuration"]}),S.jsx("div",{className:"bg-muted rounded-xl p-4 border border-border",children:S.jsx(H4,{delay:t.delay??{ms:1e3},onChange:c=>o.mutate({id:t.id,config:{delay:c}})})})]}),t.mode==="mock"&&S.jsxs("div",{className:"space-y-2",children:[S.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-mode-mock uppercase tracking-widest px-1",children:[S.jsx(Xc,{className:"w-3 h-3"}),"Mock Response"]}),S.jsx("div",{className:"bg-muted rounded-xl border border-border overflow-hidden",children:S.jsx(M9,{mock:t.mock??{statusCode:200,headers:{},body:"{}"},specResponses:t.responses,onChange:c=>o.mutate({id:t.id,config:{mock:c}})})})]}),t.mode==="passthrough"&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-6 text-center space-y-2",children:[S.jsx("div",{className:"w-10 h-10 rounded-full bg-mode-passthrough/5 flex items-center justify-center border border-border",children:S.jsx(xm,{className:"w-5 h-5 text-mode-passthrough opacity-40"})}),S.jsxs("div",{className:"max-w-[300px]",children:[S.jsx("p",{className:"text-xs font-semibold text-foreground/80",children:"Passthrough Mode Active"}),S.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed mt-1",children:"Requests will be forwarded directly to the upstream server without modification."})]})]})]})})]})}function N9(){const{data:t,isLoading:e}=Gw(),{data:i,isLoading:n}=Iw(),r=Kw(),[o,a]=N.useState(""),[c,h]=N.useState(new Set),d=N.useMemo(()=>{const C=new Map;for(const k of i??[])C.set(k.id,k);return C},[i]),p=N.useMemo(()=>new Set(i?.filter(C=>C.active).map(C=>C.id)??[]),[i]),y=N.useMemo(()=>{if(!t)return new Map;let C=t.filter(M=>p.has(M.specId));if(o){const M=o.toLowerCase();C=C.filter(O=>O.path.toLowerCase().includes(M)||O.method.toLowerCase().includes(M)||O.operationId?.toLowerCase().includes(M)||O.summary?.toLowerCase().includes(M))}const k=new Map;for(const M of C){const O=M.tags[0]??"Untagged";k.has(O)||k.set(O,[]),k.get(O).push(M)}return k},[t,o,p]),b=C=>{h(k=>{const M=new Set(k);return M.has(C)?M.delete(C):M.add(C),M})},x=(C,k)=>{const M={};C.forEach(O=>{const D={mode:k};k==="delay"&&!O.delay&&(D.delay={ms:1e3}),k==="mock"&&!O.mock&&(D.mock={statusCode:200,headers:{"content-type":"application/json"},body:"{}"}),M[O.id]=D}),r.mutate(M)};return e||n?S.jsxs("div",{className:"flex flex-col items-center justify-center h-80 gap-4",children:[S.jsx(Jc,{className:"w-10 h-10 animate-spin text-primary/40"}),S.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Indexing endpoints..."})]}):!t?.length||p.size===0?S.jsxs("div",{className:"flex flex-col items-center justify-center h-80 text-center space-y-4 px-6",children:[S.jsx("div",{className:"w-16 h-16 rounded-3xl bg-muted border border-border/40 flex items-center justify-center text-muted-foreground opacity-20",children:S.jsx(Xc,{className:"w-8 h-8"})}),S.jsxs("div",{className:"max-w-xs",children:[S.jsx("h3",{className:"text-sm font-black text-foreground uppercase tracking-tight",children:p.size===0?"No Active Specifications":"No endpoints detected"}),S.jsx("p",{className:"text-[11px] text-muted-foreground font-medium mt-1 leading-relaxed",children:p.size===0?"Select or import a specification from the header to begin.":"Import an OpenAPI specification to automatically populate your workspace."})]})]}):S.jsxs("div",{className:"space-y-6",children:[S.jsxs("div",{className:"relative group",children:[S.jsx(uN,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/40 group-focus-within:text-primary transition-colors"}),S.jsx("input",{type:"text",placeholder:"Search by path, method, or operation...",value:o,onChange:C=>a(C.target.value),className:"w-full pl-10 pr-4 py-2.5 text-sm font-bold rounded-xl border border-border/60 bg-card/30 backdrop-blur-sm placeholder:text-muted-foreground/40 focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary/40 shadow-sm transition-all"})]}),S.jsxs("div",{className:"space-y-8",children:[Array.from(y.entries()).map(([C,k])=>{const M=c.has(C);return S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center gap-3 w-full",children:[S.jsxs("button",{onClick:()=>b(C),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-muted/40 border border-border/20 text-muted-foreground hover:text-foreground hover:bg-muted/60 hover:border-border/40 transition-all shrink-0",children:[M?S.jsx(V2,{className:"w-3.5 h-3.5"}):S.jsx(La,{className:"w-3.5 h-3.5"}),S.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest",children:C}),S.jsxs("span",{className:"text-[10px] font-black opacity-40 tabular-nums",children:["(",k.length,")"]})]}),S.jsxs("div",{className:"flex items-center gap-1 bg-muted/20 p-0.5 rounded-lg border border-border/10 shrink-0",children:[S.jsx("button",{onClick:()=>x(k,"passthrough"),className:"px-2 py-1 text-[9px] font-black uppercase tracking-tighter text-muted-foreground/60 hover:text-mode-passthrough hover:bg-mode-passthrough/10 rounded-md transition-all",title:"Pass all in group",children:"Pass"}),S.jsx("button",{onClick:()=>x(k,"delay"),className:"px-2 py-1 text-[9px] font-black uppercase tracking-tighter text-muted-foreground/60 hover:text-mode-delay hover:bg-mode-delay/10 rounded-md transition-all",title:"Delay all in group",children:"Delay"}),S.jsx("button",{onClick:()=>x(k,"mock"),className:"px-2 py-1 text-[9px] font-black uppercase tracking-tighter text-muted-foreground/60 hover:text-mode-mock hover:bg-mode-mock/10 rounded-md transition-all",title:"Mock all in group",children:"Mock"})]}),S.jsx("div",{className:"h-px flex-1 bg-border/20 opacity-40 group-hover:opacity-100 group-hover:bg-primary/20 transition-all"})]}),!M&&S.jsx("div",{className:"grid grid-cols-1 gap-1 px-1",children:k.map(O=>S.jsx(E9,{endpoint:O,specName:d.get(O.specId)?.name,showSpecBadge:p.size>1},O.id))})]},C)}),y.size===0&&o&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center space-y-3",children:[S.jsx(Q2,{className:"w-10 h-10 text-muted-foreground opacity-20"}),S.jsxs("div",{className:"max-w-[240px]",children:[S.jsx("p",{className:"text-sm font-bold text-foreground/80",children:"No results found"}),S.jsxs("p",{className:"text-[11px] text-muted-foreground font-medium mt-1 leading-relaxed",children:['The search term "',o,'" did not match any active endpoints.']})]})]})]})]})}function R9(){return jr({queryKey:["presets"],queryFn:Fe.presets.list})}function D9(){const t=pt();return Nt({mutationFn:e=>Fe.presets.create(e),onSuccess:()=>{t.invalidateQueries({queryKey:["presets"]})}})}function j9(){const t=pt();return Nt({mutationFn:Fe.presets.delete,onSuccess:()=>{t.invalidateQueries({queryKey:["presets"]})}})}function L9(){const t=pt();return Nt({mutationFn:Fe.presets.apply,onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}const QA=[{name:"Slow",icon:gN,match:t=>t.length>0&&t.every(e=>e.mode==="delay"&&e.delay?.ms===2e3),apply:t=>{const e={};for(const i of t)e[i.id]={mode:"delay",delay:{ms:2e3}};return e}},{name:"Errors",icon:pN,match:t=>t.length>0&&t.every(e=>e.mode==="mock"&&e.mock?.statusCode===500),apply:t=>{const e={};for(const i of t)e[i.id]={mode:"mock",mock:{statusCode:500,headers:{"content-type":"application/json"},body:'{"error":"Internal Server Error"}'}};return e}},{name:"Pass All",icon:Dg,match:t=>t.length>0&&t.every(e=>e.mode==="passthrough"),apply:t=>{const e={};for(const i of t)e[i.id]={mode:"passthrough"};return e}}];function B9(t,e){for(const[i,n]of Object.entries(e.endpoints)){const r=t.find(o=>o.id===i);if(!r||n.mode!==void 0&&r.mode!==n.mode||n.mode==="delay"&&n.delay&&r.delay?.ms!==n.delay.ms||n.mode==="mock"&&n.mock&&(r.mock?.statusCode!==n.mock.statusCode||r.mock?.body!==n.mock.body))return!1}return!0}function z9(t,e){if(!t?.length)return null;for(const i of QA)if(i.match(t))return`builtin:${i.name}`;if(e){for(const i of e)if(B9(t,i))return`saved:${i.name}`}return null}function _9(){const{data:t}=R9(),{data:e}=Gw(),i=D9(),n=j9(),r=L9(),o=Kw(),a=N.useMemo(()=>z9(e,t),[e,t]),[c,h]=N.useState(!1),[d,p]=N.useState(!1),[y,b]=N.useState(""),x=N.useRef(null);N.useEffect(()=>{function k(M){x.current&&!x.current.contains(M.target)&&h(!1)}return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]);const w=!!e?.length,C=()=>{if(!y.trim()||!e)return;const k={};for(const M of e)k[M.id]={mode:M.mode,delay:M.delay,mock:M.mock};i.mutate({name:y.trim(),endpoints:k},{onSuccess:()=>{b(""),p(!1)}})};return w?S.jsxs("div",{className:"bg-card/30 backdrop-blur-sm border border-border/40 rounded-xl p-1 flex items-center gap-1 shadow-sm",children:[S.jsxs("div",{className:"flex items-center gap-1 bg-muted/40 rounded-lg p-0.5 border border-border/20 shadow-inner",children:[S.jsx("div",{className:"px-2 text-[9px] font-black text-muted-foreground uppercase tracking-widest hidden lg:block",children:"Presets"}),QA.map(({name:k,icon:M,apply:O})=>{const D=a===`builtin:${k}`;return S.jsxs("button",{onClick:()=>{e&&o.mutate(O(e))},className:Be("inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-md border transition-colors duration-75",D?"bg-primary/20 border-primary/30 text-primary shadow-sm":"border-transparent text-muted-foreground hover:text-foreground hover:bg-white/5"),children:[S.jsx(M,{className:Be("w-3.5 h-3.5")}),S.jsx("span",{className:"hidden sm:inline",children:k}),D&&S.jsx(Wc,{className:"w-3 h-3 ml-0.5"})]},k)})]}),S.jsx("div",{className:"h-6 w-px bg-border/40 mx-1 shrink-0"}),t&&t.length>0&&S.jsxs("div",{className:"relative",ref:x,children:[S.jsxs("button",{onClick:()=>h(!c),className:Be("inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-lg border transition-colors duration-75",c||a&&a.startsWith("saved:")?"bg-primary/20 border-primary/30 text-primary shadow-sm":"border-border/40 text-muted-foreground hover:bg-accent/40 hover:text-foreground"),children:[S.jsx(G2,{className:"w-3.5 h-3.5"}),S.jsxs("span",{className:"hidden sm:inline",children:["Saved (",t.length,")"]}),S.jsx(La,{className:Be("w-3 h-3 text-muted-foreground transition-transform duration-75",c&&"rotate-180")})]}),c&&S.jsxs("div",{className:"absolute right-0 top-full mt-2 z-[100] bg-popover border border-border shadow-2xl rounded-xl py-1.5 min-w-[240px]",children:[S.jsx("div",{className:"px-3 py-1 mb-1 border-b border-border/40",children:S.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"Saved Configurations"})}),S.jsx("div",{className:"max-h-[300px] overflow-y-auto px-1.5 ",children:t.map(k=>{const M=a===`saved:${k.name}`;return S.jsxs("div",{className:Be("group flex items-center gap-3 px-3 py-2 text-xs rounded-lg transition-colors duration-75 mb-0.5 border border-transparent",M?"bg-primary/10 border-primary/20 text-primary font-bold shadow-sm":"hover:bg-accent/50 text-muted-foreground hover:text-foreground"),children:[S.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer py-0.5",onClick:()=>r.mutate(k.name,{onSuccess:()=>h(!1)}),children:[S.jsx("p",{className:"font-bold truncate",children:k.name}),S.jsxs("p",{className:"text-[9px] opacity-60 font-medium",children:[Object.keys(k.endpoints).length," endpoints"]})]}),S.jsx("div",{className:"flex items-center gap-1 shrink-0",children:S.jsx("button",{onClick:O=>{O.stopPropagation(),n.mutate(k.name)},className:"p-1.5 text-muted-foreground hover:text-rose-500 hover:bg-rose-500/10 rounded-md transition-colors duration-75 opacity-0 group-hover:opacity-100",title:"Delete",children:S.jsx(ua,{className:"w-3.5 h-3.5"})})})]},k.name)})})]})]}),d?S.jsxs("div",{className:"flex items-center gap-1.5 bg-accent/20 rounded-lg p-0.5 border border-primary/20 shadow-inner ml-auto",children:[S.jsx("input",{autoFocus:!0,type:"text",value:y,onChange:k=>b(k.target.value),placeholder:"Name...",onKeyDown:k=>{k.key==="Enter"&&C(),k.key==="Escape"&&(p(!1),b(""))},className:"w-28 sm:w-40 px-3 py-1.5 text-[10px] font-bold rounded-md border border-border/40 bg-background/50 focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary/50 transition-colors duration-75"}),S.jsx("button",{onClick:C,disabled:!y.trim(),className:"px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors duration-75 shadow-sm",children:"Save"}),S.jsx("button",{onClick:()=>{p(!1),b("")},className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-white/5 rounded-md transition-colors duration-75",children:S.jsx(ca,{className:"w-3.5 h-3.5"})})]}):S.jsxs("button",{onClick:()=>p(!0),disabled:a!==null,className:Be("ml-auto inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-lg border border-dashed transition-colors duration-75",a!==null?"border-border/20 text-muted-foreground/20 cursor-not-allowed":"border-border/40 text-muted-foreground hover:border-primary/40 hover:text-primary hover:bg-primary/5 shadow-sm"),children:[S.jsx(aN,{className:"w-3.5 h-3.5"}),S.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]}):null}function H9(){const[t,e]=N.useState([]),[i,n]=N.useState(!1),[r,o]=N.useState(!1),a=N.useRef(null),c=pt();N.useEffect(()=>{Fe.logs.get(500).then(({entries:d})=>{e(p=>{const y=new Set(p.map(x=>x.id)),b=[...p];for(const x of d)y.has(x.id)||b.push(x);return b.slice(0,500)}),o(!0)})},[]),N.useEffect(()=>{const d=new EventSource("/api/logs/stream");return a.current=d,d.addEventListener("connected",()=>n(!0)),d.addEventListener("log",p=>{const y=JSON.parse(p.data);e(b=>[y,...b].slice(0,500))}),d.onerror=()=>n(!1),()=>{d.close(),a.current=null}},[]);const h=N.useCallback(()=>{e([]),Fe.logs.clear().then(()=>{c.invalidateQueries({queryKey:["logs"]})})},[c]);return{entries:t,connected:i,clear:h,loaded:r}}function YA({status:t}){const e=t<300?"text-emerald-400 bg-emerald-400/10 border-emerald-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-success),0.2)]":t<400?"text-blue-400 bg-blue-400/10 border-blue-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-primary),0.2)]":t<500?"text-amber-400 bg-amber-400/10 border-amber-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-warning),0.2)]":"text-rose-400 bg-rose-400/10 border-rose-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-destructive),0.2)]";return S.jsx("span",{className:Be("inline-flex items-center justify-center px-1.5 py-0.5 text-[10px] font-black font-mono rounded border uppercase tracking-wider min-w-[32px] transition-all",e),children:t})}function U9({entry:t,onClose:e}){return S.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",children:[S.jsx("div",{className:"absolute inset-0 bg-background/60",onClick:e}),S.jsxs("div",{className:"relative w-full max-w-xl bg-card border-l border-border shadow-2xl h-full flex flex-col",onClick:i=>i.stopPropagation(),children:[S.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border bg-muted",children:[S.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(qg,{method:t.method}),S.jsx(YA,{status:t.statusCode}),S.jsx("span",{className:"text-[10px] font-black text-muted-foreground uppercase tracking-widest ml-2",children:t.mode})]}),S.jsx("h2",{className:"text-sm font-black font-mono text-foreground truncate break-all",children:t.path})]}),S.jsx("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:S.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors duration-75",children:S.jsx(ca,{className:"w-5 h-5"})})})]}),S.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:[S.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[S.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[S.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[S.jsx(Ol,{className:"w-3 h-3"})," Latency"]}),S.jsxs("div",{className:"text-sm font-black font-mono text-primary",children:[t.latencyMs,S.jsx("span",{className:"text-[10px] ml-0.5 opacity-60",children:"ms"})]})]}),S.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[S.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[S.jsx(Dg,{className:"w-3 h-3"})," Status"]}),S.jsx("div",{className:"text-sm font-black font-mono text-foreground",children:t.statusCode})]}),S.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[S.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[S.jsx(Ol,{className:"w-3 h-3"})," Timestamp"]}),S.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:new Date(t.timestamp).toLocaleTimeString()})]})]}),S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(bm,{className:"w-4 h-4 text-primary"}),S.jsx("h3",{className:"text-xs font-black uppercase tracking-widest text-foreground/80",children:"Request Details"})]}),t.requestHeaders&&S.jsxs("div",{className:"space-y-2",children:[S.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[S.jsx(Zc,{className:"w-3 h-3"})," Headers"]}),S.jsx("pre",{className:"text-[11px] font-mono font-medium bg-muted border border-border rounded-xl p-4 overflow-auto max-h-48 shadow-inner leading-relaxed",children:Object.entries(t.requestHeaders).map(([i,n])=>`${i}: ${n}`).join(`
59
+ `)})]})]}),S.jsxs("div",{className:"space-y-4 border-t border-border pt-8",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(bm,{className:"w-4 h-4 text-success rotate-180"}),S.jsx("h3",{className:"text-xs font-black uppercase tracking-widest text-foreground/80",children:"Response Details"})]}),t.responseHeaders&&S.jsxs("div",{className:"space-y-2",children:[S.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[S.jsx(Zc,{className:"w-3 h-3"})," Headers"]}),S.jsx("pre",{className:"text-[11px] font-mono font-medium bg-muted border border-border rounded-xl p-4 overflow-auto max-h-48 shadow-inner leading-relaxed",children:Object.entries(t.responseHeaders).map(([i,n])=>`${i}: ${n}`).join(`
60
+ `)})]}),t.responseBody&&S.jsxs("div",{className:"space-y-2",children:[S.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[S.jsx(Kc,{className:"w-3 h-3"})," Body"]}),S.jsx("div",{className:"rounded-xl border border-border bg-muted overflow-hidden shadow-inner",children:S.jsx("pre",{className:"text-[11px] font-mono font-medium p-4 overflow-auto max-h-80 leading-relaxed text-foreground/90",children:q9(t.responseBody)})})]})]})]}),S.jsx("div",{className:"p-4 border-t border-border bg-muted flex justify-end gap-3 px-6",children:S.jsx("button",{onClick:e,className:"px-6 py-2 text-xs font-black uppercase tracking-widest bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors duration-75 shadow-sm",children:"Dismiss"})})]})]})}function q9(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function P9({isCompact:t}){const{entries:e,connected:i,clear:n,loaded:r}=H9(),[o,a]=N.useState(null),[c,h]=N.useState(""),[d,p]=N.useState(""),[y,b]=N.useState(""),x=N.useMemo(()=>e.filter(C=>!(c&&C.method!==c||d==="2xx"&&(C.statusCode<200||C.statusCode>=300)||d==="4xx"&&(C.statusCode<400||C.statusCode>=500)||d==="5xx"&&C.statusCode<500||y&&C.mode!==y)),[e,c,d,y]),w={mock:"bg-mode-mock/20 text-mode-mock border-mode-mock/20",delay:"bg-mode-delay/20 text-mode-delay border-mode-delay/20",passthrough:"bg-mode-passthrough/20 text-mode-passthrough border-mode-passthrough/20"};return S.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[!t&&S.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/40 bg-card",children:[S.jsx("div",{className:"flex items-center gap-6",children:S.jsxs("div",{className:"flex items-center gap-2.5",children:[S.jsx("div",{className:"relative",children:S.jsx(lN,{className:Be("w-4 h-4",i?"text-success":"text-destructive")})}),S.jsxs("div",{className:"flex flex-col",children:[S.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-0.5",children:"Stream"}),S.jsxs("span",{className:"text-[11px] font-bold text-muted-foreground leading-none",children:[i?"Real-time":"Offline"," · ",e.length," entries"]})]})]})}),S.jsx("button",{onClick:n,className:"p-2 text-muted-foreground/60 hover:text-destructive hover:bg-destructive/10 rounded-lg transition-colors duration-75",title:"Clear logs",children:S.jsx(ua,{className:"w-4 h-4"})})]}),S.jsxs("div",{className:"px-4 py-2 flex items-center justify-between bg-muted border-b border-border/20",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[S.jsx($3,{className:"w-3 h-3 text-muted-foreground/60"}),S.jsxs("select",{value:c,onChange:C=>h(C.target.value),className:"text-[10px] font-black uppercase tracking-wide bg-transparent outline-none cursor-pointer text-muted-foreground hover:text-foreground transition-colors duration-75",children:[S.jsx("option",{value:"",children:"Method"}),["GET","POST","PUT","PATCH","DELETE"].map(C=>S.jsx("option",{value:C,children:C},C))]})]}),S.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[S.jsx(ym,{className:"w-3 h-3 text-muted-foreground/60"}),S.jsxs("select",{value:d,onChange:C=>p(C.target.value),className:"text-[10px] font-black uppercase tracking-wide bg-transparent outline-none cursor-pointer text-muted-foreground hover:text-foreground transition-colors duration-75",children:[S.jsx("option",{value:"",children:"Status"}),S.jsx("option",{value:"2xx",children:"2xx"}),S.jsx("option",{value:"4xx",children:"4xx"}),S.jsx("option",{value:"5xx",children:"5xx"})]})]}),S.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[S.jsx(Ol,{className:"w-3 h-3 text-muted-foreground/60"}),S.jsxs("select",{value:y,onChange:C=>b(C.target.value),className:"text-[10px] font-black uppercase tracking-wide bg-transparent outline-none cursor-pointer text-muted-foreground hover:text-foreground transition-colors duration-75",children:[S.jsx("option",{value:"",children:"Mode"}),S.jsx("option",{value:"passthrough",children:"Pass"}),S.jsx("option",{value:"delay",children:"Delay"}),S.jsx("option",{value:"mock",children:"Mock"})]})]})]}),t&&S.jsx("button",{onClick:n,className:"p-1.5 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/5 rounded-md transition-colors duration-75",title:"Clear logs",children:S.jsx(ua,{className:"w-3.5 h-3.5"})})]}),S.jsx("div",{className:"flex-1 overflow-y-auto relative bg-background",children:S.jsxs("div",{className:"min-w-full",children:[!t&&S.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 bg-muted border-b border-border/20 sticky top-0 z-10",children:[S.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-20 shrink-0",children:"Time"}),S.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-[52px] shrink-0",children:"Method"}),S.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 flex-1",children:"Request Path"}),S.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-16 text-center",children:"Status"}),S.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-16 text-right",children:"Latency"}),S.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-20 text-center",children:"Mode"})]}),S.jsx("div",{className:"divide-y divide-border/20",children:x.length===0?S.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center space-y-3",children:[r?S.jsx(ym,{className:"w-12 h-12 text-muted-foreground/10"}):S.jsx(Jc,{className:"w-8 h-8 animate-spin text-primary opacity-40"}),S.jsx("div",{className:"max-w-[200px]",children:S.jsx("p",{className:"text-sm font-bold text-foreground/80",children:e.length===0?"No Traffic Recorded":"No Matches"})})]}):x.slice(0,200).map(C=>S.jsxs("button",{onClick:()=>a(C),className:Be("flex flex-col gap-2 px-4 py-3 w-full text-left transition-colors duration-75 group border-b border-border/10",o?.id===C.id?"bg-primary/5 shadow-inner":"hover:bg-accent/30"),children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(qg,{method:C.method}),S.jsx("span",{className:"text-[10px] text-muted-foreground/60 font-mono font-bold tabular-nums",children:new Date(C.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})})]}),S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsxs("div",{className:"flex items-center gap-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground opacity-60",children:[S.jsx(Ol,{className:"w-2.5 h-2.5 opacity-40"}),S.jsxs("span",{className:"tabular-nums",children:[C.latencyMs,"ms"]})]}),S.jsx(YA,{status:C.statusCode})]})]}),S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsx("span",{className:"text-xs font-mono font-bold truncate text-foreground/90 group-hover:text-primary transition-colors duration-75 flex-1",children:C.path}),S.jsx("span",{className:Be("text-[8px] font-black uppercase tracking-[0.1em] px-1.5 py-0.5 rounded border leading-none",w[C.mode]),children:C.mode})]})]},C.id))})]})}),o&&S.jsx(U9,{entry:o,onClose:()=>a(null)})]})}function F9(){return S.jsxs("div",{className:"flex h-full overflow-hidden bg-background",children:[S.jsxs("div",{className:"flex-1 flex flex-col min-w-0 border-r border-border/60 bg-background",children:[S.jsxs("div",{className:"px-6 py-4 flex items-center justify-between border-b border-border/60 bg-muted/30 shrink-0",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center border border-primary/20 text-primary",children:S.jsx(Zc,{className:"w-4 h-4"})}),S.jsx("h2",{className:"text-sm font-black uppercase tracking-widest text-foreground",children:"Endpoints Registry"})]}),S.jsx(_9,{})]}),S.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:S.jsx("div",{className:"max-w-5xl mx-auto space-y-6",children:S.jsx(N9,{})})})]}),S.jsxs("div",{className:"w-[400px] lg:w-[450px] xl:w-[500px] hidden lg:flex flex-col bg-muted/5 shrink-0",children:[S.jsxs("div",{className:"px-5 py-4 flex items-center gap-3 border-b border-border/60 bg-muted/30 shrink-0",children:[S.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center border border-primary/20 text-primary",children:S.jsx(ym,{className:"w-4 h-4"})}),S.jsx("h2",{className:"text-sm font-black uppercase tracking-widest text-foreground",children:"Traffic Monitor"})]}),S.jsx("div",{className:"flex-1 overflow-hidden",children:S.jsx(P9,{isCompact:!0})})]})]})}const V9=new E3({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});function I9(){return S.jsx(N3,{client:V9,children:S.jsx(XE,{children:S.jsx(ME,{children:S.jsxs(jc,{element:S.jsx(j4,{}),children:[S.jsx(jc,{path:"/",element:S.jsx(F9,{})}),S.jsx(jc,{path:"*",element:S.jsx(CE,{to:"/",replace:!0})})]})})})})}AO.createRoot(document.getElementById("root")).render(S.jsx(N.StrictMode,{children:S.jsx(I9,{})}));