From ed81012be65dba29b35cef2b0779a18a90b5e02b Mon Sep 17 00:00:00 2001 From: Joost Farla Date: Tue, 27 Feb 2024 19:34:09 +0000 Subject: [PATCH] Requirement 11A --- .../{index-DQ0wn-d1.js => index-CYHZ7zWI.js} | 50 +++++------ docs/index.html | 2 +- src/validation/rules/core-geometry.test.ts | 89 +++++++++++++++++++ src/validation/rules/core-geometry.ts | 24 +++++ 4 files changed, 139 insertions(+), 26 deletions(-) rename docs/assets/{index-DQ0wn-d1.js => index-CYHZ7zWI.js} (50%) diff --git a/docs/assets/index-DQ0wn-d1.js b/docs/assets/index-CYHZ7zWI.js similarity index 50% rename from docs/assets/index-DQ0wn-d1.js rename to docs/assets/index-CYHZ7zWI.js index 517861d..4c07583 100644 --- a/docs/assets/index-DQ0wn-d1.js +++ b/docs/assets/index-CYHZ7zWI.js @@ -1,4 +1,4 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var mT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ug(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ik={exports:{}},Qf={},sk={exports:{}},we={};/** +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var yO=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lk={exports:{}},eh={},ak={exports:{}},we={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Za=Symbol.for("react.element"),pT=Symbol.for("react.portal"),gT=Symbol.for("react.fragment"),yT=Symbol.for("react.strict_mode"),vT=Symbol.for("react.profiler"),wT=Symbol.for("react.provider"),ST=Symbol.for("react.context"),kT=Symbol.for("react.forward_ref"),bT=Symbol.for("react.suspense"),xT=Symbol.for("react.memo"),CT=Symbol.for("react.lazy"),Gy=Symbol.iterator;function $T(t){return t===null||typeof t!="object"?null:(t=Gy&&t[Gy]||t["@@iterator"],typeof t=="function"?t:null)}var ok={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},lk=Object.assign,ak={};function Yo(t,e,n){this.props=t,this.context=e,this.refs=ak,this.updater=n||ok}Yo.prototype.isReactComponent={};Yo.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Yo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function uk(){}uk.prototype=Yo.prototype;function cg(t,e,n){this.props=t,this.context=e,this.refs=ak,this.updater=n||ok}var fg=cg.prototype=new uk;fg.constructor=cg;lk(fg,Yo.prototype);fg.isPureReactComponent=!0;var Yy=Array.isArray,ck=Object.prototype.hasOwnProperty,hg={current:null},fk={key:!0,ref:!0,__self:!0,__source:!0};function hk(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)ck.call(e,r)&&!fk.hasOwnProperty(r)&&(i[r]=e[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,F=H[A];if(0>>1;Ai(E,I))Li(q,E)?(H[A]=q,H[L]=I,A=L):(H[A]=E,H[k]=I,A=k);else if(Li(q,I))H[A]=q,H[L]=I,A=L;else break e}}return Y}function i(H,Y){var I=H.sortIndex-Y.sortIndex;return I!==0?I:H.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],u=[],c=1,f=null,h=3,d=!1,p=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(H){for(var Y=n(u);Y!==null;){if(Y.callback===null)r(u);else if(Y.startTime<=H)r(u),Y.sortIndex=Y.expirationTime,e(a,Y);else break;Y=n(u)}}function S(H){if(y=!1,v(H),!p)if(n(a)!==null)p=!0,Ee($);else{var Y=n(u);Y!==null&&pe(S,Y.startTime-H)}}function $(H,Y){p=!1,y&&(y=!1,m(_),_=-1),d=!0;var I=h;try{for(v(Y),f=n(a);f!==null&&(!(f.expirationTime>Y)||H&&!V());){var A=f.callback;if(typeof A=="function"){f.callback=null,h=f.priorityLevel;var F=A(f.expirationTime<=Y);Y=t.unstable_now(),typeof F=="function"?f.callback=F:f===n(a)&&r(a),v(Y)}else r(a);f=n(a)}if(f!==null)var P=!0;else{var k=n(u);k!==null&&pe(S,k.startTime-Y),P=!1}return P}finally{f=null,h=I,d=!1}}var b=!1,x=null,_=-1,M=5,N=-1;function V(){return!(t.unstable_now()-NH||125A?(H.sortIndex=I,e(u,H),n(a)===null&&H===n(u)&&(y?(m(_),_=-1):y=!0,pe(S,I-A))):(H.sortIndex=F,e(a,H),p||d||(p=!0,Ee($))),H},t.unstable_shouldYield=V,t.unstable_wrapCallback=function(H){var Y=h;return function(){var I=h;h=Y;try{return H.apply(this,arguments)}finally{h=I}}}})(gk);pk.exports=gk;var LT=pk.exports;/** + */(function(t){function e(H,Y){var I=H.length;H.push(Y);e:for(;0>>1,F=H[M];if(0>>1;Mi(E,I))Li(q,E)?(H[M]=q,H[L]=I,M=L):(H[M]=E,H[k]=I,M=k);else if(Li(q,I))H[M]=q,H[L]=I,M=L;else break e}}return Y}function i(H,Y){var I=H.sortIndex-Y.sortIndex;return I!==0?I:H.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],u=[],c=1,f=null,h=3,d=!1,p=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(H){for(var Y=n(u);Y!==null;){if(Y.callback===null)r(u);else if(Y.startTime<=H)r(u),Y.sortIndex=Y.expirationTime,e(a,Y);else break;Y=n(u)}}function S(H){if(y=!1,v(H),!p)if(n(a)!==null)p=!0,Ee($);else{var Y=n(u);Y!==null&&pe(S,Y.startTime-H)}}function $(H,Y){p=!1,y&&(y=!1,m(_),_=-1),d=!0;var I=h;try{for(v(Y),f=n(a);f!==null&&(!(f.expirationTime>Y)||H&&!V());){var M=f.callback;if(typeof M=="function"){f.callback=null,h=f.priorityLevel;var F=M(f.expirationTime<=Y);Y=t.unstable_now(),typeof F=="function"?f.callback=F:f===n(a)&&r(a),v(Y)}else r(a);f=n(a)}if(f!==null)var P=!0;else{var k=n(u);k!==null&&pe(S,k.startTime-Y),P=!1}return P}finally{f=null,h=I,d=!1}}var b=!1,x=null,_=-1,A=5,N=-1;function V(){return!(t.unstable_now()-NH||125M?(H.sortIndex=I,e(u,H),n(a)===null&&H===n(u)&&(y?(m(_),_=-1):y=!0,pe(S,I-M))):(H.sortIndex=F,e(a,H),p||d||(p=!0,Ee($))),H},t.unstable_shouldYield=V,t.unstable_wrapCallback=function(H){var Y=h;return function(){var I=h;h=Y;try{return H.apply(this,arguments)}finally{h=I}}}})(wk);vk.exports=wk;var jO=vk.exports;/** * @license React * react-dom.production.min.js * @@ -30,29 +30,29 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var yk=zt,Sn=LT;function W(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),im=Object.prototype.hasOwnProperty,FT=/^[: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]*$/,Jy={},Qy={};function zT(t){return im.call(Qy,t)?!0:im.call(Jy,t)?!1:FT.test(t)?Qy[t]=!0:(Jy[t]=!0,!1)}function jT(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function BT(t,e,n,r){if(e===null||typeof e>"u"||jT(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Yt(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Tt[t]=new Yt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Tt[e]=new Yt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Tt[t]=new Yt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Tt[t]=new Yt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Tt[t]=new Yt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Tt[t]=new Yt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Tt[t]=new Yt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Tt[t]=new Yt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Tt[t]=new Yt(t,5,!1,t.toLowerCase(),null,!1,!1)});var mg=/[\-:]([a-z])/g;function pg(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(mg,pg);Tt[e]=new Yt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(mg,pg);Tt[e]=new Yt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(mg,pg);Tt[e]=new Yt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Tt[t]=new Yt(t,1,!1,t.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Yt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Tt[t]=new Yt(t,1,!1,t.toLowerCase(),null,!0,!0)});function gg(t,e,n,r){var i=Tt.hasOwnProperty(e)?Tt[e]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),om=Object.prototype.hasOwnProperty,BO=/^[: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]*$/,Zy={},Qy={};function VO(t){return om.call(Qy,t)?!0:om.call(Zy,t)?!1:BO.test(t)?Qy[t]=!0:(Zy[t]=!0,!1)}function WO(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function HO(t,e,n,r){if(e===null||typeof e>"u"||WO(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Jt(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Tt[t]=new Jt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Tt[e]=new Jt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Tt[t]=new Jt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Tt[t]=new Jt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Tt[t]=new Jt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Tt[t]=new Jt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Tt[t]=new Jt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Tt[t]=new Jt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Tt[t]=new Jt(t,5,!1,t.toLowerCase(),null,!1,!1)});var pg=/[\-:]([a-z])/g;function gg(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(pg,gg);Tt[e]=new Jt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(pg,gg);Tt[e]=new Jt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(pg,gg);Tt[e]=new Jt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Tt[t]=new Jt(t,1,!1,t.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Jt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Tt[t]=new Jt(t,1,!1,t.toLowerCase(),null,!0,!0)});function yg(t,e,n,r){var i=Tt.hasOwnProperty(e)?Tt[e]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var a=` -`+i[o].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{Kh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?zl(t):""}function VT(t){switch(t.tag){case 5:return zl(t.type);case 16:return zl("Lazy");case 13:return zl("Suspense");case 19:return zl("SuspenseList");case 0:case 2:case 15:return t=Gh(t.type,!1),t;case 11:return t=Gh(t.type.render,!1),t;case 1:return t=Gh(t.type,!0),t;default:return""}}function am(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Xs:return"Fragment";case Qs:return"Portal";case sm:return"Profiler";case yg:return"StrictMode";case om:return"Suspense";case lm:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Sk:return(t.displayName||"Context")+".Consumer";case wk:return(t._context.displayName||"Context")+".Provider";case vg:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case wg:return e=t.displayName||null,e!==null?e:am(t.type)||"Memo";case ai:e=t._payload,t=t._init;try{return am(t(e))}catch{}}return null}function WT(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return am(e);case 8:return e===yg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Ii(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function bk(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function HT(t){var e=bk(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function ku(t){t._valueTracker||(t._valueTracker=HT(t))}function xk(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=bk(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function qc(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function um(t,e){var n=e.checked;return Ge({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function ev(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Ii(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Ck(t,e){e=e.checked,e!=null&&gg(t,"checked",e,!1)}function cm(t,e){Ck(t,e);var n=Ii(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?fm(t,e.type,n):e.hasOwnProperty("defaultValue")&&fm(t,e.type,Ii(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function tv(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function fm(t,e,n){(e!=="number"||qc(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var jl=Array.isArray;function vo(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=bu.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function va(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Jl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},UT=["Webkit","ms","Moz","O"];Object.keys(Jl).forEach(function(t){UT.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Jl[e]=Jl[t]})});function Ok(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Jl.hasOwnProperty(t)&&Jl[t]?(""+e).trim():e+"px"}function _k(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Ok(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var qT=Ge({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function mm(t,e){if(e){if(qT[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(W(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(W(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(W(61))}if(e.style!=null&&typeof e.style!="object")throw Error(W(62))}}function pm(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gm=null;function Sg(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ym=null,wo=null,So=null;function iv(t){if(t=Xa(t)){if(typeof ym!="function")throw Error(W(280));var e=t.stateNode;e&&(e=rh(e),ym(t.stateNode,t.type,e))}}function Ak(t){wo?So?So.push(t):So=[t]:wo=t}function Mk(){if(wo){var t=wo,e=So;if(So=wo=null,iv(t),e)for(t=0;t>>=0,t===0?32:31-(rO(t)/iO|0)|0}var xu=64,Cu=4194304;function Bl(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Zc(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Bl(l):(s&=o,s!==0&&(r=Bl(s)))}else o=n&~i,o!==0?r=Bl(o):s!==0&&(r=Bl(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Ja(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-er(e),t[e]=n}function aO(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Xl),dv=" ",mv=!1;function Jk(t,e){switch(t){case"keyup":return IO.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qk(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var eo=!1;function FO(t,e){switch(t){case"compositionend":return Qk(e);case"keypress":return e.which!==32?null:(mv=!0,dv);case"textInput":return t=e.data,t===dv&&mv?null:t;default:return null}}function zO(t,e){if(eo)return t==="compositionend"||!Og&&Jk(t,e)?(t=Yk(),Sc=$g=yi=null,eo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=vv(n)}}function nb(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?nb(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function rb(){for(var t=window,e=qc();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=qc(t.document)}return e}function _g(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function GO(t){var e=rb(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&nb(n.ownerDocument.documentElement,n)){if(r!==null&&_g(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=wv(n,s);var o=wv(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,to=null,xm=null,ta=null,Cm=!1;function Sv(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Cm||to==null||to!==qc(r)||(r=to,"selectionStart"in r&&_g(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ta&&Ca(ta,r)||(ta=r,r=Xc(xm,"onSelect"),0io||(t.current=Am[io],Am[io]=null,io--)}function De(t,e){io++,Am[io]=t.current,t.current=e}var Li={},Lt=Ui(Li),rn=Ui(!1),bs=Li;function Ro(t,e){var n=t.type.contextTypes;if(!n)return Li;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function sn(t){return t=t.childContextTypes,t!=null}function tf(){je(rn),je(Lt)}function Tv(t,e,n){if(Lt.current!==Li)throw Error(W(168));De(Lt,e),De(rn,n)}function hb(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(W(108,WT(t)||"Unknown",i));return Ge({},n,r)}function nf(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Li,bs=Lt.current,De(Lt,t),De(rn,rn.current),!0}function Ov(t,e,n){var r=t.stateNode;if(!r)throw Error(W(169));n?(t=hb(t,e,bs),r.__reactInternalMemoizedMergedChildContext=t,je(rn),je(Lt),De(Lt,t)):je(rn),De(rn,n)}var Ir=null,ih=!1,ad=!1;function db(t){Ir===null?Ir=[t]:Ir.push(t)}function o_(t){ih=!0,db(t)}function qi(){if(!ad&&Ir!==null){ad=!0;var t=0,e=_e;try{var n=Ir;for(_e=1;t>=o,i-=o,Fr=1<<32-er(e)+i|n<_?(M=x,x=null):M=x.sibling;var N=h(m,x,v[_],S);if(N===null){x===null&&(x=M);break}t&&x&&N.alternate===null&&e(m,x),g=s(N,g,_),b===null?$=N:b.sibling=N,b=N,x=M}if(_===v.length)return n(m,x),He&&ns(m,_),$;if(x===null){for(;__?(M=x,x=null):M=x.sibling;var V=h(m,x,N.value,S);if(V===null){x===null&&(x=M);break}t&&x&&V.alternate===null&&e(m,x),g=s(V,g,_),b===null?$=V:b.sibling=V,b=V,x=M}if(N.done)return n(m,x),He&&ns(m,_),$;if(x===null){for(;!N.done;_++,N=v.next())N=f(m,N.value,S),N!==null&&(g=s(N,g,_),b===null?$=N:b.sibling=N,b=N);return He&&ns(m,_),$}for(x=r(m,x);!N.done;_++,N=v.next())N=d(x,m,_,N.value,S),N!==null&&(t&&N.alternate!==null&&x.delete(N.key===null?_:N.key),g=s(N,g,_),b===null?$=N:b.sibling=N,b=N);return t&&x.forEach(function(B){return e(m,B)}),He&&ns(m,_),$}function w(m,g,v,S){if(typeof v=="object"&&v!==null&&v.type===Xs&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Su:e:{for(var $=v.key,b=g;b!==null;){if(b.key===$){if($=v.type,$===Xs){if(b.tag===7){n(m,b.sibling),g=i(b,v.props.children),g.return=m,m=g;break e}}else if(b.elementType===$||typeof $=="object"&&$!==null&&$.$$typeof===ai&&Rv($)===b.type){n(m,b.sibling),g=i(b,v.props),g.ref=El(m,b,v),g.return=m,m=g;break e}n(m,b);break}else e(m,b);b=b.sibling}v.type===Xs?(g=ws(v.props.children,m.mode,S,v.key),g.return=m,m=g):(S=Oc(v.type,v.key,v.props,null,m.mode,S),S.ref=El(m,g,v),S.return=m,m=S)}return o(m);case Qs:e:{for(b=v.key;g!==null;){if(g.key===b)if(g.tag===4&&g.stateNode.containerInfo===v.containerInfo&&g.stateNode.implementation===v.implementation){n(m,g.sibling),g=i(g,v.children||[]),g.return=m,m=g;break e}else{n(m,g);break}else e(m,g);g=g.sibling}g=gd(v,m.mode,S),g.return=m,m=g}return o(m);case ai:return b=v._init,w(m,g,b(v._payload),S)}if(jl(v))return p(m,g,v,S);if(kl(v))return y(m,g,v,S);Mu(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,g!==null&&g.tag===6?(n(m,g.sibling),g=i(g,v),g.return=m,m=g):(n(m,g),g=pd(v,m.mode,S),g.return=m,m=g),o(m)):n(m,g)}return w}var Lo=kb(!0),bb=kb(!1),eu={},_r=Ui(eu),Oa=Ui(eu),_a=Ui(eu);function hs(t){if(t===eu)throw Error(W(174));return t}function Fg(t,e){switch(De(_a,e),De(Oa,t),De(_r,eu),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:dm(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=dm(e,t)}je(_r),De(_r,e)}function Fo(){je(_r),je(Oa),je(_a)}function xb(t){hs(_a.current);var e=hs(_r.current),n=dm(e,t.type);e!==n&&(De(Oa,t),De(_r,n))}function zg(t){Oa.current===t&&(je(_r),je(Oa))}var qe=Ui(0);function uf(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var ud=[];function jg(){for(var t=0;tn?n:4,t(!0);var r=cd.transition;cd.transition={};try{t(!1),e()}finally{_e=n,cd.transition=r}}function zb(){return Bn().memoizedState}function c_(t,e,n){var r=Ai(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},jb(t))Bb(e,n);else if(n=yb(t,e,n,r),n!==null){var i=Ut();tr(n,t,r,i),Vb(n,e,r)}}function f_(t,e,n){var r=Ai(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(jb(t))Bb(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,nr(l,o)){var a=e.interleaved;a===null?(i.next=i,Ig(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=yb(t,e,i,r),n!==null&&(i=Ut(),tr(n,t,r,i),Vb(n,e,r))}}function jb(t){var e=t.alternate;return t===Ke||e!==null&&e===Ke}function Bb(t,e){na=cf=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Vb(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,bg(t,n)}}var ff={readContext:jn,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useInsertionEffect:At,useLayoutEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useMutableSource:At,useSyncExternalStore:At,useId:At,unstable_isNewReconciler:!1},h_={readContext:jn,useCallback:function(t,e){return vr().memoizedState=[t,e===void 0?null:e],t},useContext:jn,useEffect:Lv,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Cc(4194308,4,Db.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Cc(4194308,4,t,e)},useInsertionEffect:function(t,e){return Cc(4,2,t,e)},useMemo:function(t,e){var n=vr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=vr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=c_.bind(null,Ke,t),[r.memoizedState,t]},useRef:function(t){var e=vr();return t={current:t},e.memoizedState=t},useState:Iv,useDebugValue:Ug,useDeferredValue:function(t){return vr().memoizedState=t},useTransition:function(){var t=Iv(!1),e=t[0];return t=u_.bind(null,t[1]),vr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Ke,i=vr();if(He){if(n===void 0)throw Error(W(407));n=n()}else{if(n=e(),yt===null)throw Error(W(349));Cs&30||Eb(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,Lv(Ob.bind(null,r,s,t),[t]),r.flags|=2048,Pa(9,Tb.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=vr(),e=yt.identifierPrefix;if(He){var n=zr,r=Fr;n=(r&~(1<<32-er(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Aa++,0")&&(a=a.replace("",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{Yh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?jl(t):""}function UO(t){switch(t.tag){case 5:return jl(t.type);case 16:return jl("Lazy");case 13:return jl("Suspense");case 19:return jl("SuspenseList");case 0:case 2:case 15:return t=Jh(t.type,!1),t;case 11:return t=Jh(t.type.render,!1),t;case 1:return t=Jh(t.type,!0),t;default:return""}}function cm(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case eo:return"Fragment";case Xs:return"Portal";case lm:return"Profiler";case vg:return"StrictMode";case am:return"Suspense";case um:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case xk:return(t.displayName||"Context")+".Consumer";case bk:return(t._context.displayName||"Context")+".Provider";case wg:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Sg:return e=t.displayName||null,e!==null?e:cm(t.type)||"Memo";case ui:e=t._payload,t=t._init;try{return cm(t(e))}catch{}}return null}function qO(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return cm(e);case 8:return e===vg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Li(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function $k(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function KO(t){var e=$k(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function xu(t){t._valueTracker||(t._valueTracker=KO(t))}function Ek(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=$k(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Gc(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function fm(t,e){var n=e.checked;return Ge({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function ev(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Li(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Ok(t,e){e=e.checked,e!=null&&yg(t,"checked",e,!1)}function hm(t,e){Ok(t,e);var n=Li(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?dm(t,e.type,n):e.hasOwnProperty("defaultValue")&&dm(t,e.type,Li(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function tv(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function dm(t,e,n){(e!=="number"||Gc(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Bl=Array.isArray;function wo(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Cu.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function wa(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ql={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},GO=["Webkit","ms","Moz","O"];Object.keys(Ql).forEach(function(t){GO.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ql[e]=Ql[t]})});function Ak(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ql.hasOwnProperty(t)&&Ql[t]?(""+e).trim():e+"px"}function Pk(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Ak(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var YO=Ge({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function gm(t,e){if(e){if(YO[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(W(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(W(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(W(61))}if(e.style!=null&&typeof e.style!="object")throw Error(W(62))}}function ym(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var vm=null;function kg(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var wm=null,So=null,ko=null;function iv(t){if(t=eu(t)){if(typeof wm!="function")throw Error(W(280));var e=t.stateNode;e&&(e=sh(e),wm(t.stateNode,t.type,e))}}function Nk(t){So?ko?ko.push(t):ko=[t]:So=t}function Dk(){if(So){var t=So,e=ko;if(ko=So=null,iv(t),e)for(t=0;t>>=0,t===0?32:31-(oT(t)/lT|0)|0}var $u=64,Eu=4194304;function Vl(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Qc(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Vl(l):(s&=o,s!==0&&(r=Vl(s)))}else o=n&~i,o!==0?r=Vl(o):s!==0&&(r=Vl(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Qa(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-tr(e),t[e]=n}function fT(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=ea),dv=" ",mv=!1;function eb(t,e){switch(t){case"keyup":return zT.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tb(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var to=!1;function BT(t,e){switch(t){case"compositionend":return tb(e);case"keypress":return e.which!==32?null:(mv=!0,dv);case"textInput":return t=e.data,t===dv&&mv?null:t;default:return null}}function VT(t,e){if(to)return t==="compositionend"||!_g&&eb(t,e)?(t=Qk(),bc=Eg=vi=null,to=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=vv(n)}}function sb(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?sb(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function ob(){for(var t=window,e=Gc();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Gc(t.document)}return e}function Mg(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function ZT(t){var e=ob(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&sb(n.ownerDocument.documentElement,n)){if(r!==null&&Mg(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=wv(n,s);var o=wv(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,no=null,$m=null,na=null,Em=!1;function Sv(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Em||no==null||no!==Gc(r)||(r=no,"selectionStart"in r&&Mg(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),na&&$a(na,r)||(na=r,r=tf($m,"onSelect"),0so||(t.current=Pm[so],Pm[so]=null,so--)}function De(t,e){so++,Pm[so]=t.current,t.current=e}var Fi={},Ft=qi(Fi),sn=qi(!1),xs=Fi;function Io(t,e){var n=t.type.contextTypes;if(!n)return Fi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function on(t){return t=t.childContextTypes,t!=null}function rf(){je(sn),je(Ft)}function Ov(t,e,n){if(Ft.current!==Fi)throw Error(W(168));De(Ft,e),De(sn,n)}function pb(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(W(108,qO(t)||"Unknown",i));return Ge({},n,r)}function sf(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Fi,xs=Ft.current,De(Ft,t),De(sn,sn.current),!0}function Tv(t,e,n){var r=t.stateNode;if(!r)throw Error(W(169));n?(t=pb(t,e,xs),r.__reactInternalMemoizedMergedChildContext=t,je(sn),je(Ft),De(Ft,t)):je(sn),De(sn,n)}var Lr=null,oh=!1,cd=!1;function gb(t){Lr===null?Lr=[t]:Lr.push(t)}function u_(t){oh=!0,gb(t)}function Ki(){if(!cd&&Lr!==null){cd=!0;var t=0,e=_e;try{var n=Lr;for(_e=1;t>=o,i-=o,zr=1<<32-tr(e)+i|n<_?(A=x,x=null):A=x.sibling;var N=h(m,x,v[_],S);if(N===null){x===null&&(x=A);break}t&&x&&N.alternate===null&&e(m,x),g=s(N,g,_),b===null?$=N:b.sibling=N,b=N,x=A}if(_===v.length)return n(m,x),He&&rs(m,_),$;if(x===null){for(;__?(A=x,x=null):A=x.sibling;var V=h(m,x,N.value,S);if(V===null){x===null&&(x=A);break}t&&x&&V.alternate===null&&e(m,x),g=s(V,g,_),b===null?$=V:b.sibling=V,b=V,x=A}if(N.done)return n(m,x),He&&rs(m,_),$;if(x===null){for(;!N.done;_++,N=v.next())N=f(m,N.value,S),N!==null&&(g=s(N,g,_),b===null?$=N:b.sibling=N,b=N);return He&&rs(m,_),$}for(x=r(m,x);!N.done;_++,N=v.next())N=d(x,m,_,N.value,S),N!==null&&(t&&N.alternate!==null&&x.delete(N.key===null?_:N.key),g=s(N,g,_),b===null?$=N:b.sibling=N,b=N);return t&&x.forEach(function(B){return e(m,B)}),He&&rs(m,_),$}function w(m,g,v,S){if(typeof v=="object"&&v!==null&&v.type===eo&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case bu:e:{for(var $=v.key,b=g;b!==null;){if(b.key===$){if($=v.type,$===eo){if(b.tag===7){n(m,b.sibling),g=i(b,v.props.children),g.return=m,m=g;break e}}else if(b.elementType===$||typeof $=="object"&&$!==null&&$.$$typeof===ui&&Rv($)===b.type){n(m,b.sibling),g=i(b,v.props),g.ref=Ol(m,b,v),g.return=m,m=g;break e}n(m,b);break}else e(m,b);b=b.sibling}v.type===eo?(g=Ss(v.props.children,m.mode,S,v.key),g.return=m,m=g):(S=Mc(v.type,v.key,v.props,null,m.mode,S),S.ref=Ol(m,g,v),S.return=m,m=S)}return o(m);case Xs:e:{for(b=v.key;g!==null;){if(g.key===b)if(g.tag===4&&g.stateNode.containerInfo===v.containerInfo&&g.stateNode.implementation===v.implementation){n(m,g.sibling),g=i(g,v.children||[]),g.return=m,m=g;break e}else{n(m,g);break}else e(m,g);g=g.sibling}g=vd(v,m.mode,S),g.return=m,m=g}return o(m);case ui:return b=v._init,w(m,g,b(v._payload),S)}if(Bl(v))return p(m,g,v,S);if(bl(v))return y(m,g,v,S);Nu(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,g!==null&&g.tag===6?(n(m,g.sibling),g=i(g,v),g.return=m,m=g):(n(m,g),g=yd(v,m.mode,S),g.return=m,m=g),o(m)):n(m,g)}return w}var Fo=Cb(!0),$b=Cb(!1),tu={},Mr=qi(tu),_a=qi(tu),Ma=qi(tu);function ms(t){if(t===tu)throw Error(W(174));return t}function zg(t,e){switch(De(Ma,e),De(_a,t),De(Mr,tu),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:pm(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=pm(e,t)}je(Mr),De(Mr,e)}function zo(){je(Mr),je(_a),je(Ma)}function Eb(t){ms(Ma.current);var e=ms(Mr.current),n=pm(e,t.type);e!==n&&(De(_a,t),De(Mr,n))}function jg(t){_a.current===t&&(je(Mr),je(_a))}var qe=qi(0);function ff(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var fd=[];function Bg(){for(var t=0;tn?n:4,t(!0);var r=hd.transition;hd.transition={};try{t(!1),e()}finally{_e=n,hd.transition=r}}function Vb(){return Vn().memoizedState}function d_(t,e,n){var r=Ai(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Wb(t))Hb(e,n);else if(n=Sb(t,e,n,r),n!==null){var i=qt();nr(n,t,r,i),Ub(n,e,r)}}function m_(t,e,n){var r=Ai(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Wb(t))Hb(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,rr(l,o)){var a=e.interleaved;a===null?(i.next=i,Lg(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=Sb(t,e,i,r),n!==null&&(i=qt(),nr(n,t,r,i),Ub(n,e,r))}}function Wb(t){var e=t.alternate;return t===Ke||e!==null&&e===Ke}function Hb(t,e){ra=hf=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Ub(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,xg(t,n)}}var df={readContext:Bn,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useInsertionEffect:At,useLayoutEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useMutableSource:At,useSyncExternalStore:At,useId:At,unstable_isNewReconciler:!1},p_={readContext:Bn,useCallback:function(t,e){return wr().memoizedState=[t,e===void 0?null:e],t},useContext:Bn,useEffect:Lv,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Ec(4194308,4,Lb.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Ec(4194308,4,t,e)},useInsertionEffect:function(t,e){return Ec(4,2,t,e)},useMemo:function(t,e){var n=wr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=wr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=d_.bind(null,Ke,t),[r.memoizedState,t]},useRef:function(t){var e=wr();return t={current:t},e.memoizedState=t},useState:Iv,useDebugValue:qg,useDeferredValue:function(t){return wr().memoizedState=t},useTransition:function(){var t=Iv(!1),e=t[0];return t=h_.bind(null,t[1]),wr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Ke,i=wr();if(He){if(n===void 0)throw Error(W(407));n=n()}else{if(n=e(),vt===null)throw Error(W(349));$s&30||_b(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,Lv(Ab.bind(null,r,s,t),[t]),r.flags|=2048,Na(9,Mb.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=wr(),e=vt.identifierPrefix;if(He){var n=jr,r=zr;n=(r&~(1<<32-tr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Aa++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[kr]=e,t[Ta]=r,Jb(t,e,!1,!1),e.stateNode=t;e:{switch(o=pm(n,r),n){case"dialog":Ie("cancel",t),Ie("close",t),i=r;break;case"iframe":case"object":case"embed":Ie("load",t),i=r;break;case"video":case"audio":for(i=0;ijo&&(e.flags|=128,r=!0,Tl(s,!1),e.lanes=4194304)}else{if(!r)if(t=uf(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Tl(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!He)return Mt(e),null}else 2*it()-s.renderingStartTime>jo&&n!==1073741824&&(e.flags|=128,r=!0,Tl(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=it(),e.sibling=null,n=qe.current,De(qe,r?n&1|2:n&1),e):(Mt(e),null);case 22:case 23:return Jg(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?fn&1073741824&&(Mt(e),e.subtreeFlags&6&&(e.flags|=8192)):Mt(e),null;case 24:return null;case 25:return null}throw Error(W(156,e.tag))}function S_(t,e){switch(Mg(e),e.tag){case 1:return sn(e.type)&&tf(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Fo(),je(rn),je(Lt),jg(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return zg(e),null;case 13:if(je(qe),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(W(340));Io()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return je(qe),null;case 4:return Fo(),null;case 10:return Rg(e.type._context),null;case 22:case 23:return Jg(),null;case 24:return null;default:return null}}var Nu=!1,Dt=!1,k_=typeof WeakSet=="function"?WeakSet:Set,Z=null;function ao(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qe(t,e,r)}else n.current=null}function Vm(t,e,n){try{n()}catch(r){Qe(t,e,r)}}var qv=!1;function b_(t,e){if($m=Jc,t=rb(),_g(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,c=0,f=t,h=null;t:for(;;){for(var d;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(a=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(d=f.firstChild)!==null;)h=f,f=d;for(;;){if(f===t)break t;if(h===n&&++u===i&&(l=o),h===s&&++c===r&&(a=o),(d=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=d}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Em={focusedElem:t,selectionRange:n},Jc=!1,Z=e;Z!==null;)if(e=Z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Z=t;else for(;Z!==null;){e=Z;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var y=p.memoizedProps,w=p.memoizedState,m=e.stateNode,g=m.getSnapshotBeforeUpdate(e.elementType===e.type?y:Gn(e.type,y),w);m.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(S){Qe(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Z=t;break}Z=e.return}return p=qv,qv=!1,p}function ra(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Vm(e,n,s)}i=i.next}while(i!==r)}}function lh(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Wm(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function ex(t){var e=t.alternate;e!==null&&(t.alternate=null,ex(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[kr],delete e[Ta],delete e[_m],delete e[i_],delete e[s_])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function tx(t){return t.tag===5||t.tag===3||t.tag===4}function Kv(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||tx(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Hm(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=ef));else if(r!==4&&(t=t.child,t!==null))for(Hm(t,e,n),t=t.sibling;t!==null;)Hm(t,e,n),t=t.sibling}function Um(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Um(t,e,n),t=t.sibling;t!==null;)Um(t,e,n),t=t.sibling}var wt=null,Yn=!1;function ni(t,e,n){for(n=n.child;n!==null;)nx(t,e,n),n=n.sibling}function nx(t,e,n){if(Or&&typeof Or.onCommitFiberUnmount=="function")try{Or.onCommitFiberUnmount(Xf,n)}catch{}switch(n.tag){case 5:Dt||ao(n,e);case 6:var r=wt,i=Yn;wt=null,ni(t,e,n),wt=r,Yn=i,wt!==null&&(Yn?(t=wt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):wt.removeChild(n.stateNode));break;case 18:wt!==null&&(Yn?(t=wt,n=n.stateNode,t.nodeType===8?ld(t.parentNode,n):t.nodeType===1&&ld(t,n),ba(t)):ld(wt,n.stateNode));break;case 4:r=wt,i=Yn,wt=n.stateNode.containerInfo,Yn=!0,ni(t,e,n),wt=r,Yn=i;break;case 0:case 11:case 14:case 15:if(!Dt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Vm(n,e,o),i=i.next}while(i!==r)}ni(t,e,n);break;case 1:if(!Dt&&(ao(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Qe(n,e,l)}ni(t,e,n);break;case 21:ni(t,e,n);break;case 22:n.mode&1?(Dt=(r=Dt)||n.memoizedState!==null,ni(t,e,n),Dt=r):ni(t,e,n);break;default:ni(t,e,n)}}function Gv(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new k_),e.forEach(function(r){var i=M_.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Wn(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=it()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*C_(r/1960))-r,10t?16:t,vi===null)var r=!1;else{if(t=vi,vi=null,mf=0,$e&6)throw Error(W(331));var i=$e;for($e|=4,Z=t.current;Z!==null;){var s=Z,o=s.child;if(Z.flags&16){var l=s.deletions;if(l!==null){for(var a=0;ait()-Yg?vs(t,0):Gg|=n),on(t,e)}function cx(t,e){e===0&&(t.mode&1?(e=Cu,Cu<<=1,!(Cu&130023424)&&(Cu=4194304)):e=1);var n=Ut();t=Ur(t,e),t!==null&&(Ja(t,e,n),on(t,n))}function A_(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),cx(t,n)}function M_(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(e),cx(t,n)}var fx;fx=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||rn.current)tn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return tn=!1,v_(t,e,n);tn=!!(t.flags&131072)}else tn=!1,He&&e.flags&1048576&&mb(e,sf,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;$c(t,e),t=e.pendingProps;var i=Ro(e,Lt.current);bo(e,n),i=Vg(null,e,r,t,i,n);var s=Wg();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,sn(r)?(s=!0,nf(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Lg(e),i.updater=sh,e.stateNode=i,i._reactInternals=e,Rm(e,r,t,n),e=Fm(null,e,r,!0,s,n)):(e.tag=0,He&&s&&Ag(e),jt(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch($c(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=N_(r),t=Gn(r,t),i){case 0:e=Lm(null,e,r,t,n);break e;case 1:e=Wv(null,e,r,t,n);break e;case 11:e=Bv(null,e,r,t,n);break e;case 14:e=Vv(null,e,r,Gn(r.type,t),n);break e}throw Error(W(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Gn(r,i),Lm(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Gn(r,i),Wv(t,e,r,i,n);case 3:e:{if(Gb(e),t===null)throw Error(W(387));r=e.pendingProps,s=e.memoizedState,i=s.element,vb(t,e),af(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=zo(Error(W(423)),e),e=Hv(t,e,r,n,i);break e}else if(r!==i){i=zo(Error(W(424)),e),e=Hv(t,e,r,n,i);break e}else for(pn=Ti(e.stateNode.containerInfo.firstChild),yn=e,He=!0,Zn=null,n=bb(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Io(),r===i){e=qr(t,e,n);break e}jt(t,e,r,n)}e=e.child}return e;case 5:return xb(e),t===null&&Pm(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,Tm(r,i)?o=null:s!==null&&Tm(r,s)&&(e.flags|=32),Kb(t,e),jt(t,e,o,n),e.child;case 6:return t===null&&Pm(e),null;case 13:return Yb(t,e,n);case 4:return Fg(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Lo(e,null,r,n):jt(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Gn(r,i),Bv(t,e,r,i,n);case 7:return jt(t,e,e.pendingProps,n),e.child;case 8:return jt(t,e,e.pendingProps.children,n),e.child;case 12:return jt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,De(of,r._currentValue),r._currentValue=o,s!==null)if(nr(s.value,o)){if(s.children===i.children&&!rn.current){e=qr(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=jr(-1,n&-n),a.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Nm(s.return,n,e),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(W(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Nm(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}jt(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,bo(e,n),i=jn(i),r=r(i),e.flags|=1,jt(t,e,r,n),e.child;case 14:return r=e.type,i=Gn(r,e.pendingProps),i=Gn(r.type,i),Vv(t,e,r,i,n);case 15:return Ub(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Gn(r,i),$c(t,e),e.tag=1,sn(r)?(t=!0,nf(e)):t=!1,bo(e,n),Sb(e,r,i),Rm(e,r,i,n),Fm(null,e,r,!0,t,n);case 19:return Zb(t,e,n);case 22:return qb(t,e,n)}throw Error(W(156,e.tag))};function hx(t,e){return Fk(t,e)}function P_(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pn(t,e,n,r){return new P_(t,e,n,r)}function Xg(t){return t=t.prototype,!(!t||!t.isReactComponent)}function N_(t){if(typeof t=="function")return Xg(t)?1:0;if(t!=null){if(t=t.$$typeof,t===vg)return 11;if(t===wg)return 14}return 2}function Mi(t,e){var n=t.alternate;return n===null?(n=Pn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Oc(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")Xg(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Xs:return ws(n.children,i,s,e);case yg:o=8,i|=8;break;case sm:return t=Pn(12,n,e,i|2),t.elementType=sm,t.lanes=s,t;case om:return t=Pn(13,n,e,i),t.elementType=om,t.lanes=s,t;case lm:return t=Pn(19,n,e,i),t.elementType=lm,t.lanes=s,t;case kk:return uh(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case wk:o=10;break e;case Sk:o=9;break e;case vg:o=11;break e;case wg:o=14;break e;case ai:o=16,r=null;break e}throw Error(W(130,t==null?t:typeof t,""))}return e=Pn(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function ws(t,e,n,r){return t=Pn(7,t,r,e),t.lanes=n,t}function uh(t,e,n,r){return t=Pn(22,t,r,e),t.elementType=kk,t.lanes=n,t.stateNode={isHidden:!1},t}function pd(t,e,n){return t=Pn(6,t,null,e),t.lanes=n,t}function gd(t,e,n){return e=Pn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function D_(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Zh(0),this.expirationTimes=Zh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zh(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function e0(t,e,n,r,i,s,o,l,a){return t=new D_(t,e,n,l,a),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Pn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lg(s),t}function R_(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gx)}catch(t){console.error(t)}}gx(),mk.exports=kn;var j_=mk.exports,n1=j_;rm.createRoot=n1.createRoot,rm.hydrateRoot=n1.hydrateRoot;const yx=1024;let B_=0,yd=class{constructor(e,n){this.from=e,this.to=n}};class me{constructor(e={}){this.id=B_++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ln.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}me.closedBy=new me({deserialize:t=>t.split(" ")});me.openedBy=new me({deserialize:t=>t.split(" ")});me.group=new me({deserialize:t=>t.split(" ")});me.isolate=new me({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});me.contextHash=new me({perNode:!0});me.lookAhead=new me({perNode:!0});me.mounted=new me({perNode:!0});class yf{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[me.mounted.id]}}const V_=Object.create(null);class ln{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):V_,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new ln(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(me.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(me.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}ln.none=new ln("",Object.create(null),0,8);class i0{constructor(e){this.types=e;for(let n=0;n0;for(let a=this.cursor(o|gt.IncludeAnonymous);;){let u=!1;if(a.from<=s&&a.to>=i&&(!l&&a.type.isAnonymous||n(a)!==!1)){if(a.firstChild())continue;u=!0}for(;u&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:l0(ln.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new at(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new at(ln.none,n,r,i)))}static build(e){return q_(e)}}at.empty=new at(ln.none,[],[],0);class s0{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new s0(this.buffer,this.index)}}class Fi{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return ln.none}toString(){let e=[];for(let n=0;n0));a=o[a+3]);return l}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let l=e,a=0;l=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Da(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?l.length:-1;e!=u;e+=n){let c=l[e],f=a[e]+o.from;if(vx(i,r,f,f+c.length)){if(c instanceof Fi){if(s>.ExcludeBuffers)continue;let h=c.findChild(0,c.buffer.length,n,r-f,i);if(h>-1)return new wi(new W_(o,c,e,f),null,h)}else if(s>.IncludeAnonymous||!c.type.isAnonymous||o0(c)){let h;if(!(s>.IgnoreMounts)&&(h=yf.get(c))&&!h.overlay)return new Ln(h.tree,f,e,o);let d=new Ln(c,f,e,o);return s>.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(n<0?c.children.length-1:0,n,r,i)}}}if(s>.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r>.IgnoreOverlays)&&(i=yf.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:l}of i.overlay)if((n>0?o<=s:o=s:l>s))return new Ln(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function i1(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function Zm(t,e,n=e.length-1){for(let r=t.parent;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class W_{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class wi extends wx{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new wi(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r>.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new wi(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new wi(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new wi(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new at(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Sx(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;sn.from||o.to=e){let l=new Ln(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Da(l,e,n,!1))}}return i?Sx(i):r}class Jm{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ln)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Ln?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r>.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode>.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode>.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let l=r._tree.children[s];if(this.mode>.IncludeAnonymous||l instanceof Fi||!l.type.isAnonymous||o0(l))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i=0;s--){if(s<0)return Zm(this.node,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function o0(t){return t.children.some(e=>e instanceof Fi||!e.type.isAnonymous||o0(e))}function q_(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=yx,reused:s=[],minRepeatType:o=r.types.length}=t,l=Array.isArray(n)?new s0(n,n.length):n,a=r.types,u=0,c=0;function f($,b,x,_,M,N){let{id:V,start:B,end:te,size:Q}=l,fe=c;for(;Q<0;)if(l.next(),Q==-1){let I=s[V];x.push(I),_.push(B-$);return}else if(Q==-3){u=V;return}else if(Q==-4){c=V;return}else throw new RangeError(`Unrecognized record size: ${Q}`);let Ee=a[V],pe,H,Y=B-$;if(te-B<=i&&(H=w(l.pos-b,M))){let I=new Uint16Array(H.size-H.skip),A=l.pos-H.size,F=I.length;for(;l.pos>A;)F=m(H.start,I,F);pe=new Fi(I,te-H.start,r),Y=H.start-$}else{let I=l.pos-Q;l.next();let A=[],F=[],P=V>=o?V:-1,k=0,E=te;for(;l.pos>I;)P>=0&&l.id==P&&l.size>=0?(l.end<=E-i&&(p(A,F,B,k,l.end,E,P,fe),k=A.length,E=l.end),l.next()):N>2500?h(B,I,A,F):f(B,I,A,F,P,N+1);if(P>=0&&k>0&&k-1&&k>0){let L=d(Ee);pe=l0(Ee,A,F,0,A.length,0,te-B,L,L)}else pe=y(Ee,A,F,te-B,fe-te)}x.push(pe),_.push(Y)}function h($,b,x,_){let M=[],N=0,V=-1;for(;l.pos>b;){let{id:B,start:te,end:Q,size:fe}=l;if(fe>4)l.next();else{if(V>-1&&te=0;Q-=3)B[fe++]=M[Q],B[fe++]=M[Q+1]-te,B[fe++]=M[Q+2]-te,B[fe++]=fe;x.push(new Fi(B,M[2]-te,r)),_.push(te-$)}}function d($){return(b,x,_)=>{let M=0,N=b.length-1,V,B;if(N>=0&&(V=b[N])instanceof at){if(!N&&V.type==$&&V.length==_)return V;(B=V.prop(me.lookAhead))&&(M=x[N]+V.length+B)}return y($,b,x,_,M)}}function p($,b,x,_,M,N,V,B){let te=[],Q=[];for(;$.length>_;)te.push($.pop()),Q.push(b.pop()+x-M);$.push(y(r.types[V],te,Q,N-M,B-N)),b.push(M-x)}function y($,b,x,_,M=0,N){if(u){let V=[me.contextHash,u];N=N?[V].concat(N):[V]}if(M>25){let V=[me.lookAhead,M];N=N?[V].concat(N):[V]}return new at($,b,x,_,N)}function w($,b){let x=l.fork(),_=0,M=0,N=0,V=x.end-i,B={size:0,start:0,skip:0};e:for(let te=x.pos-$;x.pos>te;){let Q=x.size;if(x.id==b&&Q>=0){B.size=_,B.start=M,B.skip=N,N+=4,_+=4,x.next();continue}let fe=x.pos-Q;if(Q<0||fe=o?4:0,pe=x.start;for(x.next();x.pos>fe;){if(x.size<0)if(x.size==-3)Ee+=4;else break e;else x.id>=o&&(Ee+=4);x.next()}M=pe,_+=Q,N+=Ee}return(b<0||_==$)&&(B.size=_,B.start=M,B.skip=N),B.size>4?B:void 0}function m($,b,x){let{id:_,start:M,end:N,size:V}=l;if(l.next(),V>=0&&_4){let te=l.pos-(V-4);for(;l.pos>te;)x=m($,b,x)}b[--x]=B,b[--x]=N-$,b[--x]=M-$,b[--x]=_}else V==-3?u=_:V==-4&&(c=_);return x}let g=[],v=[];for(;l.pos>0;)f(t.start||0,t.bufferStart||0,g,v,-1,0);let S=(e=t.length)!==null&&e!==void 0?e:g.length?v[0]+g[0].length:0;return new at(a[t.topID],g.reverse(),v.reverse(),S)}const s1=new WeakMap;function _c(t,e){if(!t.isAnonymous||e instanceof Fi||e.type!=t)return 1;let n=s1.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof at)){n=1;break}n+=_c(t,r)}s1.set(e,n)}return n}function l0(t,e,n,r,i,s,o,l,a){let u=0;for(let p=r;p=c)break;b+=x}if(v==S+1){if(b>c){let x=p[S];d(x.children,x.positions,0,x.children.length,y[S]+g);continue}f.push(p[S])}else{let x=y[v-1]+p[v-1].length-$;f.push(l0(t,p,y,S,v,$,x,null,a))}h.push($+g-s)}}return d(e,n,r,i,0),(l||a)(f,h,o)}class Ss{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Ss(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,u=0;;l++){let c=l=r)for(;o&&o.from=h.from||f<=h.to||u){let d=Math.max(h.from,a)-u,p=Math.min(h.to,f)-u;h=d>=p?null:new Ss(d,p,h.tree,h.offset+u,l>0,!!c)}if(h&&i.push(h),o.to>f)break;o=snew yd(i.from,i.to)):[new yd(0,0)]:[new yd(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class K_{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new me({perNode:!0});var o1={};class vf{constructor(e,n,r,i,s,o,l,a,u,c=0,f){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=u,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new vf(e,[],n,r,r,0,[],0,i?new l1(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=s.dynamicPrecedence(i);if(o&&(this.score+=o),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(i,a)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(n==r)return;if(o.buffer[l-2]>=n){o.buffer[l-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4);this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new vf(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new G_(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;sa&1&&l==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,u=this.stack.length-l*3;if(u>=0&&e.getGoto(this.stack[u],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class l1{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class G_{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class wf{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new wf(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new wf(this.stack,this.pos,this.index)}}function Lu(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class Ac{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const a1=new Ac;class Y_{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=a1,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;sr.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=a1,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class Co{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Z_(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Co.prototype.contextual=Co.prototype.fallback=Co.prototype.extend=!1;Co.prototype.fallback=Co.prototype.extend=!1;function Z_(t,e,n,r,i,s){let o=0,l=1<0){let p=t[d];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||J_(p,e.token.value,i,s))){e.acceptToken(p);break}}let c=e.next,f=0,h=t[o+2];if(e.next<0&&h>f&&t[u+h*3-3]==65535){o=t[u+h*3-1];continue e}for(;f>1,p=u+d+(d<<1),y=t[p],w=t[p+1]||65536;if(c=w)f=d+1;else{o=t[p+2],e.advance();continue e}}break}}function u1(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function J_(t,e,n,r){let i=u1(n,r,e);return i<0||u1(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class Q_{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?c1(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?c1(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(ee)return this.nextStart=o,null;if(s instanceof at){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class X_{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Ac)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let u=0;uf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let h=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!c.extend&&(r=f,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return a&&e.setLookAhead(a),!r&&e.pos==this.stream.end&&(r=new Ac,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Ac,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;se.bufferLength*4?new Q_(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;on)r.push(l);else{if(this.advanceStack(l,r,e))continue;{i||(i=[],s=[]),i.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=i&&nA(i);if(o)return un&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw un&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return un&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,c=u?e.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let h=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(h>-1&&f.length&&(!u||(f.prop(me.contextHash)||0)==c))return e.useNode(f,h),un&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof at)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof at&&f.positions[0]==0)f=d;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),un&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let u=0;ui?n.push(p):r.push(p)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return f1(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),un&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let f=l.split(),h=c;for(let d=0;f.forceReduce()&&d<10&&(un&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));d++)un&&(h=this.stackID(f)+" -> ");for(let d of l.recoverByInsert(a))un&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,r);this.stream.end>l.pos?(u==l.pos&&(u++,a=0),l.recoverByDelete(a,u),un&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),f1(l,r)):(!i||i.scoree.topRules[l][1]),i=[];for(let l=0;l=0)s(c,a,l[u++]);else{let f=l[u+-c];for(let h=-c;h>0;h--)s(l[u++],a,f);u++}}}this.nodeSet=new i0(n.map((l,a)=>ln.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:i[a],top:r.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=yx;let o=Lu(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Co(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new eA(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],l=o&1,a=i[s++];if(l&&r)return a;for(let u=s+(o>>1);s0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Lr(this.data,s+2);else break;i=n(Lr(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Lr(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(Sf.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=h1(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;sr)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}let rA=0;class Sr{constructor(e,n,r){this.set=e,this.base=n,this.modified=r,this.id=rA++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let n=new Sr([],null,[]);if(n.set.push(n),e)for(let r of e.set)n.set.push(r);return n}static defineModifier(){let e=new kf;return n=>n.modified.indexOf(e)>-1?n:kf.get(n.base||n,n.modified.concat(e).sort((r,i)=>r.id-i.id))}}let iA=0;class kf{constructor(){this.instances=[],this.id=iA++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&sA(n,l.modified));if(r)return r;let i=[],s=new Sr(i,e,n);for(let l of n)l.instances.push(s);let o=oA(n);for(let l of e.set)if(!l.modified.length)for(let a of o)i.push(kf.get(l,a));return s}}function sA(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function oA(t){let e=[[]];for(let n=0;nr.length-n.length)}function bx(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,l=i;for(let f=0;;){if(l=="..."&&f>0&&f+3==i.length){o=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!h)throw new RangeError("Invalid path: "+i);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==i.length)break;let d=i[f++];if(f==i.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+i);l=i.slice(f)}let a=s.length-1,u=s[a];if(!u)throw new RangeError("Invalid path: "+i);let c=new bf(r,o,a>0?s.slice(0,a):null);e[u]=c.sort(e[u])}}return xx.add(e)}const xx=new me;class bf{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=i;for(let l of s)for(let a of l.set){let u=n[a.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function lA(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function aA(t,e,n,r=0,i=t.length){let s=new uA(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class uA{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:l,to:a}=e;if(l>=r||a<=n)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let u=i,c=cA(e)||bf.empty,f=lA(s,c.tags);if(f&&(u&&(u+=" "),u+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,l),u),c.opaque)return;let h=e.tree&&e.tree.prop(me.mounted);if(h&&h.overlay){let d=e.node.enter(h.overlay[0].from+l,1),p=this.highlighters.filter(w=>!w.scope||w.scope(h.tree.type)),y=e.firstChild();for(let w=0,m=l;;w++){let g=w=v||!e.nextSibling())););if(!g||v>r)break;m=g.to+l,m>n&&(this.highlightRange(d.cursor(),Math.max(n,g.from+l),Math.min(r,m),"",p),this.startSpan(Math.min(r,m),u))}y&&e.parent()}else if(e.firstChild()){h&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),u)}while(e.nextSibling());e.parent()}}}function cA(t){let e=t.type.prop(xx);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const U=Sr.define,Fu=U(),ci=U(),d1=U(ci),m1=U(ci),fi=U(),zu=U(fi),wd=U(fi),yr=U(),Qi=U(yr),mr=U(),pr=U(),Qm=U(),_l=U(Qm),ju=U(),z={comment:Fu,lineComment:U(Fu),blockComment:U(Fu),docComment:U(Fu),name:ci,variableName:U(ci),typeName:d1,tagName:U(d1),propertyName:m1,attributeName:U(m1),className:U(ci),labelName:U(ci),namespace:U(ci),macroName:U(ci),literal:fi,string:zu,docString:U(zu),character:U(zu),attributeValue:U(zu),number:wd,integer:U(wd),float:U(wd),bool:U(fi),regexp:U(fi),escape:U(fi),color:U(fi),url:U(fi),keyword:mr,self:U(mr),null:U(mr),atom:U(mr),unit:U(mr),modifier:U(mr),operatorKeyword:U(mr),controlKeyword:U(mr),definitionKeyword:U(mr),moduleKeyword:U(mr),operator:pr,derefOperator:U(pr),arithmeticOperator:U(pr),logicOperator:U(pr),bitwiseOperator:U(pr),compareOperator:U(pr),updateOperator:U(pr),definitionOperator:U(pr),typeOperator:U(pr),controlOperator:U(pr),punctuation:Qm,separator:U(Qm),bracket:_l,angleBracket:U(_l),squareBracket:U(_l),paren:U(_l),brace:U(_l),content:yr,heading:Qi,heading1:U(Qi),heading2:U(Qi),heading3:U(Qi),heading4:U(Qi),heading5:U(Qi),heading6:U(Qi),contentSeparator:U(yr),list:U(yr),quote:U(yr),emphasis:U(yr),strong:U(yr),link:U(yr),monospace:U(yr),strikethrough:U(yr),inserted:U(),deleted:U(),changed:U(),invalid:U(),meta:ju,documentMeta:U(ju),annotation:U(ju),processingInstruction:U(ju),definition:Sr.defineModifier(),constant:Sr.defineModifier(),function:Sr.defineModifier(),standard:Sr.defineModifier(),local:Sr.defineModifier(),special:Sr.defineModifier()};Cx([{tag:z.link,class:"tok-link"},{tag:z.heading,class:"tok-heading"},{tag:z.emphasis,class:"tok-emphasis"},{tag:z.strong,class:"tok-strong"},{tag:z.keyword,class:"tok-keyword"},{tag:z.atom,class:"tok-atom"},{tag:z.bool,class:"tok-bool"},{tag:z.url,class:"tok-url"},{tag:z.labelName,class:"tok-labelName"},{tag:z.inserted,class:"tok-inserted"},{tag:z.deleted,class:"tok-deleted"},{tag:z.literal,class:"tok-literal"},{tag:z.string,class:"tok-string"},{tag:z.number,class:"tok-number"},{tag:[z.regexp,z.escape,z.special(z.string)],class:"tok-string2"},{tag:z.variableName,class:"tok-variableName"},{tag:z.local(z.variableName),class:"tok-variableName tok-local"},{tag:z.definition(z.variableName),class:"tok-variableName tok-definition"},{tag:z.special(z.variableName),class:"tok-variableName2"},{tag:z.definition(z.propertyName),class:"tok-propertyName tok-definition"},{tag:z.typeName,class:"tok-typeName"},{tag:z.namespace,class:"tok-namespace"},{tag:z.className,class:"tok-className"},{tag:z.macroName,class:"tok-macroName"},{tag:z.propertyName,class:"tok-propertyName"},{tag:z.operator,class:"tok-operator"},{tag:z.comment,class:"tok-comment"},{tag:z.meta,class:"tok-meta"},{tag:z.invalid,class:"tok-invalid"},{tag:z.punctuation,class:"tok-punctuation"}]);const fA=bx({String:z.string,Number:z.number,"True False":z.bool,PropertyName:z.propertyName,Null:z.null,",":z.separator,"[ ]":z.squareBracket,"{ }":z.brace}),hA=Sf.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!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,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[fA],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~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#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!]~$zOh~~$}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~&yOg~~'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});class Oe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Bo(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),br.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Bo(this,e,n);let r=[];return this.decompose(e,n,r,0),br.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new oa(this),s=new oa(e);for(let o=n,l=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(l+=i.value.length,i.done||l>=r)return!0}}iter(e=1){return new oa(this,e)}iterRange(e,n=this.length){return new $x(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new Ex(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Oe.empty:e.length<=32?new rt(e):br.from(rt.split(e,[]))}}class rt extends Oe{constructor(e,n=dA(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],l=i+o.length;if((n?r:l)>=e)return new mA(i,l,r,o);i=l+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new rt(p1(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),l=Mc(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new rt(l,o.length+s.length));else{let a=l.length>>1;r.push(new rt(l.slice(0,a)),new rt(l.slice(a)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof rt))return super.replace(e,n,r);[e,n]=Bo(this,e,n);let i=Mc(this.text,Mc(r.text,p1(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new rt(i,s):br.from(rt.split(i,[]),s)}sliceString(e,n=this.length,r=` -`){[e,n]=Bo(this,e,n);let i="";for(let s=0,o=0;s<=n&&oe&&o&&(i+=r),es&&(i+=l.slice(Math.max(0,e-s),n-s)),s=a+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new rt(r,i)),r=[],i=-1);return i>-1&&n.push(new rt(r,i)),n}}class br extends Oe{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],l=i+o.length,a=r+o.lines-1;if((n?a:l)>=e)return o.lineInner(e,n,r,i);i=l+1,r=a+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s=o){let u=i&((o<=e?1:0)|(a>=n?2:0));o>=e&&a<=n&&!u?r.push(l):l.decompose(e-o,n-o,r,u)}o=a+1}}replace(e,n,r){if([e,n]=Bo(this,e,n),r.lines=s&&n<=l){let a=o.replace(e-s,n-s,r),u=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>u>>6){let c=this.children.slice();return c[i]=a,new br(c,this.length-(n-e)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` -`){[e,n]=Bo(this,e,n);let i="";for(let s=0,o=0;se&&s&&(i+=r),eo&&(i+=l.sliceString(e-o,n-o,r)),o=a+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof br))return 0;let r=0,[i,s,o,l]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==l)return r;let a=this.children[i],u=e.children[s];if(a!=u)return r+a.scanIdentical(u,n);r+=a.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let d of e)r+=d.lines;if(r<32){let d=[];for(let p of e)p.flatten(d);return new rt(d,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,l=[],a=0,u=-1,c=[];function f(d){let p;if(d.lines>s&&d instanceof br)for(let y of d.children)f(y);else d.lines>o&&(a>o||!a)?(h(),l.push(d)):d instanceof rt&&a&&(p=c[c.length-1])instanceof rt&&d.lines+p.lines<=32?(a+=d.lines,u+=d.length+1,c[c.length-1]=new rt(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>i&&h(),a+=d.lines,u+=d.length+1,c.push(d))}function h(){a!=0&&(l.push(c.length==1?c[0]:br.from(c,u)),u=-1,a=c.length=0)}for(let d of e)f(d);return h(),l.length==1?l[0]:new br(l,n)}}Oe.empty=new rt([""],0);function dA(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Mc(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s=n&&(a>r&&(l=l.slice(0,r-i)),i0?1:(e instanceof rt?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,l=i instanceof rt?i.text.length:i.children.length;if(o==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(i instanceof rt){let a=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,a.length>Math.max(0,e))return this.value=e==0?a:n>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=i.children[o+(n<0?-1:0)];e>a.length?(e-=a.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(n>0?1:(a instanceof rt?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class $x{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new oa(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ex{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Oe.prototype[Symbol.iterator]=function(){return this.iter()},oa.prototype[Symbol.iterator]=$x.prototype[Symbol.iterator]=Ex.prototype[Symbol.iterator]=function(){return this});class mA{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Bo(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}let $o="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(t=>t?parseInt(t,36):1);for(let t=1;t<$o.length;t++)$o[t]+=$o[t-1];function pA(t){for(let e=1;e<$o.length;e+=2)if($o[e]>t)return $o[e-1]<=t;return!1}function g1(t){return t>=127462&&t<=127487}const y1=8205;function $t(t,e,n=!0,r=!0){return(n?Tx:gA)(t,e,r)}function Tx(t,e,n){if(e==t.length)return e;e&&Ox(t.charCodeAt(e))&&_x(t.charCodeAt(e-1))&&e--;let r=kt(t,e);for(e+=An(r);e=0&&g1(kt(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function gA(t,e,n){for(;e>0;){let r=Tx(t,e-2,n);if(r=56320&&t<57344}function _x(t){return t>=55296&&t<56320}function kt(t,e){let n=t.charCodeAt(e);if(!_x(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Ox(r)?(n-55296<<10)+(r-56320)+65536:n}function a0(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function An(t){return t<65536?1:2}const Xm=/\r\n?|\n/;var Vt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(Vt||(Vt={}));class Ar{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return s+(e-i);s+=l}else{if(r!=Vt.Simple&&u>=e&&(r==Vt.TrackDel&&ie||r==Vt.TrackBefore&&ie))return null;if(u>e||u==e&&n<0&&!l)return e==i||n<0?s:s+a;s+=a}i=u}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r=0&&i<=n&&l>=e)return in?"cover":!0;i=l}return!1}toString(){let e="";for(let n=0;n=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ar(e)}static create(e){return new Ar(e)}}class ft extends Ar{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return ep(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return tp(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i=0){n[i]=l,n[i+1]=o;let a=i>>1;for(;r.length0&&Si(r,n,s.text),s.forward(c),l+=c}let u=e[o++];for(;l>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!i.length)return;oh||f<0||h>n)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${n})`);let p=d?typeof d=="string"?Oe.of(d.split(r||Xm)):d:Oe.empty,y=p.length;if(f==h&&y==0)return;fo&&Nt(i,f-o,-1),Nt(i,h-f,y),Si(s,i,p),o=h}}return u(e),a(!l),l}static empty(e){return new ft(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;il&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length=0&&n<=0&&n==t[i+1]?t[i]+=e:e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function Si(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(i,u,s,c,f),i=u,s=c}}}function tp(t,e,n,r=!1){let i=[],s=r?[]:null,o=new Ra(t),l=new Ra(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);Nt(i,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let u=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);u+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||r.length>u),s.forward2(a),o.forward(a)}}}}class Ra{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Oe.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Oe.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ds{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new ds(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return j.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return j.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return j.range(e.anchor,e.head)}static create(e,n,r){return new ds(e,n,r)}}class j{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:j.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new j(e.ranges.map(n=>ds.fromJSON(n)),e.main)}static single(e,n=e){return new j([j.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;ie?8:0)|s)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=e.indexOf(r);for(let i=1;is.head?j.range(a,l):j.range(l,a))}}return new j(e,n)}}function Mx(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let u0=0;class X{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=u0++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new X(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:c0),!!e.static,e.enables)}of(e){return new Pc([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Pc(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Pc(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function c0(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Pc{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=u0++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,u=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?u=!0:((n=e[f.id])!==null&&n!==void 0?n:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=r(f),1},update(f,h){if(a&&h.docChanged||u&&(h.docChanged||h.selection)||np(f,c)){let d=r(f);if(l?!v1(d,f.values[o],i):!i(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,h)=>{let d,p=h.config.address[s];if(p!=null){let y=Cf(h,p);if(this.dependencies.every(w=>w instanceof X?h.facet(w)===f.facet(w):w instanceof _t?h.field(w,!1)==f.field(w,!1):!0)||(l?v1(d=r(f),y,i):i(d=r(f),y)))return f.values[o]=y,0}else d=r(f);return f.values[o]=d,1}}}}function v1(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[a.id]),i=n.map(a=>a.type),s=r.filter(a=>!(a&1)),o=t[e.id]>>1;function l(a){let u=[];for(let c=0;cr===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(w1).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}init(e){return[this,w1.of({field:this,create:e})]}get extension(){return this}}const is={lowest:4,low:3,default:2,high:1,highest:0};function Al(t){return e=>new Px(e,t)}const Qo={highest:Al(is.highest),high:Al(is.high),default:Al(is.default),low:Al(is.low),lowest:Al(is.lowest)};class Px{constructor(e,n){this.inner=e,this.prec=n}}class mh{of(e){return new rp(this,e)}reconfigure(e){return mh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class rp{constructor(e,n){this.compartment=e,this.inner=n}}class xf{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let h of vA(e,n,o))h instanceof _t?i.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let l=Object.create(null),a=[],u=[];for(let h of i)l[h.id]=u.length<<1,u.push(d=>h.slot(d));let c=r==null?void 0:r.config.facets;for(let h in s){let d=s[h],p=d[0].facet,y=c&&c[h]||[];if(d.every(w=>w.type==0))if(l[p.id]=a.length<<1|1,c0(y,d))a.push(r.facet(p));else{let w=p.combine(d.map(m=>m.value));a.push(r&&p.compare(w,r.facet(p))?r.facet(p):w)}else{for(let w of d)w.type==0?(l[w.id]=a.length<<1|1,a.push(w.value)):(l[w.id]=u.length<<1,u.push(m=>w.dynamicSlot(m)));l[p.id]=u.length<<1,u.push(w=>yA(w,p,d))}}let f=u.map(h=>h(l));return new xf(e,o,f,l,a,s)}}function vA(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,l){let a=i.get(o);if(a!=null){if(a<=l)return;let u=r[a].indexOf(o);u>-1&&r[a].splice(u,1),o instanceof rp&&n.delete(o.compartment)}if(i.set(o,l),Array.isArray(o))for(let u of o)s(u,l);else if(o instanceof rp){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,l)}else if(o instanceof Px)s(o.inner,o.prec);else if(o instanceof _t)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Pc)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,is.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(t,is.default),r.reduce((o,l)=>o.concat(l))}function la(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function Cf(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const Nx=X.define(),ip=X.define({combine:t=>t.some(e=>e),static:!0}),Dx=X.define({combine:t=>t.length?t[0]:void 0,static:!0}),Rx=X.define(),Ix=X.define(),Lx=X.define(),Fx=X.define({combine:t=>t.length?t[0]:!1});class Mr{constructor(e,n){this.type=e,this.value=n}static define(){return new wA}}class wA{of(e){return new Mr(this,e)}}class SA{constructor(e){this.map=e}of(e){return new he(this,e)}}class he{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new he(this.type,n)}is(e){return this.type==e}static define(e={}){return new SA(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}he.reconfigure=he.define();he.appendConfig=he.define();class dt{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Mx(r,n.newLength),s.some(l=>l.type==dt.time)||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(e,n,r,i,s,o){return new dt(e,n,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(dt.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}dt.time=Mr.define();dt.userEvent=Mr.define();dt.addToHistory=Mr.define();dt.remote=Mr.define();function kA(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r=t[r]))s=t[r++],o=t[r++];else if(i=0;i--){let s=r[i](t);s instanceof dt?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof dt?t=s[0]:t=jx(e,Eo(s),!1)}return t}function xA(t){let e=t.startState,n=e.facet(Lx),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=zx(r,sp(e,s,t.changes.newLength),!0))}return r==t?t:dt.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const CA=[];function Eo(t){return t==null?CA:Array.isArray(t)?t:[t]}var Ue=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Ue||(Ue={}));const $A=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let op;try{op=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function EA(t){if(op)return op.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||$A.test(n)))return!0}return!1}function TA(t){return e=>{if(!/\S/.test(e))return Ue.Space;if(EA(e))return Ue.Word;for(let n=0;n-1)return Ue.Word;return Ue.Other}}class ke{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;li.set(u,a)),n=null),i.set(l.value.compartment,l.value.extension)):l.is(he.reconfigure)?(n=null,r=l.value):l.is(he.appendConfig)&&(n=null,r=Eo(r).concat(l.value));let s;n?s=e.startState.values.slice():(n=xf.resolve(r,i,this),s=new ke(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,u)=>u.reconfigure(a,this),null).values);let o=e.startState.facet(ip)?e.newSelection:e.newSelection.asSingle();new ke(n,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:j.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Eo(r.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return ke.create({doc:e.doc,selection:j.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=xf.resolve(e.extensions||[],new Map),r=e.doc instanceof Oe?e.doc:Oe.of((e.doc||"").split(n.staticFacet(ke.lineSeparator)||Xm)),i=e.selection?e.selection instanceof j?e.selection:j.single(e.selection.anchor,e.selection.head):j.single(0);return Mx(i,r.length),n.staticFacet(ip)||(i=i.asSingle()),new ke(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(ke.tabSize)}get lineBreak(){return this.facet(ke.lineSeparator)||` -`}get readOnly(){return this.facet(Fx)}phrase(e,...n){for(let r of this.facet(ke.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(Nx))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return TA(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,l=e-r;for(;o>0;){let a=$t(n,o,!1);if(s(n.slice(a,o))!=Ue.Word)break;o=a}for(;lt.length?t[0]:4});ke.lineSeparator=Dx;ke.readOnly=Fx;ke.phrases=X.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});ke.languageData=Nx;ke.changeFilter=Rx;ke.transactionFilter=Ix;ke.transactionExtender=Lx;mh.reconfigure=he.define();function Pr(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Ts{eq(e){return this==e}range(e,n=e){return Ia.create(e,n,this)}}Ts.prototype.startSide=Ts.prototype.endSide=0;Ts.prototype.point=!1;Ts.prototype.mapMode=Vt.TrackDel;class Ia{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new Ia(e,n,r)}}function lp(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class f0{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let o=i,l=s.length;;){if(o==l)return o;let a=o+l>>1,u=s[a]-e||(r?this.value[a].endSide:this.value[a].startSide)-n;if(a==o)return u>=0?o:l;u>=0?l=a:o=a+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sd||h==d&&u.startSide>0&&u.endSide<=0)continue;(d-h||u.endSide-u.startSide)<0||(o<0&&(o=h),u.point&&(l=Math.max(l,d-h)),r.push(u),i.push(h-o),s.push(d-o))}return{mapped:r.length?new f0(i,s,r,l):null,pos:o}}}class Ce{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new Ce(e,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(lp)),this.isEmpty)return n.length?Ce.of(n):this;let l=new Bx(this,null,-1).goto(0),a=0,u=[],c=new zi;for(;l.value||a=0){let f=n[a++];c.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return La.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return La.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=S1(o,l,r),u=new Ml(o,a,s),c=new Ml(l,a,s);r.iterGaps((f,h,d)=>k1(u,f,c,h,d,i)),r.empty&&r.length==0&&k1(u,0,c,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(c=>!c.isEmpty&&n.indexOf(c)<0),o=n.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=S1(s,o),a=new Ml(s,l,0).goto(r),u=new Ml(o,l,0).goto(r);for(;;){if(a.to!=u.to||!ap(a.active,u.active)||a.point&&(!u.point||!a.point.eq(u.point)))return!1;if(a.to>i)return!0;a.next(),u.next()}}static spans(e,n,r,i,s=-1){let o=new Ml(e,null,s).goto(n),l=n,a=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(i.span(l,u,o.active,a),a=o.openEnd(u));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(e,n=!1){let r=new zi;for(let i of e instanceof Ia?[e]:n?OA(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return Ce.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=Ce.empty;i=i.nextLayer)n=new Ce(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}Ce.empty=new Ce([],[],null,-1);function OA(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(lp);e=r}return t}Ce.empty.nextLayer=Ce.empty;class zi{finishChunk(e){this.chunks.push(new f0(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new zi)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Ce.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Ce.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function S1(t,e,n){let r=new Map;for(let s of t)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&i.push(new Bx(o,n,r,s));return i.length==1?i[0]:new La(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)Sd(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)Sd(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Sd(this.heap,0)}}}function Sd(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class Ml{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=La.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Bu(this.active,e),Bu(this.activeTo,e),Bu(this.activeRank,e),this.minActive=b1(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n0;)n++;Vu(this.active,n,r),Vu(this.activeTo,n,i),Vu(this.activeRank,n,s),e&&Vu(e,n,this.cursor.from),this.minActive=b1(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&Bu(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[i]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function k1(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,l=r,a=r-e;for(;;){let u=t.to+a-n.to||t.endSide-n.endSide,c=u<0?t.to+a:n.to,f=Math.min(c,o);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&ap(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,f,t.point,n.point):f>l&&!ap(t.active,n.active)&&s.compareRange(l,f,t.active,n.active),c>o)break;l=c,u<=0&&t.next(),u>=0&&n.next()}}function ap(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function b1(t,e){let n=-1,r=1e9;for(let i=0;i=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=$t(t,i)}return r===!0?-1:t.length}const cp="ͼ",x1=typeof Symbol>"u"?"__"+cp:Symbol.for(cp),fp=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),C1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ji{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,u){let c=[],f=/^@(\w+)\b/.exec(o[0]),h=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))s(d.split(/,\s*/).map(y=>o.map(w=>y.replace(/&/,w))).reduce((y,w)=>y.concat(w)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(i(d),p,c,h)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+p+";")}(c.length||h)&&a.push((r&&!f&&!u?o.map(r):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=C1[x1]||1;return C1[x1]=e+1,cp+e.toString(36)}static mount(e,n,r){let i=e[fp],s=r&&r.nonce;i?s&&i.setNonce(s):i=new _A(e,s),i.mount(Array.isArray(n)?n:[n])}}let $1=new Map;class _A{constructor(e,n){this.root=e;let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=$1.get(r);if(s)return e[fp]=s;this.sheet=new i.CSSStyleSheet,$1.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[fp]=this}mount(e){let n=this.sheet,r=0,i=0;for(let s=0;s-1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,o),n)for(let a=0;a",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},AA=typeof navigator<"u"&&/Mac/.test(navigator.platform),MA=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var bt=0;bt<10;bt++)Bi[48+bt]=Bi[96+bt]=String(bt);for(var bt=1;bt<=24;bt++)Bi[bt+111]="F"+bt;for(var bt=65;bt<=90;bt++)Bi[bt]=String.fromCharCode(bt+32),Fa[bt]=String.fromCharCode(bt);for(var kd in Bi)Fa.hasOwnProperty(kd)||(Fa[kd]=Bi[kd]);function PA(t){var e=AA&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||MA&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Fa:Bi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function $f(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function hp(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function NA(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Nc(t,e){if(!e.anchorNode)return!1;try{return hp(t,e.anchorNode)}catch{return!1}}function Vo(t){return t.nodeType==3?Os(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function aa(t,e,n,r){return n?E1(t,e,n,r,-1)||E1(t,e,n,r,1):!1}function za(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function E1(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Kr(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=za(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?Kr(t):0}else return!1}}function Kr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ph(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function DA(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Vx(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function RA(t,e,n,r,i,s,o,l){let a=t.ownerDocument,u=a.defaultView||window;for(let c=t,f=!1;c&&!f;)if(c.nodeType==1){let h,d=c==a.body,p=1,y=1;if(d)h=DA(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let g=c.getBoundingClientRect();({scaleX:p,scaleY:y}=Vx(c,g)),h={left:g.left,right:g.left+c.clientWidth*p,top:g.top,bottom:g.top+c.clientHeight*y}}let w=0,m=0;if(i=="nearest")e.top0&&e.bottom>h.bottom+m&&(m=e.bottom-h.bottom+m+o)):e.bottom>h.bottom&&(m=e.bottom-h.bottom+o,n<0&&e.top-m0&&e.right>h.right+w&&(w=e.right-h.right+w+s)):e.right>h.right&&(w=e.right-h.right+s,n<0&&e.leftn.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else if(n.nodeType==11)n=n.host;else break;return null}class LA{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?Kr(n):0),r,Math.min(e.focusOffset,r?Kr(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let Hs=null;function Wx(t){if(t.setActive)return t.setActive();if(Hs)return t.focus(Hs);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Hs==null?{get preventScroll(){return Hs={preventScroll:!0},!0}}:void 0),!Hs){Hs=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}class Rt{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new Rt(e.parentNode,za(e),n)}static after(e,n){return new Rt(e.parentNode,za(e)+1,n)}}const h0=[];class ze{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let n=this.posAtStart;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}sync(e,n){if(this.flags&2){let r=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:r.firstChild)){let l=ze.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,n),o.flags&=-8}if(s=i?i.nextSibling:r.firstChild,n&&!n.written&&n.node==r&&s!=o.dom&&(n.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=O1(s);else r.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:r.firstChild,s&&n&&n.node==r&&(n.written=!0);s;)s=O1(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,n),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,n){let r;if(e==this.dom)r=this.dom.childNodes[n];else{let i=Kr(e)==0?0:n==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;i==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?i=-1:i=1),e=s}i<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!ze.get(r);)r=r.nextSibling;if(!r)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,n,r=0){let i=-1,s=-1,o=-1,l=-1;for(let a=0,u=r,c=r;an)return f.domBoundsAround(e,n,u);if(h>=e&&i==-1&&(i=a,s=u),u>n&&f.dom.parentNode==this.dom){o=a,l=c;break}c=h,u=h+f.breakAfter}return{from:s,to:l<0?r+this.length:l,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=h0){this.markDirty();for(let i=e;ithis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function Kx(t,e,n,r,i,s,o,l,a){let{children:u}=t,c=u.length?u[e]:null,f=s.length?s[s.length-1]:null,h=f?f.breakAfter:o;if(!(e==r&&c&&!o&&!h&&s.length<2&&c.merge(n,i,s.length?f:null,n==0,l,a))){if(r0&&(!o&&s.length&&c.merge(n,c.length,s[0],!1,l,0)?c.breakAfter=s.shift().breakAfter:(n2);var ee={mac:M1||/Mac/.test(mn.platform),windows:/Win/.test(mn.platform),linux:/Linux|X11/.test(mn.platform),ie:gh,ie_version:Yx?dp.documentMode||6:pp?+pp[1]:mp?+mp[1]:0,gecko:_1,gecko_version:_1?+(/Firefox\/(\d+)/.exec(mn.userAgent)||[0,0])[1]:0,chrome:!!bd,chrome_version:bd?+bd[1]:0,ios:M1,android:/Android\b/.test(mn.userAgent),webkit:A1,safari:Zx,webkit_version:A1?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:dp.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const jA=256;class Gr extends ze{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,r){return this.flags&8||r&&(!(r instanceof Gr)||this.length-(n-e)+r.length>jA||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new Gr(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new Rt(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return BA(this.dom,e,n)}}class Yr extends ze{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let i of n)i.setParent(this)}setAttrs(e){if(Hx(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,i,s,o){return r&&(!(r instanceof Yr&&r.mark.eq(this.mark))||e&&s<=0||ne&&n.push(r=e&&(i=s),r=a,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new Yr(this.mark,n,o)}domAtPos(e){return Jx(this,e)}coordsAt(e,n){return Xx(this,e,n)}}function BA(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&n<0||e==r&&n>=0?ee.chrome||ee.gecko||(e?(i--,o=1):s=0)?0:l.length-1];return ee.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,u=>u.width)||a),o?ph(a,o<0):a||null}class ki extends ze{static create(e,n,r){return new ki(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=ki.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,i,s,o){return r&&(!(r instanceof ki)||!this.widget.compare(r.widget)||e>0&&s<=0||n0)?Rt.before(this.dom):Rt.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?i.length-1:0;s=i[l],!(e>0?l==0:l==i.length-1||s.top0?Rt.before(this.dom):Rt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Oe.empty}get isHidden(){return!0}}Gr.prototype.children=ki.prototype.children=Wo.prototype.children=h0;function Jx(t,e){let n=t.dom,{children:r}=t,i=0;for(let s=0;is&&e0;s--){let o=r[s-1];if(o.dom.parentNode==n)return o.domAtPos(o.length)}for(let s=i;s0&&e instanceof Yr&&i.length&&(r=i[i.length-1])instanceof Yr&&r.mark.eq(e.mark)?Qx(r,e.children[0],n-1):(i.push(e),e.setParent(t)),t.length+=e.length}function Xx(t,e,n){let r=null,i=-1,s=null,o=-1;function l(u,c){for(let f=0,h=0;f=c&&(d.children.length?l(d,c-h):(!s||s.isHidden&&n>0)&&(p>c||h==p&&d.getSide()>0)?(s=d,o=c-h):(h-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function yp(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function WA(t){let e=Object.create(null);for(let n=0;n0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){d0(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){Qx(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=gp(n,this.attrs||{})),r&&(this.attrs=gp({class:r},this.attrs||{}))}domAtPos(e){return Jx(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(Hx(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(yp(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let i=this.dom.lastChild;for(;i&&ze.get(i)instanceof Yr;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((r=ze.get(i))===null||r===void 0?void 0:r.isEditable)==!1&&(!ee.ios||!this.children.some(s=>s instanceof Gr))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof Gr)||/[^ -~]/.test(r.text))return null;let i=Vo(r.dom);if(i.length!=1)return null;e+=i[0].width,n=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=Xx(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight=n){if(s instanceof ut)return s;if(o>n)break}i=o+s.breakAfter}return null}}class Pi extends ze{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,i,s,o){return r&&(!(r instanceof Pi)||!this.widget.compare(r.widget)||e>0&&s<=0||n0}}class ei{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var qt=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(qt||(qt={}));class oe extends Ts{constructor(e,n,r,i){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new tu(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Vi(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=e2(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new Vi(e,r,i,n,e.widget||null,!0)}static line(e){return new nu(e)}static set(e,n=!1){return Ce.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}oe.none=Ce.empty;class tu extends oe{constructor(e){let{start:n,end:r}=e2(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof tu&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&d0(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}tu.prototype.point=!1;class nu extends oe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof nu&&this.spec.class==e.spec.class&&d0(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}nu.prototype.mapMode=Vt.TrackBefore;nu.prototype.point=!0;class Vi extends oe{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?Vt.TrackBefore:Vt.TrackAfter:Vt.TrackDel}get type(){return this.startSide!=this.endSide?qt.WidgetRange:this.startSide<=0?qt.WidgetBefore:qt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Vi&&HA(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}Vi.prototype.point=!0;function e2(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function HA(t,e){return t==e||!!(t&&e&&t.compare(e))}function vp(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class ua{constructor(e,n,r,i){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Pi&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ut),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Wu(new Wo(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Pi)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(Wu(new Gr(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=0}}span(e,n,r,i){this.buildText(n-e,r,i),this.pos=n,this.openStart<0&&(this.openStart=i)}point(e,n,r,i,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof Vi){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=n-e;if(r instanceof Vi)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Pi(r.widget||new N1("div"),l,r));else{let a=ki.create(r.widget||new N1("span"),l,l?0:r.startSide),u=this.atCursorPos&&!a.isEditable&&s<=i.length&&(e0),c=!a.isEditable&&(ei.length||r.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!u&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),u&&(f.append(Wu(new Wo(1),i),s),s=i.length+Math.max(0,s-i.length)),f.append(Wu(a,i),s),this.atCursorPos=c,this.pendingBuffer=c?ei.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=s)}static build(e,n,r,i,s){let o=new ua(e,n,r,s);return o.openEnd=Ce.spans(i,n,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Wu(t,e){for(let n of e)t=new Yr(n,[t],t.length);return t}class N1 extends ei{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}}var Be=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Be||(Be={}));const _s=Be.LTR,m0=Be.RTL;function t2(t){let e=[];for(let n=0;n=n){if(l.level==r)return o;(s<0||(i!=0?i<0?l.fromn:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function r2(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;y-=3)if(gr[y+1]==-d){let w=gr[y+2],m=w&2?i:w&4?w&1?s:i:0;m&&(Me[f]=Me[gr[y]]=m),l=y;break}}else{if(gr.length==189)break;gr[l++]=f,gr[l++]=h,gr[l++]=a}else if((p=Me[f])==2||p==1){let y=p==i;a=y?0:1;for(let w=l-3;w>=0;w-=3){let m=gr[w+2];if(m&2)break;if(y)gr[w+2]|=2;else{if(m&4)break;gr[w+2]|=4}}}}}function ZA(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,l=ia;)p==w&&(p=n[--y].from,w=y?n[y-1].to:t),Me[--p]=d;a=c}else s=u,a++}}}function Sp(t,e,n,r,i,s,o){let l=r%2?2:1;if(r%2==i%2)for(let a=e,u=0;aa&&o.push(new bi(a,y.from,d));let w=y.direction==_s!=!(d%2);kp(t,w?r+1:r,i,y.inner,y.from,y.to,o),a=y.to}p=y.to}else{if(p==n||(c?Me[p]!=l:Me[p]==l))break;p++}h?Sp(t,a,p,r+1,i,h,o):ae;){let c=!0,f=!1;if(!u||a>s[u-1].to){let y=Me[a-1];y!=l&&(c=!1,f=y==16)}let h=!c&&l==1?[]:null,d=c?r:r+1,p=a;e:for(;;)if(u&&p==s[u-1].to){if(f)break e;let y=s[--u];if(!c)for(let w=y.from,m=u;;){if(w==e)break e;if(m&&s[m-1].to==w)w=s[--m].from;else{if(Me[w-1]==l)break e;break}}if(h)h.push(y);else{y.toMe.length;)Me[Me.length]=256;let r=[],i=e==_s?0:1;return kp(t,i,i,n,0,t.length,r),r}function i2(t){return[new bi(0,t,0)]}let s2="";function QA(t,e,n,r,i){var s;let o=r.head-t.from,l=bi.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=e[l],u=a.side(i,n);if(o==u){let h=l+=i?1:-1;if(h<0||h>=e.length)return null;a=e[l=h],o=a.side(!i,n),u=a.side(i,n)}let c=$t(t.text,o,a.forward(i,n));(ca.to)&&(c=u),s2=t.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return f&&c==u&&f.level+(i?0:1)t.some(e=>e)}),d2=X.define({combine:t=>t.some(e=>e)});class Oo{constructor(e,n="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Oo(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 Oo(j.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Hu=he.define({map:(t,e)=>t.map(e)});function vn(t,e,n){let r=t.facet(u2);r.length?r[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}const yh=X.define({combine:t=>t.length?t[0]:!0});let eM=0;const Wl=X.define();class Xe{constructor(e,n,r,i,s){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=i,this.extension=s(this)}static define(e,n){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=n||{};return new Xe(eM++,e,r,i,l=>{let a=[Wl.of(l)];return o&&a.push(ja.of(u=>{let c=u.plugin(l);return c?o(c):oe.none})),s&&a.push(s(l)),a})}static fromClass(e,n){return Xe.define(r=>new e(r),n)}}class xd{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(vn(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(n){vn(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){vn(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const m2=X.define(),p0=X.define(),ja=X.define(),p2=X.define(),g0=X.define(),g2=X.define();function D1(t,e){let n=t.state.facet(g2);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return Ce.spans(r,e.from,e.to,{point(){},span(s,o,l,a){let u=s-e.from,c=o-e.from,f=i;for(let h=l.length-1;h>=0;h--,a--){let d=l[h].spec.bidiIsolate,p;if(d==null&&(d=XA(e.text,u,c)),a>0&&f.length&&(p=f[f.length-1]).to==u&&p.direction==d)p.to=c,f=p.inner;else{let y={from:u,to:c,direction:d,inner:[]};f.push(y),f=y.inner}}}}),i}const y2=X.define();function v2(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(y2)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const Hl=X.define();class Fn{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new Fn(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toAc)break;s+=2}if(!a)return r;new Fn(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),o=a.toA,l=a.toB}}}class Ef{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=ft.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,l,a)=>i.push(new Fn(s,o,l,a))),this.changedRanges=i}static create(e,n,r){return new Ef(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>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}}class R1 extends ze{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ut],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Fn(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:u,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let i=-1;this.view.inputState.composing>=0&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!lM(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?nM(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:u,to:c}=this.hasComposition;r=new Fn(u,c,e.changes.mapPos(u,-1),e.changes.mapPos(c,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(ee.ie||ee.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=sM(o,l,e.changes);return r=Fn.extendWithRanges(r,a),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=ee.chrome||ee.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||i.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to=0?i[o]:null;if(!l)break;let{fromA:a,toA:u,fromB:c,toB:f}=l,h,d,p,y;if(r&&r.range.fromBc){let S=ua.build(this.view.state.doc,c,r.range.fromB,this.decorations,this.dynamicDecorationMap),$=ua.build(this.view.state.doc,r.range.toB,f,this.decorations,this.dynamicDecorationMap);d=S.breakAtStart,p=S.openStart,y=$.openEnd;let b=this.compositionView(r);$.breakAtStart?b.breakAfter=1:$.content.length&&b.merge(b.length,b.length,$.content[0],!1,$.openStart,0)&&(b.breakAfter=$.content[0].breakAfter,$.content.shift()),S.content.length&&b.merge(0,0,S.content[S.content.length-1],!0,0,S.openEnd)&&S.content.pop(),h=S.content.concat(b).concat($.content)}else({content:h,breakAtStart:d,openStart:p,openEnd:y}=ua.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:w,off:m}=s.findPos(u,1),{i:g,off:v}=s.findPos(a,-1);Kx(this,g,v,w,m,h,d,p,y)}r&&this.fixCompositionDOM(r)}compositionView(e){let n=new Gr(e.text.nodeValue);n.flags|=8;for(let{deco:i}of e.marks)n=new Yr(i,[n],n.length);let r=new ut;return r.append(n,0),r}fixCompositionDOM(e){let n=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=ze.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},r=this.childPos(e.range.fromB,1),i=this.children[r.i];n(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)r=i.childPos(r.off,1),i=i.children[r.i],n(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,i=r==this.dom,s=!i&&Nc(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(i||n||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),u=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(ee.gecko&&l.empty&&!this.hasComposition&&tM(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=u=new Rt(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!aa(a.node,a.offset,c.anchorNode,c.anchorOffset)||!aa(u.node,u.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))&&(this.view.observer.ignore(()=>{ee.android&&ee.chrome&&this.dom.contains(c.focusNode)&&oM(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=$f(this.view.root);if(f)if(l.empty){if(ee.gecko){let h=rM(a.node,a.offset);if(h&&h!=3){let d=S2(a.node,a.offset,h==1?1:-1);d&&(a=new Rt(d.node,d.offset))}}f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(u.node,u.offset)}catch{}}else{let h=document.createRange();l.anchor>l.head&&([a,u]=[u,a]),h.setEnd(u.node,u.offset),h.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(h)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,u)),this.impreciseAnchor=a.precise?null:new Rt(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new Rt(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&aa(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=$f(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=ut.find(this,n.head);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.length)return;let a=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!a||!u||a.bottom>u.top)return;let c=this.domAtPos(n.head+n.assoc);r.collapse(c.node,c.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&r.collapse(i,s)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let i=e.offset;!r&&i=0;i--){let s=ze.get(n.childNodes[i]);s instanceof ut&&(r=s.domAtPos(s.length))}return r?new Rt(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=ze.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;o--){let l=this.children[o],a=s-l.breakAfter,u=a-l.length;if(ae||l.covers(1))&&(!r||l instanceof ut&&!(r instanceof ut&&n>=0))&&(r=l,i=u),s=u}return r?r.coordsAt(e-i,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),i=this.children[n];if(!(i instanceof ut))return null;for(;i.children.length;){let{i:l,off:a}=i.childPos(r,1);for(;;l++){if(l==i.children.length)return null;if((i=i.children[l]).length)break}r=a}if(!(i instanceof Gr))return null;let s=$t(i.text,r);if(s==r)return null;let o=Os(i.dom,r,s).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Be.LTR;for(let u=0,c=0;ci)break;if(u>=r){let d=f.dom.getBoundingClientRect();if(n.push(d.height),o){let p=f.dom.lastChild,y=p?Vo(p):[];if(y.length){let w=y[y.length-1],m=a?w.right-d.left:d.right-w.left;m>l&&(l=m,this.minWidth=s,this.minWidthFrom=u,this.minWidthTo=h)}}}u=h+f.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Be.RTL:Be.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ut){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),n,r,i;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=Vo(e.firstChild)[0];n=e.getBoundingClientRect().height,r=s?s.width/27:7,i=s?s.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new qx(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.length;if(o>r){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(oe.replace({widget:new I1(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return oe.set(e)}updateDeco(){let e=this.view.state.facet(ja).map((i,s)=>(this.dynamicDecorationMap[s]=typeof i=="function")?i(this.view):i),n=!1,r=this.view.state.facet(p2).map((i,s)=>{let o=typeof i=="function";return o&&(n=!0),o?i(this.view):i});r.length&&(this.dynamicDecorationMap[e.length]=n,e.push(Ce.join(r)));for(let i=e.length;in.anchor?-1:1),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=v2(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;RA(this.view.scrollDOM,o,n.head0)r=r.childNodes[i-1],i=Kr(r);else break}if(n>=0)for(let r=t,i=e;;){if(r.nodeType==3)return{node:r,offset:i};if(r.nodeType==1&&i=0)r=r.childNodes[i],i=0;else break}return null}function rM(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function aM(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return j.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,l=s;n<0?o=$t(i.text,s,!1):l=$t(i.text,s);let a=r(i.text.slice(o,l));for(;o>0;){let u=$t(i.text,o,!1);if(r(i.text.slice(u,o))!=a)break;o=u}for(;lt?e.left-t:Math.max(0,t-e.right)}function cM(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function Cd(t,e){return t.tope.top+1}function L1(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function xp(t,e,n){let r,i,s,o,l=!1,a,u,c,f;for(let p=t.firstChild;p;p=p.nextSibling){let y=Vo(p);for(let w=0;wv||o==v&&s>g){r=p,i=m,s=g,o=v;let S=v?n0?w0)}g==0?n>m.bottom&&(!c||c.bottomm.top)&&(u=p,f=m):c&&Cd(c,m)?c=F1(c,m.bottom):f&&Cd(f,m)&&(f=L1(f,m.top))}}if(c&&c.bottom>=n?(r=a,i=c):f&&f.top<=n&&(r=u,i=f),!r)return{node:t,offset:0};let h=Math.max(i.left,Math.min(i.right,e));if(r.nodeType==3)return z1(r,h,n);if(l&&r.contentEditable!="false")return xp(r,h,n);let d=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(i.left+i.right)/2?1:0);return{node:t,offset:d}}function z1(t,e,n){let r=t.nodeValue.length,i=-1,s=1e9,o=0;for(let l=0;ln?c.top-n:n-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=h;if((ee.chrome||ee.gecko)&&Os(t,l).getBoundingClientRect().left==c.right&&(d=!h),f<=0)return{node:t,offset:l+(d?1:0)};i=l+(d?1:0),s=f}}}return{node:t,offset:i>-1?i:o>0?t.nodeValue.length:0}}function k2(t,e,n,r=-1){var i,s;let o=t.contentDOM.getBoundingClientRect(),l=o.top+t.viewState.paddingTop,a,{docHeight:u}=t.viewState,{x:c,y:f}=e,h=f-l;if(h<0)return 0;if(h>u)return t.state.doc.length;for(let S=t.viewState.heightOracle.textHeight/2,$=!1;a=t.elementAtHeight(h),a.type!=qt.Text;)for(;h=r>0?a.bottom+S:a.top-S,!(h>=0&&h<=u);){if($)return n?null:0;$=!0,r=-r}f=l+h;let d=a.from;if(dt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:j1(t,o,a,c,f);let p=t.dom.ownerDocument,y=t.root.elementFromPoint?t.root:p,w=y.elementFromPoint(c,f);w&&!t.contentDOM.contains(w)&&(w=null),w||(c=Math.max(o.left+1,Math.min(o.right-1,c)),w=y.elementFromPoint(c,f),w&&!t.contentDOM.contains(w)&&(w=null));let m,g=-1;if(w&&((i=t.docView.nearest(w))===null||i===void 0?void 0:i.isEditable)!=!1){if(p.caretPositionFromPoint){let S=p.caretPositionFromPoint(c,f);S&&({offsetNode:m,offset:g}=S)}else if(p.caretRangeFromPoint){let S=p.caretRangeFromPoint(c,f);S&&({startContainer:m,startOffset:g}=S,(!t.contentDOM.contains(m)||ee.safari&&fM(m,g,c)||ee.chrome&&hM(m,g,c))&&(m=void 0))}}if(!m||!t.docView.dom.contains(m)){let S=ut.find(t.docView,d);if(!S)return h>a.top+a.height/2?a.to:a.from;({node:m,offset:g}=xp(S.dom,c,f))}let v=t.docView.nearest(m);if(!v)return null;if(v.isWidget&&((s=v.dom)===null||s===void 0?void 0:s.nodeType)==1){let S=v.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,a=Math.floor((i-n.top-(t.defaultLineHeight-l)*.5)/l);s+=a*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+up(o,s,t.state.tabSize)}function fM(t,e,n){let r;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(let i=t.nextSibling;i;i=i.nextSibling)if(i.nodeType!=1||i.nodeName!="BR")return!1;return Os(t,r-1,r).getBoundingClientRect().left>n}function hM(t,e,n){if(e!=0)return!1;for(let i=t;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let r=t.nodeType==1?t.getBoundingClientRect():Os(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function Cp(t,e){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){for(let r of n.type)if(r.to>e||r.to==e&&(r.to==n.to||r.type==qt.Text))return r}return n}function dM(t,e,n,r){let i=Cp(t,e.head),s=!r||i.type!=qt.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),l=t.textDirectionAt(i.from),a=t.posAtCoords({x:n==(l==Be.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return j.cursor(a,n?-1:1)}return j.cursor(n?i.to:i.from,n?-1:1)}function B1(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let l=e,a=null;;){let u=QA(i,s,o,l,n),c=s2;if(!u){if(i.number==(n?t.state.doc.lines:1))return l;c=` -`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),u=t.visualLineSide(i,!n)}if(a){if(!a(c))return l}else{if(!r)return u;a=r(c)}l=u}}function mM(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Ue.Space&&(i=o),i==o}}function pM(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return j.cursor(i,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(i,e.assoc||-1),c=t.documentTop;if(u)o==null&&(o=u.left-a.left),l=s<0?u.top:u.bottom;else{let d=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(i-d.from))),l=(s<0?d.top:d.bottom)+c}let f=a.left+o,h=r??t.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(h+d)*s,y=k2(t,{x:f,y:p},!1,s);if(pa.bottom||(s<0?yi)){let w=t.docView.coordsForChar(y),m=!w||p{if(e>s&&ei(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:j.cursor(r,rnull),ee.gecko&&PM(e.contentDOM.ownerDocument)}handleEvent(e){!CM(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=yM(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()r.keyCode==e.keyCode))&&!e.ctrlKey||vM.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,To(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:ee.safari&&!ee.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}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 V1(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){vn(n.state,i)}}}function yM(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec;if(i&&i.domEventHandlers)for(let s in i.domEventHandlers){let o=i.domEventHandlers[s];o&&n(s).handlers.push(V1(r.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&n(s).observers.push(V1(r.value,o))}}for(let r in rr)n(r).handlers.push(rr[r]);for(let r in ir)n(r).observers.push(ir[r]);return e}const b2=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],vM="dthko",x2=[16,17,18,20,91,92,224,225],Uu=6;function qu(t){return Math.max(0,t)*.7+8}function wM(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class SM{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParent=IA(e.contentDOM),this.atoms=e.state.facet(g0).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(ke.allowMultipleSelections)&&kM(e,n),this.dragging=xM(e,n)&&T2(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var n;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&wM(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let r=0,i=0,s=((n=this.scrollParent)===null||n===void 0?void 0:n.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=v2(this.view);e.clientX-o.left<=s.left+Uu?r=-qu(s.left-e.clientX):e.clientX+o.right>=s.right-Uu&&(r=qu(e.clientX-s.right)),e.clientY-o.top<=s.top+Uu?i=-qu(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-Uu&&(i=qu(e.clientY-s.bottom)),this.setScrollSpeed(r,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let n=null;for(let r=0;rthis.select(this.lastEvent),20)}}function kM(t,e){let n=t.state.facet(o2);return n.length?n[0](e):ee.mac?e.metaKey:e.ctrlKey}function bM(t,e){let n=t.state.facet(l2);return n.length?n[0](e):ee.mac?!e.altKey:!e.ctrlKey}function xM(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=$f(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function CM(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=ze.get(n))&&r.ignoreEvent(e))return!1;return!0}const rr=Object.create(null),ir=Object.create(null),C2=ee.ie&&ee.ie_version<15||ee.ios&&ee.webkit_version<604;function $M(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),$2(t,n.value)},50)}function $2(t,e){let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if($p!=null&&n.selection.ranges.every(a=>a.empty)&&$p==s.toString()){let a=-1;r=n.changeByRange(u=>{let c=n.doc.lineAt(u.from);if(c.from==a)return{range:u};a=c.from;let f=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:c.from,insert:f},range:j.cursor(u.from+f.length)}})}else o?r=n.changeByRange(a=>{let u=s.line(i++);return{changes:{from:a.from,to:a.to,insert:u.text},range:j.cursor(a.from+u.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}ir.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};rr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&(t.inputState.lastEscPress=Date.now()),!1);ir.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};ir.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};rr.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(a2))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=OM(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new SM(t,e,n,r)),r&&t.observer.ignore(()=>Wx(t.contentDOM));let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function W1(t,e,n,r){if(r==1)return j.cursor(e,n);if(r==2)return aM(t.state,e,n);{let i=ut.find(t.docView,e),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return lt>=e.top&&t<=e.bottom,H1=(t,e,n)=>E2(e,n)&&t>=n.left&&t<=n.right;function EM(t,e,n,r){let i=ut.find(t.docView,e);if(!i)return 1;let s=e-i.posAtStart;if(s==0)return 1;if(s==i.length)return-1;let o=i.coordsAt(s,-1);if(o&&H1(n,r,o))return-1;let l=i.coordsAt(s,1);return l&&H1(n,r,l)?1:o&&E2(r,o)?-1:1}function U1(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:EM(t,n,e.clientX,e.clientY)}}const TM=ee.ie&&ee.ie_version<=11;let q1=null,K1=0,G1=0;function T2(t){if(!TM)return t.detail;let e=q1,n=G1;return q1=t,G1=Date.now(),K1=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(K1+1)%3:1}function OM(t,e){let n=U1(t,e),r=T2(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,l){let a=U1(t,s),u,c=W1(t,a.pos,a.bias,r);if(n.pos!=a.pos&&!o){let f=W1(t,n.pos,n.bias,r),h=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=h1&&(u=_M(i,a.pos))?u:l?i.addRange(c):j.create([c])}}}function _M(t,e){for(let n=0;n=e)return j.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}rr.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.nearest(e.target);if(i&&i.isWidget){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=j.range(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(n.from,n.to)),e.dataTransfer.effectAllowed="copyMove"),!1};rr.dragend=t=>(t.inputState.draggedContent=null,!1);function Y1(t,e,n,r){if(!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&bM(t,e)?{from:s.from,to:s.to}:null,l={from:i,insert:n},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(i,-1),head:a.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}rr.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&Y1(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Y1(t,e,r,!0),!0}return!1};rr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=C2?null:e.clipboardData;return n?($2(t,n.getData("text/plain")||n.getData("text/uri-text")),!0):($M(t),!1)};function AM(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function MM(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:e.join(t.lineBreak),ranges:n,linewise:r}}let $p=null;rr.copy=rr.cut=(t,e)=>{let{text:n,ranges:r,linewise:i}=MM(t.state);if(!n&&!i)return!1;$p=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=C2?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(AM(t,n),!1)};const O2=Mr.define();function _2(t,e){let n=[];for(let r of t.facet(f2)){let i=r(t,e);i&&n.push(i)}return n?t.update({effects:n,annotations:O2.of(!0)}):null}function A2(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=_2(t.state,e);n?t.dispatch(n):t.update([])}},10)}ir.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),A2(t)};ir.blur=t=>{t.observer.clearSelectionRange(),A2(t)};ir.compositionstart=ir.compositionupdate=t=>{t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)};ir.compositionend=t=>{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,ee.chrome&&ee.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50)};ir.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};rr.beforeinput=(t,e)=>{var n;let r;if(ee.chrome&&ee.android&&(r=b2.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let i=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return!1};const Z1=new Set;function PM(t){Z1.has(t)||(Z1.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const J1=["pre-wrap","normal","pre-line","break-spaces"];class NM{constructor(e){this.lineWrapping=e,this.doc=Oe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return J1.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,a=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let u=0;u0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,n){this.height!=n&&(Math.abs(this.height-n)>Rc&&(e.heightChanged=!0),this.height=n)}replace(e,n,r){return Kt.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let l=i.length-1;l>=0;l--){let{fromA:a,toA:u,fromB:c,toB:f}=i[l],h=s.lineAt(a,Le.ByPosNoHeight,r.setDoc(n),0,0),d=h.to>=u?h:s.lineAt(u,Le.ByPosNoHeight,r,0,0);for(f+=d.to-u,u=d.to;l>0&&h.from<=i[l-1].toA;)a=i[l-1].fromA,c=i[l-1].fromB,l--,as*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,i-=l.size}else if(s>i*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(i=s&&o(this.blockAt(0,r,i,s))}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class hn extends M2{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,i){return new xr(i,this.length,r,this.height,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof hn||i instanceof St&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof St?i=new hn(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Kt.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setHeight(e,i.heights[i.index++]):(r||this.outdated)&&this.setHeight(e,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 St extends Kt{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:l}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(n,i);if(n.lineWrapping){let u=i+Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length),c=n.doc.lineAt(u),f=l+c.length*a,h=Math.max(r,e-f/2);return new xr(c.from,c.length,h,f,0)}else{let u=Math.max(0,Math.min(o-s,Math.floor((e-r)/l))),{from:c,length:f}=n.doc.line(s+u);return new xr(c,f,r+l*u,l,0)}}lineAt(e,n,r,i,s){if(n==Le.ByHeight)return this.blockAt(e,r,i,s);if(n==Le.ByPosNoHeight){let{from:d,to:p}=r.doc.lineAt(e);return new xr(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),u=r.doc.lineAt(e),c=l+u.length*a,f=u.number-o,h=i+l*f+a*(u.from-s-f);return new xr(u.from,u.length,Math.max(i,Math.min(h,i+this.height-c)),c,0)}forEachLine(e,n,r,i,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:l,perLine:a,perChar:u}=this.heightMetrics(r,s);for(let c=e,f=i;c<=n;){let h=r.doc.lineAt(c);if(c==e){let p=h.number-l;f+=a*p+u*(e-s-p)}let d=a+u*h.length;o(new xr(h.from,h.length,f,d,0)),f+=d,c=h.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let s=r[r.length-1];s instanceof St?r[r.length-1]=new St(s.length+i):r.push(null,new St(i-1))}if(e>0){let s=r[0];s instanceof St?r[0]=new St(e+s.length):r.unshift(new St(e-1),null)}return Kt.of(r)}decomposeLeft(e,n){n.push(new St(e-1),null)}decomposeRight(e,n){n.push(null,new St(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],l=Math.max(n,i.from),a=-1;for(i.from>n&&o.push(new St(i.from-n-1).updateHeight(e,n));l<=s&&i.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=i.heights[i.index++];a==-1?a=f:Math.abs(f-a)>=Rc&&(a=-2);let h=new hn(c,f);h.outdated=!1,o.push(h),l+=c+1}l<=s&&o.push(null,new St(s-l).updateHeight(e,l));let u=Kt.of(o);return(a<0||Math.abs(u.height-this.height)>=Rc||Math.abs(a-this.heightMetrics(e,n).perLine)>=Rc)&&(e.heightChanged=!0),u}else(r||this.outdated)&&(this.setHeight(e,e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class RM extends Kt{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return el))return u;let c=n==Le.ByPosNoHeight?Le.ByPosNoHeight:Le.ByPos;return a?u.join(this.right.lineAt(l,c,r,o,l)):this.left.lineAt(l,c,r,i,s).join(u)}forEachLine(e,n,r,i,s,o){let l=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,n,r,l,a,o);else{let u=this.lineAt(a,Le.ByPos,r,i,s);e=e&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,a,o)}}replace(e,n,r){let i=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of r)s.push(l);if(e>0&&Q1(s,o-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e2*n.size||n.size>2*e.size?Kt.of(this.break?[e,null,n]:[e,n]):(this.left=e,this.right=n,this.height=e.height+n.height,this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,l=n+s.length+this.break,a=null;return i&&i.from<=n+s.length&&i.more?a=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=l+o.length&&i.more?a=o=o.updateHeight(e,l,r,i):o.updateHeight(e,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Q1(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof St&&(r=t[e+1])instanceof St&&t.splice(e-1,3,new St(n.length+1+r.length))}const IM=5;class y0{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof hn?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new hn(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=IM)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new hn(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new St(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof hn)return e;let n=new hn(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof hn)&&!this.isCovered?this.nodes.push(new hn(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let h=c.getBoundingClientRect();s=Math.max(s,h.left),o=Math.min(o,h.right),l=Math.max(l,h.top),a=u==t.parentNode?h.bottom:Math.min(a,h.bottom)}u=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function jM(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ed{constructor(e,n,r){this.from=e,this.to=n,this.size=r}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new NM(n),this.stateDeco=e.facet(ja).filter(r=>typeof r!="function"),this.heightMap=Kt.empty().applyChanges(this.stateDeco,Oe.empty,this.heightOracle.setDoc(e.doc),[new Fn(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=oe.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new Ku(s,o))}}this.viewports=e.sort((r,i)=>r.from-i.from),this.scaler=this.heightMap.height<=7e6?ew:new HM(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:Ul(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(ja).filter(c=>typeof c!="function");let i=e.changedRanges,s=Fn.extendWithRanges(i,LM(r,this.stateDeco,e?e.changes:ft.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,n));let u=!e.changes.empty||e.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),u&&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(),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(d2)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Be.RTL:Be.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=n.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,c=0;if(l.width&&l.height){let{scaleX:S,scaleY:$}=Vx(n,l);(this.scaleX!=S||this.scaleY!=$)&&(this.scaleX=S,this.scaleY=$,u|=8,o=a=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,h=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=h)&&(this.paddingTop=f,this.paddingBottom=h,u|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Ux(e.scrollDOM);let p=(this.printing?jM:zM)(n,this.paddingTop),y=p.top-this.pixelViewport.top,w=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let g=l.width;if((this.contentDOMWidth!=g||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=8),a){let S=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(S)&&(o=!0),o||i.lineWrapping&&Math.abs(g-this.contentDOMWidth)>i.charWidth){let{lineHeight:$,charWidth:b,textHeight:x}=e.docView.measureTextSize();o=$>0&&i.refresh(s,$,b,x,g/b,S),o&&(e.docView.minWidth=0,u|=8)}y>0&&w>0?c=Math.max(y,w):y<0&&w<0&&(c=Math.min(y,w)),i.heightChanged=!1;for(let $ of this.viewports){let b=$.from==this.viewport.from?S:e.docView.measureVisibleLineHeights($);this.heightMap=(o?Kt.empty().applyChanges(this.stateDeco,Oe.empty,this.heightOracle,[new Fn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new DM($.from,b))}i.heightChanged&&(u|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(u&2||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Ku(i.lineAt(o-r*1e3,Le.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,Le.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(ua.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=i.lineAt(u,Le.ByPos,s,0,0),h;n.y=="center"?h=(f.top+f.bottom)/2-c/2:n.y=="start"||n.y=="nearest"&&u=l+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s>1,o=i<<1;if(this.defaultTextDirection!=Be.LTR&&!r)return[];let l=[],a=(u,c,f,h)=>{if(c-uu&&ww.from>=f.from&&w.to<=f.to&&Math.abs(w.from-u)w.fromm));if(!y){if(cw.from<=c&&w.to>=c)){let w=n.moveToLineBoundary(j.cursor(c),!1,!0).head;w>u&&(c=w)}y=new Ed(u,c,this.gapSize(f,u,c,h))}l.push(y)};for(let u of this.viewportLines){if(u.lengthu.from&&a(u.from,h,u,c),dn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];Ce.spans(e,this.viewport.from,this.viewport.to,{span(i,s){n.push({from:i,to:s})},point(){}},20);let r=n.length!=this.visibleRanges.length||this.visibleRanges.some((i,s)=>i.from!=n[s].from||i.to!=n[s].to);return this.visibleRanges=n,r?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Ul(this.heightMap.lineAt(e,Le.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return Ul(this.heightMap.lineAt(this.scaler.fromDOM(e),Le.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Ul(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 Ku{constructor(e,n){this.from=e,this.to=n}}function VM(t,e,n){let r=[],i=t,s=0;return Ce.spans(n,t,e,{span(){},point(o,l){o>i&&(r.push({from:i,to:o}),s+=o-i),i=l}},20),i=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],l=o-s;if(r<=l)return s+r;r-=l}}function Yu(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function WM(t,e){for(let n of t)if(e(n))return n}const ew={toDOM(t){return t},fromDOM(t){return t},scale:1};class HM{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let u=n.lineAt(l,Le.ByPos,e,0,0).top,c=n.lineAt(a,Le.ByPos,e,0,0).bottom;return i+=c-u,{from:l,to:a,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=nUl(i,e)):t._content)}const Zu=X.define({combine:t=>t.join(" ")}),Ep=X.define({combine:t=>t.indexOf(!0)>-1}),Tp=ji.newName(),P2=ji.newName(),N2=ji.newName(),D2={"&light":"."+P2,"&dark":"."+N2};function Op(t,e,n){return new ji(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const UM=Op("."+Tp,{"&":{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},".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:"#444"},".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",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&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},"&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-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"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,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"}},D2),ql="￿";class qM{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(ke.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ql}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==n)break;let l=ze.get(i),a=ze.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:tw(i))||tw(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=i.exec(n))&&(s=l.index,o=l[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(e){if(e.cmIgnore)return;let n=ze.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(KM(e,r.node,r.offset)?n:0))}}function KM(t,e,n){for(;;){if(!e||n-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let l=s||o?[]:JM(e),a=new qM(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=QM(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!hp(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!hp(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((ee.ios||ee.chrome)&&e.state.selection.main.empty&&a!=u&&(c.from>0||c.toDate.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=i.from,u=null;(s===8||ee.android&&e.text.length=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,i.to))}:(ee.mac||ee.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=j.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Oe.of([" "])}):ee.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==` - `&&t.lineWrapping&&(r&&(r=j.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Oe.of([" "])}),n){if(ee.ios&&t.inputState.flushIOSKey()||ee.android&&(n.from==i.from&&n.to==i.to&&n.insert.length==1&&n.insert.lines==2&&To(t.contentDOM,"Enter",13)||(n.from==i.from-1&&n.to==i.to&&n.insert.length==0||s==8&&n.insert.lengthi.head)&&To(t.contentDOM,"Backspace",8)||n.from==i.from&&n.to==i.to+1&&n.insert.length==0&&To(t.contentDOM,"Delete",46)))return!0;let o=n.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l,a=()=>l||(l=YM(t,n,r));return t.state.facet(c2).some(u=>u(t,n.from,n.to,o,a))||t.dispatch(a()),!0}else if(r&&!r.main.eq(i)){let o=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),l=t.inputState.lastSelectionOrigin),t.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function YM(t,e,n){let r,i=t.state,s=i.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=s.frome.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+a))}else{let l=i.changes(e),a=n&&n.main.to<=l.newLength?n.main:void 0;if(i.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let u=t.state.sliceDoc(e.from,e.to),c,f=n&&w2(t,n.main.head);if(f){let p=e.insert.length-(e.to-e.from);c={from:f.from,to:f.to-p}}else c=t.state.doc.lineAt(s.head);let h=s.to-e.to,d=s.to-s.from;r=i.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:l,range:a||p.map(l)};let y=p.to-h,w=y-u.length;if(p.to-p.from!=d||t.state.sliceDoc(w,y)!=u||p.to>=c.from&&p.from<=c.to)return{range:p};let m=i.changes({from:w,to:y,insert:e.insert}),g=p.to-s.to;return{changes:m,range:a?j.range(Math.max(0,a.anchor+g),Math.max(0,a.head+g)):p.map(m)}})}else r={changes:l,selection:a&&i.selection.replaceRange(a)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:o,scrollIntoView:!0})}function ZM(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(r=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o=o?s-n:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-n:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function JM(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new nw(n,r)),(i!=n||s!=r)&&e.push(new nw(i,s))),e}function QM(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?j.single(n+e,r+e):null}const XM={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Td=ee.ie&&ee.ie_version<=11;class eP{constructor(e){this.view=e,this.active=!1,this.selectionRange=new LA,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(ee.ie&&ee.ie_version<=11||ee.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Td&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(yh)?r.root.activeElement!=this.dom:!Nc(r.dom,i))return;let s=i.anchorNode&&r.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(ee.ie&&ee.ie_version<=11||ee.android&&ee.chrome)&&!r.state.selection.main.empty&&i.focusNode&&aa(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=ee.safari&&e.root.nodeType==11&&NA(this.dom.ownerDocument)==this.dom&&tP(this.view)||$f(e.root);if(!n||this.selectionRange.eq(n))return!1;let r=Nc(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&To(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Nc(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new GM(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=R2(this.view,n);return this.view.state==r&&this.view.update([]),i}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=rw(n,e.previousSibling||e.target.previousSibling,-1),i=rw(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),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),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function rw(t,e,n){for(;e;){let r=ze.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function tP(t){let e=null;function n(a){a.preventDefault(),a.stopImmediatePropagation(),e=a.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),!e)return null;let r=e.startContainer,i=e.startOffset,s=e.endContainer,o=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return aa(l.node,l.offset,s,o)&&([r,i,s,o]=[s,o,r,i]),{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}}class G{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.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){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(i=>n(i,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||FA(e.parent)||document,this.viewState=new X1(e.state||ke.create(e)),e.scrollTo&&e.scrollTo.is(Hu)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Wl).map(r=>new xd(r));for(let r of this.plugins)r.update(this);this.observer=new eP(this),this.inputState=new gM(this),this.inputState.ensureHandlers(this.plugins),this.docView=new R1(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let n=e.length==1&&e[0]instanceof dt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,s=this.state;for(let h of e){if(h.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=h.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(h=>h.annotation(O2))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=_2(s,o),a||(l=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(ke.phrases)!=this.state.facet(ke.phrases))return this.setState(s);i=Ef.create(this,s,e),i.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let h of e){if(f&&(f=f.map(h.changes)),h.scrollIntoView){let{main:d}=h.state.selection;f=new Oo(d.empty?d:j.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of h.effects)d.is(Hu)&&(f=d.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=Tf.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Hl)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Zu)!=i.state.facet(Zu)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!i.empty)for(let h of this.state.facet(bp))try{h(i)}catch(d){vn(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!R2(this,c)&&u.force&&To(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new X1(e),this.plugins=e.facet(Wl).map(r=>new xd(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new R1(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Wl),r=e.state.facet(Wl);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new xd(s));else{let l=this.plugins[o];l.mustUpdate=e,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Ux(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(i);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];a&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(d=>{try{return d.read(this)}catch(p){return vn(this.state,p),iw}}),f=Ef.create(this,this.state,[]),h=!1;f.flags|=a,n?n.flags|=a:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),h=this.docView.update(f));for(let d=0;d1||p<-1){i=i+p,r.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(bp))l(n)}get themeClasses(){return Tp+" "+(this.state.facet(Ep)?N2:P2)+" "+this.state.facet(Zu)}updateAttrs(){let e=sw(this,m2,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(yh)?"true":"false",class:"cm-content",style:`${ee.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),sw(this,p0,n);let r=this.observer.ignore(()=>{let i=yp(this.contentDOM,this.contentAttrs,n),s=yp(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(G.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Hl);let e=this.state.facet(G.cspNonce);ji.mount(this.root,this.styleModules.concat(UM).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.spec==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return $d(this,e,B1(this,e,n,r))}moveByGroup(e,n){return $d(this,e,B1(this,e,n,r=>mM(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return j.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return dM(this,e,n,r)}moveVertically(e,n,r){return $d(this,e,pM(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),k2(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[bi.find(s,e-i.from,-1,n)];return ph(r,o.dir==Be.LTR==n>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(h2)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>nP)return i2(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||r2(s.isolates,r=D1(this,e))))return s.order;r||(r=D1(this,e));let i=JA(e.text,n,r);return this.bidiCache.push(new Tf(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ee.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Wx(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(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return Hu.of(new Oo(typeof e=="number"?j.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Hu.of(new Oo(j.cursor(r.from),"start","start",r.top-e,n,!0))}static domEventHandlers(e){return Xe.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Xe.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=ji.newName(),i=[Zu.of(r),Hl.of(Op(`.${r}`,e))];return n&&n.dark&&i.push(Ep.of(!0)),i}static baseTheme(e){return Qo.lowest(Hl.of(Op("."+Tp,e,D2)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&ze.get(r)||ze.get(e);return((n=i==null?void 0:i.rootView)===null||n===void 0?void 0:n.view)||null}}G.styleModule=Hl;G.inputHandler=c2;G.focusChangeEffect=f2;G.perLineTextDirection=h2;G.exceptionSink=u2;G.updateListener=bp;G.editable=yh;G.mouseSelectionStyle=a2;G.dragMovesSelection=l2;G.clickAddsSelectionRange=o2;G.decorations=ja;G.outerDecorations=p2;G.atomicRanges=g0;G.bidiIsolatedRanges=g2;G.scrollMargins=y2;G.darkTheme=Ep;G.cspNonce=X.define({combine:t=>t.length?t[0]:""});G.contentAttributes=p0;G.editorAttributes=m2;G.lineWrapping=G.contentAttributes.of({class:"cm-lineWrapping"});G.announce=he.define();const nP=4096,iw={};class Tf{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Be.LTR;for(let s=Math.max(0,e.length-10);s=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&gp(o,n)}return n}const rP=ee.mac?"mac":ee.windows?"win":ee.linux?"linux":"key";function iP(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,l;for(let a=0;ar.concat(i),[]))),n}function oP(t,e,n){return L2(I2(t.state),e,t,n)}let pi=null;const lP=4e3;function aP(t,e=rP){let n=Object.create(null),r=Object.create(null),i=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,u,c)=>{var f,h;let d=n[o]||(n[o]=Object.create(null)),p=l.split(/ (?!$)/).map(m=>iP(m,e));for(let m=1;m{let S=pi={view:v,prefix:g,scope:o};return setTimeout(()=>{pi==S&&(pi=null)},lP),!0}]})}let y=p.join(" ");i(y,!1);let w=d[y]||(d[y]={preventDefault:!1,stopPropagation:!1,run:((h=(f=d._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});a&&w.run.push(a),u&&(w.preventDefault=!0),c&&(w.stopPropagation=!0)};for(let o of t){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let f in c)c[f].run.push(o.any)}let a=o[e]||o.key;if(a)for(let u of l)s(u,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return n}function L2(t,e,n,r){let i=PA(e),s=kt(i,0),o=An(s)==i.length&&i!=" ",l="",a=!1,u=!1,c=!1;pi&&pi.view==n&&pi.scope==r&&(l=pi.prefix+" ",x2.indexOf(e.keyCode)<0&&(u=!0,pi=null));let f=new Set,h=w=>{if(w){for(let m of w.run)if(!f.has(m)&&(f.add(m),m(n,e)))return w.stopPropagation&&(c=!0),!0;w.preventDefault&&(w.stopPropagation&&(c=!0),u=!0)}return!1},d=t[r],p,y;return d&&(h(d[l+Ju(i,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ee.windows&&e.ctrlKey&&e.altKey)&&(p=Bi[e.keyCode])&&p!=i?(h(d[l+Ju(p,e,!0)])||e.shiftKey&&(y=Fa[e.keyCode])!=i&&y!=p&&h(d[l+Ju(y,e,!1)]))&&(a=!0):o&&e.shiftKey&&h(d[l+Ju(i,e,!0)])&&(a=!0),!a&&h(d._any)&&(a=!0)),u&&(a=!0),a&&c&&e.stopPropagation(),a}class ru{constructor(e,n,r,i,s){this.className=e,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=F2(e);return[new ru(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return uP(e,n,r)}}function F2(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Be.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function lw(t,e,n){let r=j.cursor(e);return{from:Math.max(n.from,t.moveToLineBoundary(r,!1,!0).from),to:Math.min(n.to,t.moveToLineBoundary(r,!0,!0).from),type:qt.Text}}function uP(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),s=t.textDirection==Be.LTR,o=t.contentDOM,l=o.getBoundingClientRect(),a=F2(t),u=o.querySelector(".cm-line"),c=u&&window.getComputedStyle(u),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),h=l.right-(c?parseInt(c.paddingRight):0),d=Cp(t,r),p=Cp(t,i),y=d.type==qt.Text?d:null,w=p.type==qt.Text?p:null;if(y&&(t.lineWrapping||d.widgetLineBreaks)&&(y=lw(t,r,y)),w&&(t.lineWrapping||p.widgetLineBreaks)&&(w=lw(t,i,w)),y&&w&&y.from==w.from)return g(v(n.from,n.to,y));{let $=y?v(n.from,null,y):S(d,!1),b=w?v(null,n.to,w):S(p,!0),x=[];return(y||d).to<(w||p).from-(y&&w?1:0)||d.widgetLineBreaks>1&&$.bottom+t.defaultLineHeight/2B&&Q.from=Ee)break;I>fe&&V(Math.max(Y,fe),$==null&&Y<=B,Math.min(I,Ee),b==null&&I>=te,H.dir)}if(fe=pe.to+1,fe>=Ee)break}return N.length==0&&V(B,$==null,te,b==null,t.textDirection),{top:_,bottom:M,horizontal:N}}function S($,b){let x=l.top+(b?$.top:$.bottom);return{top:x,bottom:x,horizontal:[]}}}function cP(t,e){return t.constructor==e.constructor&&t.eq(e)}class fP{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Ic)!=e.state.facet(Ic)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let n=0,r=e.facet(Ic);for(;n!cP(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ic=X.define();function z2(t){return[Xe.define(e=>new fP(e,t)),Ic.of(t)]}const j2=!ee.ios,Ba=X.define({combine(t){return Pr(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function hP(t={}){return[Ba.of(t),dP,mP,pP,d2.of(!0)]}function B2(t){return t.startState.facet(Ba)!=t.state.facet(Ba)}const dP=z2({above:!0,markers(t){let{state:e}=t,n=e.facet(Ba),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty?!s||j2:n.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:j.cursor(i.head,i.head>i.anchor?-1:1);for(let a of ru.forRange(t,o,l))r.push(a)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=B2(t);return n&&aw(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){aw(e.state,t)},class:"cm-cursorLayer"});function aw(t,e){e.style.animationDuration=t.facet(Ba).cursorBlinkRate+"ms"}const mP=z2({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:ru.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||B2(t)},class:"cm-selectionLayer"}),_p={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};j2&&(_p[".cm-line"].caretColor="transparent !important",_p[".cm-content"]={caretColor:"transparent !important"});const pP=Qo.highest(G.theme(_p)),V2=he.define({map(t,e){return t==null?null:e.mapPos(t)}}),Kl=_t.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(V2)?r.value:n,t)}}),gP=Xe.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Kl);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Kl)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Kl),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Kl)!=t&&this.view.dispatch({effects:V2.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 yP(){return[Kl,gP]}function uw(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)i(o+l.index,l)}function vP(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class wP{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(l,a,u,c)=>i(c,u,u+l[0].length,l,a);else if(typeof r=="function")this.addMatch=(l,a,u,c)=>{let f=r(l,a,u);f&&c(u,u+l[0].length,f)};else if(r)this.addMatch=(l,a,u,c)=>c(u,u+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let n=new zi,r=n.add.bind(n);for(let{from:i,to:s}of vP(e,this.maxLength))uw(e.state.doc,this.regexp,i,s,(o,l)=>this.addMatch(l,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>e.view.viewport.from&&l1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),l=Math.min(s.to,i);if(l>o){let a=e.state.doc.lineAt(o),u=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lh.push(m.range(y,w));if(a==u)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(w,e,y,p));n=n.update({filterFrom:c,filterTo:f,filter:(y,w)=>yf,add:h})}}return n}}const Ap=/x/.unicode!=null?"gu":"g",SP=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Ap),kP={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 Od=null;function bP(){var t;if(Od==null&&typeof document<"u"&&document.body){let e=document.body.style;Od=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Od||!1}const Lc=X.define({combine(t){let e=Pr(t,{render:null,specialChars:SP,addSpecialChars:null});return(e.replaceTabs=!bP())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Ap)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Ap)),e}});function xP(t={}){return[Lc.of(t),CP()]}let cw=null;function CP(){return cw||(cw=Xe.fromClass(class{constructor(t){this.view=t,this.decorations=oe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Lc)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new wP({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=kt(e[0],0);if(s==9){let o=i.lineAt(r),l=n.state.tabSize,a=Xo(o.text,l,r-o.from);return oe.replace({widget:new OP((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=oe.replace({widget:new TP(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Lc);t.startState.facet(Lc)!=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 $P="•";function EP(t){return t>=32?$P:t==10?"␤":String.fromCharCode(9216+t)}class TP extends ei{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=EP(this.code),r=e.state.phrase("Control character")+" "+(kP[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class OP extends ei{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 _P(){return MP}const AP=oe.line({class:"cm-activeLine"}),MP=Xe.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(AP.range(i.from)),e=i.from)}return oe.set(n)}},{decorations:t=>t.decorations});class PP extends ei{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let n=e.firstChild?Vo(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=ph(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function NP(t){return Xe.fromClass(class{constructor(e){this.view=e,this.placeholder=t?oe.set([oe.widget({widget:new PP(t),side:1}).range(0)]):oe.none}get decorations(){return this.view.state.doc.length?oe.none:this.placeholder}},{decorations:e=>e.decorations})}const Mp=2e3;function DP(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>Mp||n.off>Mp||e.col<0||n.col<0){let o=Math.min(e.off,n.off),l=Math.max(e.off,n.off);for(let a=r;a<=i;a++){let u=t.doc.line(a);u.length<=l&&s.push(j.range(u.from+o,u.to+l))}}else{let o=Math.min(e.col,n.col),l=Math.max(e.col,n.col);for(let a=r;a<=i;a++){let u=t.doc.line(a),c=up(u.text,o,t.tabSize,!0);if(c<0)s.push(j.cursor(u.to));else{let f=up(u.text,l,t.tabSize);s.push(j.range(u.from+c,u.from+f))}}}return s}function RP(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function fw(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>Mp?-1:i==r.length?RP(t,e.clientX):Xo(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function IP(t,e){let n=fw(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let l=fw(t,i);if(!l)return r;let a=DP(t.state,n,l);return a.length?o?j.create(a.concat(r.ranges)):j.create(a):r}}:null}function LP(t){let e=(t==null?void 0:t.eventFilter)||(n=>n.altKey&&n.button==0);return G.mouseSelectionStyle.of((n,r)=>e(r)?IP(n,r):null)}const FP={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},zP={style:"cursor: crosshair"};function jP(t={}){let[e,n]=FP[t.key||"Alt"],r=Xe.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,G.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?zP:null})]}const Pl="-10000px";class W2{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=n?[]:null;for(let a=0;an[u]=a),n.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function BP(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const _d=X.define({combine:t=>{var e,n,r;return{position:ee.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||BP}}}),hw=new WeakMap,v0=Xe.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(_d);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 W2(t,w0,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(_d);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.insertBefore(i,r)}return n.dom.style.position=this.position,n.dom.style.top=Pl,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,n=1,r=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(ee.gecko)r=i.offsetParent!=this.container.ownerDocument.body;else if(i.style.top==Pl&&i.style.left=="0px"){let s=i.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,n=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:n}=this.view.viewState);return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map((i,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(_d).tooltipSpace(this.view),scaleX:e,scaleY:n,makeAbsolute:r}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let l=0;l=Math.min(n.bottom,r.bottom)||f.rightMath.min(n.right,r.right)+.1){c.style.top=Pl;continue}let d=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,y=h.right-h.left,w=(e=hw.get(u))!==null&&e!==void 0?e:h.bottom-h.top,m=u.offset||WP,g=this.view.textDirection==Be.LTR,v=h.width>r.right-r.left?g?r.left:r.right-h.width:g?Math.min(f.left-(d?14:0)+m.x,r.right-y):Math.max(r.left,f.left-y+(d?14:0)-m.x),S=this.above[l];!a.strictSide&&(S?f.top-(h.bottom-h.top)-m.yr.bottom)&&S==r.bottom-f.bottom>f.top-r.top&&(S=this.above[l]=!S);let $=(S?f.top-r.top:r.bottom-f.bottom)-p;if($v&&_.topb&&(b=S?_.top-w-2-p:_.bottom+p+2);if(this.position=="absolute"?(c.style.top=(b-t.parent.top)/s+"px",c.style.left=(v-t.parent.left)/i+"px"):(c.style.top=b/s+"px",c.style.left=v/i+"px"),d){let _=f.left+(g?m.x:-m.x)-(v+14-7);d.style.left=_/i+"px"}u.overlap!==!0&&o.push({left:v,top:b,right:x,bottom:b+w}),c.classList.toggle("cm-tooltip-above",S),c.classList.toggle("cm-tooltip-below",!S),u.positioned&&u.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Pl}},{eventObservers:{scroll(){this.maybeMeasure()}}}),VP=G.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),WP={x:0,y:0},w0=X.define({enables:[v0,VP]}),Of=X.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class wh{static create(e){return new wh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new W2(e,Of,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const HP=w0.compute([Of],t=>{let e=t.facet(Of);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:wh.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class UP{constructor(e,n,r,i,s){this.view=e,this.source=n,this.field=r,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||n.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(c=>c.from<=i&&c.to>=i),u=a&&a.dir==Be.RTL?-1:1;s=n.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>vn(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(v0),n=e?e.manager.tooltips.findIndex(r=>r.create==wh.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!qP(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,l=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!KP(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Qu=4;function qP(t,e){let n=t.getBoundingClientRect();return e.clientX>=n.left-Qu&&e.clientX<=n.right+Qu&&e.clientY>=n.top-Qu&&e.clientY<=n.bottom+Qu}function KP(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.righti||Math.min(o.bottom,l)=e&&a<=n}function GP(t,e={}){let n=he.define(),r=_t.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let l of i){let a=s.changes.mapPos(l.pos,-1,Vt.TrackDel);if(a!=null){let u=Object.assign(Object.create(null),l);u.pos=a,u.end!=null&&(u.end=s.changes.mapPos(u.end)),o.push(u)}}i=o}for(let o of s.effects)o.is(n)&&(i=o.value),o.is(YP)&&(i=[]);return i},provide:i=>Of.from(i)});return[r,Xe.define(i=>new UP(i,t,r,n,e.hoverTime||300)),HP]}function H2(t,e){let n=t.plugin(v0);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const YP=he.define(),dw=X.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Va(t,e){let n=t.plugin(U2),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const U2=Xe.fromClass(class{constructor(t){this.input=t.state.facet(Wa),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(dw);this.top=new Xu(t,!0,e.topContainer),this.bottom=new Xu(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(dw);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Xu(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Xu(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Wa);if(n!=this.input){let r=n.filter(a=>a),i=[],s=[],o=[],l=[];for(let a of r){let u=this.specs.indexOf(a),c;u<0?(c=a(t.view),l.push(c)):(c=this.panels[u],c.update&&c.update(t)),i.push(c),(c.top?s:o).push(c)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>G.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Xu{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=mw(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=mw(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function mw(t){let e=t.nextSibling;return t.remove(),e}const Wa=X.define({enables:U2});class Zr extends Ts{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Zr.prototype.elementClass="";Zr.prototype.toDOM=void 0;Zr.prototype.mapMode=Vt.TrackBefore;Zr.prototype.startSide=Zr.prototype.endSide=-1;Zr.prototype.point=!0;const Fc=X.define(),ZP={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ce.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},ca=X.define();function JP(t){return[q2(),ca.of(Object.assign(Object.assign({},ZP),t))]}const Pp=X.define({combine:t=>t.some(e=>e)});function q2(t){let e=[QP];return t&&t.fixed===!1&&e.push(Pp.of(!0)),e}const QP=Xe.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(ca).map(e=>new gw(t,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(Pp),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Pp)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let n=Ce.iter(this.view.state.facet(Fc),this.view.viewport.from),r=[],i=this.gutters.map(s=>new XP(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==qt.Text&&o){Np(n,r,l.from);for(let a of i)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of i)a.widget(this.view,l)}else if(s.type==qt.Text){Np(n,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(ca),n=t.state.facet(ca),r=t.docChanged||t.heightChanged||t.viewportChanged||!Ce.eq(t.startState.facet(Fc),t.state.facet(Fc),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let s of n){let o=e.indexOf(s);o<0?i.push(new gw(this.view,s)):(this.gutters[o].update(t),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>G.scrollMargins.of(e=>{let n=e.plugin(t);return!n||n.gutters.length==0||!n.fixed?null:e.textDirection==Be.LTR?{left:n.dom.offsetWidth*e.scaleX}:{right:n.dom.offsetWidth*e.scaleX}})});function pw(t){return Array.isArray(t)?t:[t]}function Np(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class XP{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Ce.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let l=new K2(e,o,s,r);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(e,o,s,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];Np(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n);r&&this.addElement(e,n,[r])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class gw{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=i.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,l,i)&&i.preventDefault()});this.markers=pw(n.markers(e)),n.initialSpacer&&(this.spacer=new K2(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=pw(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!Ce.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class K2{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),eN(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=ss(l,a,u)||o(l,a,u):o}return r}})}});class Ad extends Zr{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Md(t,e){return t.state.facet(co).formatNumber(e,t.state)}const nN=ca.compute([co],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(tN)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new Ad(Md(e,e.state.doc.lineAt(n.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(co)!=e.state.facet(co),initialSpacer(e){return new Ad(Md(e,yw(e.state.doc.lines)))},updateSpacer(e,n){let r=Md(n.view,yw(n.view.state.doc.lines));return r==e.number?e:new Ad(r)},domEventHandlers:t.facet(co).domEventHandlers}));function rN(t={}){return[co.of(t),q2(),nN]}function yw(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(iN.range(i)))}return Ce.of(e)});function oN(){return sN}var Pd;const fo=new me;function lN(t){return X.define({combine:t?e=>e.concat(t):void 0})}const aN=new me;class Qn{constructor(e,n,r=[],i=""){this.data=e,this.name=i,ke.prototype.hasOwnProperty("tree")||Object.defineProperty(ke.prototype,"tree",{get(){return Ot(this)}}),this.parser=n,this.extension=[Wi.of(this),ke.languageData.of((s,o,l)=>{let a=vw(s,o,l),u=a.type.prop(fo);if(!u)return[];let c=s.facet(u),f=a.type.prop(aN);if(f){let h=a.resolve(o-a.from,l);for(let d of f)if(d.test(h,s)){let p=s.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(r)}isActiveAt(e,n,r=-1){return vw(e,n,r).type.prop(fo)==this.data}findRegions(e){let n=e.facet(Wi);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(fo)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(me.mounted);if(l){if(l.tree.prop(fo)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;ar.isTop?n:void 0)]}),e.name)}configure(e,n){return new _f(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ot(t){let e=t.field(Qn.state,!1);return e?e.tree:at.empty}class uN{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Nl=null;class Af{constructor(e,n,r=[],i,s,o,l,a){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new Af(e,n,[],at.empty,0,r,[],null)}startParse(){return this.parser.startParse(new uN(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=at.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Ss.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Nl;Nl=this;try{return e()}finally{Nl=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=ww(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((u,c,f,h)=>a.push({fromA:u,toA:c,fromB:f,toB:h})),r=Ss.applyChanges(r,a),i=at.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let c=e.mapPos(u.from,1),f=e.mapPos(u.to,-1);ce.from&&(this.fragments=ww(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends kx{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=Nl;if(a){for(let u of i)a.tempSkipped.push(u);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new at(ln.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Nl}}function ww(t,e,n){return Ss.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Ho{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new Ho(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=Af.create(e.facet(Wi).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Ho(r)}}Qn.state=_t.define({create:Ho.init,update(t,e){for(let n of e.effects)if(n.is(Qn.setState))return n.value;return e.startState.facet(Wi)!=e.state.facet(Wi)?Ho.init(e.state):t.apply(e)}});let G2=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(G2=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Nd=typeof navigator<"u"&&(!((Pd=navigator.scheduling)===null||Pd===void 0)&&Pd.isInputPending)?()=>navigator.scheduling.isInputPending():null,cN=Xe.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Qn.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Qn.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=G2(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEndi+1e3,a=s.context.work(()=>Nd&&Nd()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Qn.setState.of(new Ho(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>vn(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Wi=X.define({combine(t){return t.length?t[0]:null},enables:t=>[Qn.state,cN,G.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class fN{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const hN=X.define(),Sh=X.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Mf(t){let e=t.facet(Sh);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Ha(t,e){let n="",r=t.tabSize,i=t.facet(Sh)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s=e?dN(t,n,e):null}class kh{constructor(e,n={}){this.state=e,this.options=n,this.unit=Mf(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return Xo(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Y2=new me;function dN(t,e,n){let r=e.resolveStack(n),i=r.node.enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o!=r.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return Z2(r,t,n)}function Z2(t,e,n){for(let r=t;r;r=r.next){let i=pN(r.node);if(i)return i(k0.create(e,n,r))}return 0}function mN(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function pN(t){let e=t.type.prop(Y2);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(me.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>wN(o,!0,1,void 0,s&&!mN(o)?i.from:void 0)}return t.parent==null?gN:null}function gN(){return 0}class k0 extends kh{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new k0(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(yN(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return Z2(this.context.next,this.base,this.pos)}}function yN(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function vN(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=n.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped)return a.from{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const SN=200;function kN(){return ke.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+SN)return t;let s=n.sliceString(i.from,r);if(!e.some(u=>u.test(s)))return t;let{state:o}=t,l=-1,a=[];for(let{head:u}of o.selection.ranges){let c=o.doc.lineAt(u);if(c.from==l)continue;l=c.from;let f=S0(o,c.from);if(f==null)continue;let h=/^\s*/.exec(c.text)[0],d=Ha(o,f);h!=d&&a.push({from:c.from,to:c.from+h.length,insert:d})}return a.length?[t,{changes:a,sequential:!0}]:t})}const bN=X.define(),J2=new me;function xN(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(s&&l.from=e&&u.to>n&&(s=u)}}return s}function $N(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Pf(t,e,n){for(let r of t.facet(bN)){let i=r(t,e,n);if(i)return i}return CN(t,e,n)}function Q2(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const bh=he.define({map:Q2}),iu=he.define({map:Q2});function X2(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const As=_t.define({create(){return oe.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)if(n.is(bh)&&!EN(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(b0),i=r?oe.replace({widget:new NN(r(e.state,n.value))}):kw;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(iu)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));if(e.selection){let n=!1,{head:r}=e.selection.main;t.between(r,r,(i,s)=>{ir&&(n=!0)}),n&&(t=t.update({filterFrom:r,filterTo:r,filter:(i,s)=>s<=r||i>=r}))}return t},provide:t=>G.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{(!i||i.from>s)&&(i={from:s,to:o})}),i}function EN(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function eC(t,e){return t.field(As,!1)?e:e.concat(he.appendConfig.of(nC()))}const TN=t=>{for(let e of X2(t)){let n=Pf(t.state,e.from,e.to);if(n)return t.dispatch({effects:eC(t.state,[bh.of(n),tC(t,n)])}),!0}return!1},ON=t=>{if(!t.state.field(As,!1))return!1;let e=[];for(let n of X2(t)){let r=Nf(t.state,n.from,n.to);r&&e.push(iu.of(r),tC(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function tC(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return G.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const _N=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(As,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(iu.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},MN=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:TN},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:ON},{key:"Ctrl-Alt-[",run:_N},{key:"Ctrl-Alt-]",run:AN}],PN={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},b0=X.define({combine(t){return Pr(t,PN)}});function nC(t){let e=[As,IN];return t&&e.push(b0.of(t)),e}function rC(t,e){let{state:n}=t,r=n.facet(b0),i=o=>{let l=t.lineBlockAt(t.posAtDOM(o.target)),a=Nf(t.state,l.from,l.to);a&&t.dispatch({effects:iu.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const kw=oe.replace({widget:new class extends ei{toDOM(t){return rC(t,null)}}});class NN extends ei{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return rC(e,this.value)}}const DN={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Dd extends Zr{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function RN(t={}){let e=Object.assign(Object.assign({},DN),t),n=new Dd(e,!0),r=new Dd(e,!1),i=Xe.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Wi)!=o.state.facet(Wi)||o.startState.field(As,!1)!=o.state.field(As,!1)||Ot(o.startState)!=Ot(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new zi;for(let a of o.viewportLineBlocks){let u=Nf(o.state,a.from,a.to)?r:Pf(o.state,a.from,a.to)?n:null;u&&l.add(a.from,a.from,u)}return l.finish()}}),{domEventHandlers:s}=e;return[i,JP({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(i))===null||l===void 0?void 0:l.markers)||Ce.empty},initialSpacer(){return new Dd(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let u=Nf(o.state,l.from,l.to);if(u)return o.dispatch({effects:iu.of(u)}),!0;let c=Pf(o.state,l.from,l.to);return c?(o.dispatch({effects:bh.of(c)}),!0):!1}})}),nC()]}const IN=G.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 su{constructor(e,n){this.specs=e;let r;function i(l){let a=ji.newName();return(r||(r=Object.create(null)))["."+a]=l,a}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof Qn?l=>l.prop(fo)==o.data:o?l=>l==o:void 0,this.style=Cx(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new ji(r):null,this.themeType=n.themeType}static define(e,n){return new su(e,n||{})}}const Dp=X.define(),iC=X.define({combine(t){return t.length?[t[0]]:null}});function Rd(t){let e=t.facet(Dp);return e.length?e:t.facet(iC)}function sC(t,e){let n=[FN],r;return t instanceof su&&(t.module&&n.push(G.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(iC.of(t)):r?n.push(Dp.computeN([G.darkTheme],i=>i.facet(G.darkTheme)==(r=="dark")?[t]:[])):n.push(Dp.of(t)),n}class LN{constructor(e){this.markCache=Object.create(null),this.tree=Ot(e.state),this.decorations=this.buildDeco(e,Rd(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Ot(e.state),r=Rd(e.state),i=r!=Rd(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return oe.none;let r=new zi;for(let{from:i,to:s}of e.visibleRanges)aA(this.tree,n,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=oe.mark({class:a})))},i,s);return r.finish()}}const FN=Qo.high(Xe.fromClass(LN,{decorations:t=>t.decorations})),zN=su.define([{tag:z.meta,color:"#404740"},{tag:z.link,textDecoration:"underline"},{tag:z.heading,textDecoration:"underline",fontWeight:"bold"},{tag:z.emphasis,fontStyle:"italic"},{tag:z.strong,fontWeight:"bold"},{tag:z.strikethrough,textDecoration:"line-through"},{tag:z.keyword,color:"#708"},{tag:[z.atom,z.bool,z.url,z.contentSeparator,z.labelName],color:"#219"},{tag:[z.literal,z.inserted],color:"#164"},{tag:[z.string,z.deleted],color:"#a11"},{tag:[z.regexp,z.escape,z.special(z.string)],color:"#e40"},{tag:z.definition(z.variableName),color:"#00f"},{tag:z.local(z.variableName),color:"#30a"},{tag:[z.typeName,z.namespace],color:"#085"},{tag:z.className,color:"#167"},{tag:[z.special(z.variableName),z.macroName],color:"#256"},{tag:z.definition(z.propertyName),color:"#00c"},{tag:z.comment,color:"#940"},{tag:z.invalid,color:"#f00"}]),jN=G.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),oC=1e4,lC="()[]{}",aC=X.define({combine(t){return Pr(t,{afterCursor:!0,brackets:lC,maxScanDistance:oC,renderMatch:WN})}}),BN=oe.mark({class:"cm-matchingBracket"}),VN=oe.mark({class:"cm-nonmatchingBracket"});function WN(t){let e=[],n=t.matched?BN:VN;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const HN=_t.define({create(){return oe.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(aC);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=$r(e.state,i.head,-1,r)||i.head>0&&$r(e.state,i.head-1,1,r)||r.afterCursor&&($r(e.state,i.head,1,r)||i.headG.decorations.from(t)}),UN=[HN,jN];function qN(t={}){return[aC.of(t),UN]}const KN=new me;function Rp(t,e,n){let r=t.prop(e<0?me.openedBy:me.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function Ip(t){let e=t.type.prop(KN);return e?e(t.node):t}function $r(t,e,n,r={}){let i=r.maxScanDistance||oC,s=r.brackets||lC,o=Ot(t),l=o.resolveInner(e,n);for(let a=l;a;a=a.parent){let u=Rp(a.type,n,s);if(u&&a.from0?e>=c.from&&ec.from&&e<=c.to))return GN(t,e,n,a,c,u,s)}}return YN(t,e,n,o,l.type,i,s)}function GN(t,e,n,r,i,s,o){let l=r.parent,a={from:i.from,to:i.to},u=0,c=l==null?void 0:l.cursor();if(c&&(n<0?c.childBefore(r.from):c.childAfter(r.to)))do if(n<0?c.to<=r.from:c.from>=r.to){if(u==0&&s.indexOf(c.type.name)>-1&&c.from0)return null;let u={from:n<0?e-1:e,to:n>0?e+1:e},c=t.doc.iterRange(e,n>0?t.doc.length:0),f=0;for(let h=0;!c.next().done&&h<=s;){let d=c.value;n<0&&(h+=d.length);let p=e+h*n;for(let y=n>0?0:d.length-1,w=n>0?d.length:-1;y!=w;y+=n){let m=o.indexOf(d[y]);if(!(m<0||r.resolveInner(p+y,1).type!=i))if(m%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:p+y,to:p+y+1},matched:m>>1==a>>1};f--}}n>0&&(h+=d.length)}return c.done?{start:u,matched:!1}:null}const ZN=Object.create(null),bw=[ln.none],xw=[],Cw=Object.create(null),JN=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"]])JN[t]=QN(ZN,e);function Id(t,e){xw.indexOf(t)>-1||(xw.push(t),console.warn(e))}function QN(t,e){let n=[];for(let l of e.split(" ")){let a=[];for(let u of l.split(".")){let c=t[u]||z[u];c?typeof c=="function"?a.length?a=a.map(c):Id(u,`Modifier ${u} used at start of tag`):a.length?Id(u,`Tag ${u} used as modifier`):a=Array.isArray(c)?c:[c]:Id(u,`Unknown highlighting tag ${u}`)}for(let u of a)n.push(u)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),s=Cw[i];if(s)return s.id;let o=Cw[i]=ln.define({id:bw.length,name:r,props:[bx({[r]:n})]});return bw.push(o),o.id}Be.RTL,Be.LTR;const XN=_f.define({name:"json",parser:hA.configure({props:[Y2.add({Object:Sw({except:/^\s*\}/}),Array:Sw({except:/^\s*\]/})}),J2.add({"Object Array":xN})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function eD(){return new fN(XN)}function Lp(){return Lp=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}const nD=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=C0(t.state,n.from);return r.line?rD(t):r.block?sD(t):!1};function x0(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const rD=x0(aD,0),iD=x0(uC,0),sD=x0((t,e)=>uC(t,e,lD(e)),0);function C0(t,e){let n=t.languageDataAt("commentTokens",e);return n.length?n[0]:{}}const Dl=50;function oD(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-Dl,r),o=t.sliceDoc(i,i+Dl),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,u=s.length-l;if(s.slice(u-e.length,u)==e&&o.slice(a,a+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let c,f;i-r<=2*Dl?c=f=t.sliceDoc(r,i):(c=t.sliceDoc(r,r+Dl),f=t.sliceDoc(i-Dl,i));let h=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-n.length;return c.slice(h,h+e.length)==e&&f.slice(p,p+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(c.charAt(h+e.length))?1:0},close:{pos:i-d-n.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function lD(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to),s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function uC(t,e,n=e.selection.ranges){let r=n.map(s=>C0(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>oD(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,l;oi&&(s==o||o>f.from)){i=f.from;let h=/^\s*/.exec(f.text)[0].length,d=h==f.length,p=f.text.slice(h,h+u.length)==u?h:-1;hs.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:u,empty:c,single:f}of r)(f||!c)&&s.push({from:l.from+u,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let u=o.from+l,c=u+a.length;o.text[c-o.from]==" "&&c++,s.push({from:u,to:c})}return{changes:s}}return null}const Fp=Mr.define(),uD=Mr.define(),cD=X.define(),cC=X.define({combine(t){return Pr(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),fC=_t.define({create(){return Er.empty},update(t,e){let n=e.state.facet(cC),r=e.annotation(Fp);if(r){let a=nn.fromTransaction(e,r.selection),u=r.side,c=u==0?t.undone:t.done;return a?c=Df(c,c.length,n.minDepth,a):c=mC(c,e.startState.selection),new Er(u==0?r.rest:c,u==0?c:r.rest)}let i=e.annotation(uD);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(dt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=nn.fromTransaction(e),o=e.annotation(dt.time),l=e.annotation(dt.userEvent);return s?t=t.addChanges(s,o,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,l,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Er(t.done.map(nn.fromJSON),t.undone.map(nn.fromJSON))}});function fD(t={}){return[fC,cC.of(t),G.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?hC:e.inputType=="historyRedo"?zp:null;return r?(e.preventDefault(),r(n)):!1}})]}function xh(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(fC,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const hC=xh(0,!1),zp=xh(1,!1),hD=xh(0,!0),dD=xh(1,!0);class nn{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new nn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new nn(e.changes&&ft.fromJSON(e.changes),[],e.mapped&&Ar.fromJSON(e.mapped),e.startSelection&&j.fromJSON(e.startSelection),e.selectionsAfter.map(j.fromJSON))}static fromTransaction(e,n){let r=Nn;for(let i of e.startState.facet(cD)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new nn(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Nn)}static selection(e){return new nn(void 0,Nn,void 0,void 0,e)}}function Df(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function mD(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,l)=>{for(let a=0;a=u&&o<=c&&(r=!0)}}),r}function pD(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function dC(t,e){return t.length?e.length?t.concat(e):t:e}const Nn=[],gD=200;function mC(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-gD));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Df(t,t.length-1,1e9,n.setSelAfter(r)))}else return[nn.selection([e])]}function yD(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Ld(t,e){if(!t.length)return t;let n=t.length,r=Nn;for(;n;){let i=vD(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[nn.selection(r)]:Nn}function vD(t,e,n){let r=dC(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):Nn,n);if(!t.changes)return nn.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new nn(i,he.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const wD=/^(input\.type|delete)($|\.)/;class Er{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new Er(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||wD.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Ch(n,e))}function Ft(t){return t.textDirectionAt(t.state.selection.main.head)==Be.LTR}const gC=t=>pC(t,!Ft(t)),yC=t=>pC(t,Ft(t));function vC(t,e){return or(t,n=>n.empty?t.moveByGroup(n,e):Ch(n,e))}const kD=t=>vC(t,!Ft(t)),bD=t=>vC(t,Ft(t));function xD(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function $h(t,e,n){let r=Ot(t).resolveInner(e.head),i=n?me.closedBy:me.openedBy;for(let a=e.head;;){let u=n?r.childAfter(a):r.childBefore(a);if(!u)break;xD(t,u,i)?r=u:a=n?u.to:u.from}let s=r.type.prop(i),o,l;return s&&(o=n?$r(t,r.from,1):$r(t,r.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?r.to:r.from,j.cursor(l,n?-1:1)}const CD=t=>or(t,e=>$h(t.state,e,!Ft(t))),$D=t=>or(t,e=>$h(t.state,e,Ft(t)));function wC(t,e){return or(t,n=>{if(!n.empty)return Ch(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const SC=t=>wC(t,!1),kC=t=>wC(t,!0);function bC(t){let e=t.scrollDOM.clientHeighto.empty?t.moveVertically(o,e,n.height):Ch(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>a&&o.bottomxC(t,!1),jp=t=>xC(t,!0);function Ki(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=j.cursor(r.from+s))}return i}const ED=t=>or(t,e=>Ki(t,e,!0)),TD=t=>or(t,e=>Ki(t,e,!1)),OD=t=>or(t,e=>Ki(t,e,!Ft(t))),_D=t=>or(t,e=>Ki(t,e,Ft(t))),AD=t=>or(t,e=>j.cursor(t.lineBlockAt(e.head).from,1)),MD=t=>or(t,e=>j.cursor(t.lineBlockAt(e.head).to,-1));function PD(t,e,n){let r=!1,i=el(t.selection,s=>{let o=$r(t,s.head,-1)||$r(t,s.head,1)||s.head>0&&$r(t,s.head-1,1)||s.headPD(t,e,!1);function Vn(t,e){let n=el(t.state.selection,r=>{let i=e(r);return j.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Nr(t.state,n)),!0)}function CC(t,e){return Vn(t,n=>t.moveByChar(n,e))}const $C=t=>CC(t,!Ft(t)),EC=t=>CC(t,Ft(t));function TC(t,e){return Vn(t,n=>t.moveByGroup(n,e))}const DD=t=>TC(t,!Ft(t)),RD=t=>TC(t,Ft(t)),ID=t=>Vn(t,e=>$h(t.state,e,!Ft(t))),LD=t=>Vn(t,e=>$h(t.state,e,Ft(t)));function OC(t,e){return Vn(t,n=>t.moveVertically(n,e))}const _C=t=>OC(t,!1),AC=t=>OC(t,!0);function MC(t,e){return Vn(t,n=>t.moveVertically(n,e,bC(t).height))}const Ew=t=>MC(t,!1),Tw=t=>MC(t,!0),FD=t=>Vn(t,e=>Ki(t,e,!0)),zD=t=>Vn(t,e=>Ki(t,e,!1)),jD=t=>Vn(t,e=>Ki(t,e,!Ft(t))),BD=t=>Vn(t,e=>Ki(t,e,Ft(t))),VD=t=>Vn(t,e=>j.cursor(t.lineBlockAt(e.head).from)),WD=t=>Vn(t,e=>j.cursor(t.lineBlockAt(e.head).to)),Ow=({state:t,dispatch:e})=>(e(Nr(t,{anchor:0})),!0),_w=({state:t,dispatch:e})=>(e(Nr(t,{anchor:t.doc.length})),!0),Aw=({state:t,dispatch:e})=>(e(Nr(t,{anchor:t.selection.main.anchor,head:0})),!0),Mw=({state:t,dispatch:e})=>(e(Nr(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),HD=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),UD=({state:t,dispatch:e})=>{let n=Eh(t).map(({from:r,to:i})=>j.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:j.create(n),userEvent:"select"})),!0},qD=({state:t,dispatch:e})=>{let n=el(t.selection,r=>{var i;let s=Ot(t).resolveStack(r.from,1);for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&(!((i=l.parent)===null||i===void 0)&&i.parent))return j.range(l.to,l.from)}return r});return e(Nr(t,n)),!0},KD=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=j.create([n.main]):n.main.empty||(r=j.create([j.cursor(n.main.head)])),r?(e(Nr(t,r)),!0):!1};function ou(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);ao&&(n="delete.forward",a=ec(t,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=ec(t,o,!1),l=ec(t,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:j.cursor(o,oi(t)))r.between(e,e,(i,s)=>{ie&&(e=n?s:i)});return e}const PC=(t,e)=>ou(t,n=>{let r=n.from,{state:i}=t,s=i.doc.lineAt(r),o,l;if(!e&&r>s.from&&rPC(t,!1),NC=t=>PC(t,!0),DC=(t,e)=>ou(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let l=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=$t(s.text,r-s.from,e)+s.from,u=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),c=o(u);if(l!=null&&c!=l)break;(u!=" "||r!=n.head)&&(l=c),r=a}return r}),RC=t=>DC(t,!1),GD=t=>DC(t,!0),YD=t=>ou(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headou(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),JD=t=>ou(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Oe.of(["",""])},range:j.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},XD=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:$t(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:$t(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:t.doc.slice(i,l).append(t.doc.slice(o,i))},range:j.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Eh(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function IC(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of Eh(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),l=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let a of s.ranges)i.push(j.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let a of s.ranges)i.push(j.range(a.anchor-l,a.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:j.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const eR=({state:t,dispatch:e})=>IC(t,e,!1),tR=({state:t,dispatch:e})=>IC(t,e,!0);function LC(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of Eh(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const nR=({state:t,dispatch:e})=>LC(t,e,!1),rR=({state:t,dispatch:e})=>LC(t,e,!0),iR=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Eh(e).map(({from:i,to:s})=>(i>0?i--:st.moveVertically(i,!0)).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function sR(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Ot(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(me.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const oR=FC(!1),lR=FC(!0);function FC(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,l=e.doc.lineAt(s),a=!t&&s==o&&sR(e,s);t&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let u=new kh(e,{simulateBreak:s,simulateDoubleBreak:!!a}),c=S0(u,s);for(c==null&&(c=Xo(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));ol.from&&s{let i=[];for(let o=r.from;o<=r.to;){let l=t.doc.lineAt(o);l.number>n&&(r.empty||r.to>l.from)&&(e(l,i,r),n=l.number),o=l.to+1}let s=t.changes(i);return{changes:i,range:j.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const aR=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new kh(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=$0(t,(s,o,l)=>{let a=S0(r,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let u=/^\s*/.exec(s.text)[0],c=Ha(t,a);(u!=c||l.fromt.readOnly?!1:(e(t.update($0(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Sh)})}),{userEvent:"input.indent"})),!0),jC=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update($0(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=Xo(i,t.tabSize),o=0,l=Ha(t,Math.max(0,s-Mf(t)));for(;o({mac:t.key,run:t.run,shift:t.shift}))),fR=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:CD,shift:ID},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:$D,shift:LD},{key:"Alt-ArrowUp",run:eR},{key:"Shift-Alt-ArrowUp",run:nR},{key:"Alt-ArrowDown",run:tR},{key:"Shift-Alt-ArrowDown",run:rR},{key:"Escape",run:KD},{key:"Mod-Enter",run:lR},{key:"Alt-l",mac:"Ctrl-l",run:UD},{key:"Mod-i",run:qD,preventDefault:!0},{key:"Mod-[",run:jC},{key:"Mod-]",run:zC},{key:"Mod-Alt-\\",run:aR},{key:"Shift-Mod-k",run:iR},{key:"Shift-Mod-\\",run:ND},{key:"Mod-/",run:nD},{key:"Alt-A",run:iD}].concat(cR),hR={key:"Tab",run:zC,shift:jC};function Ne(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;et.normalize("NFKD"):t=>t;class Uo{constructor(e,n,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?l=>s(Pw(l)):Pw,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return kt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=a0(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=An(e);let i=this.normalize(n);for(let s=0,o=r;;s++){let l=i.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(a)return this.value=a,this;break}o==r&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=Rf(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||i.to<=n){let l=new _o(n,e.sliceString(n,r));return Fd.set(e,l),l}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this.matchPos=Rf(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=_o.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(WC.prototype[Symbol.iterator]=HC.prototype[Symbol.iterator]=function(){return this});function dR(t){try{return new RegExp(t,E0),!0}catch{return!1}}function Rf(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function Vp(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Ne("input",{class:"cm-textfield",name:"line",value:e}),r=Ne("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),t.dispatch({effects:If.of(!1)}),t.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},Ne("label",t.state.phrase("Go to line"),": ",n)," ",Ne("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!s)return;let{state:o}=t,l=o.doc.lineAt(o.selection.main.head),[,a,u,c,f]=s,h=c?+c.slice(1):0,d=u?+u:l.number;if(u&&f){let w=d/100;a&&(w=w*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*w)}else u&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),y=j.cursor(p.from+Math.max(0,Math.min(h,p.length)));t.dispatch({effects:[If.of(!1),G.scrollIntoView(y.from,{y:"center"})],selection:y}),t.focus()}return{dom:r}}const If=he.define(),Nw=_t.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(If)&&(t=n.value);return t},provide:t=>Wa.from(t,e=>e?Vp:null)}),mR=t=>{let e=Va(t,Vp);if(!e){let n=[If.of(!0)];t.state.field(Nw,!1)==null&&n.push(he.appendConfig.of([Nw,pR])),t.dispatch({effects:n}),e=Va(t,Vp)}return e&&e.dom.querySelector("input").select(),!0},pR=G.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),gR={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},UC=X.define({combine(t){return Pr(t,gR,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function yR(t){let e=[bR,kR];return t&&e.push(UC.of(t)),e}const vR=oe.mark({class:"cm-selectionMatch"}),wR=oe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Dw(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Ue.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Ue.Word)}function SR(t,e,n,r){return t(e.sliceDoc(n,n+1))==Ue.Word&&t(e.sliceDoc(r-1,r))==Ue.Word}const kR=Xe.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(UC),{state:n}=t,r=n.selection;if(r.ranges.length>1)return oe.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return oe.none;let a=n.wordAt(i.head);if(!a)return oe.none;o=n.charCategorizer(i.head),s=n.sliceDoc(a.from,a.to)}else{let a=i.to-i.from;if(a200)return oe.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Dw(o,n,i.from,i.to)&&SR(o,n,i.from,i.to)))return oe.none}else if(s=n.sliceDoc(i.from,i.to),!s)return oe.none}let l=[];for(let a of t.visibleRanges){let u=new Uo(n.doc,s,a.from,a.to);for(;!u.next().done;){let{from:c,to:f}=u.value;if((!o||Dw(o,n,c,f))&&(i.empty&&c<=i.from&&f>=i.to?l.push(wR.range(c,f)):(c>=i.to||f<=i.from)&&l.push(vR.range(c,f)),l.length>e.maxMatches))return oe.none}}return oe.set(l)}},{decorations:t=>t.decorations}),bR=G.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),xR=({state:t,dispatch:e})=>{let{selection:n}=t,r=j.create(n.ranges.map(i=>t.wordAt(i.head)||j.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function CR(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,l=new Uo(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Uo(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=t.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const $R=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return xR({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=CR(t,r);return i?(e(t.update({selection:t.selection.addRange(j.range(i.from,i.to),!1),effects:G.scrollIntoView(i.to)})),!0):!1},tl=X.define({combine(t){return Pr(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new LR(e),scrollToMatch:e=>G.scrollIntoView(e)})}});class qC{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||dR(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` -`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new _R(this):new TR(this)}getCursor(e,n=0,r){let i=e.doc?e:ke.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?Zs(this,i,n,r):Ys(this,i,n,r)}}class KC{constructor(e){this.spec=e}}function Ys(t,e,n,r){return new Uo(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?ER(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function ER(t,e){return(n,r,i,s)=>((s>n||s+i.length=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=Ys(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function Zs(t,e,n,r){return new WC(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?OR(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Lf(t,e){return t.slice($t(t,e,!1),e)}function Ff(t,e){return t.slice(e,$t(t,e))}function OR(t){return(e,n,r)=>!r[0].length||(t(Lf(r.input,r.index))!=Ue.Word||t(Ff(r.input,r.index))!=Ue.Word)&&(t(Ff(r.input,r.index+r[0].length))!=Ue.Word||t(Lf(r.input,r.index+r[0].length))!=Ue.Word)}class _R extends KC{nextMatch(e,n,r){let i=Zs(this.spec,e,r,e.doc.length).next();return i.done&&(i=Zs(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),o=Zs(this.spec,e,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==n||l.from>s+10))return l;if(s==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(n,r)=>r=="$"?"$":r=="&"?e.match[0]:r!="0"&&+r=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=Zs(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Ua=he.define(),T0=he.define(),Ni=_t.define({create(t){return new zd(Wp(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Ua)?t=new zd(n.value.create(),t.panel):n.is(T0)&&(t=new zd(t.query,n.value?O0:null));return t},provide:t=>Wa.from(t,e=>e.panel)});class zd{constructor(e,n){this.query=e,this.panel=n}}const AR=oe.mark({class:"cm-searchMatch"}),MR=oe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),PR=Xe.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Ni))}update(t){let e=t.state.field(Ni);(e!=t.startState.field(Ni)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return oe.none;let{view:n}=this,r=new zi;for(let i=0,s=n.visibleRanges,o=s.length;is[i+1].from-2*250;)a=s[++i].to;t.highlight(n.state,l,a,(u,c)=>{let f=n.state.selection.ranges.some(h=>h.from==u&&h.to==c);r.add(u,c,f?MR:AR)})}return r.finish()}},{decorations:t=>t.decorations});function lu(t){return e=>{let n=e.state.field(Ni,!1);return n&&n.query.spec.valid?t(e,n):ZC(e)}}const zf=lu((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=j.single(r.from,r.to),s=t.state.facet(tl);return t.dispatch({selection:i,effects:[_0(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),YC(t),!0}),jf=lu((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=j.single(i.from,i.to),o=t.state.facet(tl);return t.dispatch({selection:s,effects:[_0(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),YC(t),!0}),NR=lu((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:j.create(n.map(r=>j.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),DR=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],o=0;for(let l=new Uo(t.doc,t.sliceDoc(r,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(j.range(l.value.from,l.value.to))}return e(t.update({selection:j.create(s,o),userEvent:"select.search.matches"})),!0},Rw=lu((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,r,r);if(!s)return!1;let o=[],l,a,u=[];if(s.from==r&&s.to==i&&(a=n.toText(e.getReplacement(s)),o.push({from:s.from,to:s.to,insert:a}),s=e.nextMatch(n,s.from,s.to),u.push(G.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),s){let c=o.length==0||o[0].from>=s.to?0:s.to-s.from-a.length;l=j.single(s.from-c,s.to-c),u.push(_0(t,s)),u.push(n.facet(tl).scrollToMatch(l.main,t))}return t.dispatch({changes:o,selection:l,effects:u,userEvent:"input.replace"}),!0}),RR=lu((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:G.announce.of(r),userEvent:"input.replace.all"}),!0});function O0(t){return t.state.facet(tl).createPanel(t)}function Wp(t,e){var n,r,i,s,o;let l=t.selection.main,a=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!a)return e;let u=t.facet(tl);return new qC({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:u.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:u.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:u.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function GC(t){let e=Va(t,O0);return e&&e.dom.querySelector("[main-field]")}function YC(t){let e=GC(t);e&&e==t.root.activeElement&&e.select()}const ZC=t=>{let e=t.state.field(Ni,!1);if(e&&e.panel){let n=GC(t);if(n&&n!=t.root.activeElement){let r=Wp(t.state,e.query.spec);r.valid&&t.dispatch({effects:Ua.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[T0.of(!0),e?Ua.of(Wp(t.state,e.query.spec)):he.appendConfig.of(zR)]});return!0},JC=t=>{let e=t.state.field(Ni,!1);if(!e||!e.panel)return!1;let n=Va(t,O0);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:T0.of(!1)}),!0},IR=[{key:"Mod-f",run:ZC,scope:"editor search-panel"},{key:"F3",run:zf,shift:jf,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:zf,shift:jf,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:JC,scope:"editor search-panel"},{key:"Mod-Shift-l",run:DR},{key:"Mod-Alt-g",run:mR},{key:"Mod-d",run:$R,preventDefault:!0}];class LR{constructor(e){this.view=e;let n=this.query=e.state.field(Ni).query.spec;this.commit=this.commit.bind(this),this.searchField=Ne("input",{value:n.search,placeholder:cn(e,"Find"),"aria-label":cn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ne("input",{value:n.replace,placeholder:cn(e,"Replace"),"aria-label":cn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ne("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Ne("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Ne("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return Ne("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=Ne("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>zf(e),[cn(e,"next")]),r("prev",()=>jf(e),[cn(e,"previous")]),r("select",()=>NR(e),[cn(e,"all")]),Ne("label",null,[this.caseField,cn(e,"match case")]),Ne("label",null,[this.reField,cn(e,"regexp")]),Ne("label",null,[this.wordField,cn(e,"by word")]),...e.state.readOnly?[]:[Ne("br"),this.replaceField,r("replace",()=>Rw(e),[cn(e,"replace")]),r("replaceAll",()=>RR(e),[cn(e,"replace all")])],Ne("button",{name:"close",onclick:()=>JC(e),"aria-label":cn(e,"close"),type:"button"},["×"])])}commit(){let e=new qC({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:Ua.of(e)}))}keydown(e){oP(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?jf:zf)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Rw(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Ua)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(tl).top}}function cn(t,e){return t.state.phrase(e)}const tc=30,nc=/[\s\.,:;?!]/;function _0(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,s=Math.max(r.from,e-tc),o=Math.min(i,n+tc),l=t.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;al.length-tc;a--)if(!nc.test(l[a-1])&&nc.test(l[a])){l=l.slice(0,a);break}}return G.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${r.number}.`)}const FR=G.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"}}),zR=[Ni,Qo.low(PR),FR];class QC{constructor(e,n,r){this.state=e,this.pos=n,this.explicit=r,this.abortListeners=[]}tokenBefore(e){let n=Ot(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(XC(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n){e=="abort"&&this.abortListeners&&this.abortListeners.push(n)}}function Iw(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function jR(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;stypeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:jR(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}class Lw{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function Di(t){return t.selection.main.from}function XC(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const VR=Mr.define();function WR(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return Object.assign(Object.assign({},t.changeByRange(l=>l!=i&&n!=r&&t.sliceDoc(l.from+s,l.from+o)!=t.sliceDoc(n,r)?{range:l}:{changes:{from:l.from+s,to:r==i.from?l.to:l.from+o,insert:e},range:j.cursor(l.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const Fw=new WeakMap;function HR(t){if(!Array.isArray(t))return t;let e=Fw.get(t);return e||Fw.set(t,e=BR(t)),e}const Bf=he.define(),qa=he.define();class UR{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&$<=57||$>=97&&$<=122?2:$>=65&&$<=90?1:0:(b=a0($))!=b.toLowerCase()?1:b!=b.toUpperCase()?2:0;(!g||x==1&&w||S==0&&x!=0)&&(n[f]==$||r[f]==$&&(h=!0)?o[f++]=g:o.length&&(m=!1)),S=x,g+=An($)}return f==a&&o[0]==0&&m?this.result(-100+(h?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,y]):f==a?this.result(-100+(h?-200:0)+-700+(m?0:-1100),o,e):n.length==2?!1:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let o of n){let l=o+(this.astral?An(kt(r,o)):1);s&&i[s-1]==o?i[s-1]=l:(i[s++]=o,i[s++]=l)}return this.ret(e-r.length,i)}}const Ct=X.define({combine(t){return Pr(t,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:qR,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>zw(e(r),n(r)),optionClass:(e,n)=>r=>zw(e(r),n(r)),addToOptions:(e,n)=>e.concat(n)})}});function zw(t,e){return t?e?t+" "+e:t:e}function qR(t,e,n,r,i,s){let o=t.textDirection==Be.RTL,l=o,a=!1,u="top",c,f,h=e.left-i.left,d=i.right-e.right,p=r.right-r.left,y=r.bottom-r.top;if(l&&h=y||g>e.top?c=n.bottom-e.top:(u="bottom",c=e.bottom-n.top)}let w=(e.bottom-e.top)/s.offsetHeight,m=(e.right-e.left)/s.offsetWidth;return{style:`${u}: ${c/w}px; max-width: ${f/m}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function KR(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=n.displayLabel||n.label,a=0;for(let u=0;ua&&o.appendChild(document.createTextNode(l.slice(a,c)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(l.slice(c,f))),h.className="cm-completionMatchedText",a=f}return an.position-r.position).map(n=>n.render)}function jd(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class GR{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:s,selected:o}=i.open,l=e.state.facet(Ct);this.optionContent=KR(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=jd(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:u}=e.state.field(n).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet(Ct).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:qa.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:l}=r.open;(!i.open||i.open.options!=s)&&(this.range=jd(s.length,o,e.state.facet(Ct).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;if((n.selected>-1&&n.selected=this.range.to)&&(this.range=jd(n.options.length,n.selected,this.view.state.facet(Ct).maxRenderedOptions),this.showOptions(n.options,e.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(r);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,r)}).catch(o=>vn(this.view.state,o,"completion info")):this.addInfoPane(s,r)}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return n&&ZR(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottomr.from||r.from==0))if(s=h,typeof u!="string"&&u.header)i.appendChild(u.header(u));else{let d=i.appendChild(document.createElement("completion-section"));d.textContent=h}}const c=i.appendChild(document.createElement("li"));c.id=n+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let h of this.optionContent){let d=h(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.tonew GR(n,t,e)}function ZR(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function jw(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function JR(t,e){let n=[],r=null,i=a=>{n.push(a);let{section:u}=a.completion;if(u){r||(r=[]);let c=typeof u=="string"?u:u.name;r.some(f=>f.name==c)||r.push(typeof u=="string"?{name:c}:u)}};for(let a of t)if(a.hasResult()){let u=a.result.getMatch;if(a.result.filter===!1)for(let c of a.result.options)i(new Lw(c,a.source,u?u(c):[],1e9-n.length));else{let c=new UR(e.sliceDoc(a.from,a.to));for(let f of a.result.options)if(c.match(f.label)){let h=f.displayLabel?u?u(f,c.matched):[]:c.matched;i(new Lw(f,a.source,h,c.score+(f.boost||0)))}}}if(r){let a=Object.create(null),u=0,c=(f,h)=>{var d,p;return((d=f.rank)!==null&&d!==void 0?d:1e9)-((p=h.rank)!==null&&p!==void 0?p:1e9)||(f.namec.score-u.score||l(u.completion,c.completion))){let u=a.completion;!o||o.label!=u.label||o.detail!=u.detail||o.type!=null&&u.type!=null&&o.type!=u.type||o.apply!=u.apply||o.boost!=u.boost?s.push(a):jw(a.completion)>jw(o)&&(s[s.length-1]=a),o=a.completion}return s}class ho{constructor(e,n,r,i,s,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new ho(this.options,Bw(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s){let o=JR(e,n);if(!o.length)return i&&e.some(a=>a.state==1)?new ho(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let l=n.facet(Ct).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let a=i.options[i.selected].completion;for(let u=0;uu.hasResult()?Math.min(a,u.from):a,1e8),create:nI,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new ho(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class Vf{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Vf(eI,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Ct),s=(r.override||n.languageDataAt("autocomplete",Di(n)).map(HR)).map(l=>(this.active.find(u=>u.source==l)||new Xt(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((l,a)=>l==this.active[a])&&(s=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!QR(s,this.active)?o=ho.build(s,n,this.id,o,r):o&&o.disabled&&!s.some(l=>l.state==1)&&(o=null),!o&&s.every(l=>l.state!=1)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new Xt(l.source,0):l));for(let l of e.effects)l.is(t$)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new Vf(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:XR}}function QR(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const eI=[];function Hp(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class Xt{constructor(e,n,r=-1){this.source=e,this.state=n,this.explicitPos=r}hasResult(){return!1}update(e,n){let r=Hp(e),i=this;r?i=i.handleUserEvent(e,r,n):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new Xt(i.source,0));for(let s of e.effects)if(s.is(Bf))i=new Xt(i.source,1,s.value?Di(e.state):-1);else if(s.is(qa))i=new Xt(i.source,0);else if(s.is(e$))for(let o of s.value)o.source==i.source&&(i=o);return i}handleUserEvent(e,n,r){return n=="delete"||!r.activateOnTyping?this.map(e.changes):new Xt(this.source,1)}handleChange(e){return e.changes.touchesRange(Di(e.startState))?new Xt(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new Xt(this.source,this.state,e.mapPos(this.explicitPos))}}class Ao extends Xt{constructor(e,n,r,i,s){super(e,2,n),this.result=r,this.from=i,this.to=s}hasResult(){return!0}handleUserEvent(e,n,r){var i;let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Di(e.state);if((this.explicitPos<0?l<=s:lo||n=="delete"&&Di(e.startState)==this.from)return new Xt(this.source,n=="input"&&r.activateOnTyping?1:0);let a=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),u;return tI(this.result.validFor,e.state,s,o)?new Ao(this.source,a,this.result,s,o):this.result.update&&(u=this.result.update(this.result,s,o,new QC(e.state,l,a>=0)))?new Ao(this.source,a,u,u.from,(i=u.to)!==null&&i!==void 0?i:Di(e.state)):new Xt(this.source,1,a)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new Xt(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new Ao(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function tI(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):XC(t,!0).test(i)}const e$=he.define({map(t,e){return t.map(n=>n.map(e))}}),t$=he.define(),dn=_t.define({create(){return Vf.start()},update(t,e){return t.update(e)},provide:t=>[w0.from(t,e=>e.tooltip),G.contentAttributes.from(t,e=>e.attrs)]});function n$(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(dn).active.find(i=>i.source==e.source);return r instanceof Ao?(typeof n=="string"?t.dispatch(Object.assign(Object.assign({},WR(t.state,n,r.from,r.to)),{annotations:VR.of(e.completion)})):n(t,e.completion,r.from,r.to),!0):!1}const nI=YR(dn,n$);function rc(t,e="option"){return n=>{let r=n.state.field(dn,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+i*(t?1:-1):t?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),n.dispatch({effects:t$.of(l)}),!0}}const rI=t=>{let e=t.state.field(dn,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(dn,!1)?(t.dispatch({effects:Bf.of(!0)}),!0):!1,sI=t=>{let e=t.state.field(dn,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:qa.of(null)}),!0)};class oI{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const lI=50,aI=1e3,uI=Xe.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(dn).active)e.state==1&&this.startQuery(e)}update(t){let e=t.state.field(dn);if(!t.selectionSet&&!t.docChanged&&t.startState.field(dn)==e)return;let n=t.transactions.some(i=>(i.selection||i.docChanged)&&!Hp(i));for(let i=0;ilI&&Date.now()-s.time>aI){for(let o of s.context.abortListeners)try{o()}catch(l){vn(this.view.state,l)}s.context.abortListeners=null,this.running.splice(i--,1)}else s.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(s=>s.is(Bf)))&&(this.pendingStart=!0);let r=this.pendingStart?50:t.state.facet(Ct).activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.state==1&&!this.running.some(s=>s.active.source==i.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let i of t.transactions)Hp(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(dn);for(let n of e.active)n.state==1&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n)}startQuery(t){let{state:e}=this.view,n=Di(e),r=new QC(e,n,t.explicitPos==n),i=new oI(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:qa.of(null)}),vn(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ct).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Ct);for(let r=0;ro.source==i.active.source);if(s&&s.state==1)if(i.done==null){let o=new Xt(i.active.source,0);for(let l of i.updates)o=o.update(l,n);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:e$.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(dn,!1);if(e&&e.tooltip&&this.view.state.facet(Ct).closeOnBlur){let n=e.open&&H2(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:qa.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Bf.of(!1)}),20),this.composing=0}}}),cI=G.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"},".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"}}}),Ka={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ms=he.define({map(t,e){let n=e.mapPos(t,-1,Vt.TrackAfter);return n??void 0}}),A0=new class extends Ts{};A0.startSide=1;A0.endSide=-1;const r$=_t.define({create(){return Ce.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(ms)&&(t=t.update({add:[A0.range(n.value,n.value+1)]}));return t}});function fI(){return[dI,r$]}const Bd="()[]{}<>";function i$(t){for(let e=0;e{if((hI?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&An(kt(r,0))==1||e!=i.from||n!=i.to)return!1;let s=gI(t.state,r);return s?(t.dispatch(s),!0):!1}),mI=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=s$(t,t.selection.main.head).brackets||Ka.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let l=yI(t.doc,o.head);for(let a of r)if(a==l&&Th(t.doc,o.head)==i$(kt(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:j.cursor(o.head-a.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},pI=[{key:"Backspace",run:mI}];function gI(t,e){let n=s$(t,t.selection.main.head),r=n.brackets||Ka.brackets;for(let i of r){let s=i$(kt(i,0));if(e==i)return s==i?SI(t,i,r.indexOf(i+i+i)>-1,n):vI(t,i,s,n.before||Ka.before);if(e==s&&o$(t,t.selection.main.from))return wI(t,i,s)}return null}function o$(t,e){let n=!1;return t.field(r$).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Th(t,e){let n=t.sliceString(e,e+2);return n.slice(0,An(kt(n,0)))}function yI(t,e){let n=t.sliceString(e-2,e);return An(kt(n,0))==n.length?n:n.slice(1)}function vI(t,e,n,r){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:ms.of(o.to+e.length),range:j.range(o.anchor+e.length,o.head+e.length)};let l=Th(t.doc,o.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:o.head},effects:ms.of(o.head+e.length),range:j.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function wI(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&Th(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:j.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function SI(t,e,n,r){let i=r.stringPrefixes||Ka.stringPrefixes,s=null,o=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:ms.of(l.to+e.length),range:j.range(l.anchor+e.length,l.head+e.length)};let a=l.head,u=Th(t.doc,a),c;if(u==e){if(Vw(t,a))return{changes:{insert:e+e,from:a},effects:ms.of(a+e.length),range:j.cursor(a+e.length)};if(o$(t,a)){let h=n&&t.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+h.length,insert:h},range:j.cursor(a+h.length)}}}else{if(n&&t.sliceDoc(a-2*e.length,a)==e+e&&(c=Ww(t,a-2*e.length,i))>-1&&Vw(t,c))return{changes:{insert:e+e+e+e,from:a},effects:ms.of(a+e.length),range:j.cursor(a+e.length)};if(t.charCategorizer(a)(u)!=Ue.Word&&Ww(t,a,i)>-1&&!kI(t,a,e,i))return{changes:{insert:e+e,from:a},effects:ms.of(a+e.length),range:j.cursor(a+e.length)}}return{range:s=l}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Vw(t,e){let n=Ot(t).resolveInner(e+1);return n.parent&&n.from==e}function kI(t,e,n,r){let i=Ot(t).resolveInner(e,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),a=l.indexOf(n);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let c=i.firstChild;for(;c&&c.from==i.from&&c.to-c.from>n.length+a;){if(t.sliceDoc(c.to-n.length,c.to)==n)return!1;c=c.firstChild}return!0}let u=i.to==e&&i.parent;if(!u)break;i=u}return!1}function Ww(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Ue.Word)return e;for(let i of n){let s=e-i.length;if(t.sliceDoc(s,e)==i&&r(t.sliceDoc(s-1,s))!=Ue.Word)return s}return-1}function bI(t={}){return[dn,Ct.of(t),uI,xI,cI]}const l$=[{key:"Ctrl-Space",run:iI},{key:"Escape",run:sI},{key:"ArrowDown",run:rc(!0)},{key:"ArrowUp",run:rc(!1)},{key:"PageDown",run:rc(!0,"page")},{key:"PageUp",run:rc(!1,"page")},{key:"Enter",run:rI}],xI=Qo.highest(vh.computeN([Ct],t=>t.facet(Ct).defaultKeymap?[l$]:[]));class CI{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class ss{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=e,s=r.facet(ps).markerFilter;s&&(i=s(i,r));let o=oe.set(i.map(l=>l.from==l.to||l.from==l.to-1&&r.doc.lineAt(l.from).to==l.from?oe.widget({widget:new DI(l),diagnostic:l}).range(l.from):oe.mark({attributes:{class:"cm-lintRange cm-lintRange-"+l.severity+(l.markClass?" "+l.markClass:"")},diagnostic:l,inclusive:!0}).range(l.from,l.to)),!0);return new ss(o,n,qo(o))}}function qo(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return r=new CI(i,s,o.diagnostic),!1}),r}function $I(t,e){let n=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(r=>r.is(M0))||t.changes.touchesRange(n.from,n.to))}function a$(t,e){return t.field(gn,!1)?e:e.concat(he.appendConfig.of(d$))}function EI(t,e){return{effects:a$(t,[M0.of(e)])}}const M0=he.define(),P0=he.define(),u$=he.define(),gn=_t.define({create(){return new ss(oe.none,null,null)},update(t,e){if(e.docChanged){let n=t.diagnostics.map(e.changes),r=null;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=qo(n,t.selected.diagnostic,i)||qo(n,null,i)}t=new ss(n,t.panel,r)}for(let n of e.effects)n.is(M0)?t=ss.init(n.value,t.panel,e.state):n.is(P0)?t=new ss(t.diagnostics,n.value?Oh.open:null,t.selected):n.is(u$)&&(t=new ss(t.diagnostics,t.panel,n.value));return t},provide:t=>[Wa.from(t,e=>e.panel),G.decorations.from(t,e=>e.diagnostics)]}),TI=oe.mark({class:"cm-lintRange cm-lintRange-active",inclusive:!0});function OI(t,e,n){let{diagnostics:r}=t.state.field(gn),i=[],s=2e8,o=0;r.between(e-(n<0?1:0),e+(n>0?1:0),(a,u,{spec:c})=>{e>=a&&e<=u&&(a==u||(e>a||n>0)&&(eh$(t,n,!1)))}const AI=t=>{let e=t.state.field(gn,!1);(!e||!e.panel)&&t.dispatch({effects:a$(t.state,[P0.of(!0)])});let n=Va(t,Oh.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Hw=t=>{let e=t.state.field(gn,!1);return!e||!e.panel?!1:(t.dispatch({effects:P0.of(!1)}),!0)},MI=t=>{let e=t.state.field(gn,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},PI=[{key:"Mod-Shift-m",run:AI,preventDefault:!0},{key:"F8",run:MI}],NI=Xe.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(ps);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){let t=Date.now();if(tPromise.resolve(r(this.view)))).then(r=>{let i=r.reduce((s,o)=>s.concat(o));this.view.state.doc==e.doc&&this.view.dispatch(EI(this.view.state,i))},r=>{vn(this.view.state,r)})}}update(t){let e=t.state.facet(ps);(t.docChanged||e!=t.startState.facet(ps)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),ps=X.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},Pr(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n}))}});function c$(t,e={}){return[ps.of({source:t,config:e}),NI,d$]}function f$(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;rs.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function h$(t,e,n){var r;let i=n?f$(e.actions):[];return Ne("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ne("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=h=>{if(h.preventDefault(),l)return;l=!0;let d=qo(t.state.field(gn).diagnostics,e);d&&s.apply(t,d.from,d.to)},{name:u}=s,c=i[o]?u.indexOf(i[o]):-1,f=c<0?u:[u.slice(0,c),Ne("u",u.slice(c,c+1)),u.slice(c+1)];return Ne("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${u}${c<0?"":` (access key "${i[o]})"`}.`},f)}),e.source&&Ne("div",{class:"cm-diagnosticSource"},e.source))}class DI extends ei{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return Ne("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Uw{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=h$(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Oh{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)Hw(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=f$(s.actions);for(let l=0;l{for(let s=0;sHw(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(gn).selected;if(!e)return-1;for(let n=0;n{let u=-1,c;for(let f=r;fr&&(this.items.splice(r,u-r),i=!0)),n&&c.diagnostic==n.diagnostic?c.dom.hasAttribute("aria-selected")||(c.dom.setAttribute("aria-selected","true"),s=c):c.dom.hasAttribute("aria-selected")&&c.dom.removeAttribute("aria-selected"),r++});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;o.topl.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(gn),r=qo(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:u$.of(r)})}static open(e){return new Oh(e)}}function RI(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function ic(t){return RI(``,'width="6" height="3"')}const II=G.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:ic("#d11")},".cm-lintRange-warning":{backgroundImage:ic("orange")},".cm-lintRange-info":{backgroundImage:ic("#999")},".cm-lintRange-hint":{backgroundImage:ic("#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}}}),d$=[gn,G.decorations.compute([gn],t=>{let{selected:e,panel:n}=t.field(gn);return!e||!n||e.from==e.to?oe.none:oe.set([TI.range(e.from,e.to)])}),GP(OI,{hideOn:$I}),II];var qw=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(pI)),e.defaultKeymap!==!1&&(r=r.concat(fR)),e.searchKeymap!==!1&&(r=r.concat(IR)),e.historyKeymap!==!1&&(r=r.concat(SD)),e.foldKeymap!==!1&&(r=r.concat(MN)),e.completionKeymap!==!1&&(r=r.concat(l$)),e.lintKeymap!==!1&&(r=r.concat(PI));var i=[];return e.lineNumbers!==!1&&i.push(rN()),e.highlightActiveLineGutter!==!1&&i.push(oN()),e.highlightSpecialChars!==!1&&i.push(xP()),e.history!==!1&&i.push(fD()),e.foldGutter!==!1&&i.push(RN()),e.drawSelection!==!1&&i.push(hP()),e.dropCursor!==!1&&i.push(yP()),e.allowMultipleSelections!==!1&&i.push(ke.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(kN()),e.syntaxHighlighting!==!1&&i.push(sC(zN,{fallback:!0})),e.bracketMatching!==!1&&i.push(qN()),e.closeBrackets!==!1&&i.push(fI()),e.autocompletion!==!1&&i.push(bI()),e.rectangularSelection!==!1&&i.push(LP()),n!==!1&&i.push(jP()),e.highlightActiveLine!==!1&&i.push(_P()),e.highlightSelectionMatches!==!1&&i.push(yR()),e.tabSize&&typeof e.tabSize=="number"&&i.push(Sh.of(" ".repeat(e.tabSize))),i.concat([vh.of(r.flat())]).filter(Boolean)};const LI="#e5c07b",Kw="#e06c75",FI="#56b6c2",zI="#ffffff",zc="#abb2bf",Up="#7d8799",jI="#61afef",BI="#98c379",Gw="#d19a66",VI="#c678dd",WI="#21252b",Yw="#2c313a",Zw="#282c34",Vd="#353a42",HI="#3E4451",Jw="#528bff",UI=G.theme({"&":{color:zc,backgroundColor:Zw},".cm-content":{caretColor:Jw},".cm-cursor, .cm-dropCursor":{borderLeftColor:Jw},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:HI},".cm-panels":{backgroundColor:WI,color:zc},".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:Zw,color:Up,border:"none"},".cm-activeLineGutter":{backgroundColor:Yw},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Vd},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Vd,borderBottomColor:Vd},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Yw,color:zc}}},{dark:!0}),qI=su.define([{tag:z.keyword,color:VI},{tag:[z.name,z.deleted,z.character,z.propertyName,z.macroName],color:Kw},{tag:[z.function(z.variableName),z.labelName],color:jI},{tag:[z.color,z.constant(z.name),z.standard(z.name)],color:Gw},{tag:[z.definition(z.name),z.separator],color:zc},{tag:[z.typeName,z.className,z.number,z.changed,z.annotation,z.modifier,z.self,z.namespace],color:LI},{tag:[z.operator,z.operatorKeyword,z.url,z.escape,z.regexp,z.link,z.special(z.string)],color:FI},{tag:[z.meta,z.comment],color:Up},{tag:z.strong,fontWeight:"bold"},{tag:z.emphasis,fontStyle:"italic"},{tag:z.strikethrough,textDecoration:"line-through"},{tag:z.link,color:Up,textDecoration:"underline"},{tag:z.heading,fontWeight:"bold",color:Kw},{tag:[z.atom,z.bool,z.special(z.variableName)],color:Gw},{tag:[z.processingInstruction,z.string,z.inserted],color:BI},{tag:z.invalid,color:zI}]),KI=[UI,sC(qI)];var GI=G.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),YI=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:l=!0}=e,a=[];switch(n&&a.unshift(vh.of([hR])),l&&(typeof l=="boolean"?a.unshift(qw()):a.unshift(qw(l))),o&&a.unshift(NP(o)),s){case"light":a.push(GI);break;case"dark":a.push(KI);break;case"none":break;default:a.push(s);break}return r===!1&&a.push(G.editable.of(!1)),i&&a.push(ke.readOnly.of(!0)),[...a]},ZI=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)}),Qw=Mr.define(),JI=[];function QI(t){var{value:e,selection:n,onChange:r,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:l=JI,autoFocus:a,theme:u="light",height:c=null,minHeight:f=null,maxHeight:h=null,width:d=null,minWidth:p=null,maxWidth:y=null,placeholder:w="",editable:m=!0,readOnly:g=!1,indentWithTab:v=!0,basicSetup:S=!0,root:$,initialState:b}=t,[x,_]=zt.useState(),[M,N]=zt.useState(),[V,B]=zt.useState(),te=G.theme({"&":{height:c,minHeight:f,maxHeight:h,width:d,minWidth:p,maxWidth:y},"& .cm-scroller":{height:"100% !important"}}),Q=G.updateListener.of(pe=>{if(pe.docChanged&&typeof r=="function"&&!pe.transactions.some(I=>I.annotation(Qw))){var H=pe.state.doc,Y=H.toString();r(Y,pe)}i&&i(ZI(pe))}),fe=YI({theme:u,editable:m,readOnly:g,placeholder:w,indentWithTab:v,basicSetup:S}),Ee=[Q,te,...fe];return o&&typeof o=="function"&&Ee.push(G.updateListener.of(o)),Ee=Ee.concat(l),zt.useEffect(()=>{if(x&&!V){var pe={doc:e,selection:n,extensions:Ee},H=b?ke.fromJSON(b.json,pe,b.fields):ke.create(pe);if(B(H),!M){var Y=new G({state:H,parent:x,root:$});N(Y),s&&s(Y,H)}}return()=>{M&&(B(void 0),N(void 0))}},[x,V]),zt.useEffect(()=>_(t.container),[t.container]),zt.useEffect(()=>()=>{M&&(M.destroy(),N(void 0))},[M]),zt.useEffect(()=>{a&&M&&M.focus()},[a,M]),zt.useEffect(()=>{M&&M.dispatch({effects:he.reconfigure.of(Ee)})},[u,l,c,f,h,d,p,y,w,m,g,v,S,r,o]),zt.useEffect(()=>{if(e!==void 0){var pe=M?M.state.doc.toString():"";M&&e!==pe&&M.dispatch({changes:{from:0,to:pe.length,insert:e||""},annotations:[Qw.of(!0)]})}},[e,M]),{state:V,setState:B,view:M,setView:N,container:x,setContainer:_}}var XI=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],m$=zt.forwardRef((t,e)=>{var{className:n,value:r="",selection:i,extensions:s=[],onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:u,autoFocus:c,theme:f="light",height:h,minHeight:d,maxHeight:p,width:y,minWidth:w,maxWidth:m,basicSetup:g,placeholder:v,indentWithTab:S,editable:$,readOnly:b,root:x,initialState:_}=t,M=tD(t,XI),N=zt.useRef(null),{state:V,view:B,container:te}=QI({container:N.current,root:x,value:r,autoFocus:c,theme:f,height:h,minHeight:d,maxHeight:p,width:y,minWidth:w,maxWidth:m,basicSetup:g,placeholder:v,indentWithTab:S,editable:$,readOnly:b,selection:i,onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:u,extensions:s,initialState:_});if(zt.useImperativeHandle(e,()=>({editor:N.current,state:V,view:B}),[N,te,V,B]),typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var Q=typeof f=="string"?"cm-theme-"+f:"cm-theme";return mt.jsx("div",Lp({ref:N,className:""+Q+(n?" "+n:"")},M))});m$.displayName="CodeMirror";var qp=(t=>(t.FEATURE="Feature",t.FEATURECOLLECTION="FeatureCollection",t))(qp||{}),gs=(t=>(t.POINT="Point",t.MULTIPOINT="MultiPoint",t.LINESTRING="LineString",t.MULTILINESTRING="MultiLineString",t.POLYGON="Polygon",t.MULTIPOLYGON="MultiPolygon",t.POLYHEDRON="Polyhedron",t.MULTIPOLYHEDRON="MultiPolyhedron",t.PRISM="Prism",t.MULTIPRISM="MultiPrism",t))(gs||{});const Mn={STRING:"String",NUMBER:"Number",TRUE:"True",FALSE:"False",NULL:"Null",OBJECT:"Object",ARRAY:"Array",PROPERTY:"Property",PROPERTY_NAME:"PropertyName",JSON_TEXT:"JsonText"},eL=[Mn.STRING,Mn.NUMBER,Mn.TRUE,Mn.FALSE,Mn.NULL],tL=[Mn.OBJECT,Mn.ARRAY],nL=t=>t.replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1"),rL=(t,e,n=!0)=>{const r=e?t.sliceString(e.from,e.to):"";return n?nL(r):r},p$=t=>{const e=[];let n=t.firstChild;for(;n;)n&&e.push(n),n=n==null?void 0:n.nextSibling;return e},iL=t=>p$(t).filter(e=>g$(e)),sL=(t,e)=>iL(t).findIndex(n=>n.from===e.from&&n.to===e.to),oL=(t,e)=>p$(t).find(n=>n.name===e)??null,g$=t=>[...eL,...tL].includes(t.name),lL=(t,e)=>{const n=[];for(let r=e;r!=null&&r.parent;r=r.parent)if(r.parent.name===Mn.PROPERTY){const i=oL(r.parent,Mn.PROPERTY_NAME);i&&n.unshift(rL(t,i))}else if(r.parent.name===Mn.ARRAY&&g$(r)){const i=sL(r.parent,r);n.unshift(`${i}`)}return"/"+n.join("/")},y$=t=>{const e=Ot(t),n=new Map;return e.cursor().iterate(r=>{var l,a;const i=r.node,s=(l=i.nextSibling)==null?void 0:l.node,o=lL(t.doc,i);return s&&Mn.PROPERTY_NAME===r.name&&n.set(o,{keyFrom:i.from,keyTo:i.to,valueFrom:s.from,valueTo:s.to}),(i.parent===null||Mn.ARRAY===((a=i.parent)==null?void 0:a.name)&&!["[","]"].includes(i.name))&&n.set(o,{valueFrom:i.from,valueTo:i.to}),!0}),n},aL="http://www.opengis.net/spec/json-fg-1/0.2/conf/3d",uL="[ogc-json-fg-1-0.2:3d]",cL=[gs.POLYHEDRON,gs.MULTIPOLYHEDRON,gs.PRISM,gs.MULTIPRISM],Xw=t=>t.conformsTo!==void 0&&(t.conformsTo.includes(aL)||t.conformsTo.includes(uL)),eS=t=>t.place!==null&&cL.includes(t.place.type),v$=[];v$.push({name:"/req/3d/metadata",validateFeature:(t,e)=>{if(e&&eS(t)&&!Xw(t))return{pointer:"/conformsTo",message:'When having 3D geometries, the "conformsTo" member of the JSON document SHALL include at least the 3D conformance class.'}},validateFeatureCollection:t=>{if(t.features.some(e=>eS(e))&&!Xw(t))return{pointer:"/conformsTo",message:'When having 3D geometries, the "conformsTo" member of the JSON document SHALL include at least the 3D conformance class.'}}});const Gl=t=>typeof t[0]=="number"?[t.length]:t.flatMap(e=>Gl(e)),Kp=(t,e)=>typeof t[0]=="number"?[t[e]]:t.flatMap(n=>Kp(n,e)),N0=[];N0.push({name:"/req/core/coordinate-dimension",validateFeature:t=>{if(t.geometry!==null){const e=Gl(t.geometry.coordinates);if(e.some(n=>n!==e[0]))return{pointer:"/geometry",message:"All positions in a geometry object SHALL have the same dimension."}}if(t.place!==null){const e=t.place;let n=[];if(e.type===gs.PRISM?n=Gl(e.base.coordinates):e.type===gs.MULTIPRISM?n=e.prisms.flatMap(r=>Gl(r.base.coordinates)):n=Gl(e.coordinates),n.some(r=>r!==n[0]))return{pointer:"/place",message:"All positions in a geometry object SHALL have the same dimension."}}}});N0.push({name:"/req/core/geometry-wgs84",validateFeature:t=>{if(t.geometry!==null){if(Kp(t.geometry.coordinates,0).some(r=>r<-180||r>180))return{pointer:"/geometry",message:"The first element of each position SHALL be between -180 and +180 decimal degrees longitude."};if(Kp(t.geometry.coordinates,1).some(r=>r<-90||r>90))return{pointer:"/geometry",message:"The second element of each position SHALL be between -90 and +90 decimal degrees latitude."}}}});const fL="http://www.opengis.net/spec/json-fg-1/0.2/conf/core",hL="[ogc-json-fg-1-0.2:core]",tS=t=>t.conformsTo!==void 0&&(t.conformsTo.includes(fL)||t.conformsTo.includes(hL)),w$=[];w$.push({name:"/req/core/metadata",validateFeature:(t,e)=>{const n=t.conformsTo;if(e&&n===void 0)return{pointer:"/",message:'The JSON document SHALL include a "conformsTo" member.'};if(e&&n!==void 0&&!tS(t))return{pointer:"/conformsTo",message:'The "conformsTo" member of the JSON document SHALL include at least the core conformance class.'};if(!e&&n!==void 0)return{pointer:"/conformsTo",message:'Only the root object of the JSON document SHALL include a "conformsTo" member.'}},validateFeatureCollection:t=>{const e=t.conformsTo;if(e===void 0)return{pointer:"/",message:'The JSON document SHALL include a "conformsTo" member.'};if(e!==void 0&&!tS(t))return{pointer:"/conformsTo",message:'The "conformsTo" member of the JSON document SHALL include at least the core conformance class.'}}});class Rs extends Error{}class dL extends Rs{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class mL extends Rs{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class pL extends Rs{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class mo extends Rs{}class S$ extends Rs{constructor(e){super(`Invalid unit ${e}`)}}class en extends Rs{}class ri extends Rs{constructor(){super("Zone is an abstract class")}}const K="numeric",sr="short",wn="long",Wf={year:K,month:K,day:K},k$={year:K,month:sr,day:K},gL={year:K,month:sr,day:K,weekday:sr},b$={year:K,month:wn,day:K},x$={year:K,month:wn,day:K,weekday:wn},C$={hour:K,minute:K},$$={hour:K,minute:K,second:K},E$={hour:K,minute:K,second:K,timeZoneName:sr},T$={hour:K,minute:K,second:K,timeZoneName:wn},O$={hour:K,minute:K,hourCycle:"h23"},_$={hour:K,minute:K,second:K,hourCycle:"h23"},A$={hour:K,minute:K,second:K,hourCycle:"h23",timeZoneName:sr},M$={hour:K,minute:K,second:K,hourCycle:"h23",timeZoneName:wn},P$={year:K,month:K,day:K,hour:K,minute:K},N$={year:K,month:K,day:K,hour:K,minute:K,second:K},D$={year:K,month:sr,day:K,hour:K,minute:K},R$={year:K,month:sr,day:K,hour:K,minute:K,second:K},yL={year:K,month:sr,day:K,weekday:sr,hour:K,minute:K},I$={year:K,month:wn,day:K,hour:K,minute:K,timeZoneName:sr},L$={year:K,month:wn,day:K,hour:K,minute:K,second:K,timeZoneName:sr},F$={year:K,month:wn,day:K,weekday:wn,hour:K,minute:K,timeZoneName:wn},z$={year:K,month:wn,day:K,weekday:wn,hour:K,minute:K,second:K,timeZoneName:wn};class au{get type(){throw new ri}get name(){throw new ri}get ianaName(){return this.name}get isUniversal(){throw new ri}offsetName(e,n){throw new ri}formatOffset(e,n){throw new ri}offset(e){throw new ri}equals(e){throw new ri}get isValid(){throw new ri}}let Wd=null;class _h extends au{static get instance(){return Wd===null&&(Wd=new _h),Wd}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return G$(e,n,r)}formatOffset(e,n){return fa(this.offset(e),n)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let jc={};function vL(t){return jc[t]||(jc[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),jc[t]}const wL={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function SL(t,e){const n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,s,o,l,a,u,c]=r;return[o,i,s,l,a,u,c]}function kL(t,e){const n=t.formatToParts(e),r=[];for(let i=0;i=0?p:1e3+p,(h-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let nS={};function bL(t,e={}){const n=JSON.stringify([t,e]);let r=nS[n];return r||(r=new Intl.ListFormat(t,e),nS[n]=r),r}let Gp={};function Yp(t,e={}){const n=JSON.stringify([t,e]);let r=Gp[n];return r||(r=new Intl.DateTimeFormat(t,e),Gp[n]=r),r}let Zp={};function xL(t,e={}){const n=JSON.stringify([t,e]);let r=Zp[n];return r||(r=new Intl.NumberFormat(t,e),Zp[n]=r),r}let Jp={};function CL(t,e={}){const{base:n,...r}=e,i=JSON.stringify([t,r]);let s=Jp[i];return s||(s=new Intl.RelativeTimeFormat(t,e),Jp[i]=s),s}let Yl=null;function $L(){return Yl||(Yl=new Intl.DateTimeFormat().resolvedOptions().locale,Yl)}let rS={};function EL(t){let e=rS[t];if(!e){const n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,rS[t]=e}return e}function TL(t){const e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));const n=t.indexOf("-u-");if(n===-1)return[t];{let r,i;try{r=Yp(t).resolvedOptions(),i=t}catch{const a=t.substring(0,n);r=Yp(a).resolvedOptions(),i=a}const{numberingSystem:s,calendar:o}=r;return[i,s,o]}}function OL(t,e,n){return(n||e)&&(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`)),t}function _L(t){const e=[];for(let n=1;n<=12;n++){const r=se.utc(2009,n,1);e.push(t(r))}return e}function AL(t){const e=[];for(let n=1;n<=7;n++){const r=se.utc(2016,11,13+n);e.push(t(r))}return e}function oc(t,e,n,r){const i=t.listingMode();return i==="error"?null:i==="en"?n(e):r(e)}function ML(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}class PL{constructor(e,n,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:i,floor:s,...o}=r;if(!n||Object.keys(o).length>0){const l={useGrouping:!1,...r};r.padTo>0&&(l.minimumIntegerDigits=r.padTo),this.inf=xL(e,l)}}format(e){if(this.inf){const n=this.floor?Math.floor(e):e;return this.inf.format(n)}else{const n=this.floor?Math.floor(e):L0(e,3);return ot(n,this.padTo)}}}class NL{constructor(e,n,r){this.opts=r,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),l=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Jr.create(l).valid?(i=l,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=Yp(n,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(n=>{if(n.type==="timeZoneName"){const r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...n,value:r}}else return n}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class DL{constructor(e,n,r){this.opts={style:"long",...r},!n&&q$()&&(this.rtf=CL(e,r))}format(e,n){return this.rtf?this.rtf.format(e,n):e4(n,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,n){return this.rtf?this.rtf.formatToParts(e,n):[]}}const RL={firstDay:1,minimalDays:4,weekend:[6,7]};class Ae{static fromOpts(e){return Ae.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,n,r,i,s=!1){const o=e||Je.defaultLocale,l=o||(s?"en-US":$L()),a=n||Je.defaultNumberingSystem,u=r||Je.defaultOutputCalendar,c=Qp(i)||Je.defaultWeekSettings;return new Ae(l,a,u,c,o)}static resetCache(){Yl=null,Gp={},Zp={},Jp={}}static fromObject({locale:e,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return Ae.create(e,n,r,i)}constructor(e,n,r,i,s){const[o,l,a]=TL(e);this.locale=o,this.numberingSystem=n||l||null,this.outputCalendar=r||a||null,this.weekSettings=i,this.intl=OL(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=ML(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),n=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&n?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:Ae.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Qp(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,n=!1){return oc(this,e,J$,()=>{const r=n?{month:e,day:"numeric"}:{month:e},i=n?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=_L(s=>this.extract(s,r,"month"))),this.monthsCache[i][e]})}weekdays(e,n=!1){return oc(this,e,eE,()=>{const r=n?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=n?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=AL(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return oc(this,void 0,()=>tE,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[se.utc(2016,11,13,9),se.utc(2016,11,13,19)].map(n=>this.extract(n,e,"dayperiod"))}return this.meridiemCache})}eras(e){return oc(this,e,nE,()=>{const n={era:e};return this.eraCache[e]||(this.eraCache[e]=[se.utc(-40,1,1),se.utc(2017,1,1)].map(r=>this.extract(r,n,"era"))),this.eraCache[e]})}extract(e,n,r){const i=this.dtFormatter(e,n),s=i.formatToParts(),o=s.find(l=>l.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new PL(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,n={}){return new NL(e,this.intl,n)}relFormatter(e={}){return new DL(this.intl,this.isEnglish(),e)}listFormatter(e={}){return bL(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:K$()?EL(this.locale):RL}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let Hd=null;class Ht extends au{static get utcInstance(){return Hd===null&&(Hd=new Ht(0)),Hd}static instance(e){return e===0?Ht.utcInstance:new Ht(e)}static parseSpecifier(e){if(e){const n=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new Ht(Ph(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${fa(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${fa(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,n){return fa(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class IL extends au{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function gi(t,e){if(ce(t)||t===null)return e;if(t instanceof au)return t;if(zL(t)){const n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?_h.instance:n==="utc"||n==="gmt"?Ht.utcInstance:Ht.parseSpecifier(n)||Jr.create(t)}else return ks(t)?Ht.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new IL(t)}let iS=()=>Date.now(),sS="system",oS=null,lS=null,aS=null,uS=60,cS,fS=null;class Je{static get now(){return iS}static set now(e){iS=e}static set defaultZone(e){sS=e}static get defaultZone(){return gi(sS,_h.instance)}static get defaultLocale(){return oS}static set defaultLocale(e){oS=e}static get defaultNumberingSystem(){return lS}static set defaultNumberingSystem(e){lS=e}static get defaultOutputCalendar(){return aS}static set defaultOutputCalendar(e){aS=e}static get defaultWeekSettings(){return fS}static set defaultWeekSettings(e){fS=Qp(e)}static get twoDigitCutoffYear(){return uS}static set twoDigitCutoffYear(e){uS=e%100}static get throwOnInvalid(){return cS}static set throwOnInvalid(e){cS=e}static resetCaches(){Ae.resetCache(),Jr.resetCache()}}class Xn{constructor(e,n){this.reason=e,this.explanation=n}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const j$=[0,31,59,90,120,151,181,212,243,273,304,334],B$=[0,31,60,91,121,152,182,213,244,274,305,335];function Dn(t,e){return new Xn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function D0(t,e,n){const r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return i===0?7:i}function V$(t,e,n){return n+(uu(t)?B$:j$)[e-1]}function W$(t,e){const n=uu(t)?B$:j$,r=n.findIndex(s=>sGa(r,e,n)?(u=r+1,a=1):u=r,{weekYear:u,weekNumber:a,weekday:l,...Nh(t)}}function hS(t,e=4,n=1){const{weekYear:r,weekNumber:i,weekday:s}=t,o=R0(D0(r,1,e),n),l=Mo(r);let a=i*7+s-o-7+e,u;a<1?(u=r-1,a+=Mo(u)):a>l?(u=r+1,a-=Mo(r)):u=r;const{month:c,day:f}=W$(u,a);return{year:u,month:c,day:f,...Nh(t)}}function Ud(t){const{year:e,month:n,day:r}=t,i=V$(e,n,r);return{year:e,ordinal:i,...Nh(t)}}function dS(t){const{year:e,ordinal:n}=t,{month:r,day:i}=W$(e,n);return{year:e,month:r,day:i,...Nh(t)}}function mS(t,e){if(!ce(t.localWeekday)||!ce(t.localWeekNumber)||!ce(t.localWeekYear)){if(!ce(t.weekday)||!ce(t.weekNumber)||!ce(t.weekYear))throw new mo("Cannot mix locale-based week fields with ISO-based week fields");return ce(t.localWeekday)||(t.weekday=t.localWeekday),ce(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),ce(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function LL(t,e=4,n=1){const r=Ah(t.weekYear),i=Rn(t.weekNumber,1,Ga(t.weekYear,e,n)),s=Rn(t.weekday,1,7);return r?i?s?!1:Dn("weekday",t.weekday):Dn("week",t.weekNumber):Dn("weekYear",t.weekYear)}function FL(t){const e=Ah(t.year),n=Rn(t.ordinal,1,Mo(t.year));return e?n?!1:Dn("ordinal",t.ordinal):Dn("year",t.year)}function H$(t){const e=Ah(t.year),n=Rn(t.month,1,12),r=Rn(t.day,1,Uf(t.year,t.month));return e?n?r?!1:Dn("day",t.day):Dn("month",t.month):Dn("year",t.year)}function U$(t){const{hour:e,minute:n,second:r,millisecond:i}=t,s=Rn(e,0,23)||e===24&&n===0&&r===0&&i===0,o=Rn(n,0,59),l=Rn(r,0,59),a=Rn(i,0,999);return s?o?l?a?!1:Dn("millisecond",i):Dn("second",r):Dn("minute",n):Dn("hour",e)}function ce(t){return typeof t>"u"}function ks(t){return typeof t=="number"}function Ah(t){return typeof t=="number"&&t%1===0}function zL(t){return typeof t=="string"}function jL(t){return Object.prototype.toString.call(t)==="[object Date]"}function q$(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function K$(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function BL(t){return Array.isArray(t)?t:[t]}function pS(t,e,n){if(t.length!==0)return t.reduce((r,i)=>{const s=[e(i),i];return r&&n(r[0],s[0])===r[0]?r:s},null)[1]}function VL(t,e){return e.reduce((n,r)=>(n[r]=t[r],n),{})}function Ko(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Qp(t){if(t==null)return null;if(typeof t!="object")throw new en("Week settings must be an object");if(!Rn(t.firstDay,1,7)||!Rn(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Rn(e,1,7)))throw new en("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Rn(t,e,n){return Ah(t)&&t>=e&&t<=n}function WL(t,e){return t-e*Math.floor(t/e)}function ot(t,e=2){const n=t<0;let r;return n?r="-"+(""+-t).padStart(e,"0"):r=(""+t).padStart(e,"0"),r}function hi(t){if(!(ce(t)||t===null||t===""))return parseInt(t,10)}function Xi(t){if(!(ce(t)||t===null||t===""))return parseFloat(t)}function I0(t){if(!(ce(t)||t===null||t==="")){const e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function L0(t,e,n=!1){const r=10**e;return(n?Math.trunc:Math.round)(t*r)/r}function uu(t){return t%4===0&&(t%100!==0||t%400===0)}function Mo(t){return uu(t)?366:365}function Uf(t,e){const n=WL(e-1,12)+1,r=t+(e-n)/12;return n===2?uu(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Mh(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function gS(t,e,n){return-R0(D0(t,1,e),n)+e-1}function Ga(t,e=4,n=1){const r=gS(t,e,n),i=gS(t+1,e,n);return(Mo(t)-r+i)/7}function Xp(t){return t>99?t:t>Je.twoDigitCutoffYear?1900+t:2e3+t}function G$(t,e,n,r=null){const i=new Date(t),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);const o={timeZoneName:e,...s},l=new Intl.DateTimeFormat(n,o).formatToParts(i).find(a=>a.type.toLowerCase()==="timezonename");return l?l.value:null}function Ph(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);const r=parseInt(e,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function Y$(t){const e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new en(`Invalid unit value ${t}`);return e}function qf(t,e){const n={};for(const r in t)if(Ko(t,r)){const i=t[r];if(i==null)continue;n[e(r)]=Y$(i)}return n}function fa(t,e){const n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${ot(n,2)}:${ot(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${ot(n,2)}${ot(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Nh(t){return VL(t,["hour","minute","second","millisecond"])}const HL=["January","February","March","April","May","June","July","August","September","October","November","December"],Z$=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],UL=["J","F","M","A","M","J","J","A","S","O","N","D"];function J$(t){switch(t){case"narrow":return[...UL];case"short":return[...Z$];case"long":return[...HL];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Q$=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],X$=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],qL=["M","T","W","T","F","S","S"];function eE(t){switch(t){case"narrow":return[...qL];case"short":return[...X$];case"long":return[...Q$];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const tE=["AM","PM"],KL=["Before Christ","Anno Domini"],GL=["BC","AD"],YL=["B","A"];function nE(t){switch(t){case"narrow":return[...YL];case"short":return[...GL];case"long":return[...KL];default:return null}}function ZL(t){return tE[t.hour<12?0:1]}function JL(t,e){return eE(e)[t.weekday-1]}function QL(t,e){return J$(e)[t.month-1]}function XL(t,e){return nE(e)[t.year<0?0:1]}function e4(t,e,n="always",r=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(t)===-1;if(n==="auto"&&s){const f=t==="days";switch(e){case 1:return f?"tomorrow":`next ${i[t][0]}`;case-1:return f?"yesterday":`last ${i[t][0]}`;case 0:return f?"today":`this ${i[t][0]}`}}const o=Object.is(e,-0)||e<0,l=Math.abs(e),a=l===1,u=i[t],c=r?a?u[1]:u[2]||u[1]:a?i[t][0]:t;return o?`${l} ${c} ago`:`in ${l} ${c}`}function yS(t,e){let n="";for(const r of t)r.literal?n+=r.val:n+=e(r.val);return n}const t4={D:Wf,DD:k$,DDD:b$,DDDD:x$,t:C$,tt:$$,ttt:E$,tttt:T$,T:O$,TT:_$,TTT:A$,TTTT:M$,f:P$,ff:D$,fff:I$,ffff:F$,F:N$,FF:R$,FFF:L$,FFFF:z$};class It{static create(e,n={}){return new It(e,n)}static parseFormat(e){let n=null,r="",i=!1;const s=[];for(let o=0;o0&&s.push({literal:i||/^\s+$/.test(r),val:r}),n=null,r="",i=!i):i||l===n?r+=l:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=l,n=l)}return r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return t4[e]}constructor(e,n){this.opts=n,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,n){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...n}).format()}dtFormatter(e,n={}){return this.loc.dtFormatter(e,{...this.opts,...n})}formatDateTime(e,n){return this.dtFormatter(e,n).format()}formatDateTimeParts(e,n){return this.dtFormatter(e,n).formatToParts()}formatInterval(e,n){return this.dtFormatter(e.start,n).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,n){return this.dtFormatter(e,n).resolvedOptions()}num(e,n=0){if(this.opts.forceSimple)return ot(e,n);const r={...this.opts};return n>0&&(r.padTo=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,n){const r=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(d,p)=>this.loc.extract(e,d,p),o=d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"",l=()=>r?ZL(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(d,p)=>r?QL(e,d):s(p?{month:d}:{month:d,day:"numeric"},"month"),u=(d,p)=>r?JL(e,d):s(p?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),c=d=>{const p=It.macroTokenToFormatOpts(d);return p?this.formatWithSystemDefault(e,p):d},f=d=>r?XL(e,d):s({era:d},"era"),h=d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return l();case"d":return i?s({day:"numeric"},"day"):this.num(e.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(e.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(e.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(d)}};return yS(It.parseFormat(n),h)}formatDurationFromString(e,n){const r=a=>{switch(a[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=a=>u=>{const c=r(u);return c?this.num(a.get(c),u.length):u},s=It.parseFormat(n),o=s.reduce((a,{literal:u,val:c})=>u?a:a.concat(c),[]),l=e.shiftTo(...o.map(r).filter(a=>a));return yS(s,i(l))}}const rE=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function nl(...t){const e=t.reduce((n,r)=>n+r.source,"");return RegExp(`^${e}$`)}function rl(...t){return e=>t.reduce(([n,r,i],s)=>{const[o,l,a]=s(e,i);return[{...n,...o},l||r,a]},[{},null,1]).slice(0,2)}function il(t,...e){if(t==null)return[null,null];for(const[n,r]of e){const i=n.exec(t);if(i)return r(i)}return[null,null]}function iE(...t){return(e,n)=>{const r={};let i;for(i=0;id!==void 0&&(p||d&&c)?-d:d;return[{years:h(Xi(n)),months:h(Xi(r)),weeks:h(Xi(i)),days:h(Xi(s)),hours:h(Xi(o)),minutes:h(Xi(l)),seconds:h(Xi(a),a==="-0"),milliseconds:h(I0(u),f)}]}const m4={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function j0(t,e,n,r,i,s,o){const l={year:e.length===2?Xp(hi(e)):hi(e),month:Z$.indexOf(n)+1,day:hi(r),hour:hi(i),minute:hi(s)};return o&&(l.second=hi(o)),t&&(l.weekday=t.length>3?Q$.indexOf(t)+1:X$.indexOf(t)+1),l}const p4=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function g4(t){const[,e,n,r,i,s,o,l,a,u,c,f]=t,h=j0(e,i,r,n,s,o,l);let d;return a?d=m4[a]:u?d=0:d=Ph(c,f),[h,new Ht(d)]}function y4(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const v4=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,w4=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,S4=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function vS(t){const[,e,n,r,i,s,o,l]=t;return[j0(e,i,r,n,s,o,l),Ht.utcInstance]}function k4(t){const[,e,n,r,i,s,o,l]=t;return[j0(e,l,n,r,i,s,o),Ht.utcInstance]}const b4=nl(r4,z0),x4=nl(i4,z0),C4=nl(s4,z0),$4=nl(oE),aE=rl(c4,sl,cu,fu),E4=rl(o4,sl,cu,fu),T4=rl(l4,sl,cu,fu),O4=rl(sl,cu,fu);function _4(t){return il(t,[b4,aE],[x4,E4],[C4,T4],[$4,O4])}function A4(t){return il(y4(t),[p4,g4])}function M4(t){return il(t,[v4,vS],[w4,vS],[S4,k4])}function P4(t){return il(t,[h4,d4])}const N4=rl(sl);function D4(t){return il(t,[f4,N4])}const R4=nl(a4,u4),I4=nl(lE),L4=rl(sl,cu,fu);function F4(t){return il(t,[R4,aE],[I4,L4])}const wS="Invalid Duration",uE={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},z4={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...uE},En=146097/400,Us=146097/4800,j4={years:{quarters:4,months:12,weeks:En/7,days:En,hours:En*24,minutes:En*24*60,seconds:En*24*60*60,milliseconds:En*24*60*60*1e3},quarters:{months:3,weeks:En/28,days:En/4,hours:En*24/4,minutes:En*24*60/4,seconds:En*24*60*60/4,milliseconds:En*24*60*60*1e3/4},months:{weeks:Us/7,days:Us,hours:Us*24,minutes:Us*24*60,seconds:Us*24*60*60,milliseconds:Us*24*60*60*1e3},...uE},ys=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],B4=ys.slice(0).reverse();function ii(t,e,n=!1){const r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new xe(r)}function cE(t,e){let n=e.milliseconds??0;for(const r of B4.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function SS(t,e){const n=cE(t,e)<0?-1:1;ys.reduceRight((r,i)=>{if(ce(e[i]))return r;if(r){const s=e[r]*n,o=t[i][r],l=Math.floor(s/o);e[i]+=l*n,e[r]-=l*o*n}return i},null),ys.reduce((r,i)=>{if(ce(e[i]))return r;if(r){const s=e[r]%1;e[r]-=s,e[i]+=s*t[r][i]}return i},null)}function V4(t){const e={};for(const[n,r]of Object.entries(t))r!==0&&(e[n]=r);return e}class xe{constructor(e){const n=e.conversionAccuracy==="longterm"||!1;let r=n?j4:z4;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Ae.create(),this.conversionAccuracy=n?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,n){return xe.fromObject({milliseconds:e},n)}static fromObject(e,n={}){if(e==null||typeof e!="object")throw new en(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new xe({values:qf(e,xe.normalizeUnit),loc:Ae.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(e){if(ks(e))return xe.fromMillis(e);if(xe.isDuration(e))return e;if(typeof e=="object")return xe.fromObject(e);throw new en(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,n){const[r]=P4(e);return r?xe.fromObject(r,n):xe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,n){const[r]=D4(e);return r?xe.fromObject(r,n):xe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,n=null){if(!e)throw new en("need to specify a reason the Duration is invalid");const r=e instanceof Xn?e:new Xn(e,n);if(Je.throwOnInvalid)throw new pL(r);return new xe({invalid:r})}static normalizeUnit(e){const n={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!n)throw new S$(e);return n}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,n={}){const r={...n,floor:n.round!==!1&&n.floor!==!1};return this.isValid?It.create(this.loc,r).formatDurationFromString(this,e):wS}toHuman(e={}){if(!this.isValid)return wS;const n=ys.map(r=>{const i=this.values[r];return ce(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(i)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=L0(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const n=this.toMillis();return n<0||n>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},se.fromMillis(n,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?cE(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const n=xe.fromDurationLike(e),r={};for(const i of ys)(Ko(n.values,i)||Ko(this.values,i))&&(r[i]=n.get(i)+this.get(i));return ii(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const n=xe.fromDurationLike(e);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;const n={};for(const r of Object.keys(this.values))n[r]=Y$(e(this.values[r],r));return ii(this,{values:n},!0)}get(e){return this[xe.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const n={...this.values,...qf(e,xe.normalizeUnit)};return ii(this,{values:n})}reconfigure({locale:e,numberingSystem:n,conversionAccuracy:r,matrix:i}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:n}),matrix:i,conversionAccuracy:r};return ii(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return SS(this.matrix,e),ii(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=V4(this.normalize().shiftToAll().toObject());return ii(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>xe.normalizeUnit(o));const n={},r={},i=this.toObject();let s;for(const o of ys)if(e.indexOf(o)>=0){s=o;let l=0;for(const u in r)l+=this.matrix[u][o]*r[u],r[u]=0;ks(i[o])&&(l+=i[o]);const a=Math.trunc(l);n[o]=a,r[o]=(l*1e3-a*1e3)/1e3}else ks(i[o])&&(r[o]=i[o]);for(const o in r)r[o]!==0&&(n[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return SS(this.matrix,n),ii(this,{values:n},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const n of Object.keys(this.values))e[n]=this.values[n]===0?0:-this.values[n];return ii(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function n(r,i){return r===void 0||r===0?i===void 0||i===0:r===i}for(const r of ys)if(!n(this.values[r],e.values[r]))return!1;return!0}}const qs="Invalid Interval";function W4(t,e){return!t||!t.isValid?Ze.invalid("missing or invalid start"):!e||!e.isValid?Ze.invalid("missing or invalid end"):ee:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:n}={}){return this.isValid?Ze.fromDateTimes(e||this.s,n||this.e):this}splitAt(...e){if(!this.isValid)return[];const n=e.map(Il).filter(o=>this.contains(o)).sort((o,l)=>o.toMillis()-l.toMillis()),r=[];let{s:i}=this,s=0;for(;i+this.e?this.e:o;r.push(Ze.fromDateTimes(i,l)),i=l,s+=1}return r}splitBy(e){const n=xe.fromDurationLike(e);if(!this.isValid||!n.isValid||n.as("milliseconds")===0)return[];let{s:r}=this,i=1,s;const o=[];for(;ra*i));s=+l>+this.e?this.e:l,o.push(Ze.fromDateTimes(r,s)),r=s,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const n=this.s>e.s?this.s:e.s,r=this.e=r?null:Ze.fromDateTimes(n,r)}union(e){if(!this.isValid)return this;const n=this.se.e?this.e:e.e;return Ze.fromDateTimes(n,r)}static merge(e){const[n,r]=e.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return r&&n.push(r),n}static xor(e){let n=null,r=0;const i=[],s=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...s),l=o.sort((a,u)=>a.time-u.time);for(const a of l)r+=a.type==="s"?1:-1,r===1?n=a.time:(n&&+n!=+a.time&&i.push(Ze.fromDateTimes(n,a.time)),n=null);return Ze.merge(i)}difference(...e){return Ze.xor([this].concat(e)).map(n=>this.intersection(n)).filter(n=>n&&!n.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:qs}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Wf,n={}){return this.isValid?It.create(this.s.loc.clone(n),e).formatInterval(this):qs}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:qs}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:qs}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:qs}toFormat(e,{separator:n=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${n}${this.e.toFormat(e)}`:qs}toDuration(e,n){return this.isValid?this.e.diff(this.s,e,n):xe.invalid(this.invalidReason)}mapEndpoints(e){return Ze.fromDateTimes(e(this.s),e(this.e))}}class lc{static hasDST(e=Je.defaultZone){const n=se.now().setZone(e).set({month:12});return!e.isUniversal&&n.offset!==n.set({month:6}).offset}static isValidIANAZone(e){return Jr.isValidZone(e)}static normalizeZone(e){return gi(e,Je.defaultZone)}static getStartOfWeek({locale:e=null,locObj:n=null}={}){return(n||Ae.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:n=null}={}){return(n||Ae.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:n=null}={}){return(n||Ae.create(e)).getWeekendDays().slice()}static months(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||Ae.create(n,r,s)).months(e)}static monthsFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||Ae.create(n,r,s)).months(e,!0)}static weekdays(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null}={}){return(i||Ae.create(n,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null}={}){return(i||Ae.create(n,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Ae.create(e).meridiems()}static eras(e="short",{locale:n=null}={}){return Ae.create(n,null,"gregory").eras(e)}static features(){return{relative:q$(),localeWeek:K$()}}}function kS(t,e){const n=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(xe.fromMillis(r).as("days"))}function H4(t,e,n){const r=[["years",(a,u)=>u.year-a.year],["quarters",(a,u)=>u.quarter-a.quarter+(u.year-a.year)*4],["months",(a,u)=>u.month-a.month+(u.year-a.year)*12],["weeks",(a,u)=>{const c=kS(a,u);return(c-c%7)/7}],["days",kS]],i={},s=t;let o,l;for(const[a,u]of r)n.indexOf(a)>=0&&(o=a,i[a]=u(t,e),l=s.plus(i),l>e?(i[a]--,t=s.plus(i),t>e&&(l=t,i[a]--,t=s.plus(i))):t=l);return[t,i,l,o]}function U4(t,e,n,r){let[i,s,o,l]=H4(t,e,n);const a=e-i,u=n.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);u.length===0&&(o0?xe.fromMillis(a,r).shiftTo(...u).plus(c):c}const B0={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},bS={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},q4=B0.hanidec.replace(/[\[|\]]/g,"").split("");function K4(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}function Hn({numberingSystem:t},e=""){return new RegExp(`${B0[t||"latn"]}${e}`)}const G4="missing Intl.DateTimeFormat.formatToParts support";function Te(t,e=n=>n){return{regex:t,deser:([n])=>e(K4(n))}}const Y4=" ",fE=`[ ${Y4}]`,hE=new RegExp(fE,"g");function Z4(t){return t.replace(/\./g,"\\.?").replace(hE,fE)}function xS(t){return t.replace(/\./g,"").replace(hE," ").toLowerCase()}function Un(t,e){return t===null?null:{regex:RegExp(t.map(Z4).join("|")),deser:([n])=>t.findIndex(r=>xS(n)===xS(r))+e}}function CS(t,e){return{regex:t,deser:([,n,r])=>Ph(n,r),groups:e}}function ac(t){return{regex:t,deser:([e])=>e}}function J4(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Q4(t,e){const n=Hn(e),r=Hn(e,"{2}"),i=Hn(e,"{3}"),s=Hn(e,"{4}"),o=Hn(e,"{6}"),l=Hn(e,"{1,2}"),a=Hn(e,"{1,3}"),u=Hn(e,"{1,6}"),c=Hn(e,"{1,9}"),f=Hn(e,"{2,4}"),h=Hn(e,"{4,6}"),d=w=>({regex:RegExp(J4(w.val)),deser:([m])=>m,literal:!0}),y=(w=>{if(t.literal)return d(w);switch(w.val){case"G":return Un(e.eras("short"),0);case"GG":return Un(e.eras("long"),0);case"y":return Te(u);case"yy":return Te(f,Xp);case"yyyy":return Te(s);case"yyyyy":return Te(h);case"yyyyyy":return Te(o);case"M":return Te(l);case"MM":return Te(r);case"MMM":return Un(e.months("short",!0),1);case"MMMM":return Un(e.months("long",!0),1);case"L":return Te(l);case"LL":return Te(r);case"LLL":return Un(e.months("short",!1),1);case"LLLL":return Un(e.months("long",!1),1);case"d":return Te(l);case"dd":return Te(r);case"o":return Te(a);case"ooo":return Te(i);case"HH":return Te(r);case"H":return Te(l);case"hh":return Te(r);case"h":return Te(l);case"mm":return Te(r);case"m":return Te(l);case"q":return Te(l);case"qq":return Te(r);case"s":return Te(l);case"ss":return Te(r);case"S":return Te(a);case"SSS":return Te(i);case"u":return ac(c);case"uu":return ac(l);case"uuu":return Te(n);case"a":return Un(e.meridiems(),0);case"kkkk":return Te(s);case"kk":return Te(f,Xp);case"W":return Te(l);case"WW":return Te(r);case"E":case"c":return Te(n);case"EEE":return Un(e.weekdays("short",!1),1);case"EEEE":return Un(e.weekdays("long",!1),1);case"ccc":return Un(e.weekdays("short",!0),1);case"cccc":return Un(e.weekdays("long",!0),1);case"Z":case"ZZ":return CS(new RegExp(`([+-]${l.source})(?::(${r.source}))?`),2);case"ZZZ":return CS(new RegExp(`([+-]${l.source})(${r.source})?`),2);case"z":return ac(/[a-z_+-/]{1,256}?/i);case" ":return ac(/[^\S\n\r]/);default:return d(w)}})(t)||{invalidReason:G4};return y.token=t,y}const X4={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function e3(t,e,n){const{type:r,value:i}=t;if(r==="literal"){const a=/^\s+$/.test(i);return{literal:!a,val:a?" ":i}}const s=e[r];let o=r;r==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=n.hour12?"hour12":"hour24");let l=X4[o];if(typeof l=="object"&&(l=l[s]),l)return{literal:!1,val:l}}function t3(t){return[`^${t.map(n=>n.regex).reduce((n,r)=>`${n}(${r.source})`,"")}$`,t]}function n3(t,e,n){const r=t.match(e);if(r){const i={};let s=1;for(const o in n)if(Ko(n,o)){const l=n[o],a=l.groups?l.groups+1:1;!l.literal&&l.token&&(i[l.token.val[0]]=l.deser(r.slice(s,s+a))),s+=a}return[r,i]}else return[r,{}]}function r3(t){const e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let n=null,r;return ce(t.z)||(n=Jr.create(t.z)),ce(t.Z)||(n||(n=new Ht(t.Z)),r=t.Z),ce(t.q)||(t.M=(t.q-1)*3+1),ce(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),ce(t.u)||(t.S=I0(t.u)),[Object.keys(t).reduce((s,o)=>{const l=e(o);return l&&(s[l]=t[o]),s},{}),n,r]}let qd=null;function i3(){return qd||(qd=se.fromMillis(1555555555555)),qd}function s3(t,e){if(t.literal)return t;const n=It.macroTokenToFormatOpts(t.val),r=pE(n,e);return r==null||r.includes(void 0)?t:r}function dE(t,e){return Array.prototype.concat(...t.map(n=>s3(n,e)))}function mE(t,e,n){const r=dE(It.parseFormat(n),t),i=r.map(o=>Q4(o,t)),s=i.find(o=>o.invalidReason);if(s)return{input:e,tokens:r,invalidReason:s.invalidReason};{const[o,l]=t3(i),a=RegExp(o,"i"),[u,c]=n3(e,a,l),[f,h,d]=c?r3(c):[null,null,void 0];if(Ko(c,"a")&&Ko(c,"H"))throw new mo("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:r,regex:a,rawMatches:u,matches:c,result:f,zone:h,specificOffset:d}}}function o3(t,e,n){const{result:r,zone:i,specificOffset:s,invalidReason:o}=mE(t,e,n);return[r,i,s,o]}function pE(t,e){if(!t)return null;const r=It.create(e,t).dtFormatter(i3()),i=r.formatToParts(),s=r.resolvedOptions();return i.map(o=>e3(o,t,s))}const Kd="Invalid DateTime",$S=864e13;function uc(t){return new Xn("unsupported zone",`the zone "${t.name}" is not supported`)}function Gd(t){return t.weekData===null&&(t.weekData=Hf(t.c)),t.weekData}function Yd(t){return t.localWeekData===null&&(t.localWeekData=Hf(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function es(t,e){const n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new se({...n,...e,old:n})}function gE(t,e,n){let r=t-e*60*1e3;const i=n.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;const s=n.offset(r);return i===s?[r,i]:[t-Math.min(i,s)*60*1e3,Math.max(i,s)]}function cc(t,e){t+=e*60*1e3;const n=new Date(t);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function Bc(t,e,n){return gE(Mh(t),e,n)}function ES(t,e){const n=t.o,r=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...t.c,year:r,month:i,day:Math.min(t.c.day,Uf(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=xe.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),l=Mh(s);let[a,u]=gE(l,n,t.zone);return o!==0&&(a+=o,u=t.zone.offset(a)),{ts:a,o:u}}function Rl(t,e,n,r,i,s){const{setZone:o,zone:l}=n;if(t&&Object.keys(t).length!==0||e){const a=e||l,u=se.fromObject(t,{...n,zone:a,specificOffset:s});return o?u:u.setZone(l)}else return se.invalid(new Xn("unparsable",`the input "${i}" can't be parsed as ${r}`))}function fc(t,e,n=!0){return t.isValid?It.create(Ae.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Zd(t,e){const n=t.c.year>9999||t.c.year<0;let r="";return n&&t.c.year>=0&&(r+="+"),r+=ot(t.c.year,n?6:4),e?(r+="-",r+=ot(t.c.month),r+="-",r+=ot(t.c.day)):(r+=ot(t.c.month),r+=ot(t.c.day)),r}function TS(t,e,n,r,i,s){let o=ot(t.c.hour);return e?(o+=":",o+=ot(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(o+=":")):o+=ot(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(o+=ot(t.c.second),(t.c.millisecond!==0||!r)&&(o+=".",o+=ot(t.c.millisecond,3))),i&&(t.isOffsetFixed&&t.offset===0&&!s?o+="Z":t.o<0?(o+="-",o+=ot(Math.trunc(-t.o/60)),o+=":",o+=ot(Math.trunc(-t.o%60))):(o+="+",o+=ot(Math.trunc(t.o/60)),o+=":",o+=ot(Math.trunc(t.o%60)))),s&&(o+="["+t.zone.ianaName+"]"),o}const yE={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},l3={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},a3={ordinal:1,hour:0,minute:0,second:0,millisecond:0},vE=["year","month","day","hour","minute","second","millisecond"],u3=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],c3=["year","ordinal","hour","minute","second","millisecond"];function f3(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new S$(t);return e}function OS(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return f3(t)}}function _S(t,e){const n=gi(e.zone,Je.defaultZone),r=Ae.fromObject(e),i=Je.now();let s,o;if(ce(t.year))s=i;else{for(const u of vE)ce(t[u])&&(t[u]=yE[u]);const l=H$(t)||U$(t);if(l)return se.invalid(l);const a=n.offset(i);[s,o]=Bc(t,a,n)}return new se({ts:s,zone:n,loc:r,o})}function AS(t,e,n){const r=ce(n.round)?!0:n.round,i=(o,l)=>(o=L0(o,r||n.calendary?0:2,!0),e.loc.clone(n).relFormatter(n).format(o,l)),s=o=>n.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(n.unit)return i(s(n.unit),n.unit);for(const o of n.units){const l=s(o);if(Math.abs(l)>=1)return i(l,o)}return i(t>e?-0:0,n.units[n.units.length-1])}function MS(t){let e={},n;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],n=Array.from(t).slice(0,t.length-1)):n=Array.from(t),[e,n]}class se{constructor(e){const n=e.zone||Je.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new Xn("invalid input"):null)||(n.isValid?null:uc(n));this.ts=ce(e.ts)?Je.now():e.ts;let i=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(n))[i,s]=[e.old.c,e.old.o];else{const l=n.offset(this.ts);i=cc(this.ts,l),r=Number.isNaN(i.year)?new Xn("invalid input"):null,i=r?null:i,s=r?null:l}this._zone=n,this.loc=e.loc||Ae.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new se({})}static local(){const[e,n]=MS(arguments),[r,i,s,o,l,a,u]=n;return _S({year:r,month:i,day:s,hour:o,minute:l,second:a,millisecond:u},e)}static utc(){const[e,n]=MS(arguments),[r,i,s,o,l,a,u]=n;return e.zone=Ht.utcInstance,_S({year:r,month:i,day:s,hour:o,minute:l,second:a,millisecond:u},e)}static fromJSDate(e,n={}){const r=jL(e)?e.valueOf():NaN;if(Number.isNaN(r))return se.invalid("invalid input");const i=gi(n.zone,Je.defaultZone);return i.isValid?new se({ts:r,zone:i,loc:Ae.fromObject(n)}):se.invalid(uc(i))}static fromMillis(e,n={}){if(ks(e))return e<-$S||e>$S?se.invalid("Timestamp out of range"):new se({ts:e,zone:gi(n.zone,Je.defaultZone),loc:Ae.fromObject(n)});throw new en(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,n={}){if(ks(e))return new se({ts:e*1e3,zone:gi(n.zone,Je.defaultZone),loc:Ae.fromObject(n)});throw new en("fromSeconds requires a numerical input")}static fromObject(e,n={}){e=e||{};const r=gi(n.zone,Je.defaultZone);if(!r.isValid)return se.invalid(uc(r));const i=Ae.fromObject(n),s=qf(e,OS),{minDaysInFirstWeek:o,startOfWeek:l}=mS(s,i),a=Je.now(),u=ce(n.specificOffset)?r.offset(a):n.specificOffset,c=!ce(s.ordinal),f=!ce(s.year),h=!ce(s.month)||!ce(s.day),d=f||h,p=s.weekYear||s.weekNumber;if((d||c)&&p)throw new mo("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&c)throw new mo("Can't mix ordinal dates with month/day");const y=p||s.weekday&&!d;let w,m,g=cc(a,u);y?(w=u3,m=l3,g=Hf(g,o,l)):c?(w=c3,m=a3,g=Ud(g)):(w=vE,m=yE);let v=!1;for(const N of w){const V=s[N];ce(V)?v?s[N]=m[N]:s[N]=g[N]:v=!0}const S=y?LL(s,o,l):c?FL(s):H$(s),$=S||U$(s);if($)return se.invalid($);const b=y?hS(s,o,l):c?dS(s):s,[x,_]=Bc(b,u,r),M=new se({ts:x,zone:r,o:_,loc:i});return s.weekday&&d&&e.weekday!==M.weekday?se.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${M.toISO()}`):M}static fromISO(e,n={}){const[r,i]=_4(e);return Rl(r,i,n,"ISO 8601",e)}static fromRFC2822(e,n={}){const[r,i]=A4(e);return Rl(r,i,n,"RFC 2822",e)}static fromHTTP(e,n={}){const[r,i]=M4(e);return Rl(r,i,n,"HTTP",n)}static fromFormat(e,n,r={}){if(ce(e)||ce(n))throw new en("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:s=null}=r,o=Ae.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[l,a,u,c]=o3(o,e,n);return c?se.invalid(c):Rl(l,a,r,`format ${n}`,e,u)}static fromString(e,n,r={}){return se.fromFormat(e,n,r)}static fromSQL(e,n={}){const[r,i]=F4(e);return Rl(r,i,n,"SQL",e)}static invalid(e,n=null){if(!e)throw new en("need to specify a reason the DateTime is invalid");const r=e instanceof Xn?e:new Xn(e,n);if(Je.throwOnInvalid)throw new dL(r);return new se({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,n={}){const r=pE(e,Ae.fromObject(n));return r?r.map(i=>i?i.val:null).join(""):null}static expandFormat(e,n={}){return dE(It.parseFormat(e),Ae.fromObject(n)).map(i=>i.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Gd(this).weekYear:NaN}get weekNumber(){return this.isValid?Gd(this).weekNumber:NaN}get weekday(){return this.isValid?Gd(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Yd(this).weekday:NaN}get localWeekNumber(){return this.isValid?Yd(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Yd(this).weekYear:NaN}get ordinal(){return this.isValid?Ud(this.c).ordinal:NaN}get monthShort(){return this.isValid?lc.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?lc.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?lc.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?lc.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,n=6e4,r=Mh(this.c),i=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-i*n),l=this.zone.offset(r-s*n);if(o===l)return[this];const a=r-o*n,u=r-l*n,c=cc(a,o),f=cc(u,l);return c.hour===f.hour&&c.minute===f.minute&&c.second===f.second&&c.millisecond===f.millisecond?[es(this,{ts:a}),es(this,{ts:u})]:[this]}get isInLeapYear(){return uu(this.year)}get daysInMonth(){return Uf(this.year,this.month)}get daysInYear(){return this.isValid?Mo(this.year):NaN}get weeksInWeekYear(){return this.isValid?Ga(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Ga(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:n,numberingSystem:r,calendar:i}=It.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:n,numberingSystem:r,outputCalendar:i}}toUTC(e=0,n={}){return this.setZone(Ht.instance(e),n)}toLocal(){return this.setZone(Je.defaultZone)}setZone(e,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(e=gi(e,Je.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(n||r){const s=e.offset(this.ts),o=this.toObject();[i]=Bc(o,s,e)}return es(this,{ts:i,zone:e})}else return se.invalid(uc(e))}reconfigure({locale:e,numberingSystem:n,outputCalendar:r}={}){const i=this.loc.clone({locale:e,numberingSystem:n,outputCalendar:r});return es(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const n=qf(e,OS),{minDaysInFirstWeek:r,startOfWeek:i}=mS(n,this.loc),s=!ce(n.weekYear)||!ce(n.weekNumber)||!ce(n.weekday),o=!ce(n.ordinal),l=!ce(n.year),a=!ce(n.month)||!ce(n.day),u=l||a,c=n.weekYear||n.weekNumber;if((u||o)&&c)throw new mo("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new mo("Can't mix ordinal dates with month/day");let f;s?f=hS({...Hf(this.c,r,i),...n},r,i):ce(n.ordinal)?(f={...this.toObject(),...n},ce(n.day)&&(f.day=Math.min(Uf(f.year,f.month),f.day))):f=dS({...Ud(this.c),...n});const[h,d]=Bc(f,this.o,this.zone);return es(this,{ts:h,o:d})}plus(e){if(!this.isValid)return this;const n=xe.fromDurationLike(e);return es(this,ES(this,n))}minus(e){if(!this.isValid)return this;const n=xe.fromDurationLike(e).negate();return es(this,ES(this,n))}startOf(e,{useLocaleWeeks:n=!1}={}){if(!this.isValid)return this;const r={},i=xe.normalizeUnit(e);switch(i){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(i==="weeks")if(n){const s=this.loc.getStartOfWeek(),{weekday:o}=this;othis.valueOf(),l=o?this:e,a=o?e:this,u=U4(l,a,s,i);return o?u.negate():u}diffNow(e="milliseconds",n={}){return this.diff(se.now(),e,n)}until(e){return this.isValid?Ze.fromDateTimes(this,e):this}hasSame(e,n,r){if(!this.isValid)return!1;const i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(n,r)<=i&&i<=s.endOf(n,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const n=e.base||se.fromObject({},{zone:this.zone}),r=e.padding?thisn.valueOf(),Math.min)}static max(...e){if(!e.every(se.isDateTime))throw new en("max requires all arguments be DateTimes");return pS(e,n=>n.valueOf(),Math.max)}static fromFormatExplain(e,n,r={}){const{locale:i=null,numberingSystem:s=null}=r,o=Ae.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return mE(o,e,n)}static fromStringExplain(e,n,r={}){return se.fromFormatExplain(e,n,r)}static get DATE_SHORT(){return Wf}static get DATE_MED(){return k$}static get DATE_MED_WITH_WEEKDAY(){return gL}static get DATE_FULL(){return b$}static get DATE_HUGE(){return x$}static get TIME_SIMPLE(){return C$}static get TIME_WITH_SECONDS(){return $$}static get TIME_WITH_SHORT_OFFSET(){return E$}static get TIME_WITH_LONG_OFFSET(){return T$}static get TIME_24_SIMPLE(){return O$}static get TIME_24_WITH_SECONDS(){return _$}static get TIME_24_WITH_SHORT_OFFSET(){return A$}static get TIME_24_WITH_LONG_OFFSET(){return M$}static get DATETIME_SHORT(){return P$}static get DATETIME_SHORT_WITH_SECONDS(){return N$}static get DATETIME_MED(){return D$}static get DATETIME_MED_WITH_SECONDS(){return R$}static get DATETIME_MED_WITH_WEEKDAY(){return yL}static get DATETIME_FULL(){return I$}static get DATETIME_FULL_WITH_SECONDS(){return L$}static get DATETIME_HUGE(){return F$}static get DATETIME_HUGE_WITH_SECONDS(){return z$}}function Il(t){if(se.isDateTime(t))return t;if(t&&t.valueOf&&ks(t.valueOf()))return se.fromJSDate(t);if(t&&typeof t=="object")return se.fromObject(t);throw new en(`Unknown datetime argument: ${t}, of type ${typeof t}`)}Je.defaultZone="utc";const h3=/^\d{4}-\d{2}-\d{2}$/,d3=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/,wr=t=>t==="..",po=t=>h3.test(t),go=t=>d3.test(t),V0=[];V0.push({name:"/req/core/interval",validateFeature:t=>{var n;const e=(n=t.time)==null?void 0:n.interval;if(e!==void 0&&!wr(e[0])&&!wr(e[1])&&se.fromISO(e[0])>se.fromISO(e[1]))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes an "interval" member, the start instant must be earlier than or equal to the end instant.'};if(e!==void 0&&po(e[0])&&go(e[1]))return{pointer:"/time",message:'If the start is a date, the end SHALL be a date, too, or "..".'};if(e!==void 0&&go(e[0])&&po(e[1]))return{pointer:"/time",message:'If the start is a timestamp, the end SHALL be a timestamp, too, or "..".'}}});V0.push({name:"/req/core/instant-and-interval",validateFeature:t=>{if(t.time!==null){const{date:e,timestamp:n,interval:r}=t.time;if(e!==void 0&&n!==void 0&&!n.startsWith(e))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes both a "date" and a "timestamp" member, the full-date parts SHALL be identical.'};if(n!==void 0&&r!==void 0){const i=se.fromISO(n),s=i.startOf("day");if((po(r[0])||po(r[1]))&&(!wr(r[0])&&sse.fromISO(r[1])))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes both a "timestamp" and an "interval" member with start/end dates, the interval SHALL contain the date of the timestamp.'};if((go(r[0])||go(r[1]))&&(!wr(r[0])&&ise.fromISO(r[1])))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes both a "timestamp" and an "interval" member with start/end timestamps, the interval SHALL contain the timestamp.'}}if(e!==void 0&&r!==void 0){const i=se.fromISO(e);if((po(r[0])||po(r[1]))&&(!wr(r[0])&&ise.fromISO(r[1])))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes both a "date" and an "interval" member with start/end dates, the interval SHALL contain the date.'};if((go(r[0])||go(r[1]))&&(!wr(r[0])&&ise.fromISO(r[1]).startOf("day")))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes both a "date" and an "interval" member with start/end timestamps, the interval SHALL include timestamps on the date.'}}}}});const m3="http://www.opengis.net/spec/json-fg-1/0.2/conf/types-schemas",p3="[ogc-json-fg-1-0.2:types-schemas]",yo=t=>t.conformsTo!==void 0&&(t.conformsTo.includes(m3)||t.conformsTo.includes(p3)),W0=[];W0.push({name:"/req/types-schemas/metadata",validateFeature:(t,e)=>{if(e&&t.featureType!==void 0&&!yo(t))return{pointer:"/conformsTo",message:'When the "featureType" member is present, the "conformsTo" member of the JSON document SHALL include at least the Feature Types and Schemas conformance class.'}},validateFeatureCollection:t=>{if((t.featureType!==void 0||t.features.some(e=>e.featureType!==void 0))&&!yo(t))return{pointer:"/conformsTo",message:'When the "featureType" member is present, the "conformsTo" member of the JSON document SHALL include at least the Feature Types and Schemas conformance class.'}}});W0.push({name:"/req/types-schemas/feature-type",validateFeature:(t,e)=>{if(e&&yo(t)&&t.featureType===void 0)return{pointer:"/conformsTo",message:'When the document conforms to the Feature Types and Schemas conformance class, the "featureType" member must be present.'}},validateFeatureCollection:t=>{if(yo(t)&&t.featureType===void 0&&t.features.every(e=>e.featureType===void 0))return{pointer:"/conformsTo",message:'When the document conforms to the Feature Types and Schemas conformance class, the "featureType" member must be present in either the collection or in every individual feature.'};if(yo(t)&&t.featureType!==void 0&&t.features.some(e=>e.featureType!==void 0))return{pointer:"/conformsTo",message:'When the document contains a "featureType" member, individual members may not contain a "featureType" member.'};if(yo(t)&&t.featureType===void 0&&t.features.some(e=>e.featureType!==void 0)&&!t.features.every(e=>e.featureType!==void 0))return{pointer:"/conformsTo",message:'When the document does not contain a "featureType" member, every individual feature must contain a "featureType" member.'}}});const g3=[...w$,...V0,...N0,...v$,...W0],y3=(t,e)=>{var r,i,s;const n=[];if(e.type===qp.FEATURE){const o=(r=t.validateFeature)==null?void 0:r.call(void 0,e,!0);o&&n.push(o)}if(e.type===qp.FEATURECOLLECTION){const o=(i=t.validateFeatureCollection)==null?void 0:i.call(void 0,e);o&&n.push(o),(s=e.features)==null||s.forEach((l,a)=>{var c;const u=(c=t.validateFeature)==null?void 0:c.call(void 0,l,!1);u&&n.push({...u,pointer:"/features/"+a+u.pointer})})}return n},v3=c$(t=>{const e=t.state.doc.toString(),n=JSON.parse(e),r=y$(t.state),i=[];return g3.forEach(s=>{y3(s,n).forEach(l=>{const a=r.get(l.pointer);i.push({from:a.valueFrom,to:a.valueTo,severity:"error",message:l.message})})}),i});var eg={exports:{}},wE={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(M,N){return{validate:M,compare:N}}t.fullFormats={date:e(s,o),time:e(a,u),"date-time":e(f,h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:y,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:_,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:m,int32:{type:"number",validate:S},int64:{type:"number",validate:$},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);function n(M){return M%4===0&&(M%100!==0||M%400===0)}const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(M){const N=r.exec(M);if(!N)return!1;const V=+N[1],B=+N[2],te=+N[3];return B>=1&&B<=12&&te>=1&&te<=(B===2&&n(V)?29:i[B])}function o(M,N){if(M&&N)return M>N?1:MN?1:M=g}function $(M){return Number.isInteger(M)}function b(){return!0}const x=/[^\\]\\Z/;function _(M){if(x.test(M))return!1;try{return new RegExp(M),!0}catch{return!1}}})(wE);var SE={},tg={exports:{}},H0={},zn={},Go={},hu={},ae={},Ya={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends e{constructor(g){if(super(),!t.IDENTIFIER.test(g))throw new Error("CodeGen: name must be a valid identifier");this.str=g}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class r extends e{constructor(g){super(),this._items=typeof g=="string"?[g]:g}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const g=this._items[0];return g===""||g==='""'}get str(){var g;return(g=this._str)!==null&&g!==void 0?g:this._str=this._items.reduce((v,S)=>`${v}${S}`,"")}get names(){var g;return(g=this._names)!==null&&g!==void 0?g:this._names=this._items.reduce((v,S)=>(S instanceof n&&(v[S.str]=(v[S.str]||0)+1),v),{})}}t._Code=r,t.nil=new r("");function i(m,...g){const v=[m[0]];let S=0;for(;S{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,e._)`${u}${f.scopePath}`})}scopeCode(u=this._values,c,f){return this._reduceValues(u,h=>{if(h.value===void 0)throw new Error(`CodeGen: name "${h}" has no value`);return h.value.code},c,f)}_reduceValues(u,c,f={},h){let d=e.nil;for(const p in u){const y=u[p];if(!y)continue;const w=f[p]=f[p]||new Map;y.forEach(m=>{if(w.has(m))return;w.set(m,r.Started);let g=c(m);if(g){const v=this.opts.es5?t.varKinds.var:t.varKinds.const;d=(0,e._)`${d}${v} ${m} = ${g};${this.opts._n}`}else if(g=h==null?void 0:h(m))d=(0,e._)`${d}${g}${this.opts._n}`;else throw new n(m);w.set(m,r.Completed)})}return d}}t.ValueScope=l})(ng);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=Ya,n=ng;var r=Ya;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var i=ng;Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class s{optimizeNodes(){return this}optimizeNames(k,E){return this}}class o extends s{constructor(k,E,L){super(),this.varKind=k,this.name=E,this.rhs=L}render({es5:k,_n:E}){const L=k?n.varKinds.var:this.varKind,q=this.rhs===void 0?"":` = ${this.rhs}`;return`${L} ${this.name}${q};`+E}optimizeNames(k,E){if(k[this.name.str])return this.rhs&&(this.rhs=Q(this.rhs,k,E)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class l extends s{constructor(k,E,L){super(),this.lhs=k,this.rhs=E,this.sideEffects=L}render({_n:k}){return`${this.lhs} = ${this.rhs};`+k}optimizeNames(k,E){if(!(this.lhs instanceof e.Name&&!k[this.lhs.str]&&!this.sideEffects))return this.rhs=Q(this.rhs,k,E),this}get names(){const k=this.lhs instanceof e.Name?{}:{...this.lhs.names};return te(k,this.rhs)}}class a extends l{constructor(k,E,L,q){super(k,L,q),this.op=E}render({_n:k}){return`${this.lhs} ${this.op}= ${this.rhs};`+k}}class u extends s{constructor(k){super(),this.label=k,this.names={}}render({_n:k}){return`${this.label}:`+k}}class c extends s{constructor(k){super(),this.label=k,this.names={}}render({_n:k}){return`break${this.label?` ${this.label}`:""};`+k}}class f extends s{constructor(k){super(),this.error=k}render({_n:k}){return`throw ${this.error};`+k}get names(){return this.error.names}}class h extends s{constructor(k){super(),this.code=k}render({_n:k}){return`${this.code};`+k}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(k,E){return this.code=Q(this.code,k,E),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class d extends s{constructor(k=[]){super(),this.nodes=k}render(k){return this.nodes.reduce((E,L)=>E+L.render(k),"")}optimizeNodes(){const{nodes:k}=this;let E=k.length;for(;E--;){const L=k[E].optimizeNodes();Array.isArray(L)?k.splice(E,1,...L):L?k[E]=L:k.splice(E,1)}return k.length>0?this:void 0}optimizeNames(k,E){const{nodes:L}=this;let q=L.length;for(;q--;){const J=L[q];J.optimizeNames(k,E)||(fe(k,J.names),L.splice(q,1))}return L.length>0?this:void 0}get names(){return this.nodes.reduce((k,E)=>B(k,E.names),{})}}class p extends d{render(k){return"{"+k._n+super.render(k)+"}"+k._n}}class y extends d{}class w extends p{}w.kind="else";class m extends p{constructor(k,E){super(E),this.condition=k}render(k){let E=`if(${this.condition})`+super.render(k);return this.else&&(E+="else "+this.else.render(k)),E}optimizeNodes(){super.optimizeNodes();const k=this.condition;if(k===!0)return this.nodes;let E=this.else;if(E){const L=E.optimizeNodes();E=this.else=Array.isArray(L)?new w(L):L}if(E)return k===!1?E instanceof m?E:E.nodes:this.nodes.length?this:new m(Ee(k),E instanceof m?[E]:E.nodes);if(!(k===!1||!this.nodes.length))return this}optimizeNames(k,E){var L;if(this.else=(L=this.else)===null||L===void 0?void 0:L.optimizeNames(k,E),!!(super.optimizeNames(k,E)||this.else))return this.condition=Q(this.condition,k,E),this}get names(){const k=super.names;return te(k,this.condition),this.else&&B(k,this.else.names),k}}m.kind="if";class g extends p{}g.kind="for";class v extends g{constructor(k){super(),this.iteration=k}render(k){return`for(${this.iteration})`+super.render(k)}optimizeNames(k,E){if(super.optimizeNames(k,E))return this.iteration=Q(this.iteration,k,E),this}get names(){return B(super.names,this.iteration.names)}}class S extends g{constructor(k,E,L,q){super(),this.varKind=k,this.name=E,this.from=L,this.to=q}render(k){const E=k.es5?n.varKinds.var:this.varKind,{name:L,from:q,to:J}=this;return`for(${E} ${L}=${q}; ${L}<${J}; ${L}++)`+super.render(k)}get names(){const k=te(super.names,this.from);return te(k,this.to)}}class $ extends g{constructor(k,E,L,q){super(),this.loop=k,this.varKind=E,this.name=L,this.iterable=q}render(k){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(k)}optimizeNames(k,E){if(super.optimizeNames(k,E))return this.iterable=Q(this.iterable,k,E),this}get names(){return B(super.names,this.iterable.names)}}class b extends p{constructor(k,E,L){super(),this.name=k,this.args=E,this.async=L}render(k){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(k)}}b.kind="func";class x extends d{render(k){return"return "+super.render(k)}}x.kind="return";class _ extends p{render(k){let E="try"+super.render(k);return this.catch&&(E+=this.catch.render(k)),this.finally&&(E+=this.finally.render(k)),E}optimizeNodes(){var k,E;return super.optimizeNodes(),(k=this.catch)===null||k===void 0||k.optimizeNodes(),(E=this.finally)===null||E===void 0||E.optimizeNodes(),this}optimizeNames(k,E){var L,q;return super.optimizeNames(k,E),(L=this.catch)===null||L===void 0||L.optimizeNames(k,E),(q=this.finally)===null||q===void 0||q.optimizeNames(k,E),this}get names(){const k=super.names;return this.catch&&B(k,this.catch.names),this.finally&&B(k,this.finally.names),k}}class M extends p{constructor(k){super(),this.error=k}render(k){return`catch(${this.error})`+super.render(k)}}M.kind="catch";class N extends p{render(k){return"finally"+super.render(k)}}N.kind="finally";class V{constructor(k,E={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...E,_n:E.lines?` -`:""},this._extScope=k,this._scope=new n.Scope({parent:k}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(k){return this._scope.name(k)}scopeName(k){return this._extScope.name(k)}scopeValue(k,E){const L=this._extScope.value(k,E);return(this._values[L.prefix]||(this._values[L.prefix]=new Set)).add(L),L}getScopeValue(k,E){return this._extScope.getValue(k,E)}scopeRefs(k){return this._extScope.scopeRefs(k,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(k,E,L,q){const J=this._scope.toName(E);return L!==void 0&&q&&(this._constants[J.str]=L),this._leafNode(new o(k,J,L)),J}const(k,E,L){return this._def(n.varKinds.const,k,E,L)}let(k,E,L){return this._def(n.varKinds.let,k,E,L)}var(k,E,L){return this._def(n.varKinds.var,k,E,L)}assign(k,E,L){return this._leafNode(new l(k,E,L))}add(k,E){return this._leafNode(new a(k,t.operators.ADD,E))}code(k){return typeof k=="function"?k():k!==e.nil&&this._leafNode(new h(k)),this}object(...k){const E=["{"];for(const[L,q]of k)E.length>1&&E.push(","),E.push(L),(L!==q||this.opts.es5)&&(E.push(":"),(0,e.addCodeArg)(E,q));return E.push("}"),new e._Code(E)}if(k,E,L){if(this._blockNode(new m(k)),E&&L)this.code(E).else().code(L).endIf();else if(E)this.code(E).endIf();else if(L)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(k){return this._elseNode(new m(k))}else(){return this._elseNode(new w)}endIf(){return this._endBlockNode(m,w)}_for(k,E){return this._blockNode(k),E&&this.code(E).endFor(),this}for(k,E){return this._for(new v(k),E)}forRange(k,E,L,q,J=this.opts.es5?n.varKinds.var:n.varKinds.let){const ye=this._scope.toName(k);return this._for(new S(J,ye,E,L),()=>q(ye))}forOf(k,E,L,q=n.varKinds.const){const J=this._scope.toName(k);if(this.opts.es5){const ye=E instanceof e.Name?E:this.var("_arr",E);return this.forRange("_i",0,(0,e._)`${ye}.length`,Se=>{this.var(J,(0,e._)`${ye}[${Se}]`),L(J)})}return this._for(new $("of",q,J,E),()=>L(J))}forIn(k,E,L,q=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(k,(0,e._)`Object.keys(${E})`,L);const J=this._scope.toName(k);return this._for(new $("in",q,J,E),()=>L(J))}endFor(){return this._endBlockNode(g)}label(k){return this._leafNode(new u(k))}break(k){return this._leafNode(new c(k))}return(k){const E=new x;if(this._blockNode(E),this.code(k),E.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(x)}try(k,E,L){if(!E&&!L)throw new Error('CodeGen: "try" without "catch" and "finally"');const q=new _;if(this._blockNode(q),this.code(k),E){const J=this.name("e");this._currNode=q.catch=new M(J),E(J)}return L&&(this._currNode=q.finally=new N,this.code(L)),this._endBlockNode(M,N)}throw(k){return this._leafNode(new f(k))}block(k,E){return this._blockStarts.push(this._nodes.length),k&&this.code(k).endBlock(E),this}endBlock(k){const E=this._blockStarts.pop();if(E===void 0)throw new Error("CodeGen: not in self-balancing block");const L=this._nodes.length-E;if(L<0||k!==void 0&&L!==k)throw new Error(`CodeGen: wrong number of nodes: ${L} vs ${k} expected`);return this._nodes.length=E,this}func(k,E=e.nil,L,q){return this._blockNode(new b(k,E,L)),q&&this.code(q).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(k=1){for(;k-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(k){return this._currNode.nodes.push(k),this}_blockNode(k){this._currNode.nodes.push(k),this._nodes.push(k)}_endBlockNode(k,E){const L=this._currNode;if(L instanceof k||E&&L instanceof E)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${E?`${k.kind}/${E.kind}`:k.kind}"`)}_elseNode(k){const E=this._currNode;if(!(E instanceof m))throw new Error('CodeGen: "else" without "if"');return this._currNode=E.else=k,this}get _root(){return this._nodes[0]}get _currNode(){const k=this._nodes;return k[k.length-1]}set _currNode(k){const E=this._nodes;E[E.length-1]=k}}t.CodeGen=V;function B(P,k){for(const E in k)P[E]=(P[E]||0)+(k[E]||0);return P}function te(P,k){return k instanceof e._CodeOrName?B(P,k.names):P}function Q(P,k,E){if(P instanceof e.Name)return L(P);if(!q(P))return P;return new e._Code(P._items.reduce((J,ye)=>(ye instanceof e.Name&&(ye=L(ye)),ye instanceof e._Code?J.push(...ye._items):J.push(ye),J),[]));function L(J){const ye=E[J.str];return ye===void 0||k[J.str]!==1?J:(delete k[J.str],ye)}function q(J){return J instanceof e._Code&&J._items.some(ye=>ye instanceof e.Name&&k[ye.str]===1&&E[ye.str]!==void 0)}}function fe(P,k){for(const E in k)P[E]=(P[E]||0)-(k[E]||0)}function Ee(P){return typeof P=="boolean"||typeof P=="number"||P===null?!P:(0,e._)`!${F(P)}`}t.not=Ee;const pe=A(t.operators.AND);function H(...P){return P.reduce(pe)}t.and=H;const Y=A(t.operators.OR);function I(...P){return P.reduce(Y)}t.or=I;function A(P){return(k,E)=>k===e.nil?E:E===e.nil?k:(0,e._)`${F(k)} ${P} ${F(E)}`}function F(P){return P instanceof e.Name?P:(0,e._)`(${P})`}})(ae);var ge={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const e=ae,n=Ya;function r(b){const x={};for(const _ of b)x[_]=!0;return x}t.toHash=r;function i(b,x){return typeof x=="boolean"?x:Object.keys(x).length===0?!0:(s(b,x),!o(x,b.self.RULES.all))}t.alwaysValidSchema=i;function s(b,x=b.schema){const{opts:_,self:M}=b;if(!_.strictSchema||typeof x=="boolean")return;const N=M.RULES.keywords;for(const V in x)N[V]||$(b,`unknown keyword: "${V}"`)}t.checkUnknownRules=s;function o(b,x){if(typeof b=="boolean")return!b;for(const _ in b)if(x[_])return!0;return!1}t.schemaHasRules=o;function l(b,x){if(typeof b=="boolean")return!b;for(const _ in b)if(_!=="$ref"&&x.all[_])return!0;return!1}t.schemaHasRulesButRef=l;function a({topSchemaRef:b,schemaPath:x},_,M,N){if(!N){if(typeof _=="number"||typeof _=="boolean")return _;if(typeof _=="string")return(0,e._)`${_}`}return(0,e._)`${b}${x}${(0,e.getProperty)(M)}`}t.schemaRefOrVal=a;function u(b){return h(decodeURIComponent(b))}t.unescapeFragment=u;function c(b){return encodeURIComponent(f(b))}t.escapeFragment=c;function f(b){return typeof b=="number"?`${b}`:b.replace(/~/g,"~0").replace(/\//g,"~1")}t.escapeJsonPointer=f;function h(b){return b.replace(/~1/g,"/").replace(/~0/g,"~")}t.unescapeJsonPointer=h;function d(b,x){if(Array.isArray(b))for(const _ of b)x(_);else x(b)}t.eachItem=d;function p({mergeNames:b,mergeToName:x,mergeValues:_,resultToName:M}){return(N,V,B,te)=>{const Q=B===void 0?V:B instanceof e.Name?(V instanceof e.Name?b(N,V,B):x(N,V,B),B):V instanceof e.Name?(x(N,B,V),V):_(V,B);return te===e.Name&&!(Q instanceof e.Name)?M(N,Q):Q}}t.mergeEvaluated={props:p({mergeNames:(b,x,_)=>b.if((0,e._)`${_} !== true && ${x} !== undefined`,()=>{b.if((0,e._)`${x} === true`,()=>b.assign(_,!0),()=>b.assign(_,(0,e._)`${_} || {}`).code((0,e._)`Object.assign(${_}, ${x})`))}),mergeToName:(b,x,_)=>b.if((0,e._)`${_} !== true`,()=>{x===!0?b.assign(_,!0):(b.assign(_,(0,e._)`${_} || {}`),w(b,_,x))}),mergeValues:(b,x)=>b===!0?!0:{...b,...x},resultToName:y}),items:p({mergeNames:(b,x,_)=>b.if((0,e._)`${_} !== true && ${x} !== undefined`,()=>b.assign(_,(0,e._)`${x} === true ? true : ${_} > ${x} ? ${_} : ${x}`)),mergeToName:(b,x,_)=>b.if((0,e._)`${_} !== true`,()=>b.assign(_,x===!0?!0:(0,e._)`${_} > ${x} ? ${_} : ${x}`)),mergeValues:(b,x)=>b===!0?!0:Math.max(b,x),resultToName:(b,x)=>b.var("items",x)})};function y(b,x){if(x===!0)return b.var("props",!0);const _=b.var("props",(0,e._)`{}`);return x!==void 0&&w(b,_,x),_}t.evaluatedPropsToName=y;function w(b,x,_){Object.keys(_).forEach(M=>b.assign((0,e._)`${x}${(0,e.getProperty)(M)}`,!0))}t.setEvaluated=w;const m={};function g(b,x){return b.scopeValue("func",{ref:x,code:m[x.code]||(m[x.code]=new n._Code(x.code))})}t.useFunc=g;var v;(function(b){b[b.Num=0]="Num",b[b.Str=1]="Str"})(v=t.Type||(t.Type={}));function S(b,x,_){if(b instanceof e.Name){const M=x===v.Num;return _?M?(0,e._)`"[" + ${b} + "]"`:(0,e._)`"['" + ${b} + "']"`:M?(0,e._)`"/" + ${b}`:(0,e._)`"/" + ${b}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return _?(0,e.getProperty)(b).toString():"/"+f(b)}t.getErrorPath=S;function $(b,x,_=b.opts.strictSchema){if(_){if(x=`strict mode: ${x}`,_===!0)throw new Error(x);b.self.logger.warn(x)}}t.checkStrictMode=$})(ge);var xn={};Object.defineProperty(xn,"__esModule",{value:!0});const Pt=ae,w3={data:new Pt.Name("data"),valCxt:new Pt.Name("valCxt"),instancePath:new Pt.Name("instancePath"),parentData:new Pt.Name("parentData"),parentDataProperty:new Pt.Name("parentDataProperty"),rootData:new Pt.Name("rootData"),dynamicAnchors:new Pt.Name("dynamicAnchors"),vErrors:new Pt.Name("vErrors"),errors:new Pt.Name("errors"),this:new Pt.Name("this"),self:new Pt.Name("self"),scope:new Pt.Name("scope"),json:new Pt.Name("json"),jsonPos:new Pt.Name("jsonPos"),jsonLen:new Pt.Name("jsonLen"),jsonPart:new Pt.Name("jsonPart")};xn.default=w3;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=ae,n=ge,r=xn;t.keywordError={message:({keyword:w})=>(0,e.str)`must pass "${w}" keyword validation`},t.keyword$DataError={message:({keyword:w,schemaType:m})=>m?(0,e.str)`"${w}" keyword must be ${m} ($data)`:(0,e.str)`"${w}" keyword is invalid ($data)`};function i(w,m=t.keywordError,g,v){const{it:S}=w,{gen:$,compositeRule:b,allErrors:x}=S,_=f(w,m,g);v??(b||x)?a($,_):u(S,(0,e._)`[${_}]`)}t.reportError=i;function s(w,m=t.keywordError,g){const{it:v}=w,{gen:S,compositeRule:$,allErrors:b}=v,x=f(w,m,g);a(S,x),$||b||u(v,r.default.vErrors)}t.reportExtraError=s;function o(w,m){w.assign(r.default.errors,m),w.if((0,e._)`${r.default.vErrors} !== null`,()=>w.if(m,()=>w.assign((0,e._)`${r.default.vErrors}.length`,m),()=>w.assign(r.default.vErrors,null)))}t.resetErrorsCount=o;function l({gen:w,keyword:m,schemaValue:g,data:v,errsCount:S,it:$}){if(S===void 0)throw new Error("ajv implementation error");const b=w.name("err");w.forRange("i",S,r.default.errors,x=>{w.const(b,(0,e._)`${r.default.vErrors}[${x}]`),w.if((0,e._)`${b}.instancePath === undefined`,()=>w.assign((0,e._)`${b}.instancePath`,(0,e.strConcat)(r.default.instancePath,$.errorPath))),w.assign((0,e._)`${b}.schemaPath`,(0,e.str)`${$.errSchemaPath}/${m}`),$.opts.verbose&&(w.assign((0,e._)`${b}.schema`,g),w.assign((0,e._)`${b}.data`,v))})}t.extendErrors=l;function a(w,m){const g=w.const("err",m);w.if((0,e._)`${r.default.vErrors} === null`,()=>w.assign(r.default.vErrors,(0,e._)`[${g}]`),(0,e._)`${r.default.vErrors}.push(${g})`),w.code((0,e._)`${r.default.errors}++`)}function u(w,m){const{gen:g,validateName:v,schemaEnv:S}=w;S.$async?g.throw((0,e._)`new ${w.ValidationError}(${m})`):(g.assign((0,e._)`${v}.errors`,m),g.return(!1))}const c={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function f(w,m,g){const{createErrors:v}=w.it;return v===!1?(0,e._)`{}`:h(w,m,g)}function h(w,m,g={}){const{gen:v,it:S}=w,$=[d(S,g),p(w,g)];return y(w,m,$),v.object(...$)}function d({errorPath:w},{instancePath:m}){const g=m?(0,e.str)`${w}${(0,n.getErrorPath)(m,n.Type.Str)}`:w;return[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,g)]}function p({keyword:w,it:{errSchemaPath:m}},{schemaPath:g,parentSchema:v}){let S=v?m:(0,e.str)`${m}/${w}`;return g&&(S=(0,e.str)`${S}${(0,n.getErrorPath)(g,n.Type.Str)}`),[c.schemaPath,S]}function y(w,{params:m,message:g},v){const{keyword:S,data:$,schemaValue:b,it:x}=w,{opts:_,propertyName:M,topSchemaRef:N,schemaPath:V}=x;v.push([c.keyword,S],[c.params,typeof m=="function"?m(w):m||(0,e._)`{}`]),_.messages&&v.push([c.message,typeof g=="function"?g(w):g]),_.verbose&&v.push([c.schema,b],[c.parentSchema,(0,e._)`${N}${V}`],[r.default.data,$]),M&&v.push([c.propertyName,M])}})(hu);Object.defineProperty(Go,"__esModule",{value:!0});Go.boolOrEmptySchema=Go.topBoolOrEmptySchema=void 0;const S3=hu,k3=ae,b3=xn,x3={message:"boolean schema is false"};function C3(t){const{gen:e,schema:n,validateName:r}=t;n===!1?kE(t,!1):typeof n=="object"&&n.$async===!0?e.return(b3.default.data):(e.assign((0,k3._)`${r}.errors`,null),e.return(!0))}Go.topBoolOrEmptySchema=C3;function $3(t,e){const{gen:n,schema:r}=t;r===!1?(n.var(e,!1),kE(t)):n.var(e,!0)}Go.boolOrEmptySchema=$3;function kE(t,e){const{gen:n,data:r}=t,i={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,S3.reportError)(i,x3,void 0,e)}var du={},Ms={};Object.defineProperty(Ms,"__esModule",{value:!0});Ms.getRules=Ms.isJSONType=void 0;const E3=["string","number","integer","boolean","null","object","array"],T3=new Set(E3);function O3(t){return typeof t=="string"&&T3.has(t)}Ms.isJSONType=O3;function _3(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Ms.getRules=_3;var Br={};Object.defineProperty(Br,"__esModule",{value:!0});Br.shouldUseRule=Br.shouldUseGroup=Br.schemaHasRulesForType=void 0;function A3({schema:t,self:e},n){const r=e.RULES.types[n];return r&&r!==!0&&bE(t,r)}Br.schemaHasRulesForType=A3;function bE(t,e){return e.rules.some(n=>xE(t,n))}Br.shouldUseGroup=bE;function xE(t,e){var n;return t[e.keyword]!==void 0||((n=e.definition.implements)===null||n===void 0?void 0:n.some(r=>t[r]!==void 0))}Br.shouldUseRule=xE;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const e=Ms,n=Br,r=hu,i=ae,s=ge;var o;(function(v){v[v.Correct=0]="Correct",v[v.Wrong=1]="Wrong"})(o=t.DataType||(t.DataType={}));function l(v){const S=a(v.type);if(S.includes("null")){if(v.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!S.length&&v.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');v.nullable===!0&&S.push("null")}return S}t.getSchemaTypes=l;function a(v){const S=Array.isArray(v)?v:v?[v]:[];if(S.every(e.isJSONType))return S;throw new Error("type must be JSONType or JSONType[]: "+S.join(","))}t.getJSONTypes=a;function u(v,S){const{gen:$,data:b,opts:x}=v,_=f(S,x.coerceTypes),M=S.length>0&&!(_.length===0&&S.length===1&&(0,n.schemaHasRulesForType)(v,S[0]));if(M){const N=y(S,b,x.strictNumbers,o.Wrong);$.if(N,()=>{_.length?h(v,S,_):m(v)})}return M}t.coerceAndCheckDataType=u;const c=new Set(["string","number","integer","boolean","null"]);function f(v,S){return S?v.filter($=>c.has($)||S==="array"&&$==="array"):[]}function h(v,S,$){const{gen:b,data:x,opts:_}=v,M=b.let("dataType",(0,i._)`typeof ${x}`),N=b.let("coerced",(0,i._)`undefined`);_.coerceTypes==="array"&&b.if((0,i._)`${M} == 'object' && Array.isArray(${x}) && ${x}.length == 1`,()=>b.assign(x,(0,i._)`${x}[0]`).assign(M,(0,i._)`typeof ${x}`).if(y(S,x,_.strictNumbers),()=>b.assign(N,x))),b.if((0,i._)`${N} !== undefined`);for(const B of $)(c.has(B)||B==="array"&&_.coerceTypes==="array")&&V(B);b.else(),m(v),b.endIf(),b.if((0,i._)`${N} !== undefined`,()=>{b.assign(x,N),d(v,N)});function V(B){switch(B){case"string":b.elseIf((0,i._)`${M} == "number" || ${M} == "boolean"`).assign(N,(0,i._)`"" + ${x}`).elseIf((0,i._)`${x} === null`).assign(N,(0,i._)`""`);return;case"number":b.elseIf((0,i._)`${M} == "boolean" || ${x} === null - || (${M} == "string" && ${x} && ${x} == +${x})`).assign(N,(0,i._)`+${x}`);return;case"integer":b.elseIf((0,i._)`${M} === "boolean" || ${x} === null - || (${M} === "string" && ${x} && ${x} == +${x} && !(${x} % 1))`).assign(N,(0,i._)`+${x}`);return;case"boolean":b.elseIf((0,i._)`${x} === "false" || ${x} === 0 || ${x} === null`).assign(N,!1).elseIf((0,i._)`${x} === "true" || ${x} === 1`).assign(N,!0);return;case"null":b.elseIf((0,i._)`${x} === "" || ${x} === 0 || ${x} === false`),b.assign(N,null);return;case"array":b.elseIf((0,i._)`${M} === "string" || ${M} === "number" - || ${M} === "boolean" || ${x} === null`).assign(N,(0,i._)`[${x}]`)}}}function d({gen:v,parentData:S,parentDataProperty:$},b){v.if((0,i._)`${S} !== undefined`,()=>v.assign((0,i._)`${S}[${$}]`,b))}function p(v,S,$,b=o.Correct){const x=b===o.Correct?i.operators.EQ:i.operators.NEQ;let _;switch(v){case"null":return(0,i._)`${S} ${x} null`;case"array":_=(0,i._)`Array.isArray(${S})`;break;case"object":_=(0,i._)`${S} && typeof ${S} == "object" && !Array.isArray(${S})`;break;case"integer":_=M((0,i._)`!(${S} % 1) && !isNaN(${S})`);break;case"number":_=M();break;default:return(0,i._)`typeof ${S} ${x} ${v}`}return b===o.Correct?_:(0,i.not)(_);function M(N=i.nil){return(0,i.and)((0,i._)`typeof ${S} == "number"`,N,$?(0,i._)`isFinite(${S})`:i.nil)}}t.checkDataType=p;function y(v,S,$,b){if(v.length===1)return p(v[0],S,$,b);let x;const _=(0,s.toHash)(v);if(_.array&&_.object){const M=(0,i._)`typeof ${S} != "object"`;x=_.null?M:(0,i._)`!${S} || ${M}`,delete _.null,delete _.array,delete _.object}else x=i.nil;_.number&&delete _.integer;for(const M in _)x=(0,i.and)(x,p(M,S,$,b));return x}t.checkDataTypes=y;const w={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:S})=>typeof v=="string"?(0,i._)`{type: ${v}}`:(0,i._)`{type: ${S}}`};function m(v){const S=g(v);(0,r.reportError)(S,w)}t.reportTypeError=m;function g(v){const{gen:S,data:$,schema:b}=v,x=(0,s.schemaRefOrVal)(v,b,"type");return{gen:S,keyword:"type",data:$,schema:b.type,schemaCode:x,schemaValue:x,parentSchema:b,params:{},it:v}}})(du);var Dh={};Object.defineProperty(Dh,"__esModule",{value:!0});Dh.assignDefaults=void 0;const Ks=ae,M3=ge;function P3(t,e){const{properties:n,items:r}=t.schema;if(e==="object"&&n)for(const i in n)PS(t,i,n[i].default);else e==="array"&&Array.isArray(r)&&r.forEach((i,s)=>PS(t,s,i.default))}Dh.assignDefaults=P3;function PS(t,e,n){const{gen:r,compositeRule:i,data:s,opts:o}=t;if(n===void 0)return;const l=(0,Ks._)`${s}${(0,Ks.getProperty)(e)}`;if(i){(0,M3.checkStrictMode)(t,`default is ignored for: ${l}`);return}let a=(0,Ks._)`${l} === undefined`;o.useDefaults==="empty"&&(a=(0,Ks._)`${a} || ${l} === null || ${l} === ""`),r.if(a,(0,Ks._)`${l} = ${(0,Ks.stringify)(n)}`)}var Tr={},de={};Object.defineProperty(de,"__esModule",{value:!0});de.validateUnion=de.validateArray=de.usePattern=de.callValidateCode=de.schemaProperties=de.allSchemaProperties=de.noPropertyInData=de.propertyInData=de.isOwnProperty=de.hasPropFunc=de.reportMissingProp=de.checkMissingProp=de.checkReportMissingProp=void 0;const Fe=ae,U0=ge,si=xn,N3=ge;function D3(t,e){const{gen:n,data:r,it:i}=t;n.if(K0(n,r,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Fe._)`${e}`},!0),t.error()})}de.checkReportMissingProp=D3;function R3({gen:t,data:e,it:{opts:n}},r,i){return(0,Fe.or)(...r.map(s=>(0,Fe.and)(K0(t,e,s,n.ownProperties),(0,Fe._)`${i} = ${s}`)))}de.checkMissingProp=R3;function I3(t,e){t.setParams({missingProperty:e},!0),t.error()}de.reportMissingProp=I3;function CE(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Fe._)`Object.prototype.hasOwnProperty`})}de.hasPropFunc=CE;function q0(t,e,n){return(0,Fe._)`${CE(t)}.call(${e}, ${n})`}de.isOwnProperty=q0;function L3(t,e,n,r){const i=(0,Fe._)`${e}${(0,Fe.getProperty)(n)} !== undefined`;return r?(0,Fe._)`${i} && ${q0(t,e,n)}`:i}de.propertyInData=L3;function K0(t,e,n,r){const i=(0,Fe._)`${e}${(0,Fe.getProperty)(n)} === undefined`;return r?(0,Fe.or)(i,(0,Fe.not)(q0(t,e,n))):i}de.noPropertyInData=K0;function $E(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}de.allSchemaProperties=$E;function F3(t,e){return $E(e).filter(n=>!(0,U0.alwaysValidSchema)(t,e[n]))}de.schemaProperties=F3;function z3({schemaCode:t,data:e,it:{gen:n,topSchemaRef:r,schemaPath:i,errorPath:s},it:o},l,a,u){const c=u?(0,Fe._)`${t}, ${e}, ${r}${i}`:e,f=[[si.default.instancePath,(0,Fe.strConcat)(si.default.instancePath,s)],[si.default.parentData,o.parentData],[si.default.parentDataProperty,o.parentDataProperty],[si.default.rootData,si.default.rootData]];o.opts.dynamicRef&&f.push([si.default.dynamicAnchors,si.default.dynamicAnchors]);const h=(0,Fe._)`${c}, ${n.object(...f)}`;return a!==Fe.nil?(0,Fe._)`${l}.call(${a}, ${h})`:(0,Fe._)`${l}(${h})`}de.callValidateCode=z3;const j3=(0,Fe._)`new RegExp`;function B3({gen:t,it:{opts:e}},n){const r=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(n,r);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Fe._)`${i.code==="new RegExp"?j3:(0,N3.useFunc)(t,i)}(${n}, ${r})`})}de.usePattern=B3;function V3(t){const{gen:e,data:n,keyword:r,it:i}=t,s=e.name("valid");if(i.allErrors){const l=e.let("valid",!0);return o(()=>e.assign(l,!1)),l}return e.var(s,!0),o(()=>e.break()),s;function o(l){const a=e.const("len",(0,Fe._)`${n}.length`);e.forRange("i",0,a,u=>{t.subschema({keyword:r,dataProp:u,dataPropType:U0.Type.Num},s),e.if((0,Fe.not)(s),l)})}}de.validateArray=V3;function W3(t){const{gen:e,schema:n,keyword:r,it:i}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(a=>(0,U0.alwaysValidSchema)(i,a))&&!i.opts.unevaluated)return;const o=e.let("valid",!1),l=e.name("_valid");e.block(()=>n.forEach((a,u)=>{const c=t.subschema({keyword:r,schemaProp:u,compositeRule:!0},l);e.assign(o,(0,Fe._)`${o} || ${l}`),t.mergeValidEvaluated(c,l)||e.if((0,Fe.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}de.validateUnion=W3;Object.defineProperty(Tr,"__esModule",{value:!0});Tr.validateKeywordUsage=Tr.validSchemaType=Tr.funcKeywordCode=Tr.macroKeywordCode=void 0;const Bt=ae,os=xn,H3=de,U3=hu;function q3(t,e){const{gen:n,keyword:r,schema:i,parentSchema:s,it:o}=t,l=e.macro.call(o.self,i,s,o),a=EE(n,r,l);o.opts.validateSchema!==!1&&o.self.validateSchema(l,!0);const u=n.name("valid");t.subschema({schema:l,schemaPath:Bt.nil,errSchemaPath:`${o.errSchemaPath}/${r}`,topSchemaRef:a,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Tr.macroKeywordCode=q3;function K3(t,e){var n;const{gen:r,keyword:i,schema:s,parentSchema:o,$data:l,it:a}=t;Y3(a,e);const u=!l&&e.compile?e.compile.call(a.self,s,o,a):e.validate,c=EE(r,i,u),f=r.let("valid");t.block$data(f,h),t.ok((n=e.valid)!==null&&n!==void 0?n:f);function h(){if(e.errors===!1)y(),e.modifying&&NS(t),w(()=>t.error());else{const m=e.async?d():p();e.modifying&&NS(t),w(()=>G3(t,m))}}function d(){const m=r.let("ruleErrs",null);return r.try(()=>y((0,Bt._)`await `),g=>r.assign(f,!1).if((0,Bt._)`${g} instanceof ${a.ValidationError}`,()=>r.assign(m,(0,Bt._)`${g}.errors`),()=>r.throw(g))),m}function p(){const m=(0,Bt._)`${c}.errors`;return r.assign(m,null),y(Bt.nil),m}function y(m=e.async?(0,Bt._)`await `:Bt.nil){const g=a.opts.passContext?os.default.this:os.default.self,v=!("compile"in e&&!l||e.schema===!1);r.assign(f,(0,Bt._)`${m}${(0,H3.callValidateCode)(t,c,g,v)}`,e.modifying)}function w(m){var g;r.if((0,Bt.not)((g=e.valid)!==null&&g!==void 0?g:f),m)}}Tr.funcKeywordCode=K3;function NS(t){const{gen:e,data:n,it:r}=t;e.if(r.parentData,()=>e.assign(n,(0,Bt._)`${r.parentData}[${r.parentDataProperty}]`))}function G3(t,e){const{gen:n}=t;n.if((0,Bt._)`Array.isArray(${e})`,()=>{n.assign(os.default.vErrors,(0,Bt._)`${os.default.vErrors} === null ? ${e} : ${os.default.vErrors}.concat(${e})`).assign(os.default.errors,(0,Bt._)`${os.default.vErrors}.length`),(0,U3.extendErrors)(t)},()=>t.error())}function Y3({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function EE(t,e,n){if(n===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,Bt.stringify)(n)})}function Z3(t,e,n=!1){return!e.length||e.some(r=>r==="array"?Array.isArray(t):r==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==r||n&&typeof t>"u")}Tr.validSchemaType=Z3;function J3({schema:t,opts:e,self:n,errSchemaPath:r},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");const o=i.dependencies;if(o!=null&&o.some(l=>!Object.prototype.hasOwnProperty.call(t,l)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){const a=`keyword "${s}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")n.logger.error(a);else throw new Error(a)}}Tr.validateKeywordUsage=J3;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.extendSubschemaMode=Ri.extendSubschemaData=Ri.getSubschema=void 0;const Cr=ae,TE=ge;function Q3(t,{keyword:e,schemaProp:n,schema:r,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){const l=t.schema[e];return n===void 0?{schema:l,schemaPath:(0,Cr._)`${t.schemaPath}${(0,Cr.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:l[n],schemaPath:(0,Cr._)`${t.schemaPath}${(0,Cr.getProperty)(e)}${(0,Cr.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,TE.escapeFragment)(n)}`}}if(r!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Ri.getSubschema=Q3;function X3(t,e,{dataProp:n,dataPropType:r,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=e;if(n!==void 0){const{errorPath:u,dataPathArr:c,opts:f}=e,h=l.let("data",(0,Cr._)`${e.data}${(0,Cr.getProperty)(n)}`,!0);a(h),t.errorPath=(0,Cr.str)`${u}${(0,TE.getErrorPath)(n,r,f.jsPropertySyntax)}`,t.parentDataProperty=(0,Cr._)`${n}`,t.dataPathArr=[...c,t.parentDataProperty]}if(i!==void 0){const u=i instanceof Cr.Name?i:l.let("data",i,!0);a(u),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function a(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Ri.extendSubschemaData=X3;function e5(t,{jtdDiscriminator:e,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:s}){r!==void 0&&(t.compositeRule=r),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=n}Ri.extendSubschemaMode=e5;var xt={},OE=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n},_E={exports:{}},xi=_E.exports=function(t,e,n){typeof e=="function"&&(n=e,e={}),n=e.cb||n;var r=typeof n=="function"?n:n.pre||function(){},i=n.post||function(){};Vc(e,r,i,t,"",t)};xi.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};xi.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};xi.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};xi.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Vc(t,e,n,r,i,s,o,l,a,u){if(r&&typeof r=="object"&&!Array.isArray(r)){e(r,i,s,o,l,a,u);for(var c in r){var f=r[c];if(Array.isArray(f)){if(c in xi.arrayKeywords)for(var h=0;he+=AE(r)),e===1/0))return 1/0}return e}function ME(t,e="",n){n!==!1&&(e=No(e));const r=t.parse(e);return PE(t,r)}xt.getFullPath=ME;function PE(t,e){return t.serialize(e).split("#")[0]+"#"}xt._getFullPath=PE;const u5=/#\/?$/;function No(t){return t?t.replace(u5,""):""}xt.normalizeId=No;function c5(t,e,n){return n=No(n),t.resolve(e,n)}xt.resolveUrl=c5;const f5=/^[a-z_][-a-z0-9._]*$/i;function h5(t,e){if(typeof t=="boolean")return{};const{schemaId:n,uriResolver:r}=this.opts,i=No(t[n]||e),s={"":i},o=ME(r,i,!1),l={},a=new Set;return s5(t,{allKeys:!0},(f,h,d,p)=>{if(p===void 0)return;const y=o+h;let w=s[p];typeof f[n]=="string"&&(w=m.call(this,f[n])),g.call(this,f.$anchor),g.call(this,f.$dynamicAnchor),s[h]=w;function m(v){const S=this.opts.uriResolver.resolve;if(v=No(w?S(w,v):v),a.has(v))throw c(v);a.add(v);let $=this.refs[v];return typeof $=="string"&&($=this.refs[$]),typeof $=="object"?u(f,$.schema,v):v!==No(y)&&(v[0]==="#"?(u(f,l[v],v),l[v]=f):this.refs[v]=y),v}function g(v){if(typeof v=="string"){if(!f5.test(v))throw new Error(`invalid anchor "${v}"`);m.call(this,`#${v}`)}}}),l;function u(f,h,d){if(h!==void 0&&!i5(f,h))throw c(d)}function c(f){return new Error(`reference "${f}" resolves to more than one schema`)}}xt.getSchemaRefs=h5;Object.defineProperty(zn,"__esModule",{value:!0});zn.getData=zn.KeywordCxt=zn.validateFunctionCode=void 0;const NE=Go,DS=du,G0=Br,Kf=du,d5=Dh,ha=Tr,Jd=Ri,ne=ae,le=xn,m5=xt,Vr=ge,Ll=hu;function p5(t){if(IE(t)&&(LE(t),RE(t))){v5(t);return}DE(t,()=>(0,NE.topBoolOrEmptySchema)(t))}zn.validateFunctionCode=p5;function DE({gen:t,validateName:e,schema:n,schemaEnv:r,opts:i},s){i.code.es5?t.func(e,(0,ne._)`${le.default.data}, ${le.default.valCxt}`,r.$async,()=>{t.code((0,ne._)`"use strict"; ${RS(n,i)}`),y5(t,i),t.code(s)}):t.func(e,(0,ne._)`${le.default.data}, ${g5(i)}`,r.$async,()=>t.code(RS(n,i)).code(s))}function g5(t){return(0,ne._)`{${le.default.instancePath}="", ${le.default.parentData}, ${le.default.parentDataProperty}, ${le.default.rootData}=${le.default.data}${t.dynamicRef?(0,ne._)`, ${le.default.dynamicAnchors}={}`:ne.nil}}={}`}function y5(t,e){t.if(le.default.valCxt,()=>{t.var(le.default.instancePath,(0,ne._)`${le.default.valCxt}.${le.default.instancePath}`),t.var(le.default.parentData,(0,ne._)`${le.default.valCxt}.${le.default.parentData}`),t.var(le.default.parentDataProperty,(0,ne._)`${le.default.valCxt}.${le.default.parentDataProperty}`),t.var(le.default.rootData,(0,ne._)`${le.default.valCxt}.${le.default.rootData}`),e.dynamicRef&&t.var(le.default.dynamicAnchors,(0,ne._)`${le.default.valCxt}.${le.default.dynamicAnchors}`)},()=>{t.var(le.default.instancePath,(0,ne._)`""`),t.var(le.default.parentData,(0,ne._)`undefined`),t.var(le.default.parentDataProperty,(0,ne._)`undefined`),t.var(le.default.rootData,le.default.data),e.dynamicRef&&t.var(le.default.dynamicAnchors,(0,ne._)`{}`)})}function v5(t){const{schema:e,opts:n,gen:r}=t;DE(t,()=>{n.$comment&&e.$comment&&zE(t),x5(t),r.let(le.default.vErrors,null),r.let(le.default.errors,0),n.unevaluated&&w5(t),FE(t),E5(t)})}function w5(t){const{gen:e,validateName:n}=t;t.evaluated=e.const("evaluated",(0,ne._)`${n}.evaluated`),e.if((0,ne._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ne._)`${t.evaluated}.props`,(0,ne._)`undefined`)),e.if((0,ne._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ne._)`${t.evaluated}.items`,(0,ne._)`undefined`))}function RS(t,e){const n=typeof t=="object"&&t[e.schemaId];return n&&(e.code.source||e.code.process)?(0,ne._)`/*# sourceURL=${n} */`:ne.nil}function S5(t,e){if(IE(t)&&(LE(t),RE(t))){k5(t,e);return}(0,NE.boolOrEmptySchema)(t,e)}function RE({schema:t,self:e}){if(typeof t=="boolean")return!t;for(const n in t)if(e.RULES.all[n])return!0;return!1}function IE(t){return typeof t.schema!="boolean"}function k5(t,e){const{schema:n,gen:r,opts:i}=t;i.$comment&&n.$comment&&zE(t),C5(t),$5(t);const s=r.const("_errs",le.default.errors);FE(t,s),r.var(e,(0,ne._)`${s} === ${le.default.errors}`)}function LE(t){(0,Vr.checkUnknownRules)(t),b5(t)}function FE(t,e){if(t.opts.jtd)return IS(t,[],!1,e);const n=(0,DS.getSchemaTypes)(t.schema),r=(0,DS.coerceAndCheckDataType)(t,n);IS(t,n,!r,e)}function b5(t){const{schema:e,errSchemaPath:n,opts:r,self:i}=t;e.$ref&&r.ignoreKeywordsWithRef&&(0,Vr.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function x5(t){const{schema:e,opts:n}=t;e.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,Vr.checkStrictMode)(t,"default is ignored in the schema root")}function C5(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,m5.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function $5(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function zE({gen:t,schemaEnv:e,schema:n,errSchemaPath:r,opts:i}){const s=n.$comment;if(i.$comment===!0)t.code((0,ne._)`${le.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){const o=(0,ne.str)`${r}/$comment`,l=t.scopeValue("root",{ref:e.root});t.code((0,ne._)`${le.default.self}.opts.$comment(${s}, ${o}, ${l}.schema)`)}}function E5(t){const{gen:e,schemaEnv:n,validateName:r,ValidationError:i,opts:s}=t;n.$async?e.if((0,ne._)`${le.default.errors} === 0`,()=>e.return(le.default.data),()=>e.throw((0,ne._)`new ${i}(${le.default.vErrors})`)):(e.assign((0,ne._)`${r}.errors`,le.default.vErrors),s.unevaluated&&T5(t),e.return((0,ne._)`${le.default.errors} === 0`))}function T5({gen:t,evaluated:e,props:n,items:r}){n instanceof ne.Name&&t.assign((0,ne._)`${e}.props`,n),r instanceof ne.Name&&t.assign((0,ne._)`${e}.items`,r)}function IS(t,e,n,r){const{gen:i,schema:s,data:o,allErrors:l,opts:a,self:u}=t,{RULES:c}=u;if(s.$ref&&(a.ignoreKeywordsWithRef||!(0,Vr.schemaHasRulesButRef)(s,c))){i.block(()=>VE(t,"$ref",c.all.$ref.definition));return}a.jtd||O5(t,e),i.block(()=>{for(const h of c.rules)f(h);f(c.post)});function f(h){(0,G0.shouldUseGroup)(s,h)&&(h.type?(i.if((0,Kf.checkDataType)(h.type,o,a.strictNumbers)),LS(t,h),e.length===1&&e[0]===h.type&&n&&(i.else(),(0,Kf.reportTypeError)(t)),i.endIf()):LS(t,h),l||i.if((0,ne._)`${le.default.errors} === ${r||0}`))}}function LS(t,e){const{gen:n,schema:r,opts:{useDefaults:i}}=t;i&&(0,d5.assignDefaults)(t,e.type),n.block(()=>{for(const s of e.rules)(0,G0.shouldUseRule)(r,s)&&VE(t,s.keyword,s.definition,e.type)})}function O5(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(_5(t,e),t.opts.allowUnionTypes||A5(t,e),M5(t,t.dataTypes))}function _5(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(n=>{jE(t.dataTypes,n)||Y0(t,`type "${n}" not allowed by context "${t.dataTypes.join(",")}"`)}),N5(t,e)}}function A5(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Y0(t,"use allowUnionTypes to allow union type keyword")}function M5(t,e){const n=t.self.RULES.all;for(const r in n){const i=n[r];if(typeof i=="object"&&(0,G0.shouldUseRule)(t.schema,i)){const{type:s}=i.definition;s.length&&!s.some(o=>P5(e,o))&&Y0(t,`missing type "${s.join(",")}" for keyword "${r}"`)}}}function P5(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function jE(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function N5(t,e){const n=[];for(const r of t.dataTypes)jE(e,r)?n.push(r):e.includes("integer")&&r==="number"&&n.push("integer");t.dataTypes=n}function Y0(t,e){const n=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${n}" (strictTypes)`,(0,Vr.checkStrictMode)(t,e,t.opts.strictTypes)}class BE{constructor(e,n,r){if((0,ha.validateKeywordUsage)(e,n,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=n.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Vr.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=n,this.$data)this.schemaCode=e.gen.const("vSchema",WE(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,ha.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=e.gen.const("_errs",le.default.errors))}result(e,n,r){this.failResult((0,ne.not)(e),n,r)}failResult(e,n,r){this.gen.if(e),r?r():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,n){this.failResult((0,ne.not)(e),void 0,n)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:n}=this;this.fail((0,ne._)`${n} !== undefined && (${(0,ne.or)(this.invalid$data(),e)})`)}error(e,n,r){if(n){this.setParams(n),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,n){(e?Ll.reportExtraError:Ll.reportError)(this,this.def.error,n)}$dataError(){(0,Ll.reportError)(this,this.def.$dataError||Ll.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ll.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,n){n?Object.assign(this.params,e):this.params=e}block$data(e,n,r=ne.nil){this.gen.block(()=>{this.check$data(e,r),n()})}check$data(e=ne.nil,n=ne.nil){if(!this.$data)return;const{gen:r,schemaCode:i,schemaType:s,def:o}=this;r.if((0,ne.or)((0,ne._)`${i} === undefined`,n)),e!==ne.nil&&r.assign(e,!0),(s.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==ne.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:n,schemaType:r,def:i,it:s}=this;return(0,ne.or)(o(),l());function o(){if(r.length){if(!(n instanceof ne.Name))throw new Error("ajv implementation error");const a=Array.isArray(r)?r:[r];return(0,ne._)`${(0,Kf.checkDataTypes)(a,n,s.opts.strictNumbers,Kf.DataType.Wrong)}`}return ne.nil}function l(){if(i.validateSchema){const a=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,ne._)`!${a}(${n})`}return ne.nil}}subschema(e,n){const r=(0,Jd.getSubschema)(this.it,e);(0,Jd.extendSubschemaData)(r,this.it,e),(0,Jd.extendSubschemaMode)(r,e);const i={...this.it,...r,items:void 0,props:void 0};return S5(i,n),i}mergeEvaluated(e,n){const{it:r,gen:i}=this;r.opts.unevaluated&&(r.props!==!0&&e.props!==void 0&&(r.props=Vr.mergeEvaluated.props(i,e.props,r.props,n)),r.items!==!0&&e.items!==void 0&&(r.items=Vr.mergeEvaluated.items(i,e.items,r.items,n)))}mergeValidEvaluated(e,n){const{it:r,gen:i}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return i.if(n,()=>this.mergeEvaluated(e,ne.Name)),!0}}zn.KeywordCxt=BE;function VE(t,e,n,r){const i=new BE(t,n,e);"code"in n?n.code(i,r):i.$data&&n.validate?(0,ha.funcKeywordCode)(i,n):"macro"in n?(0,ha.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,ha.funcKeywordCode)(i,n)}const D5=/^\/(?:[^~]|~0|~1)*$/,R5=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function WE(t,{dataLevel:e,dataNames:n,dataPathArr:r}){let i,s;if(t==="")return le.default.rootData;if(t[0]==="/"){if(!D5.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=le.default.rootData}else{const u=R5.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);const c=+u[1];if(i=u[2],i==="#"){if(c>=e)throw new Error(a("property/index",c));return r[e-c]}if(c>e)throw new Error(a("data",c));if(s=n[e-c],!i)return s}let o=s;const l=i.split("/");for(const u of l)u&&(s=(0,ne._)`${s}${(0,ne.getProperty)((0,Vr.unescapeJsonPointer)(u))}`,o=(0,ne._)`${o} && ${s}`);return o;function a(u,c){return`Cannot access ${u} ${c} levels up, current level is ${e}`}}zn.getData=WE;var ol={};Object.defineProperty(ol,"__esModule",{value:!0});class I5 extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}ol.default=I5;var ll={};Object.defineProperty(ll,"__esModule",{value:!0});const Qd=xt;class L5 extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,Qd.resolveUrl)(e,n,r),this.missingSchema=(0,Qd.normalizeId)((0,Qd.getFullPath)(e,this.missingRef))}}ll.default=L5;var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});Wt.resolveSchema=Wt.getCompilingSchema=Wt.resolveRef=Wt.compileSchema=Wt.SchemaEnv=void 0;const qn=ae,F5=ol,ts=xn,Jn=xt,FS=ge,z5=zn;class Rh{constructor(e){var n;this.refs={},this.dynamicAnchors={};let r;typeof e.schema=="object"&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(n=e.baseId)!==null&&n!==void 0?n:(0,Jn.normalizeId)(r==null?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r==null?void 0:r.$async,this.refs={}}}Wt.SchemaEnv=Rh;function Z0(t){const e=HE.call(this,t);if(e)return e;const n=(0,Jn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:r,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new qn.CodeGen(this.scope,{es5:r,lines:i,ownProperties:s});let l;t.$async&&(l=o.scopeValue("Error",{ref:F5.default,code:(0,qn._)`require("ajv/dist/runtime/validation_error").default`}));const a=o.scopeName("validate");t.validateName=a;const u={gen:o,allErrors:this.opts.allErrors,data:ts.default.data,parentData:ts.default.parentData,parentDataProperty:ts.default.parentDataProperty,dataNames:[ts.default.data],dataPathArr:[qn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,qn.stringify)(t.schema)}:{ref:t.schema}),validateName:a,ValidationError:l,schema:t.schema,schemaEnv:t,rootId:n,baseId:t.baseId||n,schemaPath:qn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,qn._)`""`,opts:this.opts,self:this};let c;try{this._compilations.add(t),(0,z5.validateFunctionCode)(u),o.optimize(this.opts.code.optimize);const f=o.toString();c=`${o.scopeRefs(ts.default.scope)}return ${f}`,this.opts.code.process&&(c=this.opts.code.process(c,t));const d=new Function(`${ts.default.self}`,`${ts.default.scope}`,c)(this,this.scope.get());if(this.scope.value(a,{ref:d}),d.errors=null,d.schema=t.schema,d.schemaEnv=t,t.$async&&(d.$async=!0),this.opts.code.source===!0&&(d.source={validateName:a,validateCode:f,scopeValues:o._values}),this.opts.unevaluated){const{props:p,items:y}=u;d.evaluated={props:p instanceof qn.Name?void 0:p,items:y instanceof qn.Name?void 0:y,dynamicProps:p instanceof qn.Name,dynamicItems:y instanceof qn.Name},d.source&&(d.source.evaluated=(0,qn.stringify)(d.evaluated))}return t.validate=d,t}catch(f){throw delete t.validate,delete t.validateName,c&&this.logger.error("Error compiling schema, function code:",c),f}finally{this._compilations.delete(t)}}Wt.compileSchema=Z0;function j5(t,e,n){var r;n=(0,Jn.resolveUrl)(this.opts.uriResolver,e,n);const i=t.refs[n];if(i)return i;let s=W5.call(this,t,n);if(s===void 0){const o=(r=t.localRefs)===null||r===void 0?void 0:r[n],{schemaId:l}=this.opts;o&&(s=new Rh({schema:o,schemaId:l,root:t,baseId:e}))}if(s!==void 0)return t.refs[n]=B5.call(this,s)}Wt.resolveRef=j5;function B5(t){return(0,Jn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Z0.call(this,t)}function HE(t){for(const e of this._compilations)if(V5(e,t))return e}Wt.getCompilingSchema=HE;function V5(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function W5(t,e){let n;for(;typeof(n=this.refs[e])=="string";)e=n;return n||this.schemas[e]||Ih.call(this,t,e)}function Ih(t,e){const n=this.opts.uriResolver.parse(e),r=(0,Jn._getFullPath)(this.opts.uriResolver,n);let i=(0,Jn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&r===i)return Xd.call(this,n,t);const s=(0,Jn.normalizeId)(r),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){const l=Ih.call(this,t,o);return typeof(l==null?void 0:l.schema)!="object"?void 0:Xd.call(this,n,l)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||Z0.call(this,o),s===(0,Jn.normalizeId)(e)){const{schema:l}=o,{schemaId:a}=this.opts,u=l[a];return u&&(i=(0,Jn.resolveUrl)(this.opts.uriResolver,i,u)),new Rh({schema:l,schemaId:a,root:t,baseId:i})}return Xd.call(this,n,o)}}Wt.resolveSchema=Ih;const H5=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xd(t,{baseId:e,schema:n,root:r}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(const l of t.fragment.slice(1).split("/")){if(typeof n=="boolean")return;const a=n[(0,FS.unescapeFragment)(l)];if(a===void 0)return;n=a;const u=typeof n=="object"&&n[this.opts.schemaId];!H5.has(l)&&u&&(e=(0,Jn.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof n!="boolean"&&n.$ref&&!(0,FS.schemaHasRulesButRef)(n,this.RULES)){const l=(0,Jn.resolveUrl)(this.opts.uriResolver,e,n.$ref);s=Ih.call(this,r,l)}const{schemaId:o}=this.opts;if(s=s||new Rh({schema:n,schemaId:o,root:r,baseId:e}),s.schema!==s.root.schema)return s}const U5="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",q5="Meta-schema for $data reference (JSON AnySchema extension proposal)",K5="object",G5=["$data"],Y5={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Z5=!1,J5={$id:U5,description:q5,type:K5,required:G5,properties:Y5,additionalProperties:Z5};var J0={},ig={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(t,e){(function(n,r){r(e)})(mT,function(n){function r(){for(var T=arguments.length,C=Array(T),O=0;O1){C[0]=C[0].slice(0,-1);for(var R=C.length-1,D=1;D= 0x80 (not a basic code point)","invalid-input":"Invalid input"},V=y-w,B=Math.floor,te=String.fromCharCode;function Q(T){throw new RangeError(N[T])}function fe(T,C){for(var O=[],R=T.length;R--;)O[R]=C(T[R]);return O}function Ee(T,C){var O=T.split("@"),R="";O.length>1&&(R=O[0]+"@",T=O[1]),T=T.replace(M,".");var D=T.split("."),re=fe(D,C).join(".");return R+re}function pe(T){for(var C=[],O=0,R=T.length;O=55296&&D<=56319&&O>1,C+=B(C/O);C>V*m>>1;D+=y)C=B(C/V);return B(D+(V+1)*C/(C+g))},F=function(C){var O=[],R=C.length,D=0,re=$,ie=S,be=C.lastIndexOf(b);be<0&&(be=0);for(var Re=0;Re=128&&Q("not-basic"),O.push(C.charCodeAt(Re));for(var et=be>0?be+1:0;et=R&&Q("invalid-input");var ue=Y(C.charCodeAt(et++));(ue>=y||ue>B((p-D)/Pe))&&Q("overflow"),D+=ue*Pe;var Ve=tt<=ie?w:tt>=ie+m?m:tt-ie;if(ueB(p/st)&&Q("overflow"),Pe*=st}var We=O.length+1;ie=A(D-ve,We,ve==0),B(D/We)>p-re&&Q("overflow"),re+=B(D/We),D%=We,O.splice(D++,0,re)}return String.fromCodePoint.apply(String,O)},P=function(C){var O=[];C=pe(C);var R=C.length,D=$,re=0,ie=S,be=!0,Re=!1,et=void 0;try{for(var ve=C[Symbol.iterator](),Pe;!(be=(Pe=ve.next()).done);be=!0){var tt=Pe.value;tt<128&&O.push(te(tt))}}catch(Sl){Re=!0,et=Sl}finally{try{!be&&ve.return&&ve.return()}finally{if(Re)throw et}}var ue=O.length,Ve=ue;for(ue&&O.push(b);Ve=D&&ZiB((p-re)/$n)&&Q("overflow"),re+=(st-D)*$n,D=st;var hr=!0,Ji=!1,Dr=void 0;try{for(var wl=C[Symbol.iterator](),Hy;!(hr=(Hy=wl.next()).done);hr=!0){var Uy=Hy.value;if(Uyp&&Q("overflow"),Uy==D){for(var gu=re,yu=y;;yu+=y){var vu=yu<=ie?w:yu>=ie+m?m:yu-ie;if(gu>6|192).toString(16).toUpperCase()+"%"+(C&63|128).toString(16).toUpperCase():O="%"+(C>>12|224).toString(16).toUpperCase()+"%"+(C>>6&63|128).toString(16).toUpperCase()+"%"+(C&63|128).toString(16).toUpperCase(),O}function ye(T){for(var C="",O=0,R=T.length;O=194&&D<224){if(R-O>=6){var re=parseInt(T.substr(O+4,2),16);C+=String.fromCharCode((D&31)<<6|re&63)}else C+=T.substr(O,6);O+=6}else if(D>=224){if(R-O>=9){var ie=parseInt(T.substr(O+4,2),16),be=parseInt(T.substr(O+7,2),16);C+=String.fromCharCode((D&15)<<12|(ie&63)<<6|be&63)}else C+=T.substr(O,9);O+=9}else C+=T.substr(O,3),O+=3}return C}function Se(T,C){function O(R){var D=ye(R);return D.match(C.UNRESERVED)?D:R}return T.scheme&&(T.scheme=String(T.scheme).replace(C.PCT_ENCODED,O).toLowerCase().replace(C.NOT_SCHEME,"")),T.userinfo!==void 0&&(T.userinfo=String(T.userinfo).replace(C.PCT_ENCODED,O).replace(C.NOT_USERINFO,J).replace(C.PCT_ENCODED,o)),T.host!==void 0&&(T.host=String(T.host).replace(C.PCT_ENCODED,O).toLowerCase().replace(C.NOT_HOST,J).replace(C.PCT_ENCODED,o)),T.path!==void 0&&(T.path=String(T.path).replace(C.PCT_ENCODED,O).replace(T.scheme?C.NOT_PATH:C.NOT_PATH_NOSCHEME,J).replace(C.PCT_ENCODED,o)),T.query!==void 0&&(T.query=String(T.query).replace(C.PCT_ENCODED,O).replace(C.NOT_QUERY,J).replace(C.PCT_ENCODED,o)),T.fragment!==void 0&&(T.fragment=String(T.fragment).replace(C.PCT_ENCODED,O).replace(C.NOT_FRAGMENT,J).replace(C.PCT_ENCODED,o)),T}function Ye(T){return T.replace(/^0*(.*)/,"$1")||"0"}function lr(T,C){var O=T.match(C.IPV4ADDRESS)||[],R=h(O,2),D=R[1];return D?D.split(".").map(Ye).join("."):T}function Is(T,C){var O=T.match(C.IPV6ADDRESS)||[],R=h(O,3),D=R[1],re=R[2];if(D){for(var ie=D.toLowerCase().split("::").reverse(),be=h(ie,2),Re=be[0],et=be[1],ve=et?et.split(":").map(Ye):[],Pe=Re.split(":").map(Ye),tt=C.IPV4ADDRESS.test(Pe[Pe.length-1]),ue=tt?7:8,Ve=Pe.length-ue,st=Array(ue),We=0;We1){var Vs=st.slice(0,cr.index),Zi=st.slice(cr.index+cr.length);fr=Vs.join(":")+"::"+Zi.join(":")}else fr=st.join(":");return re&&(fr+="%"+re),fr}else return T}var hl=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,dl="".match(/(){0}/)[1]===void 0;function an(T){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},O={},R=C.iri!==!1?f:c;C.reference==="suffix"&&(T=(C.scheme?C.scheme+":":"")+"//"+T);var D=T.match(hl);if(D){dl?(O.scheme=D[1],O.userinfo=D[3],O.host=D[4],O.port=parseInt(D[5],10),O.path=D[6]||"",O.query=D[7],O.fragment=D[8],isNaN(O.port)&&(O.port=D[5])):(O.scheme=D[1]||void 0,O.userinfo=T.indexOf("@")!==-1?D[3]:void 0,O.host=T.indexOf("//")!==-1?D[4]:void 0,O.port=parseInt(D[5],10),O.path=D[6]||"",O.query=T.indexOf("?")!==-1?D[7]:void 0,O.fragment=T.indexOf("#")!==-1?D[8]:void 0,isNaN(O.port)&&(O.port=T.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?D[4]:void 0)),O.host&&(O.host=Is(lr(O.host,R),R)),O.scheme===void 0&&O.userinfo===void 0&&O.host===void 0&&O.port===void 0&&!O.path&&O.query===void 0?O.reference="same-document":O.scheme===void 0?O.reference="relative":O.fragment===void 0?O.reference="absolute":O.reference="uri",C.reference&&C.reference!=="suffix"&&C.reference!==O.reference&&(O.error=O.error||"URI is not a "+C.reference+" reference.");var re=q[(C.scheme||O.scheme||"").toLowerCase()];if(!C.unicodeSupport&&(!re||!re.unicodeSupport)){if(O.host&&(C.domainHost||re&&re.domainHost))try{O.host=L.toASCII(O.host.replace(R.PCT_ENCODED,ye).toLowerCase())}catch(ie){O.error=O.error||"Host's domain name can not be converted to ASCII via punycode: "+ie}Se(O,c)}else Se(O,R);re&&re.parse&&re.parse(O,C)}else O.error=O.error||"URI can not be parsed.";return O}function ml(T,C){var O=C.iri!==!1?f:c,R=[];return T.userinfo!==void 0&&(R.push(T.userinfo),R.push("@")),T.host!==void 0&&R.push(Is(lr(String(T.host),O),O).replace(O.IPV6ADDRESS,function(D,re,ie){return"["+re+(ie?"%25"+ie:"")+"]"})),(typeof T.port=="number"||typeof T.port=="string")&&(R.push(":"),R.push(String(T.port))),R.length?R.join(""):void 0}var Ls=/^\.\.?\//,Fs=/^\/\.(\/|$)/,zs=/^\/\.\.(\/|$)/,pl=/^\/?(?:.|\n)*?(?=\/|$)/;function ar(T){for(var C=[];T.length;)if(T.match(Ls))T=T.replace(Ls,"");else if(T.match(Fs))T=T.replace(Fs,"/");else if(T.match(zs))T=T.replace(zs,"/"),C.pop();else if(T==="."||T==="..")T="";else{var O=T.match(pl);if(O){var R=O[0];T=T.slice(R.length),C.push(R)}else throw new Error("Unexpected dot segment condition")}return C.join("")}function Zt(T){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},O=C.iri?f:c,R=[],D=q[(C.scheme||T.scheme||"").toLowerCase()];if(D&&D.serialize&&D.serialize(T,C),T.host&&!O.IPV6ADDRESS.test(T.host)){if(C.domainHost||D&&D.domainHost)try{T.host=C.iri?L.toUnicode(T.host):L.toASCII(T.host.replace(O.PCT_ENCODED,ye).toLowerCase())}catch(be){T.error=T.error||"Host's domain name can not be converted to "+(C.iri?"Unicode":"ASCII")+" via punycode: "+be}}Se(T,O),C.reference!=="suffix"&&T.scheme&&(R.push(T.scheme),R.push(":"));var re=ml(T,C);if(re!==void 0&&(C.reference!=="suffix"&&R.push("//"),R.push(re),T.path&&T.path.charAt(0)!=="/"&&R.push("/")),T.path!==void 0){var ie=T.path;!C.absolutePath&&(!D||!D.absolutePath)&&(ie=ar(ie)),re===void 0&&(ie=ie.replace(/^\/\//,"/%2F")),R.push(ie)}return T.query!==void 0&&(R.push("?"),R.push(T.query)),T.fragment!==void 0&&(R.push("#"),R.push(T.fragment)),R.join("")}function js(T,C){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=arguments[3],D={};return R||(T=an(Zt(T,O),O),C=an(Zt(C,O),O)),O=O||{},!O.tolerant&&C.scheme?(D.scheme=C.scheme,D.userinfo=C.userinfo,D.host=C.host,D.port=C.port,D.path=ar(C.path||""),D.query=C.query):(C.userinfo!==void 0||C.host!==void 0||C.port!==void 0?(D.userinfo=C.userinfo,D.host=C.host,D.port=C.port,D.path=ar(C.path||""),D.query=C.query):(C.path?(C.path.charAt(0)==="/"?D.path=ar(C.path):((T.userinfo!==void 0||T.host!==void 0||T.port!==void 0)&&!T.path?D.path="/"+C.path:T.path?D.path=T.path.slice(0,T.path.lastIndexOf("/")+1)+C.path:D.path=C.path,D.path=ar(D.path)),D.query=C.query):(D.path=T.path,C.query!==void 0?D.query=C.query:D.query=T.query),D.userinfo=T.userinfo,D.host=T.host,D.port=T.port),D.scheme=T.scheme),D.fragment=C.fragment,D}function gl(T,C,O){var R=a({scheme:"null"},O);return Zt(js(an(T,R),an(C,R),R,!0),R)}function Gi(T,C){return typeof T=="string"?T=Zt(an(T,C),C):s(T)==="object"&&(T=an(Zt(T,C),C)),T}function yl(T,C,O){return typeof T=="string"?T=Zt(an(T,O),O):s(T)==="object"&&(T=Zt(T,O)),typeof C=="string"?C=Zt(an(C,O),O):s(C)==="object"&&(C=Zt(C,O)),T===C}function pu(T,C){return T&&T.toString().replace(!C||!C.iri?c.ESCAPE:f.ESCAPE,J)}function Cn(T,C){return T&&T.toString().replace(!C||!C.iri?c.PCT_ENCODED:f.PCT_ENCODED,ye)}var Yi={scheme:"http",domainHost:!0,parse:function(C,O){return C.host||(C.error=C.error||"HTTP URIs must have a host."),C},serialize:function(C,O){var R=String(C.scheme).toLowerCase()==="https";return(C.port===(R?443:80)||C.port==="")&&(C.port=void 0),C.path||(C.path="/"),C}},Iy={scheme:"https",domainHost:Yi.domainHost,parse:Yi.parse,serialize:Yi.serialize};function Ly(T){return typeof T.secure=="boolean"?T.secure:String(T.scheme).toLowerCase()==="wss"}var vl={scheme:"ws",domainHost:!0,parse:function(C,O){var R=C;return R.secure=Ly(R),R.resourceName=(R.path||"/")+(R.query?"?"+R.query:""),R.path=void 0,R.query=void 0,R},serialize:function(C,O){if((C.port===(Ly(C)?443:80)||C.port==="")&&(C.port=void 0),typeof C.secure=="boolean"&&(C.scheme=C.secure?"wss":"ws",C.secure=void 0),C.resourceName){var R=C.resourceName.split("?"),D=h(R,2),re=D[0],ie=D[1];C.path=re&&re!=="/"?re:void 0,C.query=ie,C.resourceName=void 0}return C.fragment=void 0,C}},Fy={scheme:"wss",domainHost:vl.domainHost,parse:vl.parse,serialize:vl.serialize},rT={},zy="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ur="[0-9A-Fa-f]",iT=i(i("%[EFef]"+ur+"%"+ur+ur+"%"+ur+ur)+"|"+i("%[89A-Fa-f]"+ur+"%"+ur+ur)+"|"+i("%"+ur+ur)),sT="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",oT="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",lT=r(oT,'[\\"\\\\]'),aT="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",uT=new RegExp(zy,"g"),Bs=new RegExp(iT,"g"),cT=new RegExp(r("[^]",sT,"[\\.]",'[\\"]',lT),"g"),jy=new RegExp(r("[^]",zy,aT),"g"),fT=jy;function Hh(T){var C=ye(T);return C.match(uT)?C:T}var By={scheme:"mailto",parse:function(C,O){var R=C,D=R.to=R.path?R.path.split(","):[];if(R.path=void 0,R.query){for(var re=!1,ie={},be=R.query.split("&"),Re=0,et=be.length;Renew RegExp(I,A);d.code="new RegExp";const p=["removeAdditional","useDefaults","coerceTypes"],y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),w={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},m={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},g=200;function v(I){var A,F,P,k,E,L,q,J,ye,Se,Ye,lr,Is,hl,dl,an,ml,Ls,Fs,zs,pl,ar,Zt,js,gl;const Gi=I.strict,yl=(A=I.code)===null||A===void 0?void 0:A.optimize,pu=yl===!0||yl===void 0?1:yl||0,Cn=(P=(F=I.code)===null||F===void 0?void 0:F.regExp)!==null&&P!==void 0?P:d,Yi=(k=I.uriResolver)!==null&&k!==void 0?k:h.default;return{strictSchema:(L=(E=I.strictSchema)!==null&&E!==void 0?E:Gi)!==null&&L!==void 0?L:!0,strictNumbers:(J=(q=I.strictNumbers)!==null&&q!==void 0?q:Gi)!==null&&J!==void 0?J:!0,strictTypes:(Se=(ye=I.strictTypes)!==null&&ye!==void 0?ye:Gi)!==null&&Se!==void 0?Se:"log",strictTuples:(lr=(Ye=I.strictTuples)!==null&&Ye!==void 0?Ye:Gi)!==null&&lr!==void 0?lr:"log",strictRequired:(hl=(Is=I.strictRequired)!==null&&Is!==void 0?Is:Gi)!==null&&hl!==void 0?hl:!1,code:I.code?{...I.code,optimize:pu,regExp:Cn}:{optimize:pu,regExp:Cn},loopRequired:(dl=I.loopRequired)!==null&&dl!==void 0?dl:g,loopEnum:(an=I.loopEnum)!==null&&an!==void 0?an:g,meta:(ml=I.meta)!==null&&ml!==void 0?ml:!0,messages:(Ls=I.messages)!==null&&Ls!==void 0?Ls:!0,inlineRefs:(Fs=I.inlineRefs)!==null&&Fs!==void 0?Fs:!0,schemaId:(zs=I.schemaId)!==null&&zs!==void 0?zs:"$id",addUsedSchema:(pl=I.addUsedSchema)!==null&&pl!==void 0?pl:!0,validateSchema:(ar=I.validateSchema)!==null&&ar!==void 0?ar:!0,validateFormats:(Zt=I.validateFormats)!==null&&Zt!==void 0?Zt:!0,unicodeRegExp:(js=I.unicodeRegExp)!==null&&js!==void 0?js:!0,int32range:(gl=I.int32range)!==null&&gl!==void 0?gl:!0,uriResolver:Yi}}class S{constructor(A={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,A=this.opts={...A,...v(A)};const{es5:F,lines:P}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:F,lines:P}),this.logger=B(A.logger);const k=A.validateFormats;A.validateFormats=!1,this.RULES=(0,s.getRules)(),$.call(this,w,A,"NOT SUPPORTED"),$.call(this,m,A,"DEPRECATED","warn"),this._metaOpts=N.call(this),A.formats&&_.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),A.keywords&&M.call(this,A.keywords),typeof A.meta=="object"&&this.addMetaSchema(A.meta),x.call(this),A.validateFormats=k}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:A,meta:F,schemaId:P}=this.opts;let k=f;P==="id"&&(k={...f},k.id=k.$id,delete k.$id),F&&A&&this.addMetaSchema(k,k[P],!1)}defaultMeta(){const{meta:A,schemaId:F}=this.opts;return this.opts.defaultMeta=typeof A=="object"?A[F]||A:void 0}validate(A,F){let P;if(typeof A=="string"){if(P=this.getSchema(A),!P)throw new Error(`no schema with key or ref "${A}"`)}else P=this.compile(A);const k=P(F);return"$async"in P||(this.errors=P.errors),k}compile(A,F){const P=this._addSchema(A,F);return P.validate||this._compileSchemaEnv(P)}compileAsync(A,F){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:P}=this.opts;return k.call(this,A,F);async function k(Se,Ye){await E.call(this,Se.$schema);const lr=this._addSchema(Se,Ye);return lr.validate||L.call(this,lr)}async function E(Se){Se&&!this.getSchema(Se)&&await k.call(this,{$ref:Se},!0)}async function L(Se){try{return this._compileSchemaEnv(Se)}catch(Ye){if(!(Ye instanceof i.default))throw Ye;return q.call(this,Ye),await J.call(this,Ye.missingSchema),L.call(this,Se)}}function q({missingSchema:Se,missingRef:Ye}){if(this.refs[Se])throw new Error(`AnySchema ${Se} is loaded but ${Ye} cannot be resolved`)}async function J(Se){const Ye=await ye.call(this,Se);this.refs[Se]||await E.call(this,Ye.$schema),this.refs[Se]||this.addSchema(Ye,Se,F)}async function ye(Se){const Ye=this._loading[Se];if(Ye)return Ye;try{return await(this._loading[Se]=P(Se))}finally{delete this._loading[Se]}}}addSchema(A,F,P,k=this.opts.validateSchema){if(Array.isArray(A)){for(const L of A)this.addSchema(L,void 0,P,k);return this}let E;if(typeof A=="object"){const{schemaId:L}=this.opts;if(E=A[L],E!==void 0&&typeof E!="string")throw new Error(`schema ${L} must be string`)}return F=(0,a.normalizeId)(F||E),this._checkUnique(F),this.schemas[F]=this._addSchema(A,P,F,k,!0),this}addMetaSchema(A,F,P=this.opts.validateSchema){return this.addSchema(A,F,!0,P),this}validateSchema(A,F){if(typeof A=="boolean")return!0;let P;if(P=A.$schema,P!==void 0&&typeof P!="string")throw new Error("$schema must be a string");if(P=P||this.opts.defaultMeta||this.defaultMeta(),!P)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const k=this.validate(P,A);if(!k&&F){const E="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(E);else throw new Error(E)}return k}getSchema(A){let F;for(;typeof(F=b.call(this,A))=="string";)A=F;if(F===void 0){const{schemaId:P}=this.opts,k=new o.SchemaEnv({schema:{},schemaId:P});if(F=o.resolveSchema.call(this,k,A),!F)return;this.refs[A]=F}return F.validate||this._compileSchemaEnv(F)}removeSchema(A){if(A instanceof RegExp)return this._removeAllSchemas(this.schemas,A),this._removeAllSchemas(this.refs,A),this;switch(typeof A){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const F=b.call(this,A);return typeof F=="object"&&this._cache.delete(F.schema),delete this.schemas[A],delete this.refs[A],this}case"object":{const F=A;this._cache.delete(F);let P=A[this.opts.schemaId];return P&&(P=(0,a.normalizeId)(P),delete this.schemas[P],delete this.refs[P]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(A){for(const F of A)this.addKeyword(F);return this}addKeyword(A,F){let P;if(typeof A=="string")P=A,typeof F=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),F.keyword=P);else if(typeof A=="object"&&F===void 0){if(F=A,P=F.keyword,Array.isArray(P)&&!P.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Q.call(this,P,F),!F)return(0,c.eachItem)(P,E=>fe.call(this,E)),this;pe.call(this,F);const k={...F,type:(0,u.getJSONTypes)(F.type),schemaType:(0,u.getJSONTypes)(F.schemaType)};return(0,c.eachItem)(P,k.type.length===0?E=>fe.call(this,E,k):E=>k.type.forEach(L=>fe.call(this,E,k,L))),this}getKeyword(A){const F=this.RULES.all[A];return typeof F=="object"?F.definition:!!F}removeKeyword(A){const{RULES:F}=this;delete F.keywords[A],delete F.all[A];for(const P of F.rules){const k=P.rules.findIndex(E=>E.keyword===A);k>=0&&P.rules.splice(k,1)}return this}addFormat(A,F){return typeof F=="string"&&(F=new RegExp(F)),this.formats[A]=F,this}errorsText(A=this.errors,{separator:F=", ",dataVar:P="data"}={}){return!A||A.length===0?"No errors":A.map(k=>`${P}${k.instancePath} ${k.message}`).reduce((k,E)=>k+F+E)}$dataMetaSchema(A,F){const P=this.RULES.all;A=JSON.parse(JSON.stringify(A));for(const k of F){const E=k.split("/").slice(1);let L=A;for(const q of E)L=L[q];for(const q in P){const J=P[q];if(typeof J!="object")continue;const{$data:ye}=J.definition,Se=L[q];ye&&Se&&(L[q]=Y(Se))}}return A}_removeAllSchemas(A,F){for(const P in A){const k=A[P];(!F||F.test(P))&&(typeof k=="string"?delete A[P]:k&&!k.meta&&(this._cache.delete(k.schema),delete A[P]))}}_addSchema(A,F,P,k=this.opts.validateSchema,E=this.opts.addUsedSchema){let L;const{schemaId:q}=this.opts;if(typeof A=="object")L=A[q];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof A!="boolean")throw new Error("schema must be object or boolean")}let J=this._cache.get(A);if(J!==void 0)return J;P=(0,a.normalizeId)(L||P);const ye=a.getSchemaRefs.call(this,A,P);return J=new o.SchemaEnv({schema:A,schemaId:q,meta:F,baseId:P,localRefs:ye}),this._cache.set(J.schema,J),E&&!P.startsWith("#")&&(P&&this._checkUnique(P),this.refs[P]=J),k&&this.validateSchema(A,!0),J}_checkUnique(A){if(this.schemas[A]||this.refs[A])throw new Error(`schema with key or id "${A}" already exists`)}_compileSchemaEnv(A){if(A.meta?this._compileMetaSchema(A):o.compileSchema.call(this,A),!A.validate)throw new Error("ajv implementation error");return A.validate}_compileMetaSchema(A){const F=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,A)}finally{this.opts=F}}}t.default=S,S.ValidationError=r.default,S.MissingRefError=i.default;function $(I,A,F,P="error"){for(const k in I){const E=k;E in A&&this.logger[P](`${F}: option ${k}. ${I[E]}`)}}function b(I){return I=(0,a.normalizeId)(I),this.schemas[I]||this.refs[I]}function x(){const I=this.opts.schemas;if(I)if(Array.isArray(I))this.addSchema(I);else for(const A in I)this.addSchema(I[A],A)}function _(){for(const I in this.opts.formats){const A=this.opts.formats[I];A&&this.addFormat(I,A)}}function M(I){if(Array.isArray(I)){this.addVocabulary(I);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const A in I){const F=I[A];F.keyword||(F.keyword=A),this.addKeyword(F)}}function N(){const I={...this.opts};for(const A of p)delete I[A];return I}const V={log(){},warn(){},error(){}};function B(I){if(I===!1)return V;if(I===void 0)return console;if(I.log&&I.warn&&I.error)return I;throw new Error("logger must implement log, warn and error methods")}const te=/^[a-z_$][a-z0-9_$:-]*$/i;function Q(I,A){const{RULES:F}=this;if((0,c.eachItem)(I,P=>{if(F.keywords[P])throw new Error(`Keyword ${P} is already defined`);if(!te.test(P))throw new Error(`Keyword ${P} has invalid name`)}),!!A&&A.$data&&!("code"in A||"validate"in A))throw new Error('$data keyword must have "code" or "validate" function')}function fe(I,A,F){var P;const k=A==null?void 0:A.post;if(F&&k)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:E}=this;let L=k?E.post:E.rules.find(({type:J})=>J===F);if(L||(L={type:F,rules:[]},E.rules.push(L)),E.keywords[I]=!0,!A)return;const q={keyword:I,definition:{...A,type:(0,u.getJSONTypes)(A.type),schemaType:(0,u.getJSONTypes)(A.schemaType)}};A.before?Ee.call(this,L,q,A.before):L.rules.push(q),E.all[I]=q,(P=A.implements)===null||P===void 0||P.forEach(J=>this.addKeyword(J))}function Ee(I,A,F){const P=I.rules.findIndex(k=>k.keyword===F);P>=0?I.rules.splice(P,0,A):(I.rules.push(A),this.logger.warn(`rule ${F} is not defined`))}function pe(I){let{metaSchema:A}=I;A!==void 0&&(I.$data&&this.opts.$data&&(A=Y(A)),I.validateSchema=this.compile(A,!0))}const H={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Y(I){return{anyOf:[I,H]}}})(H0);var Q0={},Lh={},X0={};Object.defineProperty(X0,"__esModule",{value:!0});const X5={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};X0.default=X5;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.callRef=Qr.getValidate=void 0;const e6=ll,zS=de,Jt=ae,Gs=xn,jS=Wt,hc=ge,t6={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:n,it:r}=t,{baseId:i,schemaEnv:s,validateName:o,opts:l,self:a}=r,{root:u}=s;if((n==="#"||n==="#/")&&i===u.baseId)return f();const c=jS.resolveRef.call(a,u,i,n);if(c===void 0)throw new e6.default(r.opts.uriResolver,i,n);if(c instanceof jS.SchemaEnv)return h(c);return d(c);function f(){if(s===u)return Wc(t,o,s,s.$async);const p=e.scopeValue("root",{ref:u});return Wc(t,(0,Jt._)`${p}.validate`,u,u.$async)}function h(p){const y=qE(t,p);Wc(t,y,p,p.$async)}function d(p){const y=e.scopeValue("schema",l.code.source===!0?{ref:p,code:(0,Jt.stringify)(p)}:{ref:p}),w=e.name("valid"),m=t.subschema({schema:p,dataTypes:[],schemaPath:Jt.nil,topSchemaRef:y,errSchemaPath:n},w);t.mergeEvaluated(m),t.ok(w)}}};function qE(t,e){const{gen:n}=t;return e.validate?n.scopeValue("validate",{ref:e.validate}):(0,Jt._)`${n.scopeValue("wrapper",{ref:e})}.validate`}Qr.getValidate=qE;function Wc(t,e,n,r){const{gen:i,it:s}=t,{allErrors:o,schemaEnv:l,opts:a}=s,u=a.passContext?Gs.default.this:Jt.nil;r?c():f();function c(){if(!l.$async)throw new Error("async schema referenced by sync schema");const p=i.let("valid");i.try(()=>{i.code((0,Jt._)`await ${(0,zS.callValidateCode)(t,e,u)}`),d(e),o||i.assign(p,!0)},y=>{i.if((0,Jt._)`!(${y} instanceof ${s.ValidationError})`,()=>i.throw(y)),h(y),o||i.assign(p,!1)}),t.ok(p)}function f(){t.result((0,zS.callValidateCode)(t,e,u),()=>d(e),()=>h(e))}function h(p){const y=(0,Jt._)`${p}.errors`;i.assign(Gs.default.vErrors,(0,Jt._)`${Gs.default.vErrors} === null ? ${y} : ${Gs.default.vErrors}.concat(${y})`),i.assign(Gs.default.errors,(0,Jt._)`${Gs.default.vErrors}.length`)}function d(p){var y;if(!s.opts.unevaluated)return;const w=(y=n==null?void 0:n.validate)===null||y===void 0?void 0:y.evaluated;if(s.props!==!0)if(w&&!w.dynamicProps)w.props!==void 0&&(s.props=hc.mergeEvaluated.props(i,w.props,s.props));else{const m=i.var("props",(0,Jt._)`${p}.evaluated.props`);s.props=hc.mergeEvaluated.props(i,m,s.props,Jt.Name)}if(s.items!==!0)if(w&&!w.dynamicItems)w.items!==void 0&&(s.items=hc.mergeEvaluated.items(i,w.items,s.items));else{const m=i.var("items",(0,Jt._)`${p}.evaluated.items`);s.items=hc.mergeEvaluated.items(i,m,s.items,Jt.Name)}}}Qr.callRef=Wc;Qr.default=t6;Object.defineProperty(Lh,"__esModule",{value:!0});const n6=X0,r6=Qr,i6=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",n6.default,r6.default];Lh.default=i6;var Fh={},ey={};Object.defineProperty(ey,"__esModule",{value:!0});const Gf=ae,oi=Gf.operators,Yf={maximum:{okStr:"<=",ok:oi.LTE,fail:oi.GT},minimum:{okStr:">=",ok:oi.GTE,fail:oi.LT},exclusiveMaximum:{okStr:"<",ok:oi.LT,fail:oi.GTE},exclusiveMinimum:{okStr:">",ok:oi.GT,fail:oi.LTE}},s6={message:({keyword:t,schemaCode:e})=>(0,Gf.str)`must be ${Yf[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Gf._)`{comparison: ${Yf[t].okStr}, limit: ${e}}`},o6={keyword:Object.keys(Yf),type:"number",schemaType:"number",$data:!0,error:s6,code(t){const{keyword:e,data:n,schemaCode:r}=t;t.fail$data((0,Gf._)`${n} ${Yf[e].fail} ${r} || isNaN(${n})`)}};ey.default=o6;var ty={};Object.defineProperty(ty,"__esModule",{value:!0});const da=ae,l6={message:({schemaCode:t})=>(0,da.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,da._)`{multipleOf: ${t}}`},a6={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:l6,code(t){const{gen:e,data:n,schemaCode:r,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),l=s?(0,da._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,da._)`${o} !== parseInt(${o})`;t.fail$data((0,da._)`(${r} === 0 || (${o} = ${n}/${r}, ${l}))`)}};ty.default=a6;var ny={},ry={};Object.defineProperty(ry,"__esModule",{value:!0});function KE(t){const e=t.length;let n=0,r=0,i;for(;r=55296&&i<=56319&&r(0,ls._)`{limit: ${t}}`},h6={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:f6,code(t){const{keyword:e,data:n,schemaCode:r,it:i}=t,s=e==="maxLength"?ls.operators.GT:ls.operators.LT,o=i.opts.unicode===!1?(0,ls._)`${n}.length`:(0,ls._)`${(0,u6.useFunc)(t.gen,c6.default)}(${n})`;t.fail$data((0,ls._)`${o} ${s} ${r}`)}};ny.default=h6;var iy={};Object.defineProperty(iy,"__esModule",{value:!0});const d6=de,Zf=ae,m6={message:({schemaCode:t})=>(0,Zf.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Zf._)`{pattern: ${t}}`},p6={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:m6,code(t){const{data:e,$data:n,schema:r,schemaCode:i,it:s}=t,o=s.opts.unicodeRegExp?"u":"",l=n?(0,Zf._)`(new RegExp(${i}, ${o}))`:(0,d6.usePattern)(t,r);t.fail$data((0,Zf._)`!${l}.test(${e})`)}};iy.default=p6;var sy={};Object.defineProperty(sy,"__esModule",{value:!0});const ma=ae,g6={message({keyword:t,schemaCode:e}){const n=t==="maxProperties"?"more":"fewer";return(0,ma.str)`must NOT have ${n} than ${e} properties`},params:({schemaCode:t})=>(0,ma._)`{limit: ${t}}`},y6={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:g6,code(t){const{keyword:e,data:n,schemaCode:r}=t,i=e==="maxProperties"?ma.operators.GT:ma.operators.LT;t.fail$data((0,ma._)`Object.keys(${n}).length ${i} ${r}`)}};sy.default=y6;var oy={};Object.defineProperty(oy,"__esModule",{value:!0});const Fl=de,pa=ae,v6=ge,w6={message:({params:{missingProperty:t}})=>(0,pa.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,pa._)`{missingProperty: ${t}}`},S6={keyword:"required",type:"object",schemaType:"array",$data:!0,error:w6,code(t){const{gen:e,schema:n,schemaCode:r,data:i,$data:s,it:o}=t,{opts:l}=o;if(!s&&n.length===0)return;const a=n.length>=l.loopRequired;if(o.allErrors?u():c(),l.strictRequired){const d=t.parentSchema.properties,{definedProperties:p}=t.it;for(const y of n)if((d==null?void 0:d[y])===void 0&&!p.has(y)){const w=o.schemaEnv.baseId+o.errSchemaPath,m=`required property "${y}" is not defined at "${w}" (strictRequired)`;(0,v6.checkStrictMode)(o,m,o.opts.strictRequired)}}function u(){if(a||s)t.block$data(pa.nil,f);else for(const d of n)(0,Fl.checkReportMissingProp)(t,d)}function c(){const d=e.let("missing");if(a||s){const p=e.let("valid",!0);t.block$data(p,()=>h(d,p)),t.ok(p)}else e.if((0,Fl.checkMissingProp)(t,n,d)),(0,Fl.reportMissingProp)(t,d),e.else()}function f(){e.forOf("prop",r,d=>{t.setParams({missingProperty:d}),e.if((0,Fl.noPropertyInData)(e,i,d,l.ownProperties),()=>t.error())})}function h(d,p){t.setParams({missingProperty:d}),e.forOf(d,r,()=>{e.assign(p,(0,Fl.propertyInData)(e,i,d,l.ownProperties)),e.if((0,pa.not)(p),()=>{t.error(),e.break()})},pa.nil)}}};oy.default=S6;var ly={};Object.defineProperty(ly,"__esModule",{value:!0});const ga=ae,k6={message({keyword:t,schemaCode:e}){const n=t==="maxItems"?"more":"fewer";return(0,ga.str)`must NOT have ${n} than ${e} items`},params:({schemaCode:t})=>(0,ga._)`{limit: ${t}}`},b6={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:k6,code(t){const{keyword:e,data:n,schemaCode:r}=t,i=e==="maxItems"?ga.operators.GT:ga.operators.LT;t.fail$data((0,ga._)`${n}.length ${i} ${r}`)}};ly.default=b6;var ay={},mu={};Object.defineProperty(mu,"__esModule",{value:!0});const GE=OE;GE.code='require("ajv/dist/runtime/equal").default';mu.default=GE;Object.defineProperty(ay,"__esModule",{value:!0});const em=du,vt=ae,x6=ge,C6=mu,$6={message:({params:{i:t,j:e}})=>(0,vt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,vt._)`{i: ${t}, j: ${e}}`},E6={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$6,code(t){const{gen:e,data:n,$data:r,schema:i,parentSchema:s,schemaCode:o,it:l}=t;if(!r&&!i)return;const a=e.let("valid"),u=s.items?(0,em.getSchemaTypes)(s.items):[];t.block$data(a,c,(0,vt._)`${o} === false`),t.ok(a);function c(){const p=e.let("i",(0,vt._)`${n}.length`),y=e.let("j");t.setParams({i:p,j:y}),e.assign(a,!0),e.if((0,vt._)`${p} > 1`,()=>(f()?h:d)(p,y))}function f(){return u.length>0&&!u.some(p=>p==="object"||p==="array")}function h(p,y){const w=e.name("item"),m=(0,em.checkDataTypes)(u,w,l.opts.strictNumbers,em.DataType.Wrong),g=e.const("indices",(0,vt._)`{}`);e.for((0,vt._)`;${p}--;`,()=>{e.let(w,(0,vt._)`${n}[${p}]`),e.if(m,(0,vt._)`continue`),u.length>1&&e.if((0,vt._)`typeof ${w} == "string"`,(0,vt._)`${w} += "_"`),e.if((0,vt._)`typeof ${g}[${w}] == "number"`,()=>{e.assign(y,(0,vt._)`${g}[${w}]`),t.error(),e.assign(a,!1).break()}).code((0,vt._)`${g}[${w}] = ${p}`)})}function d(p,y){const w=(0,x6.useFunc)(e,C6.default),m=e.name("outer");e.label(m).for((0,vt._)`;${p}--;`,()=>e.for((0,vt._)`${y} = ${p}; ${y}--;`,()=>e.if((0,vt._)`${w}(${n}[${p}], ${n}[${y}])`,()=>{t.error(),e.assign(a,!1).break(m)})))}}};ay.default=E6;var uy={};Object.defineProperty(uy,"__esModule",{value:!0});const sg=ae,T6=ge,O6=mu,_6={message:"must be equal to constant",params:({schemaCode:t})=>(0,sg._)`{allowedValue: ${t}}`},A6={keyword:"const",$data:!0,error:_6,code(t){const{gen:e,data:n,$data:r,schemaCode:i,schema:s}=t;r||s&&typeof s=="object"?t.fail$data((0,sg._)`!${(0,T6.useFunc)(e,O6.default)}(${n}, ${i})`):t.fail((0,sg._)`${s} !== ${n}`)}};uy.default=A6;var cy={};Object.defineProperty(cy,"__esModule",{value:!0});const Zl=ae,M6=ge,P6=mu,N6={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Zl._)`{allowedValues: ${t}}`},D6={keyword:"enum",schemaType:"array",$data:!0,error:N6,code(t){const{gen:e,data:n,$data:r,schema:i,schemaCode:s,it:o}=t;if(!r&&i.length===0)throw new Error("enum must have non-empty array");const l=i.length>=o.opts.loopEnum;let a;const u=()=>a??(a=(0,M6.useFunc)(e,P6.default));let c;if(l||r)c=e.let("valid"),t.block$data(c,f);else{if(!Array.isArray(i))throw new Error("ajv implementation error");const d=e.const("vSchema",s);c=(0,Zl.or)(...i.map((p,y)=>h(d,y)))}t.pass(c);function f(){e.assign(c,!1),e.forOf("v",s,d=>e.if((0,Zl._)`${u()}(${n}, ${d})`,()=>e.assign(c,!0).break()))}function h(d,p){const y=i[p];return typeof y=="object"&&y!==null?(0,Zl._)`${u()}(${n}, ${d}[${p}])`:(0,Zl._)`${n} === ${y}`}}};cy.default=D6;Object.defineProperty(Fh,"__esModule",{value:!0});const R6=ey,I6=ty,L6=ny,F6=iy,z6=sy,j6=oy,B6=ly,V6=ay,W6=uy,H6=cy,U6=[R6.default,I6.default,L6.default,F6.default,z6.default,j6.default,B6.default,V6.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},W6.default,H6.default];Fh.default=U6;var zh={},al={};Object.defineProperty(al,"__esModule",{value:!0});al.validateAdditionalItems=void 0;const as=ae,og=ge,q6={message:({params:{len:t}})=>(0,as.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,as._)`{limit: ${t}}`},K6={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:q6,code(t){const{parentSchema:e,it:n}=t,{items:r}=e;if(!Array.isArray(r)){(0,og.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}YE(t,r)}};function YE(t,e){const{gen:n,schema:r,data:i,keyword:s,it:o}=t;o.items=!0;const l=n.const("len",(0,as._)`${i}.length`);if(r===!1)t.setParams({len:e.length}),t.pass((0,as._)`${l} <= ${e.length}`);else if(typeof r=="object"&&!(0,og.alwaysValidSchema)(o,r)){const u=n.var("valid",(0,as._)`${l} <= ${e.length}`);n.if((0,as.not)(u),()=>a(u)),t.ok(u)}function a(u){n.forRange("i",e.length,l,c=>{t.subschema({keyword:s,dataProp:c,dataPropType:og.Type.Num},u),o.allErrors||n.if((0,as.not)(u),()=>n.break())})}}al.validateAdditionalItems=YE;al.default=K6;var fy={},ul={};Object.defineProperty(ul,"__esModule",{value:!0});ul.validateTuple=void 0;const BS=ae,Hc=ge,G6=de,Y6={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:n}=t;if(Array.isArray(e))return ZE(t,"additionalItems",e);n.items=!0,!(0,Hc.alwaysValidSchema)(n,e)&&t.ok((0,G6.validateArray)(t))}};function ZE(t,e,n=t.schema){const{gen:r,parentSchema:i,data:s,keyword:o,it:l}=t;c(i),l.opts.unevaluated&&n.length&&l.items!==!0&&(l.items=Hc.mergeEvaluated.items(r,n.length,l.items));const a=r.name("valid"),u=r.const("len",(0,BS._)`${s}.length`);n.forEach((f,h)=>{(0,Hc.alwaysValidSchema)(l,f)||(r.if((0,BS._)`${u} > ${h}`,()=>t.subschema({keyword:o,schemaProp:h,dataProp:h},a)),t.ok(a))});function c(f){const{opts:h,errSchemaPath:d}=l,p=n.length,y=p===f.minItems&&(p===f.maxItems||f[e]===!1);if(h.strictTuples&&!y){const w=`"${o}" is ${p}-tuple, but minItems or maxItems/${e} are not specified or different at path "${d}"`;(0,Hc.checkStrictMode)(l,w,h.strictTuples)}}}ul.validateTuple=ZE;ul.default=Y6;Object.defineProperty(fy,"__esModule",{value:!0});const Z6=ul,J6={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Z6.validateTuple)(t,"items")};fy.default=J6;var hy={};Object.defineProperty(hy,"__esModule",{value:!0});const VS=ae,Q6=ge,X6=de,eF=al,tF={message:({params:{len:t}})=>(0,VS.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,VS._)`{limit: ${t}}`},nF={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:tF,code(t){const{schema:e,parentSchema:n,it:r}=t,{prefixItems:i}=n;r.items=!0,!(0,Q6.alwaysValidSchema)(r,e)&&(i?(0,eF.validateAdditionalItems)(t,i):t.ok((0,X6.validateArray)(t)))}};hy.default=nF;var dy={};Object.defineProperty(dy,"__esModule",{value:!0});const Tn=ae,dc=ge,rF={message:({params:{min:t,max:e}})=>e===void 0?(0,Tn.str)`must contain at least ${t} valid item(s)`:(0,Tn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Tn._)`{minContains: ${t}}`:(0,Tn._)`{minContains: ${t}, maxContains: ${e}}`},iF={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:rF,code(t){const{gen:e,schema:n,parentSchema:r,data:i,it:s}=t;let o,l;const{minContains:a,maxContains:u}=r;s.opts.next?(o=a===void 0?1:a,l=u):o=1;const c=e.const("len",(0,Tn._)`${i}.length`);if(t.setParams({min:o,max:l}),l===void 0&&o===0){(0,dc.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&o>l){(0,dc.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,dc.alwaysValidSchema)(s,n)){let y=(0,Tn._)`${c} >= ${o}`;l!==void 0&&(y=(0,Tn._)`${y} && ${c} <= ${l}`),t.pass(y);return}s.items=!0;const f=e.name("valid");l===void 0&&o===1?d(f,()=>e.if(f,()=>e.break())):o===0?(e.let(f,!0),l!==void 0&&e.if((0,Tn._)`${i}.length > 0`,h)):(e.let(f,!1),h()),t.result(f,()=>t.reset());function h(){const y=e.name("_valid"),w=e.let("count",0);d(y,()=>e.if(y,()=>p(w)))}function d(y,w){e.forRange("i",0,c,m=>{t.subschema({keyword:"contains",dataProp:m,dataPropType:dc.Type.Num,compositeRule:!0},y),w()})}function p(y){e.code((0,Tn._)`${y}++`),l===void 0?e.if((0,Tn._)`${y} >= ${o}`,()=>e.assign(f,!0).break()):(e.if((0,Tn._)`${y} > ${l}`,()=>e.assign(f,!1).break()),o===1?e.assign(f,!0):e.if((0,Tn._)`${y} >= ${o}`,()=>e.assign(f,!0)))}}};dy.default=iF;var jh={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=ae,n=ge,r=de;t.error={message:({params:{property:a,depsCount:u,deps:c}})=>{const f=u===1?"property":"properties";return(0,e.str)`must have ${f} ${c} when property ${a} is present`},params:({params:{property:a,depsCount:u,deps:c,missingProperty:f}})=>(0,e._)`{property: ${a}, +`+s.stack}return{value:t,source:e,stack:i,digest:null}}function pd(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Fm(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var v_=typeof WeakMap=="function"?WeakMap:Map;function qb(t,e,n){n=Br(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){pf||(pf=!0,Gm=r),Fm(t,e)},n}function Kb(t,e,n){n=Br(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){Fm(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Fm(t,e),typeof r!="function"&&(Mi===null?Mi=new Set([this]):Mi.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function Fv(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new v_;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=P_.bind(null,t,e,n),e.then(t,t))}function zv(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function jv(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=Br(-1,1),e.tag=2,_i(n,e,1))),n.lanes|=1),t)}var w_=ei.ReactCurrentOwner,nn=!1;function Bt(t,e,n,r){e.child=t===null?$b(e,null,n,r):Fo(e,t.child,n,r)}function Bv(t,e,n,r,i){n=n.render;var s=e.ref;return xo(e,i),r=Wg(t,e,n,r,s,i),n=Hg(),t!==null&&!nn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Kr(t,e,i)):(He&&n&&Ag(e),e.flags|=1,Bt(t,e,r,i),e.child)}function Vv(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!e0(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,Gb(t,e,s,r,i)):(t=Mc(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:$a,n(o,r)&&t.ref===e.ref)return Kr(t,e,i)}return e.flags|=1,t=Pi(s,r),t.ref=e.ref,t.return=e,e.child=t}function Gb(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if($a(s,r)&&t.ref===e.ref)if(nn=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(nn=!0);else return e.lanes=t.lanes,Kr(t,e,i)}return zm(t,e,n,r,i)}function Yb(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},De(co,hn),hn|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,De(co,hn),hn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,De(co,hn),hn|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,De(co,hn),hn|=r;return Bt(t,e,i,n),e.child}function Jb(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function zm(t,e,n,r,i){var s=on(n)?xs:Ft.current;return s=Io(e,s),xo(e,i),n=Wg(t,e,n,r,s,i),r=Hg(),t!==null&&!nn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Kr(t,e,i)):(He&&r&&Ag(e),e.flags|=1,Bt(t,e,n,i),e.child)}function Wv(t,e,n,r,i){if(on(n)){var s=!0;sf(e)}else s=!1;if(xo(e,i),e.stateNode===null)Oc(t,e),xb(e,n,r),Lm(e,n,r,i),r=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var a=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Bn(u):(u=on(n)?xs:Ft.current,u=Io(e,u));var c=n.getDerivedStateFromProps,f=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||a!==u)&&Dv(e,o,r,u),ci=!1;var h=e.memoizedState;o.state=h,cf(e,r,o,i),a=e.memoizedState,l!==r||h!==a||sn.current||ci?(typeof c=="function"&&(Im(e,n,c,r),a=e.memoizedState),(l=ci||Nv(e,n,l,r,h,a,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=a),o.props=r,o.state=a,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,kb(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:Yn(e.type,l),o.props=u,f=e.pendingProps,h=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=Bn(a):(a=on(n)?xs:Ft.current,a=Io(e,a));var d=n.getDerivedStateFromProps;(c=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||h!==a)&&Dv(e,o,r,a),ci=!1,h=e.memoizedState,o.state=h,cf(e,r,o,i);var p=e.memoizedState;l!==f||h!==p||sn.current||ci?(typeof d=="function"&&(Im(e,n,d,r),p=e.memoizedState),(u=ci||Nv(e,n,u,r,h,p,a)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,a)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=a,r=u):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return jm(t,e,n,r,s,i)}function jm(t,e,n,r,i,s){Jb(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&Tv(e,n,!1),Kr(t,e,s);r=e.stateNode,w_.current=e;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=Fo(e,t.child,null,s),e.child=Fo(e,null,l,s)):Bt(t,e,l,s),e.memoizedState=r.state,i&&Tv(e,n,!0),e.child}function Zb(t){var e=t.stateNode;e.pendingContext?Ov(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Ov(t,e.context,!1),zg(t,e.containerInfo)}function Hv(t,e,n,r,i){return Lo(),Ng(i),e.flags|=256,Bt(t,e,n,r),e.child}var Bm={dehydrated:null,treeContext:null,retryLane:0};function Vm(t){return{baseLanes:t,cachePool:null,transitions:null}}function Qb(t,e,n){var r=e.pendingProps,i=qe.current,s=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(i&2)!==0),l?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),De(qe,i&1),t===null)return Dm(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=fh(o,r,0,null),t=Ss(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Vm(n),e.memoizedState=Bm,t):Kg(e,o));if(i=t.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return S_(t,e,o,r,l,i,n);if(s){s=r.fallback,o=e.mode,i=t.child,l=i.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=a,e.deletions=null):(r=Pi(i,a),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=Pi(l,s):(s=Ss(s,o,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=t.child.memoizedState,o=o===null?Vm(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~n,e.memoizedState=Bm,r}return s=t.child,t=s.sibling,r=Pi(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Kg(t,e){return e=fh({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Du(t,e,n,r){return r!==null&&Ng(r),Fo(e,t.child,null,n),t=Kg(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function S_(t,e,n,r,i,s,o){if(n)return e.flags&256?(e.flags&=-257,r=pd(Error(W(422))),Du(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=fh({mode:"visible",children:r.children},i,0,null),s=Ss(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&Fo(e,t.child,null,o),e.child.memoizedState=Vm(o),e.memoizedState=Bm,s);if(!(e.mode&1))return Du(t,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(W(419)),r=pd(s,r,void 0),Du(t,e,o,r)}if(l=(o&t.childLanes)!==0,nn||l){if(r=vt,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,qr(t,i),nr(r,t,i,-1))}return Xg(),r=pd(Error(W(421))),Du(t,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=N_.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,gn=Ti(i.nextSibling),vn=e,He=!0,Zn=null,t!==null&&(_n[Mn++]=zr,_n[Mn++]=jr,_n[Mn++]=Cs,zr=t.id,jr=t.overflow,Cs=e),e=Kg(e,r.children),e.flags|=4096,e)}function Uv(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Rm(t.return,e,n)}function gd(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function Xb(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(Bt(t,e,r.children,n),r=qe.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Uv(t,n,e);else if(t.tag===19)Uv(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(De(qe,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&ff(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),gd(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&ff(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}gd(e,!0,n,null,s);break;case"together":gd(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Oc(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Kr(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Es|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(W(153));if(e.child!==null){for(t=e.child,n=Pi(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Pi(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function k_(t,e,n){switch(e.tag){case 3:Zb(e),Lo();break;case 5:Eb(e);break;case 1:on(e.type)&&sf(e);break;case 4:zg(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;De(af,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(De(qe,qe.current&1),e.flags|=128,null):n&e.child.childLanes?Qb(t,e,n):(De(qe,qe.current&1),t=Kr(t,e,n),t!==null?t.sibling:null);De(qe,qe.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Xb(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),De(qe,qe.current),r)break;return null;case 22:case 23:return e.lanes=0,Yb(t,e,n)}return Kr(t,e,n)}var ex,Wm,tx,nx;ex=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Wm=function(){};tx=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,ms(Mr.current);var s=null;switch(n){case"input":i=fm(t,i),r=fm(t,r),s=[];break;case"select":i=Ge({},i,{value:void 0}),r=Ge({},r,{value:void 0}),s=[];break;case"textarea":i=mm(t,i),r=mm(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=nf)}gm(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(va.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var a=r[u];if(l=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(s||(s=[]),s.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(s=s||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(va.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&Ie("scroll",t),s||l===a||(s=[])):(s=s||[]).push(u,a))}n&&(s=s||[]).push("style",n);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};nx=function(t,e,n,r){n!==r&&(e.flags|=4)};function Tl(t,e){if(!He)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Pt(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function b_(t,e,n){var r=e.pendingProps;switch(Pg(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(e),null;case 1:return on(e.type)&&rf(),Pt(e),null;case 3:return r=e.stateNode,zo(),je(sn),je(Ft),Bg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Pu(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Zn!==null&&(Zm(Zn),Zn=null))),Wm(t,e),Pt(e),null;case 5:jg(e);var i=ms(Ma.current);if(n=e.type,t!==null&&e.stateNode!=null)tx(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(W(166));return Pt(e),null}if(t=ms(Mr.current),Pu(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[br]=e,r[Ta]=s,t=(e.mode&1)!==0,n){case"dialog":Ie("cancel",r),Ie("close",r);break;case"iframe":case"object":case"embed":Ie("load",r);break;case"video":case"audio":for(i=0;i<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[br]=e,t[Ta]=r,ex(t,e,!1,!1),e.stateNode=t;e:{switch(o=ym(n,r),n){case"dialog":Ie("cancel",t),Ie("close",t),i=r;break;case"iframe":case"object":case"embed":Ie("load",t),i=r;break;case"video":case"audio":for(i=0;iBo&&(e.flags|=128,r=!0,Tl(s,!1),e.lanes=4194304)}else{if(!r)if(t=ff(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Tl(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!He)return Pt(e),null}else 2*st()-s.renderingStartTime>Bo&&n!==1073741824&&(e.flags|=128,r=!0,Tl(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=st(),e.sibling=null,n=qe.current,De(qe,r?n&1|2:n&1),e):(Pt(e),null);case 22:case 23:return Qg(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?hn&1073741824&&(Pt(e),e.subtreeFlags&6&&(e.flags|=8192)):Pt(e),null;case 24:return null;case 25:return null}throw Error(W(156,e.tag))}function x_(t,e){switch(Pg(e),e.tag){case 1:return on(e.type)&&rf(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return zo(),je(sn),je(Ft),Bg(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return jg(e),null;case 13:if(je(qe),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(W(340));Lo()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return je(qe),null;case 4:return zo(),null;case 10:return Ig(e.type._context),null;case 22:case 23:return Qg(),null;case 24:return null;default:return null}}var Ru=!1,Rt=!1,C_=typeof WeakSet=="function"?WeakSet:Set,J=null;function uo(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qe(t,e,r)}else n.current=null}function Hm(t,e,n){try{n()}catch(r){Qe(t,e,r)}}var qv=!1;function $_(t,e){if(Om=Xc,t=ob(),Mg(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,c=0,f=t,h=null;t:for(;;){for(var d;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(a=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(d=f.firstChild)!==null;)h=f,f=d;for(;;){if(f===t)break t;if(h===n&&++u===i&&(l=o),h===s&&++c===r&&(a=o),(d=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=d}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tm={focusedElem:t,selectionRange:n},Xc=!1,J=e;J!==null;)if(e=J,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,J=t;else for(;J!==null;){e=J;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var y=p.memoizedProps,w=p.memoizedState,m=e.stateNode,g=m.getSnapshotBeforeUpdate(e.elementType===e.type?y:Yn(e.type,y),w);m.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(S){Qe(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,J=t;break}J=e.return}return p=qv,qv=!1,p}function ia(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Hm(e,n,s)}i=i.next}while(i!==r)}}function uh(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Um(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function rx(t){var e=t.alternate;e!==null&&(t.alternate=null,rx(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[br],delete e[Ta],delete e[Am],delete e[l_],delete e[a_])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function ix(t){return t.tag===5||t.tag===3||t.tag===4}function Kv(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ix(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function qm(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=nf));else if(r!==4&&(t=t.child,t!==null))for(qm(t,e,n),t=t.sibling;t!==null;)qm(t,e,n),t=t.sibling}function Km(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Km(t,e,n),t=t.sibling;t!==null;)Km(t,e,n),t=t.sibling}var St=null,Jn=!1;function ri(t,e,n){for(n=n.child;n!==null;)sx(t,e,n),n=n.sibling}function sx(t,e,n){if(_r&&typeof _r.onCommitFiberUnmount=="function")try{_r.onCommitFiberUnmount(th,n)}catch{}switch(n.tag){case 5:Rt||uo(n,e);case 6:var r=St,i=Jn;St=null,ri(t,e,n),St=r,Jn=i,St!==null&&(Jn?(t=St,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):St.removeChild(n.stateNode));break;case 18:St!==null&&(Jn?(t=St,n=n.stateNode,t.nodeType===8?ud(t.parentNode,n):t.nodeType===1&&ud(t,n),xa(t)):ud(St,n.stateNode));break;case 4:r=St,i=Jn,St=n.stateNode.containerInfo,Jn=!0,ri(t,e,n),St=r,Jn=i;break;case 0:case 11:case 14:case 15:if(!Rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Hm(n,e,o),i=i.next}while(i!==r)}ri(t,e,n);break;case 1:if(!Rt&&(uo(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Qe(n,e,l)}ri(t,e,n);break;case 21:ri(t,e,n);break;case 22:n.mode&1?(Rt=(r=Rt)||n.memoizedState!==null,ri(t,e,n),Rt=r):ri(t,e,n);break;default:ri(t,e,n)}}function Gv(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new C_),e.forEach(function(r){var i=D_.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Hn(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=st()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*O_(r/1960))-r,10t?16:t,wi===null)var r=!1;else{if(t=wi,wi=null,gf=0,$e&6)throw Error(W(331));var i=$e;for($e|=4,J=t.current;J!==null;){var s=J,o=s.child;if(J.flags&16){var l=s.deletions;if(l!==null){for(var a=0;ast()-Jg?ws(t,0):Yg|=n),ln(t,e)}function dx(t,e){e===0&&(t.mode&1?(e=Eu,Eu<<=1,!(Eu&130023424)&&(Eu=4194304)):e=1);var n=qt();t=qr(t,e),t!==null&&(Qa(t,e,n),ln(t,n))}function N_(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),dx(t,n)}function D_(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(e),dx(t,n)}var mx;mx=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||sn.current)nn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return nn=!1,k_(t,e,n);nn=!!(t.flags&131072)}else nn=!1,He&&e.flags&1048576&&yb(e,lf,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Oc(t,e),t=e.pendingProps;var i=Io(e,Ft.current);xo(e,n),i=Wg(null,e,r,t,i,n);var s=Hg();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,on(r)?(s=!0,sf(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Fg(e),i.updater=lh,e.stateNode=i,i._reactInternals=e,Lm(e,r,t,n),e=jm(null,e,r,!0,s,n)):(e.tag=0,He&&s&&Ag(e),Bt(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Oc(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=I_(r),t=Yn(r,t),i){case 0:e=zm(null,e,r,t,n);break e;case 1:e=Wv(null,e,r,t,n);break e;case 11:e=Bv(null,e,r,t,n);break e;case 14:e=Vv(null,e,r,Yn(r.type,t),n);break e}throw Error(W(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Yn(r,i),zm(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Yn(r,i),Wv(t,e,r,i,n);case 3:e:{if(Zb(e),t===null)throw Error(W(387));r=e.pendingProps,s=e.memoizedState,i=s.element,kb(t,e),cf(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=jo(Error(W(423)),e),e=Hv(t,e,r,n,i);break e}else if(r!==i){i=jo(Error(W(424)),e),e=Hv(t,e,r,n,i);break e}else for(gn=Ti(e.stateNode.containerInfo.firstChild),vn=e,He=!0,Zn=null,n=$b(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Lo(),r===i){e=Kr(t,e,n);break e}Bt(t,e,r,n)}e=e.child}return e;case 5:return Eb(e),t===null&&Dm(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,_m(r,i)?o=null:s!==null&&_m(r,s)&&(e.flags|=32),Jb(t,e),Bt(t,e,o,n),e.child;case 6:return t===null&&Dm(e),null;case 13:return Qb(t,e,n);case 4:return zg(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Fo(e,null,r,n):Bt(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Yn(r,i),Bv(t,e,r,i,n);case 7:return Bt(t,e,e.pendingProps,n),e.child;case 8:return Bt(t,e,e.pendingProps.children,n),e.child;case 12:return Bt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,De(af,r._currentValue),r._currentValue=o,s!==null)if(rr(s.value,o)){if(s.children===i.children&&!sn.current){e=Kr(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=Br(-1,n&-n),a.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Rm(s.return,n,e),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(W(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Rm(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Bt(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,xo(e,n),i=Bn(i),r=r(i),e.flags|=1,Bt(t,e,r,n),e.child;case 14:return r=e.type,i=Yn(r,e.pendingProps),i=Yn(r.type,i),Vv(t,e,r,i,n);case 15:return Gb(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Yn(r,i),Oc(t,e),e.tag=1,on(r)?(t=!0,sf(e)):t=!1,xo(e,n),xb(e,r,i),Lm(e,r,i,n),jm(null,e,r,!0,t,n);case 19:return Xb(t,e,n);case 22:return Yb(t,e,n)}throw Error(W(156,e.tag))};function px(t,e){return Bk(t,e)}function R_(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nn(t,e,n,r){return new R_(t,e,n,r)}function e0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function I_(t){if(typeof t=="function")return e0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===wg)return 11;if(t===Sg)return 14}return 2}function Pi(t,e){var n=t.alternate;return n===null?(n=Nn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Mc(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")e0(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case eo:return Ss(n.children,i,s,e);case vg:o=8,i|=8;break;case lm:return t=Nn(12,n,e,i|2),t.elementType=lm,t.lanes=s,t;case am:return t=Nn(13,n,e,i),t.elementType=am,t.lanes=s,t;case um:return t=Nn(19,n,e,i),t.elementType=um,t.lanes=s,t;case Ck:return fh(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case bk:o=10;break e;case xk:o=9;break e;case wg:o=11;break e;case Sg:o=14;break e;case ui:o=16,r=null;break e}throw Error(W(130,t==null?t:typeof t,""))}return e=Nn(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function Ss(t,e,n,r){return t=Nn(7,t,r,e),t.lanes=n,t}function fh(t,e,n,r){return t=Nn(22,t,r,e),t.elementType=Ck,t.lanes=n,t.stateNode={isHidden:!1},t}function yd(t,e,n){return t=Nn(6,t,null,e),t.lanes=n,t}function vd(t,e,n){return e=Nn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function L_(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Qh(0),this.expirationTimes=Qh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qh(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function t0(t,e,n,r,i,s,o,l,a){return t=new L_(t,e,n,l,a),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Nn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fg(s),t}function F_(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(wx)}catch(t){console.error(t)}}wx(),yk.exports=bn;var W_=yk.exports,n1=W_;sm.createRoot=n1.createRoot,sm.hydrateRoot=n1.hydrateRoot;const Sx=1024;let H_=0,wd=class{constructor(e,n){this.from=e,this.to=n}};class me{constructor(e={}){this.id=H_++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=an.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}me.closedBy=new me({deserialize:t=>t.split(" ")});me.openedBy=new me({deserialize:t=>t.split(" ")});me.group=new me({deserialize:t=>t.split(" ")});me.isolate=new me({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});me.contextHash=new me({perNode:!0});me.lookAhead=new me({perNode:!0});me.mounted=new me({perNode:!0});class wf{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[me.mounted.id]}}const U_=Object.create(null);class an{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):U_,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new an(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(me.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(me.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}an.none=new an("",Object.create(null),0,8);class s0{constructor(e){this.types=e;for(let n=0;n0;for(let a=this.cursor(o|yt.IncludeAnonymous);;){let u=!1;if(a.from<=s&&a.to>=i&&(!l&&a.type.isAnonymous||n(a)!==!1)){if(a.firstChild())continue;u=!0}for(;u&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:a0(an.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new ut(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new ut(an.none,n,r,i)))}static build(e){return Y_(e)}}ut.empty=new ut(an.none,[],[],0);class o0{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new o0(this.buffer,this.index)}}class zi{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return an.none}toString(){let e=[];for(let n=0;n0));a=o[a+3]);return l}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let l=e,a=0;l=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ra(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?l.length:-1;e!=u;e+=n){let c=l[e],f=a[e]+o.from;if(kx(i,r,f,f+c.length)){if(c instanceof zi){if(s&yt.ExcludeBuffers)continue;let h=c.findChild(0,c.buffer.length,n,r-f,i);if(h>-1)return new Si(new q_(o,c,e,f),null,h)}else if(s&yt.IncludeAnonymous||!c.type.isAnonymous||l0(c)){let h;if(!(s&yt.IgnoreMounts)&&(h=wf.get(c))&&!h.overlay)return new Fn(h.tree,f,e,o);let d=new Fn(c,f,e,o);return s&yt.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(n<0?c.children.length-1:0,n,r,i)}}}if(s&yt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r&yt.IgnoreOverlays)&&(i=wf.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:l}of i.overlay)if((n>0?o<=s:o=s:l>s))return new Fn(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function i1(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function Qm(t,e,n=e.length-1){for(let r=t.parent;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class q_{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class Si extends bx{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new Si(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&yt.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new Si(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Si(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Si(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new ut(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function xx(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;sn.from||o.to=e){let l=new Fn(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Ra(l,e,n,!1))}}return i?xx(i):r}class Xm{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Fn)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Fn?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&yt.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&yt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&yt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let l=r._tree.children[s];if(this.mode&yt.IncludeAnonymous||l instanceof zi||!l.type.isAnonymous||l0(l))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i=0;s--){if(s<0)return Qm(this.node,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function l0(t){return t.children.some(e=>e instanceof zi||!e.type.isAnonymous||l0(e))}function Y_(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=Sx,reused:s=[],minRepeatType:o=r.types.length}=t,l=Array.isArray(n)?new o0(n,n.length):n,a=r.types,u=0,c=0;function f($,b,x,_,A,N){let{id:V,start:B,end:te,size:Q}=l,fe=c;for(;Q<0;)if(l.next(),Q==-1){let I=s[V];x.push(I),_.push(B-$);return}else if(Q==-3){u=V;return}else if(Q==-4){c=V;return}else throw new RangeError(`Unrecognized record size: ${Q}`);let Ee=a[V],pe,H,Y=B-$;if(te-B<=i&&(H=w(l.pos-b,A))){let I=new Uint16Array(H.size-H.skip),M=l.pos-H.size,F=I.length;for(;l.pos>M;)F=m(H.start,I,F);pe=new zi(I,te-H.start,r),Y=H.start-$}else{let I=l.pos-Q;l.next();let M=[],F=[],P=V>=o?V:-1,k=0,E=te;for(;l.pos>I;)P>=0&&l.id==P&&l.size>=0?(l.end<=E-i&&(p(M,F,B,k,l.end,E,P,fe),k=M.length,E=l.end),l.next()):N>2500?h(B,I,M,F):f(B,I,M,F,P,N+1);if(P>=0&&k>0&&k-1&&k>0){let L=d(Ee);pe=a0(Ee,M,F,0,M.length,0,te-B,L,L)}else pe=y(Ee,M,F,te-B,fe-te)}x.push(pe),_.push(Y)}function h($,b,x,_){let A=[],N=0,V=-1;for(;l.pos>b;){let{id:B,start:te,end:Q,size:fe}=l;if(fe>4)l.next();else{if(V>-1&&te=0;Q-=3)B[fe++]=A[Q],B[fe++]=A[Q+1]-te,B[fe++]=A[Q+2]-te,B[fe++]=fe;x.push(new zi(B,A[2]-te,r)),_.push(te-$)}}function d($){return(b,x,_)=>{let A=0,N=b.length-1,V,B;if(N>=0&&(V=b[N])instanceof ut){if(!N&&V.type==$&&V.length==_)return V;(B=V.prop(me.lookAhead))&&(A=x[N]+V.length+B)}return y($,b,x,_,A)}}function p($,b,x,_,A,N,V,B){let te=[],Q=[];for(;$.length>_;)te.push($.pop()),Q.push(b.pop()+x-A);$.push(y(r.types[V],te,Q,N-A,B-N)),b.push(A-x)}function y($,b,x,_,A=0,N){if(u){let V=[me.contextHash,u];N=N?[V].concat(N):[V]}if(A>25){let V=[me.lookAhead,A];N=N?[V].concat(N):[V]}return new ut($,b,x,_,N)}function w($,b){let x=l.fork(),_=0,A=0,N=0,V=x.end-i,B={size:0,start:0,skip:0};e:for(let te=x.pos-$;x.pos>te;){let Q=x.size;if(x.id==b&&Q>=0){B.size=_,B.start=A,B.skip=N,N+=4,_+=4,x.next();continue}let fe=x.pos-Q;if(Q<0||fe=o?4:0,pe=x.start;for(x.next();x.pos>fe;){if(x.size<0)if(x.size==-3)Ee+=4;else break e;else x.id>=o&&(Ee+=4);x.next()}A=pe,_+=Q,N+=Ee}return(b<0||_==$)&&(B.size=_,B.start=A,B.skip=N),B.size>4?B:void 0}function m($,b,x){let{id:_,start:A,end:N,size:V}=l;if(l.next(),V>=0&&_4){let te=l.pos-(V-4);for(;l.pos>te;)x=m($,b,x)}b[--x]=B,b[--x]=N-$,b[--x]=A-$,b[--x]=_}else V==-3?u=_:V==-4&&(c=_);return x}let g=[],v=[];for(;l.pos>0;)f(t.start||0,t.bufferStart||0,g,v,-1,0);let S=(e=t.length)!==null&&e!==void 0?e:g.length?v[0]+g[0].length:0;return new ut(a[t.topID],g.reverse(),v.reverse(),S)}const s1=new WeakMap;function Ac(t,e){if(!t.isAnonymous||e instanceof zi||e.type!=t)return 1;let n=s1.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof ut)){n=1;break}n+=Ac(t,r)}s1.set(e,n)}return n}function a0(t,e,n,r,i,s,o,l,a){let u=0;for(let p=r;p=c)break;b+=x}if(v==S+1){if(b>c){let x=p[S];d(x.children,x.positions,0,x.children.length,y[S]+g);continue}f.push(p[S])}else{let x=y[v-1]+p[v-1].length-$;f.push(a0(t,p,y,S,v,$,x,null,a))}h.push($+g-s)}}return d(e,n,r,i,0),(l||a)(f,h,o)}class ks{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new ks(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,u=0;;l++){let c=l=r)for(;o&&o.from=h.from||f<=h.to||u){let d=Math.max(h.from,a)-u,p=Math.min(h.to,f)-u;h=d>=p?null:new ks(d,p,h.tree,h.offset+u,l>0,!!c)}if(h&&i.push(h),o.to>f)break;o=snew wd(i.from,i.to)):[new wd(0,0)]:[new wd(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class J_{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new me({perNode:!0});var o1={};class Sf{constructor(e,n,r,i,s,o,l,a,u,c=0,f){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=u,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new Sf(e,[],n,r,r,0,[],0,i?new l1(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=s.dynamicPrecedence(i);if(o&&(this.score+=o),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(i,a)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(n==r)return;if(o.buffer[l-2]>=n){o.buffer[l-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4);this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new Sf(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Z_(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;sa&1&&l==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,u=this.stack.length-l*3;if(u>=0&&e.getGoto(this.stack[u],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class l1{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Z_{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class kf{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new kf(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new kf(this.stack,this.pos,this.index)}}function zu(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class Pc{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const a1=new Pc;class Q_{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=a1,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;sr.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=a1,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class $o{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;X_(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}$o.prototype.contextual=$o.prototype.fallback=$o.prototype.extend=!1;$o.prototype.fallback=$o.prototype.extend=!1;function X_(t,e,n,r,i,s){let o=0,l=1<0){let p=t[d];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||eM(p,e.token.value,i,s))){e.acceptToken(p);break}}let c=e.next,f=0,h=t[o+2];if(e.next<0&&h>f&&t[u+h*3-3]==65535){o=t[u+h*3-1];continue e}for(;f>1,p=u+d+(d<<1),y=t[p],w=t[p+1]||65536;if(c=w)f=d+1;else{o=t[p+2],e.advance();continue e}}break}}function u1(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function eM(t,e,n,r){let i=u1(n,r,e);return i<0||u1(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class tM{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?c1(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?c1(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(ee)return this.nextStart=o,null;if(s instanceof ut){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class nM{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Pc)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let u=0;uf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let h=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!c.extend&&(r=f,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return a&&e.setLookAhead(a),!r&&e.pos==this.stream.end&&(r=new Pc,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Pc,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;se.bufferLength*4?new tM(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;on)r.push(l);else{if(this.advanceStack(l,r,e))continue;{i||(i=[],s=[]),i.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=i&&sM(i);if(o)return cn&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw cn&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return cn&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,c=u?e.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let h=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(h>-1&&f.length&&(!u||(f.prop(me.contextHash)||0)==c))return e.useNode(f,h),cn&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof ut)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof ut&&f.positions[0]==0)f=d;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),cn&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let u=0;ui?n.push(p):r.push(p)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return f1(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),cn&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let f=l.split(),h=c;for(let d=0;f.forceReduce()&&d<10&&(cn&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));d++)cn&&(h=this.stackID(f)+" -> ");for(let d of l.recoverByInsert(a))cn&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,r);this.stream.end>l.pos?(u==l.pos&&(u++,a=0),l.recoverByDelete(a,u),cn&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),f1(l,r)):(!i||i.scoree.topRules[l][1]),i=[];for(let l=0;l=0)s(c,a,l[u++]);else{let f=l[u+-c];for(let h=-c;h>0;h--)s(l[u++],a,f);u++}}}this.nodeSet=new s0(n.map((l,a)=>an.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:i[a],top:r.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Sx;let o=zu(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new $o(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new rM(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],l=o&1,a=i[s++];if(l&&r)return a;for(let u=s+(o>>1);s0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Fr(this.data,s+2);else break;i=n(Fr(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Fr(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(bf.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=h1(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;sr)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}let oM=0;class kr{constructor(e,n,r){this.set=e,this.base=n,this.modified=r,this.id=oM++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let n=new kr([],null,[]);if(n.set.push(n),e)for(let r of e.set)n.set.push(r);return n}static defineModifier(){let e=new xf;return n=>n.modified.indexOf(e)>-1?n:xf.get(n.base||n,n.modified.concat(e).sort((r,i)=>r.id-i.id))}}let lM=0;class xf{constructor(){this.instances=[],this.id=lM++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&aM(n,l.modified));if(r)return r;let i=[],s=new kr(i,e,n);for(let l of n)l.instances.push(s);let o=uM(n);for(let l of e.set)if(!l.modified.length)for(let a of o)i.push(xf.get(l,a));return s}}function aM(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function uM(t){let e=[[]];for(let n=0;nr.length-n.length)}function $x(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,l=i;for(let f=0;;){if(l=="..."&&f>0&&f+3==i.length){o=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!h)throw new RangeError("Invalid path: "+i);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==i.length)break;let d=i[f++];if(f==i.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+i);l=i.slice(f)}let a=s.length-1,u=s[a];if(!u)throw new RangeError("Invalid path: "+i);let c=new Cf(r,o,a>0?s.slice(0,a):null);e[u]=c.sort(e[u])}}return Ex.add(e)}const Ex=new me;class Cf{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=i;for(let l of s)for(let a of l.set){let u=n[a.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function cM(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function fM(t,e,n,r=0,i=t.length){let s=new hM(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class hM{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:l,to:a}=e;if(l>=r||a<=n)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let u=i,c=dM(e)||Cf.empty,f=cM(s,c.tags);if(f&&(u&&(u+=" "),u+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,l),u),c.opaque)return;let h=e.tree&&e.tree.prop(me.mounted);if(h&&h.overlay){let d=e.node.enter(h.overlay[0].from+l,1),p=this.highlighters.filter(w=>!w.scope||w.scope(h.tree.type)),y=e.firstChild();for(let w=0,m=l;;w++){let g=w=v||!e.nextSibling())););if(!g||v>r)break;m=g.to+l,m>n&&(this.highlightRange(d.cursor(),Math.max(n,g.from+l),Math.min(r,m),"",p),this.startSpan(Math.min(r,m),u))}y&&e.parent()}else if(e.firstChild()){h&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),u)}while(e.nextSibling());e.parent()}}}function dM(t){let e=t.type.prop(Ex);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const U=kr.define,ju=U(),fi=U(),d1=U(fi),m1=U(fi),hi=U(),Bu=U(hi),kd=U(hi),vr=U(),Xi=U(vr),pr=U(),gr=U(),ep=U(),Ml=U(ep),Vu=U(),z={comment:ju,lineComment:U(ju),blockComment:U(ju),docComment:U(ju),name:fi,variableName:U(fi),typeName:d1,tagName:U(d1),propertyName:m1,attributeName:U(m1),className:U(fi),labelName:U(fi),namespace:U(fi),macroName:U(fi),literal:hi,string:Bu,docString:U(Bu),character:U(Bu),attributeValue:U(Bu),number:kd,integer:U(kd),float:U(kd),bool:U(hi),regexp:U(hi),escape:U(hi),color:U(hi),url:U(hi),keyword:pr,self:U(pr),null:U(pr),atom:U(pr),unit:U(pr),modifier:U(pr),operatorKeyword:U(pr),controlKeyword:U(pr),definitionKeyword:U(pr),moduleKeyword:U(pr),operator:gr,derefOperator:U(gr),arithmeticOperator:U(gr),logicOperator:U(gr),bitwiseOperator:U(gr),compareOperator:U(gr),updateOperator:U(gr),definitionOperator:U(gr),typeOperator:U(gr),controlOperator:U(gr),punctuation:ep,separator:U(ep),bracket:Ml,angleBracket:U(Ml),squareBracket:U(Ml),paren:U(Ml),brace:U(Ml),content:vr,heading:Xi,heading1:U(Xi),heading2:U(Xi),heading3:U(Xi),heading4:U(Xi),heading5:U(Xi),heading6:U(Xi),contentSeparator:U(vr),list:U(vr),quote:U(vr),emphasis:U(vr),strong:U(vr),link:U(vr),monospace:U(vr),strikethrough:U(vr),inserted:U(),deleted:U(),changed:U(),invalid:U(),meta:Vu,documentMeta:U(Vu),annotation:U(Vu),processingInstruction:U(Vu),definition:kr.defineModifier(),constant:kr.defineModifier(),function:kr.defineModifier(),standard:kr.defineModifier(),local:kr.defineModifier(),special:kr.defineModifier()};Ox([{tag:z.link,class:"tok-link"},{tag:z.heading,class:"tok-heading"},{tag:z.emphasis,class:"tok-emphasis"},{tag:z.strong,class:"tok-strong"},{tag:z.keyword,class:"tok-keyword"},{tag:z.atom,class:"tok-atom"},{tag:z.bool,class:"tok-bool"},{tag:z.url,class:"tok-url"},{tag:z.labelName,class:"tok-labelName"},{tag:z.inserted,class:"tok-inserted"},{tag:z.deleted,class:"tok-deleted"},{tag:z.literal,class:"tok-literal"},{tag:z.string,class:"tok-string"},{tag:z.number,class:"tok-number"},{tag:[z.regexp,z.escape,z.special(z.string)],class:"tok-string2"},{tag:z.variableName,class:"tok-variableName"},{tag:z.local(z.variableName),class:"tok-variableName tok-local"},{tag:z.definition(z.variableName),class:"tok-variableName tok-definition"},{tag:z.special(z.variableName),class:"tok-variableName2"},{tag:z.definition(z.propertyName),class:"tok-propertyName tok-definition"},{tag:z.typeName,class:"tok-typeName"},{tag:z.namespace,class:"tok-namespace"},{tag:z.className,class:"tok-className"},{tag:z.macroName,class:"tok-macroName"},{tag:z.propertyName,class:"tok-propertyName"},{tag:z.operator,class:"tok-operator"},{tag:z.comment,class:"tok-comment"},{tag:z.meta,class:"tok-meta"},{tag:z.invalid,class:"tok-invalid"},{tag:z.punctuation,class:"tok-punctuation"}]);const mM=$x({String:z.string,Number:z.number,"True False":z.bool,PropertyName:z.propertyName,Null:z.null,",":z.separator,"[ ]":z.squareBracket,"{ }":z.brace}),pM=bf.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!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,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[mM],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~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#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!]~$zOh~~$}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~&yOg~~'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});class Te{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Vo(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),xr.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Vo(this,e,n);let r=[];return this.decompose(e,n,r,0),xr.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new la(this),s=new la(e);for(let o=n,l=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(l+=i.value.length,i.done||l>=r)return!0}}iter(e=1){return new la(this,e)}iterRange(e,n=this.length){return new Tx(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new _x(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Te.empty:e.length<=32?new rt(e):xr.from(rt.split(e,[]))}}class rt extends Te{constructor(e,n=gM(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],l=i+o.length;if((n?r:l)>=e)return new yM(i,l,r,o);i=l+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new rt(p1(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),l=Nc(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new rt(l,o.length+s.length));else{let a=l.length>>1;r.push(new rt(l.slice(0,a)),new rt(l.slice(a)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof rt))return super.replace(e,n,r);[e,n]=Vo(this,e,n);let i=Nc(this.text,Nc(r.text,p1(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new rt(i,s):xr.from(rt.split(i,[]),s)}sliceString(e,n=this.length,r=` +`){[e,n]=Vo(this,e,n);let i="";for(let s=0,o=0;s<=n&&oe&&o&&(i+=r),es&&(i+=l.slice(Math.max(0,e-s),n-s)),s=a+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new rt(r,i)),r=[],i=-1);return i>-1&&n.push(new rt(r,i)),n}}class xr extends Te{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],l=i+o.length,a=r+o.lines-1;if((n?a:l)>=e)return o.lineInner(e,n,r,i);i=l+1,r=a+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s=o){let u=i&((o<=e?1:0)|(a>=n?2:0));o>=e&&a<=n&&!u?r.push(l):l.decompose(e-o,n-o,r,u)}o=a+1}}replace(e,n,r){if([e,n]=Vo(this,e,n),r.lines=s&&n<=l){let a=o.replace(e-s,n-s,r),u=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>u>>6){let c=this.children.slice();return c[i]=a,new xr(c,this.length-(n-e)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` +`){[e,n]=Vo(this,e,n);let i="";for(let s=0,o=0;se&&s&&(i+=r),eo&&(i+=l.sliceString(e-o,n-o,r)),o=a+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof xr))return 0;let r=0,[i,s,o,l]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==l)return r;let a=this.children[i],u=e.children[s];if(a!=u)return r+a.scanIdentical(u,n);r+=a.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let d of e)r+=d.lines;if(r<32){let d=[];for(let p of e)p.flatten(d);return new rt(d,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,l=[],a=0,u=-1,c=[];function f(d){let p;if(d.lines>s&&d instanceof xr)for(let y of d.children)f(y);else d.lines>o&&(a>o||!a)?(h(),l.push(d)):d instanceof rt&&a&&(p=c[c.length-1])instanceof rt&&d.lines+p.lines<=32?(a+=d.lines,u+=d.length+1,c[c.length-1]=new rt(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>i&&h(),a+=d.lines,u+=d.length+1,c.push(d))}function h(){a!=0&&(l.push(c.length==1?c[0]:xr.from(c,u)),u=-1,a=c.length=0)}for(let d of e)f(d);return h(),l.length==1?l[0]:new xr(l,n)}}Te.empty=new rt([""],0);function gM(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Nc(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s=n&&(a>r&&(l=l.slice(0,r-i)),i0?1:(e instanceof rt?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,l=i instanceof rt?i.text.length:i.children.length;if(o==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(i instanceof rt){let a=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,a.length>Math.max(0,e))return this.value=e==0?a:n>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=i.children[o+(n<0?-1:0)];e>a.length?(e-=a.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(n>0?1:(a instanceof rt?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Tx{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new la(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class _x{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Te.prototype[Symbol.iterator]=function(){return this.iter()},la.prototype[Symbol.iterator]=Tx.prototype[Symbol.iterator]=_x.prototype[Symbol.iterator]=function(){return this});class yM{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Vo(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}let Eo="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(t=>t?parseInt(t,36):1);for(let t=1;tt)return Eo[e-1]<=t;return!1}function g1(t){return t>=127462&&t<=127487}const y1=8205;function Et(t,e,n=!0,r=!0){return(n?Mx:wM)(t,e,r)}function Mx(t,e,n){if(e==t.length)return e;e&&Ax(t.charCodeAt(e))&&Px(t.charCodeAt(e-1))&&e--;let r=bt(t,e);for(e+=An(r);e=0&&g1(bt(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function wM(t,e,n){for(;e>0;){let r=Mx(t,e-2,n);if(r=56320&&t<57344}function Px(t){return t>=55296&&t<56320}function bt(t,e){let n=t.charCodeAt(e);if(!Px(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Ax(r)?(n-55296<<10)+(r-56320)+65536:n}function u0(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function An(t){return t<65536?1:2}const tp=/\r\n?|\n/;var Wt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(Wt||(Wt={}));class Ar{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return s+(e-i);s+=l}else{if(r!=Wt.Simple&&u>=e&&(r==Wt.TrackDel&&ie||r==Wt.TrackBefore&&ie))return null;if(u>e||u==e&&n<0&&!l)return e==i||n<0?s:s+a;s+=a}i=u}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r=0&&i<=n&&l>=e)return in?"cover":!0;i=l}return!1}toString(){let e="";for(let n=0;n=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ar(e)}static create(e){return new Ar(e)}}class ht extends Ar{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return np(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return rp(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i=0){n[i]=l,n[i+1]=o;let a=i>>1;for(;r.length0&&ki(r,n,s.text),s.forward(c),l+=c}let u=e[o++];for(;l>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!i.length)return;oh||f<0||h>n)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${n})`);let p=d?typeof d=="string"?Te.of(d.split(r||tp)):d:Te.empty,y=p.length;if(f==h&&y==0)return;fo&&Dt(i,f-o,-1),Dt(i,h-f,y),ki(s,i,p),o=h}}return u(e),a(!l),l}static empty(e){return new ht(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;il&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length=0&&n<=0&&n==t[i+1]?t[i]+=e:e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function ki(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(i,u,s,c,f),i=u,s=c}}}function rp(t,e,n,r=!1){let i=[],s=r?[]:null,o=new Ia(t),l=new Ia(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);Dt(i,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let u=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);u+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||r.length>u),s.forward2(a),o.forward(a)}}}}class Ia{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Te.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Te.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ps{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new ps(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return j.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return j.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return j.range(e.anchor,e.head)}static create(e,n,r){return new ps(e,n,r)}}class j{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:j.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new j(e.ranges.map(n=>ps.fromJSON(n)),e.main)}static single(e,n=e){return new j([j.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;ie?8:0)|s)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=e.indexOf(r);for(let i=1;is.head?j.range(a,l):j.range(l,a))}}return new j(e,n)}}function Dx(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let c0=0;class X{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=c0++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new X(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:f0),!!e.static,e.enables)}of(e){return new Dc([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dc(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dc(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function f0(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Dc{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=c0++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,u=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?u=!0:((n=e[f.id])!==null&&n!==void 0?n:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=r(f),1},update(f,h){if(a&&h.docChanged||u&&(h.docChanged||h.selection)||ip(f,c)){let d=r(f);if(l?!v1(d,f.values[o],i):!i(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,h)=>{let d,p=h.config.address[s];if(p!=null){let y=Ef(h,p);if(this.dependencies.every(w=>w instanceof X?h.facet(w)===f.facet(w):w instanceof Mt?h.field(w,!1)==f.field(w,!1):!0)||(l?v1(d=r(f),y,i):i(d=r(f),y)))return f.values[o]=y,0}else d=r(f);return f.values[o]=d,1}}}}function v1(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[a.id]),i=n.map(a=>a.type),s=r.filter(a=>!(a&1)),o=t[e.id]>>1;function l(a){let u=[];for(let c=0;cr===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(w1).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}init(e){return[this,w1.of({field:this,create:e})]}get extension(){return this}}const os={lowest:4,low:3,default:2,high:1,highest:0};function Al(t){return e=>new Rx(e,t)}const Xo={highest:Al(os.highest),high:Al(os.high),default:Al(os.default),low:Al(os.low),lowest:Al(os.lowest)};class Rx{constructor(e,n){this.inner=e,this.prec=n}}class gh{of(e){return new sp(this,e)}reconfigure(e){return gh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class sp{constructor(e,n){this.compartment=e,this.inner=n}}class $f{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let h of kM(e,n,o))h instanceof Mt?i.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let l=Object.create(null),a=[],u=[];for(let h of i)l[h.id]=u.length<<1,u.push(d=>h.slot(d));let c=r==null?void 0:r.config.facets;for(let h in s){let d=s[h],p=d[0].facet,y=c&&c[h]||[];if(d.every(w=>w.type==0))if(l[p.id]=a.length<<1|1,f0(y,d))a.push(r.facet(p));else{let w=p.combine(d.map(m=>m.value));a.push(r&&p.compare(w,r.facet(p))?r.facet(p):w)}else{for(let w of d)w.type==0?(l[w.id]=a.length<<1|1,a.push(w.value)):(l[w.id]=u.length<<1,u.push(m=>w.dynamicSlot(m)));l[p.id]=u.length<<1,u.push(w=>SM(w,p,d))}}let f=u.map(h=>h(l));return new $f(e,o,f,l,a,s)}}function kM(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,l){let a=i.get(o);if(a!=null){if(a<=l)return;let u=r[a].indexOf(o);u>-1&&r[a].splice(u,1),o instanceof sp&&n.delete(o.compartment)}if(i.set(o,l),Array.isArray(o))for(let u of o)s(u,l);else if(o instanceof sp){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,l)}else if(o instanceof Rx)s(o.inner,o.prec);else if(o instanceof Mt)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Dc)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,os.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(t,os.default),r.reduce((o,l)=>o.concat(l))}function aa(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function Ef(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const Ix=X.define(),op=X.define({combine:t=>t.some(e=>e),static:!0}),Lx=X.define({combine:t=>t.length?t[0]:void 0,static:!0}),Fx=X.define(),zx=X.define(),jx=X.define(),Bx=X.define({combine:t=>t.length?t[0]:!1});class Pr{constructor(e,n){this.type=e,this.value=n}static define(){return new bM}}class bM{of(e){return new Pr(this,e)}}class xM{constructor(e){this.map=e}of(e){return new he(this,e)}}class he{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new he(this.type,n)}is(e){return this.type==e}static define(e={}){return new xM(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}he.reconfigure=he.define();he.appendConfig=he.define();class mt{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Dx(r,n.newLength),s.some(l=>l.type==mt.time)||(this.annotations=s.concat(mt.time.of(Date.now())))}static create(e,n,r,i,s,o){return new mt(e,n,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(mt.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}mt.time=Pr.define();mt.userEvent=Pr.define();mt.addToHistory=Pr.define();mt.remote=Pr.define();function CM(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r=t[r]))s=t[r++],o=t[r++];else if(i=0;i--){let s=r[i](t);s instanceof mt?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof mt?t=s[0]:t=Wx(e,Oo(s),!1)}return t}function EM(t){let e=t.startState,n=e.facet(jx),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=Vx(r,lp(e,s,t.changes.newLength),!0))}return r==t?t:mt.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const OM=[];function Oo(t){return t==null?OM:Array.isArray(t)?t:[t]}var Ue=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Ue||(Ue={}));const TM=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ap;try{ap=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function _M(t){if(ap)return ap.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||TM.test(n)))return!0}return!1}function MM(t){return e=>{if(!/\S/.test(e))return Ue.Space;if(_M(e))return Ue.Word;for(let n=0;n-1)return Ue.Word;return Ue.Other}}class ke{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;li.set(u,a)),n=null),i.set(l.value.compartment,l.value.extension)):l.is(he.reconfigure)?(n=null,r=l.value):l.is(he.appendConfig)&&(n=null,r=Oo(r).concat(l.value));let s;n?s=e.startState.values.slice():(n=$f.resolve(r,i,this),s=new ke(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,u)=>u.reconfigure(a,this),null).values);let o=e.startState.facet(op)?e.newSelection:e.newSelection.asSingle();new ke(n,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:j.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Oo(r.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return ke.create({doc:e.doc,selection:j.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=$f.resolve(e.extensions||[],new Map),r=e.doc instanceof Te?e.doc:Te.of((e.doc||"").split(n.staticFacet(ke.lineSeparator)||tp)),i=e.selection?e.selection instanceof j?e.selection:j.single(e.selection.anchor,e.selection.head):j.single(0);return Dx(i,r.length),n.staticFacet(op)||(i=i.asSingle()),new ke(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(ke.tabSize)}get lineBreak(){return this.facet(ke.lineSeparator)||` +`}get readOnly(){return this.facet(Bx)}phrase(e,...n){for(let r of this.facet(ke.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(Ix))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return MM(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,l=e-r;for(;o>0;){let a=Et(n,o,!1);if(s(n.slice(a,o))!=Ue.Word)break;o=a}for(;lt.length?t[0]:4});ke.lineSeparator=Lx;ke.readOnly=Bx;ke.phrases=X.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});ke.languageData=Ix;ke.changeFilter=Fx;ke.transactionFilter=zx;ke.transactionExtender=jx;gh.reconfigure=he.define();function Nr(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Ts{eq(e){return this==e}range(e,n=e){return La.create(e,n,this)}}Ts.prototype.startSide=Ts.prototype.endSide=0;Ts.prototype.point=!1;Ts.prototype.mapMode=Wt.TrackDel;class La{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new La(e,n,r)}}function up(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class h0{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let o=i,l=s.length;;){if(o==l)return o;let a=o+l>>1,u=s[a]-e||(r?this.value[a].endSide:this.value[a].startSide)-n;if(a==o)return u>=0?o:l;u>=0?l=a:o=a+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sd||h==d&&u.startSide>0&&u.endSide<=0)continue;(d-h||u.endSide-u.startSide)<0||(o<0&&(o=h),u.point&&(l=Math.max(l,d-h)),r.push(u),i.push(h-o),s.push(d-o))}return{mapped:r.length?new h0(i,s,r,l):null,pos:o}}}class Ce{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new Ce(e,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(up)),this.isEmpty)return n.length?Ce.of(n):this;let l=new Hx(this,null,-1).goto(0),a=0,u=[],c=new ji;for(;l.value||a=0){let f=n[a++];c.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Fa.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Fa.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=S1(o,l,r),u=new Pl(o,a,s),c=new Pl(l,a,s);r.iterGaps((f,h,d)=>k1(u,f,c,h,d,i)),r.empty&&r.length==0&&k1(u,0,c,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(c=>!c.isEmpty&&n.indexOf(c)<0),o=n.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=S1(s,o),a=new Pl(s,l,0).goto(r),u=new Pl(o,l,0).goto(r);for(;;){if(a.to!=u.to||!cp(a.active,u.active)||a.point&&(!u.point||!a.point.eq(u.point)))return!1;if(a.to>i)return!0;a.next(),u.next()}}static spans(e,n,r,i,s=-1){let o=new Pl(e,null,s).goto(n),l=n,a=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(i.span(l,u,o.active,a),a=o.openEnd(u));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(e,n=!1){let r=new ji;for(let i of e instanceof La?[e]:n?AM(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return Ce.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=Ce.empty;i=i.nextLayer)n=new Ce(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}Ce.empty=new Ce([],[],null,-1);function AM(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(up);e=r}return t}Ce.empty.nextLayer=Ce.empty;class ji{finishChunk(e){this.chunks.push(new h0(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new ji)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Ce.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Ce.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function S1(t,e,n){let r=new Map;for(let s of t)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&i.push(new Hx(o,n,r,s));return i.length==1?i[0]:new Fa(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)bd(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)bd(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),bd(this.heap,0)}}}function bd(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class Pl{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Fa.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Wu(this.active,e),Wu(this.activeTo,e),Wu(this.activeRank,e),this.minActive=b1(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n0;)n++;Hu(this.active,n,r),Hu(this.activeTo,n,i),Hu(this.activeRank,n,s),e&&Hu(e,n,this.cursor.from),this.minActive=b1(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&Wu(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[i]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function k1(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,l=r,a=r-e;for(;;){let u=t.to+a-n.to||t.endSide-n.endSide,c=u<0?t.to+a:n.to,f=Math.min(c,o);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&cp(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,f,t.point,n.point):f>l&&!cp(t.active,n.active)&&s.compareRange(l,f,t.active,n.active),c>o)break;l=c,u<=0&&t.next(),u>=0&&n.next()}}function cp(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function b1(t,e){let n=-1,r=1e9;for(let i=0;i=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=Et(t,i)}return r===!0?-1:t.length}const hp="ͼ",x1=typeof Symbol>"u"?"__"+hp:Symbol.for(hp),dp=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),C1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Bi{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,u){let c=[],f=/^@(\w+)\b/.exec(o[0]),h=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))s(d.split(/,\s*/).map(y=>o.map(w=>y.replace(/&/,w))).reduce((y,w)=>y.concat(w)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(i(d),p,c,h)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+p+";")}(c.length||h)&&a.push((r&&!f&&!u?o.map(r):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=C1[x1]||1;return C1[x1]=e+1,hp+e.toString(36)}static mount(e,n,r){let i=e[dp],s=r&&r.nonce;i?s&&i.setNonce(s):i=new PM(e,s),i.mount(Array.isArray(n)?n:[n])}}let $1=new Map;class PM{constructor(e,n){this.root=e;let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=$1.get(r);if(s)return e[dp]=s;this.sheet=new i.CSSStyleSheet,$1.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[dp]=this}mount(e){let n=this.sheet,r=0,i=0;for(let s=0;s-1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,o),n)for(let a=0;a",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},NM=typeof navigator<"u"&&/Mac/.test(navigator.platform),DM=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var xt=0;xt<10;xt++)Vi[48+xt]=Vi[96+xt]=String(xt);for(var xt=1;xt<=24;xt++)Vi[xt+111]="F"+xt;for(var xt=65;xt<=90;xt++)Vi[xt]=String.fromCharCode(xt+32),za[xt]=String.fromCharCode(xt);for(var xd in Vi)za.hasOwnProperty(xd)||(za[xd]=Vi[xd]);function RM(t){var e=NM&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||DM&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?za:Vi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Of(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function mp(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function IM(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Rc(t,e){if(!e.anchorNode)return!1;try{return mp(t,e.anchorNode)}catch{return!1}}function Wo(t){return t.nodeType==3?_s(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ua(t,e,n,r){return n?E1(t,e,n,r,-1)||E1(t,e,n,r,1):!1}function ja(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function E1(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Gr(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=ja(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?Gr(t):0}else return!1}}function Gr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function yh(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function LM(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Ux(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function FM(t,e,n,r,i,s,o,l){let a=t.ownerDocument,u=a.defaultView||window;for(let c=t,f=!1;c&&!f;)if(c.nodeType==1){let h,d=c==a.body,p=1,y=1;if(d)h=LM(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let g=c.getBoundingClientRect();({scaleX:p,scaleY:y}=Ux(c,g)),h={left:g.left,right:g.left+c.clientWidth*p,top:g.top,bottom:g.top+c.clientHeight*y}}let w=0,m=0;if(i=="nearest")e.top0&&e.bottom>h.bottom+m&&(m=e.bottom-h.bottom+m+o)):e.bottom>h.bottom&&(m=e.bottom-h.bottom+o,n<0&&e.top-m0&&e.right>h.right+w&&(w=e.right-h.right+w+s)):e.right>h.right&&(w=e.right-h.right+s,n<0&&e.leftn.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else if(n.nodeType==11)n=n.host;else break;return null}class jM{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?Gr(n):0),r,Math.min(e.focusOffset,r?Gr(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let Us=null;function qx(t){if(t.setActive)return t.setActive();if(Us)return t.focus(Us);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Us==null?{get preventScroll(){return Us={preventScroll:!0},!0}}:void 0),!Us){Us=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}class It{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new It(e.parentNode,ja(e),n)}static after(e,n){return new It(e.parentNode,ja(e)+1,n)}}const d0=[];class ze{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let n=this.posAtStart;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}sync(e,n){if(this.flags&2){let r=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:r.firstChild)){let l=ze.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,n),o.flags&=-8}if(s=i?i.nextSibling:r.firstChild,n&&!n.written&&n.node==r&&s!=o.dom&&(n.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=T1(s);else r.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:r.firstChild,s&&n&&n.node==r&&(n.written=!0);s;)s=T1(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,n),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,n){let r;if(e==this.dom)r=this.dom.childNodes[n];else{let i=Gr(e)==0?0:n==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;i==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?i=-1:i=1),e=s}i<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!ze.get(r);)r=r.nextSibling;if(!r)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,n,r=0){let i=-1,s=-1,o=-1,l=-1;for(let a=0,u=r,c=r;an)return f.domBoundsAround(e,n,u);if(h>=e&&i==-1&&(i=a,s=u),u>n&&f.dom.parentNode==this.dom){o=a,l=c;break}c=h,u=h+f.breakAfter}return{from:s,to:l<0?r+this.length:l,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=d0){this.markDirty();for(let i=e;ithis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function Jx(t,e,n,r,i,s,o,l,a){let{children:u}=t,c=u.length?u[e]:null,f=s.length?s[s.length-1]:null,h=f?f.breakAfter:o;if(!(e==r&&c&&!o&&!h&&s.length<2&&c.merge(n,i,s.length?f:null,n==0,l,a))){if(r0&&(!o&&s.length&&c.merge(n,c.length,s[0],!1,l,0)?c.breakAfter=s.shift().breakAfter:(n2);var ee={mac:A1||/Mac/.test(pn.platform),windows:/Win/.test(pn.platform),linux:/Linux|X11/.test(pn.platform),ie:vh,ie_version:Qx?pp.documentMode||6:yp?+yp[1]:gp?+gp[1]:0,gecko:_1,gecko_version:_1?+(/Firefox\/(\d+)/.exec(pn.userAgent)||[0,0])[1]:0,chrome:!!Cd,chrome_version:Cd?+Cd[1]:0,ios:A1,android:/Android\b/.test(pn.userAgent),webkit:M1,safari:Xx,webkit_version:M1?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:pp.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const WM=256;class Yr extends ze{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,r){return this.flags&8||r&&(!(r instanceof Yr)||this.length-(n-e)+r.length>WM||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new Yr(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new It(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return HM(this.dom,e,n)}}class Jr extends ze{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let i of n)i.setParent(this)}setAttrs(e){if(Kx(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,i,s,o){return r&&(!(r instanceof Jr&&r.mark.eq(this.mark))||e&&s<=0||ne&&n.push(r=e&&(i=s),r=a,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new Jr(this.mark,n,o)}domAtPos(e){return e2(this,e)}coordsAt(e,n){return n2(this,e,n)}}function HM(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&n<0||e==r&&n>=0?ee.chrome||ee.gecko||(e?(i--,o=1):s=0)?0:l.length-1];return ee.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,u=>u.width)||a),o?yh(a,o<0):a||null}class bi extends ze{static create(e,n,r){return new bi(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=bi.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,i,s,o){return r&&(!(r instanceof bi)||!this.widget.compare(r.widget)||e>0&&s<=0||n0)?It.before(this.dom):It.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?i.length-1:0;s=i[l],!(e>0?l==0:l==i.length-1||s.top0?It.before(this.dom):It.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Te.empty}get isHidden(){return!0}}Yr.prototype.children=bi.prototype.children=Ho.prototype.children=d0;function e2(t,e){let n=t.dom,{children:r}=t,i=0;for(let s=0;is&&e0;s--){let o=r[s-1];if(o.dom.parentNode==n)return o.domAtPos(o.length)}for(let s=i;s0&&e instanceof Jr&&i.length&&(r=i[i.length-1])instanceof Jr&&r.mark.eq(e.mark)?t2(r,e.children[0],n-1):(i.push(e),e.setParent(t)),t.length+=e.length}function n2(t,e,n){let r=null,i=-1,s=null,o=-1;function l(u,c){for(let f=0,h=0;f=c&&(d.children.length?l(d,c-h):(!s||s.isHidden&&n>0)&&(p>c||h==p&&d.getSide()>0)?(s=d,o=c-h):(h-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function wp(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function qM(t){let e=Object.create(null);for(let n=0;n0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){m0(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){t2(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=vp(n,this.attrs||{})),r&&(this.attrs=vp({class:r},this.attrs||{}))}domAtPos(e){return e2(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(Kx(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(wp(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let i=this.dom.lastChild;for(;i&&ze.get(i)instanceof Jr;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((r=ze.get(i))===null||r===void 0?void 0:r.isEditable)==!1&&(!ee.ios||!this.children.some(s=>s instanceof Yr))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof Yr)||/[^ -~]/.test(r.text))return null;let i=Wo(r.dom);if(i.length!=1)return null;e+=i[0].width,n=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=n2(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight=n){if(s instanceof ct)return s;if(o>n)break}i=o+s.breakAfter}return null}}class Ni extends ze{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,i,s,o){return r&&(!(r instanceof Ni)||!this.widget.compare(r.widget)||e>0&&s<=0||n0}}class ti{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Kt=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Kt||(Kt={}));class oe extends Ts{constructor(e,n,r,i){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new nu(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Wi(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=r2(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new Wi(e,r,i,n,e.widget||null,!0)}static line(e){return new ru(e)}static set(e,n=!1){return Ce.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}oe.none=Ce.empty;class nu extends oe{constructor(e){let{start:n,end:r}=r2(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof nu&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&m0(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}nu.prototype.point=!1;class ru extends oe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ru&&this.spec.class==e.spec.class&&m0(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}ru.prototype.mapMode=Wt.TrackBefore;ru.prototype.point=!0;class Wi extends oe{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?Wt.TrackBefore:Wt.TrackAfter:Wt.TrackDel}get type(){return this.startSide!=this.endSide?Kt.WidgetRange:this.startSide<=0?Kt.WidgetBefore:Kt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Wi&&KM(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}Wi.prototype.point=!0;function r2(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function KM(t,e){return t==e||!!(t&&e&&t.compare(e))}function Sp(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class ca{constructor(e,n,r,i){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Ni&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ct),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Uu(new Ho(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Ni)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(Uu(new Yr(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=0}}span(e,n,r,i){this.buildText(n-e,r,i),this.pos=n,this.openStart<0&&(this.openStart=i)}point(e,n,r,i,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof Wi){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=n-e;if(r instanceof Wi)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Ni(r.widget||new N1("div"),l,r));else{let a=bi.create(r.widget||new N1("span"),l,l?0:r.startSide),u=this.atCursorPos&&!a.isEditable&&s<=i.length&&(e0),c=!a.isEditable&&(ei.length||r.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!u&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),u&&(f.append(Uu(new Ho(1),i),s),s=i.length+Math.max(0,s-i.length)),f.append(Uu(a,i),s),this.atCursorPos=c,this.pendingBuffer=c?ei.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=s)}static build(e,n,r,i,s){let o=new ca(e,n,r,s);return o.openEnd=Ce.spans(i,n,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Uu(t,e){for(let n of e)t=new Jr(n,[t],t.length);return t}class N1 extends ti{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}}var Be=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Be||(Be={}));const Ms=Be.LTR,p0=Be.RTL;function i2(t){let e=[];for(let n=0;n=n){if(l.level==r)return o;(s<0||(i!=0?i<0?l.fromn:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function o2(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;y-=3)if(yr[y+1]==-d){let w=yr[y+2],m=w&2?i:w&4?w&1?s:i:0;m&&(Ae[f]=Ae[yr[y]]=m),l=y;break}}else{if(yr.length==189)break;yr[l++]=f,yr[l++]=h,yr[l++]=a}else if((p=Ae[f])==2||p==1){let y=p==i;a=y?0:1;for(let w=l-3;w>=0;w-=3){let m=yr[w+2];if(m&2)break;if(y)yr[w+2]|=2;else{if(m&4)break;yr[w+2]|=4}}}}}function XM(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,l=ia;)p==w&&(p=n[--y].from,w=y?n[y-1].to:t),Ae[--p]=d;a=c}else s=u,a++}}}function bp(t,e,n,r,i,s,o){let l=r%2?2:1;if(r%2==i%2)for(let a=e,u=0;aa&&o.push(new xi(a,y.from,d));let w=y.direction==Ms!=!(d%2);xp(t,w?r+1:r,i,y.inner,y.from,y.to,o),a=y.to}p=y.to}else{if(p==n||(c?Ae[p]!=l:Ae[p]==l))break;p++}h?bp(t,a,p,r+1,i,h,o):ae;){let c=!0,f=!1;if(!u||a>s[u-1].to){let y=Ae[a-1];y!=l&&(c=!1,f=y==16)}let h=!c&&l==1?[]:null,d=c?r:r+1,p=a;e:for(;;)if(u&&p==s[u-1].to){if(f)break e;let y=s[--u];if(!c)for(let w=y.from,m=u;;){if(w==e)break e;if(m&&s[m-1].to==w)w=s[--m].from;else{if(Ae[w-1]==l)break e;break}}if(h)h.push(y);else{y.toAe.length;)Ae[Ae.length]=256;let r=[],i=e==Ms?0:1;return xp(t,i,i,n,0,t.length,r),r}function l2(t){return[new xi(0,t,0)]}let a2="";function tA(t,e,n,r,i){var s;let o=r.head-t.from,l=xi.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=e[l],u=a.side(i,n);if(o==u){let h=l+=i?1:-1;if(h<0||h>=e.length)return null;a=e[l=h],o=a.side(!i,n),u=a.side(i,n)}let c=Et(t.text,o,a.forward(i,n));(ca.to)&&(c=u),a2=t.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return f&&c==u&&f.level+(i?0:1)t.some(e=>e)}),g2=X.define({combine:t=>t.some(e=>e)});class _o{constructor(e,n="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new _o(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new _o(j.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const qu=he.define({map:(t,e)=>t.map(e)});function wn(t,e,n){let r=t.facet(h2);r.length?r[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}const wh=X.define({combine:t=>t.length?t[0]:!0});let rA=0;const Hl=X.define();class Xe{constructor(e,n,r,i,s){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=i,this.extension=s(this)}static define(e,n){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=n||{};return new Xe(rA++,e,r,i,l=>{let a=[Hl.of(l)];return o&&a.push(Ba.of(u=>{let c=u.plugin(l);return c?o(c):oe.none})),s&&a.push(s(l)),a})}static fromClass(e,n){return Xe.define(r=>new e(r),n)}}class $d{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(wn(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(n){wn(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){wn(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const y2=X.define(),g0=X.define(),Ba=X.define(),v2=X.define(),y0=X.define(),w2=X.define();function D1(t,e){let n=t.state.facet(w2);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return Ce.spans(r,e.from,e.to,{point(){},span(s,o,l,a){let u=s-e.from,c=o-e.from,f=i;for(let h=l.length-1;h>=0;h--,a--){let d=l[h].spec.bidiIsolate,p;if(d==null&&(d=nA(e.text,u,c)),a>0&&f.length&&(p=f[f.length-1]).to==u&&p.direction==d)p.to=c,f=p.inner;else{let y={from:u,to:c,direction:d,inner:[]};f.push(y),f=y.inner}}}}),i}const S2=X.define();function k2(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(S2)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const Ul=X.define();class zn{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new zn(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toAc)break;s+=2}if(!a)return r;new zn(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),o=a.toA,l=a.toB}}}class Tf{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=ht.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,l,a)=>i.push(new zn(s,o,l,a))),this.changedRanges=i}static create(e,n,r){return new Tf(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>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}}class R1 extends ze{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ct],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new zn(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:u,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let i=-1;this.view.inputState.composing>=0&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!cA(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?sA(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:u,to:c}=this.hasComposition;r=new zn(u,c,e.changes.mapPos(u,-1),e.changes.mapPos(c,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(ee.ie||ee.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=aA(o,l,e.changes);return r=zn.extendWithRanges(r,a),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=ee.chrome||ee.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||i.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to=0?i[o]:null;if(!l)break;let{fromA:a,toA:u,fromB:c,toB:f}=l,h,d,p,y;if(r&&r.range.fromBc){let S=ca.build(this.view.state.doc,c,r.range.fromB,this.decorations,this.dynamicDecorationMap),$=ca.build(this.view.state.doc,r.range.toB,f,this.decorations,this.dynamicDecorationMap);d=S.breakAtStart,p=S.openStart,y=$.openEnd;let b=this.compositionView(r);$.breakAtStart?b.breakAfter=1:$.content.length&&b.merge(b.length,b.length,$.content[0],!1,$.openStart,0)&&(b.breakAfter=$.content[0].breakAfter,$.content.shift()),S.content.length&&b.merge(0,0,S.content[S.content.length-1],!0,0,S.openEnd)&&S.content.pop(),h=S.content.concat(b).concat($.content)}else({content:h,breakAtStart:d,openStart:p,openEnd:y}=ca.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:w,off:m}=s.findPos(u,1),{i:g,off:v}=s.findPos(a,-1);Jx(this,g,v,w,m,h,d,p,y)}r&&this.fixCompositionDOM(r)}compositionView(e){let n=new Yr(e.text.nodeValue);n.flags|=8;for(let{deco:i}of e.marks)n=new Jr(i,[n],n.length);let r=new ct;return r.append(n,0),r}fixCompositionDOM(e){let n=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=ze.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},r=this.childPos(e.range.fromB,1),i=this.children[r.i];n(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)r=i.childPos(r.off,1),i=i.children[r.i],n(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,i=r==this.dom,s=!i&&Rc(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(i||n||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),u=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(ee.gecko&&l.empty&&!this.hasComposition&&iA(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=u=new It(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!ua(a.node,a.offset,c.anchorNode,c.anchorOffset)||!ua(u.node,u.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))&&(this.view.observer.ignore(()=>{ee.android&&ee.chrome&&this.dom.contains(c.focusNode)&&uA(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=Of(this.view.root);if(f)if(l.empty){if(ee.gecko){let h=oA(a.node,a.offset);if(h&&h!=3){let d=x2(a.node,a.offset,h==1?1:-1);d&&(a=new It(d.node,d.offset))}}f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(u.node,u.offset)}catch{}}else{let h=document.createRange();l.anchor>l.head&&([a,u]=[u,a]),h.setEnd(u.node,u.offset),h.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(h)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,u)),this.impreciseAnchor=a.precise?null:new It(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new It(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&ua(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Of(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=ct.find(this,n.head);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.length)return;let a=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!a||!u||a.bottom>u.top)return;let c=this.domAtPos(n.head+n.assoc);r.collapse(c.node,c.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&r.collapse(i,s)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let i=e.offset;!r&&i=0;i--){let s=ze.get(n.childNodes[i]);s instanceof ct&&(r=s.domAtPos(s.length))}return r?new It(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=ze.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;o--){let l=this.children[o],a=s-l.breakAfter,u=a-l.length;if(ae||l.covers(1))&&(!r||l instanceof ct&&!(r instanceof ct&&n>=0))&&(r=l,i=u),s=u}return r?r.coordsAt(e-i,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),i=this.children[n];if(!(i instanceof ct))return null;for(;i.children.length;){let{i:l,off:a}=i.childPos(r,1);for(;;l++){if(l==i.children.length)return null;if((i=i.children[l]).length)break}r=a}if(!(i instanceof Yr))return null;let s=Et(i.text,r);if(s==r)return null;let o=_s(i.dom,r,s).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Be.LTR;for(let u=0,c=0;ci)break;if(u>=r){let d=f.dom.getBoundingClientRect();if(n.push(d.height),o){let p=f.dom.lastChild,y=p?Wo(p):[];if(y.length){let w=y[y.length-1],m=a?w.right-d.left:d.right-w.left;m>l&&(l=m,this.minWidth=s,this.minWidthFrom=u,this.minWidthTo=h)}}}u=h+f.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Be.RTL:Be.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ct){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),n,r,i;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=Wo(e.firstChild)[0];n=e.getBoundingClientRect().height,r=s?s.width/27:7,i=s?s.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new Yx(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.length;if(o>r){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(oe.replace({widget:new I1(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return oe.set(e)}updateDeco(){let e=this.view.state.facet(Ba).map((i,s)=>(this.dynamicDecorationMap[s]=typeof i=="function")?i(this.view):i),n=!1,r=this.view.state.facet(v2).map((i,s)=>{let o=typeof i=="function";return o&&(n=!0),o?i(this.view):i});r.length&&(this.dynamicDecorationMap[e.length]=n,e.push(Ce.join(r)));for(let i=e.length;in.anchor?-1:1),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=k2(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;FM(this.view.scrollDOM,o,n.head0)r=r.childNodes[i-1],i=Gr(r);else break}if(n>=0)for(let r=t,i=e;;){if(r.nodeType==3)return{node:r,offset:i};if(r.nodeType==1&&i=0)r=r.childNodes[i],i=0;else break}return null}function oA(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function fA(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return j.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,l=s;n<0?o=Et(i.text,s,!1):l=Et(i.text,s);let a=r(i.text.slice(o,l));for(;o>0;){let u=Et(i.text,o,!1);if(r(i.text.slice(u,o))!=a)break;o=u}for(;lt?e.left-t:Math.max(0,t-e.right)}function dA(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function Ed(t,e){return t.tope.top+1}function L1(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function $p(t,e,n){let r,i,s,o,l=!1,a,u,c,f;for(let p=t.firstChild;p;p=p.nextSibling){let y=Wo(p);for(let w=0;wv||o==v&&s>g){r=p,i=m,s=g,o=v;let S=v?n0?w0)}g==0?n>m.bottom&&(!c||c.bottomm.top)&&(u=p,f=m):c&&Ed(c,m)?c=F1(c,m.bottom):f&&Ed(f,m)&&(f=L1(f,m.top))}}if(c&&c.bottom>=n?(r=a,i=c):f&&f.top<=n&&(r=u,i=f),!r)return{node:t,offset:0};let h=Math.max(i.left,Math.min(i.right,e));if(r.nodeType==3)return z1(r,h,n);if(l&&r.contentEditable!="false")return $p(r,h,n);let d=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(i.left+i.right)/2?1:0);return{node:t,offset:d}}function z1(t,e,n){let r=t.nodeValue.length,i=-1,s=1e9,o=0;for(let l=0;ln?c.top-n:n-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=h;if((ee.chrome||ee.gecko)&&_s(t,l).getBoundingClientRect().left==c.right&&(d=!h),f<=0)return{node:t,offset:l+(d?1:0)};i=l+(d?1:0),s=f}}}return{node:t,offset:i>-1?i:o>0?t.nodeValue.length:0}}function C2(t,e,n,r=-1){var i,s;let o=t.contentDOM.getBoundingClientRect(),l=o.top+t.viewState.paddingTop,a,{docHeight:u}=t.viewState,{x:c,y:f}=e,h=f-l;if(h<0)return 0;if(h>u)return t.state.doc.length;for(let S=t.viewState.heightOracle.textHeight/2,$=!1;a=t.elementAtHeight(h),a.type!=Kt.Text;)for(;h=r>0?a.bottom+S:a.top-S,!(h>=0&&h<=u);){if($)return n?null:0;$=!0,r=-r}f=l+h;let d=a.from;if(dt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:j1(t,o,a,c,f);let p=t.dom.ownerDocument,y=t.root.elementFromPoint?t.root:p,w=y.elementFromPoint(c,f);w&&!t.contentDOM.contains(w)&&(w=null),w||(c=Math.max(o.left+1,Math.min(o.right-1,c)),w=y.elementFromPoint(c,f),w&&!t.contentDOM.contains(w)&&(w=null));let m,g=-1;if(w&&((i=t.docView.nearest(w))===null||i===void 0?void 0:i.isEditable)!=!1){if(p.caretPositionFromPoint){let S=p.caretPositionFromPoint(c,f);S&&({offsetNode:m,offset:g}=S)}else if(p.caretRangeFromPoint){let S=p.caretRangeFromPoint(c,f);S&&({startContainer:m,startOffset:g}=S,(!t.contentDOM.contains(m)||ee.safari&&mA(m,g,c)||ee.chrome&&pA(m,g,c))&&(m=void 0))}}if(!m||!t.docView.dom.contains(m)){let S=ct.find(t.docView,d);if(!S)return h>a.top+a.height/2?a.to:a.from;({node:m,offset:g}=$p(S.dom,c,f))}let v=t.docView.nearest(m);if(!v)return null;if(v.isWidget&&((s=v.dom)===null||s===void 0?void 0:s.nodeType)==1){let S=v.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,a=Math.floor((i-n.top-(t.defaultLineHeight-l)*.5)/l);s+=a*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+fp(o,s,t.state.tabSize)}function mA(t,e,n){let r;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(let i=t.nextSibling;i;i=i.nextSibling)if(i.nodeType!=1||i.nodeName!="BR")return!1;return _s(t,r-1,r).getBoundingClientRect().left>n}function pA(t,e,n){if(e!=0)return!1;for(let i=t;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let r=t.nodeType==1?t.getBoundingClientRect():_s(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function Ep(t,e){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){for(let r of n.type)if(r.to>e||r.to==e&&(r.to==n.to||r.type==Kt.Text))return r}return n}function gA(t,e,n,r){let i=Ep(t,e.head),s=!r||i.type!=Kt.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),l=t.textDirectionAt(i.from),a=t.posAtCoords({x:n==(l==Be.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return j.cursor(a,n?-1:1)}return j.cursor(n?i.to:i.from,n?-1:1)}function B1(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let l=e,a=null;;){let u=tA(i,s,o,l,n),c=a2;if(!u){if(i.number==(n?t.state.doc.lines:1))return l;c=` +`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),u=t.visualLineSide(i,!n)}if(a){if(!a(c))return l}else{if(!r)return u;a=r(c)}l=u}}function yA(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Ue.Space&&(i=o),i==o}}function vA(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return j.cursor(i,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(i,e.assoc||-1),c=t.documentTop;if(u)o==null&&(o=u.left-a.left),l=s<0?u.top:u.bottom;else{let d=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(i-d.from))),l=(s<0?d.top:d.bottom)+c}let f=a.left+o,h=r??t.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(h+d)*s,y=C2(t,{x:f,y:p},!1,s);if(pa.bottom||(s<0?yi)){let w=t.docView.coordsForChar(y),m=!w||p{if(e>s&&ei(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:j.cursor(r,rnull),ee.gecko&&RA(e.contentDOM.ownerDocument)}handleEvent(e){!OA(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=SA(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()r.keyCode==e.keyCode))&&!e.ctrlKey||kA.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,To(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:ee.safari&&!ee.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}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 V1(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){wn(n.state,i)}}}function SA(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec;if(i&&i.domEventHandlers)for(let s in i.domEventHandlers){let o=i.domEventHandlers[s];o&&n(s).handlers.push(V1(r.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&n(s).observers.push(V1(r.value,o))}}for(let r in ir)n(r).handlers.push(ir[r]);for(let r in sr)n(r).observers.push(sr[r]);return e}const $2=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],kA="dthko",E2=[16,17,18,20,91,92,224,225],Ku=6;function Gu(t){return Math.max(0,t)*.7+8}function bA(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class xA{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParent=zM(e.contentDOM),this.atoms=e.state.facet(y0).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(ke.allowMultipleSelections)&&CA(e,n),this.dragging=EA(e,n)&&M2(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var n;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&bA(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let r=0,i=0,s=((n=this.scrollParent)===null||n===void 0?void 0:n.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=k2(this.view);e.clientX-o.left<=s.left+Ku?r=-Gu(s.left-e.clientX):e.clientX+o.right>=s.right-Ku&&(r=Gu(e.clientX-s.right)),e.clientY-o.top<=s.top+Ku?i=-Gu(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-Ku&&(i=Gu(e.clientY-s.bottom)),this.setScrollSpeed(r,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let n=null;for(let r=0;rthis.select(this.lastEvent),20)}}function CA(t,e){let n=t.state.facet(u2);return n.length?n[0](e):ee.mac?e.metaKey:e.ctrlKey}function $A(t,e){let n=t.state.facet(c2);return n.length?n[0](e):ee.mac?!e.altKey:!e.ctrlKey}function EA(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Of(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function OA(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=ze.get(n))&&r.ignoreEvent(e))return!1;return!0}const ir=Object.create(null),sr=Object.create(null),O2=ee.ie&&ee.ie_version<15||ee.ios&&ee.webkit_version<604;function TA(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),T2(t,n.value)},50)}function T2(t,e){let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(Op!=null&&n.selection.ranges.every(a=>a.empty)&&Op==s.toString()){let a=-1;r=n.changeByRange(u=>{let c=n.doc.lineAt(u.from);if(c.from==a)return{range:u};a=c.from;let f=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:c.from,insert:f},range:j.cursor(u.from+f.length)}})}else o?r=n.changeByRange(a=>{let u=s.line(i++);return{changes:{from:a.from,to:a.to,insert:u.text},range:j.cursor(a.from+u.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}sr.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};ir.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&(t.inputState.lastEscPress=Date.now()),!1);sr.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};sr.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};ir.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(f2))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=AA(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new xA(t,e,n,r)),r&&t.observer.ignore(()=>qx(t.contentDOM));let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function W1(t,e,n,r){if(r==1)return j.cursor(e,n);if(r==2)return fA(t.state,e,n);{let i=ct.find(t.docView,e),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return lt>=e.top&&t<=e.bottom,H1=(t,e,n)=>_2(e,n)&&t>=n.left&&t<=n.right;function _A(t,e,n,r){let i=ct.find(t.docView,e);if(!i)return 1;let s=e-i.posAtStart;if(s==0)return 1;if(s==i.length)return-1;let o=i.coordsAt(s,-1);if(o&&H1(n,r,o))return-1;let l=i.coordsAt(s,1);return l&&H1(n,r,l)?1:o&&_2(r,o)?-1:1}function U1(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:_A(t,n,e.clientX,e.clientY)}}const MA=ee.ie&&ee.ie_version<=11;let q1=null,K1=0,G1=0;function M2(t){if(!MA)return t.detail;let e=q1,n=G1;return q1=t,G1=Date.now(),K1=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(K1+1)%3:1}function AA(t,e){let n=U1(t,e),r=M2(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,l){let a=U1(t,s),u,c=W1(t,a.pos,a.bias,r);if(n.pos!=a.pos&&!o){let f=W1(t,n.pos,n.bias,r),h=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=h1&&(u=PA(i,a.pos))?u:l?i.addRange(c):j.create([c])}}}function PA(t,e){for(let n=0;n=e)return j.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}ir.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.nearest(e.target);if(i&&i.isWidget){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=j.range(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(n.from,n.to)),e.dataTransfer.effectAllowed="copyMove"),!1};ir.dragend=t=>(t.inputState.draggedContent=null,!1);function Y1(t,e,n,r){if(!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&$A(t,e)?{from:s.from,to:s.to}:null,l={from:i,insert:n},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(i,-1),head:a.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}ir.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&Y1(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Y1(t,e,r,!0),!0}return!1};ir.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=O2?null:e.clipboardData;return n?(T2(t,n.getData("text/plain")||n.getData("text/uri-text")),!0):(TA(t),!1)};function NA(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function DA(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:e.join(t.lineBreak),ranges:n,linewise:r}}let Op=null;ir.copy=ir.cut=(t,e)=>{let{text:n,ranges:r,linewise:i}=DA(t.state);if(!n&&!i)return!1;Op=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=O2?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(NA(t,n),!1)};const A2=Pr.define();function P2(t,e){let n=[];for(let r of t.facet(m2)){let i=r(t,e);i&&n.push(i)}return n?t.update({effects:n,annotations:A2.of(!0)}):null}function N2(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=P2(t.state,e);n?t.dispatch(n):t.update([])}},10)}sr.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),N2(t)};sr.blur=t=>{t.observer.clearSelectionRange(),N2(t)};sr.compositionstart=sr.compositionupdate=t=>{t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)};sr.compositionend=t=>{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,ee.chrome&&ee.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50)};sr.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};ir.beforeinput=(t,e)=>{var n;let r;if(ee.chrome&&ee.android&&(r=$2.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let i=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return!1};const J1=new Set;function RA(t){J1.has(t)||(J1.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Z1=["pre-wrap","normal","pre-line","break-spaces"];class IA{constructor(e){this.lineWrapping=e,this.doc=Te.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Z1.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,a=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let u=0;u0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,n){this.height!=n&&(Math.abs(this.height-n)>Lc&&(e.heightChanged=!0),this.height=n)}replace(e,n,r){return Gt.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let l=i.length-1;l>=0;l--){let{fromA:a,toA:u,fromB:c,toB:f}=i[l],h=s.lineAt(a,Le.ByPosNoHeight,r.setDoc(n),0,0),d=h.to>=u?h:s.lineAt(u,Le.ByPosNoHeight,r,0,0);for(f+=d.to-u,u=d.to;l>0&&h.from<=i[l-1].toA;)a=i[l-1].fromA,c=i[l-1].fromB,l--,as*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,i-=l.size}else if(s>i*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(i=s&&o(this.blockAt(0,r,i,s))}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class dn extends D2{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,i){return new Cr(i,this.length,r,this.height,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof dn||i instanceof kt&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof kt?i=new dn(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Gt.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setHeight(e,i.heights[i.index++]):(r||this.outdated)&&this.setHeight(e,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 kt extends Gt{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:l}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(n,i);if(n.lineWrapping){let u=i+Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length),c=n.doc.lineAt(u),f=l+c.length*a,h=Math.max(r,e-f/2);return new Cr(c.from,c.length,h,f,0)}else{let u=Math.max(0,Math.min(o-s,Math.floor((e-r)/l))),{from:c,length:f}=n.doc.line(s+u);return new Cr(c,f,r+l*u,l,0)}}lineAt(e,n,r,i,s){if(n==Le.ByHeight)return this.blockAt(e,r,i,s);if(n==Le.ByPosNoHeight){let{from:d,to:p}=r.doc.lineAt(e);return new Cr(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),u=r.doc.lineAt(e),c=l+u.length*a,f=u.number-o,h=i+l*f+a*(u.from-s-f);return new Cr(u.from,u.length,Math.max(i,Math.min(h,i+this.height-c)),c,0)}forEachLine(e,n,r,i,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:l,perLine:a,perChar:u}=this.heightMetrics(r,s);for(let c=e,f=i;c<=n;){let h=r.doc.lineAt(c);if(c==e){let p=h.number-l;f+=a*p+u*(e-s-p)}let d=a+u*h.length;o(new Cr(h.from,h.length,f,d,0)),f+=d,c=h.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let s=r[r.length-1];s instanceof kt?r[r.length-1]=new kt(s.length+i):r.push(null,new kt(i-1))}if(e>0){let s=r[0];s instanceof kt?r[0]=new kt(e+s.length):r.unshift(new kt(e-1),null)}return Gt.of(r)}decomposeLeft(e,n){n.push(new kt(e-1),null)}decomposeRight(e,n){n.push(null,new kt(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],l=Math.max(n,i.from),a=-1;for(i.from>n&&o.push(new kt(i.from-n-1).updateHeight(e,n));l<=s&&i.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=i.heights[i.index++];a==-1?a=f:Math.abs(f-a)>=Lc&&(a=-2);let h=new dn(c,f);h.outdated=!1,o.push(h),l+=c+1}l<=s&&o.push(null,new kt(s-l).updateHeight(e,l));let u=Gt.of(o);return(a<0||Math.abs(u.height-this.height)>=Lc||Math.abs(a-this.heightMetrics(e,n).perLine)>=Lc)&&(e.heightChanged=!0),u}else(r||this.outdated)&&(this.setHeight(e,e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class FA extends Gt{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return el))return u;let c=n==Le.ByPosNoHeight?Le.ByPosNoHeight:Le.ByPos;return a?u.join(this.right.lineAt(l,c,r,o,l)):this.left.lineAt(l,c,r,i,s).join(u)}forEachLine(e,n,r,i,s,o){let l=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,n,r,l,a,o);else{let u=this.lineAt(a,Le.ByPos,r,i,s);e=e&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,a,o)}}replace(e,n,r){let i=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of r)s.push(l);if(e>0&&Q1(s,o-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e2*n.size||n.size>2*e.size?Gt.of(this.break?[e,null,n]:[e,n]):(this.left=e,this.right=n,this.height=e.height+n.height,this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,l=n+s.length+this.break,a=null;return i&&i.from<=n+s.length&&i.more?a=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=l+o.length&&i.more?a=o=o.updateHeight(e,l,r,i):o.updateHeight(e,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Q1(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof kt&&(r=t[e+1])instanceof kt&&t.splice(e-1,3,new kt(n.length+1+r.length))}const zA=5;class v0{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof dn?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new dn(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=zA)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new dn(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new kt(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof dn)return e;let n=new dn(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof dn)&&!this.isCovered?this.nodes.push(new dn(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let h=c.getBoundingClientRect();s=Math.max(s,h.left),o=Math.min(o,h.right),l=Math.max(l,h.top),a=u==t.parentNode?h.bottom:Math.min(a,h.bottom)}u=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function WA(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Td{constructor(e,n,r){this.from=e,this.to=n,this.size=r}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new IA(n),this.stateDeco=e.facet(Ba).filter(r=>typeof r!="function"),this.heightMap=Gt.empty().applyChanges(this.stateDeco,Te.empty,this.heightOracle.setDoc(e.doc),[new zn(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=oe.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new Yu(s,o))}}this.viewports=e.sort((r,i)=>r.from-i.from),this.scaler=this.heightMap.height<=7e6?ew:new KA(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:ql(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Ba).filter(c=>typeof c!="function");let i=e.changedRanges,s=zn.extendWithRanges(i,jA(r,this.stateDeco,e?e.changes:ht.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,n));let u=!e.changes.empty||e.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),u&&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(),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(g2)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Be.RTL:Be.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=n.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,c=0;if(l.width&&l.height){let{scaleX:S,scaleY:$}=Ux(n,l);(this.scaleX!=S||this.scaleY!=$)&&(this.scaleX=S,this.scaleY=$,u|=8,o=a=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,h=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=h)&&(this.paddingTop=f,this.paddingBottom=h,u|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Gx(e.scrollDOM);let p=(this.printing?WA:VA)(n,this.paddingTop),y=p.top-this.pixelViewport.top,w=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let g=l.width;if((this.contentDOMWidth!=g||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=8),a){let S=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(S)&&(o=!0),o||i.lineWrapping&&Math.abs(g-this.contentDOMWidth)>i.charWidth){let{lineHeight:$,charWidth:b,textHeight:x}=e.docView.measureTextSize();o=$>0&&i.refresh(s,$,b,x,g/b,S),o&&(e.docView.minWidth=0,u|=8)}y>0&&w>0?c=Math.max(y,w):y<0&&w<0&&(c=Math.min(y,w)),i.heightChanged=!1;for(let $ of this.viewports){let b=$.from==this.viewport.from?S:e.docView.measureVisibleLineHeights($);this.heightMap=(o?Gt.empty().applyChanges(this.stateDeco,Te.empty,this.heightOracle,[new zn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new LA($.from,b))}i.heightChanged&&(u|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(u&2||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Yu(i.lineAt(o-r*1e3,Le.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,Le.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(ua.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=i.lineAt(u,Le.ByPos,s,0,0),h;n.y=="center"?h=(f.top+f.bottom)/2-c/2:n.y=="start"||n.y=="nearest"&&u=l+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s>1,o=i<<1;if(this.defaultTextDirection!=Be.LTR&&!r)return[];let l=[],a=(u,c,f,h)=>{if(c-uu&&ww.from>=f.from&&w.to<=f.to&&Math.abs(w.from-u)w.fromm));if(!y){if(cw.from<=c&&w.to>=c)){let w=n.moveToLineBoundary(j.cursor(c),!1,!0).head;w>u&&(c=w)}y=new Td(u,c,this.gapSize(f,u,c,h))}l.push(y)};for(let u of this.viewportLines){if(u.lengthu.from&&a(u.from,h,u,c),dn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];Ce.spans(e,this.viewport.from,this.viewport.to,{span(i,s){n.push({from:i,to:s})},point(){}},20);let r=n.length!=this.visibleRanges.length||this.visibleRanges.some((i,s)=>i.from!=n[s].from||i.to!=n[s].to);return this.visibleRanges=n,r?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||ql(this.heightMap.lineAt(e,Le.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return ql(this.heightMap.lineAt(this.scaler.fromDOM(e),Le.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return ql(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 Yu{constructor(e,n){this.from=e,this.to=n}}function UA(t,e,n){let r=[],i=t,s=0;return Ce.spans(n,t,e,{span(){},point(o,l){o>i&&(r.push({from:i,to:o}),s+=o-i),i=l}},20),i=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],l=o-s;if(r<=l)return s+r;r-=l}}function Zu(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function qA(t,e){for(let n of t)if(e(n))return n}const ew={toDOM(t){return t},fromDOM(t){return t},scale:1};class KA{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let u=n.lineAt(l,Le.ByPos,e,0,0).top,c=n.lineAt(a,Le.ByPos,e,0,0).bottom;return i+=c-u,{from:l,to:a,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=nql(i,e)):t._content)}const Qu=X.define({combine:t=>t.join(" ")}),Tp=X.define({combine:t=>t.indexOf(!0)>-1}),_p=Bi.newName(),R2=Bi.newName(),I2=Bi.newName(),L2={"&light":"."+R2,"&dark":"."+I2};function Mp(t,e,n){return new Bi(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const GA=Mp("."+_p,{"&":{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},".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:"#444"},".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",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&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},"&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-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"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,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"}},L2),Kl="￿";class YA{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(ke.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Kl}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==n)break;let l=ze.get(i),a=ze.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:tw(i))||tw(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=i.exec(n))&&(s=l.index,o=l[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(e){if(e.cmIgnore)return;let n=ze.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(JA(e,r.node,r.offset)?n:0))}}function JA(t,e,n){for(;;){if(!e||n-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let l=s||o?[]:eP(e),a=new YA(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=tP(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!mp(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!mp(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((ee.ios||ee.chrome)&&e.state.selection.main.empty&&a!=u&&(c.from>0||c.toDate.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=i.from,u=null;(s===8||ee.android&&e.text.length=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,i.to))}:(ee.mac||ee.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=j.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Te.of([" "])}):ee.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==` + `&&t.lineWrapping&&(r&&(r=j.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Te.of([" "])}),n){if(ee.ios&&t.inputState.flushIOSKey()||ee.android&&(n.from==i.from&&n.to==i.to&&n.insert.length==1&&n.insert.lines==2&&To(t.contentDOM,"Enter",13)||(n.from==i.from-1&&n.to==i.to&&n.insert.length==0||s==8&&n.insert.lengthi.head)&&To(t.contentDOM,"Backspace",8)||n.from==i.from&&n.to==i.to+1&&n.insert.length==0&&To(t.contentDOM,"Delete",46)))return!0;let o=n.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l,a=()=>l||(l=QA(t,n,r));return t.state.facet(d2).some(u=>u(t,n.from,n.to,o,a))||t.dispatch(a()),!0}else if(r&&!r.main.eq(i)){let o=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),l=t.inputState.lastSelectionOrigin),t.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function QA(t,e,n){let r,i=t.state,s=i.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=s.frome.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+a))}else{let l=i.changes(e),a=n&&n.main.to<=l.newLength?n.main:void 0;if(i.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let u=t.state.sliceDoc(e.from,e.to),c,f=n&&b2(t,n.main.head);if(f){let p=e.insert.length-(e.to-e.from);c={from:f.from,to:f.to-p}}else c=t.state.doc.lineAt(s.head);let h=s.to-e.to,d=s.to-s.from;r=i.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:l,range:a||p.map(l)};let y=p.to-h,w=y-u.length;if(p.to-p.from!=d||t.state.sliceDoc(w,y)!=u||p.to>=c.from&&p.from<=c.to)return{range:p};let m=i.changes({from:w,to:y,insert:e.insert}),g=p.to-s.to;return{changes:m,range:a?j.range(Math.max(0,a.anchor+g),Math.max(0,a.head+g)):p.map(m)}})}else r={changes:l,selection:a&&i.selection.replaceRange(a)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:o,scrollIntoView:!0})}function XA(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(r=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o=o?s-n:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-n:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function eP(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new nw(n,r)),(i!=n||s!=r)&&e.push(new nw(i,s))),e}function tP(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?j.single(n+e,r+e):null}const nP={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},_d=ee.ie&&ee.ie_version<=11;class rP{constructor(e){this.view=e,this.active=!1,this.selectionRange=new jM,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.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(ee.ie&&ee.ie_version<=11||ee.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),_d&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(wh)?r.root.activeElement!=this.dom:!Rc(r.dom,i))return;let s=i.anchorNode&&r.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(ee.ie&&ee.ie_version<=11||ee.android&&ee.chrome)&&!r.state.selection.main.empty&&i.focusNode&&ua(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=ee.safari&&e.root.nodeType==11&&IM(this.dom.ownerDocument)==this.dom&&iP(this.view)||Of(e.root);if(!n||this.selectionRange.eq(n))return!1;let r=Rc(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&To(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Rc(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new ZA(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=F2(this.view,n);return this.view.state==r&&this.view.update([]),i}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=rw(n,e.previousSibling||e.target.previousSibling,-1),i=rw(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),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),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function rw(t,e,n){for(;e;){let r=ze.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function iP(t){let e=null;function n(a){a.preventDefault(),a.stopImmediatePropagation(),e=a.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),!e)return null;let r=e.startContainer,i=e.startOffset,s=e.endContainer,o=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return ua(l.node,l.offset,s,o)&&([r,i,s,o]=[s,o,r,i]),{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}}class G{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.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){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(i=>n(i,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||BM(e.parent)||document,this.viewState=new X1(e.state||ke.create(e)),e.scrollTo&&e.scrollTo.is(qu)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Hl).map(r=>new $d(r));for(let r of this.plugins)r.update(this);this.observer=new rP(this),this.inputState=new wA(this),this.inputState.ensureHandlers(this.plugins),this.docView=new R1(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let n=e.length==1&&e[0]instanceof mt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,s=this.state;for(let h of e){if(h.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=h.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(h=>h.annotation(A2))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=P2(s,o),a||(l=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(ke.phrases)!=this.state.facet(ke.phrases))return this.setState(s);i=Tf.create(this,s,e),i.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let h of e){if(f&&(f=f.map(h.changes)),h.scrollIntoView){let{main:d}=h.state.selection;f=new _o(d.empty?d:j.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of h.effects)d.is(qu)&&(f=d.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=_f.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Ul)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Qu)!=i.state.facet(Qu)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!i.empty)for(let h of this.state.facet(Cp))try{h(i)}catch(d){wn(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!F2(this,c)&&u.force&&To(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new X1(e),this.plugins=e.facet(Hl).map(r=>new $d(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new R1(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Hl),r=e.state.facet(Hl);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new $d(s));else{let l=this.plugins[o];l.mustUpdate=e,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Gx(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(i);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];a&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(d=>{try{return d.read(this)}catch(p){return wn(this.state,p),iw}}),f=Tf.create(this,this.state,[]),h=!1;f.flags|=a,n?n.flags|=a:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),h=this.docView.update(f));for(let d=0;d1||p<-1){i=i+p,r.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(Cp))l(n)}get themeClasses(){return _p+" "+(this.state.facet(Tp)?I2:R2)+" "+this.state.facet(Qu)}updateAttrs(){let e=sw(this,y2,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(wh)?"true":"false",class:"cm-content",style:`${ee.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),sw(this,g0,n);let r=this.observer.ignore(()=>{let i=wp(this.contentDOM,this.contentAttrs,n),s=wp(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(G.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Ul);let e=this.state.facet(G.cspNonce);Bi.mount(this.root,this.styleModules.concat(GA).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.spec==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Od(this,e,B1(this,e,n,r))}moveByGroup(e,n){return Od(this,e,B1(this,e,n,r=>yA(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return j.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return gA(this,e,n,r)}moveVertically(e,n,r){return Od(this,e,vA(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),C2(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[xi.find(s,e-i.from,-1,n)];return yh(r,o.dir==Be.LTR==n>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(p2)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>sP)return l2(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||o2(s.isolates,r=D1(this,e))))return s.order;r||(r=D1(this,e));let i=eA(e.text,n,r);return this.bidiCache.push(new _f(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ee.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qx(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(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return qu.of(new _o(typeof e=="number"?j.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return qu.of(new _o(j.cursor(r.from),"start","start",r.top-e,n,!0))}static domEventHandlers(e){return Xe.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Xe.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Bi.newName(),i=[Qu.of(r),Ul.of(Mp(`.${r}`,e))];return n&&n.dark&&i.push(Tp.of(!0)),i}static baseTheme(e){return Xo.lowest(Ul.of(Mp("."+_p,e,L2)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&ze.get(r)||ze.get(e);return((n=i==null?void 0:i.rootView)===null||n===void 0?void 0:n.view)||null}}G.styleModule=Ul;G.inputHandler=d2;G.focusChangeEffect=m2;G.perLineTextDirection=p2;G.exceptionSink=h2;G.updateListener=Cp;G.editable=wh;G.mouseSelectionStyle=f2;G.dragMovesSelection=c2;G.clickAddsSelectionRange=u2;G.decorations=Ba;G.outerDecorations=v2;G.atomicRanges=y0;G.bidiIsolatedRanges=w2;G.scrollMargins=S2;G.darkTheme=Tp;G.cspNonce=X.define({combine:t=>t.length?t[0]:""});G.contentAttributes=g0;G.editorAttributes=y2;G.lineWrapping=G.contentAttributes.of({class:"cm-lineWrapping"});G.announce=he.define();const sP=4096,iw={};class _f{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Be.LTR;for(let s=Math.max(0,e.length-10);s=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&vp(o,n)}return n}const oP=ee.mac?"mac":ee.windows?"win":ee.linux?"linux":"key";function lP(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,l;for(let a=0;ar.concat(i),[]))),n}function uP(t,e,n){return j2(z2(t.state),e,t,n)}let gi=null;const cP=4e3;function fP(t,e=oP){let n=Object.create(null),r=Object.create(null),i=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,u,c)=>{var f,h;let d=n[o]||(n[o]=Object.create(null)),p=l.split(/ (?!$)/).map(m=>lP(m,e));for(let m=1;m{let S=gi={view:v,prefix:g,scope:o};return setTimeout(()=>{gi==S&&(gi=null)},cP),!0}]})}let y=p.join(" ");i(y,!1);let w=d[y]||(d[y]={preventDefault:!1,stopPropagation:!1,run:((h=(f=d._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});a&&w.run.push(a),u&&(w.preventDefault=!0),c&&(w.stopPropagation=!0)};for(let o of t){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let f in c)c[f].run.push(o.any)}let a=o[e]||o.key;if(a)for(let u of l)s(u,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return n}function j2(t,e,n,r){let i=RM(e),s=bt(i,0),o=An(s)==i.length&&i!=" ",l="",a=!1,u=!1,c=!1;gi&&gi.view==n&&gi.scope==r&&(l=gi.prefix+" ",E2.indexOf(e.keyCode)<0&&(u=!0,gi=null));let f=new Set,h=w=>{if(w){for(let m of w.run)if(!f.has(m)&&(f.add(m),m(n,e)))return w.stopPropagation&&(c=!0),!0;w.preventDefault&&(w.stopPropagation&&(c=!0),u=!0)}return!1},d=t[r],p,y;return d&&(h(d[l+Xu(i,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ee.windows&&e.ctrlKey&&e.altKey)&&(p=Vi[e.keyCode])&&p!=i?(h(d[l+Xu(p,e,!0)])||e.shiftKey&&(y=za[e.keyCode])!=i&&y!=p&&h(d[l+Xu(y,e,!1)]))&&(a=!0):o&&e.shiftKey&&h(d[l+Xu(i,e,!0)])&&(a=!0),!a&&h(d._any)&&(a=!0)),u&&(a=!0),a&&c&&e.stopPropagation(),a}class iu{constructor(e,n,r,i,s){this.className=e,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=B2(e);return[new iu(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return hP(e,n,r)}}function B2(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Be.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function lw(t,e,n){let r=j.cursor(e);return{from:Math.max(n.from,t.moveToLineBoundary(r,!1,!0).from),to:Math.min(n.to,t.moveToLineBoundary(r,!0,!0).from),type:Kt.Text}}function hP(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),s=t.textDirection==Be.LTR,o=t.contentDOM,l=o.getBoundingClientRect(),a=B2(t),u=o.querySelector(".cm-line"),c=u&&window.getComputedStyle(u),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),h=l.right-(c?parseInt(c.paddingRight):0),d=Ep(t,r),p=Ep(t,i),y=d.type==Kt.Text?d:null,w=p.type==Kt.Text?p:null;if(y&&(t.lineWrapping||d.widgetLineBreaks)&&(y=lw(t,r,y)),w&&(t.lineWrapping||p.widgetLineBreaks)&&(w=lw(t,i,w)),y&&w&&y.from==w.from)return g(v(n.from,n.to,y));{let $=y?v(n.from,null,y):S(d,!1),b=w?v(null,n.to,w):S(p,!0),x=[];return(y||d).to<(w||p).from-(y&&w?1:0)||d.widgetLineBreaks>1&&$.bottom+t.defaultLineHeight/2B&&Q.from=Ee)break;I>fe&&V(Math.max(Y,fe),$==null&&Y<=B,Math.min(I,Ee),b==null&&I>=te,H.dir)}if(fe=pe.to+1,fe>=Ee)break}return N.length==0&&V(B,$==null,te,b==null,t.textDirection),{top:_,bottom:A,horizontal:N}}function S($,b){let x=l.top+(b?$.top:$.bottom);return{top:x,bottom:x,horizontal:[]}}}function dP(t,e){return t.constructor==e.constructor&&t.eq(e)}class mP{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Fc)!=e.state.facet(Fc)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let n=0,r=e.facet(Fc);for(;n!dP(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Fc=X.define();function V2(t){return[Xe.define(e=>new mP(e,t)),Fc.of(t)]}const W2=!ee.ios,Va=X.define({combine(t){return Nr(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function pP(t={}){return[Va.of(t),gP,yP,vP,g2.of(!0)]}function H2(t){return t.startState.facet(Va)!=t.state.facet(Va)}const gP=V2({above:!0,markers(t){let{state:e}=t,n=e.facet(Va),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty?!s||W2:n.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:j.cursor(i.head,i.head>i.anchor?-1:1);for(let a of iu.forRange(t,o,l))r.push(a)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=H2(t);return n&&aw(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){aw(e.state,t)},class:"cm-cursorLayer"});function aw(t,e){e.style.animationDuration=t.facet(Va).cursorBlinkRate+"ms"}const yP=V2({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:iu.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||H2(t)},class:"cm-selectionLayer"}),Ap={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};W2&&(Ap[".cm-line"].caretColor="transparent !important",Ap[".cm-content"]={caretColor:"transparent !important"});const vP=Xo.highest(G.theme(Ap)),U2=he.define({map(t,e){return t==null?null:e.mapPos(t)}}),Gl=Mt.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(U2)?r.value:n,t)}}),wP=Xe.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Gl);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Gl)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Gl),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Gl)!=t&&this.view.dispatch({effects:U2.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 SP(){return[Gl,wP]}function uw(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)i(o+l.index,l)}function kP(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class bP{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(l,a,u,c)=>i(c,u,u+l[0].length,l,a);else if(typeof r=="function")this.addMatch=(l,a,u,c)=>{let f=r(l,a,u);f&&c(u,u+l[0].length,f)};else if(r)this.addMatch=(l,a,u,c)=>c(u,u+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let n=new ji,r=n.add.bind(n);for(let{from:i,to:s}of kP(e,this.maxLength))uw(e.state.doc,this.regexp,i,s,(o,l)=>this.addMatch(l,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>e.view.viewport.from&&l1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),l=Math.min(s.to,i);if(l>o){let a=e.state.doc.lineAt(o),u=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lh.push(m.range(y,w));if(a==u)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(w,e,y,p));n=n.update({filterFrom:c,filterTo:f,filter:(y,w)=>yf,add:h})}}return n}}const Pp=/x/.unicode!=null?"gu":"g",xP=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Pp),CP={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 Md=null;function $P(){var t;if(Md==null&&typeof document<"u"&&document.body){let e=document.body.style;Md=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Md||!1}const zc=X.define({combine(t){let e=Nr(t,{render:null,specialChars:xP,addSpecialChars:null});return(e.replaceTabs=!$P())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Pp)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Pp)),e}});function EP(t={}){return[zc.of(t),OP()]}let cw=null;function OP(){return cw||(cw=Xe.fromClass(class{constructor(t){this.view=t,this.decorations=oe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(zc)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new bP({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=bt(e[0],0);if(s==9){let o=i.lineAt(r),l=n.state.tabSize,a=el(o.text,l,r-o.from);return oe.replace({widget:new AP((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=oe.replace({widget:new MP(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(zc);t.startState.facet(zc)!=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 TP="•";function _P(t){return t>=32?TP:t==10?"␤":String.fromCharCode(9216+t)}class MP extends ti{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=_P(this.code),r=e.state.phrase("Control character")+" "+(CP[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class AP extends ti{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 PP(){return DP}const NP=oe.line({class:"cm-activeLine"}),DP=Xe.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(NP.range(i.from)),e=i.from)}return oe.set(n)}},{decorations:t=>t.decorations});class RP extends ti{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let n=e.firstChild?Wo(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=yh(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function IP(t){return Xe.fromClass(class{constructor(e){this.view=e,this.placeholder=t?oe.set([oe.widget({widget:new RP(t),side:1}).range(0)]):oe.none}get decorations(){return this.view.state.doc.length?oe.none:this.placeholder}},{decorations:e=>e.decorations})}const Np=2e3;function LP(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>Np||n.off>Np||e.col<0||n.col<0){let o=Math.min(e.off,n.off),l=Math.max(e.off,n.off);for(let a=r;a<=i;a++){let u=t.doc.line(a);u.length<=l&&s.push(j.range(u.from+o,u.to+l))}}else{let o=Math.min(e.col,n.col),l=Math.max(e.col,n.col);for(let a=r;a<=i;a++){let u=t.doc.line(a),c=fp(u.text,o,t.tabSize,!0);if(c<0)s.push(j.cursor(u.to));else{let f=fp(u.text,l,t.tabSize);s.push(j.range(u.from+c,u.from+f))}}}return s}function FP(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function fw(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>Np?-1:i==r.length?FP(t,e.clientX):el(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function zP(t,e){let n=fw(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let l=fw(t,i);if(!l)return r;let a=LP(t.state,n,l);return a.length?o?j.create(a.concat(r.ranges)):j.create(a):r}}:null}function jP(t){let e=(t==null?void 0:t.eventFilter)||(n=>n.altKey&&n.button==0);return G.mouseSelectionStyle.of((n,r)=>e(r)?zP(n,r):null)}const BP={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},VP={style:"cursor: crosshair"};function WP(t={}){let[e,n]=BP[t.key||"Alt"],r=Xe.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,G.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?VP:null})]}const Nl="-10000px";class q2{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=n?[]:null;for(let a=0;an[u]=a),n.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function HP(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Ad=X.define({combine:t=>{var e,n,r;return{position:ee.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||HP}}}),hw=new WeakMap,w0=Xe.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(Ad);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 q2(t,S0,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Ad);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.insertBefore(i,r)}return n.dom.style.position=this.position,n.dom.style.top=Nl,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,n=1,r=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(ee.gecko)r=i.offsetParent!=this.container.ownerDocument.body;else if(i.style.top==Nl&&i.style.left=="0px"){let s=i.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,n=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:n}=this.view.viewState);return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map((i,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Ad).tooltipSpace(this.view),scaleX:e,scaleY:n,makeAbsolute:r}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let l=0;l=Math.min(n.bottom,r.bottom)||f.rightMath.min(n.right,r.right)+.1){c.style.top=Nl;continue}let d=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,y=h.right-h.left,w=(e=hw.get(u))!==null&&e!==void 0?e:h.bottom-h.top,m=u.offset||qP,g=this.view.textDirection==Be.LTR,v=h.width>r.right-r.left?g?r.left:r.right-h.width:g?Math.min(f.left-(d?14:0)+m.x,r.right-y):Math.max(r.left,f.left-y+(d?14:0)-m.x),S=this.above[l];!a.strictSide&&(S?f.top-(h.bottom-h.top)-m.yr.bottom)&&S==r.bottom-f.bottom>f.top-r.top&&(S=this.above[l]=!S);let $=(S?f.top-r.top:r.bottom-f.bottom)-p;if($v&&_.topb&&(b=S?_.top-w-2-p:_.bottom+p+2);if(this.position=="absolute"?(c.style.top=(b-t.parent.top)/s+"px",c.style.left=(v-t.parent.left)/i+"px"):(c.style.top=b/s+"px",c.style.left=v/i+"px"),d){let _=f.left+(g?m.x:-m.x)-(v+14-7);d.style.left=_/i+"px"}u.overlap!==!0&&o.push({left:v,top:b,right:x,bottom:b+w}),c.classList.toggle("cm-tooltip-above",S),c.classList.toggle("cm-tooltip-below",!S),u.positioned&&u.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Nl}},{eventObservers:{scroll(){this.maybeMeasure()}}}),UP=G.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),qP={x:0,y:0},S0=X.define({enables:[w0,UP]}),Mf=X.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class kh{static create(e){return new kh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new q2(e,Mf,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const KP=S0.compute([Mf],t=>{let e=t.facet(Mf);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:kh.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class GP{constructor(e,n,r,i,s){this.view=e,this.source=n,this.field=r,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||n.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(c=>c.from<=i&&c.to>=i),u=a&&a.dir==Be.RTL?-1:1;s=n.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>wn(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(w0),n=e?e.manager.tooltips.findIndex(r=>r.create==kh.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!YP(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,l=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!JP(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const ec=4;function YP(t,e){let n=t.getBoundingClientRect();return e.clientX>=n.left-ec&&e.clientX<=n.right+ec&&e.clientY>=n.top-ec&&e.clientY<=n.bottom+ec}function JP(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.righti||Math.min(o.bottom,l)=e&&a<=n}function ZP(t,e={}){let n=he.define(),r=Mt.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let l of i){let a=s.changes.mapPos(l.pos,-1,Wt.TrackDel);if(a!=null){let u=Object.assign(Object.create(null),l);u.pos=a,u.end!=null&&(u.end=s.changes.mapPos(u.end)),o.push(u)}}i=o}for(let o of s.effects)o.is(n)&&(i=o.value),o.is(QP)&&(i=[]);return i},provide:i=>Mf.from(i)});return[r,Xe.define(i=>new GP(i,t,r,n,e.hoverTime||300)),KP]}function K2(t,e){let n=t.plugin(w0);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const QP=he.define(),dw=X.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Wa(t,e){let n=t.plugin(G2),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const G2=Xe.fromClass(class{constructor(t){this.input=t.state.facet(Ha),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(dw);this.top=new tc(t,!0,e.topContainer),this.bottom=new tc(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(dw);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new tc(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new tc(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Ha);if(n!=this.input){let r=n.filter(a=>a),i=[],s=[],o=[],l=[];for(let a of r){let u=this.specs.indexOf(a),c;u<0?(c=a(t.view),l.push(c)):(c=this.panels[u],c.update&&c.update(t)),i.push(c),(c.top?s:o).push(c)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>G.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class tc{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=mw(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=mw(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function mw(t){let e=t.nextSibling;return t.remove(),e}const Ha=X.define({enables:G2});class Zr extends Ts{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Zr.prototype.elementClass="";Zr.prototype.toDOM=void 0;Zr.prototype.mapMode=Wt.TrackBefore;Zr.prototype.startSide=Zr.prototype.endSide=-1;Zr.prototype.point=!0;const jc=X.define(),XP={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ce.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},fa=X.define();function eN(t){return[Y2(),fa.of(Object.assign(Object.assign({},XP),t))]}const Dp=X.define({combine:t=>t.some(e=>e)});function Y2(t){let e=[tN];return t&&t.fixed===!1&&e.push(Dp.of(!0)),e}const tN=Xe.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(fa).map(e=>new gw(t,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(Dp),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Dp)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let n=Ce.iter(this.view.state.facet(jc),this.view.viewport.from),r=[],i=this.gutters.map(s=>new nN(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==Kt.Text&&o){Rp(n,r,l.from);for(let a of i)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of i)a.widget(this.view,l)}else if(s.type==Kt.Text){Rp(n,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(fa),n=t.state.facet(fa),r=t.docChanged||t.heightChanged||t.viewportChanged||!Ce.eq(t.startState.facet(jc),t.state.facet(jc),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let s of n){let o=e.indexOf(s);o<0?i.push(new gw(this.view,s)):(this.gutters[o].update(t),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>G.scrollMargins.of(e=>{let n=e.plugin(t);return!n||n.gutters.length==0||!n.fixed?null:e.textDirection==Be.LTR?{left:n.dom.offsetWidth*e.scaleX}:{right:n.dom.offsetWidth*e.scaleX}})});function pw(t){return Array.isArray(t)?t:[t]}function Rp(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class nN{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Ce.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let l=new J2(e,o,s,r);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(e,o,s,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];Rp(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n);r&&this.addElement(e,n,[r])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class gw{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=i.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,l,i)&&i.preventDefault()});this.markers=pw(n.markers(e)),n.initialSpacer&&(this.spacer=new J2(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=pw(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!Ce.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class J2{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),rN(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=ss(l,a,u)||o(l,a,u):o}return r}})}});class Pd extends Zr{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Nd(t,e){return t.state.facet(fo).formatNumber(e,t.state)}const sN=fa.compute([fo],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(iN)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new Pd(Nd(e,e.state.doc.lineAt(n.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(fo)!=e.state.facet(fo),initialSpacer(e){return new Pd(Nd(e,yw(e.state.doc.lines)))},updateSpacer(e,n){let r=Nd(n.view,yw(n.view.state.doc.lines));return r==e.number?e:new Pd(r)},domEventHandlers:t.facet(fo).domEventHandlers}));function oN(t={}){return[fo.of(t),Y2(),sN]}function yw(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(lN.range(i)))}return Ce.of(e)});function uN(){return aN}var Dd;const ho=new me;function cN(t){return X.define({combine:t?e=>e.concat(t):void 0})}const fN=new me;class Xn{constructor(e,n,r=[],i=""){this.data=e,this.name=i,ke.prototype.hasOwnProperty("tree")||Object.defineProperty(ke.prototype,"tree",{get(){return _t(this)}}),this.parser=n,this.extension=[Hi.of(this),ke.languageData.of((s,o,l)=>{let a=vw(s,o,l),u=a.type.prop(ho);if(!u)return[];let c=s.facet(u),f=a.type.prop(fN);if(f){let h=a.resolve(o-a.from,l);for(let d of f)if(d.test(h,s)){let p=s.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(r)}isActiveAt(e,n,r=-1){return vw(e,n,r).type.prop(ho)==this.data}findRegions(e){let n=e.facet(Hi);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(ho)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(me.mounted);if(l){if(l.tree.prop(ho)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;ar.isTop?n:void 0)]}),e.name)}configure(e,n){return new Af(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function _t(t){let e=t.field(Xn.state,!1);return e?e.tree:ut.empty}class hN{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Dl=null;class Pf{constructor(e,n,r=[],i,s,o,l,a){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new Pf(e,n,[],ut.empty,0,r,[],null)}startParse(){return this.parser.startParse(new hN(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ut.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(ks.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Dl;Dl=this;try{return e()}finally{Dl=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=ww(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((u,c,f,h)=>a.push({fromA:u,toA:c,fromB:f,toB:h})),r=ks.applyChanges(r,a),i=ut.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let c=e.mapPos(u.from,1),f=e.mapPos(u.to,-1);ce.from&&(this.fragments=ww(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Cx{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=Dl;if(a){for(let u of i)a.tempSkipped.push(u);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new ut(an.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Dl}}function ww(t,e,n){return ks.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Uo{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new Uo(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=Pf.create(e.facet(Hi).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Uo(r)}}Xn.state=Mt.define({create:Uo.init,update(t,e){for(let n of e.effects)if(n.is(Xn.setState))return n.value;return e.startState.facet(Hi)!=e.state.facet(Hi)?Uo.init(e.state):t.apply(e)}});let Z2=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Z2=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Rd=typeof navigator<"u"&&(!((Dd=navigator.scheduling)===null||Dd===void 0)&&Dd.isInputPending)?()=>navigator.scheduling.isInputPending():null,dN=Xe.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Xn.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Xn.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=Z2(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEndi+1e3,a=s.context.work(()=>Rd&&Rd()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Xn.setState.of(new Uo(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>wn(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Hi=X.define({combine(t){return t.length?t[0]:null},enables:t=>[Xn.state,dN,G.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class mN{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const pN=X.define(),bh=X.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Nf(t){let e=t.facet(bh);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Ua(t,e){let n="",r=t.tabSize,i=t.facet(bh)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s=e?gN(t,n,e):null}class xh{constructor(e,n={}){this.state=e,this.options=n,this.unit=Nf(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return el(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Q2=new me;function gN(t,e,n){let r=e.resolveStack(n),i=r.node.enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o!=r.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return X2(r,t,n)}function X2(t,e,n){for(let r=t;r;r=r.next){let i=vN(r.node);if(i)return i(b0.create(e,n,r))}return 0}function yN(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function vN(t){let e=t.type.prop(Q2);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(me.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>bN(o,!0,1,void 0,s&&!yN(o)?i.from:void 0)}return t.parent==null?wN:null}function wN(){return 0}class b0 extends xh{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new b0(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(SN(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return X2(this.context.next,this.base,this.pos)}}function SN(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function kN(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=n.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped)return a.from{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const xN=200;function CN(){return ke.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+xN)return t;let s=n.sliceString(i.from,r);if(!e.some(u=>u.test(s)))return t;let{state:o}=t,l=-1,a=[];for(let{head:u}of o.selection.ranges){let c=o.doc.lineAt(u);if(c.from==l)continue;l=c.from;let f=k0(o,c.from);if(f==null)continue;let h=/^\s*/.exec(c.text)[0],d=Ua(o,f);h!=d&&a.push({from:c.from,to:c.from+h.length,insert:d})}return a.length?[t,{changes:a,sequential:!0}]:t})}const $N=X.define(),eC=new me;function EN(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(s&&l.from=e&&u.to>n&&(s=u)}}return s}function TN(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Df(t,e,n){for(let r of t.facet($N)){let i=r(t,e,n);if(i)return i}return ON(t,e,n)}function tC(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Ch=he.define({map:tC}),su=he.define({map:tC});function nC(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const As=Mt.define({create(){return oe.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)if(n.is(Ch)&&!_N(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(x0),i=r?oe.replace({widget:new IN(r(e.state,n.value))}):kw;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(su)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));if(e.selection){let n=!1,{head:r}=e.selection.main;t.between(r,r,(i,s)=>{ir&&(n=!0)}),n&&(t=t.update({filterFrom:r,filterTo:r,filter:(i,s)=>s<=r||i>=r}))}return t},provide:t=>G.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{(!i||i.from>s)&&(i={from:s,to:o})}),i}function _N(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function rC(t,e){return t.field(As,!1)?e:e.concat(he.appendConfig.of(sC()))}const MN=t=>{for(let e of nC(t)){let n=Df(t.state,e.from,e.to);if(n)return t.dispatch({effects:rC(t.state,[Ch.of(n),iC(t,n)])}),!0}return!1},AN=t=>{if(!t.state.field(As,!1))return!1;let e=[];for(let n of nC(t)){let r=Rf(t.state,n.from,n.to);r&&e.push(su.of(r),iC(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function iC(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return G.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const PN=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(As,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(su.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},DN=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:MN},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:AN},{key:"Ctrl-Alt-[",run:PN},{key:"Ctrl-Alt-]",run:NN}],RN={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},x0=X.define({combine(t){return Nr(t,RN)}});function sC(t){let e=[As,zN];return t&&e.push(x0.of(t)),e}function oC(t,e){let{state:n}=t,r=n.facet(x0),i=o=>{let l=t.lineBlockAt(t.posAtDOM(o.target)),a=Rf(t.state,l.from,l.to);a&&t.dispatch({effects:su.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const kw=oe.replace({widget:new class extends ti{toDOM(t){return oC(t,null)}}});class IN extends ti{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return oC(e,this.value)}}const LN={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Id extends Zr{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function FN(t={}){let e=Object.assign(Object.assign({},LN),t),n=new Id(e,!0),r=new Id(e,!1),i=Xe.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Hi)!=o.state.facet(Hi)||o.startState.field(As,!1)!=o.state.field(As,!1)||_t(o.startState)!=_t(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new ji;for(let a of o.viewportLineBlocks){let u=Rf(o.state,a.from,a.to)?r:Df(o.state,a.from,a.to)?n:null;u&&l.add(a.from,a.from,u)}return l.finish()}}),{domEventHandlers:s}=e;return[i,eN({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(i))===null||l===void 0?void 0:l.markers)||Ce.empty},initialSpacer(){return new Id(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let u=Rf(o.state,l.from,l.to);if(u)return o.dispatch({effects:su.of(u)}),!0;let c=Df(o.state,l.from,l.to);return c?(o.dispatch({effects:Ch.of(c)}),!0):!1}})}),sC()]}const zN=G.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 ou{constructor(e,n){this.specs=e;let r;function i(l){let a=Bi.newName();return(r||(r=Object.create(null)))["."+a]=l,a}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof Xn?l=>l.prop(ho)==o.data:o?l=>l==o:void 0,this.style=Ox(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Bi(r):null,this.themeType=n.themeType}static define(e,n){return new ou(e,n||{})}}const Ip=X.define(),lC=X.define({combine(t){return t.length?[t[0]]:null}});function Ld(t){let e=t.facet(Ip);return e.length?e:t.facet(lC)}function aC(t,e){let n=[BN],r;return t instanceof ou&&(t.module&&n.push(G.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(lC.of(t)):r?n.push(Ip.computeN([G.darkTheme],i=>i.facet(G.darkTheme)==(r=="dark")?[t]:[])):n.push(Ip.of(t)),n}class jN{constructor(e){this.markCache=Object.create(null),this.tree=_t(e.state),this.decorations=this.buildDeco(e,Ld(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=_t(e.state),r=Ld(e.state),i=r!=Ld(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return oe.none;let r=new ji;for(let{from:i,to:s}of e.visibleRanges)fM(this.tree,n,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=oe.mark({class:a})))},i,s);return r.finish()}}const BN=Xo.high(Xe.fromClass(jN,{decorations:t=>t.decorations})),VN=ou.define([{tag:z.meta,color:"#404740"},{tag:z.link,textDecoration:"underline"},{tag:z.heading,textDecoration:"underline",fontWeight:"bold"},{tag:z.emphasis,fontStyle:"italic"},{tag:z.strong,fontWeight:"bold"},{tag:z.strikethrough,textDecoration:"line-through"},{tag:z.keyword,color:"#708"},{tag:[z.atom,z.bool,z.url,z.contentSeparator,z.labelName],color:"#219"},{tag:[z.literal,z.inserted],color:"#164"},{tag:[z.string,z.deleted],color:"#a11"},{tag:[z.regexp,z.escape,z.special(z.string)],color:"#e40"},{tag:z.definition(z.variableName),color:"#00f"},{tag:z.local(z.variableName),color:"#30a"},{tag:[z.typeName,z.namespace],color:"#085"},{tag:z.className,color:"#167"},{tag:[z.special(z.variableName),z.macroName],color:"#256"},{tag:z.definition(z.propertyName),color:"#00c"},{tag:z.comment,color:"#940"},{tag:z.invalid,color:"#f00"}]),WN=G.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),uC=1e4,cC="()[]{}",fC=X.define({combine(t){return Nr(t,{afterCursor:!0,brackets:cC,maxScanDistance:uC,renderMatch:qN})}}),HN=oe.mark({class:"cm-matchingBracket"}),UN=oe.mark({class:"cm-nonmatchingBracket"});function qN(t){let e=[],n=t.matched?HN:UN;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const KN=Mt.define({create(){return oe.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(fC);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=Er(e.state,i.head,-1,r)||i.head>0&&Er(e.state,i.head-1,1,r)||r.afterCursor&&(Er(e.state,i.head,1,r)||i.headG.decorations.from(t)}),GN=[KN,WN];function YN(t={}){return[fC.of(t),GN]}const JN=new me;function Lp(t,e,n){let r=t.prop(e<0?me.openedBy:me.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function Fp(t){let e=t.type.prop(JN);return e?e(t.node):t}function Er(t,e,n,r={}){let i=r.maxScanDistance||uC,s=r.brackets||cC,o=_t(t),l=o.resolveInner(e,n);for(let a=l;a;a=a.parent){let u=Lp(a.type,n,s);if(u&&a.from0?e>=c.from&&ec.from&&e<=c.to))return ZN(t,e,n,a,c,u,s)}}return QN(t,e,n,o,l.type,i,s)}function ZN(t,e,n,r,i,s,o){let l=r.parent,a={from:i.from,to:i.to},u=0,c=l==null?void 0:l.cursor();if(c&&(n<0?c.childBefore(r.from):c.childAfter(r.to)))do if(n<0?c.to<=r.from:c.from>=r.to){if(u==0&&s.indexOf(c.type.name)>-1&&c.from0)return null;let u={from:n<0?e-1:e,to:n>0?e+1:e},c=t.doc.iterRange(e,n>0?t.doc.length:0),f=0;for(let h=0;!c.next().done&&h<=s;){let d=c.value;n<0&&(h+=d.length);let p=e+h*n;for(let y=n>0?0:d.length-1,w=n>0?d.length:-1;y!=w;y+=n){let m=o.indexOf(d[y]);if(!(m<0||r.resolveInner(p+y,1).type!=i))if(m%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:p+y,to:p+y+1},matched:m>>1==a>>1};f--}}n>0&&(h+=d.length)}return c.done?{start:u,matched:!1}:null}const XN=Object.create(null),bw=[an.none],xw=[],Cw=Object.create(null),eD=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"]])eD[t]=tD(XN,e);function Fd(t,e){xw.indexOf(t)>-1||(xw.push(t),console.warn(e))}function tD(t,e){let n=[];for(let l of e.split(" ")){let a=[];for(let u of l.split(".")){let c=t[u]||z[u];c?typeof c=="function"?a.length?a=a.map(c):Fd(u,`Modifier ${u} used at start of tag`):a.length?Fd(u,`Tag ${u} used as modifier`):a=Array.isArray(c)?c:[c]:Fd(u,`Unknown highlighting tag ${u}`)}for(let u of a)n.push(u)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),s=Cw[i];if(s)return s.id;let o=Cw[i]=an.define({id:bw.length,name:r,props:[$x({[r]:n})]});return bw.push(o),o.id}Be.RTL,Be.LTR;const nD=Af.define({name:"json",parser:pM.configure({props:[Q2.add({Object:Sw({except:/^\s*\}/}),Array:Sw({except:/^\s*\]/})}),eC.add({"Object Array":EN})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function rD(){return new mN(nD)}function zp(){return zp=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}const sD=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=$0(t.state,n.from);return r.line?oD(t):r.block?aD(t):!1};function C0(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const oD=C0(fD,0),lD=C0(hC,0),aD=C0((t,e)=>hC(t,e,cD(e)),0);function $0(t,e){let n=t.languageDataAt("commentTokens",e);return n.length?n[0]:{}}const Rl=50;function uD(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-Rl,r),o=t.sliceDoc(i,i+Rl),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,u=s.length-l;if(s.slice(u-e.length,u)==e&&o.slice(a,a+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let c,f;i-r<=2*Rl?c=f=t.sliceDoc(r,i):(c=t.sliceDoc(r,r+Rl),f=t.sliceDoc(i-Rl,i));let h=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-n.length;return c.slice(h,h+e.length)==e&&f.slice(p,p+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(c.charAt(h+e.length))?1:0},close:{pos:i-d-n.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function cD(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to),s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function hC(t,e,n=e.selection.ranges){let r=n.map(s=>$0(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>uD(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,l;oi&&(s==o||o>f.from)){i=f.from;let h=/^\s*/.exec(f.text)[0].length,d=h==f.length,p=f.text.slice(h,h+u.length)==u?h:-1;hs.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:u,empty:c,single:f}of r)(f||!c)&&s.push({from:l.from+u,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let u=o.from+l,c=u+a.length;o.text[c-o.from]==" "&&c++,s.push({from:u,to:c})}return{changes:s}}return null}const jp=Pr.define(),hD=Pr.define(),dD=X.define(),dC=X.define({combine(t){return Nr(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),mC=Mt.define({create(){return Or.empty},update(t,e){let n=e.state.facet(dC),r=e.annotation(jp);if(r){let a=rn.fromTransaction(e,r.selection),u=r.side,c=u==0?t.undone:t.done;return a?c=If(c,c.length,n.minDepth,a):c=yC(c,e.startState.selection),new Or(u==0?r.rest:c,u==0?c:r.rest)}let i=e.annotation(hD);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(mt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=rn.fromTransaction(e),o=e.annotation(mt.time),l=e.annotation(mt.userEvent);return s?t=t.addChanges(s,o,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,l,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Or(t.done.map(rn.fromJSON),t.undone.map(rn.fromJSON))}});function mD(t={}){return[mC,dC.of(t),G.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?pC:e.inputType=="historyRedo"?Bp:null;return r?(e.preventDefault(),r(n)):!1}})]}function $h(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(mC,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const pC=$h(0,!1),Bp=$h(1,!1),pD=$h(0,!0),gD=$h(1,!0);class rn{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new rn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new rn(e.changes&&ht.fromJSON(e.changes),[],e.mapped&&Ar.fromJSON(e.mapped),e.startSelection&&j.fromJSON(e.startSelection),e.selectionsAfter.map(j.fromJSON))}static fromTransaction(e,n){let r=Dn;for(let i of e.startState.facet(dD)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new rn(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Dn)}static selection(e){return new rn(void 0,Dn,void 0,void 0,e)}}function If(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function yD(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,l)=>{for(let a=0;a=u&&o<=c&&(r=!0)}}),r}function vD(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function gC(t,e){return t.length?e.length?t.concat(e):t:e}const Dn=[],wD=200;function yC(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-wD));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),If(t,t.length-1,1e9,n.setSelAfter(r)))}else return[rn.selection([e])]}function SD(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function zd(t,e){if(!t.length)return t;let n=t.length,r=Dn;for(;n;){let i=kD(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[rn.selection(r)]:Dn}function kD(t,e,n){let r=gC(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):Dn,n);if(!t.changes)return rn.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new rn(i,he.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const bD=/^(input\.type|delete)($|\.)/;class Or{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new Or(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||bD.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Eh(n,e))}function zt(t){return t.textDirectionAt(t.state.selection.main.head)==Be.LTR}const wC=t=>vC(t,!zt(t)),SC=t=>vC(t,zt(t));function kC(t,e){return lr(t,n=>n.empty?t.moveByGroup(n,e):Eh(n,e))}const CD=t=>kC(t,!zt(t)),$D=t=>kC(t,zt(t));function ED(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Oh(t,e,n){let r=_t(t).resolveInner(e.head),i=n?me.closedBy:me.openedBy;for(let a=e.head;;){let u=n?r.childAfter(a):r.childBefore(a);if(!u)break;ED(t,u,i)?r=u:a=n?u.to:u.from}let s=r.type.prop(i),o,l;return s&&(o=n?Er(t,r.from,1):Er(t,r.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?r.to:r.from,j.cursor(l,n?-1:1)}const OD=t=>lr(t,e=>Oh(t.state,e,!zt(t))),TD=t=>lr(t,e=>Oh(t.state,e,zt(t)));function bC(t,e){return lr(t,n=>{if(!n.empty)return Eh(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const xC=t=>bC(t,!1),CC=t=>bC(t,!0);function $C(t){let e=t.scrollDOM.clientHeighto.empty?t.moveVertically(o,e,n.height):Eh(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>a&&o.bottomEC(t,!1),Vp=t=>EC(t,!0);function Gi(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=j.cursor(r.from+s))}return i}const _D=t=>lr(t,e=>Gi(t,e,!0)),MD=t=>lr(t,e=>Gi(t,e,!1)),AD=t=>lr(t,e=>Gi(t,e,!zt(t))),PD=t=>lr(t,e=>Gi(t,e,zt(t))),ND=t=>lr(t,e=>j.cursor(t.lineBlockAt(e.head).from,1)),DD=t=>lr(t,e=>j.cursor(t.lineBlockAt(e.head).to,-1));function RD(t,e,n){let r=!1,i=tl(t.selection,s=>{let o=Er(t,s.head,-1)||Er(t,s.head,1)||s.head>0&&Er(t,s.head-1,1)||s.headRD(t,e,!1);function Wn(t,e){let n=tl(t.state.selection,r=>{let i=e(r);return j.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Dr(t.state,n)),!0)}function OC(t,e){return Wn(t,n=>t.moveByChar(n,e))}const TC=t=>OC(t,!zt(t)),_C=t=>OC(t,zt(t));function MC(t,e){return Wn(t,n=>t.moveByGroup(n,e))}const LD=t=>MC(t,!zt(t)),FD=t=>MC(t,zt(t)),zD=t=>Wn(t,e=>Oh(t.state,e,!zt(t))),jD=t=>Wn(t,e=>Oh(t.state,e,zt(t)));function AC(t,e){return Wn(t,n=>t.moveVertically(n,e))}const PC=t=>AC(t,!1),NC=t=>AC(t,!0);function DC(t,e){return Wn(t,n=>t.moveVertically(n,e,$C(t).height))}const Ew=t=>DC(t,!1),Ow=t=>DC(t,!0),BD=t=>Wn(t,e=>Gi(t,e,!0)),VD=t=>Wn(t,e=>Gi(t,e,!1)),WD=t=>Wn(t,e=>Gi(t,e,!zt(t))),HD=t=>Wn(t,e=>Gi(t,e,zt(t))),UD=t=>Wn(t,e=>j.cursor(t.lineBlockAt(e.head).from)),qD=t=>Wn(t,e=>j.cursor(t.lineBlockAt(e.head).to)),Tw=({state:t,dispatch:e})=>(e(Dr(t,{anchor:0})),!0),_w=({state:t,dispatch:e})=>(e(Dr(t,{anchor:t.doc.length})),!0),Mw=({state:t,dispatch:e})=>(e(Dr(t,{anchor:t.selection.main.anchor,head:0})),!0),Aw=({state:t,dispatch:e})=>(e(Dr(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),KD=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),GD=({state:t,dispatch:e})=>{let n=Th(t).map(({from:r,to:i})=>j.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:j.create(n),userEvent:"select"})),!0},YD=({state:t,dispatch:e})=>{let n=tl(t.selection,r=>{var i;let s=_t(t).resolveStack(r.from,1);for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&(!((i=l.parent)===null||i===void 0)&&i.parent))return j.range(l.to,l.from)}return r});return e(Dr(t,n)),!0},JD=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=j.create([n.main]):n.main.empty||(r=j.create([j.cursor(n.main.head)])),r?(e(Dr(t,r)),!0):!1};function lu(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);ao&&(n="delete.forward",a=nc(t,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=nc(t,o,!1),l=nc(t,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:j.cursor(o,oi(t)))r.between(e,e,(i,s)=>{ie&&(e=n?s:i)});return e}const RC=(t,e)=>lu(t,n=>{let r=n.from,{state:i}=t,s=i.doc.lineAt(r),o,l;if(!e&&r>s.from&&rRC(t,!1),IC=t=>RC(t,!0),LC=(t,e)=>lu(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let l=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=Et(s.text,r-s.from,e)+s.from,u=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),c=o(u);if(l!=null&&c!=l)break;(u!=" "||r!=n.head)&&(l=c),r=a}return r}),FC=t=>LC(t,!1),ZD=t=>LC(t,!0),QD=t=>lu(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headlu(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),eR=t=>lu(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Te.of(["",""])},range:j.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},nR=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:Et(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:Et(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:t.doc.slice(i,l).append(t.doc.slice(o,i))},range:j.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Th(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function zC(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of Th(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),l=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let a of s.ranges)i.push(j.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let a of s.ranges)i.push(j.range(a.anchor-l,a.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:j.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rR=({state:t,dispatch:e})=>zC(t,e,!1),iR=({state:t,dispatch:e})=>zC(t,e,!0);function jC(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of Th(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const sR=({state:t,dispatch:e})=>jC(t,e,!1),oR=({state:t,dispatch:e})=>jC(t,e,!0),lR=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Th(e).map(({from:i,to:s})=>(i>0?i--:st.moveVertically(i,!0)).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function aR(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=_t(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(me.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const uR=BC(!1),cR=BC(!0);function BC(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,l=e.doc.lineAt(s),a=!t&&s==o&&aR(e,s);t&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let u=new xh(e,{simulateBreak:s,simulateDoubleBreak:!!a}),c=k0(u,s);for(c==null&&(c=el(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));ol.from&&s{let i=[];for(let o=r.from;o<=r.to;){let l=t.doc.lineAt(o);l.number>n&&(r.empty||r.to>l.from)&&(e(l,i,r),n=l.number),o=l.to+1}let s=t.changes(i);return{changes:i,range:j.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const fR=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new xh(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=E0(t,(s,o,l)=>{let a=k0(r,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let u=/^\s*/.exec(s.text)[0],c=Ua(t,a);(u!=c||l.fromt.readOnly?!1:(e(t.update(E0(t,(n,r)=>{r.push({from:n.from,insert:t.facet(bh)})}),{userEvent:"input.indent"})),!0),WC=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(E0(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=el(i,t.tabSize),o=0,l=Ua(t,Math.max(0,s-Nf(t)));for(;o({mac:t.key,run:t.run,shift:t.shift}))),mR=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:OD,shift:zD},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:TD,shift:jD},{key:"Alt-ArrowUp",run:rR},{key:"Shift-Alt-ArrowUp",run:sR},{key:"Alt-ArrowDown",run:iR},{key:"Shift-Alt-ArrowDown",run:oR},{key:"Escape",run:JD},{key:"Mod-Enter",run:cR},{key:"Alt-l",mac:"Ctrl-l",run:GD},{key:"Mod-i",run:YD,preventDefault:!0},{key:"Mod-[",run:WC},{key:"Mod-]",run:VC},{key:"Mod-Alt-\\",run:fR},{key:"Shift-Mod-k",run:lR},{key:"Shift-Mod-\\",run:ID},{key:"Mod-/",run:sD},{key:"Alt-A",run:lD}].concat(dR),pR={key:"Tab",run:VC,shift:WC};function Ne(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;et.normalize("NFKD"):t=>t;class qo{constructor(e,n,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?l=>s(Pw(l)):Pw,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return bt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=u0(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=An(e);let i=this.normalize(n);for(let s=0,o=r;;s++){let l=i.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(a)return this.value=a,this;break}o==r&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=Lf(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||i.to<=n){let l=new Mo(n,e.sliceString(n,r));return jd.set(e,l),l}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this.matchPos=Lf(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Mo.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(qC.prototype[Symbol.iterator]=KC.prototype[Symbol.iterator]=function(){return this});function gR(t){try{return new RegExp(t,O0),!0}catch{return!1}}function Lf(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function Hp(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Ne("input",{class:"cm-textfield",name:"line",value:e}),r=Ne("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),t.dispatch({effects:Ff.of(!1)}),t.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},Ne("label",t.state.phrase("Go to line"),": ",n)," ",Ne("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!s)return;let{state:o}=t,l=o.doc.lineAt(o.selection.main.head),[,a,u,c,f]=s,h=c?+c.slice(1):0,d=u?+u:l.number;if(u&&f){let w=d/100;a&&(w=w*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*w)}else u&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),y=j.cursor(p.from+Math.max(0,Math.min(h,p.length)));t.dispatch({effects:[Ff.of(!1),G.scrollIntoView(y.from,{y:"center"})],selection:y}),t.focus()}return{dom:r}}const Ff=he.define(),Nw=Mt.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(Ff)&&(t=n.value);return t},provide:t=>Ha.from(t,e=>e?Hp:null)}),yR=t=>{let e=Wa(t,Hp);if(!e){let n=[Ff.of(!0)];t.state.field(Nw,!1)==null&&n.push(he.appendConfig.of([Nw,vR])),t.dispatch({effects:n}),e=Wa(t,Hp)}return e&&e.dom.querySelector("input").select(),!0},vR=G.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),wR={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},GC=X.define({combine(t){return Nr(t,wR,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function SR(t){let e=[$R,CR];return t&&e.push(GC.of(t)),e}const kR=oe.mark({class:"cm-selectionMatch"}),bR=oe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Dw(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Ue.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Ue.Word)}function xR(t,e,n,r){return t(e.sliceDoc(n,n+1))==Ue.Word&&t(e.sliceDoc(r-1,r))==Ue.Word}const CR=Xe.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(GC),{state:n}=t,r=n.selection;if(r.ranges.length>1)return oe.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return oe.none;let a=n.wordAt(i.head);if(!a)return oe.none;o=n.charCategorizer(i.head),s=n.sliceDoc(a.from,a.to)}else{let a=i.to-i.from;if(a200)return oe.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Dw(o,n,i.from,i.to)&&xR(o,n,i.from,i.to)))return oe.none}else if(s=n.sliceDoc(i.from,i.to),!s)return oe.none}let l=[];for(let a of t.visibleRanges){let u=new qo(n.doc,s,a.from,a.to);for(;!u.next().done;){let{from:c,to:f}=u.value;if((!o||Dw(o,n,c,f))&&(i.empty&&c<=i.from&&f>=i.to?l.push(bR.range(c,f)):(c>=i.to||f<=i.from)&&l.push(kR.range(c,f)),l.length>e.maxMatches))return oe.none}}return oe.set(l)}},{decorations:t=>t.decorations}),$R=G.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ER=({state:t,dispatch:e})=>{let{selection:n}=t,r=j.create(n.ranges.map(i=>t.wordAt(i.head)||j.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function OR(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,l=new qo(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new qo(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=t.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const TR=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return ER({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=OR(t,r);return i?(e(t.update({selection:t.selection.addRange(j.range(i.from,i.to),!1),effects:G.scrollIntoView(i.to)})),!0):!1},nl=X.define({combine(t){return Nr(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new jR(e),scrollToMatch:e=>G.scrollIntoView(e)})}});class YC{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||gR(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` +`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new PR(this):new MR(this)}getCursor(e,n=0,r){let i=e.doc?e:ke.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?Zs(this,i,n,r):Js(this,i,n,r)}}class JC{constructor(e){this.spec=e}}function Js(t,e,n,r){return new qo(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?_R(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function _R(t,e){return(n,r,i,s)=>((s>n||s+i.length=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=Js(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function Zs(t,e,n,r){return new qC(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?AR(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function zf(t,e){return t.slice(Et(t,e,!1),e)}function jf(t,e){return t.slice(e,Et(t,e))}function AR(t){return(e,n,r)=>!r[0].length||(t(zf(r.input,r.index))!=Ue.Word||t(jf(r.input,r.index))!=Ue.Word)&&(t(jf(r.input,r.index+r[0].length))!=Ue.Word||t(zf(r.input,r.index+r[0].length))!=Ue.Word)}class PR extends JC{nextMatch(e,n,r){let i=Zs(this.spec,e,r,e.doc.length).next();return i.done&&(i=Zs(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),o=Zs(this.spec,e,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==n||l.from>s+10))return l;if(s==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(n,r)=>r=="$"?"$":r=="&"?e.match[0]:r!="0"&&+r=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=Zs(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const qa=he.define(),T0=he.define(),Di=Mt.define({create(t){return new Bd(Up(t).create(),null)},update(t,e){for(let n of e.effects)n.is(qa)?t=new Bd(n.value.create(),t.panel):n.is(T0)&&(t=new Bd(t.query,n.value?_0:null));return t},provide:t=>Ha.from(t,e=>e.panel)});class Bd{constructor(e,n){this.query=e,this.panel=n}}const NR=oe.mark({class:"cm-searchMatch"}),DR=oe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),RR=Xe.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Di))}update(t){let e=t.state.field(Di);(e!=t.startState.field(Di)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return oe.none;let{view:n}=this,r=new ji;for(let i=0,s=n.visibleRanges,o=s.length;is[i+1].from-2*250;)a=s[++i].to;t.highlight(n.state,l,a,(u,c)=>{let f=n.state.selection.ranges.some(h=>h.from==u&&h.to==c);r.add(u,c,f?DR:NR)})}return r.finish()}},{decorations:t=>t.decorations});function au(t){return e=>{let n=e.state.field(Di,!1);return n&&n.query.spec.valid?t(e,n):XC(e)}}const Bf=au((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=j.single(r.from,r.to),s=t.state.facet(nl);return t.dispatch({selection:i,effects:[M0(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),QC(t),!0}),Vf=au((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=j.single(i.from,i.to),o=t.state.facet(nl);return t.dispatch({selection:s,effects:[M0(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),QC(t),!0}),IR=au((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:j.create(n.map(r=>j.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),LR=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],o=0;for(let l=new qo(t.doc,t.sliceDoc(r,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(j.range(l.value.from,l.value.to))}return e(t.update({selection:j.create(s,o),userEvent:"select.search.matches"})),!0},Rw=au((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,r,r);if(!s)return!1;let o=[],l,a,u=[];if(s.from==r&&s.to==i&&(a=n.toText(e.getReplacement(s)),o.push({from:s.from,to:s.to,insert:a}),s=e.nextMatch(n,s.from,s.to),u.push(G.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),s){let c=o.length==0||o[0].from>=s.to?0:s.to-s.from-a.length;l=j.single(s.from-c,s.to-c),u.push(M0(t,s)),u.push(n.facet(nl).scrollToMatch(l.main,t))}return t.dispatch({changes:o,selection:l,effects:u,userEvent:"input.replace"}),!0}),FR=au((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:G.announce.of(r),userEvent:"input.replace.all"}),!0});function _0(t){return t.state.facet(nl).createPanel(t)}function Up(t,e){var n,r,i,s,o;let l=t.selection.main,a=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!a)return e;let u=t.facet(nl);return new YC({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:u.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:u.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:u.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function ZC(t){let e=Wa(t,_0);return e&&e.dom.querySelector("[main-field]")}function QC(t){let e=ZC(t);e&&e==t.root.activeElement&&e.select()}const XC=t=>{let e=t.state.field(Di,!1);if(e&&e.panel){let n=ZC(t);if(n&&n!=t.root.activeElement){let r=Up(t.state,e.query.spec);r.valid&&t.dispatch({effects:qa.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[T0.of(!0),e?qa.of(Up(t.state,e.query.spec)):he.appendConfig.of(VR)]});return!0},e$=t=>{let e=t.state.field(Di,!1);if(!e||!e.panel)return!1;let n=Wa(t,_0);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:T0.of(!1)}),!0},zR=[{key:"Mod-f",run:XC,scope:"editor search-panel"},{key:"F3",run:Bf,shift:Vf,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Bf,shift:Vf,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:e$,scope:"editor search-panel"},{key:"Mod-Shift-l",run:LR},{key:"Mod-Alt-g",run:yR},{key:"Mod-d",run:TR,preventDefault:!0}];class jR{constructor(e){this.view=e;let n=this.query=e.state.field(Di).query.spec;this.commit=this.commit.bind(this),this.searchField=Ne("input",{value:n.search,placeholder:fn(e,"Find"),"aria-label":fn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ne("input",{value:n.replace,placeholder:fn(e,"Replace"),"aria-label":fn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ne("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Ne("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Ne("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return Ne("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=Ne("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>Bf(e),[fn(e,"next")]),r("prev",()=>Vf(e),[fn(e,"previous")]),r("select",()=>IR(e),[fn(e,"all")]),Ne("label",null,[this.caseField,fn(e,"match case")]),Ne("label",null,[this.reField,fn(e,"regexp")]),Ne("label",null,[this.wordField,fn(e,"by word")]),...e.state.readOnly?[]:[Ne("br"),this.replaceField,r("replace",()=>Rw(e),[fn(e,"replace")]),r("replaceAll",()=>FR(e),[fn(e,"replace all")])],Ne("button",{name:"close",onclick:()=>e$(e),"aria-label":fn(e,"close"),type:"button"},["×"])])}commit(){let e=new YC({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:qa.of(e)}))}keydown(e){uP(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Vf:Bf)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Rw(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(qa)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(nl).top}}function fn(t,e){return t.state.phrase(e)}const rc=30,ic=/[\s\.,:;?!]/;function M0(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,s=Math.max(r.from,e-rc),o=Math.min(i,n+rc),l=t.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;al.length-rc;a--)if(!ic.test(l[a-1])&&ic.test(l[a])){l=l.slice(0,a);break}}return G.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${r.number}.`)}const BR=G.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"}}),VR=[Di,Xo.low(RR),BR];class t${constructor(e,n,r){this.state=e,this.pos=n,this.explicit=r,this.abortListeners=[]}tokenBefore(e){let n=_t(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(n$(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n){e=="abort"&&this.abortListeners&&this.abortListeners.push(n)}}function Iw(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function WR(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;stypeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:WR(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}class Lw{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function Ri(t){return t.selection.main.from}function n$(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const UR=Pr.define();function qR(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return Object.assign(Object.assign({},t.changeByRange(l=>l!=i&&n!=r&&t.sliceDoc(l.from+s,l.from+o)!=t.sliceDoc(n,r)?{range:l}:{changes:{from:l.from+s,to:r==i.from?l.to:l.from+o,insert:e},range:j.cursor(l.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const Fw=new WeakMap;function KR(t){if(!Array.isArray(t))return t;let e=Fw.get(t);return e||Fw.set(t,e=HR(t)),e}const Wf=he.define(),Ka=he.define();class GR{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&$<=57||$>=97&&$<=122?2:$>=65&&$<=90?1:0:(b=u0($))!=b.toLowerCase()?1:b!=b.toUpperCase()?2:0;(!g||x==1&&w||S==0&&x!=0)&&(n[f]==$||r[f]==$&&(h=!0)?o[f++]=g:o.length&&(m=!1)),S=x,g+=An($)}return f==a&&o[0]==0&&m?this.result(-100+(h?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,y]):f==a?this.result(-100+(h?-200:0)+-700+(m?0:-1100),o,e):n.length==2?!1:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let o of n){let l=o+(this.astral?An(bt(r,o)):1);s&&i[s-1]==o?i[s-1]=l:(i[s++]=o,i[s++]=l)}return this.ret(e-r.length,i)}}const $t=X.define({combine(t){return Nr(t,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:YR,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>zw(e(r),n(r)),optionClass:(e,n)=>r=>zw(e(r),n(r)),addToOptions:(e,n)=>e.concat(n)})}});function zw(t,e){return t?e?t+" "+e:t:e}function YR(t,e,n,r,i,s){let o=t.textDirection==Be.RTL,l=o,a=!1,u="top",c,f,h=e.left-i.left,d=i.right-e.right,p=r.right-r.left,y=r.bottom-r.top;if(l&&h=y||g>e.top?c=n.bottom-e.top:(u="bottom",c=e.bottom-n.top)}let w=(e.bottom-e.top)/s.offsetHeight,m=(e.right-e.left)/s.offsetWidth;return{style:`${u}: ${c/w}px; max-width: ${f/m}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function JR(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=n.displayLabel||n.label,a=0;for(let u=0;ua&&o.appendChild(document.createTextNode(l.slice(a,c)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(l.slice(c,f))),h.className="cm-completionMatchedText",a=f}return an.position-r.position).map(n=>n.render)}function Vd(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class ZR{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:s,selected:o}=i.open,l=e.state.facet($t);this.optionContent=JR(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Vd(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:u}=e.state.field(n).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet($t).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Ka.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:l}=r.open;(!i.open||i.open.options!=s)&&(this.range=Vd(s.length,o,e.state.facet($t).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;if((n.selected>-1&&n.selected=this.range.to)&&(this.range=Vd(n.options.length,n.selected,this.view.state.facet($t).maxRenderedOptions),this.showOptions(n.options,e.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(r);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,r)}).catch(o=>wn(this.view.state,o,"completion info")):this.addInfoPane(s,r)}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return n&&XR(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottomr.from||r.from==0))if(s=h,typeof u!="string"&&u.header)i.appendChild(u.header(u));else{let d=i.appendChild(document.createElement("completion-section"));d.textContent=h}}const c=i.appendChild(document.createElement("li"));c.id=n+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let h of this.optionContent){let d=h(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.tonew ZR(n,t,e)}function XR(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function jw(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function eI(t,e){let n=[],r=null,i=a=>{n.push(a);let{section:u}=a.completion;if(u){r||(r=[]);let c=typeof u=="string"?u:u.name;r.some(f=>f.name==c)||r.push(typeof u=="string"?{name:c}:u)}};for(let a of t)if(a.hasResult()){let u=a.result.getMatch;if(a.result.filter===!1)for(let c of a.result.options)i(new Lw(c,a.source,u?u(c):[],1e9-n.length));else{let c=new GR(e.sliceDoc(a.from,a.to));for(let f of a.result.options)if(c.match(f.label)){let h=f.displayLabel?u?u(f,c.matched):[]:c.matched;i(new Lw(f,a.source,h,c.score+(f.boost||0)))}}}if(r){let a=Object.create(null),u=0,c=(f,h)=>{var d,p;return((d=f.rank)!==null&&d!==void 0?d:1e9)-((p=h.rank)!==null&&p!==void 0?p:1e9)||(f.namec.score-u.score||l(u.completion,c.completion))){let u=a.completion;!o||o.label!=u.label||o.detail!=u.detail||o.type!=null&&u.type!=null&&o.type!=u.type||o.apply!=u.apply||o.boost!=u.boost?s.push(a):jw(a.completion)>jw(o)&&(s[s.length-1]=a),o=a.completion}return s}class mo{constructor(e,n,r,i,s,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new mo(this.options,Bw(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s){let o=eI(e,n);if(!o.length)return i&&e.some(a=>a.state==1)?new mo(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let l=n.facet($t).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let a=i.options[i.selected].completion;for(let u=0;uu.hasResult()?Math.min(a,u.from):a,1e8),create:sI,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new mo(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class Hf{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Hf(rI,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet($t),s=(r.override||n.languageDataAt("autocomplete",Ri(n)).map(KR)).map(l=>(this.active.find(u=>u.source==l)||new en(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((l,a)=>l==this.active[a])&&(s=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!tI(s,this.active)?o=mo.build(s,n,this.id,o,r):o&&o.disabled&&!s.some(l=>l.state==1)&&(o=null),!o&&s.every(l=>l.state!=1)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new en(l.source,0):l));for(let l of e.effects)l.is(i$)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new Hf(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:nI}}function tI(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const rI=[];function qp(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class en{constructor(e,n,r=-1){this.source=e,this.state=n,this.explicitPos=r}hasResult(){return!1}update(e,n){let r=qp(e),i=this;r?i=i.handleUserEvent(e,r,n):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new en(i.source,0));for(let s of e.effects)if(s.is(Wf))i=new en(i.source,1,s.value?Ri(e.state):-1);else if(s.is(Ka))i=new en(i.source,0);else if(s.is(r$))for(let o of s.value)o.source==i.source&&(i=o);return i}handleUserEvent(e,n,r){return n=="delete"||!r.activateOnTyping?this.map(e.changes):new en(this.source,1)}handleChange(e){return e.changes.touchesRange(Ri(e.startState))?new en(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new en(this.source,this.state,e.mapPos(this.explicitPos))}}class Ao extends en{constructor(e,n,r,i,s){super(e,2,n),this.result=r,this.from=i,this.to=s}hasResult(){return!0}handleUserEvent(e,n,r){var i;let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Ri(e.state);if((this.explicitPos<0?l<=s:lo||n=="delete"&&Ri(e.startState)==this.from)return new en(this.source,n=="input"&&r.activateOnTyping?1:0);let a=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),u;return iI(this.result.validFor,e.state,s,o)?new Ao(this.source,a,this.result,s,o):this.result.update&&(u=this.result.update(this.result,s,o,new t$(e.state,l,a>=0)))?new Ao(this.source,a,u,u.from,(i=u.to)!==null&&i!==void 0?i:Ri(e.state)):new en(this.source,1,a)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new en(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new Ao(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function iI(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):n$(t,!0).test(i)}const r$=he.define({map(t,e){return t.map(n=>n.map(e))}}),i$=he.define(),mn=Mt.define({create(){return Hf.start()},update(t,e){return t.update(e)},provide:t=>[S0.from(t,e=>e.tooltip),G.contentAttributes.from(t,e=>e.attrs)]});function s$(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(mn).active.find(i=>i.source==e.source);return r instanceof Ao?(typeof n=="string"?t.dispatch(Object.assign(Object.assign({},qR(t.state,n,r.from,r.to)),{annotations:UR.of(e.completion)})):n(t,e.completion,r.from,r.to),!0):!1}const sI=QR(mn,s$);function sc(t,e="option"){return n=>{let r=n.state.field(mn,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+i*(t?1:-1):t?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),n.dispatch({effects:i$.of(l)}),!0}}const oI=t=>{let e=t.state.field(mn,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(mn,!1)?(t.dispatch({effects:Wf.of(!0)}),!0):!1,aI=t=>{let e=t.state.field(mn,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Ka.of(null)}),!0)};class uI{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const cI=50,fI=1e3,hI=Xe.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(mn).active)e.state==1&&this.startQuery(e)}update(t){let e=t.state.field(mn);if(!t.selectionSet&&!t.docChanged&&t.startState.field(mn)==e)return;let n=t.transactions.some(i=>(i.selection||i.docChanged)&&!qp(i));for(let i=0;icI&&Date.now()-s.time>fI){for(let o of s.context.abortListeners)try{o()}catch(l){wn(this.view.state,l)}s.context.abortListeners=null,this.running.splice(i--,1)}else s.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(s=>s.is(Wf)))&&(this.pendingStart=!0);let r=this.pendingStart?50:t.state.facet($t).activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.state==1&&!this.running.some(s=>s.active.source==i.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let i of t.transactions)qp(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(mn);for(let n of e.active)n.state==1&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n)}startQuery(t){let{state:e}=this.view,n=Ri(e),r=new t$(e,n,t.explicitPos==n),i=new uI(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Ka.of(null)}),wn(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet($t).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet($t);for(let r=0;ro.source==i.active.source);if(s&&s.state==1)if(i.done==null){let o=new en(i.active.source,0);for(let l of i.updates)o=o.update(l,n);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:r$.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(mn,!1);if(e&&e.tooltip&&this.view.state.facet($t).closeOnBlur){let n=e.open&&K2(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Ka.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Wf.of(!1)}),20),this.composing=0}}}),dI=G.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"},".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"}}}),Ga={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},gs=he.define({map(t,e){let n=e.mapPos(t,-1,Wt.TrackAfter);return n??void 0}}),A0=new class extends Ts{};A0.startSide=1;A0.endSide=-1;const o$=Mt.define({create(){return Ce.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(gs)&&(t=t.update({add:[A0.range(n.value,n.value+1)]}));return t}});function mI(){return[gI,o$]}const Wd="()[]{}<>";function l$(t){for(let e=0;e{if((pI?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&An(bt(r,0))==1||e!=i.from||n!=i.to)return!1;let s=wI(t.state,r);return s?(t.dispatch(s),!0):!1}),yI=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=a$(t,t.selection.main.head).brackets||Ga.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let l=SI(t.doc,o.head);for(let a of r)if(a==l&&_h(t.doc,o.head)==l$(bt(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:j.cursor(o.head-a.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},vI=[{key:"Backspace",run:yI}];function wI(t,e){let n=a$(t,t.selection.main.head),r=n.brackets||Ga.brackets;for(let i of r){let s=l$(bt(i,0));if(e==i)return s==i?xI(t,i,r.indexOf(i+i+i)>-1,n):kI(t,i,s,n.before||Ga.before);if(e==s&&u$(t,t.selection.main.from))return bI(t,i,s)}return null}function u$(t,e){let n=!1;return t.field(o$).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function _h(t,e){let n=t.sliceString(e,e+2);return n.slice(0,An(bt(n,0)))}function SI(t,e){let n=t.sliceString(e-2,e);return An(bt(n,0))==n.length?n:n.slice(1)}function kI(t,e,n,r){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:gs.of(o.to+e.length),range:j.range(o.anchor+e.length,o.head+e.length)};let l=_h(t.doc,o.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:o.head},effects:gs.of(o.head+e.length),range:j.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function bI(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&_h(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:j.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function xI(t,e,n,r){let i=r.stringPrefixes||Ga.stringPrefixes,s=null,o=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:gs.of(l.to+e.length),range:j.range(l.anchor+e.length,l.head+e.length)};let a=l.head,u=_h(t.doc,a),c;if(u==e){if(Vw(t,a))return{changes:{insert:e+e,from:a},effects:gs.of(a+e.length),range:j.cursor(a+e.length)};if(u$(t,a)){let h=n&&t.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+h.length,insert:h},range:j.cursor(a+h.length)}}}else{if(n&&t.sliceDoc(a-2*e.length,a)==e+e&&(c=Ww(t,a-2*e.length,i))>-1&&Vw(t,c))return{changes:{insert:e+e+e+e,from:a},effects:gs.of(a+e.length),range:j.cursor(a+e.length)};if(t.charCategorizer(a)(u)!=Ue.Word&&Ww(t,a,i)>-1&&!CI(t,a,e,i))return{changes:{insert:e+e,from:a},effects:gs.of(a+e.length),range:j.cursor(a+e.length)}}return{range:s=l}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Vw(t,e){let n=_t(t).resolveInner(e+1);return n.parent&&n.from==e}function CI(t,e,n,r){let i=_t(t).resolveInner(e,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),a=l.indexOf(n);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let c=i.firstChild;for(;c&&c.from==i.from&&c.to-c.from>n.length+a;){if(t.sliceDoc(c.to-n.length,c.to)==n)return!1;c=c.firstChild}return!0}let u=i.to==e&&i.parent;if(!u)break;i=u}return!1}function Ww(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Ue.Word)return e;for(let i of n){let s=e-i.length;if(t.sliceDoc(s,e)==i&&r(t.sliceDoc(s-1,s))!=Ue.Word)return s}return-1}function $I(t={}){return[mn,$t.of(t),hI,EI,dI]}const c$=[{key:"Ctrl-Space",run:lI},{key:"Escape",run:aI},{key:"ArrowDown",run:sc(!0)},{key:"ArrowUp",run:sc(!1)},{key:"PageDown",run:sc(!0,"page")},{key:"PageUp",run:sc(!1,"page")},{key:"Enter",run:oI}],EI=Xo.highest(Sh.computeN([$t],t=>t.facet($t).defaultKeymap?[c$]:[]));class OI{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class ls{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=e,s=r.facet(ys).markerFilter;s&&(i=s(i,r));let o=oe.set(i.map(l=>l.from==l.to||l.from==l.to-1&&r.doc.lineAt(l.from).to==l.from?oe.widget({widget:new LI(l),diagnostic:l}).range(l.from):oe.mark({attributes:{class:"cm-lintRange cm-lintRange-"+l.severity+(l.markClass?" "+l.markClass:"")},diagnostic:l,inclusive:!0}).range(l.from,l.to)),!0);return new ls(o,n,Ko(o))}}function Ko(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return r=new OI(i,s,o.diagnostic),!1}),r}function TI(t,e){let n=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(r=>r.is(P0))||t.changes.touchesRange(n.from,n.to))}function f$(t,e){return t.field(yn,!1)?e:e.concat(he.appendConfig.of(g$))}function _I(t,e){return{effects:f$(t,[P0.of(e)])}}const P0=he.define(),N0=he.define(),h$=he.define(),yn=Mt.define({create(){return new ls(oe.none,null,null)},update(t,e){if(e.docChanged){let n=t.diagnostics.map(e.changes),r=null;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=Ko(n,t.selected.diagnostic,i)||Ko(n,null,i)}t=new ls(n,t.panel,r)}for(let n of e.effects)n.is(P0)?t=ls.init(n.value,t.panel,e.state):n.is(N0)?t=new ls(t.diagnostics,n.value?Mh.open:null,t.selected):n.is(h$)&&(t=new ls(t.diagnostics,t.panel,n.value));return t},provide:t=>[Ha.from(t,e=>e.panel),G.decorations.from(t,e=>e.diagnostics)]}),MI=oe.mark({class:"cm-lintRange cm-lintRange-active",inclusive:!0});function AI(t,e,n){let{diagnostics:r}=t.state.field(yn),i=[],s=2e8,o=0;r.between(e-(n<0?1:0),e+(n>0?1:0),(a,u,{spec:c})=>{e>=a&&e<=u&&(a==u||(e>a||n>0)&&(ep$(t,n,!1)))}const NI=t=>{let e=t.state.field(yn,!1);(!e||!e.panel)&&t.dispatch({effects:f$(t.state,[N0.of(!0)])});let n=Wa(t,Mh.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Hw=t=>{let e=t.state.field(yn,!1);return!e||!e.panel?!1:(t.dispatch({effects:N0.of(!1)}),!0)},DI=t=>{let e=t.state.field(yn,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},RI=[{key:"Mod-Shift-m",run:NI,preventDefault:!0},{key:"F8",run:DI}],II=Xe.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(ys);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){let t=Date.now();if(tPromise.resolve(r(this.view)))).then(r=>{let i=r.reduce((s,o)=>s.concat(o));this.view.state.doc==e.doc&&this.view.dispatch(_I(this.view.state,i))},r=>{wn(this.view.state,r)})}}update(t){let e=t.state.facet(ys);(t.docChanged||e!=t.startState.facet(ys)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),ys=X.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},Nr(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n}))}});function d$(t,e={}){return[ys.of({source:t,config:e}),II,g$]}function m$(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;rs.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function p$(t,e,n){var r;let i=n?m$(e.actions):[];return Ne("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ne("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=h=>{if(h.preventDefault(),l)return;l=!0;let d=Ko(t.state.field(yn).diagnostics,e);d&&s.apply(t,d.from,d.to)},{name:u}=s,c=i[o]?u.indexOf(i[o]):-1,f=c<0?u:[u.slice(0,c),Ne("u",u.slice(c,c+1)),u.slice(c+1)];return Ne("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${u}${c<0?"":` (access key "${i[o]})"`}.`},f)}),e.source&&Ne("div",{class:"cm-diagnosticSource"},e.source))}class LI extends ti{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return Ne("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Uw{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=p$(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Mh{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)Hw(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=m$(s.actions);for(let l=0;l{for(let s=0;sHw(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(yn).selected;if(!e)return-1;for(let n=0;n{let u=-1,c;for(let f=r;fr&&(this.items.splice(r,u-r),i=!0)),n&&c.diagnostic==n.diagnostic?c.dom.hasAttribute("aria-selected")||(c.dom.setAttribute("aria-selected","true"),s=c):c.dom.hasAttribute("aria-selected")&&c.dom.removeAttribute("aria-selected"),r++});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;o.topl.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(yn),r=Ko(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:h$.of(r)})}static open(e){return new Mh(e)}}function FI(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function oc(t){return FI(``,'width="6" height="3"')}const zI=G.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:oc("#d11")},".cm-lintRange-warning":{backgroundImage:oc("orange")},".cm-lintRange-info":{backgroundImage:oc("#999")},".cm-lintRange-hint":{backgroundImage:oc("#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}}}),g$=[yn,G.decorations.compute([yn],t=>{let{selected:e,panel:n}=t.field(yn);return!e||!n||e.from==e.to?oe.none:oe.set([MI.range(e.from,e.to)])}),ZP(AI,{hideOn:TI}),zI];var qw=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(vI)),e.defaultKeymap!==!1&&(r=r.concat(mR)),e.searchKeymap!==!1&&(r=r.concat(zR)),e.historyKeymap!==!1&&(r=r.concat(xD)),e.foldKeymap!==!1&&(r=r.concat(DN)),e.completionKeymap!==!1&&(r=r.concat(c$)),e.lintKeymap!==!1&&(r=r.concat(RI));var i=[];return e.lineNumbers!==!1&&i.push(oN()),e.highlightActiveLineGutter!==!1&&i.push(uN()),e.highlightSpecialChars!==!1&&i.push(EP()),e.history!==!1&&i.push(mD()),e.foldGutter!==!1&&i.push(FN()),e.drawSelection!==!1&&i.push(pP()),e.dropCursor!==!1&&i.push(SP()),e.allowMultipleSelections!==!1&&i.push(ke.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(CN()),e.syntaxHighlighting!==!1&&i.push(aC(VN,{fallback:!0})),e.bracketMatching!==!1&&i.push(YN()),e.closeBrackets!==!1&&i.push(mI()),e.autocompletion!==!1&&i.push($I()),e.rectangularSelection!==!1&&i.push(jP()),n!==!1&&i.push(WP()),e.highlightActiveLine!==!1&&i.push(PP()),e.highlightSelectionMatches!==!1&&i.push(SR()),e.tabSize&&typeof e.tabSize=="number"&&i.push(bh.of(" ".repeat(e.tabSize))),i.concat([Sh.of(r.flat())]).filter(Boolean)};const jI="#e5c07b",Kw="#e06c75",BI="#56b6c2",VI="#ffffff",Bc="#abb2bf",Kp="#7d8799",WI="#61afef",HI="#98c379",Gw="#d19a66",UI="#c678dd",qI="#21252b",Yw="#2c313a",Jw="#282c34",Hd="#353a42",KI="#3E4451",Zw="#528bff",GI=G.theme({"&":{color:Bc,backgroundColor:Jw},".cm-content":{caretColor:Zw},".cm-cursor, .cm-dropCursor":{borderLeftColor:Zw},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:KI},".cm-panels":{backgroundColor:qI,color:Bc},".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:Jw,color:Kp,border:"none"},".cm-activeLineGutter":{backgroundColor:Yw},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Hd},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Hd,borderBottomColor:Hd},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Yw,color:Bc}}},{dark:!0}),YI=ou.define([{tag:z.keyword,color:UI},{tag:[z.name,z.deleted,z.character,z.propertyName,z.macroName],color:Kw},{tag:[z.function(z.variableName),z.labelName],color:WI},{tag:[z.color,z.constant(z.name),z.standard(z.name)],color:Gw},{tag:[z.definition(z.name),z.separator],color:Bc},{tag:[z.typeName,z.className,z.number,z.changed,z.annotation,z.modifier,z.self,z.namespace],color:jI},{tag:[z.operator,z.operatorKeyword,z.url,z.escape,z.regexp,z.link,z.special(z.string)],color:BI},{tag:[z.meta,z.comment],color:Kp},{tag:z.strong,fontWeight:"bold"},{tag:z.emphasis,fontStyle:"italic"},{tag:z.strikethrough,textDecoration:"line-through"},{tag:z.link,color:Kp,textDecoration:"underline"},{tag:z.heading,fontWeight:"bold",color:Kw},{tag:[z.atom,z.bool,z.special(z.variableName)],color:Gw},{tag:[z.processingInstruction,z.string,z.inserted],color:HI},{tag:z.invalid,color:VI}]),JI=[GI,aC(YI)];var ZI=G.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),QI=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:l=!0}=e,a=[];switch(n&&a.unshift(Sh.of([pR])),l&&(typeof l=="boolean"?a.unshift(qw()):a.unshift(qw(l))),o&&a.unshift(IP(o)),s){case"light":a.push(ZI);break;case"dark":a.push(JI);break;case"none":break;default:a.push(s);break}return r===!1&&a.push(G.editable.of(!1)),i&&a.push(ke.readOnly.of(!0)),[...a]},XI=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)}),Qw=Pr.define(),eL=[];function tL(t){var{value:e,selection:n,onChange:r,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:l=eL,autoFocus:a,theme:u="light",height:c=null,minHeight:f=null,maxHeight:h=null,width:d=null,minWidth:p=null,maxWidth:y=null,placeholder:w="",editable:m=!0,readOnly:g=!1,indentWithTab:v=!0,basicSetup:S=!0,root:$,initialState:b}=t,[x,_]=jt.useState(),[A,N]=jt.useState(),[V,B]=jt.useState(),te=G.theme({"&":{height:c,minHeight:f,maxHeight:h,width:d,minWidth:p,maxWidth:y},"& .cm-scroller":{height:"100% !important"}}),Q=G.updateListener.of(pe=>{if(pe.docChanged&&typeof r=="function"&&!pe.transactions.some(I=>I.annotation(Qw))){var H=pe.state.doc,Y=H.toString();r(Y,pe)}i&&i(XI(pe))}),fe=QI({theme:u,editable:m,readOnly:g,placeholder:w,indentWithTab:v,basicSetup:S}),Ee=[Q,te,...fe];return o&&typeof o=="function"&&Ee.push(G.updateListener.of(o)),Ee=Ee.concat(l),jt.useEffect(()=>{if(x&&!V){var pe={doc:e,selection:n,extensions:Ee},H=b?ke.fromJSON(b.json,pe,b.fields):ke.create(pe);if(B(H),!A){var Y=new G({state:H,parent:x,root:$});N(Y),s&&s(Y,H)}}return()=>{A&&(B(void 0),N(void 0))}},[x,V]),jt.useEffect(()=>_(t.container),[t.container]),jt.useEffect(()=>()=>{A&&(A.destroy(),N(void 0))},[A]),jt.useEffect(()=>{a&&A&&A.focus()},[a,A]),jt.useEffect(()=>{A&&A.dispatch({effects:he.reconfigure.of(Ee)})},[u,l,c,f,h,d,p,y,w,m,g,v,S,r,o]),jt.useEffect(()=>{if(e!==void 0){var pe=A?A.state.doc.toString():"";A&&e!==pe&&A.dispatch({changes:{from:0,to:pe.length,insert:e||""},annotations:[Qw.of(!0)]})}},[e,A]),{state:V,setState:B,view:A,setView:N,container:x,setContainer:_}}var nL=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],y$=jt.forwardRef((t,e)=>{var{className:n,value:r="",selection:i,extensions:s=[],onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:u,autoFocus:c,theme:f="light",height:h,minHeight:d,maxHeight:p,width:y,minWidth:w,maxWidth:m,basicSetup:g,placeholder:v,indentWithTab:S,editable:$,readOnly:b,root:x,initialState:_}=t,A=iD(t,nL),N=jt.useRef(null),{state:V,view:B,container:te}=tL({container:N.current,root:x,value:r,autoFocus:c,theme:f,height:h,minHeight:d,maxHeight:p,width:y,minWidth:w,maxWidth:m,basicSetup:g,placeholder:v,indentWithTab:S,editable:$,readOnly:b,selection:i,onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:u,extensions:s,initialState:_});if(jt.useImperativeHandle(e,()=>({editor:N.current,state:V,view:B}),[N,te,V,B]),typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var Q=typeof f=="string"?"cm-theme-"+f:"cm-theme";return pt.jsx("div",zp({ref:N,className:""+Q+(n?" "+n:"")},A))});y$.displayName="CodeMirror";var Gp=(t=>(t.FEATURE="Feature",t.FEATURECOLLECTION="FeatureCollection",t))(Gp||{}),it=(t=>(t.POINT="Point",t.MULTIPOINT="MultiPoint",t.LINESTRING="LineString",t.MULTILINESTRING="MultiLineString",t.POLYGON="Polygon",t.MULTIPOLYGON="MultiPolygon",t.POLYHEDRON="Polyhedron",t.MULTIPOLYHEDRON="MultiPolyhedron",t.PRISM="Prism",t.MULTIPRISM="MultiPrism",t.GEOMETRYCOLLECTION="GeometryCollection",t))(it||{});const Pn={STRING:"String",NUMBER:"Number",TRUE:"True",FALSE:"False",NULL:"Null",OBJECT:"Object",ARRAY:"Array",PROPERTY:"Property",PROPERTY_NAME:"PropertyName",JSON_TEXT:"JsonText"},rL=[Pn.STRING,Pn.NUMBER,Pn.TRUE,Pn.FALSE,Pn.NULL],iL=[Pn.OBJECT,Pn.ARRAY],sL=t=>t.replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1"),oL=(t,e,n=!0)=>{const r=e?t.sliceString(e.from,e.to):"";return n?sL(r):r},v$=t=>{const e=[];let n=t.firstChild;for(;n;)n&&e.push(n),n=n==null?void 0:n.nextSibling;return e},lL=t=>v$(t).filter(e=>w$(e)),aL=(t,e)=>lL(t).findIndex(n=>n.from===e.from&&n.to===e.to),uL=(t,e)=>v$(t).find(n=>n.name===e)??null,w$=t=>[...rL,...iL].includes(t.name),cL=(t,e)=>{const n=[];for(let r=e;r!=null&&r.parent;r=r.parent)if(r.parent.name===Pn.PROPERTY){const i=uL(r.parent,Pn.PROPERTY_NAME);i&&n.unshift(oL(t,i))}else if(r.parent.name===Pn.ARRAY&&w$(r)){const i=aL(r.parent,r);n.unshift(`${i}`)}return"/"+n.join("/")},S$=t=>{const e=_t(t),n=new Map;return e.cursor().iterate(r=>{var l,a;const i=r.node,s=(l=i.nextSibling)==null?void 0:l.node,o=cL(t.doc,i);return s&&Pn.PROPERTY_NAME===r.name&&n.set(o,{keyFrom:i.from,keyTo:i.to,valueFrom:s.from,valueTo:s.to}),(i.parent===null||Pn.ARRAY===((a=i.parent)==null?void 0:a.name)&&!["[","]"].includes(i.name))&&n.set(o,{valueFrom:i.from,valueTo:i.to}),!0}),n},fL="http://www.opengis.net/spec/json-fg-1/0.2/conf/3d",hL="[ogc-json-fg-1-0.2:3d]",dL=[it.POLYHEDRON,it.MULTIPOLYHEDRON,it.PRISM,it.MULTIPRISM],Xw=t=>t.conformsTo!==void 0&&(t.conformsTo.includes(fL)||t.conformsTo.includes(hL)),eS=t=>t.place!==null&&dL.includes(t.place.type),k$=[];k$.push({name:"/req/3d/metadata",validateFeature:(t,e)=>{if(e&&eS(t)&&!Xw(t))return{pointer:"/conformsTo",message:'When having 3D geometries, the "conformsTo" member of the JSON document SHALL include at least the 3D conformance class.'}},validateFeatureCollection:t=>{if(t.features.some(e=>eS(e))&&!Xw(t))return{pointer:"/conformsTo",message:'When having 3D geometries, the "conformsTo" member of the JSON document SHALL include at least the 3D conformance class.'}}});const mL=[it.POINT,it.MULTIPOINT,it.LINESTRING,it.MULTILINESTRING,it.POLYGON,it.MULTIPOLYGON,it.GEOMETRYCOLLECTION],tS=["http://www.opengis.net/def/crs/OGC/0/CRS84","http://www.opengis.net/def/crs/OGC/0/CRS84h","[OGC:CRS84]","[OGC:CRS84h]"],ss=t=>typeof t[0]=="number"?[t.length]:t.flatMap(e=>ss(e)),Yl=(t,e)=>typeof t[0]=="number"?[t[e]]:t.flatMap(n=>Yl(n,e)),nS=t=>mL.includes(t.type),rS=t=>{if(typeof t=="string")return tS.includes(t);if(!Array.isArray(t)&&t.type==="Reference"){const e=t;return e.epoch===void 0&&tS.includes(e.href)}else return!1},uu=[];uu.push({name:"/req/core/coordinate-dimension",validateFeature:t=>{if(t.geometry!==null){const e=t.geometry,n=e.type===it.GEOMETRYCOLLECTION?e.geometries.flatMap(r=>ss(r.coordinates)):ss(e.coordinates);if(n.some(r=>r!==n[0]))return{pointer:"/geometry",message:"All positions in a geometry object SHALL have the same dimension."}}if(t.place!==null){const e=t.place;let n=[];if(e.type===it.PRISM?n=ss(e.base.coordinates):e.type===it.MULTIPRISM?n=e.prisms.flatMap(r=>ss(r.base.coordinates)):e.type===it.GEOMETRYCOLLECTION?n=e.geometries.flatMap(r=>ss(r.coordinates)):n=ss(e.coordinates),n.some(r=>r!==n[0]))return{pointer:"/place",message:"All positions in a geometry object SHALL have the same dimension."}}}});uu.push({name:"/req/core/geometry-wgs84",validateFeature:t=>{if(t.geometry!==null){const e=t.geometry;if((e.type===it.GEOMETRYCOLLECTION?e.geometries.flatMap(i=>Yl(i.coordinates,0)):Yl(e.coordinates,0)).some(i=>i<-180||i>180))return{pointer:"/geometry",message:"The first element of each position SHALL be between -180 and +180 decimal degrees longitude."};if((e.type===it.GEOMETRYCOLLECTION?e.geometries.flatMap(i=>Yl(i.coordinates,1)):Yl(e.coordinates,1)).some(i=>i<-90||i>90))return{pointer:"/geometry",message:"The second element of each position SHALL be between -90 and +90 decimal degrees latitude."}}}});uu.push({name:"/req/core/place",validateFeature:t=>{if(t.place!==null){const n=t.place.coordRefSys??t.coordRefSys;if(nS(t.place)&&(n===void 0||rS(n)))return{pointer:"/place",message:'If the "place" member in any JSON-FG feature in the JSON document is not null and the geometry type (member "type") is one of "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon" or "GeometryCollection", the CRS SHALL not be OGC:CRS84 or OGC:CRS84h (WGS 84 with axis order longitude/latitude).'}}},validateFeatureCollection:t=>{t.features.forEach((e,n)=>{if(e.place!==null){const i=e.place.coordRefSys??e.coordRefSys??t.coordRefSys;if(nS(e.place)&&(i===void 0||rS(i)))return{pointer:"/features/"+n+"/place",message:'If the "place" member in any JSON-FG feature in the JSON document is not null and the geometry type (member "type") is one of "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon" or "GeometryCollection", the CRS SHALL not be OGC:CRS84 or OGC:CRS84h (WGS 84 with axis order longitude/latitude).'}}})}});uu.push({name:"/req/core/geometry-collection",validateFeature:t=>{if(t.place!==null){const e=t.place;if(e.type===it.GEOMETRYCOLLECTION&&e.geometries.some(n=>n.coordRefSys!==void 0)||e.type===it.PRISM&&e.base.coordRefSys!==void 0||e.type===it.MULTIPRISM&&e.prisms.some(n=>n.coordRefSys!==void 0||n.base.coordRefSys!==void 0))return{pointer:"/place",message:'If the "place" member in any JSON-FG feature in the JSON document is not null and the geometry type (member "type") is "GeometryCollection" or any other geometry type that has embedded geometry objects, no embedded geometry object SHALL include a "coordRefSys" member.'}}}});const pL="http://www.opengis.net/spec/json-fg-1/0.2/conf/core",gL="[ogc-json-fg-1-0.2:core]",iS=t=>t.conformsTo!==void 0&&(t.conformsTo.includes(pL)||t.conformsTo.includes(gL)),b$=[];b$.push({name:"/req/core/metadata",validateFeature:(t,e)=>{const n=t.conformsTo;if(e&&n===void 0)return{pointer:"/",message:'The JSON document SHALL include a "conformsTo" member.'};if(e&&n!==void 0&&!iS(t))return{pointer:"/conformsTo",message:'The "conformsTo" member of the JSON document SHALL include at least the core conformance class.'};if(!e&&n!==void 0)return{pointer:"/conformsTo",message:'Only the root object of the JSON document SHALL include a "conformsTo" member.'}},validateFeatureCollection:t=>{const e=t.conformsTo;if(e===void 0)return{pointer:"/",message:'The JSON document SHALL include a "conformsTo" member.'};if(e!==void 0&&!iS(t))return{pointer:"/conformsTo",message:'The "conformsTo" member of the JSON document SHALL include at least the core conformance class.'}}});class Is extends Error{}class yL extends Is{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class vL extends Is{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class wL extends Is{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class po extends Is{}class x$ extends Is{constructor(e){super(`Invalid unit ${e}`)}}class tn extends Is{}class ii extends Is{constructor(){super("Zone is an abstract class")}}const K="numeric",or="short",Sn="long",Uf={year:K,month:K,day:K},C$={year:K,month:or,day:K},SL={year:K,month:or,day:K,weekday:or},$$={year:K,month:Sn,day:K},E$={year:K,month:Sn,day:K,weekday:Sn},O$={hour:K,minute:K},T$={hour:K,minute:K,second:K},_$={hour:K,minute:K,second:K,timeZoneName:or},M$={hour:K,minute:K,second:K,timeZoneName:Sn},A$={hour:K,minute:K,hourCycle:"h23"},P$={hour:K,minute:K,second:K,hourCycle:"h23"},N$={hour:K,minute:K,second:K,hourCycle:"h23",timeZoneName:or},D$={hour:K,minute:K,second:K,hourCycle:"h23",timeZoneName:Sn},R$={year:K,month:K,day:K,hour:K,minute:K},I$={year:K,month:K,day:K,hour:K,minute:K,second:K},L$={year:K,month:or,day:K,hour:K,minute:K},F$={year:K,month:or,day:K,hour:K,minute:K,second:K},kL={year:K,month:or,day:K,weekday:or,hour:K,minute:K},z$={year:K,month:Sn,day:K,hour:K,minute:K,timeZoneName:or},j$={year:K,month:Sn,day:K,hour:K,minute:K,second:K,timeZoneName:or},B$={year:K,month:Sn,day:K,weekday:Sn,hour:K,minute:K,timeZoneName:Sn},V$={year:K,month:Sn,day:K,weekday:Sn,hour:K,minute:K,second:K,timeZoneName:Sn};class cu{get type(){throw new ii}get name(){throw new ii}get ianaName(){return this.name}get isUniversal(){throw new ii}offsetName(e,n){throw new ii}formatOffset(e,n){throw new ii}offset(e){throw new ii}equals(e){throw new ii}get isValid(){throw new ii}}let Ud=null;class Ah extends cu{static get instance(){return Ud===null&&(Ud=new Ah),Ud}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return Z$(e,n,r)}formatOffset(e,n){return ha(this.offset(e),n)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let Vc={};function bL(t){return Vc[t]||(Vc[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Vc[t]}const xL={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function CL(t,e){const n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,s,o,l,a,u,c]=r;return[o,i,s,l,a,u,c]}function $L(t,e){const n=t.formatToParts(e),r=[];for(let i=0;i=0?p:1e3+p,(h-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let sS={};function EL(t,e={}){const n=JSON.stringify([t,e]);let r=sS[n];return r||(r=new Intl.ListFormat(t,e),sS[n]=r),r}let Yp={};function Jp(t,e={}){const n=JSON.stringify([t,e]);let r=Yp[n];return r||(r=new Intl.DateTimeFormat(t,e),Yp[n]=r),r}let Zp={};function OL(t,e={}){const n=JSON.stringify([t,e]);let r=Zp[n];return r||(r=new Intl.NumberFormat(t,e),Zp[n]=r),r}let Qp={};function TL(t,e={}){const{base:n,...r}=e,i=JSON.stringify([t,r]);let s=Qp[i];return s||(s=new Intl.RelativeTimeFormat(t,e),Qp[i]=s),s}let Jl=null;function _L(){return Jl||(Jl=new Intl.DateTimeFormat().resolvedOptions().locale,Jl)}let oS={};function ML(t){let e=oS[t];if(!e){const n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,oS[t]=e}return e}function AL(t){const e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));const n=t.indexOf("-u-");if(n===-1)return[t];{let r,i;try{r=Jp(t).resolvedOptions(),i=t}catch{const a=t.substring(0,n);r=Jp(a).resolvedOptions(),i=a}const{numberingSystem:s,calendar:o}=r;return[i,s,o]}}function PL(t,e,n){return(n||e)&&(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`)),t}function NL(t){const e=[];for(let n=1;n<=12;n++){const r=se.utc(2009,n,1);e.push(t(r))}return e}function DL(t){const e=[];for(let n=1;n<=7;n++){const r=se.utc(2016,11,13+n);e.push(t(r))}return e}function ac(t,e,n,r){const i=t.listingMode();return i==="error"?null:i==="en"?n(e):r(e)}function RL(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}class IL{constructor(e,n,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:i,floor:s,...o}=r;if(!n||Object.keys(o).length>0){const l={useGrouping:!1,...r};r.padTo>0&&(l.minimumIntegerDigits=r.padTo),this.inf=OL(e,l)}}format(e){if(this.inf){const n=this.floor?Math.floor(e):e;return this.inf.format(n)}else{const n=this.floor?Math.floor(e):L0(e,3);return lt(n,this.padTo)}}}class LL{constructor(e,n,r){this.opts=r,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),l=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Qr.create(l).valid?(i=l,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=Jp(n,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(n=>{if(n.type==="timeZoneName"){const r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...n,value:r}}else return n}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class FL{constructor(e,n,r){this.opts={style:"long",...r},!n&&Y$()&&(this.rtf=TL(e,r))}format(e,n){return this.rtf?this.rtf.format(e,n):i4(n,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,n){return this.rtf?this.rtf.formatToParts(e,n):[]}}const zL={firstDay:1,minimalDays:4,weekend:[6,7]};class Me{static fromOpts(e){return Me.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,n,r,i,s=!1){const o=e||Ze.defaultLocale,l=o||(s?"en-US":_L()),a=n||Ze.defaultNumberingSystem,u=r||Ze.defaultOutputCalendar,c=Xp(i)||Ze.defaultWeekSettings;return new Me(l,a,u,c,o)}static resetCache(){Jl=null,Yp={},Zp={},Qp={}}static fromObject({locale:e,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return Me.create(e,n,r,i)}constructor(e,n,r,i,s){const[o,l,a]=AL(e);this.locale=o,this.numberingSystem=n||l||null,this.outputCalendar=r||a||null,this.weekSettings=i,this.intl=PL(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=RL(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),n=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&n?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:Me.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Xp(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,n=!1){return ac(this,e,eE,()=>{const r=n?{month:e,day:"numeric"}:{month:e},i=n?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=NL(s=>this.extract(s,r,"month"))),this.monthsCache[i][e]})}weekdays(e,n=!1){return ac(this,e,rE,()=>{const r=n?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=n?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=DL(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return ac(this,void 0,()=>iE,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[se.utc(2016,11,13,9),se.utc(2016,11,13,19)].map(n=>this.extract(n,e,"dayperiod"))}return this.meridiemCache})}eras(e){return ac(this,e,sE,()=>{const n={era:e};return this.eraCache[e]||(this.eraCache[e]=[se.utc(-40,1,1),se.utc(2017,1,1)].map(r=>this.extract(r,n,"era"))),this.eraCache[e]})}extract(e,n,r){const i=this.dtFormatter(e,n),s=i.formatToParts(),o=s.find(l=>l.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new IL(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,n={}){return new LL(e,this.intl,n)}relFormatter(e={}){return new FL(this.intl,this.isEnglish(),e)}listFormatter(e={}){return EL(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:J$()?ML(this.locale):zL}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let qd=null;class Ut extends cu{static get utcInstance(){return qd===null&&(qd=new Ut(0)),qd}static instance(e){return e===0?Ut.utcInstance:new Ut(e)}static parseSpecifier(e){if(e){const n=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new Ut(Dh(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${ha(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${ha(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,n){return ha(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class jL extends cu{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function yi(t,e){if(ce(t)||t===null)return e;if(t instanceof cu)return t;if(WL(t)){const n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?Ah.instance:n==="utc"||n==="gmt"?Ut.utcInstance:Ut.parseSpecifier(n)||Qr.create(t)}else return bs(t)?Ut.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new jL(t)}let lS=()=>Date.now(),aS="system",uS=null,cS=null,fS=null,hS=60,dS,mS=null;class Ze{static get now(){return lS}static set now(e){lS=e}static set defaultZone(e){aS=e}static get defaultZone(){return yi(aS,Ah.instance)}static get defaultLocale(){return uS}static set defaultLocale(e){uS=e}static get defaultNumberingSystem(){return cS}static set defaultNumberingSystem(e){cS=e}static get defaultOutputCalendar(){return fS}static set defaultOutputCalendar(e){fS=e}static get defaultWeekSettings(){return mS}static set defaultWeekSettings(e){mS=Xp(e)}static get twoDigitCutoffYear(){return hS}static set twoDigitCutoffYear(e){hS=e%100}static get throwOnInvalid(){return dS}static set throwOnInvalid(e){dS=e}static resetCaches(){Me.resetCache(),Qr.resetCache()}}class er{constructor(e,n){this.reason=e,this.explanation=n}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const W$=[0,31,59,90,120,151,181,212,243,273,304,334],H$=[0,31,60,91,121,152,182,213,244,274,305,335];function Rn(t,e){return new er("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function D0(t,e,n){const r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return i===0?7:i}function U$(t,e,n){return n+(fu(t)?H$:W$)[e-1]}function q$(t,e){const n=fu(t)?H$:W$,r=n.findIndex(s=>sYa(r,e,n)?(u=r+1,a=1):u=r,{weekYear:u,weekNumber:a,weekday:l,...Rh(t)}}function pS(t,e=4,n=1){const{weekYear:r,weekNumber:i,weekday:s}=t,o=R0(D0(r,1,e),n),l=Po(r);let a=i*7+s-o-7+e,u;a<1?(u=r-1,a+=Po(u)):a>l?(u=r+1,a-=Po(r)):u=r;const{month:c,day:f}=q$(u,a);return{year:u,month:c,day:f,...Rh(t)}}function Kd(t){const{year:e,month:n,day:r}=t,i=U$(e,n,r);return{year:e,ordinal:i,...Rh(t)}}function gS(t){const{year:e,ordinal:n}=t,{month:r,day:i}=q$(e,n);return{year:e,month:r,day:i,...Rh(t)}}function yS(t,e){if(!ce(t.localWeekday)||!ce(t.localWeekNumber)||!ce(t.localWeekYear)){if(!ce(t.weekday)||!ce(t.weekNumber)||!ce(t.weekYear))throw new po("Cannot mix locale-based week fields with ISO-based week fields");return ce(t.localWeekday)||(t.weekday=t.localWeekday),ce(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),ce(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function BL(t,e=4,n=1){const r=Ph(t.weekYear),i=In(t.weekNumber,1,Ya(t.weekYear,e,n)),s=In(t.weekday,1,7);return r?i?s?!1:Rn("weekday",t.weekday):Rn("week",t.weekNumber):Rn("weekYear",t.weekYear)}function VL(t){const e=Ph(t.year),n=In(t.ordinal,1,Po(t.year));return e?n?!1:Rn("ordinal",t.ordinal):Rn("year",t.year)}function K$(t){const e=Ph(t.year),n=In(t.month,1,12),r=In(t.day,1,Kf(t.year,t.month));return e?n?r?!1:Rn("day",t.day):Rn("month",t.month):Rn("year",t.year)}function G$(t){const{hour:e,minute:n,second:r,millisecond:i}=t,s=In(e,0,23)||e===24&&n===0&&r===0&&i===0,o=In(n,0,59),l=In(r,0,59),a=In(i,0,999);return s?o?l?a?!1:Rn("millisecond",i):Rn("second",r):Rn("minute",n):Rn("hour",e)}function ce(t){return typeof t>"u"}function bs(t){return typeof t=="number"}function Ph(t){return typeof t=="number"&&t%1===0}function WL(t){return typeof t=="string"}function HL(t){return Object.prototype.toString.call(t)==="[object Date]"}function Y$(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function J$(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function UL(t){return Array.isArray(t)?t:[t]}function vS(t,e,n){if(t.length!==0)return t.reduce((r,i)=>{const s=[e(i),i];return r&&n(r[0],s[0])===r[0]?r:s},null)[1]}function qL(t,e){return e.reduce((n,r)=>(n[r]=t[r],n),{})}function Go(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Xp(t){if(t==null)return null;if(typeof t!="object")throw new tn("Week settings must be an object");if(!In(t.firstDay,1,7)||!In(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!In(e,1,7)))throw new tn("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function In(t,e,n){return Ph(t)&&t>=e&&t<=n}function KL(t,e){return t-e*Math.floor(t/e)}function lt(t,e=2){const n=t<0;let r;return n?r="-"+(""+-t).padStart(e,"0"):r=(""+t).padStart(e,"0"),r}function di(t){if(!(ce(t)||t===null||t===""))return parseInt(t,10)}function es(t){if(!(ce(t)||t===null||t===""))return parseFloat(t)}function I0(t){if(!(ce(t)||t===null||t==="")){const e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function L0(t,e,n=!1){const r=10**e;return(n?Math.trunc:Math.round)(t*r)/r}function fu(t){return t%4===0&&(t%100!==0||t%400===0)}function Po(t){return fu(t)?366:365}function Kf(t,e){const n=KL(e-1,12)+1,r=t+(e-n)/12;return n===2?fu(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Nh(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function wS(t,e,n){return-R0(D0(t,1,e),n)+e-1}function Ya(t,e=4,n=1){const r=wS(t,e,n),i=wS(t+1,e,n);return(Po(t)-r+i)/7}function eg(t){return t>99?t:t>Ze.twoDigitCutoffYear?1900+t:2e3+t}function Z$(t,e,n,r=null){const i=new Date(t),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);const o={timeZoneName:e,...s},l=new Intl.DateTimeFormat(n,o).formatToParts(i).find(a=>a.type.toLowerCase()==="timezonename");return l?l.value:null}function Dh(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);const r=parseInt(e,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function Q$(t){const e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new tn(`Invalid unit value ${t}`);return e}function Gf(t,e){const n={};for(const r in t)if(Go(t,r)){const i=t[r];if(i==null)continue;n[e(r)]=Q$(i)}return n}function ha(t,e){const n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${lt(n,2)}:${lt(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${lt(n,2)}${lt(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Rh(t){return qL(t,["hour","minute","second","millisecond"])}const GL=["January","February","March","April","May","June","July","August","September","October","November","December"],X$=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],YL=["J","F","M","A","M","J","J","A","S","O","N","D"];function eE(t){switch(t){case"narrow":return[...YL];case"short":return[...X$];case"long":return[...GL];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const tE=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],nE=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],JL=["M","T","W","T","F","S","S"];function rE(t){switch(t){case"narrow":return[...JL];case"short":return[...nE];case"long":return[...tE];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const iE=["AM","PM"],ZL=["Before Christ","Anno Domini"],QL=["BC","AD"],XL=["B","A"];function sE(t){switch(t){case"narrow":return[...XL];case"short":return[...QL];case"long":return[...ZL];default:return null}}function e4(t){return iE[t.hour<12?0:1]}function t4(t,e){return rE(e)[t.weekday-1]}function n4(t,e){return eE(e)[t.month-1]}function r4(t,e){return sE(e)[t.year<0?0:1]}function i4(t,e,n="always",r=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(t)===-1;if(n==="auto"&&s){const f=t==="days";switch(e){case 1:return f?"tomorrow":`next ${i[t][0]}`;case-1:return f?"yesterday":`last ${i[t][0]}`;case 0:return f?"today":`this ${i[t][0]}`}}const o=Object.is(e,-0)||e<0,l=Math.abs(e),a=l===1,u=i[t],c=r?a?u[1]:u[2]||u[1]:a?i[t][0]:t;return o?`${l} ${c} ago`:`in ${l} ${c}`}function SS(t,e){let n="";for(const r of t)r.literal?n+=r.val:n+=e(r.val);return n}const s4={D:Uf,DD:C$,DDD:$$,DDDD:E$,t:O$,tt:T$,ttt:_$,tttt:M$,T:A$,TT:P$,TTT:N$,TTTT:D$,f:R$,ff:L$,fff:z$,ffff:B$,F:I$,FF:F$,FFF:j$,FFFF:V$};class Lt{static create(e,n={}){return new Lt(e,n)}static parseFormat(e){let n=null,r="",i=!1;const s=[];for(let o=0;o0&&s.push({literal:i||/^\s+$/.test(r),val:r}),n=null,r="",i=!i):i||l===n?r+=l:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=l,n=l)}return r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return s4[e]}constructor(e,n){this.opts=n,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,n){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...n}).format()}dtFormatter(e,n={}){return this.loc.dtFormatter(e,{...this.opts,...n})}formatDateTime(e,n){return this.dtFormatter(e,n).format()}formatDateTimeParts(e,n){return this.dtFormatter(e,n).formatToParts()}formatInterval(e,n){return this.dtFormatter(e.start,n).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,n){return this.dtFormatter(e,n).resolvedOptions()}num(e,n=0){if(this.opts.forceSimple)return lt(e,n);const r={...this.opts};return n>0&&(r.padTo=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,n){const r=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(d,p)=>this.loc.extract(e,d,p),o=d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"",l=()=>r?e4(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(d,p)=>r?n4(e,d):s(p?{month:d}:{month:d,day:"numeric"},"month"),u=(d,p)=>r?t4(e,d):s(p?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),c=d=>{const p=Lt.macroTokenToFormatOpts(d);return p?this.formatWithSystemDefault(e,p):d},f=d=>r?r4(e,d):s({era:d},"era"),h=d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return l();case"d":return i?s({day:"numeric"},"day"):this.num(e.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(e.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(e.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(d)}};return SS(Lt.parseFormat(n),h)}formatDurationFromString(e,n){const r=a=>{switch(a[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=a=>u=>{const c=r(u);return c?this.num(a.get(c),u.length):u},s=Lt.parseFormat(n),o=s.reduce((a,{literal:u,val:c})=>u?a:a.concat(c),[]),l=e.shiftTo(...o.map(r).filter(a=>a));return SS(s,i(l))}}const oE=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function rl(...t){const e=t.reduce((n,r)=>n+r.source,"");return RegExp(`^${e}$`)}function il(...t){return e=>t.reduce(([n,r,i],s)=>{const[o,l,a]=s(e,i);return[{...n,...o},l||r,a]},[{},null,1]).slice(0,2)}function sl(t,...e){if(t==null)return[null,null];for(const[n,r]of e){const i=n.exec(t);if(i)return r(i)}return[null,null]}function lE(...t){return(e,n)=>{const r={};let i;for(i=0;id!==void 0&&(p||d&&c)?-d:d;return[{years:h(es(n)),months:h(es(r)),weeks:h(es(i)),days:h(es(s)),hours:h(es(o)),minutes:h(es(l)),seconds:h(es(a),a==="-0"),milliseconds:h(I0(u),f)}]}const v4={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function j0(t,e,n,r,i,s,o){const l={year:e.length===2?eg(di(e)):di(e),month:X$.indexOf(n)+1,day:di(r),hour:di(i),minute:di(s)};return o&&(l.second=di(o)),t&&(l.weekday=t.length>3?tE.indexOf(t)+1:nE.indexOf(t)+1),l}const w4=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function S4(t){const[,e,n,r,i,s,o,l,a,u,c,f]=t,h=j0(e,i,r,n,s,o,l);let d;return a?d=v4[a]:u?d=0:d=Dh(c,f),[h,new Ut(d)]}function k4(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const b4=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,x4=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,C4=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function kS(t){const[,e,n,r,i,s,o,l]=t;return[j0(e,i,r,n,s,o,l),Ut.utcInstance]}function $4(t){const[,e,n,r,i,s,o,l]=t;return[j0(e,l,n,r,i,s,o),Ut.utcInstance]}const E4=rl(l4,z0),O4=rl(a4,z0),T4=rl(u4,z0),_4=rl(uE),fE=il(m4,ol,hu,du),M4=il(c4,ol,hu,du),A4=il(f4,ol,hu,du),P4=il(ol,hu,du);function N4(t){return sl(t,[E4,fE],[O4,M4],[T4,A4],[_4,P4])}function D4(t){return sl(k4(t),[w4,S4])}function R4(t){return sl(t,[b4,kS],[x4,kS],[C4,$4])}function I4(t){return sl(t,[g4,y4])}const L4=il(ol);function F4(t){return sl(t,[p4,L4])}const z4=rl(h4,d4),j4=rl(cE),B4=il(ol,hu,du);function V4(t){return sl(t,[z4,fE],[j4,B4])}const bS="Invalid Duration",hE={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},W4={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...hE},On=146097/400,qs=146097/4800,H4={years:{quarters:4,months:12,weeks:On/7,days:On,hours:On*24,minutes:On*24*60,seconds:On*24*60*60,milliseconds:On*24*60*60*1e3},quarters:{months:3,weeks:On/28,days:On/4,hours:On*24/4,minutes:On*24*60/4,seconds:On*24*60*60/4,milliseconds:On*24*60*60*1e3/4},months:{weeks:qs/7,days:qs,hours:qs*24,minutes:qs*24*60,seconds:qs*24*60*60,milliseconds:qs*24*60*60*1e3},...hE},vs=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],U4=vs.slice(0).reverse();function si(t,e,n=!1){const r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new xe(r)}function dE(t,e){let n=e.milliseconds??0;for(const r of U4.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function xS(t,e){const n=dE(t,e)<0?-1:1;vs.reduceRight((r,i)=>{if(ce(e[i]))return r;if(r){const s=e[r]*n,o=t[i][r],l=Math.floor(s/o);e[i]+=l*n,e[r]-=l*o*n}return i},null),vs.reduce((r,i)=>{if(ce(e[i]))return r;if(r){const s=e[r]%1;e[r]-=s,e[i]+=s*t[r][i]}return i},null)}function q4(t){const e={};for(const[n,r]of Object.entries(t))r!==0&&(e[n]=r);return e}class xe{constructor(e){const n=e.conversionAccuracy==="longterm"||!1;let r=n?H4:W4;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Me.create(),this.conversionAccuracy=n?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,n){return xe.fromObject({milliseconds:e},n)}static fromObject(e,n={}){if(e==null||typeof e!="object")throw new tn(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new xe({values:Gf(e,xe.normalizeUnit),loc:Me.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(e){if(bs(e))return xe.fromMillis(e);if(xe.isDuration(e))return e;if(typeof e=="object")return xe.fromObject(e);throw new tn(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,n){const[r]=I4(e);return r?xe.fromObject(r,n):xe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,n){const[r]=F4(e);return r?xe.fromObject(r,n):xe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,n=null){if(!e)throw new tn("need to specify a reason the Duration is invalid");const r=e instanceof er?e:new er(e,n);if(Ze.throwOnInvalid)throw new wL(r);return new xe({invalid:r})}static normalizeUnit(e){const n={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!n)throw new x$(e);return n}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,n={}){const r={...n,floor:n.round!==!1&&n.floor!==!1};return this.isValid?Lt.create(this.loc,r).formatDurationFromString(this,e):bS}toHuman(e={}){if(!this.isValid)return bS;const n=vs.map(r=>{const i=this.values[r];return ce(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(i)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=L0(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const n=this.toMillis();return n<0||n>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},se.fromMillis(n,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?dE(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const n=xe.fromDurationLike(e),r={};for(const i of vs)(Go(n.values,i)||Go(this.values,i))&&(r[i]=n.get(i)+this.get(i));return si(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const n=xe.fromDurationLike(e);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;const n={};for(const r of Object.keys(this.values))n[r]=Q$(e(this.values[r],r));return si(this,{values:n},!0)}get(e){return this[xe.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const n={...this.values,...Gf(e,xe.normalizeUnit)};return si(this,{values:n})}reconfigure({locale:e,numberingSystem:n,conversionAccuracy:r,matrix:i}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:n}),matrix:i,conversionAccuracy:r};return si(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return xS(this.matrix,e),si(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=q4(this.normalize().shiftToAll().toObject());return si(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>xe.normalizeUnit(o));const n={},r={},i=this.toObject();let s;for(const o of vs)if(e.indexOf(o)>=0){s=o;let l=0;for(const u in r)l+=this.matrix[u][o]*r[u],r[u]=0;bs(i[o])&&(l+=i[o]);const a=Math.trunc(l);n[o]=a,r[o]=(l*1e3-a*1e3)/1e3}else bs(i[o])&&(r[o]=i[o]);for(const o in r)r[o]!==0&&(n[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return xS(this.matrix,n),si(this,{values:n},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const n of Object.keys(this.values))e[n]=this.values[n]===0?0:-this.values[n];return si(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function n(r,i){return r===void 0||r===0?i===void 0||i===0:r===i}for(const r of vs)if(!n(this.values[r],e.values[r]))return!1;return!0}}const Ks="Invalid Interval";function K4(t,e){return!t||!t.isValid?Je.invalid("missing or invalid start"):!e||!e.isValid?Je.invalid("missing or invalid end"):ee:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:n}={}){return this.isValid?Je.fromDateTimes(e||this.s,n||this.e):this}splitAt(...e){if(!this.isValid)return[];const n=e.map(Ll).filter(o=>this.contains(o)).sort((o,l)=>o.toMillis()-l.toMillis()),r=[];let{s:i}=this,s=0;for(;i+this.e?this.e:o;r.push(Je.fromDateTimes(i,l)),i=l,s+=1}return r}splitBy(e){const n=xe.fromDurationLike(e);if(!this.isValid||!n.isValid||n.as("milliseconds")===0)return[];let{s:r}=this,i=1,s;const o=[];for(;ra*i));s=+l>+this.e?this.e:l,o.push(Je.fromDateTimes(r,s)),r=s,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const n=this.s>e.s?this.s:e.s,r=this.e=r?null:Je.fromDateTimes(n,r)}union(e){if(!this.isValid)return this;const n=this.se.e?this.e:e.e;return Je.fromDateTimes(n,r)}static merge(e){const[n,r]=e.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return r&&n.push(r),n}static xor(e){let n=null,r=0;const i=[],s=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...s),l=o.sort((a,u)=>a.time-u.time);for(const a of l)r+=a.type==="s"?1:-1,r===1?n=a.time:(n&&+n!=+a.time&&i.push(Je.fromDateTimes(n,a.time)),n=null);return Je.merge(i)}difference(...e){return Je.xor([this].concat(e)).map(n=>this.intersection(n)).filter(n=>n&&!n.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Ks}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Uf,n={}){return this.isValid?Lt.create(this.s.loc.clone(n),e).formatInterval(this):Ks}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Ks}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Ks}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Ks}toFormat(e,{separator:n=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${n}${this.e.toFormat(e)}`:Ks}toDuration(e,n){return this.isValid?this.e.diff(this.s,e,n):xe.invalid(this.invalidReason)}mapEndpoints(e){return Je.fromDateTimes(e(this.s),e(this.e))}}class uc{static hasDST(e=Ze.defaultZone){const n=se.now().setZone(e).set({month:12});return!e.isUniversal&&n.offset!==n.set({month:6}).offset}static isValidIANAZone(e){return Qr.isValidZone(e)}static normalizeZone(e){return yi(e,Ze.defaultZone)}static getStartOfWeek({locale:e=null,locObj:n=null}={}){return(n||Me.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:n=null}={}){return(n||Me.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:n=null}={}){return(n||Me.create(e)).getWeekendDays().slice()}static months(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||Me.create(n,r,s)).months(e)}static monthsFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||Me.create(n,r,s)).months(e,!0)}static weekdays(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null}={}){return(i||Me.create(n,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null}={}){return(i||Me.create(n,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Me.create(e).meridiems()}static eras(e="short",{locale:n=null}={}){return Me.create(n,null,"gregory").eras(e)}static features(){return{relative:Y$(),localeWeek:J$()}}}function CS(t,e){const n=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(xe.fromMillis(r).as("days"))}function G4(t,e,n){const r=[["years",(a,u)=>u.year-a.year],["quarters",(a,u)=>u.quarter-a.quarter+(u.year-a.year)*4],["months",(a,u)=>u.month-a.month+(u.year-a.year)*12],["weeks",(a,u)=>{const c=CS(a,u);return(c-c%7)/7}],["days",CS]],i={},s=t;let o,l;for(const[a,u]of r)n.indexOf(a)>=0&&(o=a,i[a]=u(t,e),l=s.plus(i),l>e?(i[a]--,t=s.plus(i),t>e&&(l=t,i[a]--,t=s.plus(i))):t=l);return[t,i,l,o]}function Y4(t,e,n,r){let[i,s,o,l]=G4(t,e,n);const a=e-i,u=n.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);u.length===0&&(o0?xe.fromMillis(a,r).shiftTo(...u).plus(c):c}const B0={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},$S={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},J4=B0.hanidec.replace(/[\[|\]]/g,"").split("");function Z4(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}function Un({numberingSystem:t},e=""){return new RegExp(`${B0[t||"latn"]}${e}`)}const Q4="missing Intl.DateTimeFormat.formatToParts support";function Oe(t,e=n=>n){return{regex:t,deser:([n])=>e(Z4(n))}}const X4=" ",mE=`[ ${X4}]`,pE=new RegExp(mE,"g");function e3(t){return t.replace(/\./g,"\\.?").replace(pE,mE)}function ES(t){return t.replace(/\./g,"").replace(pE," ").toLowerCase()}function qn(t,e){return t===null?null:{regex:RegExp(t.map(e3).join("|")),deser:([n])=>t.findIndex(r=>ES(n)===ES(r))+e}}function OS(t,e){return{regex:t,deser:([,n,r])=>Dh(n,r),groups:e}}function cc(t){return{regex:t,deser:([e])=>e}}function t3(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function n3(t,e){const n=Un(e),r=Un(e,"{2}"),i=Un(e,"{3}"),s=Un(e,"{4}"),o=Un(e,"{6}"),l=Un(e,"{1,2}"),a=Un(e,"{1,3}"),u=Un(e,"{1,6}"),c=Un(e,"{1,9}"),f=Un(e,"{2,4}"),h=Un(e,"{4,6}"),d=w=>({regex:RegExp(t3(w.val)),deser:([m])=>m,literal:!0}),y=(w=>{if(t.literal)return d(w);switch(w.val){case"G":return qn(e.eras("short"),0);case"GG":return qn(e.eras("long"),0);case"y":return Oe(u);case"yy":return Oe(f,eg);case"yyyy":return Oe(s);case"yyyyy":return Oe(h);case"yyyyyy":return Oe(o);case"M":return Oe(l);case"MM":return Oe(r);case"MMM":return qn(e.months("short",!0),1);case"MMMM":return qn(e.months("long",!0),1);case"L":return Oe(l);case"LL":return Oe(r);case"LLL":return qn(e.months("short",!1),1);case"LLLL":return qn(e.months("long",!1),1);case"d":return Oe(l);case"dd":return Oe(r);case"o":return Oe(a);case"ooo":return Oe(i);case"HH":return Oe(r);case"H":return Oe(l);case"hh":return Oe(r);case"h":return Oe(l);case"mm":return Oe(r);case"m":return Oe(l);case"q":return Oe(l);case"qq":return Oe(r);case"s":return Oe(l);case"ss":return Oe(r);case"S":return Oe(a);case"SSS":return Oe(i);case"u":return cc(c);case"uu":return cc(l);case"uuu":return Oe(n);case"a":return qn(e.meridiems(),0);case"kkkk":return Oe(s);case"kk":return Oe(f,eg);case"W":return Oe(l);case"WW":return Oe(r);case"E":case"c":return Oe(n);case"EEE":return qn(e.weekdays("short",!1),1);case"EEEE":return qn(e.weekdays("long",!1),1);case"ccc":return qn(e.weekdays("short",!0),1);case"cccc":return qn(e.weekdays("long",!0),1);case"Z":case"ZZ":return OS(new RegExp(`([+-]${l.source})(?::(${r.source}))?`),2);case"ZZZ":return OS(new RegExp(`([+-]${l.source})(${r.source})?`),2);case"z":return cc(/[a-z_+-/]{1,256}?/i);case" ":return cc(/[^\S\n\r]/);default:return d(w)}})(t)||{invalidReason:Q4};return y.token=t,y}const r3={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function i3(t,e,n){const{type:r,value:i}=t;if(r==="literal"){const a=/^\s+$/.test(i);return{literal:!a,val:a?" ":i}}const s=e[r];let o=r;r==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=n.hour12?"hour12":"hour24");let l=r3[o];if(typeof l=="object"&&(l=l[s]),l)return{literal:!1,val:l}}function s3(t){return[`^${t.map(n=>n.regex).reduce((n,r)=>`${n}(${r.source})`,"")}$`,t]}function o3(t,e,n){const r=t.match(e);if(r){const i={};let s=1;for(const o in n)if(Go(n,o)){const l=n[o],a=l.groups?l.groups+1:1;!l.literal&&l.token&&(i[l.token.val[0]]=l.deser(r.slice(s,s+a))),s+=a}return[r,i]}else return[r,{}]}function l3(t){const e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let n=null,r;return ce(t.z)||(n=Qr.create(t.z)),ce(t.Z)||(n||(n=new Ut(t.Z)),r=t.Z),ce(t.q)||(t.M=(t.q-1)*3+1),ce(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),ce(t.u)||(t.S=I0(t.u)),[Object.keys(t).reduce((s,o)=>{const l=e(o);return l&&(s[l]=t[o]),s},{}),n,r]}let Gd=null;function a3(){return Gd||(Gd=se.fromMillis(1555555555555)),Gd}function u3(t,e){if(t.literal)return t;const n=Lt.macroTokenToFormatOpts(t.val),r=vE(n,e);return r==null||r.includes(void 0)?t:r}function gE(t,e){return Array.prototype.concat(...t.map(n=>u3(n,e)))}function yE(t,e,n){const r=gE(Lt.parseFormat(n),t),i=r.map(o=>n3(o,t)),s=i.find(o=>o.invalidReason);if(s)return{input:e,tokens:r,invalidReason:s.invalidReason};{const[o,l]=s3(i),a=RegExp(o,"i"),[u,c]=o3(e,a,l),[f,h,d]=c?l3(c):[null,null,void 0];if(Go(c,"a")&&Go(c,"H"))throw new po("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:r,regex:a,rawMatches:u,matches:c,result:f,zone:h,specificOffset:d}}}function c3(t,e,n){const{result:r,zone:i,specificOffset:s,invalidReason:o}=yE(t,e,n);return[r,i,s,o]}function vE(t,e){if(!t)return null;const r=Lt.create(e,t).dtFormatter(a3()),i=r.formatToParts(),s=r.resolvedOptions();return i.map(o=>i3(o,t,s))}const Yd="Invalid DateTime",TS=864e13;function fc(t){return new er("unsupported zone",`the zone "${t.name}" is not supported`)}function Jd(t){return t.weekData===null&&(t.weekData=qf(t.c)),t.weekData}function Zd(t){return t.localWeekData===null&&(t.localWeekData=qf(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function ts(t,e){const n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new se({...n,...e,old:n})}function wE(t,e,n){let r=t-e*60*1e3;const i=n.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;const s=n.offset(r);return i===s?[r,i]:[t-Math.min(i,s)*60*1e3,Math.max(i,s)]}function hc(t,e){t+=e*60*1e3;const n=new Date(t);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function Wc(t,e,n){return wE(Nh(t),e,n)}function _S(t,e){const n=t.o,r=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...t.c,year:r,month:i,day:Math.min(t.c.day,Kf(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=xe.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),l=Nh(s);let[a,u]=wE(l,n,t.zone);return o!==0&&(a+=o,u=t.zone.offset(a)),{ts:a,o:u}}function Il(t,e,n,r,i,s){const{setZone:o,zone:l}=n;if(t&&Object.keys(t).length!==0||e){const a=e||l,u=se.fromObject(t,{...n,zone:a,specificOffset:s});return o?u:u.setZone(l)}else return se.invalid(new er("unparsable",`the input "${i}" can't be parsed as ${r}`))}function dc(t,e,n=!0){return t.isValid?Lt.create(Me.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Qd(t,e){const n=t.c.year>9999||t.c.year<0;let r="";return n&&t.c.year>=0&&(r+="+"),r+=lt(t.c.year,n?6:4),e?(r+="-",r+=lt(t.c.month),r+="-",r+=lt(t.c.day)):(r+=lt(t.c.month),r+=lt(t.c.day)),r}function MS(t,e,n,r,i,s){let o=lt(t.c.hour);return e?(o+=":",o+=lt(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(o+=":")):o+=lt(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(o+=lt(t.c.second),(t.c.millisecond!==0||!r)&&(o+=".",o+=lt(t.c.millisecond,3))),i&&(t.isOffsetFixed&&t.offset===0&&!s?o+="Z":t.o<0?(o+="-",o+=lt(Math.trunc(-t.o/60)),o+=":",o+=lt(Math.trunc(-t.o%60))):(o+="+",o+=lt(Math.trunc(t.o/60)),o+=":",o+=lt(Math.trunc(t.o%60)))),s&&(o+="["+t.zone.ianaName+"]"),o}const SE={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},f3={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},h3={ordinal:1,hour:0,minute:0,second:0,millisecond:0},kE=["year","month","day","hour","minute","second","millisecond"],d3=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],m3=["year","ordinal","hour","minute","second","millisecond"];function p3(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new x$(t);return e}function AS(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return p3(t)}}function PS(t,e){const n=yi(e.zone,Ze.defaultZone),r=Me.fromObject(e),i=Ze.now();let s,o;if(ce(t.year))s=i;else{for(const u of kE)ce(t[u])&&(t[u]=SE[u]);const l=K$(t)||G$(t);if(l)return se.invalid(l);const a=n.offset(i);[s,o]=Wc(t,a,n)}return new se({ts:s,zone:n,loc:r,o})}function NS(t,e,n){const r=ce(n.round)?!0:n.round,i=(o,l)=>(o=L0(o,r||n.calendary?0:2,!0),e.loc.clone(n).relFormatter(n).format(o,l)),s=o=>n.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(n.unit)return i(s(n.unit),n.unit);for(const o of n.units){const l=s(o);if(Math.abs(l)>=1)return i(l,o)}return i(t>e?-0:0,n.units[n.units.length-1])}function DS(t){let e={},n;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],n=Array.from(t).slice(0,t.length-1)):n=Array.from(t),[e,n]}class se{constructor(e){const n=e.zone||Ze.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new er("invalid input"):null)||(n.isValid?null:fc(n));this.ts=ce(e.ts)?Ze.now():e.ts;let i=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(n))[i,s]=[e.old.c,e.old.o];else{const l=n.offset(this.ts);i=hc(this.ts,l),r=Number.isNaN(i.year)?new er("invalid input"):null,i=r?null:i,s=r?null:l}this._zone=n,this.loc=e.loc||Me.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new se({})}static local(){const[e,n]=DS(arguments),[r,i,s,o,l,a,u]=n;return PS({year:r,month:i,day:s,hour:o,minute:l,second:a,millisecond:u},e)}static utc(){const[e,n]=DS(arguments),[r,i,s,o,l,a,u]=n;return e.zone=Ut.utcInstance,PS({year:r,month:i,day:s,hour:o,minute:l,second:a,millisecond:u},e)}static fromJSDate(e,n={}){const r=HL(e)?e.valueOf():NaN;if(Number.isNaN(r))return se.invalid("invalid input");const i=yi(n.zone,Ze.defaultZone);return i.isValid?new se({ts:r,zone:i,loc:Me.fromObject(n)}):se.invalid(fc(i))}static fromMillis(e,n={}){if(bs(e))return e<-TS||e>TS?se.invalid("Timestamp out of range"):new se({ts:e,zone:yi(n.zone,Ze.defaultZone),loc:Me.fromObject(n)});throw new tn(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,n={}){if(bs(e))return new se({ts:e*1e3,zone:yi(n.zone,Ze.defaultZone),loc:Me.fromObject(n)});throw new tn("fromSeconds requires a numerical input")}static fromObject(e,n={}){e=e||{};const r=yi(n.zone,Ze.defaultZone);if(!r.isValid)return se.invalid(fc(r));const i=Me.fromObject(n),s=Gf(e,AS),{minDaysInFirstWeek:o,startOfWeek:l}=yS(s,i),a=Ze.now(),u=ce(n.specificOffset)?r.offset(a):n.specificOffset,c=!ce(s.ordinal),f=!ce(s.year),h=!ce(s.month)||!ce(s.day),d=f||h,p=s.weekYear||s.weekNumber;if((d||c)&&p)throw new po("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&c)throw new po("Can't mix ordinal dates with month/day");const y=p||s.weekday&&!d;let w,m,g=hc(a,u);y?(w=d3,m=f3,g=qf(g,o,l)):c?(w=m3,m=h3,g=Kd(g)):(w=kE,m=SE);let v=!1;for(const N of w){const V=s[N];ce(V)?v?s[N]=m[N]:s[N]=g[N]:v=!0}const S=y?BL(s,o,l):c?VL(s):K$(s),$=S||G$(s);if($)return se.invalid($);const b=y?pS(s,o,l):c?gS(s):s,[x,_]=Wc(b,u,r),A=new se({ts:x,zone:r,o:_,loc:i});return s.weekday&&d&&e.weekday!==A.weekday?se.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${A.toISO()}`):A}static fromISO(e,n={}){const[r,i]=N4(e);return Il(r,i,n,"ISO 8601",e)}static fromRFC2822(e,n={}){const[r,i]=D4(e);return Il(r,i,n,"RFC 2822",e)}static fromHTTP(e,n={}){const[r,i]=R4(e);return Il(r,i,n,"HTTP",n)}static fromFormat(e,n,r={}){if(ce(e)||ce(n))throw new tn("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:s=null}=r,o=Me.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[l,a,u,c]=c3(o,e,n);return c?se.invalid(c):Il(l,a,r,`format ${n}`,e,u)}static fromString(e,n,r={}){return se.fromFormat(e,n,r)}static fromSQL(e,n={}){const[r,i]=V4(e);return Il(r,i,n,"SQL",e)}static invalid(e,n=null){if(!e)throw new tn("need to specify a reason the DateTime is invalid");const r=e instanceof er?e:new er(e,n);if(Ze.throwOnInvalid)throw new yL(r);return new se({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,n={}){const r=vE(e,Me.fromObject(n));return r?r.map(i=>i?i.val:null).join(""):null}static expandFormat(e,n={}){return gE(Lt.parseFormat(e),Me.fromObject(n)).map(i=>i.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Jd(this).weekYear:NaN}get weekNumber(){return this.isValid?Jd(this).weekNumber:NaN}get weekday(){return this.isValid?Jd(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Zd(this).weekday:NaN}get localWeekNumber(){return this.isValid?Zd(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Zd(this).weekYear:NaN}get ordinal(){return this.isValid?Kd(this.c).ordinal:NaN}get monthShort(){return this.isValid?uc.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?uc.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?uc.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?uc.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,n=6e4,r=Nh(this.c),i=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-i*n),l=this.zone.offset(r-s*n);if(o===l)return[this];const a=r-o*n,u=r-l*n,c=hc(a,o),f=hc(u,l);return c.hour===f.hour&&c.minute===f.minute&&c.second===f.second&&c.millisecond===f.millisecond?[ts(this,{ts:a}),ts(this,{ts:u})]:[this]}get isInLeapYear(){return fu(this.year)}get daysInMonth(){return Kf(this.year,this.month)}get daysInYear(){return this.isValid?Po(this.year):NaN}get weeksInWeekYear(){return this.isValid?Ya(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Ya(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:n,numberingSystem:r,calendar:i}=Lt.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:n,numberingSystem:r,outputCalendar:i}}toUTC(e=0,n={}){return this.setZone(Ut.instance(e),n)}toLocal(){return this.setZone(Ze.defaultZone)}setZone(e,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(e=yi(e,Ze.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(n||r){const s=e.offset(this.ts),o=this.toObject();[i]=Wc(o,s,e)}return ts(this,{ts:i,zone:e})}else return se.invalid(fc(e))}reconfigure({locale:e,numberingSystem:n,outputCalendar:r}={}){const i=this.loc.clone({locale:e,numberingSystem:n,outputCalendar:r});return ts(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const n=Gf(e,AS),{minDaysInFirstWeek:r,startOfWeek:i}=yS(n,this.loc),s=!ce(n.weekYear)||!ce(n.weekNumber)||!ce(n.weekday),o=!ce(n.ordinal),l=!ce(n.year),a=!ce(n.month)||!ce(n.day),u=l||a,c=n.weekYear||n.weekNumber;if((u||o)&&c)throw new po("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new po("Can't mix ordinal dates with month/day");let f;s?f=pS({...qf(this.c,r,i),...n},r,i):ce(n.ordinal)?(f={...this.toObject(),...n},ce(n.day)&&(f.day=Math.min(Kf(f.year,f.month),f.day))):f=gS({...Kd(this.c),...n});const[h,d]=Wc(f,this.o,this.zone);return ts(this,{ts:h,o:d})}plus(e){if(!this.isValid)return this;const n=xe.fromDurationLike(e);return ts(this,_S(this,n))}minus(e){if(!this.isValid)return this;const n=xe.fromDurationLike(e).negate();return ts(this,_S(this,n))}startOf(e,{useLocaleWeeks:n=!1}={}){if(!this.isValid)return this;const r={},i=xe.normalizeUnit(e);switch(i){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(i==="weeks")if(n){const s=this.loc.getStartOfWeek(),{weekday:o}=this;othis.valueOf(),l=o?this:e,a=o?e:this,u=Y4(l,a,s,i);return o?u.negate():u}diffNow(e="milliseconds",n={}){return this.diff(se.now(),e,n)}until(e){return this.isValid?Je.fromDateTimes(this,e):this}hasSame(e,n,r){if(!this.isValid)return!1;const i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(n,r)<=i&&i<=s.endOf(n,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const n=e.base||se.fromObject({},{zone:this.zone}),r=e.padding?thisn.valueOf(),Math.min)}static max(...e){if(!e.every(se.isDateTime))throw new tn("max requires all arguments be DateTimes");return vS(e,n=>n.valueOf(),Math.max)}static fromFormatExplain(e,n,r={}){const{locale:i=null,numberingSystem:s=null}=r,o=Me.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return yE(o,e,n)}static fromStringExplain(e,n,r={}){return se.fromFormatExplain(e,n,r)}static get DATE_SHORT(){return Uf}static get DATE_MED(){return C$}static get DATE_MED_WITH_WEEKDAY(){return SL}static get DATE_FULL(){return $$}static get DATE_HUGE(){return E$}static get TIME_SIMPLE(){return O$}static get TIME_WITH_SECONDS(){return T$}static get TIME_WITH_SHORT_OFFSET(){return _$}static get TIME_WITH_LONG_OFFSET(){return M$}static get TIME_24_SIMPLE(){return A$}static get TIME_24_WITH_SECONDS(){return P$}static get TIME_24_WITH_SHORT_OFFSET(){return N$}static get TIME_24_WITH_LONG_OFFSET(){return D$}static get DATETIME_SHORT(){return R$}static get DATETIME_SHORT_WITH_SECONDS(){return I$}static get DATETIME_MED(){return L$}static get DATETIME_MED_WITH_SECONDS(){return F$}static get DATETIME_MED_WITH_WEEKDAY(){return kL}static get DATETIME_FULL(){return z$}static get DATETIME_FULL_WITH_SECONDS(){return j$}static get DATETIME_HUGE(){return B$}static get DATETIME_HUGE_WITH_SECONDS(){return V$}}function Ll(t){if(se.isDateTime(t))return t;if(t&&t.valueOf&&bs(t.valueOf()))return se.fromJSDate(t);if(t&&typeof t=="object")return se.fromObject(t);throw new tn(`Unknown datetime argument: ${t}, of type ${typeof t}`)}Ze.defaultZone="utc";const g3=/^\d{4}-\d{2}-\d{2}$/,y3=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/,Sr=t=>t==="..",go=t=>g3.test(t),yo=t=>y3.test(t),V0=[];V0.push({name:"/req/core/interval",validateFeature:t=>{var n;const e=(n=t.time)==null?void 0:n.interval;if(e!==void 0&&!Sr(e[0])&&!Sr(e[1])&&se.fromISO(e[0])>se.fromISO(e[1]))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes an "interval" member, the start instant must be earlier than or equal to the end instant.'};if(e!==void 0&&go(e[0])&&yo(e[1]))return{pointer:"/time",message:'If the start is a date, the end SHALL be a date, too, or "..".'};if(e!==void 0&&yo(e[0])&&go(e[1]))return{pointer:"/time",message:'If the start is a timestamp, the end SHALL be a timestamp, too, or "..".'}}});V0.push({name:"/req/core/instant-and-interval",validateFeature:t=>{if(t.time!==null){const{date:e,timestamp:n,interval:r}=t.time;if(e!==void 0&&n!==void 0&&!n.startsWith(e))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes both a "date" and a "timestamp" member, the full-date parts SHALL be identical.'};if(n!==void 0&&r!==void 0){const i=se.fromISO(n),s=i.startOf("day");if((go(r[0])||go(r[1]))&&(!Sr(r[0])&&sse.fromISO(r[1])))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes both a "timestamp" and an "interval" member with start/end dates, the interval SHALL contain the date of the timestamp.'};if((yo(r[0])||yo(r[1]))&&(!Sr(r[0])&&ise.fromISO(r[1])))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes both a "timestamp" and an "interval" member with start/end timestamps, the interval SHALL contain the timestamp.'}}if(e!==void 0&&r!==void 0){const i=se.fromISO(e);if((go(r[0])||go(r[1]))&&(!Sr(r[0])&&ise.fromISO(r[1])))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes both a "date" and an "interval" member with start/end dates, the interval SHALL contain the date.'};if((yo(r[0])||yo(r[1]))&&(!Sr(r[0])&&ise.fromISO(r[1]).startOf("day")))return{pointer:"/time",message:'If the "time" object in any JSON-FG feature in the JSON document includes both a "date" and an "interval" member with start/end timestamps, the interval SHALL include timestamps on the date.'}}}}});const v3="http://www.opengis.net/spec/json-fg-1/0.2/conf/types-schemas",w3="[ogc-json-fg-1-0.2:types-schemas]",vo=t=>t.conformsTo!==void 0&&(t.conformsTo.includes(v3)||t.conformsTo.includes(w3)),W0=[];W0.push({name:"/req/types-schemas/metadata",validateFeature:(t,e)=>{if(e&&t.featureType!==void 0&&!vo(t))return{pointer:"/conformsTo",message:'When the "featureType" member is present, the "conformsTo" member of the JSON document SHALL include at least the Feature Types and Schemas conformance class.'}},validateFeatureCollection:t=>{if((t.featureType!==void 0||t.features.some(e=>e.featureType!==void 0))&&!vo(t))return{pointer:"/conformsTo",message:'When the "featureType" member is present, the "conformsTo" member of the JSON document SHALL include at least the Feature Types and Schemas conformance class.'}}});W0.push({name:"/req/types-schemas/feature-type",validateFeature:(t,e)=>{if(e&&vo(t)&&t.featureType===void 0)return{pointer:"/conformsTo",message:'When the document conforms to the Feature Types and Schemas conformance class, the "featureType" member must be present.'}},validateFeatureCollection:t=>{if(vo(t)&&t.featureType===void 0&&t.features.every(e=>e.featureType===void 0))return{pointer:"/conformsTo",message:'When the document conforms to the Feature Types and Schemas conformance class, the "featureType" member must be present in either the collection or in every individual feature.'};if(vo(t)&&t.featureType!==void 0&&t.features.some(e=>e.featureType!==void 0))return{pointer:"/conformsTo",message:'When the document contains a "featureType" member, individual members may not contain a "featureType" member.'};if(vo(t)&&t.featureType===void 0&&t.features.some(e=>e.featureType!==void 0)&&!t.features.every(e=>e.featureType!==void 0))return{pointer:"/conformsTo",message:'When the document does not contain a "featureType" member, every individual feature must contain a "featureType" member.'}}});const S3=[...b$,...V0,...uu,...k$,...W0],k3=(t,e)=>{var r,i,s;const n=[];if(e.type===Gp.FEATURE){const o=(r=t.validateFeature)==null?void 0:r.call(void 0,e,!0);o&&n.push(o)}if(e.type===Gp.FEATURECOLLECTION){const o=(i=t.validateFeatureCollection)==null?void 0:i.call(void 0,e);o&&n.push(o),(s=e.features)==null||s.forEach((l,a)=>{var c;const u=(c=t.validateFeature)==null?void 0:c.call(void 0,l,!1);u&&n.push({...u,pointer:"/features/"+a+u.pointer})})}return n},b3=d$(t=>{const e=t.state.doc.toString(),n=JSON.parse(e),r=S$(t.state),i=[];return S3.forEach(s=>{k3(s,n).forEach(l=>{const a=r.get(l.pointer);i.push({from:a.valueFrom,to:a.valueTo,severity:"error",message:l.message})})}),i});var tg={exports:{}},bE={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(A,N){return{validate:A,compare:N}}t.fullFormats={date:e(s,o),time:e(a,u),"date-time":e(f,h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:y,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:_,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:m,int32:{type:"number",validate:S},int64:{type:"number",validate:$},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);function n(A){return A%4===0&&(A%100!==0||A%400===0)}const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(A){const N=r.exec(A);if(!N)return!1;const V=+N[1],B=+N[2],te=+N[3];return B>=1&&B<=12&&te>=1&&te<=(B===2&&n(V)?29:i[B])}function o(A,N){if(A&&N)return A>N?1:AN?1:A=g}function $(A){return Number.isInteger(A)}function b(){return!0}const x=/[^\\]\\Z/;function _(A){if(x.test(A))return!1;try{return new RegExp(A),!0}catch{return!1}}})(bE);var xE={},ng={exports:{}},H0={},jn={},Yo={},mu={},ae={},Ja={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends e{constructor(g){if(super(),!t.IDENTIFIER.test(g))throw new Error("CodeGen: name must be a valid identifier");this.str=g}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class r extends e{constructor(g){super(),this._items=typeof g=="string"?[g]:g}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const g=this._items[0];return g===""||g==='""'}get str(){var g;return(g=this._str)!==null&&g!==void 0?g:this._str=this._items.reduce((v,S)=>`${v}${S}`,"")}get names(){var g;return(g=this._names)!==null&&g!==void 0?g:this._names=this._items.reduce((v,S)=>(S instanceof n&&(v[S.str]=(v[S.str]||0)+1),v),{})}}t._Code=r,t.nil=new r("");function i(m,...g){const v=[m[0]];let S=0;for(;S{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,e._)`${u}${f.scopePath}`})}scopeCode(u=this._values,c,f){return this._reduceValues(u,h=>{if(h.value===void 0)throw new Error(`CodeGen: name "${h}" has no value`);return h.value.code},c,f)}_reduceValues(u,c,f={},h){let d=e.nil;for(const p in u){const y=u[p];if(!y)continue;const w=f[p]=f[p]||new Map;y.forEach(m=>{if(w.has(m))return;w.set(m,r.Started);let g=c(m);if(g){const v=this.opts.es5?t.varKinds.var:t.varKinds.const;d=(0,e._)`${d}${v} ${m} = ${g};${this.opts._n}`}else if(g=h==null?void 0:h(m))d=(0,e._)`${d}${g}${this.opts._n}`;else throw new n(m);w.set(m,r.Completed)})}return d}}t.ValueScope=l})(rg);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=Ja,n=rg;var r=Ja;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var i=rg;Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class s{optimizeNodes(){return this}optimizeNames(k,E){return this}}class o extends s{constructor(k,E,L){super(),this.varKind=k,this.name=E,this.rhs=L}render({es5:k,_n:E}){const L=k?n.varKinds.var:this.varKind,q=this.rhs===void 0?"":` = ${this.rhs}`;return`${L} ${this.name}${q};`+E}optimizeNames(k,E){if(k[this.name.str])return this.rhs&&(this.rhs=Q(this.rhs,k,E)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class l extends s{constructor(k,E,L){super(),this.lhs=k,this.rhs=E,this.sideEffects=L}render({_n:k}){return`${this.lhs} = ${this.rhs};`+k}optimizeNames(k,E){if(!(this.lhs instanceof e.Name&&!k[this.lhs.str]&&!this.sideEffects))return this.rhs=Q(this.rhs,k,E),this}get names(){const k=this.lhs instanceof e.Name?{}:{...this.lhs.names};return te(k,this.rhs)}}class a extends l{constructor(k,E,L,q){super(k,L,q),this.op=E}render({_n:k}){return`${this.lhs} ${this.op}= ${this.rhs};`+k}}class u extends s{constructor(k){super(),this.label=k,this.names={}}render({_n:k}){return`${this.label}:`+k}}class c extends s{constructor(k){super(),this.label=k,this.names={}}render({_n:k}){return`break${this.label?` ${this.label}`:""};`+k}}class f extends s{constructor(k){super(),this.error=k}render({_n:k}){return`throw ${this.error};`+k}get names(){return this.error.names}}class h extends s{constructor(k){super(),this.code=k}render({_n:k}){return`${this.code};`+k}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(k,E){return this.code=Q(this.code,k,E),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class d extends s{constructor(k=[]){super(),this.nodes=k}render(k){return this.nodes.reduce((E,L)=>E+L.render(k),"")}optimizeNodes(){const{nodes:k}=this;let E=k.length;for(;E--;){const L=k[E].optimizeNodes();Array.isArray(L)?k.splice(E,1,...L):L?k[E]=L:k.splice(E,1)}return k.length>0?this:void 0}optimizeNames(k,E){const{nodes:L}=this;let q=L.length;for(;q--;){const Z=L[q];Z.optimizeNames(k,E)||(fe(k,Z.names),L.splice(q,1))}return L.length>0?this:void 0}get names(){return this.nodes.reduce((k,E)=>B(k,E.names),{})}}class p extends d{render(k){return"{"+k._n+super.render(k)+"}"+k._n}}class y extends d{}class w extends p{}w.kind="else";class m extends p{constructor(k,E){super(E),this.condition=k}render(k){let E=`if(${this.condition})`+super.render(k);return this.else&&(E+="else "+this.else.render(k)),E}optimizeNodes(){super.optimizeNodes();const k=this.condition;if(k===!0)return this.nodes;let E=this.else;if(E){const L=E.optimizeNodes();E=this.else=Array.isArray(L)?new w(L):L}if(E)return k===!1?E instanceof m?E:E.nodes:this.nodes.length?this:new m(Ee(k),E instanceof m?[E]:E.nodes);if(!(k===!1||!this.nodes.length))return this}optimizeNames(k,E){var L;if(this.else=(L=this.else)===null||L===void 0?void 0:L.optimizeNames(k,E),!!(super.optimizeNames(k,E)||this.else))return this.condition=Q(this.condition,k,E),this}get names(){const k=super.names;return te(k,this.condition),this.else&&B(k,this.else.names),k}}m.kind="if";class g extends p{}g.kind="for";class v extends g{constructor(k){super(),this.iteration=k}render(k){return`for(${this.iteration})`+super.render(k)}optimizeNames(k,E){if(super.optimizeNames(k,E))return this.iteration=Q(this.iteration,k,E),this}get names(){return B(super.names,this.iteration.names)}}class S extends g{constructor(k,E,L,q){super(),this.varKind=k,this.name=E,this.from=L,this.to=q}render(k){const E=k.es5?n.varKinds.var:this.varKind,{name:L,from:q,to:Z}=this;return`for(${E} ${L}=${q}; ${L}<${Z}; ${L}++)`+super.render(k)}get names(){const k=te(super.names,this.from);return te(k,this.to)}}class $ extends g{constructor(k,E,L,q){super(),this.loop=k,this.varKind=E,this.name=L,this.iterable=q}render(k){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(k)}optimizeNames(k,E){if(super.optimizeNames(k,E))return this.iterable=Q(this.iterable,k,E),this}get names(){return B(super.names,this.iterable.names)}}class b extends p{constructor(k,E,L){super(),this.name=k,this.args=E,this.async=L}render(k){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(k)}}b.kind="func";class x extends d{render(k){return"return "+super.render(k)}}x.kind="return";class _ extends p{render(k){let E="try"+super.render(k);return this.catch&&(E+=this.catch.render(k)),this.finally&&(E+=this.finally.render(k)),E}optimizeNodes(){var k,E;return super.optimizeNodes(),(k=this.catch)===null||k===void 0||k.optimizeNodes(),(E=this.finally)===null||E===void 0||E.optimizeNodes(),this}optimizeNames(k,E){var L,q;return super.optimizeNames(k,E),(L=this.catch)===null||L===void 0||L.optimizeNames(k,E),(q=this.finally)===null||q===void 0||q.optimizeNames(k,E),this}get names(){const k=super.names;return this.catch&&B(k,this.catch.names),this.finally&&B(k,this.finally.names),k}}class A extends p{constructor(k){super(),this.error=k}render(k){return`catch(${this.error})`+super.render(k)}}A.kind="catch";class N extends p{render(k){return"finally"+super.render(k)}}N.kind="finally";class V{constructor(k,E={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...E,_n:E.lines?` +`:""},this._extScope=k,this._scope=new n.Scope({parent:k}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(k){return this._scope.name(k)}scopeName(k){return this._extScope.name(k)}scopeValue(k,E){const L=this._extScope.value(k,E);return(this._values[L.prefix]||(this._values[L.prefix]=new Set)).add(L),L}getScopeValue(k,E){return this._extScope.getValue(k,E)}scopeRefs(k){return this._extScope.scopeRefs(k,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(k,E,L,q){const Z=this._scope.toName(E);return L!==void 0&&q&&(this._constants[Z.str]=L),this._leafNode(new o(k,Z,L)),Z}const(k,E,L){return this._def(n.varKinds.const,k,E,L)}let(k,E,L){return this._def(n.varKinds.let,k,E,L)}var(k,E,L){return this._def(n.varKinds.var,k,E,L)}assign(k,E,L){return this._leafNode(new l(k,E,L))}add(k,E){return this._leafNode(new a(k,t.operators.ADD,E))}code(k){return typeof k=="function"?k():k!==e.nil&&this._leafNode(new h(k)),this}object(...k){const E=["{"];for(const[L,q]of k)E.length>1&&E.push(","),E.push(L),(L!==q||this.opts.es5)&&(E.push(":"),(0,e.addCodeArg)(E,q));return E.push("}"),new e._Code(E)}if(k,E,L){if(this._blockNode(new m(k)),E&&L)this.code(E).else().code(L).endIf();else if(E)this.code(E).endIf();else if(L)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(k){return this._elseNode(new m(k))}else(){return this._elseNode(new w)}endIf(){return this._endBlockNode(m,w)}_for(k,E){return this._blockNode(k),E&&this.code(E).endFor(),this}for(k,E){return this._for(new v(k),E)}forRange(k,E,L,q,Z=this.opts.es5?n.varKinds.var:n.varKinds.let){const ye=this._scope.toName(k);return this._for(new S(Z,ye,E,L),()=>q(ye))}forOf(k,E,L,q=n.varKinds.const){const Z=this._scope.toName(k);if(this.opts.es5){const ye=E instanceof e.Name?E:this.var("_arr",E);return this.forRange("_i",0,(0,e._)`${ye}.length`,Se=>{this.var(Z,(0,e._)`${ye}[${Se}]`),L(Z)})}return this._for(new $("of",q,Z,E),()=>L(Z))}forIn(k,E,L,q=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(k,(0,e._)`Object.keys(${E})`,L);const Z=this._scope.toName(k);return this._for(new $("in",q,Z,E),()=>L(Z))}endFor(){return this._endBlockNode(g)}label(k){return this._leafNode(new u(k))}break(k){return this._leafNode(new c(k))}return(k){const E=new x;if(this._blockNode(E),this.code(k),E.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(x)}try(k,E,L){if(!E&&!L)throw new Error('CodeGen: "try" without "catch" and "finally"');const q=new _;if(this._blockNode(q),this.code(k),E){const Z=this.name("e");this._currNode=q.catch=new A(Z),E(Z)}return L&&(this._currNode=q.finally=new N,this.code(L)),this._endBlockNode(A,N)}throw(k){return this._leafNode(new f(k))}block(k,E){return this._blockStarts.push(this._nodes.length),k&&this.code(k).endBlock(E),this}endBlock(k){const E=this._blockStarts.pop();if(E===void 0)throw new Error("CodeGen: not in self-balancing block");const L=this._nodes.length-E;if(L<0||k!==void 0&&L!==k)throw new Error(`CodeGen: wrong number of nodes: ${L} vs ${k} expected`);return this._nodes.length=E,this}func(k,E=e.nil,L,q){return this._blockNode(new b(k,E,L)),q&&this.code(q).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(k=1){for(;k-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(k){return this._currNode.nodes.push(k),this}_blockNode(k){this._currNode.nodes.push(k),this._nodes.push(k)}_endBlockNode(k,E){const L=this._currNode;if(L instanceof k||E&&L instanceof E)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${E?`${k.kind}/${E.kind}`:k.kind}"`)}_elseNode(k){const E=this._currNode;if(!(E instanceof m))throw new Error('CodeGen: "else" without "if"');return this._currNode=E.else=k,this}get _root(){return this._nodes[0]}get _currNode(){const k=this._nodes;return k[k.length-1]}set _currNode(k){const E=this._nodes;E[E.length-1]=k}}t.CodeGen=V;function B(P,k){for(const E in k)P[E]=(P[E]||0)+(k[E]||0);return P}function te(P,k){return k instanceof e._CodeOrName?B(P,k.names):P}function Q(P,k,E){if(P instanceof e.Name)return L(P);if(!q(P))return P;return new e._Code(P._items.reduce((Z,ye)=>(ye instanceof e.Name&&(ye=L(ye)),ye instanceof e._Code?Z.push(...ye._items):Z.push(ye),Z),[]));function L(Z){const ye=E[Z.str];return ye===void 0||k[Z.str]!==1?Z:(delete k[Z.str],ye)}function q(Z){return Z instanceof e._Code&&Z._items.some(ye=>ye instanceof e.Name&&k[ye.str]===1&&E[ye.str]!==void 0)}}function fe(P,k){for(const E in k)P[E]=(P[E]||0)-(k[E]||0)}function Ee(P){return typeof P=="boolean"||typeof P=="number"||P===null?!P:(0,e._)`!${F(P)}`}t.not=Ee;const pe=M(t.operators.AND);function H(...P){return P.reduce(pe)}t.and=H;const Y=M(t.operators.OR);function I(...P){return P.reduce(Y)}t.or=I;function M(P){return(k,E)=>k===e.nil?E:E===e.nil?k:(0,e._)`${F(k)} ${P} ${F(E)}`}function F(P){return P instanceof e.Name?P:(0,e._)`(${P})`}})(ae);var ge={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const e=ae,n=Ja;function r(b){const x={};for(const _ of b)x[_]=!0;return x}t.toHash=r;function i(b,x){return typeof x=="boolean"?x:Object.keys(x).length===0?!0:(s(b,x),!o(x,b.self.RULES.all))}t.alwaysValidSchema=i;function s(b,x=b.schema){const{opts:_,self:A}=b;if(!_.strictSchema||typeof x=="boolean")return;const N=A.RULES.keywords;for(const V in x)N[V]||$(b,`unknown keyword: "${V}"`)}t.checkUnknownRules=s;function o(b,x){if(typeof b=="boolean")return!b;for(const _ in b)if(x[_])return!0;return!1}t.schemaHasRules=o;function l(b,x){if(typeof b=="boolean")return!b;for(const _ in b)if(_!=="$ref"&&x.all[_])return!0;return!1}t.schemaHasRulesButRef=l;function a({topSchemaRef:b,schemaPath:x},_,A,N){if(!N){if(typeof _=="number"||typeof _=="boolean")return _;if(typeof _=="string")return(0,e._)`${_}`}return(0,e._)`${b}${x}${(0,e.getProperty)(A)}`}t.schemaRefOrVal=a;function u(b){return h(decodeURIComponent(b))}t.unescapeFragment=u;function c(b){return encodeURIComponent(f(b))}t.escapeFragment=c;function f(b){return typeof b=="number"?`${b}`:b.replace(/~/g,"~0").replace(/\//g,"~1")}t.escapeJsonPointer=f;function h(b){return b.replace(/~1/g,"/").replace(/~0/g,"~")}t.unescapeJsonPointer=h;function d(b,x){if(Array.isArray(b))for(const _ of b)x(_);else x(b)}t.eachItem=d;function p({mergeNames:b,mergeToName:x,mergeValues:_,resultToName:A}){return(N,V,B,te)=>{const Q=B===void 0?V:B instanceof e.Name?(V instanceof e.Name?b(N,V,B):x(N,V,B),B):V instanceof e.Name?(x(N,B,V),V):_(V,B);return te===e.Name&&!(Q instanceof e.Name)?A(N,Q):Q}}t.mergeEvaluated={props:p({mergeNames:(b,x,_)=>b.if((0,e._)`${_} !== true && ${x} !== undefined`,()=>{b.if((0,e._)`${x} === true`,()=>b.assign(_,!0),()=>b.assign(_,(0,e._)`${_} || {}`).code((0,e._)`Object.assign(${_}, ${x})`))}),mergeToName:(b,x,_)=>b.if((0,e._)`${_} !== true`,()=>{x===!0?b.assign(_,!0):(b.assign(_,(0,e._)`${_} || {}`),w(b,_,x))}),mergeValues:(b,x)=>b===!0?!0:{...b,...x},resultToName:y}),items:p({mergeNames:(b,x,_)=>b.if((0,e._)`${_} !== true && ${x} !== undefined`,()=>b.assign(_,(0,e._)`${x} === true ? true : ${_} > ${x} ? ${_} : ${x}`)),mergeToName:(b,x,_)=>b.if((0,e._)`${_} !== true`,()=>b.assign(_,x===!0?!0:(0,e._)`${_} > ${x} ? ${_} : ${x}`)),mergeValues:(b,x)=>b===!0?!0:Math.max(b,x),resultToName:(b,x)=>b.var("items",x)})};function y(b,x){if(x===!0)return b.var("props",!0);const _=b.var("props",(0,e._)`{}`);return x!==void 0&&w(b,_,x),_}t.evaluatedPropsToName=y;function w(b,x,_){Object.keys(_).forEach(A=>b.assign((0,e._)`${x}${(0,e.getProperty)(A)}`,!0))}t.setEvaluated=w;const m={};function g(b,x){return b.scopeValue("func",{ref:x,code:m[x.code]||(m[x.code]=new n._Code(x.code))})}t.useFunc=g;var v;(function(b){b[b.Num=0]="Num",b[b.Str=1]="Str"})(v=t.Type||(t.Type={}));function S(b,x,_){if(b instanceof e.Name){const A=x===v.Num;return _?A?(0,e._)`"[" + ${b} + "]"`:(0,e._)`"['" + ${b} + "']"`:A?(0,e._)`"/" + ${b}`:(0,e._)`"/" + ${b}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return _?(0,e.getProperty)(b).toString():"/"+f(b)}t.getErrorPath=S;function $(b,x,_=b.opts.strictSchema){if(_){if(x=`strict mode: ${x}`,_===!0)throw new Error(x);b.self.logger.warn(x)}}t.checkStrictMode=$})(ge);var Cn={};Object.defineProperty(Cn,"__esModule",{value:!0});const Nt=ae,x3={data:new Nt.Name("data"),valCxt:new Nt.Name("valCxt"),instancePath:new Nt.Name("instancePath"),parentData:new Nt.Name("parentData"),parentDataProperty:new Nt.Name("parentDataProperty"),rootData:new Nt.Name("rootData"),dynamicAnchors:new Nt.Name("dynamicAnchors"),vErrors:new Nt.Name("vErrors"),errors:new Nt.Name("errors"),this:new Nt.Name("this"),self:new Nt.Name("self"),scope:new Nt.Name("scope"),json:new Nt.Name("json"),jsonPos:new Nt.Name("jsonPos"),jsonLen:new Nt.Name("jsonLen"),jsonPart:new Nt.Name("jsonPart")};Cn.default=x3;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=ae,n=ge,r=Cn;t.keywordError={message:({keyword:w})=>(0,e.str)`must pass "${w}" keyword validation`},t.keyword$DataError={message:({keyword:w,schemaType:m})=>m?(0,e.str)`"${w}" keyword must be ${m} ($data)`:(0,e.str)`"${w}" keyword is invalid ($data)`};function i(w,m=t.keywordError,g,v){const{it:S}=w,{gen:$,compositeRule:b,allErrors:x}=S,_=f(w,m,g);v??(b||x)?a($,_):u(S,(0,e._)`[${_}]`)}t.reportError=i;function s(w,m=t.keywordError,g){const{it:v}=w,{gen:S,compositeRule:$,allErrors:b}=v,x=f(w,m,g);a(S,x),$||b||u(v,r.default.vErrors)}t.reportExtraError=s;function o(w,m){w.assign(r.default.errors,m),w.if((0,e._)`${r.default.vErrors} !== null`,()=>w.if(m,()=>w.assign((0,e._)`${r.default.vErrors}.length`,m),()=>w.assign(r.default.vErrors,null)))}t.resetErrorsCount=o;function l({gen:w,keyword:m,schemaValue:g,data:v,errsCount:S,it:$}){if(S===void 0)throw new Error("ajv implementation error");const b=w.name("err");w.forRange("i",S,r.default.errors,x=>{w.const(b,(0,e._)`${r.default.vErrors}[${x}]`),w.if((0,e._)`${b}.instancePath === undefined`,()=>w.assign((0,e._)`${b}.instancePath`,(0,e.strConcat)(r.default.instancePath,$.errorPath))),w.assign((0,e._)`${b}.schemaPath`,(0,e.str)`${$.errSchemaPath}/${m}`),$.opts.verbose&&(w.assign((0,e._)`${b}.schema`,g),w.assign((0,e._)`${b}.data`,v))})}t.extendErrors=l;function a(w,m){const g=w.const("err",m);w.if((0,e._)`${r.default.vErrors} === null`,()=>w.assign(r.default.vErrors,(0,e._)`[${g}]`),(0,e._)`${r.default.vErrors}.push(${g})`),w.code((0,e._)`${r.default.errors}++`)}function u(w,m){const{gen:g,validateName:v,schemaEnv:S}=w;S.$async?g.throw((0,e._)`new ${w.ValidationError}(${m})`):(g.assign((0,e._)`${v}.errors`,m),g.return(!1))}const c={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function f(w,m,g){const{createErrors:v}=w.it;return v===!1?(0,e._)`{}`:h(w,m,g)}function h(w,m,g={}){const{gen:v,it:S}=w,$=[d(S,g),p(w,g)];return y(w,m,$),v.object(...$)}function d({errorPath:w},{instancePath:m}){const g=m?(0,e.str)`${w}${(0,n.getErrorPath)(m,n.Type.Str)}`:w;return[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,g)]}function p({keyword:w,it:{errSchemaPath:m}},{schemaPath:g,parentSchema:v}){let S=v?m:(0,e.str)`${m}/${w}`;return g&&(S=(0,e.str)`${S}${(0,n.getErrorPath)(g,n.Type.Str)}`),[c.schemaPath,S]}function y(w,{params:m,message:g},v){const{keyword:S,data:$,schemaValue:b,it:x}=w,{opts:_,propertyName:A,topSchemaRef:N,schemaPath:V}=x;v.push([c.keyword,S],[c.params,typeof m=="function"?m(w):m||(0,e._)`{}`]),_.messages&&v.push([c.message,typeof g=="function"?g(w):g]),_.verbose&&v.push([c.schema,b],[c.parentSchema,(0,e._)`${N}${V}`],[r.default.data,$]),A&&v.push([c.propertyName,A])}})(mu);Object.defineProperty(Yo,"__esModule",{value:!0});Yo.boolOrEmptySchema=Yo.topBoolOrEmptySchema=void 0;const C3=mu,$3=ae,E3=Cn,O3={message:"boolean schema is false"};function T3(t){const{gen:e,schema:n,validateName:r}=t;n===!1?CE(t,!1):typeof n=="object"&&n.$async===!0?e.return(E3.default.data):(e.assign((0,$3._)`${r}.errors`,null),e.return(!0))}Yo.topBoolOrEmptySchema=T3;function _3(t,e){const{gen:n,schema:r}=t;r===!1?(n.var(e,!1),CE(t)):n.var(e,!0)}Yo.boolOrEmptySchema=_3;function CE(t,e){const{gen:n,data:r}=t,i={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,C3.reportError)(i,O3,void 0,e)}var pu={},Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});Ps.getRules=Ps.isJSONType=void 0;const M3=["string","number","integer","boolean","null","object","array"],A3=new Set(M3);function P3(t){return typeof t=="string"&&A3.has(t)}Ps.isJSONType=P3;function N3(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Ps.getRules=N3;var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.shouldUseRule=Vr.shouldUseGroup=Vr.schemaHasRulesForType=void 0;function D3({schema:t,self:e},n){const r=e.RULES.types[n];return r&&r!==!0&&$E(t,r)}Vr.schemaHasRulesForType=D3;function $E(t,e){return e.rules.some(n=>EE(t,n))}Vr.shouldUseGroup=$E;function EE(t,e){var n;return t[e.keyword]!==void 0||((n=e.definition.implements)===null||n===void 0?void 0:n.some(r=>t[r]!==void 0))}Vr.shouldUseRule=EE;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const e=Ps,n=Vr,r=mu,i=ae,s=ge;var o;(function(v){v[v.Correct=0]="Correct",v[v.Wrong=1]="Wrong"})(o=t.DataType||(t.DataType={}));function l(v){const S=a(v.type);if(S.includes("null")){if(v.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!S.length&&v.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');v.nullable===!0&&S.push("null")}return S}t.getSchemaTypes=l;function a(v){const S=Array.isArray(v)?v:v?[v]:[];if(S.every(e.isJSONType))return S;throw new Error("type must be JSONType or JSONType[]: "+S.join(","))}t.getJSONTypes=a;function u(v,S){const{gen:$,data:b,opts:x}=v,_=f(S,x.coerceTypes),A=S.length>0&&!(_.length===0&&S.length===1&&(0,n.schemaHasRulesForType)(v,S[0]));if(A){const N=y(S,b,x.strictNumbers,o.Wrong);$.if(N,()=>{_.length?h(v,S,_):m(v)})}return A}t.coerceAndCheckDataType=u;const c=new Set(["string","number","integer","boolean","null"]);function f(v,S){return S?v.filter($=>c.has($)||S==="array"&&$==="array"):[]}function h(v,S,$){const{gen:b,data:x,opts:_}=v,A=b.let("dataType",(0,i._)`typeof ${x}`),N=b.let("coerced",(0,i._)`undefined`);_.coerceTypes==="array"&&b.if((0,i._)`${A} == 'object' && Array.isArray(${x}) && ${x}.length == 1`,()=>b.assign(x,(0,i._)`${x}[0]`).assign(A,(0,i._)`typeof ${x}`).if(y(S,x,_.strictNumbers),()=>b.assign(N,x))),b.if((0,i._)`${N} !== undefined`);for(const B of $)(c.has(B)||B==="array"&&_.coerceTypes==="array")&&V(B);b.else(),m(v),b.endIf(),b.if((0,i._)`${N} !== undefined`,()=>{b.assign(x,N),d(v,N)});function V(B){switch(B){case"string":b.elseIf((0,i._)`${A} == "number" || ${A} == "boolean"`).assign(N,(0,i._)`"" + ${x}`).elseIf((0,i._)`${x} === null`).assign(N,(0,i._)`""`);return;case"number":b.elseIf((0,i._)`${A} == "boolean" || ${x} === null + || (${A} == "string" && ${x} && ${x} == +${x})`).assign(N,(0,i._)`+${x}`);return;case"integer":b.elseIf((0,i._)`${A} === "boolean" || ${x} === null + || (${A} === "string" && ${x} && ${x} == +${x} && !(${x} % 1))`).assign(N,(0,i._)`+${x}`);return;case"boolean":b.elseIf((0,i._)`${x} === "false" || ${x} === 0 || ${x} === null`).assign(N,!1).elseIf((0,i._)`${x} === "true" || ${x} === 1`).assign(N,!0);return;case"null":b.elseIf((0,i._)`${x} === "" || ${x} === 0 || ${x} === false`),b.assign(N,null);return;case"array":b.elseIf((0,i._)`${A} === "string" || ${A} === "number" + || ${A} === "boolean" || ${x} === null`).assign(N,(0,i._)`[${x}]`)}}}function d({gen:v,parentData:S,parentDataProperty:$},b){v.if((0,i._)`${S} !== undefined`,()=>v.assign((0,i._)`${S}[${$}]`,b))}function p(v,S,$,b=o.Correct){const x=b===o.Correct?i.operators.EQ:i.operators.NEQ;let _;switch(v){case"null":return(0,i._)`${S} ${x} null`;case"array":_=(0,i._)`Array.isArray(${S})`;break;case"object":_=(0,i._)`${S} && typeof ${S} == "object" && !Array.isArray(${S})`;break;case"integer":_=A((0,i._)`!(${S} % 1) && !isNaN(${S})`);break;case"number":_=A();break;default:return(0,i._)`typeof ${S} ${x} ${v}`}return b===o.Correct?_:(0,i.not)(_);function A(N=i.nil){return(0,i.and)((0,i._)`typeof ${S} == "number"`,N,$?(0,i._)`isFinite(${S})`:i.nil)}}t.checkDataType=p;function y(v,S,$,b){if(v.length===1)return p(v[0],S,$,b);let x;const _=(0,s.toHash)(v);if(_.array&&_.object){const A=(0,i._)`typeof ${S} != "object"`;x=_.null?A:(0,i._)`!${S} || ${A}`,delete _.null,delete _.array,delete _.object}else x=i.nil;_.number&&delete _.integer;for(const A in _)x=(0,i.and)(x,p(A,S,$,b));return x}t.checkDataTypes=y;const w={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:S})=>typeof v=="string"?(0,i._)`{type: ${v}}`:(0,i._)`{type: ${S}}`};function m(v){const S=g(v);(0,r.reportError)(S,w)}t.reportTypeError=m;function g(v){const{gen:S,data:$,schema:b}=v,x=(0,s.schemaRefOrVal)(v,b,"type");return{gen:S,keyword:"type",data:$,schema:b.type,schemaCode:x,schemaValue:x,parentSchema:b,params:{},it:v}}})(pu);var Ih={};Object.defineProperty(Ih,"__esModule",{value:!0});Ih.assignDefaults=void 0;const Gs=ae,R3=ge;function I3(t,e){const{properties:n,items:r}=t.schema;if(e==="object"&&n)for(const i in n)RS(t,i,n[i].default);else e==="array"&&Array.isArray(r)&&r.forEach((i,s)=>RS(t,s,i.default))}Ih.assignDefaults=I3;function RS(t,e,n){const{gen:r,compositeRule:i,data:s,opts:o}=t;if(n===void 0)return;const l=(0,Gs._)`${s}${(0,Gs.getProperty)(e)}`;if(i){(0,R3.checkStrictMode)(t,`default is ignored for: ${l}`);return}let a=(0,Gs._)`${l} === undefined`;o.useDefaults==="empty"&&(a=(0,Gs._)`${a} || ${l} === null || ${l} === ""`),r.if(a,(0,Gs._)`${l} = ${(0,Gs.stringify)(n)}`)}var Tr={},de={};Object.defineProperty(de,"__esModule",{value:!0});de.validateUnion=de.validateArray=de.usePattern=de.callValidateCode=de.schemaProperties=de.allSchemaProperties=de.noPropertyInData=de.propertyInData=de.isOwnProperty=de.hasPropFunc=de.reportMissingProp=de.checkMissingProp=de.checkReportMissingProp=void 0;const Fe=ae,U0=ge,oi=Cn,L3=ge;function F3(t,e){const{gen:n,data:r,it:i}=t;n.if(K0(n,r,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Fe._)`${e}`},!0),t.error()})}de.checkReportMissingProp=F3;function z3({gen:t,data:e,it:{opts:n}},r,i){return(0,Fe.or)(...r.map(s=>(0,Fe.and)(K0(t,e,s,n.ownProperties),(0,Fe._)`${i} = ${s}`)))}de.checkMissingProp=z3;function j3(t,e){t.setParams({missingProperty:e},!0),t.error()}de.reportMissingProp=j3;function OE(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Fe._)`Object.prototype.hasOwnProperty`})}de.hasPropFunc=OE;function q0(t,e,n){return(0,Fe._)`${OE(t)}.call(${e}, ${n})`}de.isOwnProperty=q0;function B3(t,e,n,r){const i=(0,Fe._)`${e}${(0,Fe.getProperty)(n)} !== undefined`;return r?(0,Fe._)`${i} && ${q0(t,e,n)}`:i}de.propertyInData=B3;function K0(t,e,n,r){const i=(0,Fe._)`${e}${(0,Fe.getProperty)(n)} === undefined`;return r?(0,Fe.or)(i,(0,Fe.not)(q0(t,e,n))):i}de.noPropertyInData=K0;function TE(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}de.allSchemaProperties=TE;function V3(t,e){return TE(e).filter(n=>!(0,U0.alwaysValidSchema)(t,e[n]))}de.schemaProperties=V3;function W3({schemaCode:t,data:e,it:{gen:n,topSchemaRef:r,schemaPath:i,errorPath:s},it:o},l,a,u){const c=u?(0,Fe._)`${t}, ${e}, ${r}${i}`:e,f=[[oi.default.instancePath,(0,Fe.strConcat)(oi.default.instancePath,s)],[oi.default.parentData,o.parentData],[oi.default.parentDataProperty,o.parentDataProperty],[oi.default.rootData,oi.default.rootData]];o.opts.dynamicRef&&f.push([oi.default.dynamicAnchors,oi.default.dynamicAnchors]);const h=(0,Fe._)`${c}, ${n.object(...f)}`;return a!==Fe.nil?(0,Fe._)`${l}.call(${a}, ${h})`:(0,Fe._)`${l}(${h})`}de.callValidateCode=W3;const H3=(0,Fe._)`new RegExp`;function U3({gen:t,it:{opts:e}},n){const r=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(n,r);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Fe._)`${i.code==="new RegExp"?H3:(0,L3.useFunc)(t,i)}(${n}, ${r})`})}de.usePattern=U3;function q3(t){const{gen:e,data:n,keyword:r,it:i}=t,s=e.name("valid");if(i.allErrors){const l=e.let("valid",!0);return o(()=>e.assign(l,!1)),l}return e.var(s,!0),o(()=>e.break()),s;function o(l){const a=e.const("len",(0,Fe._)`${n}.length`);e.forRange("i",0,a,u=>{t.subschema({keyword:r,dataProp:u,dataPropType:U0.Type.Num},s),e.if((0,Fe.not)(s),l)})}}de.validateArray=q3;function K3(t){const{gen:e,schema:n,keyword:r,it:i}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(a=>(0,U0.alwaysValidSchema)(i,a))&&!i.opts.unevaluated)return;const o=e.let("valid",!1),l=e.name("_valid");e.block(()=>n.forEach((a,u)=>{const c=t.subschema({keyword:r,schemaProp:u,compositeRule:!0},l);e.assign(o,(0,Fe._)`${o} || ${l}`),t.mergeValidEvaluated(c,l)||e.if((0,Fe.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}de.validateUnion=K3;Object.defineProperty(Tr,"__esModule",{value:!0});Tr.validateKeywordUsage=Tr.validSchemaType=Tr.funcKeywordCode=Tr.macroKeywordCode=void 0;const Vt=ae,as=Cn,G3=de,Y3=mu;function J3(t,e){const{gen:n,keyword:r,schema:i,parentSchema:s,it:o}=t,l=e.macro.call(o.self,i,s,o),a=_E(n,r,l);o.opts.validateSchema!==!1&&o.self.validateSchema(l,!0);const u=n.name("valid");t.subschema({schema:l,schemaPath:Vt.nil,errSchemaPath:`${o.errSchemaPath}/${r}`,topSchemaRef:a,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Tr.macroKeywordCode=J3;function Z3(t,e){var n;const{gen:r,keyword:i,schema:s,parentSchema:o,$data:l,it:a}=t;X3(a,e);const u=!l&&e.compile?e.compile.call(a.self,s,o,a):e.validate,c=_E(r,i,u),f=r.let("valid");t.block$data(f,h),t.ok((n=e.valid)!==null&&n!==void 0?n:f);function h(){if(e.errors===!1)y(),e.modifying&&IS(t),w(()=>t.error());else{const m=e.async?d():p();e.modifying&&IS(t),w(()=>Q3(t,m))}}function d(){const m=r.let("ruleErrs",null);return r.try(()=>y((0,Vt._)`await `),g=>r.assign(f,!1).if((0,Vt._)`${g} instanceof ${a.ValidationError}`,()=>r.assign(m,(0,Vt._)`${g}.errors`),()=>r.throw(g))),m}function p(){const m=(0,Vt._)`${c}.errors`;return r.assign(m,null),y(Vt.nil),m}function y(m=e.async?(0,Vt._)`await `:Vt.nil){const g=a.opts.passContext?as.default.this:as.default.self,v=!("compile"in e&&!l||e.schema===!1);r.assign(f,(0,Vt._)`${m}${(0,G3.callValidateCode)(t,c,g,v)}`,e.modifying)}function w(m){var g;r.if((0,Vt.not)((g=e.valid)!==null&&g!==void 0?g:f),m)}}Tr.funcKeywordCode=Z3;function IS(t){const{gen:e,data:n,it:r}=t;e.if(r.parentData,()=>e.assign(n,(0,Vt._)`${r.parentData}[${r.parentDataProperty}]`))}function Q3(t,e){const{gen:n}=t;n.if((0,Vt._)`Array.isArray(${e})`,()=>{n.assign(as.default.vErrors,(0,Vt._)`${as.default.vErrors} === null ? ${e} : ${as.default.vErrors}.concat(${e})`).assign(as.default.errors,(0,Vt._)`${as.default.vErrors}.length`),(0,Y3.extendErrors)(t)},()=>t.error())}function X3({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function _E(t,e,n){if(n===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,Vt.stringify)(n)})}function e5(t,e,n=!1){return!e.length||e.some(r=>r==="array"?Array.isArray(t):r==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==r||n&&typeof t>"u")}Tr.validSchemaType=e5;function t5({schema:t,opts:e,self:n,errSchemaPath:r},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");const o=i.dependencies;if(o!=null&&o.some(l=>!Object.prototype.hasOwnProperty.call(t,l)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){const a=`keyword "${s}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")n.logger.error(a);else throw new Error(a)}}Tr.validateKeywordUsage=t5;var Ii={};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.extendSubschemaMode=Ii.extendSubschemaData=Ii.getSubschema=void 0;const $r=ae,ME=ge;function n5(t,{keyword:e,schemaProp:n,schema:r,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){const l=t.schema[e];return n===void 0?{schema:l,schemaPath:(0,$r._)`${t.schemaPath}${(0,$r.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:l[n],schemaPath:(0,$r._)`${t.schemaPath}${(0,$r.getProperty)(e)}${(0,$r.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,ME.escapeFragment)(n)}`}}if(r!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Ii.getSubschema=n5;function r5(t,e,{dataProp:n,dataPropType:r,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=e;if(n!==void 0){const{errorPath:u,dataPathArr:c,opts:f}=e,h=l.let("data",(0,$r._)`${e.data}${(0,$r.getProperty)(n)}`,!0);a(h),t.errorPath=(0,$r.str)`${u}${(0,ME.getErrorPath)(n,r,f.jsPropertySyntax)}`,t.parentDataProperty=(0,$r._)`${n}`,t.dataPathArr=[...c,t.parentDataProperty]}if(i!==void 0){const u=i instanceof $r.Name?i:l.let("data",i,!0);a(u),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function a(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Ii.extendSubschemaData=r5;function i5(t,{jtdDiscriminator:e,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:s}){r!==void 0&&(t.compositeRule=r),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=n}Ii.extendSubschemaMode=i5;var Ct={},AE=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n},PE={exports:{}},Ci=PE.exports=function(t,e,n){typeof e=="function"&&(n=e,e={}),n=e.cb||n;var r=typeof n=="function"?n:n.pre||function(){},i=n.post||function(){};Hc(e,r,i,t,"",t)};Ci.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ci.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ci.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ci.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Hc(t,e,n,r,i,s,o,l,a,u){if(r&&typeof r=="object"&&!Array.isArray(r)){e(r,i,s,o,l,a,u);for(var c in r){var f=r[c];if(Array.isArray(f)){if(c in Ci.arrayKeywords)for(var h=0;he+=NE(r)),e===1/0))return 1/0}return e}function DE(t,e="",n){n!==!1&&(e=Do(e));const r=t.parse(e);return RE(t,r)}Ct.getFullPath=DE;function RE(t,e){return t.serialize(e).split("#")[0]+"#"}Ct._getFullPath=RE;const d5=/#\/?$/;function Do(t){return t?t.replace(d5,""):""}Ct.normalizeId=Do;function m5(t,e,n){return n=Do(n),t.resolve(e,n)}Ct.resolveUrl=m5;const p5=/^[a-z_][-a-z0-9._]*$/i;function g5(t,e){if(typeof t=="boolean")return{};const{schemaId:n,uriResolver:r}=this.opts,i=Do(t[n]||e),s={"":i},o=DE(r,i,!1),l={},a=new Set;return u5(t,{allKeys:!0},(f,h,d,p)=>{if(p===void 0)return;const y=o+h;let w=s[p];typeof f[n]=="string"&&(w=m.call(this,f[n])),g.call(this,f.$anchor),g.call(this,f.$dynamicAnchor),s[h]=w;function m(v){const S=this.opts.uriResolver.resolve;if(v=Do(w?S(w,v):v),a.has(v))throw c(v);a.add(v);let $=this.refs[v];return typeof $=="string"&&($=this.refs[$]),typeof $=="object"?u(f,$.schema,v):v!==Do(y)&&(v[0]==="#"?(u(f,l[v],v),l[v]=f):this.refs[v]=y),v}function g(v){if(typeof v=="string"){if(!p5.test(v))throw new Error(`invalid anchor "${v}"`);m.call(this,`#${v}`)}}}),l;function u(f,h,d){if(h!==void 0&&!a5(f,h))throw c(d)}function c(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Ct.getSchemaRefs=g5;Object.defineProperty(jn,"__esModule",{value:!0});jn.getData=jn.KeywordCxt=jn.validateFunctionCode=void 0;const IE=Yo,LS=pu,G0=Vr,Yf=pu,y5=Ih,da=Tr,Xd=Ii,ne=ae,le=Cn,v5=Ct,Wr=ge,Fl=mu;function w5(t){if(zE(t)&&(jE(t),FE(t))){b5(t);return}LE(t,()=>(0,IE.topBoolOrEmptySchema)(t))}jn.validateFunctionCode=w5;function LE({gen:t,validateName:e,schema:n,schemaEnv:r,opts:i},s){i.code.es5?t.func(e,(0,ne._)`${le.default.data}, ${le.default.valCxt}`,r.$async,()=>{t.code((0,ne._)`"use strict"; ${FS(n,i)}`),k5(t,i),t.code(s)}):t.func(e,(0,ne._)`${le.default.data}, ${S5(i)}`,r.$async,()=>t.code(FS(n,i)).code(s))}function S5(t){return(0,ne._)`{${le.default.instancePath}="", ${le.default.parentData}, ${le.default.parentDataProperty}, ${le.default.rootData}=${le.default.data}${t.dynamicRef?(0,ne._)`, ${le.default.dynamicAnchors}={}`:ne.nil}}={}`}function k5(t,e){t.if(le.default.valCxt,()=>{t.var(le.default.instancePath,(0,ne._)`${le.default.valCxt}.${le.default.instancePath}`),t.var(le.default.parentData,(0,ne._)`${le.default.valCxt}.${le.default.parentData}`),t.var(le.default.parentDataProperty,(0,ne._)`${le.default.valCxt}.${le.default.parentDataProperty}`),t.var(le.default.rootData,(0,ne._)`${le.default.valCxt}.${le.default.rootData}`),e.dynamicRef&&t.var(le.default.dynamicAnchors,(0,ne._)`${le.default.valCxt}.${le.default.dynamicAnchors}`)},()=>{t.var(le.default.instancePath,(0,ne._)`""`),t.var(le.default.parentData,(0,ne._)`undefined`),t.var(le.default.parentDataProperty,(0,ne._)`undefined`),t.var(le.default.rootData,le.default.data),e.dynamicRef&&t.var(le.default.dynamicAnchors,(0,ne._)`{}`)})}function b5(t){const{schema:e,opts:n,gen:r}=t;LE(t,()=>{n.$comment&&e.$comment&&VE(t),O5(t),r.let(le.default.vErrors,null),r.let(le.default.errors,0),n.unevaluated&&x5(t),BE(t),M5(t)})}function x5(t){const{gen:e,validateName:n}=t;t.evaluated=e.const("evaluated",(0,ne._)`${n}.evaluated`),e.if((0,ne._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ne._)`${t.evaluated}.props`,(0,ne._)`undefined`)),e.if((0,ne._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ne._)`${t.evaluated}.items`,(0,ne._)`undefined`))}function FS(t,e){const n=typeof t=="object"&&t[e.schemaId];return n&&(e.code.source||e.code.process)?(0,ne._)`/*# sourceURL=${n} */`:ne.nil}function C5(t,e){if(zE(t)&&(jE(t),FE(t))){$5(t,e);return}(0,IE.boolOrEmptySchema)(t,e)}function FE({schema:t,self:e}){if(typeof t=="boolean")return!t;for(const n in t)if(e.RULES.all[n])return!0;return!1}function zE(t){return typeof t.schema!="boolean"}function $5(t,e){const{schema:n,gen:r,opts:i}=t;i.$comment&&n.$comment&&VE(t),T5(t),_5(t);const s=r.const("_errs",le.default.errors);BE(t,s),r.var(e,(0,ne._)`${s} === ${le.default.errors}`)}function jE(t){(0,Wr.checkUnknownRules)(t),E5(t)}function BE(t,e){if(t.opts.jtd)return zS(t,[],!1,e);const n=(0,LS.getSchemaTypes)(t.schema),r=(0,LS.coerceAndCheckDataType)(t,n);zS(t,n,!r,e)}function E5(t){const{schema:e,errSchemaPath:n,opts:r,self:i}=t;e.$ref&&r.ignoreKeywordsWithRef&&(0,Wr.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function O5(t){const{schema:e,opts:n}=t;e.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,Wr.checkStrictMode)(t,"default is ignored in the schema root")}function T5(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,v5.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function _5(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function VE({gen:t,schemaEnv:e,schema:n,errSchemaPath:r,opts:i}){const s=n.$comment;if(i.$comment===!0)t.code((0,ne._)`${le.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){const o=(0,ne.str)`${r}/$comment`,l=t.scopeValue("root",{ref:e.root});t.code((0,ne._)`${le.default.self}.opts.$comment(${s}, ${o}, ${l}.schema)`)}}function M5(t){const{gen:e,schemaEnv:n,validateName:r,ValidationError:i,opts:s}=t;n.$async?e.if((0,ne._)`${le.default.errors} === 0`,()=>e.return(le.default.data),()=>e.throw((0,ne._)`new ${i}(${le.default.vErrors})`)):(e.assign((0,ne._)`${r}.errors`,le.default.vErrors),s.unevaluated&&A5(t),e.return((0,ne._)`${le.default.errors} === 0`))}function A5({gen:t,evaluated:e,props:n,items:r}){n instanceof ne.Name&&t.assign((0,ne._)`${e}.props`,n),r instanceof ne.Name&&t.assign((0,ne._)`${e}.items`,r)}function zS(t,e,n,r){const{gen:i,schema:s,data:o,allErrors:l,opts:a,self:u}=t,{RULES:c}=u;if(s.$ref&&(a.ignoreKeywordsWithRef||!(0,Wr.schemaHasRulesButRef)(s,c))){i.block(()=>UE(t,"$ref",c.all.$ref.definition));return}a.jtd||P5(t,e),i.block(()=>{for(const h of c.rules)f(h);f(c.post)});function f(h){(0,G0.shouldUseGroup)(s,h)&&(h.type?(i.if((0,Yf.checkDataType)(h.type,o,a.strictNumbers)),jS(t,h),e.length===1&&e[0]===h.type&&n&&(i.else(),(0,Yf.reportTypeError)(t)),i.endIf()):jS(t,h),l||i.if((0,ne._)`${le.default.errors} === ${r||0}`))}}function jS(t,e){const{gen:n,schema:r,opts:{useDefaults:i}}=t;i&&(0,y5.assignDefaults)(t,e.type),n.block(()=>{for(const s of e.rules)(0,G0.shouldUseRule)(r,s)&&UE(t,s.keyword,s.definition,e.type)})}function P5(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(N5(t,e),t.opts.allowUnionTypes||D5(t,e),R5(t,t.dataTypes))}function N5(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(n=>{WE(t.dataTypes,n)||Y0(t,`type "${n}" not allowed by context "${t.dataTypes.join(",")}"`)}),L5(t,e)}}function D5(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Y0(t,"use allowUnionTypes to allow union type keyword")}function R5(t,e){const n=t.self.RULES.all;for(const r in n){const i=n[r];if(typeof i=="object"&&(0,G0.shouldUseRule)(t.schema,i)){const{type:s}=i.definition;s.length&&!s.some(o=>I5(e,o))&&Y0(t,`missing type "${s.join(",")}" for keyword "${r}"`)}}}function I5(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function WE(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function L5(t,e){const n=[];for(const r of t.dataTypes)WE(e,r)?n.push(r):e.includes("integer")&&r==="number"&&n.push("integer");t.dataTypes=n}function Y0(t,e){const n=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${n}" (strictTypes)`,(0,Wr.checkStrictMode)(t,e,t.opts.strictTypes)}class HE{constructor(e,n,r){if((0,da.validateKeywordUsage)(e,n,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=n.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Wr.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=n,this.$data)this.schemaCode=e.gen.const("vSchema",qE(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,da.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=e.gen.const("_errs",le.default.errors))}result(e,n,r){this.failResult((0,ne.not)(e),n,r)}failResult(e,n,r){this.gen.if(e),r?r():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,n){this.failResult((0,ne.not)(e),void 0,n)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:n}=this;this.fail((0,ne._)`${n} !== undefined && (${(0,ne.or)(this.invalid$data(),e)})`)}error(e,n,r){if(n){this.setParams(n),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,n){(e?Fl.reportExtraError:Fl.reportError)(this,this.def.error,n)}$dataError(){(0,Fl.reportError)(this,this.def.$dataError||Fl.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Fl.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,n){n?Object.assign(this.params,e):this.params=e}block$data(e,n,r=ne.nil){this.gen.block(()=>{this.check$data(e,r),n()})}check$data(e=ne.nil,n=ne.nil){if(!this.$data)return;const{gen:r,schemaCode:i,schemaType:s,def:o}=this;r.if((0,ne.or)((0,ne._)`${i} === undefined`,n)),e!==ne.nil&&r.assign(e,!0),(s.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==ne.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:n,schemaType:r,def:i,it:s}=this;return(0,ne.or)(o(),l());function o(){if(r.length){if(!(n instanceof ne.Name))throw new Error("ajv implementation error");const a=Array.isArray(r)?r:[r];return(0,ne._)`${(0,Yf.checkDataTypes)(a,n,s.opts.strictNumbers,Yf.DataType.Wrong)}`}return ne.nil}function l(){if(i.validateSchema){const a=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,ne._)`!${a}(${n})`}return ne.nil}}subschema(e,n){const r=(0,Xd.getSubschema)(this.it,e);(0,Xd.extendSubschemaData)(r,this.it,e),(0,Xd.extendSubschemaMode)(r,e);const i={...this.it,...r,items:void 0,props:void 0};return C5(i,n),i}mergeEvaluated(e,n){const{it:r,gen:i}=this;r.opts.unevaluated&&(r.props!==!0&&e.props!==void 0&&(r.props=Wr.mergeEvaluated.props(i,e.props,r.props,n)),r.items!==!0&&e.items!==void 0&&(r.items=Wr.mergeEvaluated.items(i,e.items,r.items,n)))}mergeValidEvaluated(e,n){const{it:r,gen:i}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return i.if(n,()=>this.mergeEvaluated(e,ne.Name)),!0}}jn.KeywordCxt=HE;function UE(t,e,n,r){const i=new HE(t,n,e);"code"in n?n.code(i,r):i.$data&&n.validate?(0,da.funcKeywordCode)(i,n):"macro"in n?(0,da.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,da.funcKeywordCode)(i,n)}const F5=/^\/(?:[^~]|~0|~1)*$/,z5=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function qE(t,{dataLevel:e,dataNames:n,dataPathArr:r}){let i,s;if(t==="")return le.default.rootData;if(t[0]==="/"){if(!F5.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=le.default.rootData}else{const u=z5.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);const c=+u[1];if(i=u[2],i==="#"){if(c>=e)throw new Error(a("property/index",c));return r[e-c]}if(c>e)throw new Error(a("data",c));if(s=n[e-c],!i)return s}let o=s;const l=i.split("/");for(const u of l)u&&(s=(0,ne._)`${s}${(0,ne.getProperty)((0,Wr.unescapeJsonPointer)(u))}`,o=(0,ne._)`${o} && ${s}`);return o;function a(u,c){return`Cannot access ${u} ${c} levels up, current level is ${e}`}}jn.getData=qE;var ll={};Object.defineProperty(ll,"__esModule",{value:!0});class j5 extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}ll.default=j5;var al={};Object.defineProperty(al,"__esModule",{value:!0});const em=Ct;class B5 extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,em.resolveUrl)(e,n,r),this.missingSchema=(0,em.normalizeId)((0,em.getFullPath)(e,this.missingRef))}}al.default=B5;var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.resolveSchema=Ht.getCompilingSchema=Ht.resolveRef=Ht.compileSchema=Ht.SchemaEnv=void 0;const Kn=ae,V5=ll,ns=Cn,Qn=Ct,BS=ge,W5=jn;class Lh{constructor(e){var n;this.refs={},this.dynamicAnchors={};let r;typeof e.schema=="object"&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(n=e.baseId)!==null&&n!==void 0?n:(0,Qn.normalizeId)(r==null?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r==null?void 0:r.$async,this.refs={}}}Ht.SchemaEnv=Lh;function J0(t){const e=KE.call(this,t);if(e)return e;const n=(0,Qn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:r,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new Kn.CodeGen(this.scope,{es5:r,lines:i,ownProperties:s});let l;t.$async&&(l=o.scopeValue("Error",{ref:V5.default,code:(0,Kn._)`require("ajv/dist/runtime/validation_error").default`}));const a=o.scopeName("validate");t.validateName=a;const u={gen:o,allErrors:this.opts.allErrors,data:ns.default.data,parentData:ns.default.parentData,parentDataProperty:ns.default.parentDataProperty,dataNames:[ns.default.data],dataPathArr:[Kn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Kn.stringify)(t.schema)}:{ref:t.schema}),validateName:a,ValidationError:l,schema:t.schema,schemaEnv:t,rootId:n,baseId:t.baseId||n,schemaPath:Kn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Kn._)`""`,opts:this.opts,self:this};let c;try{this._compilations.add(t),(0,W5.validateFunctionCode)(u),o.optimize(this.opts.code.optimize);const f=o.toString();c=`${o.scopeRefs(ns.default.scope)}return ${f}`,this.opts.code.process&&(c=this.opts.code.process(c,t));const d=new Function(`${ns.default.self}`,`${ns.default.scope}`,c)(this,this.scope.get());if(this.scope.value(a,{ref:d}),d.errors=null,d.schema=t.schema,d.schemaEnv=t,t.$async&&(d.$async=!0),this.opts.code.source===!0&&(d.source={validateName:a,validateCode:f,scopeValues:o._values}),this.opts.unevaluated){const{props:p,items:y}=u;d.evaluated={props:p instanceof Kn.Name?void 0:p,items:y instanceof Kn.Name?void 0:y,dynamicProps:p instanceof Kn.Name,dynamicItems:y instanceof Kn.Name},d.source&&(d.source.evaluated=(0,Kn.stringify)(d.evaluated))}return t.validate=d,t}catch(f){throw delete t.validate,delete t.validateName,c&&this.logger.error("Error compiling schema, function code:",c),f}finally{this._compilations.delete(t)}}Ht.compileSchema=J0;function H5(t,e,n){var r;n=(0,Qn.resolveUrl)(this.opts.uriResolver,e,n);const i=t.refs[n];if(i)return i;let s=K5.call(this,t,n);if(s===void 0){const o=(r=t.localRefs)===null||r===void 0?void 0:r[n],{schemaId:l}=this.opts;o&&(s=new Lh({schema:o,schemaId:l,root:t,baseId:e}))}if(s!==void 0)return t.refs[n]=U5.call(this,s)}Ht.resolveRef=H5;function U5(t){return(0,Qn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:J0.call(this,t)}function KE(t){for(const e of this._compilations)if(q5(e,t))return e}Ht.getCompilingSchema=KE;function q5(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function K5(t,e){let n;for(;typeof(n=this.refs[e])=="string";)e=n;return n||this.schemas[e]||Fh.call(this,t,e)}function Fh(t,e){const n=this.opts.uriResolver.parse(e),r=(0,Qn._getFullPath)(this.opts.uriResolver,n);let i=(0,Qn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&r===i)return tm.call(this,n,t);const s=(0,Qn.normalizeId)(r),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){const l=Fh.call(this,t,o);return typeof(l==null?void 0:l.schema)!="object"?void 0:tm.call(this,n,l)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||J0.call(this,o),s===(0,Qn.normalizeId)(e)){const{schema:l}=o,{schemaId:a}=this.opts,u=l[a];return u&&(i=(0,Qn.resolveUrl)(this.opts.uriResolver,i,u)),new Lh({schema:l,schemaId:a,root:t,baseId:i})}return tm.call(this,n,o)}}Ht.resolveSchema=Fh;const G5=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function tm(t,{baseId:e,schema:n,root:r}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(const l of t.fragment.slice(1).split("/")){if(typeof n=="boolean")return;const a=n[(0,BS.unescapeFragment)(l)];if(a===void 0)return;n=a;const u=typeof n=="object"&&n[this.opts.schemaId];!G5.has(l)&&u&&(e=(0,Qn.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof n!="boolean"&&n.$ref&&!(0,BS.schemaHasRulesButRef)(n,this.RULES)){const l=(0,Qn.resolveUrl)(this.opts.uriResolver,e,n.$ref);s=Fh.call(this,r,l)}const{schemaId:o}=this.opts;if(s=s||new Lh({schema:n,schemaId:o,root:r,baseId:e}),s.schema!==s.root.schema)return s}const Y5="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",J5="Meta-schema for $data reference (JSON AnySchema extension proposal)",Z5="object",Q5=["$data"],X5={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},eF=!1,tF={$id:Y5,description:J5,type:Z5,required:Q5,properties:X5,additionalProperties:eF};var Z0={},sg={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(t,e){(function(n,r){r(e)})(yO,function(n){function r(){for(var O=arguments.length,C=Array(O),T=0;T1){C[0]=C[0].slice(0,-1);for(var R=C.length-1,D=1;D= 0x80 (not a basic code point)","invalid-input":"Invalid input"},V=y-w,B=Math.floor,te=String.fromCharCode;function Q(O){throw new RangeError(N[O])}function fe(O,C){for(var T=[],R=O.length;R--;)T[R]=C(O[R]);return T}function Ee(O,C){var T=O.split("@"),R="";T.length>1&&(R=T[0]+"@",O=T[1]),O=O.replace(A,".");var D=O.split("."),re=fe(D,C).join(".");return R+re}function pe(O){for(var C=[],T=0,R=O.length;T=55296&&D<=56319&&T>1,C+=B(C/T);C>V*m>>1;D+=y)C=B(C/V);return B(D+(V+1)*C/(C+g))},F=function(C){var T=[],R=C.length,D=0,re=$,ie=S,be=C.lastIndexOf(b);be<0&&(be=0);for(var Re=0;Re=128&&Q("not-basic"),T.push(C.charCodeAt(Re));for(var et=be>0?be+1:0;et=R&&Q("invalid-input");var ue=Y(C.charCodeAt(et++));(ue>=y||ue>B((p-D)/Pe))&&Q("overflow"),D+=ue*Pe;var Ve=tt<=ie?w:tt>=ie+m?m:tt-ie;if(ueB(p/ot)&&Q("overflow"),Pe*=ot}var We=T.length+1;ie=M(D-ve,We,ve==0),B(D/We)>p-re&&Q("overflow"),re+=B(D/We),D%=We,T.splice(D++,0,re)}return String.fromCodePoint.apply(String,T)},P=function(C){var T=[];C=pe(C);var R=C.length,D=$,re=0,ie=S,be=!0,Re=!1,et=void 0;try{for(var ve=C[Symbol.iterator](),Pe;!(be=(Pe=ve.next()).done);be=!0){var tt=Pe.value;tt<128&&T.push(te(tt))}}catch(kl){Re=!0,et=kl}finally{try{!be&&ve.return&&ve.return()}finally{if(Re)throw et}}var ue=T.length,Ve=ue;for(ue&&T.push(b);Ve=D&&ZiB((p-re)/En)&&Q("overflow"),re+=(ot-D)*En,D=ot;var dr=!0,Qi=!1,Rr=void 0;try{for(var Sl=C[Symbol.iterator](),Hy;!(dr=(Hy=Sl.next()).done);dr=!0){var Uy=Hy.value;if(Uyp&&Q("overflow"),Uy==D){for(var vu=re,wu=y;;wu+=y){var Su=wu<=ie?w:wu>=ie+m?m:wu-ie;if(vu>6|192).toString(16).toUpperCase()+"%"+(C&63|128).toString(16).toUpperCase():T="%"+(C>>12|224).toString(16).toUpperCase()+"%"+(C>>6&63|128).toString(16).toUpperCase()+"%"+(C&63|128).toString(16).toUpperCase(),T}function ye(O){for(var C="",T=0,R=O.length;T=194&&D<224){if(R-T>=6){var re=parseInt(O.substr(T+4,2),16);C+=String.fromCharCode((D&31)<<6|re&63)}else C+=O.substr(T,6);T+=6}else if(D>=224){if(R-T>=9){var ie=parseInt(O.substr(T+4,2),16),be=parseInt(O.substr(T+7,2),16);C+=String.fromCharCode((D&15)<<12|(ie&63)<<6|be&63)}else C+=O.substr(T,9);T+=9}else C+=O.substr(T,3),T+=3}return C}function Se(O,C){function T(R){var D=ye(R);return D.match(C.UNRESERVED)?D:R}return O.scheme&&(O.scheme=String(O.scheme).replace(C.PCT_ENCODED,T).toLowerCase().replace(C.NOT_SCHEME,"")),O.userinfo!==void 0&&(O.userinfo=String(O.userinfo).replace(C.PCT_ENCODED,T).replace(C.NOT_USERINFO,Z).replace(C.PCT_ENCODED,o)),O.host!==void 0&&(O.host=String(O.host).replace(C.PCT_ENCODED,T).toLowerCase().replace(C.NOT_HOST,Z).replace(C.PCT_ENCODED,o)),O.path!==void 0&&(O.path=String(O.path).replace(C.PCT_ENCODED,T).replace(O.scheme?C.NOT_PATH:C.NOT_PATH_NOSCHEME,Z).replace(C.PCT_ENCODED,o)),O.query!==void 0&&(O.query=String(O.query).replace(C.PCT_ENCODED,T).replace(C.NOT_QUERY,Z).replace(C.PCT_ENCODED,o)),O.fragment!==void 0&&(O.fragment=String(O.fragment).replace(C.PCT_ENCODED,T).replace(C.NOT_FRAGMENT,Z).replace(C.PCT_ENCODED,o)),O}function Ye(O){return O.replace(/^0*(.*)/,"$1")||"0"}function ar(O,C){var T=O.match(C.IPV4ADDRESS)||[],R=h(T,2),D=R[1];return D?D.split(".").map(Ye).join("."):O}function Ls(O,C){var T=O.match(C.IPV6ADDRESS)||[],R=h(T,3),D=R[1],re=R[2];if(D){for(var ie=D.toLowerCase().split("::").reverse(),be=h(ie,2),Re=be[0],et=be[1],ve=et?et.split(":").map(Ye):[],Pe=Re.split(":").map(Ye),tt=C.IPV4ADDRESS.test(Pe[Pe.length-1]),ue=tt?7:8,Ve=Pe.length-ue,ot=Array(ue),We=0;We1){var Ws=ot.slice(0,fr.index),Zi=ot.slice(fr.index+fr.length);hr=Ws.join(":")+"::"+Zi.join(":")}else hr=ot.join(":");return re&&(hr+="%"+re),hr}else return O}var dl=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ml="".match(/(){0}/)[1]===void 0;function un(O){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T={},R=C.iri!==!1?f:c;C.reference==="suffix"&&(O=(C.scheme?C.scheme+":":"")+"//"+O);var D=O.match(dl);if(D){ml?(T.scheme=D[1],T.userinfo=D[3],T.host=D[4],T.port=parseInt(D[5],10),T.path=D[6]||"",T.query=D[7],T.fragment=D[8],isNaN(T.port)&&(T.port=D[5])):(T.scheme=D[1]||void 0,T.userinfo=O.indexOf("@")!==-1?D[3]:void 0,T.host=O.indexOf("//")!==-1?D[4]:void 0,T.port=parseInt(D[5],10),T.path=D[6]||"",T.query=O.indexOf("?")!==-1?D[7]:void 0,T.fragment=O.indexOf("#")!==-1?D[8]:void 0,isNaN(T.port)&&(T.port=O.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?D[4]:void 0)),T.host&&(T.host=Ls(ar(T.host,R),R)),T.scheme===void 0&&T.userinfo===void 0&&T.host===void 0&&T.port===void 0&&!T.path&&T.query===void 0?T.reference="same-document":T.scheme===void 0?T.reference="relative":T.fragment===void 0?T.reference="absolute":T.reference="uri",C.reference&&C.reference!=="suffix"&&C.reference!==T.reference&&(T.error=T.error||"URI is not a "+C.reference+" reference.");var re=q[(C.scheme||T.scheme||"").toLowerCase()];if(!C.unicodeSupport&&(!re||!re.unicodeSupport)){if(T.host&&(C.domainHost||re&&re.domainHost))try{T.host=L.toASCII(T.host.replace(R.PCT_ENCODED,ye).toLowerCase())}catch(ie){T.error=T.error||"Host's domain name can not be converted to ASCII via punycode: "+ie}Se(T,c)}else Se(T,R);re&&re.parse&&re.parse(T,C)}else T.error=T.error||"URI can not be parsed.";return T}function pl(O,C){var T=C.iri!==!1?f:c,R=[];return O.userinfo!==void 0&&(R.push(O.userinfo),R.push("@")),O.host!==void 0&&R.push(Ls(ar(String(O.host),T),T).replace(T.IPV6ADDRESS,function(D,re,ie){return"["+re+(ie?"%25"+ie:"")+"]"})),(typeof O.port=="number"||typeof O.port=="string")&&(R.push(":"),R.push(String(O.port))),R.length?R.join(""):void 0}var Fs=/^\.\.?\//,zs=/^\/\.(\/|$)/,js=/^\/\.\.(\/|$)/,gl=/^\/?(?:.|\n)*?(?=\/|$)/;function ur(O){for(var C=[];O.length;)if(O.match(Fs))O=O.replace(Fs,"");else if(O.match(zs))O=O.replace(zs,"/");else if(O.match(js))O=O.replace(js,"/"),C.pop();else if(O==="."||O==="..")O="";else{var T=O.match(gl);if(T){var R=T[0];O=O.slice(R.length),C.push(R)}else throw new Error("Unexpected dot segment condition")}return C.join("")}function Zt(O){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=C.iri?f:c,R=[],D=q[(C.scheme||O.scheme||"").toLowerCase()];if(D&&D.serialize&&D.serialize(O,C),O.host&&!T.IPV6ADDRESS.test(O.host)){if(C.domainHost||D&&D.domainHost)try{O.host=C.iri?L.toUnicode(O.host):L.toASCII(O.host.replace(T.PCT_ENCODED,ye).toLowerCase())}catch(be){O.error=O.error||"Host's domain name can not be converted to "+(C.iri?"Unicode":"ASCII")+" via punycode: "+be}}Se(O,T),C.reference!=="suffix"&&O.scheme&&(R.push(O.scheme),R.push(":"));var re=pl(O,C);if(re!==void 0&&(C.reference!=="suffix"&&R.push("//"),R.push(re),O.path&&O.path.charAt(0)!=="/"&&R.push("/")),O.path!==void 0){var ie=O.path;!C.absolutePath&&(!D||!D.absolutePath)&&(ie=ur(ie)),re===void 0&&(ie=ie.replace(/^\/\//,"/%2F")),R.push(ie)}return O.query!==void 0&&(R.push("?"),R.push(O.query)),O.fragment!==void 0&&(R.push("#"),R.push(O.fragment)),R.join("")}function Bs(O,C){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=arguments[3],D={};return R||(O=un(Zt(O,T),T),C=un(Zt(C,T),T)),T=T||{},!T.tolerant&&C.scheme?(D.scheme=C.scheme,D.userinfo=C.userinfo,D.host=C.host,D.port=C.port,D.path=ur(C.path||""),D.query=C.query):(C.userinfo!==void 0||C.host!==void 0||C.port!==void 0?(D.userinfo=C.userinfo,D.host=C.host,D.port=C.port,D.path=ur(C.path||""),D.query=C.query):(C.path?(C.path.charAt(0)==="/"?D.path=ur(C.path):((O.userinfo!==void 0||O.host!==void 0||O.port!==void 0)&&!O.path?D.path="/"+C.path:O.path?D.path=O.path.slice(0,O.path.lastIndexOf("/")+1)+C.path:D.path=C.path,D.path=ur(D.path)),D.query=C.query):(D.path=O.path,C.query!==void 0?D.query=C.query:D.query=O.query),D.userinfo=O.userinfo,D.host=O.host,D.port=O.port),D.scheme=O.scheme),D.fragment=C.fragment,D}function yl(O,C,T){var R=a({scheme:"null"},T);return Zt(Bs(un(O,R),un(C,R),R,!0),R)}function Yi(O,C){return typeof O=="string"?O=Zt(un(O,C),C):s(O)==="object"&&(O=un(Zt(O,C),C)),O}function vl(O,C,T){return typeof O=="string"?O=Zt(un(O,T),T):s(O)==="object"&&(O=Zt(O,T)),typeof C=="string"?C=Zt(un(C,T),T):s(C)==="object"&&(C=Zt(C,T)),O===C}function yu(O,C){return O&&O.toString().replace(!C||!C.iri?c.ESCAPE:f.ESCAPE,Z)}function $n(O,C){return O&&O.toString().replace(!C||!C.iri?c.PCT_ENCODED:f.PCT_ENCODED,ye)}var Ji={scheme:"http",domainHost:!0,parse:function(C,T){return C.host||(C.error=C.error||"HTTP URIs must have a host."),C},serialize:function(C,T){var R=String(C.scheme).toLowerCase()==="https";return(C.port===(R?443:80)||C.port==="")&&(C.port=void 0),C.path||(C.path="/"),C}},Iy={scheme:"https",domainHost:Ji.domainHost,parse:Ji.parse,serialize:Ji.serialize};function Ly(O){return typeof O.secure=="boolean"?O.secure:String(O.scheme).toLowerCase()==="wss"}var wl={scheme:"ws",domainHost:!0,parse:function(C,T){var R=C;return R.secure=Ly(R),R.resourceName=(R.path||"/")+(R.query?"?"+R.query:""),R.path=void 0,R.query=void 0,R},serialize:function(C,T){if((C.port===(Ly(C)?443:80)||C.port==="")&&(C.port=void 0),typeof C.secure=="boolean"&&(C.scheme=C.secure?"wss":"ws",C.secure=void 0),C.resourceName){var R=C.resourceName.split("?"),D=h(R,2),re=D[0],ie=D[1];C.path=re&&re!=="/"?re:void 0,C.query=ie,C.resourceName=void 0}return C.fragment=void 0,C}},Fy={scheme:"wss",domainHost:wl.domainHost,parse:wl.parse,serialize:wl.serialize},oO={},zy="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",cr="[0-9A-Fa-f]",lO=i(i("%[EFef]"+cr+"%"+cr+cr+"%"+cr+cr)+"|"+i("%[89A-Fa-f]"+cr+"%"+cr+cr)+"|"+i("%"+cr+cr)),aO="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",uO="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",cO=r(uO,'[\\"\\\\]'),fO="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",hO=new RegExp(zy,"g"),Vs=new RegExp(lO,"g"),dO=new RegExp(r("[^]",aO,"[\\.]",'[\\"]',cO),"g"),jy=new RegExp(r("[^]",zy,fO),"g"),mO=jy;function qh(O){var C=ye(O);return C.match(hO)?C:O}var By={scheme:"mailto",parse:function(C,T){var R=C,D=R.to=R.path?R.path.split(","):[];if(R.path=void 0,R.query){for(var re=!1,ie={},be=R.query.split("&"),Re=0,et=be.length;Renew RegExp(I,M);d.code="new RegExp";const p=["removeAdditional","useDefaults","coerceTypes"],y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),w={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},m={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},g=200;function v(I){var M,F,P,k,E,L,q,Z,ye,Se,Ye,ar,Ls,dl,ml,un,pl,Fs,zs,js,gl,ur,Zt,Bs,yl;const Yi=I.strict,vl=(M=I.code)===null||M===void 0?void 0:M.optimize,yu=vl===!0||vl===void 0?1:vl||0,$n=(P=(F=I.code)===null||F===void 0?void 0:F.regExp)!==null&&P!==void 0?P:d,Ji=(k=I.uriResolver)!==null&&k!==void 0?k:h.default;return{strictSchema:(L=(E=I.strictSchema)!==null&&E!==void 0?E:Yi)!==null&&L!==void 0?L:!0,strictNumbers:(Z=(q=I.strictNumbers)!==null&&q!==void 0?q:Yi)!==null&&Z!==void 0?Z:!0,strictTypes:(Se=(ye=I.strictTypes)!==null&&ye!==void 0?ye:Yi)!==null&&Se!==void 0?Se:"log",strictTuples:(ar=(Ye=I.strictTuples)!==null&&Ye!==void 0?Ye:Yi)!==null&&ar!==void 0?ar:"log",strictRequired:(dl=(Ls=I.strictRequired)!==null&&Ls!==void 0?Ls:Yi)!==null&&dl!==void 0?dl:!1,code:I.code?{...I.code,optimize:yu,regExp:$n}:{optimize:yu,regExp:$n},loopRequired:(ml=I.loopRequired)!==null&&ml!==void 0?ml:g,loopEnum:(un=I.loopEnum)!==null&&un!==void 0?un:g,meta:(pl=I.meta)!==null&&pl!==void 0?pl:!0,messages:(Fs=I.messages)!==null&&Fs!==void 0?Fs:!0,inlineRefs:(zs=I.inlineRefs)!==null&&zs!==void 0?zs:!0,schemaId:(js=I.schemaId)!==null&&js!==void 0?js:"$id",addUsedSchema:(gl=I.addUsedSchema)!==null&&gl!==void 0?gl:!0,validateSchema:(ur=I.validateSchema)!==null&&ur!==void 0?ur:!0,validateFormats:(Zt=I.validateFormats)!==null&&Zt!==void 0?Zt:!0,unicodeRegExp:(Bs=I.unicodeRegExp)!==null&&Bs!==void 0?Bs:!0,int32range:(yl=I.int32range)!==null&&yl!==void 0?yl:!0,uriResolver:Ji}}class S{constructor(M={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,M=this.opts={...M,...v(M)};const{es5:F,lines:P}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:F,lines:P}),this.logger=B(M.logger);const k=M.validateFormats;M.validateFormats=!1,this.RULES=(0,s.getRules)(),$.call(this,w,M,"NOT SUPPORTED"),$.call(this,m,M,"DEPRECATED","warn"),this._metaOpts=N.call(this),M.formats&&_.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),M.keywords&&A.call(this,M.keywords),typeof M.meta=="object"&&this.addMetaSchema(M.meta),x.call(this),M.validateFormats=k}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:M,meta:F,schemaId:P}=this.opts;let k=f;P==="id"&&(k={...f},k.id=k.$id,delete k.$id),F&&M&&this.addMetaSchema(k,k[P],!1)}defaultMeta(){const{meta:M,schemaId:F}=this.opts;return this.opts.defaultMeta=typeof M=="object"?M[F]||M:void 0}validate(M,F){let P;if(typeof M=="string"){if(P=this.getSchema(M),!P)throw new Error(`no schema with key or ref "${M}"`)}else P=this.compile(M);const k=P(F);return"$async"in P||(this.errors=P.errors),k}compile(M,F){const P=this._addSchema(M,F);return P.validate||this._compileSchemaEnv(P)}compileAsync(M,F){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:P}=this.opts;return k.call(this,M,F);async function k(Se,Ye){await E.call(this,Se.$schema);const ar=this._addSchema(Se,Ye);return ar.validate||L.call(this,ar)}async function E(Se){Se&&!this.getSchema(Se)&&await k.call(this,{$ref:Se},!0)}async function L(Se){try{return this._compileSchemaEnv(Se)}catch(Ye){if(!(Ye instanceof i.default))throw Ye;return q.call(this,Ye),await Z.call(this,Ye.missingSchema),L.call(this,Se)}}function q({missingSchema:Se,missingRef:Ye}){if(this.refs[Se])throw new Error(`AnySchema ${Se} is loaded but ${Ye} cannot be resolved`)}async function Z(Se){const Ye=await ye.call(this,Se);this.refs[Se]||await E.call(this,Ye.$schema),this.refs[Se]||this.addSchema(Ye,Se,F)}async function ye(Se){const Ye=this._loading[Se];if(Ye)return Ye;try{return await(this._loading[Se]=P(Se))}finally{delete this._loading[Se]}}}addSchema(M,F,P,k=this.opts.validateSchema){if(Array.isArray(M)){for(const L of M)this.addSchema(L,void 0,P,k);return this}let E;if(typeof M=="object"){const{schemaId:L}=this.opts;if(E=M[L],E!==void 0&&typeof E!="string")throw new Error(`schema ${L} must be string`)}return F=(0,a.normalizeId)(F||E),this._checkUnique(F),this.schemas[F]=this._addSchema(M,P,F,k,!0),this}addMetaSchema(M,F,P=this.opts.validateSchema){return this.addSchema(M,F,!0,P),this}validateSchema(M,F){if(typeof M=="boolean")return!0;let P;if(P=M.$schema,P!==void 0&&typeof P!="string")throw new Error("$schema must be a string");if(P=P||this.opts.defaultMeta||this.defaultMeta(),!P)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const k=this.validate(P,M);if(!k&&F){const E="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(E);else throw new Error(E)}return k}getSchema(M){let F;for(;typeof(F=b.call(this,M))=="string";)M=F;if(F===void 0){const{schemaId:P}=this.opts,k=new o.SchemaEnv({schema:{},schemaId:P});if(F=o.resolveSchema.call(this,k,M),!F)return;this.refs[M]=F}return F.validate||this._compileSchemaEnv(F)}removeSchema(M){if(M instanceof RegExp)return this._removeAllSchemas(this.schemas,M),this._removeAllSchemas(this.refs,M),this;switch(typeof M){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const F=b.call(this,M);return typeof F=="object"&&this._cache.delete(F.schema),delete this.schemas[M],delete this.refs[M],this}case"object":{const F=M;this._cache.delete(F);let P=M[this.opts.schemaId];return P&&(P=(0,a.normalizeId)(P),delete this.schemas[P],delete this.refs[P]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(M){for(const F of M)this.addKeyword(F);return this}addKeyword(M,F){let P;if(typeof M=="string")P=M,typeof F=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),F.keyword=P);else if(typeof M=="object"&&F===void 0){if(F=M,P=F.keyword,Array.isArray(P)&&!P.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Q.call(this,P,F),!F)return(0,c.eachItem)(P,E=>fe.call(this,E)),this;pe.call(this,F);const k={...F,type:(0,u.getJSONTypes)(F.type),schemaType:(0,u.getJSONTypes)(F.schemaType)};return(0,c.eachItem)(P,k.type.length===0?E=>fe.call(this,E,k):E=>k.type.forEach(L=>fe.call(this,E,k,L))),this}getKeyword(M){const F=this.RULES.all[M];return typeof F=="object"?F.definition:!!F}removeKeyword(M){const{RULES:F}=this;delete F.keywords[M],delete F.all[M];for(const P of F.rules){const k=P.rules.findIndex(E=>E.keyword===M);k>=0&&P.rules.splice(k,1)}return this}addFormat(M,F){return typeof F=="string"&&(F=new RegExp(F)),this.formats[M]=F,this}errorsText(M=this.errors,{separator:F=", ",dataVar:P="data"}={}){return!M||M.length===0?"No errors":M.map(k=>`${P}${k.instancePath} ${k.message}`).reduce((k,E)=>k+F+E)}$dataMetaSchema(M,F){const P=this.RULES.all;M=JSON.parse(JSON.stringify(M));for(const k of F){const E=k.split("/").slice(1);let L=M;for(const q of E)L=L[q];for(const q in P){const Z=P[q];if(typeof Z!="object")continue;const{$data:ye}=Z.definition,Se=L[q];ye&&Se&&(L[q]=Y(Se))}}return M}_removeAllSchemas(M,F){for(const P in M){const k=M[P];(!F||F.test(P))&&(typeof k=="string"?delete M[P]:k&&!k.meta&&(this._cache.delete(k.schema),delete M[P]))}}_addSchema(M,F,P,k=this.opts.validateSchema,E=this.opts.addUsedSchema){let L;const{schemaId:q}=this.opts;if(typeof M=="object")L=M[q];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof M!="boolean")throw new Error("schema must be object or boolean")}let Z=this._cache.get(M);if(Z!==void 0)return Z;P=(0,a.normalizeId)(L||P);const ye=a.getSchemaRefs.call(this,M,P);return Z=new o.SchemaEnv({schema:M,schemaId:q,meta:F,baseId:P,localRefs:ye}),this._cache.set(Z.schema,Z),E&&!P.startsWith("#")&&(P&&this._checkUnique(P),this.refs[P]=Z),k&&this.validateSchema(M,!0),Z}_checkUnique(M){if(this.schemas[M]||this.refs[M])throw new Error(`schema with key or id "${M}" already exists`)}_compileSchemaEnv(M){if(M.meta?this._compileMetaSchema(M):o.compileSchema.call(this,M),!M.validate)throw new Error("ajv implementation error");return M.validate}_compileMetaSchema(M){const F=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,M)}finally{this.opts=F}}}t.default=S,S.ValidationError=r.default,S.MissingRefError=i.default;function $(I,M,F,P="error"){for(const k in I){const E=k;E in M&&this.logger[P](`${F}: option ${k}. ${I[E]}`)}}function b(I){return I=(0,a.normalizeId)(I),this.schemas[I]||this.refs[I]}function x(){const I=this.opts.schemas;if(I)if(Array.isArray(I))this.addSchema(I);else for(const M in I)this.addSchema(I[M],M)}function _(){for(const I in this.opts.formats){const M=this.opts.formats[I];M&&this.addFormat(I,M)}}function A(I){if(Array.isArray(I)){this.addVocabulary(I);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const M in I){const F=I[M];F.keyword||(F.keyword=M),this.addKeyword(F)}}function N(){const I={...this.opts};for(const M of p)delete I[M];return I}const V={log(){},warn(){},error(){}};function B(I){if(I===!1)return V;if(I===void 0)return console;if(I.log&&I.warn&&I.error)return I;throw new Error("logger must implement log, warn and error methods")}const te=/^[a-z_$][a-z0-9_$:-]*$/i;function Q(I,M){const{RULES:F}=this;if((0,c.eachItem)(I,P=>{if(F.keywords[P])throw new Error(`Keyword ${P} is already defined`);if(!te.test(P))throw new Error(`Keyword ${P} has invalid name`)}),!!M&&M.$data&&!("code"in M||"validate"in M))throw new Error('$data keyword must have "code" or "validate" function')}function fe(I,M,F){var P;const k=M==null?void 0:M.post;if(F&&k)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:E}=this;let L=k?E.post:E.rules.find(({type:Z})=>Z===F);if(L||(L={type:F,rules:[]},E.rules.push(L)),E.keywords[I]=!0,!M)return;const q={keyword:I,definition:{...M,type:(0,u.getJSONTypes)(M.type),schemaType:(0,u.getJSONTypes)(M.schemaType)}};M.before?Ee.call(this,L,q,M.before):L.rules.push(q),E.all[I]=q,(P=M.implements)===null||P===void 0||P.forEach(Z=>this.addKeyword(Z))}function Ee(I,M,F){const P=I.rules.findIndex(k=>k.keyword===F);P>=0?I.rules.splice(P,0,M):(I.rules.push(M),this.logger.warn(`rule ${F} is not defined`))}function pe(I){let{metaSchema:M}=I;M!==void 0&&(I.$data&&this.opts.$data&&(M=Y(M)),I.validateSchema=this.compile(M,!0))}const H={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Y(I){return{anyOf:[I,H]}}})(H0);var Q0={},zh={},X0={};Object.defineProperty(X0,"__esModule",{value:!0});const rF={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};X0.default=rF;var Xr={};Object.defineProperty(Xr,"__esModule",{value:!0});Xr.callRef=Xr.getValidate=void 0;const iF=al,VS=de,Qt=ae,Ys=Cn,WS=Ht,mc=ge,sF={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:n,it:r}=t,{baseId:i,schemaEnv:s,validateName:o,opts:l,self:a}=r,{root:u}=s;if((n==="#"||n==="#/")&&i===u.baseId)return f();const c=WS.resolveRef.call(a,u,i,n);if(c===void 0)throw new iF.default(r.opts.uriResolver,i,n);if(c instanceof WS.SchemaEnv)return h(c);return d(c);function f(){if(s===u)return Uc(t,o,s,s.$async);const p=e.scopeValue("root",{ref:u});return Uc(t,(0,Qt._)`${p}.validate`,u,u.$async)}function h(p){const y=YE(t,p);Uc(t,y,p,p.$async)}function d(p){const y=e.scopeValue("schema",l.code.source===!0?{ref:p,code:(0,Qt.stringify)(p)}:{ref:p}),w=e.name("valid"),m=t.subschema({schema:p,dataTypes:[],schemaPath:Qt.nil,topSchemaRef:y,errSchemaPath:n},w);t.mergeEvaluated(m),t.ok(w)}}};function YE(t,e){const{gen:n}=t;return e.validate?n.scopeValue("validate",{ref:e.validate}):(0,Qt._)`${n.scopeValue("wrapper",{ref:e})}.validate`}Xr.getValidate=YE;function Uc(t,e,n,r){const{gen:i,it:s}=t,{allErrors:o,schemaEnv:l,opts:a}=s,u=a.passContext?Ys.default.this:Qt.nil;r?c():f();function c(){if(!l.$async)throw new Error("async schema referenced by sync schema");const p=i.let("valid");i.try(()=>{i.code((0,Qt._)`await ${(0,VS.callValidateCode)(t,e,u)}`),d(e),o||i.assign(p,!0)},y=>{i.if((0,Qt._)`!(${y} instanceof ${s.ValidationError})`,()=>i.throw(y)),h(y),o||i.assign(p,!1)}),t.ok(p)}function f(){t.result((0,VS.callValidateCode)(t,e,u),()=>d(e),()=>h(e))}function h(p){const y=(0,Qt._)`${p}.errors`;i.assign(Ys.default.vErrors,(0,Qt._)`${Ys.default.vErrors} === null ? ${y} : ${Ys.default.vErrors}.concat(${y})`),i.assign(Ys.default.errors,(0,Qt._)`${Ys.default.vErrors}.length`)}function d(p){var y;if(!s.opts.unevaluated)return;const w=(y=n==null?void 0:n.validate)===null||y===void 0?void 0:y.evaluated;if(s.props!==!0)if(w&&!w.dynamicProps)w.props!==void 0&&(s.props=mc.mergeEvaluated.props(i,w.props,s.props));else{const m=i.var("props",(0,Qt._)`${p}.evaluated.props`);s.props=mc.mergeEvaluated.props(i,m,s.props,Qt.Name)}if(s.items!==!0)if(w&&!w.dynamicItems)w.items!==void 0&&(s.items=mc.mergeEvaluated.items(i,w.items,s.items));else{const m=i.var("items",(0,Qt._)`${p}.evaluated.items`);s.items=mc.mergeEvaluated.items(i,m,s.items,Qt.Name)}}}Xr.callRef=Uc;Xr.default=sF;Object.defineProperty(zh,"__esModule",{value:!0});const oF=X0,lF=Xr,aF=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",oF.default,lF.default];zh.default=aF;var jh={},ey={};Object.defineProperty(ey,"__esModule",{value:!0});const Jf=ae,li=Jf.operators,Zf={maximum:{okStr:"<=",ok:li.LTE,fail:li.GT},minimum:{okStr:">=",ok:li.GTE,fail:li.LT},exclusiveMaximum:{okStr:"<",ok:li.LT,fail:li.GTE},exclusiveMinimum:{okStr:">",ok:li.GT,fail:li.LTE}},uF={message:({keyword:t,schemaCode:e})=>(0,Jf.str)`must be ${Zf[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Jf._)`{comparison: ${Zf[t].okStr}, limit: ${e}}`},cF={keyword:Object.keys(Zf),type:"number",schemaType:"number",$data:!0,error:uF,code(t){const{keyword:e,data:n,schemaCode:r}=t;t.fail$data((0,Jf._)`${n} ${Zf[e].fail} ${r} || isNaN(${n})`)}};ey.default=cF;var ty={};Object.defineProperty(ty,"__esModule",{value:!0});const ma=ae,fF={message:({schemaCode:t})=>(0,ma.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,ma._)`{multipleOf: ${t}}`},hF={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:fF,code(t){const{gen:e,data:n,schemaCode:r,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),l=s?(0,ma._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,ma._)`${o} !== parseInt(${o})`;t.fail$data((0,ma._)`(${r} === 0 || (${o} = ${n}/${r}, ${l}))`)}};ty.default=hF;var ny={},ry={};Object.defineProperty(ry,"__esModule",{value:!0});function JE(t){const e=t.length;let n=0,r=0,i;for(;r=55296&&i<=56319&&r(0,us._)`{limit: ${t}}`},gF={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:pF,code(t){const{keyword:e,data:n,schemaCode:r,it:i}=t,s=e==="maxLength"?us.operators.GT:us.operators.LT,o=i.opts.unicode===!1?(0,us._)`${n}.length`:(0,us._)`${(0,dF.useFunc)(t.gen,mF.default)}(${n})`;t.fail$data((0,us._)`${o} ${s} ${r}`)}};ny.default=gF;var iy={};Object.defineProperty(iy,"__esModule",{value:!0});const yF=de,Qf=ae,vF={message:({schemaCode:t})=>(0,Qf.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Qf._)`{pattern: ${t}}`},wF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:vF,code(t){const{data:e,$data:n,schema:r,schemaCode:i,it:s}=t,o=s.opts.unicodeRegExp?"u":"",l=n?(0,Qf._)`(new RegExp(${i}, ${o}))`:(0,yF.usePattern)(t,r);t.fail$data((0,Qf._)`!${l}.test(${e})`)}};iy.default=wF;var sy={};Object.defineProperty(sy,"__esModule",{value:!0});const pa=ae,SF={message({keyword:t,schemaCode:e}){const n=t==="maxProperties"?"more":"fewer";return(0,pa.str)`must NOT have ${n} than ${e} properties`},params:({schemaCode:t})=>(0,pa._)`{limit: ${t}}`},kF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:SF,code(t){const{keyword:e,data:n,schemaCode:r}=t,i=e==="maxProperties"?pa.operators.GT:pa.operators.LT;t.fail$data((0,pa._)`Object.keys(${n}).length ${i} ${r}`)}};sy.default=kF;var oy={};Object.defineProperty(oy,"__esModule",{value:!0});const zl=de,ga=ae,bF=ge,xF={message:({params:{missingProperty:t}})=>(0,ga.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,ga._)`{missingProperty: ${t}}`},CF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:xF,code(t){const{gen:e,schema:n,schemaCode:r,data:i,$data:s,it:o}=t,{opts:l}=o;if(!s&&n.length===0)return;const a=n.length>=l.loopRequired;if(o.allErrors?u():c(),l.strictRequired){const d=t.parentSchema.properties,{definedProperties:p}=t.it;for(const y of n)if((d==null?void 0:d[y])===void 0&&!p.has(y)){const w=o.schemaEnv.baseId+o.errSchemaPath,m=`required property "${y}" is not defined at "${w}" (strictRequired)`;(0,bF.checkStrictMode)(o,m,o.opts.strictRequired)}}function u(){if(a||s)t.block$data(ga.nil,f);else for(const d of n)(0,zl.checkReportMissingProp)(t,d)}function c(){const d=e.let("missing");if(a||s){const p=e.let("valid",!0);t.block$data(p,()=>h(d,p)),t.ok(p)}else e.if((0,zl.checkMissingProp)(t,n,d)),(0,zl.reportMissingProp)(t,d),e.else()}function f(){e.forOf("prop",r,d=>{t.setParams({missingProperty:d}),e.if((0,zl.noPropertyInData)(e,i,d,l.ownProperties),()=>t.error())})}function h(d,p){t.setParams({missingProperty:d}),e.forOf(d,r,()=>{e.assign(p,(0,zl.propertyInData)(e,i,d,l.ownProperties)),e.if((0,ga.not)(p),()=>{t.error(),e.break()})},ga.nil)}}};oy.default=CF;var ly={};Object.defineProperty(ly,"__esModule",{value:!0});const ya=ae,$F={message({keyword:t,schemaCode:e}){const n=t==="maxItems"?"more":"fewer";return(0,ya.str)`must NOT have ${n} than ${e} items`},params:({schemaCode:t})=>(0,ya._)`{limit: ${t}}`},EF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:$F,code(t){const{keyword:e,data:n,schemaCode:r}=t,i=e==="maxItems"?ya.operators.GT:ya.operators.LT;t.fail$data((0,ya._)`${n}.length ${i} ${r}`)}};ly.default=EF;var ay={},gu={};Object.defineProperty(gu,"__esModule",{value:!0});const ZE=AE;ZE.code='require("ajv/dist/runtime/equal").default';gu.default=ZE;Object.defineProperty(ay,"__esModule",{value:!0});const nm=pu,wt=ae,OF=ge,TF=gu,_F={message:({params:{i:t,j:e}})=>(0,wt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,wt._)`{i: ${t}, j: ${e}}`},MF={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:_F,code(t){const{gen:e,data:n,$data:r,schema:i,parentSchema:s,schemaCode:o,it:l}=t;if(!r&&!i)return;const a=e.let("valid"),u=s.items?(0,nm.getSchemaTypes)(s.items):[];t.block$data(a,c,(0,wt._)`${o} === false`),t.ok(a);function c(){const p=e.let("i",(0,wt._)`${n}.length`),y=e.let("j");t.setParams({i:p,j:y}),e.assign(a,!0),e.if((0,wt._)`${p} > 1`,()=>(f()?h:d)(p,y))}function f(){return u.length>0&&!u.some(p=>p==="object"||p==="array")}function h(p,y){const w=e.name("item"),m=(0,nm.checkDataTypes)(u,w,l.opts.strictNumbers,nm.DataType.Wrong),g=e.const("indices",(0,wt._)`{}`);e.for((0,wt._)`;${p}--;`,()=>{e.let(w,(0,wt._)`${n}[${p}]`),e.if(m,(0,wt._)`continue`),u.length>1&&e.if((0,wt._)`typeof ${w} == "string"`,(0,wt._)`${w} += "_"`),e.if((0,wt._)`typeof ${g}[${w}] == "number"`,()=>{e.assign(y,(0,wt._)`${g}[${w}]`),t.error(),e.assign(a,!1).break()}).code((0,wt._)`${g}[${w}] = ${p}`)})}function d(p,y){const w=(0,OF.useFunc)(e,TF.default),m=e.name("outer");e.label(m).for((0,wt._)`;${p}--;`,()=>e.for((0,wt._)`${y} = ${p}; ${y}--;`,()=>e.if((0,wt._)`${w}(${n}[${p}], ${n}[${y}])`,()=>{t.error(),e.assign(a,!1).break(m)})))}}};ay.default=MF;var uy={};Object.defineProperty(uy,"__esModule",{value:!0});const og=ae,AF=ge,PF=gu,NF={message:"must be equal to constant",params:({schemaCode:t})=>(0,og._)`{allowedValue: ${t}}`},DF={keyword:"const",$data:!0,error:NF,code(t){const{gen:e,data:n,$data:r,schemaCode:i,schema:s}=t;r||s&&typeof s=="object"?t.fail$data((0,og._)`!${(0,AF.useFunc)(e,PF.default)}(${n}, ${i})`):t.fail((0,og._)`${s} !== ${n}`)}};uy.default=DF;var cy={};Object.defineProperty(cy,"__esModule",{value:!0});const Zl=ae,RF=ge,IF=gu,LF={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Zl._)`{allowedValues: ${t}}`},FF={keyword:"enum",schemaType:"array",$data:!0,error:LF,code(t){const{gen:e,data:n,$data:r,schema:i,schemaCode:s,it:o}=t;if(!r&&i.length===0)throw new Error("enum must have non-empty array");const l=i.length>=o.opts.loopEnum;let a;const u=()=>a??(a=(0,RF.useFunc)(e,IF.default));let c;if(l||r)c=e.let("valid"),t.block$data(c,f);else{if(!Array.isArray(i))throw new Error("ajv implementation error");const d=e.const("vSchema",s);c=(0,Zl.or)(...i.map((p,y)=>h(d,y)))}t.pass(c);function f(){e.assign(c,!1),e.forOf("v",s,d=>e.if((0,Zl._)`${u()}(${n}, ${d})`,()=>e.assign(c,!0).break()))}function h(d,p){const y=i[p];return typeof y=="object"&&y!==null?(0,Zl._)`${u()}(${n}, ${d}[${p}])`:(0,Zl._)`${n} === ${y}`}}};cy.default=FF;Object.defineProperty(jh,"__esModule",{value:!0});const zF=ey,jF=ty,BF=ny,VF=iy,WF=sy,HF=oy,UF=ly,qF=ay,KF=uy,GF=cy,YF=[zF.default,jF.default,BF.default,VF.default,WF.default,HF.default,UF.default,qF.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},KF.default,GF.default];jh.default=YF;var Bh={},ul={};Object.defineProperty(ul,"__esModule",{value:!0});ul.validateAdditionalItems=void 0;const cs=ae,lg=ge,JF={message:({params:{len:t}})=>(0,cs.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,cs._)`{limit: ${t}}`},ZF={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:JF,code(t){const{parentSchema:e,it:n}=t,{items:r}=e;if(!Array.isArray(r)){(0,lg.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}QE(t,r)}};function QE(t,e){const{gen:n,schema:r,data:i,keyword:s,it:o}=t;o.items=!0;const l=n.const("len",(0,cs._)`${i}.length`);if(r===!1)t.setParams({len:e.length}),t.pass((0,cs._)`${l} <= ${e.length}`);else if(typeof r=="object"&&!(0,lg.alwaysValidSchema)(o,r)){const u=n.var("valid",(0,cs._)`${l} <= ${e.length}`);n.if((0,cs.not)(u),()=>a(u)),t.ok(u)}function a(u){n.forRange("i",e.length,l,c=>{t.subschema({keyword:s,dataProp:c,dataPropType:lg.Type.Num},u),o.allErrors||n.if((0,cs.not)(u),()=>n.break())})}}ul.validateAdditionalItems=QE;ul.default=ZF;var fy={},cl={};Object.defineProperty(cl,"__esModule",{value:!0});cl.validateTuple=void 0;const HS=ae,qc=ge,QF=de,XF={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:n}=t;if(Array.isArray(e))return XE(t,"additionalItems",e);n.items=!0,!(0,qc.alwaysValidSchema)(n,e)&&t.ok((0,QF.validateArray)(t))}};function XE(t,e,n=t.schema){const{gen:r,parentSchema:i,data:s,keyword:o,it:l}=t;c(i),l.opts.unevaluated&&n.length&&l.items!==!0&&(l.items=qc.mergeEvaluated.items(r,n.length,l.items));const a=r.name("valid"),u=r.const("len",(0,HS._)`${s}.length`);n.forEach((f,h)=>{(0,qc.alwaysValidSchema)(l,f)||(r.if((0,HS._)`${u} > ${h}`,()=>t.subschema({keyword:o,schemaProp:h,dataProp:h},a)),t.ok(a))});function c(f){const{opts:h,errSchemaPath:d}=l,p=n.length,y=p===f.minItems&&(p===f.maxItems||f[e]===!1);if(h.strictTuples&&!y){const w=`"${o}" is ${p}-tuple, but minItems or maxItems/${e} are not specified or different at path "${d}"`;(0,qc.checkStrictMode)(l,w,h.strictTuples)}}}cl.validateTuple=XE;cl.default=XF;Object.defineProperty(fy,"__esModule",{value:!0});const e6=cl,t6={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e6.validateTuple)(t,"items")};fy.default=t6;var hy={};Object.defineProperty(hy,"__esModule",{value:!0});const US=ae,n6=ge,r6=de,i6=ul,s6={message:({params:{len:t}})=>(0,US.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,US._)`{limit: ${t}}`},o6={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:s6,code(t){const{schema:e,parentSchema:n,it:r}=t,{prefixItems:i}=n;r.items=!0,!(0,n6.alwaysValidSchema)(r,e)&&(i?(0,i6.validateAdditionalItems)(t,i):t.ok((0,r6.validateArray)(t)))}};hy.default=o6;var dy={};Object.defineProperty(dy,"__esModule",{value:!0});const Tn=ae,pc=ge,l6={message:({params:{min:t,max:e}})=>e===void 0?(0,Tn.str)`must contain at least ${t} valid item(s)`:(0,Tn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Tn._)`{minContains: ${t}}`:(0,Tn._)`{minContains: ${t}, maxContains: ${e}}`},a6={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:l6,code(t){const{gen:e,schema:n,parentSchema:r,data:i,it:s}=t;let o,l;const{minContains:a,maxContains:u}=r;s.opts.next?(o=a===void 0?1:a,l=u):o=1;const c=e.const("len",(0,Tn._)`${i}.length`);if(t.setParams({min:o,max:l}),l===void 0&&o===0){(0,pc.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&o>l){(0,pc.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,pc.alwaysValidSchema)(s,n)){let y=(0,Tn._)`${c} >= ${o}`;l!==void 0&&(y=(0,Tn._)`${y} && ${c} <= ${l}`),t.pass(y);return}s.items=!0;const f=e.name("valid");l===void 0&&o===1?d(f,()=>e.if(f,()=>e.break())):o===0?(e.let(f,!0),l!==void 0&&e.if((0,Tn._)`${i}.length > 0`,h)):(e.let(f,!1),h()),t.result(f,()=>t.reset());function h(){const y=e.name("_valid"),w=e.let("count",0);d(y,()=>e.if(y,()=>p(w)))}function d(y,w){e.forRange("i",0,c,m=>{t.subschema({keyword:"contains",dataProp:m,dataPropType:pc.Type.Num,compositeRule:!0},y),w()})}function p(y){e.code((0,Tn._)`${y}++`),l===void 0?e.if((0,Tn._)`${y} >= ${o}`,()=>e.assign(f,!0).break()):(e.if((0,Tn._)`${y} > ${l}`,()=>e.assign(f,!1).break()),o===1?e.assign(f,!0):e.if((0,Tn._)`${y} >= ${o}`,()=>e.assign(f,!0)))}}};dy.default=a6;var Vh={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=ae,n=ge,r=de;t.error={message:({params:{property:a,depsCount:u,deps:c}})=>{const f=u===1?"property":"properties";return(0,e.str)`must have ${f} ${c} when property ${a} is present`},params:({params:{property:a,depsCount:u,deps:c,missingProperty:f}})=>(0,e._)`{property: ${a}, missingProperty: ${f}, depsCount: ${u}, - deps: ${c}}`};const i={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(a){const[u,c]=s(a);o(a,u),l(a,c)}};function s({schema:a}){const u={},c={};for(const f in a){if(f==="__proto__")continue;const h=Array.isArray(a[f])?u:c;h[f]=a[f]}return[u,c]}function o(a,u=a.schema){const{gen:c,data:f,it:h}=a;if(Object.keys(u).length===0)return;const d=c.let("missing");for(const p in u){const y=u[p];if(y.length===0)continue;const w=(0,r.propertyInData)(c,f,p,h.opts.ownProperties);a.setParams({property:p,depsCount:y.length,deps:y.join(", ")}),h.allErrors?c.if(w,()=>{for(const m of y)(0,r.checkReportMissingProp)(a,m)}):(c.if((0,e._)`${w} && (${(0,r.checkMissingProp)(a,y,d)})`),(0,r.reportMissingProp)(a,d),c.else())}}t.validatePropertyDeps=o;function l(a,u=a.schema){const{gen:c,data:f,keyword:h,it:d}=a,p=c.name("valid");for(const y in u)(0,n.alwaysValidSchema)(d,u[y])||(c.if((0,r.propertyInData)(c,f,y,d.opts.ownProperties),()=>{const w=a.subschema({keyword:h,schemaProp:y},p);a.mergeValidEvaluated(w,p)},()=>c.var(p,!0)),a.ok(p))}t.validateSchemaDeps=l,t.default=i})(jh);var my={};Object.defineProperty(my,"__esModule",{value:!0});const JE=ae,sF=ge,oF={message:"property name must be valid",params:({params:t})=>(0,JE._)`{propertyName: ${t.propertyName}}`},lF={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:oF,code(t){const{gen:e,schema:n,data:r,it:i}=t;if((0,sF.alwaysValidSchema)(i,n))return;const s=e.name("valid");e.forIn("key",r,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,JE.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};my.default=lF;var Bh={};Object.defineProperty(Bh,"__esModule",{value:!0});const mc=de,Kn=ae,aF=xn,pc=ge,uF={message:"must NOT have additional properties",params:({params:t})=>(0,Kn._)`{additionalProperty: ${t.additionalProperty}}`},cF={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:uF,code(t){const{gen:e,schema:n,parentSchema:r,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");const{allErrors:l,opts:a}=o;if(o.props=!0,a.removeAdditional!=="all"&&(0,pc.alwaysValidSchema)(o,n))return;const u=(0,mc.allSchemaProperties)(r.properties),c=(0,mc.allSchemaProperties)(r.patternProperties);f(),t.ok((0,Kn._)`${s} === ${aF.default.errors}`);function f(){e.forIn("key",i,w=>{!u.length&&!c.length?p(w):e.if(h(w),()=>p(w))})}function h(w){let m;if(u.length>8){const g=(0,pc.schemaRefOrVal)(o,r.properties,"properties");m=(0,mc.isOwnProperty)(e,g,w)}else u.length?m=(0,Kn.or)(...u.map(g=>(0,Kn._)`${w} === ${g}`)):m=Kn.nil;return c.length&&(m=(0,Kn.or)(m,...c.map(g=>(0,Kn._)`${(0,mc.usePattern)(t,g)}.test(${w})`))),(0,Kn.not)(m)}function d(w){e.code((0,Kn._)`delete ${i}[${w}]`)}function p(w){if(a.removeAdditional==="all"||a.removeAdditional&&n===!1){d(w);return}if(n===!1){t.setParams({additionalProperty:w}),t.error(),l||e.break();return}if(typeof n=="object"&&!(0,pc.alwaysValidSchema)(o,n)){const m=e.name("valid");a.removeAdditional==="failing"?(y(w,m,!1),e.if((0,Kn.not)(m),()=>{t.reset(),d(w)})):(y(w,m),l||e.if((0,Kn.not)(m),()=>e.break()))}}function y(w,m,g){const v={keyword:"additionalProperties",dataProp:w,dataPropType:pc.Type.Str};g===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,m)}}};Bh.default=cF;var py={};Object.defineProperty(py,"__esModule",{value:!0});const fF=zn,WS=de,tm=ge,HS=Bh,hF={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:n,parentSchema:r,data:i,it:s}=t;s.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&HS.default.code(new fF.KeywordCxt(s,HS.default,"additionalProperties"));const o=(0,WS.allSchemaProperties)(n);for(const f of o)s.definedProperties.add(f);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=tm.mergeEvaluated.props(e,(0,tm.toHash)(o),s.props));const l=o.filter(f=>!(0,tm.alwaysValidSchema)(s,n[f]));if(l.length===0)return;const a=e.name("valid");for(const f of l)u(f)?c(f):(e.if((0,WS.propertyInData)(e,i,f,s.opts.ownProperties)),c(f),s.allErrors||e.else().var(a,!0),e.endIf()),t.it.definedProperties.add(f),t.ok(a);function u(f){return s.opts.useDefaults&&!s.compositeRule&&n[f].default!==void 0}function c(f){t.subschema({keyword:"properties",schemaProp:f,dataProp:f},a)}}};py.default=hF;var gy={};Object.defineProperty(gy,"__esModule",{value:!0});const US=de,gc=ae,qS=ge,KS=ge,dF={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:n,data:r,parentSchema:i,it:s}=t,{opts:o}=s,l=(0,US.allSchemaProperties)(n),a=l.filter(y=>(0,qS.alwaysValidSchema)(s,n[y]));if(l.length===0||a.length===l.length&&(!s.opts.unevaluated||s.props===!0))return;const u=o.strictSchema&&!o.allowMatchingProperties&&i.properties,c=e.name("valid");s.props!==!0&&!(s.props instanceof gc.Name)&&(s.props=(0,KS.evaluatedPropsToName)(e,s.props));const{props:f}=s;h();function h(){for(const y of l)u&&d(y),s.allErrors?p(y):(e.var(c,!0),p(y),e.if(c))}function d(y){for(const w in u)new RegExp(y).test(w)&&(0,qS.checkStrictMode)(s,`property ${w} matches pattern ${y} (use allowMatchingProperties)`)}function p(y){e.forIn("key",r,w=>{e.if((0,gc._)`${(0,US.usePattern)(t,y)}.test(${w})`,()=>{const m=a.includes(y);m||t.subschema({keyword:"patternProperties",schemaProp:y,dataProp:w,dataPropType:KS.Type.Str},c),s.opts.unevaluated&&f!==!0?e.assign((0,gc._)`${f}[${w}]`,!0):!m&&!s.allErrors&&e.if((0,gc.not)(c),()=>e.break())})})}}};gy.default=dF;var yy={};Object.defineProperty(yy,"__esModule",{value:!0});const mF=ge,pF={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:n,it:r}=t;if((0,mF.alwaysValidSchema)(r,n)){t.fail();return}const i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};yy.default=pF;var vy={};Object.defineProperty(vy,"__esModule",{value:!0});const gF=de,yF={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:gF.validateUnion,error:{message:"must match a schema in anyOf"}};vy.default=yF;var wy={};Object.defineProperty(wy,"__esModule",{value:!0});const Uc=ae,vF=ge,wF={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Uc._)`{passingSchemas: ${t.passing}}`},SF={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:wF,code(t){const{gen:e,schema:n,parentSchema:r,it:i}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(i.opts.discriminator&&r.discriminator)return;const s=n,o=e.let("valid",!1),l=e.let("passing",null),a=e.name("_valid");t.setParams({passing:l}),e.block(u),t.result(o,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((c,f)=>{let h;(0,vF.alwaysValidSchema)(i,c)?e.var(a,!0):h=t.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},a),f>0&&e.if((0,Uc._)`${a} && ${o}`).assign(o,!1).assign(l,(0,Uc._)`[${l}, ${f}]`).else(),e.if(a,()=>{e.assign(o,!0),e.assign(l,f),h&&t.mergeEvaluated(h,Uc.Name)})})}}};wy.default=SF;var Sy={};Object.defineProperty(Sy,"__esModule",{value:!0});const kF=ge,bF={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:n,it:r}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");const i=e.name("valid");n.forEach((s,o)=>{if((0,kF.alwaysValidSchema)(r,s))return;const l=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(l)})}};Sy.default=bF;var ky={};Object.defineProperty(ky,"__esModule",{value:!0});const Jf=ae,QE=ge,xF={message:({params:t})=>(0,Jf.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Jf._)`{failingKeyword: ${t.ifClause}}`},CF={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:xF,code(t){const{gen:e,parentSchema:n,it:r}=t;n.then===void 0&&n.else===void 0&&(0,QE.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const i=GS(r,"then"),s=GS(r,"else");if(!i&&!s)return;const o=e.let("valid",!0),l=e.name("_valid");if(a(),t.reset(),i&&s){const c=e.let("ifClause");t.setParams({ifClause:c}),e.if(l,u("then",c),u("else",c))}else i?e.if(l,u("then")):e.if((0,Jf.not)(l),u("else"));t.pass(o,()=>t.error(!0));function a(){const c=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);t.mergeEvaluated(c)}function u(c,f){return()=>{const h=t.subschema({keyword:c},l);e.assign(o,l),t.mergeValidEvaluated(h,o),f?e.assign(f,(0,Jf._)`${c}`):t.setParams({ifClause:c})}}}};function GS(t,e){const n=t.schema[e];return n!==void 0&&!(0,QE.alwaysValidSchema)(t,n)}ky.default=CF;var by={};Object.defineProperty(by,"__esModule",{value:!0});const $F=ge,EF={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:n}){e.if===void 0&&(0,$F.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};by.default=EF;Object.defineProperty(zh,"__esModule",{value:!0});const TF=al,OF=fy,_F=ul,AF=hy,MF=dy,PF=jh,NF=my,DF=Bh,RF=py,IF=gy,LF=yy,FF=vy,zF=wy,jF=Sy,BF=ky,VF=by;function WF(t=!1){const e=[LF.default,FF.default,zF.default,jF.default,BF.default,VF.default,NF.default,DF.default,PF.default,RF.default,IF.default];return t?e.push(OF.default,AF.default):e.push(TF.default,_F.default),e.push(MF.default),e}zh.default=WF;var Vh={},xy={};Object.defineProperty(xy,"__esModule",{value:!0});const nt=ae,HF={message:({schemaCode:t})=>(0,nt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,nt._)`{format: ${t}}`},UF={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:HF,code(t,e){const{gen:n,data:r,$data:i,schema:s,schemaCode:o,it:l}=t,{opts:a,errSchemaPath:u,schemaEnv:c,self:f}=l;if(!a.validateFormats)return;i?h():d();function h(){const p=n.scopeValue("formats",{ref:f.formats,code:a.code.formats}),y=n.const("fDef",(0,nt._)`${p}[${o}]`),w=n.let("fType"),m=n.let("format");n.if((0,nt._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>n.assign(w,(0,nt._)`${y}.type || "string"`).assign(m,(0,nt._)`${y}.validate`),()=>n.assign(w,(0,nt._)`"string"`).assign(m,y)),t.fail$data((0,nt.or)(g(),v()));function g(){return a.strictSchema===!1?nt.nil:(0,nt._)`${o} && !${m}`}function v(){const S=c.$async?(0,nt._)`(${y}.async ? await ${m}(${r}) : ${m}(${r}))`:(0,nt._)`${m}(${r})`,$=(0,nt._)`(typeof ${m} == "function" ? ${S} : ${m}.test(${r}))`;return(0,nt._)`${m} && ${m} !== true && ${w} === ${e} && !${$}`}}function d(){const p=f.formats[s];if(!p){g();return}if(p===!0)return;const[y,w,m]=v(p);y===e&&t.pass(S());function g(){if(a.strictSchema===!1){f.logger.warn($());return}throw new Error($());function $(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function v($){const b=$ instanceof RegExp?(0,nt.regexpCode)($):a.code.formats?(0,nt._)`${a.code.formats}${(0,nt.getProperty)(s)}`:void 0,x=n.scopeValue("formats",{key:s,ref:$,code:b});return typeof $=="object"&&!($ instanceof RegExp)?[$.type||"string",$.validate,(0,nt._)`${x}.validate`]:["string",$,x]}function S(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!c.$async)throw new Error("async format in sync schema");return(0,nt._)`await ${m}(${r})`}return typeof w=="function"?(0,nt._)`${m}(${r})`:(0,nt._)`${m}.test(${r})`}}}};xy.default=UF;Object.defineProperty(Vh,"__esModule",{value:!0});const qF=xy,KF=[qF.default];Vh.default=KF;var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});Ps.contentVocabulary=Ps.metadataVocabulary=void 0;Ps.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ps.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Q0,"__esModule",{value:!0});const GF=Lh,YF=Fh,ZF=zh,JF=Vh,YS=Ps,QF=[GF.default,YF.default,(0,ZF.default)(),JF.default,YS.metadataVocabulary,YS.contentVocabulary];Q0.default=QF;var Wh={},XE={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(t.DiscrError||(t.DiscrError={}))})(XE);Object.defineProperty(Wh,"__esModule",{value:!0});const Js=ae,lg=XE,ZS=Wt,XF=ge,e8={message:({params:{discrError:t,tagName:e}})=>t===lg.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:n}})=>(0,Js._)`{error: ${t}, tag: ${n}, tagValue: ${e}}`},t8={keyword:"discriminator",type:"object",schemaType:"object",error:e8,code(t){const{gen:e,data:n,schema:r,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");const l=r.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");const a=e.let("valid",!1),u=e.const("tag",(0,Js._)`${n}${(0,Js.getProperty)(l)}`);e.if((0,Js._)`typeof ${u} == "string"`,()=>c(),()=>t.error(!1,{discrError:lg.DiscrError.Tag,tag:u,tagName:l})),t.ok(a);function c(){const d=h();e.if(!1);for(const p in d)e.elseIf((0,Js._)`${u} === ${p}`),e.assign(a,f(d[p]));e.else(),t.error(!1,{discrError:lg.DiscrError.Mapping,tag:u,tagName:l}),e.endIf()}function f(d){const p=e.name("valid"),y=t.subschema({keyword:"oneOf",schemaProp:d},p);return t.mergeEvaluated(y,Js.Name),p}function h(){var d;const p={},y=m(i);let w=!0;for(let S=0;Sthis.addVocabulary(p)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const p=this.opts.$data?this.$dataMetaSchema(s,o):s;this.addMetaSchema(p,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var u=zn;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var c=ae;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var f=ol;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var h=ll;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})})(tg,tg.exports);var u8=tg.exports;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=u8,n=ae,r=n.operators,i={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},s={message:({keyword:l,schemaCode:a})=>n.str`should be ${i[l].okStr} ${a}`,params:({keyword:l,schemaCode:a})=>n._`{comparison: ${i[l].okStr}, limit: ${a}}`};t.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:s,code(l){const{gen:a,data:u,schemaCode:c,keyword:f,it:h}=l,{opts:d,self:p}=h;if(!d.validateFormats)return;const y=new e.KeywordCxt(h,p.RULES.all.format.definition,"format");y.$data?w():m();function w(){const v=a.scopeValue("formats",{ref:p.formats,code:d.code.formats}),S=a.const("fmt",n._`${v}[${y.schemaCode}]`);l.fail$data(n.or(n._`typeof ${S} != "object"`,n._`${S} instanceof RegExp`,n._`typeof ${S}.compare != "function"`,g(S)))}function m(){const v=y.schema,S=p.formats[v];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${f}": format "${v}" does not define "compare" function`);const $=a.scopeValue("formats",{key:v,ref:S,code:d.code.formats?n._`${d.code.formats}${n.getProperty(v)}`:void 0});l.fail$data(g($))}function g(v){return n._`${v}.compare(${u}, ${c}) ${i[f].fail} 0`}},dependencies:["format"]};const o=l=>(l.addKeyword(t.formatLimitDefinition),l);t.default=o})(SE);(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const n=wE,r=SE,i=ae,s=new i.Name("fullFormats"),o=new i.Name("fastFormats"),l=(u,c={keywords:!0})=>{if(Array.isArray(c))return a(u,c,n.fullFormats,s),u;const[f,h]=c.mode==="fast"?[n.fastFormats,o]:[n.fullFormats,s],d=c.formats||n.formatNames;return a(u,d,f,h),c.keywords&&r.default(u),u};l.get=(u,c="full")=>{const h=(c==="fast"?n.fastFormats:n.fullFormats)[u];if(!h)throw new Error(`Unknown format "${u}"`);return h};function a(u,c,f,h){var d,p;(d=(p=u.opts.code).formats)!==null&&d!==void 0||(p.formats=i._`require("ajv-formats/dist/formats").${h}`);for(const y of c)u.addFormat(y,f[y])}t.exports=e=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l})(eg,eg.exports);var c8=eg.exports;const f8=ug(c8);var ag={exports:{}},Cy={},$y={},cl={};Object.defineProperty(cl,"__esModule",{value:!0});cl.dynamicAnchor=void 0;const nm=ae,h8=xn,JS=Wt,d8=Qr,m8={keyword:"$dynamicAnchor",schemaType:"string",code:t=>eT(t,t.schema)};function eT(t,e){const{gen:n,it:r}=t;r.schemaEnv.root.dynamicAnchors[e]=!0;const i=(0,nm._)`${h8.default.dynamicAnchors}${(0,nm.getProperty)(e)}`,s=r.errSchemaPath==="#"?r.validateName:p8(t);n.if((0,nm._)`!${i}`,()=>n.assign(i,s))}cl.dynamicAnchor=eT;function p8(t){const{schemaEnv:e,schema:n,self:r}=t.it,{root:i,baseId:s,localRefs:o,meta:l}=e.root,{schemaId:a}=r.opts,u=new JS.SchemaEnv({schema:n,schemaId:a,root:i,baseId:s,localRefs:o,meta:l});return JS.compileSchema.call(r,u),(0,d8.getValidate)(t,u)}cl.default=m8;var fl={};Object.defineProperty(fl,"__esModule",{value:!0});fl.dynamicRef=void 0;const QS=ae,g8=xn,XS=Qr,y8={keyword:"$dynamicRef",schemaType:"string",code:t=>tT(t,t.schema)};function tT(t,e){const{gen:n,keyword:r,it:i}=t;if(e[0]!=="#")throw new Error(`"${r}" only supports hash fragment reference`);const s=e.slice(1);if(i.allErrors)o();else{const a=n.let("valid",!1);o(a),t.ok(a)}function o(a){if(i.schemaEnv.root.dynamicAnchors[s]){const u=n.let("_v",(0,QS._)`${g8.default.dynamicAnchors}${(0,QS.getProperty)(s)}`);n.if(u,l(u,a),l(i.validateName,a))}else l(i.validateName,a)()}function l(a,u){return u?()=>n.block(()=>{(0,XS.callRef)(t,a),n.let(u,!0)}):()=>(0,XS.callRef)(t,a)}}fl.dynamicRef=tT;fl.default=y8;var Ey={};Object.defineProperty(Ey,"__esModule",{value:!0});const v8=cl,w8=ge,S8={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,v8.dynamicAnchor)(t,""):(0,w8.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};Ey.default=S8;var Ty={};Object.defineProperty(Ty,"__esModule",{value:!0});const k8=fl,b8={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,k8.dynamicRef)(t,t.schema)};Ty.default=b8;Object.defineProperty($y,"__esModule",{value:!0});const x8=cl,C8=fl,$8=Ey,E8=Ty,T8=[x8.default,C8.default,$8.default,E8.default];$y.default=T8;var Oy={},_y={};Object.defineProperty(_y,"__esModule",{value:!0});const ek=jh,O8={keyword:"dependentRequired",type:"object",schemaType:"object",error:ek.error,code:t=>(0,ek.validatePropertyDeps)(t)};_y.default=O8;var Ay={};Object.defineProperty(Ay,"__esModule",{value:!0});const _8=jh,A8={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,_8.validateSchemaDeps)(t)};Ay.default=A8;var My={};Object.defineProperty(My,"__esModule",{value:!0});const M8=ge,P8={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:n}){e.contains===void 0&&(0,M8.checkStrictMode)(n,`"${t}" without "contains" is ignored`)}};My.default=P8;Object.defineProperty(Oy,"__esModule",{value:!0});const N8=_y,D8=Ay,R8=My,I8=[N8.default,D8.default,R8.default];Oy.default=I8;var Py={},Ny={};Object.defineProperty(Ny,"__esModule",{value:!0});const li=ae,tk=ge,L8=xn,F8={message:"must NOT have unevaluated properties",params:({params:t})=>(0,li._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},z8={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:F8,code(t){const{gen:e,schema:n,data:r,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");const{allErrors:o,props:l}=s;l instanceof li.Name?e.if((0,li._)`${l} !== true`,()=>e.forIn("key",r,f=>e.if(u(l,f),()=>a(f)))):l!==!0&&e.forIn("key",r,f=>l===void 0?a(f):e.if(c(l,f),()=>a(f))),s.props=!0,t.ok((0,li._)`${i} === ${L8.default.errors}`);function a(f){if(n===!1){t.setParams({unevaluatedProperty:f}),t.error(),o||e.break();return}if(!(0,tk.alwaysValidSchema)(s,n)){const h=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:f,dataPropType:tk.Type.Str},h),o||e.if((0,li.not)(h),()=>e.break())}}function u(f,h){return(0,li._)`!${f} || !${f}[${h}]`}function c(f,h){const d=[];for(const p in f)f[p]===!0&&d.push((0,li._)`${h} !== ${p}`);return(0,li.and)(...d)}}};Ny.default=z8;var Dy={};Object.defineProperty(Dy,"__esModule",{value:!0});const us=ae,nk=ge,j8={message:({params:{len:t}})=>(0,us.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,us._)`{limit: ${t}}`},B8={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:j8,code(t){const{gen:e,schema:n,data:r,it:i}=t,s=i.items||0;if(s===!0)return;const o=e.const("len",(0,us._)`${r}.length`);if(n===!1)t.setParams({len:s}),t.fail((0,us._)`${o} > ${s}`);else if(typeof n=="object"&&!(0,nk.alwaysValidSchema)(i,n)){const a=e.var("valid",(0,us._)`${o} <= ${s}`);e.if((0,us.not)(a),()=>l(a,s)),t.ok(a)}i.items=!0;function l(a,u){e.forRange("i",u,o,c=>{t.subschema({keyword:"unevaluatedItems",dataProp:c,dataPropType:nk.Type.Num},a),i.allErrors||e.if((0,us.not)(a),()=>e.break())})}}};Dy.default=B8;Object.defineProperty(Py,"__esModule",{value:!0});const V8=Ny,W8=Dy,H8=[V8.default,W8.default];Py.default=H8;Object.defineProperty(Cy,"__esModule",{value:!0});const U8=Lh,q8=Fh,K8=zh,G8=$y,Y8=Oy,Z8=Py,J8=Vh,rk=Ps,Q8=[G8.default,U8.default,q8.default,(0,K8.default)(!0),J8.default,rk.metadataVocabulary,rk.contentVocabulary,Y8.default,Z8.default];Cy.default=Q8;var Ry={};const X8="https://json-schema.org/draft/2020-12/schema",ez="https://json-schema.org/draft/2020-12/schema",tz={"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},nz="meta",rz="Core and Validation specifications meta-schema",iz=[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],sz=["object","boolean"],oz="This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",lz={definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}},az={$schema:X8,$id:ez,$vocabulary:tz,$dynamicAnchor:nz,title:rz,allOf:iz,type:sz,$comment:oz,properties:lz},uz="https://json-schema.org/draft/2020-12/schema",cz="https://json-schema.org/draft/2020-12/meta/applicator",fz={"https://json-schema.org/draft/2020-12/vocab/applicator":!0},hz="meta",dz="Applicator vocabulary meta-schema",mz=["object","boolean"],pz={prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},gz={schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}},yz={$schema:uz,$id:cz,$vocabulary:fz,$dynamicAnchor:hz,title:dz,type:mz,properties:pz,$defs:gz},vz="https://json-schema.org/draft/2020-12/schema",wz="https://json-schema.org/draft/2020-12/meta/unevaluated",Sz={"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},kz="meta",bz="Unevaluated applicator vocabulary meta-schema",xz=["object","boolean"],Cz={unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}},$z={$schema:vz,$id:wz,$vocabulary:Sz,$dynamicAnchor:kz,title:bz,type:xz,properties:Cz},Ez="https://json-schema.org/draft/2020-12/schema",Tz="https://json-schema.org/draft/2020-12/meta/content",Oz={"https://json-schema.org/draft/2020-12/vocab/content":!0},_z="meta",Az="Content vocabulary meta-schema",Mz=["object","boolean"],Pz={contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}},Nz={$schema:Ez,$id:Tz,$vocabulary:Oz,$dynamicAnchor:_z,title:Az,type:Mz,properties:Pz},Dz="https://json-schema.org/draft/2020-12/schema",Rz="https://json-schema.org/draft/2020-12/meta/core",Iz={"https://json-schema.org/draft/2020-12/vocab/core":!0},Lz="meta",Fz="Core vocabulary meta-schema",zz=["object","boolean"],jz={$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},Bz={anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}},Vz={$schema:Dz,$id:Rz,$vocabulary:Iz,$dynamicAnchor:Lz,title:Fz,type:zz,properties:jz,$defs:Bz},Wz="https://json-schema.org/draft/2020-12/schema",Hz="https://json-schema.org/draft/2020-12/meta/format-annotation",Uz={"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},qz="meta",Kz="Format vocabulary meta-schema for annotation results",Gz=["object","boolean"],Yz={format:{type:"string"}},Zz={$schema:Wz,$id:Hz,$vocabulary:Uz,$dynamicAnchor:qz,title:Kz,type:Gz,properties:Yz},Jz="https://json-schema.org/draft/2020-12/schema",Qz="https://json-schema.org/draft/2020-12/meta/meta-data",Xz={"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},e9="meta",t9="Meta-data vocabulary meta-schema",n9=["object","boolean"],r9={title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}},i9={$schema:Jz,$id:Qz,$vocabulary:Xz,$dynamicAnchor:e9,title:t9,type:n9,properties:r9},s9="https://json-schema.org/draft/2020-12/schema",o9="https://json-schema.org/draft/2020-12/meta/validation",l9={"https://json-schema.org/draft/2020-12/vocab/validation":!0},a9="meta",u9="Validation vocabulary meta-schema",c9=["object","boolean"],f9={type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},h9={nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},d9={$schema:s9,$id:o9,$vocabulary:l9,$dynamicAnchor:a9,title:u9,type:c9,properties:f9,$defs:h9};Object.defineProperty(Ry,"__esModule",{value:!0});const m9=az,p9=yz,g9=$z,y9=Nz,v9=Vz,w9=Zz,S9=i9,k9=d9,b9=["/properties"];function x9(t){return[m9,p9,g9,y9,v9,e(this,w9),S9,e(this,k9)].forEach(n=>this.addMetaSchema(n,void 0,!1)),this;function e(n,r){return t?n.$dataMetaSchema(r,b9):r}}Ry.default=x9;(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;const n=H0,r=Cy,i=Wh,s=Ry,o="https://json-schema.org/draft/2020-12/schema";class l extends n.default{constructor(d={}){super({...d,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach(d=>this.addVocabulary(d)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:d,meta:p}=this.opts;p&&(s.default.call(this,d),this.refs["http://json-schema.org/schema"]=o)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}t.exports=e=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var a=zn;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var u=ae;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var c=ol;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return c.default}});var f=ll;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(ag,ag.exports);var C9=ag.exports;const $9=ug(C9),E9=(t,e)=>t.reduce((n,r)=>{var i;return(n[i=e(r)]||(n[i]=[])).push(r),n},{}),T9={$ref:"https://beta.schemas.opengis.net/json-fg/feature.json"},O9={$ref:"https://beta.schemas.opengis.net/json-fg/featurecollection.json"},nT=new $9({loadSchema:async t=>(await fetch(t.replace("https://beta.schemas.opengis.net/json-fg/","schemas/"))).json()});f8(nT);const _9=c$(t=>{const e=t.state.doc.toString(),n=JSON.parse(e);let r;if(n.type==="Feature")r=T9;else if(n.type==="FeatureCollection")r=O9;else return[];return nT.compileAsync(r).then(i=>{if(!i(n)){const o=y$(t.state),l=E9(i.errors,a=>a.instancePath);return Object.entries(l).map(([a,u])=>{const c=o.get(a);return{from:c.valueFrom,to:c.valueTo,severity:"error",message:u.map(f=>f.instancePath+": "+f.message).join(` -`)}})}return[]})}),A9=[eD(),_9,v3],M9=({code:t})=>mt.jsx(m$,{value:t,extensions:A9}),P9=()=>mt.jsx("div",{}),N9="Feature",D9="DENW19AL0000giv5BL",R9=["[ogc-json-fg-1-0.2:core]","[ogc-json-fg-1-0.2:types-schemas]","[ogc-json-fg-1-0.2:3d]"],I9="app:building",L9="https://example.org/data/v1/collections/buildings/schema",F9={interval:["2014-04-24T10:50:18Z",".."]},z9="http://www.opengis.net/def/crs/EPSG/0/5555",j9={type:"Polyhedron",coordinates:[[[[[479816.67,5705861672e-3,100],[479822.187,5705866783e-3,100],[479829.666,5705858785e-3,100],[479824.155,5705853684e-3,100],[479816.67,5705861672e-3,100]]],[[[479816.67,5705861672e-3,110],[479824.155,5705853684e-3,110],[479829.666,5705858785e-3,120],[479822.187,5705866783e-3,120],[479816.67,5705861672e-3,110]]],[[[479816.67,5705861672e-3,110],[479816.67,5705861672e-3,100],[479824.155,5705853684e-3,100],[479824.155,5705853684e-3,110],[479816.67,5705861672e-3,110]]],[[[479824.155,5705853684e-3,110],[479824.155,5705853684e-3,100],[479829.666,5705858785e-3,100],[479829.666,5705858785e-3,120],[479824.155,5705853684e-3,110]]],[[[479829.666,5705858785e-3,120],[479829.666,5705858785e-3,100],[479822.187,5705866783e-3,100],[479822.187,5705866783e-3,120],[479829.666,5705858785e-3,120]]],[[[479822.187,5705866783e-3,120],[479822.187,5705866783e-3,100],[479816.67,5705861672e-3,100],[479816.67,5705861672e-3,110],[479822.187,5705866783e-3,120]]]]]},B9={type:"Polygon",coordinates:[[[8.7092045,51.5035285,100],[8.7093128,51.503457,100],[8.7093919,51.503503,100],[8.7092837,51.5035747,100],[8.7092045,51.5035285,100]]]},V9={lastChange:"2014-04-24T10:50:18Z",built:"2012-03",function:"Agricultural building",height_m:20,owners:[{href:"https://example.org/john-doe",title:"John Doe"},{href:"https://example.org/jane-doe",title:"Jane Doe"}]},W9={type:N9,id:D9,conformsTo:R9,featureType:I9,featureSchema:L9,time:F9,coordRefSys:z9,place:j9,geometry:B9,properties:V9},H9=()=>{const t=JSON.stringify(W9,void 0,2);return mt.jsxs("div",{className:"h-screen",children:[mt.jsxs("header",{className:"flex p-2 bg-slate-700 text-white",children:[mt.jsx("div",{children:mt.jsx("h1",{className:"font-semibold",children:"JSON-FG Linter"})}),mt.jsx("div",{className:"ml-auto",children:mt.jsx("a",{href:"https://github.com/Geonovum-labs/json-fg-linter",target:"_blank",children:mt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96",className:"h-[24px]",children:mt.jsx("path",{fill:"#fff",d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z"})})})})]}),mt.jsxs("div",{className:"flex h-full",children:[mt.jsx("div",{className:"w-[50%] h-full overflow-auto",children:mt.jsx(M9,{code:t})}),mt.jsx("div",{className:"flex-1 h-full bg-sky-100",children:mt.jsx(P9,{})})]})]})};rm.createRoot(document.getElementById("root")).render(mt.jsx(AT.StrictMode,{children:mt.jsx(H9,{})})); + deps: ${c}}`};const i={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(a){const[u,c]=s(a);o(a,u),l(a,c)}};function s({schema:a}){const u={},c={};for(const f in a){if(f==="__proto__")continue;const h=Array.isArray(a[f])?u:c;h[f]=a[f]}return[u,c]}function o(a,u=a.schema){const{gen:c,data:f,it:h}=a;if(Object.keys(u).length===0)return;const d=c.let("missing");for(const p in u){const y=u[p];if(y.length===0)continue;const w=(0,r.propertyInData)(c,f,p,h.opts.ownProperties);a.setParams({property:p,depsCount:y.length,deps:y.join(", ")}),h.allErrors?c.if(w,()=>{for(const m of y)(0,r.checkReportMissingProp)(a,m)}):(c.if((0,e._)`${w} && (${(0,r.checkMissingProp)(a,y,d)})`),(0,r.reportMissingProp)(a,d),c.else())}}t.validatePropertyDeps=o;function l(a,u=a.schema){const{gen:c,data:f,keyword:h,it:d}=a,p=c.name("valid");for(const y in u)(0,n.alwaysValidSchema)(d,u[y])||(c.if((0,r.propertyInData)(c,f,y,d.opts.ownProperties),()=>{const w=a.subschema({keyword:h,schemaProp:y},p);a.mergeValidEvaluated(w,p)},()=>c.var(p,!0)),a.ok(p))}t.validateSchemaDeps=l,t.default=i})(Vh);var my={};Object.defineProperty(my,"__esModule",{value:!0});const eO=ae,u6=ge,c6={message:"property name must be valid",params:({params:t})=>(0,eO._)`{propertyName: ${t.propertyName}}`},f6={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:c6,code(t){const{gen:e,schema:n,data:r,it:i}=t;if((0,u6.alwaysValidSchema)(i,n))return;const s=e.name("valid");e.forIn("key",r,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,eO.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};my.default=f6;var Wh={};Object.defineProperty(Wh,"__esModule",{value:!0});const gc=de,Gn=ae,h6=Cn,yc=ge,d6={message:"must NOT have additional properties",params:({params:t})=>(0,Gn._)`{additionalProperty: ${t.additionalProperty}}`},m6={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:d6,code(t){const{gen:e,schema:n,parentSchema:r,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");const{allErrors:l,opts:a}=o;if(o.props=!0,a.removeAdditional!=="all"&&(0,yc.alwaysValidSchema)(o,n))return;const u=(0,gc.allSchemaProperties)(r.properties),c=(0,gc.allSchemaProperties)(r.patternProperties);f(),t.ok((0,Gn._)`${s} === ${h6.default.errors}`);function f(){e.forIn("key",i,w=>{!u.length&&!c.length?p(w):e.if(h(w),()=>p(w))})}function h(w){let m;if(u.length>8){const g=(0,yc.schemaRefOrVal)(o,r.properties,"properties");m=(0,gc.isOwnProperty)(e,g,w)}else u.length?m=(0,Gn.or)(...u.map(g=>(0,Gn._)`${w} === ${g}`)):m=Gn.nil;return c.length&&(m=(0,Gn.or)(m,...c.map(g=>(0,Gn._)`${(0,gc.usePattern)(t,g)}.test(${w})`))),(0,Gn.not)(m)}function d(w){e.code((0,Gn._)`delete ${i}[${w}]`)}function p(w){if(a.removeAdditional==="all"||a.removeAdditional&&n===!1){d(w);return}if(n===!1){t.setParams({additionalProperty:w}),t.error(),l||e.break();return}if(typeof n=="object"&&!(0,yc.alwaysValidSchema)(o,n)){const m=e.name("valid");a.removeAdditional==="failing"?(y(w,m,!1),e.if((0,Gn.not)(m),()=>{t.reset(),d(w)})):(y(w,m),l||e.if((0,Gn.not)(m),()=>e.break()))}}function y(w,m,g){const v={keyword:"additionalProperties",dataProp:w,dataPropType:yc.Type.Str};g===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,m)}}};Wh.default=m6;var py={};Object.defineProperty(py,"__esModule",{value:!0});const p6=jn,qS=de,rm=ge,KS=Wh,g6={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:n,parentSchema:r,data:i,it:s}=t;s.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&KS.default.code(new p6.KeywordCxt(s,KS.default,"additionalProperties"));const o=(0,qS.allSchemaProperties)(n);for(const f of o)s.definedProperties.add(f);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=rm.mergeEvaluated.props(e,(0,rm.toHash)(o),s.props));const l=o.filter(f=>!(0,rm.alwaysValidSchema)(s,n[f]));if(l.length===0)return;const a=e.name("valid");for(const f of l)u(f)?c(f):(e.if((0,qS.propertyInData)(e,i,f,s.opts.ownProperties)),c(f),s.allErrors||e.else().var(a,!0),e.endIf()),t.it.definedProperties.add(f),t.ok(a);function u(f){return s.opts.useDefaults&&!s.compositeRule&&n[f].default!==void 0}function c(f){t.subschema({keyword:"properties",schemaProp:f,dataProp:f},a)}}};py.default=g6;var gy={};Object.defineProperty(gy,"__esModule",{value:!0});const GS=de,vc=ae,YS=ge,JS=ge,y6={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:n,data:r,parentSchema:i,it:s}=t,{opts:o}=s,l=(0,GS.allSchemaProperties)(n),a=l.filter(y=>(0,YS.alwaysValidSchema)(s,n[y]));if(l.length===0||a.length===l.length&&(!s.opts.unevaluated||s.props===!0))return;const u=o.strictSchema&&!o.allowMatchingProperties&&i.properties,c=e.name("valid");s.props!==!0&&!(s.props instanceof vc.Name)&&(s.props=(0,JS.evaluatedPropsToName)(e,s.props));const{props:f}=s;h();function h(){for(const y of l)u&&d(y),s.allErrors?p(y):(e.var(c,!0),p(y),e.if(c))}function d(y){for(const w in u)new RegExp(y).test(w)&&(0,YS.checkStrictMode)(s,`property ${w} matches pattern ${y} (use allowMatchingProperties)`)}function p(y){e.forIn("key",r,w=>{e.if((0,vc._)`${(0,GS.usePattern)(t,y)}.test(${w})`,()=>{const m=a.includes(y);m||t.subschema({keyword:"patternProperties",schemaProp:y,dataProp:w,dataPropType:JS.Type.Str},c),s.opts.unevaluated&&f!==!0?e.assign((0,vc._)`${f}[${w}]`,!0):!m&&!s.allErrors&&e.if((0,vc.not)(c),()=>e.break())})})}}};gy.default=y6;var yy={};Object.defineProperty(yy,"__esModule",{value:!0});const v6=ge,w6={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:n,it:r}=t;if((0,v6.alwaysValidSchema)(r,n)){t.fail();return}const i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};yy.default=w6;var vy={};Object.defineProperty(vy,"__esModule",{value:!0});const S6=de,k6={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:S6.validateUnion,error:{message:"must match a schema in anyOf"}};vy.default=k6;var wy={};Object.defineProperty(wy,"__esModule",{value:!0});const Kc=ae,b6=ge,x6={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Kc._)`{passingSchemas: ${t.passing}}`},C6={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:x6,code(t){const{gen:e,schema:n,parentSchema:r,it:i}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(i.opts.discriminator&&r.discriminator)return;const s=n,o=e.let("valid",!1),l=e.let("passing",null),a=e.name("_valid");t.setParams({passing:l}),e.block(u),t.result(o,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((c,f)=>{let h;(0,b6.alwaysValidSchema)(i,c)?e.var(a,!0):h=t.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},a),f>0&&e.if((0,Kc._)`${a} && ${o}`).assign(o,!1).assign(l,(0,Kc._)`[${l}, ${f}]`).else(),e.if(a,()=>{e.assign(o,!0),e.assign(l,f),h&&t.mergeEvaluated(h,Kc.Name)})})}}};wy.default=C6;var Sy={};Object.defineProperty(Sy,"__esModule",{value:!0});const $6=ge,E6={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:n,it:r}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");const i=e.name("valid");n.forEach((s,o)=>{if((0,$6.alwaysValidSchema)(r,s))return;const l=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(l)})}};Sy.default=E6;var ky={};Object.defineProperty(ky,"__esModule",{value:!0});const Xf=ae,tO=ge,O6={message:({params:t})=>(0,Xf.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Xf._)`{failingKeyword: ${t.ifClause}}`},T6={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:O6,code(t){const{gen:e,parentSchema:n,it:r}=t;n.then===void 0&&n.else===void 0&&(0,tO.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const i=ZS(r,"then"),s=ZS(r,"else");if(!i&&!s)return;const o=e.let("valid",!0),l=e.name("_valid");if(a(),t.reset(),i&&s){const c=e.let("ifClause");t.setParams({ifClause:c}),e.if(l,u("then",c),u("else",c))}else i?e.if(l,u("then")):e.if((0,Xf.not)(l),u("else"));t.pass(o,()=>t.error(!0));function a(){const c=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);t.mergeEvaluated(c)}function u(c,f){return()=>{const h=t.subschema({keyword:c},l);e.assign(o,l),t.mergeValidEvaluated(h,o),f?e.assign(f,(0,Xf._)`${c}`):t.setParams({ifClause:c})}}}};function ZS(t,e){const n=t.schema[e];return n!==void 0&&!(0,tO.alwaysValidSchema)(t,n)}ky.default=T6;var by={};Object.defineProperty(by,"__esModule",{value:!0});const _6=ge,M6={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:n}){e.if===void 0&&(0,_6.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};by.default=M6;Object.defineProperty(Bh,"__esModule",{value:!0});const A6=ul,P6=fy,N6=cl,D6=hy,R6=dy,I6=Vh,L6=my,F6=Wh,z6=py,j6=gy,B6=yy,V6=vy,W6=wy,H6=Sy,U6=ky,q6=by;function K6(t=!1){const e=[B6.default,V6.default,W6.default,H6.default,U6.default,q6.default,L6.default,F6.default,I6.default,z6.default,j6.default];return t?e.push(P6.default,D6.default):e.push(A6.default,N6.default),e.push(R6.default),e}Bh.default=K6;var Hh={},xy={};Object.defineProperty(xy,"__esModule",{value:!0});const nt=ae,G6={message:({schemaCode:t})=>(0,nt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,nt._)`{format: ${t}}`},Y6={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:G6,code(t,e){const{gen:n,data:r,$data:i,schema:s,schemaCode:o,it:l}=t,{opts:a,errSchemaPath:u,schemaEnv:c,self:f}=l;if(!a.validateFormats)return;i?h():d();function h(){const p=n.scopeValue("formats",{ref:f.formats,code:a.code.formats}),y=n.const("fDef",(0,nt._)`${p}[${o}]`),w=n.let("fType"),m=n.let("format");n.if((0,nt._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>n.assign(w,(0,nt._)`${y}.type || "string"`).assign(m,(0,nt._)`${y}.validate`),()=>n.assign(w,(0,nt._)`"string"`).assign(m,y)),t.fail$data((0,nt.or)(g(),v()));function g(){return a.strictSchema===!1?nt.nil:(0,nt._)`${o} && !${m}`}function v(){const S=c.$async?(0,nt._)`(${y}.async ? await ${m}(${r}) : ${m}(${r}))`:(0,nt._)`${m}(${r})`,$=(0,nt._)`(typeof ${m} == "function" ? ${S} : ${m}.test(${r}))`;return(0,nt._)`${m} && ${m} !== true && ${w} === ${e} && !${$}`}}function d(){const p=f.formats[s];if(!p){g();return}if(p===!0)return;const[y,w,m]=v(p);y===e&&t.pass(S());function g(){if(a.strictSchema===!1){f.logger.warn($());return}throw new Error($());function $(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function v($){const b=$ instanceof RegExp?(0,nt.regexpCode)($):a.code.formats?(0,nt._)`${a.code.formats}${(0,nt.getProperty)(s)}`:void 0,x=n.scopeValue("formats",{key:s,ref:$,code:b});return typeof $=="object"&&!($ instanceof RegExp)?[$.type||"string",$.validate,(0,nt._)`${x}.validate`]:["string",$,x]}function S(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!c.$async)throw new Error("async format in sync schema");return(0,nt._)`await ${m}(${r})`}return typeof w=="function"?(0,nt._)`${m}(${r})`:(0,nt._)`${m}.test(${r})`}}}};xy.default=Y6;Object.defineProperty(Hh,"__esModule",{value:!0});const J6=xy,Z6=[J6.default];Hh.default=Z6;var Ns={};Object.defineProperty(Ns,"__esModule",{value:!0});Ns.contentVocabulary=Ns.metadataVocabulary=void 0;Ns.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ns.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Q0,"__esModule",{value:!0});const Q6=zh,X6=jh,e8=Bh,t8=Hh,QS=Ns,n8=[Q6.default,X6.default,(0,e8.default)(),t8.default,QS.metadataVocabulary,QS.contentVocabulary];Q0.default=n8;var Uh={},nO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(t.DiscrError||(t.DiscrError={}))})(nO);Object.defineProperty(Uh,"__esModule",{value:!0});const Qs=ae,ag=nO,XS=Ht,r8=ge,i8={message:({params:{discrError:t,tagName:e}})=>t===ag.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:n}})=>(0,Qs._)`{error: ${t}, tag: ${n}, tagValue: ${e}}`},s8={keyword:"discriminator",type:"object",schemaType:"object",error:i8,code(t){const{gen:e,data:n,schema:r,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");const l=r.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");const a=e.let("valid",!1),u=e.const("tag",(0,Qs._)`${n}${(0,Qs.getProperty)(l)}`);e.if((0,Qs._)`typeof ${u} == "string"`,()=>c(),()=>t.error(!1,{discrError:ag.DiscrError.Tag,tag:u,tagName:l})),t.ok(a);function c(){const d=h();e.if(!1);for(const p in d)e.elseIf((0,Qs._)`${u} === ${p}`),e.assign(a,f(d[p]));e.else(),t.error(!1,{discrError:ag.DiscrError.Mapping,tag:u,tagName:l}),e.endIf()}function f(d){const p=e.name("valid"),y=t.subschema({keyword:"oneOf",schemaProp:d},p);return t.mergeEvaluated(y,Qs.Name),p}function h(){var d;const p={},y=m(i);let w=!0;for(let S=0;Sthis.addVocabulary(p)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const p=this.opts.$data?this.$dataMetaSchema(s,o):s;this.addMetaSchema(p,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var u=jn;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var c=ae;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var f=ll;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var h=al;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})})(ng,ng.exports);var d8=ng.exports;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=d8,n=ae,r=n.operators,i={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},s={message:({keyword:l,schemaCode:a})=>n.str`should be ${i[l].okStr} ${a}`,params:({keyword:l,schemaCode:a})=>n._`{comparison: ${i[l].okStr}, limit: ${a}}`};t.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:s,code(l){const{gen:a,data:u,schemaCode:c,keyword:f,it:h}=l,{opts:d,self:p}=h;if(!d.validateFormats)return;const y=new e.KeywordCxt(h,p.RULES.all.format.definition,"format");y.$data?w():m();function w(){const v=a.scopeValue("formats",{ref:p.formats,code:d.code.formats}),S=a.const("fmt",n._`${v}[${y.schemaCode}]`);l.fail$data(n.or(n._`typeof ${S} != "object"`,n._`${S} instanceof RegExp`,n._`typeof ${S}.compare != "function"`,g(S)))}function m(){const v=y.schema,S=p.formats[v];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${f}": format "${v}" does not define "compare" function`);const $=a.scopeValue("formats",{key:v,ref:S,code:d.code.formats?n._`${d.code.formats}${n.getProperty(v)}`:void 0});l.fail$data(g($))}function g(v){return n._`${v}.compare(${u}, ${c}) ${i[f].fail} 0`}},dependencies:["format"]};const o=l=>(l.addKeyword(t.formatLimitDefinition),l);t.default=o})(xE);(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const n=bE,r=xE,i=ae,s=new i.Name("fullFormats"),o=new i.Name("fastFormats"),l=(u,c={keywords:!0})=>{if(Array.isArray(c))return a(u,c,n.fullFormats,s),u;const[f,h]=c.mode==="fast"?[n.fastFormats,o]:[n.fullFormats,s],d=c.formats||n.formatNames;return a(u,d,f,h),c.keywords&&r.default(u),u};l.get=(u,c="full")=>{const h=(c==="fast"?n.fastFormats:n.fullFormats)[u];if(!h)throw new Error(`Unknown format "${u}"`);return h};function a(u,c,f,h){var d,p;(d=(p=u.opts.code).formats)!==null&&d!==void 0||(p.formats=i._`require("ajv-formats/dist/formats").${h}`);for(const y of c)u.addFormat(y,f[y])}t.exports=e=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l})(tg,tg.exports);var m8=tg.exports;const p8=cg(m8);var ug={exports:{}},Cy={},$y={},fl={};Object.defineProperty(fl,"__esModule",{value:!0});fl.dynamicAnchor=void 0;const im=ae,g8=Cn,ek=Ht,y8=Xr,v8={keyword:"$dynamicAnchor",schemaType:"string",code:t=>rO(t,t.schema)};function rO(t,e){const{gen:n,it:r}=t;r.schemaEnv.root.dynamicAnchors[e]=!0;const i=(0,im._)`${g8.default.dynamicAnchors}${(0,im.getProperty)(e)}`,s=r.errSchemaPath==="#"?r.validateName:w8(t);n.if((0,im._)`!${i}`,()=>n.assign(i,s))}fl.dynamicAnchor=rO;function w8(t){const{schemaEnv:e,schema:n,self:r}=t.it,{root:i,baseId:s,localRefs:o,meta:l}=e.root,{schemaId:a}=r.opts,u=new ek.SchemaEnv({schema:n,schemaId:a,root:i,baseId:s,localRefs:o,meta:l});return ek.compileSchema.call(r,u),(0,y8.getValidate)(t,u)}fl.default=v8;var hl={};Object.defineProperty(hl,"__esModule",{value:!0});hl.dynamicRef=void 0;const tk=ae,S8=Cn,nk=Xr,k8={keyword:"$dynamicRef",schemaType:"string",code:t=>iO(t,t.schema)};function iO(t,e){const{gen:n,keyword:r,it:i}=t;if(e[0]!=="#")throw new Error(`"${r}" only supports hash fragment reference`);const s=e.slice(1);if(i.allErrors)o();else{const a=n.let("valid",!1);o(a),t.ok(a)}function o(a){if(i.schemaEnv.root.dynamicAnchors[s]){const u=n.let("_v",(0,tk._)`${S8.default.dynamicAnchors}${(0,tk.getProperty)(s)}`);n.if(u,l(u,a),l(i.validateName,a))}else l(i.validateName,a)()}function l(a,u){return u?()=>n.block(()=>{(0,nk.callRef)(t,a),n.let(u,!0)}):()=>(0,nk.callRef)(t,a)}}hl.dynamicRef=iO;hl.default=k8;var Ey={};Object.defineProperty(Ey,"__esModule",{value:!0});const b8=fl,x8=ge,C8={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,b8.dynamicAnchor)(t,""):(0,x8.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};Ey.default=C8;var Oy={};Object.defineProperty(Oy,"__esModule",{value:!0});const $8=hl,E8={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,$8.dynamicRef)(t,t.schema)};Oy.default=E8;Object.defineProperty($y,"__esModule",{value:!0});const O8=fl,T8=hl,_8=Ey,M8=Oy,A8=[O8.default,T8.default,_8.default,M8.default];$y.default=A8;var Ty={},_y={};Object.defineProperty(_y,"__esModule",{value:!0});const rk=Vh,P8={keyword:"dependentRequired",type:"object",schemaType:"object",error:rk.error,code:t=>(0,rk.validatePropertyDeps)(t)};_y.default=P8;var My={};Object.defineProperty(My,"__esModule",{value:!0});const N8=Vh,D8={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,N8.validateSchemaDeps)(t)};My.default=D8;var Ay={};Object.defineProperty(Ay,"__esModule",{value:!0});const R8=ge,I8={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:n}){e.contains===void 0&&(0,R8.checkStrictMode)(n,`"${t}" without "contains" is ignored`)}};Ay.default=I8;Object.defineProperty(Ty,"__esModule",{value:!0});const L8=_y,F8=My,z8=Ay,j8=[L8.default,F8.default,z8.default];Ty.default=j8;var Py={},Ny={};Object.defineProperty(Ny,"__esModule",{value:!0});const ai=ae,ik=ge,B8=Cn,V8={message:"must NOT have unevaluated properties",params:({params:t})=>(0,ai._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},W8={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:V8,code(t){const{gen:e,schema:n,data:r,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");const{allErrors:o,props:l}=s;l instanceof ai.Name?e.if((0,ai._)`${l} !== true`,()=>e.forIn("key",r,f=>e.if(u(l,f),()=>a(f)))):l!==!0&&e.forIn("key",r,f=>l===void 0?a(f):e.if(c(l,f),()=>a(f))),s.props=!0,t.ok((0,ai._)`${i} === ${B8.default.errors}`);function a(f){if(n===!1){t.setParams({unevaluatedProperty:f}),t.error(),o||e.break();return}if(!(0,ik.alwaysValidSchema)(s,n)){const h=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:f,dataPropType:ik.Type.Str},h),o||e.if((0,ai.not)(h),()=>e.break())}}function u(f,h){return(0,ai._)`!${f} || !${f}[${h}]`}function c(f,h){const d=[];for(const p in f)f[p]===!0&&d.push((0,ai._)`${h} !== ${p}`);return(0,ai.and)(...d)}}};Ny.default=W8;var Dy={};Object.defineProperty(Dy,"__esModule",{value:!0});const fs=ae,sk=ge,H8={message:({params:{len:t}})=>(0,fs.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,fs._)`{limit: ${t}}`},U8={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:H8,code(t){const{gen:e,schema:n,data:r,it:i}=t,s=i.items||0;if(s===!0)return;const o=e.const("len",(0,fs._)`${r}.length`);if(n===!1)t.setParams({len:s}),t.fail((0,fs._)`${o} > ${s}`);else if(typeof n=="object"&&!(0,sk.alwaysValidSchema)(i,n)){const a=e.var("valid",(0,fs._)`${o} <= ${s}`);e.if((0,fs.not)(a),()=>l(a,s)),t.ok(a)}i.items=!0;function l(a,u){e.forRange("i",u,o,c=>{t.subschema({keyword:"unevaluatedItems",dataProp:c,dataPropType:sk.Type.Num},a),i.allErrors||e.if((0,fs.not)(a),()=>e.break())})}}};Dy.default=U8;Object.defineProperty(Py,"__esModule",{value:!0});const q8=Ny,K8=Dy,G8=[q8.default,K8.default];Py.default=G8;Object.defineProperty(Cy,"__esModule",{value:!0});const Y8=zh,J8=jh,Z8=Bh,Q8=$y,X8=Ty,ez=Py,tz=Hh,ok=Ns,nz=[Q8.default,Y8.default,J8.default,(0,Z8.default)(!0),tz.default,ok.metadataVocabulary,ok.contentVocabulary,X8.default,ez.default];Cy.default=nz;var Ry={};const rz="https://json-schema.org/draft/2020-12/schema",iz="https://json-schema.org/draft/2020-12/schema",sz={"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},oz="meta",lz="Core and Validation specifications meta-schema",az=[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],uz=["object","boolean"],cz="This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",fz={definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}},hz={$schema:rz,$id:iz,$vocabulary:sz,$dynamicAnchor:oz,title:lz,allOf:az,type:uz,$comment:cz,properties:fz},dz="https://json-schema.org/draft/2020-12/schema",mz="https://json-schema.org/draft/2020-12/meta/applicator",pz={"https://json-schema.org/draft/2020-12/vocab/applicator":!0},gz="meta",yz="Applicator vocabulary meta-schema",vz=["object","boolean"],wz={prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},Sz={schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}},kz={$schema:dz,$id:mz,$vocabulary:pz,$dynamicAnchor:gz,title:yz,type:vz,properties:wz,$defs:Sz},bz="https://json-schema.org/draft/2020-12/schema",xz="https://json-schema.org/draft/2020-12/meta/unevaluated",Cz={"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$z="meta",Ez="Unevaluated applicator vocabulary meta-schema",Oz=["object","boolean"],Tz={unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}},_z={$schema:bz,$id:xz,$vocabulary:Cz,$dynamicAnchor:$z,title:Ez,type:Oz,properties:Tz},Mz="https://json-schema.org/draft/2020-12/schema",Az="https://json-schema.org/draft/2020-12/meta/content",Pz={"https://json-schema.org/draft/2020-12/vocab/content":!0},Nz="meta",Dz="Content vocabulary meta-schema",Rz=["object","boolean"],Iz={contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}},Lz={$schema:Mz,$id:Az,$vocabulary:Pz,$dynamicAnchor:Nz,title:Dz,type:Rz,properties:Iz},Fz="https://json-schema.org/draft/2020-12/schema",zz="https://json-schema.org/draft/2020-12/meta/core",jz={"https://json-schema.org/draft/2020-12/vocab/core":!0},Bz="meta",Vz="Core vocabulary meta-schema",Wz=["object","boolean"],Hz={$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},Uz={anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}},qz={$schema:Fz,$id:zz,$vocabulary:jz,$dynamicAnchor:Bz,title:Vz,type:Wz,properties:Hz,$defs:Uz},Kz="https://json-schema.org/draft/2020-12/schema",Gz="https://json-schema.org/draft/2020-12/meta/format-annotation",Yz={"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},Jz="meta",Zz="Format vocabulary meta-schema for annotation results",Qz=["object","boolean"],Xz={format:{type:"string"}},e9={$schema:Kz,$id:Gz,$vocabulary:Yz,$dynamicAnchor:Jz,title:Zz,type:Qz,properties:Xz},t9="https://json-schema.org/draft/2020-12/schema",n9="https://json-schema.org/draft/2020-12/meta/meta-data",r9={"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},i9="meta",s9="Meta-data vocabulary meta-schema",o9=["object","boolean"],l9={title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}},a9={$schema:t9,$id:n9,$vocabulary:r9,$dynamicAnchor:i9,title:s9,type:o9,properties:l9},u9="https://json-schema.org/draft/2020-12/schema",c9="https://json-schema.org/draft/2020-12/meta/validation",f9={"https://json-schema.org/draft/2020-12/vocab/validation":!0},h9="meta",d9="Validation vocabulary meta-schema",m9=["object","boolean"],p9={type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},g9={nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},y9={$schema:u9,$id:c9,$vocabulary:f9,$dynamicAnchor:h9,title:d9,type:m9,properties:p9,$defs:g9};Object.defineProperty(Ry,"__esModule",{value:!0});const v9=hz,w9=kz,S9=_z,k9=Lz,b9=qz,x9=e9,C9=a9,$9=y9,E9=["/properties"];function O9(t){return[v9,w9,S9,k9,b9,e(this,x9),C9,e(this,$9)].forEach(n=>this.addMetaSchema(n,void 0,!1)),this;function e(n,r){return t?n.$dataMetaSchema(r,E9):r}}Ry.default=O9;(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;const n=H0,r=Cy,i=Uh,s=Ry,o="https://json-schema.org/draft/2020-12/schema";class l extends n.default{constructor(d={}){super({...d,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach(d=>this.addVocabulary(d)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:d,meta:p}=this.opts;p&&(s.default.call(this,d),this.refs["http://json-schema.org/schema"]=o)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}t.exports=e=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var a=jn;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var u=ae;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var c=ll;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return c.default}});var f=al;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(ug,ug.exports);var T9=ug.exports;const _9=cg(T9),M9=(t,e)=>t.reduce((n,r)=>{var i;return(n[i=e(r)]||(n[i]=[])).push(r),n},{}),A9={$ref:"https://beta.schemas.opengis.net/json-fg/feature.json"},P9={$ref:"https://beta.schemas.opengis.net/json-fg/featurecollection.json"},sO=new _9({loadSchema:async t=>(await fetch(t.replace("https://beta.schemas.opengis.net/json-fg/","schemas/"))).json()});p8(sO);const N9=d$(t=>{const e=t.state.doc.toString(),n=JSON.parse(e);let r;if(n.type==="Feature")r=A9;else if(n.type==="FeatureCollection")r=P9;else return[];return sO.compileAsync(r).then(i=>{if(!i(n)){const o=S$(t.state),l=M9(i.errors,a=>a.instancePath);return Object.entries(l).map(([a,u])=>{const c=o.get(a);return{from:c.valueFrom,to:c.valueTo,severity:"error",message:u.map(f=>f.instancePath+": "+f.message).join(` +`)}})}return[]})}),D9=[rD(),N9,b3],R9=({code:t})=>pt.jsx(y$,{value:t,extensions:D9}),I9=()=>pt.jsx("div",{}),L9="Feature",F9="DENW19AL0000giv5BL",z9=["[ogc-json-fg-1-0.2:core]","[ogc-json-fg-1-0.2:types-schemas]","[ogc-json-fg-1-0.2:3d]"],j9="app:building",B9="https://example.org/data/v1/collections/buildings/schema",V9={interval:["2014-04-24T10:50:18Z",".."]},W9="http://www.opengis.net/def/crs/EPSG/0/5555",H9={type:"Polyhedron",coordinates:[[[[[479816.67,5705861672e-3,100],[479822.187,5705866783e-3,100],[479829.666,5705858785e-3,100],[479824.155,5705853684e-3,100],[479816.67,5705861672e-3,100]]],[[[479816.67,5705861672e-3,110],[479824.155,5705853684e-3,110],[479829.666,5705858785e-3,120],[479822.187,5705866783e-3,120],[479816.67,5705861672e-3,110]]],[[[479816.67,5705861672e-3,110],[479816.67,5705861672e-3,100],[479824.155,5705853684e-3,100],[479824.155,5705853684e-3,110],[479816.67,5705861672e-3,110]]],[[[479824.155,5705853684e-3,110],[479824.155,5705853684e-3,100],[479829.666,5705858785e-3,100],[479829.666,5705858785e-3,120],[479824.155,5705853684e-3,110]]],[[[479829.666,5705858785e-3,120],[479829.666,5705858785e-3,100],[479822.187,5705866783e-3,100],[479822.187,5705866783e-3,120],[479829.666,5705858785e-3,120]]],[[[479822.187,5705866783e-3,120],[479822.187,5705866783e-3,100],[479816.67,5705861672e-3,100],[479816.67,5705861672e-3,110],[479822.187,5705866783e-3,120]]]]]},U9={type:"Polygon",coordinates:[[[8.7092045,51.5035285,100],[8.7093128,51.503457,100],[8.7093919,51.503503,100],[8.7092837,51.5035747,100],[8.7092045,51.5035285,100]]]},q9={lastChange:"2014-04-24T10:50:18Z",built:"2012-03",function:"Agricultural building",height_m:20,owners:[{href:"https://example.org/john-doe",title:"John Doe"},{href:"https://example.org/jane-doe",title:"Jane Doe"}]},K9={type:L9,id:F9,conformsTo:z9,featureType:j9,featureSchema:B9,time:V9,coordRefSys:W9,place:H9,geometry:U9,properties:q9},G9=()=>{const t=JSON.stringify(K9,void 0,2);return pt.jsxs("div",{className:"h-screen",children:[pt.jsxs("header",{className:"flex p-2 bg-slate-700 text-white",children:[pt.jsx("div",{children:pt.jsx("h1",{className:"font-semibold",children:"JSON-FG Linter"})}),pt.jsx("div",{className:"ml-auto",children:pt.jsx("a",{href:"https://github.com/Geonovum-labs/json-fg-linter",target:"_blank",children:pt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96",className:"h-[24px]",children:pt.jsx("path",{fill:"#fff",d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z"})})})})]}),pt.jsxs("div",{className:"flex h-full",children:[pt.jsx("div",{className:"w-[50%] h-full overflow-auto",children:pt.jsx(R9,{code:t})}),pt.jsx("div",{className:"flex-1 h-full bg-sky-100",children:pt.jsx(I9,{})})]})]})};sm.createRoot(document.getElementById("root")).render(pt.jsx(NO.StrictMode,{children:pt.jsx(G9,{})})); diff --git a/docs/index.html b/docs/index.html index 3fad588..a3786fc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ JSON-FG Linter - + diff --git a/src/validation/rules/core-geometry.test.ts b/src/validation/rules/core-geometry.test.ts index 3a88909..d3c79bc 100644 --- a/src/validation/rules/core-geometry.test.ts +++ b/src/validation/rules/core-geometry.test.ts @@ -232,3 +232,92 @@ describe('Requirement 10A', () => { expect(violations.length).toBe(1); }); }); + +describe('Requirement 11A', () => { + test('Fails when a GeometryCollection member contains a "coordRefSys" member.', () => { + const violations = applyRules(geometry, { + type: DocumentTypes.FEATURE, + place: { + type: GeometryTypes.GEOMETRYCOLLECTION, + coordRefSys: 'http://www.opengis.net/def/crs/EPSG/0/27700', + geometries: [ + { + type: GeometryTypes.POINT, + coordRefSys: 'http://www.opengis.net/def/crs/EPSG/0/27700', + coordinates: [10, 20], + }, + ], + }, + geometry: null, + } as Feature); + + expect(violations.length).toBe(1); + }); + + test('Fails when a Prism base contains a "coordRefSys" member.', () => { + const violations = applyRules(geometry, { + type: DocumentTypes.FEATURE, + place: { + type: GeometryTypes.PRISM, + coordRefSys: 'http://www.opengis.net/def/crs/EPSG/0/27700', + base: { + type: GeometryTypes.POINT, + coordRefSys: 'http://www.opengis.net/def/crs/EPSG/0/27700', + coordinates: [10, 20], + }, + upper: 10, + }, + geometry: null, + } as Feature); + + expect(violations.length).toBe(1); + }); + + test('Fails when a PrismCollection member contains a "coordRefSys" member.', () => { + const violations = applyRules(geometry, { + type: DocumentTypes.FEATURE, + place: { + type: GeometryTypes.MULTIPRISM, + coordRefSys: 'http://www.opengis.net/def/crs/EPSG/0/27700', + prisms: [ + { + type: GeometryTypes.PRISM, + coordRefSys: 'http://www.opengis.net/def/crs/EPSG/0/27700', + base: { + type: GeometryTypes.POINT, + coordinates: [10, 20], + }, + upper: 10, + }, + ], + }, + geometry: null, + } as Feature); + + expect(violations.length).toBe(1); + }); + + test('Fails when a PrismCollection member base contains a "coordRefSys" member.', () => { + const violations = applyRules(geometry, { + type: DocumentTypes.FEATURE, + place: { + type: GeometryTypes.MULTIPRISM, + coordRefSys: 'http://www.opengis.net/def/crs/EPSG/0/27700', + prisms: [ + { + type: GeometryTypes.PRISM, + base: { + type: GeometryTypes.POINT, + coordRefSys: 'http://www.opengis.net/def/crs/EPSG/0/27700', + coordinates: [10, 20], + }, + upper: 10, + }, + ], + }, + geometry: null, + } as Feature); + + expect(violations.length).toBe(1); + }); +}); diff --git a/src/validation/rules/core-geometry.ts b/src/validation/rules/core-geometry.ts index 2239121..8fa58d9 100644 --- a/src/validation/rules/core-geometry.ts +++ b/src/validation/rules/core-geometry.ts @@ -167,4 +167,28 @@ rules.push({ }, }); +rules.push({ + name: '/req/core/geometry-collection', + validateFeature: feature => { + if (feature.place !== null) { + const place = feature.place; + + if ( + (place.type === GeometryTypes.GEOMETRYCOLLECTION && place.geometries.some(g => g.coordRefSys !== undefined)) || + (place.type === GeometryTypes.PRISM && place.base.coordRefSys !== undefined) || + (place.type === GeometryTypes.MULTIPRISM && + place.prisms.some(g => g.coordRefSys !== undefined || g.base.coordRefSys !== undefined)) + ) { + return { + pointer: '/place', + message: + 'If the "place" member in any JSON-FG feature in the JSON document is not null and the geometry type ' + + '(member "type") is "GeometryCollection" or any other geometry type that has embedded geometry objects, ' + + 'no embedded geometry object SHALL include a "coordRefSys" member.', + }; + } + } + }, +}); + export default rules;